decompiled_code:
__int64 __fastcall extract_UI8(const char *a1, const char *a2, const char *a3, __int64 *a4, _BYTE *a5)
{
char *v8; // rbx
const char *v9; // rbx
char *v10; // rax
int v11; // ebp
__int64 v13; // rdx
char *endptr; // [rsp+0h] [rbp-50h] BYREF
char dest[72]; // [rsp+8h] [rbp-48h] BYREF

*a5 = 1;
if ( !a1 )
return 0LL;
v8 = strstr(a1, a2);
if ( !v8 )
return 0LL;
v9 = &v8[strlen(a2)];
v10 = strstr(v9, a3);
if ( !v10 )
return 0LL;
if ( v10 - v9 > 31 )
{
v13 = 30LL;
LABEL_15:
fprintf(stderr, "Line %3d of File %s \n", v13, "./AUTOGEN/GENFILES/extract_UI8.c");
return 0xFFFFFFFFLL;
}
if ( v9 == v10 )
{
v11 = 0;
}
else
{
v11 = (_DWORD)v10 - (_DWORD)v9;
memcpy(dest, v9, v10 - v9);
}
dest[v11] = 0;
if ( !dest[0] )
return 0LL;
*a4 = strtoll(dest, &endptr, 10);
if ( *endptr )
{
v13 = 41LL;
goto LABEL_15;
}
*a5 = 0;
return 0LL;
}

canonical_decompiled_code:
__int64 __fastcall func0(const char *a1, const char *a2, const char *a3, __int64 *a4, _BYTE *a5)
{
char *v8; // rbx
const char *v9; // rbx
char *v10; // rax
int v11; // ebp
__int64 v13; // rdx
char *endptr; // [rsp+0h] [rbp-50h] BYREF
char dest[72]; // [rsp+8h] [rbp-48h] BYREF

*a5 = 1;
if ( !a1 )
return 0LL;
v8 = strstr(a1, a2);
if ( !v8 )
return 0LL;
v9 = &v8[strlen(a2)];
v10 = strstr(v9, a3);
if ( !v10 )
return 0LL;
if ( v10 - v9 > 31 )
{
v13 = 30LL;
LABEL_15:
fprintf(stderr, "Line %3d of File %s \n", v13, "./AUTOGEN/GENFILES/extract_UI8.c");
return 0xFFFFFFFFLL;
}
if ( v9 == v10 )
{
v11 = 0;
}
else
{
v11 = (_DWORD)v10 - (_DWORD)v9;
memcpy(dest, v9, v10 - v9);
}
dest[v11] = 0;
if ( !dest[0] )
return 0LL;
*a4 = strtoll(dest, &endptr, 10);
if ( *endptr )
{
v13 = 41LL;
goto LABEL_15;
}
*a5 = 0;
return 0LL;
}

original_code:
int
extract_UI8(
    const char *X,
    const char *start_str,
    const char *stop_str,
    unsigned long long *ptr_ival,
    _Bool *ptr_is_null
    )
{
  int status = 0;
  int i;
  char buffer[32];
  *ptr_is_null = 1;
  if ( X == ((void *)0) ) { *ptr_is_null = 1; return 0; }
  char *Y = strstr(X, start_str);
  if ( Y == ((void *)0) ) { *ptr_is_null = 1; return 0; }
  char *Z = Y + strlen(start_str);
  char *W = strstr(Z, stop_str);
  if ( W == ((void *)0) ) { *ptr_is_null = 1; return 0; }
  if ( ( W - Z ) >= 32 ) { { { fprintf(stderr, "Line %3d of File %s \n", 30, "./AUTOGEN/GENFILES/extract_UI8.c"); }; status = -1 ; goto BYE; }; }
  for ( i = 0; Z != W ; ) {
    buffer[i++] = *Z++;
  }
  buffer[i] = '\0';
  char *endptr;
  if ( buffer[0] == '\0' ) { *ptr_is_null = 1; return 0; }
  *ptr_ival = (unsigned long long)strtoll(buffer, &endptr, 10);
  if ( ( *ptr_ival < 0 ) || ( *ptr_ival > (0x7fffffffffffffffLL * 2ULL + 1ULL) ) ) {
    { { fprintf(stderr, "Line %3d of File %s \n", 39, "./AUTOGEN/GENFILES/extract_UI8.c"); }; status = -1 ; goto BYE; };
  }
  if ( *endptr != '\0' ) { { { fprintf(stderr, "Line %3d of File %s \n", 41, "./AUTOGEN/GENFILES/extract_UI8.c"); }; status = -1 ; goto BYE; }; }
  *ptr_is_null = 0;
BYE:
  return(status);
}

canonical_original_code:
int extract_UI8(char *X, char *start_str, char *stop_str, unsigned long long *ptr_ival, _Bool *ptr_is_null)
{
  int status = 0;
  int i;
  char buffer[32];
  *ptr_is_null = 1;
  if ( X == ((void *)0) ) { *ptr_is_null = 1; return 0; }
  char *Y = strstr(X, start_str);
  if ( Y == ((void *)0) ) { *ptr_is_null = 1; return 0; }
  char *Z = Y + strlen(start_str);
  char *W = strstr(Z, stop_str);
  if ( W == ((void *)0) ) { *ptr_is_null = 1; return 0; }
  if ( ( W - Z ) >= 32 ) { { { fprintf(stderr, "Line %3d of File %s \n", 30, "./AUTOGEN/GENFILES/extract_UI8.c"); }; status = -1 ; goto BYE; }; }
  for ( i = 0; Z != W ; ) {
    buffer[i++] = *Z++;
  }
  buffer[i] = '\0';
  char *endptr;
  if ( buffer[0] == '\0' ) { *ptr_is_null = 1; return 0; }
  *ptr_ival = (unsigned long long)strtoll(buffer, &endptr, 10);
  if ( ( *ptr_ival < 0 ) || ( *ptr_ival > (0x7fffffffffffffffLL * 2ULL + 1ULL) ) ) {
    { { fprintf(stderr, "Line %3d of File %s \n", 39, "./AUTOGEN/GENFILES/extract_UI8.c"); }; status = -1 ; goto BYE; };
  }
  if ( *endptr != '\0' ) { { { fprintf(stderr, "Line %3d of File %s \n", 41, "./AUTOGEN/GENFILES/extract_UI8.c"); }; status = -1 ; goto BYE; }; }
  *ptr_is_null = 0;
BYE:
  return(status);
}

variable_types:
X
char *

variable_types:
buffer
char [32]

variable_types:
Y
char *

variable_types:
Z
char *

variable_types:
W
char *

variable_types:
endptr
char *


repo: linkedin/datacl

decompiled_code:
char *__fastcall my_MDPrint(unsigned __int8 *a1, char *a2)
{
unsigned __int8 *v2; // rbx
__int64 v3; // rdx
char *result; // rax
char s[4]; // [rsp+Ch] [rbp-1Ch] BYREF

v2 = a1;
do
{
v3 = *v2;
*(_DWORD *)s = 0;
++v2;
sprintf(s, "%02x", v3);
result = strcat(a2, s);
}
while ( v2 != a1 + 16 );
return result;
}

canonical_decompiled_code:
char *__fastcall func0(unsigned __int8 *a1, char *a2)
{
unsigned __int8 *v2; // rbx
__int64 v3; // rdx
char *result; // rax
char s[4]; // [rsp+Ch] [rbp-1Ch] BYREF

v2 = a1;
do
{
v3 = *v2;
*(_DWORD *)s = 0;
++v2;
sprintf(s, "%02x", v3);
result = strcat(a2, s);
}
while ( v2 != a1 + 16 );
return result;
}

original_code:
static void my_MDPrint (
   unsigned char digest[16],
   char *out_string
   )
{
  unsigned int i, j;
  char stemp[4];
  for (i = 0; i < 16; i++) {
    for ( j = 0; j < 4; j++ ) {
      stemp[j] = '\0';
    }
    sprintf (stemp, "%02x", digest[i]);
    strcat(out_string, stemp);
  }
}

canonical_original_code:
static void my_MDPrint(unsigned char digest[16], char *out_string)
{
  unsigned int i; unsigned int j;
  char stemp[4];
  for (i = 0; i < 16; i++) {
    for ( j = 0; j < 4; j++ ) {
      stemp[j] = '\0';
    }
    sprintf (stemp, "%02x", digest[i]);
    strcat(out_string, stemp);
  }
}

variable_types:
digest
unsigned char [16]

variable_types:
i
unsigned int

variable_types:
j
unsigned int

variable_types:
stemp
char [4]

return_type: void


decompiled_code:
char *__fastcall my_MDString(const char *a1, char *a2)
{
unsigned int v2; // ebx
unsigned __int8 v4[16]; // [rsp+0h] [rbp-98h] BYREF
char v5[136]; // [rsp+10h] [rbp-88h] BYREF

v2 = strlen(a1);
MD5Init(v5);
MD5Update(v5, a1, v2);
MD5Final(v4, v5);
return my_MDPrint(v4, a2);
}

canonical_decompiled_code:
char *__fastcall func1(const char *a1, char *a2)
{
unsigned int v2; // ebx
unsigned __int8 v4[16]; // [rsp+0h] [rbp-98h] BYREF
char v5[136]; // [rsp+10h] [rbp-88h] BYREF

v2 = strlen(a1);
MD5Init(v5);
MD5Update(v5, a1, v2);
MD5Final(v4, v5);
return func0(v4, a2);
}

original_code:
void my_MDString (
    const char *in_string,
    char *out_string
    )
{
  MD5_CTX context;
  unsigned char digest[16];
  unsigned int len = strlen (in_string);
  MD5Init (&context);
  MD5Update (&context, in_string, len);
  MD5Final (digest, &context);
  my_MDPrint (digest, out_string);
}

canonical_original_code:
void my_MDString(char *in_string, char *out_string)
{
  struct MD5_CTX context;
  unsigned char digest[16];
  unsigned int len = strlen (in_string);
  MD5Init (&context);
  MD5Update (&context, in_string, len);
  MD5Final (digest, &context);
  my_MDPrint (digest, out_string);
}

variable_types: struct MD5_CTX { unsigned long state[4]; unsigned long count[2]; unsigned char buffer[64]; }

variable_types:
len
unsigned int


decompiled_code:
__int64 __fastcall mask_byte_L(_BYTE *a1, int a2)
{
__int64 result; // rax

switch ( a2 )
{
case 1:
*a1 &= 0x80u;
result = 0LL;
break;
case 2:
*a1 &= 0xB0u;
result = 0LL;
break;
case 3:
*a1 &= 0xD0u;
result = 0LL;
break;
case 4:
*a1 &= 0xF0u;
result = 0LL;
break;
case 5:
*a1 &= 0xF8u;
result = 0LL;
break;
case 6:
*a1 &= 0xFBu;
result = 0LL;
break;
case 7:
*a1 &= 0xFDu;
result = 0LL;
break;
default:
fprintf(stderr, "Line %3d of File %s \n", 34LL, "./AUX/f_to_s_sum_B.c");
result = 0xFFFFFFFFLL;
break;
}
return result;
}

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

switch ( a2 )
{
case 1:
*a1 &= 0x80u;
result = 0LL;
break;
case 2:
*a1 &= 0xB0u;
result = 0LL;
break;
case 3:
*a1 &= 0xD0u;
result = 0LL;
break;
case 4:
*a1 &= 0xF0u;
result = 0LL;
break;
case 5:
*a1 &= 0xF8u;
result = 0LL;
break;
case 6:
*a1 &= 0xFBu;
result = 0LL;
break;
case 7:
*a1 &= 0xFDu;
result = 0LL;
break;
default:
fprintf(stderr, "Line %3d of File %s \n", 34LL, "./AUX/f_to_s_sum_B.c");
result = 0xFFFFFFFFLL;
break;
}
return result;
}

original_code:
int
mask_byte_L(
   char *ptr_ctemp,
   int nbits
   )
{
  int status = 0;
  switch ( nbits ) {
  case 1 : *ptr_ctemp = *ptr_ctemp & 0x80; break;
  case 2 : *ptr_ctemp = *ptr_ctemp & 0xB0; break;
  case 3 : *ptr_ctemp = *ptr_ctemp & 0xD0; break;
  case 4 : *ptr_ctemp = *ptr_ctemp & 0xF0; break;
  case 5 : *ptr_ctemp = *ptr_ctemp & 0xF8; break;
  case 6 : *ptr_ctemp = *ptr_ctemp & 0xFB; break;
  case 7 : *ptr_ctemp = *ptr_ctemp & 0xFD; break;
  default :
    { { fprintf(stderr, "Line %3d of File %s \n", 34, "./AUX/f_to_s_sum_B.c"); }; status = -1 ; goto BYE; };
    break
      ;
  }
 BYE:
  return(status);
}

canonical_original_code:
int mask_byte_L(char *ptr_ctemp, int nbits)
{
  int status = 0;
  switch ( nbits ) {
  case 1 : *ptr_ctemp = *ptr_ctemp & 0x80; break;
  case 2 : *ptr_ctemp = *ptr_ctemp & 0xB0; break;
  case 3 : *ptr_ctemp = *ptr_ctemp & 0xD0; break;
  case 4 : *ptr_ctemp = *ptr_ctemp & 0xF0; break;
  case 5 : *ptr_ctemp = *ptr_ctemp & 0xF8; break;
  case 6 : *ptr_ctemp = *ptr_ctemp & 0xFB; break;
  case 7 : *ptr_ctemp = *ptr_ctemp & 0xFD; break;
  default :
    { { fprintf(stderr, "Line %3d of File %s \n", 34, "./AUX/f_to_s_sum_B.c"); }; status = -1 ; goto BYE; };
    break
      ;
  }
 BYE:
  return(status);
}

variable_types: nbits int

variable_types: status int

return_type: int


decompiled_code:
__int64 __fastcall mask_byte_R(_BYTE *a1, int a2)
{
__int64 result; // rax

switch ( a2 )
{
case 1:
*a1 &= 1u;
result = 0LL;
break;
case 2:
*a1 &= 3u;
result = 0LL;
break;
case 3:
*a1 &= 7u;
result = 0LL;
break;
case 4:
*a1 &= 0xFu;
result = 0LL;
break;
case 5:
*a1 &= 0x1Fu;
result = 0LL;
break;
case 6:
*a1 &= 0x3Fu;
result = 0LL;
break;
case 7:
*a1 &= 0x7Fu;
result = 0LL;
break;
default:
fprintf(stderr, "Line %3d of File %s \n", 57LL, "./AUX/f_to_s_sum_B.c");
result = 0xFFFFFFFFLL;
break;
}
return result;
}

canonical_decompiled_code:
__int64 __fastcall func1(_BYTE *a1, int a2)
{
__int64 result; // rax

switch ( a2 )
{
case 1:
*a1 &= 1u;
result = 0LL;
break;
case 2:
*a1 &= 3u;
result = 0LL;
break;
case 3:
*a1 &= 7u;
result = 0LL;
break;
case 4:
*a1 &= 0xFu;
result = 0LL;
break;
case 5:
*a1 &= 0x1Fu;
result = 0LL;
break;
case 6:
*a1 &= 0x3Fu;
result = 0LL;
break;
case 7:
*a1 &= 0x7Fu;
result = 0LL;
break;
default:
fprintf(stderr, "Line %3d of File %s \n", 57LL, "./AUX/f_to_s_sum_B.c");
result = 0xFFFFFFFFLL;
break;
}
return result;
}

original_code:
int
mask_byte_R(
   char *ptr_ctemp,
   int nbits
   )
{
  int status = 0;
  switch ( nbits ) {
  case 1 : *ptr_ctemp = *ptr_ctemp & 0x01; break;
  case 2 : *ptr_ctemp = *ptr_ctemp & 0x03; break;
  case 3 : *ptr_ctemp = *ptr_ctemp & 0x07; break;
  case 4 : *ptr_ctemp = *ptr_ctemp & 0x0F; break;
  case 5 : *ptr_ctemp = *ptr_ctemp & 0x1F; break;
  case 6 : *ptr_ctemp = *ptr_ctemp & 0x3F; break;
  case 7 : *ptr_ctemp = *ptr_ctemp & 0x7F; break;
  default :
    { { fprintf(stderr, "Line %3d of File %s \n", 57, "./AUX/f_to_s_sum_B.c"); }; status = -1 ; goto BYE; };
    break
      ;
  }
 BYE:
  return(status);
}

canonical_original_code:
int mask_byte_R(char *ptr_ctemp, int nbits)
{
  int status = 0;
  switch ( nbits ) {
  case 1 : *ptr_ctemp = *ptr_ctemp & 0x01; break;
  case 2 : *ptr_ctemp = *ptr_ctemp & 0x03; break;
  case 3 : *ptr_ctemp = *ptr_ctemp & 0x07; break;
  case 4 : *ptr_ctemp = *ptr_ctemp & 0x0F; break;
  case 5 : *ptr_ctemp = *ptr_ctemp & 0x1F; break;
  case 6 : *ptr_ctemp = *ptr_ctemp & 0x3F; break;
  case 7 : *ptr_ctemp = *ptr_ctemp & 0x7F; break;
  default :
    { { fprintf(stderr, "Line %3d of File %s \n", 57, "./AUX/f_to_s_sum_B.c"); }; status = -1 ; goto BYE; };
    break
      ;
  }
 BYE:
  return(status);
}


original_code:
int
pos_nn_copy_I8_I4(
    long long *f1,
    char *nn_f1,
    long long nR1,
    int *f2,
    char *nn_f2,
    long long nR2,
    long long *f3,
    long long *ptr_cnt
    )
{
  int status = 0;
  long long cnt = 0;
  for ( long long i = 0; i < nR2; i++ ) {
    if ( ( nn_f2 != ((void *)0) ) && ( nn_f2[i] == 0 ) ) { continue; }
    int f1idx = f2[i];
    if ( ( f1idx < 0 ) || ( f1idx >= nR1 ) ) { { { fprintf(stderr, "Line %3d of File %s \n", 34, "./AUX/pos_nn_copy_I8_I4.c"); }; status = -1 ; goto BYE; }; }
    if ( ( nn_f1 != ((void *)0) ) && ( nn_f1[f1idx] == 0 ) ) { continue; }
    long long ival = f1[f1idx];
    f3[cnt++] = ival;
  }
  *ptr_cnt = cnt;
BYE:
  return(status);
}

canonical_original_code:
int pos_nn_copy_I8_I4(long long *f1, char *nn_f1, long long nR1, int *f2, char *nn_f2, long long nR2, long long *f3, long long *ptr_cnt)
{
  int status = 0;
  long long cnt = 0;
  for ( long long i = 0; i < nR2; i++ ) {
    if ( ( nn_f2 != ((void *)0) ) && ( nn_f2[i] == 0 ) ) { continue; }
    int f1idx = f2[i];
    if ( ( f1idx < 0 ) || ( f1idx >= nR1 ) ) { { { fprintf(stderr, "Line %3d of File %s \n", 34, "./AUX/pos_nn_copy_I8_I4.c"); }; status = -1 ; goto BYE; }; }
    if ( ( nn_f1 != ((void *)0) ) && ( nn_f1[f1idx] == 0 ) ) { continue; }
    long long ival = f1[f1idx];
    f3[cnt++] = ival;
  }
  *ptr_cnt = cnt;
BYE:
  return(status);
}

variable_types:
cnt
long long

variable_types:
i
long long

variable_types:
ival
long long


original_code:
void
mul2_F4(
       float *in1,
       float *in2,
       long long nR,
       float * restrict out
       )
{
  float inv1, inv2, outv;
  for ( long long i = 0; i < nR; i++ ) {
    inv1 = *in1;
    inv2 = *in2;
    outv = inv1 * inv2;
    *out = outv;
    in1++;
    in2++;
    out++;
  }
}

canonical_original_code:
void mul2_F4(float *in1, float *in2, long long nR, float *out)
{
  float inv1; float inv2; float outv;
  for ( long long i = 0; i < nR; i++ ) {
    inv1 = *in1;
    inv2 = *in2;
    outv = inv1 * inv2;
    *out = outv;
    in1++;
    in2++;
    out++;
  }
}

variable_types:
nR
long long

variable_types:
out
float *

variable_types: outv float


original_code:
void
bwise_or2_I4(
       int *in1,
       int *in2,
       long long nR,
       int * restrict out
       )
{
  int inv1, inv2, outv;
  for ( long long i = 0; i < nR; i++ ) {
    inv1 = *in1;
    inv2 = *in2;
    outv = inv1 | inv2;
    *out = outv;
    in1++;
    in2++;
    out++;
  }
}

canonical_original_code:
void bwise_or2_I4(int *in1, int *in2, long long nR, int *out)
{
  int inv1; int inv2; int outv;
  for ( long long i = 0; i < nR; i++ ) {
    inv1 = *in1;
    inv2 = *in2;
    outv = inv1 | inv2;
    *out = outv;
    in1++;
    in2++;
    out++;
  }
}

variable_types:
out
int *

variable_types: outv int


decompiled_code:
__int64 __fastcall par_sort_with_bins(__int64 a1, __int64 a2, __int64 a3, __int64 a4, unsigned int a5, int a6, char *s1, __int64 a8, __int64 a9)
{
char *v9; // rbp
__int64 result; // rax

v9 = s1;
if ( !s1 || !*s1 )
{
fprintf(stderr, "Line %3d of File %s \n", 22LL, "par_sort_with_bins.c");
return 0xFFFFFFFFLL;
}
if ( strcasecmp(s1, "asc") && strcasecmp(s1, "dsc") )
{
fprintf(stderr, "Line %3d of File %s \n", 25LL, "par_sort_with_bins.c");
return 0xFFFFFFFFLL;
}
if ( 4 * g_num_cores <= 1 )
{
fprintf(stderr, "Line %3d of File %s \n", 28LL, "par_sort_with_bins.c");
return 0xFFFFFFFFLL;
}
if ( a6 == 4 )
{
LODWORD(s1) = 4 * g_num_cores;
result = par_sort_with_bins_I4(a1, a2, a3, a4, a5, v9, s1, a8, a9);
}
else
{
if ( a6 != 5 )
{
fprintf(stderr, "Line %3d of File %s \n", 39LL, "par_sort_with_bins.c");
return 0xFFFFFFFFLL;
}
LODWORD(s1) = 4 * g_num_cores;
result = par_sort_with_bins_I8(a1, a2, a3, a4, a5, v9, s1, a8, a9);
}
return result;
}

canonical_decompiled_code:
__int64 __fastcall func0(__int64 a1, __int64 a2, __int64 a3, __int64 a4, unsigned int a5, int a6, char *s1, __int64 a8, __int64 a9)
{
char *v9; // rbp
__int64 result; // rax

v9 = s1;
if ( !s1 || !*s1 )
{
fprintf(stderr, "Line %3d of File %s \n", 22LL, "par_sort_with_bins.c");
return 0xFFFFFFFFLL;
}
if ( strcasecmp(s1, "asc") && strcasecmp(s1, "dsc") )
{
fprintf(stderr, "Line %3d of File %s \n", 25LL, "par_sort_with_bins.c");
return 0xFFFFFFFFLL;
}
if ( 4 * g_num_cores <= 1 )
{
fprintf(stderr, "Line %3d of File %s \n", 28LL, "par_sort_with_bins.c");
return 0xFFFFFFFFLL;
}
if ( a6 == 4 )
{
LODWORD(s1) = 4 * g_num_cores;
result = par_sort_with_bins_I4(a1, a2, a3, a4, a5, v9, s1, a8, a9);
}
else
{
if ( a6 != 5 )
{
fprintf(stderr, "Line %3d of File %s \n", 39LL, "par_sort_with_bins.c");
return 0xFFFFFFFFLL;
}
LODWORD(s1) = 4 * g_num_cores;
result = par_sort_with_bins_I8(a1, a2, a3, a4, a5, v9, s1, a8, a9);
}
return result;
}

original_code:
int
par_sort_with_bins(
    char *in,
    long long nR,
    char *lb,
    char *ub,
    int num_bins,
    FLD_TYPE fldtype,
    char *srt_ordr,
    unsigned short *bin_idx,
    char *out
    )
{
  int status = 0;
  if ( ( srt_ordr == ((void *)0) ) || ( *srt_ordr == '\0' ) ) { { { fprintf(stderr, "Line %3d of File %s \n", 22, "par_sort_with_bins.c"); }; status = -1 ; goto BYE; }; }
  if ( ( strcasecmp(srt_ordr, "asc") != 0 ) &&
       ( strcasecmp(srt_ordr, "dsc") != 0 ) ) {
    { { fprintf(stderr, "Line %3d of File %s \n", 25, "par_sort_with_bins.c"); }; status = -1 ; goto BYE; };
  }
  int nT = g_num_cores * 4; if ( nT < 2 ) { { { fprintf(stderr, "Line %3d of File %s \n", 28, "par_sort_with_bins.c"); }; status = -1 ; goto BYE; }; }
  switch ( fldtype ) {
    case I4 :
      status = par_sort_with_bins_I4((int *)in, nR, (int *)lb,
   (int *)ub, num_bins, srt_ordr, nT, bin_idx, (int *)out);
      break;
    case I8 :
      status = par_sort_with_bins_I8((long long *)in, nR, (long long *)lb,
   (long long *)ub, num_bins, srt_ordr, nT, bin_idx, (long long *)out);
      break;
    default :
      { { fprintf(stderr, "Line %3d of File %s \n", 39, "par_sort_with_bins.c"); }; status = -1 ; goto BYE; };
      break;
  }
BYE:
  return(status);
}

canonical_original_code:
int par_sort_with_bins(char *in, long long nR, char *lb, char *ub, int num_bins, enum _FLD_TYPE fldtype, char *srt_ordr, unsigned short *bin_idx, char *out)
{
  int status = 0;
  if ( ( srt_ordr == ((void *)0) ) || ( *srt_ordr == '\0' ) ) { { { fprintf(stderr, "Line %3d of File %s \n", 22, "par_sort_with_bins.c"); }; status = -1 ; goto BYE; }; }
  if ( ( strcasecmp(srt_ordr, "asc") != 0 ) &&
       ( strcasecmp(srt_ordr, "dsc") != 0 ) ) {
    { { fprintf(stderr, "Line %3d of File %s \n", 25, "par_sort_with_bins.c"); }; status = -1 ; goto BYE; };
  }
  int nT = g_num_cores * 4; if ( nT < 2 ) { { { fprintf(stderr, "Line %3d of File %s \n", 28, "par_sort_with_bins.c"); }; status = -1 ; goto BYE; }; }
  switch ( fldtype ) {
    case I4 :
      status = par_sort_with_bins_I4((int *)in, nR, (int *)lb,
   (int *)ub, num_bins, srt_ordr, nT, bin_idx, (int *)out);
      break;
    case I8 :
      status = par_sort_with_bins_I8((long long *)in, nR, (long long *)lb,
   (long long *)ub, num_bins, srt_ordr, nT, bin_idx, (long long *)out);
      break;
    default :
      { { fprintf(stderr, "Line %3d of File %s \n", 39, "par_sort_with_bins.c"); }; status = -1 ; goto BYE; };
      break;
  }
BYE:
  return(status);
}

variable_types:
in
char *

variable_types:
lb
char *

variable_types:
ub
char *

variable_types:
out
char *

variable_types: nT int


decompiled_code:
__int64 __fastcall permute_I4(__int64 a1, __int64 a2)
{
__int64 v2; // rbx
__int64 v3; // rax
int *v4; // rax
int v5; // edx
__int64 v8; // rdx
double result; // [rsp+8h] [rbp-50h] BYREF
struct drand48_data buffer; // [rsp+10h] [rbp-48h] BYREF

srand48_r(852187451LL, &buffer);
if ( !a1 )
{
v8 = 21LL;
goto LABEL_9;
}
if ( a2 <= 1 )
{
v8 = 22LL;
LABEL_9:
fprintf(stderr, "Line %3d of File %s \n", v8, "./AUTOGEN/GENFILES/permute_I4.c");
return 0xFFFFFFFFLL;
}
v2 = a2 - 1;
do
{
drand48_r(&buffer, &result);
v3 = (unsigned int)(int)((double)(int)a2 * result);
if ( a2 == v3 )
v3 = a2 - 1;
v4 = (int *)(a1 + 4 * v3);
v5 = *v4;
*v4 = *(_DWORD *)(a1 + 4 * v2);
*(_DWORD *)(a1 + 4 * v2) = v5;
}
while ( v2-- != 0 );
return 0LL;
}

canonical_decompiled_code:
__int64 __fastcall func0(__int64 a1, __int64 a2)
{
__int64 v2; // rbx
__int64 v3; // rax
int *v4; // rax
int v5; // edx
__int64 v8; // rdx
double result; // [rsp+8h] [rbp-50h] BYREF
struct drand48_data buffer; // [rsp+10h] [rbp-48h] BYREF

srand48_r(852187451LL, &buffer);
if ( !a1 )
{
v8 = 21LL;
goto LABEL_9;
}
if ( a2 <= 1 )
{
v8 = 22LL;
LABEL_9:
fprintf(stderr, "Line %3d of File %s \n", v8, "./AUTOGEN/GENFILES/permute_I4.c");
return 0xFFFFFFFFLL;
}
v2 = a2 - 1;
do
{
drand48_r(&buffer, &result);
v3 = (unsigned int)(int)((double)(int)a2 * result);
if ( a2 == v3 )
v3 = a2 - 1;
v4 = (int *)(a1 + 4 * v3);
v5 = *v4;
*v4 = *(_DWORD *)(a1 + 4 * v2);
*(_DWORD *)(a1 + 4 * v2) = v5;
}
while ( v2-- != 0 );
return 0LL;
}

original_code:
int
permute_I4(
    int *X,
    long long n
    )
{
  int status = 0;
  struct drand48_data buffer;
  srand48_r(852187451, &buffer);
  if ( X == ((void *)0) ) { { { fprintf(stderr, "Line %3d of File %s \n", 21, "./AUTOGEN/GENFILES/permute_I4.c"); }; status = -1 ; goto BYE; }; }
  if ( n <= 1 ) { { { fprintf(stderr, "Line %3d of File %s \n", 22, "./AUTOGEN/GENFILES/permute_I4.c"); }; status = -1 ; goto BYE; }; }
  for (long long k = n-1; k >= 0; k--) {
    long long pos;
    double dtemp;
    int swap;
    drand48_r(&buffer, &dtemp);
    pos = dtemp * n; if ( pos == n ) { pos--; }
    swap = X[pos];
    X[pos] = X[k];
    X[k] = swap;
  }
BYE:
  return(status);
}

canonical_original_code:
int permute_I4(int *X, long long n)
{
  int status = 0;
  struct drand48_data buffer;
  srand48_r(852187451, &buffer);
  if ( X == ((void *)0) ) { { { fprintf(stderr, "Line %3d of File %s \n", 21, "./AUTOGEN/GENFILES/permute_I4.c"); }; status = -1 ; goto BYE; }; }
  if ( n <= 1 ) { { { fprintf(stderr, "Line %3d of File %s \n", 22, "./AUTOGEN/GENFILES/permute_I4.c"); }; status = -1 ; goto BYE; }; }
  for (long long k = n-1; k >= 0; k--) {
    long long pos;
    double dtemp;
    int swap;
    drand48_r(&buffer, &dtemp);
    pos = dtemp * n; if ( pos == n ) { pos--; }
    swap = X[pos];
    X[pos] = X[k];
    X[k] = swap;
  }
BYE:
  return(status);
}

variable_types:
X
int *

variable_types:
n
long long

variable_types: struct drand48_data { unsigned short __x[3]; unsigned short __old_x[3]; unsigned short __c; unsigned short __init; unsigned long long __a; }

variable_types:
k
long long

variable_types:
pos
long long

variable_types: dtemp double

variable_types: swap int


original_code:
void
bwise_a_and_not_b_I8(
       unsigned long long *in1,
       unsigned long long *in2,
       long long nR,
       unsigned long long * restrict out
       )
{
  long long inv1, inv2, outv;
  for ( long long i = 0; i < nR; i++ ) {
    inv1 = *in1;
    inv2 = ~ (*in2);
    outv = inv1 & inv2;
    *out = outv;
    in1++;
    in2++;
    out++;
  }
}

canonical_original_code:
void bwise_a_and_not_b_I8(unsigned long long *in1, unsigned long long *in2, long long nR, unsigned long long *out)
{
  long long inv1; long long inv2; long long outv;
  for ( long long i = 0; i < nR; i++ ) {
    inv1 = *in1;
    inv2 = ~ (*in2);
    outv = inv1 & inv2;
    *out = outv;
    in1++;
    in2++;
    out++;
  }
}

variable_types:
nR
long long

variable_types:
out
unsigned long long *

variable_types:
outv
long long

variable_types:
i
long long


decompiled_code:
__int64 __fastcall mk_hashes_I1(char *a1, int a2, _QWORD *a3, unsigned int *a4, unsigned int *a5, unsigned int *a6)
{
__int64 v6; // rbx
_BYTE *v7; // r13
_BYTE *v8; // r14
__int64 v9; // rax
__int64 v10; // rbx
__int64 v11; // rax
unsigned int v12; // ebp
__int64 v13; // rax
unsigned int v14; // er12
char *v15; // rcx
__int64 v16; // rsi
__int64 v17; // rdx
unsigned int v18; // ebx
__int64 v19; // rax
int v20; // ecx
char v21; // dl
unsigned int v22; // er12
__int64 v24; // rdx
__int64 v25; // rdx
unsigned int size; // [rsp+Ch] [rbp-5Ch]

v6 = (unsigned int)(a2 - 1);
*a6 = 0;
*a5 = 0;
*a4 = 0;
*a3 = 0LL;
if ( (unsigned int)v6 > 0x7F )
{
v25 = 35LL;
goto LABEL_23;
}
size = prime_geq((unsigned int)(a2 * a2));
if ( size <= 1 )
{
v25 = 37LL;
LABEL_23:
v22 = -1;
fprintf(stderr, "Line %3d of File %s \n", v25, "./AUTOGEN/GENFILES/mk_hashes_I1.c");
return v22;
}
v7 = malloc(size);
if ( !v7 )
{
fwrite("Unable to allocate memory\n", 1uLL, 0x1AuLL, stderr);
v25 = 39LL;
goto LABEL_23;
}
v8 = malloc(size);
if ( !v8 )
{
fwrite("Unable to allocate memory\n", 1uLL, 0x1AuLL, stderr);
v25 = 41LL;
goto LABEL_23;
}
v9 = get_time_usec();
srand48(v9);
v10 = (__int64)&a1[v6 + 1];
LABEL_6:
v11 = mrand48();
v12 = prime_geq(v11);
v13 = mrand48();
v14 = prime_geq(v13);
assign_const_I1(v7, size, 0LL);
assign_const_I1(v8, size, 0LL);
v15 = a1;
do
{
v16 = *v15;
v17 = (unsigned __int16)((v14 + (unsigned __int64)v12 * v16) % size);
if ( v8[v17] )
goto LABEL_6;
++v15;
v8[v17] = 1;
v7[v17] = v16;
}
while ( (char *)v10 != v15 );
v18 = v14;
v19 = 0LL;
v20 = 0;
do
{
while ( 1 )
{
v21 = v8[v19];
if ( v21 != 1 )
break;
++v19;
++v20;
if ( size == v19 )
goto LABEL_15;
}
if ( !v21 && v7[v19] )
{
v24 = 72LL;
goto LABEL_20;
}
++v19;
}
while ( size != v19 );
LABEL_15:
if ( a2 == v20 )
{
v22 = 0;
*a3 = v7;
*a5 = v12;
*a6 = v18;
*a4 = size;
goto LABEL_17;
}
v24 = 75LL;
LABEL_20:
v22 = -1;
fprintf(stderr, "Line %3d of File %s \n", v24, "./AUTOGEN/GENFILES/mk_hashes_I1.c");
LABEL_17:
free(v8);
return v22;
}

canonical_decompiled_code:
__int64 __fastcall func0(char *a1, int a2, _QWORD *a3, unsigned int *a4, unsigned int *a5, unsigned int *a6)
{
__int64 v6; // rbx
_BYTE *v7; // r13
_BYTE *v8; // r14
__int64 v9; // rax
__int64 v10; // rbx
__int64 v11; // rax
unsigned int v12; // ebp
__int64 v13; // rax
unsigned int v14; // er12
char *v15; // rcx
__int64 v16; // rsi
__int64 v17; // rdx
unsigned int v18; // ebx
__int64 v19; // rax
int v20; // ecx
char v21; // dl
unsigned int v22; // er12
__int64 v24; // rdx
__int64 v25; // rdx
unsigned int size; // [rsp+Ch] [rbp-5Ch]

v6 = (unsigned int)(a2 - 1);
*a6 = 0;
*a5 = 0;
*a4 = 0;
*a3 = 0LL;
if ( (unsigned int)v6 > 0x7F )
{
v25 = 35LL;
goto LABEL_23;
}
size = prime_geq((unsigned int)(a2 * a2));
if ( size <= 1 )
{
v25 = 37LL;
LABEL_23:
v22 = -1;
fprintf(stderr, "Line %3d of File %s \n", v25, "./AUTOGEN/GENFILES/mk_hashes_I1.c");
return v22;
}
v7 = malloc(size);
if ( !v7 )
{
fwrite("Unable to allocate memory\n", 1uLL, 0x1AuLL, stderr);
v25 = 39LL;
goto LABEL_23;
}
v8 = malloc(size);
if ( !v8 )
{
fwrite("Unable to allocate memory\n", 1uLL, 0x1AuLL, stderr);
v25 = 41LL;
goto LABEL_23;
}
v9 = get_time_usec();
srand48(v9);
v10 = (__int64)&a1[v6 + 1];
LABEL_6:
v11 = mrand48();
v12 = prime_geq(v11);
v13 = mrand48();
v14 = prime_geq(v13);
assign_const_I1(v7, size, 0LL);
assign_const_I1(v8, size, 0LL);
v15 = a1;
do
{
v16 = *v15;
v17 = (unsigned __int16)((v14 + (unsigned __int64)v12 * v16) % size);
if ( v8[v17] )
goto LABEL_6;
++v15;
v8[v17] = 1;
v7[v17] = v16;
}
while ( (char *)v10 != v15 );
v18 = v14;
v19 = 0LL;
v20 = 0;
do
{
while ( 1 )
{
v21 = v8[v19];
if ( v21 != 1 )
break;
++v19;
++v20;
if ( size == v19 )
goto LABEL_15;
}
if ( !v21 && v7[v19] )
{
v24 = 72LL;
goto LABEL_20;
}
++v19;
}
while ( size != v19 );
LABEL_15:
if ( a2 == v20 )
{
v22 = 0;
*a3 = v7;
*a5 = v12;
*a6 = v18;
*a4 = size;
goto LABEL_17;
}
v24 = 75LL;
LABEL_20:
v22 = -1;
fprintf(stderr, "Line %3d of File %s \n", v24, "./AUTOGEN/GENFILES/mk_hashes_I1.c");
LABEL_17:
free(v8);
return v22;
}

original_code:
int
mk_hashes_I1(
      char *scalars,
      int num_scalars,
      char **ptr_hashes,
      unsigned int *ptr_n,
      unsigned int *ptr_a,
      unsigned int *ptr_b
      )
{
  int status = 0;
  char *hashes = ((void *)0);
  unsigned char *used = ((void *)0);
  unsigned int n, a, b;
  *ptr_n = *ptr_a = *ptr_b = 0; *ptr_hashes = ((void *)0);
  if ( ( num_scalars < 1 ) || ( num_scalars > 128 ) ){ { { fprintf(stderr, "Line %3d of File %s \n", 35, "./AUTOGEN/GENFILES/mk_hashes_I1.c"); }; status = -1 ; goto BYE; };}
  n = prime_geq(num_scalars * num_scalars);
  if ( n <= 1 ) { { { fprintf(stderr, "Line %3d of File %s \n", 37, "./AUTOGEN/GENFILES/mk_hashes_I1.c"); }; status = -1 ; goto BYE; }; }
  hashes = malloc(n * sizeof(char));
  { if ( hashes == ((void *)0) ) { fprintf(stderr, "Unable to allocate memory\n"); { { fprintf(stderr, "Line %3d of File %s \n", 39, "./AUTOGEN/GENFILES/mk_hashes_I1.c"); }; status = -1 ; goto BYE; }; } };
  used = malloc(n * sizeof(unsigned char));
  { if ( used == ((void *)0) ) { fprintf(stderr, "Unable to allocate memory\n"); { { fprintf(stderr, "Line %3d of File %s \n", 41, "./AUTOGEN/GENFILES/mk_hashes_I1.c"); }; status = -1 ; goto BYE; }; } };
  srand48(get_time_usec());
  for ( int iter = 0; ; iter++ ) {
    a = (unsigned int)mrand48();
    a = prime_geq(a);
    b = (unsigned int)mrand48();
    b = prime_geq(b);
    _Bool is_collision = 0;
    assign_const_I1( hashes, n, 0);
    assign_const_I1((char *)used, n, 0);
    for ( int i = 0; i < num_scalars; i++ ) {
      unsigned long long val = scalars[i];
      unsigned long long ltemp = ( ( a * val ) + b ) % n;
      unsigned short loc = (unsigned short)ltemp;
      if ( used[loc] == 0 ) {
 used[loc] = 1;
 hashes[loc] = scalars[i];
      }
      else {
 is_collision = 1;
 break;
      }
    }
    if ( is_collision == 0 ) { break; }
  }
  int chk_cnt = 0;
  for ( int i = 0; i < n; i++ ) {
    if ( used[i] == 1 ) { chk_cnt++; }
    if ( ( used[i] == 0 ) && ( hashes[i] != 0 ) ) { { { fprintf(stderr, "Line %3d of File %s \n", 72, "./AUTOGEN/GENFILES/mk_hashes_I1.c"); }; status = -1 ; goto BYE; }; }
  }
  if ( chk_cnt != num_scalars ) { { { fprintf(stderr, "Line %3d of File %s \n", 75, "./AUTOGEN/GENFILES/mk_hashes_I1.c"); }; status = -1 ; goto BYE; }; }
  *ptr_hashes = hashes;
  *ptr_a = a;
  *ptr_b = b;
  *ptr_n = n;
 BYE:
  { if ( (used) != ((void *)0) ) { free((used)); (used) = ((void *)0); } };
  return(status);
}

canonical_original_code:
int mk_hashes_I1(char *scalars, int num_scalars, char **ptr_hashes, unsigned int *ptr_n, unsigned int *ptr_a, unsigned int *ptr_b)
{
  int status = 0;
  char *hashes = ((void *)0);
  unsigned char *used = ((void *)0);
  unsigned int n; unsigned int a; unsigned int b;
  *ptr_n = *ptr_a = *ptr_b = 0; *ptr_hashes = ((void *)0);
  if ( ( num_scalars < 1 ) || ( num_scalars > 128 ) ){ { { fprintf(stderr, "Line %3d of File %s \n", 35, "./AUTOGEN/GENFILES/mk_hashes_I1.c"); }; status = -1 ; goto BYE; };}
  n = prime_geq(num_scalars * num_scalars);
  if ( n <= 1 ) { { { fprintf(stderr, "Line %3d of File %s \n", 37, "./AUTOGEN/GENFILES/mk_hashes_I1.c"); }; status = -1 ; goto BYE; }; }
  hashes = malloc(n * sizeof(char));
  { if ( hashes == ((void *)0) ) { fprintf(stderr, "Unable to allocate memory\n"); { { fprintf(stderr, "Line %3d of File %s \n", 39, "./AUTOGEN/GENFILES/mk_hashes_I1.c"); }; status = -1 ; goto BYE; }; } };
  used = malloc(n * sizeof(unsigned char));
  { if ( used == ((void *)0) ) { fprintf(stderr, "Unable to allocate memory\n"); { { fprintf(stderr, "Line %3d of File %s \n", 41, "./AUTOGEN/GENFILES/mk_hashes_I1.c"); }; status = -1 ; goto BYE; }; } };
  srand48(get_time_usec());
  for ( int iter = 0; ; iter++ ) {
    a = (unsigned int)mrand48();
    a = prime_geq(a);
    b = (unsigned int)mrand48();
    b = prime_geq(b);
    _Bool is_collision = 0;
    assign_const_I1( hashes, n, 0);
    assign_const_I1((char *)used, n, 0);
    for ( int i = 0; i < num_scalars; i++ ) {
      unsigned long long val = scalars[i];
      unsigned long long ltemp = ( ( a * val ) + b ) % n;
      unsigned short loc = (unsigned short)ltemp;
      if ( used[loc] == 0 ) {
 used[loc] = 1;
 hashes[loc] = scalars[i];
      }
      else {
 is_collision = 1;
 break;
      }
    }
    if ( is_collision == 0 ) { break; }
  }
  int chk_cnt = 0;
  for ( int i = 0; i < n; i++ ) {
    if ( used[i] == 1 ) { chk_cnt++; }
    if ( ( used[i] == 0 ) && ( hashes[i] != 0 ) ) { { { fprintf(stderr, "Line %3d of File %s \n", 72, "./AUTOGEN/GENFILES/mk_hashes_I1.c"); }; status = -1 ; goto BYE; }; }
  }
  if ( chk_cnt != num_scalars ) { { { fprintf(stderr, "Line %3d of File %s \n", 75, "./AUTOGEN/GENFILES/mk_hashes_I1.c"); }; status = -1 ; goto BYE; }; }
  *ptr_hashes = hashes;
  *ptr_a = a;
  *ptr_b = b;
  *ptr_n = n;
 BYE:
  { if ( (used) != ((void *)0) ) { free((used)); (used) = ((void *)0); } };
  return(status);
}

variable_types:
scalars
char *

variable_types: status int

variable_types:
hashes
char *

variable_types:
used
unsigned char *

variable_types:
n
unsigned int

variable_types:
a
unsigned int

variable_types:
b
unsigned int

variable_types: iter int

variable_types: i int

variable_types:
val
unsigned long long

variable_types:
ltemp
unsigned long long

variable_types:
loc
unsigned short


original_code:
void
shiftleft2_I4(
       int *in1,
       int *in2,
       long long nR,
       int * restrict out
       )
{
  int inv1, inv2, outv;
  for ( long long i = 0; i < nR; i++ ) {
    inv1 = *in1;
    inv2 = *in2;
    outv = inv1 << inv2;
    *out = outv;
    in1++;
    in2++;
    out++;
  }
}

canonical_original_code:
void shiftleft2_I4(int *in1, int *in2, long long nR, int *out)
{
  int inv1; int inv2; int outv;
  for ( long long i = 0; i < nR; i++ ) {
    inv1 = *in1;
    inv2 = *in2;
    outv = inv1 << inv2;
    *out = outv;
    in1++;
    in2++;
    out++;
  }
}

variable_types:
out
int *

variable_types: outv int


original_code:
int
f1T1opf2(
  char *tbl,
  char *f1,
  char *T1,
  char *op,
  char *f2
  )
{
  int status = 0;
  char *f1_X = ((void *)0); size_t f1_nX = 0;
  char *nn_f1_X = ((void *)0); size_t nn_f1_nX = 0;
  char *f2_X = ((void *)0); size_t f2_nX = 0;
  char *nn_f2_X = ((void *)0); size_t nn_f2_nX = 0;
  char *lb_X; size_t lb_nX = 0;
  char *ub_X; size_t ub_nX = 0;
  long long nR = 0x7fffffffffffffffLL, nR2 = 0x7fffffffffffffffLL;
  TBL_REC_TYPE tbl_rec; int tbl_id;
  TBL_REC_TYPE T1_rec; int T1_id;
  FLD_REC_TYPE f1_rec, nn_f1_rec; int f1_id, nn_f1_id;
  FLD_REC_TYPE f2_rec, nn_f2_rec; int f2_id, nn_f2_id;
  FLD_REC_TYPE lb_rec, nn_lb_rec; int lb_id, nn_lb_id;
  FLD_REC_TYPE ub_rec, nn_ub_rec; int ub_id, nn_ub_id;
  char opfile[15 +1];
  char nn_opfile[15 +1];
  if ( ( tbl == ((void *)0) ) || ( *tbl == '\0' ) ) { { { fprintf(stderr, "Line %3d of File %s \n", 57, "./dir_wr_verbs/f1T1opf2.c"); }; status = -1 ; goto BYE; }; }
  if ( ( f1 == ((void *)0) ) || ( *f1 == '\0' ) ) { { { fprintf(stderr, "Line %3d of File %s \n", 58, "./dir_wr_verbs/f1T1opf2.c"); }; status = -1 ; goto BYE; }; }
  if ( ( T1 == ((void *)0) ) || ( *T1 == '\0' ) ) { { { fprintf(stderr, "Line %3d of File %s \n", 59, "./dir_wr_verbs/f1T1opf2.c"); }; status = -1 ; goto BYE; }; }
  if ( ( f2 == ((void *)0) ) || ( *f2 == '\0' ) ) { { { fprintf(stderr, "Line %3d of File %s \n", 60, "./dir_wr_verbs/f1T1opf2.c"); }; status = -1 ; goto BYE; }; }
  if ( ( op == ((void *)0) ) || ( *op == '\0' ) ) { { { fprintf(stderr, "Line %3d of File %s \n", 61, "./dir_wr_verbs/f1T1opf2.c"); }; status = -1 ; goto BYE; }; }
  zero_string(opfile, 15 +1);
  zero_string(nn_opfile, 15 +1);
  status = is_tbl(tbl, &tbl_id, &tbl_rec); { if ( (status) < 0 ) { { { fprintf(stderr, "Line %3d of File %s \n", 65, "./dir_wr_verbs/f1T1opf2.c"); }; status = (status) ; goto BYE; } } };
  { if ( ( (tbl_id) < (0) ) || ( (tbl_id) >= (g_n_tbl ) ) ) { { { fprintf(stderr, "Line %3d of File %s \n", 66, "./dir_wr_verbs/f1T1opf2.c"); }; status = -1 ; goto BYE; }; } };
  nR = tbl_rec.nR;
  status = is_fld(((void *)0), tbl_id, f1, &f1_id, &f1_rec, &nn_f1_id, &nn_f1_rec);
  { if ( ( (f1_id) < (0) ) || ( (f1_id) >= (g_n_fld ) ) ) { { { fprintf(stderr, "Line %3d of File %s \n", 69, "./dir_wr_verbs/f1T1opf2.c"); }; status = -1 ; goto BYE; }; } };
  status = get_data(f1_rec, &f1_X, &f1_nX, 0); { if ( (status) < 0 ) { { { fprintf(stderr, "Line %3d of File %s \n", 70, "./dir_wr_verbs/f1T1opf2.c"); }; status = (status) ; goto BYE; } } };
  if ( nn_f1_id >= 0 ) {
    status = get_data(nn_f1_rec, &nn_f1_X, &nn_f1_nX, 0);
    { if ( (status) < 0 ) { { { fprintf(stderr, "Line %3d of File %s \n", 74, "./dir_wr_verbs/f1T1opf2.c"); }; status = (status) ; goto BYE; } } };
  }
  status = is_tbl(T1, &T1_id, &T1_rec); { if ( (status) < 0 ) { { { fprintf(stderr, "Line %3d of File %s \n", 76, "./dir_wr_verbs/f1T1opf2.c"); }; status = (status) ; goto BYE; } } };
  { if ( ( (T1_id) < (0) ) || ( (T1_id) >= (g_n_tbl ) ) ) { { { fprintf(stderr, "Line %3d of File %s \n", 77, "./dir_wr_verbs/f1T1opf2.c"); }; status = -1 ; goto BYE; }; } };
  nR2 = T1_rec.nR;
  int fldsz = 0x7fffffff, ddir_id = 0x7fffffff, nn_ddir_id = 0x7fffffff;
  status = get_fld_sz(f1_rec.fldtype, &fldsz); { if ( (status) < 0 ) { { { fprintf(stderr, "Line %3d of File %s \n", 81, "./dir_wr_verbs/f1T1opf2.c"); }; status = (status) ; goto BYE; } } };
  status = mk_temp_file(opfile, (nR * fldsz), &ddir_id); { if ( (status) < 0 ) { { { fprintf(stderr, "Line %3d of File %s \n", 83, "./dir_wr_verbs/f1T1opf2.c"); }; status = (status) ; goto BYE; } } };
  status = q_mmap(ddir_id, opfile, &f2_X, &f2_nX, 1); { if ( (status) < 0 ) { { { fprintf(stderr, "Line %3d of File %s \n", 84, "./dir_wr_verbs/f1T1opf2.c"); }; status = (status) ; goto BYE; } } };
  status = mk_temp_file(nn_opfile, (nR * sizeof(char)), &nn_ddir_id); { if ( (status) < 0 ) { { { fprintf(stderr, "Line %3d of File %s \n", 86, "./dir_wr_verbs/f1T1opf2.c"); }; status = (status) ; goto BYE; } } };
  status = q_mmap(nn_ddir_id, nn_opfile, &nn_f2_X, &nn_f2_nX, 1); { if ( (status) < 0 ) { { { fprintf(stderr, "Line %3d of File %s \n", 87, "./dir_wr_verbs/f1T1opf2.c"); }; status = (status) ; goto BYE; } } };
  if ( strcmp(op, "bin") == 0 ) {
    status = is_fld(((void *)0), T1_id, "lb", &lb_id, &lb_rec, &nn_lb_id, &nn_lb_rec);
    { if ( ( (lb_id) < (0) ) || ( (lb_id) >= (g_n_fld ) ) ) { { { fprintf(stderr, "Line %3d of File %s \n", 91, "./dir_wr_verbs/f1T1opf2.c"); }; status = -1 ; goto BYE; }; } };
    if ( nn_lb_id >= 0 ) { { { fprintf(stderr, "Line %3d of File %s \n", 92, "./dir_wr_verbs/f1T1opf2.c"); }; status = -1 ; goto BYE; }; }
    status = get_data(lb_rec, &lb_X, &lb_nX, 0); { if ( (status) < 0 ) { { { fprintf(stderr, "Line %3d of File %s \n", 93, "./dir_wr_verbs/f1T1opf2.c"); }; status = (status) ; goto BYE; } } };
    status = is_fld(((void *)0), T1_id, "ub", &ub_id, &ub_rec, &nn_ub_id, &nn_ub_rec);
    { if ( ( (ub_id) < (0) ) || ( (ub_id) >= (g_n_fld ) ) ) { { { fprintf(stderr, "Line %3d of File %s \n", 96, "./dir_wr_verbs/f1T1opf2.c"); }; status = -1 ; goto BYE; }; } };
    if ( nn_ub_id >= 0 ) { { { fprintf(stderr, "Line %3d of File %s \n", 97, "./dir_wr_verbs/f1T1opf2.c"); }; status = -1 ; goto BYE; }; }
    status = get_data(ub_rec, &ub_X, &ub_nX, 0); { if ( (status) < 0 ) { { { fprintf(stderr, "Line %3d of File %s \n", 98, "./dir_wr_verbs/f1T1opf2.c"); }; status = (status) ; goto BYE; } } };
    if ( lb_rec.fldtype != I4 ) { { { fprintf(stderr, "Line %3d of File %s \n", 100, "./dir_wr_verbs/f1T1opf2.c"); }; status = -1 ; goto BYE; }; }
    int *lbI4 = (int *)lb_X;
    if ( ub_rec.fldtype != I4 ) { { { fprintf(stderr, "Line %3d of File %s \n", 102, "./dir_wr_verbs/f1T1opf2.c"); }; status = -1 ; goto BYE; }; }
    int *ubI4 = (int *)ub_X;
    if ( f1_rec.fldtype != I4 ) { { { fprintf(stderr, "Line %3d of File %s \n", 104, "./dir_wr_verbs/f1T1opf2.c"); }; status = -1 ; goto BYE; }; }
    int *f1I4 = (int *)f1_X;
    for ( long long i = 0; i < nR; i++ ) {
      _Bool exists = 0;
      register int valI4 = f1I4[i];
      int t2idx;
      register int *f2I4 = (int *)f2_X;
      register char *f2nn = nn_f2_X;
      which_bin_I4(valI4, lbI4, ubI4, nR2, &t2idx, &exists);
      if ( exists ) {
 f2nn[i] = 1;
 f2I4[i] = t2idx;
      }
      else {
 f2nn[i] = 0;
 f2I4[i] = 0;
      }
    }
  }
  else if ( strcmp(op, "regroup") == 0 ) {
  }
  else {
    { { fprintf(stderr, "Line %3d of File %s \n", 137, "./dir_wr_verbs/f1T1opf2.c"); }; status = -1 ; goto BYE; };
  }
  status = add_fld(tbl_id, f2, ddir_id, opfile, I4, -1, &f2_id, &f2_rec);
  { if ( (status) < 0 ) { { { fprintf(stderr, "Line %3d of File %s \n", 142, "./dir_wr_verbs/f1T1opf2.c"); }; status = (status) ; goto BYE; } } };
  if ( *nn_opfile != '\0' ) {
    status = add_aux_fld(((void *)0), tbl_id, ((void *)0), f2_id, nn_ddir_id, nn_opfile,
 "nn", &nn_f2_id, &nn_f2_rec);
    { if ( (status) < 0 ) { { { fprintf(stderr, "Line %3d of File %s \n", 146, "./dir_wr_verbs/f1T1opf2.c"); }; status = (status) ; goto BYE; } } };
  }
  else {
    fprintf(stderr, "Invalid op = [%s] \n", op);
    { { fprintf(stderr, "Line %3d of File %s \n", 150, "./dir_wr_verbs/f1T1opf2.c"); }; status = -1 ; goto BYE; };
  }
 BYE:
  { if ( ( f1_X == ((void *)0) ) && ( f1_nX != 0 ) ) { { fprintf(stderr, "Line %3d of File %s \n", 153, "./dir_wr_verbs/f1T1opf2.c"); }; return(-1); } if ( ( f1_X != ((void *)0) ) && ( f1_nX == 0 ) ) { { fprintf(stderr, "Line %3d of File %s \n", 153, "./dir_wr_verbs/f1T1opf2.c"); }; return(-1); } if ( f1_X != ((void *)0) ) { munmap(f1_X, f1_nX); f1_X = ((void *)0); f1_nX = 0; } };
  { if ( ( nn_f1_X == ((void *)0) ) && ( nn_f1_nX != 0 ) ) { { fprintf(stderr, "Line %3d of File %s \n", 154, "./dir_wr_verbs/f1T1opf2.c"); }; return(-1); } if ( ( nn_f1_X != ((void *)0) ) && ( nn_f1_nX == 0 ) ) { { fprintf(stderr, "Line %3d of File %s \n", 154, "./dir_wr_verbs/f1T1opf2.c"); }; return(-1); } if ( nn_f1_X != ((void *)0) ) { munmap(nn_f1_X, nn_f1_nX); nn_f1_X = ((void *)0); nn_f1_nX = 0; } };
  { if ( ( f2_X == ((void *)0) ) && ( f2_nX != 0 ) ) { { fprintf(stderr, "Line %3d of File %s \n", 155, "./dir_wr_verbs/f1T1opf2.c"); }; return(-1); } if ( ( f2_X != ((void *)0) ) && ( f2_nX == 0 ) ) { { fprintf(stderr, "Line %3d of File %s \n", 155, "./dir_wr_verbs/f1T1opf2.c"); }; return(-1); } if ( f2_X != ((void *)0) ) { munmap(f2_X, f2_nX); f2_X = ((void *)0); f2_nX = 0; } };
  { if ( ( nn_f2_X == ((void *)0) ) && ( nn_f2_nX != 0 ) ) { { fprintf(stderr, "Line %3d of File %s \n", 156, "./dir_wr_verbs/f1T1opf2.c"); }; return(-1); } if ( ( nn_f2_X != ((void *)0) ) && ( nn_f2_nX == 0 ) ) { { fprintf(stderr, "Line %3d of File %s \n", 156, "./dir_wr_verbs/f1T1opf2.c"); }; return(-1); } if ( nn_f2_X != ((void *)0) ) { munmap(nn_f2_X, nn_f2_nX); nn_f2_X = ((void *)0); nn_f2_nX = 0; } };
  { if ( ( lb_X == ((void *)0) ) && ( lb_nX != 0 ) ) { { fprintf(stderr, "Line %3d of File %s \n", 157, "./dir_wr_verbs/f1T1opf2.c"); }; return(-1); } if ( ( lb_X != ((void *)0) ) && ( lb_nX == 0 ) ) { { fprintf(stderr, "Line %3d of File %s \n", 157, "./dir_wr_verbs/f1T1opf2.c"); }; return(-1); } if ( lb_X != ((void *)0) ) { munmap(lb_X, lb_nX); lb_X = ((void *)0); lb_nX = 0; } };
  { if ( ( ub_X == ((void *)0) ) && ( ub_nX != 0 ) ) { { fprintf(stderr, "Line %3d of File %s \n", 158, "./dir_wr_verbs/f1T1opf2.c"); }; return(-1); } if ( ( ub_X != ((void *)0) ) && ( ub_nX == 0 ) ) { { fprintf(stderr, "Line %3d of File %s \n", 158, "./dir_wr_verbs/f1T1opf2.c"); }; return(-1); } if ( ub_X != ((void *)0) ) { munmap(ub_X, ub_nX); ub_X = ((void *)0); ub_nX = 0; } };
  return(status);
}

canonical_original_code:
int f1T1opf2(char *tbl, char *f1, char *T1, char *op, char *f2)
{
  int status = 0;
  char *f1_X = ((void *)0); unsigned long f1_nX = 0;
  char *nn_f1_X = ((void *)0); unsigned long nn_f1_nX = 0;
  char *f2_X = ((void *)0); unsigned long f2_nX = 0;
  char *nn_f2_X = ((void *)0); unsigned long nn_f2_nX = 0;
  char *lb_X; unsigned long lb_nX = 0;
  char *ub_X; unsigned long ub_nX = 0;
  long long nR = 0x7fffffffffffffffLL; long long nR2 = 0x7fffffffffffffffLL;
  struct _TBL_REC_TYPE tbl_rec; int tbl_id;
  struct _TBL_REC_TYPE T1_rec; int T1_id;
  struct _FLD_REC_TYPE f1_rec; struct _FLD_REC_TYPE nn_f1_rec; int f1_id; int nn_f1_id;
  struct _FLD_REC_TYPE f2_rec; struct _FLD_REC_TYPE nn_f2_rec; int f2_id; int nn_f2_id;
  struct _FLD_REC_TYPE lb_rec; struct _FLD_REC_TYPE nn_lb_rec; int lb_id; int nn_lb_id;
  struct _FLD_REC_TYPE ub_rec; struct _FLD_REC_TYPE nn_ub_rec; int ub_id; int nn_ub_id;
  char opfile[-1];
  char nn_opfile[-1];
  if ( ( tbl == ((void *)0) ) || ( *tbl == '\0' ) ) { { { fprintf(stderr, "Line %3d of File %s \n", 57, "./dir_wr_verbs/f1T1opf2.c"); }; status = -1 ; goto BYE; }; }
  if ( ( f1 == ((void *)0) ) || ( *f1 == '\0' ) ) { { { fprintf(stderr, "Line %3d of File %s \n", 58, "./dir_wr_verbs/f1T1opf2.c"); }; status = -1 ; goto BYE; }; }
  if ( ( T1 == ((void *)0) ) || ( *T1 == '\0' ) ) { { { fprintf(stderr, "Line %3d of File %s \n", 59, "./dir_wr_verbs/f1T1opf2.c"); }; status = -1 ; goto BYE; }; }
  if ( ( f2 == ((void *)0) ) || ( *f2 == '\0' ) ) { { { fprintf(stderr, "Line %3d of File %s \n", 60, "./dir_wr_verbs/f1T1opf2.c"); }; status = -1 ; goto BYE; }; }
  if ( ( op == ((void *)0) ) || ( *op == '\0' ) ) { { { fprintf(stderr, "Line %3d of File %s \n", 61, "./dir_wr_verbs/f1T1opf2.c"); }; status = -1 ; goto BYE; }; }
  zero_string(opfile, 15 +1);
  zero_string(nn_opfile, 15 +1);
  status = is_tbl(tbl, &tbl_id, &tbl_rec); { if ( (status) < 0 ) { { { fprintf(stderr, "Line %3d of File %s \n", 65, "./dir_wr_verbs/f1T1opf2.c"); }; status = (status) ; goto BYE; } } };
  { if ( ( (tbl_id) < (0) ) || ( (tbl_id) >= (g_n_tbl ) ) ) { { { fprintf(stderr, "Line %3d of File %s \n", 66, "./dir_wr_verbs/f1T1opf2.c"); }; status = -1 ; goto BYE; }; } };
  nR = tbl_rec.nR;
  status = is_fld(((void *)0), tbl_id, f1, &f1_id, &f1_rec, &nn_f1_id, &nn_f1_rec);
  { if ( ( (f1_id) < (0) ) || ( (f1_id) >= (g_n_fld ) ) ) { { { fprintf(stderr, "Line %3d of File %s \n", 69, "./dir_wr_verbs/f1T1opf2.c"); }; status = -1 ; goto BYE; }; } };
  status = get_data(f1_rec, &f1_X, &f1_nX, 0); { if ( (status) < 0 ) { { { fprintf(stderr, "Line %3d of File %s \n", 70, "./dir_wr_verbs/f1T1opf2.c"); }; status = (status) ; goto BYE; } } };
  if ( nn_f1_id >= 0 ) {
    status = get_data(nn_f1_rec, &nn_f1_X, &nn_f1_nX, 0);
    { if ( (status) < 0 ) { { { fprintf(stderr, "Line %3d of File %s \n", 74, "./dir_wr_verbs/f1T1opf2.c"); }; status = (status) ; goto BYE; } } };
  }
  status = is_tbl(T1, &T1_id, &T1_rec); { if ( (status) < 0 ) { { { fprintf(stderr, "Line %3d of File %s \n", 76, "./dir_wr_verbs/f1T1opf2.c"); }; status = (status) ; goto BYE; } } };
  { if ( ( (T1_id) < (0) ) || ( (T1_id) >= (g_n_tbl ) ) ) { { { fprintf(stderr, "Line %3d of File %s \n", 77, "./dir_wr_verbs/f1T1opf2.c"); }; status = -1 ; goto BYE; }; } };
  nR2 = T1_rec.nR;
  int fldsz = 0x7fffffff; int ddir_id = 0x7fffffff; int nn_ddir_id = 0x7fffffff;
  status = get_fld_sz(f1_rec.fldtype, &fldsz); { if ( (status) < 0 ) { { { fprintf(stderr, "Line %3d of File %s \n", 81, "./dir_wr_verbs/f1T1opf2.c"); }; status = (status) ; goto BYE; } } };
  status = mk_temp_file(opfile, (nR * fldsz), &ddir_id); { if ( (status) < 0 ) { { { fprintf(stderr, "Line %3d of File %s \n", 83, "./dir_wr_verbs/f1T1opf2.c"); }; status = (status) ; goto BYE; } } };
  status = q_mmap(ddir_id, opfile, &f2_X, &f2_nX, 1); { if ( (status) < 0 ) { { { fprintf(stderr, "Line %3d of File %s \n", 84, "./dir_wr_verbs/f1T1opf2.c"); }; status = (status) ; goto BYE; } } };
  status = mk_temp_file(nn_opfile, (nR * sizeof(char)), &nn_ddir_id); { if ( (status) < 0 ) { { { fprintf(stderr, "Line %3d of File %s \n", 86, "./dir_wr_verbs/f1T1opf2.c"); }; status = (status) ; goto BYE; } } };
  status = q_mmap(nn_ddir_id, nn_opfile, &nn_f2_X, &nn_f2_nX, 1); { if ( (status) < 0 ) { { { fprintf(stderr, "Line %3d of File %s \n", 87, "./dir_wr_verbs/f1T1opf2.c"); }; status = (status) ; goto BYE; } } };
  if ( strcmp(op, "bin") == 0 ) {
    status = is_fld(((void *)0), T1_id, "lb", &lb_id, &lb_rec, &nn_lb_id, &nn_lb_rec);
    { if ( ( (lb_id) < (0) ) || ( (lb_id) >= (g_n_fld ) ) ) { { { fprintf(stderr, "Line %3d of File %s \n", 91, "./dir_wr_verbs/f1T1opf2.c"); }; status = -1 ; goto BYE; }; } };
    if ( nn_lb_id >= 0 ) { { { fprintf(stderr, "Line %3d of File %s \n", 92, "./dir_wr_verbs/f1T1opf2.c"); }; status = -1 ; goto BYE; }; }
    status = get_data(lb_rec, &lb_X, &lb_nX, 0); { if ( (status) < 0 ) { { { fprintf(stderr, "Line %3d of File %s \n", 93, "./dir_wr_verbs/f1T1opf2.c"); }; status = (status) ; goto BYE; } } };
    status = is_fld(((void *)0), T1_id, "ub", &ub_id, &ub_rec, &nn_ub_id, &nn_ub_rec);
    { if ( ( (ub_id) < (0) ) || ( (ub_id) >= (g_n_fld ) ) ) { { { fprintf(stderr, "Line %3d of File %s \n", 96, "./dir_wr_verbs/f1T1opf2.c"); }; status = -1 ; goto BYE; }; } };
    if ( nn_ub_id >= 0 ) { { { fprintf(stderr, "Line %3d of File %s \n", 97, "./dir_wr_verbs/f1T1opf2.c"); }; status = -1 ; goto BYE; }; }
    status = get_data(ub_rec, &ub_X, &ub_nX, 0); { if ( (status) < 0 ) { { { fprintf(stderr, "Line %3d of File %s \n", 98, "./dir_wr_verbs/f1T1opf2.c"); }; status = (status) ; goto BYE; } } };
    if ( lb_rec.fldtype != I4 ) { { { fprintf(stderr, "Line %3d of File %s \n", 100, "./dir_wr_verbs/f1T1opf2.c"); }; status = -1 ; goto BYE; }; }
    int *lbI4 = (int *)lb_X;
    if ( ub_rec.fldtype != I4 ) { { { fprintf(stderr, "Line %3d of File %s \n", 102, "./dir_wr_verbs/f1T1opf2.c"); }; status = -1 ; goto BYE; }; }
    int *ubI4 = (int *)ub_X;
    if ( f1_rec.fldtype != I4 ) { { { fprintf(stderr, "Line %3d of File %s \n", 104, "./dir_wr_verbs/f1T1opf2.c"); }; status = -1 ; goto BYE; }; }
    int *f1I4 = (int *)f1_X;
    for ( long long i = 0; i < nR; i++ ) {
      _Bool exists = 0;
      register int valI4 = f1I4[i];
      int t2idx;
      register int *f2I4 = (int *)f2_X;
      register char *f2nn = nn_f2_X;
      which_bin_I4(valI4, lbI4, ubI4, nR2, &t2idx, &exists);
      if ( exists ) {
 f2nn[i] = 1;
 f2I4[i] = t2idx;
      }
      else {
 f2nn[i] = 0;
 f2I4[i] = 0;
      }
    }
  }
  else if ( strcmp(op, "regroup") == 0 ) {
  }
  else {
    { { fprintf(stderr, "Line %3d of File %s \n", 137, "./dir_wr_verbs/f1T1opf2.c"); }; status = -1 ; goto BYE; };
  }
  status = add_fld(tbl_id, f2, ddir_id, opfile, I4, -1, &f2_id, &f2_rec);
  { if ( (status) < 0 ) { { { fprintf(stderr, "Line %3d of File %s \n", 142, "./dir_wr_verbs/f1T1opf2.c"); }; status = (status) ; goto BYE; } } };
  if ( *nn_opfile != '\0' ) {
    status = add_aux_fld(((void *)0), tbl_id, ((void *)0), f2_id, nn_ddir_id, nn_opfile,
 "nn", &nn_f2_id, &nn_f2_rec);
    { if ( (status) < 0 ) { { { fprintf(stderr, "Line %3d of File %s \n", 146, "./dir_wr_verbs/f1T1opf2.c"); }; status = (status) ; goto BYE; } } };
  }
  else {
    fprintf(stderr, "Invalid op = [%s] \n", op);
    { { fprintf(stderr, "Line %3d of File %s \n", 150, "./dir_wr_verbs/f1T1opf2.c"); }; status = -1 ; goto BYE; };
  }
 BYE:
  { if ( ( f1_X == ((void *)0) ) && ( f1_nX != 0 ) ) { { fprintf(stderr, "Line %3d of File %s \n", 153, "./dir_wr_verbs/f1T1opf2.c"); }; return(-1); } if ( ( f1_X != ((void *)0) ) && ( f1_nX == 0 ) ) { { fprintf(stderr, "Line %3d of File %s \n", 153, "./dir_wr_verbs/f1T1opf2.c"); }; return(-1); } if ( f1_X != ((void *)0) ) { munmap(f1_X, f1_nX); f1_X = ((void *)0); f1_nX = 0; } };
  { if ( ( nn_f1_X == ((void *)0) ) && ( nn_f1_nX != 0 ) ) { { fprintf(stderr, "Line %3d of File %s \n", 154, "./dir_wr_verbs/f1T1opf2.c"); }; return(-1); } if ( ( nn_f1_X != ((void *)0) ) && ( nn_f1_nX == 0 ) ) { { fprintf(stderr, "Line %3d of File %s \n", 154, "./dir_wr_verbs/f1T1opf2.c"); }; return(-1); } if ( nn_f1_X != ((void *)0) ) { munmap(nn_f1_X, nn_f1_nX); nn_f1_X = ((void *)0); nn_f1_nX = 0; } };
  { if ( ( f2_X == ((void *)0) ) && ( f2_nX != 0 ) ) { { fprintf(stderr, "Line %3d of File %s \n", 155, "./dir_wr_verbs/f1T1opf2.c"); }; return(-1); } if ( ( f2_X != ((void *)0) ) && ( f2_nX == 0 ) ) { { fprintf(stderr, "Line %3d of File %s \n", 155, "./dir_wr_verbs/f1T1opf2.c"); }; return(-1); } if ( f2_X != ((void *)0) ) { munmap(f2_X, f2_nX); f2_X = ((void *)0); f2_nX = 0; } };
  { if ( ( nn_f2_X == ((void *)0) ) && ( nn_f2_nX != 0 ) ) { { fprintf(stderr, "Line %3d of File %s \n", 156, "./dir_wr_verbs/f1T1opf2.c"); }; return(-1); } if ( ( nn_f2_X != ((void *)0) ) && ( nn_f2_nX == 0 ) ) { { fprintf(stderr, "Line %3d of File %s \n", 156, "./dir_wr_verbs/f1T1opf2.c"); }; return(-1); } if ( nn_f2_X != ((void *)0) ) { munmap(nn_f2_X, nn_f2_nX); nn_f2_X = ((void *)0); nn_f2_nX = 0; } };
  { if ( ( lb_X == ((void *)0) ) && ( lb_nX != 0 ) ) { { fprintf(stderr, "Line %3d of File %s \n", 157, "./dir_wr_verbs/f1T1opf2.c"); }; return(-1); } if ( ( lb_X != ((void *)0) ) && ( lb_nX == 0 ) ) { { fprintf(stderr, "Line %3d of File %s \n", 157, "./dir_wr_verbs/f1T1opf2.c"); }; return(-1); } if ( lb_X != ((void *)0) ) { munmap(lb_X, lb_nX); lb_X = ((void *)0); lb_nX = 0; } };
  { if ( ( ub_X == ((void *)0) ) && ( ub_nX != 0 ) ) { { fprintf(stderr, "Line %3d of File %s \n", 158, "./dir_wr_verbs/f1T1opf2.c"); }; return(-1); } if ( ( ub_X != ((void *)0) ) && ( ub_nX == 0 ) ) { { fprintf(stderr, "Line %3d of File %s \n", 158, "./dir_wr_verbs/f1T1opf2.c"); }; return(-1); } if ( ub_X != ((void *)0) ) { munmap(ub_X, ub_nX); ub_X = ((void *)0); ub_nX = 0; } };
  return(status);
}

variable_types:
tbl
char *

variable_types:
op
char *

variable_types:
nR
long long

variable_types: struct _TBL_REC_TYPE { long long nR; char name[-1]; char dispname[-1]; _Bool is_dict_tbl; }

variable_types: struct _FLD_REC_TYPE { int tbl_id; int ddir_id; int is_external; enum _SORT_TYPE { unknown=0, ascending=1, descending=2, unsorted=3 } sort_type; int parent_id; int nn_fld_id; enum _FLD_TYPE { xunknown=0, B=1, I1=2, I2=3, I4=4, I8=5, F4=6, F8=7, clob=8 } fldtype; enum _AUX_TYPE { undef=0, nn=1 } auxtype; char name[-1]; char filename[-1]; char dispname[-1]; int dict_tbl_id; int alias_of_fld_id; long long cnt; }

variable_types:
opfile
char [-1]

variable_types: fldsz int

user_defined_types: struct _FLD_REC_TYPE { int tbl_id; int ddir_id; int is_external; enum _SORT_TYPE sort_type; int parent_id; int nn_fld_id; enum _FLD_TYPE fldtype; enum _AUX_TYPE auxtype; char name[-1]; char filename[-1]; char dispname[-1]; int dict_tbl_id; int alias_of_fld_id; long long cnt; }


decompiled_code:
__int64 __fastcall pos_sel_copy_I4_I4(__int64 a1, __int64 a2, __int64 a3, __int64 a4, int a5, int a6, __int64 a7, _QWORD *a8)
{
__int64 v12; // rdx
__int64 v13; // rcx
int v14; // eax
__int64 v15; // rax
__int64 result; // rax

if ( a4 <= 0 )
{
v13 = 0LL;
LABEL_11:
*a8 = v13;
result = 0LL;
}
else
{
v12 = 0LL;
v13 = 0LL;
while ( 1 )
{
v15 = *(int *)(a3 + 4 * v12);
if ( (int)v15 < 0 || v15 >= a2 )
break;
v14 = *(_DWORD *)(a1 + 4 * v15);
if ( v14 >= a5 && v14 <= a6 )
*(_DWORD *)(a7 + 4 * v13++) = v14;
if ( a4 == ++v12 )
goto LABEL_11;
}
fprintf(stderr, "Line %3d of File %s \n", 34LL, "./AUX/pos_sel_copy_I4_I4.c");
result = 0xFFFFFFFFLL;
}
return result;
}

original_code:
int
pos_sel_copy_I4_I4(
    int *f1,
    long long nR1,
    int *f2,
    long long nR2,
    int lb,
    int ub,
    int *f3,
    long long *ptr_cnt
    )
{
  int status = 0;
  long long cnt = 0;
  long long i3 = 0;
  for ( long long i2 = 0; i2 < nR2; i2++ ) {
    int f1idx = f2[i2];
    if ( ( f1idx < 0 ) || ( f1idx >= nR1 ) ) { { { fprintf(stderr, "Line %3d of File %s \n", 34, "./AUX/pos_sel_copy_I4_I4.c"); }; status = -1 ; goto BYE; }; }
    int val = f1[f1idx];
    if ( ( val >= lb ) && ( val <= ub ) ) {
      f3[i3++] = val;
      cnt++;
    }
  }
  *ptr_cnt = cnt;
BYE:
  return(status);
}

canonical_original_code:
int pos_sel_copy_I4_I4(int *f1, long long nR1, int *f2, long long nR2, int lb, int ub, int *f3, long long *ptr_cnt)
{
  int status = 0;
  long long cnt = 0;
  long long i3 = 0;
  for ( long long i2 = 0; i2 < nR2; i2++ ) {
    int f1idx = f2[i2];
    if ( ( f1idx < 0 ) || ( f1idx >= nR1 ) ) { { { fprintf(stderr, "Line %3d of File %s \n", 34, "./AUX/pos_sel_copy_I4_I4.c"); }; status = -1 ; goto BYE; }; }
    int val = f1[f1idx];
    if ( ( val >= lb ) && ( val <= ub ) ) {
      f3[i3++] = val;
      cnt++;
    }
  }
  *ptr_cnt = cnt;
BYE:
  return(status);
}

variable_types: lb int

variable_types: ub int

variable_types: status int

variable_types:
cnt
long long

variable_types: val int


original_code:
int
countf_I4(
  int *fk_fld,
  int *src_fld,
  long long n,
  long long * restrict cnt,
  int n_out
  )
{
  int status = 0;
  for ( long long i = 0; i < n; i++ ) {
    int idx = fk_fld[i];
    int idxI4 = (int )idx;
    int val = src_fld[i];
    cnt[idxI4] += val;
  }
  return(status);
}

canonical_original_code:
int countf_I4(int *fk_fld, int *src_fld, long long n, long long *cnt, int n_out)
{
  int status = 0;
  for ( long long i = 0; i < n; i++ ) {
    int idx = fk_fld[i];
    int idxI4 = (int )idx;
    int val = src_fld[i];
    cnt[idxI4] += val;
  }
  return(status);
}

variable_types:
n
long long

variable_types:
cnt
long long *

variable_types:
i
long long

variable_types: idx int


original_code:
int
core_srt_join_I_I_L(
          int *src_lnk,
          int *src_val,
          long long src_nR,
          long long *dst_lnk,
          int *dst_val,
          char *nn_dst_val,
          long long dst_lb,
          long long dst_ub,
          int ijoin_op,
          _Bool *ptr_is_any_null
          )
{
  int status = 0;
  long long src_idx;
  long long v_dst_lnk;
  int v_src_val;
  int v_src_lnk;
  _Bool found, prev_val_known = 0;
  status = set_init(nn_dst_val, dst_val, dst_lb, dst_ub, ijoin_op);
  { if ( (status) < 0 ) { { { fprintf(stderr, "Line %3d of File %s \n", 117, "./AUX/core_srt_join_I_I_L.c"); }; status = (status) ; goto BYE; } } };
  src_idx = 0;
  for ( long long dst_idx = dst_lb; dst_idx < dst_ub; dst_idx++ ) {
    v_dst_lnk = dst_lnk[dst_idx];
    if ( dst_idx > 0 ) {
      if ( v_dst_lnk == dst_lnk[dst_idx-1] ) {
 if ( dst_val != ((void *)0) ) {
   dst_val[dst_idx] = dst_val[dst_idx-1];
 }
        nn_dst_val[dst_idx] = nn_dst_val[dst_idx-1];
        continue;
      }
    }
    found = 0;
    for ( ; src_idx < src_nR; ) {
      v_src_lnk = src_lnk[src_idx];
      if ( v_src_lnk == v_dst_lnk ) {
 found = 1;
 prev_val_known = 1;
 break;
      }
      else if ( v_src_lnk > v_dst_lnk ) {
 if ( *ptr_is_any_null == 0 ) {
          *ptr_is_any_null = 1;
 }
 found = 0;
 break;
      }
      long long delta = 1;
      long long expt_src_idx, prev_expt_src_idx;
      prev_expt_src_idx = src_idx + delta;
      for ( ; ; ) {
        expt_src_idx = src_idx + delta;
 if ( expt_src_idx >= src_nR ) {
   expt_src_idx = prev_expt_src_idx;
   break;
 }
        v_src_lnk = src_lnk[expt_src_idx];
        if ( v_src_lnk >= v_dst_lnk ) {
   expt_src_idx = prev_expt_src_idx;
   break;
        }
 else if ( v_src_lnk < v_dst_lnk ) {
   delta *= 2;
          prev_expt_src_idx = expt_src_idx;
        }
      }
      src_idx = expt_src_idx;
    }
    if ( found == 1 ) {
      nn_dst_val[dst_idx] = 1;
      for ( ; src_idx < src_nR; src_idx++ ) {
        v_src_lnk = src_lnk[src_idx];
 if ( v_src_lnk != v_dst_lnk ) {
   src_idx--;
   break;
 }
 if ( src_val != ((void *)0) ) {
   v_src_val = src_val[src_idx];
   switch ( ijoin_op ) {
   case 100 :
     dst_val[dst_idx] += v_src_val;
     break;
   case 300 :
     if ( v_src_val > dst_val[dst_idx] ) {
       dst_val[dst_idx] = v_src_val;
     }
     break;
   case 200 :
     if ( v_src_val < dst_val[dst_idx] ) {
       dst_val[dst_idx] = v_src_val;
     }
     break;
   case 600 :
     dst_val[dst_idx] |= v_src_val;
     break;
   case 700 :
     dst_val[dst_idx] &= v_src_val;
     break;
   case 500 :
     dst_val[dst_idx] = v_src_val;
     break;
   default :
     { { fprintf(stderr, "Line %3d of File %s \n", 216, "./AUX/core_srt_join_I_I_L.c"); }; status = -1 ; goto BYE; };
     break;
   }
 }
 else {
   if ( ijoin_op == 800 ) {
            dst_val[dst_idx] += 1;
   }
 }
      }
    }
    else {
      if ( *ptr_is_any_null == 0 ) {
        *ptr_is_any_null = 1;
      }
      nn_dst_val[dst_idx] = 0;
    }
  }
  if ( *ptr_is_any_null ) {
    for ( long long dst_idx = dst_lb; dst_idx < dst_ub; dst_idx++ ) {
      if ( nn_dst_val[dst_idx] == 0 ) {
 dst_val[dst_idx] = 0;
      }
    }
  }
 BYE:
  return(status);
}

canonical_original_code:
int core_srt_join_I_I_L(int *src_lnk, int *src_val, long long src_nR, long long *dst_lnk, int *dst_val, char *nn_dst_val, long long dst_lb, long long dst_ub, int ijoin_op, _Bool *ptr_is_any_null)
{
  int status = 0;
  long long src_idx;
  long long v_dst_lnk;
  int v_src_val;
  int v_src_lnk;
  _Bool found; _Bool prev_val_known = 0;
  status = set_init(nn_dst_val, dst_val, dst_lb, dst_ub, ijoin_op);
  { if ( (status) < 0 ) { { { fprintf(stderr, "Line %3d of File %s \n", 117, "./AUX/core_srt_join_I_I_L.c"); }; status = (status) ; goto BYE; } } };
  src_idx = 0;
  for ( long long dst_idx = dst_lb; dst_idx < dst_ub; dst_idx++ ) {
    v_dst_lnk = dst_lnk[dst_idx];
    if ( dst_idx > 0 ) {
      if ( v_dst_lnk == dst_lnk[dst_idx-1] ) {
 if ( dst_val != ((void *)0) ) {
   dst_val[dst_idx] = dst_val[dst_idx-1];
 }
        nn_dst_val[dst_idx] = nn_dst_val[dst_idx-1];
        continue;
      }
    }
    found = 0;
    for ( ; src_idx < src_nR; ) {
      v_src_lnk = src_lnk[src_idx];
      if ( v_src_lnk == v_dst_lnk ) {
 found = 1;
 prev_val_known = 1;
 break;
      }
      else if ( v_src_lnk > v_dst_lnk ) {
 if ( *ptr_is_any_null == 0 ) {
          *ptr_is_any_null = 1;
 }
 found = 0;
 break;
      }
      long long delta = 1;
      long long expt_src_idx; long long prev_expt_src_idx;
      prev_expt_src_idx = src_idx + delta;
      for ( ; ; ) {
        expt_src_idx = src_idx + delta;
 if ( expt_src_idx >= src_nR ) {
   expt_src_idx = prev_expt_src_idx;
   break;
 }
        v_src_lnk = src_lnk[expt_src_idx];
        if ( v_src_lnk >= v_dst_lnk ) {
   expt_src_idx = prev_expt_src_idx;
   break;
        }
 else if ( v_src_lnk < v_dst_lnk ) {
   delta *= 2;
          prev_expt_src_idx = expt_src_idx;
        }
      }
      src_idx = expt_src_idx;
    }
    if ( found == 1 ) {
      nn_dst_val[dst_idx] = 1;
      for ( ; src_idx < src_nR; src_idx++ ) {
        v_src_lnk = src_lnk[src_idx];
 if ( v_src_lnk != v_dst_lnk ) {
   src_idx--;
   break;
 }
 if ( src_val != ((void *)0) ) {
   v_src_val = src_val[src_idx];
   switch ( ijoin_op ) {
   case 100 :
     dst_val[dst_idx] += v_src_val;
     break;
   case 300 :
     if ( v_src_val > dst_val[dst_idx] ) {
       dst_val[dst_idx] = v_src_val;
     }
     break;
   case 200 :
     if ( v_src_val < dst_val[dst_idx] ) {
       dst_val[dst_idx] = v_src_val;
     }
     break;
   case 600 :
     dst_val[dst_idx] |= v_src_val;
     break;
   case 700 :
     dst_val[dst_idx] &= v_src_val;
     break;
   case 500 :
     dst_val[dst_idx] = v_src_val;
     break;
   default :
     { { fprintf(stderr, "Line %3d of File %s \n", 216, "./AUX/core_srt_join_I_I_L.c"); }; status = -1 ; goto BYE; };
     break;
   }
 }
 else {
   if ( ijoin_op == 800 ) {
            dst_val[dst_idx] += 1;
   }
 }
      }
    }
    else {
      if ( *ptr_is_any_null == 0 ) {
        *ptr_is_any_null = 1;
      }
      nn_dst_val[dst_idx] = 0;
    }
  }
  if ( *ptr_is_any_null ) {
    for ( long long dst_idx = dst_lb; dst_idx < dst_ub; dst_idx++ ) {
      if ( nn_dst_val[dst_idx] == 0 ) {
 dst_val[dst_idx] = 0;
      }
    }
  }
 BYE:
  return(status);
}

variable_types:
delta
long long


decompiled_code:
__int64 __fastcall set_init(__int64 a1, __int64 a2, __int64 a3, int a4, int a5)
{
__int64 v8; // rdi

assign_const_I1(a3 + a1, 0LL, (unsigned int)(char)(a4 - a3));
if ( !a2 )
return 0LL;
v8 = a2 + 4 * a3;
if ( a5 == 300 )
{
assign_const_I4(v8, 0xFFFFFFFF80000000LL, (unsigned int)(a4 - a3));
return 0LL;
}
if ( a5 <= 300 )
{
if ( a5 == 100 )
{
LABEL_14:
assign_const_I4(v8, 0LL, (unsigned int)(a4 - a3));
return 0LL;
}
if ( a5 != 200 )
goto LABEL_7;
assign_const_I4(v8, 0x7FFFFFFFLL, (unsigned int)(a4 - a3));
return 0LL;
}
if ( a5 != 700 )
{
if ( a5 <= 700 )
{
if ( a5 != 500 && a5 != 600 )
goto LABEL_7;
}
else if ( a5 != 800 )
{
LABEL_7:
fprintf(stderr, "Line %3d of File %s \n", 67LL, "./AUX/core_srt_join_I_I_L.c");
return 0xFFFFFFFFLL;
}
goto LABEL_14;
}
assign_const_I4(v8, 0xFFFFFFFFLL, (unsigned int)(a4 - a3));
return 0LL;
}

canonical_decompiled_code:
__int64 __fastcall func0(__int64 a1, __int64 a2, __int64 a3, int a4, int a5)
{
__int64 v8; // rdi

assign_const_I1(a3 + a1, 0LL, (unsigned int)(char)(a4 - a3));
if ( !a2 )
return 0LL;
v8 = a2 + 4 * a3;
if ( a5 == 300 )
{
assign_const_I4(v8, 0xFFFFFFFF80000000LL, (unsigned int)(a4 - a3));
return 0LL;
}
if ( a5 <= 300 )
{
if ( a5 == 100 )
{
LABEL_14:
assign_const_I4(v8, 0LL, (unsigned int)(a4 - a3));
return 0LL;
}
if ( a5 != 200 )
goto LABEL_7;
assign_const_I4(v8, 0x7FFFFFFFLL, (unsigned int)(a4 - a3));
return 0LL;
}
if ( a5 != 700 )
{
if ( a5 <= 700 )
{
if ( a5 != 500 && a5 != 600 )
goto LABEL_7;
}
else if ( a5 != 800 )
{
LABEL_7:
fprintf(stderr, "Line %3d of File %s \n", 67LL, "./AUX/core_srt_join_I_I_L.c");
return 0xFFFFFFFFLL;
}
goto LABEL_14;
}
assign_const_I4(v8, 0xFFFFFFFFLL, (unsigned int)(a4 - a3));
return 0LL;
}

original_code:
static int
set_init(
  char *nn_dst_val,
  int *dst_val,
  long long lb,
  long long ub,
  int ijoin_op
  )
{
  int status = 0;
  assign_const_I1(nn_dst_val+lb, 0, (ub-lb));
  if ( dst_val != ((void *)0) ) {
    int *this_dst_val = dst_val;
    this_dst_val += lb;
    switch ( ijoin_op ) {
    case 500 :
    case 100 :
    case 800 :
    case 600 :
      assign_const_I4(this_dst_val, 0, (ub-lb));
      break;
    case 700 :
      assign_const_I4(this_dst_val, 0xFFFFFFFF, (ub-lb));
      break;
    case 200 :
      assign_const_I4(this_dst_val, 0x7fffffff, (ub-lb));
      break;
    case 300 :
      assign_const_I4(this_dst_val, (-0x7fffffff - 1), (ub-lb));
      break;
    default :
      { { fprintf(stderr, "Line %3d of File %s \n", 67, "./AUX/core_srt_join_I_I_L.c"); }; status = -1 ; goto BYE; };
      break;
    }
  }
 BYE:
  return(status);
}

canonical_original_code:
static int set_init(char *nn_dst_val, int *dst_val, long long lb, long long ub, int ijoin_op)
{
  int status = 0;
  assign_const_I1(nn_dst_val+lb, 0, (ub-lb));
  if ( dst_val != ((void *)0) ) {
    int *this_dst_val = dst_val;
    this_dst_val += lb;
    switch ( ijoin_op ) {
    case 500 :
    case 100 :
    case 800 :
    case 600 :
      assign_const_I4(this_dst_val, 0, (ub-lb));
      break;
    case 700 :
      assign_const_I4(this_dst_val, 0xFFFFFFFF, (ub-lb));
      break;
    case 200 :
      assign_const_I4(this_dst_val, 0x7fffffff, (ub-lb));
      break;
    case 300 :
      assign_const_I4(this_dst_val, (-0x7fffffff - 1), (ub-lb));
      break;
    default :
      { { fprintf(stderr, "Line %3d of File %s \n", 67, "./AUX/core_srt_join_I_I_L.c"); }; status = -1 ; goto BYE; };
      break;
    }
  }
 BYE:
  return(status);
}

variable_types:
lb
long long

variable_types:
ub
long long


original_code:
int
countf_nn_I1(
  char *fk_fld,
  int *src_fld,
  long long n,
  char *cfld,
  long long * restrict cnt,
  int n_out
  )
{
  int status = 0;
  register char *cptr = cfld;
  for ( long long i = 0; i < n; i++ ) {
    if ( *cptr++ == 0 ) { continue; }
    char idx = fk_fld[i];
    int val = src_fld[i];
    int idxI4 = (int)idx;
    cnt[idxI4] += val;
  }
  return(status);
}

canonical_original_code:
int countf_nn_I1(char *fk_fld, int *src_fld, long long n, char *cfld, long long *cnt, int n_out)
{
  int status = 0;
  register char *cptr = cfld;
  for ( long long i = 0; i < n; i++ ) {
    if ( *cptr++ == 0 ) { continue; }
    char idx = fk_fld[i];
    int val = src_fld[i];
    int idxI4 = (int)idx;
    cnt[idxI4] += val;
  }
  return(status);
}

variable_types:
cfld
char *

variable_types:
cptr
char *

variable_types: idx char


decompiled_code:
void __fastcall set_vals_int(__int64 a1, int a2)
{
__int64 v2; // rbx

if ( a2 > 0 )
{
v2 = a1;
do
{
v2 += 4LL;
*(_DWORD *)(v2 - 4) = mrand48();
}
while ( v2 != a1 + 4LL * (unsigned int)(a2 - 1) + 4 );
}
}

original_code:
void
set_vals_int(
      int X[],
      int N
      )
{
  for ( int i = 0; i < N; i++ ) {
    X[i] = (int)mrand48();
  }
}

canonical_original_code:
void set_vals_int(int X[], int N)
{
  for ( int i = 0; i < N; i++ ) {
    X[i] = (int)mrand48();
  }
}

variable_types:
X
int []

variable_types: N int

variable_types: i int


original_code:
void
set_vals_longlong(
    long long X[],
    int N
    )
{
  long long minval = 0x7fffffffffffffffLL, maxval = (-0x7fffffffffffffffLL - 1LL);
  for ( int i = 0; i < N; i++ ) {
    X[i] = (long long) mrand48();
    if ( X[i] < 0 ) {
      X[i] = -1 * X[i] * X[i];
    }
    else {
      X[i] = 1 * X[i] * X[i];
    }
    if ( X[i] < minval ) { minval = X[i]; }
    if ( X[i] > maxval ) { maxval = X[i]; }
  }
}

canonical_original_code:
void set_vals_longlong(long long X[], int N)
{
  long long minval = 0x7fffffffffffffffLL; long long maxval = (-0x7fffffffffffffffLL - 1LL);
  for ( int i = 0; i < N; i++ ) {
    X[i] = (long long) mrand48();
    if ( X[i] < 0 ) {
      X[i] = -1 * X[i] * X[i];
    }
    else {
      X[i] = 1 * X[i] * X[i];
    }
    if ( X[i] < minval ) { minval = X[i]; }
    if ( X[i] > maxval ) { maxval = X[i]; }
  }
}

variable_types:
X
long long []

variable_types:
minval
long long

variable_types:
maxval
long long


main

canonical_name: main

decompiled_code:
int __cdecl main(int argc, const char **argv, const char **envp)
{
int *v3; // r12
int *v4; // r13
_QWORD *v5; // r15
__int64 i; // rax
__int64 j; // rax
struct timeval *v8; // rbp
int *v9; // r14
unsigned int v10; // ebx
__int64 k; // rax
__int64 l; // rax
__int64 v13; // rax
__int64 v14; // rsi
__int64 v15; // rdx
int v16; // er14
__int64 v17; // r13
__int64 v18; // rcx
__int64 v19; // r8
__int64 v20; // rdx
__int64 v21; // rdx
void *src; // [rsp+8h] [rbp-80h]
int *dest; // [rsp+10h] [rbp-78h]
void *ptr; // [rsp+18h] [rbp-70h]
int *base; // [rsp+20h] [rbp-68h]
void *v27; // [rsp+28h] [rbp-60h]
unsigned int v28; // [rsp+30h] [rbp-58h]
int v29; // [rsp+30h] [rbp-58h]
void *v30; // [rsp+38h] [rbp-50h]
__int64 v31; // [rsp+40h] [rbp-48h]
__suseconds_t v32; // [rsp+40h] [rbp-48h]
__int64 v33; // [rsp+48h] [rbp-40h]

v3 = (int *)malloc(0x400000uLL);
dest = (int *)malloc(0x400000uLL);
base = (int *)malloc(0x400000uLL);
v4 = (int *)malloc(0x400000uLL);
v5 = malloc(0x800000uLL);
src = malloc(0x800000uLL);
ptr = malloc(0x800000uLL);
v27 = malloc(0x800000uLL);
for ( i = 0LL; i != 0x100000; ++i )
v4[i] = i;
for ( j = 0LL; j != 0x100000; ++j )
v5[j] = j;
v8 = (struct timeval *)malloc(0x10uLL);
if ( !v8 )
{
fprintf(stderr, "Line %3d of File %s \n", 105LL, "test_driver_qsort.c");
goto LABEL_80;
}
v30 = malloc(0x10uLL);
if ( !v30 )
{
fprintf(stderr, "Line %3d of File %s \n", 107LL, "test_driver_qsort.c");
LABEL_80:
v16 = -1;
free(v4);
free(v5);
v30 = 0LL;
if ( v3 )
goto LABEL_48;
goto LABEL_49;
}
v9 = v4;
gettimeofday(v8, 0LL);
srand48(v8->tv_usec);
v28 = 0;
LABEL_8:
v10 = v28 % 0xC;
switch ( v28 % 0xC )
{
case 1u:
fwrite("Sort with integer index --", 1uLL, 0x1CuLL, stderr);
break;
case 2u:
fwrite("Sort with long long index --", 1uLL, 0x1CuLL, stderr);
break;
case 3u:
case 4u:
fwrite("Sort asc int no func --", 1uLL, 0x1CuLL, stderr);
break;
case 5u:
fwrite("Sort dsc int no func --", 1uLL, 0x1CuLL, stderr);
break;
case 6u:
fwrite("Sort asc longlong no func --", 1uLL, 0x1CuLL, stderr);
break;
case 7u:
fwrite("Sort dsc longlong no func --", 1uLL, 0x1CuLL, stderr);
break;
case 8u:
fwrite("Sort asc val int idx int --", 1uLL, 0x1CuLL, stderr);
break;
case 9u:
fwrite("Sort asc val int idx LL --", 1uLL, 0x1CuLL, stderr);
break;
case 0xAu:
fwrite("Sort asc val LL idx int --", 1uLL, 0x1CuLL, stderr);
break;
case 0xBu:
fwrite("Sort asc val LL idx LL --", 1uLL, 0x1CuLL, stderr);
break;
default:
fwrite("Regular sort --", 1uLL, 0x1CuLL, stderr);
break;
}
set_vals_int((__int64)v3, 0x100000);
set_vals_longlong((__int64)src, 0x100000);
memcpy(dest, v3, 0x400000uLL);
memcpy(base, v3, 0x400000uLL);
for ( k = 0LL; k != 0x100000; ++k )
v4[k] = k;
for ( l = 0LL; l != 0x100000; ++l )
v5[l] = l;
memcpy(ptr, src, 0x800000uLL);
memcpy(v27, src, 0x800000uLL);
gettimeofday(v8, 0LL);
v31 = v8->tv_usec + 1000000 * v8->tv_sec;
switch ( v10 )
{
case 0u:
case 1u:
case 2u:
case 4u:
case 8u:
case 9u:
qsort(base, 0x100000uLL, 4uLL, (__compar_fn_t)&sort_asc_I4);
goto LABEL_16;
case 5u:
qsort(base, 0x100000uLL, 4uLL, (__compar_fn_t)&sort_dsc_I4);
gettimeofday(v8, 0LL);
v32 = v8->tv_usec + 1000000 * v8->tv_sec - v31;
gettimeofday(v8, 0LL);
v33 = v8->tv_usec + 1000000 * v8->tv_sec;
LABEL_67:
qsort_dsc_I4(dest, 0x100000LL, 4LL, 0LL);
goto LABEL_29;
case 6u:
qsort(v27, 0x100000uLL, 8uLL, (__compar_fn_t)&sort_asc_I8);
gettimeofday(v8, 0LL);
v32 = v8->tv_usec + 1000000 * v8->tv_sec - v31;
gettimeofday(v8, 0LL);
v33 = v8->tv_usec + 1000000 * v8->tv_sec;
LABEL_65:
qsort_asc_I8(ptr, 0x100000LL, 8LL, 0LL);
goto LABEL_29;
case 7u:
qsort(v27, 0x100000uLL, 8uLL, (__compar_fn_t)&sort_dsc_I8);
gettimeofday(v8, 0LL);
v32 = v8->tv_usec + 1000000 * v8->tv_sec - v31;
gettimeofday(v8, 0LL);
v33 = v8->tv_usec + 1000000 * v8->tv_sec;
LABEL_28:
qsort_dsc_I8(ptr, 0x100000LL, 8LL, 0LL);
LABEL_29:
gettimeofday(v8, 0LL);
v13 = 0LL;
break;
case 0xAu:
case 0xBu:
qsort(v27, 0x100000uLL, 8uLL, (__compar_fn_t)&sort_asc_I8);
LABEL_16:
gettimeofday(v8, 0LL);
v32 = v8->tv_usec + 1000000 * v8->tv_sec - v31;
gettimeofday(v8, 0LL);
v33 = v8->tv_usec + 1000000 * v8->tv_sec;
switch ( v10 )
{
case 0u:
qsort_with_idx(v4, dest, 0x100000LL, 4LL, &sort_asc_I4);
goto LABEL_29;
case 1u:
qsort_with_idx_int(v4, dest, 0x100000LL, 4LL, &sort_asc_I4);
goto LABEL_29;
case 2u:
qsort_with_idx_longlong(v5, dest, 0x100000LL, 4LL, &sort_asc_I4);
goto LABEL_29;
case 4u:
qsort_asc_I4(dest, 0x100000LL, 4LL, 0LL);
goto LABEL_29;
case 5u:
goto LABEL_67;
case 6u:
goto LABEL_65;
case 7u:
goto LABEL_28;
case 8u:
qsort_asc_val_I4_idx_I4(v4, dest, 0x100000LL, 0LL);
goto LABEL_29;
case 9u:
qsort_asc_val_I4_idx_I8(v5, dest, 0x100000LL, 0LL);
goto LABEL_29;
case 0xAu:
qsort_asc_val_I8_idx_I4(v4, ptr, 0x100000LL, 0LL);
goto LABEL_29;
case 0xBu:
qsort_asc_val_I8_idx_I8(v5, ptr, 0x100000LL, 0LL);
goto LABEL_29;
default:
v21 = 224LL;
goto LABEL_46;
}
default:
v21 = 175LL;
goto LABEL_46;
}
while ( 2 )
{
switch ( v10 )
{
case 0u:
case 1u:
case 8u:
v14 = dest[v13];
v15 = v3[v4[v13]];
goto LABEL_32;
case 2u:
case 9u:
if ( dest[v13] != (__int64)v3[v5[v13]] )
goto LABEL_37;
goto LABEL_33;
case 4u:
case 5u:
v14 = dest[v13];
v15 = base[v13];
goto LABEL_32;
case 6u:
case 7u:
v14 = *((_QWORD *)ptr + v13);
v15 = *((_QWORD *)v27 + v13);
goto LABEL_32;
case 0xAu:
v14 = *((_QWORD *)ptr + v13);
v15 = *((_QWORD *)src + v4[v13]);
goto LABEL_32;
case 0xBu:
v14 = *((_QWORD *)ptr + v13);
v15 = *((_QWORD *)src + v5[v13]);
LABEL_32:
if ( v14 == v15 )
{
LABEL_33:
if ( ++v13 != 0x100000 )
continue;
fprintf(stderr, " t_reg = %lld, t_opt = %lld \n", v32, v8->tv_usec + 1000000 * v8->tv_sec - v33);
if ( ++v28 == 768 )
{
v16 = 0;
goto LABEL_47;
}
goto LABEL_8;
}
LABEL_37:
v29 = v13;
fprintf(stderr, "mismatch at pos %d \n", (unsigned int)v13);
v17 = v29;
do
{
if ( v29 + 10 == v17 )
break;
v18 = (unsigned int)base[v17];
v19 = (unsigned int)dest[v17];
v20 = (unsigned int)v17++;
fprintf(stderr, "%d: good = %d, bad = %d \n", v20, v18, v19);
}
while ( (int)v17 <= 0xFFFFF );
v4 = v9;
v21 = 281LL;
LABEL_46:
v16 = -1;
fprintf(stderr, "Line %3d of File %s \n", v21, "test_driver_qsort.c");
LABEL_47:
free(v4);
free(v5);
LABEL_48:
free(v3);
LABEL_49:
if ( dest )
free(dest);
if ( base )
free(base);
if ( src )
free(src);
if ( ptr )
free(ptr);
if ( v27 )
free(v27);
if ( v8 )
free(v8);
if ( v30 )
free(v30);
return v16;
default:
v21 = 273LL;
goto LABEL_46;
}
}
}

canonical_decompiled_code:
int __cdecl main(int argc, const char **argv, const char **envp)
{
int *v3; // r12
int *v4; // r13
_QWORD *v5; // r15
__int64 i; // rax
__int64 j; // rax
struct timeval *v8; // rbp
int *v9; // r14
unsigned int v10; // ebx
__int64 k; // rax
__int64 l; // rax
__int64 v13; // rax
__int64 v14; // rsi
__int64 v15; // rdx
int v16; // er14
__int64 v17; // r13
__int64 v18; // rcx
__int64 v19; // r8
__int64 v20; // rdx
__int64 v21; // rdx
void *src; // [rsp+8h] [rbp-80h]
int *dest; // [rsp+10h] [rbp-78h]
void *ptr; // [rsp+18h] [rbp-70h]
int *base; // [rsp+20h] [rbp-68h]
void *v27; // [rsp+28h] [rbp-60h]
unsigned int v28; // [rsp+30h] [rbp-58h]
int v29; // [rsp+30h] [rbp-58h]
void *v30; // [rsp+38h] [rbp-50h]
__int64 v31; // [rsp+40h] [rbp-48h]
__suseconds_t v32; // [rsp+40h] [rbp-48h]
__int64 v33; // [rsp+48h] [rbp-40h]

v3 = (int *)malloc(0x400000uLL);
dest = (int *)malloc(0x400000uLL);
base = (int *)malloc(0x400000uLL);
v4 = (int *)malloc(0x400000uLL);
v5 = malloc(0x800000uLL);
src = malloc(0x800000uLL);
ptr = malloc(0x800000uLL);
v27 = malloc(0x800000uLL);
for ( i = 0LL; i != 0x100000; ++i )
v4[i] = i;
for ( j = 0LL; j != 0x100000; ++j )
v5[j] = j;
v8 = (struct timeval *)malloc(0x10uLL);
if ( !v8 )
{
fprintf(stderr, "Line %3d of File %s \n", 105LL, "test_driver_qsort.c");
goto LABEL_80;
}
v30 = malloc(0x10uLL);
if ( !v30 )
{
fprintf(stderr, "Line %3d of File %s \n", 107LL, "test_driver_qsort.c");
LABEL_80:
v16 = -1;
free(v4);
free(v5);
v30 = 0LL;
if ( v3 )
goto LABEL_48;
goto LABEL_49;
}
v9 = v4;
gettimeofday(v8, 0LL);
srand48(v8->tv_usec);
v28 = 0;
LABEL_8:
v10 = v28 % 0xC;
switch ( v28 % 0xC )
{
case 1u:
fwrite("Sort with integer index --", 1uLL, 0x1CuLL, stderr);
break;
case 2u:
fwrite("Sort with long long index --", 1uLL, 0x1CuLL, stderr);
break;
case 3u:
case 4u:
fwrite("Sort asc int no func --", 1uLL, 0x1CuLL, stderr);
break;
case 5u:
fwrite("Sort dsc int no func --", 1uLL, 0x1CuLL, stderr);
break;
case 6u:
fwrite("Sort asc longlong no func --", 1uLL, 0x1CuLL, stderr);
break;
case 7u:
fwrite("Sort dsc longlong no func --", 1uLL, 0x1CuLL, stderr);
break;
case 8u:
fwrite("Sort asc val int idx int --", 1uLL, 0x1CuLL, stderr);
break;
case 9u:
fwrite("Sort asc val int idx LL --", 1uLL, 0x1CuLL, stderr);
break;
case 0xAu:
fwrite("Sort asc val LL idx int --", 1uLL, 0x1CuLL, stderr);
break;
case 0xBu:
fwrite("Sort asc val LL idx LL --", 1uLL, 0x1CuLL, stderr);
break;
default:
fwrite("Regular sort --", 1uLL, 0x1CuLL, stderr);
break;
}
func0((__int64)v3, 0x100000);
func1((__int64)src, 0x100000);
memcpy(dest, v3, 0x400000uLL);
memcpy(base, v3, 0x400000uLL);
for ( k = 0LL; k != 0x100000; ++k )
v4[k] = k;
for ( l = 0LL; l != 0x100000; ++l )
v5[l] = l;
memcpy(ptr, src, 0x800000uLL);
memcpy(v27, src, 0x800000uLL);
gettimeofday(v8, 0LL);
v31 = v8->tv_usec + 1000000 * v8->tv_sec;
switch ( v10 )
{
case 0u:
case 1u:
case 2u:
case 4u:
case 8u:
case 9u:
qsort(base, 0x100000uLL, 4uLL, (__compar_fn_t)&sort_asc_I4);
goto LABEL_16;
case 5u:
qsort(base, 0x100000uLL, 4uLL, (__compar_fn_t)&sort_dsc_I4);
gettimeofday(v8, 0LL);
v32 = v8->tv_usec + 1000000 * v8->tv_sec - v31;
gettimeofday(v8, 0LL);
v33 = v8->tv_usec + 1000000 * v8->tv_sec;
LABEL_67:
qsort_dsc_I4(dest, 0x100000LL, 4LL, 0LL);
goto LABEL_29;
case 6u:
qsort(v27, 0x100000uLL, 8uLL, (__compar_fn_t)&sort_asc_I8);
gettimeofday(v8, 0LL);
v32 = v8->tv_usec + 1000000 * v8->tv_sec - v31;
gettimeofday(v8, 0LL);
v33 = v8->tv_usec + 1000000 * v8->tv_sec;
LABEL_65:
qsort_asc_I8(ptr, 0x100000LL, 8LL, 0LL);
goto LABEL_29;
case 7u:
qsort(v27, 0x100000uLL, 8uLL, (__compar_fn_t)&sort_dsc_I8);
gettimeofday(v8, 0LL);
v32 = v8->tv_usec + 1000000 * v8->tv_sec - v31;
gettimeofday(v8, 0LL);
v33 = v8->tv_usec + 1000000 * v8->tv_sec;
LABEL_28:
qsort_dsc_I8(ptr, 0x100000LL, 8LL, 0LL);
LABEL_29:
gettimeofday(v8, 0LL);
v13 = 0LL;
break;
case 0xAu:
case 0xBu:
qsort(v27, 0x100000uLL, 8uLL, (__compar_fn_t)&sort_asc_I8);
LABEL_16:
gettimeofday(v8, 0LL);
v32 = v8->tv_usec + 1000000 * v8->tv_sec - v31;
gettimeofday(v8, 0LL);
v33 = v8->tv_usec + 1000000 * v8->tv_sec;
switch ( v10 )
{
case 0u:
qsort_with_idx(v4, dest, 0x100000LL, 4LL, &sort_asc_I4);
goto LABEL_29;
case 1u:
qsort_with_idx_int(v4, dest, 0x100000LL, 4LL, &sort_asc_I4);
goto LABEL_29;
case 2u:
qsort_with_idx_longlong(v5, dest, 0x100000LL, 4LL, &sort_asc_I4);
goto LABEL_29;
case 4u:
qsort_asc_I4(dest, 0x100000LL, 4LL, 0LL);
goto LABEL_29;
case 5u:
goto LABEL_67;
case 6u:
goto LABEL_65;
case 7u:
goto LABEL_28;
case 8u:
qsort_asc_val_I4_idx_I4(v4, dest, 0x100000LL, 0LL);
goto LABEL_29;
case 9u:
qsort_asc_val_I4_idx_I8(v5, dest, 0x100000LL, 0LL);
goto LABEL_29;
case 0xAu:
qsort_asc_val_I8_idx_I4(v4, ptr, 0x100000LL, 0LL);
goto LABEL_29;
case 0xBu:
qsort_asc_val_I8_idx_I8(v5, ptr, 0x100000LL, 0LL);
goto LABEL_29;
default:
v21 = 224LL;
goto LABEL_46;
}
default:
v21 = 175LL;
goto LABEL_46;
}
while ( 2 )
{
switch ( v10 )
{
case 0u:
case 1u:
case 8u:
v14 = dest[v13];
v15 = v3[v4[v13]];
goto LABEL_32;
case 2u:
case 9u:
if ( dest[v13] != (__int64)v3[v5[v13]] )
goto LABEL_37;
goto LABEL_33;
case 4u:
case 5u:
v14 = dest[v13];
v15 = base[v13];
goto LABEL_32;
case 6u:
case 7u:
v14 = *((_QWORD *)ptr + v13);
v15 = *((_QWORD *)v27 + v13);
goto LABEL_32;
case 0xAu:
v14 = *((_QWORD *)ptr + v13);
v15 = *((_QWORD *)src + v4[v13]);
goto LABEL_32;
case 0xBu:
v14 = *((_QWORD *)ptr + v13);
v15 = *((_QWORD *)src + v5[v13]);
LABEL_32:
if ( v14 == v15 )
{
LABEL_33:
if ( ++v13 != 0x100000 )
continue;
fprintf(stderr, " t_reg = %lld, t_opt = %lld \n", v32, v8->tv_usec + 1000000 * v8->tv_sec - v33);
if ( ++v28 == 768 )
{
v16 = 0;
goto LABEL_47;
}
goto LABEL_8;
}
LABEL_37:
v29 = v13;
fprintf(stderr, "mismatch at pos %d \n", (unsigned int)v13);
v17 = v29;
do
{
if ( v29 + 10 == v17 )
break;
v18 = (unsigned int)base[v17];
v19 = (unsigned int)dest[v17];
v20 = (unsigned int)v17++;
fprintf(stderr, "%d: good = %d, bad = %d \n", v20, v18, v19);
}
while ( (int)v17 <= 0xFFFFF );
v4 = v9;
v21 = 281LL;
LABEL_46:
v16 = -1;
fprintf(stderr, "Line %3d of File %s \n", v21, "test_driver_qsort.c");
LABEL_47:
free(v4);
free(v5);
LABEL_48:
free(v3);
LABEL_49:
if ( dest )
free(dest);
if ( base )
free(base);
if ( src )
free(src);
if ( ptr )
free(ptr);
if ( v27 )
free(v27);
if ( v8 )
free(v8);
if ( v30 )
free(v30);
return v16;
default:
v21 = 273LL;
goto LABEL_46;
}
}
}

original_code:
int
main()
{
  int status = 0;
  int *X = ((void *)0); int *Y = ((void *)0); int *Z = ((void *)0);
  int *i_srt_ordr = ((void *)0);
  long long *ll_srt_ordr = ((void *)0);
  long long *XLL = ((void *)0); long long *YLL = ((void *)0); long long *ZLL = ((void *)0);
  struct timeval *Tps = ((void *)0), *Tpf = ((void *)0);
  void *Tzp = ((void *)0);
  unsigned long long int t_before_sec = 0, t_before_usec = 0, t_before = 0;
  unsigned long long int t_after_sec, t_after_usec, t_after;
  unsigned long long int t_regular, t_optimized;
  X = (int *)malloc(1*1048576 * sizeof(int));
  Y = (int *)malloc(1*1048576 * sizeof(int));
  Z = (int *)malloc(1*1048576 * sizeof(int));
  i_srt_ordr = (int *)malloc(1*1048576 * sizeof(int));
  ll_srt_ordr = (long long *)malloc(1*1048576 * sizeof(long long));
  XLL = (long long *)malloc(1*1048576 * sizeof(long long));
  YLL = (long long *)malloc(1*1048576 * sizeof(long long));
  ZLL = (long long *)malloc(1*1048576 * sizeof(long long));
  for ( int i = 0; i < 1*1048576; i++ ) { i_srt_ordr[i] = i; }
  for ( int i = 0; i < 1*1048576; i++ ) { ll_srt_ordr[i] = i; }
  Tps = (struct timeval *) malloc(sizeof(struct timeval));
  if ( Tps == ((void *)0) ) { { { fprintf(stderr, "Line %3d of File %s \n", 105, "test_driver_qsort.c"); }; status = -1 ; goto BYE; }; }
  Tpf = (struct timeval *) malloc(sizeof(struct timeval));
  if ( Tpf == ((void *)0) ) { { { fprintf(stderr, "Line %3d of File %s \n", 107, "test_driver_qsort.c"); }; status = -1 ; goto BYE; }; }
  Tzp = 0;
  gettimeofday ((struct timeval *)Tps, (struct timezone *)Tzp);
  t_before_sec = (long long int)Tps->tv_sec;
  t_before_usec = (long long int)Tps->tv_usec;
  t_before = t_before_sec * 1000000 + t_before_usec;
  srand48(t_before_usec);
  for ( int iters = 0; iters < 12*64; iters++ ) {
    int itype = iters % 12;
    switch ( itype ) {
      case 0 : fprintf(stderr, "Regular sort              --"); break;
      case 1 : fprintf(stderr, "Sort with integer index   --"); break;
      case 2 : fprintf(stderr, "Sort with long long index --"); break;
      case 3 : fprintf(stderr, "Sort asc int no func      --"); break;
      case 4 : fprintf(stderr, "Sort asc int no func      --"); break;
      case 5 : fprintf(stderr, "Sort dsc int no func      --"); break;
      case 6 : fprintf(stderr, "Sort asc longlong no func --"); break;
      case 7 : fprintf(stderr, "Sort dsc longlong no func --"); break;
      case 8 : fprintf(stderr, "Sort asc val int idx int  --"); break;
      case 9 : fprintf(stderr, "Sort asc val int idx LL   --"); break;
      case 10 : fprintf(stderr, "Sort asc val LL  idx int  --"); break;
      case 11 : fprintf(stderr, "Sort asc val LL  idx LL   --"); break;
      default : { { fprintf(stderr, "Line %3d of File %s \n", 132, "test_driver_qsort.c"); }; status = -1 ; goto BYE; }; break;
    }
    set_vals_int(X, 1*1048576);
    set_vals_longlong(XLL, 1*1048576);
    for ( int i = 0; i < 1*1048576; i++ ) { Y[i] = X[i]; }
    for ( int i = 0; i < 1*1048576; i++ ) { Z[i] = X[i]; }
    for ( int i = 0; i < 1*1048576; i++ ) { i_srt_ordr[i] = i; }
    for ( int i = 0; i < 1*1048576; i++ ) { ll_srt_ordr[i] = i; }
    for ( int i = 0; i < 1*1048576; i++ ) { YLL[i] = XLL[i]; }
    for ( int i = 0; i < 1*1048576; i++ ) { ZLL[i] = XLL[i]; }
    gettimeofday ((struct timeval *)Tps, (struct timezone *)Tzp);
    t_before_sec = (long long int)Tps->tv_sec;
    t_before_usec = (long long int)Tps->tv_usec;
    t_before = t_before_sec * 1000000 + t_before_usec;
    switch ( itype ) {
      case 0 :
      case 1 :
      case 2 :
      case 4 :
        qsort(Z, 1*1048576, sizeof(int), sort_asc_I4);
 break;
      case 5 :
        qsort(Z, 1*1048576, sizeof(int), sort_dsc_I4);
 break;
      case 6 :
        qsort(ZLL, 1*1048576, sizeof(long long), sort_asc_I8);
 break;
      case 7 :
        qsort(ZLL, 1*1048576, sizeof(long long), sort_dsc_I8);
 break;
      case 8 :
      case 9 :
        qsort(Z, 1*1048576, sizeof(int), sort_asc_I4);
 break;
      case 10 :
      case 11 :
        qsort(ZLL, 1*1048576, sizeof(long long), sort_asc_I8);
 break;
      default :
 { { fprintf(stderr, "Line %3d of File %s \n", 175, "test_driver_qsort.c"); }; status = -1 ; goto BYE; };
 break;
    }
    gettimeofday ((struct timeval *)Tps, (struct timezone *)Tzp);
    t_after_sec = (long long int)Tps->tv_sec;
    t_after_usec = (long long int)Tps->tv_usec;
    t_after = t_after_sec * 1000000 + t_after_usec;
    t_regular = t_after - t_before;
    gettimeofday ((struct timeval *)Tps, (struct timezone *)Tzp);
    t_before_sec = (long long int)Tps->tv_sec;
    t_before_usec = (long long int)Tps->tv_usec;
    t_before = t_before_sec * 1000000 + t_before_usec;
    switch ( itype ) {
      case 0 :
        qsort_with_idx(i_srt_ordr, Y, 1*1048576, sizeof(int), sort_asc_I4);
 break;
      case 1 :
        qsort_with_idx_int(i_srt_ordr, Y, 1*1048576, sizeof(int), sort_asc_I4);
 break;
      case 2 :
        qsort_with_idx_longlong(ll_srt_ordr, Y, 1*1048576, sizeof(int), sort_asc_I4);
 break;
      case 4 :
        qsort_asc_I4(Y, 1*1048576, sizeof(int), ((void *)0));
 break;
      case 5 :
        qsort_dsc_I4(Y, 1*1048576, sizeof(int), ((void *)0));
 break;
      case 6 :
        qsort_asc_I8(YLL, 1*1048576, sizeof(long long), ((void *)0));
 break;
      case 7 :
        qsort_dsc_I8(YLL, 1*1048576, sizeof(long long), ((void *)0));
 break;
      case 8 :
        qsort_asc_val_I4_idx_I4(i_srt_ordr, (void *)Y, 1*1048576, ((void *)0));
 break;
      case 9 :
        qsort_asc_val_I4_idx_I8(ll_srt_ordr, Y, 1*1048576, ((void *)0));
 break;
      case 10 :
        qsort_asc_val_I8_idx_I4(i_srt_ordr, YLL, 1*1048576, ((void *)0));
 break;
      case 11 :
        qsort_asc_val_I8_idx_I8(ll_srt_ordr, YLL, 1*1048576, ((void *)0));
 break;
      default :
 { { fprintf(stderr, "Line %3d of File %s \n", 224, "test_driver_qsort.c"); }; status = -1 ; goto BYE; };
 break;
    }
    gettimeofday ((struct timeval *)Tps, (struct timezone *)Tzp);
    t_after_sec = (long long int)Tps->tv_sec;
    t_after_usec = (long long int)Tps->tv_usec;
    t_after = t_after_sec * 1000000 + t_after_usec;
    t_optimized = t_after - t_before;
    for ( int i = 0; i < 1*1048576; i++ ) {
      long long val1, val2;
      switch ( itype ) {
 case 0 :
 case 1 :
        val1 = Y[i];
        val2 = X[i_srt_ordr[i]];
 break;
 case 2 :
        val1 = Y[i];
        val2 = X[ll_srt_ordr[i]];
 break;
 case 4 :
 case 5 :
        val1 = Y[i];
        val2 = Z[i];
 break;
 case 6 :
 case 7 :
        val1 = YLL[i];
 val2 = ZLL[i];
 break;
 case 8 :
        val1 = Y[i];
        val2 = X[i_srt_ordr[i]];
 break;
 case 9 :
        val1 = Y[i];
        val2 = X[ll_srt_ordr[i]];
 break;
 case 10 :
        val1 = YLL[i];
        val2 = XLL[i_srt_ordr[i]];
 break;
 case 11 :
        val1 = YLL[i];
        val2 = XLL[ll_srt_ordr[i]];
 break;
 default :
 { { fprintf(stderr, "Line %3d of File %s \n", 273, "test_driver_qsort.c"); }; status = -1 ; goto BYE; };
 break;
      }
      if ( val1 != val2 ) {
 fprintf(stderr, "mismatch at pos %d \n", i);
        for ( int j = i; (( j < 1*1048576 ) && ( j < i + 10 )); j++ ) {
   fprintf(stderr, "%d: good =  %d, bad = %d \n", j, Z[j], Y[j]);
 }
 { { fprintf(stderr, "Line %3d of File %s \n", 281, "test_driver_qsort.c"); }; status = -1 ; goto BYE; };
      }
    }
    fprintf(stderr, " t_reg = %lld, t_opt = %lld \n", t_regular, t_optimized);
  }
 BYE:
  { if ( (i_srt_ordr) != ((void *)0) ) { free((i_srt_ordr)); (i_srt_ordr) = ((void *)0); } };
  { if ( (ll_srt_ordr) != ((void *)0) ) { free((ll_srt_ordr)); (ll_srt_ordr) = ((void *)0); } };
  { if ( (X) != ((void *)0) ) { free((X)); (X) = ((void *)0); } };
  { if ( (Y) != ((void *)0) ) { free((Y)); (Y) = ((void *)0); } };
  { if ( (Z) != ((void *)0) ) { free((Z)); (Z) = ((void *)0); } };
  { if ( (XLL) != ((void *)0) ) { free((XLL)); (XLL) = ((void *)0); } };
  { if ( (YLL) != ((void *)0) ) { free((YLL)); (YLL) = ((void *)0); } };
  { if ( (ZLL) != ((void *)0) ) { free((ZLL)); (ZLL) = ((void *)0); } };
  { if ( (Tps) != ((void *)0) ) { free((Tps)); (Tps) = ((void *)0); } };
  { if ( (Tpf) != ((void *)0) ) { free((Tpf)); (Tpf) = ((void *)0); } };
  return(status);
}

canonical_original_code:
int main()
{
  int status = 0;
  int *X = ((void *)0); int *Y = ((void *)0); int *Z = ((void *)0);
  int *i_srt_ordr = ((void *)0);
  long long *ll_srt_ordr = ((void *)0);
  long long *XLL = ((void *)0); long long *YLL = ((void *)0); long long *ZLL = ((void *)0);
  struct timeval *Tps = ((void *)0); struct timeval *Tpf = ((void *)0);
  void *Tzp = ((void *)0);
  unsigned long long t_before_sec = 0; unsigned long long t_before_usec = 0; unsigned long long t_before = 0;
  unsigned long long t_after_sec; unsigned long long t_after_usec; unsigned long long t_after;
  unsigned long long t_regular; unsigned long long t_optimized;
  X = (int *)malloc(1*1048576 * sizeof(int));
  Y = (int *)malloc(1*1048576 * sizeof(int));
  Z = (int *)malloc(1*1048576 * sizeof(int));
  i_srt_ordr = (int *)malloc(1*1048576 * sizeof(int));
  ll_srt_ordr = (long long *)malloc(1*1048576 * sizeof(long long));
  XLL = (long long *)malloc(1*1048576 * sizeof(long long));
  YLL = (long long *)malloc(1*1048576 * sizeof(long long));
  ZLL = (long long *)malloc(1*1048576 * sizeof(long long));
  for ( int i = 0; i < 1*1048576; i++ ) { i_srt_ordr[i] = i; }
  for ( int i = 0; i < 1*1048576; i++ ) { ll_srt_ordr[i] = i; }
  Tps = (struct timeval *) malloc(sizeof(struct timeval));
  if ( Tps == ((void *)0) ) { { { fprintf(stderr, "Line %3d of File %s \n", 105, "test_driver_qsort.c"); }; status = -1 ; goto BYE; }; }
  Tpf = (struct timeval *) malloc(sizeof(struct timeval));
  if ( Tpf == ((void *)0) ) { { { fprintf(stderr, "Line %3d of File %s \n", 107, "test_driver_qsort.c"); }; status = -1 ; goto BYE; }; }
  Tzp = 0;
  gettimeofday ((struct timeval *)Tps, (struct timezone *)Tzp);
  t_before_sec = (long long)Tps->tv_sec;
  t_before_usec = (long long)Tps->tv_usec;
  t_before = t_before_sec * 1000000 + t_before_usec;
  srand48(t_before_usec);
  for ( int iters = 0; iters < 12*64; iters++ ) {
    int itype = iters % 12;
    switch ( itype ) {
      case 0 : fprintf(stderr, "Regular sort              --"); break;
      case 1 : fprintf(stderr, "Sort with integer index   --"); break;
      case 2 : fprintf(stderr, "Sort with long long index --"); break;
      case 3 : fprintf(stderr, "Sort asc int no func      --"); break;
      case 4 : fprintf(stderr, "Sort asc int no func      --"); break;
      case 5 : fprintf(stderr, "Sort dsc int no func      --"); break;
      case 6 : fprintf(stderr, "Sort asc longlong no func --"); break;
      case 7 : fprintf(stderr, "Sort dsc longlong no func --"); break;
      case 8 : fprintf(stderr, "Sort asc val int idx int  --"); break;
      case 9 : fprintf(stderr, "Sort asc val int idx LL   --"); break;
      case 10 : fprintf(stderr, "Sort asc val LL  idx int  --"); break;
      case 11 : fprintf(stderr, "Sort asc val LL  idx LL   --"); break;
      default : { { fprintf(stderr, "Line %3d of File %s \n", 132, "test_driver_qsort.c"); }; status = -1 ; goto BYE; }; break;
    }
    set_vals_int(X, 1*1048576);
    set_vals_longlong(XLL, 1*1048576);
    for ( int i = 0; i < 1*1048576; i++ ) { Y[i] = X[i]; }
    for ( int i = 0; i < 1*1048576; i++ ) { Z[i] = X[i]; }
    for ( int i = 0; i < 1*1048576; i++ ) { i_srt_ordr[i] = i; }
    for ( int i = 0; i < 1*1048576; i++ ) { ll_srt_ordr[i] = i; }
    for ( int i = 0; i < 1*1048576; i++ ) { YLL[i] = XLL[i]; }
    for ( int i = 0; i < 1*1048576; i++ ) { ZLL[i] = XLL[i]; }
    gettimeofday ((struct timeval *)Tps, (struct timezone *)Tzp);
    t_before_sec = (long long)Tps->tv_sec;
    t_before_usec = (long long)Tps->tv_usec;
    t_before = t_before_sec * 1000000 + t_before_usec;
    switch ( itype ) {
      case 0 :
      case 1 :
      case 2 :
      case 4 :
        qsort(Z, 1*1048576, sizeof(int), sort_asc_I4);
 break;
      case 5 :
        qsort(Z, 1*1048576, sizeof(int), sort_dsc_I4);
 break;
      case 6 :
        qsort(ZLL, 1*1048576, sizeof(long long), sort_asc_I8);
 break;
      case 7 :
        qsort(ZLL, 1*1048576, sizeof(long long), sort_dsc_I8);
 break;
      case 8 :
      case 9 :
        qsort(Z, 1*1048576, sizeof(int), sort_asc_I4);
 break;
      case 10 :
      case 11 :
        qsort(ZLL, 1*1048576, sizeof(long long), sort_asc_I8);
 break;
      default :
 { { fprintf(stderr, "Line %3d of File %s \n", 175, "test_driver_qsort.c"); }; status = -1 ; goto BYE; };
 break;
    }
    gettimeofday ((struct timeval *)Tps, (struct timezone *)Tzp);
    t_after_sec = (long long)Tps->tv_sec;
    t_after_usec = (long long)Tps->tv_usec;
    t_after = t_after_sec * 1000000 + t_after_usec;
    t_regular = t_after - t_before;
    gettimeofday ((struct timeval *)Tps, (struct timezone *)Tzp);
    t_before_sec = (long long)Tps->tv_sec;
    t_before_usec = (long long)Tps->tv_usec;
    t_before = t_before_sec * 1000000 + t_before_usec;
    switch ( itype ) {
      case 0 :
        qsort_with_idx(i_srt_ordr, Y, 1*1048576, sizeof(int), sort_asc_I4);
 break;
      case 1 :
        qsort_with_idx_int(i_srt_ordr, Y, 1*1048576, sizeof(int), sort_asc_I4);
 break;
      case 2 :
        qsort_with_idx_longlong(ll_srt_ordr, Y, 1*1048576, sizeof(int), sort_asc_I4);
 break;
      case 4 :
        qsort_asc_I4(Y, 1*1048576, sizeof(int), ((void *)0));
 break;
      case 5 :
        qsort_dsc_I4(Y, 1*1048576, sizeof(int), ((void *)0));
 break;
      case 6 :
        qsort_asc_I8(YLL, 1*1048576, sizeof(long long), ((void *)0));
 break;
      case 7 :
        qsort_dsc_I8(YLL, 1*1048576, sizeof(long long), ((void *)0));
 break;
      case 8 :
        qsort_asc_val_I4_idx_I4(i_srt_ordr, (void *)Y, 1*1048576, ((void *)0));
 break;
      case 9 :
        qsort_asc_val_I4_idx_I8(ll_srt_ordr, Y, 1*1048576, ((void *)0));
 break;
      case 10 :
        qsort_asc_val_I8_idx_I4(i_srt_ordr, YLL, 1*1048576, ((void *)0));
 break;
      case 11 :
        qsort_asc_val_I8_idx_I8(ll_srt_ordr, YLL, 1*1048576, ((void *)0));
 break;
      default :
 { { fprintf(stderr, "Line %3d of File %s \n", 224, "test_driver_qsort.c"); }; status = -1 ; goto BYE; };
 break;
    }
    gettimeofday ((struct timeval *)Tps, (struct timezone *)Tzp);
    t_after_sec = (long long)Tps->tv_sec;
    t_after_usec = (long long)Tps->tv_usec;
    t_after = t_after_sec * 1000000 + t_after_usec;
    t_optimized = t_after - t_before;
    for ( int i = 0; i < 1*1048576; i++ ) {
      long long val1; long long val2;
      switch ( itype ) {
 case 0 :
 case 1 :
        val1 = Y[i];
        val2 = X[i_srt_ordr[i]];
 break;
 case 2 :
        val1 = Y[i];
        val2 = X[ll_srt_ordr[i]];
 break;
 case 4 :
 case 5 :
        val1 = Y[i];
        val2 = Z[i];
 break;
 case 6 :
 case 7 :
        val1 = YLL[i];
 val2 = ZLL[i];
 break;
 case 8 :
        val1 = Y[i];
        val2 = X[i_srt_ordr[i]];
 break;
 case 9 :
        val1 = Y[i];
        val2 = X[ll_srt_ordr[i]];
 break;
 case 10 :
        val1 = YLL[i];
        val2 = XLL[i_srt_ordr[i]];
 break;
 case 11 :
        val1 = YLL[i];
        val2 = XLL[ll_srt_ordr[i]];
 break;
 default :
 { { fprintf(stderr, "Line %3d of File %s \n", 273, "test_driver_qsort.c"); }; status = -1 ; goto BYE; };
 break;
      }
      if ( val1 != val2 ) {
 fprintf(stderr, "mismatch at pos %d \n", i);
        for ( int j = i; (( j < 1*1048576 ) && ( j < i + 10 )); j++ ) {
   fprintf(stderr, "%d: good =  %d, bad = %d \n", j, Z[j], Y[j]);
 }
 { { fprintf(stderr, "Line %3d of File %s \n", 281, "test_driver_qsort.c"); }; status = -1 ; goto BYE; };
      }
    }
    fprintf(stderr, " t_reg = %lld, t_opt = %lld \n", t_regular, t_optimized);
  }
 BYE:
  { if ( (i_srt_ordr) != ((void *)0) ) { free((i_srt_ordr)); (i_srt_ordr) = ((void *)0); } };
  { if ( (ll_srt_ordr) != ((void *)0) ) { free((ll_srt_ordr)); (ll_srt_ordr) = ((void *)0); } };
  { if ( (X) != ((void *)0) ) { free((X)); (X) = ((void *)0); } };
  { if ( (Y) != ((void *)0) ) { free((Y)); (Y) = ((void *)0); } };
  { if ( (Z) != ((void *)0) ) { free((Z)); (Z) = ((void *)0); } };
  { if ( (XLL) != ((void *)0) ) { free((XLL)); (XLL) = ((void *)0); } };
  { if ( (YLL) != ((void *)0) ) { free((YLL)); (YLL) = ((void *)0); } };
  { if ( (ZLL) != ((void *)0) ) { free((ZLL)); (ZLL) = ((void *)0); } };
  { if ( (Tps) != ((void *)0) ) { free((Tps)); (Tps) = ((void *)0); } };
  { if ( (Tpf) != ((void *)0) ) { free((Tpf)); (Tpf) = ((void *)0); } };
  return(status);
}

variable_types: status int

variable_types:
X
int *

variable_types:
Y
int *

variable_types:
Z
int *

variable_types:
XLL
long long *

variable_types:
YLL
long long *

variable_types:
ZLL
long long *

variable_types: struct timeval { long tv_sec; long tv_usec; } *

variable_types:
Tzp
void *

variable_types: iters int

variable_types: itype int

variable_types: j int

user_defined_types: struct timezone { int tz_minuteswest; int tz_dsttime; }