decompiled_code:
__int64 __fastcall read_sv(__int64 a1, __int64 *a2)
{
int v2; // eax
unsigned int v3; // ebx
int v5[7]; // [rsp+Ch] [rbp-1Ch] BYREF

readn(a1, v5, 4LL);
++v5[0];
a2[1] = xmalloc(8LL * v5[0]);
v2 = read_block((unsigned int)a1, a2);
v3 = v2;
if ( v2 > 0 )
unpack_svec((__int64)a2, v2);
return v3;
}

canonical_decompiled_code:
__int64 __fastcall func2(__int64 a1, __int64 *a2)
{
int v2; // eax
unsigned int v3; // ebx
int v5[7]; // [rsp+Ch] [rbp-1Ch] BYREF

readn(a1, v5, 4LL);
++v5[0];
a2[1] = xmalloc(8LL * v5[0]);
v2 = func1((unsigned int)a1, a2);
v3 = v2;
if ( v2 > 0 )
func0((__int64)a2, v2);
return v3;
}

original_code:
int read_sv(int fd, sv *sv)
{
  int size, count;
  readn(fd, &count, sizeof (int));
  sv->svec = xmalloc(++count * sizeof (char *));
  size = read_block(fd, &(sv->buffer));
  if (size > 0) unpack_svec(sv, size);
  return size;
}

canonical_original_code:
int read_sv(int fd, struct sv *sv)
{
  int size; int count;
  readn(fd, &count, sizeof (int));
  sv->svec = xmalloc(++count * sizeof (char *));
  size = read_block(fd, &(sv->buffer));
  if (size > 0) unpack_svec(sv, size);
  return size;
}

variable_types: count int


repo: cklin/mdm

decompiled_code:
__int64 __fastcall write_string(unsigned int a1, const char *a2)
{
__int64 v2; // rbx

v2 = (unsigned int)strlen(a2) + 1;
write_int(a1, v2);
writen(a1, a2, (int)v2);
return (unsigned int)v2;
}

canonical_decompiled_code:
__int64 __fastcall func3(unsigned int a1, const char *a2)
{
__int64 v2; // rbx

v2 = (unsigned int)strlen(a2) + 1;
write_int(a1, v2);
writen(a1, a2, (int)v2);
return (unsigned int)v2;
}

original_code:
int write_string(int fd, const char buffer[])
{
  int size;
  size = strlen(buffer)+1;
  write_int(fd, size);
  writen(fd, buffer, size);
  return size;
}

canonical_original_code:
int write_string(int fd, char buffer[])
{
  int size;
  size = strlen(buffer)+1;
  write_int(fd, size);
  writen(fd, buffer, size);
  return size;
}

variable_types: fd int

variable_types:
buffer
char []

variable_types: size int

return_type: int


decompiled_code:
__int64 __fastcall write_sv(unsigned int a1, const char **a2)
{
const char *v4; // rdi
__int64 v5; // rbp
unsigned int v6; // er13
__int64 v7; // rsi
const char *v8; // rbp
const char **v9; // rbx
size_t v10; // rax

v4 = *a2;
if ( *a2 )
{
v5 = 1LL;
v6 = 0;
do
{
v7 = (unsigned int)v5;
v6 += strlen(v4) + 1;
v4 = a2[v5++];
}
while ( v4 );
}
else
{
v6 = 0;
v7 = 0LL;
}
write_int(a1, v7);
write_int(a1, v6);
v8 = *a2;
if ( *a2 )
{
v9 = a2 + 1;
do
{
v10 = strlen(v8);
writen(a1, v8, v10 + 1);
v8 = *v9++;
}
while ( v8 );
}
return 0LL;
}

canonical_decompiled_code:
__int64 __fastcall func4(unsigned int a1, const char **a2)
{
const char *v4; // rdi
__int64 v5; // rbp
unsigned int v6; // er13
__int64 v7; // rsi
const char *v8; // rbp
const char **v9; // rbx
size_t v10; // rax

v4 = *a2;
if ( *a2 )
{
v5 = 1LL;
v6 = 0;
do
{
v7 = (unsigned int)v5;
v6 += strlen(v4) + 1;
v4 = a2[v5++];
}
while ( v4 );
}
else
{
v6 = 0;
v7 = 0LL;
}
write_int(a1, v7);
write_int(a1, v6);
v8 = *a2;
if ( *a2 )
{
v9 = a2 + 1;
do
{
v10 = strlen(v8);
writen(a1, v8, v10 + 1);
v8 = *v9++;
}
while ( v8 );
}
return 0LL;
}

original_code:
int write_sv(int fd, char *const svec[])
{
  int index, size;
  for (index=0, size=0; svec[index]; index++, size++)
    size += strlen(svec[index]);
  write_int(fd, index);
  write_int(fd, size);
  for (index=0; svec[index]; index++)
    writen(fd, svec[index], strlen(svec[index])+1);
  return 0;
}

canonical_original_code:
int write_sv(int fd, char *svec[])
{
  int index; int size;
  for (index=0, size=0; svec[index]; index++, size++)
    size += strlen(svec[index]);
  write_int(fd, index);
  write_int(fd, size);
  for (index=0; svec[index]; index++)
    writen(fd, svec[index], strlen(svec[index])+1);
  return 0;
}

variable_types:
svec
char *[]

variable_types: index int


decompiled_code:
__int64 __fastcall read_job(__int64 a1, __int64 *a2)
{
readn(a1, a2 + 4, 4LL);
read_sv((unsigned int)a1, a2);
return read_sv((unsigned int)a1, a2 + 2);
}

canonical_decompiled_code:
__int64 __fastcall func5(__int64 a1, __int64 *a2)
{
readn(a1, a2 + 4, 4LL);
func2((unsigned int)a1, a2);
return func2((unsigned int)a1, a2 + 2);
}

original_code:
void read_job(int fd, job *job)
{
  readn(fd, &(job->cwd), sizeof (int));
  read_sv(fd, &(job->cmd));
  read_sv(fd, &(job->env));
}

canonical_original_code:
void read_job(int fd, struct job *job)
{
  readn(fd, &(job->cwd), sizeof (int));
  read_sv(fd, &(job->cmd));
  read_sv(fd, &(job->env));
}

variable_types: struct job { struct sv { char *buffer; char **svec; } cmd; int cwd; } *

return_type: void


decompiled_code:
__int64 __fastcall write_job(__int64 a1, __int64 a2)
{
write_int(a1, *(unsigned int *)(a2 + 32));
write_sv(a1, *(const char ***)(a2 + 8));
return write_sv(a1, *(const char ***)(a2 + 24));
}

canonical_decompiled_code:
__int64 __fastcall func6(__int64 a1, __int64 a2)
{
write_int(a1, *(unsigned int *)(a2 + 32));
func4(a1, *(const char ***)(a2 + 8));
return func4(a1, *(const char ***)(a2 + 24));
}

original_code:
void write_job(int fd, const job *job)
{
  write_int(fd, job->cwd);
  write_sv(fd, job->cmd.svec);
  write_sv(fd, job->env.svec);
}

canonical_original_code:
void write_job(int fd, struct job *job)
{
  write_int(fd, job->cwd);
  write_sv(fd, job->cmd.svec);
  write_sv(fd, job->env.svec);
}

user_defined_types: struct sv { char *buffer; char **svec; }


xmalloc

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

result = malloc(a1);
if ( a1 )
{
if ( !result )
errx(100, "Memory allocation failure (%u bytes)", a1);
}
return result;
}

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

result = malloc(a1);
if ( a1 )
{
if ( !result )
errx(100, "Memory allocation failure (%u bytes)", a1);
}
return result;
}

original_code:
void *xmalloc(size_t size)
{
  void *ptr = malloc(size);
  if (size > 0 && ptr == ((void *)0))
    errx(100, "Memory allocation failure (%u bytes)", size);
  return ptr;
}

canonical_original_code:
void *xmalloc(unsigned long size)
{
  void *ptr = malloc(size);
  if (size > 0 && ptr == ((void *)0))
    errx(100, "Memory allocation failure (%u bytes)", size);
  return ptr;
}

variable_types:
size
unsigned long

variable_types:
ptr
void *

return_type: void *


decompiled_code:
char *__fastcall path_join(char *src, char *a2)
{
int v2; // er14
int v3; // er13
int v4; // eax
char *v5; // rbx

if ( !src || !a2 )
errx(101, "NULL argument in path_join");
if ( *src != 47 )
errx(102, "Relative path argument 1 in path_join");
if ( strchr(a2, 47) )
errx(103, "Relative path argument 2 in path_join");
v2 = strlen(src);
v3 = v2;
v4 = strlen(a2);
v5 = (char *)xmalloc(v2 + v4 + 2);
strcpy(v5, src);
if ( v5[v2 - 1] != 47 )
{
v3 = v2 + 1;
v5[v2] = 47;
}
strcpy(&v5[v3], a2);
return v5;
}

canonical_decompiled_code:
char *__fastcall func1(char *src, char *a2)
{
int v2; // er14
int v3; // er13
int v4; // eax
char *v5; // rbx

if ( !src || !a2 )
errx(101, "NULL argument in path_join");
if ( *src != 47 )
errx(102, "Relative path argument 1 in path_join");
if ( strchr(a2, 47) )
errx(103, "Relative path argument 2 in path_join");
v2 = strlen(src);
v3 = v2;
v4 = strlen(a2);
v5 = (char *)func0(v2 + v4 + 2);
strcpy(v5, src);
if ( v5[v2 - 1] != 47 )
{
v3 = v2 + 1;
v5[v2] = 47;
}
strcpy(&v5[v3], a2);
return v5;
}

original_code:
char *path_join(const char *path, const char *name)
{
  int path_len, name_len;
  char *pathname;
  if (path == ((void *)0) || name == ((void *)0))
    errx(101, "NULL argument in path_join");
  if (path[0] != '/')
    errx(102, "Relative path argument 1 in path_join");
  if (strchr(name, '/'))
    errx(103, "Relative path argument 2 in path_join");
  path_len = strlen(path);
  name_len = strlen(name);
  pathname = xmalloc(path_len+name_len+2);
  strcpy(pathname, path);
  if (pathname[path_len-1] != '/')
    pathname[path_len++] = '/';
  strcpy(pathname+path_len, name);
  return pathname;
}

canonical_original_code:
char *path_join(char *path, char *name)
{
  int path_len; int name_len;
  char *pathname;
  if (path == ((void *)0) || name == ((void *)0))
    errx(101, "NULL argument in path_join");
  if (path[0] != '/')
    errx(102, "Relative path argument 1 in path_join");
  if (strchr(name, '/'))
    errx(103, "Relative path argument 2 in path_join");
  path_len = strlen(path);
  name_len = strlen(name);
  pathname = xmalloc(path_len+name_len+2);
  strcpy(pathname, path);
  if (pathname[path_len-1] != '/')
    pathname[path_len++] = '/';
  strcpy(pathname+path_len, name);
  return pathname;
}

variable_types:
path
char *

variable_types:
name
char *

variable_types:
pathname
char *

return_type: char *


xstrdup

decompiled_code:
char *__fastcall xstrdup(const char *a1)
{
char *result; // rax

result = strdup(a1);
if ( !result )
err(104, "strdup");
return result;
}

canonical_decompiled_code:
char *__fastcall func2(const char *a1)
{
char *result; // rax

result = strdup(a1);
if ( !result )
err(104, "strdup");
return result;
}

original_code:
char *xstrdup(const char *s)
{
  char *dup = strdup(s);
  if (dup == ((void *)0)) err(104, "strdup");
  return dup;
}

canonical_original_code:
char *xstrdup(char *s)
{
  char *dup = strdup(s);
  if (dup == ((void *)0)) err(104, "strdup");
  return dup;
}

variable_types:
s
char *

variable_types:
dup
char *


decompiled_code:
void __fastcall release_sv(void **a1)
{
free(*a1);
free(a1[1]);
*a1 = 0LL;
a1[1] = 0LL;
}

canonical_decompiled_code:
void __fastcall func3(void **a1)
{
free(*a1);
free(a1[1]);
*a1 = 0LL;
a1[1] = 0LL;
}

original_code:
void release_sv(sv *sv)
{
  free(sv->buffer);
  free(sv->svec);
  sv->buffer = ((void *)0);
  sv->svec = ((void *)0);
}

canonical_original_code:
void release_sv(struct sv *sv)
{
  free(sv->buffer);
  free(sv->svec);
  sv->buffer = ((void *)0);
  sv->svec = ((void *)0);
}

variable_types: struct sv { char *buffer; char **svec; } *


decompiled_code:
void __fastcall release_job(void **a1)
{
release_sv(a1);
release_sv(a1 + 2);
}

canonical_decompiled_code:
void __fastcall func4(void **a1)
{
func3(a1);
func3(a1 + 2);
}

original_code:
void release_job(job *job)
{
  release_sv(&(job->cmd));
  release_sv(&(job->env));
}

canonical_original_code:
void release_job(struct job *job)
{
  release_sv(&(job->cmd));
  release_sv(&(job->env));
}


decompiled_code:
void __fastcall flatten_sv(__int64 a1)
{
_BYTE **v1; // rax
_BYTE *v2; // rax
_BYTE *v3; // rdx
__int64 v4; // rsi
char i; // cl

if ( !*(_QWORD *)a1 || (v1 = *(_BYTE ***)(a1 + 8)) == 0LL )
_assert_fail("sv->buffer != NULL && sv->svec != NULL", "library/buffer.c", 0x54u, "flatten_sv");
v2 = *v1;
if ( *(_BYTE **)a1 != v2 )
_assert_fail("sv->svec[0] == sv->buffer", "library/buffer.c", 0x55u, "flatten_sv");
v3 = v2;
v4 = 8LL;
while ( 1 )
{
for ( i = *v2; *v2; i = *v2 )
{
++v2;
*v3++ = i;
}
*v3 = 32;
v2 = *(_BYTE **)(*(_QWORD *)(a1 + 8) + v4);
v4 += 8LL;
if ( !v2 )
break;
++v3;
}
*v3 = 0;
free(*(void **)(a1 + 8));
*(_QWORD *)(a1 + 8) = 0LL;
}

original_code:
void flatten_sv(sv *sv)
{
  char *vp, *bp;
  int index;
  ((void) sizeof ((sv->buffer != ((void *)0) && sv->svec != ((void *)0)) ? 1 : 0), __extension__ ({ if (sv->buffer != ((void *)0) && sv->svec != ((void *)0)) ; else __assert_fail ("sv->buffer != NULL && sv->svec != NULL", "library/buffer.c", 84, __extension__ __PRETTY_FUNCTION__); }));
  ((void) sizeof ((sv->svec[0] == sv->buffer) ? 1 : 0), __extension__ ({ if (sv->svec[0] == sv->buffer) ; else __assert_fail ("sv->svec[0] == sv->buffer", "library/buffer.c", 85, __extension__ __PRETTY_FUNCTION__); }));
  for (index=0, bp=sv->buffer; sv->svec[index]; index++) {
    vp = sv->svec[index];
    while (*vp) *(bp++) = *(vp++);
    *(bp++) = ' ';
  }
  *(--bp) = '\0';
  free(sv->svec);
  sv->svec = ((void *)0);
}

canonical_original_code:
void flatten_sv(struct sv *sv)
{
  char *vp; char *bp;
  int index;
  ((void) sizeof ((sv->buffer != ((void *)0) && sv->svec != ((void *)0)) ? 1 : 0), __extension__ ({ if (sv->buffer != ((void *)0) && sv->svec != ((void *)0)) ; else __assert_fail ("sv->buffer != NULL && sv->svec != NULL", "library/buffer.c", 84, __extension__ __PRETTY_FUNCTION__); }));
  ((void) sizeof ((sv->svec[0] == sv->buffer) ? 1 : 0), __extension__ ({ if (sv->svec[0] == sv->buffer) ; else __assert_fail ("sv->svec[0] == sv->buffer", "library/buffer.c", 85, __extension__ __PRETTY_FUNCTION__); }));
  for (index=0, bp=sv->buffer; sv->svec[index]; index++) {
    vp = sv->svec[index];
    while (*vp) *(bp++) = *(vp++);
    *(bp++) = ' ';
  }
  *(--bp) = '\0';
  free(sv->svec);
  sv->svec = ((void *)0);
}

variable_types:
vp
char *

variable_types:
bp
char *


repo: cknadler/marktab-c

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

v1 = *a1;
if ( !*a1 )
return 0LL;
v2 = a1 + 1;
v3 = 0LL;
do
{
v3 += (v1 & 0xC0) != 128;
v1 = *v2++;
}
while ( v1 );
return v3;
}

original_code:
static size_t utf8_length(const char* utf8_data) {
   size_t i = 0, j = 0;
   while (utf8_data[i]) {
     if ((utf8_data[i] & 0xC0) != 0x80) j++;
     i++;
   }
   return j;
}

canonical_original_code:
static unsigned long utf8_length(char *utf8_data) {
   unsigned long i = 0; unsigned long j = 0;
   while (utf8_data[i]) {
     if ((utf8_data[i] & 0xC0) != 0x80) j++;
     i++;
   }
   return j;
}

variable_types:
i
unsigned long

variable_types:
j
unsigned long

return_type: unsigned long


decompiled_code:
_QWORD *mt_string_new()
{
_QWORD *result; // rax

result = malloc(0x20uLL);
if ( !result )
_assert_fail("string != NULL", "src/mt_string.c", 0x16u, "mt_string_new");
*result = 0LL;
result[1] = 0LL;
result[3] = 0LL;
return result;
}

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

result = malloc(0x20uLL);
if ( !result )
_assert_fail("string != NULL", "src/mt_string.c", 0x16u, "mt_string_new");
*result = 0LL;
result[1] = 0LL;
result[3] = 0LL;
return result;
}

original_code:
MtString* mt_string_new()
{
  MtString* const string = ((MtString *) malloc(sizeof(MtString)));
  ((void) sizeof ((string != ((void *)0)) ? 1 : 0), __extension__ ({ if (string != ((void *)0)) ; else __assert_fail ("string != NULL", "src/mt_string.c", 22, __extension__ __PRETTY_FUNCTION__); }));
  string->utf8_data = ((void *)0);
  string->size = 0;
  string->hash = 0;
  return string;
}

canonical_original_code:
struct MtString *mt_string_new()
{
  struct MtString *string = ((MtString *) malloc(sizeof(MtString)));
  ((void) sizeof ((string != ((void *)0)) ? 1 : 0), __extension__ ({ if (string != ((void *)0)) ; else __assert_fail ("string != NULL", "src/mt_string.c", 22, __extension__ __PRETTY_FUNCTION__); }));
  string->utf8_data = ((void *)0);
  string->size = 0;
  string->hash = 0;
  return string;
}

variable_types: struct MtString { char *utf8_data; unsigned long size; unsigned long length; unsigned long hash; } *


decompiled_code:
void *__fastcall mt_string_set_utf8(__int64 a1, char *a2)
{
size_t v2; // rax
size_t v3; // r12
size_t v4; // r13
void *result; // rax

if ( !a1 )
_assert_fail("string != NULL", "src/mt_string.c", 0x68u, "mt_string_set_utf8");
if ( !a2 )
_assert_fail("utf8_data != NULL", "src/mt_string.c", 0x69u, "mt_string_set_utf8");
v2 = strlen(a2);
v3 = v2;
if ( a2[v2] )
_assert_fail("utf8_data[size] == '\\0'", "src/mt_string.c", 0x6Eu, "mt_string_set_utf8");
v4 = v2 + 1;
if ( *(_QWORD *)(a1 + 8) < v2 + 1 )
*(_QWORD *)a1 = realloc(*(void **)a1, v2 + 1);
*(_QWORD *)(a1 + 8) = v4;
*(_QWORD *)(a1 + 16) = utf8_length(a2);
memcpy(*(void **)a1, a2, v4);
result = *(void **)a1;
if ( *(_BYTE *)(*(_QWORD *)a1 + v3) )
_assert_fail("string->utf8_data[size] == '\\0'", "src/mt_string.c", 0x7Bu, "mt_string_set_utf8");
*(_QWORD *)(a1 + 24) = 0LL;
return result;
}

canonical_decompiled_code:
void *__fastcall func2(__int64 a1, char *a2)
{
size_t v2; // rax
size_t v3; // r12
size_t v4; // r13
void *result; // rax

if ( !a1 )
_assert_fail("string != NULL", "src/mt_string.c", 0x68u, "mt_string_set_utf8");
if ( !a2 )
_assert_fail("utf8_data != NULL", "src/mt_string.c", 0x69u, "mt_string_set_utf8");
v2 = strlen(a2);
v3 = v2;
if ( a2[v2] )
_assert_fail("utf8_data[size] == '\\0'", "src/mt_string.c", 0x6Eu, "mt_string_set_utf8");
v4 = v2 + 1;
if ( *(_QWORD *)(a1 + 8) < v2 + 1 )
*(_QWORD *)a1 = realloc(*(void **)a1, v2 + 1);
*(_QWORD *)(a1 + 8) = v4;
*(_QWORD *)(a1 + 16) = func0(a2);
memcpy(*(void **)a1, a2, v4);
result = *(void **)a1;
if ( *(_BYTE *)(*(_QWORD *)a1 + v3) )
_assert_fail("string->utf8_data[size] == '\\0'", "src/mt_string.c", 0x7Bu, "mt_string_set_utf8");
*(_QWORD *)(a1 + 24) = 0LL;
return result;
}

original_code:
void mt_string_set_utf8(MtString* string, const char* utf8_data)
{
  ((void) sizeof ((string != ((void *)0)) ? 1 : 0), __extension__ ({ if (string != ((void *)0)) ; else __assert_fail ("string != NULL", "src/mt_string.c", 104, __extension__ __PRETTY_FUNCTION__); }));
  ((void) sizeof ((utf8_data != ((void *)0)) ? 1 : 0), __extension__ ({ if (utf8_data != ((void *)0)) ; else __assert_fail ("utf8_data != NULL", "src/mt_string.c", 105, __extension__ __PRETTY_FUNCTION__); }));
  size_t size = strlen(utf8_data);
  ((void) sizeof ((utf8_data[size] == '\0') ? 1 : 0), __extension__ ({ if (utf8_data[size] == '\0') ; else __assert_fail ("utf8_data[size] == '\\0'", "src/mt_string.c", 110, __extension__ __PRETTY_FUNCTION__); }));
  if (string->size < size + 1)
    string->utf8_data = realloc(string->utf8_data, size + 1);
  string->size = size + 1;
  string->length = utf8_length(utf8_data);
  memcpy(string->utf8_data, utf8_data, size + 1);
  ((void) sizeof ((string->utf8_data[size] == '\0') ? 1 : 0), __extension__ ({ if (string->utf8_data[size] == '\0') ; else __assert_fail ("string->utf8_data[size] == '\\0'", "src/mt_string.c", 123, __extension__ __PRETTY_FUNCTION__); }));
  string->hash = 0;
}

canonical_original_code:
void mt_string_set_utf8(struct MtString *string, char *utf8_data)
{
  ((void) sizeof ((string != ((void *)0)) ? 1 : 0), __extension__ ({ if (string != ((void *)0)) ; else __assert_fail ("string != NULL", "src/mt_string.c", 104, __extension__ __PRETTY_FUNCTION__); }));
  ((void) sizeof ((utf8_data != ((void *)0)) ? 1 : 0), __extension__ ({ if (utf8_data != ((void *)0)) ; else __assert_fail ("utf8_data != NULL", "src/mt_string.c", 105, __extension__ __PRETTY_FUNCTION__); }));
  unsigned long size = strlen(utf8_data);
  ((void) sizeof ((utf8_data[size] == '\0') ? 1 : 0), __extension__ ({ if (utf8_data[size] == '\0') ; else __assert_fail ("utf8_data[size] == '\\0'", "src/mt_string.c", 110, __extension__ __PRETTY_FUNCTION__); }));
  if (string->size < size + 1)
    string->utf8_data = realloc(string->utf8_data, size + 1);
  string->size = size + 1;
  string->length = utf8_length(utf8_data);
  memcpy(string->utf8_data, utf8_data, size + 1);
  ((void) sizeof ((string->utf8_data[size] == '\0') ? 1 : 0), __extension__ ({ if (string->utf8_data[size] == '\0') ; else __assert_fail ("string->utf8_data[size] == '\\0'", "src/mt_string.c", 123, __extension__ __PRETTY_FUNCTION__); }));
  string->hash = 0;
}

user_defined_types: struct MtString { char *utf8_data; unsigned long size; unsigned long length; unsigned long hash; }


decompiled_code:
char **__fastcall mt_string_new_from_integer(unsigned int a1)
{
char **v1; // rbx

v1 = (char **)mt_string_new_from_utf8(" ");
sprintf(*v1, "%d", a1);
v1[2] = (char *)utf8_length(*v1);
return v1;
}

canonical_decompiled_code:
char **__fastcall func3(unsigned int a1)
{
char **v1; // rbx

v1 = (char **)mt_string_new_from_utf8(" ");
sprintf(*v1, "%d", a1);
v1[2] = (char *)func0(*v1);
return v1;
}

original_code:
MtString* mt_string_new_from_integer(int integer)
{
  MtString* string = mt_string_new_from_utf8("               ");
  sprintf(string->utf8_data,"%d", integer);
  string->length = utf8_length(string->utf8_data);
  return string;
}

canonical_original_code:
struct MtString *mt_string_new_from_integer(int integer)
{
  struct MtString *string = mt_string_new_from_utf8("               ");
  sprintf(string->utf8_data,"%d", integer);
  string->length = utf8_length(string->utf8_data);
  return string;
}

variable_types: integer int

return_type: struct MtString { char *utf8_data; unsigned long size; unsigned long length; unsigned long hash; } *


decompiled_code:
char **__fastcall mt_string_new_from_real(double a1)
{
char **v1; // rbx

v1 = (char **)mt_string_new_from_utf8(" ");
sprintf(*v1, "%lg", a1);
v1[2] = (char *)utf8_length(*v1);
return v1;
}

canonical_decompiled_code:
char **__fastcall func4(double a1)
{
char **v1; // rbx

v1 = (char **)mt_string_new_from_utf8(" ");
sprintf(*v1, "%lg", a1);
v1[2] = (char *)func0(*v1);
return v1;
}

original_code:
MtString* mt_string_new_from_real(double real)
{
  MtString* string = mt_string_new_from_utf8("               ");
  sprintf(string->utf8_data, "%lg", real);
  string->length = utf8_length(string->utf8_data);
  return string;
}

canonical_original_code:
struct MtString *mt_string_new_from_real(double real)
{
  struct MtString *string = mt_string_new_from_utf8("               ");
  sprintf(string->utf8_data, "%lg", real);
  string->length = utf8_length(string->utf8_data);
  return string;
}

variable_types: real double


decompiled_code:
void *__fastcall mt_string_cat_utf8(__int64 a1, char *a2)
{
size_t v3; // rbp
unsigned __int64 v4; // rax
size_t v5; // rsi
size_t v6; // rbp
void *result; // rax

if ( !a1 )
_assert_fail("string != NULL", "src/mt_string.c", 0x90u, "mt_string_cat_utf8");
if ( !a2 )
_assert_fail("utf8_data != NULL", "src/mt_string.c", 0x91u, "mt_string_cat_utf8");
v3 = strlen(a2);
if ( a2[v3] )
_assert_fail("utf8_data[size] == '\\0'", "src/mt_string.c", 0x96u, "mt_string_cat_utf8");
v4 = *(_QWORD *)(a1 + 8);
v5 = v4 + v3 + 1;
if ( v4 < v5 )
*(_QWORD *)a1 = realloc(*(void **)a1, v5);
*(_QWORD *)(a1 + 16) += utf8_length(a2);
memcpy((void *)(*(_QWORD *)a1 + *(_QWORD *)(a1 + 8)), a2, v3 + 1);
v6 = *(_QWORD *)(a1 + 8) + v3;
*(_QWORD *)(a1 + 8) = v6;
result = *(void **)a1;
if ( *(_BYTE *)(*(_QWORD *)a1 + v6) )
_assert_fail("string->utf8_data[string->size] == '\\0'", "src/mt_string.c", 0xA4u, "mt_string_cat_utf8");
*(_QWORD *)(a1 + 24) = 0LL;
return result;
}

canonical_decompiled_code:
void *__fastcall func6(__int64 a1, char *a2)
{
size_t v3; // rbp
unsigned __int64 v4; // rax
size_t v5; // rsi
size_t v6; // rbp
void *result; // rax

if ( !a1 )
_assert_fail("string != NULL", "src/mt_string.c", 0x90u, "mt_string_cat_utf8");
if ( !a2 )
_assert_fail("utf8_data != NULL", "src/mt_string.c", 0x91u, "mt_string_cat_utf8");
v3 = strlen(a2);
if ( a2[v3] )
_assert_fail("utf8_data[size] == '\\0'", "src/mt_string.c", 0x96u, "mt_string_cat_utf8");
v4 = *(_QWORD *)(a1 + 8);
v5 = v4 + v3 + 1;
if ( v4 < v5 )
*(_QWORD *)a1 = realloc(*(void **)a1, v5);
*(_QWORD *)(a1 + 16) += func0(a2);
memcpy((void *)(*(_QWORD *)a1 + *(_QWORD *)(a1 + 8)), a2, v3 + 1);
v6 = *(_QWORD *)(a1 + 8) + v3;
*(_QWORD *)(a1 + 8) = v6;
result = *(void **)a1;
if ( *(_BYTE *)(*(_QWORD *)a1 + v6) )
_assert_fail("string->utf8_data[string->size] == '\\0'", "src/mt_string.c", 0xA4u, "mt_string_cat_utf8");
*(_QWORD *)(a1 + 24) = 0LL;
return result;
}

original_code:
void mt_string_cat_utf8(MtString* string, const char* utf8_data)
{
  ((void) sizeof ((string != ((void *)0)) ? 1 : 0), __extension__ ({ if (string != ((void *)0)) ; else __assert_fail ("string != NULL", "src/mt_string.c", 144, __extension__ __PRETTY_FUNCTION__); }));
  ((void) sizeof ((utf8_data != ((void *)0)) ? 1 : 0), __extension__ ({ if (utf8_data != ((void *)0)) ; else __assert_fail ("utf8_data != NULL", "src/mt_string.c", 145, __extension__ __PRETTY_FUNCTION__); }));
  size_t size = strlen(utf8_data);
  ((void) sizeof ((utf8_data[size] == '\0') ? 1 : 0), __extension__ ({ if (utf8_data[size] == '\0') ; else __assert_fail ("utf8_data[size] == '\\0'", "src/mt_string.c", 150, __extension__ __PRETTY_FUNCTION__); }));
  if (string->size < string->size + size + 1)
    string->utf8_data = realloc(string->utf8_data, string->size + size + 1);
  string->length += utf8_length(utf8_data);
  memcpy(string->utf8_data + string->size, utf8_data, size + 1);
  string->size = string->size + size;
  ((void) sizeof ((string->utf8_data[string->size] == '\0') ? 1 : 0), __extension__ ({ if (string->utf8_data[string->size] == '\0') ; else __assert_fail ("string->utf8_data[string->size] == '\\0'", "src/mt_string.c", 164, __extension__ __PRETTY_FUNCTION__); }));
  string->hash = 0;
}

canonical_original_code:
void mt_string_cat_utf8(struct MtString *string, char *utf8_data)
{
  ((void) sizeof ((string != ((void *)0)) ? 1 : 0), __extension__ ({ if (string != ((void *)0)) ; else __assert_fail ("string != NULL", "src/mt_string.c", 144, __extension__ __PRETTY_FUNCTION__); }));
  ((void) sizeof ((utf8_data != ((void *)0)) ? 1 : 0), __extension__ ({ if (utf8_data != ((void *)0)) ; else __assert_fail ("utf8_data != NULL", "src/mt_string.c", 145, __extension__ __PRETTY_FUNCTION__); }));
  unsigned long size = strlen(utf8_data);
  ((void) sizeof ((utf8_data[size] == '\0') ? 1 : 0), __extension__ ({ if (utf8_data[size] == '\0') ; else __assert_fail ("utf8_data[size] == '\\0'", "src/mt_string.c", 150, __extension__ __PRETTY_FUNCTION__); }));
  if (string->size < string->size + size + 1)
    string->utf8_data = realloc(string->utf8_data, string->size + size + 1);
  string->length += utf8_length(utf8_data);
  memcpy(string->utf8_data + string->size, utf8_data, size + 1);
  string->size = string->size + size;
  ((void) sizeof ((string->utf8_data[string->size] == '\0') ? 1 : 0), __extension__ ({ if (string->utf8_data[string->size] == '\0') ; else __assert_fail ("string->utf8_data[string->size] == '\\0'", "src/mt_string.c", 164, __extension__ __PRETTY_FUNCTION__); }));
  string->hash = 0;
}


decompiled_code:
void *__fastcall mt_string_cat(__int64 a1, char **a2)
{
void *result; // rax

if ( !a1 )
_assert_fail("string != NULL", "src/mt_string.c", 0x83u, "mt_string_cat");
if ( !a2 )
_assert_fail("src != NULL", "src/mt_string.c", 0x84u, "mt_string_cat");
result = mt_string_cat_utf8(a1, *a2);
*(_QWORD *)(a1 + 24) = 0LL;
return result;
}

canonical_decompiled_code:
void *__fastcall func7(__int64 a1, char **a2)
{
void *result; // rax

if ( !a1 )
_assert_fail("string != NULL", "src/mt_string.c", 0x83u, "mt_string_cat");
if ( !a2 )
_assert_fail("src != NULL", "src/mt_string.c", 0x84u, "mt_string_cat");
result = func6(a1, *a2);
*(_QWORD *)(a1 + 24) = 0LL;
return result;
}

original_code:
void mt_string_cat(MtString* string, const MtString* src)
{
  ((void) sizeof ((string != ((void *)0)) ? 1 : 0), __extension__ ({ if (string != ((void *)0)) ; else __assert_fail ("string != NULL", "src/mt_string.c", 131, __extension__ __PRETTY_FUNCTION__); }));
  ((void) sizeof ((src != ((void *)0)) ? 1 : 0), __extension__ ({ if (src != ((void *)0)) ; else __assert_fail ("src != NULL", "src/mt_string.c", 132, __extension__ __PRETTY_FUNCTION__); }));
  mt_string_cat_utf8(string, src->utf8_data);
  string->hash = 0;
}

canonical_original_code:
void mt_string_cat(struct MtString *string, struct MtString *src)
{
  ((void) sizeof ((string != ((void *)0)) ? 1 : 0), __extension__ ({ if (string != ((void *)0)) ; else __assert_fail ("string != NULL", "src/mt_string.c", 131, __extension__ __PRETTY_FUNCTION__); }));
  ((void) sizeof ((src != ((void *)0)) ? 1 : 0), __extension__ ({ if (src != ((void *)0)) ; else __assert_fail ("src != NULL", "src/mt_string.c", 132, __extension__ __PRETTY_FUNCTION__); }));
  mt_string_cat_utf8(string, src->utf8_data);
  string->hash = 0;
}

variable_types:
src
struct MtString *


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

if ( !a1 )
_assert_fail("string != NULL", "src/mt_string.c", 0xACu, "mt_string_copy");
if ( !a2 )
_assert_fail("src != NULL", "src/mt_string.c", 0xADu, "mt_string_copy");
mt_string_set_utf8(a1, *(char **)a2);
result = *(_QWORD *)(a2 + 24);
*(_QWORD *)(a1 + 24) = result;
return result;
}

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

if ( !a1 )
_assert_fail("string != NULL", "src/mt_string.c", 0xACu, "mt_string_copy");
if ( !a2 )
_assert_fail("src != NULL", "src/mt_string.c", 0xADu, "mt_string_copy");
func2(a1, *(char **)a2);
result = *(_QWORD *)(a2 + 24);
*(_QWORD *)(a1 + 24) = result;
return result;
}

original_code:
void mt_string_copy(MtString* string, const MtString* src)
{
  ((void) sizeof ((string != ((void *)0)) ? 1 : 0), __extension__ ({ if (string != ((void *)0)) ; else __assert_fail ("string != NULL", "src/mt_string.c", 172, __extension__ __PRETTY_FUNCTION__); }));
  ((void) sizeof ((src != ((void *)0)) ? 1 : 0), __extension__ ({ if (src != ((void *)0)) ; else __assert_fail ("src != NULL", "src/mt_string.c", 173, __extension__ __PRETTY_FUNCTION__); }));
  mt_string_set_utf8(string, src->utf8_data);
  string->hash = src->hash;
}

canonical_original_code:
void mt_string_copy(struct MtString *string, struct MtString *src)
{
  ((void) sizeof ((string != ((void *)0)) ? 1 : 0), __extension__ ({ if (string != ((void *)0)) ; else __assert_fail ("string != NULL", "src/mt_string.c", 172, __extension__ __PRETTY_FUNCTION__); }));
  ((void) sizeof ((src != ((void *)0)) ? 1 : 0), __extension__ ({ if (src != ((void *)0)) ; else __assert_fail ("src != NULL", "src/mt_string.c", 173, __extension__ __PRETTY_FUNCTION__); }));
  mt_string_set_utf8(string, src->utf8_data);
  string->hash = src->hash;
}


decompiled_code:
int __fastcall mt_string_compare(__int64 a1, __int64 a2)
{
size_t v2; // rdx

if ( !a1 )
_assert_fail("string1 != NULL", "src/mt_string.c", 0xB8u, "mt_string_compare");
if ( !a2 )
_assert_fail("string2 != NULL", "src/mt_string.c", 0xB9u, "mt_string_compare");
v2 = *(_QWORD *)(a1 + 16);
if ( *(_QWORD *)(a2 + 16) >= v2 )
v2 = *(_QWORD *)(a2 + 16);
return strncmp(*(const char **)a1, *(const char **)a2, v2);
}

canonical_decompiled_code:
int __fastcall func9(__int64 a1, __int64 a2)
{
size_t v2; // rdx

if ( !a1 )
_assert_fail("string1 != NULL", "src/mt_string.c", 0xB8u, "mt_string_compare");
if ( !a2 )
_assert_fail("string2 != NULL", "src/mt_string.c", 0xB9u, "mt_string_compare");
v2 = *(_QWORD *)(a1 + 16);
if ( *(_QWORD *)(a2 + 16) >= v2 )
v2 = *(_QWORD *)(a2 + 16);
return strncmp(*(const char **)a1, *(const char **)a2, v2);
}

original_code:
int mt_string_compare(const MtString* string1, const MtString* string2)
{
  ((void) sizeof ((string1 != ((void *)0)) ? 1 : 0), __extension__ ({ if (string1 != ((void *)0)) ; else __assert_fail ("string1 != NULL", "src/mt_string.c", 184, __extension__ __PRETTY_FUNCTION__); }));
  ((void) sizeof ((string2 != ((void *)0)) ? 1 : 0), __extension__ ({ if (string2 != ((void *)0)) ; else __assert_fail ("string2 != NULL", "src/mt_string.c", 185, __extension__ __PRETTY_FUNCTION__); }));
  size_t size = (string1->length > string2->length)?
    string1->length : string2->length;
  return strncmp(string1->utf8_data, string2->utf8_data, size);
}

canonical_original_code:
int mt_string_compare(struct MtString *string1, struct MtString *string2)
{
  ((void) sizeof ((string1 != ((void *)0)) ? 1 : 0), __extension__ ({ if (string1 != ((void *)0)) ; else __assert_fail ("string1 != NULL", "src/mt_string.c", 184, __extension__ __PRETTY_FUNCTION__); }));
  ((void) sizeof ((string2 != ((void *)0)) ? 1 : 0), __extension__ ({ if (string2 != ((void *)0)) ; else __assert_fail ("string2 != NULL", "src/mt_string.c", 185, __extension__ __PRETTY_FUNCTION__); }));
  unsigned long size = (string1->length > string2->length)?
    string1->length : string2->length;
  return strncmp(string1->utf8_data, string2->utf8_data, size);
}


decompiled_code:
int __fastcall mt_string_compare_utf8(__int64 a1, char *a2)
{
unsigned __int64 v2; // rax

if ( !a1 )
_assert_fail("string != NULL", "src/mt_string.c", 0xC5u, "mt_string_compare_utf8");
if ( !a2 )
_assert_fail("utf8_data != NULL", "src/mt_string.c", 0xC6u, "mt_string_compare_utf8");
v2 = utf8_length(a2);
if ( *(_QWORD *)(a1 + 16) >= v2 )
v2 = *(_QWORD *)(a1 + 16);
return strncmp(*(const char **)a1, a2, v2);
}

canonical_decompiled_code:
int __fastcall func10(__int64 a1, char *a2)
{
unsigned __int64 v2; // rax

if ( !a1 )
_assert_fail("string != NULL", "src/mt_string.c", 0xC5u, "mt_string_compare_utf8");
if ( !a2 )
_assert_fail("utf8_data != NULL", "src/mt_string.c", 0xC6u, "mt_string_compare_utf8");
v2 = func0(a2);
if ( *(_QWORD *)(a1 + 16) >= v2 )
v2 = *(_QWORD *)(a1 + 16);
return strncmp(*(const char **)a1, a2, v2);
}

original_code:
int mt_string_compare_utf8(MtString* string, const char* utf8_data)
{
  ((void) sizeof ((string != ((void *)0)) ? 1 : 0), __extension__ ({ if (string != ((void *)0)) ; else __assert_fail ("string != NULL", "src/mt_string.c", 197, __extension__ __PRETTY_FUNCTION__); }));
  ((void) sizeof ((utf8_data != ((void *)0)) ? 1 : 0), __extension__ ({ if (utf8_data != ((void *)0)) ; else __assert_fail ("utf8_data != NULL", "src/mt_string.c", 198, __extension__ __PRETTY_FUNCTION__); }));
  size_t ulen = utf8_length(utf8_data);
  size_t size = (string->length > ulen)?
    string->length : ulen;
  return strncmp(string->utf8_data, utf8_data, size);
}

canonical_original_code:
int mt_string_compare_utf8(struct MtString *string, char *utf8_data)
{
  ((void) sizeof ((string != ((void *)0)) ? 1 : 0), __extension__ ({ if (string != ((void *)0)) ; else __assert_fail ("string != NULL", "src/mt_string.c", 197, __extension__ __PRETTY_FUNCTION__); }));
  ((void) sizeof ((utf8_data != ((void *)0)) ? 1 : 0), __extension__ ({ if (utf8_data != ((void *)0)) ; else __assert_fail ("utf8_data != NULL", "src/mt_string.c", 198, __extension__ __PRETTY_FUNCTION__); }));
  unsigned long ulen = utf8_length(utf8_data);
  unsigned long size = (string->length > ulen)?
    string->length : ulen;
  return strncmp(string->utf8_data, utf8_data, size);
}

variable_types:
ulen
unsigned long


decompiled_code:
void __fastcall mt_string_clear(__int64 a1)
{
if ( !a1 )
_assert_fail("string != NULL", "src/mt_string.c", 0xD3u, "mt_string_clear");
free(*(void **)a1);
*(_QWORD *)a1 = 0LL;
*(_QWORD *)(a1 + 8) = 0LL;
*(_QWORD *)(a1 + 16) = 0LL;
*(_QWORD *)(a1 + 24) = 0LL;
}

canonical_decompiled_code:
void __fastcall func11(__int64 a1)
{
if ( !a1 )
_assert_fail("string != NULL", "src/mt_string.c", 0xD3u, "mt_string_clear");
free(*(void **)a1);
*(_QWORD *)a1 = 0LL;
*(_QWORD *)(a1 + 8) = 0LL;
*(_QWORD *)(a1 + 16) = 0LL;
*(_QWORD *)(a1 + 24) = 0LL;
}

original_code:
void mt_string_clear(MtString* string)
{
  ((void) sizeof ((string != ((void *)0)) ? 1 : 0), __extension__ ({ if (string != ((void *)0)) ; else __assert_fail ("string != NULL", "src/mt_string.c", 211, __extension__ __PRETTY_FUNCTION__); }));
  free(string->utf8_data);
  string->utf8_data = ((void *)0);
  string->size = 0;
  string->length = 0;
  string->hash = 0;
}

canonical_original_code:
void mt_string_clear(struct MtString *string)
{
  ((void) sizeof ((string != ((void *)0)) ? 1 : 0), __extension__ ({ if (string != ((void *)0)) ; else __assert_fail ("string != NULL", "src/mt_string.c", 211, __extension__ __PRETTY_FUNCTION__); }));
  free(string->utf8_data);
  string->utf8_data = ((void *)0);
  string->size = 0;
  string->length = 0;
  string->hash = 0;
}


decompiled_code:
__int64 __fastcall mt_string_get_utf8(__int64 a1)
{
if ( !a1 )
_assert_fail("string != NULL", "src/mt_string.c", 0xE1u, "mt_string_get_utf8");
return *(_QWORD *)a1;
}

canonical_decompiled_code:
__int64 __fastcall func12(__int64 a1)
{
if ( !a1 )
_assert_fail("string != NULL", "src/mt_string.c", 0xE1u, "mt_string_get_utf8");
return *(_QWORD *)a1;
}

original_code:
const char* mt_string_get_utf8(MtString* string)
{
  ((void) sizeof ((string != ((void *)0)) ? 1 : 0), __extension__ ({ if (string != ((void *)0)) ; else __assert_fail ("string != NULL", "src/mt_string.c", 225, __extension__ __PRETTY_FUNCTION__); }));
  return string->utf8_data;
}

canonical_original_code:
char *mt_string_get_utf8(struct MtString *string)
{
  ((void) sizeof ((string != ((void *)0)) ? 1 : 0), __extension__ ({ if (string != ((void *)0)) ; else __assert_fail ("string != NULL", "src/mt_string.c", 225, __extension__ __PRETTY_FUNCTION__); }));
  return string->utf8_data;
}


decompiled_code:
__int64 __fastcall mt_string_get_size(__int64 a1)
{
if ( !a1 )
_assert_fail("string != NULL", "src/mt_string.c", 0xE8u, "mt_string_get_size");
return *(_QWORD *)(a1 + 8);
}

canonical_decompiled_code:
__int64 __fastcall func13(__int64 a1)
{
if ( !a1 )
_assert_fail("string != NULL", "src/mt_string.c", 0xE8u, "mt_string_get_size");
return *(_QWORD *)(a1 + 8);
}

original_code:
size_t mt_string_get_size(const MtString* string)
{
  ((void) sizeof ((string != ((void *)0)) ? 1 : 0), __extension__ ({ if (string != ((void *)0)) ; else __assert_fail ("string != NULL", "src/mt_string.c", 232, __extension__ __PRETTY_FUNCTION__); }));
  return string->size;
}

canonical_original_code:
unsigned long mt_string_get_size(struct MtString *string)
{
  ((void) sizeof ((string != ((void *)0)) ? 1 : 0), __extension__ ({ if (string != ((void *)0)) ; else __assert_fail ("string != NULL", "src/mt_string.c", 232, __extension__ __PRETTY_FUNCTION__); }));
  return string->size;
}


decompiled_code:
__int64 __fastcall mt_string_get_length(__int64 a1)
{
if ( !a1 )
_assert_fail("string != NULL", "src/mt_string.c", 0xEFu, "mt_string_get_length");
return *(_QWORD *)(a1 + 16);
}

canonical_decompiled_code:
__int64 __fastcall func14(__int64 a1)
{
if ( !a1 )
_assert_fail("string != NULL", "src/mt_string.c", 0xEFu, "mt_string_get_length");
return *(_QWORD *)(a1 + 16);
}

original_code:
size_t mt_string_get_length(const MtString* string)
{
  ((void) sizeof ((string != ((void *)0)) ? 1 : 0), __extension__ ({ if (string != ((void *)0)) ; else __assert_fail ("string != NULL", "src/mt_string.c", 239, __extension__ __PRETTY_FUNCTION__); }));
  return string->length;
}

canonical_original_code:
unsigned long mt_string_get_length(struct MtString *string)
{
  ((void) sizeof ((string != ((void *)0)) ? 1 : 0), __extension__ ({ if (string != ((void *)0)) ; else __assert_fail ("string != NULL", "src/mt_string.c", 239, __extension__ __PRETTY_FUNCTION__); }));
  return string->length;
}


decompiled_code:
void __fastcall mt_string_free(void *ptr)
{
if ( !ptr )
_assert_fail("string != NULL", "src/mt_string.c", 0xF6u, "mt_string_free");
mt_string_clear((__int64)ptr);
free(ptr);
}

canonical_decompiled_code:
void __fastcall func15(void *ptr)
{
if ( !ptr )
_assert_fail("string != NULL", "src/mt_string.c", 0xF6u, "mt_string_free");
func11((__int64)ptr);
free(ptr);
}

original_code:
void mt_string_free(MtString* string)
{
  ((void) sizeof ((string != ((void *)0)) ? 1 : 0), __extension__ ({ if (string != ((void *)0)) ; else __assert_fail ("string != NULL", "src/mt_string.c", 246, __extension__ __PRETTY_FUNCTION__); }));
  mt_string_clear(string);
  (free(string));
}

canonical_original_code:
void mt_string_free(struct MtString *string)
{
  ((void) sizeof ((string != ((void *)0)) ? 1 : 0), __extension__ ({ if (string != ((void *)0)) ; else __assert_fail ("string != NULL", "src/mt_string.c", 246, __extension__ __PRETTY_FUNCTION__); }));
  mt_string_clear(string);
  (free(string));
}


decompiled_code:
int __fastcall invalid_string(unsigned int a1)
{
return fprintf(stderr, "Invalid string %d\n", a1);
}

canonical_decompiled_code:
int __fastcall func0(unsigned int a1)
{
return fprintf(stderr, "Invalid string %d\n", a1);
}

original_code:
static void
invalid_string(int string)
{
  fprintf(stderr, "Invalid string %d\n", string);
}

variable_types: string int


decompiled_code:
int __fastcall invalid_conf_option(const char *a1)
{
return fprintf(stderr, "Invalid config option: %s\n", a1);
}

canonical_decompiled_code:
int __fastcall func1(const char *a1)
{
return fprintf(stderr, "Invalid config option: %s\n", a1);
}

original_code:
static void
invalid_conf_option(char* op)
{
  fprintf(stderr, "Invalid config option: %s\n", op);
}

canonical_original_code:
static void invalid_conf_option(char *op)
{
  fprintf(stderr, "Invalid config option: %s\n", op);
}

variable_types:
op
char *


decompiled_code:
int __fastcall invalid_conf_data(const char *a1)
{
return fprintf(stderr, "Invalid config data for option: %s\n", a1);
}

canonical_decompiled_code:
int __fastcall func2(const char *a1)
{
return fprintf(stderr, "Invalid config data for option: %s\n", a1);
}

original_code:
static void
invalid_conf_data(char* op)
{
  fprintf(stderr, "Invalid config data for option: %s\n", op);
}

canonical_original_code:
static void invalid_conf_data(char *op)
{
  fprintf(stderr, "Invalid config data for option: %s\n", op);
}


decompiled_code:
int __fastcall undefined_symbol(const char *a1)
{
return fprintf(stderr, "Undefined symbol: %s\n", a1);
}

canonical_decompiled_code:
int __fastcall func3(const char *a1)
{
return fprintf(stderr, "Undefined symbol: %s\n", a1);
}

original_code:
static void
undefined_symbol(char* sym)
{
  fprintf(stderr, "Undefined symbol: %s\n", sym);
}

canonical_original_code:
static void undefined_symbol(char *sym)
{
  fprintf(stderr, "Undefined symbol: %s\n", sym);
}

variable_types:
sym
char *


decompiled_code:
_QWORD *mtr_scope_new()
{
_QWORD *v0; // rax
_QWORD *v1; // rbx

v0 = malloc(0x10uLL);
if ( !v0 )
_assert_fail("scope != NULL", "src/mtr.c", 0xDu, "mtr_scope_new");
v1 = v0;
*(_DWORD *)v0 = 0;
v0[1] = mt_queue_new();
return v1;
}

canonical_decompiled_code:
_QWORD *func0()
{
_QWORD *v0; // rax
_QWORD *v1; // rbx

v0 = malloc(0x10uLL);
if ( !v0 )
_assert_fail("scope != NULL", "src/mtr.c", 0xDu, "mtr_scope_new");
v1 = v0;
*(_DWORD *)v0 = 0;
v0[1] = mt_queue_new();
return v1;
}

original_code:
MtrScope* mtr_scope_new()
{
  MtrScope* scope = ((MtrScope *) malloc(sizeof(MtrScope)));
  ((void) sizeof ((scope != ((void *)0)) ? 1 : 0), __extension__ ({ if (scope != ((void *)0)) ; else __assert_fail ("scope != NULL", "src/mtr.c", 13, __extension__ __PRETTY_FUNCTION__); }));
  scope->last_note_string = 0;
  scope->current_object_queue = mt_queue_new();
  return scope;
}

canonical_original_code:
struct MtrScope *mtr_scope_new()
{
  struct MtrScope *scope = ((MtrScope *) malloc(sizeof(MtrScope)));
  ((void) sizeof ((scope != ((void *)0)) ? 1 : 0), __extension__ ({ if (scope != ((void *)0)) ; else __assert_fail ("scope != NULL", "src/mtr.c", 13, __extension__ __PRETTY_FUNCTION__); }));
  scope->last_note_string = 0;
  scope->current_object_queue = mt_queue_new();
  return scope;
}

variable_types: struct MtrScope { int last_note_string; struct MtQueue { int length; struct MtQueueNode { void *value; struct MtQueueNode *next; } *front; struct MtQueueNode *back; } *current_object_queue; } *

user_defined_types: struct MtrScope { int last_note_string; struct MtQueue *current_object_queue; }

user_defined_types: struct MtQueue { int length; struct MtQueueNode *front; struct MtQueueNode *back; }


decompiled_code:
void __fastcall mtr_scope_free(void *a1)
{
if ( !a1 )
_assert_fail("scope != NULL", "src/mtr.c", 0x17u, "mtr_scope_free");
free(a1);
}

canonical_decompiled_code:
void __fastcall func1(void *a1)
{
if ( !a1 )
_assert_fail("scope != NULL", "src/mtr.c", 0x17u, "mtr_scope_free");
free(a1);
}

original_code:
void mtr_scope_free(MtrScope* scope)
{
  ((void) sizeof ((scope != ((void *)0)) ? 1 : 0), __extension__ ({ if (scope != ((void *)0)) ; else __assert_fail ("scope != NULL", "src/mtr.c", 23, __extension__ __PRETTY_FUNCTION__); }));
  scope->current_object_queue = ((void *)0);
  (free(scope));
}

canonical_original_code:
void mtr_scope_free(struct MtrScope *scope)
{
  ((void) sizeof ((scope != ((void *)0)) ? 1 : 0), __extension__ ({ if (scope != ((void *)0)) ; else __assert_fail ("scope != NULL", "src/mtr.c", 23, __extension__ __PRETTY_FUNCTION__); }));
  scope->current_object_queue = ((void *)0);
  (free(scope));
}

user_defined_types: struct MtQueueNode { void *value; struct MtQueueNode *next; }


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

MTR = mt_stack_new();
*(&MTR + 1) = mt_queue_new();
result = mt_hash_new();
*(&MTR + 2) = result;
return result;
}

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

MTR = mt_stack_new();
*(&MTR + 1) = mt_queue_new();
result = mt_hash_new();
*(&MTR + 2) = result;
return result;
}

original_code:
void mtr_init()
{
  MTR.scopes = mt_stack_new();
  MTR.sections = mt_queue_new();
  MTR.symbol_table = mt_hash_new();
}


decompiled_code:
__int64 mtr_current_object_queue()
{
return *(_QWORD *)(mt_stack_top(MTR) + 8);
}

canonical_decompiled_code:
__int64 func3()
{
return *(_QWORD *)(mt_stack_top(MTR) + 8);
}

original_code:
MtQueue* mtr_current_object_queue()
{
  MtrScope* scope = mt_stack_top(MTR.scopes);
  return scope->current_object_queue;
}

canonical_original_code:
struct MtQueue *mtr_current_object_queue()
{
  struct MtrScope *scope = mt_stack_top(MTR.scopes);
  return scope->current_object_queue;
}

return_type: struct MtQueue { int length; struct MtQueueNode { void *value; struct MtQueueNode *next; } *front; struct MtQueueNode *back; } *


decompiled_code:
__int64 mtr_last_note_string()
{
return *(unsigned int *)mt_stack_top(MTR);
}

canonical_decompiled_code:
__int64 func4()
{
return *(unsigned int *)mt_stack_top(MTR);
}

original_code:
int mtr_last_note_string()
{
  MtrScope* scope = mt_stack_top(MTR.scopes);
  return scope->last_note_string;
}

canonical_original_code:
int mtr_last_note_string()
{
  struct MtrScope *scope = mt_stack_top(MTR.scopes);
  return scope->last_note_string;
}


decompiled_code:
__int64 __fastcall mtr_current_object_queue_enqueue(__int64 a1)
{
__int64 v1; // rax

if ( !a1 )
_assert_fail("object != NULL", "src/mtr.c", 0x3Au, "mtr_current_object_queue_enqueue");
v1 = mt_stack_top(MTR);
return mt_queue_enqueue(*(_QWORD *)(v1 + 8), a1);
}

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

if ( !a1 )
_assert_fail("object != NULL", "src/mtr.c", 0x3Au, "mtr_current_object_queue_enqueue");
v1 = mt_stack_top(MTR);
return mt_queue_enqueue(*(_QWORD *)(v1 + 8), a1);
}

original_code:
void mtr_current_object_queue_enqueue(MtObject* object)
{
  ((void) sizeof ((object != ((void *)0)) ? 1 : 0), __extension__ ({ if (object != ((void *)0)) ; else __assert_fail ("object != NULL", "src/mtr.c", 58, __extension__ __PRETTY_FUNCTION__); }));
  MtrScope* scope = mt_stack_top(MTR.scopes);
  mt_queue_enqueue(scope->current_object_queue, object);
}

canonical_original_code:
void mtr_current_object_queue_enqueue(struct MtObject *object)
{
  ((void) sizeof ((object != ((void *)0)) ? 1 : 0), __extension__ ({ if (object != ((void *)0)) ; else __assert_fail ("object != NULL", "src/mtr.c", 58, __extension__ __PRETTY_FUNCTION__); }));
  struct MtrScope *scope = mt_stack_top(MTR.scopes);
  mt_queue_enqueue(scope->current_object_queue, object);
}

variable_types: struct MtObject { enum MtObjectType { MT_OBJ_NONE=0, MT_OBJ_NOTE=1, MT_OBJ_CHORD=2, MT_OBJ_TRANSITION=3, MT_OBJ_SEQUENCE=4, MT_OBJ_REST=5, MT_OBJ_SYMBOL=6 } type; union asvalue { struct MtNote { enum MtNoteType { MT_NOTE_NONE=0, MT_NOTE_NOTE=1, MT_NOTE_MUTE=2 } type; int string; int fret; enum MtModifier { MT_MODIFIER_NONE=0, MT_MODIFIER_PALM_MUTE=1, MT_MODIFIER_HARMONIC=2, MT_MODIFIER_VIBRATO=3 } modifier; int size; } *note; struct MtChord { struct MtQueue { int length; struct MtQueueNode { void *value; struct MtQueueNode *next; } *front; struct MtQueueNode *back; } *notes; enum MtModifier { MT_MODIFIER_NONE=0, MT_MODIFIER_PALM_MUTE=1, MT_MODIFIER_HARMONIC=2, MT_MODIFIER_VIBRATO=3 } modifier; int size; } *chord; struct MtTransition { enum MtTransitionType { MT_TRANSITION_NONE=0, MT_TRANSITION_BEND=1, MT_TRANSITION_SLIDE_UP=2, MT_TRANSITION_SLIDE_DOWN=3, MT_TRANSITION_HAMMER_ON=4, MT_TRANSITION_PULL_OFF=5 } type; struct MtObject *destination; } *transition; struct MtSequence { enum MtModifier { MT_MODIFIER_NONE=0, MT_MODIFIER_PALM_MUTE=1, MT_MODIFIER_HARMONIC=2, MT_MODIFIER_VIBRATO=3 } modifier; struct MtQueue *objects; } *sequence; struct MtSymbol { struct MtString { char *utf8_data; unsigned long size; unsigned long length; unsigned long hash; } *name; enum MtModifier { MT_MODIFIER_NONE=0, MT_MODIFIER_PALM_MUTE=1, MT_MODIFIER_HARMONIC=2, MT_MODIFIER_VIBRATO=3 } modifier; } *symbol; } as; } *

user_defined_types: struct MtObject { enum MtObjectType type; union asvalue as; }

user_defined_types: union asvalue { struct MtNote *note; struct MtChord *chord; struct MtTransition *transition; struct MtSequence *sequence; struct MtSymbol *symbol; }

user_defined_types: struct MtNote { enum MtNoteType type; int string; int fret; enum MtModifier modifier; int size; }

user_defined_types: struct MtChord { struct MtQueue *notes; enum MtModifier modifier; int size; }

user_defined_types: struct MtTransition { enum MtTransitionType type; struct MtObject *destination; }

user_defined_types: struct MtSequence { enum MtModifier modifier; struct MtQueue *objects; }

user_defined_types: struct MtSymbol { struct MtString *name; enum MtModifier modifier; }


decompiled_code:
__int64 mtr_scope_push()
{
_QWORD *v0; // rax

v0 = mtr_scope_new();
return mt_stack_push(MTR, v0);
}

canonical_decompiled_code:
__int64 func6()
{
_QWORD *v0; // rax

v0 = func0();
return mt_stack_push(MTR, v0);
}

original_code:
void mtr_scope_push()
{
  mt_stack_push(MTR.scopes, mtr_scope_new());
}


decompiled_code:
void mtr_scope_pop()
{
void *v0; // rax

v0 = (void *)mt_stack_pop(MTR);
if ( !v0 )
_assert_fail("scope != NULL", "src/mtr.c", 0x48u, "mtr_scope_pop");
mtr_scope_free(v0);
}

canonical_decompiled_code:
void func7()
{
void *v0; // rax

v0 = (void *)mt_stack_pop(MTR);
if ( !v0 )
_assert_fail("scope != NULL", "src/mtr.c", 0x48u, "mtr_scope_pop");
func1(v0);
}

original_code:
void mtr_scope_pop()
{
  MtrScope* scope = mt_stack_pop(MTR.scopes);
  ((void) sizeof ((scope != ((void *)0)) ? 1 : 0), __extension__ ({ if (scope != ((void *)0)) ; else __assert_fail ("scope != NULL", "src/mtr.c", 72, __extension__ __PRETTY_FUNCTION__); }));
  mtr_scope_free(scope);
}

canonical_original_code:
void mtr_scope_pop()
{
  struct MtrScope *scope = mt_stack_pop(MTR.scopes);
  ((void) sizeof ((scope != ((void *)0)) ? 1 : 0), __extension__ ({ if (scope != ((void *)0)) ; else __assert_fail ("scope != NULL", "src/mtr.c", 72, __extension__ __PRETTY_FUNCTION__); }));
  mtr_scope_free(scope);
}


decompiled_code:
__int64 mtr_section_push()
{
__int64 v0; // rax

v0 = mtr_current_object_queue();
return mt_queue_enqueue(*(&MTR + 1), v0);
}

canonical_decompiled_code:
__int64 func8()
{
__int64 v0; // rax

v0 = func3();
return mt_queue_enqueue(*(&MTR + 1), v0);
}

original_code:
void mtr_section_push()
{
  mt_queue_enqueue(MTR.sections, mtr_current_object_queue());
}


decompiled_code:
__int64 mtr_destroy()
{
mtr_scope_pop();
mt_stack_free(MTR);
return mt_hash_free(*(&MTR + 2));
}

canonical_decompiled_code:
__int64 func9()
{
func7();
mt_stack_free(MTR);
return mt_hash_free(*(&MTR + 2));
}

original_code:
void mtr_destroy()
{
  mtr_scope_pop();
  mt_stack_free(MTR.scopes);
  mt_hash_free(MTR.symbol_table);
}


yywrap

decompiled_code:
__int64 yywrap()
{
return 1LL;
}

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

original_code:
int yywrap()
{
  return 1;
}

canonical_original_code:
int yywrap()
{
  return 1;
}


yyerror

decompiled_code:
__int64 __fastcall yyerror(const char *a1)
{
fprintf(stderr, "On line %i: %s\n", yylineno, a1);
return 1LL;
}

canonical_decompiled_code:
__int64 __fastcall func1(const char *a1)
{
fprintf(stderr, "On line %i: %s\n", yylineno, a1);
return 1LL;
}

original_code:
int yyerror(const char* msg)
{
  fprintf(stderr, "On line %i: %s\n", yylineno, msg);
  return 1;
}

canonical_original_code:
int yyerror(char *msg)
{
  fprintf(stderr, "On line %i: %s\n", yylineno, msg);
  return 1;
}

variable_types:
msg
char *


decompiled_code:
void marktab_rend_stdin()
{
;
}

canonical_decompiled_code:
void func2()
{
;
}

original_code:
void marktab_rend_stdin()
{
}

canonical_original_code:
void marktab_rend_stdin()
{
}


decompiled_code:
__int64 __fastcall marktab_rend_file(const char *a1)
{
__int64 result; // rax

yyin = fopen(a1, "r");
if ( yyin )
{
mtr_init();
mt_conf_init();
yyparse();
mt_output(MTR[1]);
result = 0LL;
if ( yyin )
{
fclose(yyin);
result = 0LL;
}
}
else
{
fprintf(stderr, "Can't open: \"%s\"\n", a1);
result = 1LL;
}
return result;
}

canonical_decompiled_code:
__int64 __fastcall func3(const char *a1)
{
__int64 result; // rax

yyin = fopen(a1, "r");
if ( yyin )
{
mtr_init();
mt_conf_init();
yyparse();
mt_output(MTR[1]);
result = 0LL;
if ( yyin )
{
fclose(yyin);
result = 0LL;
}
}
else
{
fprintf(stderr, "Can't open: \"%s\"\n", a1);
result = 1LL;
}
return result;
}

original_code:
int marktab_rend_file(char* file)
{
  yyin = fopen(file, "r");
  if (yyin == ((void *)0))
  {
    fprintf(stderr, "Can't open: \"%s\"\n", file);
    return 1;
  }
  mtr_init();
  mt_conf_init();
  yyparse();
  mt_output(MTR.sections);
  if (yyin != ((void *)0))
    fclose(yyin);
  return 0;
}

canonical_original_code:
int marktab_rend_file(char *file)
{
  yyin = fopen(file, "r");
  if (yyin == ((void *)0))
  {
    fprintf(stderr, "Can't open: \"%s\"\n", file);
    return 1;
  }
  mtr_init();
  mt_conf_init();
  yyparse();
  mt_output(MTR.sections);
  if (yyin != ((void *)0))
    fclose(yyin);
  return 0;
}

variable_types:
file
char *


decompiled_code:
void mt_conf_init()
{
MT_CONF = 6;
*((_QWORD *)&MT_CONF + 1) = "eBGDAE";
*(&MT_CONF + 4) = 80;
}

canonical_decompiled_code:
void func0()
{
MT_CONF = 6;
*((_QWORD *)&MT_CONF + 1) = "eBGDAE";
*(&MT_CONF + 4) = 80;
}

original_code:
void
mt_conf_init()
{
  MT_CONF.strings = 6;
  MT_CONF.string_names = "eBGDAE";
  MT_CONF.max_line_length = 80;
}


decompiled_code:
__int64 __fastcall mt_conf_set_option(__int64 a1, __int64 a2)
{
if ( !a1 )
_assert_fail("id != NULL", "src/mt_conf.c", 0x1Du, "mt_conf_set_option");
if ( !a2 )
_assert_fail("value != NULL", "src/mt_conf.c", 0x1Eu, "mt_conf_set_option");
mt_string_compare_utf8(a1, "tuning");
mt_string_compare_utf8(a1, "line_length");
mt_string_free(a1);
return mt_string_free(a2);
}

canonical_decompiled_code:
__int64 __fastcall func1(__int64 a1, __int64 a2)
{
if ( !a1 )
_assert_fail("id != NULL", "src/mt_conf.c", 0x1Du, "mt_conf_set_option");
if ( !a2 )
_assert_fail("value != NULL", "src/mt_conf.c", 0x1Eu, "mt_conf_set_option");
mt_string_compare_utf8(a1, "tuning");
mt_string_compare_utf8(a1, "line_length");
mt_string_free(a1);
return mt_string_free(a2);
}

original_code:
void
mt_conf_set_option(MtString* id, MtString* value)
{
  ((void) sizeof ((id != ((void *)0)) ? 1 : 0), __extension__ ({ if (id != ((void *)0)) ; else __assert_fail ("id != NULL", "src/mt_conf.c", 29, __extension__ __PRETTY_FUNCTION__); }));
  ((void) sizeof ((value != ((void *)0)) ? 1 : 0), __extension__ ({ if (value != ((void *)0)) ; else __assert_fail ("value != NULL", "src/mt_conf.c", 30, __extension__ __PRETTY_FUNCTION__); }));
  if (mt_string_compare_utf8(id, "tuning"))
    mt_conf_set_tuning(value);
  if (mt_string_compare_utf8(id, "line_length"))
    mt_conf_set_line_length(value);
  mt_string_free(id);
  mt_string_free(value);
}

canonical_original_code:
void mt_conf_set_option(struct MtString *id, struct MtString *value)
{
  ((void) sizeof ((id != ((void *)0)) ? 1 : 0), __extension__ ({ if (id != ((void *)0)) ; else __assert_fail ("id != NULL", "src/mt_conf.c", 29, __extension__ __PRETTY_FUNCTION__); }));
  ((void) sizeof ((value != ((void *)0)) ? 1 : 0), __extension__ ({ if (value != ((void *)0)) ; else __assert_fail ("value != NULL", "src/mt_conf.c", 30, __extension__ __PRETTY_FUNCTION__); }));
  if (mt_string_compare_utf8(id, "tuning"))
    mt_conf_set_tuning(value);
  if (mt_string_compare_utf8(id, "line_length"))
    mt_conf_set_line_length(value);
  mt_string_free(id);
  mt_string_free(value);
}

variable_types:
value
struct MtString *


decompiled_code:
void __fastcall mt_pair_free(void *ptr)
{
if ( !ptr )
_assert_fail("pair != NULL", "src/mt_pair.c", 0x16u, "mt_pair_free");
mt_string_free(*(_QWORD *)ptr);
free(ptr);
}

canonical_decompiled_code:
void __fastcall func0(void *ptr)
{
if ( !ptr )
_assert_fail("pair != NULL", "src/mt_pair.c", 0x16u, "mt_pair_free");
mt_string_free(*(_QWORD *)ptr);
free(ptr);
}

original_code:
void mt_pair_free(MtPair* pair)
{
  ((void) sizeof ((pair != ((void *)0)) ? 1 : 0), __extension__ ({ if (pair != ((void *)0)) ; else __assert_fail ("pair != NULL", "src/mt_pair.c", 22, __extension__ __PRETTY_FUNCTION__); }));
  mt_string_free(pair->key);
  free(pair);
}

canonical_original_code:
void mt_pair_free(struct MtPair *pair)
{
  ((void) sizeof ((pair != ((void *)0)) ? 1 : 0), __extension__ ({ if (pair != ((void *)0)) ; else __assert_fail ("pair != NULL", "src/mt_pair.c", 22, __extension__ __PRETTY_FUNCTION__); }));
  mt_string_free(pair->key);
  free(pair);
}

variable_types: struct MtPair { struct MtString { char *utf8_data; unsigned long size; unsigned long length; unsigned long hash; } *key; void *value; } *

user_defined_types: struct MtPair { struct MtString *key; void *value; }


original_code:
static size_t Murmur3(const char* key, size_t len)
{
  const size_t seed = 0xDEADBEEF;
  const size_t m1 = 0x0acffe3d, m2 = 0x0e4ef5f3, m3 = 0xa729a897;
  const size_t r1 = 11, r2 = 18, r3 = 18;
  size_t h = len + seed, k = 0;
  const size_t* dwords = (const size_t*) key;
  while(len >= sizeof(size_t))
  {
    k = *dwords++;
    { k *= m1; k = (k<<r1)|(k>>(sizeof(size_t)*8-r1)); k *= m2; h *= 3; h ^= k; };
    len -= sizeof(size_t);
  }
  const char* tail = (const char*) dwords;
  switch (len)
  {
    case 3: k ^= tail[2] << 16;
    case 2: k ^= tail[1] << 8;
    case 1:
      k ^= tail[0];
      { k *= m1; k = (k<<r1)|(k>>(sizeof(size_t)*8-r1)); k *= m2; h *= 3; h ^= k; };
  }
  h ^= h >> r2;
  h *= m3;
  h ^= h >> r3;
  return h;
}

canonical_original_code:
static unsigned long Murmur3(char *key, unsigned long len)
{
  unsigned long seed = 0xDEADBEEF;
  unsigned long m1 = 0x0acffe3d; unsigned long m2 = 0x0e4ef5f3; unsigned long m3 = 0xa729a897;
  unsigned long r1 = 11; unsigned long r2 = 18; unsigned long r3 = 18;
  unsigned long h = len + seed; unsigned long k = 0;
  unsigned long *dwords = (const size_t*) key;
  while(len >= sizeof(unsigned long))
  {
    k = *dwords++;
    { k *= m1; k = (k<<r1)|(k>>(sizeof(unsigned long)*8-r1)); k *= m2; h *= 3; h ^= k; };
    len -= sizeof(unsigned long);
  }
  char *tail = (const char*) dwords;
  switch (len)
  {
    case 3: k ^= tail[2] << 16;
    case 2: k ^= tail[1] << 8;
    case 1:
      k ^= tail[0];
      { k *= m1; k = (k<<r1)|(k>>(sizeof(unsigned long)*8-r1)); k *= m2; h *= 3; h ^= k; };
  }
  h ^= h >> r2;
  h *= m3;
  h ^= h >> r3;
  return h;
}

variable_types:
key
char *

variable_types:
len
unsigned long

variable_types:
seed
unsigned long

variable_types:
h
unsigned long

variable_types:
k
unsigned long

variable_types:
dwords
unsigned long *

variable_types:
tail
char *


decompiled_code:
void __fastcall mt_hash_double_size(__int64 a1)
{
__int64 v1; // r12
_QWORD *v2; // r13
unsigned __int64 v3; // rax
__int64 i; // rbx

if ( !a1 )
_assert_fail("hash != NULL", "src/mt_hash.c", 0x6Au, "mt_hash_double_size");
v1 = *(_QWORD *)(a1 + 8);
*(_QWORD *)(a1 + 8) = 2 * v1;
*(_QWORD *)(a1 + 16) = 0LL;
v2 = *(_QWORD **)a1;
*(_QWORD *)a1 = malloc(32 * v1);
if ( 2 * v1 )
{
v3 = 0LL;
do
*(_QWORD *)(*(_QWORD *)a1 + 8 * v3++) = 0LL;
while ( *(_QWORD *)(a1 + 8) > v3 );
}
if ( v1 )
{
for ( i = 0LL; i != v1; ++i )
{
if ( v2[i] )
mt_hash_insert_pair(a1);
}
}
free(v2);
}

original_code:
static void
mt_hash_double_size(MtHash* hash)
{
  ((void) sizeof ((hash != ((void *)0)) ? 1 : 0), __extension__ ({ if (hash != ((void *)0)) ; else __assert_fail ("hash != NULL", "src/mt_hash.c", 106, __extension__ __PRETTY_FUNCTION__); }));
  size_t old_size = hash->size;
  hash->size <<= 1;
  hash->length = 0;
  MtPair** old_buckets = hash->buckets;
  { hash->buckets = malloc(sizeof(MtPair) * hash->size); size_t i; for (i = 0; i < hash->size; ++i) hash->buckets[i] = ((void *)0); };
  MtPair* element;
  size_t i;
  for (i = 0; i < old_size; ++i)
  {
    element = old_buckets[i];
    if (element)
      mt_hash_insert_pair(hash, element);
  }
  free(old_buckets);
}

canonical_original_code:
static void mt_hash_double_size(struct MtHash *hash)
{
  ((void) sizeof ((hash != ((void *)0)) ? 1 : 0), __extension__ ({ if (hash != ((void *)0)) ; else __assert_fail ("hash != NULL", "src/mt_hash.c", 106, __extension__ __PRETTY_FUNCTION__); }));
  unsigned long old_size = hash->size;
  hash->size <<= 1;
  hash->length = 0;
  struct MtPair **old_buckets = hash->buckets;
  { hash->buckets = malloc(sizeof(MtPair) * hash->size); unsigned long i; for (i = 0; i < hash->size; ++i) hash->buckets[i] = ((void *)0); };
  struct MtPair *element;
  unsigned long i;
  for (i = 0; i < old_size; ++i)
  {
    element = old_buckets[i];
    if (element)
      mt_hash_insert_pair(hash, element);
  }
  free(old_buckets);
}

variable_types: struct MtHash { struct MtPair { struct MtString { char *utf8_data; unsigned long size; unsigned long length; unsigned long hash; } *key; void *value; } **buckets; unsigned long size; unsigned long length; } *

variable_types:
i
unsigned long

user_defined_types: struct MtHash { struct MtPair **buckets; unsigned long size; unsigned long length; }


decompiled_code:
void __fastcall mt_hash_insert_pair(_QWORD *a1, _QWORD *a2)
{
__int64 v2; // rbx
_QWORD *v3; // rdx
_QWORD *v4; // rax
__int64 v5; // rax
bool v6; // sf
unsigned __int64 v7; // rax
double v8; // xmm1_8
__int64 v9; // rax
double v10; // xmm0_8

if ( !a1 )
_assert_fail("hash != NULL", "src/mt_hash.c", 0x46u, "mt_hash_insert_pair");
if ( !a2 )
_assert_fail("pair != NULL", "src/mt_hash.c", 0x47u, "mt_hash_insert_pair");
v2 = *(_QWORD *)(*a2 + 24LL) % a1[1];
v3 = (_QWORD *)(*a1 + 8 * v2);
v4 = (_QWORD *)*v3;
if ( *v3 )
{
while ( (unsigned int)mt_string_compare(*v4, *a2) )
{
v2 = (unsigned __int64)(v2 + 1) % a1[1];
v4 = *(_QWORD **)(*a1 + 8 * v2);
if ( !v4 )
return;
}
*(_QWORD *)(*a1 + 8 * v2) = a2;
}
else
{
*v3 = a2;
v5 = a1[2];
v6 = v5 + 1 < 0;
v7 = v5 + 1;
a1[2] = v7;
if ( v6 )
v8 = (double)(int)(v7 & 1 | (v7 >> 1)) + (double)(int)(v7 & 1 | (v7 >> 1));
else
v8 = (double)(int)v7;
v9 = a1[1];
if ( v9 < 0 )
v10 = (double)(int)(a1[1] & 1 | ((unsigned __int64)v9 >> 1))
+ (double)(int)(a1[1] & 1 | ((unsigned __int64)v9 >> 1));
else
v10 = (double)(int)v9;
if ( v8 >= v10 * 0.75 )
mt_hash_double_size((__int64)a1);
}
}

canonical_decompiled_code:
void __fastcall func2(_QWORD *a1, _QWORD *a2)
{
__int64 v2; // rbx
_QWORD *v3; // rdx
_QWORD *v4; // rax
__int64 v5; // rax
bool v6; // sf
unsigned __int64 v7; // rax
double v8; // xmm1_8
__int64 v9; // rax
double v10; // xmm0_8

if ( !a1 )
_assert_fail("hash != NULL", "src/mt_hash.c", 0x46u, "mt_hash_insert_pair");
if ( !a2 )
_assert_fail("pair != NULL", "src/mt_hash.c", 0x47u, "mt_hash_insert_pair");
v2 = *(_QWORD *)(*a2 + 24LL) % a1[1];
v3 = (_QWORD *)(*a1 + 8 * v2);
v4 = (_QWORD *)*v3;
if ( *v3 )
{
while ( (unsigned int)mt_string_compare(*v4, *a2) )
{
v2 = (unsigned __int64)(v2 + 1) % a1[1];
v4 = *(_QWORD **)(*a1 + 8 * v2);
if ( !v4 )
return;
}
*(_QWORD *)(*a1 + 8 * v2) = a2;
}
else
{
*v3 = a2;
v5 = a1[2];
v6 = v5 + 1 < 0;
v7 = v5 + 1;
a1[2] = v7;
if ( v6 )
v8 = (double)(int)(v7 & 1 | (v7 >> 1)) + (double)(int)(v7 & 1 | (v7 >> 1));
else
v8 = (double)(int)v7;
v9 = a1[1];
if ( v9 < 0 )
v10 = (double)(int)(a1[1] & 1 | ((unsigned __int64)v9 >> 1))
+ (double)(int)(a1[1] & 1 | ((unsigned __int64)v9 >> 1));
else
v10 = (double)(int)v9;
if ( v8 >= v10 * 0.75 )
func1((__int64)a1);
}
}

original_code:
static void
mt_hash_insert_pair(MtHash* hash, MtPair* pair)
{
  ((void) sizeof ((hash != ((void *)0)) ? 1 : 0), __extension__ ({ if (hash != ((void *)0)) ; else __assert_fail ("hash != NULL", "src/mt_hash.c", 70, __extension__ __PRETTY_FUNCTION__); }));
  ((void) sizeof ((pair != ((void *)0)) ? 1 : 0), __extension__ ({ if (pair != ((void *)0)) ; else __assert_fail ("pair != NULL", "src/mt_hash.c", 71, __extension__ __PRETTY_FUNCTION__); }));
  size_t index = pair->key->hash % hash->size;
  MtPair* element = hash->buckets[index];
  if (element == ((void *)0))
  {
    hash->buckets[index] = pair;
    ++hash->length;
    if (hash->length >= 0.75 * hash->size)
      mt_hash_double_size(hash);
  }
  while (element != ((void *)0))
  {
    if (mt_string_compare(element->key, pair->key) == 0)
    {
      hash->buckets[index] = pair;
      return;
    }
    ++index;
    index %= hash->size;
    element = hash->buckets[index];
  }
}

canonical_original_code:
static void mt_hash_insert_pair(struct MtHash *hash, struct MtPair *pair)
{
  ((void) sizeof ((hash != ((void *)0)) ? 1 : 0), __extension__ ({ if (hash != ((void *)0)) ; else __assert_fail ("hash != NULL", "src/mt_hash.c", 70, __extension__ __PRETTY_FUNCTION__); }));
  ((void) sizeof ((pair != ((void *)0)) ? 1 : 0), __extension__ ({ if (pair != ((void *)0)) ; else __assert_fail ("pair != NULL", "src/mt_hash.c", 71, __extension__ __PRETTY_FUNCTION__); }));
  unsigned long index = pair->key->hash % hash->size;
  struct MtPair *element = hash->buckets[index];
  if (element == ((void *)0))
  {
    hash->buckets[index] = pair;
    ++hash->length;
    if (hash->length >= 0.75 * hash->size)
      mt_hash_double_size(hash);
  }
  while (element != ((void *)0))
  {
    if (mt_string_compare(element->key, pair->key) == 0)
    {
      hash->buckets[index] = pair;
      return;
    }
    ++index;
    index %= hash->size;
    element = hash->buckets[index];
  }
}

variable_types:
pair
struct MtPair *

variable_types:
index
unsigned long


decompiled_code:
_QWORD *mt_hash_new()
{
_QWORD *v0; // rax
_QWORD *v1; // rbx
_QWORD *v2; // rax
_QWORD *v3; // rdx

v0 = malloc(0x18uLL);
if ( !v0 )
_assert_fail("hash != NULL", "src/mt_hash.c", 0x8Fu, "mt_hash_new");
v1 = v0;
v0[1] = 16LL;
v0[2] = 0LL;
v2 = malloc(0x100uLL);
*v1 = v2;
v3 = v2 + 16;
do
*v2++ = 0LL;
while ( v2 != v3 );
return v1;
}

canonical_decompiled_code:
_QWORD *func3()
{
_QWORD *v0; // rax
_QWORD *v1; // rbx
_QWORD *v2; // rax
_QWORD *v3; // rdx

v0 = malloc(0x18uLL);
if ( !v0 )
_assert_fail("hash != NULL", "src/mt_hash.c", 0x8Fu, "mt_hash_new");
v1 = v0;
v0[1] = 16LL;
v0[2] = 0LL;
v2 = malloc(0x100uLL);
*v1 = v2;
v3 = v2 + 16;
do
*v2++ = 0LL;
while ( v2 != v3 );
return v1;
}

original_code:
MtHash*
mt_hash_new()
{
  MtHash* hash = (MtHash*) malloc(sizeof(MtHash));
  ((void) sizeof ((hash != ((void *)0)) ? 1 : 0), __extension__ ({ if (hash != ((void *)0)) ; else __assert_fail ("hash != NULL", "src/mt_hash.c", 143, __extension__ __PRETTY_FUNCTION__); }));
  hash->size = 16;
  hash->length = 0;
  { hash->buckets = malloc(sizeof(MtPair) * hash->size); size_t i; for (i = 0; i < hash->size; ++i) hash->buckets[i] = ((void *)0); };
  return hash;
}

canonical_original_code:
struct MtHash *mt_hash_new()
{
  struct MtHash *hash = (MtHash*) malloc(sizeof(MtHash));
  ((void) sizeof ((hash != ((void *)0)) ? 1 : 0), __extension__ ({ if (hash != ((void *)0)) ; else __assert_fail ("hash != NULL", "src/mt_hash.c", 143, __extension__ __PRETTY_FUNCTION__); }));
  hash->size = 16;
  hash->length = 0;
  { hash->buckets = malloc(sizeof(MtPair) * hash->size); unsigned long i; for (i = 0; i < hash->size; ++i) hash->buckets[i] = ((void *)0); };
  return hash;
}

return_type: struct MtHash { struct MtPair { struct MtString { char *utf8_data; unsigned long size; unsigned long length; unsigned long hash; } *key; void *value; } **buckets; unsigned long size; unsigned long length; } *


decompiled_code:
void __fastcall mt_hash_insert(_QWORD *a1, __int64 a2, __int64 a3)
{
_QWORD *v4; // rax
unsigned __int64 v5; // r13
char *v6; // rax

if ( !a1 )
_assert_fail("hash != NULL", "src/mt_hash.c", 0x9Du, "mt_hash_insert");
if ( !a2 )
_assert_fail("key != NULL", "src/mt_hash.c", 0x9Eu, "mt_hash_insert");
if ( !*(_QWORD *)(a2 + 24) )
{
v5 = mt_string_get_length(a2);
v6 = (char *)mt_string_get_utf8(a2);
*(_QWORD *)(a2 + 24) = Murmur3(v6, v5);
}
v4 = (_QWORD *)mt_pair_new(a2, a3);
mt_hash_insert_pair(a1, v4);
}

canonical_decompiled_code:
void __fastcall func4(_QWORD *a1, __int64 a2, __int64 a3)
{
_QWORD *v4; // rax
unsigned __int64 v5; // r13
char *v6; // rax

if ( !a1 )
_assert_fail("hash != NULL", "src/mt_hash.c", 0x9Du, "mt_hash_insert");
if ( !a2 )
_assert_fail("key != NULL", "src/mt_hash.c", 0x9Eu, "mt_hash_insert");
if ( !*(_QWORD *)(a2 + 24) )
{
v5 = mt_string_get_length(a2);
v6 = (char *)mt_string_get_utf8(a2);
*(_QWORD *)(a2 + 24) = func0(v6, v5);
}
v4 = (_QWORD *)mt_pair_new(a2, a3);
func2(a1, v4);
}

original_code:
void
mt_hash_insert(MtHash* hash, MtString* key, void* value)
{
  ((void) sizeof ((hash != ((void *)0)) ? 1 : 0), __extension__ ({ if (hash != ((void *)0)) ; else __assert_fail ("hash != NULL", "src/mt_hash.c", 157, __extension__ __PRETTY_FUNCTION__); }));
  ((void) sizeof ((key != ((void *)0)) ? 1 : 0), __extension__ ({ if (key != ((void *)0)) ; else __assert_fail ("key != NULL", "src/mt_hash.c", 158, __extension__ __PRETTY_FUNCTION__); }));
  if (key->hash == 0)
    key->hash = Murmur3(mt_string_get_utf8(key), mt_string_get_length(key));
  mt_hash_insert_pair(hash, mt_pair_new(key, value));
}

canonical_original_code:
void mt_hash_insert(struct MtHash *hash, struct MtString *key, void *value)
{
  ((void) sizeof ((hash != ((void *)0)) ? 1 : 0), __extension__ ({ if (hash != ((void *)0)) ; else __assert_fail ("hash != NULL", "src/mt_hash.c", 157, __extension__ __PRETTY_FUNCTION__); }));
  ((void) sizeof ((key != ((void *)0)) ? 1 : 0), __extension__ ({ if (key != ((void *)0)) ; else __assert_fail ("key != NULL", "src/mt_hash.c", 158, __extension__ __PRETTY_FUNCTION__); }));
  if (key->hash == 0)
    key->hash = Murmur3(mt_string_get_utf8(key), mt_string_get_length(key));
  mt_hash_insert_pair(hash, mt_pair_new(key, value));
}

variable_types:
key
struct MtString *

variable_types:
value
void *


decompiled_code:
void __fastcall mt_hash_free(void *ptr)
{
if ( !ptr )
_assert_fail("hash != NULL", "src/mt_hash.c", 0xE9u, "mt_hash_free");
mt_hash_clear(ptr);
free(*(void **)ptr);
free(ptr);
}

canonical_decompiled_code:
void __fastcall func6(void *ptr)
{
if ( !ptr )
_assert_fail("hash != NULL", "src/mt_hash.c", 0xE9u, "mt_hash_free");
func5(ptr);
free(*(void **)ptr);
free(ptr);
}

original_code:
void
mt_hash_free(MtHash* hash)
{
  ((void) sizeof ((hash != ((void *)0)) ? 1 : 0), __extension__ ({ if (hash != ((void *)0)) ; else __assert_fail ("hash != NULL", "src/mt_hash.c", 233, __extension__ __PRETTY_FUNCTION__); }));
  mt_hash_clear(hash);
  free(hash->buckets);
  free(hash);
}

canonical_original_code:
void mt_hash_free(struct MtHash *hash)
{
  ((void) sizeof ((hash != ((void *)0)) ? 1 : 0), __extension__ ({ if (hash != ((void *)0)) ; else __assert_fail ("hash != NULL", "src/mt_hash.c", 233, __extension__ __PRETTY_FUNCTION__); }));
  mt_hash_clear(hash);
  free(hash->buckets);
  free(hash);
}


decompiled_code:
void __fastcall mt_queue_node_free(void *a1)
{
if ( !a1 )
_assert_fail("node != NULL", "src/mt_queue.c", 0x17u, "mt_queue_node_free");
free(a1);
}

canonical_decompiled_code:
void __fastcall func0(void *a1)
{
if ( !a1 )
_assert_fail("node != NULL", "src/mt_queue.c", 0x17u, "mt_queue_node_free");
free(a1);
}

original_code:
void mt_queue_node_free(MtQueueNode* node)
{
  ((void) sizeof ((node != ((void *)0)) ? 1 : 0), __extension__ ({ if (node != ((void *)0)) ; else __assert_fail ("node != NULL", "src/mt_queue.c", 23, __extension__ __PRETTY_FUNCTION__); }));
  node->value = ((void *)0);
  node->next = ((void *)0);
  free(node);
}

canonical_original_code:
void mt_queue_node_free(struct MtQueueNode *node)
{
  ((void) sizeof ((node != ((void *)0)) ? 1 : 0), __extension__ ({ if (node != ((void *)0)) ; else __assert_fail ("node != NULL", "src/mt_queue.c", 23, __extension__ __PRETTY_FUNCTION__); }));
  node->value = ((void *)0);
  node->next = ((void *)0);
  free(node);
}

variable_types: struct MtQueueNode { void *value; struct MtQueueNode *next; } *


decompiled_code:
_QWORD *mt_queue_new()
{
_QWORD *result; // rax

result = malloc(0x18uLL);
if ( !result )
_assert_fail("queue != NULL", "src/mt_queue.c", 0x27u, "mt_queue_new");
*(_DWORD *)result = 0;
result[1] = 0LL;
result[2] = 0LL;
return result;
}

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

result = malloc(0x18uLL);
if ( !result )
_assert_fail("queue != NULL", "src/mt_queue.c", 0x27u, "mt_queue_new");
*(_DWORD *)result = 0;
result[1] = 0LL;
result[2] = 0LL;
return result;
}

original_code:
MtQueue* mt_queue_new()
{
  MtQueue* queue = (MtQueue *) malloc(sizeof(MtQueue));
  ((void) sizeof ((queue != ((void *)0)) ? 1 : 0), __extension__ ({ if (queue != ((void *)0)) ; else __assert_fail ("queue != NULL", "src/mt_queue.c", 39, __extension__ __PRETTY_FUNCTION__); }));
  queue->length = 0;
  queue->front = ((void *)0);
  queue->back = ((void *)0);
  return queue;
}

canonical_original_code:
struct MtQueue *mt_queue_new()
{
  struct MtQueue *queue = (MtQueue *) malloc(sizeof(MtQueue));
  ((void) sizeof ((queue != ((void *)0)) ? 1 : 0), __extension__ ({ if (queue != ((void *)0)) ; else __assert_fail ("queue != NULL", "src/mt_queue.c", 39, __extension__ __PRETTY_FUNCTION__); }));
  queue->length = 0;
  queue->front = ((void *)0);
  queue->back = ((void *)0);
  return queue;
}

variable_types: struct MtQueue { int length; struct MtQueueNode { void *value; struct MtQueueNode *next; } *front; struct MtQueueNode *back; } *


decompiled_code:
__int64 __fastcall mt_queue_dequeue(__int64 a1)
{
__int64 v2; // rbp
__int64 *v4; // rdi

if ( !a1 )
_assert_fail("queue != NULL", "src/mt_queue.c", 0x47u, "mt_queue_dequeue");
v2 = 0LL;
if ( *(int *)a1 > 0 )
{
v4 = *(__int64 **)(a1 + 8);
v2 = *v4;
*(_QWORD *)(a1 + 8) = v4[1];
mt_queue_node_free(v4);
--*(_DWORD *)a1;
}
return v2;
}

original_code:
void* mt_queue_dequeue(MtQueue* queue)
{
  ((void) sizeof ((queue != ((void *)0)) ? 1 : 0), __extension__ ({ if (queue != ((void *)0)) ; else __assert_fail ("queue != NULL", "src/mt_queue.c", 71, __extension__ __PRETTY_FUNCTION__); }));
  if (queue->length > 0)
  {
    MtQueueNode* front_node = queue->front;
    void* value = front_node->value;
    queue->front = front_node->next;
    mt_queue_node_free(front_node);
    --queue->length;
    return value;
  }
  return ((void *)0);
}

canonical_original_code:
void *mt_queue_dequeue(struct MtQueue *queue)
{
  ((void) sizeof ((queue != ((void *)0)) ? 1 : 0), __extension__ ({ if (queue != ((void *)0)) ; else __assert_fail ("queue != NULL", "src/mt_queue.c", 71, __extension__ __PRETTY_FUNCTION__); }));
  if (queue->length > 0)
  {
    struct MtQueueNode *front_node = queue->front;
    void *value = front_node->value;
    queue->front = front_node->next;
    mt_queue_node_free(front_node);
    --queue->length;
    return value;
  }
  return ((void *)0);
}


decompiled_code:
void __fastcall mt_queue_clear(__int64 a1)
{
if ( !a1 )
_assert_fail("queue != NULL", "src/mt_queue.c", 0x5Du, "mt_queue_clear");
*(_DWORD *)a1 = 0;
*(_QWORD *)(a1 + 8) = 0LL;
*(_QWORD *)(a1 + 16) = 0LL;
}

canonical_decompiled_code:
void __fastcall func3(__int64 a1)
{
if ( !a1 )
_assert_fail("queue != NULL", "src/mt_queue.c", 0x5Du, "mt_queue_clear");
*(_DWORD *)a1 = 0;
*(_QWORD *)(a1 + 8) = 0LL;
*(_QWORD *)(a1 + 16) = 0LL;
}

original_code:
void mt_queue_clear(MtQueue* queue)
{
  ((void) sizeof ((queue != ((void *)0)) ? 1 : 0), __extension__ ({ if (queue != ((void *)0)) ; else __assert_fail ("queue != NULL", "src/mt_queue.c", 93, __extension__ __PRETTY_FUNCTION__); }));
  queue->length = 0;
  queue->front = ((void *)0);
  queue->back = ((void *)0);
}

canonical_original_code:
void mt_queue_clear(struct MtQueue *queue)
{
  ((void) sizeof ((queue != ((void *)0)) ? 1 : 0), __extension__ ({ if (queue != ((void *)0)) ; else __assert_fail ("queue != NULL", "src/mt_queue.c", 93, __extension__ __PRETTY_FUNCTION__); }));
  queue->length = 0;
  queue->front = ((void *)0);
  queue->back = ((void *)0);
}


decompiled_code:
void __fastcall mt_queue_free(void *ptr)
{
if ( !ptr )
_assert_fail("queue != NULL", "src/mt_queue.c", 0x68u, "mt_queue_free");
mt_queue_clear((__int64)ptr);
free(ptr);
}

canonical_decompiled_code:
void __fastcall func4(void *ptr)
{
if ( !ptr )
_assert_fail("queue != NULL", "src/mt_queue.c", 0x68u, "mt_queue_free");
func3((__int64)ptr);
free(ptr);
}

original_code:
void mt_queue_free(MtQueue* queue)
{
  ((void) sizeof ((queue != ((void *)0)) ? 1 : 0), __extension__ ({ if (queue != ((void *)0)) ; else __assert_fail ("queue != NULL", "src/mt_queue.c", 104, __extension__ __PRETTY_FUNCTION__); }));
  mt_queue_clear(queue);
  free(queue);
}

canonical_original_code:
void mt_queue_free(struct MtQueue *queue)
{
  ((void) sizeof ((queue != ((void *)0)) ? 1 : 0), __extension__ ({ if (queue != ((void *)0)) ; else __assert_fail ("queue != NULL", "src/mt_queue.c", 104, __extension__ __PRETTY_FUNCTION__); }));
  mt_queue_clear(queue);
  free(queue);
}


decompiled_code:
void __fastcall mt_stack_node_free(void *a1)
{
if ( !a1 )
_assert_fail("node != NULL", "src/mt_stack.c", 0x14u, "mt_stack_node_free");
free(a1);
}

canonical_decompiled_code:
void __fastcall func0(void *a1)
{
if ( !a1 )
_assert_fail("node != NULL", "src/mt_stack.c", 0x14u, "mt_stack_node_free");
free(a1);
}

original_code:
static void mt_stack_node_free(MtStackNode* node)
{
  ((void) sizeof ((node != ((void *)0)) ? 1 : 0), __extension__ ({ if (node != ((void *)0)) ; else __assert_fail ("node != NULL", "src/mt_stack.c", 20, __extension__ __PRETTY_FUNCTION__); }));
  free(node);
}

canonical_original_code:
static void mt_stack_node_free(struct MtStackNode *node)
{
  ((void) sizeof ((node != ((void *)0)) ? 1 : 0), __extension__ ({ if (node != ((void *)0)) ; else __assert_fail ("node != NULL", "src/mt_stack.c", 20, __extension__ __PRETTY_FUNCTION__); }));
  free(node);
}

variable_types: struct MtStackNode { void *value; struct MtStackNode *next; } *


decompiled_code:
_QWORD *mt_stack_new()
{
_QWORD *result; // rax

result = malloc(0x10uLL);
if ( !result )
_assert_fail("stack != NULL", "src/mt_stack.c", 0x1Du, "mt_stack_new");
*result = 0LL;
result[1] = 0LL;
return result;
}

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

result = malloc(0x10uLL);
if ( !result )
_assert_fail("stack != NULL", "src/mt_stack.c", 0x1Du, "mt_stack_new");
*result = 0LL;
result[1] = 0LL;
return result;
}

original_code:
MtStack* mt_stack_new()
{
  MtStack* stack = (MtStack *) malloc(sizeof(MtStack));
  ((void) sizeof ((stack != ((void *)0)) ? 1 : 0), __extension__ ({ if (stack != ((void *)0)) ; else __assert_fail ("stack != NULL", "src/mt_stack.c", 29, __extension__ __PRETTY_FUNCTION__); }));
  stack->head = ((void *)0);
  stack->size = 0;
  return stack;
}

canonical_original_code:
struct MtStack *mt_stack_new()
{
  struct MtStack *stack = (MtStack *) malloc(sizeof(MtStack));
  ((void) sizeof ((stack != ((void *)0)) ? 1 : 0), __extension__ ({ if (stack != ((void *)0)) ; else __assert_fail ("stack != NULL", "src/mt_stack.c", 29, __extension__ __PRETTY_FUNCTION__); }));
  stack->head = ((void *)0);
  stack->size = 0;
  return stack;
}

variable_types: struct MtStack { struct MtStackNode { void *value; struct MtStackNode *next; } *head; unsigned long size; } *

user_defined_types: struct MtStack { struct MtStackNode *head; unsigned long size; }


decompiled_code:
__int64 __fastcall mt_stack_pop(__int64 a1)
{
__int64 *v1; // rax
__int64 v2; // rbx

if ( !a1 )
_assert_fail("stack != NULL", "src/mt_stack.c", 0x32u, "mt_stack_pop");
v1 = *(__int64 **)a1;
if ( !*(_QWORD *)a1 || (--*(_QWORD *)(a1 + 8), *(_QWORD *)a1 = v1[1], v2 = *v1, mt_stack_node_free(v1), !v2) )
_assert_fail("data != NULL", "src/mt_stack.c", 0x40u, "mt_stack_pop");
return v2;
}

canonical_decompiled_code:
__int64 __fastcall func2(__int64 a1)
{
__int64 *v1; // rax
__int64 v2; // rbx

if ( !a1 )
_assert_fail("stack != NULL", "src/mt_stack.c", 0x32u, "mt_stack_pop");
v1 = *(__int64 **)a1;
if ( !*(_QWORD *)a1 || (--*(_QWORD *)(a1 + 8), *(_QWORD *)a1 = v1[1], v2 = *v1, func0(v1), !v2) )
_assert_fail("data != NULL", "src/mt_stack.c", 0x40u, "mt_stack_pop");
return v2;
}

original_code:
void* mt_stack_pop(MtStack* stack)
{
  ((void) sizeof ((stack != ((void *)0)) ? 1 : 0), __extension__ ({ if (stack != ((void *)0)) ; else __assert_fail ("stack != NULL", "src/mt_stack.c", 50, __extension__ __PRETTY_FUNCTION__); }));
  MtStackNode* node = stack->head;
  void* data = ((void *)0);
  if (stack->head != ((void *)0))
  {
    stack->size--;
    stack->head = stack->head->next;
    data = node->value;
    mt_stack_node_free(node);
  }
  ((void) sizeof ((data != ((void *)0)) ? 1 : 0), __extension__ ({ if (data != ((void *)0)) ; else __assert_fail ("data != NULL", "src/mt_stack.c", 64, __extension__ __PRETTY_FUNCTION__); }));
  return data;
}

canonical_original_code:
void *mt_stack_pop(struct MtStack *stack)
{
  ((void) sizeof ((stack != ((void *)0)) ? 1 : 0), __extension__ ({ if (stack != ((void *)0)) ; else __assert_fail ("stack != NULL", "src/mt_stack.c", 50, __extension__ __PRETTY_FUNCTION__); }));
  struct MtStackNode *node = stack->head;
  void *data = ((void *)0);
  if (stack->head != ((void *)0))
  {
    stack->size--;
    stack->head = stack->head->next;
    data = node->value;
    mt_stack_node_free(node);
  }
  ((void) sizeof ((data != ((void *)0)) ? 1 : 0), __extension__ ({ if (data != ((void *)0)) ; else __assert_fail ("data != NULL", "src/mt_stack.c", 64, __extension__ __PRETTY_FUNCTION__); }));
  return data;
}

variable_types:
data
void *

user_defined_types: struct MtStackNode { void *value; struct MtStackNode *next; }


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

if ( !a1 )
_assert_fail("stack != NULL", "src/mt_stack.c", 0x47u, "mt_stack_top");
result = **a1;
if ( !result )
_assert_fail("stack->head->value != NULL", "src/mt_stack.c", 0x48u, "mt_stack_top");
return result;
}

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

if ( !a1 )
_assert_fail("stack != NULL", "src/mt_stack.c", 0x47u, "mt_stack_top");
result = **a1;
if ( !result )
_assert_fail("stack->head->value != NULL", "src/mt_stack.c", 0x48u, "mt_stack_top");
return result;
}

original_code:
void* mt_stack_top(MtStack* stack)
{
  ((void) sizeof ((stack != ((void *)0)) ? 1 : 0), __extension__ ({ if (stack != ((void *)0)) ; else __assert_fail ("stack != NULL", "src/mt_stack.c", 71, __extension__ __PRETTY_FUNCTION__); }));
  ((void) sizeof ((stack->head->value != ((void *)0)) ? 1 : 0), __extension__ ({ if (stack->head->value != ((void *)0)) ; else __assert_fail ("stack->head->value != NULL", "src/mt_stack.c", 72, __extension__ __PRETTY_FUNCTION__); }));
  return stack->head->value;
}

canonical_original_code:
void *mt_stack_top(struct MtStack *stack)
{
  ((void) sizeof ((stack != ((void *)0)) ? 1 : 0), __extension__ ({ if (stack != ((void *)0)) ; else __assert_fail ("stack != NULL", "src/mt_stack.c", 71, __extension__ __PRETTY_FUNCTION__); }));
  ((void) sizeof ((stack->head->value != ((void *)0)) ? 1 : 0), __extension__ ({ if (stack->head->value != ((void *)0)) ; else __assert_fail ("stack->head->value != NULL", "src/mt_stack.c", 72, __extension__ __PRETTY_FUNCTION__); }));
  return stack->head->value;
}


decompiled_code:
void __fastcall mt_stack_clear(_QWORD *a1)
{
_QWORD *v2; // rbx
void *v3; // rdi

if ( !a1 )
_assert_fail("stack != NULL", "src/mt_stack.c", 0x4Fu, "mt_stack_clear");
v2 = (_QWORD *)*a1;
if ( *a1 )
{
do
{
v3 = v2;
v2 = (_QWORD *)v2[1];
mt_stack_node_free(v3);
}
while ( v2 );
}
*a1 = 0LL;
a1[1] = 0LL;
}

canonical_decompiled_code:
void __fastcall func4(_QWORD *a1)
{
_QWORD *v2; // rbx
void *v3; // rdi

if ( !a1 )
_assert_fail("stack != NULL", "src/mt_stack.c", 0x4Fu, "mt_stack_clear");
v2 = (_QWORD *)*a1;
if ( *a1 )
{
do
{
v3 = v2;
v2 = (_QWORD *)v2[1];
func0(v3);
}
while ( v2 );
}
*a1 = 0LL;
a1[1] = 0LL;
}

original_code:
void mt_stack_clear(MtStack* stack)
{
  ((void) sizeof ((stack != ((void *)0)) ? 1 : 0), __extension__ ({ if (stack != ((void *)0)) ; else __assert_fail ("stack != NULL", "src/mt_stack.c", 79, __extension__ __PRETTY_FUNCTION__); }));
  MtStackNode* node = stack->head;
  MtStackNode* next;
  while (node != ((void *)0))
  {
    next = node->next;
    mt_stack_node_free(node);
    node = next;
  }
  stack->head = ((void *)0);
  stack->size = 0;
}

canonical_original_code:
void mt_stack_clear(struct MtStack *stack)
{
  ((void) sizeof ((stack != ((void *)0)) ? 1 : 0), __extension__ ({ if (stack != ((void *)0)) ; else __assert_fail ("stack != NULL", "src/mt_stack.c", 79, __extension__ __PRETTY_FUNCTION__); }));
  struct MtStackNode *node = stack->head;
  struct MtStackNode *next;
  while (node != ((void *)0))
  {
    next = node->next;
    mt_stack_node_free(node);
    node = next;
  }
  stack->head = ((void *)0);
  stack->size = 0;
}


decompiled_code:
void __fastcall mt_stack_free(void *ptr)
{
if ( !ptr )
_assert_fail("stack != NULL", "src/mt_stack.c", 0x60u, "mt_stack_free");
mt_stack_clear(ptr);
free(ptr);
}

canonical_decompiled_code:
void __fastcall func5(void *ptr)
{
if ( !ptr )
_assert_fail("stack != NULL", "src/mt_stack.c", 0x60u, "mt_stack_free");
func4(ptr);
free(ptr);
}

original_code:
void mt_stack_free(MtStack* stack)
{
  ((void) sizeof ((stack != ((void *)0)) ? 1 : 0), __extension__ ({ if (stack != ((void *)0)) ; else __assert_fail ("stack != NULL", "src/mt_stack.c", 96, __extension__ __PRETTY_FUNCTION__); }));
  mt_stack_clear(stack);
  free(stack);
}

canonical_original_code:
void mt_stack_free(struct MtStack *stack)
{
  ((void) sizeof ((stack != ((void *)0)) ? 1 : 0), __extension__ ({ if (stack != ((void *)0)) ; else __assert_fail ("stack != NULL", "src/mt_stack.c", 96, __extension__ __PRETTY_FUNCTION__); }));
  mt_stack_clear(stack);
  free(stack);
}


decompiled_code:
void __fastcall mt_transition_free(void *a1)
{
if ( !a1 )
_assert_fail("transition != NULL", "src/mt_transition.c", 0x1Fu, "mt_transition_free");
free(a1);
}

canonical_decompiled_code:
void __fastcall func0(void *a1)
{
if ( !a1 )
_assert_fail("transition != NULL", "src/mt_transition.c", 0x1Fu, "mt_transition_free");
free(a1);
}

original_code:
void
mt_transition_free(MtTransition* transition)
{
  ((void) sizeof ((transition != ((void *)0)) ? 1 : 0), __extension__ ({ if (transition != ((void *)0)) ; else __assert_fail ("transition != NULL", "src/mt_transition.c", 31, __extension__ __PRETTY_FUNCTION__); }));
  (free(transition));
}

canonical_original_code:
void mt_transition_free(struct MtTransition *transition)
{
  ((void) sizeof ((transition != ((void *)0)) ? 1 : 0), __extension__ ({ if (transition != ((void *)0)) ; else __assert_fail ("transition != NULL", "src/mt_transition.c", 31, __extension__ __PRETTY_FUNCTION__); }));
  (free(transition));
}

variable_types: struct MtTransition { enum MtTransitionType { MT_TRANSITION_NONE=0, MT_TRANSITION_BEND=1, MT_TRANSITION_SLIDE_UP=2, MT_TRANSITION_SLIDE_DOWN=3, MT_TRANSITION_HAMMER_ON=4, MT_TRANSITION_PULL_OFF=5 } type; struct MtObject { enum MtObjectType { MT_OBJ_NONE=0, MT_OBJ_NOTE=1, MT_OBJ_CHORD=2, MT_OBJ_TRANSITION=3, MT_OBJ_SEQUENCE=4, MT_OBJ_REST=5, MT_OBJ_SYMBOL=6 } type; union asvalue { struct MtNote { enum MtNoteType { MT_NOTE_NONE=0, MT_NOTE_NOTE=1, MT_NOTE_MUTE=2 } type; int string; int fret; enum MtModifier { MT_MODIFIER_NONE=0, MT_MODIFIER_PALM_MUTE=1, MT_MODIFIER_HARMONIC=2, MT_MODIFIER_VIBRATO=3 } modifier; int size; } *note; struct MtChord { struct MtQueue { int length; struct MtQueueNode { void *value; struct MtQueueNode *next; } *front; struct MtQueueNode *back; } *notes; enum MtModifier { MT_MODIFIER_NONE=0, MT_MODIFIER_PALM_MUTE=1, MT_MODIFIER_HARMONIC=2, MT_MODIFIER_VIBRATO=3 } modifier; int size; } *chord; struct MtTransition *transition; struct MtSequence { enum MtModifier { MT_MODIFIER_NONE=0, MT_MODIFIER_PALM_MUTE=1, MT_MODIFIER_HARMONIC=2, MT_MODIFIER_VIBRATO=3 } modifier; struct MtQueue *objects; } *sequence; struct MtSymbol { struct MtString { char *utf8_data; unsigned long size; unsigned long length; unsigned long hash; } *name; enum MtModifier { MT_MODIFIER_NONE=0, MT_MODIFIER_PALM_MUTE=1, MT_MODIFIER_HARMONIC=2, MT_MODIFIER_VIBRATO=3 } modifier; } *symbol; } as; } *destination; } *


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

result = malloc(0x10uLL);
if ( !result )
_assert_fail("object != NULL", "src/mt_object.c", 0x32u, "mt_object_new_rest");
*result = 5;
return result;
}

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

result = malloc(0x10uLL);
if ( !result )
_assert_fail("object != NULL", "src/mt_object.c", 0x32u, "mt_object_new_rest");
*result = 5;
return result;
}

original_code:
MtObject* mt_object_new_rest()
{
  MtObject* object = ((MtObject *) malloc(sizeof(MtObject)));
  ((void) sizeof ((object != ((void *)0)) ? 1 : 0), __extension__ ({ if (object != ((void *)0)) ; else __assert_fail ("object != NULL", "src/mt_object.c", 50, __extension__ __PRETTY_FUNCTION__); }));
  object->type = MT_OBJ_REST;
  return object;
}

canonical_original_code:
struct MtObject *mt_object_new_rest()
{
  struct MtObject *object = ((MtObject *) malloc(sizeof(MtObject)));
  ((void) sizeof ((object != ((void *)0)) ? 1 : 0), __extension__ ({ if (object != ((void *)0)) ; else __assert_fail ("object != NULL", "src/mt_object.c", 50, __extension__ __PRETTY_FUNCTION__); }));
  object->type = MT_OBJ_REST;
  return object;
}

variable_types: struct MtObject { enum MtObjectType { MT_OBJ_NONE=0, MT_OBJ_NOTE=1, MT_OBJ_CHORD=2, MT_OBJ_TRANSITION=3, MT_OBJ_SEQUENCE=4, MT_OBJ_REST=5, MT_OBJ_SYMBOL=6 } type; union asvalue { struct MtNote { enum MtNoteType { MT_NOTE_NONE=0, MT_NOTE_NOTE=1, MT_NOTE_MUTE=2 } type; int string; int fret; enum MtModifier { MT_MODIFIER_NONE=0, MT_MODIFIER_PALM_MUTE=1, MT_MODIFIER_HARMONIC=2, MT_MODIFIER_VIBRATO=3 } modifier; int size; } *note; struct MtChord { struct MtQueue { int length; struct MtQueueNode { void *value; struct MtQueueNode *next; } *front; struct MtQueueNode *back; } *notes; enum MtModifier { MT_MODIFIER_NONE=0, MT_MODIFIER_PALM_MUTE=1, MT_MODIFIER_HARMONIC=2, MT_MODIFIER_VIBRATO=3 } modifier; int size; } *chord; struct MtTransition { enum MtTransitionType { MT_TRANSITION_NONE=0, MT_TRANSITION_BEND=1, MT_TRANSITION_SLIDE_UP=2, MT_TRANSITION_SLIDE_DOWN=3, MT_TRANSITION_HAMMER_ON=4, MT_TRANSITION_PULL_OFF=5 } type; struct MtObject *destination; } *transition; struct MtSequence { enum MtModifier { MT_MODIFIER_NONE=0, MT_MODIFIER_PALM_MUTE=1, MT_MODIFIER_HARMONIC=2, MT_MODIFIER_VIBRATO=3 } modifier; struct MtQueue *objects; } *sequence; struct MtSymbol { struct MtString { char *utf8_data; unsigned long size; unsigned long length; unsigned long hash; } *name; enum MtModifier { MT_MODIFIER_NONE=0, MT_MODIFIER_PALM_MUTE=1, MT_MODIFIER_HARMONIC=2, MT_MODIFIER_VIBRATO=3 } modifier; } *symbol; } as; } *


decompiled_code:
void __fastcall mt_object_free(void *ptr)
{
unsigned int v1; // eax

if ( !ptr )
_assert_fail("object != NULL", "src/mt_object.c", 0x3Bu, "mt_object_free");
v1 = *(_DWORD *)ptr;
if ( *(_DWORD *)ptr == 3 )
{
mt_transition_free(*((_QWORD *)ptr + 1));
goto LABEL_11;
}
if ( v1 > 3 )
{
if ( v1 == 6 )
{
mt_symbol_free(*((_QWORD *)ptr + 1));
goto LABEL_11;
}
LABEL_13:
_assert_fail("false", "src/mt_object.c", 0x51u, "mt_object_free");
}
if ( v1 == 1 )
{
mt_note_free(*((_QWORD *)ptr + 1));
goto LABEL_11;
}
if ( v1 != 2 )
goto LABEL_13;
mt_chord_free(*((_QWORD *)ptr + 1));
LABEL_11:
free(ptr);
}

canonical_decompiled_code:
void __fastcall func1(void *ptr)
{
unsigned int v1; // eax

if ( !ptr )
_assert_fail("object != NULL", "src/mt_object.c", 0x3Bu, "mt_object_free");
v1 = *(_DWORD *)ptr;
if ( *(_DWORD *)ptr == 3 )
{
mt_transition_free(*((_QWORD *)ptr + 1));
goto LABEL_11;
}
if ( v1 > 3 )
{
if ( v1 == 6 )
{
mt_symbol_free(*((_QWORD *)ptr + 1));
goto LABEL_11;
}
LABEL_13:
_assert_fail("false", "src/mt_object.c", 0x51u, "mt_object_free");
}
if ( v1 == 1 )
{
mt_note_free(*((_QWORD *)ptr + 1));
goto LABEL_11;
}
if ( v1 != 2 )
goto LABEL_13;
mt_chord_free(*((_QWORD *)ptr + 1));
LABEL_11:
free(ptr);
}

original_code:
void mt_object_free(MtObject* object)
{
  ((void) sizeof ((object != ((void *)0)) ? 1 : 0), __extension__ ({ if (object != ((void *)0)) ; else __assert_fail ("object != NULL", "src/mt_object.c", 59, __extension__ __PRETTY_FUNCTION__); }));
  switch (object->type)
  {
    case MT_OBJ_NOTE:
      mt_note_free(object->as.note);
      break;
    case MT_OBJ_CHORD:
      mt_chord_free(object->as.chord);
      break;
    case MT_OBJ_TRANSITION:
      mt_transition_free(object->as.transition);
      break;
    case MT_OBJ_SYMBOL:
      mt_symbol_free(object->as.symbol);
      break;
    default:
      ((void) sizeof ((0) ? 1 : 0), __extension__ ({ if (0) ; else __assert_fail ("false", "src/mt_object.c", 81, __extension__ __PRETTY_FUNCTION__); }));
      break;
  }
  (free(object));
}

canonical_original_code:
void mt_object_free(struct MtObject *object)
{
  ((void) sizeof ((object != ((void *)0)) ? 1 : 0), __extension__ ({ if (object != ((void *)0)) ; else __assert_fail ("object != NULL", "src/mt_object.c", 59, __extension__ __PRETTY_FUNCTION__); }));
  switch (object->type)
  {
    case MT_OBJ_NOTE:
      mt_note_free(object->as.note);
      break;
    case MT_OBJ_CHORD:
      mt_chord_free(object->as.chord);
      break;
    case MT_OBJ_TRANSITION:
      mt_transition_free(object->as.transition);
      break;
    case MT_OBJ_SYMBOL:
      mt_symbol_free(object->as.symbol);
      break;
    default:
      ((void) sizeof ((0) ? 1 : 0), __extension__ ({ if (0) ; else __assert_fail ("false", "src/mt_object.c", 81, __extension__ __PRETTY_FUNCTION__); }));
      break;
  }
  (free(object));
}

user_defined_types: enum MtObjectType { MT_OBJ_NONE=0, MT_OBJ_NOTE=1, MT_OBJ_CHORD=2, MT_OBJ_TRANSITION=3, MT_OBJ_SEQUENCE=4, MT_OBJ_REST=5, MT_OBJ_SYMBOL=6 }

user_defined_types: enum MtNoteType { MT_NOTE_NONE=0, MT_NOTE_NOTE=1, MT_NOTE_MUTE=2 }

user_defined_types: enum MtModifier { MT_MODIFIER_NONE=0, MT_MODIFIER_PALM_MUTE=1, MT_MODIFIER_HARMONIC=2, MT_MODIFIER_VIBRATO=3 }

user_defined_types: enum MtTransitionType { MT_TRANSITION_NONE=0, MT_TRANSITION_BEND=1, MT_TRANSITION_SLIDE_UP=2, MT_TRANSITION_SLIDE_DOWN=3, MT_TRANSITION_HAMMER_ON=4, MT_TRANSITION_PULL_OFF=5 }


decompiled_code:
void __fastcall mt_symbol_free(void *ptr)
{
if ( !ptr )
_assert_fail("symbol != NULL", "src/mt_symbol.c", 0x14u, "mt_symbol_free");
mt_string_free(*(_QWORD *)ptr);
free(ptr);
}

canonical_decompiled_code:
void __fastcall func0(void *ptr)
{
if ( !ptr )
_assert_fail("symbol != NULL", "src/mt_symbol.c", 0x14u, "mt_symbol_free");
mt_string_free(*(_QWORD *)ptr);
free(ptr);
}

original_code:
void mt_symbol_free(MtSymbol* symbol)
{
  ((void) sizeof ((symbol != ((void *)0)) ? 1 : 0), __extension__ ({ if (symbol != ((void *)0)) ; else __assert_fail ("symbol != NULL", "src/mt_symbol.c", 20, __extension__ __PRETTY_FUNCTION__); }));
  mt_string_free(symbol->name);
  (free(symbol));
}

canonical_original_code:
void mt_symbol_free(struct MtSymbol *symbol)
{
  ((void) sizeof ((symbol != ((void *)0)) ? 1 : 0), __extension__ ({ if (symbol != ((void *)0)) ; else __assert_fail ("symbol != NULL", "src/mt_symbol.c", 20, __extension__ __PRETTY_FUNCTION__); }));
  mt_string_free(symbol->name);
  (free(symbol));
}

variable_types: struct MtSymbol { struct MtString { char *utf8_data; unsigned long size; unsigned long length; unsigned long hash; } *name; enum MtModifier { MT_MODIFIER_NONE=0, MT_MODIFIER_PALM_MUTE=1, MT_MODIFIER_HARMONIC=2, MT_MODIFIER_VIBRATO=3 } modifier; } *


decompiled_code:
void __fastcall mt_sequence_free(void *a1)
{
if ( !a1 )
_assert_fail("sequence != NULL", "src/mt_sequence.c", 0x1Du, "mt_sequence_free");
free(a1);
}

canonical_decompiled_code:
void __fastcall func1(void *a1)
{
if ( !a1 )
_assert_fail("sequence != NULL", "src/mt_sequence.c", 0x1Du, "mt_sequence_free");
free(a1);
}

original_code:
void mt_sequence_free(MtSequence* sequence)
{
  ((void) sizeof ((sequence != ((void *)0)) ? 1 : 0), __extension__ ({ if (sequence != ((void *)0)) ; else __assert_fail ("sequence != NULL", "src/mt_sequence.c", 29, __extension__ __PRETTY_FUNCTION__); }));
  (free(sequence));
}

canonical_original_code:
void mt_sequence_free(struct MtSequence *sequence)
{
  ((void) sizeof ((sequence != ((void *)0)) ? 1 : 0), __extension__ ({ if (sequence != ((void *)0)) ; else __assert_fail ("sequence != NULL", "src/mt_sequence.c", 29, __extension__ __PRETTY_FUNCTION__); }));
  (free(sequence));
}

variable_types: struct MtSequence { enum MtModifier { MT_MODIFIER_NONE=0, MT_MODIFIER_PALM_MUTE=1, MT_MODIFIER_HARMONIC=2, MT_MODIFIER_VIBRATO=3 } modifier; struct MtQueue { int length; struct MtQueueNode { void *value; struct MtQueueNode *next; } *front; struct MtQueueNode *back; } *objects; } *

user_defined_types: struct MtQueue { int length; struct MtQueueNode *front; struct MtQueueNode *back; }


decompiled_code:
void __fastcall mt_note_set_modifier(__int64 a1, int a2)
{
if ( !a1 )
_assert_fail("note != NULL", "src/mt_note.c", 0x4Au, "mt_note_set_modifier");
*(_DWORD *)(a1 + 12) = a2;
}

canonical_decompiled_code:
void __fastcall func0(__int64 a1, int a2)
{
if ( !a1 )
_assert_fail("note != NULL", "src/mt_note.c", 0x4Au, "mt_note_set_modifier");
*(_DWORD *)(a1 + 12) = a2;
}

original_code:
void mt_note_set_modifier(MtNote* note, MtModifier modifier)
{
  ((void) sizeof ((note != ((void *)0)) ? 1 : 0), __extension__ ({ if (note != ((void *)0)) ; else __assert_fail ("note != NULL", "src/mt_note.c", 74, __extension__ __PRETTY_FUNCTION__); }));
  note->modifier = modifier;
}

canonical_original_code:
void mt_note_set_modifier(struct MtNote *note, enum MtModifier modifier)
{
  ((void) sizeof ((note != ((void *)0)) ? 1 : 0), __extension__ ({ if (note != ((void *)0)) ; else __assert_fail ("note != NULL", "src/mt_note.c", 74, __extension__ __PRETTY_FUNCTION__); }));
  note->modifier = modifier;
}

variable_types: struct MtNote { enum MtNoteType { MT_NOTE_NONE=0, MT_NOTE_NOTE=1, MT_NOTE_MUTE=2 } type; int string; int fret; enum MtModifier { MT_MODIFIER_NONE=0, MT_MODIFIER_PALM_MUTE=1, MT_MODIFIER_HARMONIC=2, MT_MODIFIER_VIBRATO=3 } modifier; int size; } *