Why not just do it in assembly? You'd have a much better time of it than trying to detangle some compiler output, and you'd be much less likely to get a bad grade when you turn in your code. (Professors typically have a very well-developed ability to recognize the difference between compiler-generated code and stuff students can do.)
The problem isn't hard. You only need to bitmask with a 1, some shifts, and an add, with a total of maybe four registers being used.
While I don't have much experience to say, I'd listen to Duoas. I can't say I code in Assembler but I have seen compiler output and hand written Assembler code and they certainly can be told apart! Even it's a simple program such as Hello World.