decompiled_code:
__int64 __fastcall apostrophe_s(_QWORD *a1)
{
__int64 v1; // rax
__int64 v2; // r12
__int64 v3; // rax
__int64 v4; // rax
__int64 result; // rax
__int64 v6; // rbp
__int64 v7; // rax
__int64 v8; // r13
char *v9; // rax
char *v10; // rax
_BYTE *v11; // rax
__int64 v12; // rax
const char *v13; // rax
int v14; // er8
_BYTE *v15; // rax
__int64 v16; // r13
__int64 v17; // rax

v1 = feat_val(*a1, "phoneset");
v2 = val_phoneset(v1);
v3 = utt_relation(a1, "Segment");
v4 = relation_head(v3);
result = item_next(v4);
if ( result )
{
v6 = result;
do
{
while ( 1 )
{
v12 = ffeature(v6, "R:SylStructure.parent.parent.name");
v13 = (const char *)val_string(v12);
v14 = *(unsigned __int8 *)v13;
if ( v14 == 39 && v13[1] == 115 && !v13[2] )
break;
if ( strcmp("'ve", v13) && strcmp("'ll", v13) && (v14 != 39 || v13[1] != 100 || v13[2]) )
goto LABEL_10;
v15 = (_BYTE *)ffeature_string(v6, "p.ph_vc");
if ( *v15 != 45 || v15[1] )
goto LABEL_10;
LABEL_19:
v16 = item_prepend(v6, 0LL);
item_set_string(v16, "name", "ax");
v17 = item_as(v6, "SylStructure");
item_prepend(v17, v16);
result = item_next(v6);
v6 = result;
if ( !result )
return result;
}
v7 = item_prev(v6);
v8 = item_feat_string(v7, "name");
v9 = (char *)phone_feature_string(v2, v8, "ctype");
if ( strchr("fa", *v9) )
{
v10 = (char *)phone_feature_string(v2, v8, "cplace");
if ( !strchr("dbg", *v10) )
goto LABEL_19;
}
v11 = (_BYTE *)phone_feature_string(v2, v8, "cvox");
if ( *v11 == 45 && !v11[1] )
item_set_string(v6, "name", "s");
LABEL_10:
result = item_next(v6);
v6 = result;
}
while ( result );
}
return result;
}

canonical_decompiled_code:
__int64 __fastcall func0(_QWORD *a1)
{
__int64 v1; // rax
__int64 v2; // r12
__int64 v3; // rax
__int64 v4; // rax
__int64 result; // rax
__int64 v6; // rbp
__int64 v7; // rax
__int64 v8; // r13
char *v9; // rax
char *v10; // rax
_BYTE *v11; // rax
__int64 v12; // rax
const char *v13; // rax
int v14; // er8
_BYTE *v15; // rax
__int64 v16; // r13
__int64 v17; // rax

v1 = feat_val(*a1, "phoneset");
v2 = val_phoneset(v1);
v3 = utt_relation(a1, "Segment");
v4 = relation_head(v3);
result = item_next(v4);
if ( result )
{
v6 = result;
do
{
while ( 1 )
{
v12 = ffeature(v6, "R:SylStructure.parent.parent.name");
v13 = (const char *)val_string(v12);
v14 = *(unsigned __int8 *)v13;
if ( v14 == 39 && v13[1] == 115 && !v13[2] )
break;
if ( strcmp("'ve", v13) && strcmp("'ll", v13) && (v14 != 39 || v13[1] != 100 || v13[2]) )
goto LABEL_10;
v15 = (_BYTE *)ffeature_string(v6, "p.ph_vc");
if ( *v15 != 45 || v15[1] )
goto LABEL_10;
LABEL_19:
v16 = item_prepend(v6, 0LL);
item_set_string(v16, "name", "ax");
v17 = item_as(v6, "SylStructure");
item_prepend(v17, v16);
result = item_next(v6);
v6 = result;
if ( !result )
return result;
}
v7 = item_prev(v6);
v8 = item_feat_string(v7, "name");
v9 = (char *)phone_feature_string(v2, v8, "ctype");
if ( strchr("fa", *v9) )
{
v10 = (char *)phone_feature_string(v2, v8, "cplace");
if ( !strchr("dbg", *v10) )
goto LABEL_19;
}
v11 = (_BYTE *)phone_feature_string(v2, v8, "cvox");
if ( *v11 == 45 && !v11[1] )
item_set_string(v6, "name", "s");
LABEL_10:
result = item_next(v6);
v6 = result;
}
while ( result );
}
return result;
}

original_code:
static void apostrophe_s(cst_utterance *u)
{
   cst_item *s;
   cst_item *schwa;
   cst_phoneset *ps=0;
   const char *pname, *word;
   ps = val_phoneset(feat_val(u->features,"phoneset"));
   for (s=item_next(relation_head(utt_relation(u,"Segment")));
      s; s=item_next(s))
   {
      word = val_string(ffeature(s, "R:SylStructure.parent.parent.name"));
      if ((strcmp("'s",word) == 0))
      {
         pname = item_feat_string(item_prev(s),"name");
         if ((strchr("fa",*phone_feature_string(ps,pname,"ctype")) != ((void *)0))
            && (strchr("dbg",
            *phone_feature_string(ps,pname,"cplace")) == ((void *)0)))
         {
            schwa = item_prepend(s,((void *)0));
            item_set_string(schwa,"name","ax");
            item_prepend(item_as(s,"SylStructure"),schwa);
         }
         else if ((strcmp("-",phone_feature_string(ps,pname,"cvox")) == 0))
            item_set_string(s,"name","s");
      }
      else if ((strcmp("'ve",word) == 0)
         || (strcmp("'ll",word) == 0)
         || (strcmp("'d",word) == 0))
      {
         if ((strcmp("-",ffeature_string(s,"p.ph_vc")) == 0))
         {
            schwa = item_prepend(s,((void *)0));
            item_set_string(schwa,"name","ax");
            item_prepend(item_as(s,"SylStructure"),schwa);
         }
      }
   }
}

canonical_original_code:
static void apostrophe_s(struct cst_utterance_struct *u)
{
   struct cst_item_struct *s;
   struct cst_item_struct *schwa;
   struct cst_phoneset_struct *ps = 0;
   char *pname; char *word;
   ps = val_phoneset(feat_val(u->features,"phoneset"));
   for (s=item_next(relation_head(utt_relation(u,"Segment")));
      s; s=item_next(s))
   {
      word = val_string(ffeature(s, "R:SylStructure.parent.parent.name"));
      if ((strcmp("'s",word) == 0))
      {
         pname = item_feat_string(item_prev(s),"name");
         if ((strchr("fa",*phone_feature_string(ps,pname,"ctype")) != ((void *)0))
            && (strchr("dbg",
            *phone_feature_string(ps,pname,"cplace")) == ((void *)0)))
         {
            schwa = item_prepend(s,((void *)0));
            item_set_string(schwa,"name","ax");
            item_prepend(item_as(s,"SylStructure"),schwa);
         }
         else if ((strcmp("-",phone_feature_string(ps,pname,"cvox")) == 0))
            item_set_string(s,"name","s");
      }
      else if ((strcmp("'ve",word) == 0)
         || (strcmp("'ll",word) == 0)
         || (strcmp("'d",word) == 0))
      {
         if ((strcmp("-",ffeature_string(s,"p.ph_vc")) == 0))
         {
            schwa = item_prepend(s,((void *)0));
            item_set_string(schwa,"name","ax");
            item_prepend(item_as(s,"SylStructure"),schwa);
         }
      }
   }
}

variable_types: struct cst_utterance_struct { struct cst_features_struct { struct cst_featvalpair_struct { char *name; struct cst_val_struct { union { struct cst_val_cons_struct { struct cst_val_struct *car; struct cst_val_struct *cdr; } cc; struct cst_val_atom_struct { short type; short ref_count; union { float fval; int ival; void *vval; } v; } a; } c; } *val; struct cst_featvalpair_struct *next; } *head; void *ctx; } *features; struct cst_features_struct *ffunctions; struct cst_features_struct *relations; void *ctx; } *

variable_types: struct cst_item_struct { struct cst_item_contents_struct { struct cst_features_struct { struct cst_featvalpair_struct { char *name; struct cst_val_struct { union { struct cst_val_cons_struct { struct cst_val_struct *car; struct cst_val_struct *cdr; } cc; struct cst_val_atom_struct { short type; short ref_count; union { float fval; int ival; void *vval; } v; } a; } c; } *val; struct cst_featvalpair_struct *next; } *head; void *ctx; } *features; struct cst_features_struct *relations; } *contents; struct cst_relation_struct { char *name; struct cst_features_struct *features; struct cst_utterance_struct { struct cst_features_struct *features; struct cst_features_struct *ffunctions; struct cst_features_struct *relations; void *ctx; } *utterance; struct cst_item_struct *head; struct cst_item_struct *tail; } *relation; struct cst_item_struct *n; struct cst_item_struct *p; struct cst_item_struct *u; struct cst_item_struct *d; } *

variable_types: struct cst_phoneset_struct { char *name; char **featnames; struct cst_val_struct { union { struct cst_val_cons_struct { struct cst_val_struct *car; struct cst_val_struct *cdr; } cc; struct cst_val_atom_struct { short type; short ref_count; union { float fval; int ival; void *vval; } v; } a; } c; } **featvals; char **phonenames; char *silence; int num_phones; int **fvtable; } *

variable_types:
pname
char *

variable_types:
word
char *

user_defined_types: struct cst_item_struct { struct cst_item_contents_struct *contents; struct cst_relation_struct *relation; struct cst_item_struct *n; struct cst_item_struct *p; struct cst_item_struct *u; struct cst_item_struct *d; }

user_defined_types: struct cst_phoneset_struct { char *name; char **featnames; struct cst_val_struct **featvals; char **phonenames; char *silence; int num_phones; int **fvtable; }

user_defined_types: struct cst_item_contents_struct { struct cst_features_struct *features; struct cst_features_struct *relations; }

user_defined_types: struct cst_relation_struct { char *name; struct cst_features_struct *features; struct cst_utterance_struct *utterance; struct cst_item_struct *head; struct cst_item_struct *tail; }

user_defined_types: struct cst_val_struct { union { struct cst_val_cons_struct cc; struct cst_val_atom_struct a; } c; }


repo: deardaniel/PizzaTest

decompiled_code:
__int64 __fastcall the_iy_ax(__int64 a1)
{
__int64 v1; // rax
__int64 result; // rax
__int64 v3; // rbp
_BYTE *v4; // rax
_BYTE *v5; // rax

v1 = utt_relation(a1, "Segment");
result = relation_head(v1);
if ( result )
{
v3 = result;
do
{
v4 = (_BYTE *)item_feat_string(v3, "name");
if ( *v4 == 97
&& v4[1] == 120
&& !v4[2]
&& !strcmp("the", (const char *)ffeature_string(v3, "R:SylStructure.parent.parent.name")) )
{
v5 = (_BYTE *)ffeature_string(v3, "n.ph_vc");
if ( *v5 == 43 && !v5[1] )
item_set_string(v3, "name", "iy");
}
result = item_next(v3);
v3 = result;
}
while ( result );
}
return result;
}

canonical_decompiled_code:
__int64 __fastcall func1(__int64 a1)
{
__int64 v1; // rax
__int64 result; // rax
__int64 v3; // rbp
_BYTE *v4; // rax
_BYTE *v5; // rax

v1 = utt_relation(a1, "Segment");
result = relation_head(v1);
if ( result )
{
v3 = result;
do
{
v4 = (_BYTE *)item_feat_string(v3, "name");
if ( *v4 == 97
&& v4[1] == 120
&& !v4[2]
&& !strcmp("the", (const char *)ffeature_string(v3, "R:SylStructure.parent.parent.name")) )
{
v5 = (_BYTE *)ffeature_string(v3, "n.ph_vc");
if ( *v5 == 43 && !v5[1] )
item_set_string(v3, "name", "iy");
}
result = item_next(v3);
v3 = result;
}
while ( result );
}
return result;
}

original_code:
static void the_iy_ax(cst_utterance *u)
{
   const cst_item *i;
   const char *word;
   for (i = relation_head(utt_relation(u, "Segment")); i; i = item_next(i))
   {
      if ((strcmp("ax",item_feat_string(i,"name")) == 0))
      {
         word = ffeature_string(i,"R:SylStructure.parent.parent.name");
         if ((strcmp("the",word) == 0)
            && (strcmp("+",ffeature_string(i,"n.ph_vc")) == 0))
            item_set_string(i, "name", "iy");
      }
   }
}

canonical_original_code:
static void the_iy_ax(struct cst_utterance_struct *u)
{
   struct cst_item_struct *i;
   char *word;
   for (i = relation_head(utt_relation(u, "Segment")); i; i = item_next(i))
   {
      if ((strcmp("ax",item_feat_string(i,"name")) == 0))
      {
         word = ffeature_string(i,"R:SylStructure.parent.parent.name");
         if ((strcmp("the",word) == 0)
            && (strcmp("+",ffeature_string(i,"n.ph_vc")) == 0))
            item_set_string(i, "name", "iy");
      }
   }
}

return_type: void

user_defined_types: struct cst_utterance_struct { struct cst_features_struct *features; struct cst_features_struct *ffunctions; struct cst_features_struct *relations; void *ctx; }

user_defined_types: struct cst_features_struct { struct cst_featvalpair_struct *head; void *ctx; }

user_defined_types: struct cst_featvalpair_struct { char *name; struct cst_val_struct *val; struct cst_featvalpair_struct *next; }

user_defined_types: struct cst_val_cons_struct { struct cst_val_struct *car; struct cst_val_struct *cdr; }

user_defined_types: struct cst_val_atom_struct { short type; short ref_count; union { float fval; int ival; void *vval; } v; }


decompiled_code:
void val_delete_uttfunc()
{
;
}

canonical_decompiled_code:
void func0()
{
;
}

original_code: void val_delete_uttfunc(void *v) { (void)v; }

variable_types:
v
void *


decompiled_code:
void val_delete_itemfunc()
{
;
}

canonical_decompiled_code:
void func2()
{
;
}

original_code: void val_delete_itemfunc(void *v) { (void)v; }


decompiled_code:
void val_delete_userdata()
{
;
}

canonical_decompiled_code:
void func3()
{
;
}

original_code: void val_delete_userdata(void *v) { (void)v; }


decompiled_code:
void val_delete_sts_list()
{
;
}

canonical_decompiled_code:
void func4()
{
;
}

original_code: void val_delete_sts_list(void *v) { (void)v; }


decompiled_code:
void val_delete_vit_cand()
{
;
}

canonical_decompiled_code:
void func5()
{
;
}

original_code: void val_delete_vit_cand(void *v) { (void)v; }


decompiled_code:
void val_delete_clunit_db()
{
;
}

canonical_decompiled_code:
void func6()
{
;
}

original_code: void val_delete_clunit_db(void *v) { (void)v; }


decompiled_code:
void val_delete_diphone_db()
{
;
}

canonical_decompiled_code:
void func7()
{
;
}

original_code: void val_delete_diphone_db(void *v) { (void)v; }


decompiled_code:
void val_delete_dur_stats()
{
;
}

canonical_decompiled_code:
void func8()
{
;
}

original_code: void val_delete_dur_stats(void *v) { (void)v; }


decompiled_code:
void val_delete_lexicon()
{
;
}

canonical_decompiled_code:
void func9()
{
;
}

original_code: void val_delete_lexicon(void *v) { (void)v; }


decompiled_code:
void val_delete_phoneset()
{
;
}

canonical_decompiled_code:
void func10()
{
;
}

original_code: void val_delete_phoneset(void *v) { (void)v; }


decompiled_code:
void val_delete_cart()
{
;
}

canonical_decompiled_code:
void func11()
{
;
}

original_code: void val_delete_cart(void *v) { (void)v; }


decompiled_code:
void val_delete_item()
{
;
}

canonical_decompiled_code:
void func12()
{
;
}

original_code: void val_delete_item(void *v) { (void)v; }


decompiled_code:
void val_delete_relation()
{
;
}

canonical_decompiled_code:
void func13()
{
;
}

original_code: void val_delete_relation(void *v) { (void)v; }


decompiled_code:
void val_delete_ffunc()
{
;
}

canonical_decompiled_code:
void func14()
{
;
}

original_code: void val_delete_ffunc(void *v) { (void)v; }


decompiled_code:
__int64 __fastcall val_userdata(__int64 a1)
{
if ( !a1 || *(_WORD *)a1 != 41 )
{
cst_errmsg("VAL: tried to access %s in %d type val\n", "userdata");
if ( cst_errjmp )
longjmp(cst_errjmp, 1);
exit(-1);
}
return *(_QWORD *)(a1 + 8);
}

canonical_decompiled_code:
__int64 __fastcall func15(__int64 a1)
{
if ( !a1 || *(_WORD *)a1 != 41 )
{
cst_errmsg("VAL: tried to access %s in %d type val\n", "userdata");
if ( cst_errjmp )
longjmp(cst_errjmp, 1);
exit(-1);
}
return *(_QWORD *)(a1 + 8);
}

original_code: cst_userdata *val_userdata(const cst_val *v) { if (v && ((v)->c.a.type) == cst_val_type_userdata) return (cst_userdata *)((v)->c.a.v.vval); else { cst_errmsg("VAL: tried to access %s in %d type val\n", "userdata", (v ? ((v)->c.a.type) : -1)); (cst_errjmp ? longjmp(*cst_errjmp,1) : exit(-1)); } return ((void *)0); }

canonical_original_code: void *val_userdata(struct cst_val_struct *v) { if (v && ((v)->c.a.type) == cst_val_type_userdata) return (void *)((v)->c.a.v.vval); else { cst_errmsg("VAL: tried to access %s in %d type val\n", "userdata", (v ? ((v)->c.a.type) : -1)); (cst_errjmp ? longjmp(*cst_errjmp,1) : exit(-1)); } return ((void *)0); }

variable_types: struct cst_val_struct { union { struct cst_val_cons_struct { struct cst_val_struct *car; struct cst_val_struct *cdr; } cc; struct cst_val_atom_struct { short type; short ref_count; union { float fval; int ival; void *vval; } v; } a; } c; } *

return_type: void *


decompiled_code:
__int64 __fastcall userdata_val(__int64 a1)
{
return val_new_typed(41LL, a1);
}

canonical_decompiled_code:
__int64 __fastcall func16(__int64 a1)
{
return val_new_typed(41LL, a1);
}

original_code: cst_val *userdata_val(const cst_userdata *v) { return val_new_typed(cst_val_type_userdata, (void *)v); }

canonical_original_code: struct cst_val_struct *userdata_val(void *v) { return val_new_typed(cst_val_type_userdata, (void *)v); }

return_type: struct cst_val_struct { union { struct cst_val_cons_struct { struct cst_val_struct *car; struct cst_val_struct *cdr; } cc; struct cst_val_atom_struct { short type; short ref_count; union { float fval; int ival; void *vval; } v; } a; } c; } *


decompiled_code:
__int64 __fastcall fsm_transition(__int16 *a1, int a2, int a3)
{
unsigned __int16 *v5; // rcx
int v6; // eax
int v7; // esi
__int64 result; // rax
int v9; // edx

v5 = (unsigned __int16 *)(*((_QWORD *)a1 + 1) + 2LL * a2);
v6 = *v5;
if ( !(_WORD)v6 )
return 0xFFFFFFFFLL;
v7 = *a1;
while ( 1 )
{
v9 = v6 % v7;
result = (unsigned int)(v6 / v7);
if ( v9 == a3 )
break;
v6 = v5[1];
++v5;
if ( !(_WORD)v6 )
return 0xFFFFFFFFLL;
}
return result;
}

canonical_decompiled_code:
__int64 __fastcall func0(__int16 *a1, int a2, int a3)
{
unsigned __int16 *v5; // rcx
int v6; // eax
int v7; // esi
__int64 result; // rax
int v9; // edx

v5 = (unsigned __int16 *)(*((_QWORD *)a1 + 1) + 2LL * a2);
v6 = *v5;
if ( !(_WORD)v6 )
return 0xFFFFFFFFLL;
v7 = *a1;
while ( 1 )
{
v9 = v6 % v7;
result = (unsigned int)(v6 / v7);
if ( v9 == a3 )
break;
v6 = v5[1];
++v5;
if ( !(_WORD)v6 )
return 0xFFFFFFFFLL;
}
return result;
}

original_code:
int fsm_transition(cst_fsm *fsm,int state, int symbol)
{
    int i;
    for (i=state; fsm->transitions[i]; i++)
    {
 if ((fsm->transitions[i] % fsm->vocab_size) == symbol)
     return fsm->transitions[i] / fsm->vocab_size;
    }
    return -1;
}

canonical_original_code:
int fsm_transition(struct fsm_struct *fsm, int state, int symbol)
{
    int i;
    for (i=state; fsm->transitions[i]; i++)
    {
 if ((fsm->transitions[i] % fsm->vocab_size) == symbol)
     return fsm->transitions[i] / fsm->vocab_size;
    }
    return -1;
}

variable_types: struct fsm_struct { short vocab_size; short num_transitions; unsigned short *transitions; } *

variable_types: state int

variable_types: symbol int

variable_types: i int

return_type: int


decompiled_code:
_BOOL8 __fastcall is_word_pre(char *a1)
{
int v1; // ebp
char v2; // al
char *v3; // r12
int v4; // ebx

v1 = fsm_transition(fsm_aswdP, 0, 35);
v2 = *a1;
if ( !*a1 )
return 0LL;
v3 = a1 + 1;
while ( 1 )
{
if ( (unsigned __int8)(v2 - 109) <= 1u )
{
v1 = fsm_transition(fsm_aswdP, v1, 78);
if ( v1 == -1 )
return 0LL;
goto LABEL_7;
}
v4 = v2;
if ( strchr("aeiouy", v2) )
return (unsigned int)fsm_transition(fsm_aswdP, v1, 86) != -1;
v1 = fsm_transition(fsm_aswdP, v1, v4);
if ( v1 == -1 )
return 0LL;
if ( v4 == 86 )
return 1LL;
LABEL_7:
v2 = *v3++;
if ( !v2 )
return 0LL;
}
}

canonical_decompiled_code:
_BOOL8 __fastcall func1(char *a1)
{
int v1; // ebp
char v2; // al
char *v3; // r12
int v4; // ebx

v1 = func0(fsm_aswdP, 0, 35);
v2 = *a1;
if ( !*a1 )
return 0LL;
v3 = a1 + 1;
while ( 1 )
{
if ( (unsigned __int8)(v2 - 109) <= 1u )
{
v1 = func0(fsm_aswdP, v1, 78);
if ( v1 == -1 )
return 0LL;
goto LABEL_7;
}
v4 = v2;
if ( strchr("aeiouy", v2) )
return (unsigned int)func0(fsm_aswdP, v1, 86) != -1;
v1 = func0(fsm_aswdP, v1, v4);
if ( v1 == -1 )
return 0LL;
if ( v4 == 86 )
return 1LL;
LABEL_7:
v2 = *v3++;
if ( !v2 )
return 0LL;
}
}

original_code:
static int is_word_pre(const char *word)
{
    int i, state, symbol;
    state = fsm_transition(&fsm_aswdP,0,'#');
    for (i=0; word[i]; i++)
    {
 if ((word[i] == 'n') || ((word[i] == 'm')))
     symbol = 'N';
 else if (strchr("aeiouy",word[i]) != ((void *)0))
     symbol = 'V';
 else
     symbol = word[i];
 state = fsm_transition(&fsm_aswdP,state,symbol);
 if (state == -1)
     return 0;
 else if (symbol == 'V')
     return 1;
    }
    return 0;
}

canonical_original_code:
static int is_word_pre(char *word)
{
    int i; int state; int symbol;
    state = fsm_transition(&fsm_aswdP,0,'#');
    for (i=0; word[i]; i++)
    {
 if ((word[i] == 'n') || ((word[i] == 'm')))
     symbol = 'N';
 else if (strchr("aeiouy",word[i]) != ((void *)0))
     symbol = 'V';
 else
     symbol = word[i];
 state = fsm_transition(&fsm_aswdP,state,symbol);
 if (state == -1)
     return 0;
 else if (symbol == 'V')
     return 1;
    }
    return 0;
}


decompiled_code:
_BOOL8 __fastcall is_word_suf(char *s)
{
int v1; // er13
int v2; // eax
__int64 v3; // rbx
char v4; // al
int v5; // ebp

v1 = fsm_transition(fsm_aswdP, 0, 35);
v2 = strlen(s) - 1;
if ( v2 < 0 )
return 0LL;
v3 = v2;
while ( 1 )
{
v4 = s[v3];
if ( (unsigned __int8)(v4 - 109) <= 1u )
{
v1 = fsm_transition(fsm_aswdS, v1, 78);
if ( v1 == -1 )
return 0LL;
goto LABEL_7;
}
v5 = v4;
if ( strchr("aeiouy", v4) )
return (unsigned int)fsm_transition(fsm_aswdS, v1, 86) != -1;
v1 = fsm_transition(fsm_aswdS, v1, v5);
if ( v1 == -1 )
return 0LL;
if ( v5 == 86 )
return 1LL;
LABEL_7:
if ( (int)--v3 < 0 )
return 0LL;
}
}

canonical_decompiled_code:
_BOOL8 __fastcall func2(char *s)
{
int v1; // er13
int v2; // eax
__int64 v3; // rbx
char v4; // al
int v5; // ebp

v1 = func0(fsm_aswdP, 0, 35);
v2 = strlen(s) - 1;
if ( v2 < 0 )
return 0LL;
v3 = v2;
while ( 1 )
{
v4 = s[v3];
if ( (unsigned __int8)(v4 - 109) <= 1u )
{
v1 = func0(fsm_aswdS, v1, 78);
if ( v1 == -1 )
return 0LL;
goto LABEL_7;
}
v5 = v4;
if ( strchr("aeiouy", v4) )
return (unsigned int)func0(fsm_aswdS, v1, 86) != -1;
v1 = func0(fsm_aswdS, v1, v5);
if ( v1 == -1 )
return 0LL;
if ( v5 == 86 )
return 1LL;
LABEL_7:
if ( (int)--v3 < 0 )
return 0LL;
}
}

original_code:
static int is_word_suf(const char *word)
{
    int i, state, symbol;
    state = fsm_transition(&fsm_aswdP,0,'#');
    for (i=strlen(word)-1; i >= 0 ; i--)
    {
 if ((word[i] == 'n') || ((word[i] == 'm')))
     symbol = 'N';
 else if (strchr("aeiouy",word[i]) != ((void *)0))
     symbol = 'V';
 else
     symbol = word[i];
 state = fsm_transition(&fsm_aswdS,state,symbol);
 if (state == -1)
     return 0;
 else if (symbol == 'V')
     return 1;
    }
    return 0;
}

canonical_original_code:
static int is_word_suf(char *word)
{
    int i; int state; int symbol;
    state = fsm_transition(&fsm_aswdP,0,'#');
    for (i=strlen(word)-1; i >= 0 ; i--)
    {
 if ((word[i] == 'n') || ((word[i] == 'm')))
     symbol = 'N';
 else if (strchr("aeiouy",word[i]) != ((void *)0))
     symbol = 'V';
 else
     symbol = word[i];
 state = fsm_transition(&fsm_aswdS,state,symbol);
 if (state == -1)
     return 0;
 else if (symbol == 'V')
     return 1;
    }
    return 0;
}


decompiled_code:
_BOOL8 us_aswd()
{
char *v0; // rbp
_BOOL8 v1; // r12

v0 = (char *)cst_downcase();
LODWORD(v1) = is_word_pre(v0);
if ( v1 )
v1 = is_word_suf(v0);
cst_free(v0);
return v1;
}

canonical_decompiled_code:
_BOOL8 func3()
{
char *v0; // rbp
_BOOL8 v1; // r12

v0 = (char *)cst_downcase();
LODWORD(v1) = func1(v0);
if ( v1 )
v1 = func2(v0);
cst_free(v0);
return v1;
}

original_code:
int us_aswd(const char *word)
{
    char *dc;
    int i;
    dc = cst_downcase(word);
    i = is_word_pre(dc) && is_word_suf(dc);
    cst_free(dc);
    return i;
}

canonical_original_code:
int us_aswd(char *word)
{
    char *dc;
    int i;
    dc = cst_downcase(word);
    i = is_word_pre(dc) && is_word_suf(dc);
    cst_free(dc);
    return i;
}

variable_types:
dc
char *


decompiled_code:
__int64 __fastcall flite_synth_foo(__int64 a1, __int64 a2, __int64 (__fastcall *a3)(__int64))
{
__int64 v3; // r12

v3 = a1;
utt_init();
if ( !a3(a1) )
{
v3 = 0LL;
delete_utterance(a1);
}
return v3;
}

canonical_decompiled_code:
__int64 __fastcall func0(__int64 a1, __int64 a2, __int64 (__fastcall *a3)(__int64))
{
__int64 v3; // r12

v3 = a1;
utt_init();
if ( !a3(a1) )
{
v3 = 0LL;
delete_utterance(a1);
}
return v3;
}

original_code:
static cst_utterance *flite_synth_foo(cst_utterance *u,
          cst_voice *voice,
          cst_uttfunc synth)
{
   utt_init(u, voice);
   if ((*synth)(u) == ((void *)0))
   {
      delete_utterance(u);
      return ((void *)0);
   } else
      return u;
}

canonical_original_code:
static struct cst_utterance_struct *flite_synth_foo(struct cst_utterance_struct *u, struct cst_voice_struct *voice, struct cst_utterance_struct *(*synth)(struct cst_utterance_struct *i))
{
   utt_init(u, voice);
   if ((*synth)(u) == ((void *)0))
   {
      delete_utterance(u);
      return ((void *)0);
   } else
      return u;
}

variable_types:
u
struct cst_utterance_struct *

variable_types: struct cst_voice_struct { struct cst_features_struct *features; struct cst_features_struct *ffunctions; struct cst_utterance_struct *(*utt_init)(struct cst_utterance_struct *u, struct cst_voice_struct *v); } *

variable_types: struct cst_utterance_struct *(*)(struct cst_utterance_struct *i)

return_type: struct cst_utterance_struct { struct cst_features_struct { struct cst_featvalpair_struct { char *name; struct cst_val_struct { union { struct cst_val_cons_struct { struct cst_val_struct *car; struct cst_val_struct *cdr; } cc; struct cst_val_atom_struct { short type; short ref_count; union { float fval; int ival; void *vval; } v; } a; } c; } *val; struct cst_featvalpair_struct *next; } *head; void *ctx; } *features; struct cst_features_struct *ffunctions; struct cst_features_struct *relations; void *ctx; } *


decompiled_code:
__int64 flite_init()
{
cst_regex_init();
return 0LL;
}

canonical_decompiled_code:
__int64 func1()
{
cst_regex_init();
return 0LL;
}

original_code:
int flite_init()
{
    cst_regex_init();
    return 0;
}


decompiled_code:
__int64 __fastcall flite_synth_text(__int64 a1, __int64 a2)
{
__int64 v2; // rbp

v2 = new_utterance();
utt_set_input_text(v2, a1);
return flite_synth_foo(v2, a2, (__int64 (__fastcall *)(__int64))&utt_synth);
}

canonical_decompiled_code:
__int64 __fastcall func2(__int64 a1, __int64 a2)
{
__int64 v2; // rbp

v2 = new_utterance();
utt_set_input_text(v2, a1);
return func0(v2, a2, (__int64 (__fastcall *)(__int64))&utt_synth);
}

original_code:
cst_utterance *flite_synth_text(const char *text, cst_voice *voice)
{
    cst_utterance *u;
    u = new_utterance();
    utt_set_input_text(u,text);
    return flite_synth_foo(u, voice, utt_synth);
}

canonical_original_code:
struct cst_utterance_struct *flite_synth_text(char *text, struct cst_voice_struct *voice)
{
    struct cst_utterance_struct *u;
    u = new_utterance();
    utt_set_input_text(u,text);
    return flite_synth_foo(u, voice, utt_synth);
}

variable_types:
text
char *

user_defined_types: struct cst_voice_struct { struct cst_features_struct *features; struct cst_features_struct *ffunctions; struct cst_utterance_struct *(*utt_init)(struct cst_utterance_struct *u, struct cst_voice_struct *v); }


decompiled_code:
__int64 __fastcall flite_synth_phones(__int64 a1, __int64 a2)
{
__int64 v2; // rbp

v2 = new_utterance();
utt_set_input_text(v2, a1);
return flite_synth_foo(v2, a2, (__int64 (__fastcall *)(__int64))&utt_synth_phones);
}

canonical_decompiled_code:
__int64 __fastcall func3(__int64 a1, __int64 a2)
{
__int64 v2; // rbp

v2 = new_utterance();
utt_set_input_text(v2, a1);
return func0(v2, a2, (__int64 (__fastcall *)(__int64))&utt_synth_phones);
}

original_code:
cst_utterance *flite_synth_phones(const char *text, cst_voice *voice)
{
    cst_utterance *u;
    u = new_utterance();
    utt_set_input_text(u,text);
    return flite_synth_foo(u, voice, utt_synth_phones);
}

canonical_original_code:
struct cst_utterance_struct *flite_synth_phones(char *text, struct cst_voice_struct *voice)
{
    struct cst_utterance_struct *u;
    u = new_utterance();
    utt_set_input_text(u,text);
    return flite_synth_foo(u, voice, utt_synth_phones);
}


original_code:
cst_wave *lpc_resynth_fixedpoint(cst_lpcres *lpcres)
{
    cst_wave *w;
    int i,j,r,o,k;
    int ci,cr;
    int *outbuf, *lpccoefs;
    int pm_size_samps, ilpc_min, ilpc_range;
    int pp = 0;
    w = new_wave();
    cst_wave_resize(w,lpcres->num_samples * lpcres->residual_fold,1);
    w->sample_rate = lpcres->sample_rate;
    outbuf = ((int *)cst_safe_alloc(sizeof(int)*(1+lpcres->num_channels)));
    lpccoefs = ((int *)cst_safe_alloc(sizeof(int)*(lpcres->num_channels)));
    ilpc_min = (int)(lpcres->lpc_min*32768.0);
    ilpc_range = (int)(lpcres->lpc_range*2048.0);
    for (r=0,o=lpcres->num_channels,i=0; i < lpcres->num_frames; i++)
    {
 pm_size_samps = lpcres->sizes[i] * lpcres->residual_fold;
 for (k=0; k<lpcres->num_channels; k++)
     lpccoefs[k]=((lpcres->frames[i][k]/2*ilpc_range)/2048+ilpc_min)/2;
 for (j=0; j < pm_size_samps; j++,r++)
 {
     outbuf[o] = (int)cst_ulaw_to_short(lpcres->residual[r / lpcres->residual_fold]);
     outbuf[o] *= 16384;
     cr = (o == 0 ? lpcres->num_channels : o-1);
     for (ci=0; ci < lpcres->num_channels; ci++)
     {
  outbuf[o] += lpccoefs[ci]*outbuf[cr];
  cr = (cr == 0 ? lpcres->num_channels : cr-1);
     }
     outbuf[o] /= 16384;
     w->samples[r] = (short)outbuf[o]
  ;
     pp = outbuf[o];
     o = (o == lpcres->num_channels ? 0 : o+1);
 }
    }
    cst_free(outbuf);
    cst_free(lpccoefs);
    return w;
}

canonical_original_code:
struct cst_wave_struct *lpc_resynth_fixedpoint(struct cst_lpcres_struct *lpcres)
{
    struct cst_wave_struct *w;
    int i; int j; int r; int o; int k;
    int ci; int cr;
    int *outbuf; int *lpccoefs;
    int pm_size_samps; int ilpc_min; int ilpc_range;
    int pp = 0;
    w = new_wave();
    cst_wave_resize(w,lpcres->num_samples * lpcres->residual_fold,1);
    w->sample_rate = lpcres->sample_rate;
    outbuf = ((int *)cst_safe_alloc(sizeof(int)*(1+lpcres->num_channels)));
    lpccoefs = ((int *)cst_safe_alloc(sizeof(int)*(lpcres->num_channels)));
    ilpc_min = (int)(lpcres->lpc_min*32768.0);
    ilpc_range = (int)(lpcres->lpc_range*2048.0);
    for (r=0,o=lpcres->num_channels,i=0; i < lpcres->num_frames; i++)
    {
 pm_size_samps = lpcres->sizes[i] * lpcres->residual_fold;
 for (k=0; k<lpcres->num_channels; k++)
     lpccoefs[k]=((lpcres->frames[i][k]/2*ilpc_range)/2048+ilpc_min)/2;
 for (j=0; j < pm_size_samps; j++,r++)
 {
     outbuf[o] = (int)cst_ulaw_to_short(lpcres->residual[r / lpcres->residual_fold]);
     outbuf[o] *= 16384;
     cr = (o == 0 ? lpcres->num_channels : o-1);
     for (ci=0; ci < lpcres->num_channels; ci++)
     {
  outbuf[o] += lpccoefs[ci]*outbuf[cr];
  cr = (cr == 0 ? lpcres->num_channels : cr-1);
     }
     outbuf[o] /= 16384;
     w->samples[r] = (short)outbuf[o]
  ;
     pp = outbuf[o];
     o = (o == lpcres->num_channels ? 0 : o+1);
 }
    }
    cst_free(outbuf);
    cst_free(lpccoefs);
    return w;
}

variable_types: struct cst_lpcres_struct { unsigned short **frames; int *times; int num_frames; int num_channels; float lpc_min; float lpc_range; float post_emphasis; int num_samples; int sample_rate; int residual_fold; int *sizes; unsigned char *residual; } *

variable_types: struct cst_wave_struct { char *type; int sample_rate; int num_samples; int num_channels; short *samples; } *

variable_types: j int

variable_types: r int

variable_types: o int

variable_types: k int

variable_types: ci int

variable_types: cr int

variable_types:
outbuf
int *

variable_types:
lpccoefs
int *

variable_types: pp int


decompiled_code:
__int64 __fastcall cst_args(const char **a1, int a2, const char *a3, __int64 a4)
{
__int64 v4; // r14
__int64 v5; // r13
int v6; // er15
__int64 v7; // rbp
__int64 v8; // rax
__int64 v9; // rbx
const char **v10; // r14
const char *v11; // r10
const char *v12; // rax
unsigned int v14; // eax
float v15; // xmm0_4

v4 = (__int64)a3;
v5 = new_features();
parse_description(v4, v5);
if ( a2 > 1 )
{
v6 = 1;
v7 = 0LL;
while ( 1 )
{
while ( 1 )
{
v9 = v6;
v10 = &a1[v9];
if ( *a1[v9] == 45 )
break;
v8 = string_val();
v7 = cons_val(v8, v7);
LABEL_4:
if ( a2 <= ++v6 )
goto LABEL_19;
}
if ( !(unsigned int)feat_present(v5, a1[v6])
|| (v11 = *v10, **v10 == 45) && (v11[1] == 104 && !v11[2] || v11[1] == 63 && !v11[2])
|| !strcmp("-help", *v10) )
{
parse_usage(stdout, *a1, (const char *)&unk_37B, (const char *)&unk_37B, a3);
}
v12 = (const char *)feat_string(v5, *v10);
if ( !strcmp("<binary>", v12) )
{
feat_set_string(a4, *v10, "true");
goto LABEL_4;
}
if ( a2 == ++v6 )
parse_usage(stderr, *a1, "missing argument for ", *v10, a3);
if ( !strcmp("<int>", v12) )
{
v14 = atoi(a1[v9 + 1]);
feat_set_int(a4, *v10, v14);
goto LABEL_4;
}
if ( !strcmp("<float>", v12) )
{
v15 = atof(a1[v9 + 1]);
feat_set_float(a4, *v10, v15);
goto LABEL_4;
}
if ( strcmp("<string>", v12) )
parse_usage(stderr, *a1, "unknown arg type ", v12, a3);
++v6;
feat_set_string(a4, *v10, a1[v9 + 1]);
if ( a2 <= v6 )
goto LABEL_19;
}
}
v7 = 0LL;
LABEL_19:
delete_features(v5);
return val_reverse(v7);
}

canonical_decompiled_code:
__int64 __fastcall func2(const char **a1, int a2, const char *a3, __int64 a4)
{
__int64 v4; // r14
__int64 v5; // r13
int v6; // er15
__int64 v7; // rbp
__int64 v8; // rax
__int64 v9; // rbx
const char **v10; // r14
const char *v11; // r10
const char *v12; // rax
unsigned int v14; // eax
float v15; // xmm0_4

v4 = (__int64)a3;
v5 = new_features();
func0(v4, v5);
if ( a2 > 1 )
{
v6 = 1;
v7 = 0LL;
while ( 1 )
{
while ( 1 )
{
v9 = v6;
v10 = &a1[v9];
if ( *a1[v9] == 45 )
break;
v8 = string_val();
v7 = cons_val(v8, v7);
LABEL_4:
if ( a2 <= ++v6 )
goto LABEL_19;
}
if ( !(unsigned int)feat_present(v5, a1[v6])
|| (v11 = *v10, **v10 == 45) && (v11[1] == 104 && !v11[2] || v11[1] == 63 && !v11[2])
|| !strcmp("-help", *v10) )
{
func1(stdout, *a1, (const char *)&unk_37B, (const char *)&unk_37B, a3);
}
v12 = (const char *)feat_string(v5, *v10);
if ( !strcmp("<binary>", v12) )
{
feat_set_string(a4, *v10, "true");
goto LABEL_4;
}
if ( a2 == ++v6 )
func1(stderr, *a1, "missing argument for ", *v10, a3);
if ( !strcmp("<int>", v12) )
{
v14 = atoi(a1[v9 + 1]);
feat_set_int(a4, *v10, v14);
goto LABEL_4;
}
if ( !strcmp("<float>", v12) )
{
v15 = atof(a1[v9 + 1]);
feat_set_float(a4, *v10, v15);
goto LABEL_4;
}
if ( strcmp("<string>", v12) )
func1(stderr, *a1, "unknown arg type ", v12, a3);
++v6;
feat_set_string(a4, *v10, a1[v9 + 1]);
if ( a2 <= v6 )
goto LABEL_19;
}
}
v7 = 0LL;
LABEL_19:
delete_features(v5);
return val_reverse(v7);
}

original_code:
cst_val *cst_args(char **argv, int argc,
    const char *description,
    cst_features *args)
{
    cst_features *op_types = new_features();
    cst_val *files = ((void *)0);
    int i;
    const char *type;
    parse_description(description,op_types);
    for (i=1; i<argc; i++)
    {
 if (argv[i][0] == '-')
 {
     if ((!feat_present(op_types,argv[i])) ||
  ((strcmp("-h",argv[i]) == 0)) ||
  ((strcmp("-?",argv[i]) == 0)) ||
  ((strcmp("-help",argv[i]) == 0)))
  parse_usage(stdout,argv[0],"","",description);
     else
     {
  type = feat_string(op_types,argv[i]);
  if ((strcmp("<binary>",type) == 0))
      feat_set_string(args,argv[i],"true");
  else
  {
      if (i+1 == argc)
   parse_usage(stderr,argv[0],
        "missing argument for ",argv[i],
        description);
      if ((strcmp("<int>",type) == 0))
   feat_set_int(args,argv[i],atoi(argv[i+1]));
      else if ((strcmp("<float>",type) == 0))
   feat_set_float(args,argv[i],atof(argv[i+1]));
      else if ((strcmp("<string>",type) == 0))
   feat_set_string(args,argv[i],argv[i+1]);
      else
   parse_usage(stderr,argv[0],
        "unknown arg type ",type,
        description);
      i++;
  }
     }
 }
 else
     files = cons_val(string_val(argv[i]),files);
    }
    delete_features(op_types);
    return val_reverse(files);
}

canonical_original_code:
struct cst_val_struct *cst_args(char **argv, int argc, char *description, struct cst_features_struct *args)
{
    struct cst_features_struct *op_types = new_features();
    struct cst_val_struct *files = ((void *)0);
    int i;
    char *type;
    parse_description(description,op_types);
    for (i=1; i<argc; i++)
    {
 if (argv[i][0] == '-')
 {
     if ((!feat_present(op_types,argv[i])) ||
  ((strcmp("-h",argv[i]) == 0)) ||
  ((strcmp("-?",argv[i]) == 0)) ||
  ((strcmp("-help",argv[i]) == 0)))
  parse_usage(stdout,argv[0],"","",description);
     else
     {
  type = feat_string(op_types,argv[i]);
  if ((strcmp("<binary>",type) == 0))
      feat_set_string(args,argv[i],"true");
  else
  {
      if (i+1 == argc)
   parse_usage(stderr,argv[0],
        "missing argument for ",argv[i],
        description);
      if ((strcmp("<int>",type) == 0))
   feat_set_int(args,argv[i],atoi(argv[i+1]));
      else if ((strcmp("<float>",type) == 0))
   feat_set_float(args,argv[i],atof(argv[i+1]));
      else if ((strcmp("<string>",type) == 0))
   feat_set_string(args,argv[i],argv[i+1]);
      else
   parse_usage(stderr,argv[0],
        "unknown arg type ",type,
        description);
      i++;
  }
     }
 }
 else
     files = cons_val(string_val(argv[i]),files);
    }
    delete_features(op_types);
    return val_reverse(files);
}

variable_types:
argv
char **

variable_types: argc int

variable_types:
description
char *

variable_types: struct cst_features_struct { struct cst_featvalpair_struct { char *name; struct cst_val_struct *val; struct cst_featvalpair_struct *next; } *head; void *ctx; } *

variable_types: struct cst_features_struct { struct cst_featvalpair_struct { char *name; struct cst_val_struct { union { struct cst_val_cons_struct { struct cst_val_struct *car; struct cst_val_struct *cdr; } cc; struct cst_val_atom_struct { short type; short ref_count; union { float fval; int ival; void *vval; } v; } a; } c; } *val; struct cst_featvalpair_struct *next; } *head; void *ctx; } *

variable_types: i int

variable_types:
type
char *


decompiled_code:
int __fastcall lex_match_entry(__int64 a1, __int64 a2)
{
return strcmp((const char *)(a1 + 1), (const char *)(a2 + 1));
}

canonical_decompiled_code:
int __fastcall func1(__int64 a1, __int64 a2)
{
return strcmp((const char *)(a1 + 1), (const char *)(a2 + 1));
}

original_code:
static int lex_match_entry(const char *a, const char *b)
{
    int c;
    c = strcmp(a+1,b+1);
    return c;
}

canonical_original_code:
static int lex_match_entry(char *a, char *b)
{
    int c;
    c = strcmp(a+1,b+1);
    return c;
}

variable_types:
a
char *

variable_types:
b
char *

variable_types: c int


decompiled_code:
__int64 __fastcall find_full_match(__int64 a1, int a2, const char *a3)
{
unsigned int v3; // er12
const char *v5; // r14
const char **v6; // rbx
const char *v7; // rbp
__int64 v8; // rbp
const char *v9; // rbx
__int64 v11; // [rsp+8h] [rbp-40h]

v3 = a2;
if ( *a3 != 48 )
{
if ( a2 < 0 )
{
v3 = a2 + 1;
v11 = a2;
}
else
{
v5 = a3 + 1;
v11 = a2;
v6 = (const char **)(a1 + 16LL * a2);
do
{
v7 = *v6;
if ( strcmp(v5, *v6 + 1) )
{
++v3;
goto LABEL_9;
}
if ( !strcmp(a3, v7) || *v7 == 48 )
return v3;
--v3;
v6 -= 2;
}
while ( v3 != -1 );
v3 = 0;
}
LABEL_9:
v8 = v11;
v9 = *(const char **)(a1 + 16 * v11);
if ( v9 )
{
while ( !strcmp(a3 + 1, v9 + 1) )
{
if ( !strcmp(a3, v9) || *v9 == 48 )
return (unsigned int)v8;
++v8;
v9 = *(const char **)(a1 + 16 * v8);
if ( !v9 )
return v3;
}
}
}
return v3;
}

canonical_decompiled_code:
__int64 __fastcall func2(__int64 a1, int a2, const char *a3)
{
unsigned int v3; // er12
const char *v5; // r14
const char **v6; // rbx
const char *v7; // rbp
__int64 v8; // rbp
const char *v9; // rbx
__int64 v11; // [rsp+8h] [rbp-40h]

v3 = a2;
if ( *a3 != 48 )
{
if ( a2 < 0 )
{
v3 = a2 + 1;
v11 = a2;
}
else
{
v5 = a3 + 1;
v11 = a2;
v6 = (const char **)(a1 + 16LL * a2);
do
{
v7 = *v6;
if ( strcmp(v5, *v6 + 1) )
{
++v3;
goto LABEL_9;
}
if ( !strcmp(a3, v7) || *v7 == 48 )
return v3;
--v3;
v6 -= 2;
}
while ( v3 != -1 );
v3 = 0;
}
LABEL_9:
v8 = v11;
v9 = *(const char **)(a1 + 16 * v11);
if ( v9 )
{
while ( !strcmp(a3 + 1, v9 + 1) )
{
if ( !strcmp(a3, v9) || *v9 == 48 )
return (unsigned int)v8;
++v8;
v9 = *(const char **)(a1 + 16 * v8);
if ( !v9 )
return v3;
}
}
}
return v3;
}

original_code:
static int find_full_match(const lexicon_entry *entries, int i,const char *word)
{
    int w, match;
    if (word[0] == '0')
 return i;
    for (w=i; w >=0; w--)
    {
 if (!(strcmp(word+1,entries[w].word_pos+1) == 0))
     break;
 else if (((strcmp(word,entries[w].word_pos) == 0)) ||
   (entries[w].word_pos[0] == '0'))
     return w;
    }
    match = w+1;
    for (w=i; entries[w].word_pos; w++)
    {
 if (!(strcmp(word+1,entries[w].word_pos+1) == 0))
     break;
 else if (((strcmp(word,entries[w].word_pos) == 0)) ||
   (entries[w].word_pos[0] == '0'))
     return w;
    }
    return match;
}

canonical_original_code:
static int find_full_match(struct lexicon_entry_struct *entries, int i, char *word)
{
    int w; int match;
    if (word[0] == '0')
 return i;
    for (w=i; w >=0; w--)
    {
 if (!(strcmp(word+1,entries[w].word_pos+1) == 0))
     break;
 else if (((strcmp(word,entries[w].word_pos) == 0)) ||
   (entries[w].word_pos[0] == '0'))
     return w;
    }
    match = w+1;
    for (w=i; entries[w].word_pos; w++)
    {
 if (!(strcmp(word+1,entries[w].word_pos+1) == 0))
     break;
 else if (((strcmp(word,entries[w].word_pos) == 0)) ||
   (entries[w].word_pos[0] == '0'))
     return w;
    }
    return match;
}

variable_types: struct lexicon_entry_struct { char *word_pos; int phone_index; } *

variable_types:
word
char *

variable_types: w int

variable_types: match int


decompiled_code:
void *__fastcall val_int_n(int a1)
{
void *result; // rax

result = &val_int_19;
if ( a1 <= 19 )
result = *(&val_int_const + a1);
return result;
}

canonical_decompiled_code:
void *__fastcall func0(int a1)
{
void *result; // rax

result = &val_int_19;
if ( a1 <= 19 )
result = *(&val_int_const + a1);
return result;
}

original_code:
const cst_val *val_int_n(int n)
{
    if (n < val_int_const_max)
 return val_int_const[n];
    else
 return val_int_const[val_int_const_max-1];
}

canonical_original_code:
struct cst_val_struct *val_int_n(int n)
{
    if (n < val_int_const_max)
 return val_int_const[n];
    else
 return val_int_const[val_int_const_max-1];
}

variable_types: n int


decompiled_code:
void *__fastcall val_string_n(int a1)
{
void *result; // rax

result = &val_string_19;
if ( a1 <= 19 )
result = *(&val_string_const + a1);
return result;
}

canonical_decompiled_code:
void *__fastcall func1(int a1)
{
void *result; // rax

result = &val_string_19;
if ( a1 <= 19 )
result = *(&val_string_const + a1);
return result;
}

original_code:
const cst_val *val_string_n(int n)
{
    if (n < val_int_const_max)
 return val_string_const[n];
    else
 return val_string_const[val_int_const_max-1];
}

canonical_original_code:
struct cst_val_struct *val_string_n(int n)
{
    if (n < val_int_const_max)
 return val_string_const[n];
    else
 return val_string_const[val_int_const_max-1];
}


decompiled_code:
__int64 __fastcall en_exp_digits(char *a1)
{
char v1; // al
char *v2; // rbx
__int64 v3; // rbp
unsigned __int8 v4; // al
const char *v5; // rdi
__int64 v6; // rax

v1 = *a1;
if ( !*a1 )
return val_reverse(0LL);
v2 = a1;
v3 = 0LL;
do
{
v4 = v1 - 48;
v5 = "umpty";
if ( v4 <= 9u )
v5 = digit2num[(char)v4];
v6 = string_val(v5);
++v2;
v3 = cons_val(v6, v3);
v1 = *v2;
}
while ( *v2 );
return val_reverse(v3);
}

canonical_decompiled_code:
__int64 __fastcall func0(char *a1)
{
char v1; // al
char *v2; // rbx
__int64 v3; // rbp
unsigned __int8 v4; // al
const char *v5; // rdi
__int64 v6; // rax

v1 = *a1;
if ( !*a1 )
return val_reverse(0LL);
v2 = a1;
v3 = 0LL;
do
{
v4 = v1 - 48;
v5 = "umpty";
if ( v4 <= 9u )
v5 = digit2num[(char)v4];
v6 = string_val(v5);
++v2;
v3 = cons_val(v6, v3);
v1 = *v2;
}
while ( *v2 );
return val_reverse(v3);
}

original_code:
cst_val *en_exp_digits(const char *numstring)
{
    cst_val *d = 0;
    const char *p;
    for (p=numstring; *p; p++)
    {
 if ((*p >= '0') && (*p <= '9'))
     d = cons_val(string_val(digit2num[*p-'0']),d);
 else
     d = cons_val(string_val("umpty"),d);
    }
    return val_reverse(d);
}

canonical_original_code:
struct cst_val_struct *en_exp_digits(char *numstring)
{
    struct cst_val_struct *d = 0;
    char *p;
    for (p=numstring; *p; p++)
    {
 if ((*p >= '0') && (*p <= '9'))
     d = cons_val(string_val(digit2num[*p-'0']),d);
 else
     d = cons_val(string_val("umpty"),d);
    }
    return val_reverse(d);
}

variable_types:
numstring
char *

variable_types: struct cst_val_struct { union { struct cst_val_cons_struct { struct cst_val_struct *car; struct cst_val_struct *cdr; } cc; struct cst_val_atom_struct { short type; short ref_count; union { float fval; int ival; void *vval; } v; } a; } c; } *

variable_types:
p
char *


decompiled_code:
__int64 __fastcall en_exp_number(char *a1)
{
int v2; // eax
char v4; // dl
int v5; // eax
__int64 v6; // r12
__int64 v7; // rax
int v8; // ebx
char *v9; // rdi
__int64 v10; // rdx
char *v11; // rax
__int64 v12; // rax
char *v13; // rdi
__int64 v14; // r12
const char *v15; // rdi
__int64 v16; // rbp
__int64 v17; // rax
__int64 v18; // rax
__int64 v19; // r12
__int64 v20; // rax
__int64 v21; // r12
__int64 v22; // rax
int v23; // edx
unsigned int v24; // eax
unsigned int j; // ecx
__int64 v26; // rsi
char *v27; // rbp
char *v28; // rdi
__int64 v29; // rax
int v30; // edx
unsigned int v31; // eax
unsigned int i; // ecx
__int64 v33; // rsi
char *v34; // rbp
char s[28]; // [rsp+Ch] [rbp-1Ch] BYREF

while ( 1 )
{
v2 = strlen(a1);
switch ( v2 )
{
case 0:
return 0LL;
case 1:
return en_exp_digits(a1);
case 2:
v4 = *a1;
v5 = a1[1];
if ( *a1 == 48 )
{
if ( (_BYTE)v5 == 48 )
return 0LL;
v28 = digit2num[v5 - 48];
}
else if ( (_BYTE)v5 == 48 )
{
v28 = digit2enty[v4 - 48];
}
else
{
if ( v4 != 49 )
{
v6 = en_exp_digits(a1 + 1);
v7 = string_val(digit2enty[*a1 - 48]);
return cons_val(v7, v6);
}
v28 = digit2teen[v5 - 48];
}
v29 = string_val(v28);
return cons_val(v29, 0LL);
}
if ( v2 != 3 )
break;
if ( *a1 != 48 )
{
v19 = en_exp_number(a1 + 1);
v20 = string_val("hundred");
v21 = cons_val(v20, v19);
v22 = string_val(digit2num[*a1 - 48]);
return cons_val(v22, v21);
}
++a1;
}
if ( v2 > 6 )
{
if ( v2 <= 9 )
{
v30 = v2 - 6;
v31 = v2 - 6;
if ( v31 )
{
for ( i = 0; i < v31; ++i )
{
v33 = i;
s[v33] = a1[v33];
}
}
v34 = &a1[v30];
s[v30] = 0;
v13 = v34;
v14 = en_exp_number(s);
if ( v14 )
{
v15 = "million";
v16 = en_exp_number(v34);
goto LABEL_19;
}
}
else
{
if ( v2 > 12 )
return en_exp_digits(a1);
v23 = v2 - 9;
v24 = v2 - 9;
if ( v24 )
{
for ( j = 0; j < v24; ++j )
{
v26 = j;
s[v26] = a1[v26];
}
}
v27 = &a1[v23];
s[v23] = 0;
v13 = v27;
v14 = en_exp_number(s);
if ( v14 )
{
v15 = "billion";
v16 = en_exp_number(v27);
goto LABEL_19;
}
}
}
else
{
v8 = v2 - 3;
v9 = s;
v10 = 0LL;
if ( v2 - 3 > 0 )
{
v11 = (char *)memcpy(s, a1, (unsigned int)(v2 - 4) + 1LL);
v10 = v8;
v9 = v11;
a1 += v8;
}
s[v10] = 0;
v12 = en_exp_number(v9);
v13 = a1;
v14 = v12;
if ( v12 )
{
v15 = "thousand";
v16 = en_exp_number(a1);
LABEL_19:
v17 = string_val(v15);
v18 = cons_val(v17, v16);
return val_append(v14, v18);
}
}
return en_exp_number(v13);
}

original_code:
cst_val *en_exp_number(const char *numstring)
{
    int num_digits = strlen(numstring);
    char part[4];
    cst_val *p;
    int i;
    if (num_digits == 0)
 return ((void *)0);
    else if (num_digits == 1)
 return en_exp_digits(numstring);
    else if (num_digits == 2)
    {
 if (numstring[0] == '0')
 {
     if (numstring[1] == '0')
  return 0;
     else
  return cons_val(string_val(digit2num[numstring[1]-'0']),0);
 }
 else if (numstring[1] == '0')
     return cons_val(string_val(digit2enty[numstring[0]-'0']),0);
 else if (numstring[0] == '1')
     return cons_val(string_val(digit2teen[numstring[1]-'0']),0);
 else
     return cons_val(string_val(digit2enty[numstring[0]-'0']),
       en_exp_digits(numstring+1));
    }
    else if (num_digits == 3)
    {
 if (numstring[0] == '0')
     return en_exp_number(numstring+1);
 else
     return cons_val(string_val(digit2num[numstring[0]-'0']),
    cons_val(string_val("hundred"),
          en_exp_number(numstring+1)));
    }
    else if (num_digits < 7)
    {
 for (i=0; i < num_digits-3; i++)
     part[i] = numstring[i];
 part[i]='\0';
 p = en_exp_number(part);
 if (p == 0)
     return en_exp_number(numstring+i);
 else
     return val_append(p,cons_val(string_val("thousand"),
      en_exp_number(numstring+i)));
    }
    else if (num_digits < 10)
    {
 for (i=0; i < num_digits-6; i++)
     part[i] = numstring[i];
 part[i]='\0';
 p = en_exp_number(part);
 if (p == 0)
     return en_exp_number(numstring+i);
 else
     return val_append(p,cons_val(string_val("million"),
      en_exp_number(numstring+i)));
    }
    else if (num_digits < 13)
    {
 for (i=0; i < num_digits-9; i++)
     part[i] = numstring[i];
 part[i]='\0';
 p = en_exp_number(part);
 if (p == 0)
     return en_exp_number(numstring+i);
 else
     return val_append(p,cons_val(string_val("billion"),
      en_exp_number(numstring+i)));
    }
    else
    {
 return en_exp_digits(numstring);
    }
}

canonical_original_code:
struct cst_val_struct *en_exp_number(char *numstring)
{
    int num_digits = strlen(numstring);
    char part[4];
    struct cst_val_struct *p;
    int i;
    if (num_digits == 0)
 return ((void *)0);
    else if (num_digits == 1)
 return en_exp_digits(numstring);
    else if (num_digits == 2)
    {
 if (numstring[0] == '0')
 {
     if (numstring[1] == '0')
  return 0;
     else
  return cons_val(string_val(digit2num[numstring[1]-'0']),0);
 }
 else if (numstring[1] == '0')
     return cons_val(string_val(digit2enty[numstring[0]-'0']),0);
 else if (numstring[0] == '1')
     return cons_val(string_val(digit2teen[numstring[1]-'0']),0);
 else
     return cons_val(string_val(digit2enty[numstring[0]-'0']),
       en_exp_digits(numstring+1));
    }
    else if (num_digits == 3)
    {
 if (numstring[0] == '0')
     return en_exp_number(numstring+1);
 else
     return cons_val(string_val(digit2num[numstring[0]-'0']),
    cons_val(string_val("hundred"),
          en_exp_number(numstring+1)));
    }
    else if (num_digits < 7)
    {
 for (i=0; i < num_digits-3; i++)
     part[i] = numstring[i];
 part[i]='\0';
 p = en_exp_number(part);
 if (p == 0)
     return en_exp_number(numstring+i);
 else
     return val_append(p,cons_val(string_val("thousand"),
      en_exp_number(numstring+i)));
    }
    else if (num_digits < 10)
    {
 for (i=0; i < num_digits-6; i++)
     part[i] = numstring[i];
 part[i]='\0';
 p = en_exp_number(part);
 if (p == 0)
     return en_exp_number(numstring+i);
 else
     return val_append(p,cons_val(string_val("million"),
      en_exp_number(numstring+i)));
    }
    else if (num_digits < 13)
    {
 for (i=0; i < num_digits-9; i++)
     part[i] = numstring[i];
 part[i]='\0';
 p = en_exp_number(part);
 if (p == 0)
     return en_exp_number(numstring+i);
 else
     return val_append(p,cons_val(string_val("billion"),
      en_exp_number(numstring+i)));
    }
    else
    {
 return en_exp_digits(numstring);
    }
}

variable_types:
part
char [4]


decompiled_code:
__int64 __fastcall en_exp_ordinal(char *s)
{
int v1; // er13
size_t v2; // rbx
char *v3; // rbp
size_t v4; // rax
__int64 v5; // rsi
char v6; // dl
char *v7; // rcx
__int64 v8; // rbx
const char *v9; // r12
__int64 v10; // rax
__int64 v11; // r13
__int64 v12; // rax
const char *v13; // rsi
const char *v14; // rbp
__int64 v16; // rax
__int64 v17; // r12
__int64 k; // rbp
__int64 v19; // rax
__int64 v20; // rbx
const char *i; // rsi
__int64 v22; // rbx
const char *j; // rsi

v1 = 0;
v2 = 0LL;
v3 = (char *)cst_strdup();
v4 = strlen(s);
v5 = 0LL;
while ( 1 )
{
v7 = &v3[v5];
if ( v2 >= v4 )
break;
v6 = s[v2];
if ( v6 != 44 )
{
*v7 = v6;
++v1;
v4 = strlen(s);
v5 = v1;
}
++v2;
}
*v7 = 0;
v8 = 0LL;
v9 = 0LL;
v10 = en_exp_number(v3);
v11 = val_reverse(v10);
cst_free(v3);
v12 = val_car(v11);
v13 = "zero";
v14 = (const char *)val_string(v12);
while ( 1 )
{
if ( !strcmp(v14, v13) )
v9 = ord2num[v8];
if ( ++v8 == 10 )
break;
v13 = digit2num[v8];
}
if ( !v9 )
{
v20 = 0LL;
for ( i = "ten"; ; i = digit2teen[v20] )
{
if ( !strcmp(v14, i) )
v9 = ord2teen[v20];
if ( ++v20 == 10 )
break;
}
if ( !v9 )
{
v22 = 0LL;
for ( j = "zero"; ; j = digit2enty[v22] )
{
if ( !strcmp(v14, j) )
v9 = ord2enty[v22];
if ( ++v22 == 10 )
break;
}
}
}
if ( !strcmp(v14, "hundred") )
v9 = "hundredth";
if ( !strcmp(v14, "thousand") )
{
v9 = "billtionth";
if ( strcmp(v14, "billion") )
v9 = "thousandth";
}
else if ( !strcmp(v14, "billion") )
{
v9 = "billtionth";
}
else if ( !v9 )
{
return v11;
}
v16 = string_val(v9);
v17 = cons_val(v16, 0LL);
for ( k = val_cdr(v11); k; k = val_cdr(k) )
{
v19 = val_car(k);
v17 = cons_val(v19, v17);
}
delete_val(v11);
return v17;
}

canonical_decompiled_code:
__int64 __fastcall func2(char *s)
{
int v1; // er13
size_t v2; // rbx
char *v3; // rbp
size_t v4; // rax
__int64 v5; // rsi
char v6; // dl
char *v7; // rcx
__int64 v8; // rbx
const char *v9; // r12
__int64 v10; // rax
__int64 v11; // r13
__int64 v12; // rax
const char *v13; // rsi
const char *v14; // rbp
__int64 v16; // rax
__int64 v17; // r12
__int64 k; // rbp
__int64 v19; // rax
__int64 v20; // rbx
const char *i; // rsi
__int64 v22; // rbx
const char *j; // rsi

v1 = 0;
v2 = 0LL;
v3 = (char *)cst_strdup();
v4 = strlen(s);
v5 = 0LL;
while ( 1 )
{
v7 = &v3[v5];
if ( v2 >= v4 )
break;
v6 = s[v2];
if ( v6 != 44 )
{
*v7 = v6;
++v1;
v4 = strlen(s);
v5 = v1;
}
++v2;
}
*v7 = 0;
v8 = 0LL;
v9 = 0LL;
v10 = func1(v3);
v11 = val_reverse(v10);
cst_free(v3);
v12 = val_car(v11);
v13 = "zero";
v14 = (const char *)val_string(v12);
while ( 1 )
{
if ( !strcmp(v14, v13) )
v9 = ord2num[v8];
if ( ++v8 == 10 )
break;
v13 = digit2num[v8];
}
if ( !v9 )
{
v20 = 0LL;
for ( i = "ten"; ; i = digit2teen[v20] )
{
if ( !strcmp(v14, i) )
v9 = ord2teen[v20];
if ( ++v20 == 10 )
break;
}
if ( !v9 )
{
v22 = 0LL;
for ( j = "zero"; ; j = digit2enty[v22] )
{
if ( !strcmp(v14, j) )
v9 = ord2enty[v22];
if ( ++v22 == 10 )
break;
}
}
}
if ( !strcmp(v14, "hundred") )
v9 = "hundredth";
if ( !strcmp(v14, "thousand") )
{
v9 = "billtionth";
if ( strcmp(v14, "billion") )
v9 = "thousandth";
}
else if ( !strcmp(v14, "billion") )
{
v9 = "billtionth";
}
else if ( !v9 )
{
return v11;
}
v16 = string_val(v9);
v17 = cons_val(v16, 0LL);
for ( k = val_cdr(v11); k; k = val_cdr(k) )
{
v19 = val_car(k);
v17 = cons_val(v19, v17);
}
delete_val(v11);
return v17;
}

original_code:
cst_val *en_exp_ordinal(const char *rawnumstring)
{
    cst_val *card, *o;
    const cst_val *t;
    const char *l;
    const char *ord;
    char *numstring;
    int i,j;
    numstring = cst_strdup(rawnumstring);
    for (j=i=0; i < strlen(rawnumstring); i++)
 if (rawnumstring[i] != ',')
 {
     numstring[j] = rawnumstring[i];
     j++;
 }
    numstring[j] = '\0';
    card = val_reverse(en_exp_number(numstring));
    cst_free(numstring);
    l = val_string(val_car(card));
    ord = 0;
    for (i=0; i<10; i++)
 if ((strcmp(l,digit2num[i]) == 0))
     ord = ord2num[i];
    if (!ord)
 for (i=0; i<10; i++)
     if ((strcmp(l,digit2teen[i]) == 0))
  ord = ord2teen[i];
    if (!ord)
 for (i=0; i<10; i++)
     if ((strcmp(l,digit2enty[i]) == 0))
  ord = ord2enty[i];
    if ((strcmp(l,"hundred") == 0))
 ord = "hundredth";
    if ((strcmp(l,"thousand") == 0))
 ord = "thousandth";
    if ((strcmp(l,"billion") == 0))
 ord = "billtionth";
    if (!ord)
 return card;
    o = cons_val(string_val(ord),0);
    for (t=val_cdr(card); t; t=val_cdr(t))
 o = cons_val(val_car(t),o);
    delete_val(card);
    return o;
}

canonical_original_code:
struct cst_val_struct *en_exp_ordinal(char *rawnumstring)
{
    struct cst_val_struct *card; struct cst_val_struct *o;
    struct cst_val_struct *t;
    char *l;
    char *ord;
    char *numstring;
    int i; int j;
    numstring = cst_strdup(rawnumstring);
    for (j=i=0; i < strlen(rawnumstring); i++)
 if (rawnumstring[i] != ',')
 {
     numstring[j] = rawnumstring[i];
     j++;
 }
    numstring[j] = '\0';
    card = val_reverse(en_exp_number(numstring));
    cst_free(numstring);
    l = val_string(val_car(card));
    ord = 0;
    for (i=0; i<10; i++)
 if ((strcmp(l,digit2num[i]) == 0))
     ord = ord2num[i];
    if (!ord)
 for (i=0; i<10; i++)
     if ((strcmp(l,digit2teen[i]) == 0))
  ord = ord2teen[i];
    if (!ord)
 for (i=0; i<10; i++)
     if ((strcmp(l,digit2enty[i]) == 0))
  ord = ord2enty[i];
    if ((strcmp(l,"hundred") == 0))
 ord = "hundredth";
    if ((strcmp(l,"thousand") == 0))
 ord = "thousandth";
    if ((strcmp(l,"billion") == 0))
 ord = "billtionth";
    if (!ord)
 return card;
    o = cons_val(string_val(ord),0);
    for (t=val_cdr(card); t; t=val_cdr(t))
 o = cons_val(val_car(t),o);
    delete_val(card);
    return o;
}

variable_types:
rawnumstring
char *

variable_types:
l
char *

variable_types:
ord
char *

variable_types: j int


decompiled_code:
__int64 __fastcall en_exp_id(char *a1)
{
size_t v1; // rax
__int64 v2; // r12
__int64 v3; // rax
char v5; // al
char v6; // dl
__int64 v7; // rax
__int64 v8; // rbp
__int64 v9; // rax
__int16 v10; // ax
__int64 v11; // rax
__int64 v12; // rbp
__int64 v13; // rax
__int16 v14; // [rsp+Dh] [rbp-1Bh] BYREF
char v15; // [rsp+Fh] [rbp-19h]

v1 = strlen(a1);
if ( v1 == 4 )
{
v5 = a1[1];
if ( a1[2] == 48 && a1[3] == 48 )
{
if ( v5 != 48 )
{
v10 = *(_WORD *)a1;
v15 = 0;
v14 = v10;
v11 = string_val("hundred");
v7 = cons_val(v11, 0LL);
goto LABEL_11;
}
}
else if ( v5 != 48 )
{
LABEL_10:
v6 = *a1;
HIBYTE(v14) = v5;
v15 = 0;
LOBYTE(v14) = v6;
v7 = en_exp_id(a1 + 2);
LABEL_11:
v8 = v7;
v9 = en_exp_number((char *)&v14);
return val_append(v9, v8);
}
return en_exp_number(a1);
}
if ( v1 != 2 )
{
if ( v1 > 2 )
{
if ( (v1 & 1) != 0 )
{
v2 = en_exp_id(a1 + 1);
v3 = string_val(digit2num[*a1 - 48]);
return cons_val(v3, v2);
}
v5 = a1[1];
goto LABEL_10;
}
return en_exp_number(a1);
}
if ( *a1 != 48 )
return en_exp_number(a1);
v12 = en_exp_digits(a1 + 1);
v13 = string_val("oh");
return cons_val(v13, v12);
}

original_code:
cst_val *en_exp_id(const char *numstring)
{
    char aaa[3];
    if ((strlen(numstring) == 4) &&
 (numstring[2] == '0') &&
 (numstring[3] == '0'))
    {
 if (numstring[1] == '0')
     return en_exp_number(numstring);
 else
 {
     aaa[0] = numstring[0];
     aaa[1] = numstring[1];
     aaa[2] = '\0';
     return val_append(en_exp_number(aaa),
         cons_val(string_val("hundred"),0));
 }
    }
    else if ((strlen(numstring) == 2) && (numstring[0] == '0'))
 return cons_val(string_val("oh"),
   en_exp_digits(&numstring[1]));
    else if (((strlen(numstring) == 4) &&
  ((numstring[1] == '0'))) ||
 (strlen(numstring) < 3))
 return en_exp_number(numstring);
    else if (strlen(numstring)%2 == 1)
    {
 return cons_val(string_val(digit2num[numstring[0]-'0']),
   en_exp_id(&numstring[1]));
    }
    else
    {
 aaa[0] = numstring[0];
 aaa[1] = numstring[1];
 aaa[2] = '\0';
 return val_append(en_exp_number(aaa),en_exp_id(&numstring[2]));
    }
}

canonical_original_code:
struct cst_val_struct *en_exp_id(char *numstring)
{
    char aaa[3];
    if ((strlen(numstring) == 4) &&
 (numstring[2] == '0') &&
 (numstring[3] == '0'))
    {
 if (numstring[1] == '0')
     return en_exp_number(numstring);
 else
 {
     aaa[0] = numstring[0];
     aaa[1] = numstring[1];
     aaa[2] = '\0';
     return val_append(en_exp_number(aaa),
         cons_val(string_val("hundred"),0));
 }
    }
    else if ((strlen(numstring) == 2) && (numstring[0] == '0'))
 return cons_val(string_val("oh"),
   en_exp_digits(&numstring[1]));
    else if (((strlen(numstring) == 4) &&
  ((numstring[1] == '0'))) ||
 (strlen(numstring) < 3))
 return en_exp_number(numstring);
    else if (strlen(numstring)%2 == 1)
    {
 return cons_val(string_val(digit2num[numstring[0]-'0']),
   en_exp_id(&numstring[1]));
    }
    else
    {
 aaa[0] = numstring[0];
 aaa[1] = numstring[1];
 aaa[2] = '\0';
 return val_append(en_exp_number(aaa),en_exp_id(&numstring[2]));
    }
}

variable_types:
aaa
char [3]


decompiled_code:
__int64 __fastcall en_exp_real(char *a1)
{
char *v1; // rbx
char *v2; // r12
size_t v3; // rbp
__int64 v4; // rbp
__int64 v5; // rax
__int64 v6; // rbp
__int64 v7; // rax
__int64 v8; // r13
char *v10; // rbx
size_t v11; // rbp
__int64 v12; // rbp
__int64 v13; // rax
__int64 v14; // rax
const char *v15; // rdi
__int64 v16; // rbp
__int64 v17; // rax
__int64 v18; // rax

if ( !a1 )
goto LABEL_4;
if ( *a1 == 45 )
{
v18 = en_exp_real(a1 + 1);
v15 = "minus";
v16 = v18;
goto LABEL_11;
}
if ( *a1 == 43 )
{
v14 = en_exp_real(a1 + 1);
v15 = "plus";
v16 = v14;
LABEL_11:
v17 = string_val(v15);
return cons_val(v17, v16);
}
LABEL_4:
v1 = strchr(a1, 101);
if ( v1 || (v1 = strchr(a1, 69)) != 0LL )
{
v2 = (char *)cst_strdup(a1);
v3 = strlen(a1);
v2[v3 - strlen(v1)] = 0;
v4 = en_exp_real(v1 + 1);
v5 = string_val("e");
v6 = cons_val(v5, v4);
v7 = en_exp_real(v2);
LABEL_6:
v8 = val_append(v7, v6);
cst_free(v2);
return v8;
}
v10 = strchr(a1, 46);
if ( v10 )
{
v2 = (char *)cst_strdup(a1);
v11 = strlen(a1);
v2[v11 - strlen(v10)] = 0;
v12 = en_exp_digits(v10 + 1);
v13 = string_val("point");
v6 = cons_val(v13, v12);
v7 = en_exp_number(v2);
goto LABEL_6;
}
return en_exp_number(a1);
}

canonical_decompiled_code:
__int64 __fastcall func4(char *a1)
{
char *v1; // rbx
char *v2; // r12
size_t v3; // rbp
__int64 v4; // rbp
__int64 v5; // rax
__int64 v6; // rbp
__int64 v7; // rax
__int64 v8; // r13
char *v10; // rbx
size_t v11; // rbp
__int64 v12; // rbp
__int64 v13; // rax
__int64 v14; // rax
const char *v15; // rdi
__int64 v16; // rbp
__int64 v17; // rax
__int64 v18; // rax

if ( !a1 )
goto LABEL_4;
if ( *a1 == 45 )
{
v18 = func4(a1 + 1);
v15 = "minus";
v16 = v18;
goto LABEL_11;
}
if ( *a1 == 43 )
{
v14 = func4(a1 + 1);
v15 = "plus";
v16 = v14;
LABEL_11:
v17 = string_val(v15);
return cons_val(v17, v16);
}
LABEL_4:
v1 = strchr(a1, 101);
if ( v1 || (v1 = strchr(a1, 69)) != 0LL )
{
v2 = (char *)cst_strdup(a1);
v3 = strlen(a1);
v2[v3 - strlen(v1)] = 0;
v4 = func4(v1 + 1);
v5 = string_val("e");
v6 = cons_val(v5, v4);
v7 = func4(v2);
LABEL_6:
v8 = val_append(v7, v6);
cst_free(v2);
return v8;
}
v10 = strchr(a1, 46);
if ( v10 )
{
v2 = (char *)cst_strdup(a1);
v11 = strlen(a1);
v2[v11 - strlen(v10)] = 0;
v12 = func0(v10 + 1);
v13 = string_val("point");
v6 = cons_val(v13, v12);
v7 = func1(v2);
goto LABEL_6;
}
return func1(a1);
}

original_code:
cst_val *en_exp_real(const char *numstring)
{
    char *aaa, *p;
    cst_val *r;
    if (numstring && (numstring[0] == '-'))
 r = cons_val(string_val("minus"),
       en_exp_real(&numstring[1]));
    else if (numstring && (numstring[0] == '+'))
 r = cons_val(string_val("plus"),
       en_exp_real(&numstring[1]));
    else if (((p=strchr(numstring,'e')) != 0) ||
      ((p=strchr(numstring,'E')) != 0))
    {
 aaa = cst_strdup(numstring);
 aaa[strlen(numstring)-strlen(p)] = '\0';
 r = val_append(en_exp_real(aaa),
         cons_val(string_val("e"),
    en_exp_real(p+1)));
 cst_free(aaa);
    }
    else if ((p=strchr(numstring,'.')) != 0)
    {
 aaa = cst_strdup(numstring);
 aaa[strlen(numstring)-strlen(p)] = '\0';
 r = val_append(en_exp_number(aaa),
         cons_val(string_val("point"),
    en_exp_digits(p+1)));
 cst_free(aaa);
    }
    else
 r = en_exp_number(numstring);
    return r;
}

canonical_original_code:
struct cst_val_struct *en_exp_real(char *numstring)
{
    char *aaa; char *p;
    struct cst_val_struct *r;
    if (numstring && (numstring[0] == '-'))
 r = cons_val(string_val("minus"),
       en_exp_real(&numstring[1]));
    else if (numstring && (numstring[0] == '+'))
 r = cons_val(string_val("plus"),
       en_exp_real(&numstring[1]));
    else if (((p=strchr(numstring,'e')) != 0) ||
      ((p=strchr(numstring,'E')) != 0))
    {
 aaa = cst_strdup(numstring);
 aaa[strlen(numstring)-strlen(p)] = '\0';
 r = val_append(en_exp_real(aaa),
         cons_val(string_val("e"),
    en_exp_real(p+1)));
 cst_free(aaa);
    }
    else if ((p=strchr(numstring,'.')) != 0)
    {
 aaa = cst_strdup(numstring);
 aaa[strlen(numstring)-strlen(p)] = '\0';
 r = val_append(en_exp_number(aaa),
         cons_val(string_val("point"),
    en_exp_digits(p+1)));
 cst_free(aaa);
    }
    else
 r = en_exp_number(numstring);
    return r;
}

variable_types:
aaa
char *


original_code:
cst_val *en_exp_letters(const char *lets)
{
    char *aaa;
    cst_val *r;
    int i;
    aaa = ((char *)cst_safe_alloc(sizeof(char)*(2)));
    aaa[1] = '\0';
    for (r=0,i=0; lets[i] != '\0'; i++)
    {
 aaa[0] = lets[i];
 if (((*__ctype_b_loc ())[(int) (((int)aaa[0]))] & (unsigned short int) _ISupper))
     aaa[0] = tolower((int)aaa[0]);
 if (strchr("0123456789",aaa[0]))
     r = cons_val(string_val(digit2num[aaa[0]-'0']),r);
 else if ((strcmp(aaa,"a") == 0))
     r = cons_val(string_val("_a"),r);
 else
     r = cons_val(string_val(aaa),r);
    }
    cst_free(aaa);
    return val_reverse(r);
}

canonical_original_code:
struct cst_val_struct *en_exp_letters(char *lets)
{
    char *aaa;
    struct cst_val_struct *r;
    int i;
    aaa = ((char *)cst_safe_alloc(sizeof(char)*(2)));
    aaa[1] = '\0';
    for (r=0,i=0; lets[i] != '\0'; i++)
    {
 aaa[0] = lets[i];
 if (((*__ctype_b_loc ())[(int) (((int)aaa[0]))] & (unsigned short) _ISupper))
     aaa[0] = tolower((int)aaa[0]);
 if (strchr("0123456789",aaa[0]))
     r = cons_val(string_val(digit2num[aaa[0]-'0']),r);
 else if ((strcmp(aaa,"a") == 0))
     r = cons_val(string_val("_a"),r);
 else
     r = cons_val(string_val(aaa),r);
    }
    cst_free(aaa);
    return val_reverse(r);
}

variable_types:
lets
char *

variable_types: i int


original_code:
int en_exp_roman(const char *roman)
{
    int val;
    const char *p;
    val = 0;
    for (p=roman; *p != 0; p++)
    {
 if (*p == 'X')
     val += 10;
 else if (*p == 'V')
     val += 5;
 else if (*p == 'I')
 {
     if (p[1] == 'V')
     {
  val += 4;
  p++;
     }
     else if (p[1] == 'X')
     {
  val += 9;
  p++;
     }
     else
  val += 1;
 }
    }
    return val;
}

canonical_original_code:
int en_exp_roman(char *roman)
{
    int val;
    char *p;
    val = 0;
    for (p=roman; *p != 0; p++)
    {
 if (*p == 'X')
     val += 10;
 else if (*p == 'V')
     val += 5;
 else if (*p == 'I')
 {
     if (p[1] == 'V')
     {
  val += 4;
  p++;
     }
     else if (p[1] == 'X')
     {
  val += 9;
  p++;
     }
     else
  val += 1;
 }
    }
    return val;
}

variable_types:
roman
char *

variable_types: val int


decompiled_code:
__int64 __fastcall usenglish_init(_QWORD *a1)
{
__int64 v1; // rax
__int64 v2; // rax
__int64 v3; // rax
__int64 v4; // rax
__int64 v5; // rax
__int64 v6; // rax
__int64 v7; // rax
__int64 v8; // rax
__int64 v9; // rax

us_text_init();
v1 = phoneset_val(us_phoneset);
feat_set(*a1, "phoneset", v1);
feat_set_string(*a1, "silence", us_phoneset[4]);
feat_set_string(*a1, "text_whitespace", us_english_whitespace);
feat_set_string(*a1, "text_postpunctuation", us_english_punctuation);
feat_set_string(*a1, "text_prepunctuation", us_english_prepunctuation);
feat_set_string(*a1, "text_singlecharsymbols", us_english_singlecharsymbols);
v2 = itemfunc_val(&us_tokentowords);
feat_set(*a1, "tokentowords_func", v2);
v3 = cart_val(&us_phrasing_cart);
feat_set(*a1, "phrasing_cart", v3);
v4 = cart_val(&us_int_accent_cart);
feat_set(*a1, "int_cart_accents", v4);
v5 = cart_val(&us_int_tone_cart);
feat_set(*a1, "int_cart_tones", v5);
v6 = cart_val(&us_durz_cart);
feat_set(*a1, "dur_cart", v6);
v7 = dur_stats_val(&us_dur_stats);
feat_set(*a1, "dur_stats", v7);
v8 = uttfunc_val(&us_f0_model);
feat_set(*a1, "f0_model_func", v8);
v9 = uttfunc_val(&us_postlex);
feat_set(*a1, "postlex_func", v9);
return us_ff_register(a1[1]);
}

canonical_decompiled_code:
__int64 __fastcall func0(_QWORD *a1)
{
__int64 v1; // rax
__int64 v2; // rax
__int64 v3; // rax
__int64 v4; // rax
__int64 v5; // rax
__int64 v6; // rax
__int64 v7; // rax
__int64 v8; // rax
__int64 v9; // rax

us_text_init();
v1 = phoneset_val(us_phoneset);
feat_set(*a1, "phoneset", v1);
feat_set_string(*a1, "silence", us_phoneset[4]);
feat_set_string(*a1, "text_whitespace", us_english_whitespace);
feat_set_string(*a1, "text_postpunctuation", us_english_punctuation);
feat_set_string(*a1, "text_prepunctuation", us_english_prepunctuation);
feat_set_string(*a1, "text_singlecharsymbols", us_english_singlecharsymbols);
v2 = itemfunc_val(&us_tokentowords);
feat_set(*a1, "tokentowords_func", v2);
v3 = cart_val(&us_phrasing_cart);
feat_set(*a1, "phrasing_cart", v3);
v4 = cart_val(&us_int_accent_cart);
feat_set(*a1, "int_cart_accents", v4);
v5 = cart_val(&us_int_tone_cart);
feat_set(*a1, "int_cart_tones", v5);
v6 = cart_val(&us_durz_cart);
feat_set(*a1, "dur_cart", v6);
v7 = dur_stats_val(&us_dur_stats);
feat_set(*a1, "dur_stats", v7);
v8 = uttfunc_val(&us_f0_model);
feat_set(*a1, "f0_model_func", v8);
v9 = uttfunc_val(&us_postlex);
feat_set(*a1, "postlex_func", v9);
return us_ff_register(a1[1]);
}

original_code:
void usenglish_init(cst_voice *v)
{
    us_text_init();
    feat_set(v->features,"phoneset",phoneset_val(&us_phoneset));
    feat_set_string(v->features,"silence",us_phoneset.silence);
    feat_set_string(v->features,"text_whitespace",us_english_whitespace);
    feat_set_string(v->features,"text_postpunctuation",us_english_punctuation);
    feat_set_string(v->features,"text_prepunctuation",
      us_english_prepunctuation);
    feat_set_string(v->features,"text_singlecharsymbols",
      us_english_singlecharsymbols);
    feat_set(v->features,"tokentowords_func",itemfunc_val(&us_tokentowords));
    feat_set(v->features,"phrasing_cart",cart_val(&us_phrasing_cart));
    feat_set(v->features,"int_cart_accents",cart_val(&us_int_accent_cart));
    feat_set(v->features,"int_cart_tones",cart_val(&us_int_tone_cart));
    feat_set(v->features,"dur_cart",cart_val(&us_durz_cart));
    feat_set(v->features,"dur_stats",dur_stats_val((dur_stats *)us_dur_stats));
    feat_set(v->features,"f0_model_func",uttfunc_val(&us_f0_model));
    feat_set(v->features,"postlex_func",uttfunc_val(&us_postlex));
    us_ff_register(v->ffunctions);
}

canonical_original_code:
void usenglish_init(struct cst_voice_struct *v)
{
    us_text_init();
    feat_set(v->features,"phoneset",phoneset_val(&us_phoneset));
    feat_set_string(v->features,"silence",us_phoneset.silence);
    feat_set_string(v->features,"text_whitespace",us_english_whitespace);
    feat_set_string(v->features,"text_postpunctuation",us_english_punctuation);
    feat_set_string(v->features,"text_prepunctuation",
      us_english_prepunctuation);
    feat_set_string(v->features,"text_singlecharsymbols",
      us_english_singlecharsymbols);
    feat_set(v->features,"tokentowords_func",itemfunc_val(&us_tokentowords));
    feat_set(v->features,"phrasing_cart",cart_val(&us_phrasing_cart));
    feat_set(v->features,"int_cart_accents",cart_val(&us_int_accent_cart));
    feat_set(v->features,"int_cart_tones",cart_val(&us_int_tone_cart));
    feat_set(v->features,"dur_cart",cart_val(&us_durz_cart));
    feat_set(v->features,"dur_stats",dur_stats_val((struct cst_dur_stats_struct **)us_dur_stats));
    feat_set(v->features,"f0_model_func",uttfunc_val(&us_f0_model));
    feat_set(v->features,"postlex_func",uttfunc_val(&us_postlex));
    us_ff_register(v->ffunctions);
}

variable_types: struct cst_voice_struct { struct cst_features_struct { struct cst_featvalpair_struct { char *name; struct cst_val_struct { union { struct cst_val_cons_struct { struct cst_val_struct *car; struct cst_val_struct *cdr; } cc; struct cst_val_atom_struct { short type; short ref_count; union { float fval; int ival; void *vval; } v; } a; } c; } *val; struct cst_featvalpair_struct *next; } *head; void *ctx; } *features; struct cst_features_struct *ffunctions; struct cst_utterance_struct { struct cst_features_struct *features; struct cst_features_struct *ffunctions; struct cst_features_struct *relations; void *ctx; } *(*utt_init)(struct cst_utterance_struct *u, struct cst_voice_struct *v); } *

user_defined_types: struct cst_dur_stats_struct { char *phone; float mean; float stddev; }


decompiled_code:
__int64 cst_errmsg(__int64 a1, ...)
{
gcc_va_list va; // [rsp+8h] [rbp-D0h] BYREF

va_start(va, a1);
HRError(7999LL, a1, va);
return 0LL;
}

canonical_decompiled_code:
__int64 func0(__int64 a1, ...)
{
gcc_va_list va; // [rsp+8h] [rbp-D0h] BYREF

va_start(va, a1);
HRError(7999LL, a1, va);
return 0LL;
}

original_code:
int cst_errmsg(char *fmt, ...)
{
 va_list args;
 __builtin_va_start(args,fmt);
 HRError(7999, fmt, args);
 __builtin_va_end(args);
 return 0;
}

canonical_original_code:
int cst_errmsg(char *fmt, ...)
{
 __builtin_va_list args;
 __builtin_va_start(args,fmt);
 HRError(7999, fmt, args);
 __builtin_va_end(args);
 return 0;
}

variable_types:
fmt
char *


decompiled_code:
_BOOL8 __fastcall post_break(__int64 a1)
{
__int64 v1; // r8
_BOOL8 result; // rax

v1 = item_prev();
result = 1LL;
if ( v1 )
result = strcmp("pau", (const char *)ffeature_string(a1, "R:SylStructure.daughter.R:Segment.p.name")) == 0;
return result;
}

canonical_decompiled_code:
_BOOL8 __fastcall func0(__int64 a1)
{
__int64 v1; // r8
_BOOL8 result; // rax

v1 = item_prev();
result = 1LL;
if ( v1 )
result = strcmp("pau", (const char *)ffeature_string(a1, "R:SylStructure.daughter.R:Segment.p.name")) == 0;
return result;
}

original_code:
static int post_break(cst_item *syl)
{
    if ((item_prev(syl) == 0) ||
 ((strcmp("pau",ffeature_string(syl, "R:SylStructure.daughter.R:Segment.p.name")) == 0)))
 return TRUE;
    else
 return FALSE;
}

canonical_original_code:
static int post_break(struct cst_item_struct *syl)
{
    if ((item_prev(syl) == 0) ||
 ((strcmp("pau",ffeature_string(syl, "R:SylStructure.daughter.R:Segment.p.name")) == 0)))
 return TRUE;
    else
 return FALSE;
}

variable_types: struct cst_item_struct { struct cst_item_contents_struct { struct cst_features_struct { struct cst_featvalpair_struct { char *name; struct cst_val_struct { union { struct cst_val_cons_struct { struct cst_val_struct *car; struct cst_val_struct *cdr; } cc; struct cst_val_atom_struct { short type; short ref_count; union { float fval; int ival; void *vval; } v; } a; } c; } *val; struct cst_featvalpair_struct *next; } *head; void *ctx; } *features; struct cst_features_struct *relations; } *contents; struct cst_relation_struct { char *name; struct cst_features_struct *features; struct cst_utterance_struct { struct cst_features_struct *features; struct cst_features_struct *ffunctions; struct cst_features_struct *relations; void *ctx; } *utterance; struct cst_item_struct *head; struct cst_item_struct *tail; } *relation; struct cst_item_struct *n; struct cst_item_struct *p; struct cst_item_struct *u; struct cst_item_struct *d; } *


decompiled_code:
_BOOL8 __fastcall pre_break(__int64 a1)
{
__int64 v1; // r8
_BOOL8 result; // rax

v1 = item_next();
result = 1LL;
if ( v1 )
result = strcmp("pau", (const char *)ffeature_string(a1, "R:SylStructure.daughtern.R:Segment.n.name")) == 0;
return result;
}

canonical_decompiled_code:
_BOOL8 __fastcall func1(__int64 a1)
{
__int64 v1; // r8
_BOOL8 result; // rax

v1 = item_next();
result = 1LL;
if ( v1 )
result = strcmp("pau", (const char *)ffeature_string(a1, "R:SylStructure.daughtern.R:Segment.n.name")) == 0;
return result;
}

original_code:
static int pre_break(cst_item *syl)
{
    if ((item_next(syl) == 0) ||
 ((strcmp("pau",ffeature_string(syl, "R:SylStructure.daughtern.R:Segment.n.name")) == 0)))
 return TRUE;
    else
 return FALSE;
}

canonical_original_code:
static int pre_break(struct cst_item_struct *syl)
{
    if ((item_next(syl) == 0) ||
 ((strcmp("pau",ffeature_string(syl, "R:SylStructure.daughtern.R:Segment.n.name")) == 0)))
 return TRUE;
    else
 return FALSE;
}


decompiled_code:
double __fastcall vowel_mid(__int64 a1)
{
__int64 v1; // rbx
__int64 v2; // rax
__int64 v3; // rax
__int64 v4; // r13
__int64 v5; // rbp
__int64 v6; // rax
_BYTE *v7; // rax
double result; // xmm0_8
float v9; // [rsp+Ch] [rbp-2Ch]
float v10; // [rsp+Ch] [rbp-2Ch]

v1 = item_phoneset();
v2 = item_as(a1, "SylStructure");
v3 = item_daughter(v2);
if ( !v3 )
return 0.0;
v4 = v3;
v5 = v3;
do
{
v6 = item_feat_string(v5, "name");
v7 = (_BYTE *)phone_feature_string(v1, v6, "vc");
if ( *v7 == 43 && !v7[1] )
{
v9 = item_feat_float(v5, "end");
*(float *)&result = (float)(ffeature_float(v5, "R:Segment.p.end") + v9) * 0.5;
return result;
}
v5 = item_next(v5);
}
while ( v5 );
v10 = item_feat_float(v4, "end");
*(float *)&result = (float)(ffeature_float(v4, "R:Segment.p.end") + v10) * 0.5;
return result;
}

canonical_decompiled_code:
double __fastcall func2(__int64 a1)
{
__int64 v1; // rbx
__int64 v2; // rax
__int64 v3; // rax
__int64 v4; // r13
__int64 v5; // rbp
__int64 v6; // rax
_BYTE *v7; // rax
double result; // xmm0_8
float v9; // [rsp+Ch] [rbp-2Ch]
float v10; // [rsp+Ch] [rbp-2Ch]

v1 = item_phoneset();
v2 = item_as(a1, "SylStructure");
v3 = item_daughter(v2);
if ( !v3 )
return 0.0;
v4 = v3;
v5 = v3;
do
{
v6 = item_feat_string(v5, "name");
v7 = (_BYTE *)phone_feature_string(v1, v6, "vc");
if ( *v7 == 43 && !v7[1] )
{
v9 = item_feat_float(v5, "end");
*(float *)&result = (float)(ffeature_float(v5, "R:Segment.p.end") + v9) * 0.5;
return result;
}
v5 = item_next(v5);
}
while ( v5 );
v10 = item_feat_float(v4, "end");
*(float *)&result = (float)(ffeature_float(v4, "R:Segment.p.end") + v10) * 0.5;
return result;
}

original_code:
static float vowel_mid(cst_item *syl)
{
    cst_item *s;
    cst_item *ts;
    const cst_phoneset *ps = item_phoneset(syl);
    ts = item_daughter(item_as(syl,"SylStructure"));
    for (s=ts; s; s = item_next(s))
    {
 if ((strcmp("+",phone_feature_string(ps,item_feat_string(s,"name"), "vc")) == 0))
 {
     return (item_feat_float(s,"end")+
      ffeature_float(s,"R:Segment.p.end"))/2.0;
 }
    }
    if (ts == 0)
 return 0;
    return (item_feat_float(ts,"end")+
     ffeature_float(ts,"R:Segment.p.end"))/2.0;
}

canonical_original_code:
static float vowel_mid(struct cst_item_struct *syl)
{
    struct cst_item_struct *s;
    struct cst_item_struct *ts;
    struct cst_phoneset_struct *ps = item_phoneset(syl);
    ts = item_daughter(item_as(syl,"SylStructure"));
    for (s=ts; s; s = item_next(s))
    {
 if ((strcmp("+",phone_feature_string(ps,item_feat_string(s,"name"), "vc")) == 0))
 {
     return (item_feat_float(s,"end")+
      ffeature_float(s,"R:Segment.p.end"))/2.0;
 }
    }
    if (ts == 0)
 return 0;
    return (item_feat_float(ts,"end")+
     ffeature_float(ts,"R:Segment.p.end"))/2.0;
}

variable_types: struct cst_phoneset_struct { char *name; char **featnames; struct cst_val_struct { union { struct cst_val_cons_struct { struct cst_val_struct *car; struct cst_val_struct *cdr; } cc; struct cst_val_atom_struct { short type; short ref_count; union { float fval; int ival; void *vval; } v; } a; } c; } **featvals; char **phonenames; char *silence; int num_phones; int **fvtable; } *

return_type: float


decompiled_code:
__int64 __fastcall add_target_point(__int64 a1, float a2, float a3)
{
__int64 v3; // rbp
float v4; // xmm0_4

v3 = relation_append(a1, 0LL);
item_set_float(v3, "pos", a2);
v4 = *(float *)&LC11;
if ( a3 <= 500.0 )
{
v4 = *(float *)&LC13;
if ( a3 >= 50.0 )
v4 = a3;
}
return item_set_float(v3, "f0", v4);
}

canonical_decompiled_code:
__int64 __fastcall func3(__int64 a1, float a2, float a3)
{
__int64 v3; // rbp
float v4; // xmm0_4

v3 = relation_append(a1, 0LL);
item_set_float(v3, "pos", a2);
v4 = *(float *)&LC11;
if ( a3 <= 500.0 )
{
v4 = *(float *)&LC13;
if ( a3 >= 50.0 )
v4 = a3;
}
return item_set_float(v3, "f0", v4);
}

original_code:
static void add_target_point(cst_relation *targ,float pos, float f0)
{
    cst_item *t;
    t = relation_append(targ,((void *)0));
    item_set_float(t,"pos",pos);
    if (f0 > 500.0)
 item_set_float(t,"f0",500.0);
    else if (f0 < 50.0)
 item_set_float(t,"f0",50.0);
    else
 item_set_float(t,"f0",f0);
}

canonical_original_code:
static void add_target_point(struct cst_relation_struct *targ, float pos, float f0)
{
    struct cst_item_struct *t;
    t = relation_append(targ,((void *)0));
    item_set_float(t,"pos",pos);
    if (f0 > 500.0)
 item_set_float(t,"f0",500.0);
    else if (f0 < 50.0)
 item_set_float(t,"f0",50.0);
    else
 item_set_float(t,"f0",f0);
}

variable_types: struct cst_relation_struct { char *name; struct cst_features_struct { struct cst_featvalpair_struct { char *name; struct cst_val_struct { union { struct cst_val_cons_struct { struct cst_val_struct *car; struct cst_val_struct *cdr; } cc; struct cst_val_atom_struct { short type; short ref_count; union { float fval; int ival; void *vval; } v; } a; } c; } *val; struct cst_featvalpair_struct *next; } *head; void *ctx; } *features; struct cst_utterance_struct { struct cst_features_struct *features; struct cst_features_struct *ffunctions; struct cst_features_struct *relations; void *ctx; } *utterance; struct cst_item_struct { struct cst_item_contents_struct { struct cst_features_struct *features; struct cst_features_struct *relations; } *contents; struct cst_relation_struct *relation; struct cst_item_struct *n; struct cst_item_struct *p; struct cst_item_struct *u; struct cst_item_struct *d; } *head; struct cst_item_struct *tail; } *

variable_types: pos float


main

canonical_name: main

repo: deaz/sntp-server

decompiled_code:
int __cdecl main(int argc, const char **argv, const char **envp)
{
__int64 v3; // r12

if ( (int)daemon_init((char *)*argv, 0) < 0 )
exit(-1);
v3 = (unsigned int)server();
syslog(7, "exited with %d", v3);
return v3;
}

canonical_decompiled_code:
int __cdecl main(int argc, const char **argv, const char **envp)
{
__int64 v3; // r12

if ( (int)func7((char *)*argv, 0) < 0 )
exit(-1);
v3 = (unsigned int)func13();
syslog(7, "exited with %d", v3);
return v3;
}

original_code:
int main(int argc, char *argv[]) {
    if (daemon_init(argv[0], 0) < 0) {
        exit(-1);
    }
    int status;
    status = server();
    syslog(7, "exited with %d", status);
    return status;
}

variable_types: argc int

variable_types:
argv
char *[]

variable_types: status int


decompiled_code:
__int64 __fastcall daemon_init(char *ident, int facility)
{
__pid_t v2; // eax
unsigned int v3; // er12

v2 = fork();
if ( v2 < 0 )
return (unsigned int)-1;
if ( v2 )
exit(0);
v3 = 0;
umask(0);
if ( setsid() < 0 || chdir("/") < 0 )
return (unsigned int)-1;
close(0);
close(1);
close(2);
openlog(ident, 1, facility);
syslog(7, "started");
return v3;
}

canonical_decompiled_code:
__int64 __fastcall func7(char *ident, int facility)
{
__pid_t v2; // eax
unsigned int v3; // er12

v2 = fork();
if ( v2 < 0 )
return (unsigned int)-1;
if ( v2 )
exit(0);
v3 = 0;
umask(0);
if ( setsid() < 0 || chdir("/") < 0 )
return (unsigned int)-1;
close(0);
close(1);
close(2);
openlog(ident, 1, facility);
syslog(7, "started");
return v3;
}

original_code:
int daemon_init(const char *pname, int facility) {
    pid_t pid;
    pid = fork();
    if (pid < 0) {
        return -1;
    } else if (pid != 0) {
        exit(0);
    }
    umask(0);
    if (setsid() < 0) {
        return -1;
    }
    if (chdir("/") < 0) {
        return -1;
    }
    close(0);
    close(1);
    close(2);
    openlog(pname, 0x01, facility);
    syslog(7, "started");
    return 0;
}

canonical_original_code:
int daemon_init(char *pname, int facility) {
    int pid;
    pid = fork();
    if (pid < 0) {
        return -1;
    } else if (pid != 0) {
        exit(0);
    }
    umask(0);
    if (setsid() < 0) {
        return -1;
    }
    if (chdir("/") < 0) {
        return -1;
    }
    close(0);
    close(1);
    close(2);
    openlog(pname, 0x01, facility);
    syslog(7, "started");
    return 0;
}

variable_types:
pname
char *

variable_types: facility int

variable_types: pid int


decompiled_code:
__int64 ntp_time()
{
__int64 v0; // rax
unsigned int v1; // edx
struct timeval v3; // [rsp+0h] [rbp-18h] BYREF

gettimeofday(&v3, 0LL);
_bswap_32(LODWORD(v3.tv_sec) - 2085978496);
v0 = _bswap_32((int)((double)SLODWORD(v3.tv_usec) / 1000000.0 * 4294967296.0));
return (v0 << 32) | v1;
}

canonical_decompiled_code:
__int64 func10()
{
__int64 v0; // rax
unsigned int v1; // edx
struct timeval v3; // [rsp+0h] [rbp-18h] BYREF

gettimeofday(&v3, 0LL);
func8(LODWORD(v3.tv_sec) - 2085978496);
v0 = func8((int)((double)SLODWORD(v3.tv_usec) / 1000000.0 * 4294967296.0));
return (v0 << 32) | v1;
}

original_code:
fixedpt64 ntp_time() {
    struct timeval tv;
    gettimeofday(&tv, ((void *)0));
    double usecf = (double)tv.tv_usec / 1000000;
    uint32_t useci = (uint32_t)(usecf * 4294967296);
    fixedpt64 res = {htonl(tv.tv_sec + 2208988800UL), htonl(useci)};
    return res;
}

canonical_original_code:
struct fixedpt64 ntp_time() {
    struct timeval tv;
    gettimeofday(&tv, ((void *)0));
    double usecf = (double)tv.tv_usec / 1000000;
    unsigned int useci = (uint32_t)(usecf * 4294967296);
    struct fixedpt64 res = {htonl(tv.tv_sec + 2208988800UL), htonl(useci)};
    return res;
}

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

variable_types: usecf double

variable_types:
useci
unsigned int

variable_types: struct fixedpt64 { unsigned int integer; unsigned int fraction; }


original_code:
void make_ntp_msg(ntpmsg *msg) {
    msg->status = (msg->status & ~0xC0);
    msg->status = (msg->status & ~0x07) | 4;
    msg->stratum = 1;
    msg->precision = -6;
    memset(&(msg->delay), 0, sizeof(msg->delay));
    memset(&(msg->dispersion), 0, sizeof(msg->dispersion));
    strncpy(msg->refid, "LOCL", 4);
    memset(&(msg->reftime), 0, sizeof(msg->reftime));
    msg->origintime = msg->transtime;
    msg->recvtime = ntp_time();
    msg->transtime = ntp_time();
}

canonical_original_code:
void make_ntp_msg(struct ntpmsg *msg) {
    msg->status = (msg->status & ~0xC0);
    msg->status = (msg->status & ~0x07) | 4;
    msg->stratum = 1;
    msg->precision = -6;
    memset(&(msg->delay), 0, sizeof(msg->delay));
    memset(&(msg->dispersion), 0, sizeof(msg->dispersion));
    strncpy(msg->refid, "LOCL", 4);
    memset(&(msg->reftime), 0, sizeof(msg->reftime));
    msg->origintime = msg->transtime;
    msg->recvtime = ntp_time();
    msg->transtime = ntp_time();
}

variable_types: struct ntpmsg { unsigned char status; unsigned char stratum; unsigned char poll; char precision; struct fixedpt32 { unsigned short integer; unsigned short fraction; } delay; struct fixedpt32 dispersion; char refid[4]; struct fixedpt64 { unsigned int integer; unsigned int fraction; } reftime; struct fixedpt64 origintime; struct fixedpt64 recvtime; struct fixedpt64 transtime; } *

user_defined_types: struct ntpmsg { unsigned char status; unsigned char stratum; unsigned char poll; char precision; struct fixedpt32 delay; struct fixedpt32 dispersion; char refid[4]; struct fixedpt64 reftime; struct fixedpt64 origintime; struct fixedpt64 recvtime; struct fixedpt64 transtime; }


decompiled_code:
int __fastcall init_server(int *a1, __int64 a2)
{
int v2; // eax
socklen_t v3; // edx
int result; // eax
int *v5; // rax
char *v6; // rax
int *v7; // rax
char *v8; // rax
int optval[7]; // [rsp+Ch] [rbp-1Ch] BYREF

v2 = socket(2, 2, 0);
*a1 = v2;
if ( v2 < 0 )
{
v5 = __errno_location();
v6 = strerror(*v5);
syslog(7, "opening socket: %s", v6);
result = -1;
}
else
{
optval[0] = 1;
setsockopt(v2, 1, 2, optval, 4u);
*(_QWORD *)(a2 + 8) = 0LL;
*(_WORD *)a2 = 2;
*(_WORD *)(a2 + 2) = _bswap_16_constprop_0(0LL, a2, 16LL);
*(_DWORD *)(a2 + 4) = _bswap_32(0);
result = bind(*a1, (const struct sockaddr *)a2, v3);
if ( result )
{
v7 = __errno_location();
v8 = strerror(*v7);
syslog(7, "binding: %s", v8);
result = -1;
}
}
return result;
}

canonical_decompiled_code:
int __fastcall func12(int *a1, __int64 a2)
{
int v2; // eax
socklen_t v3; // edx
int result; // eax
int *v5; // rax
char *v6; // rax
int *v7; // rax
char *v8; // rax
int optval[7]; // [rsp+Ch] [rbp-1Ch] BYREF

v2 = socket(2, 2, 0);
*a1 = v2;
if ( v2 < 0 )
{
v5 = __errno_location();
v6 = strerror(*v5);
syslog(7, "opening socket: %s", v6);
result = -1;
}
else
{
optval[0] = 1;
setsockopt(v2, 1, 2, optval, 4u);
*(_QWORD *)(a2 + 8) = 0LL;
*(_WORD *)a2 = 2;
*(_WORD *)(a2 + 2) = func9(0LL, a2, 16LL);
*(_DWORD *)(a2 + 4) = func8(0);
result = bind(*a1, (const struct sockaddr *)a2, v3);
if ( result )
{
v7 = __errno_location();
v8 = strerror(*v7);
syslog(7, "binding: %s", v8);
result = -1;
}
}
return result;
}

original_code:
int init_server(int *sockfd, sockaddr_in *servaddr) {
    *sockfd = socket(2, SOCK_DGRAM, 0);
    if (*sockfd < 0) {
        syslog(7, "opening socket: %s", strerror((*__errno_location ())));
        return -1;
    }
    int tr = 1;
    setsockopt(*sockfd, 1, 2, &tr, sizeof(tr));
    memset(servaddr, 0, sizeof(*servaddr));
    (*servaddr).sin_family = 2;
    (*servaddr).sin_port = htons(123);
    (*servaddr).sin_addr.s_addr = htonl(((in_addr_t) 0x00000000));
    if (bind(*sockfd, (sockaddr*)servaddr, sizeof(*servaddr))) {
        syslog(7, "binding: %s", strerror((*__errno_location ())));
        return -1;
    }
    return 0;
}

canonical_original_code:
int init_server(int *sockfd, struct sockaddr_in *servaddr) {
    *sockfd = socket(2, SOCK_DGRAM, 0);
    if (*sockfd < 0) {
        syslog(7, "opening socket: %s", strerror((*__errno_location ())));
        return -1;
    }
    int tr = 1;
    setsockopt(*sockfd, 1, 2, &tr, sizeof(tr));
    memset(servaddr, 0, sizeof(*servaddr));
    (*servaddr).sin_family = 2;
    (*servaddr).sin_port = htons(123);
    (*servaddr).sin_addr.s_addr = htonl(((unsigned int) 0x00000000));
    if (bind(*sockfd, (struct sockaddr *)servaddr, sizeof(*servaddr))) {
        syslog(7, "binding: %s", strerror((*__errno_location ())));
        return -1;
    }
    return 0;
}

variable_types:
sockfd
int *

variable_types: struct sockaddr_in { unsigned short sin_family; unsigned short sin_port; struct in_addr { unsigned int s_addr; } sin_addr; unsigned char sin_zero[-1]; } *

variable_types: tr int

user_defined_types: struct sockaddr_in { unsigned short sin_family; unsigned short sin_port; struct in_addr sin_addr; unsigned char sin_zero[-1]; }

user_defined_types: struct sockaddr { unsigned short sa_family; char sa_data[14]; }


server

decompiled_code:
__int64 server()
{
int *v0; // rbx
int v1; // eax
char *v2; // rax
char *v3; // rax
int fd; // [rsp+8h] [rbp-60h] BYREF
socklen_t addr_len; // [rsp+Ch] [rbp-5Ch] BYREF
char v7[16]; // [rsp+10h] [rbp-58h] BYREF
struct sockaddr addr; // [rsp+20h] [rbp-48h] BYREF
char buf[56]; // [rsp+30h] [rbp-38h] BYREF

if ( init_server(&fd, (__int64)v7) >= 0 )
{
v0 = __errno_location();
while ( 1 )
{
addr_len = 16;
v1 = recvfrom(fd, buf, 0x30uLL, 0, &addr, &addr_len);
if ( v1 < 0 )
{
v2 = strerror(*v0);
syslog(7, "receiving: %s", v2);
}
else if ( (unsigned int)v1 <= 0x2F )
{
syslog(7, "message too small");
}
else
{
make_ntp_msg(buf);
if ( sendto(fd, buf, 0x30uLL, 0, &addr, 0x10u) < 0 )
{
v3 = strerror(*v0);
syslog(7, "sending: %s", v3);
}
else
{
syslog(7, "client synced");
}
}
}
}
return 0xFFFFFFFFLL;
}

canonical_decompiled_code:
__int64 func13()
{
int *v0; // rbx
int v1; // eax
char *v2; // rax
char *v3; // rax
int fd; // [rsp+8h] [rbp-60h] BYREF
socklen_t addr_len; // [rsp+Ch] [rbp-5Ch] BYREF
char v7[16]; // [rsp+10h] [rbp-58h] BYREF
struct sockaddr addr; // [rsp+20h] [rbp-48h] BYREF
char buf[56]; // [rsp+30h] [rbp-38h] BYREF

if ( func12(&fd, (__int64)v7) >= 0 )
{
v0 = __errno_location();
while ( 1 )
{
addr_len = 16;
v1 = recvfrom(fd, buf, 0x30uLL, 0, &addr, &addr_len);
if ( v1 < 0 )
{
v2 = strerror(*v0);
syslog(7, "receiving: %s", v2);
}
else if ( (unsigned int)v1 <= 0x2F )
{
syslog(7, "message too small");
}
else
{
func11(buf);
if ( sendto(fd, buf, 0x30uLL, 0, &addr, 0x10u) < 0 )
{
v3 = strerror(*v0);
syslog(7, "sending: %s", v3);
}
else
{
syslog(7, "client synced");
}
}
}
}
return 0xFFFFFFFFLL;
}

original_code:
int server() {
    int sockfd;
    sockaddr_in servaddr;
    if (init_server(&sockfd, &servaddr) < 0) {
        return -1;
    }
    sockaddr_in cliaddr;
    socklen_t cliaddr_size;
    int recvbytes;
    char buf[sizeof(ntpmsg)];
    while (1) {
        cliaddr_size = sizeof(cliaddr);
        recvbytes = recvfrom(sockfd, buf, sizeof(ntpmsg), 0, (sockaddr*)&cliaddr, &cliaddr_size);
        if (recvbytes < 0) {
            syslog(7, "receiving: %s", strerror((*__errno_location ())));
            continue;
        }
        if (recvbytes < sizeof(ntpmsg)) {
            syslog(7, "message too small");
            continue;
        }
        make_ntp_msg((ntpmsg*)buf);
        if (sendto(sockfd, buf, sizeof(ntpmsg), 0, (sockaddr*)&cliaddr, sizeof(cliaddr)) < 0) {
            syslog(7, "sending: %s", strerror((*__errno_location ())));
            continue;
        }
        syslog(7, "client synced");
    }
    return 0;
}

canonical_original_code:
int server() {
    int sockfd;
    struct sockaddr_in servaddr;
    if (init_server(&sockfd, &servaddr) < 0) {
        return -1;
    }
    struct sockaddr_in cliaddr;
    unsigned int cliaddr_size;
    int recvbytes;
    char buf[-1];
    while (1) {
        cliaddr_size = sizeof(cliaddr);
        recvbytes = recvfrom(sockfd, buf, sizeof(ntpmsg), 0, (struct sockaddr *)&cliaddr, &cliaddr_size);
        if (recvbytes < 0) {
            syslog(7, "receiving: %s", strerror((*__errno_location ())));
            continue;
        }
        if (recvbytes < sizeof(ntpmsg)) {
            syslog(7, "message too small");
            continue;
        }
        make_ntp_msg((struct ntpmsg *)buf);
        if (sendto(sockfd, buf, sizeof(ntpmsg), 0, (struct sockaddr *)&cliaddr, sizeof(cliaddr)) < 0) {
            syslog(7, "sending: %s", strerror((*__errno_location ())));
            continue;
        }
        syslog(7, "client synced");
    }
    return 0;
}

variable_types: sockfd int

variable_types: struct sockaddr_in { unsigned short sin_family; unsigned short sin_port; struct in_addr { unsigned int s_addr; } sin_addr; unsigned char sin_zero[-1]; }

variable_types: recvbytes int

variable_types:
buf
char [-1]

user_defined_types: struct fixedpt32 { unsigned short integer; unsigned short fraction; }

user_defined_types: struct fixedpt64 { unsigned int integer; unsigned int fraction; }


inserirClientes

repo: debymf/msgserver

decompiled_code:
void inserirClientes()
{
unsigned int i; // ebx
int v1; // edi
_DWORD v2[10]; // [rsp+0h] [rbp-28h] BYREF

for ( i = 0; ; ++i )
{
if ( msgrcv(filaE1, v2, 8uLL, 0LL, 0) < 0 )
{
puts("Erro ao receber cliente para cadastro.");
perror("msgrcv");
exit(1);
}
v1 = filaE2;
if ( i > 4 )
break;
clientes_cadastrados[v2[2]] = 1;
if ( msgsnd(v1, v2, 8uLL, 0) < 0 )
goto LABEL_9;
LABEL_6:
;
}
v2[3] = 0;
if ( msgsnd(filaE2, v2, 8uLL, 0) >= 0 )
goto LABEL_5;
LABEL_9:
puts("Erro ao enviar resposta de cadastro ao cliente.");
perror("msgsnd");
LABEL_5:
if ( i != 8 )
goto LABEL_6;
}

canonical_decompiled_code:
void func7()
{
unsigned int i; // ebx
int v1; // edi
_DWORD v2[10]; // [rsp+0h] [rbp-28h] BYREF

for ( i = 0; ; ++i )
{
if ( msgrcv(filaE1, v2, 8uLL, 0LL, 0) < 0 )
{
puts("Erro ao receber cliente para cadastro.");
perror("msgrcv");
exit(1);
}
v1 = filaE2;
if ( i > 4 )
break;
clientes_cadastrados[v2[2]] = 1;
if ( msgsnd(v1, v2, 8uLL, 0) < 0 )
goto LABEL_9;
LABEL_6:
;
}
v2[3] = 0;
if ( msgsnd(filaE2, v2, 8uLL, 0) >= 0 )
goto LABEL_5;
LABEL_9:
puts("Erro ao enviar resposta de cadastro ao cliente.");
perror("msgsnd");
LABEL_5:
if ( i != 8 )
goto LABEL_6;
}

original_code:
void inserirClientes(){
 struct inServer msg1_recv;
 int i;
 for(i=0;i<9;i++){
  if(msgrcv(filaE1, &msg1_recv, sizeof(struct inServer) - sizeof(long), 0, 0)<0){
   printf("Erro ao receber cliente para cadastro.\n");
   perror("msgrcv");
   exit(1);
  }
  if (i>4){
   msg1_recv.auth=0;
  }
  else{
   clientes_cadastrados[msg1_recv.pid]=1;
  }
;
  if(msgsnd(filaE2,&msg1_recv, sizeof(struct inServer) - sizeof(long), 0)<0){
   printf("Erro ao enviar resposta de cadastro ao cliente.\n");
   perror("msgsnd");
  }
 }
}

variable_types: struct inServer { long type; int pid; int auth; }

variable_types: i int


imprimirMsgs

decompiled_code:
int imprimirMsgs()
{
int v0; // ebx
int result; // eax
__int64 v2; // [rsp+0h] [rbp-58h] BYREF
int v3; // [rsp+8h] [rbp-50h]
char v4[72]; // [rsp+10h] [rbp-48h] BYREF

v0 = 5;
do
{
if ( msgrcv(filaM, &v2, 0x40uLL, 0LL, 0) < 0 )
{
puts(" Erro ao receber cliente para imprimir msg.");
perror("msgrcv");
exit(1);
}
result = v3;
if ( clientes_cadastrados[v3] == 1 )
result = printf("Mensagem: %s\n", v4);
--v0;
}
while ( v0 );
return result;
}

canonical_decompiled_code:
int func8()
{
int v0; // ebx
int result; // eax
__int64 v2; // [rsp+0h] [rbp-58h] BYREF
int v3; // [rsp+8h] [rbp-50h]
char v4[72]; // [rsp+10h] [rbp-48h] BYREF

v0 = 5;
do
{
if ( msgrcv(filaM, &v2, 0x40uLL, 0LL, 0) < 0 )
{
puts(" Erro ao receber cliente para imprimir msg.");
perror("msgrcv");
exit(1);
}
result = v3;
if ( clientes_cadastrados[v3] == 1 )
result = printf("Mensagem: %s\n", v4);
--v0;
}
while ( v0 );
return result;
}

original_code:
void imprimirMsgs(){
 struct msgServer msg1_recv;
 int i;
 for(i=0;i<5;i++){
  if(msgrcv(filaM, &msg1_recv, sizeof(struct msgServer) - sizeof(long), 0, 0)<0){
   printf(" Erro ao receber cliente para imprimir msg.\n");
   perror("msgrcv");
   exit(1);
  }
  if (clientes_cadastrados[msg1_recv.pid]==1){
   printf("Mensagem: %s\n", msg1_recv.buf);
  }
 }
}

variable_types: struct msgServer { long type; int pid; int auth; char buf[50]; }


removerClientes

decompiled_code:
void removerClientes()
{
int v0; // ebx
int v1; // edi
_DWORD v2[6]; // [rsp+0h] [rbp-18h] BYREF

v0 = 5;
do
{
if ( msgrcv(filaE1, v2, 8uLL, 0LL, 0) < 0 )
{
puts("Erro ao receber cliente para retirada.");
perror("msgrcv");
exit(1);
}
v1 = filaE2;
v2[3] = 2;
clientes_cadastrados[v2[2]] = 0;
if ( msgsnd(v1, v2, 8uLL, 0) < 0 )
{
puts("Erro ao enviar resposta de remocao ao cliente.");
perror("msgsnd");
}
--v0;
}
while ( v0 );
}

canonical_decompiled_code:
void func9()
{
int v0; // ebx
int v1; // edi
_DWORD v2[6]; // [rsp+0h] [rbp-18h] BYREF

v0 = 5;
do
{
if ( msgrcv(filaE1, v2, 8uLL, 0LL, 0) < 0 )
{
puts("Erro ao receber cliente para retirada.");
perror("msgrcv");
exit(1);
}
v1 = filaE2;
v2[3] = 2;
clientes_cadastrados[v2[2]] = 0;
if ( msgsnd(v1, v2, 8uLL, 0) < 0 )
{
puts("Erro ao enviar resposta de remocao ao cliente.");
perror("msgsnd");
}
--v0;
}
while ( v0 );
}

original_code:
void removerClientes(){
 struct inServer msg1_recv;
 int i;
 for(i=0;i<5;i++){
  if(msgrcv(filaE1, &msg1_recv, sizeof(struct inServer) - sizeof(long), 0, 0)<0){
   printf("Erro ao receber cliente para retirada.\n");
   perror("msgrcv");
   exit(1);
  }
  clientes_cadastrados[msg1_recv.pid]=0;
  msg1_recv.auth=2;
  if(msgsnd(filaE2,&msg1_recv, sizeof(struct inServer) - sizeof(long), 0)<0){
   printf("Erro ao enviar resposta de remocao ao cliente.\n");
   perror("msgsnd");
  }
 }
}

user_defined_types: struct inServer { long type; int pid; int auth; }


main

decompiled_code:
int __cdecl main(int argc, const char **argv, const char **envp)
{
key_t v3; // eax
key_t v4; // eax
key_t v5; // eax

v3 = ftok("main.c", 1);
filaE1 = msgget(v3, 950);
if ( filaE1 < 0
|| (v4 = ftok("main.c", 2), filaE2 = msgget(v4, 950), filaE2 < 0)
|| (v5 = ftok("main.c", 3), filaM = msgget(v5, 950), filaM < 0) )
{
puts("Erro na criacao da fila de entrada.");
exit(1);
}
puts("Inicia servidor de impressao");
inserirClientes();
imprimirMsgs();
removerClientes();
sleep(0xAu);
msgctl(filaE1, 0, 0LL);
msgctl(filaE2, 0, 0LL);
msgctl(filaM, 0, 0LL);
return 0;
}

canonical_decompiled_code:
int __cdecl main(int argc, const char **argv, const char **envp)
{
key_t v3; // eax
key_t v4; // eax
key_t v5; // eax

v3 = ftok("main.c", 1);
filaE1 = msgget(v3, 950);
if ( filaE1 < 0
|| (v4 = ftok("main.c", 2), filaE2 = msgget(v4, 950), filaE2 < 0)
|| (v5 = ftok("main.c", 3), filaM = msgget(v5, 950), filaM < 0) )
{
puts("Erro na criacao da fila de entrada.");
exit(1);
}
puts("Inicia servidor de impressao");
func7();
func8();
func9();
sleep(0xAu);
msgctl(filaE1, 0, 0LL);
msgctl(filaE2, 0, 0LL);
msgctl(filaM, 0, 0LL);
return 0;
}

original_code:
int main(){
 int key1;
 if ((filaE1 = msgget(ftok("main.c", 1), 01000|0x1B6)) < 0)
 {
  printf("Erro na criacao da fila de entrada.\n");
  exit(1);
 }
 if ((filaE2 = msgget(ftok("main.c", 2), 01000|0x1B6)) < 0)
 {
  printf("Erro na criacao da fila de entrada.\n");
  exit(1);
 }
 if ((filaM = msgget(ftok("main.c", 3), 01000|0x1B6)) < 0)
 {
  printf("Erro na criacao da fila de entrada.\n");
  exit(1);
 }
 printf("Inicia servidor de impressao\n");
 inserirClientes();
 imprimirMsgs();
 removerClientes();
 sleep(10);
 msgctl(filaE1, 0, ((void *)0));
 msgctl(filaE2, 0, ((void *)0));
 msgctl(filaM, 0, ((void *)0));
 return 0;
}