HackerTrans
TopNewTrendsCommentsPastAskShowJobs

xddj

no profile record

Submissions

AI challenge – generate ECX = 0x08C0C166 with no memory, no immediates

1 points·by xddj·tahun lalu·4 comments

comments

xddj
·tahun lalu·discuss
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.
xddj
·tahun lalu·discuss
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.