The function total(v) counts the number of set bits (1s) in binary representation of v and adds it to the static variable count, which retains its value across function calls.
Let us trace the loop for i=5,4,3,2,1:
i=5:
Binary of 5=1012 (number of set bits = 2)
count becomes 0+2=2
x=0+2=2
i=4:
Binary of 4=1002 (number of set bits = 1)
count becomes 2+1=3
x=2+3=5
i=3:
Binary of 3=0112 (number of set bits = 2)
count becomes 3+2=5
x=5+5=10
i=2:
Binary of 2=0102 (number of set bits = 1)
count becomes 5+1=6
x=10+6=16
i=1:
Binary of 1=0012 (number of set bits = 1)
count becomes 6+1=7
x=16+7=23
After the loop finishes, printf outputs x=23.