# decomp.me recipe — 01_memset ## Create a scratch Open https://decomp.me/ (or your self-hosted instance at http://192.168.88.64 if available). Click **New scratch**. - **Platform / Compiler:** `gcc 12.x aarch64-linux-gnu` (or whatever aarch64-gcc is offered — exact version doesn't matter much for this size). - **Compiler flags:** `-O2 -ffreestanding -nostdlib` - **Diff label:** `memset_byte` ## Target asm Paste the following into the **"Target asm"** box: ```asm memset_byte: mov x3, #0x0 .Lloop: cmp x2, x3 b.ne .Lbody ret .Lbody: strb w1, [x0, x3] add x3, x3, #0x1 b .Lloop ``` ## Context (headers/decls) ```c #include #include ``` ## Source Paste the ground-truth C from `reference.c` (or write your own first and iterate). ## Expected workflow - First compile: scorer usually reports a high similarity (>= 80%) if the compiler picks the same `while (i != n)` pattern. - Fine-tune: try `i++` vs `i+=1`, try `while` vs `for`, try `uint8_t *` cast placement. Each yields a distinct register-allocation order the scorer rewards or punishes. - Perfect match possible if you hit the exact code shape GCC chose. ## Benchmark notes - decomp.me's strength is the **compile-and-diff** feedback loop — every edit immediately shows the byte-delta against the target. - Weakness for this target: the real blob was likely built with a different compiler (ARMCC / Keil / vendor LLVM?). GCC may never match exactly even with perfect C. Similarity >= 90% is the realistic ceiling.