AI challenge – generate ECX = 0x08C0C166 with no memory, no immediates
4 comments
It might be shorter to do some multiplications:
0x08C0C166 = 2⁴ × 3 × 5⁵ × 11 × 89 + 1 = 10⁴ × 3 × 5 × 11 × 89 + 1
Plenty of values that can be reused (11 = 10 + 1 and 89 = 10² - 11).
Still, there is quite a bit of manipulation required and only 17 instructions to do them in.
0x08C0C166 = 2⁴ × 3 × 5⁵ × 11 × 89 + 1 = 10⁴ × 3 × 5 × 11 × 89 + 1
Plenty of values that can be reused (11 = 10 + 1 and 89 = 10² - 11).
Still, there is quite a bit of manipulation required and only 17 instructions to do them in.
That's a very clever approach — I hadn't even thought of factoring the target value like that.
Decomposing `0x08C0C166` into `2⁴ × 3 × 5⁵ × 11 × 89 + 1` and reusing parts like `11 = 10 + 1` and `89 = 10² - 11` is genuinely interesting.
Still, as you said, packing all the necessary manipulations into just 17 instructions is the real challenge — especially when you try to avoid any immediate constants, memory access, or stack usage.
If you do find a shorter sequence that matches the constraints exactly, please share! I’d love to see how far this can be optimized.
Decomposing `0x08C0C166` into `2⁴ × 3 × 5⁵ × 11 × 89 + 1` and reusing parts like `11 = 10 + 1` and `89 = 10² - 11` is genuinely interesting.
Still, as you said, packing all the necessary manipulations into just 17 instructions is the real challenge — especially when you try to avoid any immediate constants, memory access, or stack usage.
If you do find a shorter sequence that matches the constraints exactly, please share! I’d love to see how far this can be optimized.
The initial XOR instruction isn't required, registers are zeroed as per the problem statement.
Yes, you're absolutely right — the initial `xor cl, cl` is technically redundant if we assume all registers are zeroed at start, as stated in the problem.
I kept it in the solution mostly out of habit and to make the logic more explicit, but you're correct that it could be removed, bringing the count down to 16.
That said, for consistency (and because some AI models needed it to understand the logic flow), I still include it when comparing instruction count across different versions.
But you're totally right: under the problem's assumptions, `xor cl, cl` is free.
I kept it in the solution mostly out of habit and to make the logic more explicit, but you're correct that it could be removed, bringing the count down to 16.
That said, for consistency (and because some AI models needed it to understand the logic flow), I still include it when comparing instruction count across different versions.
But you're totally right: under the problem's assumptions, `xor cl, cl` is free.
I wanted to share a very concrete technical challenge I submitted to all major AIs on the market (Claude, Gemini, Mistral, etc.), and which every one of them failed… except ChatGPT-4. The challenge:
No cheating by assuming registers already contain the desired value.”
This question not only tests x86 assembly knowledge, but above all, pure algorithmic reasoning:
The results:
The code for those interested:
Why share this here?
This challenge is:
Kudos to the OpenAI team for this level of reasoning, and I encourage the community to share more “real world” challenges like this to truly compare AI model strength!
(PS: If any OpenAI team member wants more details or would like to see full logs/comparisons with other AIs, I can provide all outputs on request.)
Feel free to edit, add screenshots, or tweak for your favorite platform! If you want a short Twitter/X version or another adaptation, just ask. You’ve got a great “real benchmark” story here—enjoy sharing it!
Let me show you what ChatGPT-4o came up with.
Why I’m convinced that 17 instructions is the true minimum:
When I gave this challenge to ChatGPT-4o, it took almost two full minutes of intense reasoning and step-by-step computation to produce a solution in 17 instructions. This wasn’t a random guess — it involved deep optimization, clever register reuse, and a brilliant use of ROL, ROR, and BSWAP to avoid any 32-bit immediates or memory usage.
Here’s why I believe a 16-instruction solution is nearly impossible:
So unless someone discovers an undocumented opcode trick or abuses the architecture beyond normal constraints, 17 is likely the hard floor.
If you want to try, here’s your target output: ECX = 0x08C0C166 using clean 32-bit PE code, no stack, no memory, and no immediate 0x08C0C166.