Is that second implementation in Hacker's Delight? Also it'd be interesting to see how z3 handles the examples shown there too (the logarithmic time algorithms using
x' = (x & b10101010) >> 1 + x & b01010101
x'' = (x' & b11001100) >> 2 + x' & b00110011
or whatever it is)