x86 machine code, 18 bytes
080497c8 <f>: 80497c8: be 55 55 55 55 mov esi,0x55555555 80497cd: c4 e2 7a f5 d6 pext edx,eax,esi 80497d2: f7 d6 not esi 80497d4: c4 e2 7a f5 c6 pext eax,eax,esi 80497d9: c3 ret
Input is in eax
, output in edx:eax
.