original_code:
void
qsort_dsc_I4 (
     void *const pbase,
     size_t total_elems,
     size_t size,
     __compar_fn_t cmp
     )
{
  register char *base_ptr = (char *) pbase;
  if ( size != sizeof(int) ) { exit(1); }
  const size_t max_thresh = 4 * size;
  if (total_elems == 0) {
    return;
  }
  if ( total_elems > 4 ) {
    char *lo = base_ptr;
    char *hi = &lo[size * (total_elems - 1)];
    stack_node stack[(8 * sizeof(size_t))];
    stack_node *top = stack;
    ((void) ((top->lo = (((void *)0))), (top->hi = (((void *)0))), ++top));
    while ((stack < top)) {
      char *left_ptr;
      char *right_ptr;
      char *mid = lo + size * ((hi - lo) / size >> 1);
      if ( *((int *)mid) > *((int *)lo) ) {
 { int *ia = (int *)mid; int *ib = (int *)lo; int itmp = *ia; *ia = *ib; *ib = itmp; };
      }
      if ( *((int *)hi) > *((int *)mid) ) {
 { int *ia = (int *)mid; int *ib = (int *)hi; int itmp = *ia; *ia = *ib; *ib = itmp; };
      }
      else {
 goto jump_over;
      }
      if ( *((int *)mid) > *((int *)lo) ) {
 { int *ia = (int *)mid; int *ib = (int *)lo; int itmp = *ia; *ia = *ib; *ib = itmp; };
      }
    jump_over:;
      left_ptr = lo + size;
      right_ptr = hi - size;
      do {
 while ( *((int *)left_ptr) > *((int *)mid) ) {
   left_ptr += size;
 }
 while ( *((int *)mid) > *((int *)right_ptr) ) {
   right_ptr -= size;
 }
 if (left_ptr < right_ptr) {
   { int *ia = (int *)left_ptr; int *ib = (int *)right_ptr; int itmp = *ia; *ia = *ib; *ib = itmp; };
   if (mid == left_ptr) {
     mid = right_ptr;
   }
   else if (mid == right_ptr) {
     mid = left_ptr;
   }
   left_ptr += size;
   right_ptr -= size;
 }
 else if (left_ptr == right_ptr) {
   left_ptr += size;
   right_ptr -= size;
   break;
 }
      } while (left_ptr <= right_ptr);
      if ((size_t) (right_ptr - lo) <= max_thresh) {
 if ((size_t) (hi - left_ptr) <= max_thresh) {
   ((void) (--top, (lo = top->lo), (hi = top->hi)));
 }
 else {
   lo = left_ptr;
 }
      }
      else if ((size_t) (hi - left_ptr) <= max_thresh) {
 hi = right_ptr;
      }
      else if ((right_ptr - lo) > (hi - left_ptr)) {
 ((void) ((top->lo = (lo)), (top->hi = (right_ptr)), ++top));
 lo = left_ptr;
      }
      else {
 ((void) ((top->lo = (left_ptr)), (top->hi = (hi)), ++top));
 hi = right_ptr;
      }
    }
  }
  {
    char *const end_ptr = &base_ptr[size * (total_elems - 1)];
    char *tmp_ptr = base_ptr;
    char *thresh = ((end_ptr) < (base_ptr + max_thresh) ? (end_ptr) : (base_ptr + max_thresh));
    register char *run_ptr;
    for (run_ptr = tmp_ptr + size; run_ptr <= thresh; run_ptr += size) {
      if ( *((int *)run_ptr) > *((int *) tmp_ptr) ) {
        tmp_ptr = run_ptr;
      }
    }
    if (tmp_ptr != base_ptr) {
      { int *ia = (int *)tmp_ptr; int *ib = (int *)base_ptr; int itmp = *ia; *ia = *ib; *ib = itmp; };
    }
    run_ptr = base_ptr + size;
    while ((run_ptr += size) <= end_ptr) {
      tmp_ptr = run_ptr - size;
      while ( *((int *)run_ptr) > *((int *)tmp_ptr) ) {
 tmp_ptr -= size;
      }
      tmp_ptr += size;
      if (tmp_ptr != run_ptr) {
 char *trav;
 trav = run_ptr + size;
 while (--trav >= run_ptr) {
   char c = *trav;
   char *hi, *lo;
   for (hi = lo = trav; (lo -= size) >= tmp_ptr; hi = lo) {
     *hi = *lo;
   }
   *hi = c;
 }
      }
    }
  }
}

canonical_original_code:
void qsort_dsc_I4(void *pbase, unsigned long total_elems, unsigned long size, int (*cmp)(void *, void *))
{
  register char *base_ptr = (char *) pbase;
  if ( size != sizeof(int) ) { exit(1); }
  unsigned long max_thresh = 4 * size;
  if (total_elems == 0) {
    return;
  }
  if ( total_elems > 4 ) {
    char *lo = base_ptr;
    char *hi = &lo[size * (total_elems - 1)];
    struct stack_node stack[-1];
    struct stack_node *top = stack;
    ((void) ((top->lo = (((void *)0))), (top->hi = (((void *)0))), ++top));
    while ((stack < top)) {
      char *left_ptr;
      char *right_ptr;
      char *mid = lo + size * ((hi - lo) / size >> 1);
      if ( *((int *)mid) > *((int *)lo) ) {
 { int *ia = (int *)mid; int *ib = (int *)lo; int itmp = *ia; *ia = *ib; *ib = itmp; };
      }
      if ( *((int *)hi) > *((int *)mid) ) {
 { int *ia = (int *)mid; int *ib = (int *)hi; int itmp = *ia; *ia = *ib; *ib = itmp; };
      }
      else {
 goto jump_over;
      }
      if ( *((int *)mid) > *((int *)lo) ) {
 { int *ia = (int *)mid; int *ib = (int *)lo; int itmp = *ia; *ia = *ib; *ib = itmp; };
      }
    jump_over:;
      left_ptr = lo + size;
      right_ptr = hi - size;
      do {
 while ( *((int *)left_ptr) > *((int *)mid) ) {
   left_ptr += size;
 }
 while ( *((int *)mid) > *((int *)right_ptr) ) {
   right_ptr -= size;
 }
 if (left_ptr < right_ptr) {
   { int *ia = (int *)left_ptr; int *ib = (int *)right_ptr; int itmp = *ia; *ia = *ib; *ib = itmp; };
   if (mid == left_ptr) {
     mid = right_ptr;
   }
   else if (mid == right_ptr) {
     mid = left_ptr;
   }
   left_ptr += size;
   right_ptr -= size;
 }
 else if (left_ptr == right_ptr) {
   left_ptr += size;
   right_ptr -= size;
   break;
 }
      } while (left_ptr <= right_ptr);
      if ((unsigned long) (right_ptr - lo) <= max_thresh) {
 if ((unsigned long) (hi - left_ptr) <= max_thresh) {
   ((void) (--top, (lo = top->lo), (hi = top->hi)));
 }
 else {
   lo = left_ptr;
 }
      }
      else if ((unsigned long) (hi - left_ptr) <= max_thresh) {
 hi = right_ptr;
      }
      else if ((right_ptr - lo) > (hi - left_ptr)) {
 ((void) ((top->lo = (lo)), (top->hi = (right_ptr)), ++top));
 lo = left_ptr;
      }
      else {
 ((void) ((top->lo = (left_ptr)), (top->hi = (hi)), ++top));
 hi = right_ptr;
      }
    }
  }
  {
    char *end_ptr = &base_ptr[size * (total_elems - 1)];
    char *tmp_ptr = base_ptr;
    char *thresh = ((end_ptr) < (base_ptr + max_thresh) ? (end_ptr) : (base_ptr + max_thresh));
    register char *run_ptr;
    for (run_ptr = tmp_ptr + size; run_ptr <= thresh; run_ptr += size) {
      if ( *((int *)run_ptr) > *((int *) tmp_ptr) ) {
        tmp_ptr = run_ptr;
      }
    }
    if (tmp_ptr != base_ptr) {
      { int *ia = (int *)tmp_ptr; int *ib = (int *)base_ptr; int itmp = *ia; *ia = *ib; *ib = itmp; };
    }
    run_ptr = base_ptr + size;
    while ((run_ptr += size) <= end_ptr) {
      tmp_ptr = run_ptr - size;
      while ( *((int *)run_ptr) > *((int *)tmp_ptr) ) {
 tmp_ptr -= size;
      }
      tmp_ptr += size;
      if (tmp_ptr != run_ptr) {
 char *trav;
 trav = run_ptr + size;
 while (--trav >= run_ptr) {
   char c = *trav;
   char *hi; char *lo;
   for (hi = lo = trav; (lo -= size) >= tmp_ptr; hi = lo) {
     *hi = *lo;
   }
   *hi = c;
 }
      }
    }
  }
}

variable_types:
pbase
void *

variable_types:
size
unsigned long

variable_types:
cmp
int (*)(void *, void *)

variable_types:
lo
char *

variable_types:
hi
char *

variable_types: struct stack_node { char *lo; char *hi; } [-1]

variable_types: struct stack_node { char *lo; char *hi; } *

variable_types:
mid
char *

variable_types:
ia
int *

variable_types:
ib
int *

variable_types: itmp int

variable_types:
thresh
char *

variable_types:
trav
char *

variable_types: c char


repo: linkedin/datacl

original_code:
void
add2_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 add2_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:
nR
long long

variable_types:
out
int *

variable_types: outv int

variable_types:
i
long long

return_type: void


decompiled_code:
__int64 __fastcall pos_count_I8_I4(__int64 a1, __int64 a2, __int64 a3, __int64 a4, __int64 a5, __int64 a6)
{
__int64 v7; // rdx
int v8; // eax
__int64 v9; // rax

if ( a4 <= 0 )
return 0LL;
v7 = 0LL;
while ( 1 )
{
v8 = *(_DWORD *)(a3 + 4 * v7);
if ( v8 < 0 || v8 >= a2 )
{
fprintf(stderr, "Line %3d of File %s \n", 32LL, "./AUX/pos_count_I8_I4.c");
return 0xFFFFFFFFLL;
}
v9 = *(_QWORD *)(a1 + 8LL * v8);
if ( v9 < 0 || v9 >= a6 )
break;
++*(_DWORD *)(a5 + 4 * v9);
if ( a4 == ++v7 )
return 0LL;
}
fprintf(stderr, "Line %3d of File %s \n", 36LL, "./AUX/pos_count_I8_I4.c");
return 0xFFFFFFFFLL;
}

canonical_decompiled_code:
__int64 __fastcall func0(__int64 a1, __int64 a2, __int64 a3, __int64 a4, __int64 a5, __int64 a6)
{
__int64 v7; // rdx
int v8; // eax
__int64 v9; // rax

if ( a4 <= 0 )
return 0LL;
v7 = 0LL;
while ( 1 )
{
v8 = *(_DWORD *)(a3 + 4 * v7);
if ( v8 < 0 || v8 >= a2 )
{
fprintf(stderr, "Line %3d of File %s \n", 32LL, "./AUX/pos_count_I8_I4.c");
return 0xFFFFFFFFLL;
}
v9 = *(_QWORD *)(a1 + 8LL * v8);
if ( v9 < 0 || v9 >= a6 )
break;
++*(_DWORD *)(a5 + 4 * v9);
if ( a4 == ++v7 )
return 0LL;
}
fprintf(stderr, "Line %3d of File %s \n", 36LL, "./AUX/pos_count_I8_I4.c");
return 0xFFFFFFFFLL;
}

original_code:
int
pos_count_I8_I4(
    long long *f1,
    long long nR1,
    int *f2,
    long long nR2,
    int *f3,
    long long nR3
    )
{
  int status = 0;
  for ( long long i = 0; i < nR2; i++ ) {
    int f1idx = f2[i];
    if ( ( f1idx < 0 ) || ( f1idx >= nR1 ) ) { { { fprintf(stderr, "Line %3d of File %s \n", 32, "./AUX/pos_count_I8_I4.c"); }; status = -1 ; goto BYE; }; }
    long long f3idx = f1[f1idx];
    if ( ( f3idx < 0 ) || ( f3idx >= nR3 ) ) { { { fprintf(stderr, "Line %3d of File %s \n", 36, "./AUX/pos_count_I8_I4.c"); }; status = -1 ; goto BYE; }; }
    f3[f3idx]++;
  }
BYE:
  return(status);
}

canonical_original_code:
int pos_count_I8_I4(long long *f1, long long nR1, int *f2, long long nR2, int *f3, long long nR3)
{
  int status = 0;
  for ( long long i = 0; i < nR2; i++ ) {
    int f1idx = f2[i];
    if ( ( f1idx < 0 ) || ( f1idx >= nR1 ) ) { { { fprintf(stderr, "Line %3d of File %s \n", 32, "./AUX/pos_count_I8_I4.c"); }; status = -1 ; goto BYE; }; }
    long long f3idx = f1[f1idx];
    if ( ( f3idx < 0 ) || ( f3idx >= nR3 ) ) { { { fprintf(stderr, "Line %3d of File %s \n", 36, "./AUX/pos_count_I8_I4.c"); }; status = -1 ; goto BYE; }; }
    f3[f3idx]++;
  }
BYE:
  return(status);
}

variable_types: status int

return_type: int


original_code:
void
qsort_asc_I8 (
     void *const pbase,
     size_t total_elems,
     size_t size,
     __compar_fn_t cmp
     )
{
  register char *base_ptr = (char *) pbase;
  if ( size != sizeof(long long) ) { exit(1); }
  const size_t max_thresh = 4 * size;
  if (total_elems == 0) {
    return;
  }
  if ( total_elems > 4 ) {
    char *lo = base_ptr;
    char *hi = &lo[size * (total_elems - 1)];
    stack_node stack[(8 * sizeof(size_t))];
    stack_node *top = stack;
    ((void) ((top->lo = (((void *)0))), (top->hi = (((void *)0))), ++top));
    while ((stack < top)) {
      char *left_ptr;
      char *right_ptr;
      char *mid = lo + size * ((hi - lo) / size >> 1);
      if ( *((long long *)mid) < *((long long *)lo) ) {
 { long long *ia = (long long *)mid; long long *ib = (long long *)lo; long long itmp = *ia; *ia = *ib; *ib = itmp; };
      }
      if ( *((long long *)hi) < *((long long *)mid) ) {
 { long long *ia = (long long *)mid; long long *ib = (long long *)hi; long long itmp = *ia; *ia = *ib; *ib = itmp; };
      }
      else {
 goto jump_over;
      }
      if ( *((long long *)mid) < *((long long *)lo) ) {
 { long long *ia = (long long *)mid; long long *ib = (long long *)lo; long long itmp = *ia; *ia = *ib; *ib = itmp; };
      }
    jump_over:;
      left_ptr = lo + size;
      right_ptr = hi - size;
      do {
 while ( *((long long *)left_ptr) < *((long long *)mid) ) {
   left_ptr += size;
 }
 while ( *((long long *)mid) < *((long long *)right_ptr) ) {
   right_ptr -= size;
 }
 if (left_ptr < right_ptr) {
   { long long *ia = (long long *)left_ptr; long long *ib = (long long *)right_ptr; long long itmp = *ia; *ia = *ib; *ib = itmp; };
   if (mid == left_ptr) {
     mid = right_ptr;
   }
   else if (mid == right_ptr) {
     mid = left_ptr;
   }
   left_ptr += size;
   right_ptr -= size;
 }
 else if (left_ptr == right_ptr) {
   left_ptr += size;
   right_ptr -= size;
   break;
 }
      } while (left_ptr <= right_ptr);
      if ((size_t) (right_ptr - lo) <= max_thresh) {
 if ((size_t) (hi - left_ptr) <= max_thresh) {
   ((void) (--top, (lo = top->lo), (hi = top->hi)));
 }
 else {
   lo = left_ptr;
 }
      }
      else if ((size_t) (hi - left_ptr) <= max_thresh) {
 hi = right_ptr;
      }
      else if ((right_ptr - lo) > (hi - left_ptr)) {
 ((void) ((top->lo = (lo)), (top->hi = (right_ptr)), ++top));
 lo = left_ptr;
      }
      else {
 ((void) ((top->lo = (left_ptr)), (top->hi = (hi)), ++top));
 hi = right_ptr;
      }
    }
  }
  {
    char *const end_ptr = &base_ptr[size * (total_elems - 1)];
    char *tmp_ptr = base_ptr;
    char *thresh = ((end_ptr) < (base_ptr + max_thresh) ? (end_ptr) : (base_ptr + max_thresh));
    register char *run_ptr;
    for (run_ptr = tmp_ptr + size; run_ptr <= thresh; run_ptr += size) {
      if ( *((long long *)run_ptr) < *((long long *) tmp_ptr) ) {
        tmp_ptr = run_ptr;
      }
    }
    if (tmp_ptr != base_ptr) {
      { long long *ia = (long long *)tmp_ptr; long long *ib = (long long *)base_ptr; long long itmp = *ia; *ia = *ib; *ib = itmp; };
    }
    run_ptr = base_ptr + size;
    while ((run_ptr += size) <= end_ptr) {
      tmp_ptr = run_ptr - size;
      while ( *((long long *)run_ptr) < *((long long *)tmp_ptr) ) {
 tmp_ptr -= size;
      }
      tmp_ptr += size;
      if (tmp_ptr != run_ptr) {
 char *trav;
 trav = run_ptr + size;
 while (--trav >= run_ptr) {
   char c = *trav;
   char *hi, *lo;
   for (hi = lo = trav; (lo -= size) >= tmp_ptr; hi = lo) {
     *hi = *lo;
   }
   *hi = c;
 }
      }
    }
  }
}

canonical_original_code:
void qsort_asc_I8(void *pbase, unsigned long total_elems, unsigned long size, int (*cmp)(void *, void *))
{
  register char *base_ptr = (char *) pbase;
  if ( size != sizeof(long long) ) { exit(1); }
  unsigned long max_thresh = 4 * size;
  if (total_elems == 0) {
    return;
  }
  if ( total_elems > 4 ) {
    char *lo = base_ptr;
    char *hi = &lo[size * (total_elems - 1)];
    struct stack_node stack[-1];
    struct stack_node *top = stack;
    ((void) ((top->lo = (((void *)0))), (top->hi = (((void *)0))), ++top));
    while ((stack < top)) {
      char *left_ptr;
      char *right_ptr;
      char *mid = lo + size * ((hi - lo) / size >> 1);
      if ( *((long long *)mid) < *((long long *)lo) ) {
 { long long *ia = (long long *)mid; long long *ib = (long long *)lo; long long itmp = *ia; *ia = *ib; *ib = itmp; };
      }
      if ( *((long long *)hi) < *((long long *)mid) ) {
 { long long *ia = (long long *)mid; long long *ib = (long long *)hi; long long itmp = *ia; *ia = *ib; *ib = itmp; };
      }
      else {
 goto jump_over;
      }
      if ( *((long long *)mid) < *((long long *)lo) ) {
 { long long *ia = (long long *)mid; long long *ib = (long long *)lo; long long itmp = *ia; *ia = *ib; *ib = itmp; };
      }
    jump_over:;
      left_ptr = lo + size;
      right_ptr = hi - size;
      do {
 while ( *((long long *)left_ptr) < *((long long *)mid) ) {
   left_ptr += size;
 }
 while ( *((long long *)mid) < *((long long *)right_ptr) ) {
   right_ptr -= size;
 }
 if (left_ptr < right_ptr) {
   { long long *ia = (long long *)left_ptr; long long *ib = (long long *)right_ptr; long long itmp = *ia; *ia = *ib; *ib = itmp; };
   if (mid == left_ptr) {
     mid = right_ptr;
   }
   else if (mid == right_ptr) {
     mid = left_ptr;
   }
   left_ptr += size;
   right_ptr -= size;
 }
 else if (left_ptr == right_ptr) {
   left_ptr += size;
   right_ptr -= size;
   break;
 }
      } while (left_ptr <= right_ptr);
      if ((unsigned long) (right_ptr - lo) <= max_thresh) {
 if ((unsigned long) (hi - left_ptr) <= max_thresh) {
   ((void) (--top, (lo = top->lo), (hi = top->hi)));
 }
 else {
   lo = left_ptr;
 }
      }
      else if ((unsigned long) (hi - left_ptr) <= max_thresh) {
 hi = right_ptr;
      }
      else if ((right_ptr - lo) > (hi - left_ptr)) {
 ((void) ((top->lo = (lo)), (top->hi = (right_ptr)), ++top));
 lo = left_ptr;
      }
      else {
 ((void) ((top->lo = (left_ptr)), (top->hi = (hi)), ++top));
 hi = right_ptr;
      }
    }
  }
  {
    char *end_ptr = &base_ptr[size * (total_elems - 1)];
    char *tmp_ptr = base_ptr;
    char *thresh = ((end_ptr) < (base_ptr + max_thresh) ? (end_ptr) : (base_ptr + max_thresh));
    register char *run_ptr;
    for (run_ptr = tmp_ptr + size; run_ptr <= thresh; run_ptr += size) {
      if ( *((long long *)run_ptr) < *((long long *) tmp_ptr) ) {
        tmp_ptr = run_ptr;
      }
    }
    if (tmp_ptr != base_ptr) {
      { long long *ia = (long long *)tmp_ptr; long long *ib = (long long *)base_ptr; long long itmp = *ia; *ia = *ib; *ib = itmp; };
    }
    run_ptr = base_ptr + size;
    while ((run_ptr += size) <= end_ptr) {
      tmp_ptr = run_ptr - size;
      while ( *((long long *)run_ptr) < *((long long *)tmp_ptr) ) {
 tmp_ptr -= size;
      }
      tmp_ptr += size;
      if (tmp_ptr != run_ptr) {
 char *trav;
 trav = run_ptr + size;
 while (--trav >= run_ptr) {
   char c = *trav;
   char *hi; char *lo;
   for (hi = lo = trav; (lo -= size) >= tmp_ptr; hi = lo) {
     *hi = *lo;
   }
   *hi = c;
 }
      }
    }
  }
}

variable_types:
pbase
void *

variable_types:
size
unsigned long

variable_types:
cmp
int (*)(void *, void *)

variable_types:
ia
long long *

variable_types:
ib
long long *

variable_types:
itmp
long long

user_defined_types: struct stack_node { char *lo; char *hi; }


decompiled_code:
__int64 __fastcall copy_tbl(char *s1, char *s2)
{
int v3; // ebp
__int64 v4; // rbx
__int64 v6; // rsi
int v7[1027]; // [rsp+0h] [rbp-10C8h] BYREF
int v8; // [rsp+100Ch] [rbp-BCh] BYREF
char s[32]; // [rsp+1010h] [rbp-B8h] BYREF
char v10[48]; // [rsp+1030h] [rbp-98h] BYREF
__int64 v11[7]; // [rsp+1060h] [rbp-68h] BYREF
char v12[4]; // [rsp+1098h] [rbp-30h] BYREF
int v13[11]; // [rsp+109Ch] [rbp-2Ch] BYREF

v8 = 0;
zero_string(s, 32LL);
if ( s1 && *s1 )
{
if ( s2 && *s2 )
{
if ( !strcmp(s1, s2) )
{
fprintf(stderr, "Line %3d of File %s \n", 33LL, "copy_tbl.c");
v3 = -1;
}
else
{
v3 = is_tbl(s1, v13, v11);
if ( v3 < 0 )
{
fprintf(stderr, "Line %3d of File %s \n", 35LL, "copy_tbl.c");
}
else if ( v13[0] < 0 || v13[0] >= g_n_tbl )
{
fprintf(stderr, "Line %3d of File %s \n", 36LL, "copy_tbl.c");
v3 = -1;
}
else
{
v3 = del_tbl(s2, 0xFFFFFFFFLL);
if ( v3 < 0 )
{
fprintf(stderr, "Line %3d of File %s \n", 37LL, "copy_tbl.c");
}
else
{
sprintf(s, "%lld", v11[0]);
tbl_meta(s1, 0LL, v7, &v8);
v3 = add_tbl(s2, s, v12, v10);
if ( v3 < 0 )
{
fprintf(stderr, "Line %3d of File %s \n", 44LL, "copy_tbl.c");
}
else
{
v4 = 0LL;
if ( v8 > 0 )
{
while ( 1 )
{
v6 = g_flds + 120LL * v7[v4];
if ( (unsigned int)(*(_DWORD *)(v6 + 32) - 2) <= 5 )
{
v3 = copy_fld(s1, v6 + 40, 0LL, s2);
if ( v3 < 0 )
break;
}
if ( v8 <= (int)++v4 )
return (unsigned int)v3;
}
fprintf(stderr, "Line %3d of File %s \n", 57LL, "copy_tbl.c");
}
}
}
}
}
}
else
{
fprintf(stderr, "Line %3d of File %s \n", 32LL, "copy_tbl.c");
v3 = -1;
}
}
else
{
fprintf(stderr, "Line %3d of File %s \n", 31LL, "copy_tbl.c");
v3 = -1;
}
return (unsigned int)v3;
}

canonical_decompiled_code:
__int64 __fastcall func0(char *s1, char *s2)
{
int v3; // ebp
__int64 v4; // rbx
__int64 v6; // rsi
int v7[1027]; // [rsp+0h] [rbp-10C8h] BYREF
int v8; // [rsp+100Ch] [rbp-BCh] BYREF
char s[32]; // [rsp+1010h] [rbp-B8h] BYREF
char v10[48]; // [rsp+1030h] [rbp-98h] BYREF
__int64 v11[7]; // [rsp+1060h] [rbp-68h] BYREF
char v12[4]; // [rsp+1098h] [rbp-30h] BYREF
int v13[11]; // [rsp+109Ch] [rbp-2Ch] BYREF

v8 = 0;
zero_string(s, 32LL);
if ( s1 && *s1 )
{
if ( s2 && *s2 )
{
if ( !strcmp(s1, s2) )
{
fprintf(stderr, "Line %3d of File %s \n", 33LL, "copy_tbl.c");
v3 = -1;
}
else
{
v3 = is_tbl(s1, v13, v11);
if ( v3 < 0 )
{
fprintf(stderr, "Line %3d of File %s \n", 35LL, "copy_tbl.c");
}
else if ( v13[0] < 0 || v13[0] >= g_n_tbl )
{
fprintf(stderr, "Line %3d of File %s \n", 36LL, "copy_tbl.c");
v3 = -1;
}
else
{
v3 = del_tbl(s2, 0xFFFFFFFFLL);
if ( v3 < 0 )
{
fprintf(stderr, "Line %3d of File %s \n", 37LL, "copy_tbl.c");
}
else
{
sprintf(s, "%lld", v11[0]);
tbl_meta(s1, 0LL, v7, &v8);
v3 = add_tbl(s2, s, v12, v10);
if ( v3 < 0 )
{
fprintf(stderr, "Line %3d of File %s \n", 44LL, "copy_tbl.c");
}
else
{
v4 = 0LL;
if ( v8 > 0 )
{
while ( 1 )
{
v6 = g_flds + 120LL * v7[v4];
if ( (unsigned int)(*(_DWORD *)(v6 + 32) - 2) <= 5 )
{
v3 = copy_fld(s1, v6 + 40, 0LL, s2);
if ( v3 < 0 )
break;
}
if ( v8 <= (int)++v4 )
return (unsigned int)v3;
}
fprintf(stderr, "Line %3d of File %s \n", 57LL, "copy_tbl.c");
}
}
}
}
}
}
else
{
fprintf(stderr, "Line %3d of File %s \n", 32LL, "copy_tbl.c");
v3 = -1;
}
}
else
{
fprintf(stderr, "Line %3d of File %s \n", 31LL, "copy_tbl.c");
v3 = -1;
}
return (unsigned int)v3;
}

original_code:
int
copy_tbl(
  char *in_tbl,
  char *out_tbl
  )
{
  int status = 0;
  int in_tbl_id, out_tbl_id;
  TBL_REC_TYPE in_tbl_rec, out_tbl_rec;
  long long nR; char str_nR[32];
  int num_flds = 0; int fld_ids[1024];
  zero_string(str_nR, 32);
  if ( ( in_tbl == ((void *)0) ) || ( *in_tbl == '\0' ) ) { { { fprintf(stderr, "Line %3d of File %s \n", 31, "copy_tbl.c"); }; status = -1 ; goto BYE; }; }
  if ( ( out_tbl == ((void *)0) ) || ( *out_tbl == '\0' ) ) { { { fprintf(stderr, "Line %3d of File %s \n", 32, "copy_tbl.c"); }; status = -1 ; goto BYE; }; }
  if ( strcmp(in_tbl, out_tbl) == 0 ) { { { fprintf(stderr, "Line %3d of File %s \n", 33, "copy_tbl.c"); }; status = -1 ; goto BYE; }; }
  status = is_tbl(in_tbl, &in_tbl_id, &in_tbl_rec); { if ( (status) < 0 ) { { { fprintf(stderr, "Line %3d of File %s \n", 35, "copy_tbl.c"); }; status = (status) ; goto BYE; } } };
  { if ( ( (in_tbl_id) < (0) ) || ( (in_tbl_id) >= (g_n_tbl ) ) ) { { { fprintf(stderr, "Line %3d of File %s \n", 36, "copy_tbl.c"); }; status = -1 ; goto BYE; }; } };
  status = del_tbl(out_tbl, -1); { if ( (status) < 0 ) { { { fprintf(stderr, "Line %3d of File %s \n", 37, "copy_tbl.c"); }; status = (status) ; goto BYE; } } };
  nR = in_tbl_rec.nR;
  sprintf(str_nR, "%lld", nR);
  status = tbl_meta(in_tbl, 0, fld_ids, &num_flds);
  status = add_tbl(out_tbl, str_nR, &out_tbl_id, &out_tbl_rec); { if ( (status) < 0 ) { { { fprintf(stderr, "Line %3d of File %s \n", 44, "copy_tbl.c"); }; status = (status) ; goto BYE; } } };
  for ( int i = 0; i < num_flds; i++ ) {
    int fld_id; char *fldname = ((void *)0);
    fld_id = fld_ids[i];
    FLD_REC_TYPE fld_rec = g_flds[fld_id];
    fldname = g_flds[fld_id].name;
    _Bool skip_fld = 0;
    switch ( fld_rec.fldtype ) {
      case I1 : case I2 : case I4 : case I8 : case F4 : case F8 : break;
      default : skip_fld = 1; break;
    }
    if ( skip_fld == 1 ) { continue; }
    status = copy_fld(in_tbl, fldname, ((void *)0), out_tbl);
    { if ( (status) < 0 ) { { { fprintf(stderr, "Line %3d of File %s \n", 57, "copy_tbl.c"); }; status = (status) ; goto BYE; } } };
  }
 BYE:
  return status ;
}

canonical_original_code:
int copy_tbl(char *in_tbl, char *out_tbl)
{
  int status = 0;
  int in_tbl_id; int out_tbl_id;
  struct _TBL_REC_TYPE in_tbl_rec; struct _TBL_REC_TYPE out_tbl_rec;
  long long nR; char str_nR[32];
  int num_flds = 0; int fld_ids[1024];
  zero_string(str_nR, 32);
  if ( ( in_tbl == ((void *)0) ) || ( *in_tbl == '\0' ) ) { { { fprintf(stderr, "Line %3d of File %s \n", 31, "copy_tbl.c"); }; status = -1 ; goto BYE; }; }
  if ( ( out_tbl == ((void *)0) ) || ( *out_tbl == '\0' ) ) { { { fprintf(stderr, "Line %3d of File %s \n", 32, "copy_tbl.c"); }; status = -1 ; goto BYE; }; }
  if ( strcmp(in_tbl, out_tbl) == 0 ) { { { fprintf(stderr, "Line %3d of File %s \n", 33, "copy_tbl.c"); }; status = -1 ; goto BYE; }; }
  status = is_tbl(in_tbl, &in_tbl_id, &in_tbl_rec); { if ( (status) < 0 ) { { { fprintf(stderr, "Line %3d of File %s \n", 35, "copy_tbl.c"); }; status = (status) ; goto BYE; } } };
  { if ( ( (in_tbl_id) < (0) ) || ( (in_tbl_id) >= (g_n_tbl ) ) ) { { { fprintf(stderr, "Line %3d of File %s \n", 36, "copy_tbl.c"); }; status = -1 ; goto BYE; }; } };
  status = del_tbl(out_tbl, -1); { if ( (status) < 0 ) { { { fprintf(stderr, "Line %3d of File %s \n", 37, "copy_tbl.c"); }; status = (status) ; goto BYE; } } };
  nR = in_tbl_rec.nR;
  sprintf(str_nR, "%lld", nR);
  status = tbl_meta(in_tbl, 0, fld_ids, &num_flds);
  status = add_tbl(out_tbl, str_nR, &out_tbl_id, &out_tbl_rec); { if ( (status) < 0 ) { { { fprintf(stderr, "Line %3d of File %s \n", 44, "copy_tbl.c"); }; status = (status) ; goto BYE; } } };
  for ( int i = 0; i < num_flds; i++ ) {
    int fld_id; char *fldname = ((void *)0);
    fld_id = fld_ids[i];
    struct _FLD_REC_TYPE fld_rec = g_flds[fld_id];
    fldname = g_flds[fld_id].name;
    _Bool skip_fld = 0;
    switch ( fld_rec.fldtype ) {
      case I1 : case I2 : case I4 : case I8 : case F4 : case F8 : break;
      default : skip_fld = 1; break;
    }
    if ( skip_fld == 1 ) { continue; }
    status = copy_fld(in_tbl, fldname, ((void *)0), out_tbl);
    { if ( (status) < 0 ) { { { fprintf(stderr, "Line %3d of File %s \n", 57, "copy_tbl.c"); }; status = (status) ; goto BYE; } } };
  }
 BYE:
  return status ;
}

variable_types: struct _TBL_REC_TYPE { long long nR; _Bool is_temp; char name[-1]; enum _TBL_TYPE { undef_tbl=0, regular=1, ldb_dict=2, txt_lkp=3, min_max=4, first_last=5, bins=6 } tbltype; }

variable_types: i int

variable_types:
fldname
char *

variable_types: struct _FLD_REC_TYPE { short tbl_id; short ddir_id; short parent_id; short nn_fld_id; short len; unsigned long filesz; _Bool is_external; enum _SORT_TYPE { unknown=0, ascending=1, descending=2, unsorted=3 } srttype; enum _FLD_TYPE { undef_fldtype=0, B=1, I1=2, I2=3, I4=4, I8=5, F4=6, F8=7, SC=8, SV=9 } fldtype; enum _AUX_TYPE { undef_auxtype=0, nn=1, len=2, off=3 } auxtype; char name[-1]; int fileno; union sumval { long long sumI8; double sumF8; } sumval; union minval { long long minI8; double minF8; } minval; union maxval { long long maxI8; double maxF8; } maxval; _Bool is_sum_nn; _Bool is_min_nn; _Bool is_max_nn; long long num_nn; }

user_defined_types: struct _TBL_REC_TYPE { long long nR; _Bool is_temp; char name[-1]; enum _TBL_TYPE tbltype; }

user_defined_types: struct _FLD_REC_TYPE { short tbl_id; short ddir_id; short parent_id; short nn_fld_id; short len; unsigned long filesz; _Bool is_external; enum _SORT_TYPE srttype; enum _FLD_TYPE fldtype; enum _AUX_TYPE auxtype; char name[-1]; int fileno; union sumval sumval; union minval minval; union maxval maxval; _Bool is_sum_nn; _Bool is_min_nn; _Bool is_max_nn; long long num_nn; }


decompiled_code:
__int64 __fastcall g_count(char *s1, char *s2, char *a3)
{
int v4; // ebx
char *v5; // rbp
_BYTE v7[712]; // [rsp-860h] [rbp-1D28h] BYREF
_BYTE v8[712]; // [rsp-598h] [rbp-1A60h] BYREF
_BYTE v9[712]; // [rsp-2D0h] [rbp-1798h] BYREF
char v10[1024]; // [rsp+0h] [rbp-14C8h] BYREF
char v11[2060]; // [rsp+400h] [rbp-10C8h] BYREF
unsigned int v12; // [rsp+C0Ch] [rbp-8BCh] BYREF
__int64 v13; // [rsp+C10h] [rbp-8B8h] BYREF
__int64 v14; // [rsp+C18h] [rbp-8B0h] BYREF
__int64 v15; // [rsp+C20h] [rbp-8A8h] BYREF
char *haystack; // [rsp+C28h] [rbp-8A0h] BYREF
int v17[179]; // [rsp+C30h] [rbp-898h] BYREF
int v18; // [rsp+EFCh] [rbp-5CCh] BYREF
int v19[179]; // [rsp+F00h] [rbp-5C8h] BYREF
int v20; // [rsp+11CCh] [rbp-2FCh] BYREF
int v21[179]; // [rsp+11D0h] [rbp-2F8h] BYREF
int v22[11]; // [rsp+149Ch] [rbp-2Ch] BYREF

v22[0] = -1;
v20 = -1;
v18 = -1;
haystack = 0LL;
v15 = 0LL;
v14 = 0LL;
v13 = 0LL;
v12 = 0;
g_mmap_meta_data(&g_docroot, &v15, &v14, &v13, &v12);
if ( s1 && *s1 )
{
if ( s2 && *s2 )
{
if ( a3 && *a3 )
{
if ( !strcmp(s1, s2) )
{
fprintf(stderr, "Line %3d of File %s \n", 47LL, "g_count.c");
v4 = -1;
}
else if ( !strcmp(s1, a3) )
{
fprintf(stderr, "Line %3d of File %s \n", 48LL, "g_count.c");
v4 = -1;
}
else if ( !strcmp(a3, s2) )
{
fprintf(stderr, "Line %3d of File %s \n", 49LL, "g_count.c");
v4 = -1;
}
else
{
v4 = g_is_fld(v13, v12, s1, v22, v21);
if ( v4 < 0 )
{
fprintf(stderr, "Line %3d of File %s \n", 51LL, "g_count.c");
}
else if ( v22[0] < 0 )
{
fprintf(stderr, "Line %3d of File %s \n", 52LL, "g_count.c");
v4 = -1;
}
else if ( (unsigned int)is_fldtype_goodfor_gpu((unsigned int)v21[8]) )
{
v4 = g_is_fld(v13, v12, s2, &v20, v19);
if ( v4 < 0 )
{
fprintf(stderr, "Line %3d of File %s \n", 55LL, "g_count.c");
}
else if ( v20 < 0 )
{
fprintf(stderr, "Line %3d of File %s \n", 56LL, "g_count.c");
v4 = -1;
}
else if ( (unsigned int)is_fldtype_goodfor_gpu((unsigned int)v19[8]) )
{
v4 = g_is_fld(v13, v12, a3, &v18, v17);
if ( v4 < 0 )
{
fprintf(stderr, "Line %3d of File %s \n", 59LL, "g_count.c");
}
else if ( v18 < 0 )
{
fprintf(stderr, "Line %3d of File %s \n", 60LL, "g_count.c");
v4 = -1;
}
else if ( (unsigned int)is_fldtype_goodfor_gpu((unsigned int)v17[8]) )
{
qmemcpy(v9, v17, sizeof(v9));
qmemcpy(v8, v19, sizeof(v8));
qmemcpy(v7, v21, sizeof(v7));
v4 = g_chk_count();
if ( v4 < 0 )
{
fprintf(stderr, "Line %3d of File %s \n", 63LL, "g_count.c");
}
else
{
zero_string(v11, 2048LL);
zero_string(v10, 1024LL);
sprintf(v10, "f1f2opf3 d_fld1=%s d_cfld=%s d_fld2=%s", s1, s2, a3);
v4 = g_make_url(v10, v11);
if ( v4 < 0 )
{
fprintf(stderr, "Line %3d of File %s \n", 69LL, "g_count.c");
}
else
{
v4 = g_call_gpu(v11, &haystack);
if ( v4 < 0 )
{
fprintf(stderr, "Line %3d of File %s \n", 70LL, "g_count.c");
}
else
{
v5 = haystack;
if ( !haystack )
goto LABEL_43;
if ( strstr(haystack, "\"\"") )
{
LABEL_42:
free(v5);
haystack = 0LL;
goto LABEL_43;
}
fprintf(stderr, "Response from GPU = [%s]\n", v5);
}
}
}
}
else
{
fprintf(stderr, "Line %3d of File %s \n", 61LL, "g_count.c");
v4 = -1;
}
}
else
{
fprintf(stderr, "Line %3d of File %s \n", 57LL, "g_count.c");
v4 = -1;
}
}
else
{
fprintf(stderr, "Line %3d of File %s \n", 53LL, "g_count.c");
v4 = -1;
}
}
}
else
{
fprintf(stderr, "Line %3d of File %s \n", 46LL, "g_count.c");
v4 = -1;
}
}
else
{
fprintf(stderr, "Line %3d of File %s \n", 45LL, "g_count.c");
v4 = -1;
}
}
else
{
fprintf(stderr, "Line %3d of File %s \n", 44LL, "g_count.c");
v4 = -1;
}
v5 = haystack;
if ( haystack )
goto LABEL_42;
LABEL_43:
g_unmap_meta_data(v15, v14);
return (unsigned int)v4;
}

canonical_decompiled_code:
__int64 __fastcall func0(char *s1, char *s2, char *a3)
{
int v4; // ebx
char *v5; // rbp
_BYTE v7[712]; // [rsp-860h] [rbp-1D28h] BYREF
_BYTE v8[712]; // [rsp-598h] [rbp-1A60h] BYREF
_BYTE v9[712]; // [rsp-2D0h] [rbp-1798h] BYREF
char v10[1024]; // [rsp+0h] [rbp-14C8h] BYREF
char v11[2060]; // [rsp+400h] [rbp-10C8h] BYREF
unsigned int v12; // [rsp+C0Ch] [rbp-8BCh] BYREF
__int64 v13; // [rsp+C10h] [rbp-8B8h] BYREF
__int64 v14; // [rsp+C18h] [rbp-8B0h] BYREF
__int64 v15; // [rsp+C20h] [rbp-8A8h] BYREF
char *haystack; // [rsp+C28h] [rbp-8A0h] BYREF
int v17[179]; // [rsp+C30h] [rbp-898h] BYREF
int v18; // [rsp+EFCh] [rbp-5CCh] BYREF
int v19[179]; // [rsp+F00h] [rbp-5C8h] BYREF
int v20; // [rsp+11CCh] [rbp-2FCh] BYREF
int v21[179]; // [rsp+11D0h] [rbp-2F8h] BYREF
int v22[11]; // [rsp+149Ch] [rbp-2Ch] BYREF

v22[0] = -1;
v20 = -1;
v18 = -1;
haystack = 0LL;
v15 = 0LL;
v14 = 0LL;
v13 = 0LL;
v12 = 0;
g_mmap_meta_data(&g_docroot, &v15, &v14, &v13, &v12);
if ( s1 && *s1 )
{
if ( s2 && *s2 )
{
if ( a3 && *a3 )
{
if ( !strcmp(s1, s2) )
{
fprintf(stderr, "Line %3d of File %s \n", 47LL, "g_count.c");
v4 = -1;
}
else if ( !strcmp(s1, a3) )
{
fprintf(stderr, "Line %3d of File %s \n", 48LL, "g_count.c");
v4 = -1;
}
else if ( !strcmp(a3, s2) )
{
fprintf(stderr, "Line %3d of File %s \n", 49LL, "g_count.c");
v4 = -1;
}
else
{
v4 = g_is_fld(v13, v12, s1, v22, v21);
if ( v4 < 0 )
{
fprintf(stderr, "Line %3d of File %s \n", 51LL, "g_count.c");
}
else if ( v22[0] < 0 )
{
fprintf(stderr, "Line %3d of File %s \n", 52LL, "g_count.c");
v4 = -1;
}
else if ( (unsigned int)is_fldtype_goodfor_gpu((unsigned int)v21[8]) )
{
v4 = g_is_fld(v13, v12, s2, &v20, v19);
if ( v4 < 0 )
{
fprintf(stderr, "Line %3d of File %s \n", 55LL, "g_count.c");
}
else if ( v20 < 0 )
{
fprintf(stderr, "Line %3d of File %s \n", 56LL, "g_count.c");
v4 = -1;
}
else if ( (unsigned int)is_fldtype_goodfor_gpu((unsigned int)v19[8]) )
{
v4 = g_is_fld(v13, v12, a3, &v18, v17);
if ( v4 < 0 )
{
fprintf(stderr, "Line %3d of File %s \n", 59LL, "g_count.c");
}
else if ( v18 < 0 )
{
fprintf(stderr, "Line %3d of File %s \n", 60LL, "g_count.c");
v4 = -1;
}
else if ( (unsigned int)is_fldtype_goodfor_gpu((unsigned int)v17[8]) )
{
qmemcpy(v9, v17, sizeof(v9));
qmemcpy(v8, v19, sizeof(v8));
qmemcpy(v7, v21, sizeof(v7));
v4 = g_chk_count();
if ( v4 < 0 )
{
fprintf(stderr, "Line %3d of File %s \n", 63LL, "g_count.c");
}
else
{
zero_string(v11, 2048LL);
zero_string(v10, 1024LL);
sprintf(v10, "f1f2opf3 d_fld1=%s d_cfld=%s d_fld2=%s", s1, s2, a3);
v4 = g_make_url(v10, v11);
if ( v4 < 0 )
{
fprintf(stderr, "Line %3d of File %s \n", 69LL, "g_count.c");
}
else
{
v4 = g_call_gpu(v11, &haystack);
if ( v4 < 0 )
{
fprintf(stderr, "Line %3d of File %s \n", 70LL, "g_count.c");
}
else
{
v5 = haystack;
if ( !haystack )
goto LABEL_43;
if ( strstr(haystack, "\"\"") )
{
LABEL_42:
free(v5);
haystack = 0LL;
goto LABEL_43;
}
fprintf(stderr, "Response from GPU = [%s]\n", v5);
}
}
}
}
else
{
fprintf(stderr, "Line %3d of File %s \n", 61LL, "g_count.c");
v4 = -1;
}
}
else
{
fprintf(stderr, "Line %3d of File %s \n", 57LL, "g_count.c");
v4 = -1;
}
}
else
{
fprintf(stderr, "Line %3d of File %s \n", 53LL, "g_count.c");
v4 = -1;
}
}
}
else
{
fprintf(stderr, "Line %3d of File %s \n", 46LL, "g_count.c");
v4 = -1;
}
}
else
{
fprintf(stderr, "Line %3d of File %s \n", 45LL, "g_count.c");
v4 = -1;
}
}
else
{
fprintf(stderr, "Line %3d of File %s \n", 44LL, "g_count.c");
v4 = -1;
}
v5 = haystack;
if ( haystack )
goto LABEL_42;
LABEL_43:
g_unmap_meta_data(v15, v14);
return (unsigned int)v4;
}

original_code:
int
g_count(
    char *f1,
    char *cfld,
    char *f2
    )
{
  int status = 0;
  int f1_id = -1; GPU_REG_TYPE f1_rec;
  int cfld_id = -1; GPU_REG_TYPE cfld_rec;
  int f2_id = -1; GPU_REG_TYPE f2_rec;
  char *curl_response = ((void *)0);
  char *gpu_reg_X = ((void *)0);
  size_t gpu_reg_nX = 0;
  GPU_REG_TYPE *gpu_reg = ((void *)0);
  int n_gpu_reg = 0;
  status = g_mmap_meta_data(g_docroot, &gpu_reg_X, &gpu_reg_nX,
      &gpu_reg, &n_gpu_reg);
  if ( ( f1 == ((void *)0) ) || ( *f1 == '\0' ) ) { { { fprintf(stderr, "Line %3d of File %s \n", 44, "g_count.c"); }; status = -1 ; goto BYE; }; }
  if ( ( cfld == ((void *)0) ) || ( *cfld == '\0' ) ) { { { fprintf(stderr, "Line %3d of File %s \n", 45, "g_count.c"); }; status = -1 ; goto BYE; }; }
  if ( ( f2 == ((void *)0) ) || ( *f2 == '\0' ) ) { { { fprintf(stderr, "Line %3d of File %s \n", 46, "g_count.c"); }; status = -1 ; goto BYE; }; }
  if ( strcmp(f1, cfld) == 0 ) { { { fprintf(stderr, "Line %3d of File %s \n", 47, "g_count.c"); }; status = -1 ; goto BYE; }; }
  if ( strcmp(f1, f2) == 0 ) { { { fprintf(stderr, "Line %3d of File %s \n", 48, "g_count.c"); }; status = -1 ; goto BYE; }; }
  if ( strcmp(f2, cfld) == 0 ) { { { fprintf(stderr, "Line %3d of File %s \n", 49, "g_count.c"); }; status = -1 ; goto BYE; }; }
  status = g_is_fld(gpu_reg, n_gpu_reg, f1, &f1_id, &f1_rec); { if ( (status) < 0 ) { { { fprintf(stderr, "Line %3d of File %s \n", 51, "g_count.c"); }; status = (status) ; goto BYE; } } };
  if ( f1_id < 0 ) { { { fprintf(stderr, "Line %3d of File %s \n", 52, "g_count.c"); }; status = -1 ; goto BYE; }; }
  if ( is_fldtype_goodfor_gpu(f1_rec.fldtype) == 0 ) { { { fprintf(stderr, "Line %3d of File %s \n", 53, "g_count.c"); }; status = -1 ; goto BYE; }; }
  status = g_is_fld(gpu_reg, n_gpu_reg, cfld, &cfld_id, &cfld_rec); { if ( (status) < 0 ) { { { fprintf(stderr, "Line %3d of File %s \n", 55, "g_count.c"); }; status = (status) ; goto BYE; } } };
  if ( cfld_id < 0 ) { { { fprintf(stderr, "Line %3d of File %s \n", 56, "g_count.c"); }; status = -1 ; goto BYE; }; }
  if ( is_fldtype_goodfor_gpu(cfld_rec.fldtype) == 0 ) { { { fprintf(stderr, "Line %3d of File %s \n", 57, "g_count.c"); }; status = -1 ; goto BYE; }; }
  status = g_is_fld(gpu_reg, n_gpu_reg, f2, &f2_id, &f2_rec); { if ( (status) < 0 ) { { { fprintf(stderr, "Line %3d of File %s \n", 59, "g_count.c"); }; status = (status) ; goto BYE; } } };
  if ( f2_id < 0 ) { { { fprintf(stderr, "Line %3d of File %s \n", 60, "g_count.c"); }; status = -1 ; goto BYE; }; }
  if ( is_fldtype_goodfor_gpu(f2_rec.fldtype) == 0 ) { { { fprintf(stderr, "Line %3d of File %s \n", 61, "g_count.c"); }; status = -1 ; goto BYE; }; }
  status = g_chk_count(f1_rec, cfld_rec, f2_rec); { if ( (status) < 0 ) { { { fprintf(stderr, "Line %3d of File %s \n", 63, "g_count.c"); }; status = (status) ; goto BYE; } } };
  char url[2048]; zero_string(url, 2048);
  char command[1024]; zero_string(command, 1024);
  sprintf(command, "f1f2opf3 d_fld1=%s d_cfld=%s d_fld2=%s",
        f1, cfld, f2);
  status = g_make_url(command, url); { if ( (status) < 0 ) { { { fprintf(stderr, "Line %3d of File %s \n", 69, "g_count.c"); }; status = (status) ; goto BYE; } } };
  status = g_call_gpu(url, &curl_response); { if ( (status) < 0 ) { { { fprintf(stderr, "Line %3d of File %s \n", 70, "g_count.c"); }; status = (status) ; goto BYE; } } };
  if ( curl_response != ((void *)0) ) {
    if ( strstr(curl_response, "\"\"") == ((void *)0) ) {
      fprintf(stderr, "Response from GPU = [%s]\n", curl_response);
    }
  }
BYE:
  { if ( (curl_response) != ((void *)0) ) { free((curl_response)); (curl_response) = ((void *)0); } };
  g_unmap_meta_data(gpu_reg_X, gpu_reg_nX);
  return status ;
}

canonical_original_code:
int g_count(char *f1, char *cfld, char *f2)
{
  int status = 0;
  int f1_id = -1; struct _GPU_REG_TYPE f1_rec;
  int cfld_id = -1; struct _GPU_REG_TYPE cfld_rec;
  int f2_id = -1; struct _GPU_REG_TYPE f2_rec;
  char *curl_response = ((void *)0);
  char *gpu_reg_X = ((void *)0);
  unsigned long gpu_reg_nX = 0;
  struct _GPU_REG_TYPE *gpu_reg = ((void *)0);
  int n_gpu_reg = 0;
  status = g_mmap_meta_data(g_docroot, &gpu_reg_X, &gpu_reg_nX,
      &gpu_reg, &n_gpu_reg);
  if ( ( f1 == ((void *)0) ) || ( *f1 == '\0' ) ) { { { fprintf(stderr, "Line %3d of File %s \n", 44, "g_count.c"); }; status = -1 ; goto BYE; }; }
  if ( ( cfld == ((void *)0) ) || ( *cfld == '\0' ) ) { { { fprintf(stderr, "Line %3d of File %s \n", 45, "g_count.c"); }; status = -1 ; goto BYE; }; }
  if ( ( f2 == ((void *)0) ) || ( *f2 == '\0' ) ) { { { fprintf(stderr, "Line %3d of File %s \n", 46, "g_count.c"); }; status = -1 ; goto BYE; }; }
  if ( strcmp(f1, cfld) == 0 ) { { { fprintf(stderr, "Line %3d of File %s \n", 47, "g_count.c"); }; status = -1 ; goto BYE; }; }
  if ( strcmp(f1, f2) == 0 ) { { { fprintf(stderr, "Line %3d of File %s \n", 48, "g_count.c"); }; status = -1 ; goto BYE; }; }
  if ( strcmp(f2, cfld) == 0 ) { { { fprintf(stderr, "Line %3d of File %s \n", 49, "g_count.c"); }; status = -1 ; goto BYE; }; }
  status = g_is_fld(gpu_reg, n_gpu_reg, f1, &f1_id, &f1_rec); { if ( (status) < 0 ) { { { fprintf(stderr, "Line %3d of File %s \n", 51, "g_count.c"); }; status = (status) ; goto BYE; } } };
  if ( f1_id < 0 ) { { { fprintf(stderr, "Line %3d of File %s \n", 52, "g_count.c"); }; status = -1 ; goto BYE; }; }
  if ( is_fldtype_goodfor_gpu(f1_rec.fldtype) == 0 ) { { { fprintf(stderr, "Line %3d of File %s \n", 53, "g_count.c"); }; status = -1 ; goto BYE; }; }
  status = g_is_fld(gpu_reg, n_gpu_reg, cfld, &cfld_id, &cfld_rec); { if ( (status) < 0 ) { { { fprintf(stderr, "Line %3d of File %s \n", 55, "g_count.c"); }; status = (status) ; goto BYE; } } };
  if ( cfld_id < 0 ) { { { fprintf(stderr, "Line %3d of File %s \n", 56, "g_count.c"); }; status = -1 ; goto BYE; }; }
  if ( is_fldtype_goodfor_gpu(cfld_rec.fldtype) == 0 ) { { { fprintf(stderr, "Line %3d of File %s \n", 57, "g_count.c"); }; status = -1 ; goto BYE; }; }
  status = g_is_fld(gpu_reg, n_gpu_reg, f2, &f2_id, &f2_rec); { if ( (status) < 0 ) { { { fprintf(stderr, "Line %3d of File %s \n", 59, "g_count.c"); }; status = (status) ; goto BYE; } } };
  if ( f2_id < 0 ) { { { fprintf(stderr, "Line %3d of File %s \n", 60, "g_count.c"); }; status = -1 ; goto BYE; }; }
  if ( is_fldtype_goodfor_gpu(f2_rec.fldtype) == 0 ) { { { fprintf(stderr, "Line %3d of File %s \n", 61, "g_count.c"); }; status = -1 ; goto BYE; }; }
  status = g_chk_count(f1_rec, cfld_rec, f2_rec); { if ( (status) < 0 ) { { { fprintf(stderr, "Line %3d of File %s \n", 63, "g_count.c"); }; status = (status) ; goto BYE; } } };
  char url[2048]; zero_string(url, 2048);
  char command[1024]; zero_string(command, 1024);
  sprintf(command, "f1f2opf3 d_fld1=%s d_cfld=%s d_fld2=%s",
        f1, cfld, f2);
  status = g_make_url(command, url); { if ( (status) < 0 ) { { { fprintf(stderr, "Line %3d of File %s \n", 69, "g_count.c"); }; status = (status) ; goto BYE; } } };
  status = g_call_gpu(url, &curl_response); { if ( (status) < 0 ) { { { fprintf(stderr, "Line %3d of File %s \n", 70, "g_count.c"); }; status = (status) ; goto BYE; } } };
  if ( curl_response != ((void *)0) ) {
    if ( strstr(curl_response, "\"\"") == ((void *)0) ) {
      fprintf(stderr, "Response from GPU = [%s]\n", curl_response);
    }
  }
BYE:
  { if ( (curl_response) != ((void *)0) ) { free((curl_response)); (curl_response) = ((void *)0); } };
  g_unmap_meta_data(gpu_reg_X, gpu_reg_nX);
  return status ;
}

variable_types:
cfld
char *

variable_types: struct _GPU_REG_TYPE { void *reg; unsigned long filesz; _Bool is_busy; long long nR; enum _FLD_TYPE { undef_fldtype=0, B=1, I1=2, I2=3, I4=4, I8=5, F4=6, F8=7, SC=8, SV=9 } fldtype; char filename[-1]; char tbl[-1]; char h_fld[-1]; char d_fld[-1]; } *

variable_types:
url
char [2048]

variable_types:
command
char [1024]

user_defined_types: struct _GPU_REG_TYPE { void *reg; unsigned long filesz; _Bool is_busy; long long nR; enum _FLD_TYPE fldtype; char filename[-1]; char tbl[-1]; char h_fld[-1]; char d_fld[-1]; }


original_code:
void
div2_F8(
       double *in1,
       double *in2,
       long long nR,
       double * restrict out
       )
{
  double 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 div2_F8(double *in1, double *in2, long long nR, double *out)
{
  double inv1; double inv2; double 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
double *

variable_types: outv double


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
char *v11; // rcx
__int64 v12; // rax
__int64 v13; // rsi
__int64 v14; // rax
int v15; // ecx
__int64 result; // rax
char *endptr; // [rsp+0h] [rbp-50h] BYREF
char nptr[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);
v11 = v10;
if ( !v10 )
return 0LL;
v12 = v10 - v9;
if ( v12 > 31 )
{
fprintf(stderr, "Line %3d of File %s \n", 30LL, "./AUTOGEN/GENFILES/extract_UI8.c");
result = 0xFFFFFFFFLL;
}
else
{
v13 = v12;
v14 = 0LL;
if ( v9 == v11 )
{
v15 = 0;
}
else
{
do
{
nptr[v14] = v9[v14];
++v14;
}
while ( v14 != v13 );
v15 = (_DWORD)v11 - (_DWORD)v9;
}
nptr[v15] = 0;
result = 0LL;
if ( nptr[0] )
{
*a4 = strtoll(nptr, &endptr, 10);
if ( *endptr )
{
fprintf(stderr, "Line %3d of File %s \n", 41LL, "./AUTOGEN/GENFILES/extract_UI8.c");
result = 0xFFFFFFFFLL;
}
else
{
*a5 = 0;
result = 0LL;
}
}
}
return result;
}

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
char *v11; // rcx
__int64 v12; // rax
__int64 v13; // rsi
__int64 v14; // rax
int v15; // ecx
__int64 result; // rax
char *endptr; // [rsp+0h] [rbp-50h] BYREF
char nptr[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);
v11 = v10;
if ( !v10 )
return 0LL;
v12 = v10 - v9;
if ( v12 > 31 )
{
fprintf(stderr, "Line %3d of File %s \n", 30LL, "./AUTOGEN/GENFILES/extract_UI8.c");
result = 0xFFFFFFFFLL;
}
else
{
v13 = v12;
v14 = 0LL;
if ( v9 == v11 )
{
v15 = 0;
}
else
{
do
{
nptr[v14] = v9[v14];
++v14;
}
while ( v14 != v13 );
v15 = (_DWORD)v11 - (_DWORD)v9;
}
nptr[v15] = 0;
result = 0LL;
if ( nptr[0] )
{
*a4 = strtoll(nptr, &endptr, 10);
if ( *endptr )
{
fprintf(stderr, "Line %3d of File %s \n", 41LL, "./AUTOGEN/GENFILES/extract_UI8.c");
result = 0xFFFFFFFFLL;
}
else
{
*a5 = 0;
result = 0LL;
}
}
}
return result;
}

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: status int

variable_types:
buffer
char [32]

variable_types:
Y
char *

variable_types:
Z
char *

variable_types:
W
char *

variable_types:
endptr
char *


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

v2 = a1;
do
{
s[0] = 0;
s[1] = 0;
s[2] = 0;
s[3] = 0;
sprintf(s, "%02x", *v2);
result = strcat(a2, s);
++v2;
}
while ( a1 + 16 != v2 );
return result;
}

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

v2 = a1;
do
{
s[0] = 0;
s[1] = 0;
s[2] = 0;
s[3] = 0;
sprintf(s, "%02x", *v2);
result = strcat(a2, s);
++v2;
}
while ( a1 + 16 != v2 );
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]


decompiled_code:
char *__fastcall my_MDString(const char *a1, char *a2)
{
unsigned int v2; // er12
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; // er12
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


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)
{
__int64 result; // rax

if ( s1 && *s1 )
{
if ( !strcasecmp(s1, "asc") || !strcasecmp(s1, "dsc") )
{
if ( 4 * g_num_cores <= 1 )
{
fprintf(stderr, "Line %3d of File %s \n", 28LL, "par_sort_with_bins.c");
result = 0xFFFFFFFFLL;
}
else if ( a6 == 4 )
{
result = par_sort_with_bins_I4(a1, a2, a3, a4, a5, s1, (unsigned int)(4 * g_num_cores), a8, a9);
}
else if ( a6 == 5 )
{
result = par_sort_with_bins_I8(a1, a2, a3, a4, a5, s1, (unsigned int)(4 * g_num_cores), a8, a9);
}
else
{
fprintf(stderr, "Line %3d of File %s \n", 39LL, "par_sort_with_bins.c");
result = 0xFFFFFFFFLL;
}
}
else
{
fprintf(stderr, "Line %3d of File %s \n", 25LL, "par_sort_with_bins.c");
result = 0xFFFFFFFFLL;
}
}
else
{
fprintf(stderr, "Line %3d of File %s \n", 22LL, "par_sort_with_bins.c");
result = 0xFFFFFFFFLL;
}
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)
{
__int64 result; // rax

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

variable_types: nT int


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

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

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

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

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)
{
_BYTE *v6; // r12
_BYTE *v7; // rbp
__int64 v8; // rax
__int64 v9; // r13
__int64 v10; // rax
__int64 v11; // rax
char *v12; // rcx
char v13; // si
__int64 v14; // rdx
__int64 v15; // rax
int v16; // esi
unsigned int v17; // ebx
char v18; // dl
unsigned int v20; // [rsp+0h] [rbp-68h]
unsigned int v21; // [rsp+4h] [rbp-64h]
unsigned int size; // [rsp+8h] [rbp-60h]

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

canonical_decompiled_code:
__int64 __fastcall func0(char *a1, int a2, _QWORD *a3, unsigned int *a4, unsigned int *a5, unsigned int *a6)
{
_BYTE *v6; // r12
_BYTE *v7; // rbp
__int64 v8; // rax
__int64 v9; // r13
__int64 v10; // rax
__int64 v11; // rax
char *v12; // rcx
char v13; // si
__int64 v14; // rdx
__int64 v15; // rax
int v16; // esi
unsigned int v17; // ebx
char v18; // dl
unsigned int v20; // [rsp+0h] [rbp-68h]
unsigned int v21; // [rsp+4h] [rbp-64h]
unsigned int size; // [rsp+8h] [rbp-60h]

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

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:
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: status int

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; }


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:
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