strtol

decompiled_code:
unsigned __int64 __fastcall strtol(char *a1, char **a2, int a3)
{
unsigned __int64 result; // rax
char v4[25]; // [rsp+Fh] [rbp-19h] BYREF

++_gcov0_strtol;
if ( (unsigned int)(a3 - 2) <= 0x22 || (result = 0LL, !a3) )
{
++qword_D08;
result = strtox(a1, a2, a3, v4);
if ( v4[0] == 111 )
{
++qword_D10;
*(_DWORD *)geterrno() = 75;
if ( a2 )
{
++qword_D20;
result = 0LL;
*a2 = a1;
}
else
{
++qword_D18;
result = 0LL;
}
}
else if ( v4[0] == 43 )
{
if ( result > 0x7FFFFFFF )
{
++qword_D28;
*(_DWORD *)geterrno() = 75;
if ( a2 )
{
++qword_D40;
result = 0LL;
*a2 = a1;
}
else
{
++qword_D38;
result = 0LL;
}
}
else
{
++qword_D30;
}
}
else if ( result > 0x80000000 )
{
++qword_D48;
*(_DWORD *)geterrno() = 75;
if ( a2 )
{
++qword_D60;
result = 0LL;
*a2 = a1;
}
else
{
++qword_D58;
result = 0LL;
}
}
else
{
++qword_D50;
result = -(__int64)result;
}
}
return result;
}

canonical_decompiled_code:
unsigned __int64 __fastcall func4(char *a1, char **a2, int a3)
{
unsigned __int64 result; // rax
char v4[25]; // [rsp+Fh] [rbp-19h] BYREF

++_gcov0_strtol;
if ( (unsigned int)(a3 - 2) <= 0x22 || (result = 0LL, !a3) )
{
++qword_D08;
result = func0(a1, a2, a3, v4);
if ( v4[0] == 111 )
{
++qword_D10;
*(_DWORD *)geterrno() = 75;
if ( a2 )
{
++qword_D20;
result = 0LL;
*a2 = a1;
}
else
{
++qword_D18;
result = 0LL;
}
}
else if ( v4[0] == 43 )
{
if ( result > 0x7FFFFFFF )
{
++qword_D28;
*(_DWORD *)geterrno() = 75;
if ( a2 )
{
++qword_D40;
result = 0LL;
*a2 = a1;
}
else
{
++qword_D38;
result = 0LL;
}
}
else
{
++qword_D30;
}
}
else if ( result > 0x80000000 )
{
++qword_D48;
*(_DWORD *)geterrno() = 75;
if ( a2 )
{
++qword_D60;
result = 0LL;
*a2 = a1;
}
else
{
++qword_D58;
result = 0LL;
}
}
else
{
++qword_D50;
result = -(__int64)result;
}
}
return result;
}

original_code:
long strtol (const char * str, char ** endptr, int base)
{
  char sign;
  uintmax_t value;
  if (base != 0 && (base < 2 || base > 36)) {
    return 0;
  }
  value = _strtox(str, endptr, base, &sign);
  if (sign == 'o') {
    (*_geterrno()) = 75;
    if (endptr) (*endptr) = (char*)str;
    return 0;
  }
  if (sign == '+') {
    if (value > 2147483647L) {
      (*_geterrno()) = 75;
      if (endptr) (*endptr) = (char*)str;
      return 0;
    }
    return (long) value;
  } else {
    if (value > (-(uintmax_t)(-2147483647L - 1L))) {
      (*_geterrno()) = 75;
      if (endptr) (*endptr) = (char*)str;
      return 0;
    }
    return (long) -value;
  }
}

canonical_original_code:
long strtol(char *str, char **endptr, int base)
{
  char sign;
  unsigned long long value;
  if (base != 0 && (base < 2 || base > 36)) {
    return 0;
  }
  value = _strtox(str, endptr, base, &sign);
  if (sign == 'o') {
    (*_geterrno()) = 75;
    if (endptr) (*endptr) = (char *)str;
    return 0;
  }
  if (sign == '+') {
    if (value > 2147483647L) {
      (*_geterrno()) = 75;
      if (endptr) (*endptr) = (char *)str;
      return 0;
    }
    return (long) value;
  } else {
    if (value > (-(uintmax_t)(-2147483647L - 1L))) {
      (*_geterrno()) = 75;
      if (endptr) (*endptr) = (char *)str;
      return 0;
    }
    return (long) -value;
  }
}

variable_types:
endptr
char **

variable_types: base int


strtoll

repo: AxFab/axlibc

decompiled_code:
__int64 __fastcall strtoll(char *a1, char **a2, int a3)
{
__int64 result; // rax
char v4[25]; // [rsp+Fh] [rbp-19h] BYREF

++_gcov0_strtoll;
if ( (unsigned int)(a3 - 2) <= 0x22 || (result = 0LL, !a3) )
{
++qword_D88;
result = strtox(a1, a2, a3, v4);
if ( v4[0] == 111 )
{
++qword_D90;
*(_DWORD *)geterrno() = 75;
if ( a2 )
{
++qword_DA0;
result = 0LL;
*a2 = a1;
}
else
{
++qword_D98;
result = 0LL;
}
}
else if ( v4[0] == 43 )
{
++qword_DA8;
if ( result < 0 )
{
++qword_DB0;
*(_DWORD *)geterrno() = 75;
if ( a2 )
{
++qword_DC0;
result = 0LL;
*a2 = a1;
}
else
{
++qword_DB8;
result = 0LL;
}
}
}
else if ( (unsigned __int64)result > 0x8000000000000000LL )
{
++qword_DC8;
*(_DWORD *)geterrno() = 75;
if ( a2 )
{
++qword_DE0;
result = 0LL;
*a2 = a1;
}
else
{
++qword_DD8;
result = 0LL;
}
}
else
{
++qword_DD0;
result = -result;
}
}
return result;
}

canonical_decompiled_code:
__int64 __fastcall func5(char *a1, char **a2, int a3)
{
__int64 result; // rax
char v4[25]; // [rsp+Fh] [rbp-19h] BYREF

++_gcov0_strtoll;
if ( (unsigned int)(a3 - 2) <= 0x22 || (result = 0LL, !a3) )
{
++qword_D88;
result = func0(a1, a2, a3, v4);
if ( v4[0] == 111 )
{
++qword_D90;
*(_DWORD *)geterrno() = 75;
if ( a2 )
{
++qword_DA0;
result = 0LL;
*a2 = a1;
}
else
{
++qword_D98;
result = 0LL;
}
}
else if ( v4[0] == 43 )
{
++qword_DA8;
if ( result < 0 )
{
++qword_DB0;
*(_DWORD *)geterrno() = 75;
if ( a2 )
{
++qword_DC0;
result = 0LL;
*a2 = a1;
}
else
{
++qword_DB8;
result = 0LL;
}
}
}
else if ( (unsigned __int64)result > 0x8000000000000000LL )
{
++qword_DC8;
*(_DWORD *)geterrno() = 75;
if ( a2 )
{
++qword_DE0;
result = 0LL;
*a2 = a1;
}
else
{
++qword_DD8;
result = 0LL;
}
}
else
{
++qword_DD0;
result = -result;
}
}
return result;
}

original_code:
long long strtoll (const char * str, char ** endptr, int base)
{
  char sign;
  uintmax_t value;
  if (base != 0 && (base < 2 || base > 36)) {
    return 0;
  }
  value = _strtox(str, endptr, base, &sign);
  if (sign == 'o') {
    (*_geterrno()) = 75;
    if (endptr) (*endptr) = (char*)str;
    return 0;
  }
  if (sign == '+') {
    if (value > 9223372036854775807LL) {
      (*_geterrno()) = 75;
      if (endptr) (*endptr) = (char*)str;
      return 0;
    }
    return (long long) value;
  } else {
    if (value > (-(uintmax_t)(-9223372036854775807LL - 1LL))) {
      (*_geterrno()) = 75;
      if (endptr) (*endptr) = (char*)str;
      return 0;
    }
    return (long long) -value;
  }
}

canonical_original_code:
long long strtoll(char *str, char **endptr, int base)
{
  char sign;
  unsigned long long value;
  if (base != 0 && (base < 2 || base > 36)) {
    return 0;
  }
  value = _strtox(str, endptr, base, &sign);
  if (sign == 'o') {
    (*_geterrno()) = 75;
    if (endptr) (*endptr) = (char *)str;
    return 0;
  }
  if (sign == '+') {
    if (value > 9223372036854775807LL) {
      (*_geterrno()) = 75;
      if (endptr) (*endptr) = (char *)str;
      return 0;
    }
    return (long long) value;
  } else {
    if (value > (-(uintmax_t)(-9223372036854775807LL - 1LL))) {
      (*_geterrno()) = 75;
      if (endptr) (*endptr) = (char *)str;
      return 0;
    }
    return (long long) -value;
  }
}

variable_types:
str
char *

variable_types: sign char

variable_types:
value
unsigned long long

return_type: long long


strtoul

decompiled_code:
unsigned __int64 __fastcall strtoul(char *a1, char **a2, int a3)
{
unsigned __int64 result; // rax
char v4[25]; // [rsp+Fh] [rbp-19h] BYREF

++_gcov0_strtoul;
if ( (unsigned int)(a3 - 2) <= 0x22 || (result = 0LL, !a3) )
{
++qword_E08;
result = strtox(a1, a2, a3, v4);
if ( v4[0] == 111 )
{
++qword_E10;
*(_DWORD *)geterrno() = 75;
if ( a2 )
{
++qword_E20;
result = 0LL;
*a2 = a1;
}
else
{
++qword_E18;
result = 0LL;
}
}
else if ( result > 0xFFFFFFFF )
{
++qword_E28;
*(_DWORD *)geterrno() = 75;
if ( a2 )
{
++qword_E38;
result = 0LL;
*a2 = a1;
}
else
{
++qword_E30;
result = 0LL;
}
}
else if ( v4[0] == 43 )
{
++qword_E48;
}
else
{
++qword_E40;
result = -(__int64)result;
}
}
return result;
}

canonical_decompiled_code:
unsigned __int64 __fastcall func6(char *a1, char **a2, int a3)
{
unsigned __int64 result; // rax
char v4[25]; // [rsp+Fh] [rbp-19h] BYREF

++_gcov0_strtoul;
if ( (unsigned int)(a3 - 2) <= 0x22 || (result = 0LL, !a3) )
{
++qword_E08;
result = func0(a1, a2, a3, v4);
if ( v4[0] == 111 )
{
++qword_E10;
*(_DWORD *)geterrno() = 75;
if ( a2 )
{
++qword_E20;
result = 0LL;
*a2 = a1;
}
else
{
++qword_E18;
result = 0LL;
}
}
else if ( result > 0xFFFFFFFF )
{
++qword_E28;
*(_DWORD *)geterrno() = 75;
if ( a2 )
{
++qword_E38;
result = 0LL;
*a2 = a1;
}
else
{
++qword_E30;
result = 0LL;
}
}
else if ( v4[0] == 43 )
{
++qword_E48;
}
else
{
++qword_E40;
result = -(__int64)result;
}
}
return result;
}

original_code:
unsigned long strtoul (const char * str, char ** endptr, int base)
{
  char sign;
  uintmax_t value;
  if (base != 0 && (base < 2 || base > 36)) {
    return 0;
  }
  value = _strtox(str, endptr, base, &sign);
  if (sign == 'o') {
    (*_geterrno()) = 75;
    if (endptr) (*endptr) = (char*)str;
    return 0;
  }
  if (value > 4294967295UL) {
    (*_geterrno()) = 75;
    if (endptr) (*endptr) = (char*)str;
    return 0;
  }
  return (unsigned long) (sign == '+' ? value : -value);
}

canonical_original_code:
unsigned long strtoul(char *str, char **endptr, int base)
{
  char sign;
  unsigned long long value;
  if (base != 0 && (base < 2 || base > 36)) {
    return 0;
  }
  value = _strtox(str, endptr, base, &sign);
  if (sign == 'o') {
    (*_geterrno()) = 75;
    if (endptr) (*endptr) = (char *)str;
    return 0;
  }
  if (value > 4294967295UL) {
    (*_geterrno()) = 75;
    if (endptr) (*endptr) = (char *)str;
    return 0;
  }
  return (unsigned long) (sign == '+' ? value : -value);
}

return_type: unsigned long


strtoull

decompiled_code:
__int64 __fastcall strtoull(char *a1, char **a2, int a3)
{
__int64 result; // rax
char v4[25]; // [rsp+Fh] [rbp-19h] BYREF

++_gcov0_strtoull;
if ( (unsigned int)(a3 - 2) <= 0x22 || (result = 0LL, !a3) )
{
++qword_E68;
result = strtox(a1, a2, a3, v4);
if ( v4[0] == 111 )
{
++qword_E70;
*(_DWORD *)geterrno() = 75;
if ( a2 )
{
++qword_E80;
result = 0LL;
*a2 = a1;
}
else
{
++qword_E78;
result = 0LL;
}
}
else if ( v4[0] == 43 )
{
++qword_E90;
}
else
{
++qword_E88;
result = -result;
}
}
return result;
}

canonical_decompiled_code:
__int64 __fastcall func7(char *a1, char **a2, int a3)
{
__int64 result; // rax
char v4[25]; // [rsp+Fh] [rbp-19h] BYREF

++_gcov0_strtoull;
if ( (unsigned int)(a3 - 2) <= 0x22 || (result = 0LL, !a3) )
{
++qword_E68;
result = func0(a1, a2, a3, v4);
if ( v4[0] == 111 )
{
++qword_E70;
*(_DWORD *)geterrno() = 75;
if ( a2 )
{
++qword_E80;
result = 0LL;
*a2 = a1;
}
else
{
++qword_E78;
result = 0LL;
}
}
else if ( v4[0] == 43 )
{
++qword_E90;
}
else
{
++qword_E88;
result = -result;
}
}
return result;
}

original_code:
unsigned long long strtoull (const char * str, char ** endptr, int base)
{
  char sign;
  uintmax_t value;
  if (base != 0 && (base < 2 || base > 36)) {
    return 0;
  }
  value = _strtox(str, endptr, base, &sign);
  if (sign == 'o') {
    (*_geterrno()) = 75;
    if (endptr) (*endptr) = (char*)str;
    return 0;
  }
  if (value > 18446744073709551615ULL) {
    (*_geterrno()) = 75;
    if (endptr) (*endptr) = (char*)str;
    return 0;
  }
  return (unsigned long long) (sign == '+' ? value : -value);
}

canonical_original_code:
unsigned long long strtoull(char *str, char **endptr, int base)
{
  char sign;
  unsigned long long value;
  if (base != 0 && (base < 2 || base > 36)) {
    return 0;
  }
  value = _strtox(str, endptr, base, &sign);
  if (sign == 'o') {
    (*_geterrno()) = 75;
    if (endptr) (*endptr) = (char *)str;
    return 0;
  }
  if (value > 18446744073709551615ULL) {
    (*_geterrno()) = 75;
    if (endptr) (*endptr) = (char *)str;
    return 0;
  }
  return (unsigned long long) (sign == '+' ? value : -value);
}

return_type: unsigned long long


isalnum

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

if ( a1 > 0x7F )
{
++_gcov0_isalnum;
result = 0LL;
}
else
{
++qword_1088;
result = stdlocal[2 * a1 + 1] & 0x101;
}
return result;
}

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

if ( a1 > 0x7F )
{
++_gcov0_isalnum;
result = 0LL;
}
else
{
++qword_1088;
result = stdlocal[2 * a1 + 1] & 0x101;
}
return result;
}

original_code:
int isalnum (int c)
{
  if (c < 0 || c >= 128) return 0;
  return (&stdlocal)->_ctype[c]._flags & ( 0x001 | 0x100 );
}

canonical_original_code:
int isalnum(int c)
{
  if (c < 0 || c >= 128) return 0;
  return (&stdlocal)->_ctype[c]._flags & ( 0x001 | 0x100 );
}

variable_types: c int

return_type: int


isalpha

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

if ( a1 > 0x7F )
{
++_gcov0_isalpha;
result = 0LL;
}
else
{
++qword_1098;
result = stdlocal[2 * a1 + 1] & 1;
}
return result;
}

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

if ( a1 > 0x7F )
{
++_gcov0_isalpha;
result = 0LL;
}
else
{
++qword_1098;
result = stdlocal[2 * a1 + 1] & 1;
}
return result;
}

original_code:
int isalpha (int c)
{
  if (c < 0 || c >= 128) return 0;
  return (&stdlocal)->_ctype[c]._flags & 0x001;
}

canonical_original_code:
int isalpha(int c)
{
  if (c < 0 || c >= 128) return 0;
  return (&stdlocal)->_ctype[c]._flags & 0x001;
}


isblank

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

if ( a1 > 0x7F )
{
++_gcov0_isblank;
result = 0LL;
}
else
{
++qword_10A8;
result = stdlocal[2 * a1 + 1] & 2;
}
return result;
}

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

if ( a1 > 0x7F )
{
++_gcov0_isblank;
result = 0LL;
}
else
{
++qword_10A8;
result = stdlocal[2 * a1 + 1] & 2;
}
return result;
}

original_code:
int isblank (int c)
{
  if (c < 0 || c >= 128) return 0;
  return (&stdlocal)->_ctype[c]._flags & 0x002;
}

canonical_original_code:
int isblank(int c)
{
  if (c < 0 || c >= 128) return 0;
  return (&stdlocal)->_ctype[c]._flags & 0x002;
}


iscntrl

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

if ( a1 > 0x7F )
{
++_gcov0_iscntrl;
result = 0LL;
}
else
{
++qword_10B8;
result = stdlocal[2 * a1 + 1] & 4;
}
return result;
}

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

if ( a1 > 0x7F )
{
++_gcov0_iscntrl;
result = 0LL;
}
else
{
++qword_10B8;
result = stdlocal[2 * a1 + 1] & 4;
}
return result;
}

original_code:
int iscntrl (int c)
{
  if (c < 0 || c >= 128) return 0;
  return (&stdlocal)->_ctype[c]._flags & 0x004;
}

canonical_original_code:
int iscntrl(int c)
{
  if (c < 0 || c >= 128) return 0;
  return (&stdlocal)->_ctype[c]._flags & 0x004;
}


isdigit

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

if ( a1 > 0x7F )
{
++_gcov0_isdigit;
result = 0LL;
}
else
{
++qword_10C8;
result = stdlocal[2 * a1 + 1] & 0x100;
}
return result;
}

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

if ( a1 > 0x7F )
{
++_gcov0_isdigit;
result = 0LL;
}
else
{
++qword_10C8;
result = stdlocal[2 * a1 + 1] & 0x100;
}
return result;
}

original_code:
int isdigit (int c)
{
  if (c < 0 || c >= 128) return 0;
  return (&stdlocal)->_ctype[c]._flags & 0x100;
}

canonical_original_code:
int isdigit(int c)
{
  if (c < 0 || c >= 128) return 0;
  return (&stdlocal)->_ctype[c]._flags & 0x100;
}


isgraph

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

if ( a1 > 0x7F )
{
++_gcov0_isgraph;
result = 0LL;
}
else
{
++qword_10D8;
result = stdlocal[2 * a1 + 1] & 8;
}
return result;
}

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

if ( a1 > 0x7F )
{
++_gcov0_isgraph;
result = 0LL;
}
else
{
++qword_10D8;
result = stdlocal[2 * a1 + 1] & 8;
}
return result;
}

original_code:
int isgraph (int c)
{
  if (c < 0 || c >= 128) return 0;
  return (&stdlocal)->_ctype[c]._flags & 0x008;
}

canonical_original_code:
int isgraph(int c)
{
  if (c < 0 || c >= 128) return 0;
  return (&stdlocal)->_ctype[c]._flags & 0x008;
}


islower

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

if ( a1 > 0x7F )
{
++_gcov0_islower;
result = 0LL;
}
else
{
++qword_10E8;
result = stdlocal[2 * a1 + 1] & 0x40;
}
return result;
}

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

if ( a1 > 0x7F )
{
++_gcov0_islower;
result = 0LL;
}
else
{
++qword_10E8;
result = stdlocal[2 * a1 + 1] & 0x40;
}
return result;
}

original_code:
int islower (int c)
{
  if (c < 0 || c >= 128) return 0;
  return (&stdlocal)->_ctype[c]._flags & 0x040;
}

canonical_original_code:
int islower(int c)
{
  if (c < 0 || c >= 128) return 0;
  return (&stdlocal)->_ctype[c]._flags & 0x040;
}


isprint

decompiled_code:
__int64 __fastcall isprint(unsigned int a1)
{
unsigned int v1; // er8
__int64 result; // rax

if ( a1 > 0x7F )
{
++_gcov0_isprint;
result = 0LL;
}
else
{
++qword_1108;
v1 = 1;
if ( (stdlocal[2 * a1 + 1] & 8) != 0 )
return v1;
if ( a1 != 32 )
{
++qword_1118;
return 0;
}
++qword_1110;
result = 1LL;
}
return result;
}

canonical_decompiled_code:
__int64 __fastcall func7(unsigned int a1)
{
unsigned int v1; // er8
__int64 result; // rax

if ( a1 > 0x7F )
{
++_gcov0_isprint;
result = 0LL;
}
else
{
++qword_1108;
v1 = 1;
if ( (stdlocal[2 * a1 + 1] & 8) != 0 )
return v1;
if ( a1 != 32 )
{
++qword_1118;
return 0;
}
++qword_1110;
result = 1LL;
}
return result;
}

original_code:
int isprint (int c)
{
  if (c < 0 || c >= 128) return 0;
  return ((&stdlocal)->_ctype[c]._flags & 0x008 ) || ( c == ' ' );
}

canonical_original_code:
int isprint(int c)
{
  if (c < 0 || c >= 128) return 0;
  return ((&stdlocal)->_ctype[c]._flags & 0x008 ) || ( c == ' ' );
}


ispunct

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

if ( a1 > 0x7F )
{
++_gcov0_ispunct;
result = 0LL;
}
else
{
++qword_1128;
result = stdlocal[2 * a1 + 1] & 0x10;
}
return result;
}

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

if ( a1 > 0x7F )
{
++_gcov0_ispunct;
result = 0LL;
}
else
{
++qword_1128;
result = stdlocal[2 * a1 + 1] & 0x10;
}
return result;
}

original_code:
int ispunct (int c)
{
  if (c < 0 || c >= 128) return 0;
  return (&stdlocal)->_ctype[c]._flags & 0x010;
}

canonical_original_code:
int ispunct(int c)
{
  if (c < 0 || c >= 128) return 0;
  return (&stdlocal)->_ctype[c]._flags & 0x010;
}


isspace

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

if ( a1 > 0x7F )
{
++_gcov0_isspace;
result = 0LL;
}
else
{
++qword_1138;
result = stdlocal[2 * a1 + 1] & 0x20;
}
return result;
}

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

if ( a1 > 0x7F )
{
++_gcov0_isspace;
result = 0LL;
}
else
{
++qword_1138;
result = stdlocal[2 * a1 + 1] & 0x20;
}
return result;
}

original_code:
int isspace (int c)
{
  if (c < 0 || c >= 128) return 0;
  return (&stdlocal)->_ctype[c]._flags & 0x020;
}

canonical_original_code:
int isspace(int c)
{
  if (c < 0 || c >= 128) return 0;
  return (&stdlocal)->_ctype[c]._flags & 0x020;
}


isupper

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

if ( a1 > 0x7F )
{
++_gcov0_isupper;
result = 0LL;
}
else
{
++qword_1148;
result = stdlocal[2 * a1 + 1] & 0x80;
}
return result;
}

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

if ( a1 > 0x7F )
{
++_gcov0_isupper;
result = 0LL;
}
else
{
++qword_1148;
result = stdlocal[2 * a1 + 1] & 0x80;
}
return result;
}

original_code:
int isupper (int c)
{
  if (c < 0 || c >= 128) return 0;
  return (&stdlocal)->_ctype[c]._flags & 0x080;
}

canonical_original_code:
int isupper(int c)
{
  if (c < 0 || c >= 128) return 0;
  return (&stdlocal)->_ctype[c]._flags & 0x080;
}


isxdigit

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

if ( a1 > 0x7F )
{
++_gcov0_isxdigit;
result = 0LL;
}
else
{
++qword_1158;
result = stdlocal[2 * a1 + 1] & 0x200;
}
return result;
}

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

if ( a1 > 0x7F )
{
++_gcov0_isxdigit;
result = 0LL;
}
else
{
++qword_1158;
result = stdlocal[2 * a1 + 1] & 0x200;
}
return result;
}

original_code:
int isxdigit (int c)
{
  if (c < 0 || c >= 128) return 0;
  return (&stdlocal)->_ctype[c]._flags & 0x200;
}

canonical_original_code:
int isxdigit(int c)
{
  if (c < 0 || c >= 128) return 0;
  return (&stdlocal)->_ctype[c]._flags & 0x200;
}


tolower

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

if ( a1 > 0x7F )
{
++_gcov0_tolower;
result = a1;
}
else
{
++qword_1168;
result = LOBYTE(stdlocal[2 * a1]);
}
return result;
}

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

if ( a1 > 0x7F )
{
++_gcov0_tolower;
result = a1;
}
else
{
++qword_1168;
result = LOBYTE(stdlocal[2 * a1]);
}
return result;
}

original_code:
int tolower (int c)
{
  if (c < 0 || c >= 128) return c;
  return (&stdlocal)->_ctype[c]._lower;
}

canonical_original_code:
int tolower(int c)
{
  if (c < 0 || c >= 128) return c;
  return (&stdlocal)->_ctype[c]._lower;
}


toupper

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

if ( a1 > 0x7F )
{
++_gcov0_toupper;
result = a1;
}
else
{
++qword_1178;
result = HIBYTE(stdlocal[2 * a1]);
}
return result;
}

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

if ( a1 > 0x7F )
{
++_gcov0_toupper;
result = a1;
}
else
{
++qword_1178;
result = HIBYTE(stdlocal[2 * a1]);
}
return result;
}

original_code:
int toupper (int c)
{
  if (c < 0 || c >= 128) return c;
  return (&stdlocal)->_ctype[c]._upper;
}

canonical_original_code:
int toupper(int c)
{
  if (c < 0 || c >= 128) return c;
  return (&stdlocal)->_ctype[c]._upper;
}


decompiled_code:
__int64 __fastcall isalnum_l(unsigned int a1, __int64 a2, __int64 a3, __int64 a4, __int64 a5, __int64 a6, int a7)
{
__int64 result; // rax

if ( a1 > 0x7F )
{
++_gcov0_isalnum_l;
result = 0LL;
}
else
{
++qword_1188;
result = *((_WORD *)&a7 + 2 * (int)a1 + 1) & 0x101;
}
return result;
}

canonical_decompiled_code:
__int64 __fastcall func14(unsigned int a1, __int64 a2, __int64 a3, __int64 a4, __int64 a5, __int64 a6, int a7)
{
__int64 result; // rax

if ( a1 > 0x7F )
{
++_gcov0_isalnum_l;
result = 0LL;
}
else
{
++qword_1188;
result = *((_WORD *)&a7 + 2 * (int)a1 + 1) & 0x101;
}
return result;
}

original_code:
int isalnum_l (int c, locale_t locale)
{
  if (c < 0 || c >= 128) return 0;
  return locale._ctype[c]._flags & ( 0x001 | 0x100 );
}

canonical_original_code:
int isalnum_l(int c, struct axLocale locale)
{
  if (c < 0 || c >= 128) return 0;
  return locale._ctype[c]._flags & ( 0x001 | 0x100 );
}

variable_types: struct axLocale { struct axCinfo { unsigned char _lower; unsigned char _upper; unsigned short _flags; } _ctype[128]; }

user_defined_types: struct axLocale { struct axCinfo _ctype[128]; }


decompiled_code:
__int64 __fastcall isalpha_l(unsigned int a1, __int64 a2, __int64 a3, __int64 a4, __int64 a5, __int64 a6, int a7)
{
__int64 result; // rax

if ( a1 > 0x7F )
{
++_gcov0_isalpha_l;
result = 0LL;
}
else
{
++qword_1198;
result = *((_WORD *)&a7 + 2 * (int)a1 + 1) & 1;
}
return result;
}

canonical_decompiled_code:
__int64 __fastcall func15(unsigned int a1, __int64 a2, __int64 a3, __int64 a4, __int64 a5, __int64 a6, int a7)
{
__int64 result; // rax

if ( a1 > 0x7F )
{
++_gcov0_isalpha_l;
result = 0LL;
}
else
{
++qword_1198;
result = *((_WORD *)&a7 + 2 * (int)a1 + 1) & 1;
}
return result;
}

original_code:
int isalpha_l (int c, locale_t locale)
{
  if (c < 0 || c >= 128) return 0;
  return locale._ctype[c]._flags & 0x001;
}

canonical_original_code:
int isalpha_l(int c, struct axLocale locale)
{
  if (c < 0 || c >= 128) return 0;
  return locale._ctype[c]._flags & 0x001;
}

user_defined_types: struct axCinfo { unsigned char _lower; unsigned char _upper; unsigned short _flags; }


decompiled_code:
__int64 __fastcall isblank_l(unsigned int a1, __int64 a2, __int64 a3, __int64 a4, __int64 a5, __int64 a6, int a7)
{
__int64 result; // rax

if ( a1 > 0x7F )
{
++_gcov0_isblank_l;
result = 0LL;
}
else
{
++qword_11A8;
result = *((_WORD *)&a7 + 2 * (int)a1 + 1) & 2;
}
return result;
}

canonical_decompiled_code:
__int64 __fastcall func16(unsigned int a1, __int64 a2, __int64 a3, __int64 a4, __int64 a5, __int64 a6, int a7)
{
__int64 result; // rax

if ( a1 > 0x7F )
{
++_gcov0_isblank_l;
result = 0LL;
}
else
{
++qword_11A8;
result = *((_WORD *)&a7 + 2 * (int)a1 + 1) & 2;
}
return result;
}

original_code:
int isblank_l (int c, locale_t locale)
{
  if (c < 0 || c >= 128) return 0;
  return locale._ctype[c]._flags & 0x002;
}

canonical_original_code:
int isblank_l(int c, struct axLocale locale)
{
  if (c < 0 || c >= 128) return 0;
  return locale._ctype[c]._flags & 0x002;
}


decompiled_code:
__int64 __fastcall iscntrl_l(unsigned int a1, __int64 a2, __int64 a3, __int64 a4, __int64 a5, __int64 a6, int a7)
{
__int64 result; // rax

if ( a1 > 0x7F )
{
++_gcov0_iscntrl_l;
result = 0LL;
}
else
{
++qword_11B8;
result = *((_WORD *)&a7 + 2 * (int)a1 + 1) & 4;
}
return result;
}

canonical_decompiled_code:
__int64 __fastcall func17(unsigned int a1, __int64 a2, __int64 a3, __int64 a4, __int64 a5, __int64 a6, int a7)
{
__int64 result; // rax

if ( a1 > 0x7F )
{
++_gcov0_iscntrl_l;
result = 0LL;
}
else
{
++qword_11B8;
result = *((_WORD *)&a7 + 2 * (int)a1 + 1) & 4;
}
return result;
}

original_code:
int iscntrl_l (int c, locale_t locale)
{
  if (c < 0 || c >= 128) return 0;
  return locale._ctype[c]._flags & 0x004;
}

canonical_original_code:
int iscntrl_l(int c, struct axLocale locale)
{
  if (c < 0 || c >= 128) return 0;
  return locale._ctype[c]._flags & 0x004;
}


decompiled_code:
__int64 __fastcall isdigit_l(unsigned int a1, __int64 a2, __int64 a3, __int64 a4, __int64 a5, __int64 a6, int a7)
{
__int64 result; // rax

if ( a1 > 0x7F )
{
++_gcov0_isdigit_l;
result = 0LL;
}
else
{
++qword_11C8;
result = *((_WORD *)&a7 + 2 * (int)a1 + 1) & 0x100;
}
return result;
}

canonical_decompiled_code:
__int64 __fastcall func18(unsigned int a1, __int64 a2, __int64 a3, __int64 a4, __int64 a5, __int64 a6, int a7)
{
__int64 result; // rax

if ( a1 > 0x7F )
{
++_gcov0_isdigit_l;
result = 0LL;
}
else
{
++qword_11C8;
result = *((_WORD *)&a7 + 2 * (int)a1 + 1) & 0x100;
}
return result;
}

original_code:
int isdigit_l (int c, locale_t locale)
{
  if (c < 0 || c >= 128) return 0;
  return locale._ctype[c]._flags & 0x100;
}

canonical_original_code:
int isdigit_l(int c, struct axLocale locale)
{
  if (c < 0 || c >= 128) return 0;
  return locale._ctype[c]._flags & 0x100;
}


decompiled_code:
__int64 __fastcall isgraph_l(unsigned int a1, __int64 a2, __int64 a3, __int64 a4, __int64 a5, __int64 a6, int a7)
{
__int64 result; // rax

if ( a1 > 0x7F )
{
++_gcov0_isgraph_l;
result = 0LL;
}
else
{
++qword_11D8;
result = *((_WORD *)&a7 + 2 * (int)a1 + 1) & 8;
}
return result;
}

canonical_decompiled_code:
__int64 __fastcall func19(unsigned int a1, __int64 a2, __int64 a3, __int64 a4, __int64 a5, __int64 a6, int a7)
{
__int64 result; // rax

if ( a1 > 0x7F )
{
++_gcov0_isgraph_l;
result = 0LL;
}
else
{
++qword_11D8;
result = *((_WORD *)&a7 + 2 * (int)a1 + 1) & 8;
}
return result;
}

original_code:
int isgraph_l (int c, locale_t locale)
{
  if (c < 0 || c >= 128) return 0;
  return locale._ctype[c]._flags & 0x008;
}

canonical_original_code:
int isgraph_l(int c, struct axLocale locale)
{
  if (c < 0 || c >= 128) return 0;
  return locale._ctype[c]._flags & 0x008;
}


decompiled_code:
__int64 __fastcall islower_l(unsigned int a1, __int64 a2, __int64 a3, __int64 a4, __int64 a5, __int64 a6, int a7)
{
__int64 result; // rax

if ( a1 > 0x7F )
{
++_gcov0_islower_l;
result = 0LL;
}
else
{
++qword_11E8;
result = *((_WORD *)&a7 + 2 * (int)a1 + 1) & 0x40;
}
return result;
}

canonical_decompiled_code:
__int64 __fastcall func20(unsigned int a1, __int64 a2, __int64 a3, __int64 a4, __int64 a5, __int64 a6, int a7)
{
__int64 result; // rax

if ( a1 > 0x7F )
{
++_gcov0_islower_l;
result = 0LL;
}
else
{
++qword_11E8;
result = *((_WORD *)&a7 + 2 * (int)a1 + 1) & 0x40;
}
return result;
}

original_code:
int islower_l (int c, locale_t locale)
{
  if (c < 0 || c >= 128) return 0;
  return locale._ctype[c]._flags & 0x040;
}

canonical_original_code:
int islower_l(int c, struct axLocale locale)
{
  if (c < 0 || c >= 128) return 0;
  return locale._ctype[c]._flags & 0x040;
}


decompiled_code:
__int64 __fastcall isprint_l(unsigned int a1, __int64 a2, __int64 a3, __int64 a4, __int64 a5, __int64 a6, int a7)
{
unsigned int v7; // er8
__int64 result; // rax

if ( a1 > 0x7F )
{
++_gcov0_isprint_l;
result = 0LL;
}
else
{
++qword_1208;
v7 = 1;
if ( (*((_BYTE *)&a7 + 4 * (int)a1 + 2) & 8) != 0 )
return v7;
if ( a1 != 32 )
{
++qword_1218;
return 0;
}
++qword_1210;
result = 1LL;
}
return result;
}

canonical_decompiled_code:
__int64 __fastcall func21(unsigned int a1, __int64 a2, __int64 a3, __int64 a4, __int64 a5, __int64 a6, int a7)
{
unsigned int v7; // er8
__int64 result; // rax

if ( a1 > 0x7F )
{
++_gcov0_isprint_l;
result = 0LL;
}
else
{
++qword_1208;
v7 = 1;
if ( (*((_BYTE *)&a7 + 4 * (int)a1 + 2) & 8) != 0 )
return v7;
if ( a1 != 32 )
{
++qword_1218;
return 0;
}
++qword_1210;
result = 1LL;
}
return result;
}

original_code:
int isprint_l (int c, locale_t locale)
{
  if (c < 0 || c >= 128) return 0;
  return (locale._ctype[c]._flags & 0x008 ) || ( c == ' ' );
}

canonical_original_code:
int isprint_l(int c, struct axLocale locale)
{
  if (c < 0 || c >= 128) return 0;
  return (locale._ctype[c]._flags & 0x008 ) || ( c == ' ' );
}


decompiled_code:
__int64 __fastcall ispunct_l(unsigned int a1, __int64 a2, __int64 a3, __int64 a4, __int64 a5, __int64 a6, int a7)
{
__int64 result; // rax

if ( a1 > 0x7F )
{
++_gcov0_ispunct_l;
result = 0LL;
}
else
{
++qword_1228;
result = *((_WORD *)&a7 + 2 * (int)a1 + 1) & 0x10;
}
return result;
}

canonical_decompiled_code:
__int64 __fastcall func22(unsigned int a1, __int64 a2, __int64 a3, __int64 a4, __int64 a5, __int64 a6, int a7)
{
__int64 result; // rax

if ( a1 > 0x7F )
{
++_gcov0_ispunct_l;
result = 0LL;
}
else
{
++qword_1228;
result = *((_WORD *)&a7 + 2 * (int)a1 + 1) & 0x10;
}
return result;
}

original_code:
int ispunct_l (int c, locale_t locale)
{
  if (c < 0 || c >= 128) return 0;
  return locale._ctype[c]._flags & 0x010;
}

canonical_original_code:
int ispunct_l(int c, struct axLocale locale)
{
  if (c < 0 || c >= 128) return 0;
  return locale._ctype[c]._flags & 0x010;
}


decompiled_code:
__int64 __fastcall isspace_l(unsigned int a1, __int64 a2, __int64 a3, __int64 a4, __int64 a5, __int64 a6, int a7)
{
__int64 result; // rax

if ( a1 > 0x7F )
{
++_gcov0_isspace_l;
result = 0LL;
}
else
{
++qword_1238;
result = *((_WORD *)&a7 + 2 * (int)a1 + 1) & 0x20;
}
return result;
}

canonical_decompiled_code:
__int64 __fastcall func23(unsigned int a1, __int64 a2, __int64 a3, __int64 a4, __int64 a5, __int64 a6, int a7)
{
__int64 result; // rax

if ( a1 > 0x7F )
{
++_gcov0_isspace_l;
result = 0LL;
}
else
{
++qword_1238;
result = *((_WORD *)&a7 + 2 * (int)a1 + 1) & 0x20;
}
return result;
}

original_code:
int isspace_l (int c, locale_t locale)
{
  if (c < 0 || c >= 128) return 0;
  return locale._ctype[c]._flags & 0x020;
}

canonical_original_code:
int isspace_l(int c, struct axLocale locale)
{
  if (c < 0 || c >= 128) return 0;
  return locale._ctype[c]._flags & 0x020;
}


decompiled_code:
__int64 __fastcall isupper_l(unsigned int a1, __int64 a2, __int64 a3, __int64 a4, __int64 a5, __int64 a6, int a7)
{
__int64 result; // rax

if ( a1 > 0x7F )
{
++_gcov0_isupper_l;
result = 0LL;
}
else
{
++qword_1248;
result = *((_WORD *)&a7 + 2 * (int)a1 + 1) & 0x80;
}
return result;
}

canonical_decompiled_code:
__int64 __fastcall func24(unsigned int a1, __int64 a2, __int64 a3, __int64 a4, __int64 a5, __int64 a6, int a7)
{
__int64 result; // rax

if ( a1 > 0x7F )
{
++_gcov0_isupper_l;
result = 0LL;
}
else
{
++qword_1248;
result = *((_WORD *)&a7 + 2 * (int)a1 + 1) & 0x80;
}
return result;
}

original_code:
int isupper_l (int c, locale_t locale)
{
  if (c < 0 || c >= 128) return 0;
  return locale._ctype[c]._flags & 0x080;
}

canonical_original_code:
int isupper_l(int c, struct axLocale locale)
{
  if (c < 0 || c >= 128) return 0;
  return locale._ctype[c]._flags & 0x080;
}


decompiled_code:
__int64 __fastcall isxdigit_l(unsigned int a1, __int64 a2, __int64 a3, __int64 a4, __int64 a5, __int64 a6, int a7)
{
__int64 result; // rax

if ( a1 > 0x7F )
{
++_gcov0_isxdigit_l;
result = 0LL;
}
else
{
++qword_1258;
result = *((_WORD *)&a7 + 2 * (int)a1 + 1) & 0x200;
}
return result;
}

canonical_decompiled_code:
__int64 __fastcall func25(unsigned int a1, __int64 a2, __int64 a3, __int64 a4, __int64 a5, __int64 a6, int a7)
{
__int64 result; // rax

if ( a1 > 0x7F )
{
++_gcov0_isxdigit_l;
result = 0LL;
}
else
{
++qword_1258;
result = *((_WORD *)&a7 + 2 * (int)a1 + 1) & 0x200;
}
return result;
}

original_code:
int isxdigit_l (int c, locale_t locale)
{
  if (c < 0 || c >= 128) return 0;
  return locale._ctype[c]._flags & 0x200;
}

canonical_original_code:
int isxdigit_l(int c, struct axLocale locale)
{
  if (c < 0 || c >= 128) return 0;
  return locale._ctype[c]._flags & 0x200;
}


decompiled_code:
__int64 __fastcall tolower_l(unsigned int a1, __int64 a2, __int64 a3, __int64 a4, __int64 a5, __int64 a6, char a7)
{
__int64 result; // rax

if ( a1 > 0x7F )
{
++_gcov0_tolower_l;
result = a1;
}
else
{
++qword_1268;
result = (unsigned __int8)*(&a7 + 4 * (int)a1);
}
return result;
}

canonical_decompiled_code:
__int64 __fastcall func26(unsigned int a1, __int64 a2, __int64 a3, __int64 a4, __int64 a5, __int64 a6, char a7)
{
__int64 result; // rax

if ( a1 > 0x7F )
{
++_gcov0_tolower_l;
result = a1;
}
else
{
++qword_1268;
result = (unsigned __int8)*(&a7 + 4 * (int)a1);
}
return result;
}

original_code:
int tolower_l (int c, locale_t locale)
{
  if (c < 0 || c >= 128) return c;
  return locale._ctype[c]._lower;
}

canonical_original_code:
int tolower_l(int c, struct axLocale locale)
{
  if (c < 0 || c >= 128) return c;
  return locale._ctype[c]._lower;
}


decompiled_code:
__int64 __fastcall toupper_l(unsigned int a1, __int64 a2, __int64 a3, __int64 a4, __int64 a5, __int64 a6, __int16 a7)
{
__int64 result; // rax

if ( a1 > 0x7F )
{
++_gcov0_toupper_l;
result = a1;
}
else
{
++qword_1278;
result = *((unsigned __int8 *)&a7 + 4 * (int)a1 + 1);
}
return result;
}

canonical_decompiled_code:
__int64 __fastcall func27(unsigned int a1, __int64 a2, __int64 a3, __int64 a4, __int64 a5, __int64 a6, __int16 a7)
{
__int64 result; // rax

if ( a1 > 0x7F )
{
++_gcov0_toupper_l;
result = a1;
}
else
{
++qword_1278;
result = *((unsigned __int8 *)&a7 + 4 * (int)a1 + 1);
}
return result;
}

original_code:
int toupper_l (int c, locale_t locale)
{
  if (c < 0 || c >= 128) return c;
  return locale._ctype[c]._upper;
}

canonical_original_code:
int toupper_l(int c, struct axLocale locale)
{
  if (c < 0 || c >= 128) return c;
  return locale._ctype[c]._upper;
}


isascii

decompiled_code:
_BOOL8 __fastcall isascii(int a1)
{
++_gcov0_isascii;
return (a1 & 0xFFFFFF80) == 0;
}

canonical_decompiled_code:
_BOOL8 __fastcall func28(int a1)
{
++_gcov0_isascii;
return (a1 & 0xFFFFFF80) == 0;
}

original_code:
int isascii(int c)
{
  return !(c&~0x7f);
}


decompiled_code:
unsigned __int64 __fastcall axMurmur2_init(_QWORD *a1)
{
unsigned __int64 result; // rax

result = 0x98BADCFE00000004LL;
++_gcov0_axMurmur2_init;
*a1 = 0x98BADCFE00000004LL;
a1[1] = 0LL;
a1[2] = 0LL;
return result;
}

canonical_decompiled_code:
unsigned __int64 __fastcall func0(_QWORD *a1)
{
unsigned __int64 result; // rax

result = 0x98BADCFE00000004LL;
++_gcov0_axMurmur2_init;
*a1 = 0x98BADCFE00000004LL;
a1[1] = 0LL;
a1[2] = 0LL;
return result;
}

original_code:
void axMurmur2_init (axMurmurContext_t* ctx)
{
  ctx->_digestLg = sizeof (uint32_t);
  ctx->_digest[0] = 0x98BADCFE;
  ctx->_length = 0;
  ctx->_remains = 0;
  ctx->_bytes = 0;
}

canonical_original_code:
void axMurmur2_init(struct axMurmurContext_t *ctx)
{
  ctx->_digestLg = sizeof (unsigned int);
  ctx->_digest[0] = 0x98BADCFE;
  ctx->_length = 0;
  ctx->_remains = 0;
  ctx->_bytes = 0;
}

variable_types: struct axMurmurContext_t { unsigned int _digestLg; unsigned int _digest[]; unsigned long long _length; int _remains; int _bytes; } *

return_type: void


canonical_original_code:
void axMurmur2_data(struct axMurmurContext_t *ctx, unsigned char *ptr, unsigned long length)
{
  unsigned int k;
  unsigned int *chunk = (uint32_t*)ptr;
  if (ctx->_bytes != 0 ) {
    while (ctx->_bytes < 4 && length > 0) {
      ctx->_remains |= (*ptr << (ctx->_bytes * 8));
      ptr++;
      length--;
    }
    if (ctx->_bytes == 4) {
      k = ctx->_remains;
      ctx->_bytes = 0;
      ctx->_remains = 0;
      k *= 0xcc9e2d51;
      k = (((k) << (15)) | ((k) >> (32 - (15))));
      k *= 0x1b873593;
      *ctx->_digest ^= k;
      *ctx->_digest = (((*ctx->_digest) << (13)) | ((*ctx->_digest) >> (32 - (13))));
      *ctx->_digest *= 5;
      *ctx->_digest += 0xe6546b64;
      ctx->_length += 4;
    }
  }
  while (length >= 4) {
    k = *chunk;
    k *= 0xcc9e2d51;
    k = (((k) << (15)) | ((k) >> (32 - (15))));
    k *= 0x1b873593;
    *ctx->_digest ^= k;
    *ctx->_digest = (((*ctx->_digest) << (13)) | ((*ctx->_digest) >> (32 - (13))));
    *ctx->_digest *= 5;
    *ctx->_digest += 0xe6546b64;
    ctx->_length += 4;
    length -= 4;
    chunk ++;
  }
  while (length > 0) {
    ctx->_remains |= (*ptr << (ctx->_bytes++ * 8));
    ptr++;
    length--;
  }
}

variable_types:
ptr
unsigned char *

variable_types:
length
unsigned long

variable_types:
k
unsigned int

variable_types:
chunk
unsigned int *

user_defined_types: struct axMurmurContext_t { unsigned int _digestLg; unsigned int _digest[]; unsigned long long _length; int _remains; int _bytes; }


original_code:
void axMurmur2_finalize (axMurmurContext_t* ctx)
{
  uint32_t k;
  if (ctx->_bytes != 0 ) {
    k = ctx->_remains;
    k *= 0xcc9e2d51;
    k = (((k) << (15)) | ((k) >> (32 - (15))));
    k *= 0x1b873593;
    *ctx->_digest ^= k;
    ctx->_length += ctx->_bytes;
  }
  *ctx->_digest ^= ctx->_length;
  *ctx->_digest ^= *ctx->_digest >> 16;
  *ctx->_digest *= 0x85ebca6b;
  *ctx->_digest ^= *ctx->_digest >> 13;
  *ctx->_digest *= 0xc2b2ae35;
  *ctx->_digest ^= *ctx->_digest >> 16;
}

canonical_original_code:
void axMurmur2_finalize(struct axMurmurContext_t *ctx)
{
  unsigned int k;
  if (ctx->_bytes != 0 ) {
    k = ctx->_remains;
    k *= 0xcc9e2d51;
    k = (((k) << (15)) | ((k) >> (32 - (15))));
    k *= 0x1b873593;
    *ctx->_digest ^= k;
    ctx->_length += ctx->_bytes;
  }
  *ctx->_digest ^= ctx->_length;
  *ctx->_digest ^= *ctx->_digest >> 16;
  *ctx->_digest *= 0x85ebca6b;
  *ctx->_digest ^= *ctx->_digest >> 13;
  *ctx->_digest *= 0xc2b2ae35;
  *ctx->_digest ^= *ctx->_digest >> 16;
}


strrchr

decompiled_code:
const char *__fastcall strrchr(const char *a1, char a2)
{
__int64 v2; // rax
__int64 v3; // rdx
char v4; // cl

++_gcov0_strrchr;
LODWORD(v2) = strlen(a1) - 1;
if ( (int)v2 < 0 )
return 0LL;
v3 = qword_450;
v2 = (int)v2;
v4 = 0;
while ( a1[v2] != a2 )
{
--v2;
++v3;
v4 = 1;
if ( (int)v2 < 0 )
{
qword_450 = v3;
return 0LL;
}
}
if ( v4 )
qword_450 = v3;
++qword_448;
return a1;
}

canonical_decompiled_code:
const char *__fastcall func1(const char *a1, char a2)
{
__int64 v2; // rax
__int64 v3; // rdx
char v4; // cl

++_gcov0_strrchr;
LODWORD(v2) = strlen(a1) - 1;
if ( (int)v2 < 0 )
return 0LL;
v3 = qword_450;
v2 = (int)v2;
v4 = 0;
while ( a1[v2] != a2 )
{
--v2;
++v3;
v4 = 1;
if ( (int)v2 < 0 )
{
qword_450 = v3;
return 0LL;
}
}
if ( v4 )
qword_450 = v3;
++qword_448;
return a1;
}

original_code:
char* strrchr (const char* string, int ch)
{
  int lg = strlen (string) -1;
  for (; lg >= 0; --lg) {
    if (string[lg] == (char) ch) {
      return (char*) string;
    }
  }
  return 0;
}

canonical_original_code:
char *strrchr(char *string, int ch)
{
  int lg = strlen (string) -1;
  for (; lg >= 0; --lg) {
    if (string[lg] == (char) ch) {
      return (char *) string;
    }
  }
  return 0;
}

variable_types:
string
char *

variable_types: ch int

variable_types: lg int

return_type: char *


original_code:
char* strtok_r ( register char* s, register const char* delim, char** lasts )
{
    int skip_leading_delim = 1;
    register char* spanp;
    register int c, sc;
    char* tok;
    if ( s == 0 && ( s = *lasts ) == 0 ) {
        return 0;
    }
cont:
    c = *s++;
    for ( spanp = ( char* ) delim; ( sc = *spanp++ ) != 0; ) {
        if ( c == sc ) {
            if ( skip_leading_delim ) {
                goto cont;
            } else {
                *lasts = s;
                s[-1] = 0;
                return ( s - 1 );
            }
        }
    }
    if ( c == 0 ) {
        *lasts = 0;
        return 0;
    }
    tok = s - 1;
    for ( ;; ) {
        c = *s++;
        spanp = ( char* ) delim;
        do {
            if ( ( sc = *spanp++ ) == c ) {
                if ( c == 0 ) {
                    s = 0;
                } else {
                    s[-1] = 0;
                }
                *lasts = s;
                return ( tok );
            }
        } while ( sc != 0 );
    }
}

canonical_original_code:
char *strtok_r(char *s, char *delim, char **lasts)
{
    int skip_leading_delim = 1;
    register char *spanp;
    register int c; register int sc;
    char *tok;
    if ( s == 0 && ( s = *lasts ) == 0 ) {
        return 0;
    }
cont:
    c = *s++;
    for ( spanp = ( char * ) delim; ( sc = *spanp++ ) != 0; ) {
        if ( c == sc ) {
            if ( skip_leading_delim ) {
                goto cont;
            } else {
                *lasts = s;
                s[-1] = 0;
                return ( s - 1 );
            }
        }
    }
    if ( c == 0 ) {
        *lasts = 0;
        return 0;
    }
    tok = s - 1;
    for ( ;; ) {
        c = *s++;
        spanp = ( char * ) delim;
        do {
            if ( ( sc = *spanp++ ) == c ) {
                if ( c == 0 ) {
                    s = 0;
                } else {
                    s[-1] = 0;
                }
                *lasts = s;
                return ( tok );
            }
        } while ( sc != 0 );
    }
}

variable_types:
s
char *

variable_types:
delim
char *

variable_types:
lasts
char **

variable_types:
spanp
char *

variable_types: sc int

variable_types:
tok
char *


strtok

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

++_gcov0_strtok;
result = strtok_r(a1, a2, &strtok_reent);
++qword_4B8;
return result;
}

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

++_gcov0_strtok;
result = func2(a1, a2, &strtok_reent);
++qword_4B8;
return result;
}

original_code:
char* strtok ( register char* string , register const char* delimitors )
{
    return strtok_r ( string, delimitors, &strtok_reent );
}

canonical_original_code:
char *strtok(char *string, char *delimitors)
{
    return strtok_r ( string, delimitors, &strtok_reent );
}

variable_types:
delimitors
char *


scanf

decompiled_code:
int __fastcall scanf(char *format)
{
int result; // eax
char arg[8]; // [rsp+10h] [rbp-8h] BYREF

++_gcov0_scanf;
result = vfscanf(stdin, format, arg);
++qword_408;
return result;
}

canonical_decompiled_code:
int __fastcall func1(char *format)
{
int result; // eax
char arg[8]; // [rsp+10h] [rbp-8h] BYREF

++_gcov0_scanf;
result = vfscanf(stdin, format, arg);
++qword_408;
return result;
}

original_code:
int scanf(const char * format, ...)
{
  int ret;
  va_list ap;
  ((ap) = (va_list)(&(format)) + (((sizeof(format))+(sizeof(void*)-1))&(~(sizeof(void*)-1))));
  ret = vfscanf(stdin, format, ap);
  ((ap) = (va_list)0);
  return ret;
}

canonical_original_code:
int scanf(char *format, ...)
{
  int ret;
  char *ap;
  ((ap) = (va_list)(&(format)) + (((sizeof(format))+(sizeof(void *)-1))&(~(sizeof(void *)-1))));
  ret = vfscanf(stdin, format, ap);
  ((ap) = (char *)0);
  return ret;
}

variable_types:
format
char *

variable_types: ret int

variable_types:
ap
char *


fscanf

decompiled_code:
int __fastcall fscanf(FILE *a1, const char *a2)
{
int result; // eax
char arg[8]; // [rsp+10h] [rbp-8h] BYREF

++_gcov0_fscanf;
result = vfscanf(a1, a2, arg);
++qword_418;
return result;
}

canonical_decompiled_code:
int __fastcall func2(FILE *a1, const char *a2)
{
int result; // eax
char arg[8]; // [rsp+10h] [rbp-8h] BYREF

++_gcov0_fscanf;
result = vfscanf(a1, a2, arg);
++qword_418;
return result;
}

original_code:
int fscanf(FILE * f, const char * format, ...)
{
  int ret;
  va_list ap;
  ((ap) = (va_list)(&(format)) + (((sizeof(format))+(sizeof(void*)-1))&(~(sizeof(void*)-1))));
  ret = vfscanf(f, format, ap);
  ((ap) = (va_list)0);
  return ret;
}

canonical_original_code:
int fscanf(struct axFile *f, char *format, ...)
{
  int ret;
  char *ap;
  ((ap) = (va_list)(&(format)) + (((sizeof(format))+(sizeof(void *)-1))&(~(sizeof(void *)-1))));
  ret = vfscanf(f, format, ap);
  ((ap) = (char *)0);
  return ret;
}

variable_types: struct axFile { int fd_; int oflags_; struct axFile *next_; int lock_; int count_; char lbuf_; char *buf_; long off_; long lpos_; unsigned long bsize_; char *rpos_; char *rend_; char *wpos_; char *wend_; int (*write_)(struct axFile *fp, char *buf, unsigned long length); int (*read_)(struct axFile *fp, char *buf, unsigned long length); } *


vscanf

decompiled_code:
int __fastcall vscanf(char *format, __gnuc_va_list arg)
{
int result; // eax

++_gcov0_vscanf;
result = vfscanf(stdin, format, arg);
++qword_428;
return result;
}

canonical_decompiled_code:
int __fastcall func3(char *format, __gnuc_va_list arg)
{
int result; // eax

++_gcov0_vscanf;
result = vfscanf(stdin, format, arg);
++qword_428;
return result;
}

original_code:
int vscanf(const char * format, va_list ap)
{
  return vfscanf(stdin, format, ap);
}

canonical_original_code:
int vscanf(char *format, char *ap)
{
  return vfscanf(stdin, format, ap);
}


sscanf

decompiled_code:
int __fastcall sscanf(__int64 a1, const char *a2)
{
int result; // eax
__int64 arg[15]; // [rsp+10h] [rbp-78h] BYREF

memset(arg, 0, 0x68uLL);
LODWORD(arg[2]) = -1;
arg[8] = a1;
arg[9] = 0xFFFFFFFFLL;
arg[13] = (__int64)sread;
++_gcov0_sscanf;
result = vfscanf((FILE *)arg, a2, arg);
++qword_438;
return result;
}

canonical_decompiled_code:
int __fastcall func4(__int64 a1, const char *a2)
{
int result; // eax
__int64 arg[15]; // [rsp+10h] [rbp-78h] BYREF

memset(arg, 0, 0x68uLL);
LODWORD(arg[2]) = -1;
arg[8] = a1;
arg[9] = 0xFFFFFFFFLL;
arg[13] = (__int64)sread;
++_gcov0_sscanf;
result = vfscanf((FILE *)arg, a2, arg);
++qword_438;
return result;
}

original_code:
int sscanf(const char * str, const char * format, ...)
{
  int ret;
  va_list ap;
  ((ap) = (va_list)(&(format)) + (((sizeof(format))+(sizeof(void*)-1))&(~(sizeof(void*)-1))));
  FILE fp = {
    .rpos_ = (char*)str,
    .rend_ = (char*)4294967295UL,
    .read_ = _sread,
    .lock_ = -1
  };
  ret = vfscanf(&fp, format, ap);
  ((ap) = (va_list)0);
  return ret;
}

canonical_original_code:
int sscanf(char *str, char *format, ...)
{
  int ret;
  char *ap;
  ((ap) = (va_list)(&(format)) + (((sizeof(format))+(sizeof(void *)-1))&(~(sizeof(void *)-1))));
  struct axFile fp = {
    .rpos_ = (char*)str,
    .rend_ = (char*)4294967295UL,
    .read_ = _sread,
    .lock_ = -1
  };
  ret = vfscanf(&fp, format, ap);
  ((ap) = (char *)0);
  return ret;
}

variable_types:
str
char *

variable_types: struct axFile { int fd_; int oflags_; struct axFile *next_; int lock_; int count_; char lbuf_; char *buf_; long off_; long lpos_; unsigned long bsize_; char *rpos_; char *rend_; char *wpos_; char *wend_; int (*write_)(struct axFile *fp, char *buf, unsigned long length); int (*read_)(struct axFile *fp, char *buf, unsigned long length); }


vsscanf

decompiled_code:
int __fastcall vsscanf(__int64 a1, const char *a2, void *a3)
{
int result; // eax
__int64 v4[15]; // [rsp+0h] [rbp-78h] BYREF

++_gcov0_vsscanf;
memset(v4, 0, 0x68uLL);
LODWORD(v4[2]) = -1;
v4[8] = a1;
v4[9] = 0xFFFFFFFFLL;
v4[13] = (__int64)sread;
result = vfscanf((FILE *)v4, a2, a3);
++qword_448;
return result;
}

canonical_decompiled_code:
int __fastcall func5(__int64 a1, const char *a2, void *a3)
{
int result; // eax
__int64 v4[15]; // [rsp+0h] [rbp-78h] BYREF

++_gcov0_vsscanf;
memset(v4, 0, 0x68uLL);
LODWORD(v4[2]) = -1;
v4[8] = a1;
v4[9] = 0xFFFFFFFFLL;
v4[13] = (__int64)sread;
result = vfscanf((FILE *)v4, a2, a3);
++qword_448;
return result;
}

original_code:
int vsscanf(const char * str, const char * format, va_list ap)
{
  FILE fp = {
    .rpos_ = (char*)str,
    .rend_ = (char*)4294967295UL,
    .read_ = _sread,
    .lock_ = -1
  };
  return vfscanf(&fp, format, ap);
}

canonical_original_code:
int vsscanf(char *str, char *format, char *ap)
{
  struct axFile fp = {
    .rpos_ = (char*)str,
    .rend_ = (char*)4294967295UL,
    .read_ = _sread,
    .lock_ = -1
  };
  return vfscanf(&fp, format, ap);
}

user_defined_types: struct axFile { int fd_; int oflags_; struct axFile *next_; int lock_; int count_; char lbuf_; char *buf_; long off_; long lpos_; unsigned long bsize_; char *rpos_; char *rend_; char *wpos_; char *wend_; int (*write_)(struct axFile *fp, char *buf, unsigned long length); int (*read_)(struct axFile *fp, char *buf, unsigned long length); }


decompiled_code:
unsigned __int64 __fastcall pop_arg(long double *a1, unsigned int a2, double ***a3)
{
unsigned __int64 result; // rax
long double v4; // fst7
long double v5; // fst7
double **v6; // rax
double **v7; // rax
int *v8; // rcx
double **v9; // rax
unsigned int *v10; // rcx
double **v11; // rax
__int16 *v12; // rcx
double **v13; // rax
unsigned __int16 *v14; // rcx
double **v15; // rax
char *v16; // rcx
double **v17; // rax
unsigned __int8 *v18; // rcx

if ( a2 > 0x14 )
{
++_gcov0_pop_arg;
}
else
{
switch ( a2 )
{
case 9u:
++qword_AB0;
goto LABEL_7;
case 0xAu:
v7 = *a3;
++qword_AB8;
v8 = (int *)(v7 + 1);
result = *(int *)v7;
*a3 = (double **)v8;
*(_QWORD *)a1 = result;
break;
case 0xBu:
v9 = *a3;
++qword_AC0;
v10 = (unsigned int *)(v9 + 1);
result = *(unsigned int *)v9;
*a3 = (double **)v10;
*(_QWORD *)a1 = result;
break;
case 0xCu:
++qword_AC8;
LABEL_7:
v6 = (*a3)++;
result = (unsigned __int64)*v6;
*(_QWORD *)a1 = result;
break;
case 0xDu:
v11 = *a3;
++qword_AD0;
v12 = (__int16 *)(v11 + 1);
result = *(__int16 *)v11;
*a3 = (double **)v12;
*(_QWORD *)a1 = result;
break;
case 0xEu:
v13 = *a3;
++qword_AD8;
v14 = (unsigned __int16 *)(v13 + 1);
result = *(unsigned __int16 *)v13;
*a3 = (double **)v14;
*(_QWORD *)a1 = result;
break;
case 0xFu:
v15 = *a3;
++qword_AE0;
v16 = (char *)(v15 + 1);
result = *(char *)v15;
*a3 = (double **)v16;
*(_QWORD *)a1 = result;
break;
case 0x10u:
v17 = *a3;
++qword_AE8;
v18 = (unsigned __int8 *)(v17 + 1);
result = *(unsigned __int8 *)v17;
*a3 = (double **)v18;
*(_QWORD *)a1 = result;
break;
case 0x11u:
result = (unsigned __int64)*a3;
++qword_AF0;
v4 = *(double *)result;
*a3 = (double **)(result + 8);
*a1 = v4;
break;
case 0x12u:
result = (unsigned __int64)*a3;
++qword_AF8;
v5 = *(long double *)result;
*a3 = (double **)(result + 16);
*a1 = v5;
break;
default:
++qword_AA8;
break;
}
}
return result;
}

canonical_decompiled_code:
unsigned __int64 __fastcall func0(long double *a1, unsigned int a2, double ***a3)
{
unsigned __int64 result; // rax
long double v4; // fst7
long double v5; // fst7
double **v6; // rax
double **v7; // rax
int *v8; // rcx
double **v9; // rax
unsigned int *v10; // rcx
double **v11; // rax
__int16 *v12; // rcx
double **v13; // rax
unsigned __int16 *v14; // rcx
double **v15; // rax
char *v16; // rcx
double **v17; // rax
unsigned __int8 *v18; // rcx

if ( a2 > 0x14 )
{
++_gcov0_pop_arg;
}
else
{
switch ( a2 )
{
case 9u:
++qword_AB0;
goto LABEL_7;
case 0xAu:
v7 = *a3;
++qword_AB8;
v8 = (int *)(v7 + 1);
result = *(int *)v7;
*a3 = (double **)v8;
*(_QWORD *)a1 = result;
break;
case 0xBu:
v9 = *a3;
++qword_AC0;
v10 = (unsigned int *)(v9 + 1);
result = *(unsigned int *)v9;
*a3 = (double **)v10;
*(_QWORD *)a1 = result;
break;
case 0xCu:
++qword_AC8;
LABEL_7:
v6 = (*a3)++;
result = (unsigned __int64)*v6;
*(_QWORD *)a1 = result;
break;
case 0xDu:
v11 = *a3;
++qword_AD0;
v12 = (__int16 *)(v11 + 1);
result = *(__int16 *)v11;
*a3 = (double **)v12;
*(_QWORD *)a1 = result;
break;
case 0xEu:
v13 = *a3;
++qword_AD8;
v14 = (unsigned __int16 *)(v13 + 1);
result = *(unsigned __int16 *)v13;
*a3 = (double **)v14;
*(_QWORD *)a1 = result;
break;
case 0xFu:
v15 = *a3;
++qword_AE0;
v16 = (char *)(v15 + 1);
result = *(char *)v15;
*a3 = (double **)v16;
*(_QWORD *)a1 = result;
break;
case 0x10u:
v17 = *a3;
++qword_AE8;
v18 = (unsigned __int8 *)(v17 + 1);
result = *(unsigned __int8 *)v17;
*a3 = (double **)v18;
*(_QWORD *)a1 = result;
break;
case 0x11u:
result = (unsigned __int64)*a3;
++qword_AF0;
v4 = *(double *)result;
*a3 = (double **)(result + 8);
*a1 = v4;
break;
case 0x12u:
result = (unsigned __int64)*a3;
++qword_AF8;
v5 = *(long double *)result;
*a3 = (double **)(result + 16);
*a1 = v5;
break;
default:
++qword_AA8;
break;
}
}
return result;
}

original_code:
static inline void pop_arg(axArg_t* arg, int type, va_list *ap)
{
  if ((unsigned)type > MAXSTATE) return;
  switch (type) {
    case PTR: arg->p = (*(void **) (((*ap) += (((sizeof(void *))+(sizeof(void*)-1))&(~(sizeof(void*)-1)))) - (((sizeof(void *))+(sizeof(void*)-1))&(~(sizeof(void*)-1))))); break;
    case INT: arg->s = (*(int*) (((*ap) += (((sizeof(int))+(sizeof(void*)-1))&(~(sizeof(void*)-1)))) - (((sizeof(int))+(sizeof(void*)-1))&(~(sizeof(void*)-1))))); break;
    case UINT: arg->i = (*(unsigned int*) (((*ap) += (((sizeof(unsigned int))+(sizeof(void*)-1))&(~(sizeof(void*)-1)))) - (((sizeof(unsigned int))+(sizeof(void*)-1))&(~(sizeof(void*)-1))))); break;
    case ULLONG: arg->i = (*(unsigned long long*) (((*ap) += (((sizeof(unsigned long long))+(sizeof(void*)-1))&(~(sizeof(void*)-1)))) - (((sizeof(unsigned long long))+(sizeof(void*)-1))&(~(sizeof(void*)-1))))); break;
    case SHORT: arg->s = (short)(*(int*) (((*ap) += (((sizeof(int))+(sizeof(void*)-1))&(~(sizeof(void*)-1)))) - (((sizeof(int))+(sizeof(void*)-1))&(~(sizeof(void*)-1))))); break;
    case USHORT: arg->i = (unsigned short)(*(int*) (((*ap) += (((sizeof(int))+(sizeof(void*)-1))&(~(sizeof(void*)-1)))) - (((sizeof(int))+(sizeof(void*)-1))&(~(sizeof(void*)-1))))); break;
    case CHAR: arg->s = (signed char)(*(int*) (((*ap) += (((sizeof(int))+(sizeof(void*)-1))&(~(sizeof(void*)-1)))) - (((sizeof(int))+(sizeof(void*)-1))&(~(sizeof(void*)-1))))); break;
    case UCHAR: arg->i = (unsigned char)(*(int*) (((*ap) += (((sizeof(int))+(sizeof(void*)-1))&(~(sizeof(void*)-1)))) - (((sizeof(int))+(sizeof(void*)-1))&(~(sizeof(void*)-1))))); break;
    case DBL: arg->f = (*(double*) (((*ap) += (((sizeof(double))+(sizeof(void*)-1))&(~(sizeof(void*)-1)))) - (((sizeof(double))+(sizeof(void*)-1))&(~(sizeof(void*)-1))))); break;
    case LDBL: arg->f = (*(long double*) (((*ap) += (((sizeof(long double))+(sizeof(void*)-1))&(~(sizeof(void*)-1)))) - (((sizeof(long double))+(sizeof(void*)-1))&(~(sizeof(void*)-1))))); break;
  }
}

canonical_original_code:
static inline void pop_arg(union axArg *arg, int type, char **ap)
{
  if ((unsigned int)type > MAXSTATE) return;
  switch (type) {
    case PTR: arg->p = (*(void **) (((*ap) += (((sizeof(void *))+(sizeof(void *)-1))&(~(sizeof(void *)-1)))) - (((sizeof(void *))+(sizeof(void *)-1))&(~(sizeof(void *)-1))))); break;
    case INT: arg->s = (*(int *) (((*ap) += (((sizeof(int))+(sizeof(void *)-1))&(~(sizeof(void *)-1)))) - (((sizeof(int))+(sizeof(void *)-1))&(~(sizeof(void *)-1))))); break;
    case UINT: arg->i = (*(unsigned int *) (((*ap) += (((sizeof(unsigned int))+(sizeof(void *)-1))&(~(sizeof(void *)-1)))) - (((sizeof(unsigned int))+(sizeof(void *)-1))&(~(sizeof(void *)-1))))); break;
    case ULLONG: arg->i = (*(unsigned long long *) (((*ap) += (((sizeof(unsigned long long))+(sizeof(void *)-1))&(~(sizeof(void *)-1)))) - (((sizeof(unsigned long long))+(sizeof(void *)-1))&(~(sizeof(void *)-1))))); break;
    case SHORT: arg->s = (short)(*(int *) (((*ap) += (((sizeof(int))+(sizeof(void *)-1))&(~(sizeof(void *)-1)))) - (((sizeof(int))+(sizeof(void *)-1))&(~(sizeof(void *)-1))))); break;
    case USHORT: arg->i = (unsigned short)(*(int *) (((*ap) += (((sizeof(int))+(sizeof(void *)-1))&(~(sizeof(void *)-1)))) - (((sizeof(int))+(sizeof(void *)-1))&(~(sizeof(void *)-1))))); break;
    case CHAR: arg->s = (char)(*(int *) (((*ap) += (((sizeof(int))+(sizeof(void *)-1))&(~(sizeof(void *)-1)))) - (((sizeof(int))+(sizeof(void *)-1))&(~(sizeof(void *)-1))))); break;
    case UCHAR: arg->i = (unsigned char)(*(int *) (((*ap) += (((sizeof(int))+(sizeof(void *)-1))&(~(sizeof(void *)-1)))) - (((sizeof(int))+(sizeof(void *)-1))&(~(sizeof(void *)-1))))); break;
    case DBL: arg->f = (*(double *) (((*ap) += (((sizeof(double))+(sizeof(void *)-1))&(~(sizeof(void *)-1)))) - (((sizeof(double))+(sizeof(void *)-1))&(~(sizeof(void *)-1))))); break;
    case LDBL: arg->f = (*(long double *) (((*ap) += (((sizeof(long double))+(sizeof(void *)-1))&(~(sizeof(void *)-1)))) - (((sizeof(long double))+(sizeof(void *)-1))&(~(sizeof(void *)-1))))); break;
  }
}

variable_types: union axArg { long long s; unsigned long long i; long double f; void *p; } *

variable_types: type int

variable_types:
ap
char **


variable_types: struct axFormatSpec { int flag_; int field_; int precis_; int type_; } *

variable_types:
ptr
char **

variable_types: sign char

variable_types: ty int


vfprintf

original_code:
int vfprintf (FILE* fp, const char* str, va_list ap)
{
  int lg;
  char ch;
  axArg_t arg;
  char tmp [512];
  axFormatSpec_t sb;
  ;
  while (*str) {
    if (*str != '%') {
      if (fp->write_(fp, str++, 1) < 0)
        return -1;
      continue;
    } else if (str[1] == '%') {
      if (fp->write_(fp, str, 1) < 0)
        return -1;
      str += 2;
      continue;
    }
    str++;
    if (read_format_specifier(&sb, &str, &ap) < 0)
      return -1;
    if (sb.flag_ & (1<<('-'-' ')))
      sb.flag_ &= ~(1<<('0'-' '));
    pop_arg (&arg, sb.type_, &ap);
    lg = 0;
    switch (str[-1]) {
      case 'n':
        break;
      case 'p':
        sb.flag_ = (1<<('#'-' ')) | (1<<('0'-' '));
      case 'x': case 'X':
        if (sb.flag_ & (1<<('#'-' ')))
          lg -= 2;
        if (str[-1] & 32)
          _utoa(arg.i, tmp, 16, _utoa_digits);
        else
          _utoa(arg.i, tmp, 16, _utoa_digitsX);
        break;
      case 'o':
        _utoa(arg.i, tmp, 8, _utoa_digits);
        break;
      case 'u':
        _utoa(arg.i, tmp, 10, _utoa_digits);
        break;
      case 'd': case 'i':
        if (arg.s >= 0)
          _utoa(arg.s, tmp, 10, _utoa_digits);
        else {
          lg--;
          if (fp->write_(fp, "-", 1) < 0)
            return -1;
          _utoa(-arg.s, tmp, 10, _utoa_digits);
        }
        break;
      case 'c':
        ch = arg.s;
        if (fp->write_(fp, &ch, 1) < 0)
          return -1;
        break;
      case 's':
        lg = strlen((char*)arg.p);
        if (fp->write_(fp, (char*)arg.p, lg) < 0)
          return -1;
        break;
    }
    switch (str[-1]) {
      case 'p':
      case 'x': case 'X':
      case 'o': case 'u':
      case 'd': case 'i':
        lg += sb.field_ - strlen(tmp);
        ch = (sb.flag_ & (1<<('0'-' ')) ? '0' : ' ');
        if (lg > 0 && !(sb.flag_ & (1<<('-'-' ')))) {
          while (lg--) {
              if (fp->write_(fp, &ch, 1) < 0)
                return -1;
            }
        }
        if (sb.flag_ & (1<<('#'-' ')) && (str[-1] & 32) == 'x') {
          if (fp->write_(fp, "0x", 2) < 0)
            return -1;
        }
        if (fp->write_(fp, tmp, strlen(tmp)) < 0)
          return -1;
        if (lg > 0) {
          while (lg--) {
              if (fp->write_(fp, &ch, 1) < 0)
                return -1;
            }
        }
        break;
    }
  }
  ;
  return fp->count_;
}

canonical_original_code:
int vfprintf(struct axFile *fp, char *str, char *ap)
{
  int lg;
  char ch;
  union axArg arg;
  char tmp[512];
  struct axFormatSpec sb;
  ;
  while (*str) {
    if (*str != '%') {
      if (fp->write_(fp, str++, 1) < 0)
        return -1;
      continue;
    } else if (str[1] == '%') {
      if (fp->write_(fp, str, 1) < 0)
        return -1;
      str += 2;
      continue;
    }
    str++;
    if (read_format_specifier(&sb, &str, &ap) < 0)
      return -1;
    if (sb.flag_ & (1<<('-'-' ')))
      sb.flag_ &= ~(1<<('0'-' '));
    pop_arg (&arg, sb.type_, &ap);
    lg = 0;
    switch (str[-1]) {
      case 'n':
        break;
      case 'p':
        sb.flag_ = (1<<('#'-' ')) | (1<<('0'-' '));
      case 'x': case 'X':
        if (sb.flag_ & (1<<('#'-' ')))
          lg -= 2;
        if (str[-1] & 32)
          _utoa(arg.i, tmp, 16, _utoa_digits);
        else
          _utoa(arg.i, tmp, 16, _utoa_digitsX);
        break;
      case 'o':
        _utoa(arg.i, tmp, 8, _utoa_digits);
        break;
      case 'u':
        _utoa(arg.i, tmp, 10, _utoa_digits);
        break;
      case 'd': case 'i':
        if (arg.s >= 0)
          _utoa(arg.s, tmp, 10, _utoa_digits);
        else {
          lg--;
          if (fp->write_(fp, "-", 1) < 0)
            return -1;
          _utoa(-arg.s, tmp, 10, _utoa_digits);
        }
        break;
      case 'c':
        ch = arg.s;
        if (fp->write_(fp, &ch, 1) < 0)
          return -1;
        break;
      case 's':
        lg = strlen((char *)arg.p);
        if (fp->write_(fp, (char *)arg.p, lg) < 0)
          return -1;
        break;
    }
    switch (str[-1]) {
      case 'p':
      case 'x': case 'X':
      case 'o': case 'u':
      case 'd': case 'i':
        lg += sb.field_ - strlen(tmp);
        ch = (sb.flag_ & (1<<('0'-' ')) ? '0' : ' ');
        if (lg > 0 && !(sb.flag_ & (1<<('-'-' ')))) {
          while (lg--) {
              if (fp->write_(fp, &ch, 1) < 0)
                return -1;
            }
        }
        if (sb.flag_ & (1<<('#'-' ')) && (str[-1] & 32) == 'x') {
          if (fp->write_(fp, "0x", 2) < 0)
            return -1;
        }
        if (fp->write_(fp, tmp, strlen(tmp)) < 0)
          return -1;
        if (lg > 0) {
          while (lg--) {
              if (fp->write_(fp, &ch, 1) < 0)
                return -1;
            }
        }
        break;
    }
  }
  ;
  return fp->count_;
}

variable_types: lg int

variable_types: ch char

variable_types: union axArg { long long s; unsigned long long i; long double f; void *p; }

variable_types:
tmp
char [512]

variable_types: struct axFormatSpec { int flag_; int field_; int precis_; int type_; }


strcmp

decompiled_code:
__int64 __fastcall strcmp(char *a1, char *a2)
{
int v2; // eax
__int64 v3; // rdx
char v4; // r8
char *v5; // rdi
int v7; // ecx
int v8; // ecx

v2 = *a1;
v3 = qword_788;
v4 = 0;
++_gcov0_strcmp;
v5 = &a1[-qword_788];
if ( (_BYTE)v2 )
{
while ( 1 )
{
v8 = *a2;
if ( *a2 != (_BYTE)v2 )
break;
++v3;
v4 = 1;
v2 = v5[v3];
if ( !v5[v3] )
{
v7 = a2[1];
qword_788 = v3;
return (unsigned int)-v7;
}
++a2;
}
if ( v4 )
qword_788 = v3;
++qword_790;
}
else
{
v8 = *a2;
v2 = 0;
}
return (unsigned int)(v2 - v8);
}

canonical_decompiled_code:
__int64 __fastcall func1(char *a1, char *a2)
{
int v2; // eax
__int64 v3; // rdx
char v4; // r8
char *v5; // rdi
int v7; // ecx
int v8; // ecx

v2 = *a1;
v3 = qword_788;
v4 = 0;
++_gcov0_strcmp;
v5 = &a1[-qword_788];
if ( (_BYTE)v2 )
{
while ( 1 )
{
v8 = *a2;
if ( *a2 != (_BYTE)v2 )
break;
++v3;
v4 = 1;
v2 = v5[v3];
if ( !v5[v3] )
{
v7 = a2[1];
qword_788 = v3;
return (unsigned int)-v7;
}
++a2;
}
if ( v4 )
qword_788 = v3;
++qword_790;
}
else
{
v8 = *a2;
v2 = 0;
}
return (unsigned int)(v2 - v8);
}

original_code:
int strcmp ( const char* str1, const char* str2 )
{
    while ( *str1 && ( *str1 == *str2 ) ) {
        ++str1;
        ++str2;
    }
    return *str1 - *str2;
}

canonical_original_code:
int strcmp(char *str1, char *str2)
{
    while ( *str1 && ( *str1 == *str2 ) ) {
        ++str1;
        ++str2;
    }
    return *str1 - *str2;
}


strncmp

decompiled_code:
__int64 __fastcall strncmp(_BYTE *a1, char *a2, __int64 a3)
{
__int64 v3; // rcx
char v4; // r9
__int64 v5; // rdx
_BYTE *v6; // r8
int v7; // eax
int v8; // edx
__int64 result; // rax
int v10; // eax
int v11; // edx

v3 = _gcov0_strncmp;
v4 = 0;
v5 = a3 - 1;
if ( v5 )
{
v6 = &a1[v5];
while ( 1 )
{
v7 = (char)*a1;
v8 = *a2;
if ( !*a1 )
{
if ( v4 )
_gcov0_strncmp = v3;
++qword_7B0;
return (unsigned int)(v7 - v8);
}
if ( (_BYTE)v7 != (_BYTE)v8 )
break;
++a1;
++a2;
++v3;
v4 = 1;
if ( a1 == v6 )
{
_gcov0_strncmp = v3;
goto LABEL_10;
}
}
if ( v4 )
_gcov0_strncmp = v3;
++qword_7B8;
result = (unsigned int)(v7 - v8);
}
else
{
LABEL_10:
v10 = (char)*a1;
v11 = *a2;
++qword_7A8;
result = (unsigned int)(v10 - v11);
}
return result;
}

canonical_decompiled_code:
__int64 __fastcall func2(_BYTE *a1, char *a2, __int64 a3)
{
__int64 v3; // rcx
char v4; // r9
__int64 v5; // rdx
_BYTE *v6; // r8
int v7; // eax
int v8; // edx
__int64 result; // rax
int v10; // eax
int v11; // edx

v3 = _gcov0_strncmp;
v4 = 0;
v5 = a3 - 1;
if ( v5 )
{
v6 = &a1[v5];
while ( 1 )
{
v7 = (char)*a1;
v8 = *a2;
if ( !*a1 )
{
if ( v4 )
_gcov0_strncmp = v3;
++qword_7B0;
return (unsigned int)(v7 - v8);
}
if ( (_BYTE)v7 != (_BYTE)v8 )
break;
++a1;
++a2;
++v3;
v4 = 1;
if ( a1 == v6 )
{
_gcov0_strncmp = v3;
goto LABEL_10;
}
}
if ( v4 )
_gcov0_strncmp = v3;
++qword_7B8;
result = (unsigned int)(v7 - v8);
}
else
{
LABEL_10:
v10 = (char)*a1;
v11 = *a2;
++qword_7A8;
result = (unsigned int)(v10 - v11);
}
return result;
}

original_code:
int strncmp ( const char* str1, const char* str2, size_t length )
{
    while ( --length && *str1 && *str1 == *str2 ) {
        ++str1;
        ++str2;
    }
    return *str1 - *str2;
}

canonical_original_code:
int strncmp(char *str1, char *str2, unsigned long length)
{
    while ( --length && *str1 && *str1 == *str2 ) {
        ++str1;
        ++str2;
    }
    return *str1 - *str2;
}

variable_types:
length
unsigned long


strcoll

decompiled_code:
__int64 __fastcall strcoll(__int64 a1, __int64 a2)
{
__int64 v2; // rax
char v3; // r8
__int64 v4; // rdi
__int64 v5; // rsi
char v6; // dl
int v7; // ecx
__int64 result; // rax

v2 = qword_7C8;
v3 = 0;
v4 = a1 - qword_7C8;
v5 = a2 - qword_7C8;
while ( 1 )
{
v6 = *(_BYTE *)(v4 + v2);
v7 = *(char *)(v5 + v2);
if ( v6 != *(_BYTE *)(v5 + v2) )
break;
++v2;
v3 = 1;
if ( !v6 )
{
qword_7C8 = v2;
result = 0LL;
++_gcov0_strcoll;
return result;
}
}
if ( v3 )
qword_7C8 = v2;
++qword_7D0;
return (unsigned int)(v6 - v7);
}

canonical_decompiled_code:
__int64 __fastcall func3(__int64 a1, __int64 a2)
{
__int64 v2; // rax
char v3; // r8
__int64 v4; // rdi
__int64 v5; // rsi
char v6; // dl
int v7; // ecx
__int64 result; // rax

v2 = qword_7C8;
v3 = 0;
v4 = a1 - qword_7C8;
v5 = a2 - qword_7C8;
while ( 1 )
{
v6 = *(_BYTE *)(v4 + v2);
v7 = *(char *)(v5 + v2);
if ( v6 != *(_BYTE *)(v5 + v2) )
break;
++v2;
v3 = 1;
if ( !v6 )
{
qword_7C8 = v2;
result = 0LL;
++_gcov0_strcoll;
return result;
}
}
if ( v3 )
qword_7C8 = v2;
++qword_7D0;
return (unsigned int)(v6 - v7);
}

original_code:
int strcoll ( char* str1, const char* str2 )
{
    while ( *str1 == *str2++ )
        if ( *str1++ == '\0' ) {
            return 0;
        }
    return *str1 - *--str2;
}

canonical_original_code:
int strcoll(char *str1, char *str2)
{
    while ( *str1 == *str2++ )
        if ( *str1++ == '\0' ) {
            return 0;
        }
    return *str1 - *--str2;
}


flockfile

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

result = mtx_lock(a1 + 16);
if ( (_DWORD)result )
flockfile_cold();
return result;
}

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

result = mtx_lock(a1 + 16);
if ( (_DWORD)result )
func3();
return result;
}

original_code:
void flockfile (FILE* fp)
{
  if(mtx_lock( &fp->lock_ ) != 0 ) {
    abort();
  }
}

canonical_original_code:
void flockfile(struct axFile *fp)
{
  if(mtx_lock( &fp->lock_ ) != 0 ) {
    abort();
  }
}


funlockfile

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

result = mtx_unlock(a1 + 16);
if ( (_DWORD)result )
funlockfile_cold();
return result;
}

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

result = mtx_unlock(a1 + 16);
if ( (_DWORD)result )
func4();
return result;
}

original_code:
void funlockfile (FILE* fp)
{
  if (mtx_unlock( &fp->lock_ ) != 0) {
    abort();
  }
}

canonical_original_code:
void funlockfile(struct axFile *fp)
{
  if (mtx_unlock( &fp->lock_ ) != 0) {
    abort();
  }
}


ftrylockfile

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

result = mtx_trylock(a1 + 16);
if ( (_DWORD)result )
{
if ( (_DWORD)result != 1 )
ftrylockfile_cold();
}
return result;
}

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

result = mtx_trylock(a1 + 16);
if ( (_DWORD)result )
{
if ( (_DWORD)result != 1 )
func5();
}
return result;
}

original_code:
int ftrylockfile (FILE* fp)
{
  switch(mtx_trylock( &fp->lock_ )) {
    case 0:
      return 0;
    case 1:
      return 1;
    default:
      abort();
  }
}

canonical_original_code:
int ftrylockfile(struct axFile *fp)
{
  switch(mtx_trylock( &fp->lock_ )) {
    case 0:
      return 0;
    case 1:
      return 1;
    default:
      abort();
  }
}


clearerr

decompiled_code:
void __fastcall clearerr(FILE *stream)
{
flockfile(stream);
*(&stream->_flags + 1) &= 0xFFFFCFFF;
funlockfile(stream);
}

canonical_decompiled_code:
void __fastcall func0(FILE *stream)
{
flockfile(stream);
*(&stream->_flags + 1) &= 0xFFFFCFFF;
funlockfile(stream);
}

original_code:
void clearerr (FILE* stream)
{
  flockfile (stream);
  stream->oflags_ &= ~(0x2000 | 0x1000);
  funlockfile (stream);
}

canonical_original_code:
void clearerr(struct axFile *stream)
{
  flockfile (stream);
  stream->oflags_ &= ~(0x2000 | 0x1000);
  funlockfile (stream);
}


feof

decompiled_code:
__int64 __fastcall feof(__int64 a1)
{
return *(_DWORD *)(a1 + 4) & 0x1000;
}

original_code:
int feof (FILE* stream)
{
  return stream->oflags_ & 0x1000;
}

canonical_original_code:
int feof(struct axFile *stream)
{
  return stream->oflags_ & 0x1000;
}


ferror

decompiled_code:
__int64 __fastcall ferror(__int64 a1)
{
return *(_DWORD *)(a1 + 4) & 0x2000;
}

original_code:
int ferror (FILE* stream)
{
  return stream->oflags_ & 0x2000;
}

canonical_original_code:
int ferror(struct axFile *stream)
{
  return stream->oflags_ & 0x2000;
}


fileno

decompiled_code:
__int64 __fastcall fileno(unsigned int *a1)
{
return *a1;
}

canonical_decompiled_code:
__int64 __fastcall func3(unsigned int *a1)
{
return *a1;
}

original_code:
int fileno (FILE* stream)
{
  return stream->fd_;
}

canonical_original_code:
int fileno(struct axFile *stream)
{
  return stream->fd_;
}


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

if ( a1 )
{
++qword_808;
result = "Unknown Error";
if ( (a1 & 0x1FFF00) == 0 )
{
++qword_810;
result = (const char *)*(&errMsgs + a1);
}
}
else
{
++_gcov0_strerror_p;
result = "No error";
}
return result;
}

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

if ( a1 )
{
++qword_808;
result = "Unknown Error";
if ( (a1 & 0x1FFF00) == 0 )
{
++qword_810;
result = (const char *)*(&errMsgs + a1);
}
}
else
{
++_gcov0_strerror_p;
result = "No error";
}
return result;
}

original_code:
static const char* strerror_p ( int err )
{
  if ( err == 0 ) {
    return "No error";
  }
  int grp = err & 0x1fff00;
  switch ( grp ) {
    case 0:
    return errMsgs[err];
    default:
      return "Unknown Error";
  }
}

canonical_original_code:
static char *strerror_p(int err)
{
  if ( err == 0 ) {
    return "No error";
  }
  int grp = err & 0x1fff00;
  switch ( grp ) {
    case 0:
    return errMsgs[err];
    default:
      return "Unknown Error";
  }
}

variable_types: err int

variable_types: grp int


decompiled_code:
char *__fastcall strerror_s(__int64 a1, size_t a2, int a3)
{
const char *v3; // rax
char *v4; // r8

++_gcov0_strerror_s;
v3 = strerror_p(a3);
return strncpy(v4, v3, a2);
}

canonical_decompiled_code:
char *__fastcall func1(__int64 a1, size_t a2, int a3)
{
const char *v3; // rax
char *v4; // r8

++_gcov0_strerror_s;
v3 = func0(a3);
return strncpy(v4, v3, a2);
}

original_code:
void strerror_s ( char* str, size_t length, int err )
{
  strncpy ( str, strerror_p ( err ), length );
}

canonical_original_code:
void strerror_s(char *str, unsigned long length, int err)
{
  strncpy ( str, strerror_p ( err ), length );
}

variable_types:
str
char *


strerror

decompiled_code:
char *__fastcall strerror(int a1)
{
const char *v1; // rax
size_t v2; // rdx

++_gcov0_strerror;
v1 = strerror_p(a1);
return strncpy(strerror_tmp, v1, v2);
}

canonical_decompiled_code:
char *__fastcall func2(int a1)
{
const char *v1; // rax
size_t v2; // rdx

++_gcov0_strerror;
v1 = func0(a1);
return strncpy(strerror_tmp, v1, v2);
}

original_code:
char* strerror ( int err )
{
  return strncpy ( _strerror_tmp, strerror_p ( err ), 256 );
}

canonical_original_code:
char *strerror(int err)
{
  return strncpy ( _strerror_tmp, strerror_p ( err ), 256 );
}


decompiled_code:
__int64 __fastcall strerror_r(int a1, __int64 a2, unsigned __int64 a3)
{
char *v4; // rbp
size_t v5; // rdx
char *v6; // r8
__int64 result; // rax

if ( a2 )
{
if ( a3 )
{
++qword_828;
v4 = (char *)strerror_p(a1);
strncpy(v6, v4, v5);
if ( strlen(v4) > a3 )
{
++qword_830;
result = 0xFFFFFFFFLL;
}
else
{
result = 0LL;
}
}
else
{
++_gcov0_strerror_r;
result = 0xFFFFFFFFLL;
}
}
else
{
++_gcov0_strerror_r;
result = 0xFFFFFFFFLL;
}
return result;
}

canonical_decompiled_code:
__int64 __fastcall func4(int a1, __int64 a2, unsigned __int64 a3)
{
char *v4; // rbp
size_t v5; // rdx
char *v6; // r8
__int64 result; // rax

if ( a2 )
{
if ( a3 )
{
++qword_828;
v4 = (char *)func0(a1);
strncpy(v6, v4, v5);
if ( func3(v4) > a3 )
{
++qword_830;
result = 0xFFFFFFFFLL;
}
else
{
result = 0LL;
}
}
else
{
++_gcov0_strerror_r;
result = 0xFFFFFFFFLL;
}
}
else
{
++_gcov0_strerror_r;
result = 0xFFFFFFFFLL;
}
return result;
}

original_code:
int strerror_r (int err, char* buffer, size_t length)
{
  const char* str;
  if (buffer == 0 || length == 0)
    return -1;
  str = strerror_p ( err );
  strncpy ( buffer, str, length );
  return strlen(str) <= length ? 0 : -1;
}

canonical_original_code:
int strerror_r(int err, char *buffer, unsigned long length)
{
  char *str;
  if (buffer == 0 || length == 0)
    return -1;
  str = strerror_p ( err );
  strncpy ( buffer, str, length );
  return strlen(str) <= length ? 0 : -1;
}

variable_types:
buffer
char *


strnlen

decompiled_code:
__int64 strnlen()
{
++_gcov0_strnlen;
return 0LL;
}

canonical_decompiled_code:
__int64 func5()
{
++_gcov0_strnlen;
return 0LL;
}

original_code:
size_t strnlen ( const char* str, size_t length )
{
  register size_t count;
  for ( count = 0; count < length && *str; ++str );
  return count;
}

canonical_original_code:
unsigned long strnlen(char *str, unsigned long length)
{
  register unsigned long count;
  for ( count = 0; count < length && *str; ++str );
  return count;
}

variable_types:
count
unsigned long


memcmp

decompiled_code:
__int64 __fastcall memcmp(unsigned __int8 *a1, unsigned __int8 *a2, __int64 a3)
{
char v4; // r9
__int64 v5; // rdi
unsigned __int8 *v6; // rax
__int64 v7; // rdx
unsigned __int8 *v8; // r8
unsigned __int8 v9; // dl
int v10; // ecx
unsigned __int8 v12; // dl
int v13; // ecx

++_gcov0_memcmp;
v4 = 0;
v5 = qword_498;
v6 = a1;
v7 = a3 - 1;
if ( v7 )
{
v8 = &a1[v7];
while ( 1 )
{
v9 = *v6;
v10 = *a2;
if ( *v6 != (_BYTE)v10 )
break;
++v5;
v4 = 1;
if ( v6 + 1 == v8 )
{
v12 = v6[1];
v13 = a2[1];
qword_498 = v5;
return (unsigned int)v12 - v13;
}
++a2;
++v6;
}
if ( v4 )
qword_498 = v5;
++qword_4A0;
}
else
{
v9 = *a1;
v10 = *a2;
}
return (unsigned int)v9 - v10;
}

canonical_decompiled_code:
__int64 __fastcall func2(unsigned __int8 *a1, unsigned __int8 *a2, __int64 a3)
{
char v4; // r9
__int64 v5; // rdi
unsigned __int8 *v6; // rax
__int64 v7; // rdx
unsigned __int8 *v8; // r8
unsigned __int8 v9; // dl
int v10; // ecx
unsigned __int8 v12; // dl
int v13; // ecx

++_gcov0_memcmp;
v4 = 0;
v5 = qword_498;
v6 = a1;
v7 = a3 - 1;
if ( v7 )
{
v8 = &a1[v7];
while ( 1 )
{
v9 = *v6;
v10 = *a2;
if ( *v6 != (_BYTE)v10 )
break;
++v5;
v4 = 1;
if ( v6 + 1 == v8 )
{
v12 = v6[1];
v13 = a2[1];
qword_498 = v5;
return (unsigned int)v12 - v13;
}
++a2;
++v6;
}
if ( v4 )
qword_498 = v5;
++qword_4A0;
}
else
{
v9 = *a1;
v10 = *a2;
}
return (unsigned int)v9 - v10;
}

original_code:
int memcmp ( const void* dest, const void* src, size_t length )
{
  register const uint8_t* ptr1 = ( const uint8_t* ) dest;
  register const uint8_t* ptr2 = ( const uint8_t* ) src;
  while ( --length && *ptr1 == *ptr2 ) {
    ++ptr1;
    ++ptr2;
  }
  return *ptr1 - *ptr2;
}

canonical_original_code:
int memcmp(void *dest, void *src, unsigned long length)
{
  register unsigned char *ptr1 = ( const uint8_t* ) dest;
  register unsigned char *ptr2 = ( const uint8_t* ) src;
  while ( --length && *ptr1 == *ptr2 ) {
    ++ptr1;
    ++ptr2;
  }
  return *ptr1 - *ptr2;
}

variable_types:
dest
void *

variable_types:
src
void *


decompiled_code:
__int64 __fastcall fill_cache(__int64 a1)
{
ssize_t v1; // rax
__int64 result; // rax

v1 = read(*(_DWORD *)a1, *(void **)(a1 + 32), *(_QWORD *)(a1 + 56));
if ( *(_QWORD *)(a1 + 56) == v1 )
{
*(_DWORD *)(a1 + 4) |= 0x2000u;
result = 0xFFFFFFFFLL;
}
else if ( v1 )
{
*(_QWORD *)(a1 + 40) += v1;
result = 0LL;
}
else
{
*(_DWORD *)(a1 + 4) |= 0x1000u;
result = 0xFFFFFFFFLL;
}
return result;
}

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

v1 = read(*(_DWORD *)a1, *(void **)(a1 + 32), *(_QWORD *)(a1 + 56));
if ( *(_QWORD *)(a1 + 56) == v1 )
{
*(_DWORD *)(a1 + 4) |= 0x2000u;
result = 0xFFFFFFFFLL;
}
else if ( v1 )
{
*(_QWORD *)(a1 + 40) += v1;
result = 0LL;
}
else
{
*(_DWORD *)(a1 + 4) |= 0x1000u;
result = 0xFFFFFFFFLL;
}
return result;
}

original_code:
int fill_cache (FILE* fp)
{
  size_t bread = read( fp->fd_, fp->buf_, fp->bsize_);
  if (bread != fp->bsize_) {
      if (bread == 0) {
        fp->oflags_ |= 0x1000;
        return (-1);
      }
      fp->off_ += bread;
      return 0;
  } else {
      fp->oflags_ |= 0x2000;
      return (-1);
  }
}

canonical_original_code:
int fill_cache(struct axFile *fp)
{
  unsigned long bread = read( fp->fd_, fp->buf_, fp->bsize_);
  if (bread != fp->bsize_) {
      if (bread == 0) {
        fp->oflags_ |= 0x1000;
        return (-1);
      }
      fp->off_ += bread;
      return 0;
  } else {
      fp->oflags_ |= 0x2000;
      return (-1);
  }
}

variable_types: struct axFile { int fd_; int oflags_; struct axFile *next_; int lock_; int count_; char lbuf_; char *buf_; long off_; long lpos_; unsigned long bsize_; char *rpos_; char *rend_; char *wpos_; char *wend_; int (*write_)(struct axFile *fp, char *buf, unsigned long length); int (*read_)(struct axFile *fp, char *buf, unsigned long length); } *

variable_types:
bread
unsigned long


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

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

original_code:
int flush_cache (FILE* fp)
{
  return 0;
}

canonical_original_code:
int flush_cache(struct axFile *fp)
{
  return 0;
}


fflush

decompiled_code:
__int64 __fastcall fflush(FILE *stream)
{
unsigned int v1; // er12
__int64 i; // rbx
bool v3; // zf
__int64 result; // rax
unsigned int v5; // er12

if ( stream )
{
flockfile(stream);
v5 = flush_cache(stream);
funlockfile(stream);
result = v5;
}
else
{
v1 = 0;
for ( i = OFP_HEAD; i; i = *(_QWORD *)(i + 8) )
{
while ( 1 )
{
v3 = (*(_DWORD *)(i + 4) & 3) == 0;
*(_DWORD *)(i + 4) &= 3u;
if ( !v3 )
break;
i = *(_QWORD *)(i + 8);
if ( !i )
goto LABEL_7;
}
flockfile((FILE *)i);
v1 |= flush_cache(i);
funlockfile((FILE *)i);
}
LABEL_7:
result = v1;
}
return result;
}

canonical_decompiled_code:
__int64 __fastcall func2(FILE *stream)
{
unsigned int v1; // er12
__int64 i; // rbx
bool v3; // zf
__int64 result; // rax
unsigned int v5; // er12

if ( stream )
{
flockfile(stream);
v5 = func1(stream);
funlockfile(stream);
result = v5;
}
else
{
v1 = 0;
for ( i = OFP_HEAD; i; i = *(_QWORD *)(i + 8) )
{
while ( 1 )
{
v3 = (*(_DWORD *)(i + 4) & 3) == 0;
*(_DWORD *)(i + 4) &= 3u;
if ( !v3 )
break;
i = *(_QWORD *)(i + 8);
if ( !i )
goto LABEL_7;
}
flockfile((FILE *)i);
v1 |= func1(i);
funlockfile((FILE *)i);
}
LABEL_7:
result = v1;
}
return result;
}

original_code:
int fflush (FILE* fp)
{
  int res = 0;
  if (fp != 0) {
    flockfile (fp);
    res = flush_cache (fp);
    funlockfile (fp);
    return res;
  }
  fp = OFP_HEAD;
  while (fp != 0) {
    if (fp->oflags_ &= (1 | 2)) {
      flockfile (fp);
      res |= flush_cache (fp);
      funlockfile (fp);
    }
    fp = fp->next_;
  }
  return res;
}

canonical_original_code:
int fflush(struct axFile *fp)
{
  int res = 0;
  if (fp != 0) {
    flockfile (fp);
    res = flush_cache (fp);
    funlockfile (fp);
    return res;
  }
  fp = OFP_HEAD;
  while (fp != 0) {
    if (fp->oflags_ &= (1 | 2)) {
      flockfile (fp);
      res |= flush_cache (fp);
      funlockfile (fp);
    }
    fp = fp->next_;
  }
  return res;
}

variable_types: res int


setbuf

decompiled_code:
void setbuf()
{
;
}

canonical_decompiled_code:
void func3()
{
;
}

original_code:
void setbuf(FILE *stream, char *buf)
{
}

canonical_original_code:
void setbuf(struct axFile *stream, char *buf)
{
}

variable_types:
buf
char *


perror

decompiled_code:
int __fastcall perror(const char *a1)
{
int *v1; // rax
char *v2; // rax
int result; // eax
int *v4; // rax
char *v5; // rax

if ( a1 && *a1 != 10 )
{
v4 = (int *)geterrno();
v5 = strerror(*v4);
result = fprintf(stderr, "%s: %s\n", a1, v5);
}
else
{
v1 = (int *)geterrno();
v2 = strerror(*v1);
result = fprintf(stderr, "%s\n", v2);
}
return result;
}

canonical_decompiled_code:
int __fastcall func0(const char *a1)
{
int *v1; // rax
char *v2; // rax
int result; // eax
int *v4; // rax
char *v5; // rax

if ( a1 && *a1 != 10 )
{
v4 = (int *)geterrno();
v5 = strerror(*v4);
result = fprintf(stderr, "%s: %s\n", a1, v5);
}
else
{
v1 = (int *)geterrno();
v2 = strerror(*v1);
result = fprintf(stderr, "%s\n", v2);
}
return result;
}

original_code:
void perror (const char* str)
{
  if ( (str != 0) && (str[0] != '\n') ) {
    fprintf (stderr, "%s: %s\n", str, strerror((*_geterrno())) );
  } else {
    fprintf (stderr, "%s\n", strerror((*_geterrno())) );
  }
}

canonical_original_code:
void perror(char *str)
{
  if ( (str != 0) && (str[0] != '\n') ) {
    fprintf (stderr, "%s: %s\n", str, strerror((*_geterrno())) );
  } else {
    fprintf (stderr, "%s\n", strerror((*_geterrno())) );
  }
}


abs

decompiled_code:
__int64 __fastcall abs(int a1)
{
return abs32(a1);
}

canonical_decompiled_code:
__int64 __fastcall func0(int a1)
{
return abs32(a1);
}

original_code:
int abs (int value)
{
  return ( value >= 0 ) ? value : -value;
}

canonical_original_code:
int abs(int value)
{
  return ( value >= 0 ) ? value : -value;
}

variable_types: value int


llabs

decompiled_code:
unsigned __int64 __fastcall llabs(__int64 a1)
{
return abs64(a1);
}

canonical_decompiled_code:
unsigned __int64 __fastcall func2(__int64 a1)
{
return abs64(a1);
}

original_code:
long long llabs (long long value)
{
  return ( value >= 0 ) ? value : -value;
}

canonical_original_code:
long long llabs(long long value)
{
  return ( value >= 0 ) ? value : -value;
}

variable_types:
value
long long


div

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

v2 = (unsigned int)(a1 >> 31);
LODWORD(v2) = a1 % a2;
return (v2 << 32) | (unsigned int)(a1 / a2);
}

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

v2 = (unsigned int)(a1 >> 31);
LODWORD(v2) = a1 % a2;
return (v2 << 32) | (unsigned int)(a1 / a2);
}

original_code:
div_t div (int numer, int denom)
{
  div_t rc;
  rc.quot = numer / denom;
  rc.rem = numer % denom;
  return rc;
}

canonical_original_code:
struct div div(int numer, int denom)
{
  struct div rc;
  rc.quot = numer / denom;
  rc.rem = numer % denom;
  return rc;
}

variable_types: numer int

variable_types: denom int

variable_types:
rc
struct div { int quot; int rem; }

return_type: struct div { int quot; int rem; }


ldiv

decompiled_code:
__int64 __fastcall ldiv(__int64 a1, __int64 a2)
{
return a1 / a2;
}

canonical_decompiled_code:
__int64 __fastcall func4(__int64 a1, __int64 a2)
{
return a1 / a2;
}

original_code:
ldiv_t ldiv (long numer, long denom)
{
  ldiv_t rc;
  rc.quot = numer / denom;
  rc.rem = numer % denom;
  return rc;
}

canonical_original_code:
struct ldiv ldiv(long numer, long denom)
{
  struct ldiv rc;
  rc.quot = numer / denom;
  rc.rem = numer % denom;
  return rc;
}

variable_types: numer long

variable_types: denom long

variable_types:
rc
struct ldiv { long quot; long rem; }

return_type: struct ldiv { long quot; long rem; }


lldiv

decompiled_code:
__int64 __fastcall lldiv(__int64 a1, __int64 a2)
{
return a1 / a2;
}

canonical_decompiled_code:
__int64 __fastcall func5(__int64 a1, __int64 a2)
{
return a1 / a2;
}

original_code:
lldiv_t lldiv (long long numer, long long denom)
{
  lldiv_t rc;
  rc.quot = numer / denom;
  rc.rem = numer % denom;
  return rc;
}

canonical_original_code:
struct lldiv lldiv(long long numer, long long denom)
{
  struct lldiv rc;
  rc.quot = numer / denom;
  rc.rem = numer % denom;
  return rc;
}

variable_types:
numer
long long

variable_types:
denom
long long

variable_types: struct lldiv { long long quot; long long rem; }


decompiled_code:
char *__fastcall asctime_r(unsigned int *a1, char *a2)
{
snprintf(
a2,
0x1AuLL,
"%.3s %.3s %3d %.2d:%.2d:%.2d %d\n",
shWeekDayStrings[a1[6]],
shMonthStrings[a1[4] - 1],
a1[3],
a1[2],
a1[1],
*a1,
a1[5] + 1900);
return a2;
}

canonical_decompiled_code:
char *__fastcall func0(unsigned int *a1, char *a2)
{
snprintf(
a2,
0x1AuLL,
"%.3s %.3s %3d %.2d:%.2d:%.2d %d\n",
shWeekDayStrings[a1[6]],
shMonthStrings[a1[4] - 1],
a1[3],
a1[2],
a1[1],
*a1,
a1[5] + 1900);
return a2;
}

original_code:
char* asctime_r(const struct tm* date, char* str)
{
  snprintf(str, 26, "%.3s %.3s %3d %.2d:%.2d:%.2d %d\n",
    shWeekDayStrings[date->tm_wday], shMonthStrings[date->tm_mon - 1],
    date->tm_mday, date->tm_hour,
    date->tm_min, date->tm_sec,
    1900 + date->tm_year);
  return str;
}

canonical_original_code:
char *asctime_r(struct tm *date, char *str)
{
  snprintf(str, 26, "%.3s %.3s %3d %.2d:%.2d:%.2d %d\n",
    shWeekDayStrings[date->tm_wday], shMonthStrings[date->tm_mon - 1],
    date->tm_mday, date->tm_hour,
    date->tm_min, date->tm_sec,
    1900 + date->tm_year);
  return str;
}

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

variable_types:
str
char *


asctime

decompiled_code:
char *__fastcall asctime(unsigned int *a1)
{
char v2[40]; // [rsp+0h] [rbp-28h] BYREF

return asctime_r(a1, v2);
}

canonical_decompiled_code:
char *__fastcall func1(unsigned int *a1)
{
char v2[40]; // [rsp+0h] [rbp-28h] BYREF

return func0(a1, v2);
}

original_code:
char* asctime(const struct tm* date)
{
  char tmp[28];
  return asctime_r(date, tmp);
}

canonical_original_code:
char *asctime(struct tm *date)
{
  char tmp[28];
  return asctime_r(date, tmp);
}

variable_types:
tmp
char [28]

user_defined_types: struct tm { int tm_sec; int tm_min; int tm_hour; int tm_mday; int tm_mon; int tm_year; int tm_wday; int tm_yday; int tm_isdst; }


decompiled_code:
__int64 __fastcall alloc_add_to_free(__int64 a1, __int64 a2)
{
__int64 result; // rax
unsigned int v3; // ecx
__int64 v4; // rdx
char v5; // r8
__int64 v6; // rdi

result = *(_QWORD *)(a1 + 8);
*(_DWORD *)(a2 + 12) = 0;
if ( result )
{
v3 = *(_DWORD *)(a2 + 8);
v4 = qword_AF8;
v5 = 0;
if ( *(_DWORD *)(result + 8) <= v3 )
{
while ( 1 )
{
v6 = result;
result = *(_QWORD *)(result + 24);
if ( !result )
break;
++v4;
v5 = 1;
if ( v3 < *(_DWORD *)(result + 8) )
{
*(_QWORD *)(result + 16) = a2;
++qword_AF0;
*(_QWORD *)(a2 + 16) = v6;
*(_QWORD *)(a2 + 24) = result;
++qword_B00;
qword_AF8 = v4;
*(_QWORD *)(v6 + 24) = a2;
return result;
}
}
if ( v5 )
qword_AF8 = v4;
*(_QWORD *)(a2 + 16) = v6;
*(_QWORD *)(a2 + 24) = 0LL;
++qword_B08;
*(_QWORD *)(v6 + 24) = a2;
}
else
{
*(_QWORD *)(a1 + 8) = a2;
++qword_AE8;
*(_QWORD *)(a2 + 16) = 0LL;
*(_QWORD *)(a2 + 24) = result;
*(_QWORD *)(result + 16) = a2;
}
}
else
{
*(_QWORD *)(a1 + 8) = a2;
++_gcov0_alloc_add_to_free;
*(_QWORD *)(a2 + 16) = 0LL;
*(_QWORD *)(a2 + 24) = 0LL;
}
return result;
}

original_code:
static void alloc_add_to_free (xHeapArea_t* heap, xHeapChunk_t* chunk)
{
    xHeapChunk_t* curs = heap->free_list;
    chunk->is_used = 0;
    if ( !curs ) {
        heap->free_list = chunk;
        chunk->prev_chunk = 0;
        chunk->next_chunk = 0;
        return;
    }
    if ( curs->chunk_size > chunk->chunk_size ) {
        heap->free_list = chunk;
        chunk->prev_chunk = 0;
        chunk->next_chunk = curs;
        curs->prev_chunk = chunk;
        return;
    }
    while ( curs->next_chunk ) {
        if ( curs->next_chunk->chunk_size > chunk->chunk_size ) {
            break;
        }
        curs = curs->next_chunk;
    }
    if ( curs->next_chunk ) {
        curs->next_chunk->prev_chunk = chunk;
    }
    chunk->prev_chunk = curs;
    chunk->next_chunk = curs->next_chunk;
    curs->next_chunk = chunk;
}

canonical_original_code:
static void alloc_add_to_free(struct xHeapArea *heap, struct xHeapChunk *chunk)
{
    struct xHeapChunk *curs = heap->free_list;
    chunk->is_used = 0;
    if ( !curs ) {
        heap->free_list = chunk;
        chunk->prev_chunk = 0;
        chunk->next_chunk = 0;
        return;
    }
    if ( curs->chunk_size > chunk->chunk_size ) {
        heap->free_list = chunk;
        chunk->prev_chunk = 0;
        chunk->next_chunk = curs;
        curs->prev_chunk = chunk;
        return;
    }
    while ( curs->next_chunk ) {
        if ( curs->next_chunk->chunk_size > chunk->chunk_size ) {
            break;
        }
        curs = curs->next_chunk;
    }
    if ( curs->next_chunk ) {
        curs->next_chunk->prev_chunk = chunk;
    }
    chunk->prev_chunk = curs;
    chunk->next_chunk = curs->next_chunk;
    curs->next_chunk = chunk;
}

variable_types: struct xHeapArea { struct xHeapChunk { unsigned int prev_size; unsigned int reserved; unsigned int chunk_size; unsigned int is_used; union { struct { struct xHeapChunk *prev_chunk; struct xHeapChunk *next_chunk; }; unsigned int data[4]; }; } *start; struct xHeapChunk *free_list; unsigned long max; unsigned long available; char lock; long flags; } *

variable_types:
chunk
struct xHeapChunk *

user_defined_types: struct xHeapArea { struct xHeapChunk *start; struct xHeapChunk *free_list; unsigned long max; unsigned long available; char lock; long flags; }


original_code:
static void alloc_rem_of_free (xHeapArea_t* heap, xHeapChunk_t* chunk)
{
    if ( chunk->next_chunk ) {
        chunk->next_chunk->prev_chunk = chunk->prev_chunk;
    }
    if ( chunk->prev_chunk ) {
        chunk->prev_chunk->next_chunk = chunk->next_chunk;
    } else {
        heap->free_list = chunk->next_chunk;
    }
    chunk->prev_chunk = (xHeapChunk_t*)0xcccccccc;
    chunk->next_chunk = (xHeapChunk_t*)0xcccccccc;
    chunk->is_used |= 0x01;
}

canonical_original_code:
static void alloc_rem_of_free(struct xHeapArea *heap, struct xHeapChunk *chunk)
{
    if ( chunk->next_chunk ) {
        chunk->next_chunk->prev_chunk = chunk->prev_chunk;
    }
    if ( chunk->prev_chunk ) {
        chunk->prev_chunk->next_chunk = chunk->next_chunk;
    } else {
        heap->free_list = chunk->next_chunk;
    }
    chunk->prev_chunk = (struct xHeapChunk *)0xcccccccc;
    chunk->next_chunk = (struct xHeapChunk *)0xcccccccc;
    chunk->is_used |= 0x01;
}

user_defined_types: struct xHeapChunk { unsigned int prev_size; unsigned int reserved; unsigned int chunk_size; unsigned int is_used; union { struct { struct xHeapChunk *prev_chunk; struct xHeapChunk *next_chunk; }; unsigned int data[4]; }; }


decompiled_code:
__int64 __fastcall meminit_r(__int64 a1, __int64 a2, __int64 a3)
{
__int64 v3; // rax
_DWORD *v4; // r8
unsigned __int64 v5; // rdx
__int64 result; // rax

v3 = *(_QWORD *)(a1 + 40);
*(_QWORD *)(a1 + 8) = 0LL;
v4 = (_DWORD *)((a2 + 31) & 0xFFFFFFFFFFFFFFE0LL);
++_gcov0_meminit_r;
*(_QWORD *)a1 = v4;
v5 = (a2 + a3 - (_QWORD)v4) & 0xFFFFFFFFFFFFFFE0LL;
*(_QWORD *)(a1 + 24) = v5;
*(_QWORD *)(a1 + 16) = (char *)v4 + v5;
*v4 = 0;
v4[2] = v5;
*(_QWORD *)(a1 + 40) = v3 | 5;
*(_BYTE *)(a1 + 32) = 0;
result = alloc_add_to_free(a1, (__int64)v4);
++qword_B38;
return result;
}

original_code:
void meminit_r(xHeapArea_t* heap, void* base, size_t length)
{
    heap->flags |= 0x04;
    heap->start = ( xHeapChunk_t* ) ((((uintptr_t)base)+(sizeof(xHeapChunk_t)-1))&(~(sizeof(xHeapChunk_t)-1)));
    heap->free_list = 0;
    heap->available = (size_t)heap->start - (size_t)base;
    heap->available = length - heap->available;
    heap->available = heap->available & ~(sizeof(xHeapChunk_t) - 1);
    heap->max = (size_t)heap->start + heap->available;
    heap->start->prev_size = 0;
    heap->start->chunk_size = heap->available;
    heap->flags |= 0x01;
    heap->lock = 0;
    alloc_add_to_free (heap, heap->start);
}

canonical_original_code:
void meminit_r(struct xHeapArea *heap, void *base, unsigned long length)
{
    heap->flags |= 0x04;
    heap->start = ( struct xHeapChunk * ) ((((unsigned long long)base)+(sizeof(xHeapChunk_t)-1))&(~(sizeof(xHeapChunk_t)-1)));
    heap->free_list = 0;
    heap->available = (unsigned long)heap->start - (unsigned long)base;
    heap->available = length - heap->available;
    heap->available = heap->available & ~(sizeof(xHeapChunk_t) - 1);
    heap->max = (unsigned long)heap->start + heap->available;
    heap->start->prev_size = 0;
    heap->start->chunk_size = heap->available;
    heap->flags |= 0x01;
    heap->lock = 0;
    alloc_add_to_free (heap, heap->start);
}

variable_types:
base
void *

variable_types:
length
unsigned long


original_code:
void* malloc_r(xHeapArea_t* heap, size_t size)
{
    xHeapChunk_t* chunk = heap->free_list;
    xHeapChunk_t* split = 0;
    xHeapChunk_t* prev = 0;
    xHeapChunk_t* next = 0;
    size_t lsize = 0;
    ((void)(0));
    if (heap->flags & 0x04) {
        if (memcorrupt_r(heap)) {
            ((void)(0));
        }
    }
    if (size > 0x30000000 - sizeof(xHeapChunk_t)) {
        ((void)(0));
        return 0;
    }
    size = (((size + (sizeof (uint32_t)*4))+(sizeof(xHeapChunk_t)-1))&(~(sizeof(xHeapChunk_t)-1)));
    if (size < sizeof(xHeapChunk_t)) size = sizeof(xHeapChunk_t);
    while ( chunk ) {
        if (heap->flags & 0x01) {
            if (chunk->is_used)
                heap->flags |= 0x02;
            if (chunk->prev_chunk != prev)
                heap->flags |= 0x02;
            if (chunk->chunk_size < lsize)
                heap->flags |= 0x02;
            if (heap->flags & 0x02) {
                ((void)(0));
                return 0;
            }
            lsize = chunk->chunk_size;
            prev = chunk;
        }
        if ( chunk->chunk_size >= size) {
            alloc_rem_of_free ( heap, chunk );
            if (chunk->chunk_size >= size + sizeof(xHeapChunk_t) ) {
                split = ( xHeapChunk_t* ) ((( size_t ) chunk ) + size);
                split->chunk_size = chunk->chunk_size - size;
                split->prev_size = size;
                next = (xHeapChunk_t*)((size_t)split + (size_t)split->chunk_size);
                if ((size_t)next < heap->max)
                    next->prev_size = split->chunk_size;
                else if ((heap->flags & 0x01) && (size_t)next != heap->max) {
                    heap->flags |= 0x02;
                    ((void)(0));
                    return 0;
                }
                alloc_add_to_free ( heap, split );
                chunk->chunk_size = size;
                chunk->is_used |= 0x01;
            }
            heap->available -= size;
            ((void)(0));
            if (heap->flags & 0x04) {
                if (memcorrupt_r(heap)) {
                    ((void)(0));
                }
            }
            return (chunk->data);
        }
        chunk = chunk->next_chunk;
    }
    ((void)(0));
    (*_geterrno()) = 12;
    if (heap->flags & 0x04) {
        if (memcorrupt_r(heap)) {
            ((void)(0));
        }
    }
    return 0;
}

canonical_original_code:
void *malloc_r(struct xHeapArea *heap, unsigned long size)
{
    struct xHeapChunk *chunk = heap->free_list;
    struct xHeapChunk *split = 0;
    struct xHeapChunk *prev = 0;
    struct xHeapChunk *next = 0;
    unsigned long lsize = 0;
    ((void)(0));
    if (heap->flags & 0x04) {
        if (memcorrupt_r(heap)) {
            ((void)(0));
        }
    }
    if (size > 0x30000000 - sizeof(xHeapChunk_t)) {
        ((void)(0));
        return 0;
    }
    size = (((size + (sizeof (unsigned int)*4))+(sizeof(xHeapChunk_t)-1))&(~(sizeof(xHeapChunk_t)-1)));
    if (size < sizeof(xHeapChunk_t)) size = sizeof(xHeapChunk_t);
    while ( chunk ) {
        if (heap->flags & 0x01) {
            if (chunk->is_used)
                heap->flags |= 0x02;
            if (chunk->prev_chunk != prev)
                heap->flags |= 0x02;
            if (chunk->chunk_size < lsize)
                heap->flags |= 0x02;
            if (heap->flags & 0x02) {
                ((void)(0));
                return 0;
            }
            lsize = chunk->chunk_size;
            prev = chunk;
        }
        if ( chunk->chunk_size >= size) {
            alloc_rem_of_free ( heap, chunk );
            if (chunk->chunk_size >= size + sizeof(xHeapChunk_t) ) {
                split = ( struct xHeapChunk * ) ((( unsigned long ) chunk ) + size);
                split->chunk_size = chunk->chunk_size - size;
                split->prev_size = size;
                next = (struct xHeapChunk *)((unsigned long)split + (unsigned long)split->chunk_size);
                if ((unsigned long)next < heap->max)
                    next->prev_size = split->chunk_size;
                else if ((heap->flags & 0x01) && (unsigned long)next != heap->max) {
                    heap->flags |= 0x02;
                    ((void)(0));
                    return 0;
                }
                alloc_add_to_free ( heap, split );
                chunk->chunk_size = size;
                chunk->is_used |= 0x01;
            }
            heap->available -= size;
            ((void)(0));
            if (heap->flags & 0x04) {
                if (memcorrupt_r(heap)) {
                    ((void)(0));
                }
            }
            return (chunk->data);
        }
        chunk = chunk->next_chunk;
    }
    ((void)(0));
    (*_geterrno()) = 12;
    if (heap->flags & 0x04) {
        if (memcorrupt_r(heap)) {
            ((void)(0));
        }
    }
    return 0;
}

variable_types:
size
unsigned long

variable_types: struct xHeapChunk { unsigned int prev_size; unsigned int reserved; unsigned int chunk_size; unsigned int is_used; union { struct { struct xHeapChunk *prev_chunk; struct xHeapChunk *next_chunk; }; unsigned int data[4]; }; } *

variable_types:
lsize
unsigned long

return_type: void *