original_code:
void ring_link_beh (CONFIG* abe__config)
{
 CONS* next = _mine(_car((abe__config)->q_entry));
 CONS* first = _cdr((abe__config)->q_entry);
 struct dbug_ctx_t dbug_ctx; dbug_ctx.name = ("countdown_ring_beh"); dbug_ctx.depth = dbug_cfg->ctx->depth; dbug_ctx.line = 130; dbug_ctx.keyword = ""; dbug_ctx.unit = &dbug_unit; dbug_ctx.caller = dbug_cfg->ctx; dbug_enter (&dbug_ctx);
 abe__send((abe__config),(next),(first));
 dbug_ctx.line = 132; dbug_return (&dbug_ctx); return;
}

canonical_original_code:
void ring_link_beh(struct config *abe__config)
{
 struct cons *next = _mine(_car((abe__config)->q_entry));
 struct cons *first = _cdr((abe__config)->q_entry);
 struct dbug_ctx_t dbug_ctx; dbug_ctx.name = ("countdown_ring_beh"); dbug_ctx.depth = dbug_cfg->ctx->depth; dbug_ctx.line = 130; dbug_ctx.keyword = ""; dbug_ctx.unit = &dbug_unit; dbug_ctx.caller = dbug_cfg->ctx; dbug_enter (&dbug_ctx);
 abe__send((abe__config),(next),(first));
 dbug_ctx.line = 132; dbug_return (&dbug_ctx); return;
}


decompiled_code:
__int64 __fastcall countdown_builder_beh(__int64 a1)
{
__int64 v1; // rax
__int64 v2; // rax
__int64 v3; // rbp
__int64 v4; // rax
__int64 v5; // r12
__int64 v6; // rax
__int64 v7; // r13
__int64 v8; // rbp
__int64 v9; // rbp
__int64 v10; // rax
__int64 v11; // rax
__int64 v13; // rax
const char *v14; // [rsp+0h] [rbp-58h] BYREF
int v15; // [rsp+8h] [rbp-50h]
int v16; // [rsp+Ch] [rbp-4Ch]
void *v17; // [rsp+10h] [rbp-48h]
char **v18; // [rsp+18h] [rbp-40h]
__int64 v19; // [rsp+20h] [rbp-38h]

v14 = "countdown_builder_beh";
v1 = *(_QWORD *)(dbug_cfg + 80LL);
v15 = *(_DWORD *)(v1 + 8);
v16 = 96;
v17 = &unk_9E3;
v18 = dbug_unit;
v19 = v1;
dbug_enter(&v14);
v2 = car(*(_QWORD *)(a1 + 48));
v3 = mine(v2);
if ( (v3 & 3) != 3 )
_assert_fail("numberp(n)", "echallenge.c", 0x62u, "countdown_builder_beh");
if ( !cdr(*(_QWORD *)(a1 + 48)) || (cdr(*(_QWORD *)(a1 + 48)) & 3) != 0 )
_assert_fail("consp(WHAT)", "echallenge.c", 0x63u, "countdown_builder_beh");
v4 = cdr(*(_QWORD *)(a1 + 48));
v5 = car(v4);
if ( (v5 & 3) != 1 )
_assert_fail("actorp(first)", "echallenge.c", 0x65u, "countdown_builder_beh");
v6 = cdr(*(_QWORD *)(a1 + 48));
v7 = cdr(v6);
if ( (v7 & 3) != 3 )
_assert_fail("numberp(m)", "echallenge.c", 0x67u, "countdown_builder_beh");
v8 = v3 >> 2;
if ( dbug_on )
{
*(_QWORD *)(*(_QWORD *)(dbug_cfg + 80LL) + 16LL) = &unk_9E3;
if ( (unsigned int)dbug_keyword(&unk_9E3) )
{
*(_DWORD *)(*(_QWORD *)(dbug_cfg + 80LL) + 12LL) = 105;
dbug_print("n=%d m=%d", (unsigned int)v8, v7 >> 2);
}
}
if ( (int)v8 <= 0 )
{
v13 = car(*(_QWORD *)(a1 + 48));
abe__become(v13, countdown_ring_0_beh, v5);
abe__send(a1, timing_actor, &nil__cons);
abe__send(a1, v5, v7);
}
else
{
v9 = abe__actor(a1, countdown_builder_beh, 4LL * ((int)v8 - 1) + 3);
v10 = car(*(_QWORD *)(a1 + 48));
abe__become(v10, countdown_ring_beh, v9);
v11 = cdr(*(_QWORD *)(a1 + 48));
abe__send(a1, v9, v11);
}
v16 = 117;
return dbug_return(&v14);
}

canonical_decompiled_code:
__int64 __fastcall func4(__int64 a1)
{
__int64 v1; // rax
__int64 v2; // rax
__int64 v3; // rbp
__int64 v4; // rax
__int64 v5; // r12
__int64 v6; // rax
__int64 v7; // r13
__int64 v8; // rbp
__int64 v9; // rbp
__int64 v10; // rax
__int64 v11; // rax
__int64 v13; // rax
const char *v14; // [rsp+0h] [rbp-58h] BYREF
int v15; // [rsp+8h] [rbp-50h]
int v16; // [rsp+Ch] [rbp-4Ch]
void *v17; // [rsp+10h] [rbp-48h]
char **v18; // [rsp+18h] [rbp-40h]
__int64 v19; // [rsp+20h] [rbp-38h]

v14 = "countdown_builder_beh";
v1 = *(_QWORD *)(dbug_cfg + 80LL);
v15 = *(_DWORD *)(v1 + 8);
v16 = 96;
v17 = &unk_9E3;
v18 = dbug_unit;
v19 = v1;
dbug_enter(&v14);
v2 = car(*(_QWORD *)(a1 + 48));
v3 = mine(v2);
if ( (v3 & 3) != 3 )
_assert_fail("numberp(n)", "echallenge.c", 0x62u, "countdown_builder_beh");
if ( !cdr(*(_QWORD *)(a1 + 48)) || (cdr(*(_QWORD *)(a1 + 48)) & 3) != 0 )
_assert_fail("consp(WHAT)", "echallenge.c", 0x63u, "countdown_builder_beh");
v4 = cdr(*(_QWORD *)(a1 + 48));
v5 = car(v4);
if ( (v5 & 3) != 1 )
_assert_fail("actorp(first)", "echallenge.c", 0x65u, "countdown_builder_beh");
v6 = cdr(*(_QWORD *)(a1 + 48));
v7 = cdr(v6);
if ( (v7 & 3) != 3 )
_assert_fail("numberp(m)", "echallenge.c", 0x67u, "countdown_builder_beh");
v8 = v3 >> 2;
if ( dbug_on )
{
*(_QWORD *)(*(_QWORD *)(dbug_cfg + 80LL) + 16LL) = &unk_9E3;
if ( (unsigned int)dbug_keyword(&unk_9E3) )
{
*(_DWORD *)(*(_QWORD *)(dbug_cfg + 80LL) + 12LL) = 105;
dbug_print("n=%d m=%d", (unsigned int)v8, v7 >> 2);
}
}
if ( (int)v8 <= 0 )
{
v13 = car(*(_QWORD *)(a1 + 48));
abe__become(v13, countdown_ring_0_beh, v5);
abe__send(a1, timing_actor, &nil__cons);
abe__send(a1, v5, v7);
}
else
{
v9 = abe__actor(a1, countdown_builder_beh, 4LL * ((int)v8 - 1) + 3);
v10 = car(*(_QWORD *)(a1 + 48));
abe__become(v10, countdown_ring_beh, v9);
v11 = cdr(*(_QWORD *)(a1 + 48));
abe__send(a1, v9, v11);
}
v16 = 117;
return dbug_return(&v14);
}

original_code:
void countdown_builder_beh (CONFIG* abe__config)
{
 CONS* n;
 CONS* first;
 CONS* m;
 int n_int;
 struct dbug_ctx_t dbug_ctx; dbug_ctx.name = ("countdown_builder_beh"); dbug_ctx.depth = dbug_cfg->ctx->depth; dbug_ctx.line = 96; dbug_ctx.keyword = ""; dbug_ctx.unit = &dbug_unit; dbug_ctx.caller = dbug_cfg->ctx; dbug_enter (&dbug_ctx);
 n = _mine(_car((abe__config)->q_entry));
 ((((BOOL)((((WORD)(n)) & ((WORD)(0x00000003))) == ((WORD)(0x00000003))))) ? (void) (0) : __assert_fail ("numberp(n)", "echallenge.c", 98, __extension__ __PRETTY_FUNCTION__));
 ((((BOOL)(((_cdr((abe__config)->q_entry))!=((BOOL)(0)))&&((((WORD)(_cdr((abe__config)->q_entry))) & ((WORD)(0x00000003))) == ((WORD)(0x00000000)))))) ? (void) (0) : __assert_fail ("consp(WHAT)", "echallenge.c", 99, __extension__ __PRETTY_FUNCTION__));
 first = _car(_cdr((abe__config)->q_entry));
 ((((BOOL)((((WORD)(first)) & ((WORD)(0x00000003))) == ((WORD)(0x00000001))))) ? (void) (0) : __assert_fail ("actorp(first)", "echallenge.c", 101, __extension__ __PRETTY_FUNCTION__));
 m = _cdr(_cdr((abe__config)->q_entry));
 ((((BOOL)((((WORD)(m)) & ((WORD)(0x00000003))) == ((WORD)(0x00000003))))) ? (void) (0) : __assert_fail ("numberp(m)", "echallenge.c", 103, __extension__ __PRETTY_FUNCTION__));
 n_int = ((int)(((WORD)(n))>>2));
 do{ if(dbug_on && dbug_keyword (dbug_cfg->ctx->keyword = (""))){ dbug_cfg->ctx->line = 105; dbug_print ("n=%d m=%d", n_int, ((int)(((WORD)(m))>>2))); }}while(0);
 if (n_int <= 0) {
  abe__become(_car((abe__config)->q_entry),(countdown_ring_0_beh),(first));
  abe__send((abe__config),(timing_actor),(((CONS*)(&nil__cons))));
  abe__send((abe__config),(first),(m));
 } else {
  CONS* next;
  next = abe__actor((abe__config),(countdown_builder_beh),(((CONS*)((((WORD)(n_int - 1))<<2) | ((WORD)(0x00000003))))));
  abe__become(_car((abe__config)->q_entry),(countdown_ring_beh),(next));
  abe__send((abe__config),(next),(_cdr((abe__config)->q_entry)));
 }
 dbug_ctx.line = 117; dbug_return (&dbug_ctx); return;
}

canonical_original_code:
void countdown_builder_beh(struct config *abe__config)
{
 struct cons *n;
 struct cons *first;
 struct cons *m;
 int n_int;
 struct dbug_ctx_t dbug_ctx; dbug_ctx.name = ("countdown_builder_beh"); dbug_ctx.depth = dbug_cfg->ctx->depth; dbug_ctx.line = 96; dbug_ctx.keyword = ""; dbug_ctx.unit = &dbug_unit; dbug_ctx.caller = dbug_cfg->ctx; dbug_enter (&dbug_ctx);
 n = _mine(_car((abe__config)->q_entry));
 ((((BOOL)((((WORD)(n)) & ((WORD)(0x00000003))) == ((WORD)(0x00000003))))) ? (void) (0) : __assert_fail ("numberp(n)", "echallenge.c", 98, __extension__ __PRETTY_FUNCTION__));
 ((((BOOL)(((_cdr((abe__config)->q_entry))!=((BOOL)(0)))&&((((WORD)(_cdr((abe__config)->q_entry))) & ((WORD)(0x00000003))) == ((WORD)(0x00000000)))))) ? (void) (0) : __assert_fail ("consp(WHAT)", "echallenge.c", 99, __extension__ __PRETTY_FUNCTION__));
 first = _car(_cdr((abe__config)->q_entry));
 ((((BOOL)((((WORD)(first)) & ((WORD)(0x00000003))) == ((WORD)(0x00000001))))) ? (void) (0) : __assert_fail ("actorp(first)", "echallenge.c", 101, __extension__ __PRETTY_FUNCTION__));
 m = _cdr(_cdr((abe__config)->q_entry));
 ((((BOOL)((((WORD)(m)) & ((WORD)(0x00000003))) == ((WORD)(0x00000003))))) ? (void) (0) : __assert_fail ("numberp(m)", "echallenge.c", 103, __extension__ __PRETTY_FUNCTION__));
 n_int = ((int)(((WORD)(n))>>2));
 do{ if(dbug_on && dbug_keyword (dbug_cfg->ctx->keyword = (""))){ dbug_cfg->ctx->line = 105; dbug_print ("n=%d m=%d", n_int, ((int)(((WORD)(m))>>2))); }}while(0);
 if (n_int <= 0) {
  abe__become(_car((abe__config)->q_entry),(countdown_ring_0_beh),(first));
  abe__send((abe__config),(timing_actor),(((struct cons *)(&nil__cons))));
  abe__send((abe__config),(first),(m));
 } else {
  struct cons *next;
  next = abe__actor((abe__config),(countdown_builder_beh),(((struct cons *)((((WORD)(n_int - 1))<<2) | ((WORD)(0x00000003))))));
  abe__become(_car((abe__config)->q_entry),(countdown_ring_beh),(next));
  abe__send((abe__config),(next),(_cdr((abe__config)->q_entry)));
 }
 dbug_ctx.line = 117; dbug_return (&dbug_ctx); return;
}

variable_types: struct config { struct cell { struct cons { struct cons *first; struct cons *rest; } *first; struct cons *rest; long _prev; long _next; } msg_queue; struct cons *gc_root; int q_count; struct cons *q_entry; int msg_cnt_hi; int msg_cnt_lo; int q_limit; long t_epoch; long t_now_s; long t_now_us; struct cons *t_queue; int t_count; } *

variable_types: struct dbug_ctx_t { char *name; int depth; int line; char *keyword; struct dbug_unit_t { char *name; char *unit; } *unit; struct dbug_ctx_t *caller; }

return_type: void

user_defined_types: struct dbug_ctx_t { char *name; int depth; int line; char *keyword; struct dbug_unit_t *unit; struct dbug_ctx_t *caller; }

user_defined_types: struct config { struct cell msg_queue; struct cons *gc_root; int q_count; struct cons *q_entry; int msg_cnt_hi; int msg_cnt_lo; int q_limit; long t_epoch; long t_now_s; long t_now_us; struct cons *t_queue; int t_count; }

user_defined_types: struct cell { struct cons *first; struct cons *rest; long _prev; long _next; }


decompiled_code:
__int64 __fastcall ring_seed_beh(__int64 a1)
{
__int64 v1; // rax
__int64 v2; // rbx
__int64 v3; // r12
__int64 v4; // rbx
__int64 v5; // rax
__int64 v6; // rbx
__int64 v7; // rax
const char *v9; // [rsp+0h] [rbp-48h] BYREF
int v10; // [rsp+8h] [rbp-40h]
int v11; // [rsp+Ch] [rbp-3Ch]
void *v12; // [rsp+10h] [rbp-38h]
char **v13; // [rsp+18h] [rbp-30h]
__int64 v14; // [rsp+20h] [rbp-28h]

v1 = car(*(_QWORD *)(a1 + 48));
v2 = mine(v1);
v3 = cdr(*(_QWORD *)(a1 + 48));
v4 = v2 >> 2;
v9 = "ring_seed_beh";
v5 = *(_QWORD *)(dbug_cfg + 80LL);
v10 = *(_DWORD *)(v5 + 8);
v11 = 150;
v12 = &unk_9E3;
v13 = dbug_unit;
v14 = v5;
dbug_enter(&v9);
if ( thresh_0 <= (int)v4 )
{
thresh_0 *= 2;
fprintf(stderr, "%d:", (unsigned int)v4);
abe__send(a1, timing_actor, &nil__cons);
}
v6 = abe__actor(a1, ring_seed_beh, 4LL * ((int)v4 + 1) + 3);
v7 = car(*(_QWORD *)(a1 + 48));
abe__become(v7, ring_link_beh, v6);
abe__send(a1, v3, v3);
v11 = 159;
return dbug_return(&v9);
}

canonical_decompiled_code:
__int64 __fastcall func5(__int64 a1)
{
__int64 v1; // rax
__int64 v2; // rbx
__int64 v3; // r12
__int64 v4; // rbx
__int64 v5; // rax
__int64 v6; // rbx
__int64 v7; // rax
const char *v9; // [rsp+0h] [rbp-48h] BYREF
int v10; // [rsp+8h] [rbp-40h]
int v11; // [rsp+Ch] [rbp-3Ch]
void *v12; // [rsp+10h] [rbp-38h]
char **v13; // [rsp+18h] [rbp-30h]
__int64 v14; // [rsp+20h] [rbp-28h]

v1 = car(*(_QWORD *)(a1 + 48));
v2 = mine(v1);
v3 = cdr(*(_QWORD *)(a1 + 48));
v4 = v2 >> 2;
v9 = "ring_seed_beh";
v5 = *(_QWORD *)(dbug_cfg + 80LL);
v10 = *(_DWORD *)(v5 + 8);
v11 = 150;
v12 = &unk_9E3;
v13 = dbug_unit;
v14 = v5;
dbug_enter(&v9);
if ( thresh_0 <= (int)v4 )
{
thresh_0 *= 2;
fprintf(stderr, "%d:", (unsigned int)v4);
abe__send(a1, timing_actor, &nil__cons);
}
v6 = abe__actor(a1, ring_seed_beh, 4LL * ((int)v4 + 1) + 3);
v7 = car(*(_QWORD *)(a1 + 48));
abe__become(v7, ring_link_beh, v6);
abe__send(a1, v3, v3);
v11 = 159;
return dbug_return(&v9);
}

original_code:
void ring_seed_beh (CONFIG* abe__config)
{
 static int thresh = 1 << 10;
 CONS* n = _mine(_car((abe__config)->q_entry));
 CONS* first = _cdr((abe__config)->q_entry);
 CONS* next;
 int n_int = ((int)(((WORD)(n))>>2));
 struct dbug_ctx_t dbug_ctx; dbug_ctx.name = ("ring_seed_beh"); dbug_ctx.depth = dbug_cfg->ctx->depth; dbug_ctx.line = 150; dbug_ctx.keyword = ""; dbug_ctx.unit = &dbug_unit; dbug_ctx.caller = dbug_cfg->ctx; dbug_enter (&dbug_ctx);
 if (n_int >= thresh) {
  thresh <<= 1;
  fprintf(stderr, "%d:", n_int);
  abe__send((abe__config),(timing_actor),(((CONS*)(&nil__cons))));
 }
 next = abe__actor((abe__config),(ring_seed_beh),(((CONS*)((((WORD)(n_int + 1))<<2) | ((WORD)(0x00000003))))));
 abe__become(_car((abe__config)->q_entry),(ring_link_beh),(next));
 abe__send((abe__config),(first),(first));
 dbug_ctx.line = 159; dbug_return (&dbug_ctx); return;
}

canonical_original_code:
void ring_seed_beh(struct config *abe__config)
{
 static int thresh = 1 << 10;
 struct cons *n = _mine(_car((abe__config)->q_entry));
 struct cons *first = _cdr((abe__config)->q_entry);
 struct cons *next;
 int n_int = ((int)(((WORD)(n))>>2));
 struct dbug_ctx_t dbug_ctx; dbug_ctx.name = ("ring_seed_beh"); dbug_ctx.depth = dbug_cfg->ctx->depth; dbug_ctx.line = 150; dbug_ctx.keyword = ""; dbug_ctx.unit = &dbug_unit; dbug_ctx.caller = dbug_cfg->ctx; dbug_enter (&dbug_ctx);
 if (n_int >= thresh) {
  thresh <<= 1;
  fprintf(stderr, "%d:", n_int);
  abe__send((abe__config),(timing_actor),(((struct cons *)(&nil__cons))));
 }
 next = abe__actor((abe__config),(ring_seed_beh),(((struct cons *)((((WORD)(n_int + 1))<<2) | ((WORD)(0x00000003))))));
 abe__become(_car((abe__config)->q_entry),(ring_link_beh),(next));
 abe__send((abe__config),(first),(first));
 dbug_ctx.line = 159; dbug_return (&dbug_ctx); return;
}

variable_types: thresh int

variable_types: struct cons { struct cons *first; struct cons *rest; } *

user_defined_types: struct dbug_unit_t { char *name; char *unit; }


decompiled_code:
__int64 __fastcall erlang_challenge(int a1, unsigned int a2)
{
__int64 v2; // rax
__int64 v3; // rbp
__int64 v4; // rbx
__int64 v5; // rax
unsigned int i; // ebx
__int64 v8; // rax
const char *v9; // [rsp+0h] [rbp-48h] BYREF
int v10; // [rsp+8h] [rbp-40h]
int v11; // [rsp+Ch] [rbp-3Ch]
void *v12; // [rsp+10h] [rbp-38h]
char **v13; // [rsp+18h] [rbp-30h]
__int64 v14; // [rsp+20h] [rbp-28h]

v9 = "erlang_challenge";
v2 = *(_QWORD *)(dbug_cfg + 80LL);
v10 = *(_DWORD *)(v2 + 8);
v11 = 177;
v12 = &unk_9E3;
v13 = dbug_unit;
v14 = v2;
dbug_enter(&v9);
v3 = new_configuration(10LL);
timing_actor = abe__actor(v3, timing_beh, &nil__cons);
if ( a1 <= 0 )
{
puts("Seeding unbounded growth message ring.");
v8 = abe__actor(v3, ring_seed_beh, 3LL);
abe__send(v3, v8, v8);
}
else
{
printf("Sending %d messages around a ring of %d processes.\n", a2, (unsigned int)a1);
v4 = abe__actor(v3, countdown_builder_beh, 4LL * a1 + 3);
v5 = cons(v4, 4LL * (int)a2 + 3);
abe__send(v3, v4, v5);
}
abe__send(v3, timing_actor, &nil__cons);
for ( i = 1; i != 1000000; ++i )
{
run_configuration(v3, 1000000LL);
fputc(46, stderr);
if ( *(int *)(v3 + 40) <= 0 )
break;
}
printf("< %dM messages delivered.\n", i);
report_actor_usage(v3);
v11 = 208;
return dbug_return(&v9);
}

canonical_decompiled_code:
__int64 __fastcall func6(int a1, unsigned int a2)
{
__int64 v2; // rax
__int64 v3; // rbp
__int64 v4; // rbx
__int64 v5; // rax
unsigned int i; // ebx
__int64 v8; // rax
const char *v9; // [rsp+0h] [rbp-48h] BYREF
int v10; // [rsp+8h] [rbp-40h]
int v11; // [rsp+Ch] [rbp-3Ch]
void *v12; // [rsp+10h] [rbp-38h]
char **v13; // [rsp+18h] [rbp-30h]
__int64 v14; // [rsp+20h] [rbp-28h]

v9 = "erlang_challenge";
v2 = *(_QWORD *)(dbug_cfg + 80LL);
v10 = *(_DWORD *)(v2 + 8);
v11 = 177;
v12 = &unk_9E3;
v13 = dbug_unit;
v14 = v2;
dbug_enter(&v9);
v3 = new_configuration(10LL);
timing_actor = abe__actor(v3, timing_beh, &nil__cons);
if ( a1 <= 0 )
{
puts("Seeding unbounded growth message ring.");
v8 = abe__actor(v3, ring_seed_beh, 3LL);
abe__send(v3, v8, v8);
}
else
{
printf("Sending %d messages around a ring of %d processes.\n", a2, (unsigned int)a1);
v4 = abe__actor(v3, countdown_builder_beh, 4LL * a1 + 3);
v5 = cons(v4, 4LL * (int)a2 + 3);
abe__send(v3, v4, v5);
}
abe__send(v3, timing_actor, &nil__cons);
for ( i = 1; i != 1000000; ++i )
{
run_configuration(v3, 1000000LL);
fputc(46, stderr);
if ( *(int *)(v3 + 40) <= 0 )
break;
}
printf("< %dM messages delivered.\n", i);
report_actor_usage(v3);
v11 = 208;
return dbug_return(&v9);
}

original_code:
void
erlang_challenge(int n, int m)
{
 CONFIG* cfg;
 int cnt;
 struct dbug_ctx_t dbug_ctx; dbug_ctx.name = ("erlang_challenge"); dbug_ctx.depth = dbug_cfg->ctx->depth; dbug_ctx.line = 177; dbug_ctx.keyword = ""; dbug_ctx.unit = &dbug_unit; dbug_ctx.caller = dbug_cfg->ctx; dbug_enter (&dbug_ctx);
 cfg = new_configuration(10);
 timing_actor = abe__actor((cfg),(timing_beh),(((CONS*)(&nil__cons))));
 if (n <= 0) {
  CONS* ring;
  printf("Seeding unbounded growth message ring.\n");
  ring = abe__actor((cfg),(ring_seed_beh),(((CONS*)((((WORD)(0))<<2) | ((WORD)(0x00000003))))));
  abe__send((cfg),(ring),(ring));
 } else {
  CONS* countdown;
  printf("Sending %d messages around a ring of %d processes.\n", m, n);
  countdown = abe__actor((cfg),(countdown_builder_beh),(((CONS*)((((WORD)(n))<<2) | ((WORD)(0x00000003))))));
  abe__send((cfg),(countdown),(cons(countdown, ((CONS*)((((WORD)(m))<<2) | ((WORD)(0x00000003)))))));
 }
 abe__send((cfg),(timing_actor),(((CONS*)(&nil__cons))));
 for (cnt = 1; cnt < 1000000; ++cnt) {
  int max = 1000000;
  int rem;
  rem = run_configuration(cfg, max);
  fputc('.', stderr);
  if (cfg->q_count <= 0) {
   break;
  }
 }
 printf("< %dM messages delivered.\n", cnt);
 report_actor_usage(cfg);
 dbug_ctx.line = 208; dbug_return (&dbug_ctx); return;
}

canonical_original_code:
void erlang_challenge(int n, int m)
{
 struct config *cfg;
 int cnt;
 struct dbug_ctx_t dbug_ctx; dbug_ctx.name = ("erlang_challenge"); dbug_ctx.depth = dbug_cfg->ctx->depth; dbug_ctx.line = 177; dbug_ctx.keyword = ""; dbug_ctx.unit = &dbug_unit; dbug_ctx.caller = dbug_cfg->ctx; dbug_enter (&dbug_ctx);
 cfg = new_configuration(10);
 timing_actor = abe__actor((cfg),(timing_beh),(((struct cons *)(&nil__cons))));
 if (n <= 0) {
  struct cons *ring;
  printf("Seeding unbounded growth message ring.\n");
  ring = abe__actor((cfg),(ring_seed_beh),(((struct cons *)((((WORD)(0))<<2) | ((WORD)(0x00000003))))));
  abe__send((cfg),(ring),(ring));
 } else {
  struct cons *countdown;
  printf("Sending %d messages around a ring of %d processes.\n", m, n);
  countdown = abe__actor((cfg),(countdown_builder_beh),(((struct cons *)((((WORD)(n))<<2) | ((WORD)(0x00000003))))));
  abe__send((cfg),(countdown),(cons(countdown, ((struct cons *)((((WORD)(m))<<2) | ((WORD)(0x00000003)))))));
 }
 abe__send((cfg),(timing_actor),(((struct cons *)(&nil__cons))));
 for (cnt = 1; cnt < 1000000; ++cnt) {
  int max = 1000000;
  int rem;
  rem = run_configuration(cfg, max);
  fputc('.', stderr);
  if (cfg->q_count <= 0) {
   break;
  }
 }
 printf("< %dM messages delivered.\n", cnt);
 report_actor_usage(cfg);
 dbug_ctx.line = 208; dbug_return (&dbug_ctx); return;
}

variable_types: n int

variable_types: m int

variable_types: cnt int

variable_types: max int

variable_types: rem int

user_defined_types: struct cons { struct cons *first; struct cons *rest; }


banner

decompiled_code:
int banner()
{
return printf("%s v%s -- %s\n", Program, Version, Copyright);
}

canonical_decompiled_code:
int func9()
{
return printf("%s v%s -- %s\n", Program, Version, Copyright);
}

original_code:
void
banner(void)
{
 printf("%s v%s -- %s\n", _Program, _Version, _Copyright);
}

canonical_original_code:
void banner()
{
 printf("%s v%s -- %s\n", _Program, _Version, _Copyright);
}


original_code:
static int
match_set(char *set, char *key)
{
 int sense = 1;
 int match = 1;
 int klen;
 int len;
 char *p;
 if ((set == ((void *)0)) || (*set == '\0') || (*set == ':')) {
  return 1;
 }
 if (key == ((void *)0)) {
  return 0;
 }
 match = 0;
 klen = strlen(key);
 if (*set == '^') {
  sense = !sense;
  ++set;
 }
 p = set;
 for (;;) {
  while ((*p != ',') && (*p != ':') && (*p != '\0')) {
   ++p;
  }
  len = (int) (p - set);
  if ((len == klen) && (strncmp(set, key, klen) == 0)) {
   match = 1;
   break;
  }
  if ((*p == ':') || (*p == '\0')) {
   break;
  }
  set = ++p;
 }
 return (match == sense);
}

variable_types:
set
char *

variable_types:
key
char *

variable_types: sense int

variable_types: match int

variable_types: klen int

variable_types: len int

variable_types:
p
char *

return_type: int


selected

decompiled_code:
__int64 selected()
{
__int64 result; // rax
char **v1; // rbx
__int64 v2; // rbp

result = (unsigned int)dbug_on;
if ( dbug_on )
{
v1 = (char **)dbug_cfg;
v2 = *((_QWORD *)dbug_cfg + 10);
result = 0LL;
if ( *(_DWORD *)(v2 + 8) <= *((_DWORD *)dbug_cfg + 9) )
{
result = match_set(*((char **)dbug_cfg + 6), *((char **)dbug_cfg + 1));
if ( (_DWORD)result )
{
result = match_set(v1[7], *(char **)(*(_QWORD *)(v2 + 24) + 8LL));
if ( (_DWORD)result )
result = match_set(v1[8], *(char **)v2);
}
}
}
return result;
}

canonical_decompiled_code:
__int64 func1()
{
__int64 result; // rax
char **v1; // rbx
__int64 v2; // rbp

result = (unsigned int)dbug_on;
if ( dbug_on )
{
v1 = (char **)dbug_cfg;
v2 = *((_QWORD *)dbug_cfg + 10);
result = 0LL;
if ( *(_DWORD *)(v2 + 8) <= *((_DWORD *)dbug_cfg + 9) )
{
result = func0(*((char **)dbug_cfg + 6), *((char **)dbug_cfg + 1));
if ( (_DWORD)result )
{
result = func0(v1[7], *(char **)(*(_QWORD *)(v2 + 24) + 8LL));
if ( (_DWORD)result )
result = func0(v1[8], *(char **)v2);
}
}
}
return result;
}

original_code:
static int
selected(void)
{
 return (dbug_on
      && (dbug_cfg->ctx->depth <= dbug_cfg->maxdepth)
      && match_set(dbug_cfg->proc_list, dbug_cfg->process)
      && match_set(dbug_cfg->unit_list, dbug_cfg->ctx->unit->unit)
      && match_set(dbug_cfg->fn_list, dbug_cfg->ctx->name));
}

canonical_original_code:
static int selected()
{
 return (dbug_on
      && (dbug_cfg->ctx->depth <= dbug_cfg->maxdepth)
      && match_set(dbug_cfg->proc_list, dbug_cfg->process)
      && match_set(dbug_cfg->unit_list, dbug_cfg->ctx->unit->unit)
      && match_set(dbug_cfg->fn_list, dbug_cfg->ctx->name));
}


decompiled_code:
int __fastcall call_trace(void **a1)
{
void **v2; // rdi
int result; // eax

if ( a1 != &base_ctx && a1 )
{
v2 = (void **)a1[4];
if ( v2 == &base_ctx || !v2 )
{
result = fprintf(*((FILE **)dbug_cfg + 3), "%.31s", (const char *)*a1);
}
else
{
call_trace();
result = fprintf(*((FILE **)dbug_cfg + 3), ",%.31s", (const char *)*a1);
}
}
return result;
}

canonical_decompiled_code:
int __fastcall func2(void **a1)
{
void **v2; // rdi
int result; // eax

if ( a1 != &base_ctx && a1 )
{
v2 = (void **)a1[4];
if ( v2 == &base_ctx || !v2 )
{
result = fprintf(*((FILE **)dbug_cfg + 3), "%.31s", (const char *)*a1);
}
else
{
func2();
result = fprintf(*((FILE **)dbug_cfg + 3), ",%.31s", (const char *)*a1);
}
}
return result;
}

original_code:
static void
call_trace(struct dbug_ctx_t *ctx)
{
 if (ctx && (ctx != &base_ctx)) {
  if (ctx->caller && (ctx->caller != &base_ctx)) {
   call_trace(ctx->caller);
   fprintf(dbug_cfg->output, ",%.31s", ctx->name);
  } else {
   fprintf(dbug_cfg->output, "%.31s", ctx->name);
  }
 }
 return;
}

variable_types: struct dbug_ctx_t { char *name; int depth; int line; char *keyword; struct dbug_unit_t { char *name; char *unit; } *unit; struct dbug_ctx_t *caller; } *


decompiled_code:
char *__fastcall mk_string(_BYTE *a1)
{
const char *v1; // rsi
_BYTE *v2; // rdx
int v3; // edx

v1 = &a1[*a1 == 44];
if ( !*v1 || *v1 == 58 )
{
v3 = 0;
}
else
{
v2 = &a1[*a1 == 44];
do
++v2;
while ( *v2 && *v2 != 58 );
v3 = (_DWORD)v2 - (_DWORD)v1;
if ( (unsigned int)v3 > 0xFF )
v3 = 255;
}
memset(buf_0, 0, sizeof(buf_0));
strncpy(buf_0, v1, v3);
return buf_0;
}

canonical_decompiled_code:
char *__fastcall func3(_BYTE *a1)
{
const char *v1; // rsi
_BYTE *v2; // rdx
int v3; // edx

v1 = &a1[*a1 == 44];
if ( !*v1 || *v1 == 58 )
{
v3 = 0;
}
else
{
v2 = &a1[*a1 == 44];
do
++v2;
while ( *v2 && *v2 != 58 );
v3 = (_DWORD)v2 - (_DWORD)v1;
if ( (unsigned int)v3 > 0xFF )
v3 = 255;
}
memset(buf_0, 0, sizeof(buf_0));
strncpy(buf_0, v1, v3);
return buf_0;
}

original_code:
static char *
mk_string(char *p)
{
 static char buf[256];
 char *q;
 int n;
 if (*p == ',') {
  ++p;
 }
 for (q = p; *q && (*q != ':'); ++q)
  ;
 n = (int)(q - p);
 if (n > (sizeof(buf) - 1)) {
  n = (sizeof(buf) - 1);
 }
 memset(buf, '\0', sizeof(buf));
 strncpy(buf, p, n);
 return buf;
}

canonical_original_code:
static char *mk_string(char *p)
{
 static char buf[256];
 char *q;
 int n;
 if (*p == ',') {
  ++p;
 }
 for (q = p; *q && (*q != ':'); ++q)
  ;
 n = (int)(q - p);
 if (n > (sizeof(buf) - 1)) {
  n = (sizeof(buf) - 1);
 }
 memset(buf, '\0', sizeof(buf));
 strncpy(buf, p, n);
 return buf;
}

variable_types:
buf
char [256]

variable_types:
q
char *

return_type: char *


prefix

decompiled_code:
int prefix()
{
__int64 v0; // rax
int v1; // ebx
FILE **v2; // rax
__int64 v3; // rdx
struct tm *v4; // rax
time_t timer; // [rsp+0h] [rbp-10h] BYREF

LODWORD(v0) = dbug_on;
if ( dbug_on )
{
if ( (dbug_on & 0x100) != 0 )
{
v2 = (FILE **)dbug_cfg;
v3 = (unsigned int)(*((_DWORD *)dbug_cfg + 10) + 1);
*((_DWORD *)dbug_cfg + 10) = v3;
fprintf(v2[3], "%05d:", v3);
}
if ( (dbug_on & 0x1000) != 0 )
fprintf(*((FILE **)dbug_cfg + 3), "%.8s:", *((const char **)dbug_cfg + 1));
if ( (dbug_on & 0x2000) != 0 )
fprintf(*((FILE **)dbug_cfg + 3), "%05u:", *((unsigned int *)dbug_cfg + 4));
if ( (dbug_on & 0x200) != 0 )
{
time(&timer);
v4 = localtime(&timer);
fprintf(
*((FILE **)dbug_cfg + 3),
"%02d/%02d %02d.%02d.%02d:",
(unsigned int)(v4->tm_mon + 1),
(unsigned int)v4->tm_mday,
(unsigned int)v4->tm_hour,
(unsigned int)v4->tm_min,
(unsigned int)v4->tm_sec);
}
if ( (dbug_on & 0x400) != 0 )
fprintf(*((FILE **)dbug_cfg + 3), "%14.14s:", **(const char ***)(*((_QWORD *)dbug_cfg + 10) + 24LL));
if ( (dbug_on & 0x800) != 0 )
fprintf(*((FILE **)dbug_cfg + 3), "%-5d ", *(unsigned int *)(*((_QWORD *)dbug_cfg + 10) + 12LL));
if ( (dbug_on & 0x4000) != 0 )
fprintf(
*((FILE **)dbug_cfg + 3),
"%8.8s:",
*(const char **)(*(_QWORD *)(*((_QWORD *)dbug_cfg + 10) + 24LL) + 8LL));
if ( (dbug_on & 0x8000) != 0 )
fprintf(*((FILE **)dbug_cfg + 3), "%02d ", *(unsigned int *)(*((_QWORD *)dbug_cfg + 10) + 8LL));
if ( (dbug_on & 4) != 0 )
{
call_trace(*((void ***)dbug_cfg + 10));
LODWORD(v0) = fputc(32, *((FILE **)dbug_cfg + 3));
}
else if ( (dbug_on & 2) != 0 )
{
v0 = *((_QWORD *)dbug_cfg + 10);
v1 = *(_DWORD *)(v0 + 8);
if ( v1 > 0 )
{
do
{
LODWORD(v0) = fprintf(*((FILE **)dbug_cfg + 3), "%-*s", *((_DWORD *)dbug_cfg + 8), "|");
--v1;
}
while ( v1 );
}
}
else
{
LODWORD(v0) = fprintf(*((FILE **)dbug_cfg + 3), "%.31s ", **((const char ***)dbug_cfg + 10));
}
}
return v0;
}

canonical_decompiled_code:
int func7()
{
__int64 v0; // rax
int v1; // ebx
FILE **v2; // rax
__int64 v3; // rdx
struct tm *v4; // rax
time_t timer; // [rsp+0h] [rbp-10h] BYREF

LODWORD(v0) = dbug_on;
if ( dbug_on )
{
if ( (dbug_on & 0x100) != 0 )
{
v2 = (FILE **)dbug_cfg;
v3 = (unsigned int)(*((_DWORD *)dbug_cfg + 10) + 1);
*((_DWORD *)dbug_cfg + 10) = v3;
fprintf(v2[3], "%05d:", v3);
}
if ( (dbug_on & 0x1000) != 0 )
fprintf(*((FILE **)dbug_cfg + 3), "%.8s:", *((const char **)dbug_cfg + 1));
if ( (dbug_on & 0x2000) != 0 )
fprintf(*((FILE **)dbug_cfg + 3), "%05u:", *((unsigned int *)dbug_cfg + 4));
if ( (dbug_on & 0x200) != 0 )
{
time(&timer);
v4 = localtime(&timer);
fprintf(
*((FILE **)dbug_cfg + 3),
"%02d/%02d %02d.%02d.%02d:",
(unsigned int)(v4->tm_mon + 1),
(unsigned int)v4->tm_mday,
(unsigned int)v4->tm_hour,
(unsigned int)v4->tm_min,
(unsigned int)v4->tm_sec);
}
if ( (dbug_on & 0x400) != 0 )
fprintf(*((FILE **)dbug_cfg + 3), "%14.14s:", **(const char ***)(*((_QWORD *)dbug_cfg + 10) + 24LL));
if ( (dbug_on & 0x800) != 0 )
fprintf(*((FILE **)dbug_cfg + 3), "%-5d ", *(unsigned int *)(*((_QWORD *)dbug_cfg + 10) + 12LL));
if ( (dbug_on & 0x4000) != 0 )
fprintf(
*((FILE **)dbug_cfg + 3),
"%8.8s:",
*(const char **)(*(_QWORD *)(*((_QWORD *)dbug_cfg + 10) + 24LL) + 8LL));
if ( (dbug_on & 0x8000) != 0 )
fprintf(*((FILE **)dbug_cfg + 3), "%02d ", *(unsigned int *)(*((_QWORD *)dbug_cfg + 10) + 8LL));
if ( (dbug_on & 4) != 0 )
{
func2(*((void ***)dbug_cfg + 10));
LODWORD(v0) = fputc(32, *((FILE **)dbug_cfg + 3));
}
else if ( (dbug_on & 2) != 0 )
{
v0 = *((_QWORD *)dbug_cfg + 10);
v1 = *(_DWORD *)(v0 + 8);
if ( v1 > 0 )
{
do
{
LODWORD(v0) = fprintf(*((FILE **)dbug_cfg + 3), "%-*s", *((_DWORD *)dbug_cfg + 8), "|");
--v1;
}
while ( v1 );
}
}
else
{
LODWORD(v0) = fprintf(*((FILE **)dbug_cfg + 3), "%.31s ", **((const char ***)dbug_cfg + 10));
}
}
return v0;
}

original_code:
static void
prefix(void)
{
 if (!dbug_on) {
  return;
 }
 if (dbug_on & (0x0100)) {
  fprintf(dbug_cfg->output, "%05d:", ++dbug_cfg->line_cnt);
 }
 if (dbug_on & (0x1000)) {
  fprintf(dbug_cfg->output, "%.8s:", dbug_cfg->process);
 }
 if (dbug_on & (0x2000)) {
  fprintf(dbug_cfg->output, "%05u:", dbug_cfg->proc_id);
 }
 if (dbug_on & (0x0200)) {
  time_t t;
  struct tm *tm;
  time(&t);
  tm = localtime(&t);
  fprintf(dbug_cfg->output, "%02d/%02d %02d.%02d.%02d:",
   tm->tm_mon + 1, tm->tm_mday,
   tm->tm_hour, tm->tm_min, tm->tm_sec);
 }
 if (dbug_on & (0x0400)) {
  fprintf(dbug_cfg->output, "%14.14s:",
   dbug_cfg->ctx->unit->name);
 }
 if (dbug_on & (0x0800)) {
  fprintf(dbug_cfg->output, "%-5d ", dbug_cfg->ctx->line);
 }
 if (dbug_on & (0x4000)) {
  fprintf(dbug_cfg->output, "%8.8s:",
   dbug_cfg->ctx->unit->unit);
 }
 if (dbug_on & (0x8000)) {
  fprintf(dbug_cfg->output, "%02d ", dbug_cfg->ctx->depth);
 }
 if (dbug_on & (0x0004)) {
  call_trace(dbug_cfg->ctx);
  fputc(' ', dbug_cfg->output);
 } else if (dbug_on & (0x0002)) {
  int i;
  for (i = dbug_cfg->ctx->depth; i > 0; --i) {
   fprintf(dbug_cfg->output, "%-*s",
    dbug_cfg->indent, "|");
  }
 } else {
  fprintf(dbug_cfg->output, "%.31s ", dbug_cfg->ctx->name);
 }
 return;
}

canonical_original_code:
static void prefix()
{
 if (!dbug_on) {
  return;
 }
 if (dbug_on & (0x0100)) {
  fprintf(dbug_cfg->output, "%05d:", ++dbug_cfg->line_cnt);
 }
 if (dbug_on & (0x1000)) {
  fprintf(dbug_cfg->output, "%.8s:", dbug_cfg->process);
 }
 if (dbug_on & (0x2000)) {
  fprintf(dbug_cfg->output, "%05u:", dbug_cfg->proc_id);
 }
 if (dbug_on & (0x0200)) {
  long t;
  struct tm *tm;
  time(&t);
  tm = localtime(&t);
  fprintf(dbug_cfg->output, "%02d/%02d %02d.%02d.%02d:",
   tm->tm_mon + 1, tm->tm_mday,
   tm->tm_hour, tm->tm_min, tm->tm_sec);
 }
 if (dbug_on & (0x0400)) {
  fprintf(dbug_cfg->output, "%14.14s:",
   dbug_cfg->ctx->unit->name);
 }
 if (dbug_on & (0x0800)) {
  fprintf(dbug_cfg->output, "%-5d ", dbug_cfg->ctx->line);
 }
 if (dbug_on & (0x4000)) {
  fprintf(dbug_cfg->output, "%8.8s:",
   dbug_cfg->ctx->unit->unit);
 }
 if (dbug_on & (0x8000)) {
  fprintf(dbug_cfg->output, "%02d ", dbug_cfg->ctx->depth);
 }
 if (dbug_on & (0x0004)) {
  call_trace(dbug_cfg->ctx);
  fputc(' ', dbug_cfg->output);
 } else if (dbug_on & (0x0002)) {
  int i;
  for (i = dbug_cfg->ctx->depth; i > 0; --i) {
   fprintf(dbug_cfg->output, "%-*s",
    dbug_cfg->indent, "|");
  }
 } else {
  fprintf(dbug_cfg->output, "%.31s ", dbug_cfg->ctx->name);
 }
 return;
}

variable_types: t long

variable_types: struct tm { int tm_sec; int tm_min; int tm_hour; int tm_mday; int tm_mon; int tm_year; int tm_wday; int tm_yday; int tm_isdst; long __tm_gmtoff; char *__tm_zone; } *

variable_types: i int


decompiled_code:
void __noreturn io_error()
{
int *v0; // rax

v0 = _errno_location();
dbug_fatal("i/o error on dbug output file (errno=%d)", (unsigned int)*v0);
}

canonical_decompiled_code:
void __noreturn func9()
{
int *v0; // rax

v0 = _errno_location();
func4("i/o error on dbug output file (errno=%d)", (unsigned int)*v0);
}

original_code:
static void
io_error(void)
{
 dbug_fatal("i/o error on dbug output file (errno=%d)", (*__errno_location ()));
 return;
}

canonical_original_code:
static void io_error()
{
 dbug_fatal("i/o error on dbug output file (errno=%d)", (*__errno_location ()));
 return;
}


decompiled_code:
__int64 __fastcall dbug_keyword(char *s)
{
__int64 result; // rax

result = selected();
if ( (_DWORD)result )
result = match_set(*((char **)dbug_cfg + 9), s);
return result;
}

canonical_decompiled_code:
__int64 __fastcall func10(char *s)
{
__int64 result; // rax

result = func1();
if ( (_DWORD)result )
result = func0(*((char **)dbug_cfg + 9), s);
return result;
}

original_code:
int
dbug_keyword(char *key)
{
 return (selected() && match_set(dbug_cfg->kw_list, key));
}


decompiled_code:
int __fastcall dbug_enter(__int64 a1)
{
int result; // eax

*((_QWORD *)dbug_cfg + 10) = a1;
result = selected();
if ( result )
{
if ( (dbug_on & 2) != 0 )
{
prefix();
fprintf(*((FILE **)dbug_cfg + 3), ">%.31s\n", *(const char **)a1);
result = fflush(*((FILE **)dbug_cfg + 3));
if ( result == -1 )
io_error();
}
}
++*(_DWORD *)(a1 + 8);
return result;
}

canonical_decompiled_code:
int __fastcall func13(__int64 a1)
{
int result; // eax

*((_QWORD *)dbug_cfg + 10) = a1;
result = func1();
if ( result )
{
if ( (dbug_on & 2) != 0 )
{
func7();
fprintf(*((FILE **)dbug_cfg + 3), ">%.31s\n", *(const char **)a1);
result = fflush(*((FILE **)dbug_cfg + 3));
if ( result == -1 )
func9();
}
}
++*(_DWORD *)(a1 + 8);
return result;
}

original_code:
void
dbug_enter(struct dbug_ctx_t *ctx)
{
 dbug_cfg->ctx = ctx;
 if (selected() && (dbug_on & (0x0002))) {
  prefix();
  fprintf(dbug_cfg->output, ">%.31s\n", ctx->name);
  if (fflush(dbug_cfg->output) == (-1)) {
   io_error();
  }
 }
 ++ctx->depth;
 return;
}


decompiled_code:
int dbug_print(char *format, ...)
{
int result; // eax
gcc_va_list arg; // [rsp+8h] [rbp-D0h] BYREF

va_start(arg, format);
prefix();
fprintf(*((FILE **)dbug_cfg + 3), "%.31s: ", *(const char **)(*((_QWORD *)dbug_cfg + 10) + 16LL));
fflush(*((FILE **)dbug_cfg + 3));
vfprintf(*((FILE **)dbug_cfg + 3), format, arg);
fputc(10, *((FILE **)dbug_cfg + 3));
result = fflush(*((FILE **)dbug_cfg + 3));
if ( result == -1 )
io_error();
return result;
}

canonical_decompiled_code:
int func14(char *format, ...)
{
int result; // eax
gcc_va_list arg; // [rsp+8h] [rbp-D0h] BYREF

va_start(arg, format);
func7();
fprintf(*((FILE **)dbug_cfg + 3), "%.31s: ", *(const char **)(*((_QWORD *)dbug_cfg + 10) + 16LL));
fflush(*((FILE **)dbug_cfg + 3));
vfprintf(*((FILE **)dbug_cfg + 3), format, arg);
fputc(10, *((FILE **)dbug_cfg + 3));
result = fflush(*((FILE **)dbug_cfg + 3));
if ( result == -1 )
func9();
return result;
}

original_code:
void
dbug_print(char *fmt, ...)
{
 va_list va;
 prefix();
 fprintf(dbug_cfg->output, "%.31s: ", dbug_cfg->ctx->keyword);
 fflush(dbug_cfg->output);
 __builtin_va_start(va,fmt);
 vfprintf(dbug_cfg->output, fmt, va);
 __builtin_va_end(va);
 fputc('\n', dbug_cfg->output);
 if (fflush(dbug_cfg->output) == (-1)) {
  io_error();
 }
 return;
}

canonical_original_code:
void dbug_print(char *fmt, ...)
{
 __builtin_va_list va;
 prefix();
 fprintf(dbug_cfg->output, "%.31s: ", dbug_cfg->ctx->keyword);
 fflush(dbug_cfg->output);
 __builtin_va_start(va,fmt);
 vfprintf(dbug_cfg->output, fmt, va);
 __builtin_va_end(va);
 fputc('\n', dbug_cfg->output);
 if (fflush(dbug_cfg->output) == (-1)) {
  io_error();
 }
 return;
}

variable_types:
fmt
char *


decompiled_code:
void *__fastcall dbug_return(__int64 a1)
{
__int64 v1; // rax
void *result; // rax

v1 = *((_QWORD *)dbug_cfg + 10);
if ( v1 != a1 )
dbug_fatal(
"missing DBUG_RETURN detected in '%s' (%s:%d)",
*(const char **)v1,
**(const char ***)(v1 + 24),
*(unsigned int *)(v1 + 12));
--*(_DWORD *)(a1 + 8);
if ( (unsigned int)selected() )
{
if ( (dbug_on & 2) != 0 )
{
prefix();
fprintf(*((FILE **)dbug_cfg + 3), "<%.31s\n", *(const char **)a1);
if ( fflush(*((FILE **)dbug_cfg + 3)) == -1 )
io_error();
}
}
result = dbug_cfg;
*((_QWORD *)dbug_cfg + 10) = *(_QWORD *)(a1 + 32);
return result;
}

canonical_decompiled_code:
void *__fastcall func15(__int64 a1)
{
__int64 v1; // rax
void *result; // rax

v1 = *((_QWORD *)dbug_cfg + 10);
if ( v1 != a1 )
func4(
"missing DBUG_RETURN detected in '%s' (%s:%d)",
*(const char **)v1,
**(const char ***)(v1 + 24),
*(unsigned int *)(v1 + 12));
--*(_DWORD *)(a1 + 8);
if ( (unsigned int)func1() )
{
if ( (dbug_on & 2) != 0 )
{
func7();
fprintf(*((FILE **)dbug_cfg + 3), "<%.31s\n", *(const char **)a1);
if ( fflush(*((FILE **)dbug_cfg + 3)) == -1 )
func9();
}
}
result = dbug_cfg;
*((_QWORD *)dbug_cfg + 10) = *(_QWORD *)(a1 + 32);
return result;
}

original_code:
void
dbug_return(struct dbug_ctx_t *ctx)
{
 if (ctx != dbug_cfg->ctx) {
  dbug_fatal("missing DBUG_RETURN detected in '%s' (%s:%d)",
   dbug_cfg->ctx->name,
   dbug_cfg->ctx->unit->name,
   dbug_cfg->ctx->line);
 }
 --ctx->depth;
 if (selected() && (dbug_on & (0x0002))) {
  prefix();
  fprintf(dbug_cfg->output, "<%.31s\n", ctx->name);
  if (fflush(dbug_cfg->output) == (-1)) {
   io_error();
  }
 }
 dbug_cfg->ctx = ctx->caller;
 return;
}


original_code:
void
dbug_hexdump(void *p, int n)
{
 unsigned char *bp = p;
 char asc[16 + 1];
 int i;
 int c;
 while (n > 0) {
  fprintf(dbug_cfg->output, "%p  ", bp);
  for (i = 0; i < 16; ++i) {
   if (i < n) {
    c = bp[i];
    if ((c >= ' ') && (c < 0x7F)) {
     asc[i] = c;
    } else {
     asc[i] = '.';
    }
    fprintf(dbug_cfg->output, " %02x", c);
   } else {
    asc[i] = ' ';
    fprintf(dbug_cfg->output, "   ");
   }
  }
  asc[16] = '\0';
  fprintf(dbug_cfg->output, "  |%16.16s|\n", asc);
  bp += 16;
  n -= 16;
 }
 fflush(dbug_cfg->output);
}

canonical_original_code:
void dbug_hexdump(void *p, int n)
{
 unsigned char *bp = p;
 char asc[-1];
 int i;
 int c;
 while (n > 0) {
  fprintf(dbug_cfg->output, "%p  ", bp);
  for (i = 0; i < 16; ++i) {
   if (i < n) {
    c = bp[i];
    if ((c >= ' ') && (c < 0x7F)) {
     asc[i] = c;
    } else {
     asc[i] = '.';
    }
    fprintf(dbug_cfg->output, " %02x", c);
   } else {
    asc[i] = ' ';
    fprintf(dbug_cfg->output, "   ");
   }
  }
  asc[16] = '\0';
  fprintf(dbug_cfg->output, "  |%16.16s|\n", asc);
  bp += 16;
  n -= 16;
 }
 fflush(dbug_cfg->output);
}

variable_types:
p
void *

variable_types: n int

variable_types:
bp
unsigned char *

variable_types:
asc
char [-1]

variable_types: c int


decompiled_code:
__int64 __fastcall countdown_ring(__int64 a1)
{
__int64 v1; // r13
__int64 v2; // rax
__int64 v3; // r12
__int64 v4; // rax
__int64 v5; // rbp
__int64 v6; // rax
const void *v7; // r12
__int64 v8; // rax
__int64 v9; // rdx
const void *v10; // rax
const char *v12; // [rsp+0h] [rbp-58h] BYREF
int v13; // [rsp+8h] [rbp-50h]
int v14; // [rsp+Ch] [rbp-4Ch]
void *v15; // [rsp+10h] [rbp-48h]
char **v16; // [rsp+18h] [rbp-40h]
__int64 v17; // [rsp+20h] [rbp-38h]

v1 = cdr(*(_QWORD *)(a1 + 48));
v2 = car(*(_QWORD *)(a1 + 48));
v3 = mine(v2);
v4 = lu_atom(&unk_73B);
v5 = map_get_def(v3, v4, 0LL);
v6 = lu_atom(&unk_73D);
v7 = (const void *)map_get_def(v3, v6, 0LL);
v12 = "countdown_ring";
v8 = *(_QWORD *)(dbug_cfg + 80LL);
v13 = *(_DWORD *)(v8 + 8);
v14 = 46;
v15 = &unk_74E;
v16 = dbug_unit;
v17 = v8;
dbug_enter(&v12);
if ( dbug_on )
{
*(_QWORD *)(*(_QWORD *)(dbug_cfg + 80LL) + 16LL) = &unk_74E;
if ( (unsigned int)dbug_keyword(&unk_74E) )
{
*(_DWORD *)(*(_QWORD *)(dbug_cfg + 80LL) + 12LL) = 47;
v10 = (const void *)car(*(_QWORD *)(a1 + 48));
dbug_print("self=%p", v10);
}
if ( dbug_on )
{
*(_QWORD *)(*(_QWORD *)(dbug_cfg + 80LL) + 16LL) = &unk_74E;
if ( (unsigned int)dbug_keyword(&unk_74E) )
{
*(_DWORD *)(*(_QWORD *)(dbug_cfg + 80LL) + 12LL) = 48;
dbug_print("m=%d n=%d a=%p", v1 >> 2, v5 >> 2, v7);
}
}
}
v9 = v1 >> 2;
if ( (int)(v1 >> 2) < 0 )
{
abe__send(a1, v7, v5);
}
else if ( (int)(v5 >> 2) > 0 )
{
abe__send(a1, v7, v1);
}
else if ( (int)v9 > 0 )
{
abe__send(a1, v7, 4LL * ((int)v9 - 1) + 3);
}
v14 = 56;
return dbug_return(&v12);
}

original_code:
void countdown_ring (CONFIG* abe__config)
{
 CONS* m = _cdr((abe__config)->q_entry);
 CONS* state = _mine(_car((abe__config)->q_entry));
 CONS* n = map_get_def((state), (lu_atom("n")), ((void *)0));
 CONS* a = map_get_def((state), (lu_atom("a")), ((void *)0));
 struct dbug_ctx_t dbug_ctx; dbug_ctx.name = ("countdown_ring"); dbug_ctx.depth = dbug_cfg->ctx->depth; dbug_ctx.line = 46; dbug_ctx.keyword = ""; dbug_ctx.unit = &dbug_unit; dbug_ctx.caller = dbug_cfg->ctx; dbug_enter (&dbug_ctx);
 do{ if(dbug_on && dbug_keyword (dbug_cfg->ctx->keyword = (""))){ dbug_cfg->ctx->line = 47; dbug_print ("self=%p", _car((abe__config)->q_entry)); }}while(0);
 do{ if(dbug_on && dbug_keyword (dbug_cfg->ctx->keyword = (""))){ dbug_cfg->ctx->line = 48; dbug_print ("m=%d n=%d a=%p", ((int)(((WORD)(m))>>2)), ((int)(((WORD)(n))>>2)), a); }}while(0);
 if (((int)(((WORD)(m))>>2)) < 0) {
  abe__send((abe__config),(a),(n));
 } else if (0 < ((int)(((WORD)(n))>>2))) {
  abe__send((abe__config),(a),(m));
 } else if (0 < ((int)(((WORD)(m))>>2))) {
  abe__send((abe__config),(a),(((CONS*)((((WORD)(((int)(((WORD)(m))>>2)) - 1))<<2) | ((WORD)(0x00000003))))));
 }
 dbug_ctx.line = 56; dbug_return (&dbug_ctx); return;
}

canonical_original_code:
void countdown_ring(struct config *abe__config)
{
 struct cons *m = _cdr((abe__config)->q_entry);
 struct cons *state = _mine(_car((abe__config)->q_entry));
 struct cons *n = map_get_def((state), (lu_atom("n")), ((void *)0));
 struct cons *a = map_get_def((state), (lu_atom("a")), ((void *)0));
 struct dbug_ctx_t dbug_ctx; dbug_ctx.name = ("countdown_ring"); dbug_ctx.depth = dbug_cfg->ctx->depth; dbug_ctx.line = 46; dbug_ctx.keyword = ""; dbug_ctx.unit = &dbug_unit; dbug_ctx.caller = dbug_cfg->ctx; dbug_enter (&dbug_ctx);
 do{ if(dbug_on && dbug_keyword (dbug_cfg->ctx->keyword = (""))){ dbug_cfg->ctx->line = 47; dbug_print ("self=%p", _car((abe__config)->q_entry)); }}while(0);
 do{ if(dbug_on && dbug_keyword (dbug_cfg->ctx->keyword = (""))){ dbug_cfg->ctx->line = 48; dbug_print ("m=%d n=%d a=%p", ((int)(((WORD)(m))>>2)), ((int)(((WORD)(n))>>2)), a); }}while(0);
 if (((int)(((WORD)(m))>>2)) < 0) {
  abe__send((abe__config),(a),(n));
 } else if (0 < ((int)(((WORD)(n))>>2))) {
  abe__send((abe__config),(a),(m));
 } else if (0 < ((int)(((WORD)(m))>>2))) {
  abe__send((abe__config),(a),(((struct cons *)((((WORD)(((int)(((WORD)(m))>>2)) - 1))<<2) | ((WORD)(0x00000003))))));
 }
 dbug_ctx.line = 56; dbug_return (&dbug_ctx); return;
}

variable_types: struct config { struct cell { struct cons { struct cons *first; struct cons *rest; } *first; struct cons *rest; long _prev; long _next; } msg_queue; struct cons *gc_root; int q_count; struct cons *q_entry; int msg_cnt_hi; int msg_cnt_lo; int q_limit; long t_epoch; long t_now_s; long t_now_us; struct cons *t_queue; int t_count; } *

variable_types: struct dbug_ctx_t { char *name; int depth; int line; char *keyword; struct dbug_unit_t { char *name; char *unit; } *unit; struct dbug_ctx_t *caller; }


challenge

decompiled_code:
__int64 __fastcall challenge(__int64 a1)
{
const void *v1; // r13
__int64 v2; // rax
__int64 v3; // r12
__int64 v4; // rax
__int64 v5; // r14
__int64 v6; // rax
const void *v7; // rbp
__int64 v8; // rax
__int64 v9; // rax
__int64 v10; // rax
__int64 v11; // rbp
__int64 v12; // rax
__int64 v13; // r12
__int64 v14; // rax
const void *v16; // rax
__int64 v17; // rax
__int64 v18; // rbp
__int64 v19; // rax
__int64 v20; // rbp
__int64 v21; // rax
const char *v22; // [rsp+0h] [rbp-58h] BYREF
int v23; // [rsp+8h] [rbp-50h]
int v24; // [rsp+Ch] [rbp-4Ch]
void *v25; // [rsp+10h] [rbp-48h]
char **v26; // [rsp+18h] [rbp-40h]
__int64 v27; // [rsp+20h] [rbp-38h]

v1 = (const void *)cdr(*(_QWORD *)(a1 + 48));
v2 = car(*(_QWORD *)(a1 + 48));
v3 = mine(v2);
v4 = lu_atom(&unk_73B);
v5 = map_get_def(v3, v4, 0LL);
v6 = lu_atom(&unk_73D);
v7 = (const void *)map_get_def(v3, v6, 0LL);
v22 = "challenge";
v8 = *(_QWORD *)(dbug_cfg + 80LL);
v23 = *(_DWORD *)(v8 + 8);
v24 = 81;
v25 = &unk_74E;
v26 = dbug_unit;
v27 = v8;
dbug_enter(&v22);
if ( dbug_on )
{
*(_QWORD *)(*(_QWORD *)(dbug_cfg + 80LL) + 16LL) = &unk_74E;
if ( (unsigned int)dbug_keyword(&unk_74E) )
{
*(_DWORD *)(*(_QWORD *)(dbug_cfg + 80LL) + 12LL) = 82;
v16 = (const void *)car(*(_QWORD *)(a1 + 48));
dbug_print("self=%p", v16);
}
if ( dbug_on )
{
*(_QWORD *)(*(_QWORD *)(dbug_cfg + 80LL) + 16LL) = &unk_74E;
if ( (unsigned int)dbug_keyword(&unk_74E) )
{
*(_DWORD *)(*(_QWORD *)(dbug_cfg + 80LL) + 12LL) = 83;
dbug_print("msg=%p n=%d a=%p", v1, v5 >> 2, v7);
}
}
}
if ( (int)(v5 >> 2) <= 0 )
{
v17 = lu_atom(&unk_73D);
v18 = map_put(&nil__cons, v17, v1);
v19 = lu_atom(&unk_73B);
v20 = map_put(v18, v19, v5);
v21 = car(*(_QWORD *)(a1 + 48));
abe__become(v21, countdown_ring, v20);
abe__send(a1, v1, 403LL);
}
else
{
v9 = lu_atom(&unk_73B);
v10 = map_put(&nil__cons, v9, 4LL * (int)((v5 >> 2) - 1) + 3);
v11 = abe__actor(a1, challenge, v10);
v12 = lu_atom(&unk_73D);
v13 = map_put(v3, v12, v11);
v14 = car(*(_QWORD *)(a1 + 48));
abe__become(v14, countdown_ring, v13);
abe__send(a1, v11, v1);
}
v24 = 95;
return dbug_return(&v22);
}

original_code:
void challenge (CONFIG* abe__config)
{
 CONS* msg = _cdr((abe__config)->q_entry);
 CONS* state = _mine(_car((abe__config)->q_entry));
 CONS* n = map_get_def((state), (lu_atom("n")), ((void *)0));
 CONS* a = map_get_def((state), (lu_atom("a")), ((void *)0));
 struct dbug_ctx_t dbug_ctx; dbug_ctx.name = ("challenge"); dbug_ctx.depth = dbug_cfg->ctx->depth; dbug_ctx.line = 81; dbug_ctx.keyword = ""; dbug_ctx.unit = &dbug_unit; dbug_ctx.caller = dbug_cfg->ctx; dbug_enter (&dbug_ctx);
 do{ if(dbug_on && dbug_keyword (dbug_cfg->ctx->keyword = (""))){ dbug_cfg->ctx->line = 82; dbug_print ("self=%p", _car((abe__config)->q_entry)); }}while(0);
 do{ if(dbug_on && dbug_keyword (dbug_cfg->ctx->keyword = (""))){ dbug_cfg->ctx->line = 83; dbug_print ("msg=%p n=%d a=%p", msg, ((int)(((WORD)(n))>>2)), a); }}while(0);
 if (0 < ((int)(((WORD)(n))>>2))) {
  a = abe__actor((abe__config),(challenge),(map_put(((CONS*)(&nil__cons)), lu_atom("n"), ((CONS*)((((WORD)(((int)(((WORD)(n))>>2)) - 1))<<2) | ((WORD)(0x00000003)))))));
  abe__become(_car((abe__config)->q_entry),(countdown_ring),(map_put(state, lu_atom("a"), a)));
  abe__send((abe__config),(a),(msg));
 } else {
  state = ((CONS*)(&nil__cons));
  state = map_put(state, lu_atom("a"), msg);
  state = map_put(state, lu_atom("n"), n);
  abe__become(_car((abe__config)->q_entry),(countdown_ring),(state));
  abe__send((abe__config),(msg),(((CONS*)((((WORD)((100)))<<2) | ((WORD)(0x00000003))))));
 }
 dbug_ctx.line = 95; dbug_return (&dbug_ctx); return;
}

canonical_original_code:
void challenge(struct config *abe__config)
{
 struct cons *msg = _cdr((abe__config)->q_entry);
 struct cons *state = _mine(_car((abe__config)->q_entry));
 struct cons *n = map_get_def((state), (lu_atom("n")), ((void *)0));
 struct cons *a = map_get_def((state), (lu_atom("a")), ((void *)0));
 struct dbug_ctx_t dbug_ctx; dbug_ctx.name = ("challenge"); dbug_ctx.depth = dbug_cfg->ctx->depth; dbug_ctx.line = 81; dbug_ctx.keyword = ""; dbug_ctx.unit = &dbug_unit; dbug_ctx.caller = dbug_cfg->ctx; dbug_enter (&dbug_ctx);
 do{ if(dbug_on && dbug_keyword (dbug_cfg->ctx->keyword = (""))){ dbug_cfg->ctx->line = 82; dbug_print ("self=%p", _car((abe__config)->q_entry)); }}while(0);
 do{ if(dbug_on && dbug_keyword (dbug_cfg->ctx->keyword = (""))){ dbug_cfg->ctx->line = 83; dbug_print ("msg=%p n=%d a=%p", msg, ((int)(((WORD)(n))>>2)), a); }}while(0);
 if (0 < ((int)(((WORD)(n))>>2))) {
  a = abe__actor((abe__config),(challenge),(map_put(((struct cons *)(&nil__cons)), lu_atom("n"), ((struct cons *)((((WORD)(((int)(((WORD)(n))>>2)) - 1))<<2) | ((WORD)(0x00000003)))))));
  abe__become(_car((abe__config)->q_entry),(countdown_ring),(map_put(state, lu_atom("a"), a)));
  abe__send((abe__config),(a),(msg));
 } else {
  state = ((struct cons *)(&nil__cons));
  state = map_put(state, lu_atom("a"), msg);
  state = map_put(state, lu_atom("n"), n);
  abe__become(_car((abe__config)->q_entry),(countdown_ring),(state));
  abe__send((abe__config),(msg),(((struct cons *)((((WORD)((100)))<<2) | ((WORD)(0x00000003))))));
 }
 dbug_ctx.line = 95; dbug_return (&dbug_ctx); return;
}

variable_types: struct cons { struct cons *first; struct cons *rest; } *


decompiled_code:
__int64 __fastcall test_erlang_challenge(int a1)
{
__int64 v1; // rax
__int64 v2; // rbp
__int64 v3; // rax
__int64 v4; // rax
__int64 v5; // rax
unsigned int i; // ebx
const char *v8; // [rsp+0h] [rbp-48h] BYREF
int v9; // [rsp+8h] [rbp-40h]
int v10; // [rsp+Ch] [rbp-3Ch]
void *v11; // [rsp+10h] [rbp-38h]
char **v12; // [rsp+18h] [rbp-30h]
__int64 v13; // [rsp+20h] [rbp-28h]

v8 = "test_erlang_challenge";
v1 = *(_QWORD *)(dbug_cfg + 80LL);
v9 = *(_DWORD *)(v1 + 8);
v10 = 110;
v11 = &unk_74E;
v12 = dbug_unit;
v13 = v1;
dbug_enter(&v8);
v2 = new_configuration(10LL);
v3 = lu_atom(&unk_73B);
v4 = map_put(&nil__cons, v3, 4LL * a1 + 3);
v5 = abe__actor(v2, challenge, v4);
abe__send(v2, v5, v5);
for ( i = 1; i != 1000000; ++i )
{
run_configuration(v2, 1000000LL);
if ( *(int *)(v2 + 40) <= 0 )
break;
}
printf("~%dM messages delivered.\n", i);
report_actor_usage(v2);
v10 = 123;
return dbug_return(&v8);
}

canonical_decompiled_code:
__int64 __fastcall func2(int a1)
{
__int64 v1; // rax
__int64 v2; // rbp
__int64 v3; // rax
__int64 v4; // rax
__int64 v5; // rax
unsigned int i; // ebx
const char *v8; // [rsp+0h] [rbp-48h] BYREF
int v9; // [rsp+8h] [rbp-40h]
int v10; // [rsp+Ch] [rbp-3Ch]
void *v11; // [rsp+10h] [rbp-38h]
char **v12; // [rsp+18h] [rbp-30h]
__int64 v13; // [rsp+20h] [rbp-28h]

v8 = "test_erlang_challenge";
v1 = *(_QWORD *)(dbug_cfg + 80LL);
v9 = *(_DWORD *)(v1 + 8);
v10 = 110;
v11 = &unk_74E;
v12 = dbug_unit;
v13 = v1;
dbug_enter(&v8);
v2 = new_configuration(10LL);
v3 = lu_atom(&unk_73B);
v4 = map_put(&nil__cons, v3, 4LL * a1 + 3);
v5 = abe__actor(v2, challenge, v4);
abe__send(v2, v5, v5);
for ( i = 1; i != 1000000; ++i )
{
run_configuration(v2, 1000000LL);
if ( *(int *)(v2 + 40) <= 0 )
break;
}
printf("~%dM messages delivered.\n", i);
report_actor_usage(v2);
v10 = 123;
return dbug_return(&v8);
}

original_code:
void
test_erlang_challenge(int counter)
{
 CONFIG* cfg;
 CONS* actor;
 int n;
 int m;
 struct dbug_ctx_t dbug_ctx; dbug_ctx.name = ("test_erlang_challenge"); dbug_ctx.depth = dbug_cfg->ctx->depth; dbug_ctx.line = 110; dbug_ctx.keyword = ""; dbug_ctx.unit = &dbug_unit; dbug_ctx.caller = dbug_cfg->ctx; dbug_enter (&dbug_ctx);
 cfg = new_configuration(10);
 actor = abe__actor((cfg),(challenge),(map_put(((CONS*)(&nil__cons)), lu_atom("n"), ((CONS*)((((WORD)(counter))<<2) | ((WORD)(0x00000003)))))));
 abe__send((cfg),(actor),(actor));
 for (m = 1; m < 1000000; ++m) {
  n = run_configuration(cfg, 1000000);
  if (cfg->q_count <= 0) {
   break;
  }
 }
 printf("~%dM messages delivered.\n", m);
 report_actor_usage(cfg);
 dbug_ctx.line = 123; dbug_return (&dbug_ctx); return;
}

canonical_original_code:
void test_erlang_challenge(int counter)
{
 struct config *cfg;
 struct cons *actor;
 int n;
 int m;
 struct dbug_ctx_t dbug_ctx; dbug_ctx.name = ("test_erlang_challenge"); dbug_ctx.depth = dbug_cfg->ctx->depth; dbug_ctx.line = 110; dbug_ctx.keyword = ""; dbug_ctx.unit = &dbug_unit; dbug_ctx.caller = dbug_cfg->ctx; dbug_enter (&dbug_ctx);
 cfg = new_configuration(10);
 actor = abe__actor((cfg),(challenge),(map_put(((struct cons *)(&nil__cons)), lu_atom("n"), ((struct cons *)((((WORD)(counter))<<2) | ((WORD)(0x00000003)))))));
 abe__send((cfg),(actor),(actor));
 for (m = 1; m < 1000000; ++m) {
  n = run_configuration(cfg, 1000000);
  if (cfg->q_count <= 0) {
   break;
  }
 }
 printf("~%dM messages delivered.\n", m);
 report_actor_usage(cfg);
 dbug_ctx.line = 123; dbug_return (&dbug_ctx); return;
}

variable_types: counter int

variable_types: m int


banner

canonical_decompiled_code:
int func5()
{
return printf("%s v%s -- %s\n", Program, Version, Copyright);
}


decompiled_code:
__int64 lu_cons()
{
__int64 result; // rax

result = gc_perm();
++lu_cons_cnt;
return result;
}

canonical_decompiled_code:
__int64 func0()
{
__int64 result; // rax

result = gc_perm();
++lu_cons_cnt;
return result;
}

original_code:
CONS*
lu_cons(CONS* a, CONS* d)
{
 CONS* p = ((void *)0);
 p = gc_perm(a, d);
 ++lu_cons_cnt;
 ;
 return p;
}

canonical_original_code:
struct cons *lu_cons(struct cons *a, struct cons *d)
{
 struct cons *p = ((void *)0);
 p = gc_perm(a, d);
 ++lu_cons_cnt;
 ;
 return p;
}

variable_types:
a
struct cons *

variable_types:
d
struct cons *

return_type: struct cons { struct cons *first; struct cons *rest; } *


decompiled_code:
unsigned __int64 __fastcall lu_extend_atom(void *a1, int a2)
{
__int64 v2; // r12
__int64 v3; // rbp
unsigned __int64 v4; // r12
void *v5; // rbx
__int64 v6; // rax
__int64 v7; // rax
__int64 v8; // rax
__int64 v9; // rbx
__int64 v10; // rax

v2 = (__int64)a1;
v3 = 4LL * a2 + 3;
if ( !lu_atom_root )
lu_atom_root = lu_cons(&nil__cons) & 0xFFFFFFFFFFFFFFFCLL | 2;
if ( a1 == &nil__cons || !a1 )
v2 = lu_atom_root;
if ( (v2 & 3) != 2 )
_assert_fail("atomp(atom)", "atom.c", 0x2Eu, "lu_extend_atom");
v4 = v2 & 0xFFFFFFFFFFFFFFFCLL;
v5 = (void *)cdr(v4);
if ( v5 == &nil__cons )
{
LABEL_10:
car(v4);
v8 = lu_cons(v3);
v9 = lu_cons(v8);
cdr(v4);
v10 = lu_cons(v9);
rplacd(v4, v10);
}
else
{
while ( 1 )
{
v6 = car(v5);
v7 = car(v6);
if ( v3 == car(v7) )
break;
v5 = (void *)cdr(v5);
if ( v5 == &nil__cons )
goto LABEL_10;
}
v9 = car(v5);
}
return v9 & 0xFFFFFFFFFFFFFFFCLL | 2;
}

canonical_decompiled_code:
unsigned __int64 __fastcall func1(void *a1, int a2)
{
__int64 v2; // r12
__int64 v3; // rbp
unsigned __int64 v4; // r12
void *v5; // rbx
__int64 v6; // rax
__int64 v7; // rax
__int64 v8; // rax
__int64 v9; // rbx
__int64 v10; // rax

v2 = (__int64)a1;
v3 = 4LL * a2 + 3;
if ( !lu_atom_root )
lu_atom_root = func0(&nil__cons) & 0xFFFFFFFFFFFFFFFCLL | 2;
if ( a1 == &nil__cons || !a1 )
v2 = lu_atom_root;
if ( (v2 & 3) != 2 )
_assert_fail("atomp(atom)", "atom.c", 0x2Eu, "lu_extend_atom");
v4 = v2 & 0xFFFFFFFFFFFFFFFCLL;
v5 = (void *)cdr(v4);
if ( v5 == &nil__cons )
{
LABEL_10:
car(v4);
v8 = func0(v3);
v9 = func0(v8);
cdr(v4);
v10 = func0(v9);
rplacd(v4, v10);
}
else
{
while ( 1 )
{
v6 = car(v5);
v7 = car(v6);
if ( v3 == car(v7) )
break;
v5 = (void *)cdr(v5);
if ( v5 == &nil__cons )
goto LABEL_10;
}
v9 = car(v5);
}
return v9 & 0xFFFFFFFFFFFFFFFCLL | 2;
}

canonical_original_code:
struct cons *lu_extend_atom(struct cons *atom, int c)
{
 struct cons *root;
 struct cons *node;
 struct cons *ch = ((CONS*)((((WORD)(c))<<2) | ((WORD)(0x00000003))));
 ;
 ;
 ;
 if (lu_atom_root == ((void *)0)) {
  root = lu_cons(((struct cons *)(&nil__cons)), ((struct cons *)(&nil__cons)));
  ;
  lu_atom_root = ((struct cons *)((((WORD)(root)) & ~((WORD)(0x00000003))) | ((WORD)(0x00000002))));
 }
 if ((atom == ((void *)0)) || ((BOOL)((atom)==((struct cons *)(&nil__cons))))) {
  atom = lu_atom_root;
 }
 ((((BOOL)((((WORD)(atom)) & ((WORD)(0x00000003))) == ((WORD)(0x00000002))))) ? (void) (0) : __assert_fail ("atomp(atom)", "atom.c", 46, __extension__ __PRETTY_FUNCTION__));
 root = ((struct cons *)((((WORD)(atom)) & ~((WORD)(0x00000003))) | ((WORD)(0x00000000))));
 ;
 node = _cdr(root);
 for (;;) {
  ;
  if (((BOOL)((node)==((struct cons *)(&nil__cons))))) {
   ;
   node = lu_cons(ch, _car(root));
   node = lu_cons(node, ((struct cons *)(&nil__cons)));
   rplacd(root, lu_cons(node, _cdr(root)));
   break;
  }
  if (_car(_car(_car(node))) == ch) {
   ;
   node = _car(node);
   break;
  }
  node = _cdr(node);
 }
 atom = ((struct cons *)((((WORD)(node)) & ~((WORD)(0x00000003))) | ((WORD)(0x00000002))));
 ((((BOOL)((((WORD)(atom)) & ((WORD)(0x00000003))) == ((WORD)(0x00000002))))) ? (void) (0) : __assert_fail ("atomp(atom)", "atom.c", 69, __extension__ __PRETTY_FUNCTION__));
 return atom;
}

variable_types:
atom
struct cons *


decompiled_code:
void *__fastcall lu_atom(_BYTE *a1)
{
int v1; // esi
char *v2; // rbx
unsigned __int64 v3; // rdi

if ( !a1 )
return &nil__cons;
LOBYTE(v1) = *a1;
if ( !*a1 )
return &nil__cons;
v2 = a1 + 1;
v1 = (char)v1;
if ( (_BYTE)v1 )
{
v3 = (unsigned __int64)&nil__cons;
do
{
v3 = lu_extend_atom((void *)v3, v1);
v1 = *v2++;
}
while ( *(v2 - 1) );
}
else
{
v3 = (unsigned __int64)&nil__cons;
}
if ( (v3 & 3) != 2 )
_assert_fail("atomp(atom)", "atom.c", 0x5Au, "lu_atom");
return (void *)v3;
}

canonical_decompiled_code:
void *__fastcall func2(_BYTE *a1)
{
int v1; // esi
char *v2; // rbx
unsigned __int64 v3; // rdi

if ( !a1 )
return &nil__cons;
LOBYTE(v1) = *a1;
if ( !*a1 )
return &nil__cons;
v2 = a1 + 1;
v1 = (char)v1;
if ( (_BYTE)v1 )
{
v3 = (unsigned __int64)&nil__cons;
do
{
v3 = func1((void *)v3, v1);
v1 = *v2++;
}
while ( *(v2 - 1) );
}
else
{
v3 = (unsigned __int64)&nil__cons;
}
if ( (v3 & 3) != 2 )
_assert_fail("atomp(atom)", "atom.c", 0x5Au, "lu_atom");
return (void *)v3;
}

original_code:
CONS*
lu_atom(char* s)
{
 CONS* atom;
 int c;
 ;
 ;
 if ((s == ((void *)0)) || (*s == '\0')) {
  ;
  return ((CONS*)(&nil__cons));
 }
 atom = ((CONS*)(&nil__cons));
 while ((c = *s++) != '\0') {
  atom = lu_extend_atom(atom, c);
 }
 ((((BOOL)((((WORD)(atom)) & ((WORD)(0x00000003))) == ((WORD)(0x00000002))))) ? (void) (0) : __assert_fail ("atomp(atom)", "atom.c", 90, __extension__ __PRETTY_FUNCTION__));
 ;
 return atom;
}

canonical_original_code:
struct cons *lu_atom(char *s)
{
 struct cons *atom;
 int c;
 ;
 ;
 if ((s == ((void *)0)) || (*s == '\0')) {
  ;
  return ((struct cons *)(&nil__cons));
 }
 atom = ((struct cons *)(&nil__cons));
 while ((c = *s++) != '\0') {
  atom = lu_extend_atom(atom, c);
 }
 ((((BOOL)((((WORD)(atom)) & ((WORD)(0x00000003))) == ((WORD)(0x00000002))))) ? (void) (0) : __assert_fail ("atomp(atom)", "atom.c", 90, __extension__ __PRETTY_FUNCTION__));
 ;
 return atom;
}

variable_types:
s
char *


decompiled_code:
char *__fastcall atom_str(__int64 a1)
{
char *result; // rax
void *v2; // rbx
unsigned int v3; // eax
unsigned int v4; // ebp
__int64 v5; // rbp

if ( !a1 )
return (char *)&unk_8C3;
result = (char *)&unk_8C3;
if ( (a1 & 3) != 2 )
return result;
v2 = (void *)car(a1 & 0xFFFFFFFFFFFFFFFCLL);
v3 = length(v2);
v4 = v3;
if ( v3 <= 0xFF )
{
s_3[v3] = 0;
LODWORD(v5) = v3 - 1;
if ( (int)(v3 - 1) < 0 )
goto LABEL_8;
}
else
{
do
{
v2 = (void *)cdr(v2);
--v4;
}
while ( v4 != 255 );
byte_89F = 0;
LODWORD(v5) = 254;
}
v5 = (int)v5;
do
{
s_3[v5] = car(v2) >> 2;
v2 = (void *)cdr(v2);
--v5;
}
while ( (int)v5 >= 0 );
LABEL_8:
if ( v2 != &nil__cons )
_assert_fail("nilp(p)", "atom.c", 0x76u, "atom_str");
return s_3;
}

canonical_decompiled_code:
char *__fastcall func3(__int64 a1)
{
char *result; // rax
void *v2; // rbx
unsigned int v3; // eax
unsigned int v4; // ebp
__int64 v5; // rbp

if ( !a1 )
return (char *)&unk_8C3;
result = (char *)&unk_8C3;
if ( (a1 & 3) != 2 )
return result;
v2 = (void *)car(a1 & 0xFFFFFFFFFFFFFFFCLL);
v3 = length(v2);
v4 = v3;
if ( v3 <= 0xFF )
{
s_3[v3] = 0;
LODWORD(v5) = v3 - 1;
if ( (int)(v3 - 1) < 0 )
goto LABEL_8;
}
else
{
do
{
v2 = (void *)cdr(v2);
--v4;
}
while ( v4 != 255 );
byte_89F = 0;
LODWORD(v5) = 254;
}
v5 = (int)v5;
do
{
s_3[v5] = car(v2) >> 2;
v2 = (void *)cdr(v2);
--v5;
}
while ( (int)v5 >= 0 );
LABEL_8:
if ( v2 != &nil__cons )
_assert_fail("nilp(p)", "atom.c", 0x76u, "atom_str");
return s_3;
}

variable_types:
s
char [256]


decompiled_code:
__int64 test_atom()
{
__int64 v0; // rax
void *v1; // rbx
void *v2; // rax
void *v3; // rbx
void *v4; // rbp
void *v5; // rax
void *v6; // rbx
bool v7; // cf
bool v8; // zf
char *v9; // rdi
const char *v10; // rsi
__int64 v11; // rcx
void *v12; // rbp
__int64 v14; // rbx
const char *v15; // [rsp+0h] [rbp-148h] BYREF
int v16; // [rsp+8h] [rbp-140h]
int v17; // [rsp+Ch] [rbp-13Ch]
void *v18; // [rsp+10h] [rbp-138h]
char **v19; // [rsp+18h] [rbp-130h]
__int64 v20; // [rsp+20h] [rbp-128h]
__int64 v21[35]; // [rsp+30h] [rbp-118h] BYREF

v15 = "test_atom";
v0 = *(_QWORD *)(dbug_cfg + 80LL);
v16 = *(_DWORD *)(v0 + 8);
v17 = 130;
v18 = &unk_8C3;
v19 = &dbug_unit;
v20 = v0;
dbug_enter(&v15);
puts("--test_atom--");
v1 = lu_atom(0LL);
v2 = lu_atom(&unk_8C3);
if ( v1 != &nil__cons )
_assert_fail("nilp(p)", "atom.c", 0x86u, "test_atom");
if ( v2 != &nil__cons )
_assert_fail("p == q", "atom.c", 0x87u, "test_atom");
if ( *atom_str((__int64)&nil__cons) )
_assert_fail("atom_str(q)[0] == '\\0'", "atom.c", 0x88u, "test_atom");
v21[0] = 84LL;
v3 = lu_atom("T");
if ( v3 != lu_atom(v21) )
_assert_fail("p == q", "atom.c", 0x8Eu, "test_atom");
v4 = lu_atom("n");
if ( v3 == v4 )
_assert_fail("p != q", "atom.c", 0x90u, "test_atom");
v21[0] = 7104878LL;
v5 = lu_atom("nil");
v6 = v5;
if ( v4 == v5 )
_assert_fail("p != q", "atom.c", 0x94u, "test_atom");
v9 = atom_str((__int64)v5);
v10 = "nil";
v11 = 4LL;
do
{
if ( !v11 )
break;
v7 = (unsigned int)*v10 < (unsigned __int8)*v9;
v8 = *v10++ == (unsigned __int8)*v9++;
--v11;
}
while ( v8 );
if ( (!v7 && !v8) != v7 )
_assert_fail("strcmp(s, atom_str(p)) == 0", "atom.c", 0x95u, "test_atom");
v12 = lu_atom(v21);
if ( v6 != v12 )
_assert_fail("p == q", "atom.c", 0x97u, "test_atom");
if ( v12 == lu_atom("F") )
_assert_fail("p != q", "atom.c", 0x99u, "test_atom");
if ( dbug_on )
{
v14 = lu_atom_root;
*(_QWORD *)(*(_QWORD *)(dbug_cfg + 80LL) + 16LL) = &unk_8C3;
if ( (unsigned int)dbug_keyword(&unk_8C3, v10) )
{
*(_DWORD *)(*(_QWORD *)(dbug_cfg + 80LL) + 12LL) = 156;
v10 = (const char *)cons_to_str(v14 & 0xFFFFFFFFFFFFFFFCLL);
dbug_print("lu_atom_root=%s", v10);
}
}
v17 = 157;
return dbug_return(&v15, v10);
}

canonical_decompiled_code:
__int64 func4()
{
__int64 v0; // rax
void *v1; // rbx
void *v2; // rax
void *v3; // rbx
void *v4; // rbp
void *v5; // rax
void *v6; // rbx
bool v7; // cf
bool v8; // zf
char *v9; // rdi
const char *v10; // rsi
__int64 v11; // rcx
void *v12; // rbp
__int64 v14; // rbx
const char *v15; // [rsp+0h] [rbp-148h] BYREF
int v16; // [rsp+8h] [rbp-140h]
int v17; // [rsp+Ch] [rbp-13Ch]
void *v18; // [rsp+10h] [rbp-138h]
char **v19; // [rsp+18h] [rbp-130h]
__int64 v20; // [rsp+20h] [rbp-128h]
__int64 v21[35]; // [rsp+30h] [rbp-118h] BYREF

v15 = "test_atom";
v0 = *(_QWORD *)(dbug_cfg + 80LL);
v16 = *(_DWORD *)(v0 + 8);
v17 = 130;
v18 = &unk_8C3;
v19 = &dbug_unit;
v20 = v0;
dbug_enter(&v15);
puts("--test_atom--");
v1 = func2(0LL);
v2 = func2(&unk_8C3);
if ( v1 != &nil__cons )
_assert_fail("nilp(p)", "atom.c", 0x86u, "test_atom");
if ( v2 != &nil__cons )
_assert_fail("p == q", "atom.c", 0x87u, "test_atom");
if ( *func3((__int64)&nil__cons) )
_assert_fail("atom_str(q)[0] == '\\0'", "atom.c", 0x88u, "test_atom");
v21[0] = 84LL;
v3 = func2("T");
if ( v3 != func2(v21) )
_assert_fail("p == q", "atom.c", 0x8Eu, "test_atom");
v4 = func2("n");
if ( v3 == v4 )
_assert_fail("p != q", "atom.c", 0x90u, "test_atom");
v21[0] = 7104878LL;
v5 = func2("nil");
v6 = v5;
if ( v4 == v5 )
_assert_fail("p != q", "atom.c", 0x94u, "test_atom");
v9 = func3((__int64)v5);
v10 = "nil";
v11 = 4LL;
do
{
if ( !v11 )
break;
v7 = (unsigned int)*v10 < (unsigned __int8)*v9;
v8 = *v10++ == (unsigned __int8)*v9++;
--v11;
}
while ( v8 );
if ( (!v7 && !v8) != v7 )
_assert_fail("strcmp(s, atom_str(p)) == 0", "atom.c", 0x95u, "test_atom");
v12 = func2(v21);
if ( v6 != v12 )
_assert_fail("p == q", "atom.c", 0x97u, "test_atom");
if ( v12 == func2("F") )
_assert_fail("p != q", "atom.c", 0x99u, "test_atom");
if ( dbug_on )
{
v14 = lu_atom_root;
*(_QWORD *)(*(_QWORD *)(dbug_cfg + 80LL) + 16LL) = &unk_8C3;
if ( (unsigned int)dbug_keyword(&unk_8C3, v10) )
{
*(_DWORD *)(*(_QWORD *)(dbug_cfg + 80LL) + 12LL) = 156;
v10 = (const char *)cons_to_str(v14 & 0xFFFFFFFFFFFFFFFCLL);
dbug_print("lu_atom_root=%s", v10);
}
}
v17 = 157;
return dbug_return(&v15, v10);
}

original_code:
void
test_atom()
{
 CONS* p;
 CONS* q;
 char* s;
 char buf[256];
 struct dbug_ctx_t dbug_ctx; dbug_ctx.name = ("test_atom"); dbug_ctx.depth = dbug_cfg->ctx->depth; dbug_ctx.line = 130; dbug_ctx.keyword = ""; dbug_ctx.unit = &dbug_unit; dbug_ctx.caller = dbug_cfg->ctx; dbug_enter (&dbug_ctx);
 printf("--test_atom--\n");
 p = lu_atom(((void *)0));
 q = lu_atom("");
 ((((BOOL)((p)==((CONS*)(&nil__cons))))) ? (void) (0) : __assert_fail ("nilp(p)", "atom.c", 134, __extension__ __PRETTY_FUNCTION__));
 ((p == q) ? (void) (0) : __assert_fail ("p == q", "atom.c", 135, __extension__ __PRETTY_FUNCTION__));
 ((atom_str(q)[0] == '\0') ? (void) (0) : __assert_fail ("atom_str(q)[0] == '\\0'", "atom.c", 136, __extension__ __PRETTY_FUNCTION__));
 s = "T";
 strncpy(buf, s, sizeof(buf - 1));
 p = lu_atom(s);
 q = lu_atom(buf);
 ((p == q) ? (void) (0) : __assert_fail ("p == q", "atom.c", 142, __extension__ __PRETTY_FUNCTION__));
 q = lu_atom("n");
 ((p != q) ? (void) (0) : __assert_fail ("p != q", "atom.c", 144, __extension__ __PRETTY_FUNCTION__));
 s = "nil";
 strncpy(buf, s, sizeof(buf - 1));
 p = lu_atom(s);
 ((p != q) ? (void) (0) : __assert_fail ("p != q", "atom.c", 148, __extension__ __PRETTY_FUNCTION__));
 ((strcmp(s, atom_str(p)) == 0) ? (void) (0) : __assert_fail ("strcmp(s, atom_str(p)) == 0", "atom.c", 149, __extension__ __PRETTY_FUNCTION__));
 q = lu_atom(buf);
 ((p == q) ? (void) (0) : __assert_fail ("p == q", "atom.c", 151, __extension__ __PRETTY_FUNCTION__));
 p = lu_atom("F");
 ((p != q) ? (void) (0) : __assert_fail ("p != q", "atom.c", 153, __extension__ __PRETTY_FUNCTION__));
 p = ((CONS*)((((WORD)(lu_atom_root)) & ~((WORD)(0x00000003))) | ((WORD)(0x00000000))));
 do{ if(dbug_on && dbug_keyword (dbug_cfg->ctx->keyword = (""))){ dbug_cfg->ctx->line = 156; dbug_print ("lu_atom_root=%s", cons_to_str(p)); }}while(0);
 dbug_ctx.line = 157; dbug_return (&dbug_ctx); return;
}

canonical_original_code:
void test_atom()
{
 struct cons *p;
 struct cons *q;
 char *s;
 char buf[256];
 struct dbug_ctx_t dbug_ctx; dbug_ctx.name = ("test_atom"); dbug_ctx.depth = dbug_cfg->ctx->depth; dbug_ctx.line = 130; dbug_ctx.keyword = ""; dbug_ctx.unit = &dbug_unit; dbug_ctx.caller = dbug_cfg->ctx; dbug_enter (&dbug_ctx);
 printf("--test_atom--\n");
 p = lu_atom(((void *)0));
 q = lu_atom("");
 ((((BOOL)((p)==((struct cons *)(&nil__cons))))) ? (void) (0) : __assert_fail ("nilp(p)", "atom.c", 134, __extension__ __PRETTY_FUNCTION__));
 ((p == q) ? (void) (0) : __assert_fail ("p == q", "atom.c", 135, __extension__ __PRETTY_FUNCTION__));
 ((atom_str(q)[0] == '\0') ? (void) (0) : __assert_fail ("atom_str(q)[0] == '\\0'", "atom.c", 136, __extension__ __PRETTY_FUNCTION__));
 s = "T";
 strncpy(buf, s, sizeof(buf - 1));
 p = lu_atom(s);
 q = lu_atom(buf);
 ((p == q) ? (void) (0) : __assert_fail ("p == q", "atom.c", 142, __extension__ __PRETTY_FUNCTION__));
 q = lu_atom("n");
 ((p != q) ? (void) (0) : __assert_fail ("p != q", "atom.c", 144, __extension__ __PRETTY_FUNCTION__));
 s = "nil";
 strncpy(buf, s, sizeof(buf - 1));
 p = lu_atom(s);
 ((p != q) ? (void) (0) : __assert_fail ("p != q", "atom.c", 148, __extension__ __PRETTY_FUNCTION__));
 ((strcmp(s, atom_str(p)) == 0) ? (void) (0) : __assert_fail ("strcmp(s, atom_str(p)) == 0", "atom.c", 149, __extension__ __PRETTY_FUNCTION__));
 q = lu_atom(buf);
 ((p == q) ? (void) (0) : __assert_fail ("p == q", "atom.c", 151, __extension__ __PRETTY_FUNCTION__));
 p = lu_atom("F");
 ((p != q) ? (void) (0) : __assert_fail ("p != q", "atom.c", 153, __extension__ __PRETTY_FUNCTION__));
 p = ((struct cons *)((((WORD)(lu_atom_root)) & ~((WORD)(0x00000003))) | ((WORD)(0x00000000))));
 do{ if(dbug_on && dbug_keyword (dbug_cfg->ctx->keyword = (""))){ dbug_cfg->ctx->line = 156; dbug_print ("lu_atom_root=%s", cons_to_str(p)); }}while(0);
 dbug_ctx.line = 157; dbug_return (&dbug_ctx); return;
}

variable_types:
buf
char [256]


decompiled_code:
int report_atom_usage()
{
return printf("lu_cons_cnt=%d\n", (unsigned int)lu_cons_cnt);
}

canonical_decompiled_code:
int func5()
{
return printf("lu_cons_cnt=%d\n", (unsigned int)lu_cons_cnt);
}

original_code:
void
report_atom_usage()
{
 printf("lu_cons_cnt=%d\n", lu_cons_cnt);
}


decompiled_code:
__int64 __fastcall test_number(__int64 a1, __int64 a2)
{
__int64 v2; // rax
const char *v4; // [rsp+0h] [rbp-38h] BYREF
int v5; // [rsp+8h] [rbp-30h]
int v6; // [rsp+Ch] [rbp-2Ch]
void *v7; // [rsp+10h] [rbp-28h]
char **v8; // [rsp+18h] [rbp-20h]
__int64 v9; // [rsp+20h] [rbp-18h]

v4 = "test_number";
v2 = *(_QWORD *)(dbug_cfg + 80LL);
v5 = *(_DWORD *)(v2 + 8);
v6 = 173;
v7 = &unk_8C3;
v8 = &dbug_unit;
v9 = v2;
dbug_enter(&v4);
puts("--test_number--");
if ( dbug_on )
{
*(_QWORD *)(*(_QWORD *)(dbug_cfg + 80LL) + 16LL) = &unk_8C3;
if ( (unsigned int)dbug_keyword(&unk_8C3, a2) )
{
*(_DWORD *)(*(_QWORD *)(dbug_cfg + 80LL) + 12LL) = 178;
a2 = 0LL;
dbug_print("NUMBER(%d)=16#%08lx", 0LL, 3LL);
}
if ( dbug_on )
{
*(_QWORD *)(*(_QWORD *)(dbug_cfg + 80LL) + 16LL) = &unk_8C3;
if ( (unsigned int)dbug_keyword(&unk_8C3, a2) )
{
*(_DWORD *)(*(_QWORD *)(dbug_cfg + 80LL) + 12LL) = 196;
a2 = 1LL;
dbug_print("NUMBER(%d)=16#%08lx", 1LL, 7LL);
}
if ( dbug_on )
{
*(_QWORD *)(*(_QWORD *)(dbug_cfg + 80LL) + 16LL) = &unk_8C3;
if ( (unsigned int)dbug_keyword(&unk_8C3, a2) )
{
*(_DWORD *)(*(_QWORD *)(dbug_cfg + 80LL) + 12LL) = 212;
a2 = 0xFFFFFFFFLL;
dbug_print("NUMBER(%d)=16#%08lx", 0xFFFFFFFFLL, -1LL);
}
if ( dbug_on )
{
*(_QWORD *)(*(_QWORD *)(dbug_cfg + 80LL) + 16LL) = &unk_8C3;
if ( (unsigned int)dbug_keyword(&unk_8C3, a2) )
{
*(_DWORD *)(*(_QWORD *)(dbug_cfg + 80LL) + 12LL) = 228;
a2 = 0x7FFFFFFLL;
dbug_print("NUMBER(%d)=16#%08lx", 0x7FFFFFFLL, 0x1FFFFFFFLL);
}
if ( dbug_on )
{
*(_QWORD *)(*(_QWORD *)(dbug_cfg + 80LL) + 16LL) = &unk_8C3;
if ( (unsigned int)dbug_keyword(&unk_8C3, a2) )
{
*(_DWORD *)(*(_QWORD *)(dbug_cfg + 80LL) + 12LL) = 235;
a2 = 4160749569LL;
dbug_print("NUMBER(%d)=16#%08lx", 4160749569LL, -536870905LL);
}
}
}
}
}
}
v6 = 240;
return dbug_return(&v4, a2);
}

canonical_decompiled_code:
__int64 __fastcall func6(__int64 a1, __int64 a2)
{
__int64 v2; // rax
const char *v4; // [rsp+0h] [rbp-38h] BYREF
int v5; // [rsp+8h] [rbp-30h]
int v6; // [rsp+Ch] [rbp-2Ch]
void *v7; // [rsp+10h] [rbp-28h]
char **v8; // [rsp+18h] [rbp-20h]
__int64 v9; // [rsp+20h] [rbp-18h]

v4 = "test_number";
v2 = *(_QWORD *)(dbug_cfg + 80LL);
v5 = *(_DWORD *)(v2 + 8);
v6 = 173;
v7 = &unk_8C3;
v8 = &dbug_unit;
v9 = v2;
dbug_enter(&v4);
puts("--test_number--");
if ( dbug_on )
{
*(_QWORD *)(*(_QWORD *)(dbug_cfg + 80LL) + 16LL) = &unk_8C3;
if ( (unsigned int)dbug_keyword(&unk_8C3, a2) )
{
*(_DWORD *)(*(_QWORD *)(dbug_cfg + 80LL) + 12LL) = 178;
a2 = 0LL;
dbug_print("NUMBER(%d)=16#%08lx", 0LL, 3LL);
}
if ( dbug_on )
{
*(_QWORD *)(*(_QWORD *)(dbug_cfg + 80LL) + 16LL) = &unk_8C3;
if ( (unsigned int)dbug_keyword(&unk_8C3, a2) )
{
*(_DWORD *)(*(_QWORD *)(dbug_cfg + 80LL) + 12LL) = 196;
a2 = 1LL;
dbug_print("NUMBER(%d)=16#%08lx", 1LL, 7LL);
}
if ( dbug_on )
{
*(_QWORD *)(*(_QWORD *)(dbug_cfg + 80LL) + 16LL) = &unk_8C3;
if ( (unsigned int)dbug_keyword(&unk_8C3, a2) )
{
*(_DWORD *)(*(_QWORD *)(dbug_cfg + 80LL) + 12LL) = 212;
a2 = 0xFFFFFFFFLL;
dbug_print("NUMBER(%d)=16#%08lx", 0xFFFFFFFFLL, -1LL);
}
if ( dbug_on )
{
*(_QWORD *)(*(_QWORD *)(dbug_cfg + 80LL) + 16LL) = &unk_8C3;
if ( (unsigned int)dbug_keyword(&unk_8C3, a2) )
{
*(_DWORD *)(*(_QWORD *)(dbug_cfg + 80LL) + 12LL) = 228;
a2 = 0x7FFFFFFLL;
dbug_print("NUMBER(%d)=16#%08lx", 0x7FFFFFFLL, 0x1FFFFFFFLL);
}
if ( dbug_on )
{
*(_QWORD *)(*(_QWORD *)(dbug_cfg + 80LL) + 16LL) = &unk_8C3;
if ( (unsigned int)dbug_keyword(&unk_8C3, a2) )
{
*(_DWORD *)(*(_QWORD *)(dbug_cfg + 80LL) + 12LL) = 235;
a2 = 4160749569LL;
dbug_print("NUMBER(%d)=16#%08lx", 4160749569LL, -536870905LL);
}
}
}
}
}
}
v6 = 240;
return dbug_return(&v4, a2);
}

canonical_original_code:
void test_number()
{
 int i;
 int j;
 struct cons *p;
 struct dbug_ctx_t dbug_ctx; dbug_ctx.name = ("test_number"); dbug_ctx.depth = dbug_cfg->ctx->depth; dbug_ctx.line = 173; dbug_ctx.keyword = ""; dbug_ctx.unit = &dbug_unit; dbug_ctx.caller = dbug_cfg->ctx; dbug_enter (&dbug_ctx);
 printf("--test_number--\n");
 j = 0;
 p = ((struct cons *)((((WORD)(j))<<2) | ((WORD)(0x00000003))));
 do{ if(dbug_on && dbug_keyword (dbug_cfg->ctx->keyword = (""))){ dbug_cfg->ctx->line = 178; dbug_print ("NUMBER(%d)=16#%08lx", j, (unsigned long)p); }}while(0);
 ((((BOOL)((((WORD)(p)) & ((WORD)(0x00000003))) == ((WORD)(0x00000003))))) ? (void) (0) : __assert_fail ("numberp(p)", "atom.c", 179, __extension__ __PRETTY_FUNCTION__));
 i = ((int)(((WORD)(p))>>2));
 ((0 == i) ? (void) (0) : __assert_fail ("0 == i", "atom.c", 181, __extension__ __PRETTY_FUNCTION__));
 ((!((BOOL)((p)==((struct cons *)(&nil__cons))))) ? (void) (0) : __assert_fail ("!nilp(p)", "atom.c", 182, __extension__ __PRETTY_FUNCTION__));
 ((!((BOOL)(((p)!=((BOOL)(0)))&&((((WORD)(p)) & ((WORD)(0x00000003))) == ((WORD)(0x00000000)))))) ? (void) (0) : __assert_fail ("!consp(p)", "atom.c", 183, __extension__ __PRETTY_FUNCTION__));
 ((!((BOOL)((((WORD)(p)) & ((WORD)(0x00000003))) == ((WORD)(0x00000002))))) ? (void) (0) : __assert_fail ("!atomp(p)", "atom.c", 184, __extension__ __PRETTY_FUNCTION__));
 ((((BOOL)(((p)!=((BOOL)(1)))&&((((WORD)(p)) & ((WORD)(0x00000003))) == ((WORD)(0x00000003)))))) ? (void) (0) : __assert_fail ("funcp(p)", "atom.c", 187, __extension__ __PRETTY_FUNCTION__));
 ((!(((p)==((BOOL)(0)))||((p)==((BOOL)(1))))) ? (void) (0) : __assert_fail ("!boolp(p)", "atom.c", 188, __extension__ __PRETTY_FUNCTION__));
 j = 1;
 p = ((struct cons *)((((WORD)(j))<<2) | ((WORD)(0x00000003))));
 do{ if(dbug_on && dbug_keyword (dbug_cfg->ctx->keyword = (""))){ dbug_cfg->ctx->line = 196; dbug_print ("NUMBER(%d)=16#%08lx", j, (unsigned long)p); }}while(0);
 ((((BOOL)((((WORD)(p)) & ((WORD)(0x00000003))) == ((WORD)(0x00000003))))) ? (void) (0) : __assert_fail ("numberp(p)", "atom.c", 197, __extension__ __PRETTY_FUNCTION__));
 i = ((int)(((WORD)(p))>>2));
 ((i == j) ? (void) (0) : __assert_fail ("i == j", "atom.c", 199, __extension__ __PRETTY_FUNCTION__));
 ((!((BOOL)((p)==((struct cons *)(&nil__cons))))) ? (void) (0) : __assert_fail ("!nilp(p)", "atom.c", 200, __extension__ __PRETTY_FUNCTION__));
 ((!((BOOL)(((p)!=((BOOL)(0)))&&((((WORD)(p)) & ((WORD)(0x00000003))) == ((WORD)(0x00000000)))))) ? (void) (0) : __assert_fail ("!consp(p)", "atom.c", 201, __extension__ __PRETTY_FUNCTION__));
 ((!((BOOL)((((WORD)(p)) & ((WORD)(0x00000003))) == ((WORD)(0x00000002))))) ? (void) (0) : __assert_fail ("!atomp(p)", "atom.c", 202, __extension__ __PRETTY_FUNCTION__));
 ((((BOOL)(((p)!=((BOOL)(1)))&&((((WORD)(p)) & ((WORD)(0x00000003))) == ((WORD)(0x00000003)))))) ? (void) (0) : __assert_fail ("funcp(p)", "atom.c", 204, __extension__ __PRETTY_FUNCTION__));
 ((!(((p)==((BOOL)(0)))||((p)==((BOOL)(1))))) ? (void) (0) : __assert_fail ("!boolp(p)", "atom.c", 208, __extension__ __PRETTY_FUNCTION__));
 j = -1;
 p = ((struct cons *)((((WORD)(j))<<2) | ((WORD)(0x00000003))));
 do{ if(dbug_on && dbug_keyword (dbug_cfg->ctx->keyword = (""))){ dbug_cfg->ctx->line = 212; dbug_print ("NUMBER(%d)=16#%08lx", j, (unsigned long)p); }}while(0);
 ((((BOOL)((((WORD)(p)) & ((WORD)(0x00000003))) == ((WORD)(0x00000003))))) ? (void) (0) : __assert_fail ("numberp(p)", "atom.c", 213, __extension__ __PRETTY_FUNCTION__));
 i = ((int)(((WORD)(p))>>2));
 ((i == j) ? (void) (0) : __assert_fail ("i == j", "atom.c", 215, __extension__ __PRETTY_FUNCTION__));
 ((!((BOOL)((p)==((struct cons *)(&nil__cons))))) ? (void) (0) : __assert_fail ("!nilp(p)", "atom.c", 216, __extension__ __PRETTY_FUNCTION__));
 ((!((BOOL)(((p)!=((BOOL)(0)))&&((((WORD)(p)) & ((WORD)(0x00000003))) == ((WORD)(0x00000000)))))) ? (void) (0) : __assert_fail ("!consp(p)", "atom.c", 217, __extension__ __PRETTY_FUNCTION__));
 ((!((BOOL)((((WORD)(p)) & ((WORD)(0x00000003))) == ((WORD)(0x00000002))))) ? (void) (0) : __assert_fail ("!atomp(p)", "atom.c", 218, __extension__ __PRETTY_FUNCTION__));
 ((((BOOL)(((p)!=((BOOL)(1)))&&((((WORD)(p)) & ((WORD)(0x00000003))) == ((WORD)(0x00000003)))))) ? (void) (0) : __assert_fail ("funcp(p)", "atom.c", 220, __extension__ __PRETTY_FUNCTION__));
 ((!(((p)==((BOOL)(0)))||((p)==((BOOL)(1))))) ? (void) (0) : __assert_fail ("!boolp(p)", "atom.c", 224, __extension__ __PRETTY_FUNCTION__));
 j = 0x07FFFFFF;
 p = ((struct cons *)((((WORD)(j))<<2) | ((WORD)(0x00000003))));
 do{ if(dbug_on && dbug_keyword (dbug_cfg->ctx->keyword = (""))){ dbug_cfg->ctx->line = 228; dbug_print ("NUMBER(%d)=16#%08lx", j, (unsigned long)p); }}while(0);
 ((((BOOL)((((WORD)(p)) & ((WORD)(0x00000003))) == ((WORD)(0x00000003))))) ? (void) (0) : __assert_fail ("numberp(p)", "atom.c", 229, __extension__ __PRETTY_FUNCTION__));
 i = ((int)(((WORD)(p))>>2));
 ((i == j) ? (void) (0) : __assert_fail ("i == j", "atom.c", 231, __extension__ __PRETTY_FUNCTION__));
 j = -j;
 p = ((struct cons *)((((WORD)(j))<<2) | ((WORD)(0x00000003))));
 do{ if(dbug_on && dbug_keyword (dbug_cfg->ctx->keyword = (""))){ dbug_cfg->ctx->line = 235; dbug_print ("NUMBER(%d)=16#%08lx", j, (unsigned long)p); }}while(0);
 ((((BOOL)((((WORD)(p)) & ((WORD)(0x00000003))) == ((WORD)(0x00000003))))) ? (void) (0) : __assert_fail ("numberp(p)", "atom.c", 236, __extension__ __PRETTY_FUNCTION__));
 i = ((int)(((WORD)(p))>>2));
 ((i == j) ? (void) (0) : __assert_fail ("i == j", "atom.c", 238, __extension__ __PRETTY_FUNCTION__));
 dbug_ctx.line = 240; dbug_return (&dbug_ctx); return;
}

variable_types: i int

variable_types: j int


decompiled_code:
char *__fastcall clear_sbuf(__int64 a1)
{
*(_QWORD *)(a1 + 8) = 0LL;
return strncpy(*(char **)(a1 + 16), &src, *(_QWORD *)a1 + 1LL);
}

canonical_decompiled_code:
char *__fastcall func0(__int64 a1)
{
*(_QWORD *)(a1 + 8) = 0LL;
return strncpy(*(char **)(a1 + 16), &src, *(_QWORD *)a1 + 1LL);
}

original_code:
void
clear_sbuf(SBUF* sbuf)
{
 sbuf->offset = 0;
 strncpy(sbuf->buf, "", sbuf->limit + 1);
}

canonical_original_code:
void clear_sbuf(struct string_buffer *sbuf)
{
 sbuf->offset = 0;
 strncpy(sbuf->buf, "", sbuf->limit + 1);
}

variable_types: struct string_buffer { unsigned long limit; unsigned long offset; char *buf; } *


decompiled_code:
__int64 __fastcall free_sbuf(void *ptr)
{
free(*((void **)ptr + 2));
free(ptr);
return 0LL;
}

canonical_decompiled_code:
__int64 __fastcall func1(void *ptr)
{
free(*((void **)ptr + 2));
free(ptr);
return 0LL;
}

original_code:
SBUF*
free_sbuf(SBUF* sbuf)
{
 free(sbuf->buf);
 free(sbuf);
 return ((void *)0);
}

canonical_original_code:
struct string_buffer *free_sbuf(struct string_buffer *sbuf)
{
 free(sbuf->buf);
 free(sbuf);
 return ((void *)0);
}

variable_types:
sbuf
struct string_buffer *

return_type: struct string_buffer { unsigned long limit; unsigned long offset; char *buf; } *


decompiled_code:
void __noreturn test_pre()
{
__int64 v0; // rax
const char *v1; // [rsp+0h] [rbp-38h] BYREF
int v2; // [rsp+8h] [rbp-30h]
int v3; // [rsp+Ch] [rbp-2Ch]
void *v4; // [rsp+10h] [rbp-28h]
char **v5; // [rsp+18h] [rbp-20h]
__int64 v6; // [rsp+20h] [rbp-18h]

v1 = "test_pre";
v0 = *(_QWORD *)(dbug_cfg + 80LL);
v2 = *(_DWORD *)(v0 + 8);
v3 = 28;
v4 = &unk_671;
v5 = dbug_unit;
v6 = v0;
dbug_enter(&v1);
if ( dbug_on )
{
*(_QWORD *)(*(_QWORD *)(dbug_cfg + 80LL) + 16LL) = &unk_671;
if ( (unsigned int)dbug_keyword(&unk_671) )
{
*(_DWORD *)(*(_QWORD *)(dbug_cfg + 80LL) + 12LL) = 30;
dbug_print("sizeof(int)=%d", 4LL);
}
if ( dbug_on )
{
*(_QWORD *)(*(_QWORD *)(dbug_cfg + 80LL) + 16LL) = &unk_671;
if ( (unsigned int)dbug_keyword(&unk_671) )
{
*(_DWORD *)(*(_QWORD *)(dbug_cfg + 80LL) + 12LL) = 31;
dbug_print("sizeof(CONS*)=%d", 8LL);
}
if ( dbug_on )
{
*(_QWORD *)(*(_QWORD *)(dbug_cfg + 80LL) + 16LL) = &unk_671;
if ( (unsigned int)dbug_keyword(&unk_671) )
{
*(_DWORD *)(*(_QWORD *)(dbug_cfg + 80LL) + 12LL) = 32;
dbug_print("sizeof(BEH)=%d", 8LL);
}
}
}
}
_assert_fail("sizeof(int) == sizeof(CONS*)", "abe.c", 0x21u, "test_pre");
}

canonical_decompiled_code:
void __noreturn func0()
{
__int64 v0; // rax
const char *v1; // [rsp+0h] [rbp-38h] BYREF
int v2; // [rsp+8h] [rbp-30h]
int v3; // [rsp+Ch] [rbp-2Ch]
void *v4; // [rsp+10h] [rbp-28h]
char **v5; // [rsp+18h] [rbp-20h]
__int64 v6; // [rsp+20h] [rbp-18h]

v1 = "test_pre";
v0 = *(_QWORD *)(dbug_cfg + 80LL);
v2 = *(_DWORD *)(v0 + 8);
v3 = 28;
v4 = &unk_671;
v5 = dbug_unit;
v6 = v0;
dbug_enter(&v1);
if ( dbug_on )
{
*(_QWORD *)(*(_QWORD *)(dbug_cfg + 80LL) + 16LL) = &unk_671;
if ( (unsigned int)dbug_keyword(&unk_671) )
{
*(_DWORD *)(*(_QWORD *)(dbug_cfg + 80LL) + 12LL) = 30;
dbug_print("sizeof(int)=%d", 4LL);
}
if ( dbug_on )
{
*(_QWORD *)(*(_QWORD *)(dbug_cfg + 80LL) + 16LL) = &unk_671;
if ( (unsigned int)dbug_keyword(&unk_671) )
{
*(_DWORD *)(*(_QWORD *)(dbug_cfg + 80LL) + 12LL) = 31;
dbug_print("sizeof(CONS*)=%d", 8LL);
}
if ( dbug_on )
{
*(_QWORD *)(*(_QWORD *)(dbug_cfg + 80LL) + 16LL) = &unk_671;
if ( (unsigned int)dbug_keyword(&unk_671) )
{
*(_DWORD *)(*(_QWORD *)(dbug_cfg + 80LL) + 12LL) = 32;
dbug_print("sizeof(BEH)=%d", 8LL);
}
}
}
}
_assert_fail("sizeof(int) == sizeof(CONS*)", "abe.c", 0x21u, "test_pre");
}

original_code:
void
test_pre()
{
 struct dbug_ctx_t dbug_ctx; dbug_ctx.name = ("test_pre"); dbug_ctx.depth = dbug_cfg->ctx->depth; dbug_ctx.line = 28; dbug_ctx.keyword = ""; dbug_ctx.unit = &dbug_unit; dbug_ctx.caller = dbug_cfg->ctx; dbug_enter (&dbug_ctx);
 do{ if(dbug_on && dbug_keyword (dbug_cfg->ctx->keyword = (""))){ dbug_cfg->ctx->line = 30; dbug_print ("sizeof(int)=%d", sizeof(int)); }}while(0);
 do{ if(dbug_on && dbug_keyword (dbug_cfg->ctx->keyword = (""))){ dbug_cfg->ctx->line = 31; dbug_print ("sizeof(CONS*)=%d", sizeof(CONS*)); }}while(0);
 do{ if(dbug_on && dbug_keyword (dbug_cfg->ctx->keyword = (""))){ dbug_cfg->ctx->line = 32; dbug_print ("sizeof(BEH)=%d", sizeof(BEH)); }}while(0);
 ((sizeof(int) == sizeof(CONS*)) ? (void) (0) : __assert_fail ("sizeof(int) == sizeof(CONS*)", "abe.c", 33, __extension__ __PRETTY_FUNCTION__));
 ((sizeof(BEH) == sizeof(CONS*)) ? (void) (0) : __assert_fail ("sizeof(BEH) == sizeof(CONS*)", "abe.c", 34, __extension__ __PRETTY_FUNCTION__));
 do{ if(dbug_on && dbug_keyword (dbug_cfg->ctx->keyword = (""))){ dbug_cfg->ctx->line = 36; dbug_print ("NIL=16#%08lx (%p)", ((CONS*)(&nil__cons)), ((CONS*)(&nil__cons))); }}while(0);
 ((((BOOL)((((CONS*)(&nil__cons)))==((CONS*)(&nil__cons))))) ? (void) (0) : __assert_fail ("nilp(NIL)", "abe.c", 37, __extension__ __PRETTY_FUNCTION__));
 ((((BOOL)((((CONS*)(&nil__cons)))==((CONS*)(&nil__cons)))) == _nilp(((CONS*)(&nil__cons)))) ? (void) (0) : __assert_fail ("nilp(NIL) == _nilp(NIL)", "abe.c", 38, __extension__ __PRETTY_FUNCTION__));
 do{ if(dbug_on && dbug_keyword (dbug_cfg->ctx->keyword = (""))){ dbug_cfg->ctx->line = 40; dbug_print ("sizeof(BOOL)=%d", sizeof(BOOL)); }}while(0);
 ((sizeof(BOOL) == sizeof(CONS*)) ? (void) (0) : __assert_fail ("sizeof(BOOL) == sizeof(CONS*)", "abe.c", 41, __extension__ __PRETTY_FUNCTION__));
 do{ if(dbug_on && dbug_keyword (dbug_cfg->ctx->keyword = (""))){ dbug_cfg->ctx->line = 42; dbug_print ("TRUE=16#%08lx (%p)", ((BOOL)(1)), ((BOOL)(1))); }}while(0);
 do{ if(dbug_on && dbug_keyword (dbug_cfg->ctx->keyword = (""))){ dbug_cfg->ctx->line = 43; dbug_print ("FALSE=16#%08lx (%p)", ((BOOL)(0)), ((BOOL)(0))); }}while(0);
 ((((BOOL)(1))) ? (void) (0) : __assert_fail ("TRUE", "abe.c", 44, __extension__ __PRETTY_FUNCTION__));
 ((!((BOOL)(0))) ? (void) (0) : __assert_fail ("!FALSE", "abe.c", 45, __extension__ __PRETTY_FUNCTION__));
 ((((BOOL)(1)) == ((BOOL)(0 == 0))) ? (void) (0) : __assert_fail ("TRUE == ((BOOL)(0 == 0))", "abe.c", 46, __extension__ __PRETTY_FUNCTION__));
 ((((BOOL)(0)) == ((BOOL)(0 != 0))) ? (void) (0) : __assert_fail ("FALSE == ((BOOL)(0 != 0))", "abe.c", 47, __extension__ __PRETTY_FUNCTION__));
 do{ if(dbug_on && dbug_keyword (dbug_cfg->ctx->keyword = (""))){ dbug_cfg->ctx->line = 53; dbug_print ("Type tag in LSB[1:0]"); }}while(0);
 do{ if(dbug_on && dbug_keyword (dbug_cfg->ctx->keyword = (""))){ dbug_cfg->ctx->line = 61; dbug_print ("_Program[]=16#%08lx (%p)", _Program, _Program); }}while(0);
 ((_Program == ((void*)(((WORD)(((CONS*)((((WORD)(_Program))<<2) | ((WORD)(0x00000003))))))>>2))) ? (void) (0) : __assert_fail ("_Program == MK_PTR(MK_REF(_Program))", "abe.c", 62, __extension__ __PRETTY_FUNCTION__));
 do{ if(dbug_on && dbug_keyword (dbug_cfg->ctx->keyword = (""))){ dbug_cfg->ctx->line = 69; dbug_print ("test_pre()=16#%08lx (%p)", test_pre, test_pre); }}while(0);
 ((test_pre == ((BEH)((ptrdiff_t)((void*)(((WORD)(((CONS*)((((WORD)(test_pre))<<2) | ((WORD)(0x00000003))))))>>2))))) ? (void) (0) : __assert_fail ("test_pre == MK_BEH(MK_FUNC(test_pre))", "abe.c", 70, __extension__ __PRETTY_FUNCTION__));
 dbug_ctx.line = 72; dbug_return (&dbug_ctx); return;
}

canonical_original_code:
void test_pre()
{
 struct dbug_ctx_t dbug_ctx; dbug_ctx.name = ("test_pre"); dbug_ctx.depth = dbug_cfg->ctx->depth; dbug_ctx.line = 28; dbug_ctx.keyword = ""; dbug_ctx.unit = &dbug_unit; dbug_ctx.caller = dbug_cfg->ctx; dbug_enter (&dbug_ctx);
 do{ if(dbug_on && dbug_keyword (dbug_cfg->ctx->keyword = (""))){ dbug_cfg->ctx->line = 30; dbug_print ("sizeof(int)=%d", sizeof(int)); }}while(0);
 do{ if(dbug_on && dbug_keyword (dbug_cfg->ctx->keyword = (""))){ dbug_cfg->ctx->line = 31; dbug_print ("sizeof(CONS*)=%d", sizeof(struct cons *)); }}while(0);
 do{ if(dbug_on && dbug_keyword (dbug_cfg->ctx->keyword = (""))){ dbug_cfg->ctx->line = 32; dbug_print ("sizeof(BEH)=%d", sizeof(BEH)); }}while(0);
 ((sizeof(int) == sizeof(struct cons *)) ? (void) (0) : __assert_fail ("sizeof(int) == sizeof(CONS*)", "abe.c", 33, __extension__ __PRETTY_FUNCTION__));
 ((sizeof(BEH) == sizeof(struct cons *)) ? (void) (0) : __assert_fail ("sizeof(BEH) == sizeof(CONS*)", "abe.c", 34, __extension__ __PRETTY_FUNCTION__));
 do{ if(dbug_on && dbug_keyword (dbug_cfg->ctx->keyword = (""))){ dbug_cfg->ctx->line = 36; dbug_print ("NIL=16#%08lx (%p)", ((struct cons *)(&nil__cons)), ((struct cons *)(&nil__cons))); }}while(0);
 ((((BOOL)((((struct cons *)(&nil__cons)))==((struct cons *)(&nil__cons))))) ? (void) (0) : __assert_fail ("nilp(NIL)", "abe.c", 37, __extension__ __PRETTY_FUNCTION__));
 ((((BOOL)((((struct cons *)(&nil__cons)))==((struct cons *)(&nil__cons)))) == _nilp(((struct cons *)(&nil__cons)))) ? (void) (0) : __assert_fail ("nilp(NIL) == _nilp(NIL)", "abe.c", 38, __extension__ __PRETTY_FUNCTION__));
 do{ if(dbug_on && dbug_keyword (dbug_cfg->ctx->keyword = (""))){ dbug_cfg->ctx->line = 40; dbug_print ("sizeof(BOOL)=%d", sizeof(BOOL)); }}while(0);
 ((sizeof(BOOL) == sizeof(struct cons *)) ? (void) (0) : __assert_fail ("sizeof(BOOL) == sizeof(CONS*)", "abe.c", 41, __extension__ __PRETTY_FUNCTION__));
 do{ if(dbug_on && dbug_keyword (dbug_cfg->ctx->keyword = (""))){ dbug_cfg->ctx->line = 42; dbug_print ("TRUE=16#%08lx (%p)", ((BOOL)(1)), ((BOOL)(1))); }}while(0);
 do{ if(dbug_on && dbug_keyword (dbug_cfg->ctx->keyword = (""))){ dbug_cfg->ctx->line = 43; dbug_print ("FALSE=16#%08lx (%p)", ((BOOL)(0)), ((BOOL)(0))); }}while(0);
 ((((BOOL)(1))) ? (void) (0) : __assert_fail ("TRUE", "abe.c", 44, __extension__ __PRETTY_FUNCTION__));
 ((!((BOOL)(0))) ? (void) (0) : __assert_fail ("!FALSE", "abe.c", 45, __extension__ __PRETTY_FUNCTION__));
 ((((BOOL)(1)) == ((BOOL)(0 == 0))) ? (void) (0) : __assert_fail ("TRUE == ((BOOL)(0 == 0))", "abe.c", 46, __extension__ __PRETTY_FUNCTION__));
 ((((BOOL)(0)) == ((BOOL)(0 != 0))) ? (void) (0) : __assert_fail ("FALSE == ((BOOL)(0 != 0))", "abe.c", 47, __extension__ __PRETTY_FUNCTION__));
 do{ if(dbug_on && dbug_keyword (dbug_cfg->ctx->keyword = (""))){ dbug_cfg->ctx->line = 53; dbug_print ("Type tag in LSB[1:0]"); }}while(0);
 do{ if(dbug_on && dbug_keyword (dbug_cfg->ctx->keyword = (""))){ dbug_cfg->ctx->line = 61; dbug_print ("_Program[]=16#%08lx (%p)", _Program, _Program); }}while(0);
 ((_Program == ((void *)(((WORD)(((struct cons *)((((WORD)(_Program))<<2) | ((WORD)(0x00000003))))))>>2))) ? (void) (0) : __assert_fail ("_Program == MK_PTR(MK_REF(_Program))", "abe.c", 62, __extension__ __PRETTY_FUNCTION__));
 do{ if(dbug_on && dbug_keyword (dbug_cfg->ctx->keyword = (""))){ dbug_cfg->ctx->line = 69; dbug_print ("test_pre()=16#%08lx (%p)", test_pre, test_pre); }}while(0);
 ((test_pre == ((BEH)((long)((void *)(((WORD)(((struct cons *)((((WORD)(test_pre))<<2) | ((WORD)(0x00000003))))))>>2))))) ? (void) (0) : __assert_fail ("test_pre == MK_BEH(MK_FUNC(test_pre))", "abe.c", 70, __extension__ __PRETTY_FUNCTION__));
 dbug_ctx.line = 72; dbug_return (&dbug_ctx); return;
}


decompiled_code:
__int64 system_info()
{
__int64 v0; // rbx
__int64 v1; // rax
__int64 v2; // rbx
__int64 v3; // rbp
__int64 v4; // rax
__int64 v5; // rbx
__int64 v6; // rbp
__int64 v7; // rax

v0 = lu_atom(Program);
v1 = lu_atom("Program");
v2 = map_put(&nil__cons, v1, v0);
v3 = lu_atom(Version);
v4 = lu_atom("Version");
v5 = map_put(v2, v4, v3);
v6 = lu_atom(Copyright);
v7 = lu_atom("Copyright");
return map_put(v5, v7, v6);
}

canonical_decompiled_code:
__int64 func1()
{
__int64 v0; // rbx
__int64 v1; // rax
__int64 v2; // rbx
__int64 v3; // rbp
__int64 v4; // rax
__int64 v5; // rbx
__int64 v6; // rbp
__int64 v7; // rax

v0 = lu_atom(Program);
v1 = lu_atom("Program");
v2 = map_put(&nil__cons, v1, v0);
v3 = lu_atom(Version);
v4 = lu_atom("Version");
v5 = map_put(v2, v4, v3);
v6 = lu_atom(Copyright);
v7 = lu_atom("Copyright");
return map_put(v5, v7, v6);
}

original_code:
CONS*
system_info()
{
 CONS* info = ((CONS*)(&nil__cons));
 info = map_put(info, lu_atom("Program"), lu_atom(_Program));
 info = map_put(info, lu_atom("Version"), lu_atom(_Version));
 info = map_put(info, lu_atom("Copyright"), lu_atom(_Copyright));
 return info;
}

canonical_original_code:
struct cons *system_info()
{
 struct cons *info = ((CONS*)(&nil__cons));
 info = map_put(info, lu_atom("Program"), lu_atom(_Program));
 info = map_put(info, lu_atom("Version"), lu_atom(_Version));
 info = map_put(info, lu_atom("Copyright"), lu_atom(_Copyright));
 return info;
}


decompiled_code:
int banner()
{
return printf("%s v%s -- %s\n", Program, Version, Copyright);
}

canonical_decompiled_code:
int func4()
{
return printf("%s v%s -- %s\n", Program, Version, Copyright);
}

original_code:
void
banner(void)
{
 printf("%s v%s -- %s\n", _Program, _Version, _Copyright);
}

canonical_original_code:
void banner()
{
 printf("%s v%s -- %s\n", _Program, _Version, _Copyright);
}


main

canonical_name: main

decompiled_code:
int __cdecl main(int argc, const char **argv, const char **envp)
{
puts("Doing something in main...");
somethingInFile2("Doing something in main...", argv);
return 0;
}

canonical_decompiled_code:
int __cdecl main(int argc, const char **argv, const char **envp)
{
puts("Doing something in main...");
func7("Doing something in main...", argv);
return 0;
}

original_code:
int main()
{
 printf("Doing something in main...\n");
 somethingInFile2();
 return 0;
}


decompiled_code:
int somethingInFile2()
{
return puts("Doing something in file2...");
}

canonical_decompiled_code:
int func7()
{
return puts("Doing something in file2...");
}

original_code:
void somethingInFile2()
{
 printf("Doing something in file2...\n");
}


decompiled_code:
__int64 conveyor_belt()
{
return 0LL;
}

canonical_decompiled_code:
__int64 func7()
{
return 0LL;
}

original_code:
void * conveyor_belt(void * data){
 return ((void *)0);
}

canonical_original_code:
void *conveyor_belt(void *data){
 return ((void *)0);
}

variable_types:
data
void *

return_type: void *


decompiled_code:
__int64 assembly_robot()
{
return 0LL;
}

canonical_decompiled_code:
__int64 func8()
{
return 0LL;
}

original_code:
void * assembly_robot(void * data){
 return ((void *)0);
}

canonical_original_code:
void *assembly_robot(void *data){
 return ((void *)0);
}


decompiled_code:
void finish_production_factory()
{
;
}

canonical_decompiled_code:
void func10()
{
;
}

original_code:
void finish_production_factory(){
}

canonical_original_code:
void finish_production_factory(){
}


decompiled_code:
int __cdecl main(int argc, const char **argv, const char **envp)
{
int result; // eax

if ( argc == 3 )
{
if ( (unsigned int)load_factory(argv[1], argv[2]) )
{
result = 0;
}
else
{
puts("[ERROR] Cannot load factory");
result = -1;
}
}
else
{
puts("[ERROR] Invalid syntax: ./production <belts> <robots>");
result = -2;
}
return result;
}

canonical_decompiled_code:
int __cdecl main(int argc, const char **argv, const char **envp)
{
int result; // eax

if ( argc == 3 )
{
if ( (unsigned int)func9(argv[1], argv[2]) )
{
result = 0;
}
else
{
puts("[ERROR] Cannot load factory");
result = -1;
}
}
else
{
puts("[ERROR] Invalid syntax: ./production <belts> <robots>");
result = -2;
}
return result;
}

original_code:
int main (int argc, char ** argv){
 int result = 0;
 if(argc == 3){
  if(load_factory(argv[1], argv[2])){
   finish_production_factory();
  }else{
   printf("[ERROR] Cannot load factory\n");
   result = -1;
  }
 }else{
  printf("[ERROR] Invalid syntax: ./production <belts> <robots>\n");
  result = -2;
 }
 return result;
}

canonical_original_code:
int main(int argc, char **argv){
 int result = 0;
 if(argc == 3){
  if(load_factory(argv[1], argv[2])){
   finish_production_factory();
  }else{
   printf("[ERROR] Cannot load factory\n");
   result = -1;
  }
 }else{
  printf("[ERROR] Invalid syntax: ./production <belts> <robots>\n");
  result = -2;
 }
 return result;
}

variable_types: argc int

variable_types:
argv
char **

variable_types: result int


timestring

repo: dandavison/shellfish

decompiled_code:
char *timestring()
{
struct tm *v0; // rax
time_t timer; // [rsp+8h] [rbp-10h] BYREF

time(&timer);
v0 = localtime(&timer);
strftime(buff_0, 0x64uLL, "%a %d %b %H:%M:%S", v0);
return buff_0;
}

canonical_decompiled_code:
char *func0()
{
struct tm *v0; // rax
time_t timer; // [rsp+8h] [rbp-10h] BYREF

time(&timer);
v0 = localtime(&timer);
strftime(buff_0, 0x64uLL, "%a %d %b %H:%M:%S", v0);
return buff_0;
}

original_code:
char *timestring() {
    static char buff[100] ;
    time_t t ;
    time(&t) ;
    strftime(buff, 100, "%a %d %b %H:%M:%S", localtime(&t)) ;
    return buff ;
}

canonical_original_code:
char *timestring() {
    static char buff[100];
    long t;
    time(&t) ;
    strftime(buff, 100, "%a %d %b %H:%M:%S", localtime(&t)) ;
    return buff ;
}

variable_types:
buff
char [100]

variable_types: t long


decompiled_code:
int print_stdout(char *format, ...)
{
gcc_va_list arg; // [rsp+8h] [rbp-D0h] BYREF

va_start(arg, format);
fflush(stdout);
vfprintf(stdout, format, arg);
return fflush(stdout);
}

canonical_decompiled_code:
int func1(char *format, ...)
{
gcc_va_list arg; // [rsp+8h] [rbp-D0h] BYREF

va_start(arg, format);
fflush(stdout);
vfprintf(stdout, format, arg);
return fflush(stdout);
}

original_code:
void print_stdout(char *fmt, ...) {
    va_list args;
    fflush(stdout);
    __builtin_va_start(args,fmt);
    vfprintf(stdout, fmt, args);
    __builtin_va_end(args);
    fflush(stdout) ;
}

canonical_original_code:
void print_stdout(char *fmt, ...) {
    __builtin_va_list args;
    fflush(stdout);
    __builtin_va_start(args,fmt);
    vfprintf(stdout, fmt, args);
    __builtin_va_end(args);
    fflush(stdout) ;
}

variable_types:
fmt
char *


decompiled_code:
int print_stderr(char *format, ...)
{
gcc_va_list arg; // [rsp+8h] [rbp-D0h] BYREF

va_start(arg, format);
fflush(stderr);
vfprintf(stderr, format, arg);
return fflush(stderr);
}

canonical_decompiled_code:
int func2(char *format, ...)
{
gcc_va_list arg; // [rsp+8h] [rbp-D0h] BYREF

va_start(arg, format);
fflush(stderr);
vfprintf(stderr, format, arg);
return fflush(stderr);
}

original_code:
void print_stderr(char *fmt, ...) {
    va_list args;
    fflush(stderr);
    __builtin_va_start(args,fmt);
    vfprintf(stderr, fmt, args);
    __builtin_va_end(args);
    fflush(stderr) ;
}

canonical_original_code:
void print_stderr(char *fmt, ...) {
    __builtin_va_list args;
    fflush(stderr);
    __builtin_va_start(args,fmt);
    vfprintf(stderr, fmt, args);
    __builtin_va_end(args);
    fflush(stderr) ;
}


eprintf

decompiled_code:
void __noreturn eprintf(char *s, ...)
{
int *v1; // rax
char *v2; // rax
gcc_va_list arg; // [rsp+8h] [rbp-D0h] BYREF

va_start(arg, s);
fflush(stdout);
vfprintf(stderr, s, arg);
if ( *s )
{
if ( s[strlen(s) - 1] == 58 )
{
v1 = _errno_location();
v2 = strerror(*v1);
fprintf(stderr, " %s", v2);
}
}
fputc(10, stderr);
exit(2);
}

canonical_decompiled_code:
void __noreturn func3(char *s, ...)
{
int *v1; // rax
char *v2; // rax
gcc_va_list arg; // [rsp+8h] [rbp-D0h] BYREF

va_start(arg, s);
fflush(stdout);
vfprintf(stderr, s, arg);
if ( *s )
{
if ( s[strlen(s) - 1] == 58 )
{
v1 = _errno_location();
v2 = strerror(*v1);
fprintf(stderr, " %s", v2);
}
}
fputc(10, stderr);
exit(2);
}

original_code:
void eprintf(char *fmt, ...)
{
    va_list args;
    fflush(stdout);
    __builtin_va_start(args,fmt);
    vfprintf(stderr, fmt, args);
    __builtin_va_end(args);
    if (fmt[0] != '\0' && fmt[strlen(fmt)-1] == ':')
 fprintf(stderr, " %s", strerror((*__errno_location ())));
    fprintf(stderr, "\n");
    exit(2);
}

canonical_original_code:
void eprintf(char *fmt, ...)
{
    __builtin_va_list args;
    fflush(stdout);
    __builtin_va_start(args,fmt);
    vfprintf(stderr, fmt, args);
    __builtin_va_end(args);
    if (fmt[0] != '\0' && fmt[strlen(fmt)-1] == ':')
 fprintf(stderr, " %s", strerror((*__errno_location ())));
    fprintf(stderr, "\n");
    exit(2);
}


decompiled_code:
void *__fastcall malloc_dan(size_t a1)
{
void *result; // rax

result = malloc(a1);
if ( !result )
eprintf("malloc failed:");
return result;
}

canonical_decompiled_code:
void *__fastcall func4(size_t a1)
{
void *result; // rax

result = malloc(a1);
if ( !result )
func3("malloc failed:");
return result;
}

original_code:
void *malloc_dan(size_t size) {
    void *p = malloc(size) ;
    if(p == ((void *)0)) eprintf("malloc failed:") ;
    return p ;
}

canonical_original_code:
void *malloc_dan(unsigned long size) {
    void *p = malloc(size);
    if(p == ((void *)0)) eprintf("malloc failed:") ;
    return p ;
}

variable_types:
size
unsigned long

variable_types:
p
void *


decompiled_code:
void *__fastcall calloc_dan(size_t a1, size_t a2)
{
void *result; // rax

result = calloc(a1, a2);
if ( !result )
eprintf("calloc failed:");
return result;
}

canonical_decompiled_code:
void *__fastcall func5(size_t a1, size_t a2)
{
void *result; // rax

result = calloc(a1, a2);
if ( !result )
func3("calloc failed:");
return result;
}

original_code:
void *calloc_dan(size_t nmemb, size_t size) {
    void *p = calloc(nmemb, size) ;
    if(p == ((void *)0)) eprintf("calloc failed:") ;
    return p ;
}

canonical_original_code:
void *calloc_dan(unsigned long nmemb, unsigned long size) {
    void *p = calloc(nmemb, size);
    if(p == ((void *)0)) eprintf("calloc failed:") ;
    return p ;
}

variable_types:
nmemb
unsigned long


weprintf

decompiled_code:
int weprintf(char *s, ...)
{
int *v2; // rax
char *v3; // rax
gcc_va_list arg; // [rsp+8h] [rbp-D0h] BYREF

va_start(arg, s);
fflush(stdout);
fwrite("warning: ", 1uLL, 9uLL, stderr);
vfprintf(stderr, s, arg);
if ( !*s || s[strlen(s) - 1] != 58 )
return fputc(10, stderr);
v2 = _errno_location();
v3 = strerror(*v2);
return fprintf(stderr, " %s\n", v3);
}

canonical_decompiled_code:
int func6(char *s, ...)
{
int *v2; // rax
char *v3; // rax
gcc_va_list arg; // [rsp+8h] [rbp-D0h] BYREF

va_start(arg, s);
fflush(stdout);
fwrite("warning: ", 1uLL, 9uLL, stderr);
vfprintf(stderr, s, arg);
if ( !*s || s[strlen(s) - 1] != 58 )
return fputc(10, stderr);
v2 = _errno_location();
v3 = strerror(*v2);
return fprintf(stderr, " %s\n", v3);
}

original_code:
void weprintf(char *fmt, ...)
{
 va_list args;
 fflush(stdout);
 fprintf(stderr, "warning: ");
 __builtin_va_start(args,fmt);
 vfprintf(stderr, fmt, args);
 __builtin_va_end(args);
 if (fmt[0] != '\0' && fmt[strlen(fmt)-1] == ':')
  fprintf(stderr, " %s\n", strerror((*__errno_location ())));
 else
  fprintf(stderr, "\n");
}

canonical_original_code:
void weprintf(char *fmt, ...)
{
 __builtin_va_list args;
 fflush(stdout);
 fprintf(stderr, "warning: ");
 __builtin_va_start(args,fmt);
 vfprintf(stderr, fmt, args);
 __builtin_va_end(args);
 if (fmt[0] != '\0' && fmt[strlen(fmt)-1] == ':')
  fprintf(stderr, " %s\n", strerror((*__errno_location ())));
 else
  fprintf(stderr, "\n");
}