stringequal

decompiled_code:
_BOOL8 stringequal()
{
return (unsigned int)Ustrcmp() == 0;
}

canonical_decompiled_code:
_BOOL8 func12()
{
return (unsigned int)Ustrcmp() == 0;
}

original_code:
static int stringequal(Uchar *s1, Uchar *s2)
{
    return !Ustrcmp(s1, s2);
}

canonical_original_code:
static int stringequal(unsigned short *s1, unsigned short *s2)
{
    return !Ustrcmp(s1, s2);
}


stringminus

repo: jff/mathspad

decompiled_code:
__int64 __fastcall stringminus(__int64 a1, __int64 a2)
{
__int64 v2; // r12
int v3; // ebx
int v4; // eax
int v6; // ebp
__int64 v7; // r13
__int64 v8; // rbx

v2 = a1;
v3 = ((__int64 (*)(void))Ustrlen)();
v4 = Ustrlen(a2);
if ( v3 >= v4 )
{
v6 = v4;
v7 = v3 - (__int64)v4;
if ( !(unsigned int)Ustrcmp(a1 + 2 * v7, a2) )
{
v8 = mm_malloc(2LL * (v3 - v6 + 1));
Ustrncpy(v8, a1, v7);
*(_WORD *)(v8 + 2 * v7) = 0;
increase_refcount(v8, &free);
v2 = v8;
}
}
return v2;
}

canonical_decompiled_code:
__int64 __fastcall func13(__int64 a1, __int64 a2)
{
__int64 v2; // r12
int v3; // ebx
int v4; // eax
int v6; // ebp
__int64 v7; // r13
__int64 v8; // rbx

v2 = a1;
v3 = ((__int64 (*)(void))Ustrlen)();
v4 = Ustrlen(a2);
if ( v3 >= v4 )
{
v6 = v4;
v7 = v3 - (__int64)v4;
if ( !(unsigned int)Ustrcmp(a1 + 2 * v7, a2) )
{
v8 = mm_malloc(2LL * (v3 - v6 + 1));
Ustrncpy(v8, a1, v7);
*(_WORD *)(v8 + 2 * v7) = 0;
increase_refcount(v8, &free);
v2 = v8;
}
}
return v2;
}

original_code:
static Uchar *stringminus(Uchar *s1, Uchar *s2)
{
    int i=Ustrlen(s1);
    int j=Ustrlen(s2);
    Uchar *t;
    if (i<j) { return s1; }
    if (Ustrcmp(s1+i-j, s2)) { return s1; }
    t=mm_malloc((i-j+1)*sizeof(Uchar));
    Ustrncpy(t, s1, i-j);
    t[i-j]='\0';
    increase_refcount(t,free);
    return t;
}

canonical_original_code:
static unsigned short *stringminus(unsigned short *s1, unsigned short *s2)
{
    int i = Ustrlen(s1);
    int j = Ustrlen(s2);
    unsigned short *t;
    if (i<j) { return s1; }
    if (Ustrcmp(s1+i-j, s2)) { return s1; }
    t=mm_malloc((i-j+1)*sizeof(Uchar));
    Ustrncpy(t, s1, i-j);
    t[i-j]='\0';
    increase_refcount(t,free);
    return t;
}

variable_types: i int

variable_types: j int

variable_types:
t
unsigned short *

return_type: unsigned short *


stringadd

decompiled_code:
__int64 __fastcall stringadd(__int64 a1, __int64 a2)
{
int v2; // ebp
int v3; // eax
__int64 v4; // rbx

v2 = Ustrlen(a1);
v3 = Ustrlen(a2);
v4 = mm_malloc(2LL * (v3 + v2 + 1));
Ustrcpy(v4, a1);
Ustrcpy(v4 + 2LL * v2, a2);
increase_refcount(v4, &free);
return v4;
}

canonical_decompiled_code:
__int64 __fastcall func15(__int64 a1, __int64 a2)
{
int v2; // ebp
int v3; // eax
__int64 v4; // rbx

v2 = Ustrlen(a1);
v3 = Ustrlen(a2);
v4 = mm_malloc(2LL * (v3 + v2 + 1));
Ustrcpy(v4, a1);
Ustrcpy(v4 + 2LL * v2, a2);
increase_refcount(v4, &free);
return v4;
}

original_code:
static Uchar *stringadd(Uchar *s1, Uchar *s2)
{
    int j=Ustrlen(s1);
    int i=j+Ustrlen(s2)+1;
    Uchar *t;
    t=mm_malloc(i*sizeof(Uchar));
    Ustrcpy(t,s1);
    Ustrcpy(t+j, s2);
    increase_refcount(t,free);
    return t;
}

canonical_original_code:
static unsigned short *stringadd(unsigned short *s1, unsigned short *s2)
{
    int j = Ustrlen(s1);
    int i = j+Ustrlen(s2)+1;
    unsigned short *t;
    t=mm_malloc(i*sizeof(Uchar));
    Ustrcpy(t,s1);
    Ustrcpy(t+j, s2);
    increase_refcount(t,free);
    return t;
}


decompiled_code:
__int64 __fastcall destruct_string(__int64 a1)
{
return decrease_refcount(a1);
}

canonical_decompiled_code:
__int64 __fastcall func17(__int64 a1)
{
return decrease_refcount(a1);
}

original_code:
static void destruct_string(void *object)
{
   decrease_refcount(object);
}

variable_types:
object
void *

return_type: void


printstring

decompiled_code:
int printstring()
{
const char *v0; // rax

v0 = (const char *)UstrtoLocale();
return printf("%s", v0);
}

canonical_decompiled_code:
int func18()
{
const char *v0; // rax

v0 = (const char *)UstrtoLocale();
return printf("%s", v0);
}

original_code:
static void printstring(Uchar *s)
{
    printf("%s", UstrtoLocale(s));
}

canonical_original_code:
static void printstring(unsigned short *s)
{
    printf("%s", UstrtoLocale(s));
}

variable_types:
s
unsigned short *


decompiled_code:
__int64 __fastcall call_str(__int64 (__fastcall *a1)(_QWORD), _QWORD **a2)
{
return a1(**a2);
}

canonical_decompiled_code:
__int64 __fastcall func3(__int64 (__fastcall *a1)(_QWORD), _QWORD **a2)
{
return a1(**a2);
}

original_code:
static int call_str(int (*fcal)(), void **args)
{
    return (*fcal)(*((Uchar**)args[0]));
}

canonical_original_code:
static int call_str(int (*fcal)(), void **args)
{
    return (*fcal)(*((unsigned short **)args[0]));
}

variable_types:
fcal
int (*)()

variable_types:
args
void **

return_type: int


assign

decompiled_code:
__int64 __fastcall assign(__int64 a1, __int64 *a2)
{
__int64 v2; // r12

Ustrlen(a1);
v2 = *a2;
increase_refcount(a1, &free);
*a2 = a1;
return decrease_refcount(v2);
}

canonical_decompiled_code:
__int64 __fastcall func16(__int64 a1, __int64 *a2)
{
__int64 v2; // r12

Ustrlen(a1);
v2 = *a2;
increase_refcount(a1, &free);
*a2 = a1;
return decrease_refcount(v2);
}

original_code:
static void assign(Uchar *s, Uchar **t)
{
    int i;
    Uchar *oldt;
    i = Ustrlen(s)+1;
    oldt=*t;
    increase_refcount(s,free);
    *t=s;
    decrease_refcount(oldt);
}

canonical_original_code:
static void assign(unsigned short *s, unsigned short **t)
{
    int i;
    unsigned short *oldt;
    i = Ustrlen(s)+1;
    oldt=*t;
    increase_refcount(s,free);
    *t=s;
    decrease_refcount(oldt);
}

variable_types:
t
unsigned short **

variable_types:
oldt
unsigned short *


decompiled_code:
__int64 init_library()
{
__int64 v0; // rax
__int64 v1; // rax
__int64 v2; // rax
__int64 v3; // rax
__int64 v4; // rax
__int64 v5; // rbx
__int64 v6; // rax
__int64 v7; // rax
__int64 v8; // rbx
__int64 v9; // rax
__int64 v10; // rax
__int64 v11; // rax
__int64 v12; // rax
__int64 v13; // rax
__int64 v14; // rax

define_type("String", 8LL, construct_string, destruct_string, copy_string);
define_program_variable(2LL, "TestVar", &testvar);
v0 = define_prototype(&unk_540, 1LL, 0LL, call_str);
define_function("PrintString", &unk_57A, v0, printstring);
v1 = define_prototype(&unk_510, 2LL, 0LL, call_strstrref);
v2 = define_function("AssignString", &unk_57A, v1, assign);
define_operator(1LL, v2);
v3 = define_prototype(&unk_550, 2LL, 1LL, call_strintresint);
v4 = define_function("StringElem", &unk_57A, v3, arrayvalue);
define_operator(2LL, v4);
v5 = define_prototype(&tlist, 2LL, 2LL, call_strstrresstr);
v6 = define_function("StringAdd", &unk_57A, v5, stringadd);
define_operator(11LL, v6);
v7 = define_function("StringMin", &unk_57A, v5, stringminus);
define_operator(12LL, v7);
v8 = define_prototype(&unk_520, 2LL, 1LL, call_strstrresint);
v9 = define_function("StringEqual", &unk_57A, v8, stringequal);
define_operator(25LL, v9);
v10 = define_function("StringNotEqual", &unk_57A, v8, stringnotequal);
define_operator(26LL, v10);
v11 = define_function("StringGreater", &unk_57A, v8, stringgreater);
define_operator(27LL, v11);
v12 = define_function("StringLess", &unk_57A, v8, stringless);
define_operator(28LL, v12);
v13 = define_function("StringLessEqual", &unk_57A, v8, stringlessequal);
define_operator(29LL, v13);
v14 = define_function("StringGreaterEqual", &unk_57A, v8, stringgreaterequal);
define_operator(30LL, v14);
return 1LL;
}

canonical_decompiled_code:
__int64 func19()
{
__int64 v0; // rax
__int64 v1; // rax
__int64 v2; // rax
__int64 v3; // rax
__int64 v4; // rax
__int64 v5; // rbx
__int64 v6; // rax
__int64 v7; // rax
__int64 v8; // rbx
__int64 v9; // rax
__int64 v10; // rax
__int64 v11; // rax
__int64 v12; // rax
__int64 v13; // rax
__int64 v14; // rax

define_type("String", 8LL, construct_string, destruct_string, copy_string);
define_program_variable(2LL, "TestVar", &testvar);
v0 = define_prototype(&unk_540, 1LL, 0LL, call_str);
define_function("PrintString", &unk_57A, v0, printstring);
v1 = define_prototype(&unk_510, 2LL, 0LL, call_strstrref);
v2 = define_function("AssignString", &unk_57A, v1, assign);
define_operator(1LL, v2);
v3 = define_prototype(&unk_550, 2LL, 1LL, call_strintresint);
v4 = define_function("StringElem", &unk_57A, v3, arrayvalue);
define_operator(2LL, v4);
v5 = define_prototype(&tlist, 2LL, 2LL, call_strstrresstr);
v6 = define_function("StringAdd", &unk_57A, v5, stringadd);
define_operator(11LL, v6);
v7 = define_function("StringMin", &unk_57A, v5, stringminus);
define_operator(12LL, v7);
v8 = define_prototype(&unk_520, 2LL, 1LL, call_strstrresint);
v9 = define_function("StringEqual", &unk_57A, v8, stringequal);
define_operator(25LL, v9);
v10 = define_function("StringNotEqual", &unk_57A, v8, stringnotequal);
define_operator(26LL, v10);
v11 = define_function("StringGreater", &unk_57A, v8, stringgreater);
define_operator(27LL, v11);
v12 = define_function("StringLess", &unk_57A, v8, stringless);
define_operator(28LL, v12);
v13 = define_function("StringLessEqual", &unk_57A, v8, stringlessequal);
define_operator(29LL, v13);
v14 = define_function("StringGreaterEqual", &unk_57A, v8, stringgreaterequal);
define_operator(30LL, v14);
return 1LL;
}

original_code:
int init_library(void)
{
    Prototype *pt;
    FuncRef fr;
    Type t;
    t=define_type("String", sizeof(Uchar*), construct_string,
    destruct_string, copy_string);
    define_program_variable(2, "TestVar", &testvar);
    pt=define_prototype(tlist[4], 1, 0, call_str);
    define_function("PrintString", "", pt, (Function) printstring);
    pt=define_prototype(tlist[1], 2, 0, call_strstrref);
    fr = define_function("AssignString", "", pt, (Function) assign);
    define_operator(1, fr);
    pt=define_prototype(tlist[5], 2, 1, call_strintresint);
    fr = define_function("StringElem", "", pt, (Function) arrayvalue);
    define_operator(2, fr);
    pt=define_prototype(tlist[0], 2, 2, call_strstrresstr);
    fr = define_function("StringAdd", "", pt, (Function) stringadd);
    define_operator(11, fr);
    fr = define_function("StringMin", "", pt, (Function) stringminus);
    define_operator(12, fr);
    pt=define_prototype(tlist[2], 2, 1, call_strstrresint);
    fr = define_function("StringEqual", "", pt, (Function) stringequal);
    define_operator(25, fr);
    fr = define_function("StringNotEqual", "", pt, (Function) stringnotequal);
    define_operator(26, fr);
    fr = define_function("StringGreater", "", pt, (Function) stringgreater);
    define_operator(27, fr);
    fr = define_function("StringLess", "", pt, (Function) stringless);
    define_operator(28, fr);
    fr = define_function("StringLessEqual", "", pt, (Function) stringlessequal);
    define_operator(29, fr);
    fr = define_function("StringGreaterEqual", "", pt, (Function) stringgreaterequal);
    define_operator(30, fr);
    return 1;
}

canonical_original_code:
int init_library()
{
    struct Prototype *pt;
    struct FuncDef *fr;
    unsigned int t;
    t=define_type("String", sizeof(unsigned short *), construct_string,
    destruct_string, copy_string);
    define_program_variable(2, "TestVar", &testvar);
    pt=define_prototype(tlist[4], 1, 0, call_str);
    define_function("PrintString", "", pt, (void (*)()) printstring);
    pt=define_prototype(tlist[1], 2, 0, call_strstrref);
    fr = define_function("AssignString", "", pt, (void (*)()) assign);
    define_operator(1, fr);
    pt=define_prototype(tlist[5], 2, 1, call_strintresint);
    fr = define_function("StringElem", "", pt, (void (*)()) arrayvalue);
    define_operator(2, fr);
    pt=define_prototype(tlist[0], 2, 2, call_strstrresstr);
    fr = define_function("StringAdd", "", pt, (void (*)()) stringadd);
    define_operator(11, fr);
    fr = define_function("StringMin", "", pt, (void (*)()) stringminus);
    define_operator(12, fr);
    pt=define_prototype(tlist[2], 2, 1, call_strstrresint);
    fr = define_function("StringEqual", "", pt, (void (*)()) stringequal);
    define_operator(25, fr);
    fr = define_function("StringNotEqual", "", pt, (void (*)()) stringnotequal);
    define_operator(26, fr);
    fr = define_function("StringGreater", "", pt, (void (*)()) stringgreater);
    define_operator(27, fr);
    fr = define_function("StringLess", "", pt, (void (*)()) stringless);
    define_operator(28, fr);
    fr = define_function("StringLessEqual", "", pt, (void (*)()) stringlessequal);
    define_operator(29, fr);
    fr = define_function("StringGreaterEqual", "", pt, (void (*)()) stringgreaterequal);
    define_operator(30, fr);
    return 1;
}

variable_types: struct Prototype { unsigned int *type; int n; unsigned int restype; int max; int (*caller)(); } *

variable_types: struct FuncDef { char *name; char *description; char nr_args; char functype; unsigned int rettype; void *prototype; } *

variable_types:
t
unsigned int


decompiled_code:
__int64 __fastcall userdef_free(_QWORD *a1)
{
mm_free(*a1);
mm_free(a1[1]);
mm_free(a1[5]);
destroy_local_names(a1[6]);
return free_sequence(a1[7]);
}

canonical_decompiled_code:
__int64 __fastcall func0(_QWORD *a1)
{
mm_free(*a1);
mm_free(a1[1]);
mm_free(a1[5]);
destroy_local_names(a1[6]);
return free_sequence(a1[7]);
}

original_code:
static void userdef_free(void *udef)
{
    UserDef *usd=(UserDef*)udef;
    mm_free(usd->name);
    mm_free(usd->description);
    mm_free(usd->localvar);
    destroy_local_names(usd->localname);
    free_sequence(usd->sequence);
}

canonical_original_code:
static void userdef_free(void *udef)
{
    struct UserDef *usd = (UserDef*)udef;
    mm_free(usd->name);
    mm_free(usd->description);
    mm_free(usd->localvar);
    destroy_local_names(usd->localname);
    free_sequence(usd->sequence);
}

variable_types:
udef
void *

variable_types: struct UserDef { char *name; char *description; char nr_args; char functype; unsigned int rettype; struct Prototype { unsigned int *type; int n; unsigned int restype; int max; int (*caller)(); } *prototype; char nr_local; struct Value { unsigned int type; union TVal { int ival; double rval; void *stval; int *iref; double *rref; void **stref; } val; } *localvar; char **localname; struct FuncSequence { char free_next; char free_alt; struct Expression { char type; char delta; unsigned int restype; union { int op; int arg; struct Expression *le; struct FuncDef { char *name; char *description; char nr_args; char functype; unsigned int rettype; void *prototype; } *ifunc; struct FuncDef *ufunc; } val; struct Expression *next; } *arglist; struct FuncSequence *next; struct FuncSequence *alternative; } *sequence; } *

user_defined_types: struct UserDef { char *name; char *description; char nr_args; char functype; unsigned int rettype; struct Prototype *prototype; char nr_local; struct Value *localvar; char **localname; struct FuncSequence *sequence; }

user_defined_types: struct Value { unsigned int type; union TVal val; }

user_defined_types: struct FuncSequence { char free_next; char free_alt; struct Expression *arglist; struct FuncSequence *next; struct FuncSequence *alternative; }

user_defined_types: struct Expression { char type; char delta; unsigned int restype; union { int op; int arg; struct Expression *le; struct FuncDef *ifunc; struct FuncDef *ufunc; } val; struct Expression *next; }


decompiled_code:
int __fastcall userdef_cmp(const char **a1, const char **a2)
{
return strcmp(*a1, *a2);
}

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

original_code:
static int userdef_cmp(const void *func1, const void *func2)
{
    return strcmp(((UserDef*)func1)->name, ((UserDef*)func2)->name);
}

canonical_original_code:
static int userdef_cmp(void *func1, void *func2)
{
    return strcmp(((struct UserDef *)func1)->name, ((struct UserDef *)func2)->name);
}

user_defined_types: struct Prototype { unsigned int *type; int n; unsigned int restype; int max; int (*caller)(); }

user_defined_types: union TVal { int ival; double rval; void *stval; int *iref; double *rref; void **stref; }

user_defined_types: struct FuncDef { char *name; char *description; char nr_args; char functype; unsigned int rettype; void *prototype; }


decompiled_code:
__int64 __fastcall lookup_user_function(__int64 a1)
{
__int64 result; // rax
__int64 v2[9]; // [rsp+0h] [rbp-48h] BYREF

v2[0] = a1;
result = LT_member(&userfuncpool, v2);
if ( result )
result = LT_found_leaf();
return result;
}

canonical_decompiled_code:
__int64 __fastcall func2(__int64 a1)
{
__int64 result; // rax
__int64 v2[9]; // [rsp+0h] [rbp-48h] BYREF

v2[0] = a1;
result = LT_member(&userfuncpool, v2);
if ( result )
result = LT_found_leaf();
return result;
}

original_code:
FuncRef lookup_user_function(char *name)
{
    UserDef udef;
    udef.name=name;
    if (LT_member(&userfuncpool, &(udef))) {
 return LT_found_leaf();
    } else {
 return 0;
    }
}

canonical_original_code:
struct FuncDef *lookup_user_function(char *name)
{
    struct UserDef udef;
    udef.name=name;
    if (LT_member(&userfuncpool, &(udef))) {
 return LT_found_leaf();
    } else {
 return 0;
    }
}

variable_types:
name
char *

variable_types: struct UserDef { char *name; char *description; char nr_args; char functype; unsigned int rettype; struct Prototype { unsigned int *type; int n; unsigned int restype; int max; int (*caller)(); } *prototype; char nr_local; struct Value { unsigned int type; union TVal { int ival; double rval; void *stval; int *iref; double *rref; void **stref; } val; } *localvar; char **localname; struct FuncSequence { char free_next; char free_alt; struct Expression { char type; char delta; unsigned int restype; union { int op; int arg; struct Expression *le; struct FuncDef { char *name; char *description; char nr_args; char functype; unsigned int rettype; void *prototype; } *ifunc; struct FuncDef *ufunc; } val; struct Expression *next; } *arglist; struct FuncSequence *next; struct FuncSequence *alternative; } *sequence; }


decompiled_code:
__int64 __fastcall call_user_function(__int64 a1, _QWORD *a2)
{
char *v3; // r13
char *v4; // r14
int v5; // ebx
char *v6; // r12
char *v7; // r12
int v8; // ebx

v3 = (char *)mm_malloc(16LL * *(char *)(a1 + 32));
memcpy(v3, *(const void **)(a1 + 40), 16LL * *(char *)(a1 + 32));
if ( *(char *)(a1 + 16) <= 0 )
{
v5 = 0;
}
else
{
v4 = v3;
v5 = 0;
do
{
CopyValue(v4, *a2);
++v5;
++a2;
v4 += 16;
}
while ( *(char *)(a1 + 16) > v5 );
}
if ( *(char *)(a1 + 32) > v5 )
{
v6 = &v3[16 * v5];
do
{
ConstructValue(v6);
++v5;
v6 += 16;
}
while ( *(char *)(a1 + 32) > v5 );
}
push_local_variables(v3);
push_eval_stack();
run_sequence(*(_QWORD *)(a1 + 56));
pop_eval_stack();
pop_local_variables();
if ( *(char *)(a1 + 32) > 0 )
{
v7 = v3;
v8 = 0;
do
{
DestructValue(v7);
++v8;
v7 += 16;
}
while ( *(char *)(a1 + 32) > v8 );
}
mm_free(v3);
return 0LL;
}

original_code:
int call_user_function(FuncRef userdef, Value **alist)
{
    UserDef *udef = (UserDef *) userdef;
    int i;
    Value *lv;
    lv = (Value*) mm_malloc(sizeof(Value)*(udef->nr_local));
    memcpy(lv, udef->localvar, sizeof(Value)*udef->nr_local);
    for (i=0; i<udef->nr_args; i++) {
        CopyValue(&lv[i], alist[i]);
    }
    for (;i<udef->nr_local;i++)
      ConstructValue(&lv[i]);
    push_local_variables(lv, udef->nr_local);
    push_eval_stack();
    run_sequence(udef->sequence);
    pop_eval_stack();
    pop_local_variables();
    for (i=0; i<udef->nr_local; i++)
      DestructValue(&lv[i]);
    mm_free(lv);
    return 0;
}

canonical_original_code:
int call_user_function(struct FuncDef *userdef, struct Value **alist)
{
    struct UserDef *udef = (UserDef *) userdef;
    int i;
    struct Value *lv;
    lv = (struct Value *) mm_malloc(sizeof(Value)*(udef->nr_local));
    memcpy(lv, udef->localvar, sizeof(Value)*udef->nr_local);
    for (i=0; i<udef->nr_args; i++) {
        CopyValue(&lv[i], alist[i]);
    }
    for (;i<udef->nr_local;i++)
      ConstructValue(&lv[i]);
    push_local_variables(lv, udef->nr_local);
    push_eval_stack();
    run_sequence(udef->sequence);
    pop_eval_stack();
    pop_local_variables();
    for (i=0; i<udef->nr_local; i++)
      DestructValue(&lv[i]);
    mm_free(lv);
    return 0;
}

variable_types: struct Value { unsigned int type; union TVal { int ival; double rval; void *stval; int *iref; double *rref; void **stref; } val; } **


original_code:
int user_define(char *name, char *description, Prototype *prototype,
  int nr_local,
  Value *localvar, char **localname, FuncSequenceRef *sequence)
{
    UserDef udef;
    udef.name=name;
    udef.description=description;
    udef.nr_args=((prototype)->n);
    udef.rettype=((prototype)->restype);
    udef.prototype=prototype;
    udef.localvar=localvar;
    udef.localname=localname;
    udef.sequence=sequence;
    udef.nr_local=nr_local;
    LT_insert(&userfuncpool, &(udef));
    return 1;
}

canonical_original_code:
int user_define(char *name, char *description, struct Prototype *prototype, int nr_local, struct Value *localvar, char **localname, struct FuncSequence *sequence)
{
    struct UserDef udef;
    udef.name=name;
    udef.description=description;
    udef.nr_args=((prototype)->n);
    udef.rettype=((prototype)->restype);
    udef.prototype=prototype;
    udef.localvar=localvar;
    udef.localname=localname;
    udef.sequence=sequence;
    udef.nr_local=nr_local;
    LT_insert(&userfuncpool, &(udef));
    return 1;
}

variable_types:
description
char *

variable_types: struct Value { unsigned int type; union TVal { int ival; double rval; void *stval; int *iref; double *rref; void **stref; } val; } *

variable_types:
localname
char **

variable_types: struct FuncSequence { char free_next; char free_alt; struct Expression { char type; char delta; unsigned int restype; union { int op; int arg; struct Expression *le; struct FuncDef { char *name; char *description; char nr_args; char functype; unsigned int rettype; void *prototype; } *ifunc; struct FuncDef *ufunc; } val; struct Expression *next; } *arglist; struct FuncSequence *next; struct FuncSequence *alternative; } *


decompiled_code:
__int64 __fastcall user_destroy(_QWORD *a1)
{
return userdef_free(a1);
}

canonical_decompiled_code:
__int64 __fastcall func5(_QWORD *a1)
{
return func0(a1);
}

original_code:
void user_destroy(FuncRef udef)
{
    userdef_free(udef);
}

canonical_original_code:
void user_destroy(struct FuncDef *udef)
{
    userdef_free(udef);
}


decompiled_code:
__int64 __fastcall proto_user(__int64 a1)
{
return *(_QWORD *)(a1 + 24);
}

canonical_decompiled_code:
__int64 __fastcall func6(__int64 a1)
{
return *(_QWORD *)(a1 + 24);
}

original_code:
Prototype *proto_user(FuncRef function)
{
    return ((UserDef*) function)->prototype;
}

canonical_original_code:
struct Prototype *proto_user(struct FuncDef *function)
{
    return ((struct UserDef *) function)->prototype;
}

return_type: struct Prototype { unsigned int *type; int n; unsigned int restype; int max; int (*caller)(); } *


decompiled_code:
__int64 __fastcall restype_user_function(__int64 a1)
{
return *(unsigned int *)(a1 + 20);
}

canonical_decompiled_code:
__int64 __fastcall func7(__int64 a1)
{
return *(unsigned int *)(a1 + 20);
}

original_code:
Type restype_user_function(FuncRef function)
{
    return ((UserDef*)function)->rettype;
}

canonical_original_code:
unsigned int restype_user_function(struct FuncDef *function)
{
    return ((struct UserDef *)function)->rettype;
}

return_type: unsigned int


decompiled_code:
__int64 __fastcall push_int(_QWORD *a1, int a2)
{
_DWORD *v2; // rax

v2 = (_DWORD *)freeint;
if ( freeint )
{
freeint = *(_QWORD *)freeint;
LABEL_3:
*(_QWORD *)v2 = *a1;
v2[2] = a2;
*a1 = v2;
return 1LL;
}
v2 = malloc(0x10uLL);
if ( v2 )
goto LABEL_3;
return 0LL;
}

canonical_decompiled_code:
__int64 __fastcall func0(_QWORD *a1, int a2)
{
_DWORD *v2; // rax

v2 = (_DWORD *)freeint;
if ( freeint )
{
freeint = *(_QWORD *)freeint;
LABEL_3:
*(_QWORD *)v2 = *a1;
v2[2] = a2;
*a1 = v2;
return 1LL;
}
v2 = malloc(0x10uLL);
if ( v2 )
goto LABEL_3;
return 0LL;
}

original_code:
int push_int(INTSTACK **s, int i)
{
    INTSTACK *h = freeint;
    if (!h)
 h = (INTSTACK*) malloc(sizeof(INTSTACK));
    else
 freeint = h->next;
    if (!h) return 0;
    h->next = *s;
    h->nr = i;
    *s = h;
    return 1;
}

canonical_original_code:
int push_int(struct INTSTACK **s, int i)
{
    struct INTSTACK *h = freeint;
    if (!h)
 h = (struct INTSTACK *) malloc(sizeof(INTSTACK));
    else
 freeint = h->next;
    if (!h) return 0;
    h->next = *s;
    h->nr = i;
    *s = h;
    return 1;
}

variable_types: struct INTSTACK { struct INTSTACK *next; int nr; } **

variable_types: i int


decompiled_code:
__int64 __fastcall pop_int(__int64 *a1)
{
__int64 v1; // rax
unsigned int v2; // edx
__int64 v3; // rcx

v1 = *a1;
v2 = 0;
if ( *a1 )
{
v2 = *(_DWORD *)(v1 + 8);
v3 = *(_QWORD *)v1;
*(_QWORD *)v1 = freeint;
freeint = *a1;
*a1 = v3;
}
return v2;
}

canonical_decompiled_code:
__int64 __fastcall func1(__int64 *a1)
{
__int64 v1; // rax
unsigned int v2; // edx
__int64 v3; // rcx

v1 = *a1;
v2 = 0;
if ( *a1 )
{
v2 = *(_DWORD *)(v1 + 8);
v3 = *(_QWORD *)v1;
*(_QWORD *)v1 = freeint;
freeint = *a1;
*a1 = v3;
}
return v2;
}

original_code:
int pop_int(INTSTACK **s)
{
    if (*s) {
 int i=(*s)->nr;
 INTSTACK *h = (*s)->next;
 (*s)->next = freeint;
 freeint = (*s);
 (*s) = h;
 return i;
    } else return 0;
}

canonical_original_code:
int pop_int(struct INTSTACK **s)
{
    if (*s) {
 int i = (*s)->nr;
 struct INTSTACK *h = (*s)->next;
 (*s)->next = freeint;
 freeint = (*s);
 (*s) = h;
 return i;
    } else return 0;
}

variable_types: struct INTSTACK { struct INTSTACK *next; int nr; } *


decompiled_code:
__int64 __fastcall remove_int(__int64 *a1, int a2)
{
__int64 result; // rax
__int64 *v3; // rcx
__int64 v4; // rdx
char v5; // di

result = *a1;
v3 = 0LL;
if ( *a1 )
{
while ( *(_DWORD *)(result + 8) == a2 )
{
v3 = (__int64 *)result;
if ( !*(_QWORD *)result )
{
*(_QWORD *)result = freeint;
result = *a1;
freeint = *a1;
*a1 = 0LL;
return result;
}
result = *(_QWORD *)result;
}
if ( v3 )
{
*v3 = freeint;
freeint = *a1;
*a1 = result;
}
v4 = freeint;
v5 = 0;
do
{
if ( *(_DWORD *)(result + 8) == a2 )
{
*v3 = *(_QWORD *)result;
*(_QWORD *)result = v4;
v4 = result;
result = *v3;
v5 = 1;
}
else
{
v3 = (__int64 *)result;
result = *(_QWORD *)result;
}
}
while ( result );
if ( v5 )
freeint = v4;
}
return result;
}

canonical_decompiled_code:
__int64 __fastcall func2(__int64 *a1, int a2)
{
__int64 result; // rax
__int64 *v3; // rcx
__int64 v4; // rdx
char v5; // di

result = *a1;
v3 = 0LL;
if ( *a1 )
{
while ( *(_DWORD *)(result + 8) == a2 )
{
v3 = (__int64 *)result;
if ( !*(_QWORD *)result )
{
*(_QWORD *)result = freeint;
result = *a1;
freeint = *a1;
*a1 = 0LL;
return result;
}
result = *(_QWORD *)result;
}
if ( v3 )
{
*v3 = freeint;
freeint = *a1;
*a1 = result;
}
v4 = freeint;
v5 = 0;
do
{
if ( *(_DWORD *)(result + 8) == a2 )
{
*v3 = *(_QWORD *)result;
*(_QWORD *)result = v4;
v4 = result;
result = *v3;
v5 = 1;
}
else
{
v3 = (__int64 *)result;
result = *(_QWORD *)result;
}
}
while ( result );
if ( v5 )
freeint = v4;
}
return result;
}

original_code:
void remove_int(INTSTACK **s, int nr)
{
    if (*s) {
 INTSTACK *h = *s;
 INTSTACK *g = 0;
 while (h && h->nr==nr) {
     g = h;
     h = h->next;
 }
 if (g) {
     g->next = freeint;
     freeint = *s;
     *s = h;
 }
 while (h) {
     if (h->nr==nr) {
  g->next = h->next;
  h->next = freeint;
  freeint = h;
  h = g->next;
     } else {
  g = h;
  h = h->next;
     }
 }
    }
}

canonical_original_code:
void remove_int(struct INTSTACK **s, int nr)
{
    if (*s) {
 struct INTSTACK *h = *s;
 struct INTSTACK *g = 0;
 while (h && h->nr==nr) {
     g = h;
     h = h->next;
 }
 if (g) {
     g->next = freeint;
     freeint = *s;
     *s = h;
 }
 while (h) {
     if (h->nr==nr) {
  g->next = h->next;
  h->next = freeint;
  freeint = h;
  h = g->next;
     } else {
  g = h;
  h = h->next;
     }
 }
    }
}

variable_types: nr int

user_defined_types: struct INTSTACK { struct INTSTACK *next; int nr; }


decompiled_code:
void __fastcall free_int(__int64 a1)
{
_QWORD *v1; // rax
_QWORD *v2; // rdx

if ( a1 )
{
v1 = (_QWORD *)a1;
do
{
v2 = v1;
v1 = (_QWORD *)*v1;
}
while ( v1 );
*v2 = freeint;
freeint = a1;
}
}

canonical_decompiled_code:
void __fastcall func3(__int64 a1)
{
_QWORD *v1; // rax
_QWORD *v2; // rdx

if ( a1 )
{
v1 = (_QWORD *)a1;
do
{
v2 = v1;
v1 = (_QWORD *)*v1;
}
while ( v1 );
*v2 = freeint;
freeint = a1;
}
}

original_code:
void free_int(INTSTACK *s)
{
    if (s) {
 INTSTACK *h = s;
 while (h->next) h=h->next;
 h->next = freeint;
 freeint = s;
    }
}

canonical_original_code:
void free_int(struct INTSTACK *s)
{
    if (s) {
 struct INTSTACK *h = s;
 while (h->next) h=h->next;
 h->next = freeint;
 freeint = s;
    }
}


decompiled_code:
__int64 value_cmp()
{
return 0xFFFFFFFFLL;
}

canonical_decompiled_code:
__int64 func0()
{
return 0xFFFFFFFFLL;
}

original_code:
static int value_cmp(const void *val1, const void *val2)
{
  return -1;
}

canonical_original_code:
static int value_cmp(void *val1, void *val2)
{
  return -1;
}


decompiled_code:
__int64 __fastcall argint_cmp(_DWORD *a1, _DWORD *a2)
{
int v4; // esi
int v5; // edx
__int64 result; // rax

v4 = *(_DWORD *)(valuepool + *a1 * dword_890 + 8);
v5 = *(_DWORD *)(valuepool + *a2 * dword_890 + 8);
result = 0xFFFFFFFFLL;
if ( v4 >= v5 )
result = v4 != v5;
return result;
}

canonical_decompiled_code:
__int64 __fastcall func1(_DWORD *a1, _DWORD *a2)
{
int v4; // esi
int v5; // edx
__int64 result; // rax

v4 = *(_DWORD *)(valuepool + *a1 * dword_890 + 8);
v5 = *(_DWORD *)(valuepool + *a2 * dword_890 + 8);
result = 0xFFFFFFFFLL;
if ( v4 >= v5 )
result = v4 != v5;
return result;
}

original_code:
static int argint_cmp(const void *arg1, const void *arg2)
{
  int i,j;
  i= (*((Value*) (((char*)(&valuepool)->arr) + ((*((int*)arg1)))*((&valuepool)->size)))).val.ival;
  j= (*((Value*) (((char*)(&valuepool)->arr) + ((*((int*)arg2)))*((&valuepool)->size)))).val.ival;
  return (i<j?-1:(i==j?0:1));
}

canonical_original_code:
static int argint_cmp(void *arg1, void *arg2)
{
  int i; int j;
  i= (*((struct Value *) (((char *)(&valuepool)->arr) + ((*((int *)arg1)))*((&valuepool)->size)))).val.ival;
  j= (*((struct Value *) (((char *)(&valuepool)->arr) + ((*((int *)arg2)))*((&valuepool)->size)))).val.ival;
  return (i<j?-1:(i==j?0:1));
}

variable_types: j int


decompiled_code:
__int64 __fastcall argreal_cmp(_DWORD *a1, _DWORD *a2)
{
double v2; // xmm1_8
double v3; // xmm0_8
__int64 result; // rax

v2 = *(double *)(valuepool + *a1 * dword_890 + 8);
v3 = *(double *)(valuepool + *a2 * dword_890 + 8);
result = 0xFFFFFFFFLL;
if ( v3 <= v2 )
result = v2 != v3;
return result;
}

canonical_decompiled_code:
__int64 __fastcall func2(_DWORD *a1, _DWORD *a2)
{
double v2; // xmm1_8
double v3; // xmm0_8
__int64 result; // rax

v2 = *(double *)(valuepool + *a1 * dword_890 + 8);
v3 = *(double *)(valuepool + *a2 * dword_890 + 8);
result = 0xFFFFFFFFLL;
if ( v3 <= v2 )
result = v2 != v3;
return result;
}

original_code:
static int argreal_cmp(const void *arg1, const void *arg2)
{
  double i,j;
  i= (*((Value*) (((char*)(&valuepool)->arr) + ((*((int*)arg1)))*((&valuepool)->size)))).val.rval;
  j= (*((Value*) (((char*)(&valuepool)->arr) + ((*((int*)arg2)))*((&valuepool)->size)))).val.rval;
  return (i<j?-1:(i==j?0:1));
}

canonical_original_code:
static int argreal_cmp(void *arg1, void *arg2)
{
  double i; double j;
  i= (*((struct Value *) (((char *)(&valuepool)->arr) + ((*((int *)arg1)))*((&valuepool)->size)))).val.rval;
  j= (*((struct Value *) (((char *)(&valuepool)->arr) + ((*((int *)arg2)))*((&valuepool)->size)))).val.rval;
  return (i<j?-1:(i==j?0:1));
}

variable_types: i double

variable_types: j double


decompiled_code:
__int64 __fastcall var_free(_QWORD *a1)
{
return mm_free(*a1);
}

canonical_decompiled_code:
__int64 __fastcall func3(_QWORD *a1)
{
return mm_free(*a1);
}

original_code:
static void var_free(void *var)
{
    mm_free(((Variable*)var)->name);
}

canonical_original_code:
static void var_free(void *var)
{
    mm_free(((struct Variable *)var)->name);
}

variable_types:
var
void *

user_defined_types: struct Variable { char *name; int value; }


decompiled_code:
int __fastcall var_cmp(const char **a1, const char **a2)
{
return strcmp(*a1, *a2);
}

canonical_decompiled_code:
int __fastcall func4(const char **a1, const char **a2)
{
return strcmp(*a1, *a2);
}

original_code:
static int var_cmp(const void *var1, const void *var2)
{
  return strcmp(((Variable*)var1)->name, ((Variable*)var2)->name);
}

canonical_original_code:
static int var_cmp(void *var1, void *var2)
{
  return strcmp(((struct Variable *)var1)->name, ((struct Variable *)var2)->name);
}


decompiled_code:
__int64 __fastcall argstring_cmp(_DWORD *a1, _DWORD *a2)
{
return Ustrcmp(*(_QWORD *)(valuepool + *a1 * dword_890 + 8), *(_QWORD *)(valuepool + *a2 * dword_890 + 8));
}

canonical_decompiled_code:
__int64 __fastcall func5(_DWORD *a1, _DWORD *a2)
{
return Ustrcmp(*(_QWORD *)(valuepool + *a1 * dword_890 + 8), *(_QWORD *)(valuepool + *a2 * dword_890 + 8));
}

original_code:
static int argstring_cmp(const void *arg1, const void *arg2)
{
  Uchar *s,*t;
  s= (*((Value*) (((char*)(&valuepool)->arr) + ((*((int*)arg1)))*((&valuepool)->size)))).val.stval;
  t= (*((Value*) (((char*)(&valuepool)->arr) + ((*((int*)arg2)))*((&valuepool)->size)))).val.stval;
  return Ustrcmp(s,t);
}

canonical_original_code:
static int argstring_cmp(void *arg1, void *arg2)
{
  unsigned short *s; unsigned short *t;
  s= (*((struct Value *) (((char *)(&valuepool)->arr) + ((*((int *)arg1)))*((&valuepool)->size)))).val.stval;
  t= (*((struct Value *) (((char *)(&valuepool)->arr) + ((*((int *)arg2)))*((&valuepool)->size)))).val.stval;
  return Ustrcmp(s,t);
}

variable_types:
s
unsigned short *

variable_types:
t
unsigned short *


decompiled_code:
__int64 __fastcall define_global_variable(int a1, __int64 a2)
{
unsigned int v2; // ebp
__int64 v4; // [rsp+0h] [rbp-38h] BYREF
int v5; // [rsp+8h] [rbp-30h]
__int128 v6[2]; // [rsp+10h] [rbp-28h] BYREF

v6[0] = (__int128)_mm_load_si128((const __m128i *)&empty_val);
LODWORD(v6[0]) = a1;
ConstructValue(v6);
v2 = dword_888;
v4 = a2;
v5 = dword_888;
fx_add(&valuepool, v6);
LT_insert(&allvars, &v4);
return v2;
}

canonical_decompiled_code:
__int64 __fastcall func6(int a1, __int64 a2)
{
unsigned int v2; // ebp
__int64 v4; // [rsp+0h] [rbp-38h] BYREF
int v5; // [rsp+8h] [rbp-30h]
__int128 v6[2]; // [rsp+10h] [rbp-28h] BYREF

v6[0] = (__int128)_mm_load_si128((const __m128i *)&empty_val);
LODWORD(v6[0]) = a1;
ConstructValue(v6);
v2 = dword_888;
v4 = a2;
v5 = dword_888;
fx_add(&valuepool, v6);
LT_insert(&allvars, &v4);
return v2;
}

original_code:
Argument define_global_variable(Type type, char *name)
{
    Value v;
    Variable vr;
    Argument r;
    v=empty_val;
    v.type=type;
    ConstructValue(&v);
    r = ((&valuepool)->nr);
    vr.name=name;
    vr.value=r;
    fx_add(&valuepool, &(v));
    LT_insert(&allvars, &vr);
    return r;
}

canonical_original_code:
int define_global_variable(unsigned int type, char *name)
{
    struct Value v;
    struct Variable vr;
    int r;
    v=empty_val;
    v.type=type;
    ConstructValue(&v);
    r = ((&valuepool)->nr);
    vr.name=name;
    vr.value=r;
    fx_add(&valuepool, &(v));
    LT_insert(&allvars, &vr);
    return r;
}

variable_types:
type
unsigned int

variable_types:
name
char *

variable_types: struct Value { unsigned int type; union TVal { int ival; double rval; void *stval; int *iref; double *rref; void **stref; } val; }

variable_types: struct Variable { char *name; int value; }

variable_types: r int


decompiled_code:
__int64 __fastcall define_program_variable(int a1, __int64 a2, __int64 a3)
{
unsigned int v3; // ebx
__int64 v5; // [rsp+0h] [rbp-28h] BYREF
int v6; // [rsp+8h] [rbp-20h]
__int128 v7; // [rsp+10h] [rbp-18h] BYREF

DWORD1(v7) = HIDWORD(_mm_load_si128((const __m128i *)&empty_val).m128i_u64[0]);
LODWORD(v7) = a1 | 0x8000;
*((_QWORD *)&v7 + 1) = a3;
v3 = dword_888;
v5 = a2;
v6 = dword_888;
fx_add(&valuepool, &v7);
LT_insert(&allvars, &v5);
return v3;
}

canonical_decompiled_code:
__int64 __fastcall func7(int a1, __int64 a2, __int64 a3)
{
unsigned int v3; // ebx
__int64 v5; // [rsp+0h] [rbp-28h] BYREF
int v6; // [rsp+8h] [rbp-20h]
__int128 v7; // [rsp+10h] [rbp-18h] BYREF

DWORD1(v7) = HIDWORD(_mm_load_si128((const __m128i *)&empty_val).m128i_u64[0]);
LODWORD(v7) = a1 | 0x8000;
*((_QWORD *)&v7 + 1) = a3;
v3 = dword_888;
v5 = a2;
v6 = dword_888;
fx_add(&valuepool, &v7);
LT_insert(&allvars, &v5);
return v3;
}

original_code:
Argument define_program_variable(Type type, char *name, void *address)
{
    Value v;
    Variable vr;
    Argument r;
    v=empty_val;
    v.type=((type)|0x8000);
    v.val.stval=address;
    r = ((&valuepool)->nr);
    vr.name=name;
    vr.value=r;
    fx_add(&valuepool, &(v));
    LT_insert(&allvars, &vr);
    return r;
}

canonical_original_code:
int define_program_variable(unsigned int type, char *name, void *address)
{
    struct Value v;
    struct Variable vr;
    int r;
    v=empty_val;
    v.type=((type)|0x8000);
    v.val.stval=address;
    r = ((&valuepool)->nr);
    vr.name=name;
    vr.value=r;
    fx_add(&valuepool, &(v));
    LT_insert(&allvars, &vr);
    return r;
}

variable_types:
address
void *


decompiled_code:
__int64 __fastcall define_int_constant(__int32 a1)
{
__int64 v1; // rdx
__int64 result; // rax
int v3; // [rsp+Ch] [rbp-1Ch] BYREF
__m128i v4; // [rsp+10h] [rbp-18h] BYREF

v4 = _mm_load_si128((const __m128i *)&empty_val);
v4.m128i_i32[0] = 16385;
v4.m128i_i32[2] = a1;
*(__m128i *)valuepool = _mm_loadu_si128(&v4);
v3 = 0;
if ( !LT_member(&intconsts, &v3) )
{
v3 = dword_888;
fx_add(&valuepool, &v4);
LT_insert(&intconsts, &v3);
}
v1 = LT_found_leaf();
result = 0LL;
if ( v1 )
result = *(unsigned int *)LT_found_leaf();
return result;
}

canonical_decompiled_code:
__int64 __fastcall func8(__int32 a1)
{
__int64 v1; // rdx
__int64 result; // rax
int v3; // [rsp+Ch] [rbp-1Ch] BYREF
__m128i v4; // [rsp+10h] [rbp-18h] BYREF

v4 = _mm_load_si128((const __m128i *)&empty_val);
v4.m128i_i32[0] = 16385;
v4.m128i_i32[2] = a1;
*(__m128i *)valuepool = _mm_loadu_si128(&v4);
v3 = 0;
if ( !LT_member(&intconsts, &v3) )
{
v3 = dword_888;
fx_add(&valuepool, &v4);
LT_insert(&intconsts, &v3);
}
v1 = LT_found_leaf();
result = 0LL;
if ( v1 )
result = *(unsigned int *)LT_found_leaf();
return result;
}

original_code:
Argument define_int_constant(int n)
{
    Value v;
    Argument r;
    v=empty_val;
    v.type=((1)|0x4000);
    v.val.ival=n;
    (*((Value*) (((char*)(&valuepool)->arr) + ((0))*((&valuepool)->size))))=v;
    r=0;
    if (!LT_member(&intconsts,&r)) {
 r = ((&valuepool)->nr);
 fx_add(&valuepool, &(v));
 LT_insert(&intconsts, &r);
    }
    if (LT_found_leaf())
        return *((Argument*)LT_found_leaf());
    else
        return 0;
}

canonical_original_code:
int define_int_constant(int n)
{
    struct Value v;
    int r;
    v=empty_val;
    v.type=((1)|0x4000);
    v.val.ival=n;
    (*((struct Value *) (((char *)(&valuepool)->arr) + ((0))*((&valuepool)->size))))=v;
    r=0;
    if (!LT_member(&intconsts,&r)) {
 r = ((&valuepool)->nr);
 fx_add(&valuepool, &(v));
 LT_insert(&intconsts, &r);
    }
    if (LT_found_leaf())
        return *((int *)LT_found_leaf());
    else
        return 0;
}

variable_types: n int


decompiled_code:
__int64 __fastcall define_string_constant(void *src)
{
__int64 v1; // rdx
__int64 result; // rax
size_t v3; // rbp
void *v4; // rax
__int64 v5; // r12
int v6; // [rsp+Ch] [rbp-2Ch] BYREF
__m128i v7; // [rsp+10h] [rbp-28h] BYREF

v7.m128i_i32[1] = HIDWORD(_mm_load_si128((const __m128i *)&empty_val).m128i_u64[0]);
v7.m128i_i32[0] = 16386;
v7.m128i_i64[1] = (__int64)src;
*(__m128i *)valuepool = _mm_loadu_si128(&v7);
v6 = 0;
if ( !LT_member(&stringconsts, &v6) )
{
v3 = 2LL * (int)(Ustrlen(src) + 1);
v4 = (void *)mm_malloc(v3);
v5 = (__int64)v4;
if ( v4 )
{
memcpy(v4, src, v3);
v7.m128i_i64[1] = v5;
increase_refcount(v5, &free);
v6 = dword_888;
fx_add(&valuepool, &v7);
LT_insert(&stringconsts, &v6);
}
}
v1 = LT_found_leaf();
result = 0LL;
if ( v1 )
result = *(unsigned int *)LT_found_leaf();
return result;
}

canonical_decompiled_code:
__int64 __fastcall func9(void *src)
{
__int64 v1; // rdx
__int64 result; // rax
size_t v3; // rbp
void *v4; // rax
__int64 v5; // r12
int v6; // [rsp+Ch] [rbp-2Ch] BYREF
__m128i v7; // [rsp+10h] [rbp-28h] BYREF

v7.m128i_i32[1] = HIDWORD(_mm_load_si128((const __m128i *)&empty_val).m128i_u64[0]);
v7.m128i_i32[0] = 16386;
v7.m128i_i64[1] = (__int64)src;
*(__m128i *)valuepool = _mm_loadu_si128(&v7);
v6 = 0;
if ( !LT_member(&stringconsts, &v6) )
{
v3 = 2LL * (int)(Ustrlen(src) + 1);
v4 = (void *)mm_malloc(v3);
v5 = (__int64)v4;
if ( v4 )
{
memcpy(v4, src, v3);
v7.m128i_i64[1] = v5;
increase_refcount(v5, &free);
v6 = dword_888;
fx_add(&valuepool, &v7);
LT_insert(&stringconsts, &v6);
}
}
v1 = LT_found_leaf();
result = 0LL;
if ( v1 )
result = *(unsigned int *)LT_found_leaf();
return result;
}

original_code:
Argument define_string_constant(Uchar *s)
{
    Value v;
    Argument r;
    v=empty_val;
    v.type=((2)|0x4000);
    v.val.stval=s;
    (*((Value*) (((char*)(&valuepool)->arr) + ((0))*((&valuepool)->size))))=v;
    r=0;
    if (!LT_member(&stringconsts,&r)) {
 int i;
 Uchar *c;
 i=Ustrlen(s)+1;
 c=mm_malloc(sizeof(Uchar)*i);
 if (c) {
     memcpy(c,s,sizeof(Uchar)*i);
     v.val.stval=c;
     increase_refcount(c,free);
     r = ((&valuepool)->nr);
     fx_add(&valuepool, &(v));
     LT_insert(&stringconsts, &r);
 }
    }
    if (LT_found_leaf()) return *((Argument*)LT_found_leaf());
    else return 0;
}

canonical_original_code:
int define_string_constant(unsigned short *s)
{
    struct Value v;
    int r;
    v=empty_val;
    v.type=((2)|0x4000);
    v.val.stval=s;
    (*((struct Value *) (((char *)(&valuepool)->arr) + ((0))*((&valuepool)->size))))=v;
    r=0;
    if (!LT_member(&stringconsts,&r)) {
 int i;
 unsigned short *c;
 i=Ustrlen(s)+1;
 c=mm_malloc(sizeof(Uchar)*i);
 if (c) {
     memcpy(c,s,sizeof(Uchar)*i);
     v.val.stval=c;
     increase_refcount(c,free);
     r = ((&valuepool)->nr);
     fx_add(&valuepool, &(v));
     LT_insert(&stringconsts, &r);
 }
    }
    if (LT_found_leaf()) return *((int *)LT_found_leaf());
    else return 0;
}

variable_types:
c
unsigned short *


decompiled_code:
__int64 __fastcall define_real_constant(double a1)
{
__int64 v1; // rdx
__int64 result; // rax
int v3; // [rsp+Ch] [rbp-1Ch] BYREF
__m128i v4; // [rsp+10h] [rbp-18h] BYREF

v4.m128i_i32[1] = HIDWORD(_mm_load_si128((const __m128i *)&empty_val).m128i_u64[0]);
v4.m128i_i32[0] = 16387;
*(double *)&v4.m128i_i64[1] = a1;
*(__m128i *)valuepool = _mm_loadu_si128(&v4);
v3 = 0;
if ( !LT_member(&realconsts, &v3) )
{
v3 = dword_888;
fx_add(&valuepool, &v4);
LT_insert(&realconsts, &v3);
}
v1 = LT_found_leaf();
result = 0LL;
if ( v1 )
result = *(unsigned int *)LT_found_leaf();
return result;
}

canonical_decompiled_code:
__int64 __fastcall func10(double a1)
{
__int64 v1; // rdx
__int64 result; // rax
int v3; // [rsp+Ch] [rbp-1Ch] BYREF
__m128i v4; // [rsp+10h] [rbp-18h] BYREF

v4.m128i_i32[1] = HIDWORD(_mm_load_si128((const __m128i *)&empty_val).m128i_u64[0]);
v4.m128i_i32[0] = 16387;
*(double *)&v4.m128i_i64[1] = a1;
*(__m128i *)valuepool = _mm_loadu_si128(&v4);
v3 = 0;
if ( !LT_member(&realconsts, &v3) )
{
v3 = dword_888;
fx_add(&valuepool, &v4);
LT_insert(&realconsts, &v3);
}
v1 = LT_found_leaf();
result = 0LL;
if ( v1 )
result = *(unsigned int *)LT_found_leaf();
return result;
}

original_code:
Argument define_real_constant(double d)
{
    Value v;
    Argument r;
    v=empty_val;
    v.type=((3)|0x4000);
    v.val.rval=d;
    (*((Value*) (((char*)(&valuepool)->arr) + ((0))*((&valuepool)->size))))=v;
    r=0;
    if (!LT_member(&realconsts,&r)) {
 r = ((&valuepool)->nr);
 fx_add(&valuepool, &(v));
 LT_insert(&realconsts, &r);
    }
    if (LT_found_leaf()) return *((Argument*)LT_found_leaf());
    else return 0;
}

canonical_original_code:
int define_real_constant(double d)
{
    struct Value v;
    int r;
    v=empty_val;
    v.type=((3)|0x4000);
    v.val.rval=d;
    (*((struct Value *) (((char *)(&valuepool)->arr) + ((0))*((&valuepool)->size))))=v;
    r=0;
    if (!LT_member(&realconsts,&r)) {
 r = ((&valuepool)->nr);
 fx_add(&valuepool, &(v));
 LT_insert(&realconsts, &r);
    }
    if (LT_found_leaf()) return *((int *)LT_found_leaf());
    else return 0;
}

variable_types: d double


decompiled_code:
void new_local_variables()
{
++scope_count;
}

canonical_decompiled_code:
void func11()
{
++scope_count;
}

original_code:
void new_local_variables(void)
{
    scope_count++;
}

canonical_original_code:
void new_local_variables()
{
    scope_count++;
}


decompiled_code:
__int64 __fastcall define_local_variable(int a1, const char *a2)
{
size_t v2; // rax
char *v3; // rbx
char *src; // [rsp+8h] [rbp-30h] BYREF
int v6[10]; // [rsp+10h] [rbp-28h] BYREF

v2 = strlen(a2);
v3 = (char *)mm_malloc(v2 + 1);
strcpy(v3, a2);
src = v3;
if ( !scope_count )
return define_global_variable(a1, (__int64)v3);
fx_add(&localname, &src);
v6[0] = a1;
fx_add(&localvar, v6);
fx_add(&localscope, &scope_count);
return (unsigned int)-dword_808;
}

canonical_decompiled_code:
__int64 __fastcall func12(int a1, const char *a2)
{
size_t v2; // rax
char *v3; // rbx
char *src; // [rsp+8h] [rbp-30h] BYREF
int v6[10]; // [rsp+10h] [rbp-28h] BYREF

v2 = strlen(a2);
v3 = (char *)mm_malloc(v2 + 1);
strcpy(v3, a2);
src = v3;
if ( !scope_count )
return func6(a1, (__int64)v3);
fx_add(&localname, &src);
v6[0] = a1;
fx_add(&localvar, v6);
fx_add(&localscope, &scope_count);
return (unsigned int)-dword_808;
}

original_code:
Argument define_local_variable(Type type, char *name)
{
    Value v;
    char *mname;
    mname=mm_malloc(strlen(name)+1);
    strcpy(mname, name);
    name=mname;
    if (!scope_count) {
 return define_global_variable(type, name);
    } else {
 fx_add(&localname, &(name));
 v.type=type;
 fx_add(&localvar, &(v));
 fx_add(&localscope, &(scope_count));
 return -((&localvar)->nr);
    }
}

canonical_original_code:
int define_local_variable(unsigned int type, char *name)
{
    struct Value v;
    char *mname;
    mname=mm_malloc(strlen(name)+1);
    strcpy(mname, name);
    name=mname;
    if (!scope_count) {
 return define_global_variable(type, name);
    } else {
 fx_add(&localname, &(name));
 v.type=type;
 fx_add(&localvar, &(v));
 fx_add(&localscope, &(scope_count));
 return -((&localvar)->nr);
    }
}

variable_types:
mname
char *


decompiled_code:
__int64 __fastcall get_local_variables(_DWORD *a1)
{
__int64 v1; // r12
int v2; // ebx
__int64 v3; // rdi

v1 = 0LL;
if ( scope_count > 0 )
{
v2 = scope_count - 1;
scope_count = v2;
if ( !v2 )
{
v1 = fx_copy(&localvar);
if ( a1 )
*a1 = dword_808;
fx_clear(&localvar);
fx_clear(&localscope);
if ( dword_7E8 > 0 )
{
do
{
v3 = *(_QWORD *)(localname + *((_DWORD *)&localname + 4) * v2);
if ( v3 )
mm_free(v3);
++v2;
}
while ( *((_DWORD *)&localname + 2) > v2 );
}
fx_clear(&localname);
}
}
return v1;
}

canonical_decompiled_code:
__int64 __fastcall func13(_DWORD *a1)
{
__int64 v1; // r12
int v2; // ebx
__int64 v3; // rdi

v1 = 0LL;
if ( scope_count > 0 )
{
v2 = scope_count - 1;
scope_count = v2;
if ( !v2 )
{
v1 = fx_copy(&localvar);
if ( a1 )
*a1 = dword_808;
fx_clear(&localvar);
fx_clear(&localscope);
if ( dword_7E8 > 0 )
{
do
{
v3 = *(_QWORD *)(localname + *((_DWORD *)&localname + 4) * v2);
if ( v3 )
mm_free(v3);
++v2;
}
while ( *((_DWORD *)&localname + 2) > v2 );
}
fx_clear(&localname);
}
}
return v1;
}

original_code:
Value *get_local_variables(int *nrargs)
{
    Value *retval=0;
    if (scope_count>0) {
 scope_count--;
 if (!scope_count) {
     int i;
     retval = (Value*) fx_copy(&localvar);
     if (nrargs) *nrargs=((&localvar)->nr);
     fx_clear(&localvar);
     fx_clear(&localscope);
     for (i=0; i<((&localname)->nr); i++) {
  if ((*((char**) (((char*)(&localname)->arr) + ((i))*((&localname)->size))))) mm_free((*((char**) (((char*)(&localname)->arr) + ((i))*((&localname)->size)))));
     }
     fx_clear(&localname);
 }
    }
    return retval;
}

canonical_original_code:
struct Value *get_local_variables(int *nrargs)
{
    struct Value *retval = 0;
    if (scope_count>0) {
 scope_count--;
 if (!scope_count) {
     int i;
     retval = (struct Value *) fx_copy(&localvar);
     if (nrargs) *nrargs=((&localvar)->nr);
     fx_clear(&localvar);
     fx_clear(&localscope);
     for (i=0; i<((&localname)->nr); i++) {
  if ((*((char **) (((char *)(&localname)->arr) + ((i))*((&localname)->size))))) mm_free((*((char **) (((char *)(&localname)->arr) + ((i))*((&localname)->size)))));
     }
     fx_clear(&localname);
 }
    }
    return retval;
}

variable_types:
nrargs
int *

variable_types: struct Value { unsigned int type; union TVal { int ival; double rval; void *stval; int *iref; double *rref; void **stref; } val; } *

variable_types: i int


decompiled_code:
__int64 __fastcall push_local_variables(__int64 a1, int a2)
{
__int64 result; // rax

result = mm_malloc(24LL);
*(_QWORD *)(result + 16) = lvstack;
*(_QWORD *)result = a1;
*(_DWORD *)(result + 8) = a2;
lvstack = result;
return result;
}

canonical_decompiled_code:
__int64 __fastcall func14(__int64 a1, int a2)
{
__int64 result; // rax

result = mm_malloc(24LL);
*(_QWORD *)(result + 16) = lvstack;
*(_QWORD *)result = a1;
*(_DWORD *)(result + 8) = a2;
lvstack = result;
return result;
}

original_code:
void push_local_variables(Value *list, int nr)
{
    LVStack *lv;
    lv = mm_malloc(sizeof(LVStack));
    lv->prev=lvstack;
    lv->lvlist=list;
    lv->length=nr;
    lvstack=lv;
}

canonical_original_code:
void push_local_variables(struct Value *list, int nr)
{
    struct LVStack *lv;
    lv = mm_malloc(sizeof(LVStack));
    lv->prev=lvstack;
    lv->lvlist=list;
    lv->length=nr;
    lvstack=lv;
}

variable_types: nr int

variable_types: struct LVStack { struct Value { unsigned int type; union TVal { int ival; double rval; void *stval; int *iref; double *rref; void **stref; } val; } *lvlist; int length; struct LVStack *prev; } *

user_defined_types: struct LVStack { struct Value *lvlist; int length; struct LVStack *prev; }


decompiled_code:
__int64 pop_local_variables()
{
__int64 v0; // rdi
__int64 result; // rax

v0 = lvstack;
if ( lvstack )
{
lvstack = *(_QWORD *)(lvstack + 16);
result = mm_free(v0);
}
return result;
}

canonical_decompiled_code:
__int64 func15()
{
__int64 v0; // rdi
__int64 result; // rax

v0 = lvstack;
if ( lvstack )
{
lvstack = *(_QWORD *)(lvstack + 16);
result = mm_free(v0);
}
return result;
}

original_code:
void pop_local_variables(void)
{
    LVStack *lv;
    if (lvstack) {
 lv=lvstack;
 lvstack=lv->prev;
 mm_free(lv);
    }
}

canonical_original_code:
void pop_local_variables()
{
    struct LVStack *lv;
    if (lvstack) {
 lv=lvstack;
 lvstack=lv->prev;
 mm_free(lv);
    }
}


decompiled_code:
__int64 __fastcall get_value(int a1)
{
__int64 v1; // rdx

if ( a1 >= 0 )
return valuepool + dword_890 * a1;
v1 = lvstack;
if ( lvstack )
{
if ( ~a1 >= *(_DWORD *)(lvstack + 8) )
v1 = 0LL;
else
v1 = *(_QWORD *)lvstack + 16LL * -a1 - 16;
}
return v1;
}

canonical_decompiled_code:
__int64 __fastcall func16(int a1)
{
__int64 v1; // rdx

if ( a1 >= 0 )
return valuepool + dword_890 * a1;
v1 = lvstack;
if ( lvstack )
{
if ( ~a1 >= *(_DWORD *)(lvstack + 8) )
v1 = 0LL;
else
v1 = *(_QWORD *)lvstack + 16LL * -a1 - 16;
}
return v1;
}

original_code:
Value *get_value(Argument arg)
{
    if (arg<0) {
 if (lvstack && (-arg-1)<lvstack->length) {
     return &(lvstack->lvlist[-arg-1]);
 } else return 0;
    } else {
 return &((*((Value*) (((char*)(&valuepool)->arr) + ((arg))*((&valuepool)->size)))));
    }
}

canonical_original_code:
struct Value *get_value(int arg)
{
    if (arg<0) {
 if (lvstack && (-arg-1)<lvstack->length) {
     return &(lvstack->lvlist[-arg-1]);
 } else return 0;
    } else {
 return &((*((struct Value *) (((char *)(&valuepool)->arr) + ((arg))*((&valuepool)->size)))));
    }
}

variable_types: arg int

return_type: struct Value { unsigned int type; union TVal { int ival; double rval; void *stval; int *iref; double *rref; void **stref; } val; } *


decompiled_code:
__int64 __fastcall get_type(int a1)
{
__int64 result; // rax

if ( a1 >= 0 )
return *(unsigned int *)(valuepool + dword_890 * a1);
if ( scope_count )
return *(unsigned int *)(localvar + dword_810 * ~a1);
if ( !lvstack )
return 0LL;
result = 0LL;
if ( ~a1 < *(_DWORD *)(lvstack + 8) )
result = *(unsigned int *)(*(_QWORD *)lvstack + 16LL * -a1 - 16);
return result;
}

canonical_decompiled_code:
__int64 __fastcall func17(int a1)
{
__int64 result; // rax

if ( a1 >= 0 )
return *(unsigned int *)(valuepool + dword_890 * a1);
if ( scope_count )
return *(unsigned int *)(localvar + dword_810 * ~a1);
if ( !lvstack )
return 0LL;
result = 0LL;
if ( ~a1 < *(_DWORD *)(lvstack + 8) )
result = *(unsigned int *)(*(_QWORD *)lvstack + 16LL * -a1 - 16);
return result;
}

original_code:
Type get_type(Argument arg)
{
    if (arg<0) {
 if (scope_count) {
     return (*((Value*) (((char*)(&localvar)->arr) + ((-arg-1))*((&localvar)->size)))).type;
 } else if (lvstack && (-arg-1)<lvstack->length) {
     return lvstack->lvlist[-arg-1].type;
 } else return 0;
    } else {
 return (*((Value*) (((char*)(&valuepool)->arr) + ((arg))*((&valuepool)->size)))).type;
    }
}

canonical_original_code:
unsigned int get_type(int arg)
{
    if (arg<0) {
 if (scope_count) {
     return (*((struct Value *) (((char *)(&localvar)->arr) + ((-arg-1))*((&localvar)->size)))).type;
 } else if (lvstack && (-arg-1)<lvstack->length) {
     return lvstack->lvlist[-arg-1].type;
 } else return 0;
    } else {
 return (*((struct Value *) (((char *)(&valuepool)->arr) + ((arg))*((&valuepool)->size)))).type;
    }
}


decompiled_code:
__int64 get_local_names()
{
__int64 v0; // rbx
int v1; // eax

v0 = fx_copy(&localname);
if ( dword_7E8 > 0 )
{
v1 = 0;
do
*(_QWORD *)(localname + *((_DWORD *)&localname + 4) * v1++) = 0LL;
while ( *((_DWORD *)&localname + 2) > v1 );
}
fx_clear(&localname);
return v0;
}

canonical_decompiled_code:
__int64 func18()
{
__int64 v0; // rbx
int v1; // eax

v0 = fx_copy(&localname);
if ( dword_7E8 > 0 )
{
v1 = 0;
do
*(_QWORD *)(localname + *((_DWORD *)&localname + 4) * v1++) = 0LL;
while ( *((_DWORD *)&localname + 2) > v1 );
}
fx_clear(&localname);
return v0;
}

original_code:
char **get_local_names(void)
{
    char **retval;
    int i;
    retval = (char** )fx_copy(&localname);
    for (i=0; i<((&localname)->nr); i++) {
 (*((char**) (((char*)(&localname)->arr) + ((i))*((&localname)->size))))=0;
    }
    fx_clear(&localname);
    return retval;
}

canonical_original_code:
char **get_local_names()
{
    char **retval;
    int i;
    retval = (char ** )fx_copy(&localname);
    for (i=0; i<((&localname)->nr); i++) {
 (*((char **) (((char *)(&localname)->arr) + ((i))*((&localname)->size))))=0;
    }
    fx_clear(&localname);
    return retval;
}

variable_types:
retval
char **

return_type: char **


decompiled_code:
__int64 __fastcall destroy_local_names(__int64 *a1)
{
__int64 v2; // rdi
_QWORD *v3; // rbx

v2 = *a1;
if ( v2 )
{
v3 = a1 + 1;
do
{
mm_free(v2);
v2 = *v3++;
}
while ( v2 );
}
return mm_free(a1);
}

canonical_decompiled_code:
__int64 __fastcall func19(__int64 *a1)
{
__int64 v2; // rdi
_QWORD *v3; // rbx

v2 = *a1;
if ( v2 )
{
v3 = a1 + 1;
do
{
mm_free(v2);
v2 = *v3++;
}
while ( v2 );
}
return mm_free(a1);
}

original_code:
void destroy_local_names(char **local_names)
{
    int i;
    for (i=0;local_names[i]; i++) mm_free(local_names[i]);
    mm_free(local_names);
}


decompiled_code:
__int64 __fastcall lookup_variable(char *s1)
{
int v1; // ebp
int v2; // ebx
__int64 v3; // r15
int *v4; // r12
int v5; // er13
int v6; // edx
__int64 result; // rax
__int64 v8; // rdx
__int64 v9; // [rsp+0h] [rbp-58h]
int v10; // [rsp+8h] [rbp-50h]
int v11; // [rsp+Ch] [rbp-4Ch]
char *v12; // [rsp+10h] [rbp-48h] BYREF

v1 = scope_count;
v2 = dword_7C8;
if ( dword_7C8 )
{
v3 = localname;
v9 = -dword_7D0;
v4 = (int *)(localscope + (dword_7C8 - 1) * dword_7D0);
v10 = dword_7F0;
v5 = dword_7F0 * (dword_7C8 - 1);
while ( 1 )
{
v11 = v2--;
v6 = v1;
if ( v1 > *v4 )
v1 = *v4;
if ( *v4 <= v6 && !strcmp(s1, *(const char **)(v3 + v5)) )
break;
v4 = (int *)((char *)v4 + v9);
v5 -= v10;
if ( !v2 )
goto LABEL_9;
}
result = (unsigned int)-v11;
}
else
{
LABEL_9:
v12 = s1;
v8 = LT_member(&allvars, &v12);
result = 0LL;
if ( v8 )
result = *(unsigned int *)(v8 + 8);
}
return result;
}

canonical_decompiled_code:
__int64 __fastcall func20(char *s1)
{
int v1; // ebp
int v2; // ebx
__int64 v3; // r15
int *v4; // r12
int v5; // er13
int v6; // edx
__int64 result; // rax
__int64 v8; // rdx
__int64 v9; // [rsp+0h] [rbp-58h]
int v10; // [rsp+8h] [rbp-50h]
int v11; // [rsp+Ch] [rbp-4Ch]
char *v12; // [rsp+10h] [rbp-48h] BYREF

v1 = scope_count;
v2 = dword_7C8;
if ( dword_7C8 )
{
v3 = localname;
v9 = -dword_7D0;
v4 = (int *)(localscope + (dword_7C8 - 1) * dword_7D0);
v10 = dword_7F0;
v5 = dword_7F0 * (dword_7C8 - 1);
while ( 1 )
{
v11 = v2--;
v6 = v1;
if ( v1 > *v4 )
v1 = *v4;
if ( *v4 <= v6 && !strcmp(s1, *(const char **)(v3 + v5)) )
break;
v4 = (int *)((char *)v4 + v9);
v5 -= v10;
if ( !v2 )
goto LABEL_9;
}
result = (unsigned int)-v11;
}
else
{
LABEL_9:
v12 = s1;
v8 = LT_member(&allvars, &v12);
result = 0LL;
if ( v8 )
result = *(unsigned int *)(v8 + 8);
}
return result;
}

original_code:
Argument lookup_variable(char *name)
{
    int in_scope = scope_count;
    int i,s;
    Variable *v;
    Variable tv;
    i=((&localscope)->nr);
    while (i) {
 i--;
 s=(*((int*) (((char*)(&localscope)->arr) + ((i))*((&localscope)->size))));
 if (s<in_scope) in_scope=s;
 if (s==in_scope) {
     if (!strcmp(name, (*((char**) (((char*)(&localname)->arr) + ((i))*((&localname)->size)))))) {
  return (-i-1);
     }
 }
    }
    tv.name=name;
    v = LT_member(&allvars, &tv);
    if (!v) return 0;
    else return (v->value);
}

canonical_original_code:
int lookup_variable(char *name)
{
    int in_scope = scope_count;
    int i; int s;
    struct Variable *v;
    struct Variable tv;
    i=((&localscope)->nr);
    while (i) {
 i--;
 s=(*((int *) (((char *)(&localscope)->arr) + ((i))*((&localscope)->size))));
 if (s<in_scope) in_scope=s;
 if (s==in_scope) {
     if (!strcmp(name, (*((char **) (((char *)(&localname)->arr) + ((i))*((&localname)->size)))))) {
  return (-i-1);
     }
 }
    }
    tv.name=name;
    v = LT_member(&allvars, &tv);
    if (!v) return 0;
    else return (v->value);
}

variable_types: s int

variable_types: struct Variable { char *name; int value; } *


decompiled_code:
__int64 __fastcall lookup_arg_type(int a1)
{
__int64 result; // rax

if ( a1 < 0 )
result = *(unsigned int *)(localvar + dword_810 * ~a1);
else
result = *(unsigned int *)(valuepool + dword_890 * a1);
return result;
}

canonical_decompiled_code:
__int64 __fastcall func21(int a1)
{
__int64 result; // rax

if ( a1 < 0 )
result = *(unsigned int *)(localvar + dword_810 * ~a1);
else
result = *(unsigned int *)(valuepool + dword_890 * a1);
return result;
}

original_code:
Type lookup_arg_type(Argument arg)
{
    if (arg<0) {
        return (*((Value*) (((char*)(&localvar)->arr) + ((-arg-1))*((&localvar)->size)))).type;
    } else {
 return (*((Value*) (((char*)(&valuepool)->arr) + ((arg))*((&valuepool)->size)))).type;
    }
}

canonical_original_code:
unsigned int lookup_arg_type(int arg)
{
    if (arg<0) {
        return (*((struct Value *) (((char *)(&localvar)->arr) + ((-arg-1))*((&localvar)->size)))).type;
    } else {
 return (*((struct Value *) (((char *)(&valuepool)->arr) + ((arg))*((&valuepool)->size)))).type;
    }
}


decompiled_code:
__int64 variable_init()
{
__int64 v1; // [rsp+0h] [rbp-18h] BYREF

return fx_add(&valuepool, &v1);
}

canonical_decompiled_code:
__int64 func22()
{
__int64 v1; // [rsp+0h] [rbp-18h] BYREF

return fx_add(&valuepool, &v1);
}

original_code:
void variable_init(void)
{
    Value v;
    fx_add(&valuepool, &(v));
}

canonical_original_code:
void variable_init()
{
    struct Value v;
    fx_add(&valuepool, &(v));
}

variable_types: struct Value { unsigned int type; union TVal { int ival; double rval; void *stval; int *iref; double *rref; void **stref; } val; }


decompiled_code:
_BOOL8 __fastcall popup_line_diff(_WORD *a1, _WORD *a2)
{
if ( !a1 || !a2 )
return 1LL;
while ( 1 )
{
if ( !*a1 )
return *a2 != 0;
if ( *a2 != *a1 )
break;
++a1;
++a2;
}
return 1LL;
}

canonical_decompiled_code:
_BOOL8 __fastcall func0(_WORD *a1, _WORD *a2)
{
if ( !a1 || !a2 )
return 1LL;
while ( 1 )
{
if ( !*a1 )
return *a2 != 0;
if ( *a2 != *a1 )
break;
++a1;
++a2;
}
return 1LL;
}

original_code:
static int popup_line_diff(Uchar *s, Uchar *t)
{
  if (!s || !t) return 1;
  while (*s || *t) {
    if (*s == *t) {
      s++;
      t++;
    } else return 1;
  }
  return 0;
}

canonical_original_code:
static int popup_line_diff(unsigned short *s, unsigned short *t)
{
  if (!s || !t) return 1;
  while (*s || *t) {
    if (*s == *t) {
      s++;
      t++;
    } else return 1;
  }
  return 0;
}

variable_types:
s
unsigned short *

variable_types:
t
unsigned short *


decompiled_code:
void __fastcall popup_clear_items(__int64 a1)
{
_QWORD *v1; // rbp
_QWORD *v2; // rbx
int v3; // eax

v1 = *(_QWORD **)(a1 + 40);
while ( v1 )
{
v2 = v1;
v1 = (_QWORD *)v1[5];
v3 = *((_DWORD *)v2 + 6);
switch ( v3 )
{
case 1:
mm_free(*v2);
break;
case 2:
mm_free(*v2);
free_sequence(v2[4]);
break;
case 0:
mm_free(v2);
break;
}
if ( (_QWORD *)last_added == v2 )
last_added = 0LL;
mm_free(v2);
}
*(_QWORD *)(a1 + 48) = 0LL;
*(_QWORD *)(a1 + 40) = 0LL;
}

canonical_decompiled_code:
void __fastcall func2(__int64 a1)
{
_QWORD *v1; // rbp
_QWORD *v2; // rbx
int v3; // eax

v1 = *(_QWORD **)(a1 + 40);
while ( v1 )
{
v2 = v1;
v1 = (_QWORD *)v1[5];
v3 = *((_DWORD *)v2 + 6);
switch ( v3 )
{
case 1:
mm_free(*v2);
break;
case 2:
mm_free(*v2);
free_sequence(v2[4]);
break;
case 0:
mm_free(v2);
break;
}
if ( (_QWORD *)last_added == v2 )
last_added = 0LL;
mm_free(v2);
}
*(_QWORD *)(a1 + 48) = 0LL;
*(_QWORD *)(a1 + 40) = 0LL;
}

original_code:
static void popup_clear_items(PopupMenu *menu)
{
  if (menu->firstline) {
    PopupLine *pl, *pln;
    pl=menu->firstline;
    while (pl) {
      pln=pl->next;
      switch (pl->linetype) {
      case 0:
 mm_free(pl);
 break;
      case 2:
 mm_free(pl->string);
 free_sequence(pl->line.func);
 break;
      case 1:
 mm_free(pl->string);
 break;
      default:
 break;
      }
      if (pl==last_added) last_added=((void *)0);
      mm_free(pl);
      pl=pln;
    }
  }
  menu->firstline=menu->lastline=((void *)0);
}

canonical_original_code:
static void popup_clear_items(struct PopupMenu *menu)
{
  if (menu->firstline) {
    struct PopupLine *pl; struct PopupLine *pln;
    pl=menu->firstline;
    while (pl) {
      pln=pl->next;
      switch (pl->linetype) {
      case 0:
 mm_free(pl);
 break;
      case 2:
 mm_free(pl->string);
 free_sequence(pl->line.func);
 break;
      case 1:
 mm_free(pl->string);
 break;
      default:
 break;
      }
      if (pl==last_added) last_added=((void *)0);
      mm_free(pl);
      pl=pln;
    }
  }
  menu->firstline=menu->lastline=((void *)0);
}

variable_types: struct PopupMenu { unsigned short *title; unsigned short *help; unsigned short *name; int rightleft; int pinable; int width; struct PopupLine { unsigned short *string; int enabled; int width; int defaultline; int linetype; union { struct FuncSequence { char free_next; char free_alt; struct Expression { char type; char delta; unsigned int restype; union { int op; int arg; struct Expression *le; struct FuncDef { char *name; char *description; char nr_args; char functype; unsigned int rettype; void *prototype; } *ifunc; struct FuncDef *ufunc; } val; struct Expression *next; } *arglist; struct FuncSequence *next; struct FuncSequence *alternative; } *func; struct PopupMenu *menu; int thickness; } line; struct PopupLine *next; } *firstline; } *

variable_types: struct PopupLine { unsigned short *string; int enabled; int width; int defaultline; int linetype; union { struct FuncSequence { char free_next; char free_alt; struct Expression { char type; char delta; unsigned int restype; union { int op; int arg; struct Expression *le; struct FuncDef { char *name; char *description; char nr_args; char functype; unsigned int rettype; void *prototype; } *ifunc; struct FuncDef *ufunc; } val; struct Expression *next; } *arglist; struct FuncSequence *next; struct FuncSequence *alternative; } *func; struct PopupMenu { unsigned short *title; unsigned short *help; unsigned short *name; int rightleft; int pinable; int width; struct PopupLine *firstline; } *menu; int thickness; } line; struct PopupLine *next; } *

user_defined_types: struct PopupLine { unsigned short *string; int enabled; int width; int defaultline; int linetype; union { struct FuncSequence *func; struct PopupMenu *menu; int thickness; } line; struct PopupLine *next; }


decompiled_code:
void __fastcall popup_set_title(__int64 *a1, __int64 a2)
{
__int64 v2; // rax
__int64 v3; // rax

v2 = Ustrlen(a2);
v3 = mm_malloc(2 * v2 + 2);
*a1 = v3;
Ustrcpy(v3, a2);
popup_clear_items((__int64)a1);
}

canonical_decompiled_code:
void __fastcall func3(__int64 *a1, __int64 a2)
{
__int64 v2; // rax
__int64 v3; // rax

v2 = Ustrlen(a2);
v3 = mm_malloc(2 * v2 + 2);
*a1 = v3;
Ustrcpy(v3, a2);
func2((__int64)a1);
}

original_code:
void popup_set_title(PopupMenu *menu, Uchar *title)
{
  menu->title = mm_malloc(sizeof(Uchar)*(Ustrlen(title)+1));
  Ustrcpy(menu->title,title);
  popup_clear_items(menu);
}

canonical_original_code:
void popup_set_title(struct PopupMenu *menu, unsigned short *title)
{
  menu->title = mm_malloc(sizeof(Uchar)*(Ustrlen(title)+1));
  Ustrcpy(menu->title,title);
  popup_clear_items(menu);
}

variable_types:
title
unsigned short *

user_defined_types: struct PopupMenu { unsigned short *title; unsigned short *help; unsigned short *name; int rightleft; int pinable; int width; struct PopupLine *firstline; }


decompiled_code:
size_t __fastcall popup_add_line(__int64 a1, _WORD *a2, __int64 a3)
{
const void *v4; // rax
__int64 v5; // rbx
size_t result; // rax

if ( !a1 )
return fwrite("No menu.", 1uLL, 8uLL, stderr);
v4 = (const void *)popup_find_line(a1, a2);
v5 = (__int64)v4;
if ( v4 )
{
printf("pl: %p\n", v4);
if ( *(_DWORD *)(v5 + 24) == 2 )
free_sequence(*(_QWORD *)(v5 + 32));
result = mm_free(*(_QWORD *)v5);
}
else
{
v5 = mm_malloc(56LL);
*(_QWORD *)v5 = 0LL;
*(_QWORD *)(v5 + 8) = 0LL;
*(_QWORD *)(v5 + 16) = 0LL;
*(_QWORD *)(v5 + 24) = 0LL;
*(_QWORD *)(v5 + 32) = 0LL;
*(_QWORD *)(v5 + 40) = 0LL;
*(_QWORD *)(v5 + 48) = 0LL;
result = *(_QWORD *)(a1 + 48);
if ( result )
{
*(_QWORD *)(result + 40) = v5;
result = *(_QWORD *)(a1 + 48);
*(_QWORD *)(v5 + 48) = result;
*(_QWORD *)(a1 + 48) = v5;
}
else
{
*(_QWORD *)(a1 + 48) = v5;
*(_QWORD *)(a1 + 40) = v5;
}
}
*(_DWORD *)(v5 + 24) = 2;
*(_QWORD *)(v5 + 32) = a3;
*(_DWORD *)(v5 + 8) = 1;
*(_QWORD *)v5 = a2;
last_added = v5;
return result;
}

original_code:
void popup_add_line(PopupMenu *menu, Uchar *line, FuncSequenceRef *func)
{
  PopupLine *pl;
  if (!menu) { fprintf(stderr,"No menu."); return; }
  pl = popup_find_line(menu, line);
  if (pl) {
    printf("pl: %p\n",pl);
    if (pl->linetype==2) free_sequence(pl->line.func);
    mm_free(pl->string);
  } else {
    pl = mm_malloc(sizeof(PopupLine));
    memset(pl,0,sizeof(PopupLine));
    if (menu->lastline) {
      menu->lastline->next=pl;
      pl->prev=menu->lastline;
      menu->lastline=pl;
    } else
      menu->firstline=menu->lastline=pl;
  }
  pl->linetype=2;
  pl->line.func=func;
  pl->enabled=1;
  pl->string=line;
  last_added=pl;
}

canonical_original_code:
void popup_add_line(struct PopupMenu *menu, unsigned short *line, struct FuncSequence *func)
{
  struct PopupLine *pl;
  if (!menu) { fprintf(stderr,"No menu."); return; }
  pl = popup_find_line(menu, line);
  if (pl) {
    printf("pl: %p\n",pl);
    if (pl->linetype==2) free_sequence(pl->line.func);
    mm_free(pl->string);
  } else {
    pl = mm_malloc(sizeof(PopupLine));
    memset(pl,0,sizeof(PopupLine));
    if (menu->lastline) {
      menu->lastline->next=pl;
      pl->prev=menu->lastline;
      menu->lastline=pl;
    } else
      menu->firstline=menu->lastline=pl;
  }
  pl->linetype=2;
  pl->line.func=func;
  pl->enabled=1;
  pl->string=line;
  last_added=pl;
}

variable_types:
line
unsigned short *

variable_types:
func
struct FuncSequence *


decompiled_code:
void __fastcall popup_make_default(__int64 a1)
{
__int64 v1; // rdx
__int64 i; // rax

if ( a1 && *(_QWORD *)(a1 + 48) )
{
v1 = last_added;
if ( last_added )
{
*(_DWORD *)(last_added + 20) = 1;
for ( i = *(_QWORD *)(a1 + 40); i; i = *(_QWORD *)(i + 40) )
{
if ( v1 != i )
*(_DWORD *)(i + 20) = 0;
}
}
}
else
{
fwrite("No menu(line).", 1uLL, 0xEuLL, stderr);
}
}

canonical_decompiled_code:
void __fastcall func5(__int64 a1)
{
__int64 v1; // rdx
__int64 i; // rax

if ( a1 && *(_QWORD *)(a1 + 48) )
{
v1 = last_added;
if ( last_added )
{
*(_DWORD *)(last_added + 20) = 1;
for ( i = *(_QWORD *)(a1 + 40); i; i = *(_QWORD *)(i + 40) )
{
if ( v1 != i )
*(_DWORD *)(i + 20) = 0;
}
}
}
else
{
fwrite("No menu(line).", 1uLL, 0xEuLL, stderr);
}
}

original_code:
void popup_make_default(PopupMenu *menu)
{
  PopupLine *pl;
  if (!menu || !menu->lastline) { fprintf(stderr,"No menu(line)."); return; }
  if (last_added) {
    last_added->defaultline=1;
    pl= menu->firstline;
    while (pl) {
      if (pl!=last_added) pl->defaultline=0;
      pl=pl->next;
    }
  }
}

canonical_original_code:
void popup_make_default(struct PopupMenu *menu)
{
  struct PopupLine *pl;
  if (!menu || !menu->lastline) { fprintf(stderr,"No menu(line)."); return; }
  if (last_added) {
    last_added->defaultline=1;
    pl= menu->firstline;
    while (pl) {
      if (pl!=last_added) pl->defaultline=0;
      pl=pl->next;
    }
  }
}


decompiled_code:
size_t __fastcall popup_direction(__int64 a1, int a2)
{
size_t result; // rax

if ( !a1 )
return fwrite("No menu.", 1uLL, 8uLL, stderr);
*(_DWORD *)(a1 + 24) = a2;
return result;
}

canonical_decompiled_code:
size_t __fastcall func6(__int64 a1, int a2)
{
size_t result; // rax

if ( !a1 )
return fwrite("No menu.", 1uLL, 8uLL, stderr);
*(_DWORD *)(a1 + 24) = a2;
return result;
}

original_code:
void popup_direction(PopupMenu *menu, int rtol)
{
  if (!menu) { fprintf(stderr,"No menu."); return; }
  menu->rightleft = rtol;
}

canonical_original_code:
void popup_direction(struct PopupMenu *menu, int rtol)
{
  if (!menu) { fprintf(stderr,"No menu."); return; }
  menu->rightleft = rtol;
}

variable_types: rtol int


decompiled_code:
size_t __fastcall popup_pinable(__int64 a1)
{
size_t result; // rax

if ( !a1 )
return fwrite("No menu.", 1uLL, 8uLL, stderr);
*(_DWORD *)(a1 + 28) = 1;
return result;
}

canonical_decompiled_code:
size_t __fastcall func7(__int64 a1)
{
size_t result; // rax

if ( !a1 )
return fwrite("No menu.", 1uLL, 8uLL, stderr);
*(_DWORD *)(a1 + 28) = 1;
return result;
}

original_code:
void popup_pinable(PopupMenu *menu)
{
  if (!menu) { fprintf(stderr,"No menu."); return; }
  menu->pinable = 1;
}

canonical_original_code:
void popup_pinable(struct PopupMenu *menu)
{
  if (!menu) { fprintf(stderr,"No menu."); return; }
  menu->pinable = 1;
}


decompiled_code:
__int64 __fastcall popup_disable(__int64 a1, _WORD *a2)
{
__int64 v2; // rbx
__int64 result; // rax

result = (__int64)popup_define(a1);
if ( result )
{
result = popup_find_line(result, a2);
v2 = result;
}
if ( v2 )
*(_DWORD *)(v2 + 8) = 0;
return result;
}

canonical_decompiled_code:
__int64 __fastcall func8(__int64 a1, _WORD *a2)
{
__int64 v2; // rbx
__int64 result; // rax

result = (__int64)popup_define(a1);
if ( result )
{
result = func1(result, a2);
v2 = result;
}
if ( v2 )
*(_DWORD *)(v2 + 8) = 0;
return result;
}

original_code:
void popup_disable(Uchar *menuID, Uchar *label)
{
  PopupMenu *menu;
  PopupLine *pl;
  menu = popup_define(menuID);
  if (menu) pl = popup_find_line(menu, label);
  if (pl) pl->enabled=0;
}

canonical_original_code:
void popup_disable(unsigned short *menuID, unsigned short *label)
{
  struct PopupMenu *menu;
  struct PopupLine *pl;
  menu = popup_define(menuID);
  if (menu) pl = popup_find_line(menu, label);
  if (pl) pl->enabled=0;
}

variable_types:
menuID
unsigned short *

variable_types:
label
unsigned short *


decompiled_code:
__int64 __fastcall popup_enable(__int64 a1, _WORD *a2)
{
__int64 v2; // rbx
__int64 result; // rax

result = (__int64)popup_define(a1);
if ( result )
{
result = popup_find_line(result, a2);
v2 = result;
}
if ( v2 )
*(_DWORD *)(v2 + 8) = 1;
return result;
}

canonical_decompiled_code:
__int64 __fastcall func9(__int64 a1, _WORD *a2)
{
__int64 v2; // rbx
__int64 result; // rax

result = (__int64)popup_define(a1);
if ( result )
{
result = func1(result, a2);
v2 = result;
}
if ( v2 )
*(_DWORD *)(v2 + 8) = 1;
return result;
}

original_code:
void popup_enable(Uchar *menuID, Uchar *label)
{
  PopupMenu *menu;
  PopupLine *pl;
  menu = popup_define(menuID);
  if (menu) pl = popup_find_line(menu, label);
  if (pl) pl->enabled=1;
}

canonical_original_code:
void popup_enable(unsigned short *menuID, unsigned short *label)
{
  struct PopupMenu *menu;
  struct PopupLine *pl;
  menu = popup_define(menuID);
  if (menu) pl = popup_find_line(menu, label);
  if (pl) pl->enabled=1;
}


original_code:
static Uchar *lang_handle(int lowvalue, Attribute *attr, RedirectFunc *func)
{
    int i;
    i = lowvalue&0x3ff;
    if (i<(sizeof(isolang)/sizeof(ISOLANG))) attr->language=i;
    else if (1023-i < (sizeof(unoflang)/sizeof(UNOFLANG))) attr->language=i;
    return 0;
}

canonical_original_code:
static unsigned short *lang_handle(int lowvalue, struct _attribs *attr, int (**func)(unsigned short))
{
    int i;
    i = lowvalue&0x3ff;
    if (i<(sizeof(isolang)/sizeof(ISOLANG))) attr->language=i;
    else if (1023-i < (sizeof(unoflang)/sizeof(UNOFLANG))) attr->language=i;
    return 0;
}

variable_types: lowvalue int

variable_types: struct _attribs { int font; int fgcolor; int bgcolor; int language; int country; int direction; int text; int plane; void *object; int pos; int posdelta; } *

variable_types:
func
int (**)(unsigned short)

variable_types: i int


decompiled_code:
__int64 __fastcall lang_print(__int16 a1)
{
unsigned int v1; // edi
const char *v2; // rdi
__int64 v3; // rbx
__int64 v4; // rbp
int v5; // er12
int v6; // eax
int v7; // edx
__int64 result; // rax
int v9; // ebp
__int64 v10; // rax
bool v11; // zf

v1 = a1 & 0x3FF;
if ( v1 > 0x1B1 )
{
v11 = v1 == 1023;
v2 = "unknown";
if ( v11 )
v2 = "Klingon (from Star Trek)";
}
else
{
v2 = (&off_13D0)[3 * (int)v1];
}
v3 = translate(v2);
v4 = translate("Language");
v5 = Ustrlen(v3);
v6 = Ustrlen(v4);
v7 = set_string_size(&langbuf, &langbufsize, (unsigned int)(v5 + v6 + 5));
result = 0LL;
if ( v7 )
{
*(_WORD *)langbuf = 91;
Ustrcpy(langbuf + 2, v4);
v9 = Ustrlen(langbuf);
*(_WORD *)(langbuf + 2LL * v9) = 58;
Ustrcpy(langbuf + 2LL * v9 + 2, v3);
v10 = (int)(v9 + Ustrlen(langbuf + 2LL * v9 + 2) + 1);
*(_WORD *)(langbuf + 2 * v10) = 93;
*(_WORD *)(langbuf + 2 * v10 + 2) = 0;
result = langbuf;
}
return result;
}

canonical_decompiled_code:
__int64 __fastcall func1(__int16 a1)
{
unsigned int v1; // edi
const char *v2; // rdi
__int64 v3; // rbx
__int64 v4; // rbp
int v5; // er12
int v6; // eax
int v7; // edx
__int64 result; // rax
int v9; // ebp
__int64 v10; // rax
bool v11; // zf

v1 = a1 & 0x3FF;
if ( v1 > 0x1B1 )
{
v11 = v1 == 1023;
v2 = "unknown";
if ( v11 )
v2 = "Klingon (from Star Trek)";
}
else
{
v2 = (&off_13D0)[3 * (int)v1];
}
v3 = translate(v2);
v4 = translate("Language");
v5 = Ustrlen(v3);
v6 = Ustrlen(v4);
v7 = set_string_size(&langbuf, &langbufsize, (unsigned int)(v5 + v6 + 5));
result = 0LL;
if ( v7 )
{
*(_WORD *)langbuf = 91;
Ustrcpy(langbuf + 2, v4);
v9 = Ustrlen(langbuf);
*(_WORD *)(langbuf + 2LL * v9) = 58;
Ustrcpy(langbuf + 2LL * v9 + 2, v3);
v10 = (int)(v9 + Ustrlen(langbuf + 2LL * v9 + 2) + 1);
*(_WORD *)(langbuf + 2 * v10) = 93;
*(_WORD *)(langbuf + 2 * v10 + 2) = 0;
result = langbuf;
}
return result;
}

original_code:
static Uchar *lang_print(int lowvalue, Attribute *attr, RedirectFunc *func)
{
    int i;
    char *name;
    Uchar *unname;
    char *lang;
    Uchar *unlang;
    i = lowvalue&0x3ff;
    if (i<(sizeof(isolang)/sizeof(ISOLANG))) name=isolang[i].fullname;
    else if (1023-i<(sizeof(unoflang)/sizeof(UNOFLANG))) name=unoflang[1023-i].fullname;
    else name="unknown";
    unname=translate(name);
    unlang=translate("Language");
    i=Ustrlen(unname)+Ustrlen(unlang)+5;
    if (!set_string_size(&langbuf, &langbufsize, i)) return 0;
    langbuf[0]='[';
    Ustrcpy(langbuf+1, unlang);
    i=Ustrlen(langbuf);
    langbuf[i++]=':';
    Ustrcpy(langbuf+i, unname);
    i=i+Ustrlen(langbuf+i);
    langbuf[i++]=']';
    langbuf[i]='\0';
    return langbuf;
}

canonical_original_code:
static unsigned short *lang_print(int lowvalue, struct _attribs *attr, int (**func)(unsigned short))
{
    int i;
    char *name;
    unsigned short *unname;
    char *lang;
    unsigned short *unlang;
    i = lowvalue&0x3ff;
    if (i<(sizeof(isolang)/sizeof(ISOLANG))) name=isolang[i].fullname;
    else if (1023-i<(sizeof(unoflang)/sizeof(UNOFLANG))) name=unoflang[1023-i].fullname;
    else name="unknown";
    unname=translate(name);
    unlang=translate("Language");
    i=Ustrlen(unname)+Ustrlen(unlang)+5;
    if (!set_string_size(&langbuf, &langbufsize, i)) return 0;
    langbuf[0]='[';
    Ustrcpy(langbuf+1, unlang);
    i=Ustrlen(langbuf);
    langbuf[i++]=':';
    Ustrcpy(langbuf+i, unname);
    i=i+Ustrlen(langbuf+i);
    langbuf[i++]=']';
    langbuf[i]='\0';
    return langbuf;
}

variable_types:
name
char *

variable_types:
unname
unsigned short *

variable_types:
lang
char *

variable_types:
unlang
unsigned short *

user_defined_types: struct _attribs { int font; int fgcolor; int bgcolor; int language; int country; int direction; int text; int plane; void *object; int pos; int posdelta; }


decompiled_code:
int lang_markup_init()
{
int result; // eax
__int64 v1; // rax
const char *v2; // rax

result = add_markup_handler(56196LL, lang_print, lang_handle);
if ( !result )
{
v1 = translate("Unable to add language handler.\n");
v2 = (const char *)UstrtoLocale(v1);
result = fprintf(stderr, v2);
}
return result;
}

canonical_decompiled_code:
int func2()
{
int result; // eax
__int64 v1; // rax
const char *v2; // rax

result = add_markup_handler(56196LL, lang_print, lang_handle);
if ( !result )
{
v1 = translate("Unable to add language handler.\n");
v2 = (const char *)UstrtoLocale(v1);
result = fprintf(stderr, v2);
}
return result;
}

original_code:
void lang_markup_init(void)
{
    if (!add_markup_handler(LangAttrib, lang_print, lang_handle)) {
 fprintf(stderr, UstrtoLocale(translate("Unable to add language handler.\n")));
    }
}

canonical_original_code:
void lang_markup_init()
{
    if (!add_markup_handler(LangAttrib, lang_print, lang_handle)) {
 fprintf(stderr, UstrtoLocale(translate("Unable to add language handler.\n")));
    }
}


decompiled_code:
int __fastcall checkbox_draw(__int64 a1)
{
struct _XGC *v1; // rax
struct _XGC *v2; // rax

if ( !*(_DWORD *)(a1 + 8) )
return XClearWindow(display, *(_QWORD *)a1);
v1 = (struct _XGC *)get_GC(0LL, 0LL, 0LL);
XDrawLine(display, *(_QWORD *)a1, v1, 0, 0, 8, 8);
v2 = (struct _XGC *)get_GC(0LL, 0LL, 0LL);
return XDrawLine(display, *(_QWORD *)a1, v2, 0, 8, 8, 0);
}

canonical_decompiled_code:
int __fastcall func0(__int64 a1)
{
struct _XGC *v1; // rax
struct _XGC *v2; // rax

if ( !*(_DWORD *)(a1 + 8) )
return XClearWindow(display, *(_QWORD *)a1);
v1 = (struct _XGC *)get_GC(0LL, 0LL, 0LL);
XDrawLine(display, *(_QWORD *)a1, v1, 0, 0, 8, 8);
v2 = (struct _XGC *)get_GC(0LL, 0LL, 0LL);
return XDrawLine(display, *(_QWORD *)a1, v2, 0, 8, 8, 0);
}

original_code:
static void checkbox_draw(void *data)
{
    CHECKBOXINFO *cbinfo = (CHECKBOXINFO *) data;
    if (cbinfo->check) {
        XDrawLine(display, cbinfo->win_id, get_GC(Normal, 0,0),
    0, 0, 9 -1, 9 -1);
 XDrawLine(display, cbinfo->win_id, get_GC(Normal, 0,0),
    0, 9 -1, 9 -1, 0);
    } else {
 XClearWindow(display, cbinfo->win_id);
    }
}

canonical_original_code:
static void checkbox_draw(void *data)
{
    struct CHECKBOXINFO *cbinfo = (CHECKBOXINFO *) data;
    if (cbinfo->check) {
        XDrawLine(display, cbinfo->win_id, get_GC(Normal, 0,0),
    0, 0, 9 -1, 9 -1);
 XDrawLine(display, cbinfo->win_id, get_GC(Normal, 0,0),
    0, 9 -1, 9 -1, 0);
    } else {
 XClearWindow(display, cbinfo->win_id);
    }
}

variable_types:
data
void *

variable_types: struct CHECKBOXINFO { unsigned long win_id; int check; struct CHECKBOXINFO *next; } *


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

checkbox_mask = 10282LL;
checkbox_attr.background_pixel = white_pixel;
checkbox_attr.border_pixel = black_pixel;
checkbox_attr.win_gravity = 1;
result = colormap;
checkbox_attr.colormap = colormap;
checkbox_attr.event_mask = 229388LL;
return result;
}

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

checkbox_mask = 10282LL;
checkbox_attr.background_pixel = white_pixel;
checkbox_attr.border_pixel = black_pixel;
checkbox_attr.win_gravity = 1;
result = colormap;
checkbox_attr.colormap = colormap;
checkbox_attr.event_mask = 229388LL;
return result;
}

original_code:
void checkbox_init(void)
{
    checkbox_mask =
 ((1L<<1) | (1L<<3) | (1L<<5) |
  (1L<<11) | (1L<<13) );
    checkbox_attr.background_pixel = white_pixel;
    checkbox_attr.border_pixel = black_pixel;
    checkbox_attr.win_gravity = 1;
    checkbox_attr.colormap = colormap;
    checkbox_attr.event_mask = ((1L<<15) | (1L<<2) |
         (1L<<3) | (1L<<17) |
         (1L<<16));
}

canonical_original_code:
void checkbox_init()
{
    checkbox_mask =
 ((1L<<1) | (1L<<3) | (1L<<5) |
  (1L<<11) | (1L<<13) );
    checkbox_attr.background_pixel = white_pixel;
    checkbox_attr.border_pixel = black_pixel;
    checkbox_attr.win_gravity = 1;
    checkbox_attr.colormap = colormap;
    checkbox_attr.event_mask = ((1L<<15) | (1L<<2) |
         (1L<<3) | (1L<<17) |
         (1L<<16));
}


decompiled_code:
int __fastcall checkbox_set(__int64 a1, int a2)
{
int result; // eax

if ( *(_DWORD *)(a1 + 8) != a2 )
result = checkbox_release(a1);
return result;
}

canonical_decompiled_code:
int __fastcall func3(__int64 a1, int a2)
{
int result; // eax

if ( *(_DWORD *)(a1 + 8) != a2 )
result = func1(a1);
return result;
}

original_code:
void checkbox_set(void *data, int on)
{
    CHECKBOXINFO *cbinfo = (CHECKBOXINFO*) data;
    if (cbinfo->check != on) checkbox_release(data, ((void *)0));
}

canonical_original_code:
void checkbox_set(void *data, int on)
{
    struct CHECKBOXINFO *cbinfo = (CHECKBOXINFO*) data;
    if (cbinfo->check != on) checkbox_release(data, ((void *)0));
}

variable_types: on int

user_defined_types: struct CHECKBOXINFO { unsigned long win_id; int check; struct CHECKBOXINFO *next; }


decompiled_code:
__int64 __fastcall checkbox_value(__int64 a1)
{
return *(unsigned int *)(a1 + 8);
}

canonical_decompiled_code:
__int64 __fastcall func4(__int64 a1)
{
return *(unsigned int *)(a1 + 8);
}

original_code:
int checkbox_value(void *data)
{
    return ((CHECKBOXINFO*)data)->check;
}

canonical_original_code:
int checkbox_value(void *data)
{
    return ((struct CHECKBOXINFO *)data)->check;
}


original_code:
void checkbox_connect(void *box, void *other_box)
{
    CHECKBOXINFO *cb1 = (CHECKBOXINFO*)box;
    CHECKBOXINFO *cb2 = (CHECKBOXINFO*)other_box;
    CHECKBOXINFO *h;
    cb1->next->prev = cb2;
    cb2->next->prev = cb1;
    h=cb1->next;
    cb1->next=cb2->next;
    cb2->next=h;
}

canonical_original_code:
void checkbox_connect(void *box, void *other_box)
{
    struct CHECKBOXINFO *cb1 = (CHECKBOXINFO*)box;
    struct CHECKBOXINFO *cb2 = (CHECKBOXINFO*)other_box;
    struct CHECKBOXINFO *h;
    cb1->next->prev = cb2;
    cb2->next->prev = cb1;
    h=cb1->next;
    cb1->next=cb2->next;
    cb2->next=h;
}

variable_types:
box
void *


myfree

decompiled_code:
void __fastcall myfree(void *a1)
{
if ( a1 )
free(a1);
}

canonical_decompiled_code:
void __fastcall func0(void *a1)
{
if ( a1 )
free(a1);
}

original_code:
void myfree(void *p)
{
    if (p) free(p);
}

variable_types:
p
void *


mymalloc

decompiled_code:
void *__fastcall mymalloc(size_t a1)
{
return malloc(a1);
}

canonical_decompiled_code:
void *__fastcall func1(size_t a1)
{
return malloc(a1);
}

original_code:
void *mymalloc(size_t size)
{
    return malloc(size);
}

canonical_original_code:
void *mymalloc(unsigned long size)
{
    return malloc(size);
}

variable_types:
size
unsigned long

return_type: void *


mycalloc

decompiled_code:
void *__fastcall mycalloc(size_t a1, size_t a2)
{
return calloc(a1, a2);
}

canonical_decompiled_code:
void *__fastcall func2(size_t a1, size_t a2)
{
return calloc(a1, a2);
}

original_code:
void *mycalloc(size_t nr, size_t size)
{
    return calloc(nr,size);
}

canonical_original_code:
void *mycalloc(unsigned long nr, unsigned long size)
{
    return calloc(nr,size);
}

variable_types:
nr
unsigned long


myrealloc

decompiled_code:
void *__fastcall myrealloc(void *a1, size_t a2)
{
if ( a1 )
return realloc(a1, a2);
puts("Warning: reallocing NULL pointer.");
return malloc(a2);
}

canonical_decompiled_code:
void *__fastcall func3(void *a1, size_t a2)
{
if ( a1 )
return realloc(a1, a2);
puts("Warning: reallocing NULL pointer.");
return malloc(a2);
}

original_code:
void *myrealloc(void *p, size_t size)
{
    if (p)
 return realloc(p,size);
    else {
 printf("Warning: reallocing NULL pointer.\n");
 error_func();
 return malloc(size);
    }
}

canonical_original_code:
void *myrealloc(void *p, unsigned long size)
{
    if (p)
 return realloc(p,size);
    else {
 printf("Warning: reallocing NULL pointer.\n");
 error_func();
 return malloc(size);
    }
}


decompiled_code:
__int64 find_margin()
{
return 3LL;
}

canonical_decompiled_code:
__int64 func0()
{
return 3LL;
}

original_code:
static int find_margin(void *data __attribute__((unused)))
{
    return 3;
}

canonical_original_code:
static int find_margin(void *data)
{
    return 3;
}


decompiled_code:
__int64 __fastcall find_last_pos(_DWORD *a1, _DWORD *a2, _DWORD *a3, _DWORD *a4)
{
*a1 = last_xpos;
*a2 = last_ypos;
*a3 = last_width;
*a4 = last_height;
return 0LL;
}

canonical_decompiled_code:
__int64 __fastcall func1(_DWORD *a1, _DWORD *a2, _DWORD *a3, _DWORD *a4)
{
*a1 = last_xpos;
*a2 = last_ypos;
*a3 = last_width;
*a4 = last_height;
return 0LL;
}

original_code:
static int find_last_pos(int *x, int *y, int *w, int *h)
{
    *x = last_xpos;
    *y = last_ypos;
    *w = last_width;
    *h = last_height;
    return 0;
}

variable_types:
x
int *

variable_types:
y
int *

variable_types:
w
int *

variable_types:
h
int *


decompiled_code:
void __fastcall find_set_last_pos(int a1, int a2, int a3, int a4)
{
last_xpos = a1;
last_ypos = a2;
last_width = a3;
last_height = a4;
}

canonical_decompiled_code:
void __fastcall func2(int a1, int a2, int a3, int a4)
{
last_xpos = a1;
last_ypos = a2;
last_width = a3;
last_height = a4;
}

original_code:
static void find_set_last_pos(int x, int y, int w, int h)
{
    last_xpos = x;
    last_ypos = y;
    last_width = w;
    last_height = h;
}

variable_types: x int

variable_types: y int

variable_types: w int

variable_types: h int


decompiled_code:
__int64 __fastcall find_set_number_of_lines(__int64 *a1, unsigned int a2)
{
__int64 result; // rax
unsigned int v3; // eax
unsigned int v4; // eax

result = *a1;
if ( *a1 == finddrawwin )
{
v3 = line_number(find_info);
result = scrollbar_set(scrollfind, v3, a2);
}
else if ( result == repdrawwin )
{
v4 = line_number(rep_info);
result = scrollbar_set(scrollrep, v4, a2);
}
return result;
}

canonical_decompiled_code:
__int64 __fastcall func3(__int64 *a1, unsigned int a2)
{
__int64 result; // rax
unsigned int v3; // eax
unsigned int v4; // eax

result = *a1;
if ( *a1 == finddrawwin )
{
v3 = line_number(find_info);
result = scrollbar_set(scrollfind, v3, a2);
}
else if ( result == repdrawwin )
{
v4 = line_number(rep_info);
result = scrollbar_set(scrollrep, v4, a2);
}
return result;
}

original_code:
void find_set_number_of_lines(void *window, int numlin)
{
    if (*((Window*)window)==finddrawwin)
 scrollbar_set(scrollfind, line_number(find_info), numlin);
    else if (*((Window*)window)==repdrawwin)
 scrollbar_set(scrollrep, line_number(rep_info), numlin);
}

canonical_original_code:
void find_set_number_of_lines(void *window, int numlin)
{
    if (*((unsigned long *)window)==finddrawwin)
 scrollbar_set(scrollfind, line_number(find_info), numlin);
    else if (*((unsigned long *)window)==repdrawwin)
 scrollbar_set(scrollrep, line_number(rep_info), numlin);
}

variable_types:
window
void *

variable_types: numlin int


decompiled_code:
void find_layout_change()
{
unsigned int v0; // eax
unsigned int v1; // eax

if ( find_is_open )
{
if ( !find_iconized )
{
XClearArea(display, finddrawwin, 0, 0, 0, 0, 1);
XClearArea(display, repdrawwin, 0, 0, 0, 0, 1);
}
v0 = line_height();
scrollbar_linesize(scrollfind, v0);
v1 = line_height();
scrollbar_linesize(scrollrep, v1);
}
}

canonical_decompiled_code:
void func5()
{
unsigned int v0; // eax
unsigned int v1; // eax

if ( find_is_open )
{
if ( !find_iconized )
{
XClearArea(display, finddrawwin, 0, 0, 0, 0, 1);
XClearArea(display, repdrawwin, 0, 0, 0, 0, 1);
}
v0 = line_height();
scrollbar_linesize(scrollfind, v0);
v1 = line_height();
scrollbar_linesize(scrollrep, v1);
}
}

original_code:
static void find_layout_change(void *data __attribute__((unused)))
{
    if (find_is_open) {
 if (!find_iconized) {
     XClearArea(display, finddrawwin, 0, 0, 0, 0, 1);
     XClearArea(display, repdrawwin, 0, 0, 0, 0, 1);
 }
 scrollbar_linesize(scrollfind, line_height());
 scrollbar_linesize(scrollrep, line_height());
    }
}

canonical_original_code:
static void find_layout_change(void *data)
{
    if (find_is_open) {
 if (!find_iconized) {
     XClearArea(display, finddrawwin, 0, 0, 0, 0, 1);
     XClearArea(display, repdrawwin, 0, 0, 0, 0, 1);
 }
 scrollbar_linesize(scrollfind, line_height());
 scrollbar_linesize(scrollrep, line_height());
    }
}

variable_types:
data
void *


decompiled_code:
__int64 find_deiconize()
{
find_iconized = 0;
return popup_map(findwin);
}

canonical_decompiled_code:
__int64 func6()
{
find_iconized = 0;
return popup_map(findwin);
}

original_code:
static void find_deiconize(void *data __attribute__((unused)))
{
    find_iconized = 0;
    popup_map(findwin);
}

canonical_original_code:
static void find_deiconize(void *data)
{
    find_iconized = 0;
    popup_map(findwin);
}


decompiled_code:
__int64 find_iconize()
{
find_iconized = 1;
return popup_unmap(findwin);
}

canonical_decompiled_code:
__int64 func7()
{
find_iconized = 1;
return popup_unmap(findwin);
}

original_code:
static void find_iconize(void *data __attribute__((unused)))
{
    find_iconized = 1;
    popup_unmap(findwin);
}

canonical_original_code:
static void find_iconize(void *data)
{
    find_iconized = 1;
    popup_unmap(findwin);
}


decompiled_code:
__int64 __fastcall find_motion(__int64 a1, int a2, unsigned int a3)
{
return mouse_move((unsigned int)(a2 - 3), a3);
}

canonical_decompiled_code:
__int64 __fastcall func8(__int64 a1, int a2, unsigned int a3)
{
return mouse_move((unsigned int)(a2 - 3), a3);
}

original_code:
static void find_motion(void *data __attribute__((unused)), int x, int y)
{
    mouse_move(x-3, y);
}

canonical_original_code:
static void find_motion(void *data, int x, int y)
{
    mouse_move(x-3, y);
}


decompiled_code:
__int64 __fastcall find_draw(__int64 *a1)
{
__int64 result; // rax

result = *a1;
if ( finddrawwin == *a1 )
return redraw_window(find_info);
if ( repdrawwin == result )
result = redraw_window(rep_info);
return result;
}

canonical_decompiled_code:
__int64 __fastcall func12(__int64 *a1)
{
__int64 result; // rax

result = *a1;
if ( finddrawwin == *a1 )
return redraw_window(find_info);
if ( repdrawwin == result )
result = redraw_window(rep_info);
return result;
}

original_code:
static void find_draw(void *data)
{
    Window win = *((Window *) data);
    if (win == finddrawwin)
 redraw_window(find_info);
    else if (win == repdrawwin)
 redraw_window(rep_info);
}

canonical_original_code:
static void find_draw(void *data)
{
    unsigned long win = *((Window *) data);
    if (win == finddrawwin)
 redraw_window(find_info);
    else if (win == repdrawwin)
 redraw_window(rep_info);
}

variable_types:
win
unsigned long


decompiled_code:
__int64 find_bad_end()
{
popup_remove(findwin);
close_findwindow();
close_replacewindow();
find_iconized = 0;
find_is_open = 0;
return destroy_window(findwin);
}

canonical_decompiled_code:
__int64 func13()
{
popup_remove(findwin);
close_findwindow();
close_replacewindow();
find_iconized = 0;
find_is_open = 0;
return destroy_window(findwin);
}

original_code:
static void find_bad_end(void *data __attribute__((unused)))
{
    popup_remove(findwin);
    close_findwindow();
    close_replacewindow();
    find_iconized = 0;
    find_is_open = 0;
    destroy_window(findwin);
}

canonical_original_code:
static void find_bad_end(void *data)
{
    popup_remove(findwin);
    close_findwindow();
    close_replacewindow();
    find_iconized = 0;
    find_is_open = 0;
    destroy_window(findwin);
}


decompiled_code:
__int64 __fastcall find_scrollto(_QWORD *a1)
{
unsigned int v1; // eax
__int64 result; // rax
unsigned int v3; // eax

if ( finddrawwin == *a1 )
{
v3 = scrollbar_line(scrollfind, 0LL);
result = editwindow_line(find_info, v3);
}
else
{
v1 = scrollbar_line(scrollrep, 0LL);
result = editwindow_line(rep_info, v1);
}
return result;
}

canonical_decompiled_code:
__int64 __fastcall func14(_QWORD *a1)
{
unsigned int v1; // eax
__int64 result; // rax
unsigned int v3; // eax

if ( finddrawwin == *a1 )
{
v3 = scrollbar_line(scrollfind, 0LL);
result = editwindow_line(find_info, v3);
}
else
{
v1 = scrollbar_line(scrollrep, 0LL);
result = editwindow_line(rep_info, v1);
}
return result;
}

original_code:
static void find_scrollto(void *data, int kind __attribute__((unused)))
{
    Window win = *((Window*) data);
    if (win == finddrawwin) {
 int line_nr = scrollbar_line(scrollfind, 0);
 editwindow_line(find_info, line_nr);
    } else {
 int line_nr = scrollbar_line(scrollrep, 0);
 editwindow_line(rep_info, line_nr);
    }
}

canonical_original_code:
static void find_scrollto(void *data, int kind)
{
    unsigned long win = *((Window*) data);
    if (win == finddrawwin) {
 int line_nr = scrollbar_line(scrollfind, 0);
 editwindow_line(find_info, line_nr);
    } else {
 int line_nr = scrollbar_line(scrollrep, 0);
 editwindow_line(rep_info, line_nr);
    }
}

variable_types: kind int


decompiled_code:
int find_init()
{
int result; // eax
__int64 v1; // rax
__int64 v2; // rax

win_width = display_width >> 1;
win_height = display_height / 3u;
if ( !XStringListToTextProperty(&findname, 1, &find_name) )
{
v1 = translate("Can't set the name for the find.");
message(999LL, v1);
}
result = XStringListToTextProperty(&iconname, 1, &icon_name);
if ( !result )
{
v2 = translate("Can't set iconname for the find.");
result = message(999LL, v2);
}
return result;
}

canonical_decompiled_code:
int func15()
{
int result; // eax
__int64 v1; // rax
__int64 v2; // rax

win_width = display_width >> 1;
win_height = display_height / 3u;
if ( !XStringListToTextProperty(&findname, 1, &find_name) )
{
v1 = translate("Can't set the name for the find.");
message(999LL, v1);
}
result = XStringListToTextProperty(&iconname, 1, &icon_name);
if ( !result )
{
v2 = translate("Can't set iconname for the find.");
result = message(999LL, v2);
}
return result;
}

original_code:
void find_init(void)
{
    win_width = display_width/2;
    win_height= display_height/3;
    if (!XStringListToTextProperty(&findname, 1, &find_name))
 message(1000 -1,translate("Can't set the name for the find."));
    if (!XStringListToTextProperty(&iconname, 1, &icon_name))
 message(1000 -1, translate("Can't set iconname for the find."));
}

canonical_original_code:
void find_init()
{
    win_width = display_width/2;
    win_height= display_height/3;
    if (!XStringListToTextProperty(&findname, 1, &find_name))
 message(1000 -1,translate("Can't set the name for the find."));
    if (!XStringListToTextProperty(&iconname, 1, &icon_name))
 message(1000 -1, translate("Can't set iconname for the find."));
}


decompiled_code:
__int64 find_close()
{
XDestroyWindow(display, findwin);
return find_bad_end(0LL);
}

canonical_decompiled_code:
__int64 func17()
{
XDestroyWindow(display, findwin);
return func13(0LL);
}

original_code:
void find_close(void)
{
    XDestroyWindow(display, findwin);
    find_bad_end(((void *)0));
}

canonical_original_code:
void find_close()
{
    XDestroyWindow(display, findwin);
    find_bad_end(((void *)0));
}


decompiled_code:
void __fastcall find_handle_button(__int64 a1, int a2)
{
__int64 v2; // rax
__int64 v3; // rax
__int64 v4; // rdx
__int64 v5; // rax

if ( a2 <= 1 )
{
if ( a2 >= 0 )
{
if ( mouse_button == 3 )
{
menufind[12 * a2] = findwin;
v3 = translate(menuname[a2]);
v4 = popup_define(v3);
v5 = 12LL * a2;
qword_CB8[v5] = v4;
popup_make(&menufind[v5]);
}
else
{
v2 = translate(menuname[a2]);
qword_CB8[12 * a2] = popup_define(v2);
popup_call_default(&menufind[12 * a2]);
}
}
}
else if ( a2 == 2 && find_is_open && !remark_is_open )
{
find_close();
}
}

canonical_decompiled_code:
void __fastcall func18(__int64 a1, int a2)
{
__int64 v2; // rax
__int64 v3; // rax
__int64 v4; // rdx
__int64 v5; // rax

if ( a2 <= 1 )
{
if ( a2 >= 0 )
{
if ( mouse_button == 3 )
{
menufind[12 * a2] = findwin;
v3 = translate(menuname[a2]);
v4 = popup_define(v3);
v5 = 12LL * a2;
qword_CB8[v5] = v4;
popup_make(&menufind[v5]);
}
else
{
v2 = translate(menuname[a2]);
qword_CB8[12 * a2] = popup_define(v2);
popup_call_default(&menufind[12 * a2]);
}
}
}
else if ( a2 == 2 && find_is_open && !remark_is_open )
{
func17();
}
}

original_code:
static void find_handle_button(void *data __attribute__((unused)), int b_num)
{
    int ph_match = 1;
    switch (b_num) {
    case FINDBUTTON:
    case STACKBUTTON:
 if (mouse_button == 3) {
     menufind[b_num].parentwin=findwin;
     menufind[b_num].menu=popup_define(translate(menuname[b_num]));
     popup_make(&menufind[b_num]);
 } else {
     menufind[b_num].menu=popup_define(translate(menuname[b_num]));
     popup_call_default(menufind+b_num);
 }
 break;
      case DONEBUTTON:
 if ((find_is_open && !remark_is_open)) find_close();
 break;
    }
    if (!ph_match)
 message(1, translate("Place holders don't match."));
}

canonical_original_code:
static void find_handle_button(void *data, int b_num)
{
    int ph_match = 1;
    switch (b_num) {
    case FINDBUTTON:
    case STACKBUTTON:
 if (mouse_button == 3) {
     menufind[b_num].parentwin=findwin;
     menufind[b_num].menu=popup_define(translate(menuname[b_num]));
     popup_make(&menufind[b_num]);
 } else {
     menufind[b_num].menu=popup_define(translate(menuname[b_num]));
     popup_call_default(menufind+b_num);
 }
 break;
      case DONEBUTTON:
 if ((find_is_open && !remark_is_open)) find_close();
 break;
    }
    if (!ph_match)
 message(1, translate("Place holders don't match."));
}