More efficient would be this:
C:
unsigned char hp = ((atk & 1)<<3) + ((def & 1)<<2) + ((spe & 1)<<1) + (spc & 1);
AND 1 is faster than MOD 2 since you just want to reduce it to the least significant byte.
And bitshift operations are faster than multiplications.
There's possibly a better way but that would require some brainwork.
Additionally I would use unsigned chars (basically byte) instead of integers since you can't have negative values anyway and the game also handles the values in bytes I'd think since they cap at 255.