decompiled_code:
__int64 __fastcall token_new(__int64 a1, unsigned int a2)
{
__int64 v2; // rbx
int v3; // er12
int v4; // eax

if ( a1 )
{
v2 = xmalloc(72LL);
if ( a2 == 10 )
{
v3 = atoi(*(const char **)a1);
*(_DWORD *)v2 = v3;
*(_QWORD *)(v2 + 8) = *(_QWORD *)(a1 + 8);
*(_QWORD *)(v2 + 16) = *(_QWORD *)(a1 + 16);
*(_QWORD *)(v2 + 24) = *(_QWORD *)(a1 + 24);
*(_QWORD *)(v2 + 32) = *(_QWORD *)(a1 + 32);
*(_QWORD *)(v2 + 40) = *(_QWORD *)(a1 + 40);
v4 = atoi(*(const char **)(a1 + 48));
*(_DWORD *)(v2 + 4) = v4;
*(_QWORD *)(v2 + 48) = *(_QWORD *)(a1 + 56);
*(_QWORD *)(v2 + 56) = *(_QWORD *)(a1 + 64);
*(_QWORD *)(v2 + 64) = *(_QWORD *)(a1 + 72);
if ( v3 < 0 )
{
fprintf(stderr, "invalid id = %d\n", (unsigned int)v3);
v2 = 0LL;
}
else if ( v4 < 0 )
{
fprintf(stderr, "invalid head = %d\n", (unsigned int)v4);
v2 = 0LL;
}
}
else
{
fprintf(stderr, "invalid data format: n = %d\n", a2);
v2 = 0LL;
}
}
else
{
fwrite("Warning: the pointer seq is NULL.\n", 1uLL, 0x22uLL, stderr);
v2 = 0LL;
}
return v2;
}

canonical_decompiled_code:
__int64 __fastcall func14(__int64 a1, unsigned int a2)
{
__int64 v2; // rbx
int v3; // er12
int v4; // eax

if ( a1 )
{
v2 = func24(72LL);
if ( a2 == 10 )
{
v3 = atoi(*(const char **)a1);
*(_DWORD *)v2 = v3;
*(_QWORD *)(v2 + 8) = *(_QWORD *)(a1 + 8);
*(_QWORD *)(v2 + 16) = *(_QWORD *)(a1 + 16);
*(_QWORD *)(v2 + 24) = *(_QWORD *)(a1 + 24);
*(_QWORD *)(v2 + 32) = *(_QWORD *)(a1 + 32);
*(_QWORD *)(v2 + 40) = *(_QWORD *)(a1 + 40);
v4 = atoi(*(const char **)(a1 + 48));
*(_DWORD *)(v2 + 4) = v4;
*(_QWORD *)(v2 + 48) = *(_QWORD *)(a1 + 56);
*(_QWORD *)(v2 + 56) = *(_QWORD *)(a1 + 64);
*(_QWORD *)(v2 + 64) = *(_QWORD *)(a1 + 72);
if ( v3 < 0 )
{
fprintf(stderr, "invalid id = %d\n", (unsigned int)v3);
v2 = 0LL;
}
else if ( v4 < 0 )
{
fprintf(stderr, "invalid head = %d\n", (unsigned int)v4);
v2 = 0LL;
}
}
else
{
fprintf(stderr, "invalid data format: n = %d\n", a2);
v2 = 0LL;
}
}
else
{
fwrite("Warning: the pointer seq is NULL.\n", 1uLL, 0x22uLL, stderr);
v2 = 0LL;
}
return v2;
}

original_code:
struct token* token_new(const char** seq, int n)
{
    struct token* t;
    if (seq == ((void *)0)) {
        fprintf(stderr, "Warning: the pointer seq is NULL.\n");
        return ((void *)0);
    }
    t = xmalloc(sizeof(struct token));
    if (n != 10) {
        fprintf(stderr, "invalid data format: n = %d\n", n);
        return ((void *)0);
    }
    t->id = atoi(seq[0]);
    t->form = seq[1];
    t->lemma = seq[2];
    t->cpos = seq[3];
    t->pos = seq[4];
    t->feat = seq[5];
    t->head = atoi(seq[6]);
    t->deprel = seq[7];
    t->phead = seq[8];
    t->pdeprel = seq[9];
    if (t->id < 0) {
        fprintf(stderr, "invalid id = %d\n", t->id);
        return ((void *)0);
    }
    if (t->head < 0) {
        fprintf(stderr, "invalid head = %d\n", t->head);
        return ((void *)0);
    }
    return t;
}

canonical_original_code:
struct token *token_new(char **seq, int n)
{
    struct token *t;
    if (seq == ((void *)0)) {
        fprintf(stderr, "Warning: the pointer seq is NULL.\n");
        return ((void *)0);
    }
    t = xmalloc(sizeof(struct token));
    if (n != 10) {
        fprintf(stderr, "invalid data format: n = %d\n", n);
        return ((void *)0);
    }
    t->id = atoi(seq[0]);
    t->form = seq[1];
    t->lemma = seq[2];
    t->cpos = seq[3];
    t->pos = seq[4];
    t->feat = seq[5];
    t->head = atoi(seq[6]);
    t->deprel = seq[7];
    t->phead = seq[8];
    t->pdeprel = seq[9];
    if (t->id < 0) {
        fprintf(stderr, "invalid id = %d\n", t->id);
        return ((void *)0);
    }
    if (t->head < 0) {
        fprintf(stderr, "invalid head = %d\n", t->head);
        return ((void *)0);
    }
    return t;
}

variable_types:
seq
char **

variable_types: n int

variable_types: struct token { int id; int head; char *form; char *lemma; char *cpos; char *pos; char *feat; char *deprel; char *phead; char *pdeprel; } *


repo: tetsuok/conllx-to-tikz-dep

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

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

original_code:
void token_destroy(struct token* t)
{
    if (t == ((void *)0)) return;
    free(t);
}

canonical_original_code:
void token_destroy(struct token *t)
{
    if (t == ((void *)0)) return;
    free(t);
}

return_type: void

user_defined_types: struct token { int id; int head; char *form; char *lemma; char *cpos; char *pos; char *feat; char *deprel; char *phead; char *pdeprel; }


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

result = 0xFFFFFFFFLL;
if ( a1 )
result = *(_DWORD *)(a1 + 4) == 0;
return result;
}

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

result = 0xFFFFFFFFLL;
if ( a1 )
result = *(_DWORD *)(a1 + 4) == 0;
return result;
}

original_code:
int is_root(const struct token* t)
{
    return (t != ((void *)0)) ? t->head == 0 : -1;
}

canonical_original_code:
int is_root(struct token *t)
{
    return (t != ((void *)0)) ? t->head == 0 : -1;
}

return_type: int


original_code:
struct sentence* sentence_new(void)
{
    struct sentence* s = xmalloc(sizeof(struct sentence));
    s->length = 0;
    s->cap = kBufSize;
    s->tokens = xmalloc(sizeof(struct token *) * kBufSize);
    return s;
}

canonical_original_code:
struct sentence *sentence_new()
{
    struct sentence *s = xmalloc(sizeof(struct sentence));
    s->length = 0;
    s->cap = kBufSize;
    s->tokens = xmalloc(sizeof(struct token *) * kBufSize);
    return s;
}

variable_types: struct sentence { int length; int cap; struct token { int id; int head; char *form; char *lemma; char *cpos; char *pos; char *feat; char *deprel; char *phead; char *pdeprel; } **tokens; } *

user_defined_types: struct sentence { int length; int cap; struct token **tokens; }


decompiled_code:
void __fastcall sentence_destroy(void *ptr)
{
__int64 v1; // rbx

if ( ptr )
{
if ( *(int *)ptr > 0 )
{
v1 = 0LL;
do
token_destroy(*(void **)(*((_QWORD *)ptr + 1) + 8 * v1++));
while ( *(_DWORD *)ptr > (int)v1 );
}
free(*((void **)ptr + 1));
free(ptr);
}
}

canonical_decompiled_code:
void __fastcall func18(void *ptr)
{
__int64 v1; // rbx

if ( ptr )
{
if ( *(int *)ptr > 0 )
{
v1 = 0LL;
do
func15(*(void **)(*((_QWORD *)ptr + 1) + 8 * v1++));
while ( *(_DWORD *)ptr > (int)v1 );
}
free(*((void **)ptr + 1));
free(ptr);
}
}

original_code:
void sentence_destroy(struct sentence* s)
{
    if (s == ((void *)0)) return;
    int i;
    for (i = 0; i < s->length; i++) {
        token_destroy(s->tokens[i]);
    }
    free(s->tokens);
    free(s);
}

canonical_original_code:
void sentence_destroy(struct sentence *s)
{
    if (s == ((void *)0)) return;
    int i;
    for (i = 0; i < s->length; i++) {
        token_destroy(s->tokens[i]);
    }
    free(s->tokens);
    free(s);
}

variable_types: i int


original_code:
void sentence_add_token(struct sentence* s, struct token* t)
{
    if (s == ((void *)0) || t == ((void *)0)) return;
    if (s->length >= s->cap) {
        struct token* new_tokens = xmalloc(sizeof(struct token *) * (unsigned long)s->cap * 2);
        memcpy(new_tokens, s->tokens, s->cap);
        s->cap *= 2;
    }
    s->tokens[s->length] = t;
    s->length++;
}

canonical_original_code:
void sentence_add_token(struct sentence *s, struct token *t)
{
    if (s == ((void *)0) || t == ((void *)0)) return;
    if (s->length >= s->cap) {
        struct token *new_tokens = xmalloc(sizeof(struct token *) * (unsigned long)s->cap * 2);
        memcpy(new_tokens, s->tokens, s->cap);
        s->cap *= 2;
    }
    s->tokens[s->length] = t;
    s->length++;
}

variable_types:
t
struct token *


decompiled_code:
int __fastcall print_form(__int64 a1)
{
__int64 v1; // rbx

v1 = 0LL;
if ( *(int *)a1 > 0 )
{
while ( 1 )
{
printf("%s", *(const char **)(*(_QWORD *)(*(_QWORD *)(a1 + 8) + 8 * v1) + 8LL));
if ( *(_DWORD *)a1 <= (int)v1 + 1 )
break;
if ( (int)v1 + 1 > 0 )
putchar(32);
++v1;
}
}
return putchar(10);
}

original_code:
void print_form(const struct sentence* s)
{
    int i;
    for (i = 0; i < s->length; i++) {
        if (i > 0) printf(" ");
        printf("%s", s->tokens[i]->form);
    }
    printf("\n");
}

canonical_original_code:
void print_form(struct sentence *s)
{
    int i;
    for (i = 0; i < s->length; i++) {
        if (i > 0) printf(" ");
        printf("%s", s->tokens[i]->form);
    }
    printf("\n");
}


decompiled_code:
__int64 __fastcall new_blocks(int a1)
{
__int64 v1; // rbx
__int64 v2; // rax

v1 = xmalloc(16LL);
*(_QWORD *)v1 = xmalloc(8LL * a1);
if ( a1 > 0 )
{
v2 = 0LL;
do
{
*(_QWORD *)(*(_QWORD *)v1 + v2) = 0LL;
v2 += 8LL;
}
while ( v2 != 8LL * (unsigned int)a1 );
}
*(_DWORD *)(v1 + 8) = a1;
*(_DWORD *)(v1 + 12) = 0;
return v1;
}

original_code:
struct blocks* new_blocks(int size)
{
    int i;
    struct blocks* b = xmalloc(sizeof(struct blocks));
    b->bufs = xmalloc(sizeof(char *) * (unsigned long)size);
    for (i = 0; i < size; i++) {
        b->bufs[i] = ((void *)0);
    }
    b->size = size;
    b->ptr = 0;
    return b;
}

canonical_original_code:
struct blocks *new_blocks(int size)
{
    int i;
    struct blocks *b = xmalloc(sizeof(struct blocks));
    b->bufs = xmalloc(sizeof(char *) * (unsigned long)size);
    for (i = 0; i < size; i++) {
        b->bufs[i] = ((void *)0);
    }
    b->size = size;
    b->ptr = 0;
    return b;
}

variable_types: size int

variable_types: struct blocks { char **bufs; int size; int ptr; } *


decompiled_code:
void __fastcall destroy_blocks(void *ptr)
{
__int64 v2; // rbx
void *v3; // rdi

if ( *((int *)ptr + 3) > 0 )
{
v2 = 0LL;
do
{
v3 = *(void **)(*(_QWORD *)ptr + 8 * v2);
if ( v3 )
free(v3);
++v2;
}
while ( *((_DWORD *)ptr + 3) > (int)v2 );
}
free(*(void **)ptr);
free(ptr);
}

canonical_decompiled_code:
void __fastcall func22(void *ptr)
{
__int64 v2; // rbx
void *v3; // rdi

if ( *((int *)ptr + 3) > 0 )
{
v2 = 0LL;
do
{
v3 = *(void **)(*(_QWORD *)ptr + 8 * v2);
if ( v3 )
free(v3);
++v2;
}
while ( *((_DWORD *)ptr + 3) > (int)v2 );
}
free(*(void **)ptr);
free(ptr);
}

original_code:
void destroy_blocks(struct blocks* b)
{
    int i;
    for (i = 0; i < b->ptr; i++) {
        if (b->bufs[i] != ((void *)0))
            free(b->bufs[i]);
    }
    free(b->bufs);
    free(b);
}

canonical_original_code:
void destroy_blocks(struct blocks *b)
{
    int i;
    for (i = 0; i < b->ptr; i++) {
        if (b->bufs[i] != ((void *)0))
            free(b->bufs[i]);
    }
    free(b->bufs);
    free(b);
}

user_defined_types: struct blocks { char **bufs; int size; int ptr; }


decompiled_code:
const void *__fastcall blocks_add_elem(__int64 a1, __int64 a2)
{
int v3; // edi
const void *result; // rax
void *v5; // r12

v3 = *(_DWORD *)(a1 + 8);
if ( *(_DWORD *)(a1 + 12) >= v3 )
{
v5 = (void *)xmalloc(16LL * v3);
memcpy(v5, *(const void **)a1, *(int *)(a1 + 8));
*(_QWORD *)a1 = v5;
*(_DWORD *)(a1 + 8) *= 2;
}
result = *(const void **)a1;
*(_QWORD *)(*(_QWORD *)a1 + 8LL * (int)(*(_DWORD *)(a1 + 12))++) = a2;
return result;
}

canonical_decompiled_code:
const void *__fastcall func23(__int64 a1, __int64 a2)
{
int v3; // edi
const void *result; // rax
void *v5; // r12

v3 = *(_DWORD *)(a1 + 8);
if ( *(_DWORD *)(a1 + 12) >= v3 )
{
v5 = (void *)func24(16LL * v3);
memcpy(v5, *(const void **)a1, *(int *)(a1 + 8));
*(_QWORD *)a1 = v5;
*(_DWORD *)(a1 + 8) *= 2;
}
result = *(const void **)a1;
*(_QWORD *)(*(_QWORD *)a1 + 8LL * (int)(*(_DWORD *)(a1 + 12))++) = a2;
return result;
}

original_code:
void blocks_add_elem(struct blocks* b, char* s)
{
    if (b->ptr >= b->size) {
        char** new_bufs = xmalloc(sizeof(char *) * (unsigned long)b->size * 2);
        memcpy(new_bufs, b->bufs, b->size);
        b->bufs = new_bufs;
        b->size *= 2;
    }
    b->bufs[b->ptr] = s;
    b->ptr++;
}

canonical_original_code:
void blocks_add_elem(struct blocks *b, char *s)
{
    if (b->ptr >= b->size) {
        char **new_bufs = xmalloc(sizeof(char *) * (unsigned long)b->size * 2);
        memcpy(new_bufs, b->bufs, b->size);
        b->bufs = new_bufs;
        b->size *= 2;
    }
    b->bufs[b->ptr] = s;
    b->ptr++;
}

variable_types:
s
char *


xmalloc

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

result = malloc(a1);
if ( !result )
{
fwrite("memory exhausted!\n", 1uLL, 0x12uLL, stderr);
exit(-1);
}
return result;
}

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

result = malloc(a1);
if ( !result )
{
fwrite("memory exhausted!\n", 1uLL, 0x12uLL, stderr);
exit(-1);
}
return result;
}

original_code:
void* xmalloc(size_t n) {
    void *p = (void *)malloc(n);
    if (p == ((void *)0)) {
        fprintf(stderr, "memory exhausted!\n");
        exit(-1);
    }
    return p;
}

canonical_original_code:
void *xmalloc(unsigned long n) {
    void *p = (void *)malloc(n);
    if (p == ((void *)0)) {
        fprintf(stderr, "memory exhausted!\n");
        exit(-1);
    }
    return p;
}

variable_types:
n
unsigned long

variable_types:
p
void *

return_type: void *


main

canonical_name: main

decompiled_code:
int __cdecl main(int argc, const char **argv, const char **envp)
{
const char *v3; // r12
__int64 v4; // rdx
int v5; // er12
__int64 v7; // rax
__int64 v8; // rdx
std::ostream *v9; // rax
__int64 v10; // rax
__int64 v11; // rdx
__int64 v12; // rax
__int64 v13; // rdx
std::ostream *v14; // rax
__int64 v15[5]; // [rsp+0h] [rbp-28h] BYREF

if ( argc == 1 )
{
v3 = (const char *)&unk_55F;
}
else
{
if ( argc != 2 )
{
v5 = -1;
v10 = std::operator<<<std::char_traits<char>>(&std::cerr, "Usage: ", envp);
v12 = std::operator<<<std::char_traits<char>>(v10, *argv, v11);
v14 = (std::ostream *)std::operator<<<std::char_traits<char>>(v12, "filename", v13);
std::endl<char,std::char_traits<char>>(v14);
return v5;
}
v3 = argv[1];
}
v15[0] = 0LL;
v15[1] = sentence_new(argc, argv, envp);
latex_print_header();
if ( (unsigned __int8)conll::Reader::Open((conll::Reader *)v15, v3) )
{
latex_print_footer();
v5 = 0;
}
else
{
v7 = std::operator<<<std::char_traits<char>>(&std::cerr, "ERROR: failed to open ", v4);
v9 = (std::ostream *)std::operator<<<std::char_traits<char>>(v7, v3, v8);
std::endl<char,std::char_traits<char>>(v9);
v5 = -1;
}
conll::Reader::~Reader((conll::Reader *)v15);
return v5;
}

canonical_decompiled_code:
int __cdecl main(int argc, const char **argv, const char **envp)
{
const char *v3; // r12
__int64 v4; // rdx
int v5; // er12
__int64 v7; // rax
__int64 v8; // rdx
std::ostream *v9; // rax
__int64 v10; // rax
__int64 v11; // rdx
__int64 v12; // rax
__int64 v13; // rdx
std::ostream *v14; // rax
__int64 v15[5]; // [rsp+0h] [rbp-28h] BYREF

if ( argc == 1 )
{
v3 = (const char *)&unk_55F;
}
else
{
if ( argc != 2 )
{
v5 = -1;
v10 = std::operator<<<std::char_traits<char>>(&std::cerr, "Usage: ", envp);
v12 = std::operator<<<std::char_traits<char>>(v10, *argv, v11);
v14 = (std::ostream *)std::operator<<<std::char_traits<char>>(v12, "filename", v13);
std::endl<char,std::char_traits<char>>(v14);
return v5;
}
v3 = argv[1];
}
v15[0] = 0LL;
v15[1] = sentence_new(argc, argv, envp);
latex_print_header();
if ( (unsigned __int8)conll::Reader::func0((conll::Reader *)v15, v3) )
{
latex_print_footer();
v5 = 0;
}
else
{
v7 = std::operator<<<std::char_traits<char>>(&std::cerr, "ERROR: failed to open ", v4);
v9 = (std::ostream *)std::operator<<<std::char_traits<char>>(v7, v3, v8);
std::endl<char,std::char_traits<char>>(v9);
v5 = -1;
}
conll::Reader::~func2((conll::Reader *)v15);
return v5;
}

original_code:
int main(int argc, char** argv)
{
    const char* filename = ((void *)0);
    if (argc == 1) {
        filename = "-";
    } else if (argc == 2) {
        filename = argv[1];
    } else {
        fprintf(stderr, "Usage: %s filename\n", argv[0]);
        return -1;
    }
    latex_print_header();
    if (open_conllx(filename) != 0) {
        fprintf(stderr, "ERROR: failed to open %s\n", argv[1]);
        return -1;
    }
    latex_print_footer();
    return 0;
}

canonical_original_code:
int main(int argc, char **argv)
{
    char *filename = ((void *)0);
    if (argc == 1) {
        filename = "-";
    } else if (argc == 2) {
        filename = argv[1];
    } else {
        fprintf(stderr, "Usage: %s filename\n", argv[0]);
        return -1;
    }
    latex_print_header();
    if (open_conllx(filename) != 0) {
        fprintf(stderr, "ERROR: failed to open %s\n", argv[1]);
        return -1;
    }
    latex_print_footer();
    return 0;
}

variable_types: argc int

variable_types:
argv
char **

variable_types:
filename
char *


original_code:
static int calc_samples(int freq)
{
 int x, samples;
 samples = 8000;
 for (x=0;x<6;x++)
  if (!(freq % 2)) {
   freq /= 2;
   samples /= 2;
  }
 for (x=0;x<3;x++)
  if (!(freq % 5)) {
   freq /= 5;
   samples /=5;
  }
 return samples;
}

canonical_original_code:
static int calc_samples(int freq)
{
 int x; int samples;
 samples = 8000;
 for (x=0;x<6;x++)
  if (!(freq % 2)) {
   freq /= 2;
   samples /= 2;
  }
 for (x=0;x<3;x++)
  if (!(freq % 5)) {
   freq /= 5;
   samples /=5;
  }
 return samples;
}

variable_types: freq int

variable_types: x int

variable_types: samples int


repo: tgreaves/ilona

decompiled_code:
__int64 __fastcall set_systemlog(__int64 a1)
{
return _isoc99_sscanf(a1, &unk_A51, sc);
}

canonical_decompiled_code:
__int64 __fastcall func0(__int64 a1)
{
return _isoc99_sscanf(a1, &unk_A51, sc);
}

original_code:
void set_systemlog (char *f)
{
    sscanf (f, "%s ", sc->systemlog);
}

canonical_original_code:
void set_systemlog(char *f)
{
    sscanf (f, "%s ", sc->systemlog);
}

variable_types:
f
char *


decompiled_code:
int set_newbot()
{
int result; // eax

if ( edit_bot == 1 )
{
result = printf(
"Error parsing configuration (line %d) - Can't define a bot inside another bot!\n",
(unsigned int)line);
cfg_error = 1;
}
else
{
result = insert_bot(thebots);
edit_bot = 1;
}
return result;
}

canonical_decompiled_code:
int func1()
{
int result; // eax

if ( edit_bot == 1 )
{
result = printf(
"Error parsing configuration (line %d) - Can't define a bot inside another bot!\n",
(unsigned int)line);
cfg_error = 1;
}
else
{
result = insert_bot(thebots);
edit_bot = 1;
}
return result;
}

original_code:
void set_newbot (char *f)
{
    if (edit_bot != 1)
    {
        insert_bot (thebots);
        edit_bot=1;
    }
    else
    {
        printf("Error parsing configuration (line %d) - Can't define a bot inside another bot!\n", line);
        cfg_error=1;
    }
}

canonical_original_code:
void set_newbot(char *f)
{
    if (edit_bot != 1)
    {
        insert_bot (thebots);
        edit_bot=1;
    }
    else
    {
        printf("Error parsing configuration (line %d) - Can't define a bot inside another bot!\n", line);
        cfg_error=1;
    }
}


decompiled_code:
int set_endchannel()
{
__int64 v0; // rax
__int64 v1; // rax
__int64 v2; // rbx

if ( edit_channel == 1 )
{
v1 = get_bot(thebots, 1LL);
v0 = get_channel(v1, 1LL);
v2 = v0;
if ( !*(_BYTE *)(v0 + 16) )
{
LODWORD(v0) = printf(
"Error parsing configuration file (line %d) - Channel name not defined!\n",
(unsigned int)line);
cfg_error = 1;
}
if ( !*(_BYTE *)(v2 + 66) )
{
LODWORD(v0) = printf("Error parsing configuration file (line %d) - Userfile not defined!\n", (unsigned int)line);
cfg_error = 1;
}
if ( !*(_BYTE *)(v2 + 166) )
{
LODWORD(v0) = printf(
"Error parsing configuration file (line %d) - Channel_Log not defined!\n",
(unsigned int)line);
cfg_error = 1;
}
edit_channel = 0;
}
else
{
LODWORD(v0) = printf(
"Error parsing configuration file (line %d) - Found EndChannel before NewChannel.\n",
(unsigned int)line);
cfg_error = 1;
}
return v0;
}

canonical_decompiled_code:
int func3()
{
__int64 v0; // rax
__int64 v1; // rax
__int64 v2; // rbx

if ( edit_channel == 1 )
{
v1 = get_bot(thebots, 1LL);
v0 = get_channel(v1, 1LL);
v2 = v0;
if ( !*(_BYTE *)(v0 + 16) )
{
LODWORD(v0) = printf(
"Error parsing configuration file (line %d) - Channel name not defined!\n",
(unsigned int)line);
cfg_error = 1;
}
if ( !*(_BYTE *)(v2 + 66) )
{
LODWORD(v0) = printf("Error parsing configuration file (line %d) - Userfile not defined!\n", (unsigned int)line);
cfg_error = 1;
}
if ( !*(_BYTE *)(v2 + 166) )
{
LODWORD(v0) = printf(
"Error parsing configuration file (line %d) - Channel_Log not defined!\n",
(unsigned int)line);
cfg_error = 1;
}
edit_channel = 0;
}
else
{
LODWORD(v0) = printf(
"Error parsing configuration file (line %d) - Found EndChannel before NewChannel.\n",
(unsigned int)line);
cfg_error = 1;
}
return v0;
}

original_code:
void set_endchannel (char *f)
{
    struct Channel *mychan;
    if (edit_channel==1)
    {
        mychan= get_channel ( get_bot(thebots,1), 1);
        if ( mychan->channel[0]=='\0')
        {
            printf("Error parsing configuration file (line %d) - Channel name not defined!\n", line);
            cfg_error=1;
        }
        if ( mychan->userfile[0]=='\0')
        {
            printf("Error parsing configuration file (line %d) - Userfile not defined!\n", line);
            cfg_error=1;
        }
        if ( mychan->logfile[0]=='\0')
        {
            printf("Error parsing configuration file (line %d) - Channel_Log not defined!\n", line);
            cfg_error=1;
        }
        edit_channel=0;
    }
    else
    {
        printf("Error parsing configuration file (line %d) - Found EndChannel before NewChannel.\n", line);
        cfg_error=1;
    }
}

canonical_original_code:
void set_endchannel(char *f)
{
    struct Channel *mychan;
    if (edit_channel==1)
    {
        mychan= get_channel ( get_bot(thebots,1), 1);
        if ( mychan->channel[0]=='\0')
        {
            printf("Error parsing configuration file (line %d) - Channel name not defined!\n", line);
            cfg_error=1;
        }
        if ( mychan->userfile[0]=='\0')
        {
            printf("Error parsing configuration file (line %d) - Userfile not defined!\n", line);
            cfg_error=1;
        }
        if ( mychan->logfile[0]=='\0')
        {
            printf("Error parsing configuration file (line %d) - Channel_Log not defined!\n", line);
            cfg_error=1;
        }
        edit_channel=0;
    }
    else
    {
        printf("Error parsing configuration file (line %d) - Found EndChannel before NewChannel.\n", line);
        cfg_error=1;
    }
}

variable_types: struct Channel { struct ChanUser { char nick[12]; char NUH[30]; struct ChanUser *next; } *cusers; struct User { struct User *next; char nick[12]; char NUH[30]; int level; int op; int autoop; } *users; char channel[50]; char userfile[100]; char logfile[100]; struct Channel *next; int no_users; int no_cusers; int anonops; } *

user_defined_types: struct Channel { struct ChanUser *cusers; struct User *users; char channel[50]; char userfile[100]; char logfile[100]; struct Channel *next; int no_users; int no_cusers; int anonops; }


decompiled_code:
int __fastcall set_channel(__int64 a1)
{
__int64 v2; // rax
__int64 v3; // rax

if ( edit_channel != 1 )
return printf(
"Error parsing configuration file (line %d) - Can't define Channel ouuside a NewChannel/EndChannel eefinition.\n",
(unsigned int)line);
_isoc99_sscanf(a1, &unk_A51, temp_line);
v2 = get_bot(thebots, 1LL);
v3 = get_channel(v2, 1LL);
return (unsigned int)strcpy((char *)(v3 + 16), temp_line);
}

canonical_decompiled_code:
int __fastcall func4(__int64 a1)
{
__int64 v2; // rax
__int64 v3; // rax

if ( edit_channel != 1 )
return printf(
"Error parsing configuration file (line %d) - Can't define Channel ouuside a NewChannel/EndChannel eefinition.\n",
(unsigned int)line);
_isoc99_sscanf(a1, &unk_A51, temp_line);
v2 = get_bot(thebots, 1LL);
v3 = get_channel(v2, 1LL);
return (unsigned int)strcpy((char *)(v3 + 16), temp_line);
}

original_code:
void set_channel (char *f)
{
    if (edit_channel==1)
    {
        sscanf (f, "%s ", temp_line);
        strcpy ( get_channel(get_bot (thebots, 1), 1)->channel, temp_line);
    }
    else
    {
        printf("Error parsing configuration file (line %d) - Can't define Channel ouuside a NewChannel/EndChannel eefinition.\n", line);
    }
}

canonical_original_code:
void set_channel(char *f)
{
    if (edit_channel==1)
    {
        sscanf (f, "%s ", temp_line);
        strcpy ( get_channel(get_bot (thebots, 1), 1)->channel, temp_line);
    }
    else
    {
        printf("Error parsing configuration file (line %d) - Can't define Channel ouuside a NewChannel/EndChannel eefinition.\n", line);
    }
}


decompiled_code:
int __fastcall set_userfile(__int64 a1)
{
__int64 v2; // rax
__int64 v3; // rax

if ( edit_channel != 1 )
return printf(
"Error parsing configuration file (line %d) - Can't define Userfile outside a NewChannel/EndChannel definition.\n",
(unsigned int)line);
_isoc99_sscanf(a1, &unk_A51, temp_line);
v2 = get_bot(thebots, 1LL);
v3 = get_channel(v2, 1LL);
return (unsigned int)strcpy((char *)(v3 + 66), temp_line);
}

canonical_decompiled_code:
int __fastcall func5(__int64 a1)
{
__int64 v2; // rax
__int64 v3; // rax

if ( edit_channel != 1 )
return printf(
"Error parsing configuration file (line %d) - Can't define Userfile outside a NewChannel/EndChannel definition.\n",
(unsigned int)line);
_isoc99_sscanf(a1, &unk_A51, temp_line);
v2 = get_bot(thebots, 1LL);
v3 = get_channel(v2, 1LL);
return (unsigned int)strcpy((char *)(v3 + 66), temp_line);
}

original_code:
void set_userfile (char *f)
{
    if (edit_channel==1)
    {
        sscanf (f, "%s ", temp_line);
        strcpy ( get_channel(get_bot (thebots,1), 1)->userfile, temp_line);
    }
    else
    {
        printf("Error parsing configuration file (line %d) - Can't define Userfile outside a NewChannel/EndChannel definition.\n", line);
    }
}

canonical_original_code:
void set_userfile(char *f)
{
    if (edit_channel==1)
    {
        sscanf (f, "%s ", temp_line);
        strcpy ( get_channel(get_bot (thebots,1), 1)->userfile, temp_line);
    }
    else
    {
        printf("Error parsing configuration file (line %d) - Can't define Userfile outside a NewChannel/EndChannel definition.\n", line);
    }
}


decompiled_code:
int __fastcall set_chanlog(__int64 a1)
{
__int64 v2; // rax
__int64 v3; // rax

if ( edit_channel != 1 )
return printf(
"Error parsing configuration file (line %d) - Can't define Channel_Log ouuside a NewChannel/EndChannel definition.\n",
(unsigned int)line);
_isoc99_sscanf(a1, &unk_A51, temp_line);
v2 = get_bot(thebots, 1LL);
v3 = get_channel(v2, 1LL);
return (unsigned int)strcpy((char *)(v3 + 166), temp_line);
}

canonical_decompiled_code:
int __fastcall func6(__int64 a1)
{
__int64 v2; // rax
__int64 v3; // rax

if ( edit_channel != 1 )
return printf(
"Error parsing configuration file (line %d) - Can't define Channel_Log ouuside a NewChannel/EndChannel definition.\n",
(unsigned int)line);
_isoc99_sscanf(a1, &unk_A51, temp_line);
v2 = get_bot(thebots, 1LL);
v3 = get_channel(v2, 1LL);
return (unsigned int)strcpy((char *)(v3 + 166), temp_line);
}

original_code:
void set_chanlog (char *f)
{
    if (edit_channel==1)
    {
        sscanf (f, "%s ", temp_line);
        strcpy ( get_channel(get_bot (thebots,1), 1)->logfile, temp_line);
    }
    else
    {
        printf("Error parsing configuration file (line %d) - Can't define Channel_Log ouuside a NewChannel/EndChannel definition.\n", line);
    }
}

canonical_original_code:
void set_chanlog(char *f)
{
    if (edit_channel==1)
    {
        sscanf (f, "%s ", temp_line);
        strcpy ( get_channel(get_bot (thebots,1), 1)->logfile, temp_line);
    }
    else
    {
        printf("Error parsing configuration file (line %d) - Can't define Channel_Log ouuside a NewChannel/EndChannel definition.\n", line);
    }
}


decompiled_code:
int set_anonops()
{
__int64 v0; // rax
__int64 v1; // rax

if ( edit_channel == 1 )
{
v1 = get_bot(thebots, 1LL);
v0 = get_channel(v1, 1LL);
*(_DWORD *)(v0 + 288) = 1;
}
else
{
LODWORD(v0) = printf(
"Error parsing configuration file (line %d) - Can't define AnonOps ouuside a NewChannel/EndChannel definition.\n",
(unsigned int)line);
}
return v0;
}

canonical_decompiled_code:
int func7()
{
__int64 v0; // rax
__int64 v1; // rax

if ( edit_channel == 1 )
{
v1 = get_bot(thebots, 1LL);
v0 = get_channel(v1, 1LL);
*(_DWORD *)(v0 + 288) = 1;
}
else
{
LODWORD(v0) = printf(
"Error parsing configuration file (line %d) - Can't define AnonOps ouuside a NewChannel/EndChannel definition.\n",
(unsigned int)line);
}
return v0;
}

original_code:
void set_anonops (char *f)
{
    if (edit_channel==1)
    {
        get_channel(get_bot(thebots,1), 1)->anonops = 1 ;
    }
    else
    {
        printf("Error parsing configuration file (line %d) - Can't define AnonOps ouuside a NewChannel/EndChannel definition.\n", line);
    }
}

canonical_original_code:
void set_anonops(char *f)
{
    if (edit_channel==1)
    {
        get_channel(get_bot(thebots,1), 1)->anonops = 1 ;
    }
    else
    {
        printf("Error parsing configuration file (line %d) - Can't define AnonOps ouuside a NewChannel/EndChannel definition.\n", line);
    }
}


decompiled_code:
int __fastcall err_notinbot(const char *a1)
{
return printf(
"Error parsing configuration (line %d) - Can't define %s outside a bot definition.\n",
(unsigned int)line,
a1);
}

canonical_decompiled_code:
int __fastcall func8(const char *a1)
{
return printf(
"Error parsing configuration (line %d) - Can't define %s outside a bot definition.\n",
(unsigned int)line,
a1);
}

original_code:
void err_notinbot (char *f)
{
    printf("Error parsing configuration (line %d) - Can't define %s outside a bot definition.\n", line, f);
}

canonical_original_code:
void err_notinbot(char *f)
{
    printf("Error parsing configuration (line %d) - Can't define %s outside a bot definition.\n", line, f);
}


decompiled_code:
int __fastcall set_description(char *src)
{
__int64 v2; // rax

if ( edit_bot != 1 )
return err_notinbot("Description");
v2 = get_bot(thebots, 1LL);
return (unsigned int)strcpy((char *)(v2 + 44), src);
}

canonical_decompiled_code:
int __fastcall func11(char *src)
{
__int64 v2; // rax

if ( edit_bot != 1 )
return func8("Description");
v2 = get_bot(thebots, 1LL);
return (unsigned int)strcpy((char *)(v2 + 44), src);
}

original_code:
void set_description (char *f)
{
    if (edit_bot == 1)
    {
        strcpy ( get_bot (thebots,1)->description, f);
    }
    else
    {
        err_notinbot ("Description");
    }
}

canonical_original_code:
void set_description(char *f)
{
    if (edit_bot == 1)
    {
        strcpy ( get_bot (thebots,1)->description, f);
    }
    else
    {
        err_notinbot ("Description");
    }
}


decompiled_code:
int __fastcall set_server(__int64 a1)
{
unsigned int v2; // ebx
__int64 v3; // rax
char v4[120]; // [rsp+0h] [rbp-78h] BYREF

if ( edit_bot != 1 )
return err_notinbot("Server");
_isoc99_sscanf(a1, "%s %s ", temp_line);
v2 = strtol(v4, 0LL, 0);
v3 = get_bot(thebots, 1LL);
return insert_IRCServer(v3, temp_line, v2);
}

canonical_decompiled_code:
int __fastcall func12(__int64 a1)
{
unsigned int v2; // ebx
__int64 v3; // rax
char v4[120]; // [rsp+0h] [rbp-78h] BYREF

if ( edit_bot != 1 )
return func8("Server");
_isoc99_sscanf(a1, "%s %s ", temp_line);
v2 = strtol(v4, 0LL, 0);
v3 = get_bot(thebots, 1LL);
return insert_IRCServer(v3, temp_line, v2);
}

original_code:
void set_server (char *f)
{
    int port;
    char temp[100];
    if (edit_bot == 1)
    {
        sscanf (f, "%s %s ", temp_line, temp);
        port = strtol (temp, ((void *)0), 0);
        insert_IRCServer ( get_bot (thebots, 1), temp_line, port ) ;
    }
    else
    {
        err_notinbot ("Server");
    }
}

canonical_original_code:
void set_server(char *f)
{
    int port;
    char temp[100];
    if (edit_bot == 1)
    {
        sscanf (f, "%s %s ", temp_line, temp);
        port = strtol (temp, ((void *)0), 0);
        insert_IRCServer ( get_bot (thebots, 1), temp_line, port ) ;
    }
    else
    {
        err_notinbot ("Server");
    }
}

variable_types: port int

variable_types:
temp
char [100]


decompiled_code:
int __fastcall set_nickname(__int64 a1)
{
__int64 v2; // rax

if ( edit_bot != 1 )
return err_notinbot("Nickname");
_isoc99_sscanf(a1, &unk_A51, temp_line);
v2 = get_bot(thebots, 1LL);
return insert_nick(v2, temp_line);
}

canonical_decompiled_code:
int __fastcall func13(__int64 a1)
{
__int64 v2; // rax

if ( edit_bot != 1 )
return func8("Nickname");
_isoc99_sscanf(a1, &unk_A51, temp_line);
v2 = get_bot(thebots, 1LL);
return insert_nick(v2, temp_line);
}

original_code:
void set_nickname (char *f)
{
    if (edit_bot == 1)
    {
        sscanf (f, "%s ", temp_line);
        insert_nick ( get_bot (thebots, 1), temp_line);
    }
    else
    {
        err_notinbot ("Nickname");
    }
}

canonical_original_code:
void set_nickname(char *f)
{
    if (edit_bot == 1)
    {
        sscanf (f, "%s ", temp_line);
        insert_nick ( get_bot (thebots, 1), temp_line);
    }
    else
    {
        err_notinbot ("Nickname");
    }
}


decompiled_code:
int __fastcall set_maxconnects(const char *a1)
{
__int64 v1; // rax
int v2; // ebx
char *endptr; // [rsp+8h] [rbp-10h] BYREF

if ( edit_bot == 1 )
{
v2 = strtol(a1, &endptr, 0);
v1 = get_bot(thebots, 1LL);
*(_DWORD *)(v1 + 156) = v2;
}
else
{
LODWORD(v1) = err_notinbot("Max_Connects");
}
return v1;
}

canonical_decompiled_code:
int __fastcall func14(const char *a1)
{
__int64 v1; // rax
int v2; // ebx
char *endptr; // [rsp+8h] [rbp-10h] BYREF

if ( edit_bot == 1 )
{
v2 = strtol(a1, &endptr, 0);
v1 = get_bot(thebots, 1LL);
*(_DWORD *)(v1 + 156) = v2;
}
else
{
LODWORD(v1) = func8("Max_Connects");
}
return v1;
}

original_code:
void set_maxconnects (char *f)
{
    int no;
    char *tail;
    if (edit_bot == 1)
    {
        no = strtol (f, &tail, 0);
        get_bot(thebots, 1)->max_connects = no;
    }
    else
    {
        err_notinbot ("Max_Connects");
    }
}

canonical_original_code:
void set_maxconnects(char *f)
{
    int no;
    char *tail;
    if (edit_bot == 1)
    {
        no = strtol (f, &tail, 0);
        get_bot(thebots, 1)->max_connects = no;
    }
    else
    {
        err_notinbot ("Max_Connects");
    }
}

variable_types: no int

variable_types:
tail
char *


decompiled_code:
int set_motd()
{
__int64 v0; // rax

if ( edit_bot == 1 )
{
v0 = get_bot(thebots, 1LL);
*(_DWORD *)(v0 + 912) = 1;
}
else
{
LODWORD(v0) = err_notinbot("Log_MOTD");
}
return v0;
}

canonical_decompiled_code:
int func15()
{
__int64 v0; // rax

if ( edit_bot == 1 )
{
v0 = get_bot(thebots, 1LL);
*(_DWORD *)(v0 + 912) = 1;
}
else
{
LODWORD(v0) = func8("Log_MOTD");
}
return v0;
}

original_code:
void set_motd (char *f)
{
    if (edit_bot == 1)
    {
        get_bot(thebots,1)->log_motd=1;
    }
    else
    {
        err_notinbot ("Log_MOTD");
    }
}

canonical_original_code:
void set_motd(char *f)
{
    if (edit_bot == 1)
    {
        get_bot(thebots,1)->log_motd=1;
    }
    else
    {
        err_notinbot ("Log_MOTD");
    }
}


decompiled_code:
int set_newchannel()
{
__int64 v0; // rax
int result; // eax

if ( edit_bot != 1 )
return err_notinbot("NewChannel");
if ( edit_channel )
{
result = printf(
"Error parsing configuration (line %d) - Can't define a channel inside another one!\n",
(unsigned int)line);
cfg_error = 1;
}
else
{
v0 = get_bot(thebots, 1LL);
result = insert_channel(v0);
edit_channel = 1;
}
return result;
}

canonical_decompiled_code:
int func16()
{
__int64 v0; // rax
int result; // eax

if ( edit_bot != 1 )
return func8("NewChannel");
if ( edit_channel )
{
result = printf(
"Error parsing configuration (line %d) - Can't define a channel inside another one!\n",
(unsigned int)line);
cfg_error = 1;
}
else
{
v0 = get_bot(thebots, 1LL);
result = insert_channel(v0);
edit_channel = 1;
}
return result;
}

original_code:
void set_newchannel (char *f)
{
    if (edit_bot == 1)
    {
        if (edit_channel ==0)
        {
            insert_channel ( get_bot(thebots, 1));
            edit_channel=1;
        }
        else
        {
            printf("Error parsing configuration (line %d) - Can't define a channel inside another one!\n", line);
            cfg_error=1;
        }
    }
    else
    {
        err_notinbot ("NewChannel");
    }
}

canonical_original_code:
void set_newchannel(char *f)
{
    if (edit_bot == 1)
    {
        if (edit_channel ==0)
        {
            insert_channel ( get_bot(thebots, 1));
            edit_channel=1;
        }
        else
        {
            printf("Error parsing configuration (line %d) - Can't define a channel inside another one!\n", line);
            cfg_error=1;
        }
    }
    else
    {
        err_notinbot ("NewChannel");
    }
}


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

if ( edit_user == 1 )
{
result = printf(
"Error parsing %s (line %d) - Can't define a user inside another user!\n",
(const char *)(a1 + 66),
(unsigned int)line);
cfg_error = 1;
}
else
{
result = (unsigned int)insert_user(a1);
edit_user = 1;
}
return result;
}

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

if ( edit_user == 1 )
{
result = printf(
"Error parsing %s (line %d) - Can't define a user inside another user!\n",
(const char *)(a1 + 66),
(unsigned int)line);
cfg_error = 1;
}
else
{
result = (unsigned int)insert_user(a1);
edit_user = 1;
}
return result;
}

original_code:
void set_newuser (struct Channel *chan, char *f)
{
    if (edit_user != 1)
    {
        insert_user (chan);
        edit_user=1;
    }
    else
    {
        printf("Error parsing %s (line %d) - Can't define a user inside another user!\n", chan->userfile, line);
        cfg_error=1;
    }
}

canonical_original_code:
void set_newuser(struct Channel *chan, char *f)
{
    if (edit_user != 1)
    {
        insert_user (chan);
        edit_user=1;
    }
    else
    {
        printf("Error parsing %s (line %d) - Can't define a user inside another user!\n", chan->userfile, line);
        cfg_error=1;
    }
}

user_defined_types: struct ChanUser { char nick[12]; char NUH[30]; struct ChanUser *next; }

user_defined_types: struct User { struct User *next; char nick[12]; char NUH[30]; int level; int op; int autoop; }


decompiled_code:
int __fastcall set_enduser(__int64 a1)
{
_QWORD *v1; // rax
_QWORD *v2; // rbp

if ( edit_user == 1 )
{
v1 = get_user(a1, 1);
v2 = v1;
if ( !*((_BYTE *)v1 + 8) )
{
LODWORD(v1) = printf(
"Error parsing %s (line %d) - User nickname not defined!\n",
(const char *)(a1 + 66),
(unsigned int)line);
cfg_error = 1;
}
if ( !*((_BYTE *)v2 + 20) )
{
LODWORD(v1) = printf(
"Error parsing %s (line %d) - User's nick!user@host not defined!\n",
(const char *)(a1 + 66),
(unsigned int)line);
cfg_error = 1;
}
if ( !*((_DWORD *)v2 + 13) )
{
LODWORD(v1) = printf(
"Error parsing %s (line %d) - User's level not defined!\n",
(const char *)(a1 + 66),
(unsigned int)line);
cfg_error = 1;
}
edit_user = 0;
}
else
{
LODWORD(v1) = printf(
"Error parsing %s (line %d) - Found EndUser before NewUser!.\n",
(const char *)(a1 + 66),
(unsigned int)line);
cfg_error = 1;
}
return (int)v1;
}

canonical_decompiled_code:
int __fastcall func1(__int64 a1)
{
_QWORD *v1; // rax
_QWORD *v2; // rbp

if ( edit_user == 1 )
{
v1 = get_user(a1, 1);
v2 = v1;
if ( !*((_BYTE *)v1 + 8) )
{
LODWORD(v1) = printf(
"Error parsing %s (line %d) - User nickname not defined!\n",
(const char *)(a1 + 66),
(unsigned int)line);
cfg_error = 1;
}
if ( !*((_BYTE *)v2 + 20) )
{
LODWORD(v1) = printf(
"Error parsing %s (line %d) - User's nick!user@host not defined!\n",
(const char *)(a1 + 66),
(unsigned int)line);
cfg_error = 1;
}
if ( !*((_DWORD *)v2 + 13) )
{
LODWORD(v1) = printf(
"Error parsing %s (line %d) - User's level not defined!\n",
(const char *)(a1 + 66),
(unsigned int)line);
cfg_error = 1;
}
edit_user = 0;
}
else
{
LODWORD(v1) = printf(
"Error parsing %s (line %d) - Found EndUser before NewUser!.\n",
(const char *)(a1 + 66),
(unsigned int)line);
cfg_error = 1;
}
return (int)v1;
}

original_code:
void set_enduser (struct Channel *chan, char *f)
{
    struct User *myuser;
    if (edit_user==1)
    {
        myuser= get_user ( chan, 1);
        if ( myuser->nick[0]=='\0')
        {
            printf("Error parsing %s (line %d) - User nickname not defined!\n", chan->userfile, line);
            cfg_error=1;
        }
        if ( myuser->NUH[0]=='\0')
        {
            printf("Error parsing %s (line %d) - User's nick!user@host not defined!\n", chan->userfile, line);
            cfg_error=1;
        }
        if ( myuser->level==0)
        {
            printf("Error parsing %s (line %d) - User's level not defined!\n", chan->userfile, line);
            cfg_error=1;
        }
        edit_user=0;
    }
    else
    {
        printf("Error parsing %s (line %d) - Found EndUser before NewUser!.\n", chan->userfile, line);
        cfg_error=1;
    }
}

canonical_original_code:
void set_enduser(struct Channel *chan, char *f)
{
    struct User *myuser;
    if (edit_user==1)
    {
        myuser= get_user ( chan, 1);
        if ( myuser->nick[0]=='\0')
        {
            printf("Error parsing %s (line %d) - User nickname not defined!\n", chan->userfile, line);
            cfg_error=1;
        }
        if ( myuser->NUH[0]=='\0')
        {
            printf("Error parsing %s (line %d) - User's nick!user@host not defined!\n", chan->userfile, line);
            cfg_error=1;
        }
        if ( myuser->level==0)
        {
            printf("Error parsing %s (line %d) - User's level not defined!\n", chan->userfile, line);
            cfg_error=1;
        }
        edit_user=0;
    }
    else
    {
        printf("Error parsing %s (line %d) - Found EndUser before NewUser!.\n", chan->userfile, line);
        cfg_error=1;
    }
}

variable_types: struct User { struct User *next; char nick[12]; char NUH[30]; int level; int op; int autoop; } *


decompiled_code:
__int64 __fastcall get_chanuser(__int64 *a1, int a2)
{
__int64 result; // rax
int i; // edx

result = *a1;
if ( *a1 && a2 != 1 )
{
for ( i = 1; i != a2; ++i )
{
result = *(_QWORD *)(result + 48);
if ( !result )
break;
}
}
return result;
}

canonical_decompiled_code:
__int64 __fastcall func2(__int64 *a1, int a2)
{
__int64 result; // rax
int i; // edx

result = *a1;
if ( *a1 && a2 != 1 )
{
for ( i = 1; i != a2; ++i )
{
result = *(_QWORD *)(result + 48);
if ( !result )
break;
}
}
return result;
}

original_code:
struct ChanUser * get_chanuser (struct Channel *b, int no)
{
    struct ChanUser *temp;
    int count=0;
    for (temp=b->cusers; temp; temp=temp->next)
    {
        count++;
        if (count == no)
        {
            break;
        }
    }
    return temp;
}

canonical_original_code:
struct ChanUser *get_chanuser(struct Channel *b, int no)
{
    struct ChanUser *temp;
    int count = 0;
    for (temp=b->cusers; temp; temp=temp->next)
    {
        count++;
        if (count == no)
        {
            break;
        }
    }
    return temp;
}

variable_types: struct Channel { struct ChanUser *cusers; struct User { struct User *next; char nick[12]; char NUH[30]; int level; int op; int autoop; } *users; char channel[50]; char userfile[100]; char logfile[100]; struct Channel *next; int no_users; int no_cusers; int anonops; } *

variable_types: struct ChanUser { char nick[12]; char NUH[30]; struct ChanUser *next; } *

variable_types: count int


decompiled_code:
int __fastcall err_notinuser(__int64 a1, const char *a2)
{
return printf(
"Error parsing %s (line %d) - Can't define %s outside a user definition.\n",
(const char *)(a1 + 66),
(unsigned int)line,
a2);
}

canonical_decompiled_code:
int __fastcall func3(__int64 a1, const char *a2)
{
return printf(
"Error parsing %s (line %d) - Can't define %s outside a user definition.\n",
(const char *)(a1 + 66),
(unsigned int)line,
a2);
}

original_code:
void err_notinuser (struct Channel *chan, char *f)
{
    printf("Error parsing %s (line %d) - Can't define %s outside a user definition.\n", chan->userfile, line, f);
}

canonical_original_code:
void err_notinuser(struct Channel *chan, char *f)
{
    printf("Error parsing %s (line %d) - Can't define %s outside a user definition.\n", chan->userfile, line, f);
}


decompiled_code:
int __fastcall set_nick(__int64 a1, __int64 a2)
{
char *v3; // rax

if ( edit_user != 1 )
return err_notinuser(a1, "Nick");
_isoc99_sscanf(a2, "%s ", temp_line);
v3 = (char *)get_user(a1, 1);
return (unsigned int)strcpy(v3 + 8, temp_line);
}

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

if ( edit_user != 1 )
return func3(a1, "Nick");
_isoc99_sscanf(a2, "%s ", temp_line);
v3 = (char *)get_user(a1, 1);
return (unsigned int)strcpy(v3 + 8, temp_line);
}

original_code:
void set_nick (struct Channel *chan, char *f)
{
    if (edit_user == 1)
    {
        sscanf (f, "%s ", temp_line);
        strcpy ( get_user (chan, 1)->nick, temp_line);
    }
    else
    {
        err_notinuser (chan, "Nick");
    }
}

canonical_original_code:
void set_nick(struct Channel *chan, char *f)
{
    if (edit_user == 1)
    {
        sscanf (f, "%s ", temp_line);
        strcpy ( get_user (chan, 1)->nick, temp_line);
    }
    else
    {
        err_notinuser (chan, "Nick");
    }
}


decompiled_code:
int __fastcall set_NUH(__int64 a1, __int64 a2)
{
char *v3; // rax

if ( edit_user != 1 )
return err_notinuser(a1, "NUH");
_isoc99_sscanf(a2, "%s ", temp_line);
v3 = (char *)get_user(a1, 1);
return (unsigned int)strcpy(v3 + 20, temp_line);
}

canonical_decompiled_code:
int __fastcall func5(__int64 a1, __int64 a2)
{
char *v3; // rax

if ( edit_user != 1 )
return func3(a1, "NUH");
_isoc99_sscanf(a2, "%s ", temp_line);
v3 = (char *)get_user(a1, 1);
return (unsigned int)strcpy(v3 + 20, temp_line);
}

original_code:
void set_NUH (struct Channel *chan, char *f)
{
    if (edit_user == 1)
    {
        sscanf (f, "%s ", temp_line);
        strcpy ( get_user (chan, 1)->NUH, temp_line);
    }
    else
    {
        err_notinuser (chan, "NUH");
    }
}

canonical_original_code:
void set_NUH(struct Channel *chan, char *f)
{
    if (edit_user == 1)
    {
        sscanf (f, "%s ", temp_line);
        strcpy ( get_user (chan, 1)->NUH, temp_line);
    }
    else
    {
        err_notinuser (chan, "NUH");
    }
}


decompiled_code:
int __fastcall set_level(__int64 a1, __int64 a2)
{
_QWORD *v2; // rax
int v3; // ebp
char *endptr; // [rsp+8h] [rbp-20h] BYREF

if ( edit_user == 1 )
{
_isoc99_sscanf(a2, "%s ", temp_line);
v3 = strtol(temp_line, &endptr, 0);
v2 = get_user(a1, 1);
*((_DWORD *)v2 + 13) = v3;
}
else
{
LODWORD(v2) = err_notinuser(a1, "Level");
}
return (int)v2;
}

canonical_decompiled_code:
int __fastcall func6(__int64 a1, __int64 a2)
{
_QWORD *v2; // rax
int v3; // ebp
char *endptr; // [rsp+8h] [rbp-20h] BYREF

if ( edit_user == 1 )
{
_isoc99_sscanf(a2, "%s ", temp_line);
v3 = strtol(temp_line, &endptr, 0);
v2 = get_user(a1, 1);
*((_DWORD *)v2 + 13) = v3;
}
else
{
LODWORD(v2) = func3(a1, "Level");
}
return (int)v2;
}

original_code:
void set_level (struct Channel *chan, char *f)
{
    char *tail;
    if (edit_user == 1)
    {
        sscanf (f, "%s ", temp_line);
        get_user (chan, 1)->level = strtol (temp_line, &tail, 0);
    }
    else
    {
        err_notinuser (chan, "Level");
    }
}

canonical_original_code:
void set_level(struct Channel *chan, char *f)
{
    char *tail;
    if (edit_user == 1)
    {
        sscanf (f, "%s ", temp_line);
        get_user (chan, 1)->level = strtol (temp_line, &tail, 0);
    }
    else
    {
        err_notinuser (chan, "Level");
    }
}


decompiled_code:
int __fastcall set_op(__int64 a1)
{
_QWORD *v1; // rax

if ( edit_user == 1 )
{
v1 = get_user(a1, 1);
*((_DWORD *)v1 + 14) = 1;
}
else
{
LODWORD(v1) = err_notinuser(a1, "Op");
}
return (int)v1;
}

canonical_decompiled_code:
int __fastcall func7(__int64 a1)
{
_QWORD *v1; // rax

if ( edit_user == 1 )
{
v1 = get_user(a1, 1);
*((_DWORD *)v1 + 14) = 1;
}
else
{
LODWORD(v1) = func3(a1, "Op");
}
return (int)v1;
}

original_code:
void set_op (struct Channel *chan, char *f)
{
    if (edit_user == 1)
    {
        get_user (chan,1)->op = 1;
    }
    else
    {
        err_notinuser (chan, "Op");
    }
}

canonical_original_code:
void set_op(struct Channel *chan, char *f)
{
    if (edit_user == 1)
    {
        get_user (chan,1)->op = 1;
    }
    else
    {
        err_notinuser (chan, "Op");
    }
}


decompiled_code:
int __fastcall set_autoop(__int64 a1)
{
_QWORD *v1; // rax

if ( edit_user == 1 )
{
v1 = get_user(a1, 1);
*((_DWORD *)v1 + 15) = 1;
}
else
{
LODWORD(v1) = err_notinuser(a1, "AutoOp");
}
return (int)v1;
}

canonical_decompiled_code:
int __fastcall func8(__int64 a1)
{
_QWORD *v1; // rax

if ( edit_user == 1 )
{
v1 = get_user(a1, 1);
*((_DWORD *)v1 + 15) = 1;
}
else
{
LODWORD(v1) = func3(a1, "AutoOp");
}
return (int)v1;
}

original_code:
void set_autoop (struct Channel *chan, char *f)
{
    if (edit_user ==1)
    {
        get_user (chan,1)->autoop = 1;
    }
    else
    {
        err_notinuser (chan, "AutoOp");
    }
}

canonical_original_code:
void set_autoop(struct Channel *chan, char *f)
{
    if (edit_user ==1)
    {
        get_user (chan,1)->autoop = 1;
    }
    else
    {
        err_notinuser (chan, "AutoOp");
    }
}


decompiled_code:
void __fastcall __noreturn exit_nicely(int status)
{
int i; // ebx

do_sys_log(sc, "Ilona %s closed.\n", "v2.0");
if ( sc )
free(sc);
for ( i = 1; (int)no_bots(thebots) >= i; ++i )
{
mybot = get_bot(thebots, (unsigned int)i);
do_bot_log(mybot, "Ilona %s closed.\n", "v2.0");
}
kill_bots(thebots);
if ( thebots )
free(thebots);
exit(status);
}

canonical_decompiled_code:
void __fastcall __noreturn func0(int status)
{
int i; // ebx

do_sys_log(sc, "Ilona %s closed.\n", "v2.0");
if ( sc )
free(sc);
for ( i = 1; (int)no_bots(thebots) >= i; ++i )
{
mybot = get_bot(thebots, (unsigned int)i);
do_bot_log(mybot, "Ilona %s closed.\n", "v2.0");
}
kill_bots(thebots);
if ( thebots )
free(thebots);
exit(status);
}

original_code:
void exit_nicely (int nice)
{
    int i;
    do_sys_log (sc, "Ilona %s closed.\n", "v2.0");
    if (sc)
    {
        free(sc);
    }
    for (i=1; i<=no_bots(thebots); i++)
    {
        mybot=get_bot (thebots, i);
        do_bot_log (mybot, "Ilona %s closed.\n", "v2.0");
    }
    kill_bots(thebots);
    if (thebots)
    {
        free (thebots);
    }
    exit(nice) ;
}

canonical_original_code:
void exit_nicely(int nice)
{
    int i;
    do_sys_log (sc, "Ilona %s closed.\n", "v2.0");
    if (sc)
    {
        free(sc);
    }
    for (i=1; i<=no_bots(thebots); i++)
    {
        mybot=get_bot (thebots, i);
        do_bot_log (mybot, "Ilona %s closed.\n", "v2.0");
    }
    kill_bots(thebots);
    if (thebots)
    {
        free (thebots);
    }
    exit(nice) ;
}

variable_types: nice int

variable_types: i int


SigInt

decompiled_code:
void __noreturn SigInt()
{
do_sys_log(sc, "User break detected.");
exit_nicely(0);
}

canonical_decompiled_code:
void __noreturn func1()
{
do_sys_log(sc, "User break detected.");
func0(0);
}

original_code:
void SigInt (int sig)
{
    do_sys_log(sc, "User break detected.") ;
    exit_nicely(0);
}

canonical_original_code:
void SigInt(int sig)
{
    do_sys_log(sc, "User break detected.") ;
    exit_nicely(0);
}

variable_types: sig int


titles

decompiled_code:
int titles()
{
return printf("Ilona %s - (c) Copyright 1996-2012 Tristan Greaves.\n\n", "v2.0");
}

canonical_decompiled_code:
int func2()
{
return printf("Ilona %s - (c) Copyright 1996-2012 Tristan Greaves.\n\n", "v2.0");
}

original_code:
void titles (void)
{
    printf("Ilona %s - (c) Copyright 1996-2012 Tristan Greaves.\n\n", "v2.0");
}

canonical_original_code:
void titles()
{
    printf("Ilona %s - (c) Copyright 1996-2012 Tristan Greaves.\n\n", "v2.0");
}


DateToString

decompiled_code:
char *__fastcall DateToString(const time_t *a1)
{
struct tm *v1; // rax

v1 = localtime(a1);
strftime(datebuffer_1, 0xAuLL, "%d-%b-%y", v1);
return datebuffer_1;
}

canonical_decompiled_code:
char *__fastcall func0(const time_t *a1)
{
struct tm *v1; // rax

v1 = localtime(a1);
strftime(datebuffer_1, 0xAuLL, "%d-%b-%y", v1);
return datebuffer_1;
}

original_code:
char *DateToString (time_t *dat)
{
    static char datebuffer[10] ;
    struct tm *btime ;
    btime = localtime ( dat ) ;
    strftime (datebuffer, 10, "%d-%b-%y", btime) ;
    return (datebuffer) ;
}

canonical_original_code:
char *DateToString(long *dat)
{
    static char datebuffer[10];
    struct tm *btime;
    btime = localtime ( dat ) ;
    strftime (datebuffer, 10, "%d-%b-%y", btime) ;
    return (datebuffer) ;
}

variable_types:
dat
long *

variable_types:
datebuffer
char [10]

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

return_type: char *


TimeToString

decompiled_code:
char *__fastcall TimeToString(const time_t *a1)
{
struct tm *v1; // rax

v1 = localtime(a1);
strftime(timebuffer_0, 9uLL, "%H:%M:%S", v1);
return timebuffer_0;
}

canonical_decompiled_code:
char *__fastcall func1(const time_t *a1)
{
struct tm *v1; // rax

v1 = localtime(a1);
strftime(timebuffer_0, 9uLL, "%H:%M:%S", v1);
return timebuffer_0;
}

original_code:
char *TimeToString (time_t *dat)
{
    static char timebuffer[9] ;
    struct tm *btime ;
    btime = localtime ( dat ) ;
    strftime (timebuffer, 9, "%H:%M:%S", btime) ;
    return (timebuffer) ;
}

canonical_original_code:
char *TimeToString(long *dat)
{
    static char timebuffer[9];
    struct tm *btime;
    btime = localtime ( dat ) ;
    strftime (timebuffer, 9, "%H:%M:%S", btime) ;
    return (timebuffer) ;
}

variable_types:
timebuffer
char [9]

user_defined_types: struct tm { int tm_sec; int tm_min; int tm_hour; int tm_mday; int tm_mon; int tm_year; int tm_wday; int tm_yday; int tm_isdst; long tm_gmtoff; char *tm_zone; }


insertInstrucInTable

repo: thaliacampolina/sb

decompiled_code:
char *__fastcall insertInstrucInTable(__int64 a1, const char *a2, const char *a3)
{
int v3; // ebp
char *v4; // r13
char *v5; // r12
char *result; // rax

v3 = *(_DWORD *)(a1 + 1616);
v4 = (char *)calloc(0x64uLL, 1uLL);
*(_QWORD *)(a1 + 8LL * v3 + 8) = v4;
v5 = (char *)calloc(0x64uLL, 1uLL);
*(_QWORD *)(a1 + 8LL * v3 + 808) = v5;
strcpy(v4, a2);
result = strcpy(v5, a3);
*(_DWORD *)(a1 + 1616) = v3 + 1;
return result;
}

canonical_decompiled_code:
char *__fastcall func0(__int64 a1, const char *a2, const char *a3)
{
int v3; // ebp
char *v4; // r13
char *v5; // r12
char *result; // rax

v3 = *(_DWORD *)(a1 + 1616);
v4 = (char *)calloc(0x64uLL, 1uLL);
*(_QWORD *)(a1 + 8LL * v3 + 8) = v4;
v5 = (char *)calloc(0x64uLL, 1uLL);
*(_QWORD *)(a1 + 8LL * v3 + 808) = v5;
strcpy(v4, a2);
result = strcpy(v5, a3);
*(_DWORD *)(a1 + 1616) = v3 + 1;
return result;
}

original_code:
void insertInstrucInTable(MacroSymbols* macro, char* instruc,char* oper){
    macro->instruc_[macro->last_]=(char*) calloc(100,sizeof(char));
    macro->oper_[macro->last_]=(char*) calloc(100,sizeof(char));
    strcpy(macro->instruc_[macro->last_],instruc);
    strcpy(macro->oper_[macro->last_],oper);
    macro->last_++;
}

canonical_original_code:
void insertInstrucInTable(struct macroSymbols *macro, char *instruc, char *oper){
    macro->instruc_[macro->last_]=(char *) calloc(100,sizeof(char));
    macro->oper_[macro->last_]=(char *) calloc(100,sizeof(char));
    strcpy(macro->instruc_[macro->last_],instruc);
    strcpy(macro->oper_[macro->last_],oper);
    macro->last_++;
}

variable_types: struct macroSymbols { char *name_; char *instruc_[100]; char *oper_[100]; char *parameter_; int last_; int has_parameter_; } *

variable_types:
instruc
char *

variable_types:
oper
char *


createMacroTable

decompiled_code:
_DWORD *createMacroTable()
{
_DWORD *result; // rax

result = malloc(0x328uLL);
result[200] = 0;
return result;
}

canonical_decompiled_code:
_DWORD *func1()
{
_DWORD *result; // rax

result = malloc(0x328uLL);
result[200] = 0;
return result;
}

original_code:
MacroTable* createMacroTable(){
    MacroTable* macroTable = (MacroTable*) malloc(sizeof(MacroTable));
    macroTable->last_=0;
    return macroTable;
}

canonical_original_code:
struct macroTable *createMacroTable(){
    struct macroTable *macroTable = (MacroTable*) malloc(sizeof(MacroTable));
    macroTable->last_=0;
    return macroTable;
}

variable_types: struct macroTable { struct macroSymbols { char *name_; char *instruc_[100]; char *oper_[100]; char *parameter_; int last_; int has_parameter_; } *macros_[100]; int last_; } *

user_defined_types: struct macroTable { struct macroSymbols *macros_[100]; int last_; }


insertInMacroTable

decompiled_code:
__int64 __fastcall insertInMacroTable(__int64 a1, __int64 a2)
{
int v2; // eax
__int64 result; // rax

v2 = *(_DWORD *)(a1 + 800);
*(_QWORD *)(a1 + 8LL * v2) = a2;
result = (unsigned int)(v2 + 1);
*(_DWORD *)(a1 + 800) = result;
return result;
}

canonical_decompiled_code:
__int64 __fastcall func2(__int64 a1, __int64 a2)
{
int v2; // eax
__int64 result; // rax

v2 = *(_DWORD *)(a1 + 800);
*(_QWORD *)(a1 + 8LL * v2) = a2;
result = (unsigned int)(v2 + 1);
*(_DWORD *)(a1 + 800) = result;
return result;
}

original_code:
void insertInMacroTable(MacroTable* macroTable, MacroSymbols* macroSymbol){
    macroTable->macros_[macroTable->last_] = macroSymbol;
    macroTable->last_ ++;
}

canonical_original_code:
void insertInMacroTable(struct macroTable *macroTable, struct macroSymbols *macroSymbol){
    macroTable->macros_[macroTable->last_] = macroSymbol;
    macroTable->last_ ++;
}

variable_types:
macroSymbol
struct macroSymbols *

user_defined_types: struct macroSymbols { char *name_; char *instruc_[100]; char *oper_[100]; char *parameter_; int last_; int has_parameter_; }


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

for ( result = (unsigned __int8)*a1; (_BYTE)result; result = (unsigned __int8)*a1 )
{
if ( (_BYTE)result == 58 )
*a1 = 0;
++a1;
}
return result;
}

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

for ( result = (unsigned __int8)*a1; (_BYTE)result; result = (unsigned __int8)*a1 )
{
if ( (_BYTE)result == 58 )
*a1 = 0;
++a1;
}
return result;
}

original_code:
void remove2P(char *str)
{
     int i=0;
     while(str[i]){
 if(str[i]==':'){
     str[i]='\0';
 }
 i++;
     }
}

canonical_original_code:
void remove2P(char *str)
{
     int i = 0;
     while(str[i]){
 if(str[i]==':'){
     str[i]='\0';
 }
 i++;
     }
}

variable_types:
str
char *


findLabelName

decompiled_code:
__int64 __fastcall findLabelName(__int64 a1, const char *a2)
{
int v2; // er12
__int64 v3; // rbx
unsigned int v4; // er14

v2 = *(_DWORD *)(a1 + 800);
if ( v2 <= 0 )
return (unsigned int)-1;
v3 = 0LL;
while ( 1 )
{
v4 = v3;
if ( !strcmp(**(const char ***)(a1 + 8 * v3), a2) )
break;
if ( ++v3 == v2 )
return (unsigned int)-1;
}
return v4;
}

canonical_decompiled_code:
__int64 __fastcall func6(__int64 a1, const char *a2)
{
int v2; // er12
__int64 v3; // rbx
unsigned int v4; // er14

v2 = *(_DWORD *)(a1 + 800);
if ( v2 <= 0 )
return (unsigned int)-1;
v3 = 0LL;
while ( 1 )
{
v4 = v3;
if ( !strcmp(**(const char ***)(a1 + 8 * v3), a2) )
break;
if ( ++v3 == v2 )
return (unsigned int)-1;
}
return v4;
}

original_code:
int findLabelName(MacroTable* macro, char* name){
    int i = 0;
    for(i=0;i<macro->last_;i++){
       if(strcmp(macro->macros_[i]->name_, name)==0){
           return i;
       }
    }
    return -1;
}

canonical_original_code:
int findLabelName(struct macroTable *macro, char *name){
    int i = 0;
    for(i=0;i<macro->last_;i++){
       if(strcmp(macro->macros_[i]->name_, name)==0){
           return i;
       }
    }
    return -1;
}

variable_types:
name
char *


hasParameter

decompiled_code:
_BOOL8 __fastcall hasParameter(__int64 a1, const char *a2)
{
return *(_DWORD *)(*(_QWORD *)(a1 + 8LL * (int)findLabelName(a1, a2)) + 1620LL) == 1;
}

canonical_decompiled_code:
_BOOL8 __fastcall func9(__int64 a1, const char *a2)
{
return *(_DWORD *)(*(_QWORD *)(a1 + 8LL * (int)func6(a1, a2)) + 1620LL) == 1;
}

original_code:
int hasParameter(MacroTable* macroTable,char* name){
    if(macroTable->macros_[findLabelName(macroTable,name)]->has_parameter_==1)
 return 1;
    else
 return 0;
}

canonical_original_code:
int hasParameter(struct macroTable *macroTable, char *name){
    if(macroTable->macros_[findLabelName(macroTable,name)]->has_parameter_==1)
 return 1;
    else
 return 0;
}


isMacro

decompiled_code:
__int64 __fastcall isMacro(__int64 a1, const char *a2)
{
int v2; // ebx
int v3; // edx
int v4; // eax

v2 = *(_DWORD *)(a1 + 800);
if ( v2 <= 0 )
return 0LL;
v3 = findLabelName(a1, a2);
v4 = 0;
while ( v3 == -1 )
{
if ( ++v4 == v2 )
return 0LL;
}
return (unsigned int)hasParameter(a1, a2) + 1;
}

canonical_decompiled_code:
__int64 __fastcall func10(__int64 a1, const char *a2)
{
int v2; // ebx
int v3; // edx
int v4; // eax

v2 = *(_DWORD *)(a1 + 800);
if ( v2 <= 0 )
return 0LL;
v3 = func6(a1, a2);
v4 = 0;
while ( v3 == -1 )
{
if ( ++v4 == v2 )
return 0LL;
}
return (unsigned int)func9(a1, a2) + 1;
}

original_code:
int isMacro(MacroTable* macroTable, char* name){
    int i;
    for(i=0;i<macroTable->last_; i++){
        if(findLabelName(macroTable,name) != -1){
            if(hasParameter(macroTable,name)==1)
  return 2;
     else
  return 1;
        }
    }
    return 0;
}

canonical_original_code:
int isMacro(struct macroTable *macroTable, char *name){
    int i;
    for(i=0;i<macroTable->last_; i++){
        if(findLabelName(macroTable,name) != -1){
            if(hasParameter(macroTable,name)==1)
  return 2;
     else
  return 1;
        }
    }
    return 0;
}


PrintTable

decompiled_code:
void __fastcall PrintTable(__int64 a1)
{
__int64 i; // rbp
int j; // ebx
__int64 v3; // rax

for ( i = 0LL; *(_DWORD *)(a1 + 800) > (int)i; ++i )
{
v3 = *(_QWORD *)(a1 + 8 * i);
for ( j = 0; *(_DWORD *)(v3 + 1616) > j; v3 = *(_QWORD *)(a1 + 8 * i) )
{
printf(
"name: %s parameter: %s info: %s %s parametro:%d\n",
*(const char **)v3,
*(const char **)(v3 + 1608),
*(const char **)(v3 + 8LL * j + 8),
*(const char **)(v3 + 8LL * j + 808),
*(unsigned int *)(v3 + 1620));
++j;
}
}
}

original_code:
void PrintTable(MacroTable* macroTable){
    int i = 0;
    int j = 0;
    for(i=0;i<macroTable->last_; i++){
        for(j=0;j<macroTable->macros_[i]->last_; j++){
            printf("name: %s parameter: %s info: %s %s parametro:%d\n", macroTable->macros_[i]->name_ ,
  macroTable->macros_[i]->parameter_ ,macroTable->macros_[i]->instruc_[j],
   macroTable->macros_[i]->oper_[j],macroTable->macros_[i]->has_parameter_);
        }
    }
}

canonical_original_code:
void PrintTable(struct macroTable *macroTable){
    int i = 0;
    int j = 0;
    for(i=0;i<macroTable->last_; i++){
        for(j=0;j<macroTable->macros_[i]->last_; j++){
            printf("name: %s parameter: %s info: %s %s parametro:%d\n", macroTable->macros_[i]->name_ ,
  macroTable->macros_[i]->parameter_ ,macroTable->macros_[i]->instruc_[j],
   macroTable->macros_[i]->oper_[j],macroTable->macros_[i]->has_parameter_);
        }
    }
}

variable_types: j int


IsLabel

decompiled_code:
__int64 __fastcall IsLabel(char *a1)
{
char v1; // al
char *v2; // rdi

v1 = *a1;
if ( !*a1 )
return 0LL;
v2 = a1 + 1;
while ( v1 != 58 )
{
v1 = *v2++;
if ( !v1 )
return 0LL;
}
return 1LL;
}

canonical_decompiled_code:
__int64 __fastcall func4(char *a1)
{
char v1; // al
char *v2; // rdi

v1 = *a1;
if ( !*a1 )
return 0LL;
v2 = a1 + 1;
while ( v1 != 58 )
{
v1 = *v2++;
if ( !v1 )
return 0LL;
}
return 1LL;
}

original_code:
int IsLabel(char* str){
    int i = 0;
    while(str[i]){
        if(str[i] == ':'){
            return 1;
        }
        i++;
    }
    return 0;
}

canonical_original_code:
int IsLabel(char *str){
    int i = 0;
    while(str[i]){
        if(str[i] == ':'){
            return 1;
        }
        i++;
    }
    return 0;
}


IsKeyword

decompiled_code:
__int64 __fastcall IsKeyword(char *s1)
{
unsigned int v1; // edx
__int64 result; // rax

v1 = 2;
if ( !strcmp(s1, "LOAD")
|| !strcmp(s1, "STORE")
|| !strcmp(s1, "PUSH")
|| !strcmp(s1, "POP")
|| !strcmp(s1, "JMP")
|| !strcmp(s1, "JPG")
|| !strcmp(s1, "JPGE")
|| !strcmp(s1, "JPL")
|| !strcmp(s1, "JPLE")
|| !strcmp(s1, "JPE")
|| !strcmp(s1, "JPNE")
|| !strcmp(s1, "XOR")
|| !strcmp(s1, "AND")
|| !strcmp(s1, "OR")
|| (v1 = 1, !strcmp(s1, "NOT"))
|| (v1 = 2, !strcmp(s1, "ADD"))
|| !strcmp(s1, "SUB")
|| !strcmp(s1, "READ")
|| !strcmp(s1, "WRITE")
|| !strcmp(s1, "CALL")
|| (v1 = 1, !strcmp(s1, "RET"))
|| !strcmp(s1, "HALT")
|| (v1 = 2, !strcmp(s1, "WORD"))
|| (v1 = 1, !strcmp(s1, "END"))
|| !strcmp(s1, "ENDMACRO") )
{
result = v1;
}
else
{
result = strcmp(s1, "BEGINMACRO") == 0;
}
return result;
}

canonical_decompiled_code:
__int64 __fastcall func11(char *s1)
{
unsigned int v1; // edx
__int64 result; // rax

v1 = 2;
if ( !strcmp(s1, "LOAD")
|| !strcmp(s1, "STORE")
|| !strcmp(s1, "PUSH")
|| !strcmp(s1, "POP")
|| !strcmp(s1, "JMP")
|| !strcmp(s1, "JPG")
|| !strcmp(s1, "JPGE")
|| !strcmp(s1, "JPL")
|| !strcmp(s1, "JPLE")
|| !strcmp(s1, "JPE")
|| !strcmp(s1, "JPNE")
|| !strcmp(s1, "XOR")
|| !strcmp(s1, "AND")
|| !strcmp(s1, "OR")
|| (v1 = 1, !strcmp(s1, "NOT"))
|| (v1 = 2, !strcmp(s1, "ADD"))
|| !strcmp(s1, "SUB")
|| !strcmp(s1, "READ")
|| !strcmp(s1, "WRITE")
|| !strcmp(s1, "CALL")
|| (v1 = 1, !strcmp(s1, "RET"))
|| !strcmp(s1, "HALT")
|| (v1 = 2, !strcmp(s1, "WORD"))
|| (v1 = 1, !strcmp(s1, "END"))
|| !strcmp(s1, "ENDMACRO") )
{
result = v1;
}
else
{
result = strcmp(s1, "BEGINMACRO") == 0;
}
return result;
}

original_code:
int IsKeyword(char* instruc){
    if(strcmp(instruc,"LOAD")==0) return 2;
    if(strcmp(instruc,"STORE")==0) return 2;
    if(strcmp(instruc,"PUSH")==0) return 2;
    if(strcmp(instruc,"POP")==0) return 2;
    if(strcmp(instruc,"JMP")==0) return 2;
    if(strcmp(instruc,"JPG")==0) return 2;
    if(strcmp(instruc,"JPGE")==0) return 2;
    if(strcmp(instruc,"JPL")==0) return 2;
    if(strcmp(instruc,"JPLE")==0) return 2;
    if(strcmp(instruc,"JPE")==0) return 2;
    if(strcmp(instruc,"JPNE")==0) return 2;
    if(strcmp(instruc,"XOR")==0) return 2;
    if(strcmp(instruc,"AND")==0) return 2;
    if(strcmp(instruc,"OR")==0) return 2;
    if(strcmp(instruc,"NOT")==0) return 1;
    if(strcmp(instruc,"ADD")==0) return 2;
    if(strcmp(instruc,"SUB")==0) return 2;
    if(strcmp(instruc,"READ")==0) return 2;
    if(strcmp(instruc,"WRITE")==0) return 2;
    if(strcmp(instruc,"CALL")==0) return 2;
    if(strcmp(instruc,"RET")==0) return 1;
    if(strcmp(instruc,"HALT")==0) return 1;
    if(strcmp(instruc,"WORD")==0) return 2;
    if(strcmp(instruc,"END")==0) return 1;
    if(strcmp(instruc,"ENDMACRO")==0) return 1;
    if(strcmp(instruc,"BEGINMACRO")==0) return 1;
    return 0;
}

canonical_original_code:
int IsKeyword(char *instruc){
    if(strcmp(instruc,"LOAD")==0) return 2;
    if(strcmp(instruc,"STORE")==0) return 2;
    if(strcmp(instruc,"PUSH")==0) return 2;
    if(strcmp(instruc,"POP")==0) return 2;
    if(strcmp(instruc,"JMP")==0) return 2;
    if(strcmp(instruc,"JPG")==0) return 2;
    if(strcmp(instruc,"JPGE")==0) return 2;
    if(strcmp(instruc,"JPL")==0) return 2;
    if(strcmp(instruc,"JPLE")==0) return 2;
    if(strcmp(instruc,"JPE")==0) return 2;
    if(strcmp(instruc,"JPNE")==0) return 2;
    if(strcmp(instruc,"XOR")==0) return 2;
    if(strcmp(instruc,"AND")==0) return 2;
    if(strcmp(instruc,"OR")==0) return 2;
    if(strcmp(instruc,"NOT")==0) return 1;
    if(strcmp(instruc,"ADD")==0) return 2;
    if(strcmp(instruc,"SUB")==0) return 2;
    if(strcmp(instruc,"READ")==0) return 2;
    if(strcmp(instruc,"WRITE")==0) return 2;
    if(strcmp(instruc,"CALL")==0) return 2;
    if(strcmp(instruc,"RET")==0) return 1;
    if(strcmp(instruc,"HALT")==0) return 1;
    if(strcmp(instruc,"WORD")==0) return 2;
    if(strcmp(instruc,"END")==0) return 1;
    if(strcmp(instruc,"ENDMACRO")==0) return 1;
    if(strcmp(instruc,"BEGINMACRO")==0) return 1;
    return 0;
}


CreateSymbol

decompiled_code:
char *__fastcall CreateSymbol(__int64 a1, const char *a2, int a3)
{
char *v4; // rax
char *result; // rax

v4 = (char *)calloc(0x64uLL, 1uLL);
*(_QWORD *)a1 = v4;
result = strcpy(v4, a2);
*(_DWORD *)(a1 + 8) = a3;
return result;
}

canonical_decompiled_code:
char *__fastcall func8(__int64 a1, const char *a2, int a3)
{
char *v4; // rax
char *result; // rax

v4 = (char *)calloc(0x64uLL, 1uLL);
*(_QWORD *)a1 = v4;
result = strcpy(v4, a2);
*(_DWORD *)(a1 + 8) = a3;
return result;
}

original_code:
void CreateSymbol(Symbol* symbol,char* name, int ILC){
    symbol->name_=(char*)calloc(100,sizeof(char));
    strcpy(symbol->name_,name);
    symbol->value_=ILC;
}

canonical_original_code:
void CreateSymbol(struct symbol *symbol, char *name, int ILC){
    symbol->name_=(char *)calloc(100,sizeof(char));
    strcpy(symbol->name_,name);
    symbol->value_=ILC;
}

variable_types: struct symbol { char *name_; int value_; } *

variable_types: ILC int


InsertSymbolInTable

decompiled_code:
__int64 __fastcall InsertSymbolInTable(__int64 a1, __int64 a2)
{
int v2; // eax
__int64 result; // rax

v2 = *(_DWORD *)(a1 + 800);
*(_QWORD *)(a1 + 8LL * v2) = a2;
result = (unsigned int)(v2 + 1);
*(_DWORD *)(a1 + 800) = result;
return result;
}

canonical_decompiled_code:
__int64 __fastcall func9(__int64 a1, __int64 a2)
{
int v2; // eax
__int64 result; // rax

v2 = *(_DWORD *)(a1 + 800);
*(_QWORD *)(a1 + 8LL * v2) = a2;
result = (unsigned int)(v2 + 1);
*(_DWORD *)(a1 + 800) = result;
return result;
}

original_code:
void InsertSymbolInTable(Table* table, Symbol* symbol){
    table->symbol_[table->last_]=symbol;
    table->last_++;
}

canonical_original_code:
void InsertSymbolInTable(struct table *table, struct symbol *symbol){
    table->symbol_[table->last_]=symbol;
    table->last_++;
}

variable_types: struct table { struct symbol { char *name_; int value_; } *symbol_[100]; int last_; } *

variable_types:
symbol
struct symbol *

user_defined_types: struct table { struct symbol *symbol_[100]; int last_; }


IncreaseILC

decompiled_code:
__int64 __fastcall IncreaseILC(int a1, const char *a2)
{
int v2; // eax
int v4; // eax
_BOOL4 v5; // ett
int v6; // eax
_BOOL4 v7; // ett
_BOOL4 v8; // ett

v2 = a1;
if ( !strcmp(a2, "LOAD") )
v2 = a1 + 2;
if ( !strcmp(a2, "STORE") )
v2 += 2;
if ( !strcmp(a2, "PUSH") )
v2 += 2;
if ( !strcmp(a2, "POP") )
v2 += 2;
if ( !strcmp(a2, "JMP") )
v2 += 2;
if ( !strcmp(a2, "JPG") )
v2 += 2;
if ( !strcmp(a2, "JPGE") )
v2 += 2;
if ( !strcmp(a2, "JPL") )
v2 += 2;
if ( !strcmp(a2, "JPLE") )
v2 += 2;
if ( !strcmp(a2, "JPE") )
v2 += 2;
if ( !strcmp(a2, "JPNE") )
v2 += 2;
if ( !strcmp(a2, "XOR") )
v2 += 2;
if ( !strcmp(a2, "AND") )
v2 += 2;
if ( !memcmp(a2, "OR", 3uLL) )
v2 += 2;
v5 = strcmp(a2, "NOT") == 0;
v4 = v5 + v2;
if ( !strcmp(a2, "ADD") )
v4 += 2;
if ( !strcmp(a2, "SUB") )
v4 += 2;
if ( !strcmp(a2, "READ") )
v4 += 2;
if ( !strcmp(a2, "WRITE") )
v4 += 2;
if ( !strcmp(a2, "CALL") )
v4 += 2;
v7 = strcmp(a2, "RET") == 0;
v6 = v7 + v4;
v8 = strcmp(a2, "HALT") == 0;
return (unsigned int)(strcmp(a2, "WORD") == 0) + v8 + v6;
}

canonical_decompiled_code:
__int64 __fastcall func10(int a1, const char *a2)
{
int v2; // eax
int v4; // eax
_BOOL4 v5; // ett
int v6; // eax
_BOOL4 v7; // ett
_BOOL4 v8; // ett

v2 = a1;
if ( !strcmp(a2, "LOAD") )
v2 = a1 + 2;
if ( !strcmp(a2, "STORE") )
v2 += 2;
if ( !strcmp(a2, "PUSH") )
v2 += 2;
if ( !strcmp(a2, "POP") )
v2 += 2;
if ( !strcmp(a2, "JMP") )
v2 += 2;
if ( !strcmp(a2, "JPG") )
v2 += 2;
if ( !strcmp(a2, "JPGE") )
v2 += 2;
if ( !strcmp(a2, "JPL") )
v2 += 2;
if ( !strcmp(a2, "JPLE") )
v2 += 2;
if ( !strcmp(a2, "JPE") )
v2 += 2;
if ( !strcmp(a2, "JPNE") )
v2 += 2;
if ( !strcmp(a2, "XOR") )
v2 += 2;
if ( !strcmp(a2, "AND") )
v2 += 2;
if ( !memcmp(a2, "OR", 3uLL) )
v2 += 2;
v5 = strcmp(a2, "NOT") == 0;
v4 = v5 + v2;
if ( !strcmp(a2, "ADD") )
v4 += 2;
if ( !strcmp(a2, "SUB") )
v4 += 2;
if ( !strcmp(a2, "READ") )
v4 += 2;
if ( !strcmp(a2, "WRITE") )
v4 += 2;
if ( !strcmp(a2, "CALL") )
v4 += 2;
v7 = strcmp(a2, "RET") == 0;
v6 = v7 + v4;
v8 = strcmp(a2, "HALT") == 0;
return (unsigned int)(strcmp(a2, "WORD") == 0) + v8 + v6;
}

original_code:
int IncreaseILC(int ILC, char* instruc){
    if(strcmp(instruc,"LOAD")==0)ILC=ILC+2;
    if(strcmp(instruc,"STORE")==0)ILC=ILC+2;
    if(strcmp(instruc,"PUSH")==0)ILC=ILC+2;
    if(strcmp(instruc,"POP")==0)ILC=ILC+2;
    if(strcmp(instruc,"JMP")==0)ILC=ILC+2;
    if(strcmp(instruc,"JPG")==0)ILC=ILC+2;
    if(strcmp(instruc,"JPGE")==0)ILC=ILC+2;
    if(strcmp(instruc,"JPL")==0)ILC=ILC+2;
    if(strcmp(instruc,"JPLE")==0)ILC=ILC+2;
    if(strcmp(instruc,"JPE")==0)ILC=ILC+2;
    if(strcmp(instruc,"JPNE")==0)ILC=ILC+2;
    if(strcmp(instruc,"XOR")==0)ILC=ILC+2;
    if(strcmp(instruc,"AND")==0)ILC=ILC+2;
    if(strcmp(instruc,"OR")==0)ILC=ILC+2;
    if(strcmp(instruc,"NOT")==0)ILC=ILC+1;
    if(strcmp(instruc,"ADD")==0)ILC=ILC+2;
    if(strcmp(instruc,"SUB")==0)ILC=ILC+2;
    if(strcmp(instruc,"READ")==0)ILC=ILC+2;
    if(strcmp(instruc,"WRITE")==0)ILC=ILC+2;
    if(strcmp(instruc,"CALL")==0)ILC=ILC+2;
    if(strcmp(instruc,"RET")==0)ILC=ILC+1;
    if(strcmp(instruc,"HALT")==0)ILC=ILC+1;
    if(strcmp(instruc,"WORD")==0)ILC=ILC+1;
    return(ILC);
}

canonical_original_code:
int IncreaseILC(int ILC, char *instruc){
    if(strcmp(instruc,"LOAD")==0)ILC=ILC+2;
    if(strcmp(instruc,"STORE")==0)ILC=ILC+2;
    if(strcmp(instruc,"PUSH")==0)ILC=ILC+2;
    if(strcmp(instruc,"POP")==0)ILC=ILC+2;
    if(strcmp(instruc,"JMP")==0)ILC=ILC+2;
    if(strcmp(instruc,"JPG")==0)ILC=ILC+2;
    if(strcmp(instruc,"JPGE")==0)ILC=ILC+2;
    if(strcmp(instruc,"JPL")==0)ILC=ILC+2;
    if(strcmp(instruc,"JPLE")==0)ILC=ILC+2;
    if(strcmp(instruc,"JPE")==0)ILC=ILC+2;
    if(strcmp(instruc,"JPNE")==0)ILC=ILC+2;
    if(strcmp(instruc,"XOR")==0)ILC=ILC+2;
    if(strcmp(instruc,"AND")==0)ILC=ILC+2;
    if(strcmp(instruc,"OR")==0)ILC=ILC+2;
    if(strcmp(instruc,"NOT")==0)ILC=ILC+1;
    if(strcmp(instruc,"ADD")==0)ILC=ILC+2;
    if(strcmp(instruc,"SUB")==0)ILC=ILC+2;
    if(strcmp(instruc,"READ")==0)ILC=ILC+2;
    if(strcmp(instruc,"WRITE")==0)ILC=ILC+2;
    if(strcmp(instruc,"CALL")==0)ILC=ILC+2;
    if(strcmp(instruc,"RET")==0)ILC=ILC+1;
    if(strcmp(instruc,"HALT")==0)ILC=ILC+1;
    if(strcmp(instruc,"WORD")==0)ILC=ILC+1;
    return(ILC);
}


decompiled_code:
char *__fastcall Remove2P(char *a1)
{
return strtok(a1, ":");
}

canonical_decompiled_code:
char *__fastcall func11(char *a1)
{
return strtok(a1, ":");
}

original_code:
char* Remove2P(char* str){
    return strtok(str,":");
}

canonical_original_code:
char *Remove2P(char *str){
    return strtok(str,":");
}


isCommentary

decompiled_code:
__int64 __fastcall isCommentary(char *a1)
{
char v1; // al

v1 = *a1;
if ( !*a1 )
return 0LL;
while ( v1 != 59 )
{
v1 = *++a1;
if ( !*a1 )
return 0LL;
}
*a1 = 0;
return 1LL;
}

canonical_decompiled_code:
__int64 __fastcall func13(char *a1)
{
char v1; // al

v1 = *a1;
if ( !*a1 )
return 0LL;
while ( v1 != 59 )
{
v1 = *++a1;
if ( !*a1 )
return 0LL;
}
*a1 = 0;
return 1LL;
}

original_code:
int isCommentary(char* str) {
    int i = 0;
    while((str[i] != '\0') ){
        if(str[i] == ';'){
            str[i]='\0';
            return 1;
        }
        i++;
    }
    return 0;
}

canonical_original_code:
int isCommentary(char *str) {
    int i = 0;
    while((str[i] != '\0') ){
        if(str[i] == ';'){
            str[i]='\0';
            return 1;
        }
        i++;
    }
    return 0;
}

variable_types: i int


SearchLabelValue

decompiled_code:
__int64 __fastcall SearchLabelValue(__int64 a1, const char *a2)
{
int v2; // eax
const char ***v3; // rbx
__int64 v4; // r13
const char **v5; // rbp

v2 = *(_DWORD *)(a1 + 800);
if ( v2 <= 0 )
return 0xFFFFFFFFLL;
v3 = (const char ***)a1;
v4 = a1 + 8LL * (unsigned int)(v2 - 1) + 8;
while ( 1 )
{
v5 = *v3;
if ( !strcmp(**v3, a2) )
break;
if ( ++v3 == (const char ***)v4 )
return 0xFFFFFFFFLL;
}
return *((unsigned int *)v5 + 2);
}

canonical_decompiled_code:
__int64 __fastcall func15(__int64 a1, const char *a2)
{
int v2; // eax
const char ***v3; // rbx
__int64 v4; // r13
const char **v5; // rbp

v2 = *(_DWORD *)(a1 + 800);
if ( v2 <= 0 )
return 0xFFFFFFFFLL;
v3 = (const char ***)a1;
v4 = a1 + 8LL * (unsigned int)(v2 - 1) + 8;
while ( 1 )
{
v5 = *v3;
if ( !strcmp(**v3, a2) )
break;
if ( ++v3 == (const char ***)v4 )
return 0xFFFFFFFFLL;
}
return *((unsigned int *)v5 + 2);
}

original_code:
int SearchLabelValue(Table* table, char* label){
    int i=0;
    for(i=0;i<table->last_;i++){
        if(strcmp(table->symbol_[i]->name_,label) == 0)
            return table->symbol_[i]->value_;
    }
 return -1;
}

canonical_original_code:
int SearchLabelValue(struct table *table, char *label){
    int i = 0;
    for(i=0;i<table->last_;i++){
        if(strcmp(table->symbol_[i]->name_,label) == 0)
            return table->symbol_[i]->value_;
    }
 return -1;
}

variable_types:
label
char *

user_defined_types: struct symbol { char *name_; int value_; }


Decode

decompiled_code:
__int64 __fastcall Decode(const char *a1)
{
unsigned int v2; // edx

v2 = 1;
if ( strcmp(a1, "LOAD") )
{
v2 = 2;
if ( strcmp(a1, "STORE") )
{
v2 = 3;
if ( strcmp(a1, "PUSH") )
{
v2 = 4;
if ( strcmp(a1, "POP") )
{
v2 = 5;
if ( strcmp(a1, "JMP") )
{
v2 = 6;
if ( strcmp(a1, "JPG") )
{
v2 = 7;
if ( strcmp(a1, "JPGE") )
{
v2 = 8;
if ( strcmp(a1, "JPL") )
{
v2 = 9;
if ( strcmp(a1, "JPLE") )
{
v2 = 10;
if ( strcmp(a1, "JPE") )
{
v2 = 11;
if ( strcmp(a1, "JPNE") )
{
v2 = 12;
if ( strcmp(a1, "XOR") )
{
v2 = 13;
if ( strcmp(a1, "AND") )
{
v2 = 14;
if ( memcmp(a1, "OR", 3uLL) )
{
v2 = 15;
if ( strcmp(a1, "NOT") )
{
v2 = 16;
if ( strcmp(a1, "ADD") )
{
v2 = 17;
if ( strcmp(a1, "SUB") )
{
v2 = 18;
if ( strcmp(a1, "READ") )
{
v2 = 19;
if ( strcmp(a1, "WRITE") )
{
v2 = 20;
if ( strcmp(a1, "CALL") )
{
v2 = 21;
if ( strcmp(a1, "RET") )
v2 = strcmp(a1, "HALT") == 0 ? 22 : -1;
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
return v2;
}

canonical_decompiled_code:
__int64 __fastcall func17(const char *a1)
{
unsigned int v2; // edx

v2 = 1;
if ( strcmp(a1, "LOAD") )
{
v2 = 2;
if ( strcmp(a1, "STORE") )
{
v2 = 3;
if ( strcmp(a1, "PUSH") )
{
v2 = 4;
if ( strcmp(a1, "POP") )
{
v2 = 5;
if ( strcmp(a1, "JMP") )
{
v2 = 6;
if ( strcmp(a1, "JPG") )
{
v2 = 7;
if ( strcmp(a1, "JPGE") )
{
v2 = 8;
if ( strcmp(a1, "JPL") )
{
v2 = 9;
if ( strcmp(a1, "JPLE") )
{
v2 = 10;
if ( strcmp(a1, "JPE") )
{
v2 = 11;
if ( strcmp(a1, "JPNE") )
{
v2 = 12;
if ( strcmp(a1, "XOR") )
{
v2 = 13;
if ( strcmp(a1, "AND") )
{
v2 = 14;
if ( memcmp(a1, "OR", 3uLL) )
{
v2 = 15;
if ( strcmp(a1, "NOT") )
{
v2 = 16;
if ( strcmp(a1, "ADD") )
{
v2 = 17;
if ( strcmp(a1, "SUB") )
{
v2 = 18;
if ( strcmp(a1, "READ") )
{
v2 = 19;
if ( strcmp(a1, "WRITE") )
{
v2 = 20;
if ( strcmp(a1, "CALL") )
{
v2 = 21;
if ( strcmp(a1, "RET") )
v2 = strcmp(a1, "HALT") == 0 ? 22 : -1;
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
}
return v2;
}

original_code:
int Decode(char* instruc){
    if(strcmp(instruc,"LOAD")==0) return 1;
    if(strcmp(instruc,"STORE")==0) return 2;
    if(strcmp(instruc,"PUSH")==0) return 3;
    if(strcmp(instruc,"POP")==0) return 4;
    if(strcmp(instruc,"JMP")==0) return 5;
    if(strcmp(instruc,"JPG")==0) return 6;
    if(strcmp(instruc,"JPGE")==0) return 7;
    if(strcmp(instruc,"JPL")==0) return 8;
    if(strcmp(instruc,"JPLE")==0) return 9;
    if(strcmp(instruc,"JPE")==0) return 10;
    if(strcmp(instruc,"JPNE")==0) return 11;
    if(strcmp(instruc,"XOR")==0) return 12;
    if(strcmp(instruc,"AND")==0) return 13;
    if(strcmp(instruc,"OR")==0) return 14;
    if(strcmp(instruc,"NOT")==0) return 15;
    if(strcmp(instruc,"ADD")==0) return 16;
    if(strcmp(instruc,"SUB")==0) return 17;
    if(strcmp(instruc,"READ")==0) return 18;
    if(strcmp(instruc,"WRITE")==0) return 19;
    if(strcmp(instruc,"CALL")==0) return 20;
    if(strcmp(instruc,"RET")==0) return 21;
    if(strcmp(instruc,"HALT")==0) return 22;
    return -1;
}

canonical_original_code:
int Decode(char *instruc){
    if(strcmp(instruc,"LOAD")==0) return 1;
    if(strcmp(instruc,"STORE")==0) return 2;
    if(strcmp(instruc,"PUSH")==0) return 3;
    if(strcmp(instruc,"POP")==0) return 4;
    if(strcmp(instruc,"JMP")==0) return 5;
    if(strcmp(instruc,"JPG")==0) return 6;
    if(strcmp(instruc,"JPGE")==0) return 7;
    if(strcmp(instruc,"JPL")==0) return 8;
    if(strcmp(instruc,"JPLE")==0) return 9;
    if(strcmp(instruc,"JPE")==0) return 10;
    if(strcmp(instruc,"JPNE")==0) return 11;
    if(strcmp(instruc,"XOR")==0) return 12;
    if(strcmp(instruc,"AND")==0) return 13;
    if(strcmp(instruc,"OR")==0) return 14;
    if(strcmp(instruc,"NOT")==0) return 15;
    if(strcmp(instruc,"ADD")==0) return 16;
    if(strcmp(instruc,"SUB")==0) return 17;
    if(strcmp(instruc,"READ")==0) return 18;
    if(strcmp(instruc,"WRITE")==0) return 19;
    if(strcmp(instruc,"CALL")==0) return 20;
    if(strcmp(instruc,"RET")==0) return 21;
    if(strcmp(instruc,"HALT")==0) return 22;
    return -1;
}