Created
September 14, 2016 04:24
-
-
Save inaz2/e137d2a25bbd161efe2a2d5dcda19af7 to your computer and use it in GitHub Desktop.
evaluation of fcd decompiler http://zneak.github.io/fcd/
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| uint64_t __libc_start_main(uint64_t rdi, uint64_t rsi, uint64_t rdx, uint64_t rcx, uint64_t r8, uint64_t r9, uint64_t sp0); | |
| uint64_t printf(uint64_t rdi); | |
| uint64_t puts(uint64_t rdi); | |
| void _init(uint64_t rip) | |
| { | |
| if (*(uint64_t*)6295544 != 0) | |
| { | |
| func_400460(4195349); | |
| } | |
| return; | |
| } | |
| void func_400460(uint64_t rip) | |
| { | |
| __indirect_jump(*(uint64_t*)6295544); | |
| } | |
| void _start(uint64_t rip, uint64_t rsp, uint64_t rdx) | |
| { | |
| *(uint64_t*)(rsp - 8) = rip; | |
| uint64_t anon2 = rsp & -16; | |
| uint64_t anon1 = anon2 - 16; | |
| *(uint64_t*)anon1 = anon2 - 8; | |
| __libc_start_main(4195696, rip, rsp, 4195952, 4196064, rdx, *(uint64_t*)anon1); | |
| llvm.trap(); | |
| } | |
| void deregister_tm_clones(uint64_t rip) | |
| { | |
| return; | |
| } | |
| void register_tm_clones(uint64_t rip) | |
| { | |
| return; | |
| } | |
| void __do_global_dtors_aux(uint64_t rip) | |
| { | |
| uint8_t* anon1 = (uint8_t*)6295616; | |
| if (*anon1 == 0) | |
| { | |
| deregister_tm_clones(4195634); | |
| *anon1 = 1; | |
| } | |
| return; | |
| } | |
| void frame_dummy(uint64_t rip) | |
| { | |
| return; | |
| } | |
| void main(uint64_t rip) | |
| { | |
| uint32_t phi2; | |
| uint32_t phi_in1 = 0; | |
| do | |
| { | |
| phi2 = phi_in1; | |
| if (phi2 <= 99) | |
| { | |
| int64_t anon3 = (__sext int64_t)phi2; | |
| if ((uint32_t)(anon3 % 15) != 0) | |
| { | |
| if ((uint32_t)(anon3 % 5) != 0) | |
| { | |
| if ((uint32_t)(anon3 % 3) != 0) | |
| { | |
| printf(4196098); | |
| } | |
| else | |
| { | |
| puts(4196093); | |
| } | |
| } | |
| else | |
| { | |
| puts(4196088); | |
| } | |
| } | |
| else | |
| { | |
| puts(4196084); | |
| } | |
| phi_in1 = phi2 + 1; | |
| } | |
| } | |
| while (phi2 <= 99); | |
| return; | |
| } | |
| void __libc_csu_init(uint64_t rip, uint64_t rdi, uint64_t rsi, uint64_t rdx) | |
| { | |
| _init(4196001); | |
| (*(void(**)(uint64_t, uint64_t, uint64_t))6295056)(rdi & 4294967295, rsi, rdx); | |
| return; | |
| } | |
| void __libc_csu_fini(uint64_t rip) | |
| { | |
| return; | |
| } | |
| void _fini(uint64_t rip) | |
| { | |
| return; | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| uint64_t __libc_start_main(uint64_t rdi, uint64_t rsi, uint64_t rdx, uint64_t rcx, uint64_t r8, uint64_t r9, uint64_t sp0); | |
| uint64_t printf(uint64_t rdi); | |
| uint64_t puts(uint64_t rdi); | |
| void _init(uint64_t rip) | |
| { | |
| if (*(uint64_t*)6295544 != 0) | |
| { | |
| func_400460(4195349); | |
| } | |
| return; | |
| } | |
| void func_400460(uint64_t rip) | |
| { | |
| __indirect_jump(*(uint64_t*)6295544); | |
| } | |
| void _start(uint64_t rip, uint64_t rsp, uint64_t rdx) | |
| { | |
| *(uint64_t*)(rsp - 8) = rip; | |
| uint64_t anon2 = rsp & -16; | |
| uint64_t anon1 = anon2 - 16; | |
| *(uint64_t*)anon1 = anon2 - 8; | |
| __libc_start_main(4195696, rip, rsp, 4195888, 4196000, rdx, *(uint64_t*)anon1); | |
| llvm.trap(); | |
| } | |
| void deregister_tm_clones(uint64_t rip) | |
| { | |
| return; | |
| } | |
| void register_tm_clones(uint64_t rip) | |
| { | |
| return; | |
| } | |
| void __do_global_dtors_aux(uint64_t rip) | |
| { | |
| uint8_t* anon1 = (uint8_t*)6295616; | |
| if (*anon1 == 0) | |
| { | |
| deregister_tm_clones(4195634); | |
| *anon1 = 1; | |
| } | |
| return; | |
| } | |
| void frame_dummy(uint64_t rip) | |
| { | |
| return; | |
| } | |
| void main(uint64_t rip) | |
| { | |
| uint32_t phi2; | |
| uint32_t phi_in1 = 0; | |
| do | |
| { | |
| phi2 = phi_in1; | |
| int64_t anon4 = (__sext int64_t)phi2; | |
| uint32_t anon3 = (uint32_t)(anon4 * -2004318071 >> 32) + phi2; | |
| if (phi2 != ((anon3 >> 3) + (anon3 >> 31)) * 15) | |
| { | |
| int64_t anon5 = anon4 * 1717986919; | |
| if (phi2 != ((uint32_t)(anon5 >> 33) + (uint32_t)(anon5 >> 63)) * 5) | |
| { | |
| int64_t anon6 = anon4 * 1431655766; | |
| if (phi2 != ((uint32_t)(anon6 >> 32) + (uint32_t)(anon6 >> 63)) * 3) | |
| { | |
| printf(4196034); | |
| } | |
| else | |
| { | |
| puts(4196029); | |
| } | |
| } | |
| else | |
| { | |
| puts(4196024); | |
| } | |
| } | |
| else | |
| { | |
| puts(4196020); | |
| } | |
| phi_in1 = phi2 + 1; | |
| } | |
| while (phi2 != 99); | |
| return; | |
| } | |
| void __libc_csu_init(uint64_t rip, uint64_t rdi, uint64_t rsi, uint64_t rdx) | |
| { | |
| _init(4195937); | |
| (*(void(**)(uint64_t, uint64_t, uint64_t))6295056)(rdi & 4294967295, rsi, rdx); | |
| return; | |
| } | |
| void __libc_csu_fini(uint64_t rip) | |
| { | |
| return; | |
| } | |
| void _fini(uint64_t rip) | |
| { | |
| return; | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| uint64_t __libc_start_main(uint64_t rdi, uint64_t rsi, uint64_t rdx, uint64_t rcx, uint64_t r8, uint64_t r9, uint64_t sp0); | |
| uint64_t printf(uint64_t rdi); | |
| uint64_t puts(uint64_t rdi); | |
| void _init(uint64_t rip) | |
| { | |
| if (*(uint64_t*)6295544 != 0) | |
| { | |
| func_400460(4195349); | |
| } | |
| return; | |
| } | |
| void func_400460(uint64_t rip) | |
| { | |
| __indirect_jump(*(uint64_t*)6295544); | |
| } | |
| void _start(uint64_t rip, uint64_t rsp, uint64_t rdx) | |
| { | |
| *(uint64_t*)(rsp - 8) = rip; | |
| uint64_t anon2 = rsp & -16; | |
| uint64_t anon1 = anon2 - 16; | |
| *(uint64_t*)anon1 = anon2 - 8; | |
| __libc_start_main(4195686, rip, rsp, 4195904, 4196016, rdx, *(uint64_t*)anon1); | |
| llvm.trap(); | |
| } | |
| void deregister_tm_clones(uint64_t rip) | |
| { | |
| return; | |
| } | |
| void register_tm_clones(uint64_t rip) | |
| { | |
| return; | |
| } | |
| void __do_global_dtors_aux(uint64_t rip) | |
| { | |
| uint8_t* anon1 = (uint8_t*)6295616; | |
| if (*anon1 == 0) | |
| { | |
| deregister_tm_clones(4195634); | |
| *anon1 = 1; | |
| } | |
| return; | |
| } | |
| void frame_dummy(uint64_t rip) | |
| { | |
| return; | |
| } | |
| void main(uint64_t rip) | |
| { | |
| bool anon3; | |
| uint32_t phi_in1 = 0; | |
| do | |
| { | |
| uint32_t phi2 = phi_in1; | |
| anon3 = phi2 < 100; | |
| if (anon3) | |
| { | |
| uint64_t anon4 = (__zext uint64_t)phi2; | |
| uint32_t anon5 = phi2 >> 31; | |
| if (phi2 != ((uint32_t)(anon4 * 6585616521 >> 35) - anon5) * 15) | |
| { | |
| if (phi2 != ((uint32_t)(anon4 * 1717986919 >> 33) - anon5) * 5) | |
| { | |
| if (phi2 != ((uint32_t)(anon4 * 1431655766 >> 32) - anon5) * 3) | |
| { | |
| printf(4196055); | |
| } | |
| else | |
| { | |
| puts(4196050); | |
| } | |
| } | |
| else | |
| { | |
| puts(4196045); | |
| } | |
| } | |
| else | |
| { | |
| puts(4196036); | |
| } | |
| phi_in1 = phi2 + 1; | |
| } | |
| } | |
| while (anon3); | |
| return; | |
| } | |
| void __libc_csu_init(uint64_t rip, uint64_t rdi, uint64_t rsi, uint64_t rdx) | |
| { | |
| _init(4195953); | |
| (*(void(**)(uint64_t, uint64_t, uint64_t))6295056)(rdi & 4294967295, rsi, rdx); | |
| return; | |
| } | |
| void __libc_csu_fini(uint64_t rip) | |
| { | |
| return; | |
| } | |
| void _fini(uint64_t rip) | |
| { | |
| return; | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| uint64_t __libc_start_main(uint64_t rdi, uint64_t rsi, uint64_t rdx, uint64_t rcx, uint64_t r8, uint64_t r9, uint64_t sp0); | |
| void __printf_chk(uint64_t rdi, uint64_t rsi, uint64_t rdx, uint64_t rcx); | |
| uint64_t puts(uint64_t rdi); | |
| void _init(uint64_t rip) | |
| { | |
| if (*(uint64_t*)6295544 != 0) | |
| { | |
| func_400480(4195381); | |
| } | |
| return; | |
| } | |
| void func_400480(uint64_t rip) | |
| { | |
| __indirect_jump(*(uint64_t*)6295544); | |
| } | |
| void main(uint64_t rip) | |
| { | |
| uint32_t phi_in1 = 0; | |
| while (true) | |
| { | |
| uint32_t phi2 = phi_in1; | |
| uint64_t anon3 = (__zext uint64_t)phi2; | |
| int64_t anon5 = (__sext int64_t)phi2 >> 31; | |
| uint32_t anon4 = (uint32_t)anon5; | |
| if (phi2 != (((uint32_t)(anon3 * 2290649225 >> 32) + phi2 >> 3) - anon4) * 15) | |
| { | |
| if (phi2 != ((uint32_t)(anon3 * 1717986919 >> 33) - anon4) * 5) | |
| { | |
| if (phi2 != ((uint32_t)(anon3 * 1431655766 >> 32) - anon4) * 3) | |
| { | |
| __printf_chk(1, 4196050, anon3, anon5 & 4294967295); | |
| } | |
| else | |
| { | |
| puts(4196045); | |
| } | |
| } | |
| else | |
| { | |
| puts(4196040); | |
| } | |
| phi_in1 = phi2 + 1; | |
| if (phi2 == 99) | |
| { | |
| break; | |
| } | |
| } | |
| else | |
| { | |
| puts(4196036); | |
| uint32_t anon6 = phi2 + 1; | |
| phi_in1 = anon6; | |
| if (anon6 == 100) | |
| { | |
| break; | |
| } | |
| } | |
| } | |
| return; | |
| } | |
| void _start(uint64_t rip, uint64_t rsp, uint64_t rdx) | |
| { | |
| *(uint64_t*)(rsp - 8) = rip; | |
| uint64_t anon2 = rsp & -16; | |
| uint64_t anon1 = anon2 - 16; | |
| *(uint64_t*)anon1 = anon2 - 8; | |
| __libc_start_main(4195472, rip, rsp, 4195904, 4196016, rdx, *(uint64_t*)anon1); | |
| llvm.trap(); | |
| } | |
| void deregister_tm_clones(uint64_t rip) | |
| { | |
| return; | |
| } | |
| void register_tm_clones(uint64_t rip) | |
| { | |
| return; | |
| } | |
| void __do_global_dtors_aux(uint64_t rip) | |
| { | |
| uint8_t* anon1 = (uint8_t*)6295616; | |
| if (*anon1 == 0) | |
| { | |
| deregister_tm_clones(4195842); | |
| *anon1 = 1; | |
| } | |
| return; | |
| } | |
| void frame_dummy(uint64_t rip) | |
| { | |
| return; | |
| } | |
| void __libc_csu_init(uint64_t rip, uint64_t rdi, uint64_t rsi, uint64_t rdx) | |
| { | |
| _init(4195953); | |
| (*(void(**)(uint64_t, uint64_t, uint64_t))6295056)(rdi & 4294967295, rsi, rdx); | |
| return; | |
| } | |
| void __libc_csu_fini(uint64_t rip) | |
| { | |
| return; | |
| } | |
| void _fini(uint64_t rip) | |
| { | |
| return; | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #include <stdio.h> | |
| int main() | |
| { | |
| int i; | |
| for (i=0; i<100; i++) { | |
| if (i%15 == 0) { | |
| puts("fizzbuzz"); | |
| } else if (i%5 == 0) { | |
| puts("buzz"); | |
| } else if (i%3 == 0) { | |
| puts("fizz"); | |
| } else { | |
| printf("%d\n", i); | |
| } | |
| } | |
| return 0; | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # gcc -o fizzbuzz-gcc fizzbuzz.c | |
| # gcc -O2 -o fizzbuzz-gccO2 fizzbuzz.c | |
| # clang-3.8 -o fizzbuzz-clang fizzbuzz.c | |
| # clang-3.8 -O2 -o fizzbuzz-clangO2 fizzbuzz.c | |
| # ./build/fcd fizzbuzz-gcc >fizzbuzz-gcc.txt | |
| # ./build/fcd fizzbuzz-gccO2 >fizzbuzz-gccO2.txt | |
| # ./build/fcd fizzbuzz-clang >fizzbuzz-clang.txt | |
| # ./build/fcd fizzbuzz-clangO2 >fizzbuzz-clangO2.txt |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment