#include <stdio.h>

int bit_count(int x)
{
	int retVal;

	int fives;
	fives = 0x55;
	fives |= fives << 0x08;
	fives |= fives << 0x10;

	int threes;
	threes = 0x33;
	threes |= threes << 0x08;
	threes |= threes << 0x10;

	int ofs;
	ofs = 0x0f;
	ofs |= ofs << 0x08;
	ofs |= ofs << 0x10;

	int ooffs;
	ooffs = 0xff;
	ooffs |= ooffs << 0x10;

	int ffff;
	ffff = 0xff;
	ffff |= ffff << 0x08;

	retVal = x;
	retVal = ( retVal & fives ) + ( retVal >> 0x01 & fives );
	retVal = ( retVal & threes ) + ( retVal >> 0x02 & threes );
	retVal = ( retVal & ofs ) + ( retVal >> 0x04 & ofs );
	retVal = ( retVal & ooffs ) + ( retVal >> 0x08 & ooffs );
	retVal = ( retVal & ffff ) + ( retVal >> 0x10 & ffff );

	return retVal;
}

int main(void)
{
	printf("%d\n", bit_count(0b11110000111100001111000011110000));

	return 0;
}