Skip to content

Instantly share code, notes, and snippets.

@yarjor
Last active January 26, 2024 14:58
Show Gist options
  • Save yarjor/72a2364d94193c1305e3c348031a2884 to your computer and use it in GitHub Desktop.
Save yarjor/72a2364d94193c1305e3c348031a2884 to your computer and use it in GitHub Desktop.
[Decompiler Comparison] #radare2 #r2 #ida #idapro #retdec #r2dec #radeco #hexrays
int __cdecl main(int argc, const char **argv, const char **envp)
{
char *src; // [esp+Ch] [ebp-Ch]
puts("\n .:: Megabeets ::.\n");
puts("Show me what you got?");
__isoc99_scanf("%ms", &src);
if ( beet(src) )
puts("Success!\n");
else
puts("Nop, Wrong argument.\n\n");
return 0;
}
/* r2dec pseudo C output */
#include <stdint.h>
uint32_t main (int32_t arg_4h) {
int32_t local_ch;
int32_t local_4h;
ecx = &arg_4h;
puts ("\n .:: Megabeets ::.\n");
puts ("Show me what you got?");
eax = &local_ch;
_isoc99_scanf (0x804878c, eax);
eax = local_ch;
eax = beet (eax);
if (eax != 0) {
puts ("Success!\n");
} else {
puts ("Nop, Wrong argument.\n\n");
}
eax = 0;
ecx = local_4h;
esp = ecx - 4;
return eax;
fn main () {
*(((4294967280 & esp) - 4)) = *(((4 + esp) - 4));
*((((4294967280 & esp) - 4) - 4)) = ebp;
*(((((4294967280 & esp) - 4) - 4) - 4)) = (4 + esp);
*((((((((4294967280 & esp) - 4) - 4) - 4) - 20) - 12) - 4)) = "\n .:: Megabeets ::.\n";
sym.imp.puts();
*(((((((((((4294967280 & esp) - 4) - 4) - 4) - 20) - 12) - 4) + 16) - 12) - 4)) = "Show me what you got?";
sym.imp.puts();
*((((((((((((((4294967280 & esp) - 4) - 4) - 4) - 20) - 12) - 4) + 16) - 12) - 4) + 16) - 8) - 4)) = ((((4294967280 & esp) - 4) - 4) - 12);
*(((((((((((((((4294967280 & esp) - 4) - 4) - 4) - 20) - 12) - 4) + 16) - 12) - 4) + 16) - 8) - 4) - 4)) = "%ms";
sym.imp.__isoc99_scanf();
*((((((((((((((((((4294967280 & esp) - 4) - 4) - 4) - 20) - 12) - 4) + 16) - 12) - 4) + 16) - 8) - 4) - 4) + 16) - 12) - 4)) = *(((((4294967280 & esp) - 4) - 4) - 12));
sym.beet();
}
//
// This file was generated by the Retargetable Decompiler
// Website: https://retdec.com
// Copyright (c) 2018 Retargetable Decompiler <info@retdec.com>
//
#include <stdint.h>
#include <stdio.h>
int32_t beet(char * a1);
// ------------------------ Functions -------------------------
// Address range: 0x8048658 - 0x80486df
int main(int argc, char ** argv) {
// 0x8048658
puts("\n .:: Megabeets ::.\n");
puts("Show me what you got?");
int32_t v1 = 0; // bp-20
scanf("%ms", &v1);
if (beet((char *)v1) == 0) {
// 0x80486c2
puts("Nop, Wrong argument.\n\n");
// branch -> 0x80486d2
} else {
// 0x80486b0
puts("Success!\n");
// branch -> 0x80486d2
}
// 0x80486d2
return 0;
}
// --------------- Dynamically Linked Functions ---------------
// int puts(const char * s);
// int scanf(const char * restrict format, ...);
// --------------------- Meta-Information ---------------------
// Detected compiler/packer: gcc (7.1.1)
// Detected functions: 1
// Decompilation date: 2018-09-11 11:04:45
int main(int argc, char *argv[])
{
char *input;
puts("\n .:: Megabeets ::.\n");
puts("Show me what you got:");
scanf("%ms", &input);
if (beet(input))
{
printf("Success!\n\n");
}
else
puts("Nop, Wrong argument.\n\n");
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment