Use add instead of or
- Dominant language
- C++
- Stars
- 8.6k
- Forks
- 1k
- PR merge metrics
- No merged PRs in 30d
Description
Subject: https://github.com/rfalke/decompiler-subjects/tree/master/from_holdec/dmi/transformation/ia32_elf/subject.exe
Source:
```
// Address range: 0x8048810 - 0x8048904
int32_t advanced_1_unrolled_loop(void) {
...
for (int32_t i = 48; i < 57; i += 2) {
// 0x8048859
*v2 = i;
putchar((int32_t)&g1);
*v2 = i | 1;
putchar((int32_t)&g1);
}
...
```
Objdump:
```
8048859: 83 ec 0c sub $0xc,%esp
804885c: 53 push %ebx
804885d: e8 be fa ff ff call 8048320
8048862: 8d 43 01 lea 0x1(%ebx),%eax
8048865: 83 c3 02 add $0x2,%ebx
8048868: 89 04 24 mov %eax,(%esp)
804886b: e8 b0 fa ff ff call 8048320
8048870: 83 c4 10 add $0x10,%esp
8048873: 83 fb 3a cmp $0x3a,%ebx
8048876: 75 e1 jne 8048859
```
So it is a `lea` in the binary and not an `or`. retdec converts this to this `|1` (which is correct because we start even) but makes the output harder to understand.
Contributor guide
No contributing guide indexed for this repository
Research direction
Start with the linked decompiler subject and compare the source around advanced_1_unrolled_loop with the objdump at 0x8048859–0x8048876. Trace where the lea instruction becomes `| 1`, then identify the relevant transformation or output tests; done means the generated expression reflects the add/lea operation while preserving correctness.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- cpp
- Domain
- compilers, reverse-engineering
- Issue type
- Refactor
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100