decompiled_code:
int __cdecl main(int argc, const char **argv, const char **envp)
{
__int128 *v3; // rbx
int v4; // ebx
int *v5; // rax
int *v7; // rax
__int64 v8; // [rsp+0h] [rbp-78h] BYREF
__int64 v9; // [rsp+8h] [rbp-70h] BYREF
__int64 s2; // [rsp+10h] [rbp-68h] BYREF
__int64 s1; // [rsp+18h] [rbp-60h] BYREF
__m128i v12; // [rsp+20h] [rbp-58h] BYREF
__m128i v13; // [rsp+30h] [rbp-48h] BYREF
__m128i v14; // [rsp+40h] [rbp-38h] BYREF
__m128i v15[2]; // [rsp+50h] [rbp-28h] BYREF

test_init(argc, argv, envp);
v3 = (__int128 *)&v12;
if ( (unsigned int)chk_proc_mmx() )
{
do
{
*(_DWORD *)v3 = mrand48();
v3 = (__int128 *)((char *)v3 + 4);
}
while ( v3 != (__int128 *)&v14 );
v15[0] = _mm_loadu_si128(&v12);
v14 = _mm_loadu_si128(&v13);
start();
finish(&s1, &v9);
start();
test_daemon(v15, &v14);
test_waitsig();
finish(&s2, &v8);
v4 = memcmp(&s1, &s2, 8uLL);
if ( v4 )
{
v7 = _errno_location();
test_msg("FAIL: %s:%d: byte op mismatch\n (errno = %d)\n", "mmx00.c", 88LL, (unsigned int)*v7);
v4 = 0;
}
else if ( !memcmp(&v9, &v8, 8uLL) )
{
test_msg("PASS\n");
v4 = 0;
}
else
{
v5 = _errno_location();
test_msg("FAIL: %s:%d: word op mismatch\n (errno = %d)\n", "mmx00.c", 90LL, (unsigned int)*v5);
}
}
else
{
test_msg("SKIP: %s:%d: MMX not supported\n", "mmx00.c", 67LL);
v4 = 1;
}
return v4;
}

canonical_decompiled_code:
int __cdecl main(int argc, const char **argv, const char **envp)
{
__int128 *v3; // rbx
int v4; // ebx
int *v5; // rax
int *v7; // rax
__int64 v8; // [rsp+0h] [rbp-78h] BYREF
__int64 v9; // [rsp+8h] [rbp-70h] BYREF
__int64 s2; // [rsp+10h] [rbp-68h] BYREF
__int64 s1; // [rsp+18h] [rbp-60h] BYREF
__m128i v12; // [rsp+20h] [rbp-58h] BYREF
__m128i v13; // [rsp+30h] [rbp-48h] BYREF
__m128i v14; // [rsp+40h] [rbp-38h] BYREF
__m128i v15[2]; // [rsp+50h] [rbp-28h] BYREF

test_init(argc, argv, envp);
v3 = (__int128 *)&v12;
if ( (unsigned int)func3() )
{
do
{
*(_DWORD *)v3 = mrand48();
v3 = (__int128 *)((char *)v3 + 4);
}
while ( v3 != (__int128 *)&v14 );
v15[0] = _mm_loadu_si128(&v12);
v14 = _mm_loadu_si128(&v13);
func1();
func2(&s1, &v9);
func1();
test_daemon(v15, &v14);
test_waitsig();
func2(&s2, &v8);
v4 = memcmp(&s1, &s2, 8uLL);
if ( v4 )
{
v7 = _errno_location();
test_msg("FAIL: %s:%d: byte op mismatch\n (errno = %d)\n", "mmx00.c", 88LL, (unsigned int)*v7);
v4 = 0;
}
else if ( !memcmp(&v9, &v8, 8uLL) )
{
test_msg("PASS\n");
v4 = 0;
}
else
{
v5 = _errno_location();
test_msg("FAIL: %s:%d: word op mismatch\n (errno = %d)\n", "mmx00.c", 90LL, (unsigned int)*v5);
}
}
else
{
test_msg("SKIP: %s:%d: MMX not supported\n", "mmx00.c", 67LL);
v4 = 1;
}
return v4;
}

original_code:
int main(int argc, char **argv)
{
 uint8_t bytes[16];
 uint16_t words[8];
 uint32_t rnd[8];
 int i;
 uint8_t resbytes1[8], resbytes2[8];
 uint16_t reswords1[4], reswords2[4];
 test_init(argc, argv);
 if (!chk_proc_mmx()) {
  test_msg("SKIP: %s:%d: " "MMX not supported" "\n", "mmx00.c", 67);
  return 1;
 }
 for (i = 0; i < (sizeof(bytes) + sizeof(words)) / 4; i++)
  rnd[i] = mrand48();
 memcpy((uint8_t *) bytes, (uint8_t *) rnd, sizeof(bytes));
 memcpy((uint8_t *) words, (uint8_t *) rnd + sizeof(bytes), sizeof(words));
 start(bytes, words);
 finish(resbytes1, reswords1);
 start(bytes, words);
 test_daemon();
 test_waitsig();
 finish(resbytes2, reswords2);
 if (memcmp((uint8_t *) resbytes1, (uint8_t *) resbytes2, sizeof(resbytes1)))
  test_msg("FAIL: %s:%d: " "byte op mismatch\n" " (errno = %d)\n", "mmx00.c", 88, (*__errno_location ()));
 else if (memcmp((uint8_t *) reswords1, (uint8_t *) reswords2, sizeof(reswords2)))
  test_msg("FAIL: %s:%d: " "word op mismatch\n" " (errno = %d)\n", "mmx00.c", 90, (*__errno_location ()));
 else
  test_msg("PASS\n");
 return 0;
}

canonical_original_code:
int main(int argc, char **argv)
{
 unsigned char bytes[16];
 unsigned short words[8];
 unsigned int rnd[8];
 int i;
 unsigned char resbytes1[8]; unsigned char resbytes2[8];
 unsigned short reswords1[4]; unsigned short reswords2[4];
 test_init(argc, argv);
 if (!chk_proc_mmx()) {
  test_msg("SKIP: %s:%d: " "MMX not supported" "\n", "mmx00.c", 67);
  return 1;
 }
 for (i = 0; i < (sizeof(bytes) + sizeof(words)) / 4; i++)
  rnd[i] = mrand48();
 memcpy((unsigned char *) bytes, (unsigned char *) rnd, sizeof(bytes));
 memcpy((unsigned char *) words, (unsigned char *) rnd + sizeof(bytes), sizeof(words));
 start(bytes, words);
 finish(resbytes1, reswords1);
 start(bytes, words);
 test_daemon();
 test_waitsig();
 finish(resbytes2, reswords2);
 if (memcmp((unsigned char *) resbytes1, (unsigned char *) resbytes2, sizeof(resbytes1)))
  test_msg("FAIL: %s:%d: " "byte op mismatch\n" " (errno = %d)\n", "mmx00.c", 88, (*__errno_location ()));
 else if (memcmp((unsigned char *) reswords1, (unsigned char *) reswords2, sizeof(reswords2)))
  test_msg("FAIL: %s:%d: " "word op mismatch\n" " (errno = %d)\n", "mmx00.c", 90, (*__errno_location ()));
 else
  test_msg("PASS\n");
 return 0;
}

variable_types:
bytes
unsigned char [16]

variable_types:
words
unsigned short [8]

variable_types:
rnd
unsigned int [8]

variable_types: i int


repo: OSLL/pmover

decompiled_code:
void *__fastcall thread_fn(void *a1)
{
unsigned int v1; // eax
unsigned int v2; // eax
int *v3; // rax
int *v5; // rax
int *v6; // rax
__int64 v7; // [rsp+0h] [rbp-28h] BYREF
__int64 v8; // [rsp+8h] [rbp-20h] BYREF
__int64 v9; // [rsp+10h] [rbp-18h] BYREF
__int64 v10; // [rsp+18h] [rbp-10h] BYREF

v10 = 0LL;
v9 = 0LL;
v8 = 0LL;
v7 = 0LL;
test_msg("Obtaining old RL\n");
v1 = _gettid();
if ( syscall(274LL, v1, &v10, &v8) )
{
*((_DWORD *)a1 + 4) = -1;
v5 = _errno_location();
test_msg("FAIL: %s:%d: __NR_get_robust_list failed (errno = %d)\n", "futex-rl.c", 35LL, (unsigned int)*v5);
}
test_msg("Complete\n");
task_waiter_complete(a1, 1LL);
if ( *((_DWORD *)a1 + 4) != -1 )
{
task_waiter_wait4(a1, 2LL);
test_msg("Obtaining new RL\n");
v2 = _gettid();
if ( syscall(274LL, v2, &v9, &v7) )
{
*((_DWORD *)a1 + 4) = -1;
v6 = _errno_location();
test_msg("FAIL: %s:%d: __NR_get_robust_list failed (errno = %d)\n", "futex-rl.c", 48LL, (unsigned int)*v6);
}
if ( *((_DWORD *)a1 + 4) != -1 )
{
if ( v10 != v9 || v8 != v7 )
{
*((_DWORD *)a1 + 4) = -1;
v3 = _errno_location();
test_msg("FAIL: %s:%d: comparision failed (errno = %d)\n", "futex-rl.c", 55LL, (unsigned int)*v3);
}
*((_DWORD *)a1 + 4) = 0;
}
}
return 0LL;
}

canonical_decompiled_code:
void *__fastcall func1(void *a1)
{
unsigned int v1; // eax
unsigned int v2; // eax
int *v3; // rax
int *v5; // rax
int *v6; // rax
__int64 v7; // [rsp+0h] [rbp-28h] BYREF
__int64 v8; // [rsp+8h] [rbp-20h] BYREF
__int64 v9; // [rsp+10h] [rbp-18h] BYREF
__int64 v10; // [rsp+18h] [rbp-10h] BYREF

v10 = 0LL;
v9 = 0LL;
v8 = 0LL;
v7 = 0LL;
test_msg("Obtaining old RL\n");
v1 = func0();
if ( syscall(274LL, v1, &v10, &v8) )
{
*((_DWORD *)a1 + 4) = -1;
v5 = _errno_location();
test_msg("FAIL: %s:%d: __NR_get_robust_list failed (errno = %d)\n", "futex-rl.c", 35LL, (unsigned int)*v5);
}
test_msg("Complete\n");
task_waiter_complete(a1, 1LL);
if ( *((_DWORD *)a1 + 4) != -1 )
{
task_waiter_wait4(a1, 2LL);
test_msg("Obtaining new RL\n");
v2 = func0();
if ( syscall(274LL, v2, &v9, &v7) )
{
*((_DWORD *)a1 + 4) = -1;
v6 = _errno_location();
test_msg("FAIL: %s:%d: __NR_get_robust_list failed (errno = %d)\n", "futex-rl.c", 48LL, (unsigned int)*v6);
}
if ( *((_DWORD *)a1 + 4) != -1 )
{
if ( v10 != v9 || v8 != v7 )
{
*((_DWORD *)a1 + 4) = -1;
v3 = _errno_location();
test_msg("FAIL: %s:%d: comparision failed (errno = %d)\n", "futex-rl.c", 55LL, (unsigned int)*v3);
}
*((_DWORD *)a1 + 4) = 0;
}
}
return 0LL;
}

original_code:
void *thread_fn(void *lock)
{
 pthread_mutex_t *mutex;
 mutex = (pthread_mutex_t *)lock;
 pthread_mutex_lock(mutex);
 kid_passed++;
 pthread_mutex_unlock(mutex);
 return ((void *)0);
}

canonical_original_code:
void *thread_fn(void *lock)
{
 union pthread_mutex_t *mutex;
 mutex = (union pthread_mutex_t *)lock;
 pthread_mutex_lock(mutex);
 kid_passed++;
 pthread_mutex_unlock(mutex);
 return ((void *)0);
}

variable_types:
lock
void *

variable_types: union pthread_mutex_t { struct __pthread_mutex_s { int __lock; unsigned int __count; int __owner; unsigned int __nusers; int __kind; short __spins; short __elision; struct __pthread_internal_list { struct __pthread_internal_list *__prev; struct __pthread_internal_list *__next; } __list; } __data; char __size[40]; long __align; } *

return_type: void *

user_defined_types: union pthread_mutex_t { struct __pthread_mutex_s __data; char __size[40]; long __align; }

user_defined_types: struct __pthread_mutex_s { int __lock; unsigned int __count; int __owner; unsigned int __nusers; int __kind; short __spins; short __elision; struct __pthread_internal_list __list; }


main

canonical_name: main

decompiled_code:
int __cdecl main(int argc, const char **argv, const char **envp)
{
_DWORD *v3; // rax
_DWORD *v4; // rbx
int *v5; // rax
int *v7; // rax
int *v8; // rax
int *v9; // rax
pthread_t newthread[2]; // [rsp+8h] [rbp-10h] BYREF

test_init(argc, argv, envp);
v3 = mmap(0LL, 0x18uLL, 3, 33, -1, 0LL);
if ( v3 == (_DWORD *)-1LL )
{
v7 = _errno_location();
test_msg("FAIL: %s:%d: mmap failed\n (errno = %d)\n", "futex-rl.c", 72LL, (unsigned int)*v7);
exit(1);
}
v4 = v3;
task_waiter_init(v3);
v4[4] = 0;
test_msg("Createing thread\n");
if ( pthread_create(newthread, 0LL, thread_fn, v4) )
{
v8 = _errno_location();
test_msg("FAIL: %s:%d: Can't create thread\n (errno = %d)\n", "futex-rl.c", 81LL, (unsigned int)*v8);
exit(1);
}
test_msg("Wait for thread work\n");
task_waiter_wait4(v4, 1LL);
if ( v4[4] == -1 )
{
v9 = _errno_location();
test_msg("FAIL: %s:%d: thread failed\n (errno = %d)\n", "futex-rl.c", 88LL, (unsigned int)*v9);
exit(1);
}
test_msg("C/R cycle\n");
test_daemon();
test_waitsig();
task_waiter_complete(v4, 2LL);
pthread_join(newthread[0], 0LL);
if ( v4[4] )
{
v5 = _errno_location();
test_msg("FAIL: %s:%d: (errno = %d)\n", "futex-rl.c", 100LL, (unsigned int)*v5);
}
else
{
test_msg("PASS\n");
}
munmap(v4, 0x18uLL);
return 0;
}

original_code:
int main(int argc, char **argv)
{
 int i;
 pthread_t thr[num_threads];
 pthread_mutex_t m;
 test_init(argc, argv);
 if (num_threads > 50) {
  test_msg("ERR: %s:%d: " "%d threads it too much. max is %d\n" " (errno = %d)\n", "futex.c", 41, num_threads, 50, (*__errno_location ()));
  goto out;
 }
 pthread_mutex_init(&m, ((void *)0));
 pthread_mutex_lock(&m);
 for (i = 0; i < num_threads; i++)
  if (pthread_create(&thr[i], ((void *)0), thread_fn, &m)) {
   test_msg("ERR: %s:%d: " "Can't create %d'th thread\n" " (errno = %d)\n", "futex.c", 51, i + 1, (*__errno_location ()));
   goto out_kill;
  }
 kid_passed = 0;
 test_daemon();
 test_waitsig();
 sleep(1);
 if (kid_passed != 0)
  test_msg("FAIL: %s:%d: " "some kids broke through\n" " (errno = %d)\n", "futex.c", 62, (*__errno_location ()));
 pthread_mutex_unlock(&m);
 for (i = 0; i < num_threads; i++)
  pthread_join(thr[i], ((void *)0));
 if (pthread_mutex_trylock(&m)) {
  if ((*__errno_location ()) == 16)
   test_msg("FAIL: %s:%d: " "kids left my mutex locked\n" " (errno = %d)\n", "futex.c", 70, (*__errno_location ()));
  else
   test_msg("ERR: %s:%d: " "kids spoiled my mutex\n" " (errno = %d)\n", "futex.c", 72, (*__errno_location ()));
 }
 if (kid_passed != num_threads)
  test_msg("FAIL: %s:%d: " "some kids died during migration\n" " (errno = %d)\n", "futex.c", 76, (*__errno_location ()));
 test_msg("PASS\n");
out:
 return 0;
out_kill:
 for (i--; i >= 0; i--) {
  pthread_kill(thr[i], 9);
  pthread_join(thr[i], ((void *)0));
 }
 goto out;
}

canonical_original_code:
int main(int argc, char **argv)
{
 int i;
 unsigned long thr[-1];
 union pthread_mutex_t m;
 test_init(argc, argv);
 if (num_threads > 50) {
  test_msg("ERR: %s:%d: " "%d threads it too much. max is %d\n" " (errno = %d)\n", "futex.c", 41, num_threads, 50, (*__errno_location ()));
  goto out;
 }
 pthread_mutex_init(&m, ((void *)0));
 pthread_mutex_lock(&m);
 for (i = 0; i < num_threads; i++)
  if (pthread_create(&thr[i], ((void *)0), thread_fn, &m)) {
   test_msg("ERR: %s:%d: " "Can't create %d'th thread\n" " (errno = %d)\n", "futex.c", 51, i + 1, (*__errno_location ()));
   goto out_kill;
  }
 kid_passed = 0;
 test_daemon();
 test_waitsig();
 sleep(1);
 if (kid_passed != 0)
  test_msg("FAIL: %s:%d: " "some kids broke through\n" " (errno = %d)\n", "futex.c", 62, (*__errno_location ()));
 pthread_mutex_unlock(&m);
 for (i = 0; i < num_threads; i++)
  pthread_join(thr[i], ((void *)0));
 if (pthread_mutex_trylock(&m)) {
  if ((*__errno_location ()) == 16)
   test_msg("FAIL: %s:%d: " "kids left my mutex locked\n" " (errno = %d)\n", "futex.c", 70, (*__errno_location ()));
  else
   test_msg("ERR: %s:%d: " "kids spoiled my mutex\n" " (errno = %d)\n", "futex.c", 72, (*__errno_location ()));
 }
 if (kid_passed != num_threads)
  test_msg("FAIL: %s:%d: " "some kids died during migration\n" " (errno = %d)\n", "futex.c", 76, (*__errno_location ()));
 test_msg("PASS\n");
out:
 return 0;
out_kill:
 for (i--; i >= 0; i--) {
  pthread_kill(thr[i], 9);
  pthread_join(thr[i], ((void *)0));
 }
 goto out;
}

variable_types: argc int

variable_types:
argv
char **

variable_types:
thr
unsigned long [-1]

variable_types: union pthread_mutex_t { struct __pthread_mutex_s { int __lock; unsigned int __count; int __owner; unsigned int __nusers; int __kind; short __spins; short __elision; struct __pthread_internal_list { struct __pthread_internal_list *__prev; struct __pthread_internal_list *__next; } __list; } __data; char __size[40]; long __align; }

return_type: int


decompiled_code:
void *__fastcall thread_fn(void *a1)
{
pthread_mutex_lock((pthread_mutex_t *)a1);
++kid_passed;
pthread_mutex_unlock((pthread_mutex_t *)a1);
return 0LL;
}

canonical_decompiled_code:
void *__fastcall func0(void *a1)
{
pthread_mutex_lock((pthread_mutex_t *)a1);
++kid_passed;
pthread_mutex_unlock((pthread_mutex_t *)a1);
return 0LL;
}

user_defined_types: struct __pthread_internal_list { struct __pthread_internal_list *__prev; struct __pthread_internal_list *__next; }


decompiled_code:
int __cdecl main(int argc, const char **argv, const char **envp)
{
void *v3; // rsp
unsigned int v4; // ebx
pthread_mutex_t *v5; // r12
int v6; // ebx
__int64 v7; // rbx
__int64 v8; // rcx
int *v9; // rax
int *v11; // rax
char *v12; // r12
__int64 v13; // rbx
int *v14; // rax
int *v15; // rax
pthread_mutex_t mutex; // [rsp+0h] [rbp-50h] BYREF

v3 = alloca(8LL * num_threads);
test_init(argc, argv, envp);
v4 = num_threads;
if ( num_threads > 50 )
{
v9 = _errno_location();
test_msg(
"ERR: %s:%d: %d threads it too much. max is %d\n (errno = %d)\n",
"futex.c",
41LL,
v4,
50LL,
(unsigned int)*v9);
}
else
{
pthread_mutex_init(&mutex, 0LL);
pthread_mutex_lock(&mutex);
if ( num_threads <= 0 )
{
LABEL_6:
kid_passed = 0;
test_daemon();
test_waitsig();
sleep(1u);
if ( kid_passed )
{
v14 = _errno_location();
test_msg("FAIL: %s:%d: some kids broke through\n (errno = %d)\n", "futex.c", 62LL, (unsigned int)*v14);
}
pthread_mutex_unlock(&mutex);
if ( num_threads > 0 )
{
v7 = 0LL;
do
pthread_join(*(_QWORD *)&mutex.__size[8 * v7++], 0LL);
while ( num_threads > (int)v7 );
}
if ( pthread_mutex_trylock(&mutex) )
{
v8 = (unsigned int)*_errno_location();
if ( (_DWORD)v8 == 16 )
test_msg("FAIL: %s:%d: kids left my mutex locked\n (errno = %d)\n", "futex.c", 70LL);
else
test_msg("ERR: %s:%d: kids spoiled my mutex\n (errno = %d)\n", "futex.c", 72LL, v8);
}
if ( kid_passed != num_threads )
{
v15 = _errno_location();
test_msg("FAIL: %s:%d: some kids died during migration\n (errno = %d)\n", "futex.c", 76LL, (unsigned int)*v15);
}
test_msg("PASS\n");
}
else
{
v5 = &mutex;
v6 = 0;
while ( !pthread_create((pthread_t *)v5, 0LL, thread_fn, &mutex) )
{
++v6;
v5 = (pthread_mutex_t *)((char *)v5 + 8);
if ( num_threads <= v6 )
goto LABEL_6;
}
v11 = _errno_location();
test_msg(
"ERR: %s:%d: Can't create %d'th thread\n (errno = %d)\n",
"futex.c",
51LL,
(unsigned int)(v6 + 1),
(unsigned int)*v11);
if ( v6 > 0 )
{
v12 = (char *)&mutex + 8 * v6;
v13 = (__int64)&v12[-8 * (v6 - 1) - 8];
do
{
pthread_kill(*((_QWORD *)v12 - 1), 9);
pthread_join(*((_QWORD *)v12 - 1), 0LL);
v12 -= 8;
}
while ( v12 != (char *)v13 );
}
}
}
return 0;
}


decompiled_code:
__int64 __fastcall fill_sock_name(__int64 a1, const char *a2)
{
if ( strlen(a2) > 0x6B )
return 0xFFFFFFFFLL;
*(_WORD *)a1 = 1;
strcpy((char *)(a1 + 2), a2);
return 0LL;
}

canonical_decompiled_code:
__int64 __fastcall func0(__int64 a1, const char *a2)
{
if ( strlen(a2) > 0x6B )
return 0xFFFFFFFFLL;
*(_WORD *)a1 = 1;
strcpy((char *)(a1 + 2), a2);
return 0LL;
}

original_code:
static int fill_sock_name(struct sockaddr_un *name, const char *filename)
{
 if (strlen(filename) >= sizeof(name->sun_path))
  return -1;
 name->sun_family = 1;
 strcpy(name->sun_path, filename);
 return 0;
}

canonical_original_code:
static int fill_sock_name(struct sockaddr_un *name, char *filename)
{
 if (strlen(filename) >= sizeof(name->sun_path))
  return -1;
 name->sun_family = 1;
 strcpy(name->sun_path, filename);
 return 0;
}

variable_types: struct sockaddr_un { unsigned short sun_family; char sun_path[108]; } *

variable_types:
filename
char *


decompiled_code:
void inc_num_exited()
{
++num_exited;
}

canonical_decompiled_code:
void func0()
{
++num_exited;
}

original_code:
void inc_num_exited(int signo)
{
 num_exited++;
}

variable_types: signo int

return_type: void


canonical_original_code:
void inc_num_exited(int signo)
{
 num_exited++;
}


repo: OlegIvanov/cmm

decompiled_code:
void *List_create()
{
return calloc(1uLL, 0x18uLL);
}

canonical_decompiled_code:
void *func0()
{
return calloc(1uLL, 0x18uLL);
}

canonical_original_code:
struct List *List_create()
{
 return calloc(1, sizeof(List));
}

return_type: struct List { int count; struct ListNode { struct ListNode *next; struct ListNode *prev; void *value; } *first; struct ListNode *last; } *

user_defined_types: struct List { int count; struct ListNode *first; struct ListNode *last; }


decompiled_code:
void __fastcall List_destroy(void *ptr)
{
_QWORD *i; // rbx
void *v3; // rdi

for ( i = (_QWORD *)*((_QWORD *)ptr + 1); i; i = (_QWORD *)*i )
{
v3 = (void *)i[1];
if ( v3 )
free(v3);
}
free(*((void **)ptr + 2));
free(ptr);
}

canonical_decompiled_code:
void __fastcall func1(void *ptr)
{
_QWORD *i; // rbx
void *v3; // rdi

for ( i = (_QWORD *)*((_QWORD *)ptr + 1); i; i = (_QWORD *)*i )
{
v3 = (void *)i[1];
if ( v3 )
free(v3);
}
free(*((void **)ptr + 2));
free(ptr);
}

original_code:
void List_destroy(List *list)
{
 ListNode *_node = ((void *)0); ListNode *cur = ((void *)0); for(cur = _node = list->first; _node != ((void *)0); cur = _node = _node->next) {
  if(cur->prev) {
   free(cur->prev);
  }
 }
 free(list->last);
 free(list);
}

canonical_original_code:
void List_destroy(struct List *list)
{
 struct ListNode *_node = ((void *)0); struct ListNode *cur = ((void *)0); for(cur = _node = list->first; _node != ((void *)0); cur = _node = _node->next) {
  if(cur->prev) {
   free(cur->prev);
  }
 }
 free(list->last);
 free(list);
}

variable_types: struct List { int count; struct ListNode { struct ListNode *next; struct ListNode *prev; void *value; } *first; struct ListNode *last; } *


decompiled_code:
void __fastcall List_clear_destroy(void *ptr)
{
List_clear((__int64)ptr);
List_destroy(ptr);
}

canonical_decompiled_code:
void __fastcall func3(void *ptr)
{
func2((__int64)ptr);
func1(ptr);
}

original_code:
void List_clear_destroy(List *list)
{
 List_clear(list);
 List_destroy(list);
}

canonical_original_code:
void List_clear_destroy(struct List *list)
{
 List_clear(list);
 List_destroy(list);
}

user_defined_types: struct ListNode { struct ListNode *next; struct ListNode *prev; void *value; }


decompiled_code:
int __fastcall List_push(__int64 a1, __int64 a2)
{
_QWORD *v2; // rax
_QWORD *v3; // rdx
int *v4; // rbx
char *v5; // r8

v2 = calloc(1uLL, 0x18uLL);
if ( v2 )
{
v2[2] = a2;
v3 = *(_QWORD **)(a1 + 16);
if ( v3 )
{
*v3 = v2;
v2[1] = *(_QWORD *)(a1 + 16);
}
else
{
*(_QWORD *)(a1 + 8) = v2;
}
*(_QWORD *)(a1 + 16) = v2;
++*(_DWORD *)a1;
}
else
{
v4 = _errno_location();
v5 = "None";
if ( *v4 )
v5 = strerror(*v4);
LODWORD(v2) = fprintf(stderr, "[ERROR] (%s:%d: errno: %s) Out of memory.\n", "src/cmm/list.c", 37LL, v5);
*v4 = 0;
}
return (int)v2;
}

canonical_decompiled_code:
int __fastcall func4(__int64 a1, __int64 a2)
{
_QWORD *v2; // rax
_QWORD *v3; // rdx
int *v4; // rbx
char *v5; // r8

v2 = calloc(1uLL, 0x18uLL);
if ( v2 )
{
v2[2] = a2;
v3 = *(_QWORD **)(a1 + 16);
if ( v3 )
{
*v3 = v2;
v2[1] = *(_QWORD *)(a1 + 16);
}
else
{
*(_QWORD *)(a1 + 8) = v2;
}
*(_QWORD *)(a1 + 16) = v2;
++*(_DWORD *)a1;
}
else
{
v4 = _errno_location();
v5 = "None";
if ( *v4 )
v5 = strerror(*v4);
LODWORD(v2) = fprintf(stderr, "[ERROR] (%s:%d: errno: %s) Out of memory.\n", "src/cmm/list.c", 37LL, v5);
*v4 = 0;
}
return (int)v2;
}

original_code:
void List_push(List *list, void *value)
{
 ListNode *node = calloc(1, sizeof(ListNode));
 if(!((node))) { fprintf(stderr, "[ERROR] (%s:%d: errno: %s) " "Out of memory." "\n", "src/cmm/list.c", 37, ((*__errno_location ()) == 0 ? "None" : strerror((*__errno_location ())))); (*__errno_location ())=0; goto error; };
 node->value = value;
 if(list->last == ((void *)0)) {
  list->first = node;
  list->last = node;
 } else {
  list->last->next = node;
  node->prev = list->last;
  list->last = node;
 }
 list->count++;
error:
 return;
}

canonical_original_code:
void List_push(struct List *list, void *value)
{
 struct ListNode *node = calloc(1, sizeof(ListNode));
 if(!((node))) { fprintf(stderr, "[ERROR] (%s:%d: errno: %s) " "Out of memory." "\n", "src/cmm/list.c", 37, ((*__errno_location ()) == 0 ? "None" : strerror((*__errno_location ())))); (*__errno_location ())=0; goto error; };
 node->value = value;
 if(list->last == ((void *)0)) {
  list->first = node;
  list->last = node;
 } else {
  list->last->next = node;
  node->prev = list->last;
  list->last = node;
 }
 list->count++;
error:
 return;
}

variable_types:
value
void *

variable_types: struct ListNode { struct ListNode *next; struct ListNode *prev; void *value; } *


decompiled_code:
int __fastcall List_unshift(__int64 a1, __int64 a2)
{
_QWORD *v2; // rax
__int64 v3; // rdx
int *v4; // rbx
char *v5; // r8

v2 = calloc(1uLL, 0x18uLL);
if ( v2 )
{
v2[2] = a2;
v3 = *(_QWORD *)(a1 + 8);
if ( v3 )
{
*v2 = v3;
*(_QWORD *)(v3 + 8) = v2;
*(_QWORD *)(a1 + 8) = v2;
}
else
{
*(_QWORD *)(a1 + 8) = v2;
*(_QWORD *)(a1 + 16) = v2;
}
++*(_DWORD *)a1;
}
else
{
v4 = _errno_location();
v5 = "None";
if ( *v4 )
v5 = strerror(*v4);
LODWORD(v2) = fprintf(stderr, "[ERROR] (%s:%d: errno: %s) Out of memory.\n", "src/cmm/list.c", 65LL, v5);
*v4 = 0;
}
return (int)v2;
}

canonical_decompiled_code:
int __fastcall func5(__int64 a1, __int64 a2)
{
_QWORD *v2; // rax
__int64 v3; // rdx
int *v4; // rbx
char *v5; // r8

v2 = calloc(1uLL, 0x18uLL);
if ( v2 )
{
v2[2] = a2;
v3 = *(_QWORD *)(a1 + 8);
if ( v3 )
{
*v2 = v3;
*(_QWORD *)(v3 + 8) = v2;
*(_QWORD *)(a1 + 8) = v2;
}
else
{
*(_QWORD *)(a1 + 8) = v2;
*(_QWORD *)(a1 + 16) = v2;
}
++*(_DWORD *)a1;
}
else
{
v4 = _errno_location();
v5 = "None";
if ( *v4 )
v5 = strerror(*v4);
LODWORD(v2) = fprintf(stderr, "[ERROR] (%s:%d: errno: %s) Out of memory.\n", "src/cmm/list.c", 65LL, v5);
*v4 = 0;
}
return (int)v2;
}

original_code:
void List_unshift(List *list, void *value)
{
 ListNode *node = calloc(1, sizeof(ListNode));
 if(!((node))) { fprintf(stderr, "[ERROR] (%s:%d: errno: %s) " "Out of memory." "\n", "src/cmm/list.c", 65, ((*__errno_location ()) == 0 ? "None" : strerror((*__errno_location ())))); (*__errno_location ())=0; goto error; };
 node->value = value;
 if(list->first == ((void *)0)) {
  list->first = node;
  list->last = node;
 } else {
  node->next = list->first;
  list->first->prev = node;
  list->first = node;
 }
 list->count++;
error:
 return;
}

canonical_original_code:
void List_unshift(struct List *list, void *value)
{
 struct ListNode *node = calloc(1, sizeof(ListNode));
 if(!((node))) { fprintf(stderr, "[ERROR] (%s:%d: errno: %s) " "Out of memory." "\n", "src/cmm/list.c", 65, ((*__errno_location ()) == 0 ? "None" : strerror((*__errno_location ())))); (*__errno_location ())=0; goto error; };
 node->value = value;
 if(list->first == ((void *)0)) {
  list->first = node;
  list->last = node;
 } else {
  node->next = list->first;
  list->first->prev = node;
  list->first = node;
 }
 list->count++;
error:
 return;
}


decompiled_code:
__int64 __fastcall ARPool_create(__int64 a1)
{
_QWORD *v1; // rbp
__int64 result; // rax
int *v3; // rbp
char *v4; // r8
__int64 v5[4]; // [rsp+8h] [rbp-20h] BYREF

if ( a1 )
{
v5[0] = 0LL;
Object_new(_GC__, 8LL, v5);
v1 = (_QWORD *)v5[0];
*v1 = List_create();
List_push(*(_QWORD *)(a1 + 168), v5[0]);
result = v5[0];
}
else
{
v3 = _errno_location();
v4 = "None";
if ( *v3 )
v4 = strerror(*v3);
fprintf(stderr, "[ERROR] (%s:%d: errno: %s) Argument 'gc' can't be NULL.\n", "src/cmm/arp.c", 7LL, v4);
*v3 = 0;
result = 0LL;
}
return result;
}

canonical_decompiled_code:
__int64 __fastcall func0(__int64 a1)
{
_QWORD *v1; // rbp
__int64 result; // rax
int *v3; // rbp
char *v4; // r8
__int64 v5[4]; // [rsp+8h] [rbp-20h] BYREF

if ( a1 )
{
v5[0] = 0LL;
Object_new(_GC__, 8LL, v5);
v1 = (_QWORD *)v5[0];
*v1 = List_create();
List_push(*(_QWORD *)(a1 + 168), v5[0]);
result = v5[0];
}
else
{
v3 = _errno_location();
v4 = "None";
if ( *v3 )
v4 = strerror(*v3);
fprintf(stderr, "[ERROR] (%s:%d: errno: %s) Argument 'gc' can't be NULL.\n", "src/cmm/arp.c", 7LL, v4);
*v3 = 0;
result = 0LL;
}
return result;
}

original_code:
ARPool *ARPool_create(GC *gc)
{
 if(!(gc)) { fprintf(stderr, "[ERROR] (%s:%d: errno: %s) " "Argument 'gc' can't be NULL." "\n", "src/cmm/arp.c", 7, ((*__errno_location ()) == 0 ? "None" : strerror((*__errno_location ())))); (*__errno_location ())=0; goto error; };
 ARPool *arp = ((void *)0);
 Object_new(__GC__, sizeof(ARPool), (void **)&(arp));
 arp->pool = List_create();
 List_push(gc->arp_stack, arp);
 return arp;
error:
 return ((void *)0);
}

canonical_original_code:
struct ARPool *ARPool_create(struct GC *gc)
{
 if(!(gc)) { fprintf(stderr, "[ERROR] (%s:%d: errno: %s) " "Argument 'gc' can't be NULL." "\n", "src/cmm/arp.c", 7, ((*__errno_location ()) == 0 ? "None" : strerror((*__errno_location ())))); (*__errno_location ())=0; goto error; };
 struct ARPool *arp = ((void *)0);
 Object_new(__GC__, sizeof(ARPool), (void **)&(arp));
 arp->pool = List_create();
 List_push(gc->arp_stack, arp);
 return arp;
error:
 return ((void *)0);
}

variable_types: struct GC { struct BottomIndex { struct BlockHeader { unsigned int size; short *map; void *block; unsigned char *marks; } **index; unsigned long key; struct BottomIndex *hash_link; } **top_index; struct BottomIndex *all_nils; unsigned int size_map[-1]; short *obj_map; struct Heap { void *low; void *high; } heap; struct List *block_list; struct List *block_freelist; struct List *freelists[-1]; struct List *arp_stack; } *

variable_types: struct ARPool { struct List { int count; struct ListNode { struct ListNode *next; struct ListNode *prev; void *value; } *first; struct ListNode *last; } *pool; } *

user_defined_types: struct GC { struct BottomIndex **top_index; struct BottomIndex *all_nils; unsigned int size_map[-1]; short *obj_map; struct Heap heap; struct List *block_list; struct List *block_freelist; struct List *freelists[-1]; struct List *arp_stack; }

user_defined_types: struct BottomIndex { struct BlockHeader **index; unsigned long key; struct BottomIndex *hash_link; }


decompiled_code:
int __fastcall ARPool_release(__int64 a1)
{
__int64 v1; // rax
_QWORD *v2; // r12
_QWORD *i; // rbx
int result; // eax
int *v5; // rbx
char *v6; // r8
int *v7; // rbx
char *v8; // r8

if ( a1 )
{
v1 = List_pop(*(_QWORD *)(a1 + 168));
v2 = (_QWORD *)v1;
if ( v1 )
{
for ( i = *(_QWORD **)(*(_QWORD *)v1 + 8LL); i; i = (_QWORD *)*i )
Object_release(_GC__, i[2]);
List_destroy(*v2);
result = Object_release(_GC__, v2);
}
else
{
v7 = _errno_location();
v8 = "None";
if ( *v7 )
v8 = strerror(*v7);
result = fprintf(stderr, "[ERROR] (%s:%d: errno: %s) There is no pool.\n", "src/cmm/arp.c", 25LL, v8);
*v7 = 0;
}
}
else
{
v5 = _errno_location();
v6 = "None";
if ( *v5 )
v6 = strerror(*v5);
result = fprintf(stderr, "[ERROR] (%s:%d: errno: %s) Argument 'gc' can't be NULL.\n", "src/cmm/arp.c", 22LL, v6);
*v5 = 0;
}
return result;
}

canonical_decompiled_code:
int __fastcall func1(__int64 a1)
{
__int64 v1; // rax
_QWORD *v2; // r12
_QWORD *i; // rbx
int result; // eax
int *v5; // rbx
char *v6; // r8
int *v7; // rbx
char *v8; // r8

if ( a1 )
{
v1 = List_pop(*(_QWORD *)(a1 + 168));
v2 = (_QWORD *)v1;
if ( v1 )
{
for ( i = *(_QWORD **)(*(_QWORD *)v1 + 8LL); i; i = (_QWORD *)*i )
Object_release(_GC__, i[2]);
List_destroy(*v2);
result = Object_release(_GC__, v2);
}
else
{
v7 = _errno_location();
v8 = "None";
if ( *v7 )
v8 = strerror(*v7);
result = fprintf(stderr, "[ERROR] (%s:%d: errno: %s) There is no pool.\n", "src/cmm/arp.c", 25LL, v8);
*v7 = 0;
}
}
else
{
v5 = _errno_location();
v6 = "None";
if ( *v5 )
v6 = strerror(*v5);
result = fprintf(stderr, "[ERROR] (%s:%d: errno: %s) Argument 'gc' can't be NULL.\n", "src/cmm/arp.c", 22LL, v6);
*v5 = 0;
}
return result;
}

original_code:
void ARPool_release(GC *gc)
{
 if(!(gc)) { fprintf(stderr, "[ERROR] (%s:%d: errno: %s) " "Argument 'gc' can't be NULL." "\n", "src/cmm/arp.c", 22, ((*__errno_location ()) == 0 ? "None" : strerror((*__errno_location ())))); (*__errno_location ())=0; goto error; };
 ARPool *arp = List_pop(gc->arp_stack);
 if(!(arp)) { fprintf(stderr, "[ERROR] (%s:%d: errno: %s) " "There is no pool." "\n", "src/cmm/arp.c", 25, ((*__errno_location ()) == 0 ? "None" : strerror((*__errno_location ())))); (*__errno_location ())=0; goto error; };
 ListNode *_node = ((void *)0); ListNode *cur = ((void *)0); for(cur = _node = arp->pool->first; _node != ((void *)0); cur = _node = _node->next) {
  Object_release(__GC__, (void *)(cur->value));
 }
 List_destroy(arp->pool);
 Object_release(__GC__, (void *)(arp));
error:
 return;
}

canonical_original_code:
void ARPool_release(struct GC *gc)
{
 if(!(gc)) { fprintf(stderr, "[ERROR] (%s:%d: errno: %s) " "Argument 'gc' can't be NULL." "\n", "src/cmm/arp.c", 22, ((*__errno_location ()) == 0 ? "None" : strerror((*__errno_location ())))); (*__errno_location ())=0; goto error; };
 struct ARPool *arp = List_pop(gc->arp_stack);
 if(!(arp)) { fprintf(stderr, "[ERROR] (%s:%d: errno: %s) " "There is no pool." "\n", "src/cmm/arp.c", 25, ((*__errno_location ()) == 0 ? "None" : strerror((*__errno_location ())))); (*__errno_location ())=0; goto error; };
 struct ListNode *_node = ((void *)0); struct ListNode *cur = ((void *)0); for(cur = _node = arp->pool->first; _node != ((void *)0); cur = _node = _node->next) {
  Object_release(__GC__, (void *)(cur->value));
 }
 List_destroy(arp->pool);
 Object_release(__GC__, (void *)(arp));
error:
 return;
}

variable_types: struct GC { struct BottomIndex { struct BlockHeader { unsigned int size; short *map; void *block; unsigned char *marks; } **index; unsigned long key; struct BottomIndex *hash_link; } **top_index; struct BottomIndex *all_nils; unsigned int size_map[-1]; short *obj_map; struct Heap { void *low; void *high; } heap; struct List { int count; struct ListNode { struct ListNode *next; struct ListNode *prev; void *value; } *first; struct ListNode *last; } *block_list; struct List *block_freelist; struct List *freelists[-1]; struct List *arp_stack; } *


decompiled_code:
int __fastcall ARPool_autorelease(__int64 a1, __int64 a2)
{
__int64 v2; // rax
_QWORD *v3; // rax
int result; // eax
int *v5; // rbx
char *v6; // r8
int *v7; // rbx
char *v8; // r8

if ( a1 )
{
v2 = *(_QWORD *)(*(_QWORD *)(a1 + 168) + 16LL);
if ( v2 && (v3 = *(_QWORD **)(v2 + 16)) != 0LL )
{
result = List_push(*v3, a2);
}
else
{
v7 = _errno_location();
v8 = "None";
if ( *v7 )
v8 = strerror(*v7);
result = fprintf(stderr, "[ERROR] (%s:%d: errno: %s) There is no pool.\n", "src/cmm/arp.c", 42LL, v8);
*v7 = 0;
}
}
else
{
v5 = _errno_location();
v6 = "None";
if ( *v5 )
v6 = strerror(*v5);
result = fprintf(stderr, "[ERROR] (%s:%d: errno: %s) Argument 'gc' can't be NULL.\n", "src/cmm/arp.c", 39LL, v6);
*v5 = 0;
}
return result;
}

canonical_decompiled_code:
int __fastcall func2(__int64 a1, __int64 a2)
{
__int64 v2; // rax
_QWORD *v3; // rax
int result; // eax
int *v5; // rbx
char *v6; // r8
int *v7; // rbx
char *v8; // r8

if ( a1 )
{
v2 = *(_QWORD *)(*(_QWORD *)(a1 + 168) + 16LL);
if ( v2 && (v3 = *(_QWORD **)(v2 + 16)) != 0LL )
{
result = List_push(*v3, a2);
}
else
{
v7 = _errno_location();
v8 = "None";
if ( *v7 )
v8 = strerror(*v7);
result = fprintf(stderr, "[ERROR] (%s:%d: errno: %s) There is no pool.\n", "src/cmm/arp.c", 42LL, v8);
*v7 = 0;
}
}
else
{
v5 = _errno_location();
v6 = "None";
if ( *v5 )
v6 = strerror(*v5);
result = fprintf(stderr, "[ERROR] (%s:%d: errno: %s) Argument 'gc' can't be NULL.\n", "src/cmm/arp.c", 39LL, v6);
*v5 = 0;
}
return result;
}

original_code:
void ARPool_autorelease(GC *gc, void *obj)
{
 if(!(gc)) { fprintf(stderr, "[ERROR] (%s:%d: errno: %s) " "Argument 'gc' can't be NULL." "\n", "src/cmm/arp.c", 39, ((*__errno_location ()) == 0 ? "None" : strerror((*__errno_location ())))); (*__errno_location ())=0; goto error; };
 ARPool *arp = ((gc->arp_stack)->last != ((void *)0) ? (gc->arp_stack)->last->value : ((void *)0));
 if(!(arp)) { fprintf(stderr, "[ERROR] (%s:%d: errno: %s) " "There is no pool." "\n", "src/cmm/arp.c", 42, ((*__errno_location ()) == 0 ? "None" : strerror((*__errno_location ())))); (*__errno_location ())=0; goto error; };
 List_push(arp->pool, obj);
error:
 return;
}

canonical_original_code:
void ARPool_autorelease(struct GC *gc, void *obj)
{
 if(!(gc)) { fprintf(stderr, "[ERROR] (%s:%d: errno: %s) " "Argument 'gc' can't be NULL." "\n", "src/cmm/arp.c", 39, ((*__errno_location ()) == 0 ? "None" : strerror((*__errno_location ())))); (*__errno_location ())=0; goto error; };
 struct ARPool *arp = ((gc->arp_stack)->last != ((void *)0) ? (gc->arp_stack)->last->value : ((void *)0));
 if(!(arp)) { fprintf(stderr, "[ERROR] (%s:%d: errno: %s) " "There is no pool." "\n", "src/cmm/arp.c", 42, ((*__errno_location ()) == 0 ? "None" : strerror((*__errno_location ())))); (*__errno_location ())=0; goto error; };
 List_push(arp->pool, obj);
error:
 return;
}

variable_types:
obj
void *

user_defined_types: struct BlockHeader { unsigned int size; short *map; void *block; unsigned char *marks; }


decompiled_code:
int __fastcall ARPool_release_callback(_QWORD *a1)
{
*a1 = 0LL;
return ARPool_release(_GC__);
}

canonical_decompiled_code:
int __fastcall func3(_QWORD *a1)
{
*a1 = 0LL;
return func1(_GC__);
}

original_code:
void ARPool_release_callback(ARPool **arp)
{
 *arp = ((void *)0);
 ARPool_release(__GC__);
}

canonical_original_code:
void ARPool_release_callback(struct ARPool **arp)
{
 *arp = ((void *)0);
 ARPool_release(__GC__);
}

variable_types: struct ARPool { struct List { int count; struct ListNode { struct ListNode *next; struct ListNode *prev; void *value; } *first; struct ListNode *last; } *pool; } **


decompiled_code:
_BOOL8 __fastcall Object_validate(__int64 a1, __int64 a2)
{
__int64 v2; // rax
_BOOL4 v3; // ecx

v2 = GC_get_block_header();
v3 = 0;
if ( v2 && !*(_WORD *)(*(_QWORD *)(v2 + 8) + 2 * (((unsigned __int64)(a2 - 8) >> 3) & 0x3FF)) )
v3 = *(_QWORD *)(a2 - 8) != 0LL;
return v3;
}

original_code:
static inline int Object_validate(GC *gc, void *obj)
{
 BlockHeader *blkhdr = GC_get_block_header(gc, obj);
 ObjectHeader *objhdr = ((ObjectHeader *)(obj) - 1);
 if(blkhdr) {
  if(blkhdr->map[(((uintptr_t)(objhdr)) & ((18446744073709551615UL) >> (64 - 13))) >> 3] == 0) {
   return objhdr->ref_count > 0;
  }
 }
 return 0;
}

canonical_original_code:
static inline int Object_validate(struct GC *gc, void *obj)
{
 struct BlockHeader *blkhdr = GC_get_block_header(gc, obj);
 struct ObjectHeader *objhdr = ((ObjectHeader *)(obj) - 1);
 if(blkhdr) {
  if(blkhdr->map[(((unsigned long)(objhdr)) & ((18446744073709551615UL) >> (64 - 13))) >> 3] == 0) {
   return objhdr->ref_count > 0;
  }
 }
 return 0;
}

variable_types: struct BlockHeader { unsigned int size; short *map; void *block; unsigned char *marks; } *

variable_types: struct ObjectHeader { unsigned long ref_count; } *


decompiled_code:
int __fastcall Object_new(__int64 a1, __int64 a2, unsigned __int64 *a3)
{
int v4; // eax
unsigned __int16 v5; // bp
_DWORD *v6; // r13
int *v7; // rbx
char *v8; // r8
_QWORD *v9; // rax
__int64 v10; // rax
_QWORD *v11; // rax

if ( a1 )
{
Object_release_localalias(a1, *a3);
v4 = GC_get_size(a1, a2 + 8);
v5 = v4;
v6 = *(_DWORD **)(a1 + 8LL * v4 + 96);
if ( !*v6 )
{
if ( **(_DWORD **)(a1 + 88) || (GC_sweep(a1), **(_DWORD **)(a1 + 88)) )
{
v10 = List_pop();
GC_recycle_block(a1, v10, v5);
}
else
{
GC_allocate_block(a1, 1LL, v5);
}
}
v11 = (_QWORD *)List_shift(v6);
++*v11;
v9 = v11 + 1;
*a3 = (unsigned __int64)v9;
}
else
{
v7 = _errno_location();
v8 = "None";
if ( *v7 )
v8 = strerror(*v7);
LODWORD(v9) = fprintf(
stderr,
"[ERROR] (%s:%d: errno: %s) Argument 'gc' can't be NULL.\n",
"src/cmm/object.c",
20LL,
v8);
*v7 = 0;
}
return (int)v9;
}

canonical_decompiled_code:
int __fastcall func2(__int64 a1, __int64 a2, unsigned __int64 *a3)
{
int v4; // eax
unsigned __int16 v5; // bp
_DWORD *v6; // r13
int *v7; // rbx
char *v8; // r8
_QWORD *v9; // rax
__int64 v10; // rax
_QWORD *v11; // rax

if ( a1 )
{
func1(a1, *a3);
v4 = GC_get_size(a1, a2 + 8);
v5 = v4;
v6 = *(_DWORD **)(a1 + 8LL * v4 + 96);
if ( !*v6 )
{
if ( **(_DWORD **)(a1 + 88) || (GC_sweep(a1), **(_DWORD **)(a1 + 88)) )
{
v10 = List_pop();
GC_recycle_block(a1, v10, v5);
}
else
{
GC_allocate_block(a1, 1LL, v5);
}
}
v11 = (_QWORD *)List_shift(v6);
++*v11;
v9 = v11 + 1;
*a3 = (unsigned __int64)v9;
}
else
{
v7 = _errno_location();
v8 = "None";
if ( *v7 )
v8 = strerror(*v7);
LODWORD(v9) = fprintf(
stderr,
"[ERROR] (%s:%d: errno: %s) Argument 'gc' can't be NULL.\n",
"src/cmm/object.c",
20LL,
v8);
*v7 = 0;
}
return (int)v9;
}

original_code:
void Object_new(GC *gc, size_t type_size, void **obj)
{
 if(!(gc)) { fprintf(stderr, "[ERROR] (%s:%d: errno: %s) " "Argument 'gc' can't be NULL." "\n", "src/cmm/object.c", 20, ((*__errno_location ()) == 0 ? "None" : strerror((*__errno_location ())))); (*__errno_location ())=0; goto error; };
 Object_release(gc, *obj);
 int size_index = GC_get_size(gc, type_size + sizeof(ObjectHeader));
 List *freelist = gc->freelists[size_index];
 if(((freelist)->count) == 0) {
  if(((gc->block_freelist)->count) == 0) {
   GC_sweep(gc);
   if(((gc->block_freelist)->count) == 0) {
    GC_allocate_block(gc, 1, size_index);
   } else {
    GC_recycle_block(gc, List_pop(gc->block_freelist), size_index);
   }
  } else {
   GC_recycle_block(gc, List_pop(gc->block_freelist), size_index);
  }
 }
 ObjectHeader *objhdr = List_shift(freelist);
 (objhdr)->ref_count++;
 *obj = ((objhdr) + 1);
error:
 return;
}

canonical_original_code:
void Object_new(struct GC *gc, unsigned long type_size, void **obj)
{
 if(!(gc)) { fprintf(stderr, "[ERROR] (%s:%d: errno: %s) " "Argument 'gc' can't be NULL." "\n", "src/cmm/object.c", 20, ((*__errno_location ()) == 0 ? "None" : strerror((*__errno_location ())))); (*__errno_location ())=0; goto error; };
 Object_release(gc, *obj);
 int size_index = GC_get_size(gc, type_size + sizeof(ObjectHeader));
 struct List *freelist = gc->freelists[size_index];
 if(((freelist)->count) == 0) {
  if(((gc->block_freelist)->count) == 0) {
   GC_sweep(gc);
   if(((gc->block_freelist)->count) == 0) {
    GC_allocate_block(gc, 1, size_index);
   } else {
    GC_recycle_block(gc, List_pop(gc->block_freelist), size_index);
   }
  } else {
   GC_recycle_block(gc, List_pop(gc->block_freelist), size_index);
  }
 }
 struct ObjectHeader *objhdr = List_shift(freelist);
 (objhdr)->ref_count++;
 *obj = ((objhdr) + 1);
error:
 return;
}

variable_types:
obj
void **

user_defined_types: struct ObjectHeader { unsigned long ref_count; }


decompiled_code:
int __fastcall Object_copy(__int64 a1, unsigned __int64 *a2, __int64 a3)
{
int result; // eax
int *v5; // rbx
char *v6; // r8

if ( a1 )
{
if ( Object_validate(a1, a3) )
++*(_QWORD *)(a3 - 8);
result = Object_release_localalias(a1, *a2);
*a2 = a3;
}
else
{
v5 = _errno_location();
v6 = "None";
if ( *v5 )
v6 = strerror(*v5);
result = fprintf(stderr, "[ERROR] (%s:%d: errno: %s) Argument 'gc' can't be NULL.\n", "src/cmm/object.c", 74LL, v6);
*v5 = 0;
}
return result;
}

canonical_decompiled_code:
int __fastcall func3(__int64 a1, unsigned __int64 *a2, __int64 a3)
{
int result; // eax
int *v5; // rbx
char *v6; // r8

if ( a1 )
{
if ( func0(a1, a3) )
++*(_QWORD *)(a3 - 8);
result = func1(a1, *a2);
*a2 = a3;
}
else
{
v5 = _errno_location();
v6 = "None";
if ( *v5 )
v6 = strerror(*v5);
result = fprintf(stderr, "[ERROR] (%s:%d: errno: %s) Argument 'gc' can't be NULL.\n", "src/cmm/object.c", 74LL, v6);
*v5 = 0;
}
return result;
}

original_code:
void Object_copy(GC *gc, void **lobj, void *robj)
{
 if(!(gc)) { fprintf(stderr, "[ERROR] (%s:%d: errno: %s) " "Argument 'gc' can't be NULL." "\n", "src/cmm/object.c", 74, ((*__errno_location ()) == 0 ? "None" : strerror((*__errno_location ())))); (*__errno_location ())=0; goto error; };
 if(Object_validate(gc, robj)) {
  (((ObjectHeader *)(robj) - 1))->ref_count++;
 }
 Object_release(gc, *lobj);
 *lobj = robj;
error:
 return;
}

canonical_original_code:
void Object_copy(struct GC *gc, void **lobj, void *robj)
{
 if(!(gc)) { fprintf(stderr, "[ERROR] (%s:%d: errno: %s) " "Argument 'gc' can't be NULL." "\n", "src/cmm/object.c", 74, ((*__errno_location ()) == 0 ? "None" : strerror((*__errno_location ())))); (*__errno_location ())=0; goto error; };
 if(Object_validate(gc, robj)) {
  (((struct ObjectHeader *)(robj) - 1))->ref_count++;
 }
 Object_release(gc, *lobj);
 *lobj = robj;
error:
 return;
}

variable_types:
lobj
void **

variable_types:
robj
void *


decompiled_code:
__int64 __fastcall Object_retain_count(__int64 a1, __int64 a2)
{
__int64 result; // rax
int *v3; // rbx
char *v4; // r8

if ( a1 )
{
if ( Object_validate(a1, a2) )
result = *(unsigned int *)(a2 - 8);
else
result = 0xFFFFFFFFLL;
}
else
{
v3 = _errno_location();
v4 = "None";
if ( *v3 )
v4 = strerror(*v3);
fprintf(stderr, "[ERROR] (%s:%d: errno: %s) Argument 'gc' can't be NULL.\n", "src/cmm/object.c", 89LL, v4);
*v3 = 0;
result = 0xFFFFFFFFLL;
}
return result;
}

canonical_decompiled_code:
__int64 __fastcall func4(__int64 a1, __int64 a2)
{
__int64 result; // rax
int *v3; // rbx
char *v4; // r8

if ( a1 )
{
if ( func0(a1, a2) )
result = *(unsigned int *)(a2 - 8);
else
result = 0xFFFFFFFFLL;
}
else
{
v3 = _errno_location();
v4 = "None";
if ( *v3 )
v4 = strerror(*v3);
fprintf(stderr, "[ERROR] (%s:%d: errno: %s) Argument 'gc' can't be NULL.\n", "src/cmm/object.c", 89LL, v4);
*v3 = 0;
result = 0xFFFFFFFFLL;
}
return result;
}

original_code:
int Object_retain_count(GC *gc, void *obj)
{
 if(!(gc)) { fprintf(stderr, "[ERROR] (%s:%d: errno: %s) " "Argument 'gc' can't be NULL." "\n", "src/cmm/object.c", 89, ((*__errno_location ()) == 0 ? "None" : strerror((*__errno_location ())))); (*__errno_location ())=0; goto error; };
 if(Object_validate(gc, obj)) {
  return ((ObjectHeader *)(obj) - 1)->ref_count;
 }
error:
 return -1;
}

canonical_original_code:
int Object_retain_count(struct GC *gc, void *obj)
{
 if(!(gc)) { fprintf(stderr, "[ERROR] (%s:%d: errno: %s) " "Argument 'gc' can't be NULL." "\n", "src/cmm/object.c", 89, ((*__errno_location ()) == 0 ? "None" : strerror((*__errno_location ())))); (*__errno_location ())=0; goto error; };
 if(Object_validate(gc, obj)) {
  return ((struct ObjectHeader *)(obj) - 1)->ref_count;
 }
error:
 return -1;
}


repo: OlinElecanisms/first-day-c

decompiled_code:
int __cdecl main(int argc, const char **argv, const char **envp)
{
puts("Hello World!");
return 1;
}

original_code:
int32_t main(void) {
    printf("Hello World!\n");
    return 1;
}

canonical_original_code:
int main() {
    printf("Hello World!\n");
    return 1;
}


repo: Onway/anoj

decompiled_code:
struct passwd *init_varible()
{
__int64 v0; // rbp
_DWORD *v1; // rax
__int64 v2; // rbx
struct passwd *result; // rax

input = g_string_new(&unk_DAC);
output = g_string_new(&unk_DAC);
v0 = g_string_new(&unk_DAC);
answer = v0;
v1 = malloc(0x20uLL);
::result = (__int64)v1;
if ( input && v0 != 0 && output != 0 && v1 )
{
*v1 = 7;
v1[2] = 0;
v1[1] = 0;
*((_QWORD *)v1 + 2) = g_string_new(&unk_DAC);
v2 = ::result;
*(_QWORD *)(v2 + 24) = g_string_new(&unk_DAC);
if ( *(_QWORD *)(::result + 16) && *(_QWORD *)(::result + 24) )
{
result = getpwnam("nobody");
pwd = (__int64)result;
if ( result )
return result;
g_assertion_message_expr(0LL, "main.c", 87LL, "init_varible", &unk_DAD);
}
g_assertion_message_expr(0LL, "main.c", 84LL, "init_varible", "result->msg && result->err");
}
g_assertion_message_expr(0LL, "main.c", 78LL, "init_varible", "input && output && answer && result");
return (struct passwd *)exit_func();
}

canonical_decompiled_code:
struct passwd *func0()
{
__int64 v0; // rbp
_DWORD *v1; // rax
__int64 v2; // rbx
struct passwd *result; // rax

input = g_string_new(&unk_DAC);
output = g_string_new(&unk_DAC);
v0 = g_string_new(&unk_DAC);
answer = v0;
v1 = malloc(0x20uLL);
::result = (__int64)v1;
if ( input && v0 != 0 && output != 0 && v1 )
{
*v1 = 7;
v1[2] = 0;
v1[1] = 0;
*((_QWORD *)v1 + 2) = g_string_new(&unk_DAC);
v2 = ::result;
*(_QWORD *)(v2 + 24) = g_string_new(&unk_DAC);
if ( *(_QWORD *)(::result + 16) && *(_QWORD *)(::result + 24) )
{
result = getpwnam("nobody");
pwd = (__int64)result;
if ( result )
return result;
g_assertion_message_expr(0LL, "main.c", 87LL, "init_varible", &unk_DAD);
}
g_assertion_message_expr(0LL, "main.c", 84LL, "init_varible", "result->msg && result->err");
}
g_assertion_message_expr(0LL, "main.c", 78LL, "init_varible", "input && output && answer && result");
return (struct passwd *)func1();
}

original_code:
static void
init_varible()
{
    input = g_string_new("");
    output = g_string_new("");
    answer = g_string_new("");
    result = (Result *)malloc(sizeof(Result));
    do { if (input && output && answer && result) ; else g_assertion_message_expr (((gchar*) 0), "main.c", 78, ((const char*) (__func__)), "input && output && answer && result"); } while (0);
    result->code = EXIT_IE;
    result->time = result->memory = 0;
    result->msg = g_string_new("");
    result->err = g_string_new("");
    do { if (result->msg && result->err) ; else g_assertion_message_expr (((gchar*) 0), "main.c", 84, ((const char*) (__func__)), "result->msg && result->err"); } while (0);
    pwd = getpwnam("nobody");
    do { if (pwd) ; else g_assertion_message_expr (((gchar*) 0), "main.c", 87, ((const char*) (__func__)), "pwd"); } while (0);
}

canonical_original_code:
static void init_varible()
{
    input = g_string_new("");
    output = g_string_new("");
    answer = g_string_new("");
    result = (struct Result *)malloc(sizeof(Result));
    do { if (input && output && answer && result) ; else g_assertion_message_expr (((char *) 0), "main.c", 78, ((char *) (__func__)), "input && output && answer && result"); } while (0);
    result->code = EXIT_IE;
    result->time = result->memory = 0;
    result->msg = g_string_new("");
    result->err = g_string_new("");
    do { if (result->msg && result->err) ; else g_assertion_message_expr (((char *) 0), "main.c", 84, ((char *) (__func__)), "result->msg && result->err"); } while (0);
    pwd = getpwnam("nobody");
    do { if (pwd) ; else g_assertion_message_expr (((char *) 0), "main.c", 87, ((char *) (__func__)), "pwd"); } while (0);
}

user_defined_types: struct Result { enum Status code; int time; int memory; struct _GString *msg; struct _GString *err; }

user_defined_types: enum Status { EXIT_AC=0, EXIT_PE=1, EXIT_WA=2, EXIT_RE=3, EXIT_TLE=4, EXIT_MLE=5, EXIT_OLE=6, EXIT_IE=7 }

user_defined_types: struct _GString { char *str; unsigned long len; unsigned long allocated_len; }


decompiled_code:
void exit_func()
{
printf("result:");
switch ( *(_DWORD *)result )
{
case 0:
puts("Accetped");
break;
case 1:
puts("Presentation Error");
break;
case 2:
puts("Wrong Answer");
break;
case 3:
puts("Runtime Error");
break;
case 4:
puts("Time Limit Exceeded");
break;
case 5:
puts("Memory Limit Exceeded");
break;
case 6:
puts("Output Limit Exceeded");
break;
case 7:
puts("Internal Error");
break;
default:
break;
}
printf("time:%d\n", *(unsigned int *)(result + 4));
printf("memory:%d\n", *(unsigned int *)(result + 8));
printf("msg:%s\n", **(const char ***)(result + 16));
printf("debug:%s\n", **(const char ***)(result + 24));
exit(0);
}

canonical_decompiled_code:
void func1()
{
printf("result:");
switch ( *(_DWORD *)result )
{
case 0:
puts("Accetped");
break;
case 1:
puts("Presentation Error");
break;
case 2:
puts("Wrong Answer");
break;
case 3:
puts("Runtime Error");
break;
case 4:
puts("Time Limit Exceeded");
break;
case 5:
puts("Memory Limit Exceeded");
break;
case 6:
puts("Output Limit Exceeded");
break;
case 7:
puts("Internal Error");
break;
default:
break;
}
printf("time:%d\n", *(unsigned int *)(result + 4));
printf("memory:%d\n", *(unsigned int *)(result + 8));
printf("msg:%s\n", **(const char ***)(result + 16));
printf("debug:%s\n", **(const char ***)(result + 24));
exit(0);
}

original_code:
static void
exit_func()
{
    printf("result:");
    switch(result->code) {
        case EXIT_AC : printf("Accetped\n");
                       break;
        case EXIT_PE : printf("Presentation Error\n");
                       break;
        case EXIT_WA : printf("Wrong Answer\n");
                       break;
        case EXIT_RE : printf("Runtime Error\n");
                       break;
        case EXIT_IE : printf("Internal Error\n");
                       break;
        case EXIT_TLE : printf("Time Limit Exceeded\n");
                        break;
        case EXIT_MLE : printf("Memory Limit Exceeded\n");
                        break;
        case EXIT_OLE : printf("Output Limit Exceeded\n");
                        break;
    }
    printf("time:%d\n", result->time);
    printf("memory:%d\n", result->memory);
    printf("msg:%s\n", result->msg->str);
    printf("debug:%s\n", result->err->str);
    exit(0);
}


decompiled_code:
int __cdecl main(int argc, const char **argv, const char **envp)
{
const char *v3; // rdi
int v4; // ebx
int v5; // ebp
__int64 v6; // rdi
int v7; // eax
bool v8; // cf
bool v9; // zf
const char *v10; // rsi
__int64 v11; // rcx
char *v12; // rdi
const char **v14; // [rsp+0h] [rbp-B8h] BYREF
int v15; // [rsp+Ch] [rbp-ACh] BYREF
struct stat v16; // [rsp+10h] [rbp-A8h] BYREF

v15 = argc;
v14 = argv;
init_varible();
if ( !(unsigned int)parse_cmdline(&v15, &v14) || !(unsigned int)parse_data(&v15) )
exit_func();
v3 = "java";
if ( strcmp("java", lang) )
init_conf("java");
v4 = 0;
v5 = 0;
while ( 1 )
{
v7 = next_data(v3);
v8 = 0;
v9 = v7 == 0;
if ( !v7 )
goto LABEL_26;
v10 = "java";
v11 = 5LL;
v12 = lang;
do
{
if ( !v11 )
break;
v8 = (unsigned int)*v10 < (unsigned __int8)*v12;
v9 = *v10++ == (unsigned __int8)*v12++;
--v11;
}
while ( v9 );
if ( (!v8 && !v9) == v8 )
execute_jcommand(v12);
else
execute_command(v12, v10);
if ( *(_DWORD *)result )
break;
v6 = *(_QWORD *)answer;
stat(*(const char **)answer, &v16);
if ( (v16.st_mode & 1) == 0 )
goto LABEL_9;
special_judge(v6);
LABEL_10:
if ( *(_DWORD *)result )
{
unlink(*(const char **)output);
exit_func();
LABEL_26:
*(_DWORD *)(result + 4) = v5;
*(_DWORD *)(result + 8) = v4;
exit_func();
JUMPOUT(0x3DFLL);
}
if ( v5 < *(_DWORD *)(result + 4) )
v5 = *(_DWORD *)(result + 4);
if ( v4 < *(_DWORD *)(result + 8) )
v4 = *(_DWORD *)(result + 8);
v3 = *(const char **)output;
unlink(*(const char **)output);
}
v6 = *(_QWORD *)output;
unlink(*(const char **)output);
exit_func();
LABEL_9:
normal_judge(v6);
goto LABEL_10;
}

canonical_decompiled_code:
int __cdecl main(int argc, const char **argv, const char **envp)
{
const char *v3; // rdi
int v4; // ebx
int v5; // ebp
__int64 v6; // rdi
int v7; // eax
bool v8; // cf
bool v9; // zf
const char *v10; // rsi
__int64 v11; // rcx
char *v12; // rdi
const char **v14; // [rsp+0h] [rbp-B8h] BYREF
int v15; // [rsp+Ch] [rbp-ACh] BYREF
struct stat v16; // [rsp+10h] [rbp-A8h] BYREF

v15 = argc;
v14 = argv;
func0();
if ( !(unsigned int)parse_cmdline(&v15, &v14) || !(unsigned int)parse_data(&v15) )
func1();
v3 = "java";
if ( strcmp("java", lang) )
init_conf("java");
v4 = 0;
v5 = 0;
while ( 1 )
{
v7 = next_data(v3);
v8 = 0;
v9 = v7 == 0;
if ( !v7 )
goto LABEL_26;
v10 = "java";
v11 = 5LL;
v12 = lang;
do
{
if ( !v11 )
break;
v8 = (unsigned int)*v10 < (unsigned __int8)*v12;
v9 = *v10++ == (unsigned __int8)*v12++;
--v11;
}
while ( v9 );
if ( (!v8 && !v9) == v8 )
execute_jcommand(v12);
else
execute_command(v12, v10);
if ( *(_DWORD *)result )
break;
v6 = *(_QWORD *)answer;
stat(*(const char **)answer, &v16);
if ( (v16.st_mode & 1) == 0 )
goto LABEL_9;
special_judge(v6);
LABEL_10:
if ( *(_DWORD *)result )
{
unlink(*(const char **)output);
func1();
LABEL_26:
*(_DWORD *)(result + 4) = v5;
*(_DWORD *)(result + 8) = v4;
func1();
JUMPOUT(0x3DFLL);
}
if ( v5 < *(_DWORD *)(result + 4) )
v5 = *(_DWORD *)(result + 4);
if ( v4 < *(_DWORD *)(result + 8) )
v4 = *(_DWORD *)(result + 8);
v3 = *(const char **)output;
unlink(*(const char **)output);
}
v6 = *(_QWORD *)output;
unlink(*(const char **)output);
func1();
LABEL_9:
normal_judge(v6);
goto LABEL_10;
}

original_code:
int
main(int argc, char *argv[])
{
    struct stat sbuf;
    int max_time, max_memory;
    init_varible();
    max_time = max_memory = 0;
    if (!parse_cmdline(&argc, &argv) || !parse_data())
        exit_func();
    strcmp("java", lang) && init_conf();
    while (next_data()) {
        strcmp("java", lang) ? execute_command() : execute_jcommand();
        result->code != EXIT_AC ? unlink(output->str), exit_func() : 1;
        stat(answer->str, &sbuf);
        sbuf.st_mode & ((0100 >> 3) >> 3) ? special_judge() : normal_judge();
        result->code != EXIT_AC ? unlink(output->str), exit_func() : 1;
        max_time = (((max_time) > (result->time)) ? (max_time) : (result->time));
        max_memory = (((max_memory) > (result->memory)) ? (max_memory) : (result->memory));
        unlink(output->str);
    }
    result->time = max_time;
    result->memory = max_memory;
    exit_func();
    return 0;
}

canonical_original_code:
int main(int argc, char *argv[])
{
    struct stat sbuf;
    int max_time; int max_memory;
    init_varible();
    max_time = max_memory = 0;
    if (!parse_cmdline(&argc, &argv) || !parse_data())
        exit_func();
    strcmp("java", lang) && init_conf();
    while (next_data()) {
        strcmp("java", lang) ? execute_command() : execute_jcommand();
        result->code != EXIT_AC ? unlink(output->str), exit_func() : 1;
        stat(answer->str, &sbuf);
        sbuf.st_mode & ((0100 >> 3) >> 3) ? special_judge() : normal_judge();
        result->code != EXIT_AC ? unlink(output->str), exit_func() : 1;
        max_time = (((max_time) > (result->time)) ? (max_time) : (result->time));
        max_memory = (((max_memory) > (result->memory)) ? (max_memory) : (result->memory));
        unlink(output->str);
    }
    result->time = max_time;
    result->memory = max_memory;
    exit_func();
    return 0;
}

variable_types: argc int

variable_types:
argv
char *[]

variable_types: struct stat { unsigned long st_dev; unsigned long st_ino; unsigned long st_nlink; unsigned int st_mode; unsigned int st_uid; unsigned int st_gid; int __pad0; unsigned long st_rdev; long st_size; long st_blksize; long st_blocks; struct timespec { long tv_sec; long tv_nsec; } st_atim; struct timespec st_mtim; struct timespec st_ctim; long __glibc_reserved[3]; }

user_defined_types: struct stat { unsigned long st_dev; unsigned long st_ino; unsigned long st_nlink; unsigned int st_mode; unsigned int st_uid; unsigned int st_gid; int __pad0; unsigned long st_rdev; long st_size; long st_blksize; long st_blocks; struct timespec st_atim; struct timespec st_mtim; struct timespec st_ctim; long __glibc_reserved[3]; }


decompiled_code:
void init_signal_rule()
{
signal_rule[24] = 2;
signal_rule[25] = 2;
signal_rule[1] = 2;
signal_rule[2] = 2;
signal_rule[3] = 2;
signal_rule[4] = 2;
signal_rule[6] = 2;
signal_rule[7] = 2;
signal_rule[8] = 2;
signal_rule[11] = 2;
signal_rule[13] = 2;
signal_rule[14] = 2;
signal_rule[15] = 2;
signal_rule[16] = 2;
signal_rule[17] = 2;
signal_rule[18] = 2;
signal_rule[20] = 2;
signal_rule[21] = 2;
signal_rule[22] = 2;
signal_rule[23] = 2;
signal_rule[26] = 2;
signal_rule[27] = 2;
signal_rule[28] = 2;
signal_rule[29] = 2;
signal_rule[30] = 2;
signal_rule[31] = 2;
}

canonical_decompiled_code:
void func0()
{
signal_rule[24] = 2;
signal_rule[25] = 2;
signal_rule[1] = 2;
signal_rule[2] = 2;
signal_rule[3] = 2;
signal_rule[4] = 2;
signal_rule[6] = 2;
signal_rule[7] = 2;
signal_rule[8] = 2;
signal_rule[11] = 2;
signal_rule[13] = 2;
signal_rule[14] = 2;
signal_rule[15] = 2;
signal_rule[16] = 2;
signal_rule[17] = 2;
signal_rule[18] = 2;
signal_rule[20] = 2;
signal_rule[21] = 2;
signal_rule[22] = 2;
signal_rule[23] = 2;
signal_rule[26] = 2;
signal_rule[27] = 2;
signal_rule[28] = 2;
signal_rule[29] = 2;
signal_rule[30] = 2;
signal_rule[31] = 2;
}

original_code:
static void
init_signal_rule()
{
    signal_rule[24] = SIG_TERMINATE;
    signal_rule[25] = SIG_TERMINATE;
    signal_rule[1] = SIG_TERMINATE;
    signal_rule[2] = SIG_TERMINATE;
    signal_rule[3] = SIG_TERMINATE;
    signal_rule[4] = SIG_TERMINATE;
    signal_rule[6] = SIG_TERMINATE;
    signal_rule[7] = SIG_TERMINATE;
    signal_rule[8] = SIG_TERMINATE;
    signal_rule[11] = SIG_TERMINATE;
    signal_rule[13] = SIG_TERMINATE;
    signal_rule[14] = SIG_TERMINATE;
    signal_rule[15] = SIG_TERMINATE;
    signal_rule[16] = SIG_TERMINATE;
    signal_rule[17] = SIG_TERMINATE;
    signal_rule[18] = SIG_TERMINATE;
    signal_rule[20] = SIG_TERMINATE;
    signal_rule[21] = SIG_TERMINATE;
    signal_rule[22] = SIG_TERMINATE;
    signal_rule[23] = SIG_TERMINATE;
    signal_rule[26] = SIG_TERMINATE;
    signal_rule[27] = SIG_TERMINATE;
    signal_rule[28] = SIG_TERMINATE;
    signal_rule[29] = SIG_TERMINATE;
    signal_rule[30] = SIG_TERMINATE;
    signal_rule[31] = SIG_TERMINATE;
}


decompiled_code:
void init_syscall_rule()
{
syscall_rule[156] = 0;
syscall_rule[21] = 1;
syscall_rule[163] = 0;
syscall_rule[248] = 0;
syscall_rule[159] = 1;
syscall_rule[183] = 0;
syscall_rule[37] = 1;
syscall_rule[12] = 1;
syscall_rule[125] = 1;
syscall_rule[126] = 1;
syscall_rule[80] = 1;
syscall_rule[90] = 1;
syscall_rule[92] = 1;
syscall_rule[161] = 1;
syscall_rule[305] = 1;
syscall_rule[229] = 1;
syscall_rule[228] = 1;
syscall_rule[230] = 1;
syscall_rule[227] = 1;
syscall_rule[56] = 0;
syscall_rule[3] = 1;
syscall_rule[85] = 0;
syscall_rule[174] = 0;
syscall_rule[176] = 0;
syscall_rule[32] = 0;
syscall_rule[33] = 0;
syscall_rule[292] = 0;
syscall_rule[213] = 1;
syscall_rule[291] = 1;
syscall_rule[233] = 1;
syscall_rule[281] = 1;
syscall_rule[232] = 1;
syscall_rule[284] = 0;
syscall_rule[290] = 0;
syscall_rule[59] = 0;
syscall_rule[60] = 1;
syscall_rule[231] = 1;
syscall_rule[269] = 1;
syscall_rule[221] = 1;
syscall_rule[285] = 0;
syscall_rule[300] = 0;
syscall_rule[301] = 0;
syscall_rule[81] = 1;
syscall_rule[91] = 1;
syscall_rule[268] = 1;
syscall_rule[93] = 1;
syscall_rule[260] = 1;
syscall_rule[72] = 1;
syscall_rule[75] = 1;
syscall_rule[193] = 1;
syscall_rule[196] = 1;
syscall_rule[73] = 1;
syscall_rule[57] = 0;
syscall_rule[199] = 0;
syscall_rule[190] = 0;
syscall_rule[5] = 1;
syscall_rule[138] = 1;
syscall_rule[74] = 1;
syscall_rule[77] = 0;
syscall_rule[202] = 1;
syscall_rule[261] = 0;
syscall_rule[177] = 0;
syscall_rule[239] = 0;
syscall_rule[274] = 1;
syscall_rule[211] = 1;
syscall_rule[309] = 0;
syscall_rule[79] = 1;
syscall_rule[78] = 1;
syscall_rule[217] = 1;
syscall_rule[108] = 1;
syscall_rule[107] = 1;
syscall_rule[104] = 1;
syscall_rule[115] = 1;
syscall_rule[36] = 1;
syscall_rule[121] = 1;
syscall_rule[111] = 1;
syscall_rule[39] = 1;
syscall_rule[181] = 0;
syscall_rule[110] = 1;
syscall_rule[140] = 1;
syscall_rule[120] = 1;
syscall_rule[118] = 1;
syscall_rule[97] = 1;
syscall_rule[98] = 1;
syscall_rule[124] = 1;
syscall_rule[186] = 1;
syscall_rule[96] = 1;
syscall_rule[102] = 1;
syscall_rule[191] = 0;
syscall_rule[175] = 0;
syscall_rule[254] = 0;
syscall_rule[253] = 0;
syscall_rule[294] = 0;
syscall_rule[255] = 0;
syscall_rule[210] = 0;
syscall_rule[207] = 0;
syscall_rule[208] = 0;
syscall_rule[206] = 0;
syscall_rule[209] = 0;
syscall_rule[16] = 1;
syscall_rule[173] = 0;
syscall_rule[172] = 0;
syscall_rule[252] = 0;
syscall_rule[251] = 0;
syscall_rule[246] = 0;
syscall_rule[250] = 1;
syscall_rule[62] = 0;
syscall_rule[94] = 1;
syscall_rule[192] = 0;
syscall_rule[86] = 0;
syscall_rule[265] = 1;
syscall_rule[194] = 0;
syscall_rule[195] = 0;
syscall_rule[212] = 0;
syscall_rule[198] = 0;
syscall_rule[8] = 1;
syscall_rule[189] = 0;
syscall_rule[6] = 1;
syscall_rule[28] = 0;
syscall_rule[237] = 0;
syscall_rule[256] = 0;
syscall_rule[27] = 1;
syscall_rule[83] = 0;
syscall_rule[258] = 0;
syscall_rule[133] = 0;
syscall_rule[259] = 0;
syscall_rule[149] = 1;
syscall_rule[151] = 1;
syscall_rule[9] = 1;
syscall_rule[154] = 0;
syscall_rule[165] = 0;
syscall_rule[279] = 0;
syscall_rule[10] = 1;
syscall_rule[245] = 0;
syscall_rule[244] = 0;
syscall_rule[240] = 0;
syscall_rule[243] = 0;
syscall_rule[242] = 0;
syscall_rule[241] = 0;
syscall_rule[25] = 1;
syscall_rule[26] = 1;
syscall_rule[150] = 1;
syscall_rule[152] = 1;
syscall_rule[11] = 1;
syscall_rule[303] = 0;
syscall_rule[35] = 1;
syscall_rule[180] = 0;
syscall_rule[2] = 1;
syscall_rule[304] = 0;
syscall_rule[257] = 1;
syscall_rule[34] = 1;
syscall_rule[298] = 0;
syscall_rule[135] = 0;
syscall_rule[22] = 1;
syscall_rule[293] = 1;
syscall_rule[155] = 0;
syscall_rule[7] = 1;
syscall_rule[271] = 1;
syscall_rule[157] = 0;
syscall_rule[158] = 1;
syscall_rule[17] = 1;
syscall_rule[295] = 1;
syscall_rule[302] = 1;
syscall_rule[310] = 1;
syscall_rule[311] = 1;
syscall_rule[270] = 1;
syscall_rule[101] = 0;
syscall_rule[182] = 0;
syscall_rule[18] = 1;
syscall_rule[296] = 1;
syscall_rule[178] = 0;
syscall_rule[179] = 0;
syscall_rule[0] = 1;
syscall_rule[187] = 1;
syscall_rule[89] = 1;
syscall_rule[267] = 1;
syscall_rule[19] = 1;
syscall_rule[169] = 0;
syscall_rule[299] = 1;
syscall_rule[216] = 0;
syscall_rule[197] = 0;
syscall_rule[82] = 0;
syscall_rule[264] = 0;
syscall_rule[249] = 0;
syscall_rule[219] = 0;
syscall_rule[84] = 0;
syscall_rule[13] = 1;
syscall_rule[127] = 1;
syscall_rule[14] = 1;
syscall_rule[129] = 1;
syscall_rule[15] = 1;
syscall_rule[130] = 1;
syscall_rule[128] = 1;
syscall_rule[297] = 1;
syscall_rule[146] = 0;
syscall_rule[147] = 0;
syscall_rule[204] = 0;
syscall_rule[143] = 0;
syscall_rule[145] = 0;
syscall_rule[148] = 0;
syscall_rule[203] = 0;
syscall_rule[142] = 0;
syscall_rule[144] = 0;
syscall_rule[24] = 0;
syscall_rule[23] = 1;
syscall_rule[40] = 1;
syscall_rule[307] = 0;
syscall_rule[238] = 0;
syscall_rule[273] = 1;
syscall_rule[205] = 1;
syscall_rule[218] = 1;
syscall_rule[171] = 0;
syscall_rule[123] = 0;
syscall_rule[122] = 0;
syscall_rule[106] = 1;
syscall_rule[116] = 1;
syscall_rule[170] = 0;
syscall_rule[38] = 1;
syscall_rule[308] = 0;
syscall_rule[109] = 0;
syscall_rule[141] = 0;
syscall_rule[114] = 1;
syscall_rule[119] = 1;
syscall_rule[117] = 1;
syscall_rule[113] = 1;
syscall_rule[160] = 1;
syscall_rule[112] = 0;
syscall_rule[164] = 1;
syscall_rule[105] = 1;
syscall_rule[188] = 0;
syscall_rule[131] = 1;
syscall_rule[282] = 1;
syscall_rule[289] = 1;
syscall_rule[275] = 1;
syscall_rule[4] = 1;
syscall_rule[137] = 1;
syscall_rule[168] = 0;
syscall_rule[167] = 0;
syscall_rule[88] = 0;
syscall_rule[266] = 0;
syscall_rule[162] = 1;
syscall_rule[277] = 1;
syscall_rule[306] = 1;
syscall_rule[139] = 1;
syscall_rule[99] = 1;
syscall_rule[103] = 0;
syscall_rule[276] = 1;
syscall_rule[234] = 1;
syscall_rule[201] = 1;
syscall_rule[222] = 1;
syscall_rule[226] = 1;
syscall_rule[225] = 1;
syscall_rule[224] = 1;
syscall_rule[223] = 1;
syscall_rule[283] = 1;
syscall_rule[287] = 1;
syscall_rule[286] = 1;
syscall_rule[100] = 1;
syscall_rule[200] = 1;
syscall_rule[76] = 0;
syscall_rule[95] = 0;
syscall_rule[166] = 0;
syscall_rule[63] = 1;
syscall_rule[87] = 0;
syscall_rule[263] = 0;
syscall_rule[272] = 1;
syscall_rule[134] = 1;
syscall_rule[136] = 1;
syscall_rule[132] = 1;
syscall_rule[280] = 1;
syscall_rule[235] = 1;
syscall_rule[58] = 0;
syscall_rule[153] = 0;
syscall_rule[278] = 0;
syscall_rule[236] = 0;
syscall_rule[61] = 1;
syscall_rule[247] = 1;
syscall_rule[1] = 1;
syscall_rule[20] = 1;
}

canonical_decompiled_code:
void func1()
{
syscall_rule[156] = 0;
syscall_rule[21] = 1;
syscall_rule[163] = 0;
syscall_rule[248] = 0;
syscall_rule[159] = 1;
syscall_rule[183] = 0;
syscall_rule[37] = 1;
syscall_rule[12] = 1;
syscall_rule[125] = 1;
syscall_rule[126] = 1;
syscall_rule[80] = 1;
syscall_rule[90] = 1;
syscall_rule[92] = 1;
syscall_rule[161] = 1;
syscall_rule[305] = 1;
syscall_rule[229] = 1;
syscall_rule[228] = 1;
syscall_rule[230] = 1;
syscall_rule[227] = 1;
syscall_rule[56] = 0;
syscall_rule[3] = 1;
syscall_rule[85] = 0;
syscall_rule[174] = 0;
syscall_rule[176] = 0;
syscall_rule[32] = 0;
syscall_rule[33] = 0;
syscall_rule[292] = 0;
syscall_rule[213] = 1;
syscall_rule[291] = 1;
syscall_rule[233] = 1;
syscall_rule[281] = 1;
syscall_rule[232] = 1;
syscall_rule[284] = 0;
syscall_rule[290] = 0;
syscall_rule[59] = 0;
syscall_rule[60] = 1;
syscall_rule[231] = 1;
syscall_rule[269] = 1;
syscall_rule[221] = 1;
syscall_rule[285] = 0;
syscall_rule[300] = 0;
syscall_rule[301] = 0;
syscall_rule[81] = 1;
syscall_rule[91] = 1;
syscall_rule[268] = 1;
syscall_rule[93] = 1;
syscall_rule[260] = 1;
syscall_rule[72] = 1;
syscall_rule[75] = 1;
syscall_rule[193] = 1;
syscall_rule[196] = 1;
syscall_rule[73] = 1;
syscall_rule[57] = 0;
syscall_rule[199] = 0;
syscall_rule[190] = 0;
syscall_rule[5] = 1;
syscall_rule[138] = 1;
syscall_rule[74] = 1;
syscall_rule[77] = 0;
syscall_rule[202] = 1;
syscall_rule[261] = 0;
syscall_rule[177] = 0;
syscall_rule[239] = 0;
syscall_rule[274] = 1;
syscall_rule[211] = 1;
syscall_rule[309] = 0;
syscall_rule[79] = 1;
syscall_rule[78] = 1;
syscall_rule[217] = 1;
syscall_rule[108] = 1;
syscall_rule[107] = 1;
syscall_rule[104] = 1;
syscall_rule[115] = 1;
syscall_rule[36] = 1;
syscall_rule[121] = 1;
syscall_rule[111] = 1;
syscall_rule[39] = 1;
syscall_rule[181] = 0;
syscall_rule[110] = 1;
syscall_rule[140] = 1;
syscall_rule[120] = 1;
syscall_rule[118] = 1;
syscall_rule[97] = 1;
syscall_rule[98] = 1;
syscall_rule[124] = 1;
syscall_rule[186] = 1;
syscall_rule[96] = 1;
syscall_rule[102] = 1;
syscall_rule[191] = 0;
syscall_rule[175] = 0;
syscall_rule[254] = 0;
syscall_rule[253] = 0;
syscall_rule[294] = 0;
syscall_rule[255] = 0;
syscall_rule[210] = 0;
syscall_rule[207] = 0;
syscall_rule[208] = 0;
syscall_rule[206] = 0;
syscall_rule[209] = 0;
syscall_rule[16] = 1;
syscall_rule[173] = 0;
syscall_rule[172] = 0;
syscall_rule[252] = 0;
syscall_rule[251] = 0;
syscall_rule[246] = 0;
syscall_rule[250] = 1;
syscall_rule[62] = 0;
syscall_rule[94] = 1;
syscall_rule[192] = 0;
syscall_rule[86] = 0;
syscall_rule[265] = 1;
syscall_rule[194] = 0;
syscall_rule[195] = 0;
syscall_rule[212] = 0;
syscall_rule[198] = 0;
syscall_rule[8] = 1;
syscall_rule[189] = 0;
syscall_rule[6] = 1;
syscall_rule[28] = 0;
syscall_rule[237] = 0;
syscall_rule[256] = 0;
syscall_rule[27] = 1;
syscall_rule[83] = 0;
syscall_rule[258] = 0;
syscall_rule[133] = 0;
syscall_rule[259] = 0;
syscall_rule[149] = 1;
syscall_rule[151] = 1;
syscall_rule[9] = 1;
syscall_rule[154] = 0;
syscall_rule[165] = 0;
syscall_rule[279] = 0;
syscall_rule[10] = 1;
syscall_rule[245] = 0;
syscall_rule[244] = 0;
syscall_rule[240] = 0;
syscall_rule[243] = 0;
syscall_rule[242] = 0;
syscall_rule[241] = 0;
syscall_rule[25] = 1;
syscall_rule[26] = 1;
syscall_rule[150] = 1;
syscall_rule[152] = 1;
syscall_rule[11] = 1;
syscall_rule[303] = 0;
syscall_rule[35] = 1;
syscall_rule[180] = 0;
syscall_rule[2] = 1;
syscall_rule[304] = 0;
syscall_rule[257] = 1;
syscall_rule[34] = 1;
syscall_rule[298] = 0;
syscall_rule[135] = 0;
syscall_rule[22] = 1;
syscall_rule[293] = 1;
syscall_rule[155] = 0;
syscall_rule[7] = 1;
syscall_rule[271] = 1;
syscall_rule[157] = 0;
syscall_rule[158] = 1;
syscall_rule[17] = 1;
syscall_rule[295] = 1;
syscall_rule[302] = 1;
syscall_rule[310] = 1;
syscall_rule[311] = 1;
syscall_rule[270] = 1;
syscall_rule[101] = 0;
syscall_rule[182] = 0;
syscall_rule[18] = 1;
syscall_rule[296] = 1;
syscall_rule[178] = 0;
syscall_rule[179] = 0;
syscall_rule[0] = 1;
syscall_rule[187] = 1;
syscall_rule[89] = 1;
syscall_rule[267] = 1;
syscall_rule[19] = 1;
syscall_rule[169] = 0;
syscall_rule[299] = 1;
syscall_rule[216] = 0;
syscall_rule[197] = 0;
syscall_rule[82] = 0;
syscall_rule[264] = 0;
syscall_rule[249] = 0;
syscall_rule[219] = 0;
syscall_rule[84] = 0;
syscall_rule[13] = 1;
syscall_rule[127] = 1;
syscall_rule[14] = 1;
syscall_rule[129] = 1;
syscall_rule[15] = 1;
syscall_rule[130] = 1;
syscall_rule[128] = 1;
syscall_rule[297] = 1;
syscall_rule[146] = 0;
syscall_rule[147] = 0;
syscall_rule[204] = 0;
syscall_rule[143] = 0;
syscall_rule[145] = 0;
syscall_rule[148] = 0;
syscall_rule[203] = 0;
syscall_rule[142] = 0;
syscall_rule[144] = 0;
syscall_rule[24] = 0;
syscall_rule[23] = 1;
syscall_rule[40] = 1;
syscall_rule[307] = 0;
syscall_rule[238] = 0;
syscall_rule[273] = 1;
syscall_rule[205] = 1;
syscall_rule[218] = 1;
syscall_rule[171] = 0;
syscall_rule[123] = 0;
syscall_rule[122] = 0;
syscall_rule[106] = 1;
syscall_rule[116] = 1;
syscall_rule[170] = 0;
syscall_rule[38] = 1;
syscall_rule[308] = 0;
syscall_rule[109] = 0;
syscall_rule[141] = 0;
syscall_rule[114] = 1;
syscall_rule[119] = 1;
syscall_rule[117] = 1;
syscall_rule[113] = 1;
syscall_rule[160] = 1;
syscall_rule[112] = 0;
syscall_rule[164] = 1;
syscall_rule[105] = 1;
syscall_rule[188] = 0;
syscall_rule[131] = 1;
syscall_rule[282] = 1;
syscall_rule[289] = 1;
syscall_rule[275] = 1;
syscall_rule[4] = 1;
syscall_rule[137] = 1;
syscall_rule[168] = 0;
syscall_rule[167] = 0;
syscall_rule[88] = 0;
syscall_rule[266] = 0;
syscall_rule[162] = 1;
syscall_rule[277] = 1;
syscall_rule[306] = 1;
syscall_rule[139] = 1;
syscall_rule[99] = 1;
syscall_rule[103] = 0;
syscall_rule[276] = 1;
syscall_rule[234] = 1;
syscall_rule[201] = 1;
syscall_rule[222] = 1;
syscall_rule[226] = 1;
syscall_rule[225] = 1;
syscall_rule[224] = 1;
syscall_rule[223] = 1;
syscall_rule[283] = 1;
syscall_rule[287] = 1;
syscall_rule[286] = 1;
syscall_rule[100] = 1;
syscall_rule[200] = 1;
syscall_rule[76] = 0;
syscall_rule[95] = 0;
syscall_rule[166] = 0;
syscall_rule[63] = 1;
syscall_rule[87] = 0;
syscall_rule[263] = 0;
syscall_rule[272] = 1;
syscall_rule[134] = 1;
syscall_rule[136] = 1;
syscall_rule[132] = 1;
syscall_rule[280] = 1;
syscall_rule[235] = 1;
syscall_rule[58] = 0;
syscall_rule[153] = 0;
syscall_rule[278] = 0;
syscall_rule[236] = 0;
syscall_rule[61] = 1;
syscall_rule[247] = 1;
syscall_rule[1] = 1;
syscall_rule[20] = 1;
}


decompiled_code:
__int64 init_feedback()
{
__int64 result; // rax
__int64 *v1; // rbx

feedback[11] = g_strdup("Invalid Memory Reference");
result = g_strdup("Floating Point Exception");
feedback[8] = result;
v1 = feedback;
do
{
if ( !*v1 )
{
result = g_strdup(&unk_CA0);
*v1 = result;
}
++v1;
}
while ( v1 != (__int64 *)(unsigned int)((_DWORD)feedback + 520) );
return result;
}

canonical_decompiled_code:
__int64 func2()
{
__int64 result; // rax
__int64 *v1; // rbx

feedback[11] = g_strdup("Invalid Memory Reference");
result = g_strdup("Floating Point Exception");
feedback[8] = result;
v1 = feedback;
do
{
if ( !*v1 )
{
result = g_strdup(&unk_CA0);
*v1 = result;
}
++v1;
}
while ( v1 != (__int64 *)(unsigned int)((_DWORD)feedback + 520) );
return result;
}

original_code:
void
static init_feedback()
{
    int i;
    feedback[11] = g_strdup("Invalid Memory Reference");
    feedback[8] = g_strdup("Floating Point Exception");
    for (i = 0; i < 65; ++i)
        if (feedback[i] == ((void *)0))
            feedback[i] = g_strdup("");
}

canonical_original_code:
static void init_feedback()
{
    int i;
    feedback[11] = g_strdup("Invalid Memory Reference");
    feedback[8] = g_strdup("Floating Point Exception");
    for (i = 0; i < 65; ++i)
        if (feedback[i] == ((void *)0))
            feedback[i] = g_strdup("");
}

variable_types: i int


decompiled_code:
void init_conf()
{
init_signal_rule();
init_feedback();
init_syscall_rule();
}

canonical_decompiled_code:
void func3()
{
func0();
func2();
func1();
}


decompiled_code:
void __fastcall alarm_func(int a1)
{
if ( a1 == 14 )
longjmp(jbuf, 1);
}

canonical_decompiled_code:
void __fastcall func0(int a1)
{
if ( a1 == 14 )
longjmp(jbuf, 1);
}

original_code:
static void
alarm_func(int signo)
{
    if (signo == 14)
        longjmp(jbuf, 1);
}

variable_types: signo int


decompiled_code:
int setup_io()
{
int v0; // eax
int v1; // ebp
int v2; // ebx

v0 = open((const char *)*input, 0);
if ( v0 == -1 )
exit(2);
v1 = v0;
v2 = open((const char *)*output, 65, 420LL);
if ( v2 == -1 )
exit(3);
dup2(v1, 0);
dup2(v2, 1);
dup2(v2, 2);
close(v1);
return close(v2);
}

canonical_decompiled_code:
int func1()
{
int v0; // eax
int v1; // ebp
int v2; // ebx

v0 = open((const char *)*input, 0);
if ( v0 == -1 )
exit(2);
v1 = v0;
v2 = open((const char *)*output, 65, 420LL);
if ( v2 == -1 )
exit(3);
dup2(v1, 0);
dup2(v2, 1);
dup2(v2, 2);
close(v1);
return close(v2);
}

original_code:
static void
setup_io()
{
    int infd, outfd;
    infd = open(input->str, 00);
    if (infd == -1) exit(2);
    outfd = open(output->str, 01 | 0100, (0400 | 0200 | (0400 >> 3) | ((0400 >> 3) >> 3)));
    if (outfd == -1) exit(3);
    dup2(infd, 0);
    dup2(outfd, 1);
    dup2(outfd, 2);
    close(infd);
    close(outfd);
}

canonical_original_code:
static void setup_io()
{
    int infd; int outfd;
    infd = open(input->str, 00);
    if (infd == -1) exit(2);
    outfd = open(output->str, 01 | 0100, (0400 | 0200 | (0400 >> 3) | ((0400 >> 3) >> 3)));
    if (outfd == -1) exit(3);
    dup2(infd, 0);
    dup2(outfd, 1);
    dup2(outfd, 2);
    close(infd);
    close(outfd);
}

variable_types: infd int

variable_types: outfd int


decompiled_code:
void __noreturn setup_child()
{
char *const *v0; // rax

setup_io();
if ( !setgroups(0LL, 0LL)
&& !setresgid(*(_DWORD *)(pwd + 20LL), *(_DWORD *)(pwd + 20LL), *(_DWORD *)(pwd + 20LL))
&& !setresuid(*(_DWORD *)(pwd + 16LL), *(_DWORD *)(pwd + 16LL), *(_DWORD *)(pwd + 16LL)) )
{
chdir(workdir);
setup_resource();
ptrace(PTRACE_TRACEME, 0LL, 0LL, 0LL);
v0 = (char *const *)g_get_environ();
execvpe(*command, command, v0);
exit(1);
}
exit(0);
}

canonical_decompiled_code:
void __noreturn func3()
{
char *const *v0; // rax

func1();
if ( !setgroups(0LL, 0LL)
&& !setresgid(*(_DWORD *)(pwd + 20LL), *(_DWORD *)(pwd + 20LL), *(_DWORD *)(pwd + 20LL))
&& !setresuid(*(_DWORD *)(pwd + 16LL), *(_DWORD *)(pwd + 16LL), *(_DWORD *)(pwd + 16LL)) )
{
chdir(workdir);
func2();
ptrace(PTRACE_TRACEME, 0LL, 0LL, 0LL);
v0 = (char *const *)g_get_environ();
execvpe(*command, command, v0);
exit(1);
}
exit(0);
}

original_code:
static void
setup_child()
{
    setup_io();
    if (setgroups(0, ((void *)0)) != 0 ||
            setresgid(pwd->pw_gid, pwd->pw_gid, pwd->pw_gid) != 0 ||
            setresuid(pwd->pw_uid, pwd->pw_uid, pwd->pw_uid) != 0)
        exit(0);
    chdir(workdir);
    setup_resource();
    ptrace(PTRACE_TRACEME, 0, ((void *)0), ((void *)0));
    execvpe(command[0], command, (char * const *)g_get_environ());
    exit(1);
}

canonical_original_code:
static void setup_child()
{
    setup_io();
    if (setgroups(0, ((void *)0)) != 0 ||
            setresgid(pwd->pw_gid, pwd->pw_gid, pwd->pw_gid) != 0 ||
            setresuid(pwd->pw_uid, pwd->pw_uid, pwd->pw_uid) != 0)
        exit(0);
    chdir(workdir);
    setup_resource();
    ptrace(PTRACE_TRACEME, 0, ((void *)0), ((void *)0));
    execvpe(command[0], command, (char **)g_get_environ());
    exit(1);
}


original_code:
static int
get_time(struct rusage *used)
{
    return (*used).ru_utime.tv_sec * 1000 + (*used).ru_stime.tv_sec * 1000 +
        (int)ceil((((*used).ru_utime.tv_usec +
                        (*used).ru_stime.tv_usec)) / 1000.0);
}

variable_types: struct rusage { struct timeval { long tv_sec; long tv_usec; } ru_utime; struct timeval ru_stime; union { long ru_maxrss; long __ru_maxrss_word; }; union { long ru_ixrss; long __ru_ixrss_word; }; union { long ru_idrss; long __ru_idrss_word; }; union { long ru_isrss; long __ru_isrss_word; }; union { long ru_minflt; long __ru_minflt_word; }; union { long ru_majflt; long __ru_majflt_word; }; union { long ru_nswap; long __ru_nswap_word; }; union { long ru_inblock; long __ru_inblock_word; }; union { long ru_oublock; long __ru_oublock_word; }; union { long ru_msgsnd; long __ru_msgsnd_word; }; union { long ru_msgrcv; long __ru_msgrcv_word; }; union { long ru_nsignals; long __ru_nsignals_word; }; union { long ru_nvcsw; long __ru_nvcsw_word; }; union { long ru_nivcsw; long __ru_nivcsw_word; }; } *

user_defined_types: struct rusage { struct timeval ru_utime; struct timeval ru_stime; union { long ru_maxrss; long __ru_maxrss_word; }; union { long ru_ixrss; long __ru_ixrss_word; }; union { long ru_idrss; long __ru_idrss_word; }; union { long ru_isrss; long __ru_isrss_word; }; union { long ru_minflt; long __ru_minflt_word; }; union { long ru_majflt; long __ru_majflt_word; }; union { long ru_nswap; long __ru_nswap_word; }; union { long ru_inblock; long __ru_inblock_word; }; union { long ru_oublock; long __ru_oublock_word; }; union { long ru_msgsnd; long __ru_msgsnd_word; }; union { long ru_msgrcv; long __ru_msgrcv_word; }; union { long ru_nsignals; long __ru_nsignals_word; }; union { long ru_nvcsw; long __ru_nvcsw_word; }; union { long ru_nivcsw; long __ru_nivcsw_word; }; }


decompiled_code:
int filter_output()
{
int result; // eax
struct stat v1; // [rsp+0h] [rbp-1098h] BYREF
char s[4104]; // [rsp+90h] [rbp-1008h] BYREF

stat((const char *)*output, &v1);
if ( v1.st_size < (int)(fsize << 10) )
{
sprintf(s, "egrep -q '^Exception in thread.*java\\..*(Exception|Error):' %s", (const char *)*output);
if ( (unsigned __int16)system(s) >> 8 )
{
sprintf(s, "egrep -q '^java\\.security\\..*Exception:' %s", (const char *)*output);
result = system(s);
if ( !BYTE1(result) )
{
result = ::result;
*::result = 3;
}
}
else
{
result = ::result;
*::result = 3;
}
}
else
{
result = ::result;
*::result = 6;
}
return result;
}

canonical_decompiled_code:
int func7()
{
int result; // eax
struct stat v1; // [rsp+0h] [rbp-1098h] BYREF
char s[4104]; // [rsp+90h] [rbp-1008h] BYREF

stat((const char *)*output, &v1);
if ( v1.st_size < (int)(fsize << 10) )
{
sprintf(s, "egrep -q '^Exception in thread.*java\\..*(Exception|Error):' %s", (const char *)*output);
if ( (unsigned __int16)system(s) >> 8 )
{
sprintf(s, "egrep -q '^java\\.security\\..*Exception:' %s", (const char *)*output);
result = system(s);
if ( !BYTE1(result) )
{
result = ::result;
*::result = 3;
}
}
else
{
result = ::result;
*::result = 3;
}
}
else
{
result = ::result;
*::result = 6;
}
return result;
}

original_code:
static void
filter_output()
{
    int status;
    char cmd[4096];
    struct stat stbuf;
    stat(output->str, &stbuf);
    if (stbuf.st_size >= fsize * 1024) {
        result->code = EXIT_OLE;
        return;
    }
    sprintf(cmd,
      "egrep -q '^Exception in thread.*java\\..*(Exception|Error):' %s",
      output->str);
    status = system(cmd);
    if ((((status) & 0xff00) >> 8) == 0) {
        result->code = EXIT_RE;
        return;
    }
    sprintf(cmd, "egrep -q '^java\\.security\\..*Exception:' %s", output->str);
    status = system(cmd);
    if ((((status) & 0xff00) >> 8) == 0) {
        result->code = EXIT_RE;
        return;
    }
}

variable_types: status int

variable_types:
cmd
char [4096]

user_defined_types: struct timespec { long tv_sec; long tv_nsec; }


decompiled_code:
int execute_jcommand()
{
char v0; // bh
int result; // eax
unsigned int pid; // [rsp+Ch] [rbp-18Ch]
char v3[120]; // [rsp+10h] [rbp-188h] BYREF
__int64 v4; // [rsp+88h] [rbp-110h]
struct rusage usage; // [rsp+F0h] [rbp-A8h] BYREF
__WAIT_STATUS stat_loc; // [rsp+18Ch] [rbp-Ch] BYREF

pid = fork();
if ( !pid )
setup_child();
wait3((__WAIT_STATUS)&stat_loc, 0, &usage);
v0 = BYTE1(stat_loc.__uptr);
if ( ((__int64)stat_loc.__uptr & 0x7F) != 0 )
{
if ( LOBYTE(stat_loc.__uptr) == 127 )
{
ptrace(PTRACE_GETREGS, pid, 0LL, v3);
if ( v0 == 5 && v4 == 59 )
{
signal(14, alarm_func);
if ( setjmp(jbuf) )
{
kill(pid, 9);
*(_DWORD *)(::result + 4LL) = ltime;
result = ::result;
*::result = 4;
}
else
{
alarm(ltime / 1000 + 2);
ptrace(PTRACE_SYSCALL, pid, 0LL, 0LL);
trace_child(pid);
alarm(0);
result = ::result;
if ( !*::result )
result = filter_output();
}
}
else
{
kill(pid, 9);
*::result = 7;
result = g_string_assign(*(_QWORD *)(::result + 24LL), "unexpected child stop before execve");
}
}
else
{
kill(pid, 9);
*::result = 7;
result = g_string_assign(*(_QWORD *)(::result + 24LL), "unknow child status before execve");
}
}
else
{
switch ( BYTE1(stat_loc.__uptr) )
{
case 0:
g_string_assign(*(_QWORD *)(::result + 24LL), "drop privileges error");
break;
case 1:
g_string_assign(*(_QWORD *)(::result + 24LL), "execvpe error");
break;
case 2:
g_string_assign(*(_QWORD *)(::result + 24LL), "open input file error");
break;
case 3:
g_string_assign(*(_QWORD *)(::result + 24LL), "open output file error");
break;
case 4:
g_string_assign(*(_QWORD *)(::result + 24LL), "dup2 input error");
break;
case 5:
g_string_assign(*(_QWORD *)(::result + 24LL), "dup2 ouput error");
break;
default:
break;
}
result = ::result;
*::result = 7;
}
return result;
}

canonical_decompiled_code:
int func8()
{
char v0; // bh
int result; // eax
unsigned int pid; // [rsp+Ch] [rbp-18Ch]
char v3[120]; // [rsp+10h] [rbp-188h] BYREF
__int64 v4; // [rsp+88h] [rbp-110h]
struct rusage usage; // [rsp+F0h] [rbp-A8h] BYREF
__WAIT_STATUS stat_loc; // [rsp+18Ch] [rbp-Ch] BYREF

pid = fork();
if ( !pid )
func3();
wait3((__WAIT_STATUS)&stat_loc, 0, &usage);
v0 = BYTE1(stat_loc.__uptr);
if ( ((__int64)stat_loc.__uptr & 0x7F) != 0 )
{
if ( LOBYTE(stat_loc.__uptr) == 127 )
{
ptrace(PTRACE_GETREGS, pid, 0LL, v3);
if ( v0 == 5 && v4 == 59 )
{
signal(14, alarm_func);
if ( setjmp(jbuf) )
{
kill(pid, 9);
*(_DWORD *)(::result + 4LL) = ltime;
result = ::result;
*::result = 4;
}
else
{
alarm(ltime / 1000 + 2);
ptrace(PTRACE_SYSCALL, pid, 0LL, 0LL);
func6(pid);
alarm(0);
result = ::result;
if ( !*::result )
result = func7();
}
}
else
{
kill(pid, 9);
*::result = 7;
result = g_string_assign(*(_QWORD *)(::result + 24LL), "unexpected child stop before execve");
}
}
else
{
kill(pid, 9);
*::result = 7;
result = g_string_assign(*(_QWORD *)(::result + 24LL), "unknow child status before execve");
}
}
else
{
switch ( BYTE1(stat_loc.__uptr) )
{
case 0:
g_string_assign(*(_QWORD *)(::result + 24LL), "drop privileges error");
break;
case 1:
g_string_assign(*(_QWORD *)(::result + 24LL), "execvpe error");
break;
case 2:
g_string_assign(*(_QWORD *)(::result + 24LL), "open input file error");
break;
case 3:
g_string_assign(*(_QWORD *)(::result + 24LL), "open output file error");
break;
case 4:
g_string_assign(*(_QWORD *)(::result + 24LL), "dup2 input error");
break;
case 5:
g_string_assign(*(_QWORD *)(::result + 24LL), "dup2 ouput error");
break;
default:
break;
}
result = ::result;
*::result = 7;
}
return result;
}

original_code:
void
execute_jcommand()
{
    int signo;
    int status;
    pid_t child;
    struct rusage used;
    struct user_regs_struct regs;
    child = fork();
    if (child == 0)
        setup_child();
    wait3(&status, 0, &used);
    if ((((status) & 0x7f) == 0)) {
        switch ((((status) & 0xff00) >> 8)) {
            case 0 : g_string_assign(result->err, "drop privileges error");
                     break;
            case 1 : g_string_assign(result->err, "execvpe error");
                     break;
            case 2 : g_string_assign(result->err, "open input file error");
                     break;
            case 3 : g_string_assign(result->err, "open output file error");
                     break;
            case 4 : g_string_assign(result->err, "dup2 input error");
                     break;
            case 5 : g_string_assign(result->err, "dup2 ouput error");
                     break;
        }
        result->code = EXIT_IE;
        return;
    }
    if (!(((status) & 0xff) == 0x7f)) {
        kill(child, 9);
        result->code = EXIT_IE;
        g_string_assign(result->err,
                "unknow child status before execve");
        return;
    }
    signo = (((status) & 0xff00) >> 8);
    ptrace(PTRACE_GETREGS, child, ((void *)0), &regs);
    if (signo != 5 || regs.orig_rax != 59) {
        kill(child, 9);
        result->code = EXIT_IE;
        g_string_assign(result->err,
                "unexpected child stop before execve");
        return;
    }
    signal(14, alarm_func);
    if (_setjmp (jbuf)) {
        kill(child, 9);
        result->time = ltime;
        result->code = EXIT_TLE;
        return;
    }
    alarm(ltime / 1000 + 2);
    ptrace(PTRACE_SYSCALL, child, ((void *)0), ((void *)0));
    trace_child(child);
    alarm(0);
    if (result->code == EXIT_AC)
        filter_output();
    return;
}

canonical_original_code:
void execute_jcommand()
{
    int signo;
    int status;
    int child;
    struct rusage used;
    struct user_regs_struct regs;
    child = fork();
    if (child == 0)
        setup_child();
    wait3(&status, 0, &used);
    if ((((status) & 0x7f) == 0)) {
        switch ((((status) & 0xff00) >> 8)) {
            case 0 : g_string_assign(result->err, "drop privileges error");
                     break;
            case 1 : g_string_assign(result->err, "execvpe error");
                     break;
            case 2 : g_string_assign(result->err, "open input file error");
                     break;
            case 3 : g_string_assign(result->err, "open output file error");
                     break;
            case 4 : g_string_assign(result->err, "dup2 input error");
                     break;
            case 5 : g_string_assign(result->err, "dup2 ouput error");
                     break;
        }
        result->code = EXIT_IE;
        return;
    }
    if (!(((status) & 0xff) == 0x7f)) {
        kill(child, 9);
        result->code = EXIT_IE;
        g_string_assign(result->err,
                "unknow child status before execve");
        return;
    }
    signo = (((status) & 0xff00) >> 8);
    ptrace(PTRACE_GETREGS, child, ((void *)0), &regs);
    if (signo != 5 || regs.orig_rax != 59) {
        kill(child, 9);
        result->code = EXIT_IE;
        g_string_assign(result->err,
                "unexpected child stop before execve");
        return;
    }
    signal(14, alarm_func);
    if (_setjmp (jbuf)) {
        kill(child, 9);
        result->time = ltime;
        result->code = EXIT_TLE;
        return;
    }
    alarm(ltime / 1000 + 2);
    ptrace(PTRACE_SYSCALL, child, ((void *)0), ((void *)0));
    trace_child(child);
    alarm(0);
    if (result->code == EXIT_AC)
        filter_output();
    return;
}

variable_types: child int

variable_types: struct rusage { struct timeval { long tv_sec; long tv_usec; } ru_utime; struct timeval ru_stime; union { long ru_maxrss; long __ru_maxrss_word; }; union { long ru_ixrss; long __ru_ixrss_word; }; union { long ru_idrss; long __ru_idrss_word; }; union { long ru_isrss; long __ru_isrss_word; }; union { long ru_minflt; long __ru_minflt_word; }; union { long ru_majflt; long __ru_majflt_word; }; union { long ru_nswap; long __ru_nswap_word; }; union { long ru_inblock; long __ru_inblock_word; }; union { long ru_oublock; long __ru_oublock_word; }; union { long ru_msgsnd; long __ru_msgsnd_word; }; union { long ru_msgrcv; long __ru_msgrcv_word; }; union { long ru_nsignals; long __ru_nsignals_word; }; union { long ru_nvcsw; long __ru_nvcsw_word; }; union { long ru_nivcsw; long __ru_nivcsw_word; }; }

variable_types: struct user_regs_struct { unsigned long long r15; unsigned long long r14; unsigned long long r13; unsigned long long r12; unsigned long long rbp; unsigned long long rbx; unsigned long long r11; unsigned long long r10; unsigned long long r9; unsigned long long r8; unsigned long long rax; unsigned long long rcx; unsigned long long rdx; unsigned long long rsi; unsigned long long rdi; unsigned long long orig_rax; unsigned long long rip; unsigned long long cs; unsigned long long eflags; unsigned long long rsp; unsigned long long ss; unsigned long long fs_base; unsigned long long gs_base; unsigned long long ds; unsigned long long es; unsigned long long fs; unsigned long long gs; }


canonical_decompiled_code:
void __fastcall func1(int a1)
{
if ( a1 == 14 )
longjmp(jbuf, 1);
}

canonical_original_code:
static void alarm_func(int signo)
{
    if (signo == 14)
        longjmp(jbuf, 1);
}


decompiled_code:
__int64 normal_judge()
{
__int64 result; // rax
_DWORD *v1; // rbx
__int64 v2; // [rsp+8h] [rbp-20h] BYREF
char *v3; // [rsp+10h] [rbp-18h] BYREF
char *s; // [rsp+18h] [rbp-10h] BYREF

s = 0LL;
v3 = 0LL;
v2 = 0LL;
g_file_get_contents(*output, &s, 0LL, &v2);
if ( v2 || (g_file_get_contents(*answer, &v3, 0LL, &v2), v2) )
{
*::result = 7;
g_string_assign(*(_QWORD *)(::result + 24LL), *(_QWORD *)(v2 + 8));
result = g_error_free(v2);
}
else
{
v1 = (_DWORD *)::result;
result = compare_string(s, v3);
*v1 = result;
}
return result;
}

canonical_decompiled_code:
__int64 func2()
{
__int64 result; // rax
_DWORD *v1; // rbx
__int64 v2; // [rsp+8h] [rbp-20h] BYREF
char *v3; // [rsp+10h] [rbp-18h] BYREF
char *s; // [rsp+18h] [rbp-10h] BYREF

s = 0LL;
v3 = 0LL;
v2 = 0LL;
g_file_get_contents(*output, &s, 0LL, &v2);
if ( v2 || (g_file_get_contents(*answer, &v3, 0LL, &v2), v2) )
{
*::result = 7;
g_string_assign(*(_QWORD *)(::result + 24LL), *(_QWORD *)(v2 + 8));
result = g_error_free(v2);
}
else
{
v1 = (_DWORD *)::result;
result = func0(s, v3);
*v1 = result;
}
return result;
}

original_code:
void
normal_judge()
{
    char * outstr = ((void *)0), * ansstr = ((void *)0);
    GError * gerr = ((void *)0);
    g_file_get_contents(output->str, &outstr, ((void *)0), &gerr);
    if (gerr) {
        result->code = EXIT_IE;
        g_string_assign(result->err, gerr->message);
        g_error_free(gerr);
        return;
    }
    g_file_get_contents(answer->str, &ansstr, ((void *)0), &gerr);
    if (gerr) {
        result->code = EXIT_IE;
        g_string_assign(result->err, gerr->message);
        g_error_free(gerr);
        return;
    }
    result->code = compare_string(outstr, ansstr);
    return;
}

canonical_original_code:
void normal_judge()
{
    char *outstr = ((void *)0); char *ansstr = ((void *)0);
    struct _GError *gerr = ((void *)0);
    g_file_get_contents(output->str, &outstr, ((void *)0), &gerr);
    if (gerr) {
        result->code = EXIT_IE;
        g_string_assign(result->err, gerr->message);
        g_error_free(gerr);
        return;
    }
    g_file_get_contents(answer->str, &ansstr, ((void *)0), &gerr);
    if (gerr) {
        result->code = EXIT_IE;
        g_string_assign(result->err, gerr->message);
        g_error_free(gerr);
        return;
    }
    result->code = compare_string(outstr, ansstr);
    return;
}

variable_types:
outstr
char *

variable_types:
ansstr
char *

variable_types: struct _GError { unsigned int domain; int code; char *message; } *


decompiled_code:
unsigned int special_judge()
{
int v0; // ebx
unsigned int result; // eax
__pid_t pid; // [rsp+Ch] [rbp-1Ch]
__WAIT_STATUS stat_loc; // [rsp+1Ch] [rbp-Ch] BYREF

pid = fork();
if ( !pid )
{
if ( setgroups(0LL, 0LL)
|| setresgid(*(_DWORD *)(pwd + 20LL), *(_DWORD *)(pwd + 20LL), *(_DWORD *)(pwd + 20LL))
|| setresuid(*(_DWORD *)(pwd + 16LL), *(_DWORD *)(pwd + 16LL), *(_DWORD *)(pwd + 16LL)) )
{
abort();
}
v0 = open((const char *)*output, 0);
dup2(v0, 0);
close(v0);
close(1);
close(2);
execl((const char *)*answer, (const char *)*answer, 0LL);
}
signal(14, alarm_func);
if ( setjmp(jbuf) )
{
kill(pid, 9);
*::result = 7;
result = g_string_printf(*(_QWORD *)(::result + 24LL), "spj time limit exceeded");
}
else
{
alarm(5u);
wait((__WAIT_STATUS)&stat_loc);
if ( ((__int64)stat_loc.__uptr & 0x7F) != 0 )
{
kill(pid, 9);
*::result = 7;
g_string_printf(*(_QWORD *)(::result + 24LL), "unknow spj status");
}
else
{
*::result = BYTE1(stat_loc.__uptr) - 3 * ((1431655766 * (unsigned __int64)BYTE1(stat_loc.__uptr)) >> 32);
}
result = alarm(0);
}
return result;
}

canonical_decompiled_code:
unsigned int func3()
{
int v0; // ebx
unsigned int result; // eax
__pid_t pid; // [rsp+Ch] [rbp-1Ch]
__WAIT_STATUS stat_loc; // [rsp+1Ch] [rbp-Ch] BYREF

pid = fork();
if ( !pid )
{
if ( setgroups(0LL, 0LL)
|| setresgid(*(_DWORD *)(pwd + 20LL), *(_DWORD *)(pwd + 20LL), *(_DWORD *)(pwd + 20LL))
|| setresuid(*(_DWORD *)(pwd + 16LL), *(_DWORD *)(pwd + 16LL), *(_DWORD *)(pwd + 16LL)) )
{
abort();
}
v0 = open((const char *)*output, 0);
dup2(v0, 0);
close(v0);
close(1);
close(2);
execl((const char *)*answer, (const char *)*answer, 0LL);
}
signal(14, alarm_func);
if ( setjmp(jbuf) )
{
kill(pid, 9);
*::result = 7;
result = g_string_printf(*(_QWORD *)(::result + 24LL), "spj time limit exceeded");
}
else
{
alarm(5u);
wait((__WAIT_STATUS)&stat_loc);
if ( ((__int64)stat_loc.__uptr & 0x7F) != 0 )
{
kill(pid, 9);
*::result = 7;
g_string_printf(*(_QWORD *)(::result + 24LL), "unknow spj status");
}
else
{
*::result = BYTE1(stat_loc.__uptr) - 3 * ((1431655766 * (unsigned __int64)BYTE1(stat_loc.__uptr)) >> 32);
}
result = alarm(0);
}
return result;
}

original_code:
void
special_judge()
{
    int infd;
    int status;
    pid_t child;
    child = fork();
    if (child == 0) {
        if (setgroups(0, ((void *)0)) != 0 ||
                setresgid(pwd->pw_gid, pwd->pw_gid, pwd->pw_gid) != 0 ||
                setresuid(pwd->pw_uid, pwd->pw_uid, pwd->pw_uid) != 0)
            abort();
        infd = open(output->str, 00);
        dup2(infd, 0);
        close(infd);
        close(1);
        close(2);
        execl(answer->str, answer->str, (char *)((void *)0));
    }
    signal(14, alarm_func);
    if (_setjmp (jbuf)) {
        kill(child, 9);
        result->code = EXIT_IE;
        g_string_printf(result->err, "spj time limit exceeded");
        return;
    }
    alarm(5);
    wait(&status);
    if (!(((status) & 0x7f) == 0)) {
        kill(child, 9);
        result->code = EXIT_IE;
        g_string_printf(result->err, "unknow spj status");
    } else {
        result->code = (((status) & 0xff00) >> 8) % 3;
    }
    alarm(0);
    return;
}

canonical_original_code:
void special_judge()
{
    int infd;
    int status;
    int child;
    child = fork();
    if (child == 0) {
        if (setgroups(0, ((void *)0)) != 0 ||
                setresgid(pwd->pw_gid, pwd->pw_gid, pwd->pw_gid) != 0 ||
                setresuid(pwd->pw_uid, pwd->pw_uid, pwd->pw_uid) != 0)
            abort();
        infd = open(output->str, 00);
        dup2(infd, 0);
        close(infd);
        close(1);
        close(2);
        execl(answer->str, answer->str, (char *)((void *)0));
    }
    signal(14, alarm_func);
    if (_setjmp (jbuf)) {
        kill(child, 9);
        result->code = EXIT_IE;
        g_string_printf(result->err, "spj time limit exceeded");
        return;
    }
    alarm(5);
    wait(&status);
    if (!(((status) & 0x7f) == 0)) {
        kill(child, 9);
        result->code = EXIT_IE;
        g_string_printf(result->err, "unknow spj status");
    } else {
        result->code = (((status) & 0xff00) >> 8) % 3;
    }
    alarm(0);
    return;
}


canonical_original_code:
static int get_time(struct rusage *used)
{
    return (*used).ru_utime.tv_sec * 1000 + (*used).ru_stime.tv_sec * 1000 +
        (int)ceil((((*used).ru_utime.tv_usec +
                        (*used).ru_stime.tv_usec)) / 1000.0);
}

user_defined_types: struct timeval { long tv_sec; long tv_usec; }


decompiled_code:
int python_filter()
{
int result; // eax
char v1[4104]; // [rsp+0h] [rbp-1008h] BYREF

sprintf(v1, "grep -q '^Traceback (most recent call last):' %s", (const char *)*output);
result = system(v1);
if ( !BYTE1(result) )
{
result = ::result;
*::result = 3;
}
return result;
}

canonical_decompiled_code:
int func7()
{
int result; // eax
char v1[4104]; // [rsp+0h] [rbp-1008h] BYREF

sprintf(v1, "grep -q '^Traceback (most recent call last):' %s", (const char *)*output);
result = system(v1);
if ( !BYTE1(result) )
{
result = ::result;
*::result = 3;
}
return result;
}

original_code:
static void
python_filter()
{
    int status;
    char cmd[4096];
    sprintf(cmd, "grep -q '^Traceback (most recent call last):' %s",
            output->str);
    status = system(cmd);
    if ((((status) & 0xff00) >> 8) == 0) {
        result->code = EXIT_RE;
        return;
    }
}