decompiled_code:
__int64 test001_rtpv6()
{
unsigned int v0; // er12
unsigned int v2; // [rsp+4h] [rbp-14h] BYREF
__int64 v3; // [rsp+8h] [rbp-10h] BYREF

if ( MIDIErrorNumber | (unsigned int)rtp_addressv6((__m128i *)&server_address, 5104) )
{
if ( MIDILogger )
{
v0 = 1;
MIDILogger(
32LL,
"%s/%s:%i: error: assertion failed: %s\n"
" _rtp_addressv6( &server_address, RTP_SERVER_PORT ) returned an error!\n",
"test",
"driver_rtpv6.c",
54LL,
"Could not fill out server address.");
return v0;
}
}
else
{
v0 = MIDIErrorNumber | rtp_socketv6((int *)&v2, &server_address);
if ( v0 )
{
if ( MIDILogger )
MIDILogger(
32LL,
"%s/%s:%i: error: assertion failed: %s\n _rtp_socketv6( &s, &server_address ) returned an error!\n",
"test",
"driver_rtpv6.c",
56LL,
"Could not create server socket.");
}
else
{
session = RTPSessionCreate(v2);
if ( session )
{
RTPSessionGetSSRC(session, &v3);
printf("SSRC: 0x%lx\n", v3);
return v0;
}
if ( MIDILogger )
{
v0 = 1;
MIDILogger(
32LL,
"%s/%s:%i: error: assertion failed: %s\n _session may not be equal to NULL!\n",
"test",
"driver_rtpv6.c",
60LL,
"Could not create RTP session.");
return v0;
}
}
}
return 1LL;
}

canonical_decompiled_code:
__int64 func2()
{
unsigned int v0; // er12
unsigned int v2; // [rsp+4h] [rbp-14h] BYREF
__int64 v3; // [rsp+8h] [rbp-10h] BYREF

if ( MIDIErrorNumber | (unsigned int)func0((__m128i *)&server_address, 5104) )
{
if ( MIDILogger )
{
v0 = 1;
MIDILogger(
32LL,
"%s/%s:%i: error: assertion failed: %s\n"
" _rtp_addressv6( &server_address, RTP_SERVER_PORT ) returned an error!\n",
"test",
"driver_rtpv6.c",
54LL,
"Could not fill out server address.");
return v0;
}
}
else
{
v0 = MIDIErrorNumber | func1((int *)&v2, &server_address);
if ( v0 )
{
if ( MIDILogger )
MIDILogger(
32LL,
"%s/%s:%i: error: assertion failed: %s\n _rtp_socketv6( &s, &server_address ) returned an error!\n",
"test",
"driver_rtpv6.c",
56LL,
"Could not create server socket.");
}
else
{
session = RTPSessionCreate(v2);
if ( session )
{
RTPSessionGetSSRC(session, &v3);
printf("SSRC: 0x%lx\n", v3);
return v0;
}
if ( MIDILogger )
{
v0 = 1;
MIDILogger(
32LL,
"%s/%s:%i: error: assertion failed: %s\n _session may not be equal to NULL!\n",
"test",
"driver_rtpv6.c",
60LL,
"Could not create RTP session.");
return v0;
}
}
}
return 1LL;
}

original_code:
int test001_rtpv6( void ) {
  int s;
  unsigned long ssrc;
  if( ! ((_rtp_addressv6( &server_address, 5104 )) == 0 && MIDIErrorNumber == 0) ) { do { if( MIDILogger != ((void *)0) ) { (*MIDILogger)( 0x20, "%s/%s:%i: " "error: assertion failed: %s\n  " "_rtp_addressv6( &server_address, RTP_SERVER_PORT )" " returned an error!" "\n", "test", "driver_rtpv6.c", 54, "Could not fill out server address." ); } } while( 0 );; return 1; };
  if( ! ((_rtp_socketv6( &s, &server_address )) == 0 && MIDIErrorNumber == 0) ) { do { if( MIDILogger != ((void *)0) ) { (*MIDILogger)( 0x20, "%s/%s:%i: " "error: assertion failed: %s\n  " "_rtp_socketv6( &s, &server_address )" " returned an error!" "\n", "test", "driver_rtpv6.c", 56, "Could not create server socket." ); } } while( 0 );; return 1; };
  _session = RTPSessionCreate( s );
  if( ! ((_session) != (((void *)0))) ) { do { if( MIDILogger != ((void *)0) ) { (*MIDILogger)( 0x20, "%s/%s:%i: " "error: assertion failed: %s\n  " "_session" " may not be equal to " "NULL" "!" "\n", "test", "driver_rtpv6.c", 60, "Could not create RTP session." ); } } while( 0 );; return 1; };
  RTPSessionGetSSRC( _session, &ssrc );
  printf( "SSRC: 0x%lx\n", ssrc );
  return 0;
}

canonical_original_code:
int test001_rtpv6() {
  int s;
  unsigned long ssrc;
  if( ! ((_rtp_addressv6( &server_address, 5104 )) == 0 && MIDIErrorNumber == 0) ) { do { if( MIDILogger != ((void *)0) ) { (*MIDILogger)( 0x20, "%s/%s:%i: " "error: assertion failed: %s\n  " "_rtp_addressv6( &server_address, RTP_SERVER_PORT )" " returned an error!" "\n", "test", "driver_rtpv6.c", 54, "Could not fill out server address." ); } } while( 0 );; return 1; };
  if( ! ((_rtp_socketv6( &s, &server_address )) == 0 && MIDIErrorNumber == 0) ) { do { if( MIDILogger != ((void *)0) ) { (*MIDILogger)( 0x20, "%s/%s:%i: " "error: assertion failed: %s\n  " "_rtp_socketv6( &s, &server_address )" " returned an error!" "\n", "test", "driver_rtpv6.c", 56, "Could not create server socket." ); } } while( 0 );; return 1; };
  _session = RTPSessionCreate( s );
  if( ! ((_session) != (((void *)0))) ) { do { if( MIDILogger != ((void *)0) ) { (*MIDILogger)( 0x20, "%s/%s:%i: " "error: assertion failed: %s\n  " "_session" " may not be equal to " "NULL" "!" "\n", "test", "driver_rtpv6.c", 60, "Could not create RTP session." ); } } while( 0 );; return 1; };
  RTPSessionGetSSRC( _session, &ssrc );
  printf( "SSRC: 0x%lx\n", ssrc );
  return 0;
}

variable_types: s int

variable_types:
ssrc
unsigned long


repo: jpommerening/midikit

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

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

original_code:
int test005_rtpv6( void ) {
  return 0;
}

canonical_original_code:
int test005_rtpv6() {
  return 0;
}

return_type: int


decompiled_code:
__int64 test006_rtpv6()
{
if ( session )
RTPSessionRelease();
return 0LL;
}

canonical_decompiled_code:
__int64 func7()
{
if ( session )
RTPSessionRelease();
return 0LL;
}

original_code:
int test006_rtpv6( void ) {
  if( _session != ((void *)0) ) {
    RTPSessionRelease( _session );
  }
  return 0;
}

canonical_original_code:
int test006_rtpv6() {
  if( _session != ((void *)0) ) {
    RTPSessionRelease( _session );
  }
  return 0;
}


decompiled_code:
__int64 test001_rtp()
{
unsigned int v0; // er12
unsigned int v2; // [rsp+4h] [rbp-14h] BYREF
__int64 v3; // [rsp+8h] [rbp-10h] BYREF

if ( MIDIErrorNumber | (unsigned int)rtp_address((__int64)&server_address, 5104) )
{
if ( MIDILogger )
{
v0 = 1;
MIDILogger(
32LL,
"%s/%s:%i: error: assertion failed: %s\n _rtp_address( &server_address, RTP_SERVER_PORT ) returned an error!\n",
"test",
"driver_rtp.c",
43LL,
"Could not fill out server address.");
return v0;
}
}
else
{
v0 = MIDIErrorNumber | rtp_socket((int *)&v2, &server_address);
if ( v0 )
{
if ( MIDILogger )
MIDILogger(
32LL,
"%s/%s:%i: error: assertion failed: %s\n _rtp_socket( &s, &server_address ) returned an error!\n",
"test",
"driver_rtp.c",
45LL,
"Could not create server socket.");
}
else
{
session = RTPSessionCreate(v2);
if ( session )
{
RTPSessionGetSSRC(session, &v3);
printf("SSRC: 0x%lx\n", v3);
return v0;
}
if ( MIDILogger )
{
v0 = 1;
MIDILogger(
32LL,
"%s/%s:%i: error: assertion failed: %s\n _session may not be equal to NULL!\n",
"test",
"driver_rtp.c",
49LL,
"Could not create RTP session.");
return v0;
}
}
}
return 1LL;
}

canonical_decompiled_code:
__int64 func2()
{
unsigned int v0; // er12
unsigned int v2; // [rsp+4h] [rbp-14h] BYREF
__int64 v3; // [rsp+8h] [rbp-10h] BYREF

if ( MIDIErrorNumber | (unsigned int)func0((__int64)&server_address, 5104) )
{
if ( MIDILogger )
{
v0 = 1;
MIDILogger(
32LL,
"%s/%s:%i: error: assertion failed: %s\n _rtp_address( &server_address, RTP_SERVER_PORT ) returned an error!\n",
"test",
"driver_rtp.c",
43LL,
"Could not fill out server address.");
return v0;
}
}
else
{
v0 = MIDIErrorNumber | func1((int *)&v2, &server_address);
if ( v0 )
{
if ( MIDILogger )
MIDILogger(
32LL,
"%s/%s:%i: error: assertion failed: %s\n _rtp_socket( &s, &server_address ) returned an error!\n",
"test",
"driver_rtp.c",
45LL,
"Could not create server socket.");
}
else
{
session = RTPSessionCreate(v2);
if ( session )
{
RTPSessionGetSSRC(session, &v3);
printf("SSRC: 0x%lx\n", v3);
return v0;
}
if ( MIDILogger )
{
v0 = 1;
MIDILogger(
32LL,
"%s/%s:%i: error: assertion failed: %s\n _session may not be equal to NULL!\n",
"test",
"driver_rtp.c",
49LL,
"Could not create RTP session.");
return v0;
}
}
}
return 1LL;
}

original_code:
int test001_rtp( void ) {
  int s;
  unsigned long ssrc;
  if( ! ((_rtp_address( &server_address, 5104 )) == 0 && MIDIErrorNumber == 0) ) { do { if( MIDILogger != ((void *)0) ) { (*MIDILogger)( 0x20, "%s/%s:%i: " "error: assertion failed: %s\n  " "_rtp_address( &server_address, RTP_SERVER_PORT )" " returned an error!" "\n", "test", "driver_rtp.c", 43, "Could not fill out server address." ); } } while( 0 );; return 1; };
  if( ! ((_rtp_socket( &s, &server_address )) == 0 && MIDIErrorNumber == 0) ) { do { if( MIDILogger != ((void *)0) ) { (*MIDILogger)( 0x20, "%s/%s:%i: " "error: assertion failed: %s\n  " "_rtp_socket( &s, &server_address )" " returned an error!" "\n", "test", "driver_rtp.c", 45, "Could not create server socket." ); } } while( 0 );; return 1; };
  _session = RTPSessionCreate( s );
  if( ! ((_session) != (((void *)0))) ) { do { if( MIDILogger != ((void *)0) ) { (*MIDILogger)( 0x20, "%s/%s:%i: " "error: assertion failed: %s\n  " "_session" " may not be equal to " "NULL" "!" "\n", "test", "driver_rtp.c", 49, "Could not create RTP session." ); } } while( 0 );; return 1; };
  RTPSessionGetSSRC( _session, &ssrc );
  printf( "SSRC: 0x%lx\n", ssrc );
  return 0;
}

canonical_original_code:
int test001_rtp() {
  int s;
  unsigned long ssrc;
  if( ! ((_rtp_address( &server_address, 5104 )) == 0 && MIDIErrorNumber == 0) ) { do { if( MIDILogger != ((void *)0) ) { (*MIDILogger)( 0x20, "%s/%s:%i: " "error: assertion failed: %s\n  " "_rtp_address( &server_address, RTP_SERVER_PORT )" " returned an error!" "\n", "test", "driver_rtp.c", 43, "Could not fill out server address." ); } } while( 0 );; return 1; };
  if( ! ((_rtp_socket( &s, &server_address )) == 0 && MIDIErrorNumber == 0) ) { do { if( MIDILogger != ((void *)0) ) { (*MIDILogger)( 0x20, "%s/%s:%i: " "error: assertion failed: %s\n  " "_rtp_socket( &s, &server_address )" " returned an error!" "\n", "test", "driver_rtp.c", 45, "Could not create server socket." ); } } while( 0 );; return 1; };
  _session = RTPSessionCreate( s );
  if( ! ((_session) != (((void *)0))) ) { do { if( MIDILogger != ((void *)0) ) { (*MIDILogger)( 0x20, "%s/%s:%i: " "error: assertion failed: %s\n  " "_session" " may not be equal to " "NULL" "!" "\n", "test", "driver_rtp.c", 49, "Could not create RTP session." ); } } while( 0 );; return 1; };
  RTPSessionGetSSRC( _session, &ssrc );
  printf( "SSRC: 0x%lx\n", ssrc );
  return 0;
}


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

original_code:
int test005_rtp( void ) {
  return 0;
}

canonical_original_code:
int test005_rtp() {
  return 0;
}


decompiled_code:
__int64 test006_rtp()
{
if ( session )
RTPSessionRelease();
return 0LL;
}

original_code:
int test006_rtp( void ) {
  if( _session != ((void *)0) ) {
    RTPSessionRelease( _session );
  }
  return 0;
}

canonical_original_code:
int test006_rtp() {
  if( _session != ((void *)0) ) {
    RTPSessionRelease( _session );
  }
  return 0;
}


decompiled_code:
// attributes: thunk
__int64 test002_midi()
{
return test001_midi_localalias();
}

canonical_decompiled_code:
__int64 func1()
{
return func0();
}

original_code:
int test002_midi( void ) {
  if( ! (((((0x01 & 0x7f)<<7) | (0x01 & 0x7f))) == ((1<<7)+1)) ) { do { if( MIDILogger != ((void *)0) ) { (*MIDILogger)( 0x20, "%s/%s:%i: " "error: assertion failed: %s\n  " "MIDI_LONG_VALUE( 0x01, 0x01 )" " has to be equal to " "(1<<7)+1" "!" "\n", "test", "midi.c", 21, "MIDI_LONG_VALUE macro computes incorrect value." ); } } while( 0 );; return 1; };
  if( ! (((((0x40 & 0x7f)<<7) | (0x00 & 0x7f))) == (1<<13)) ) { do { if( MIDILogger != ((void *)0) ) { (*MIDILogger)( 0x20, "%s/%s:%i: " "error: assertion failed: %s\n  " "MIDI_LONG_VALUE( 0x40, 0x00 )" " has to be equal to " "1<<13" "!" "\n", "test", "midi.c", 22, "MIDI_LONG_VALUE macro computes incorrect value." ); } } while( 0 );; return 1; };
  if( ! (((((0x7f & 0x7f)<<7) | (0x7f & 0x7f))) == ((1<<14)-1)) ) { do { if( MIDILogger != ((void *)0) ) { (*MIDILogger)( 0x20, "%s/%s:%i: " "error: assertion failed: %s\n  " "MIDI_LONG_VALUE( 0x7f, 0x7f )" " has to be equal to " "(1<<14)-1" "!" "\n", "test", "midi.c", 23, "MIDI_LONG_VALUE macro computes incorrect value." ); } } while( 0 );; return 1; };
  return 0;
}

canonical_original_code:
int test002_midi() {
  if( ! (((((0x01 & 0x7f)<<7) | (0x01 & 0x7f))) == ((1<<7)+1)) ) { do { if( MIDILogger != ((void *)0) ) { (*MIDILogger)( 0x20, "%s/%s:%i: " "error: assertion failed: %s\n  " "MIDI_LONG_VALUE( 0x01, 0x01 )" " has to be equal to " "(1<<7)+1" "!" "\n", "test", "midi.c", 21, "MIDI_LONG_VALUE macro computes incorrect value." ); } } while( 0 );; return 1; };
  if( ! (((((0x40 & 0x7f)<<7) | (0x00 & 0x7f))) == (1<<13)) ) { do { if( MIDILogger != ((void *)0) ) { (*MIDILogger)( 0x20, "%s/%s:%i: " "error: assertion failed: %s\n  " "MIDI_LONG_VALUE( 0x40, 0x00 )" " has to be equal to " "1<<13" "!" "\n", "test", "midi.c", 22, "MIDI_LONG_VALUE macro computes incorrect value." ); } } while( 0 );; return 1; };
  if( ! (((((0x7f & 0x7f)<<7) | (0x7f & 0x7f))) == ((1<<14)-1)) ) { do { if( MIDILogger != ((void *)0) ) { (*MIDILogger)( 0x20, "%s/%s:%i: " "error: assertion failed: %s\n  " "MIDI_LONG_VALUE( 0x7f, 0x7f )" " has to be equal to " "(1<<14)-1" "!" "\n", "test", "midi.c", 23, "MIDI_LONG_VALUE macro computes incorrect value." ); } } while( 0 );; return 1; };
  return 0;
}


decompiled_code:
// attributes: thunk
__int64 test003_midi()
{
return test001_midi_localalias();
}

canonical_decompiled_code:
__int64 func2()
{
return func0();
}

original_code:
int test003_midi( void ) {
  MIDILongValue v = 12345;
  if( ! (((((((v)>>7) & 0x7f & 0x7f)<<7) | ((v) & 0x7f & 0x7f))) == (v)) ) { do { if( MIDILogger != ((void *)0) ) { (*MIDILogger)( 0x20, "%s/%s:%i: " "error: assertion failed: %s\n  " "MIDI_LONG_VALUE( MIDI_MSB( v ), MIDI_LSB( v ) )" " has to be equal to " "v" "!" "\n", "test", "midi.c", 32, "MIDI_LONG_VALUE and MIDI_MSB / MIDI_LSB are not orthogonal." ); } } while( 0 );; return 1; };
  return 0;
}

canonical_original_code:
int test003_midi() {
  short v = 12345;
  if( ! (((((((v)>>7) & 0x7f & 0x7f)<<7) | ((v) & 0x7f & 0x7f))) == (v)) ) { do { if( MIDILogger != ((void *)0) ) { (*MIDILogger)( 0x20, "%s/%s:%i: " "error: assertion failed: %s\n  " "MIDI_LONG_VALUE( MIDI_MSB( v ), MIDI_LSB( v ) )" " has to be equal to " "v" "!" "\n", "test", "midi.c", 32, "MIDI_LONG_VALUE and MIDI_MSB / MIDI_LSB are not orthogonal." ); } } while( 0 );; return 1; };
  return 0;
}

variable_types: v short


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

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

original_code:
int test001_runloop( void ) {
  return 0;
}

canonical_original_code:
int test001_runloop() {
  return 0;
}


MIDIUtilReadVarLen

decompiled_code:
__int64 __fastcall MIDIUtilReadVarLen(int *a1, __int64 a2, __int64 a3, _QWORD *a4)
{
__int64 v7; // rdx
int v8; // eax
char v9; // cl
__int64 result; // rax
const char *v11; // r9
__int64 v12; // r8
void (*v13)(__int64, const char *, ...); // r10

if ( !a3 || !a1 )
{
v11 = "[EINVAL] Precondition failed (buffer != NULL && value != NULL)";
v12 = 27LL;
MIDIErrorNumber = 22;
v13 = (void (*)(__int64, const char *, ...))MIDILogger;
if ( !MIDILogger )
return 22LL;
LABEL_11:
v13(16LL, "%s/%s:%i: %s\n", "midi", "util.c", v12, v11);
return 22LL;
}
v7 = 0LL;
v8 = 0;
if ( !a2 )
{
v11 = "[EINVAL] Precondition failed (size > 0)";
v12 = 28LL;
MIDIErrorNumber = 22;
v13 = (void (*)(__int64, const char *, ...))MIDILogger;
if ( !MIDILogger )
return 22LL;
goto LABEL_11;
}
while ( 1 )
{
v9 = *(_BYTE *)(a3 + v7++);
v8 = v9 & 0x7F | (v8 << 7);
if ( v9 >= 0 )
break;
if ( a2 == v7 )
return 1LL;
}
*a1 = v8 & 0xFFFFFFF;
result = 0LL;
if ( a4 )
*a4 = v7;
return result;
}

canonical_decompiled_code:
__int64 __fastcall func0(int *a1, __int64 a2, __int64 a3, _QWORD *a4)
{
__int64 v7; // rdx
int v8; // eax
char v9; // cl
__int64 result; // rax
const char *v11; // r9
__int64 v12; // r8
void (*v13)(__int64, const char *, ...); // r10

if ( !a3 || !a1 )
{
v11 = "[EINVAL] Precondition failed (buffer != NULL && value != NULL)";
v12 = 27LL;
MIDIErrorNumber = 22;
v13 = (void (*)(__int64, const char *, ...))MIDILogger;
if ( !MIDILogger )
return 22LL;
LABEL_11:
v13(16LL, "%s/%s:%i: %s\n", "midi", "util.c", v12, v11);
return 22LL;
}
v7 = 0LL;
v8 = 0;
if ( !a2 )
{
v11 = "[EINVAL] Precondition failed (size > 0)";
v12 = 28LL;
MIDIErrorNumber = 22;
v13 = (void (*)(__int64, const char *, ...))MIDILogger;
if ( !MIDILogger )
return 22LL;
goto LABEL_11;
}
while ( 1 )
{
v9 = *(_BYTE *)(a3 + v7++);
v8 = v9 & 0x7F | (v8 << 7);
if ( v9 >= 0 )
break;
if ( a2 == v7 )
return 1LL;
}
*a1 = v8 & 0xFFFFFFF;
result = 0LL;
if ( a4 )
*a4 = v7;
return result;
}

original_code:
int MIDIUtilReadVarLen( MIDIVarLen * value, size_t size, unsigned char * buffer, size_t * read ) {
  MIDIVarLen v = 0;
  size_t p = 0;
  do { if( !(buffer != ((void *)0) && value != ((void *)0)) ) { MIDIErrorNumber = 22; do { if( MIDILogger != ((void *)0) ) { (*MIDILogger)( 0x10, "%s/%s:%i: " "%s\n", "midi", "util.c", 27, "[" "EINVAL" "] Precondition failed (" "buffer != NULL && value != NULL" ")" ); } } while( 0 );; return 22;; } } while( 0 );
  do { if( !(size > 0) ) { MIDIErrorNumber = 22; do { if( MIDILogger != ((void *)0) ) { (*MIDILogger)( 0x10, "%s/%s:%i: " "%s\n", "midi", "util.c", 28, "[" "EINVAL" "] Precondition failed (" "size > 0" ")" ); } } while( 0 );; return 22;; } } while( 0 );
  do {
    if( p>=size ) return 1;
    v = (v<<7) | (buffer[p] & 0x7f);
  } while( buffer[p++] & 0x80 );
  *value = v & 0x0fffffff;
  if( read != ((void *)0) ) *read = p;
  return 0;
}

canonical_original_code:
int MIDIUtilReadVarLen(unsigned int *value, unsigned long size, unsigned char *buffer, unsigned long *read) {
  unsigned int v = 0;
  unsigned long p = 0;
  do { if( !(buffer != ((void *)0) && value != ((void *)0)) ) { MIDIErrorNumber = 22; do { if( MIDILogger != ((void *)0) ) { (*MIDILogger)( 0x10, "%s/%s:%i: " "%s\n", "midi", "util.c", 27, "[" "EINVAL" "] Precondition failed (" "buffer != NULL && value != NULL" ")" ); } } while( 0 );; return 22;; } } while( 0 );
  do { if( !(size > 0) ) { MIDIErrorNumber = 22; do { if( MIDILogger != ((void *)0) ) { (*MIDILogger)( 0x10, "%s/%s:%i: " "%s\n", "midi", "util.c", 28, "[" "EINVAL" "] Precondition failed (" "size > 0" ")" ); } } while( 0 );; return 22;; } } while( 0 );
  do {
    if( p>=size ) return 1;
    v = (v<<7) | (buffer[p] & 0x7f);
  } while( buffer[p++] & 0x80 );
  *value = v & 0x0fffffff;
  if( read != ((void *)0) ) *read = p;
  return 0;
}

variable_types:
value
unsigned int *

variable_types:
size
unsigned long

variable_types:
buffer
unsigned char *

variable_types:
read
unsigned long *

variable_types:
v
unsigned int

variable_types:
p
unsigned long


MIDIUtilWriteVarLen

decompiled_code:
__int64 __fastcall MIDIUtilWriteVarLen(int *a1, unsigned __int64 a2, __int64 a3, __int64 *a4)
{
int v6; // edx
char v8; // r8
int *v9; // rcx
unsigned __int64 v10; // rax
unsigned int v11; // edx
unsigned int v12; // er8
__int64 v13; // rcx
char *v14; // r11
unsigned int v15; // eax
__int64 v16; // rdx
const char *v18; // r9
__int64 v19; // r8
void (*v20)(__int64, const char *, ...); // r10
int v21[3]; // [rsp+Ch] [rbp-Ch] BYREF

v21[0] = 8421504;
if ( !a3 || !a1 )
{
v18 = "[EINVAL] Precondition failed (buffer != NULL && value != NULL)";
v19 = 53LL;
MIDIErrorNumber = 22;
v20 = (void (*)(__int64, const char *, ...))MIDILogger;
if ( !MIDILogger )
return 22LL;
LABEL_18:
v20(16LL, "%s/%s:%i: %s\n", "midi", "util.c", v19, v18);
return 22LL;
}
if ( !a2 )
{
v18 = "[EINVAL] Precondition failed (size > 0)";
v19 = 54LL;
MIDIErrorNumber = 22;
v20 = (void (*)(__int64, const char *, ...))MIDILogger;
if ( !MIDILogger )
return 22LL;
goto LABEL_18;
}
v6 = *a1;
v8 = 0;
v9 = v21;
v10 = 0LL;
v11 = v6 & 0xFFFFFFF;
while ( 1 )
{
++v10;
v9 = (int *)((char *)v9 - 1);
*((_BYTE *)v9 + 4) = v8 | v11 & 0x7F;
v11 >>= 7;
if ( !v11 || v10 > 3 )
break;
v8 = *((_BYTE *)v9 + 3);
}
v12 = 1;
if ( a2 >= v10 )
{
v13 = 1LL;
if ( 5 - v10 <= 4 )
v13 = v10;
v14 = (char *)v21 - v10;
if ( (_DWORD)v13 )
{
v15 = 0;
do
{
v16 = v15++;
*(_BYTE *)(a3 + v16) = v14[v16 + 4];
}
while ( v15 < (unsigned int)v13 );
}
v12 = 0;
if ( a4 )
*a4 = v13;
}
return v12;
}

canonical_decompiled_code:
__int64 __fastcall func1(int *a1, unsigned __int64 a2, __int64 a3, __int64 *a4)
{
int v6; // edx
char v8; // r8
int *v9; // rcx
unsigned __int64 v10; // rax
unsigned int v11; // edx
unsigned int v12; // er8
__int64 v13; // rcx
char *v14; // r11
unsigned int v15; // eax
__int64 v16; // rdx
const char *v18; // r9
__int64 v19; // r8
void (*v20)(__int64, const char *, ...); // r10
int v21[3]; // [rsp+Ch] [rbp-Ch] BYREF

v21[0] = 8421504;
if ( !a3 || !a1 )
{
v18 = "[EINVAL] Precondition failed (buffer != NULL && value != NULL)";
v19 = 53LL;
MIDIErrorNumber = 22;
v20 = (void (*)(__int64, const char *, ...))MIDILogger;
if ( !MIDILogger )
return 22LL;
LABEL_18:
v20(16LL, "%s/%s:%i: %s\n", "midi", "util.c", v19, v18);
return 22LL;
}
if ( !a2 )
{
v18 = "[EINVAL] Precondition failed (size > 0)";
v19 = 54LL;
MIDIErrorNumber = 22;
v20 = (void (*)(__int64, const char *, ...))MIDILogger;
if ( !MIDILogger )
return 22LL;
goto LABEL_18;
}
v6 = *a1;
v8 = 0;
v9 = v21;
v10 = 0LL;
v11 = v6 & 0xFFFFFFF;
while ( 1 )
{
++v10;
v9 = (int *)((char *)v9 - 1);
*((_BYTE *)v9 + 4) = v8 | v11 & 0x7F;
v11 >>= 7;
if ( !v11 || v10 > 3 )
break;
v8 = *((_BYTE *)v9 + 3);
}
v12 = 1;
if ( a2 >= v10 )
{
v13 = 1LL;
if ( 5 - v10 <= 4 )
v13 = v10;
v14 = (char *)v21 - v10;
if ( (_DWORD)v13 )
{
v15 = 0;
do
{
v16 = v15++;
*(_BYTE *)(a3 + v16) = v14[v16 + 4];
}
while ( v15 < (unsigned int)v13 );
}
v12 = 0;
if ( a4 )
*a4 = v13;
}
return v12;
}

original_code:
int MIDIUtilWriteVarLen( MIDIVarLen * value, size_t size, unsigned char * buffer, size_t * written ) {
  MIDIVarLen v = 0;
  unsigned char tmp[4] = { 0x80, 0x80, 0x80, 0x00 };
  size_t p = 0, q = 0;
  do { if( !(buffer != ((void *)0) && value != ((void *)0)) ) { MIDIErrorNumber = 22; do { if( MIDILogger != ((void *)0) ) { (*MIDILogger)( 0x10, "%s/%s:%i: " "%s\n", "midi", "util.c", 53, "[" "EINVAL" "] Precondition failed (" "buffer != NULL && value != NULL" ")" ); } } while( 0 );; return 22;; } } while( 0 );
  do { if( !(size > 0) ) { MIDIErrorNumber = 22; do { if( MIDILogger != ((void *)0) ) { (*MIDILogger)( 0x10, "%s/%s:%i: " "%s\n", "midi", "util.c", 54, "[" "EINVAL" "] Precondition failed (" "size > 0" ")" ); } } while( 0 );; return 22;; } } while( 0 );
  v = *value & 0x0fffffff;
  do {
    tmp[3-p] |= v & 0x7f;
    v >>= 7;
    p++;
  } while( v != 0 && p<4 );
  if( p>size ) return 1;
  q = 4-p;
  for( p=0; q+p<4; p++ ) {
    buffer[p] = tmp[q+p];
  }
  if( written != ((void *)0) ) *written = p;
  return 0;
}

canonical_original_code:
int MIDIUtilWriteVarLen(unsigned int *value, unsigned long size, unsigned char *buffer, unsigned long *written) {
  unsigned int v = 0;
  unsigned char tmp[4] = { 0x80, 0x80, 0x80, 0x00 };
  unsigned long p = 0; unsigned long q = 0;
  do { if( !(buffer != ((void *)0) && value != ((void *)0)) ) { MIDIErrorNumber = 22; do { if( MIDILogger != ((void *)0) ) { (*MIDILogger)( 0x10, "%s/%s:%i: " "%s\n", "midi", "util.c", 53, "[" "EINVAL" "] Precondition failed (" "buffer != NULL && value != NULL" ")" ); } } while( 0 );; return 22;; } } while( 0 );
  do { if( !(size > 0) ) { MIDIErrorNumber = 22; do { if( MIDILogger != ((void *)0) ) { (*MIDILogger)( 0x10, "%s/%s:%i: " "%s\n", "midi", "util.c", 54, "[" "EINVAL" "] Precondition failed (" "size > 0" ")" ); } } while( 0 );; return 22;; } } while( 0 );
  v = *value & 0x0fffffff;
  do {
    tmp[3-p] |= v & 0x7f;
    v >>= 7;
    p++;
  } while( v != 0 && p<4 );
  if( p>size ) return 1;
  q = 4-p;
  for( p=0; q+p<4; p++ ) {
    buffer[p] = tmp[q+p];
  }
  if( written != ((void *)0) ) *written = p;
  return 0;
}

variable_types:
written
unsigned long *

variable_types:
tmp
unsigned char [4]

variable_types:
q
unsigned long


repo: jpommerening/template

decompiled_code:
void __fastcall template_destroy(void **a1)
{
void *v1; // rdi

v1 = *a1;
if ( v1 )
free(v1);
}

canonical_decompiled_code:
void __fastcall func1(void **a1)
{
void *v1; // rdi

v1 = *a1;
if ( v1 )
free(v1);
}

original_code:
void template_destroy( template_t* template ) {
  if( template->data != ((void *)0) ) {
    free( template->data );
  }
}

canonical_original_code:
void template_destroy(struct template_s *template) {
  if( template->data != ((void *)0) ) {
    free( template->data );
  }
}

variable_types:
template
struct template_s { void *data; } *

return_type: void


repo: jpraher/teyjus

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

result = malloc(a1);
if ( !result )
{
puts("Error : cannot allocate space");
exit(1);
}
return result;
}

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

result = malloc(a1);
if ( !result )
{
puts("Error : cannot allocate space");
exit(1);
}
return result;
}

original_code:
void* UTIL_malloc(size_t n)
{
    void* ptr = (void*)malloc(n);
    if (ptr) return ptr;
    printf("Error : cannot allocate space\n");
    exit(1);
}

canonical_original_code:
void *UTIL_malloc(unsigned long n)
{
    void *ptr = (void*)malloc(n);
    if (ptr) return ptr;
    printf("Error : cannot allocate space\n");
    exit(1);
}

variable_types:
n
unsigned long

variable_types:
ptr
void *

return_type: void *


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

result = malloc(a1 + 1);
if ( !result )
{
puts("Error : cannot allocate space");
exit(1);
}
return result;
}

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

result = malloc(a1 + 1);
if ( !result )
{
puts("Error : cannot allocate space");
exit(1);
}
return result;
}

original_code:
char* UTIL_mallocStr(size_t size)
{
    char* ptr = (char*)malloc(sizeof(char)*(size + 1));
    if (ptr) return ptr;
    printf("Error : cannot allocate space\n");
    exit(1);
}

canonical_original_code:
char *UTIL_mallocStr(unsigned long size)
{
    char *ptr = (char*)malloc(sizeof(char)*(size + 1));
    if (ptr) return ptr;
    printf("Error : cannot allocate space\n");
    exit(1);
}

variable_types:
ptr
char *

return_type: char *


decompiled_code:
char *__fastcall UTIL_appendStr(char *src, char *a2)
{
size_t v2; // r12
size_t v3; // rax
char *v4; // r12
char *v5; // rax

v2 = strlen(src);
v3 = strlen(a2);
v4 = (char *)UTIL_mallocStr(v2 + v3 + 1);
v5 = stpcpy(v4, src);
strcpy(v5, a2);
return v4;
}

canonical_decompiled_code:
char *__fastcall func2(char *src, char *a2)
{
size_t v2; // r12
size_t v3; // rax
char *v4; // r12
char *v5; // rax

v2 = strlen(src);
v3 = strlen(a2);
v4 = (char *)func1(v2 + v3 + 1);
v5 = stpcpy(v4, src);
strcpy(v5, a2);
return v4;
}

original_code:
char* UTIL_appendStr(char* str1, char* str2)
{
  size_t length = strlen(str1) + strlen(str2);
  char* ptr = UTIL_mallocStr(length + 1);
  strcpy(ptr, str1);
  strcat(ptr, str2);
  return ptr;
}

canonical_original_code:
char *UTIL_appendStr(char *str1, char *str2)
{
  unsigned long length = strlen(str1) + strlen(str2);
  char *ptr = UTIL_mallocStr(length + 1);
  strcpy(ptr, str1);
  strcat(ptr, str2);
  return ptr;
}

variable_types:
length
unsigned long


decompiled_code:
char *__fastcall UTIL_upperCase(const char *a1)
{
char *v1; // r8
char v2; // al
char *v3; // rdx

v1 = strdup(a1);
v2 = *v1;
if ( *v1 )
{
v3 = v1;
do
{
if ( (unsigned __int8)(v2 - 97) <= 0x19u )
*v3 = v2 - 32;
v2 = *++v3;
}
while ( v2 );
}
return v1;
}

canonical_decompiled_code:
char *__fastcall func3(const char *a1)
{
char *v1; // r8
char v2; // al
char *v3; // rdx

v1 = strdup(a1);
v2 = *v1;
if ( *v1 )
{
v3 = v1;
do
{
if ( (unsigned __int8)(v2 - 97) <= 0x19u )
*v3 = v2 - 32;
v2 = *++v3;
}
while ( v2 );
}
return v1;
}

original_code:
char* UTIL_upperCase(char* str)
{
    char *newstr, *tmp;
    newstr = strdup(str);
    tmp = newstr;
    while ((*tmp) != '\0'){
        if ((97 <= (int)*tmp) && ((int)*tmp <= 122))
            *tmp = (char)((int)*tmp - 32);
        tmp++;
    }
    return newstr;
}

canonical_original_code:
char *UTIL_upperCase(char *str)
{
    char *newstr; char *tmp;
    newstr = strdup(str);
    tmp = newstr;
    while ((*tmp) != '\0'){
        if ((97 <= (int)*tmp) && ((int)*tmp <= 122))
            *tmp = (char)((int)*tmp - 32);
        tmp++;
    }
    return newstr;
}

variable_types:
str
char *

variable_types:
newstr
char *

variable_types:
tmp
char *


decompiled_code:
char *__fastcall UTIL_lowerCase(const char *a1)
{
char *v1; // r8
char v2; // al
char *v3; // rdx

v1 = strdup(a1);
v2 = *v1;
if ( *v1 )
{
v3 = v1;
do
{
if ( (unsigned __int8)(v2 - 65) <= 0x19u )
*v3 = v2 + 32;
v2 = *++v3;
}
while ( v2 );
}
return v1;
}

canonical_decompiled_code:
char *__fastcall func4(const char *a1)
{
char *v1; // r8
char v2; // al
char *v3; // rdx

v1 = strdup(a1);
v2 = *v1;
if ( *v1 )
{
v3 = v1;
do
{
if ( (unsigned __int8)(v2 - 65) <= 0x19u )
*v3 = v2 + 32;
v2 = *++v3;
}
while ( v2 );
}
return v1;
}

original_code:
char* UTIL_lowerCase(char* str)
{
    char *newstr, *tmp;
    newstr = strdup(str);
    tmp = newstr;
    while ((*tmp) != '\0'){
        if ((65 <= (int)*tmp) && ((int)*tmp) <= 90)
            *tmp = (char)((int)*tmp + 32);
        tmp++;
    }
    return newstr;
}

canonical_original_code:
char *UTIL_lowerCase(char *str)
{
    char *newstr; char *tmp;
    newstr = strdup(str);
    tmp = newstr;
    while ((*tmp) != '\0'){
        if ((65 <= (int)*tmp) && ((int)*tmp) <= 90)
            *tmp = (char)((int)*tmp + 32);
        tmp++;
    }
    return newstr;
}


decompiled_code:
char *__fastcall UTIL_itoa(unsigned int a1)
{
char *v1; // r12

v1 = (char *)UTIL_mallocStr(33LL);
sprintf(v1, "%d", a1);
return v1;
}

canonical_decompiled_code:
char *__fastcall func5(unsigned int a1)
{
char *v1; // r12

v1 = (char *)func1(33LL);
sprintf(v1, "%d", a1);
return v1;
}

original_code:
char* UTIL_itoa(int num)
{
    char *str = UTIL_mallocStr(33);
    sprintf(str, "%d", num);
    return str;
}

canonical_original_code:
char *UTIL_itoa(int num)
{
    char *str = UTIL_mallocStr(33);
    sprintf(str, "%d", num);
    return str;
}

variable_types: num int


addStr

decompiled_code:
char *__fastcall addStr(char *src, char *a2)
{
size_t v2; // rax
size_t v3; // r12
size_t v4; // rax
char *v5; // r12
char *v6; // rax

v2 = strlen(a2);
v3 = v2;
if ( src )
{
v4 = strlen(src);
v5 = (char *)UTIL_mallocStr(v4 + v3);
v6 = stpcpy(v5, src);
strcpy(v6, a2);
}
else
{
v5 = (char *)UTIL_mallocStr(v2);
strcpy(v5, a2);
}
return v5;
}

canonical_decompiled_code:
char *__fastcall func0(char *src, char *a2)
{
size_t v2; // rax
size_t v3; // r12
size_t v4; // rax
char *v5; // r12
char *v6; // rax

v2 = strlen(a2);
v3 = v2;
if ( src )
{
v4 = strlen(src);
v5 = (char *)UTIL_mallocStr(v4 + v3);
v6 = stpcpy(v5, src);
strcpy(v6, a2);
}
else
{
v5 = (char *)UTIL_mallocStr(v2);
strcpy(v5, a2);
}
return v5;
}

original_code:
static char* addStr(char* str, char* addOn)
{
    size_t length = (str ? strlen(str) : 0) + strlen(addOn);
    char* newStr = UTIL_mallocStr(length);
    if (str) {
        strcpy(newStr, str);
        strcat(newStr, addOn);
    } else strcpy(newStr, addOn);
    return newStr;
}

canonical_original_code:
static char *addStr(char *str, char *addOn)
{
    unsigned long length = (str ? strlen(str) : 0) + strlen(addOn);
    char *newStr = UTIL_mallocStr(length);
    if (str) {
        strcpy(newStr, str);
        strcat(newStr, addOn);
    } else strcpy(newStr, addOn);
    return newStr;
}

variable_types:
addOn
char *

variable_types:
newStr
char *


addLine

decompiled_code:
char *__fastcall addLine(char *src, char *a2)
{
size_t v2; // rax
size_t v3; // r12
size_t v4; // rax
char *v5; // r12
char *v6; // rax

v2 = strlen(a2);
v3 = v2;
if ( src )
{
v4 = strlen(src);
v5 = (char *)UTIL_mallocStr(v3 + v4 + 2);
v6 = stpcpy(v5, src);
strcpy(v6, a2);
}
else
{
v5 = (char *)UTIL_mallocStr(v2 + 2);
strcpy(v5, a2);
}
strcat(v5, "\n\n");
return v5;
}

canonical_decompiled_code:
char *__fastcall func1(char *src, char *a2)
{
size_t v2; // rax
size_t v3; // r12
size_t v4; // rax
char *v5; // r12
char *v6; // rax

v2 = strlen(a2);
v3 = v2;
if ( src )
{
v4 = strlen(src);
v5 = (char *)UTIL_mallocStr(v3 + v4 + 2);
v6 = stpcpy(v5, src);
strcpy(v6, a2);
}
else
{
v5 = (char *)UTIL_mallocStr(v2 + 2);
strcpy(v5, a2);
}
strcat(v5, "\n\n");
return v5;
}

original_code:
static char* addLine(char* str, char* addOn)
{
    size_t length = (str ? strlen(str) : 0) + strlen(addOn) + 2;
    char* newStr = UTIL_mallocStr(length);
    if (str) {
        strcpy(newStr, str);
        strcat(newStr, addOn);
    } else strcpy(newStr, addOn);
    strcat(newStr, "\n\n");
    return newStr;
}

canonical_original_code:
static char *addLine(char *str, char *addOn)
{
    unsigned long length = (str ? strlen(str) : 0) + strlen(addOn) + 2;
    char *newStr = UTIL_mallocStr(length);
    if (str) {
        strcpy(newStr, str);
        strcat(newStr, addOn);
    } else strcpy(newStr, addOn);
    strcat(newStr, "\n\n");
    return newStr;
}


ocamlGenFixedML

decompiled_code:
void *ocamlGenFixedML()
{
void *result; // rax

result = (void *)OC_mkFixedML();
fixedML = result;
return result;
}

canonical_decompiled_code:
void *func2()
{
void *result; // rax

result = (void *)OC_mkFixedML();
fixedML = result;
return result;
}

original_code:
static void ocamlGenFixedML()
{
    fixedML = OC_mkFixedML();
}


ocamlGenFixedMLI

decompiled_code:
void *ocamlGenFixedMLI()
{
void *result; // rax

result = (void *)OC_mkFixedMLI();
fixedMLI = result;
return result;
}

canonical_decompiled_code:
void *func3()
{
void *result; // rax

result = (void *)OC_mkFixedMLI();
fixedMLI = result;
return result;
}

original_code:
static void ocamlGenFixedMLI()
{
    fixedMLI = OC_mkFixedMLI();
}


ocamlGenNumKinds

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

numKindsMLI = strdup("val numberPervasiveKinds : int");
result = addStr("let numberPervasiveKinds = ", a1);
numKindsML = result;
return result;
}

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

numKindsMLI = strdup("val numberPervasiveKinds : int");
result = func0("let numberPervasiveKinds = ", a1);
numKindsML = result;
return result;
}

original_code:
void ocamlGenNumKinds(char* number)
{
    numKindsMLI = strdup("val numberPervasiveKinds : int");
    numKindsML = addStr("let numberPervasiveKinds = ", number);
}

canonical_original_code:
void ocamlGenNumKinds(char *number)
{
    numKindsMLI = strdup("val numberPervasiveKinds : int");
    numKindsML = addStr("let numberPervasiveKinds = ", number);
}

variable_types:
number
char *


ocamlGenKind

decompiled_code:
void __fastcall ocamlGenKind(__int64 a1, __int64 a2, __int64 a3, __int64 a4)
{
void *v6; // rbp
__int64 v7; // r12
char *v8; // rbx
char *v9; // r15
char *v10; // r14
char *v11; // r13
char *v12; // r12
char *v13; // rbp
char *v14; // rbx
char *v15; // rbx
char *v16; // rbx
char *v17; // rbx

v6 = (void *)OC_mkKVarName(a2);
v7 = OC_mkIsKindFuncName(v6);
v8 = (char *)OC_mkKindVar(v6, a1, a3, a4);
v9 = (char *)OC_mkTabEntry(a1, v6);
v10 = (char *)OC_mkKindVarDec(v6);
v11 = (char *)OC_mkIsKindFuncDec(v7);
v12 = (char *)OC_mkIsKindFuncDef(v7, v6);
free(v6);
v13 = addLine(kindVarList, v8);
free(kindVarList);
free(v8);
kindVarList = v13;
v14 = addStr(buildPervKindBody, v9);
free(buildPervKindBody);
free(v9);
buildPervKindBody = v14;
v15 = addStr(kindVarDecs, v10);
free(kindVarDecs);
free(v10);
kindVarDecs = v15;
v16 = addStr(isKindFuncDecs, v11);
free(isKindFuncDecs);
free(v11);
isKindFuncDecs = v16;
v17 = addLine(isKindFuncDefs, v12);
free(isKindFuncDefs);
free(v12);
isKindFuncDefs = v17;
}

canonical_decompiled_code:
void __fastcall func5(__int64 a1, __int64 a2, __int64 a3, __int64 a4)
{
void *v6; // rbp
__int64 v7; // r12
char *v8; // rbx
char *v9; // r15
char *v10; // r14
char *v11; // r13
char *v12; // r12
char *v13; // rbp
char *v14; // rbx
char *v15; // rbx
char *v16; // rbx
char *v17; // rbx

v6 = (void *)OC_mkKVarName(a2);
v7 = OC_mkIsKindFuncName(v6);
v8 = (char *)OC_mkKindVar(v6, a1, a3, a4);
v9 = (char *)OC_mkTabEntry(a1, v6);
v10 = (char *)OC_mkKindVarDec(v6);
v11 = (char *)OC_mkIsKindFuncDec(v7);
v12 = (char *)OC_mkIsKindFuncDef(v7, v6);
free(v6);
v13 = func1(kindVarList, v8);
free(kindVarList);
free(v8);
kindVarList = v13;
v14 = func0(buildPervKindBody, v9);
free(buildPervKindBody);
free(v9);
buildPervKindBody = v14;
v15 = func0(kindVarDecs, v10);
free(kindVarDecs);
free(v10);
kindVarDecs = v15;
v16 = func0(isKindFuncDecs, v11);
free(isKindFuncDecs);
free(v11);
isKindFuncDecs = v16;
v17 = func1(isKindFuncDefs, v12);
free(isKindFuncDefs);
free(v12);
isKindFuncDefs = v17;
}

original_code:
void ocamlGenKind(char* kindName, char* kVarName, char* arity, char* offset)
{
    char* kindVarName = OC_mkKVarName(kVarName);
    char* funcName = OC_mkIsKindFuncName(kindVarName);
    char* kindVar = OC_mkKindVar(kindVarName, kindName, arity, offset);
    char* kindTabEntry = OC_mkTabEntry(kindName, kindVarName);
    char* kindVarDec = OC_mkKindVarDec(kindVarName);
    char* funcDec = OC_mkIsKindFuncDec(funcName);
    char* funcDef = OC_mkIsKindFuncDef(funcName, kindVarName);
    char *myKindVarList, *myBuildPervKindBody, *myKindVarDecs,
        *myisKindFuncDecs, *myisKindFuncDefs;
    free(kindVarName);
    myKindVarList = addLine(kindVarList, kindVar);
    free(kindVarList); free(kindVar);
    kindVarList = myKindVarList;
    myBuildPervKindBody = addStr(buildPervKindBody, kindTabEntry);
    free(buildPervKindBody); free(kindTabEntry);
    buildPervKindBody = myBuildPervKindBody;
    myKindVarDecs = addStr(kindVarDecs, kindVarDec);
    free(kindVarDecs); free(kindVarDec);
    kindVarDecs = myKindVarDecs;
    myisKindFuncDecs = addStr(isKindFuncDecs, funcDec);
    free(isKindFuncDecs); free(funcDec);
    isKindFuncDecs = myisKindFuncDecs;
    myisKindFuncDefs = addLine(isKindFuncDefs, funcDef);
    free(isKindFuncDefs); free(funcDef);
    isKindFuncDefs = myisKindFuncDefs;
}

canonical_original_code:
void ocamlGenKind(char *kindName, char *kVarName, char *arity, char *offset)
{
    char *kindVarName = OC_mkKVarName(kVarName);
    char *funcName = OC_mkIsKindFuncName(kindVarName);
    char *kindVar = OC_mkKindVar(kindVarName, kindName, arity, offset);
    char *kindTabEntry = OC_mkTabEntry(kindName, kindVarName);
    char *kindVarDec = OC_mkKindVarDec(kindVarName);
    char *funcDec = OC_mkIsKindFuncDec(funcName);
    char *funcDef = OC_mkIsKindFuncDef(funcName, kindVarName);
    char *myKindVarList; char *myBuildPervKindBody; char *myKindVarDecs; char *myisKindFuncDecs; char *myisKindFuncDefs;
    free(kindVarName);
    myKindVarList = addLine(kindVarList, kindVar);
    free(kindVarList); free(kindVar);
    kindVarList = myKindVarList;
    myBuildPervKindBody = addStr(buildPervKindBody, kindTabEntry);
    free(buildPervKindBody); free(kindTabEntry);
    buildPervKindBody = myBuildPervKindBody;
    myKindVarDecs = addStr(kindVarDecs, kindVarDec);
    free(kindVarDecs); free(kindVarDec);
    kindVarDecs = myKindVarDecs;
    myisKindFuncDecs = addStr(isKindFuncDecs, funcDec);
    free(isKindFuncDecs); free(funcDec);
    isKindFuncDecs = myisKindFuncDecs;
    myisKindFuncDefs = addLine(isKindFuncDefs, funcDef);
    free(isKindFuncDefs); free(funcDef);
    isKindFuncDefs = myisKindFuncDefs;
}

variable_types:
kindName
char *

variable_types:
kVarName
char *

variable_types:
arity
char *

variable_types:
offset
char *

variable_types:
kindVarName
char *

variable_types:
funcName
char *

variable_types:
kindVar
char *

variable_types:
kindTabEntry
char *

variable_types:
kindVarDec
char *

variable_types:
funcDec
char *

variable_types:
funcDef
char *

variable_types:
myKindVarList
char *

variable_types:
myBuildPervKindBody
char *

variable_types:
myKindVarDecs
char *

variable_types:
myisKindFuncDecs
char *

variable_types:
myisKindFuncDefs
char *


ocamlGenKinds

decompiled_code:
void ocamlGenKinds()
{
char *v0; // rbp
size_t v1; // r13
size_t v2; // r12
size_t v3; // rbx
size_t v4; // rax
void *v5; // rax
char *v6; // r14
char *v7; // rax
char *v8; // r12
char *v9; // rax
char *v10; // rax
char *v11; // r13
size_t v12; // rbx
size_t v13; // rbp
size_t v14; // rax
void *v15; // rax
char *v16; // r13
char *v17; // rax
char *v18; // rbp
char *v19; // rax
char *v20; // r12

v0 = (char *)OC_mkBuildKTabFunc(buildPervKindBody);
v1 = strlen(kindVarList);
v2 = strlen(v0);
v3 = strlen(isKindFuncDefs);
v4 = strlen(numKindsML);
v5 = (void *)UTIL_mallocStr(v4 + v3 + v1 + v2 + 4);
v6 = kindVarList;
kindML = v5;
v7 = stpcpy((char *)v5, kindVarList);
v8 = numKindsML;
*(_WORD *)v7 = 10;
v9 = stpcpy(v7 + 1, v8);
*(_WORD *)v9 = 2570;
v10 = stpcpy(v9 + 2, v0);
v11 = isKindFuncDefs;
*(_WORD *)v10 = 10;
strcpy(v10 + 1, v11);
free(buildPervKindBody);
free(v0);
free(v6);
free(v11);
free(v8);
v12 = strlen(kindVarDecs);
v13 = strlen(isKindFuncDecs);
v14 = strlen(numKindsMLI);
v15 = (void *)UTIL_mallocStr(v14 + v12 + v13 + 4);
v16 = kindVarDecs;
kindMLI = v15;
v17 = stpcpy((char *)v15, kindVarDecs);
v18 = numKindsMLI;
strcpy(v17, "\n\n");
v19 = stpcpy(v17 + 2, numKindsMLI);
v20 = isKindFuncDecs;
strcpy(v19, "\n\n");
strcpy(v19 + 2, isKindFuncDecs);
free(v16);
free(v20);
free(v18);
}

canonical_decompiled_code:
void func6()
{
char *v0; // rbp
size_t v1; // r13
size_t v2; // r12
size_t v3; // rbx
size_t v4; // rax
void *v5; // rax
char *v6; // r14
char *v7; // rax
char *v8; // r12
char *v9; // rax
char *v10; // rax
char *v11; // r13
size_t v12; // rbx
size_t v13; // rbp
size_t v14; // rax
void *v15; // rax
char *v16; // r13
char *v17; // rax
char *v18; // rbp
char *v19; // rax
char *v20; // r12

v0 = (char *)OC_mkBuildKTabFunc(buildPervKindBody);
v1 = strlen(kindVarList);
v2 = strlen(v0);
v3 = strlen(isKindFuncDefs);
v4 = strlen(numKindsML);
v5 = (void *)UTIL_mallocStr(v4 + v3 + v1 + v2 + 4);
v6 = kindVarList;
kindML = v5;
v7 = stpcpy((char *)v5, kindVarList);
v8 = numKindsML;
*(_WORD *)v7 = 10;
v9 = stpcpy(v7 + 1, v8);
*(_WORD *)v9 = 2570;
v10 = stpcpy(v9 + 2, v0);
v11 = isKindFuncDefs;
*(_WORD *)v10 = 10;
strcpy(v10 + 1, v11);
free(buildPervKindBody);
free(v0);
free(v6);
free(v11);
free(v8);
v12 = strlen(kindVarDecs);
v13 = strlen(isKindFuncDecs);
v14 = strlen(numKindsMLI);
v15 = (void *)UTIL_mallocStr(v14 + v12 + v13 + 4);
v16 = kindVarDecs;
kindMLI = v15;
v17 = stpcpy((char *)v15, kindVarDecs);
v18 = numKindsMLI;
strcpy(v17, "\n\n");
v19 = stpcpy(v17 + 2, numKindsMLI);
v20 = isKindFuncDecs;
strcpy(v19, "\n\n");
strcpy(v19 + 2, isKindFuncDecs);
free(v16);
free(v20);
free(v18);
}

original_code:
void ocamlGenKinds()
{
    char* buildTabFunc = OC_mkBuildKTabFunc(buildPervKindBody);
    size_t length = strlen(kindVarList) + strlen(buildTabFunc) +
        strlen(isKindFuncDefs) + strlen(numKindsML) + 4;
    kindML = UTIL_mallocStr(length);
    strcpy(kindML, kindVarList);
    strcat(kindML, "\n");
    strcat(kindML, numKindsML);
    strcat(kindML, "\n\n");
    strcat(kindML, buildTabFunc);
    strcat(kindML, "\n");
    strcat(kindML, isKindFuncDefs);
    free(buildPervKindBody); free(buildTabFunc); free(kindVarList);
    free(isKindFuncDefs); free(numKindsML);
    length = strlen(kindVarDecs) + strlen(isKindFuncDecs) +
        strlen(numKindsMLI) + 4;
    kindMLI = UTIL_mallocStr(length);
    strcpy(kindMLI, kindVarDecs);
    strcat(kindMLI, "\n\n");
    strcat(kindMLI, numKindsMLI);
    strcat(kindMLI, "\n\n");
    strcat(kindMLI, isKindFuncDecs);
    free(kindVarDecs); free(isKindFuncDecs); free(numKindsMLI);
}

canonical_original_code:
void ocamlGenKinds()
{
    char *buildTabFunc = OC_mkBuildKTabFunc(buildPervKindBody);
    unsigned long length = strlen(kindVarList) + strlen(buildTabFunc) +
        strlen(isKindFuncDefs) + strlen(numKindsML) + 4;
    kindML = UTIL_mallocStr(length);
    strcpy(kindML, kindVarList);
    strcat(kindML, "\n");
    strcat(kindML, numKindsML);
    strcat(kindML, "\n\n");
    strcat(kindML, buildTabFunc);
    strcat(kindML, "\n");
    strcat(kindML, isKindFuncDefs);
    free(buildPervKindBody); free(buildTabFunc); free(kindVarList);
    free(isKindFuncDefs); free(numKindsML);
    length = strlen(kindVarDecs) + strlen(isKindFuncDecs) +
        strlen(numKindsMLI) + 4;
    kindMLI = UTIL_mallocStr(length);
    strcpy(kindMLI, kindVarDecs);
    strcat(kindMLI, "\n\n");
    strcat(kindMLI, numKindsMLI);
    strcat(kindMLI, "\n\n");
    strcat(kindMLI, isKindFuncDecs);
    free(kindVarDecs); free(isKindFuncDecs); free(numKindsMLI);
}

variable_types:
buildTabFunc
char *

variable_types:
length
unsigned long


ocamlGenTySkel

decompiled_code:
void __fastcall ocamlGenTySkel(__int64 a1, __int64 a2)
{
size_t v2; // rbx
void *v3; // r13
void *v4; // r12
char *v5; // rbp
size_t v6; // rax
char *v7; // rbx

v2 = 0LL;
v3 = (void *)OC_mkTySkelVarName();
v4 = (void *)OC_genTySkel(a2);
v5 = (char *)OC_mkTYSkelVar(v3, v4);
if ( tySkelVarList )
v2 = strlen(tySkelVarList);
v6 = strlen(v5);
UTIL_mallocStr(v2 + v6 + 2);
free(v3);
free(v4);
v7 = addLine(tySkelVarList, v5);
free(tySkelVarList);
free(v5);
tySkelVarList = v7;
}

canonical_decompiled_code:
void __fastcall func7(__int64 a1, __int64 a2)
{
size_t v2; // rbx
void *v3; // r13
void *v4; // r12
char *v5; // rbp
size_t v6; // rax
char *v7; // rbx

v2 = 0LL;
v3 = (void *)OC_mkTySkelVarName();
v4 = (void *)OC_genTySkel(a2);
v5 = (char *)OC_mkTYSkelVar(v3, v4);
if ( tySkelVarList )
v2 = strlen(tySkelVarList);
v6 = strlen(v5);
UTIL_mallocStr(v2 + v6 + 2);
free(v3);
free(v4);
v7 = func1(tySkelVarList, v5);
free(tySkelVarList);
free(v5);
tySkelVarList = v7;
}

original_code:
void ocamlGenTySkel(char* ind, Type tySkel)
{
    char* varName = OC_mkTySkelVarName(ind);
    char* tySkelText = OC_genTySkel(tySkel);
    char* tySkelVarDef = OC_mkTYSkelVar(varName, tySkelText);
    size_t length = (tySkelVarList ? strlen(tySkelVarList) : 0) +
        strlen(tySkelVarDef) + 1;
    char* mytySkelVarList = UTIL_mallocStr(length + 1);
    free(varName); free(tySkelText);
    mytySkelVarList = addLine(tySkelVarList, tySkelVarDef);
    free(tySkelVarList); free(tySkelVarDef);
    tySkelVarList = mytySkelVarList;
}

canonical_original_code:
void ocamlGenTySkel(char *ind, struct Type_ *tySkel)
{
    char *varName = OC_mkTySkelVarName(ind);
    char *tySkelText = OC_genTySkel(tySkel);
    char *tySkelVarDef = OC_mkTYSkelVar(varName, tySkelText);
    unsigned long length = (tySkelVarList ? strlen(tySkelVarList) : 0) +
        strlen(tySkelVarDef) + 1;
    char *mytySkelVarList = UTIL_mallocStr(length + 1);
    free(varName); free(tySkelText);
    mytySkelVarList = addLine(tySkelVarList, tySkelVarDef);
    free(tySkelVarList); free(tySkelVarDef);
    tySkelVarList = mytySkelVarList;
}

variable_types:
ind
char *

variable_types: struct Type_ { enum TypeCats { SORT=0, SKVAR=1, ARROW=2, STR=3, FUNC=4 } tag; union { char *sort; char *skvar; struct FuncInfo { char *name; char *arity; } func; struct ArrowInfo { struct Type_ *lop; struct Type_ *rop; } arrow; struct StrInfo { struct Type_ *functor; int arity; struct TypeList_ { struct Type_ *oneType; struct TypeList_ *next; } *args; } str; } data; } *

variable_types:
varName
char *

variable_types:
tySkelText
char *

variable_types:
tySkelVarDef
char *

variable_types:
mytySkelVarList
char *

user_defined_types: struct Type_ { enum TypeCats tag; union { char *sort; char *skvar; struct FuncInfo func; struct ArrowInfo arrow; struct StrInfo str; } data; }

user_defined_types: struct StrInfo { struct Type_ *functor; int arity; struct TypeList_ *args; }


ocamlGenNumConsts

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

numConstsMLI = strdup("val numberPervasiveConstants : int");
result = addStr("let numberPervasiveConstants = ", a1);
numConstsML = result;
return result;
}

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

numConstsMLI = strdup("val numberPervasiveConstants : int");
result = func0("let numberPervasiveConstants = ", a1);
numConstsML = result;
return result;
}

original_code:
void ocamlGenNumConsts(char* number)
{
    numConstsMLI = strdup("val numberPervasiveConstants : int");
    numConstsML = addStr("let numberPervasiveConstants = ", number);
}

canonical_original_code:
void ocamlGenNumConsts(char *number)
{
    numConstsMLI = strdup("val numberPervasiveConstants : int");
    numConstsML = addStr("let numberPervasiveConstants = ", number);
}

variable_types:
number
char *


ocamlGenConst

decompiled_code:
void __fastcall ocamlGenConst(__int64 a1, __int64 a2, __int64 a3, unsigned int a4, unsigned int a5, __int64 a6, unsigned int a7, int a8, int a9, unsigned int a10)
{
void *v13; // rbp
void *v14; // r12
char *v15; // rbx
char *v16; // r15
char *v17; // r14
char *v18; // r13
char *v19; // rbp
char *v20; // rbp
char *v21; // rbx
char *v22; // rbx
char *v23; // rbx
char *v24; // [rsp+8h] [rbp-50h]
void *ptr; // [rsp+10h] [rbp-48h]
void *v26; // [rsp+18h] [rbp-40h]

v13 = (void *)OC_mkCVarName(a3);
v14 = (void *)OC_mkIsConstFuncName(v13);
v26 = (void *)UTIL_itoa(a10);
ptr = (void *)OC_mkTySkelVarName(v26);
v24 = (char *)OC_mkConstVar(a2, a4, a5, a6, a7);
v15 = (char *)OC_mkTabEntry(a2, v13);
v16 = (char *)OC_mkConstVarDec(v13);
v17 = (char *)OC_mkIsConstFuncDec(v14);
v18 = (char *)OC_mkIsConstFuncDef(v14, v13);
free(v13);
free(v14);
free(ptr);
free(v26);
v19 = addLine(constVarList, v24);
free(constVarList);
free(v24);
constVarList = v19;
v20 = addStr(buildPervConstBody, v15);
free(buildPervConstBody);
free(v15);
buildPervConstBody = v20;
v21 = addStr(constVarDecs, v16);
free(constVarDecs);
free(v16);
constVarDecs = v21;
v22 = addStr(isConstFuncDecs, v17);
free(isConstFuncDecs);
free(v17);
isConstFuncDecs = v22;
v23 = addLine(isConstFuncDefs, v18);
free(isConstFuncDefs);
free(v18);
isConstFuncDefs = v23;
}

canonical_decompiled_code:
void __fastcall func9(__int64 a1, __int64 a2, __int64 a3, unsigned int a4, unsigned int a5, __int64 a6, unsigned int a7, int a8, int a9, unsigned int a10)
{
void *v13; // rbp
void *v14; // r12
char *v15; // rbx
char *v16; // r15
char *v17; // r14
char *v18; // r13
char *v19; // rbp
char *v20; // rbp
char *v21; // rbx
char *v22; // rbx
char *v23; // rbx
char *v24; // [rsp+8h] [rbp-50h]
void *ptr; // [rsp+10h] [rbp-48h]
void *v26; // [rsp+18h] [rbp-40h]

v13 = (void *)OC_mkCVarName(a3);
v14 = (void *)OC_mkIsConstFuncName(v13);
v26 = (void *)UTIL_itoa(a10);
ptr = (void *)OC_mkTySkelVarName(v26);
v24 = (char *)OC_mkConstVar(a2, a4, a5, a6, a7);
v15 = (char *)OC_mkTabEntry(a2, v13);
v16 = (char *)OC_mkConstVarDec(v13);
v17 = (char *)OC_mkIsConstFuncDec(v14);
v18 = (char *)OC_mkIsConstFuncDef(v14, v13);
free(v13);
free(v14);
free(ptr);
free(v26);
v19 = func1(constVarList, v24);
free(constVarList);
free(v24);
constVarList = v19;
v20 = func0(buildPervConstBody, v15);
free(buildPervConstBody);
free(v15);
buildPervConstBody = v20;
v21 = func0(constVarDecs, v16);
free(constVarDecs);
free(v16);
constVarDecs = v21;
v22 = func0(isConstFuncDecs, v17);
free(isConstFuncDecs);
free(v17);
isConstFuncDecs = v22;
v23 = func1(isConstFuncDefs, v18);
free(isConstFuncDefs);
free(v18);
isConstFuncDefs = v23;
}

original_code:
void ocamlGenConst(char* ind, char* name, char* cVarName, OP_Fixity fixity,
                   OP_Prec prec, UTIL_Bool tyPrev, UTIL_Bool redef, int tesize,
                   int tyskelInd, int neededness, OP_Code codeInfo,
                   char* offset, char *printName)
{
    char* constVarName = OC_mkCVarName(cVarName);
    char* funcName = OC_mkIsConstFuncName(constVarName);
    char* tyskelText = UTIL_itoa(tyskelInd);
    char* tyskelName = OC_mkTySkelVarName(tyskelText);
    char* constVar = OC_mkConstVar(name, fixity, prec, tyPrev, tyskelName,
                                       tesize, neededness, codeInfo, redef,
                                       constVarName, offset, printName);
    char* constTabEntry = OC_mkTabEntry(name, constVarName);
    char* constVarDec = OC_mkConstVarDec(constVarName);
    char* funcDec = OC_mkIsConstFuncDec(funcName);
    char* funcDef = OC_mkIsConstFuncDef(funcName, constVarName);
    char *myConstVarList, *myBuildPervConstBody, *myConstVarDecs,
        *myisConstFuncDecs, *myisConstFuncDefs;
    free(constVarName); free(funcName); free(tyskelName); free(tyskelText);
    myConstVarList = addLine(constVarList, constVar);
    free(constVarList); free(constVar);
    constVarList = myConstVarList;
    myBuildPervConstBody = addStr(buildPervConstBody, constTabEntry);
    free(buildPervConstBody); free(constTabEntry);
    buildPervConstBody = myBuildPervConstBody;
    myConstVarDecs = addStr(constVarDecs, constVarDec);
    free(constVarDecs); free(constVarDec);
    constVarDecs = myConstVarDecs;
    myisConstFuncDecs = addStr(isConstFuncDecs, funcDec);
    free(isConstFuncDecs); free(funcDec);
    isConstFuncDecs = myisConstFuncDecs;
    myisConstFuncDefs = addLine(isConstFuncDefs, funcDef);
    free(isConstFuncDefs); free(funcDef);
    isConstFuncDefs = myisConstFuncDefs;
}

canonical_original_code:
void ocamlGenConst(char *ind, char *name, char *cVarName, enum OP_Fixity fixity, struct OP_Prec prec, enum UTIL_Bool tyPrev, enum UTIL_Bool redef, int tesize, int tyskelInd, int neededness, int codeInfo, char *offset, char *printName)
{
    char *constVarName = OC_mkCVarName(cVarName);
    char *funcName = OC_mkIsConstFuncName(constVarName);
    char *tyskelText = UTIL_itoa(tyskelInd);
    char *tyskelName = OC_mkTySkelVarName(tyskelText);
    char *constVar = OC_mkConstVar(name, fixity, prec, tyPrev, tyskelName,
                                       tesize, neededness, codeInfo, redef,
                                       constVarName, offset, printName);
    char *constTabEntry = OC_mkTabEntry(name, constVarName);
    char *constVarDec = OC_mkConstVarDec(constVarName);
    char *funcDec = OC_mkIsConstFuncDec(funcName);
    char *funcDef = OC_mkIsConstFuncDef(funcName, constVarName);
    char *myConstVarList; char *myBuildPervConstBody; char *myConstVarDecs; char *myisConstFuncDecs; char *myisConstFuncDefs;
    free(constVarName); free(funcName); free(tyskelName); free(tyskelText);
    myConstVarList = addLine(constVarList, constVar);
    free(constVarList); free(constVar);
    constVarList = myConstVarList;
    myBuildPervConstBody = addStr(buildPervConstBody, constTabEntry);
    free(buildPervConstBody); free(constTabEntry);
    buildPervConstBody = myBuildPervConstBody;
    myConstVarDecs = addStr(constVarDecs, constVarDec);
    free(constVarDecs); free(constVarDec);
    constVarDecs = myConstVarDecs;
    myisConstFuncDecs = addStr(isConstFuncDecs, funcDec);
    free(isConstFuncDecs); free(funcDec);
    isConstFuncDecs = myisConstFuncDecs;
    myisConstFuncDefs = addLine(isConstFuncDefs, funcDef);
    free(isConstFuncDefs); free(funcDef);
    isConstFuncDefs = myisConstFuncDefs;
}

variable_types:
name
char *

variable_types:
cVarName
char *

variable_types: enum OP_Fixity { OP_INFIX=0, OP_INFIXL=1, OP_INFIXR=2, OP_PREFIX=3, OP_PREFIXR=4, OP_POSTFIX=5, OP_POSTFIXL=6, OP_NONE=7 }

variable_types: struct OP_Prec { enum OP_PrecTypeCat { OP_PREC=0, OP_PREC_NAME=1 } cat; union { int prec; char *name; } data; }

variable_types: enum UTIL_Bool { UTIL_FALSE=0, UTIL_TRUE=1 }

variable_types: tesize int

variable_types: tyskelInd int

variable_types: neededness int

variable_types: codeInfo int

variable_types:
offset
char *

variable_types:
printName
char *

variable_types:
constVarName
char *

variable_types:
funcName
char *

variable_types:
tyskelText
char *

variable_types:
tyskelName
char *

variable_types:
constVar
char *

variable_types:
constTabEntry
char *

variable_types:
constVarDec
char *

variable_types:
myConstVarList
char *

variable_types:
myBuildPervConstBody
char *

variable_types:
myConstVarDecs
char *

variable_types:
myisConstFuncDecs
char *

variable_types:
myisConstFuncDefs
char *

user_defined_types: struct OP_Prec { enum OP_PrecTypeCat cat; union { int prec; char *name; } data; }


ocamlGenConsts

decompiled_code:
void ocamlGenConsts()
{
char *v0; // r15
char *v1; // r12
char *v2; // r14
char *v3; // r13
char *v4; // rbp
size_t v5; // rbx
size_t v6; // rax
char *v7; // rbx
size_t v8; // rax
char *v9; // r15
size_t v10; // rax
size_t v11; // rax
size_t v12; // r13
size_t v13; // rbx
size_t v14; // rax
char *v15; // rbx
size_t v16; // rax
char *v17; // r12
size_t v18; // rax
size_t v19; // [rsp+0h] [rbp-58h]
size_t v20; // [rsp+8h] [rbp-50h]
void *ptr; // [rsp+10h] [rbp-48h]
char *v22; // [rsp+18h] [rbp-40h]

v22 = (char *)OC_mkFixedTySkels(tySkelVarList);
v0 = (char *)OC_mkGenericConstVar(constVarList);
v1 = (char *)OC_mkGenericConstVarDec(constVarDecs);
ptr = (void *)OC_mkGenericConstTabEntry(buildPervConstBody);
v2 = (char *)OC_mkBuildCTabFunc(ptr);
v3 = (char *)OC_mkGenericConstFuncDefs(isConstFuncDefs);
v4 = (char *)OC_mkGenericConstFuncDecs(isConstFuncDecs);
v20 = strlen(v0);
v5 = strlen(v2);
v19 = strlen(v3);
v6 = strlen(numConstsML);
tySkelVarList = v22;
v7 = (char *)UTIL_mallocStr(v6 + v19 + v20 + v5 + 4);
constML = v7;
strcpy(v7, v0);
free(v0);
v8 = strlen(v7);
v9 = numConstsML;
*(_WORD *)&v7[v8] = 10;
strcpy(&v7[v8 + 1], v9);
free(v9);
v10 = strlen(v7);
*(_WORD *)&v7[v10] = 2570;
strcpy(&v7[v10 + 2], v2);
free(v2);
free(ptr);
v11 = strlen(v7);
v7[v11] = 10;
strcpy(&v7[v11 + 1], v3);
free(v3);
v12 = strlen(v1);
v13 = strlen(v4);
v14 = strlen(numConstsMLI);
v15 = (char *)UTIL_mallocStr(v14 + v12 + v13 + 4);
constMLI = v15;
strcpy(v15, v1);
free(v1);
v16 = strlen(v15);
v17 = numConstsMLI;
strcpy(&v15[v16], "\n\n");
strcpy(&v15[v16 + 2], numConstsMLI);
free(v17);
v18 = strlen(v15);
*(_WORD *)&v15[v18] = 2570;
strcpy(&v15[v18 + 2], v4);
free(v4);
}

canonical_decompiled_code:
void func10()
{
char *v0; // r15
char *v1; // r12
char *v2; // r14
char *v3; // r13
char *v4; // rbp
size_t v5; // rbx
size_t v6; // rax
char *v7; // rbx
size_t v8; // rax
char *v9; // r15
size_t v10; // rax
size_t v11; // rax
size_t v12; // r13
size_t v13; // rbx
size_t v14; // rax
char *v15; // rbx
size_t v16; // rax
char *v17; // r12
size_t v18; // rax
size_t v19; // [rsp+0h] [rbp-58h]
size_t v20; // [rsp+8h] [rbp-50h]
void *ptr; // [rsp+10h] [rbp-48h]
char *v22; // [rsp+18h] [rbp-40h]

v22 = (char *)OC_mkFixedTySkels(tySkelVarList);
v0 = (char *)OC_mkGenericConstVar(constVarList);
v1 = (char *)OC_mkGenericConstVarDec(constVarDecs);
ptr = (void *)OC_mkGenericConstTabEntry(buildPervConstBody);
v2 = (char *)OC_mkBuildCTabFunc(ptr);
v3 = (char *)OC_mkGenericConstFuncDefs(isConstFuncDefs);
v4 = (char *)OC_mkGenericConstFuncDecs(isConstFuncDecs);
v20 = strlen(v0);
v5 = strlen(v2);
v19 = strlen(v3);
v6 = strlen(numConstsML);
tySkelVarList = v22;
v7 = (char *)UTIL_mallocStr(v6 + v19 + v20 + v5 + 4);
constML = v7;
strcpy(v7, v0);
free(v0);
v8 = strlen(v7);
v9 = numConstsML;
*(_WORD *)&v7[v8] = 10;
strcpy(&v7[v8 + 1], v9);
free(v9);
v10 = strlen(v7);
*(_WORD *)&v7[v10] = 2570;
strcpy(&v7[v10 + 2], v2);
free(v2);
free(ptr);
v11 = strlen(v7);
v7[v11] = 10;
strcpy(&v7[v11 + 1], v3);
free(v3);
v12 = strlen(v1);
v13 = strlen(v4);
v14 = strlen(numConstsMLI);
v15 = (char *)UTIL_mallocStr(v14 + v12 + v13 + 4);
constMLI = v15;
strcpy(v15, v1);
free(v1);
v16 = strlen(v15);
v17 = numConstsMLI;
strcpy(&v15[v16], "\n\n");
strcpy(&v15[v16 + 2], numConstsMLI);
free(v17);
v18 = strlen(v15);
*(_WORD *)&v15[v18] = 2570;
strcpy(&v15[v18 + 2], v4);
free(v4);
}

original_code:
void ocamlGenConsts()
{
    char* tyskels = OC_mkFixedTySkels(tySkelVarList);
    char* varDefs = OC_mkGenericConstVar(constVarList);
    char* varDecs = OC_mkGenericConstVarDec(constVarDecs);
    char* buildFuncBody = OC_mkGenericConstTabEntry(buildPervConstBody);
    char* buildTabFunc = OC_mkBuildCTabFunc(buildFuncBody);
    char* funcDefs = OC_mkGenericConstFuncDefs(isConstFuncDefs);
    char* funcDecs = OC_mkGenericConstFuncDecs(isConstFuncDecs);
    size_t length = strlen(varDefs) + strlen(buildTabFunc) + strlen(funcDefs)
        + strlen(numConstsML) + 4;
    tySkelVarList = tyskels;
    constML = UTIL_mallocStr(length);
    strcpy(constML, varDefs); free(varDefs);
    strcat(constML, "\n");
    strcat(constML, numConstsML); free(numConstsML);
    strcat(constML, "\n\n");
    strcat(constML, buildTabFunc); free(buildTabFunc); free(buildFuncBody);
    strcat(constML, "\n");
    strcat(constML, funcDefs); free(funcDefs);
    length = strlen(varDecs) + strlen(funcDecs) + strlen(numConstsMLI) + 4;
    constMLI = UTIL_mallocStr(length);
    strcpy(constMLI, varDecs); free(varDecs);
    strcat(constMLI, "\n\n");
    strcat(constMLI, numConstsMLI); free(numConstsMLI);
    strcat(constMLI, "\n\n");
    strcat(constMLI, funcDecs); free(funcDecs);
}

canonical_original_code:
void ocamlGenConsts()
{
    char *tyskels = OC_mkFixedTySkels(tySkelVarList);
    char *varDefs = OC_mkGenericConstVar(constVarList);
    char *varDecs = OC_mkGenericConstVarDec(constVarDecs);
    char *buildFuncBody = OC_mkGenericConstTabEntry(buildPervConstBody);
    char *buildTabFunc = OC_mkBuildCTabFunc(buildFuncBody);
    char *funcDefs = OC_mkGenericConstFuncDefs(isConstFuncDefs);
    char *funcDecs = OC_mkGenericConstFuncDecs(isConstFuncDecs);
    unsigned long length = strlen(varDefs) + strlen(buildTabFunc) + strlen(funcDefs)
        + strlen(numConstsML) + 4;
    tySkelVarList = tyskels;
    constML = UTIL_mallocStr(length);
    strcpy(constML, varDefs); free(varDefs);
    strcat(constML, "\n");
    strcat(constML, numConstsML); free(numConstsML);
    strcat(constML, "\n\n");
    strcat(constML, buildTabFunc); free(buildTabFunc); free(buildFuncBody);
    strcat(constML, "\n");
    strcat(constML, funcDefs); free(funcDefs);
    length = strlen(varDecs) + strlen(funcDecs) + strlen(numConstsMLI) + 4;
    constMLI = UTIL_mallocStr(length);
    strcpy(constMLI, varDecs); free(varDecs);
    strcat(constMLI, "\n\n");
    strcat(constMLI, numConstsMLI); free(numConstsMLI);
    strcat(constMLI, "\n\n");
    strcat(constMLI, funcDecs); free(funcDecs);
}

variable_types:
tyskels
char *

variable_types:
varDefs
char *

variable_types:
varDecs
char *

variable_types:
buildFuncBody
char *

variable_types:
buildTabFunc
char *

variable_types:
funcDefs
char *

variable_types:
funcDecs
char *

variable_types:
length
unsigned long


ocamlCollectConsts

decompiled_code:
void __fastcall ocamlCollectConsts(__int64 a1, int a2)
{
void *v2; // rbp
void *v3; // r12
__int64 v4; // rbx
void *v5; // rdi

v2 = (void *)OC_mkCVarName(a1);
v3 = (void *)OC_mkCompare(v2);
free(v2);
if ( !a2 && constProperty )
{
v4 = OC_mkOr(v3);
free(constProperty);
v5 = v3;
v3 = (void *)v4;
free(v5);
}
constProperty = v3;
}

canonical_decompiled_code:
void __fastcall func11(__int64 a1, int a2)
{
void *v2; // rbp
void *v3; // r12
__int64 v4; // rbx
void *v5; // rdi

v2 = (void *)OC_mkCVarName(a1);
v3 = (void *)OC_mkCompare(v2);
free(v2);
if ( !a2 && constProperty )
{
v4 = OC_mkOr(v3);
free(constProperty);
v5 = v3;
v3 = (void *)v4;
free(v5);
}
constProperty = v3;
}

original_code:
void ocamlCollectConsts(char* name, int last)
{
    char* constName = OC_mkCVarName(name);
    char* cond = OC_mkCompare(constName);
    char* body;
    free(constName);
    if (last) body = cond;
    else {
        if (constProperty) {
            body = OC_mkOr(cond, constProperty);
            free(constProperty);
            free(cond);
        } else body = cond;
    }
    constProperty = body;
}

canonical_original_code:
void ocamlCollectConsts(char *name, int last)
{
    char *constName = OC_mkCVarName(name);
    char *cond = OC_mkCompare(constName);
    char *body;
    free(constName);
    if (last) body = cond;
    else {
        if (constProperty) {
            body = OC_mkOr(cond, constProperty);
            free(constProperty);
            free(cond);
        } else body = cond;
    }
    constProperty = body;
}

variable_types:
name
char *

variable_types: last int

variable_types:
constName
char *

variable_types:
cond
char *

variable_types:
body
char *


ocamlGenRC

decompiled_code:
void ocamlGenRC()
{
regClob = (void *)OC_mkRegClobFunc(constProperty);
free(constProperty);
constProperty = 0LL;
}

canonical_decompiled_code:
void func12()
{
regClob = (void *)OC_mkRegClobFunc(constProperty);
free(constProperty);
constProperty = 0LL;
}

original_code:
void ocamlGenRC()
{
    regClob = OC_mkRegClobFunc(constProperty);
    free(constProperty);
    constProperty = ((void *)0);
}


ocamlGenBC

decompiled_code:
void ocamlGenBC()
{
backTrack = (void *)OC_mkBackTrackFunc(constProperty);
free(constProperty);
constProperty = 0LL;
}

canonical_decompiled_code:
void func13()
{
backTrack = (void *)OC_mkBackTrackFunc(constProperty);
free(constProperty);
constProperty = 0LL;
}

original_code:
void ocamlGenBC()
{
    backTrack = OC_mkBackTrackFunc(constProperty);
    free(constProperty);
    constProperty = ((void *)0);
}


arrayInit

decompiled_code:
void *__fastcall arrayInit(void *a1, int a2)
{
void *result; // rax

if ( a2 > 0 )
result = memset(a1, 0, 8LL * a2);
return result;
}

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

if ( a2 > 0 )
result = memset(a1, 0, 8LL * a2);
return result;
}

original_code:
static void arrayInit(char **array, int size)
{
    int i ;
    for (i =0; i < size; i++) array[i] = ((void *)0);
}

canonical_original_code:
static void arrayInit(char **array, int size)
{
    int i;
    for (i =0; i < size; i++) array[i] = ((void *)0);
}

variable_types:
array
char **

variable_types: size int

variable_types: i int


cgenFixedH

decompiled_code:
void *cgenFixedH()
{
void *result; // rax

pervBegH = (void *)C_mkFixedBegH();
result = (void *)C_mkFixedEndH();
pervEndH = result;
return result;
}

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

pervBegH = (void *)C_mkFixedBegH();
result = (void *)C_mkFixedEndH();
pervEndH = result;
return result;
}

original_code:
static void cgenFixedH()
{
    pervBegH = C_mkFixedBegH();
    pervEndH = C_mkFixedEndH();
}


cgenFixedC

decompiled_code:
void *cgenFixedC()
{
void *result; // rax

pervBegC = (void *)C_mkFixedBegC();
result = (void *)C_mkFixedEndC();
pervEndC = result;
return result;
}

canonical_decompiled_code:
void *func2()
{
void *result; // rax

pervBegC = (void *)C_mkFixedBegC();
result = (void *)C_mkFixedEndC();
pervEndC = result;
return result;
}

original_code:
static void cgenFixedC()
{
    pervBegC = C_mkFixedBegC();
    pervEndC = C_mkFixedEndC();
}


cgenTySkelTabInit

decompiled_code:
__int64 cgenTySkelTabInit()
{
char *v0; // rbp
__int64 v1; // r12

v0 = collectStringArray_isra_0((void *)tySkels, dword_D58, (const char *)&unk_DB8);
v1 = C_mkTySkelTabInit(v0, C_totalSpace);
free(v0);
return v1;
}

canonical_decompiled_code:
__int64 func4()
{
char *v0; // rbp
__int64 v1; // r12

v0 = func3((void *)tySkels, dword_D58, (const char *)&unk_DB8);
v1 = C_mkTySkelTabInit(v0, C_totalSpace);
free(v0);
return v1;
}

original_code:
static char* cgenTySkelTabInit()
{
    char* body = collectStringArray(tySkels, "");
    char* text = C_mkTySkelTabInit(body, C_totalSpace);
    free(body);
    return text;
}

canonical_original_code:
static char *cgenTySkelTabInit()
{
    char *body = collectStringArray(tySkels, "");
    char *text = C_mkTySkelTabInit(body, C_totalSpace);
    free(body);
    return text;
}

variable_types:
text
char *


cgenNumKinds

decompiled_code:
void *cgenNumKinds()
{
void *result; // rax

result = (void *)C_mkNumKinds();
numKinds = result;
return result;
}

canonical_decompiled_code:
void *func5()
{
void *result; // rax

result = (void *)C_mkNumKinds();
numKinds = result;
return result;
}

original_code:
void cgenNumKinds(char* num)
{
    numKinds = C_mkNumKinds(num);
}

canonical_original_code:
void cgenNumKinds(char *num)
{
    numKinds = C_mkNumKinds(num);
}

variable_types:
num
char *


cgenKindIndex

decompiled_code:
__int64 __fastcall cgenKindIndex(int a1, __int64 a2, __int64 a3, __int64 a4)
{
char *v4; // r12
size_t v5; // rax
char *v6; // rbp
__int64 result; // rax

if ( dword_DA8 <= a1 )
{
fwrite("kind index exceed total number of kinds\n", 1uLL, 0x28uLL, stderr);
exit(1);
}
v4 = (char *)C_mkIndex(a2, a3, a4);
v5 = strlen(v4);
v6 = (char *)UTIL_mallocStr(v5 + 2);
strcpy(v6, v4);
free(v4);
if ( dword_DA8 - 1 != a1 )
*(_WORD *)&v6[strlen(v6)] = 44;
*(_WORD *)&v6[strlen(v6)] = 10;
result = kindIndices;
*(_QWORD *)(kindIndices + 8LL * a1) = v6;
return result;
}

canonical_decompiled_code:
__int64 __fastcall func6(int a1, __int64 a2, __int64 a3, __int64 a4)
{
char *v4; // r12
size_t v5; // rax
char *v6; // rbp
__int64 result; // rax

if ( dword_DA8 <= a1 )
{
fwrite("kind index exceed total number of kinds\n", 1uLL, 0x28uLL, stderr);
exit(1);
}
v4 = (char *)C_mkIndex(a2, a3, a4);
v5 = strlen(v4);
v6 = (char *)UTIL_mallocStr(v5 + 2);
strcpy(v6, v4);
free(v4);
if ( dword_DA8 - 1 != a1 )
*(_WORD *)&v6[strlen(v6)] = 44;
*(_WORD *)&v6[strlen(v6)] = 10;
result = kindIndices;
*(_QWORD *)(kindIndices + 8LL * a1) = v6;
return result;
}

original_code:
void cgenKindIndex(int index, char* name, char* indexT, char* comments)
{
    char* kindIndex;
    char* kindIndexText;
    if (index >= kindIndices.length) {
        fprintf(stderr, "kind index exceed total number of kinds\n");
        exit(1);
    }
    kindIndex = C_mkIndex(name, indexT, comments);
    kindIndexText = UTIL_mallocStr(strlen(kindIndex) + 2);
    strcpy(kindIndexText, kindIndex); free(kindIndex);
    if (index != (kindIndices.length - 1)) strcat(kindIndexText, ",");
    strcat(kindIndexText, "\n");
    kindIndices.array[index] = kindIndexText;
}

canonical_original_code:
void cgenKindIndex(int index, char *name, char *indexT, char *comments)
{
    char *kindIndex;
    char *kindIndexText;
    if (index >= kindIndices.length) {
        fprintf(stderr, "kind index exceed total number of kinds\n");
        exit(1);
    }
    kindIndex = C_mkIndex(name, indexT, comments);
    kindIndexText = UTIL_mallocStr(strlen(kindIndex) + 2);
    strcpy(kindIndexText, kindIndex); free(kindIndex);
    if (index != (kindIndices.length - 1)) strcat(kindIndexText, ",");
    strcat(kindIndexText, "\n");
    kindIndices.array[index] = kindIndexText;
}

variable_types: index int

variable_types:
indexT
char *

variable_types:
comments
char *

variable_types:
kindIndex
char *

variable_types:
kindIndexText
char *


cgenKindH

decompiled_code:
void cgenKindH()
{
char *v0; // rbp
char *v1; // r13
void *v2; // r12

v0 = (char *)C_mkEmptyComments();
v1 = collectStringArray_isra_0((void *)kindIndices, dword_DA8, v0);
v2 = (void *)C_mkKindIndexType(v1);
kindH = (void *)C_mkKindH(v2, numKinds);
free(v1);
free(v2);
free(numKinds);
free(v0);
}

canonical_decompiled_code:
void func7()
{
char *v0; // rbp
char *v1; // r13
void *v2; // r12

v0 = (char *)C_mkEmptyComments();
v1 = func3((void *)kindIndices, dword_DA8, v0);
v2 = (void *)C_mkKindIndexType(v1);
kindH = (void *)C_mkKindH(v2, numKinds);
free(v1);
free(v2);
free(numKinds);
free(v0);
}

original_code:
void cgenKindH()
{
    char* emptyText = C_mkEmptyComments();
    char* kindIndexBody = collectStringArray(kindIndices, emptyText);
    char* kindIndexTypeDef = C_mkKindIndexType(kindIndexBody);
    kindH = C_mkKindH(kindIndexTypeDef, numKinds);
    free(kindIndexBody); free(kindIndexTypeDef); free(numKinds);
    free(emptyText);
}

canonical_original_code:
void cgenKindH()
{
    char *emptyText = C_mkEmptyComments();
    char *kindIndexBody = collectStringArray(kindIndices, emptyText);
    char *kindIndexTypeDef = C_mkKindIndexType(kindIndexBody);
    kindH = C_mkKindH(kindIndexTypeDef, numKinds);
    free(kindIndexBody); free(kindIndexTypeDef); free(numKinds);
    free(emptyText);
}

variable_types:
emptyText
char *

variable_types:
kindIndexBody
char *

variable_types:
kindIndexTypeDef
char *


cgenKindData

decompiled_code:
__int64 __fastcall cgenKindData(int a1, __int64 a2, __int64 a3, __int64 a4)
{
char *v4; // r12
size_t v5; // rax
char *v6; // rbp
__int64 result; // rax

if ( dword_D88 <= a1 )
{
fwrite("kind index exceed total number of kinds\n", 1uLL, 0x28uLL, stderr);
exit(1);
}
v4 = (char *)C_mkKindTabEntry(a2, a3, a4);
v5 = strlen(v4);
v6 = (char *)UTIL_mallocStr(v5 + 2);
strcpy(v6, v4);
free(v4);
if ( dword_D88 - 1 != a1 )
*(_WORD *)&v6[strlen(v6)] = 44;
*(_WORD *)&v6[strlen(v6)] = 10;
result = kindData;
*(_QWORD *)(kindData + 8LL * a1) = v6;
return result;
}

canonical_decompiled_code:
__int64 __fastcall func8(int a1, __int64 a2, __int64 a3, __int64 a4)
{
char *v4; // r12
size_t v5; // rax
char *v6; // rbp
__int64 result; // rax

if ( dword_D88 <= a1 )
{
fwrite("kind index exceed total number of kinds\n", 1uLL, 0x28uLL, stderr);
exit(1);
}
v4 = (char *)C_mkKindTabEntry(a2, a3, a4);
v5 = strlen(v4);
v6 = (char *)UTIL_mallocStr(v5 + 2);
strcpy(v6, v4);
free(v4);
if ( dword_D88 - 1 != a1 )
*(_WORD *)&v6[strlen(v6)] = 44;
*(_WORD *)&v6[strlen(v6)] = 10;
result = kindData;
*(_QWORD *)(kindData + 8LL * a1) = v6;
return result;
}

original_code:
void cgenKindData(int index, char* name, char* arity, char* comments)
{
    char* oneKindData;
    char* kindDataText;
    if (index >= kindData.length) {
      fprintf(stderr, "kind index exceed total number of kinds\n");
      exit(1);
    }
    oneKindData = C_mkKindTabEntry(name, arity, comments);
    kindDataText = UTIL_mallocStr(strlen(oneKindData) + 2);
    strcpy(kindDataText, oneKindData); free(oneKindData);
    if (index != kindData.length - 1) strcat(kindDataText, ",");
    strcat(kindDataText, "\n");
    kindData.array[index] = kindDataText;
}

canonical_original_code:
void cgenKindData(int index, char *name, char *arity, char *comments)
{
    char *oneKindData;
    char *kindDataText;
    if (index >= kindData.length) {
      fprintf(stderr, "kind index exceed total number of kinds\n");
      exit(1);
    }
    oneKindData = C_mkKindTabEntry(name, arity, comments);
    kindDataText = UTIL_mallocStr(strlen(oneKindData) + 2);
    strcpy(kindDataText, oneKindData); free(oneKindData);
    if (index != kindData.length - 1) strcat(kindDataText, ",");
    strcat(kindDataText, "\n");
    kindData.array[index] = kindDataText;
}

variable_types:
name
char *

variable_types:
arity
char *

variable_types:
oneKindData
char *

variable_types:
kindDataText
char *


cgenKindC

decompiled_code:
void cgenKindC()
{
char *v0; // r12
void *v1; // rbp

v0 = collectStringArray_isra_0((void *)kindData, dword_D88, " //nothing \n {NULL, 0},\n");
v1 = (void *)C_mkKindTab(v0);
kindC = (void *)C_mkKindC(v1);
free(v0);
free(v1);
}

canonical_decompiled_code:
void func9()
{
char *v0; // r12
void *v1; // rbp

v0 = func3((void *)kindData, dword_D88, " //nothing \n {NULL, 0},\n");
v1 = (void *)C_mkKindTab(v0);
kindC = (void *)C_mkKindC(v1);
free(v0);
free(v1);
}

original_code:
void cgenKindC()
{
    char* kindTabBody = collectStringArray(kindData, "    //nothing \n    {NULL,    0},\n");
    char* kindTab = C_mkKindTab(kindTabBody);
    kindC = C_mkKindC(kindTab);
    free(kindTabBody); free(kindTab);
}

canonical_original_code:
void cgenKindC()
{
    char *kindTabBody = collectStringArray(kindData, "    //nothing \n    {NULL,    0},\n");
    char *kindTab = C_mkKindTab(kindTabBody);
    kindC = C_mkKindC(kindTab);
    free(kindTabBody); free(kindTab);
}

variable_types:
kindTabBody
char *

variable_types:
kindTab
char *


cgenKindInit

decompiled_code:
void *__fastcall cgenKindInit(int a1)
{
dword_DA8 = a1;
kindIndices = UTIL_malloc(8LL * a1);
arrayInit((void *)kindIndices, a1);
dword_D88 = a1;
kindData = UTIL_malloc(8LL * a1);
return arrayInit((void *)kindData, a1);
}

canonical_decompiled_code:
void *__fastcall func10(int a1)
{
dword_DA8 = a1;
kindIndices = UTIL_malloc(8LL * a1);
func0((void *)kindIndices, a1);
dword_D88 = a1;
kindData = UTIL_malloc(8LL * a1);
return func0((void *)kindData, a1);
}

original_code:
void cgenKindInit(int length)
{
    kindIndices.length = length;
    kindIndices.array = (char**)UTIL_malloc(sizeof(char*)*length);
    arrayInit(kindIndices.array, length);
    kindData.length = length;
    kindData.array = (char**)UTIL_malloc(sizeof(char*)*length);
    arrayInit(kindData.array, length);
}

canonical_original_code:
void cgenKindInit(int length)
{
    kindIndices.length = length;
    kindIndices.array = (char **)UTIL_malloc(sizeof(char *)*length);
    arrayInit(kindIndices.array, length);
    kindData.length = length;
    kindData.array = (char **)UTIL_malloc(sizeof(char *)*length);
    arrayInit(kindData.array, length);
}

variable_types: length int


cgenNumTySkels

decompiled_code:
void *cgenNumTySkels()
{
void *result; // rax

result = (void *)C_mkNumTySkels();
numTySkels = result;
return result;
}

canonical_decompiled_code:
void *func11()
{
void *result; // rax

result = (void *)C_mkNumTySkels();
numTySkels = result;
return result;
}

original_code:
void cgenNumTySkels(char* num)
{
    numTySkels = C_mkNumTySkels(num);
}

canonical_original_code:
void cgenNumTySkels(char *num)
{
    numTySkels = C_mkNumTySkels(num);
}


cgenTySkelsH

decompiled_code:
void cgenTySkelsH()
{
tySkelsH = (void *)C_mkTySkelsH(numTySkels);
free(numTySkels);
}

canonical_decompiled_code:
void func12()
{
tySkelsH = (void *)C_mkTySkelsH(numTySkels);
free(numTySkels);
}

original_code:
void cgenTySkelsH()
{
    tySkelsH = C_mkTySkelsH(numTySkels);
    free(numTySkels);
}


cgenTySkelTab

decompiled_code:
__int64 __fastcall cgenTySkelTab(int a1, __int64 a2, __int64 a3)
{
__int64 *v3; // rbx
__int64 result; // rax

if ( dword_D58 <= a1 )
{
fwrite("type skeleton index exceed total number of type skeletons\n", 1uLL, 0x3AuLL, stderr);
exit(1);
}
v3 = (__int64 *)(tySkels + 8LL * a1);
result = C_genTySkel(a2, a3);
*v3 = result;
return result;
}

canonical_decompiled_code:
__int64 __fastcall func13(int a1, __int64 a2, __int64 a3)
{
__int64 *v3; // rbx
__int64 result; // rax

if ( dword_D58 <= a1 )
{
fwrite("type skeleton index exceed total number of type skeletons\n", 1uLL, 0x3AuLL, stderr);
exit(1);
}
v3 = (__int64 *)(tySkels + 8LL * a1);
result = C_genTySkel(a2, a3);
*v3 = result;
return result;
}

original_code:
void cgenTySkelTab(int index, Type tyskel, char* comments)
{
    if (index >= tySkels.length){
        fprintf(stderr,
                "type skeleton index exceed total number of type skeletons\n");
        exit(1);
    }
    tySkels.array[index] = C_genTySkel(tyskel, comments);
}

canonical_original_code:
void cgenTySkelTab(int index, struct Type_ *tyskel, char *comments)
{
    if (index >= tySkels.length){
        fprintf(stderr,
                "type skeleton index exceed total number of type skeletons\n");
        exit(1);
    }
    tySkels.array[index] = C_genTySkel(tyskel, comments);
}

variable_types: struct Type_ { enum TypeCats { SORT=0, SKVAR=1, ARROW=2, STR=3, FUNC=4 } tag; union { char *sort; char *skvar; struct FuncInfo { char *name; char *arity; } func; struct ArrowInfo { struct Type_ *lop; struct Type_ *rop; } arrow; struct StrInfo { struct Type_ *functor; int arity; struct TypeList_ { struct Type_ *oneType; struct TypeList_ *next; } *args; } str; } data; } *


cgenTySkelInit

decompiled_code:
void *__fastcall cgenTySkelInit(int a1)
{
if ( !a1 )
{
fwrite("The number of type skeletons cannot be 0\n", 1uLL, 0x29uLL, stderr);
exit(1);
}
dword_D58 = a1;
tySkels = UTIL_malloc(8LL * a1);
return arrayInit((void *)tySkels, a1);
}

canonical_decompiled_code:
void *__fastcall func14(int a1)
{
if ( !a1 )
{
fwrite("The number of type skeletons cannot be 0\n", 1uLL, 0x29uLL, stderr);
exit(1);
}
dword_D58 = a1;
tySkels = UTIL_malloc(8LL * a1);
return func0((void *)tySkels, a1);
}

original_code:
void cgenTySkelInit(int length)
{
    if (length == 0) {
        fprintf(stderr, "The number of type skeletons cannot be 0\n");
        exit(1);
    }
    tySkels.length = length;
    tySkels.array = (char**)UTIL_malloc(sizeof(char*)*length);
    arrayInit(tySkels.array, length);
}

canonical_original_code:
void cgenTySkelInit(int length)
{
    if (length == 0) {
        fprintf(stderr, "The number of type skeletons cannot be 0\n");
        exit(1);
    }
    tySkels.length = length;
    tySkels.array = (char **)UTIL_malloc(sizeof(char *)*length);
    arrayInit(tySkels.array, length);
}


cgenTySkelsC

decompiled_code:
void cgenTySkelsC()
{
void *v0; // rbp

v0 = (void *)cgenTySkelTabInit();
tySkelsC = (void *)C_mkTySkelsC(v0);
free(v0);
}

canonical_decompiled_code:
void func15()
{
void *v0; // rbp

v0 = (void *)func4();
tySkelsC = (void *)C_mkTySkelsC(v0);
free(v0);
}

original_code:
void cgenTySkelsC()
{
    char* tySkelTab = cgenTySkelTabInit();
    tySkelsC = C_mkTySkelsC(tySkelTab); free(tySkelTab);
}

canonical_original_code:
void cgenTySkelsC()
{
    char *tySkelTab = cgenTySkelTabInit();
    tySkelsC = C_mkTySkelsC(tySkelTab); free(tySkelTab);
}

variable_types:
tySkelTab
char *


cgenNumConsts

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

result = C_mkNumConsts();
numConsts = result;
return result;
}

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

result = C_mkNumConsts();
numConsts = result;
return result;
}

original_code:
void cgenNumConsts(char* num)
{
    numConsts = C_mkNumConsts(num);
}

canonical_original_code:
void cgenNumConsts(char *num)
{
    numConsts = C_mkNumConsts(num);
}

variable_types:
num
char *


cgenConstIndex

decompiled_code:
__int64 __fastcall cgenConstIndex(int a1, __int64 a2, __int64 a3, __int64 a4)
{
const char *v4; // r12
size_t v5; // rax
char *v6; // rbp
char *v7; // rdx
__int64 result; // rax

if ( dword_D38 <= a1 )
{
fwrite("constant index exceed total number of constants\n", 1uLL, 0x30uLL, stderr);
exit(1);
}
v4 = (const char *)C_mkIndex(a2, a3, a4);
v5 = strlen(v4);
v6 = (char *)UTIL_mallocStr(v5 + 2);
v7 = stpcpy(v6, v4);
if ( dword_D38 - 1 != a1 )
*(_WORD *)v7 = 44;
*(_WORD *)&v6[strlen(v6)] = 10;
result = constIndices;
*(_QWORD *)(constIndices + 8LL * a1) = v6;
return result;
}

canonical_decompiled_code:
__int64 __fastcall func17(int a1, __int64 a2, __int64 a3, __int64 a4)
{
const char *v4; // r12
size_t v5; // rax
char *v6; // rbp
char *v7; // rdx
__int64 result; // rax

if ( dword_D38 <= a1 )
{
fwrite("constant index exceed total number of constants\n", 1uLL, 0x30uLL, stderr);
exit(1);
}
v4 = (const char *)C_mkIndex(a2, a3, a4);
v5 = strlen(v4);
v6 = (char *)UTIL_mallocStr(v5 + 2);
v7 = stpcpy(v6, v4);
if ( dword_D38 - 1 != a1 )
*(_WORD *)v7 = 44;
*(_WORD *)&v6[strlen(v6)] = 10;
result = constIndices;
*(_QWORD *)(constIndices + 8LL * a1) = v6;
return result;
}

original_code:
void cgenConstIndex(int index, char* name, char* indexT, char* comments)
{
    char* constIndex;
    char* constIndexText;
    if (index >= constIndices.length) {
        fprintf(stderr, "constant index exceed total number of constants\n");
        exit(1);
    }
    constIndex = C_mkIndex(name, indexT, comments);
    constIndexText = UTIL_mallocStr(strlen(constIndex) + 2);
    strcpy(constIndexText, constIndex);
    if (index != (constIndices.length - 1)) strcat(constIndexText, ",");
    strcat(constIndexText, "\n");
    constIndices.array[index] = constIndexText;
}

canonical_original_code:
void cgenConstIndex(int index, char *name, char *indexT, char *comments)
{
    char *constIndex;
    char *constIndexText;
    if (index >= constIndices.length) {
        fprintf(stderr, "constant index exceed total number of constants\n");
        exit(1);
    }
    constIndex = C_mkIndex(name, indexT, comments);
    constIndexText = UTIL_mallocStr(strlen(constIndex) + 2);
    strcpy(constIndexText, constIndex);
    if (index != (constIndices.length - 1)) strcat(constIndexText, ",");
    strcat(constIndexText, "\n");
    constIndices.array[index] = constIndexText;
}

variable_types: index int

variable_types:
indexT
char *

variable_types:
constIndex
char *

variable_types:
constIndexText
char *


cgenLogicSymbolInit

decompiled_code:
void *__fastcall cgenLogicSymbolInit(int a1)
{
dword_D28 = a1;
logicSymbTypes = UTIL_malloc(8LL * a1);
return arrayInit((void *)logicSymbTypes, a1);
}

canonical_decompiled_code:
void *__fastcall func18(int a1)
{
dword_D28 = a1;
logicSymbTypes = UTIL_malloc(8LL * a1);
return func0((void *)logicSymbTypes, a1);
}

original_code:
void cgenLogicSymbolInit(int length)
{
    logicSymbTypes.length = length;
    logicSymbTypes.array = (char**)UTIL_malloc(sizeof(char*)*length);
    arrayInit(logicSymbTypes.array, length);
}

canonical_original_code:
void cgenLogicSymbolInit(int length)
{
    logicSymbTypes.length = length;
    logicSymbTypes.array = (char **)UTIL_malloc(sizeof(char *)*length);
    arrayInit(logicSymbTypes.array, length);
}


cgenLogicSymbType

decompiled_code:
__int64 __fastcall cgenLogicSymbType(int a1, __int64 a2, __int64 a3)
{
const char *v3; // r12
size_t v4; // rax
char *v5; // rbp
char *v6; // rdx
__int64 result; // rax

if ( dword_D28 <= a1 )
{
fwrite("logic symbol type index exceed the total number of logic symbols\n", 1uLL, 0x41uLL, stderr);
exit(1);
}
v3 = (const char *)C_mkIndex2(a2, a3);
v4 = strlen(v3);
v5 = (char *)UTIL_mallocStr(v4 + 2);
v6 = stpcpy(v5, v3);
if ( dword_D38 - 1 != a1 )
*(_WORD *)v6 = 44;
*(_WORD *)&v5[strlen(v5)] = 10;
result = logicSymbTypes;
*(_QWORD *)(logicSymbTypes + 8LL * a1) = v5;
return result;
}

canonical_decompiled_code:
__int64 __fastcall func19(int a1, __int64 a2, __int64 a3)
{
const char *v3; // r12
size_t v4; // rax
char *v5; // rbp
char *v6; // rdx
__int64 result; // rax

if ( dword_D28 <= a1 )
{
fwrite("logic symbol type index exceed the total number of logic symbols\n", 1uLL, 0x41uLL, stderr);
exit(1);
}
v3 = (const char *)C_mkIndex2(a2, a3);
v4 = strlen(v3);
v5 = (char *)UTIL_mallocStr(v4 + 2);
v6 = stpcpy(v5, v3);
if ( dword_D38 - 1 != a1 )
*(_WORD *)v6 = 44;
*(_WORD *)&v5[strlen(v5)] = 10;
result = logicSymbTypes;
*(_QWORD *)(logicSymbTypes + 8LL * a1) = v5;
return result;
}

original_code:
void cgenLogicSymbType(int index, char* name, char* indexT)
{
    char* constIndex;
    char* constIndexText;
    if (index >= logicSymbTypes.length) {
         fprintf(stderr, "logic symbol type index exceed the total number of logic symbols\n");
         exit(1);
    }
    constIndex = C_mkIndex2(name, indexT);
    constIndexText = UTIL_mallocStr(strlen(constIndex) + 2);
    strcpy(constIndexText, constIndex);
    if (index != (constIndices.length - 1)) strcat(constIndexText, ",");
    strcat(constIndexText, "\n");
    logicSymbTypes.array[index] = constIndexText;
}

canonical_original_code:
void cgenLogicSymbType(int index, char *name, char *indexT)
{
    char *constIndex;
    char *constIndexText;
    if (index >= logicSymbTypes.length) {
         fprintf(stderr, "logic symbol type index exceed the total number of logic symbols\n");
         exit(1);
    }
    constIndex = C_mkIndex2(name, indexT);
    constIndexText = UTIL_mallocStr(strlen(constIndex) + 2);
    strcpy(constIndexText, constIndex);
    if (index != (constIndices.length - 1)) strcat(constIndexText, ",");
    strcat(constIndexText, "\n");
    logicSymbTypes.array[index] = constIndexText;
}


cgenLSRange

decompiled_code:
char *cgenLSRange()
{
char *result; // rax

result = (char *)C_mkLSRange();
lsRange = result;
return result;
}

canonical_decompiled_code:
char *func20()
{
char *result; // rax

result = (char *)C_mkLSRange();
lsRange = result;
return result;
}

original_code:
void cgenLSRange(char* start, char* end)
{
    lsRange = C_mkLSRange(start, end);
}

canonical_original_code:
void cgenLSRange(char *start, char *end)
{
    lsRange = C_mkLSRange(start, end);
}

variable_types:
start
char *

variable_types:
end
char *


cgenPREDRange

decompiled_code:
char *cgenPREDRange()
{
char *result; // rax

result = (char *)C_mkPredRange();
predRange = result;
return result;
}

canonical_decompiled_code:
char *func21()
{
char *result; // rax

result = (char *)C_mkPredRange();
predRange = result;
return result;
}

original_code:
void cgenPREDRange(char* start, char* end)
{
    predRange = C_mkPredRange(start, end);
}

canonical_original_code:
void cgenPREDRange(char *start, char *end)
{
    predRange = C_mkPredRange(start, end);
}


cgenConstProperty

decompiled_code:
void cgenConstProperty()
{
char *v0; // r13
char *v1; // r12
char *v2; // rbp
size_t v3; // rbx
size_t v4; // r14
size_t v5; // rax
void *v6; // rax
char *v7; // r15
char *v8; // rax
char *v9; // r14
char *v10; // rax

v0 = (char *)C_mkEmptyComments();
v1 = collectStringArray_isra_0((void *)logicSymbTypes, dword_D28, v0);
v2 = (char *)C_mkLSTypeDec(v1);
v3 = strlen(v2);
v4 = strlen(lsRange);
v5 = strlen(predRange);
v6 = (void *)UTIL_mallocStr(v4 + v3 + v5);
v7 = lsRange;
constProperty = v6;
v8 = stpcpy((char *)v6, lsRange);
v9 = predRange;
v10 = stpcpy(v8, predRange);
strcpy(v10, v2);
free(v0);
free(v1);
free(v2);
free(v7);
free(v9);
}

canonical_decompiled_code:
void func22()
{
char *v0; // r13
char *v1; // r12
char *v2; // rbp
size_t v3; // rbx
size_t v4; // r14
size_t v5; // rax
void *v6; // rax
char *v7; // r15
char *v8; // rax
char *v9; // r14
char *v10; // rax

v0 = (char *)C_mkEmptyComments();
v1 = func3((void *)logicSymbTypes, dword_D28, v0);
v2 = (char *)C_mkLSTypeDec(v1);
v3 = strlen(v2);
v4 = strlen(lsRange);
v5 = strlen(predRange);
v6 = (void *)UTIL_mallocStr(v4 + v3 + v5);
v7 = lsRange;
constProperty = v6;
v8 = stpcpy((char *)v6, lsRange);
v9 = predRange;
v10 = stpcpy(v8, predRange);
strcpy(v10, v2);
free(v0);
free(v1);
free(v2);
free(v7);
free(v9);
}

original_code:
void cgenConstProperty()
{
    char* emptyText = C_mkEmptyComments();
    char* logicSymbTypeBody = collectStringArray(logicSymbTypes, emptyText);
    char* logicSymbTypeDec = C_mkLSTypeDec(logicSymbTypeBody);
    constProperty = UTIL_mallocStr(strlen(logicSymbTypeDec) + strlen(lsRange)
                                   + strlen(predRange));
    strcpy(constProperty, lsRange);
    strcat(constProperty, predRange);
    strcat(constProperty , logicSymbTypeDec);
    free(emptyText); free(logicSymbTypeBody); free(logicSymbTypeDec);
    free(lsRange); free(predRange);
}

canonical_original_code:
void cgenConstProperty()
{
    char *emptyText = C_mkEmptyComments();
    char *logicSymbTypeBody = collectStringArray(logicSymbTypes, emptyText);
    char *logicSymbTypeDec = C_mkLSTypeDec(logicSymbTypeBody);
    constProperty = UTIL_mallocStr(strlen(logicSymbTypeDec) + strlen(lsRange)
                                   + strlen(predRange));
    strcpy(constProperty, lsRange);
    strcat(constProperty, predRange);
    strcat(constProperty , logicSymbTypeDec);
    free(emptyText); free(logicSymbTypeBody); free(logicSymbTypeDec);
    free(lsRange); free(predRange);
}

variable_types:
emptyText
char *

variable_types:
logicSymbTypeBody
char *

variable_types:
logicSymbTypeDec
char *


cgenConstH

decompiled_code:
void cgenConstH()
{
char *v0; // rbp
char *v1; // r13
void *v2; // r12

v0 = (char *)C_mkEmptyComments();
v1 = collectStringArray_isra_0((void *)constIndices, dword_D38, v0);
v2 = (void *)C_mkConstIndexType(v1);
constH = (void *)C_mkConstH(v2, numConsts, constProperty);
free(v1);
free(v2);
free(v0);
free(constProperty);
}

canonical_decompiled_code:
void func23()
{
char *v0; // rbp
char *v1; // r13
void *v2; // r12

v0 = (char *)C_mkEmptyComments();
v1 = func3((void *)constIndices, dword_D38, v0);
v2 = (void *)C_mkConstIndexType(v1);
constH = (void *)C_mkConstH(v2, numConsts, constProperty);
free(v1);
free(v2);
free(v0);
free(constProperty);
}

original_code:
void cgenConstH()
{
    char* emptyText = C_mkEmptyComments();
    char* constIndexBody = collectStringArray(constIndices, emptyText);
    char* constIndexTypeDef = C_mkConstIndexType(constIndexBody);
    constH = C_mkConstH(constIndexTypeDef, numConsts, constProperty);
    free(constIndexBody); free(constIndexTypeDef);
    free(emptyText); free(constProperty);
}

canonical_original_code:
void cgenConstH()
{
    char *emptyText = C_mkEmptyComments();
    char *constIndexBody = collectStringArray(constIndices, emptyText);
    char *constIndexTypeDef = C_mkConstIndexType(constIndexBody);
    constH = C_mkConstH(constIndexTypeDef, numConsts, constProperty);
    free(constIndexBody); free(constIndexTypeDef);
    free(emptyText); free(constProperty);
}

variable_types:
constIndexBody
char *

variable_types:
constIndexTypeDef
char *


cgenConstData

decompiled_code:
__int64 __fastcall cgenConstData(int a1, __int64 a2, __int64 a3, unsigned int a4, __int64 a5, unsigned int a6, unsigned int a7, __int64 a8, __int64 a9)
{
__int64 v12; // rax
void *v13; // rbp
char *v14; // r12
size_t v15; // rax
char *v16; // rbp
__int64 result; // rax

v12 = UTIL_itoa(a7);
if ( dword_CF8 <= a1 )
{
fwrite("const index exceed total number of consts\n", 1uLL, 0x2AuLL, stderr);
exit(1);
}
v13 = (void *)v12;
v14 = (char *)C_mkConstTabEntry(a2, a3, a4, a5, a6, v12, a8, a9);
free(v13);
v15 = strlen(v14);
v16 = (char *)UTIL_mallocStr(v15 + 2);
strcpy(v16, v14);
free(v14);
if ( dword_CF8 - 1 != a1 )
*(_WORD *)&v16[strlen(v16)] = 44;
*(_WORD *)&v16[strlen(v16)] = 10;
result = constData;
*(_QWORD *)(constData + 8LL * a1) = v16;
return result;
}

canonical_decompiled_code:
__int64 __fastcall func24(int a1, __int64 a2, __int64 a3, unsigned int a4, __int64 a5, unsigned int a6, unsigned int a7, __int64 a8, __int64 a9)
{
__int64 v12; // rax
void *v13; // rbp
char *v14; // r12
size_t v15; // rax
char *v16; // rbp
__int64 result; // rax

v12 = UTIL_itoa(a7);
if ( dword_CF8 <= a1 )
{
fwrite("const index exceed total number of consts\n", 1uLL, 0x2AuLL, stderr);
exit(1);
}
v13 = (void *)v12;
v14 = (char *)C_mkConstTabEntry(a2, a3, a4, a5, a6, v12, a8, a9);
free(v13);
v15 = strlen(v14);
v16 = (char *)UTIL_mallocStr(v15 + 2);
strcpy(v16, v14);
free(v14);
if ( dword_CF8 - 1 != a1 )
*(_WORD *)&v16[strlen(v16)] = 44;
*(_WORD *)&v16[strlen(v16)] = 10;
result = constData;
*(_QWORD *)(constData + 8LL * a1) = v16;
return result;
}

original_code:
void cgenConstData(int index, char* name, char* tesize, OP_Prec prec,
                   OP_Fixity fixity, int tySkelInd, char* neededness,
                   char* comments)
{
    char* oneConstData;
    char* constDataText;
    char* tySkelIndText = UTIL_itoa(tySkelInd);
    if (index >= constData.length) {
        fprintf(stderr, "const index exceed total number of consts\n");
        exit(1);
    }
    oneConstData = C_mkConstTabEntry(name, tesize, prec, fixity, tySkelIndText,
                                     neededness, comments);
    free(tySkelIndText);
    constDataText = UTIL_mallocStr(strlen(oneConstData) + 2);
    strcpy(constDataText, oneConstData); free(oneConstData);
    if (index != constData.length - 1) strcat(constDataText, ",");
    strcat(constDataText, "\n");
    constData.array[index] = constDataText;
}

canonical_original_code:
void cgenConstData(int index, char *name, char *tesize, struct OP_Prec prec, enum OP_Fixity fixity, int tySkelInd, char *neededness, char *comments)
{
    char *oneConstData;
    char *constDataText;
    char *tySkelIndText = UTIL_itoa(tySkelInd);
    if (index >= constData.length) {
        fprintf(stderr, "const index exceed total number of consts\n");
        exit(1);
    }
    oneConstData = C_mkConstTabEntry(name, tesize, prec, fixity, tySkelIndText,
                                     neededness, comments);
    free(tySkelIndText);
    constDataText = UTIL_mallocStr(strlen(oneConstData) + 2);
    strcpy(constDataText, oneConstData); free(oneConstData);
    if (index != constData.length - 1) strcat(constDataText, ",");
    strcat(constDataText, "\n");
    constData.array[index] = constDataText;
}

variable_types:
name
char *

variable_types:
tesize
char *

variable_types: struct OP_Prec { enum OP_PrecTypeCat { OP_PREC=0, OP_PREC_NAME=1 } cat; union { int prec; char *name; } data; }

variable_types: enum OP_Fixity { OP_INFIX=0, OP_INFIXL=1, OP_INFIXR=2, OP_PREFIX=3, OP_PREFIXR=4, OP_POSTFIX=5, OP_POSTFIXL=6, OP_NONE=7 }

variable_types: tySkelInd int

variable_types:
neededness
char *

variable_types:
comments
char *

variable_types:
oneConstData
char *

variable_types:
constDataText
char *

variable_types:
tySkelIndText
char *


cgenConstC

decompiled_code:
void cgenConstC()
{
char *v0; // r12
void *v1; // rbp

v0 = collectStringArray_isra_0(
(void *)constData,
dword_CF8,
" //nothing\n {NULL, 0, 0, 0, 0, OP_NONE },\n");
v1 = (void *)C_mkConstTab(v0);
constC = (void *)C_mkConstC(v1);
free(v0);
free(v1);
}

canonical_decompiled_code:
void func25()
{
char *v0; // r12
void *v1; // rbp

v0 = func3(
(void *)constData,
dword_CF8,
" //nothing\n {NULL, 0, 0, 0, 0, OP_NONE },\n");
v1 = (void *)C_mkConstTab(v0);
constC = (void *)C_mkConstC(v1);
free(v0);
free(v1);
}

original_code:
void cgenConstC()
{
    char* constTabBody = collectStringArray(constData, "    //nothing\n    {NULL,   0,     0,     0,     0,   OP_NONE  },\n");
    char* constTab = C_mkConstTab(constTabBody);
    constC = C_mkConstC(constTab);
    free(constTabBody); free(constTab);
}

canonical_original_code:
void cgenConstC()
{
    char *constTabBody = collectStringArray(constData, "    //nothing\n    {NULL,   0,     0,     0,     0,   OP_NONE  },\n");
    char *constTab = C_mkConstTab(constTabBody);
    constC = C_mkConstC(constTab);
    free(constTabBody); free(constTab);
}

variable_types:
constTabBody
char *

variable_types:
constTab
char *


cgenConstInit

decompiled_code:
void *__fastcall cgenConstInit(int a1)
{
dword_D38 = a1;
constIndices = UTIL_malloc(8LL * a1);
arrayInit((void *)constIndices, a1);
dword_CF8 = a1;
constData = UTIL_malloc(8LL * a1);
return arrayInit((void *)constData, a1);
}

canonical_decompiled_code:
void *__fastcall func26(int a1)
{
dword_D38 = a1;
constIndices = UTIL_malloc(8LL * a1);
func0((void *)constIndices, a1);
dword_CF8 = a1;
constData = UTIL_malloc(8LL * a1);
return func0((void *)constData, a1);
}

original_code:
void cgenConstInit(int length)
{
    constIndices.length = length;
    constIndices.array = (char**)UTIL_malloc(sizeof(char*)*length);
    arrayInit(constIndices.array, length);
    constData.length = length;
    constData.array = (char**)UTIL_malloc(sizeof(char*)*length);
    arrayInit(constData.array, length);
}

canonical_original_code:
void cgenConstInit(int length)
{
    constIndices.length = length;
    constIndices.array = (char **)UTIL_malloc(sizeof(char *)*length);
    arrayInit(constIndices.array, length);
    constData.length = length;
    constData.array = (char **)UTIL_malloc(sizeof(char *)*length);
    arrayInit(constData.array, length);
}

variable_types: length int


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

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

original_code:
OP_Prec OP_mkPrecMin1()
{
    OP_Prec prec;
    prec.cat = OP_PREC;
    prec.data.prec = -1;
    return prec;
}

canonical_original_code:
struct OP_Prec OP_mkPrecMin1()
{
    struct OP_Prec prec;
    prec.cat = OP_PREC;
    prec.data.prec = -1;
    return prec;
}

return_type: struct OP_Prec { enum OP_PrecTypeCat { OP_PREC=0, OP_PREC_NAME=1 } cat; union { int prec; char *name; } data; }


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

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

original_code:
OP_Prec OP_mkPrecMin2()
{
    OP_Prec prec;
    prec.cat = OP_PREC;
    prec.data.prec = -2;
    return prec;
}

canonical_original_code:
struct OP_Prec OP_mkPrecMin2()
{
    struct OP_Prec prec;
    prec.cat = OP_PREC;
    prec.data.prec = -2;
    return prec;
}

user_defined_types: enum OP_PrecTypeCat { OP_PREC=0, OP_PREC_NAME=1 }


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

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

original_code:
OP_Prec OP_mkPrec(int precedence)
{
    OP_Prec prec;
    prec.cat = OP_PREC;
    prec.data.prec = precedence ;
    return prec;
}

canonical_original_code:
struct OP_Prec OP_mkPrec(int precedence)
{
    struct OP_Prec prec;
    prec.cat = OP_PREC;
    prec.data.prec = precedence ;
    return prec;
}

variable_types: precedence int