decompiled_code:
__int64 __fastcall count_I1(char *a1, __int64 a2, __int64 a3, int a4)
{
char *v5; // rsi
__int64 v6; // rcx

if ( a2 <= 0 )
return 0LL;
v5 = &a1[a2];
while ( 1 )
{
v6 = *a1;
if ( (int)v6 >= a4 || (v6 & 0x80u) != 0LL )
break;
++a1;
++*(_QWORD *)(a3 + 8 * v6);
if ( v5 == a1 )
return 0LL;
}
fprintf(stderr, "Line %3d of File %s \n", 30LL, "./AUX/count_I1.c");
return 0xFFFFFFFFLL;
}

canonical_decompiled_code:
__int64 __fastcall func0(char *a1, __int64 a2, __int64 a3, int a4)
{
char *v5; // rsi
__int64 v6; // rcx

if ( a2 <= 0 )
return 0LL;
v5 = &a1[a2];
while ( 1 )
{
v6 = *a1;
if ( (int)v6 >= a4 || (v6 & 0x80u) != 0LL )
break;
++a1;
++*(_QWORD *)(a3 + 8 * v6);
if ( v5 == a1 )
return 0LL;
}
fprintf(stderr, "Line %3d of File %s \n", 30LL, "./AUX/count_I1.c");
return 0xFFFFFFFFLL;
}

original_code:
int
count_I1(
  char *in,
  long long n,
  long long * restrict cnt,
  int n_out
  )
{
  int status = 0;
  for ( long long i = 0; i < n; i++ ) {
    char idx = in[i];
    int idxI4 = (int)idx;
    if ( ( idx < 0 ) || ( idx >= n_out ) ) { { { fprintf(stderr, "Line %3d of File %s \n", 30, "./AUX/count_I1.c"); }; status = -1 ; goto BYE; }; }
    cnt[idxI4]++;
  }
 BYE:
  return(status);
}

canonical_original_code:
int count_I1(char *in, long long n, long long *cnt, int n_out)
{
  int status = 0;
  for ( long long i = 0; i < n; i++ ) {
    char idx = in[i];
    int idxI4 = (int)idx;
    if ( ( idx < 0 ) || ( idx >= n_out ) ) { { { fprintf(stderr, "Line %3d of File %s \n", 30, "./AUX/count_I1.c"); }; status = -1 ; goto BYE; }; }
    cnt[idxI4]++;
  }
 BYE:
  return(status);
}

variable_types:
in
char *

variable_types: idx char


repo: linkedin/datacl

original_code:
int
sorted_array_to_id_freq (
     int * buf,
     long long num_buf,
     int * bf_id,
     int * bf_freq,
     long long * ptr_bf_siz
     )
{
  int status = 0;
  if ( buf == ((void *)0) ) { { { fprintf(stderr, "Line %3d of File %s \n", 46, "sorted_array_to_id_freq.c"); }; status = -1 ; goto BYE; }; }
  if ( bf_id == ((void *)0) ) { { { fprintf(stderr, "Line %3d of File %s \n", 47, "sorted_array_to_id_freq.c"); }; status = -1 ; goto BYE; }; }
  if ( bf_freq == ((void *)0) ) { { { fprintf(stderr, "Line %3d of File %s \n", 48, "sorted_array_to_id_freq.c"); }; status = -1 ; goto BYE; }; }
  if ( ptr_bf_siz == ((void *)0) ) { { { fprintf(stderr, "Line %3d of File %s \n", 49, "sorted_array_to_id_freq.c"); }; status = -1 ; goto BYE; }; }
  long long ii = 0, jj = 0;
  int temp_freq = 1;
  while ( ii < num_buf-1 ) {
    if ( buf[ii] == buf[ii+1] ) {
      temp_freq++;
    }
    else {
      bf_id[jj] = buf[ii];
      bf_freq[jj++] = temp_freq;
      temp_freq = 1;
    }
    ii++;
  }
  bf_id[jj] = buf[ii];
  bf_freq[jj] = temp_freq;
  jj++;
  *ptr_bf_siz = jj;
 BYE:
  return(status);
}

canonical_original_code:
int sorted_array_to_id_freq(int *buf, long long num_buf, int *bf_id, int *bf_freq, long long *ptr_bf_siz)
{
  int status = 0;
  if ( buf == ((void *)0) ) { { { fprintf(stderr, "Line %3d of File %s \n", 46, "sorted_array_to_id_freq.c"); }; status = -1 ; goto BYE; }; }
  if ( bf_id == ((void *)0) ) { { { fprintf(stderr, "Line %3d of File %s \n", 47, "sorted_array_to_id_freq.c"); }; status = -1 ; goto BYE; }; }
  if ( bf_freq == ((void *)0) ) { { { fprintf(stderr, "Line %3d of File %s \n", 48, "sorted_array_to_id_freq.c"); }; status = -1 ; goto BYE; }; }
  if ( ptr_bf_siz == ((void *)0) ) { { { fprintf(stderr, "Line %3d of File %s \n", 49, "sorted_array_to_id_freq.c"); }; status = -1 ; goto BYE; }; }
  long long ii = 0; long long jj = 0;
  int temp_freq = 1;
  while ( ii < num_buf-1 ) {
    if ( buf[ii] == buf[ii+1] ) {
      temp_freq++;
    }
    else {
      bf_id[jj] = buf[ii];
      bf_freq[jj++] = temp_freq;
      temp_freq = 1;
    }
    ii++;
  }
  bf_id[jj] = buf[ii];
  bf_freq[jj] = temp_freq;
  jj++;
  *ptr_bf_siz = jj;
 BYE:
  return(status);
}

variable_types:
buf
int *

variable_types: status int

variable_types:
ii
long long

variable_types:
jj
long long

return_type: int


decompiled_code:
__int64 __fastcall find_smallest_geq_I8(__int64 a1, __int64 a2, __int64 a3, __int64 *a4)
{
__int64 v4; // rsi
__int64 v7; // rdi
__int64 i; // rdx
__int64 v10; // rdx

if ( a1 )
{
if ( a2 > 1 )
{
v4 = a2 - 1;
v7 = 0LL;
for ( i = v4 / 2; ; i = (v7 + v4) / 2 )
{
if ( *(_QWORD *)(a1 + 8 * i) <= a3 )
{
if ( *(_QWORD *)(a1 + 8 * i) >= a3 )
{
*a4 = i;
return 0LL;
}
v7 = i;
}
else
{
v4 = i;
}
if ( (v7 + v4) / 2 == i )
{
*a4 = v7;
return 0LL;
}
}
}
v10 = 19LL;
}
else
{
v10 = 18LL;
}
fprintf(stderr, "Line %3d of File %s \n", v10, "./AUTOGEN/GENFILES/find_smallest_geq_I8.c");
return 0xFFFFFFFFLL;
}

original_code:
int
find_smallest_geq_I8(
    long long *X,
    long long n,
    long long val,
    long long *ptr_idx
    )
{
  int status = 0;
  long long mid, prev_mid = (-0x7fffffffffffffffLL - 1LL);
  long long bot = 0;
  long long top = n-1;
  if ( X == ((void *)0) ) { { { fprintf(stderr, "Line %3d of File %s \n", 18, "./AUTOGEN/GENFILES/find_smallest_geq_I8.c"); }; status = -1 ; goto BYE; }; }
  if ( n <= 1 ) { { { fprintf(stderr, "Line %3d of File %s \n", 19, "./AUTOGEN/GENFILES/find_smallest_geq_I8.c"); }; status = -1 ; goto BYE; }; }
  for ( ; ; ) {
    mid = ( bot + top ) / 2;
    if ( mid == prev_mid ) { *ptr_idx = bot; break; }
    if ( X[mid] > val ) {
      top = mid;
    }
    else if ( X[mid] < val ) {
      bot = mid;
    }
    else {
      *ptr_idx = mid; break;
    }
    prev_mid = mid;
  }
BYE:
  return(status);
}

canonical_original_code:
int find_smallest_geq_I8(long long *X, long long n, long long val, long long *ptr_idx)
{
  int status = 0;
  long long mid; long long prev_mid = (-0x7fffffffffffffffLL - 1LL);
  long long bot = 0;
  long long top = n-1;
  if ( X == ((void *)0) ) { { { fprintf(stderr, "Line %3d of File %s \n", 18, "./AUTOGEN/GENFILES/find_smallest_geq_I8.c"); }; status = -1 ; goto BYE; }; }
  if ( n <= 1 ) { { { fprintf(stderr, "Line %3d of File %s \n", 19, "./AUTOGEN/GENFILES/find_smallest_geq_I8.c"); }; status = -1 ; goto BYE; }; }
  for ( ; ; ) {
    mid = ( bot + top ) / 2;
    if ( mid == prev_mid ) { *ptr_idx = bot; break; }
    if ( X[mid] > val ) {
      top = mid;
    }
    else if ( X[mid] < val ) {
      bot = mid;
    }
    else {
      *ptr_idx = mid; break;
    }
    prev_mid = mid;
  }
BYE:
  return(status);
}

variable_types:
X
long long *

variable_types:
n
long long

variable_types:
val
long long

variable_types:
mid
long long

variable_types:
bot
long long

variable_types:
top
long long


decompiled_code:
__int64 __fastcall g_f1f2_to_s(const char *a1, const char *a2, const char *a3, char *a4, int a5)
{
int v6; // er15
char *v7; // rbp
__int64 v9; // rdx
_BYTE v10[712]; // [rsp-590h] [rbp-17A8h] BYREF
_BYTE v11[712]; // [rsp-2C8h] [rbp-14E0h] BYREF
char *dest; // [rsp+0h] [rbp-1218h]
int v13; // [rsp+Ch] [rbp-120Ch]
int v14; // [rsp+14h] [rbp-1204h] BYREF
int v15; // [rsp+18h] [rbp-1200h] BYREF
unsigned int v16; // [rsp+1Ch] [rbp-11FCh] BYREF
char *src; // [rsp+20h] [rbp-11F8h] BYREF
__int64 v18; // [rsp+28h] [rbp-11F0h] BYREF
__int64 v19; // [rsp+30h] [rbp-11E8h] BYREF
__int64 v20; // [rsp+38h] [rbp-11E0h] BYREF
__int64 v21[90]; // [rsp+40h] [rbp-11D8h] BYREF
__int64 v22[90]; // [rsp+310h] [rbp-F08h] BYREF
char s[1024]; // [rsp+5E0h] [rbp-C38h] BYREF
char v24[2104]; // [rsp+9E0h] [rbp-838h] BYREF

dest = a4;
v13 = a5;
v14 = -1;
v15 = -1;
src = 0LL;
v18 = 0LL;
v19 = 0LL;
v20 = 0LL;
v16 = 0;
g_mmap_meta_data(&g_docroot, &v18, &v19, &v20, &v16);
if ( !a3 || !*a3 )
{
v9 = 43LL;
goto LABEL_29;
}
if ( !a1 || !*a1 )
{
v9 = 45LL;
LABEL_29:
v6 = -1;
fprintf(stderr, "Line %3d of File %s \n", v9, "g_f1f2_to_s.c");
goto LABEL_21;
}
v6 = g_is_fld(v20, v16, a1, &v14, v21);
if ( v6 < 0 )
{
fprintf(stderr, "Line %3d of File %s \n", 47LL, "g_f1f2_to_s.c");
goto LABEL_21;
}
if ( v14 < 0 )
{
v9 = 48LL;
goto LABEL_29;
}
if ( !(unsigned int)is_fldtype_goodfor_gpu(LODWORD(v21[4])) )
{
v6 = -1;
fprintf(stderr, "Line %3d of File %s \n", 49LL, "g_f1f2_to_s.c");
goto LABEL_21;
}
v6 = g_is_fld(v20, v16, a2, &v15, v22);
if ( v6 < 0 )
{
fprintf(stderr, "Line %3d of File %s \n", 51LL, "g_f1f2_to_s.c");
goto LABEL_21;
}
if ( v15 < 0 )
{
v9 = 52LL;
goto LABEL_29;
}
if ( !(unsigned int)is_fldtype_goodfor_gpu(LODWORD(v22[4])) )
{
v6 = -1;
fprintf(stderr, "Line %3d of File %s \n", 53LL, "g_f1f2_to_s.c");
LABEL_21:
v7 = src;
if ( src )
goto LABEL_22;
goto LABEL_23;
}
if ( !v21[1] )
{
v9 = 55LL;
goto LABEL_29;
}
if ( !v21[3] )
{
v9 = 56LL;
goto LABEL_29;
}
if ( !v22[1] )
{
v9 = 57LL;
goto LABEL_29;
}
if ( !v22[3] )
{
v9 = 58LL;
goto LABEL_29;
}
qmemcpy(v11, v22, sizeof(v11));
qmemcpy(v10, v21, sizeof(v10));
v6 = g_chk_f1f2_to_s(a3);
if ( v6 < 0 )
{
fprintf(stderr, "Line %3d of File %s \n", 59LL, "g_f1f2_to_s.c");
goto LABEL_21;
}
zero_string(v24, 2048LL);
zero_string(s, 1024LL);
sprintf(s, "f1f2_to_s d_fld1=%s d_fld2=%s op=%s ", a1, a2, a3);
v6 = g_make_url(s, v24);
if ( v6 < 0 )
{
fprintf(stderr, "Line %3d of File %s \n", 64LL, "g_f1f2_to_s.c");
goto LABEL_21;
}
v6 = g_call_gpu(v24, &src);
if ( v6 < 0 )
{
fprintf(stderr, "Line %3d of File %s \n", 65LL, "g_f1f2_to_s.c");
goto LABEL_21;
}
v7 = src;
if ( src )
{
strncpy(dest, src, v13);
LABEL_22:
free(v7);
src = 0LL;
}
LABEL_23:
g_unmap_meta_data(v18, v19);
return (unsigned int)v6;
}

canonical_decompiled_code:
__int64 __fastcall func0(const char *a1, const char *a2, const char *a3, char *a4, int a5)
{
int v6; // er15
char *v7; // rbp
__int64 v9; // rdx
_BYTE v10[712]; // [rsp-590h] [rbp-17A8h] BYREF
_BYTE v11[712]; // [rsp-2C8h] [rbp-14E0h] BYREF
char *dest; // [rsp+0h] [rbp-1218h]
int v13; // [rsp+Ch] [rbp-120Ch]
int v14; // [rsp+14h] [rbp-1204h] BYREF
int v15; // [rsp+18h] [rbp-1200h] BYREF
unsigned int v16; // [rsp+1Ch] [rbp-11FCh] BYREF
char *src; // [rsp+20h] [rbp-11F8h] BYREF
__int64 v18; // [rsp+28h] [rbp-11F0h] BYREF
__int64 v19; // [rsp+30h] [rbp-11E8h] BYREF
__int64 v20; // [rsp+38h] [rbp-11E0h] BYREF
__int64 v21[90]; // [rsp+40h] [rbp-11D8h] BYREF
__int64 v22[90]; // [rsp+310h] [rbp-F08h] BYREF
char s[1024]; // [rsp+5E0h] [rbp-C38h] BYREF
char v24[2104]; // [rsp+9E0h] [rbp-838h] BYREF

dest = a4;
v13 = a5;
v14 = -1;
v15 = -1;
src = 0LL;
v18 = 0LL;
v19 = 0LL;
v20 = 0LL;
v16 = 0;
g_mmap_meta_data(&g_docroot, &v18, &v19, &v20, &v16);
if ( !a3 || !*a3 )
{
v9 = 43LL;
goto LABEL_29;
}
if ( !a1 || !*a1 )
{
v9 = 45LL;
LABEL_29:
v6 = -1;
fprintf(stderr, "Line %3d of File %s \n", v9, "g_f1f2_to_s.c");
goto LABEL_21;
}
v6 = g_is_fld(v20, v16, a1, &v14, v21);
if ( v6 < 0 )
{
fprintf(stderr, "Line %3d of File %s \n", 47LL, "g_f1f2_to_s.c");
goto LABEL_21;
}
if ( v14 < 0 )
{
v9 = 48LL;
goto LABEL_29;
}
if ( !(unsigned int)is_fldtype_goodfor_gpu(LODWORD(v21[4])) )
{
v6 = -1;
fprintf(stderr, "Line %3d of File %s \n", 49LL, "g_f1f2_to_s.c");
goto LABEL_21;
}
v6 = g_is_fld(v20, v16, a2, &v15, v22);
if ( v6 < 0 )
{
fprintf(stderr, "Line %3d of File %s \n", 51LL, "g_f1f2_to_s.c");
goto LABEL_21;
}
if ( v15 < 0 )
{
v9 = 52LL;
goto LABEL_29;
}
if ( !(unsigned int)is_fldtype_goodfor_gpu(LODWORD(v22[4])) )
{
v6 = -1;
fprintf(stderr, "Line %3d of File %s \n", 53LL, "g_f1f2_to_s.c");
LABEL_21:
v7 = src;
if ( src )
goto LABEL_22;
goto LABEL_23;
}
if ( !v21[1] )
{
v9 = 55LL;
goto LABEL_29;
}
if ( !v21[3] )
{
v9 = 56LL;
goto LABEL_29;
}
if ( !v22[1] )
{
v9 = 57LL;
goto LABEL_29;
}
if ( !v22[3] )
{
v9 = 58LL;
goto LABEL_29;
}
qmemcpy(v11, v22, sizeof(v11));
qmemcpy(v10, v21, sizeof(v10));
v6 = g_chk_f1f2_to_s(a3);
if ( v6 < 0 )
{
fprintf(stderr, "Line %3d of File %s \n", 59LL, "g_f1f2_to_s.c");
goto LABEL_21;
}
zero_string(v24, 2048LL);
zero_string(s, 1024LL);
sprintf(s, "f1f2_to_s d_fld1=%s d_fld2=%s op=%s ", a1, a2, a3);
v6 = g_make_url(s, v24);
if ( v6 < 0 )
{
fprintf(stderr, "Line %3d of File %s \n", 64LL, "g_f1f2_to_s.c");
goto LABEL_21;
}
v6 = g_call_gpu(v24, &src);
if ( v6 < 0 )
{
fprintf(stderr, "Line %3d of File %s \n", 65LL, "g_f1f2_to_s.c");
goto LABEL_21;
}
v7 = src;
if ( src )
{
strncpy(dest, src, v13);
LABEL_22:
free(v7);
src = 0LL;
}
LABEL_23:
g_unmap_meta_data(v18, v19);
return (unsigned int)v6;
}

original_code:
int
g_f1f2_to_s(
    char *f1,
    char *f2,
    char *str_op,
    char *rslt_buf,
    int sz_rslt_buf
    )
{
  int status = 0;
  int f1_id = -1; GPU_REG_TYPE f1_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 ( ( str_op == ((void *)0) ) || ( *str_op == '\0' ) ) { { { fprintf(stderr, "Line %3d of File %s \n", 43, "g_f1f2_to_s.c"); }; status = -1 ; goto BYE; }; }
  if ( ( str_op == ((void *)0) ) || ( *str_op == '\0' ) ) { { { fprintf(stderr, "Line %3d of File %s \n", 44, "g_f1f2_to_s.c"); }; status = -1 ; goto BYE; }; }
  if ( ( f1 == ((void *)0) ) || ( *f1 == '\0' ) ) { { { fprintf(stderr, "Line %3d of File %s \n", 45, "g_f1f2_to_s.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", 47, "g_f1f2_to_s.c"); }; status = (status) ; goto BYE; } } };
  if ( f1_id < 0 ) { { { fprintf(stderr, "Line %3d of File %s \n", 48, "g_f1f2_to_s.c"); }; status = -1 ; goto BYE; }; }
  if ( is_fldtype_goodfor_gpu(f1_rec.fldtype) == 0 ) { { { fprintf(stderr, "Line %3d of File %s \n", 49, "g_f1f2_to_s.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", 51, "g_f1f2_to_s.c"); }; status = (status) ; goto BYE; } } };
  if ( f2_id < 0 ) { { { fprintf(stderr, "Line %3d of File %s \n", 52, "g_f1f2_to_s.c"); }; status = -1 ; goto BYE; }; }
  if ( is_fldtype_goodfor_gpu(f2_rec.fldtype) == 0 ) { { { fprintf(stderr, "Line %3d of File %s \n", 53, "g_f1f2_to_s.c"); }; status = -1 ; goto BYE; }; }
  if ( f1_rec.filesz == 0 ) { { { fprintf(stderr, "Line %3d of File %s \n", 55, "g_f1f2_to_s.c"); }; status = -1 ; goto BYE; }; }
  if ( f1_rec.nR == 0 ) { { { fprintf(stderr, "Line %3d of File %s \n", 56, "g_f1f2_to_s.c"); }; status = -1 ; goto BYE; }; }
  if ( f2_rec.filesz == 0 ) { { { fprintf(stderr, "Line %3d of File %s \n", 57, "g_f1f2_to_s.c"); }; status = -1 ; goto BYE; }; }
  if ( f2_rec.nR == 0 ) { { { fprintf(stderr, "Line %3d of File %s \n", 58, "g_f1f2_to_s.c"); }; status = -1 ; goto BYE; }; }
  status = g_chk_f1f2_to_s(f1_rec, f2_rec, str_op); { if ( (status) < 0 ) { { { fprintf(stderr, "Line %3d of File %s \n", 59, "g_f1f2_to_s.c"); }; status = (status) ; goto BYE; } } };
  char url[2048]; zero_string(url, 2048);
  char command[1024]; zero_string(command, 1024);
  sprintf(command, "f1f2_to_s d_fld1=%s d_fld2=%s op=%s ", f1, f2, str_op);
  status = g_make_url(command, url); { if ( (status) < 0 ) { { { fprintf(stderr, "Line %3d of File %s \n", 64, "g_f1f2_to_s.c"); }; status = (status) ; goto BYE; } } };
  status = g_call_gpu(url, &curl_response); { if ( (status) < 0 ) { { { fprintf(stderr, "Line %3d of File %s \n", 65, "g_f1f2_to_s.c"); }; status = (status) ; goto BYE; } } };
  if ( curl_response != ((void *)0) ) {
    strncpy(rslt_buf, curl_response, sz_rslt_buf);
  }
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_f1f2_to_s(char *f1, char *f2, char *str_op, char *rslt_buf, int sz_rslt_buf)
{
  int status = 0;
  int f1_id = -1; struct _GPU_REG_TYPE f1_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 ( ( str_op == ((void *)0) ) || ( *str_op == '\0' ) ) { { { fprintf(stderr, "Line %3d of File %s \n", 43, "g_f1f2_to_s.c"); }; status = -1 ; goto BYE; }; }
  if ( ( str_op == ((void *)0) ) || ( *str_op == '\0' ) ) { { { fprintf(stderr, "Line %3d of File %s \n", 44, "g_f1f2_to_s.c"); }; status = -1 ; goto BYE; }; }
  if ( ( f1 == ((void *)0) ) || ( *f1 == '\0' ) ) { { { fprintf(stderr, "Line %3d of File %s \n", 45, "g_f1f2_to_s.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", 47, "g_f1f2_to_s.c"); }; status = (status) ; goto BYE; } } };
  if ( f1_id < 0 ) { { { fprintf(stderr, "Line %3d of File %s \n", 48, "g_f1f2_to_s.c"); }; status = -1 ; goto BYE; }; }
  if ( is_fldtype_goodfor_gpu(f1_rec.fldtype) == 0 ) { { { fprintf(stderr, "Line %3d of File %s \n", 49, "g_f1f2_to_s.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", 51, "g_f1f2_to_s.c"); }; status = (status) ; goto BYE; } } };
  if ( f2_id < 0 ) { { { fprintf(stderr, "Line %3d of File %s \n", 52, "g_f1f2_to_s.c"); }; status = -1 ; goto BYE; }; }
  if ( is_fldtype_goodfor_gpu(f2_rec.fldtype) == 0 ) { { { fprintf(stderr, "Line %3d of File %s \n", 53, "g_f1f2_to_s.c"); }; status = -1 ; goto BYE; }; }
  if ( f1_rec.filesz == 0 ) { { { fprintf(stderr, "Line %3d of File %s \n", 55, "g_f1f2_to_s.c"); }; status = -1 ; goto BYE; }; }
  if ( f1_rec.nR == 0 ) { { { fprintf(stderr, "Line %3d of File %s \n", 56, "g_f1f2_to_s.c"); }; status = -1 ; goto BYE; }; }
  if ( f2_rec.filesz == 0 ) { { { fprintf(stderr, "Line %3d of File %s \n", 57, "g_f1f2_to_s.c"); }; status = -1 ; goto BYE; }; }
  if ( f2_rec.nR == 0 ) { { { fprintf(stderr, "Line %3d of File %s \n", 58, "g_f1f2_to_s.c"); }; status = -1 ; goto BYE; }; }
  status = g_chk_f1f2_to_s(f1_rec, f2_rec, str_op); { if ( (status) < 0 ) { { { fprintf(stderr, "Line %3d of File %s \n", 59, "g_f1f2_to_s.c"); }; status = (status) ; goto BYE; } } };
  char url[2048]; zero_string(url, 2048);
  char command[1024]; zero_string(command, 1024);
  sprintf(command, "f1f2_to_s d_fld1=%s d_fld2=%s op=%s ", f1, f2, str_op);
  status = g_make_url(command, url); { if ( (status) < 0 ) { { { fprintf(stderr, "Line %3d of File %s \n", 64, "g_f1f2_to_s.c"); }; status = (status) ; goto BYE; } } };
  status = g_call_gpu(url, &curl_response); { if ( (status) < 0 ) { { { fprintf(stderr, "Line %3d of File %s \n", 65, "g_f1f2_to_s.c"); }; status = (status) ; goto BYE; } } };
  if ( curl_response != ((void *)0) ) {
    strncpy(rslt_buf, curl_response, sz_rslt_buf);
  }
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: 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:
int
conv_I1_to_B(
    char *X,
    long long nX,
    char * restrict Y
    )
{
  int status = 0;
  long long n;
  unsigned int uix, uiy;
  n = ( nX / 8 ) * 8 ;
  long long xindex = 0;
  long long yindex = 0;
  for ( xindex = 0; xindex < n; ) {
    uiy = 0;
    for ( int j = 0; j < 8; j++ ) {
      uix = X[xindex++];
      if ( ( uix != 0 ) && ( uix != 1 ) ) {
 { fprintf(stderr, "Line %3d of File %s \n", 39, "./AUX/conv_I1_to_B.c"); }; status = -1; continue;
      }
      uix = uix << j;
      uiy = uiy | uix;
    }
    Y[yindex++] = uiy;
  }
  int leftover = nX - n;
  for ( ; xindex < nX; ) {
    uiy = 0;
    for ( int j = 0; j < leftover; j++ ) {
      uix = X[xindex++];
      uix = uix << j;
      uiy = uiy | uix;
    }
    Y[yindex++] = uiy;
  }
  if ( xindex != nX ) { { { fprintf(stderr, "Line %3d of File %s \n", 58, "./AUX/conv_I1_to_B.c"); }; status = -1 ; goto BYE; }; }
  long long chk_yindex;
  chk_yindex = nX / 8;
  if ( ( ( nX / 8 ) * 8 ) != nX ) {
    chk_yindex++;
  }
  if ( yindex != chk_yindex ) { { { fprintf(stderr, "Line %3d of File %s \n", 64, "./AUX/conv_I1_to_B.c"); }; status = -1 ; goto BYE; }; }
BYE:
  return(status);
}

canonical_original_code:
int conv_I1_to_B(char *X, long long nX, char *Y)
{
  int status = 0;
  long long n;
  unsigned int uix; unsigned int uiy;
  n = ( nX / 8 ) * 8 ;
  long long xindex = 0;
  long long yindex = 0;
  for ( xindex = 0; xindex < n; ) {
    uiy = 0;
    for ( int j = 0; j < 8; j++ ) {
      uix = X[xindex++];
      if ( ( uix != 0 ) && ( uix != 1 ) ) {
 { fprintf(stderr, "Line %3d of File %s \n", 39, "./AUX/conv_I1_to_B.c"); }; status = -1; continue;
      }
      uix = uix << j;
      uiy = uiy | uix;
    }
    Y[yindex++] = uiy;
  }
  int leftover = nX - n;
  for ( ; xindex < nX; ) {
    uiy = 0;
    for ( int j = 0; j < leftover; j++ ) {
      uix = X[xindex++];
      uix = uix << j;
      uiy = uiy | uix;
    }
    Y[yindex++] = uiy;
  }
  if ( xindex != nX ) { { { fprintf(stderr, "Line %3d of File %s \n", 58, "./AUX/conv_I1_to_B.c"); }; status = -1 ; goto BYE; }; }
  long long chk_yindex;
  chk_yindex = nX / 8;
  if ( ( ( nX / 8 ) * 8 ) != nX ) {
    chk_yindex++;
  }
  if ( yindex != chk_yindex ) { { { fprintf(stderr, "Line %3d of File %s \n", 64, "./AUX/conv_I1_to_B.c"); }; status = -1 ; goto BYE; }; }
BYE:
  return(status);
}

variable_types:
X
char *

variable_types:
nX
long long

variable_types:
Y
char *

variable_types:
uix
unsigned int

variable_types:
uiy
unsigned int

variable_types:
xindex
long long

variable_types:
yindex
long long

variable_types: j int

variable_types: leftover int


decompiled_code:
__int64 __fastcall g_add_fld(const char *a1, const char *a2, const char *a3)
{
int v4; // er12
__int64 v5; // r14
__int64 v6; // r12
const char *v7; // rdx
char *v8; // r12
__int64 v9; // rdx
__int64 v11; // [rsp-10h] [rbp-F78h]
int v12; // [rsp+Ch] [rbp-F5Ch] BYREF
int v13; // [rsp+10h] [rbp-F58h] BYREF
int v14; // [rsp+14h] [rbp-F54h] BYREF
unsigned int v15; // [rsp+18h] [rbp-F50h] BYREF
unsigned int v16; // [rsp+1Ch] [rbp-F4Ch] BYREF
char *haystack; // [rsp+20h] [rbp-F48h] BYREF
__int64 v18; // [rsp+28h] [rbp-F40h] BYREF
__int64 v19; // [rsp+30h] [rbp-F38h] BYREF
__int64 v20; // [rsp+38h] [rbp-F30h] BYREF
__int64 v21[6]; // [rsp+40h] [rbp-F28h] BYREF
char v22[720]; // [rsp+70h] [rbp-EF8h] BYREF
char s[1024]; // [rsp+340h] [rbp-C28h] BYREF
char v24[2088]; // [rsp+740h] [rbp-828h] BYREF

v12 = -1;
v13 = -1;
haystack = 0LL;
v14 = 0;
v18 = 0LL;
v19 = 0LL;
v20 = 0LL;
v15 = 0;
if ( !a1 || !*a1 )
{
v9 = 42LL;
goto LABEL_20;
}
if ( !a2 || !*a2 )
{
v9 = 43LL;
goto LABEL_20;
}
if ( !a3 || !*a3 )
{
v9 = 44LL;
LABEL_20:
v4 = -1;
fprintf(stderr, "Line %3d of File %s \n", v9, "g_add_fld.c");
goto LABEL_22;
}
v4 = chk_fld_name(a2);
if ( v4 < 0 )
{
fprintf(stderr, "Line %3d of File %s \n", 45LL, "g_add_fld.c");
}
else
{
v4 = unstr_fldtype(a3, &v16);
if ( v4 < 0 )
{
fprintf(stderr, "Line %3d of File %s \n", 47LL, "g_add_fld.c");
}
else if ( (unsigned int)is_fldtype_goodfor_gpu(v16) )
{
v4 = is_tbl(a1, &v12, v21);
if ( v4 < 0 )
{
fprintf(stderr, "Line %3d of File %s \n", 49LL, "g_add_fld.c");
}
else
{
v5 = v21[0];
v4 = get_fld_sz(v16, &v14);
if ( v4 < 0 )
{
fprintf(stderr, "Line %3d of File %s \n", 51LL, "g_add_fld.c");
}
else
{
v6 = v14;
zero_string(v24, (const char *)2048);
zero_string(v24, "ile %s \n", v7);
sprintf(
s,
"add_fld filesz=%lld nR=%lld fldtype=%s tbl=%s d_fld=%s h_fld=undefined filename=undefined",
v5 * v6,
v5,
a3,
a1,
a2);
v4 = g_make_url(s, v24);
if ( v4 < 0 )
{
fprintf(stderr, "Line %3d of File %s \n", 60LL, "g_add_fld.c");
}
else
{
v4 = g_call_gpu(v24, &haystack, v11);
if ( v4 < 0 )
{
fprintf(stderr, "Line %3d of File %s \n", 61LL, "g_add_fld.c");
}
else
{
v8 = haystack;
if ( haystack && !strstr(haystack, "\"\"") )
fprintf(stderr, "Response from GPU = [%s]\n", v8);
g_mmap_meta_data(&g_docroot, &v18, &v19, &v20, &v15);
v4 = g_is_fld(v20, v15, a2, &v13, v22);
if ( v4 >= 0 )
{
if ( v13 >= 0 )
goto LABEL_22;
v9 = 72LL;
goto LABEL_20;
}
fprintf(stderr, "Line %3d of File %s \n", 71LL, "g_add_fld.c");
}
}
}
}
}
else
{
v4 = -1;
fprintf(stderr, "Line %3d of File %s \n", 48LL, "g_add_fld.c");
}
}
LABEL_22:
if ( haystack )
{
free(haystack);
haystack = 0LL;
}
g_unmap_meta_data(v18, v19);
return (unsigned int)v4;
}

canonical_decompiled_code:
__int64 __fastcall func0(const char *a1, const char *a2, const char *a3)
{
int v4; // er12
__int64 v5; // r14
__int64 v6; // r12
const char *v7; // rdx
char *v8; // r12
__int64 v9; // rdx
__int64 v11; // [rsp-10h] [rbp-F78h]
int v12; // [rsp+Ch] [rbp-F5Ch] BYREF
int v13; // [rsp+10h] [rbp-F58h] BYREF
int v14; // [rsp+14h] [rbp-F54h] BYREF
unsigned int v15; // [rsp+18h] [rbp-F50h] BYREF
unsigned int v16; // [rsp+1Ch] [rbp-F4Ch] BYREF
char *haystack; // [rsp+20h] [rbp-F48h] BYREF
__int64 v18; // [rsp+28h] [rbp-F40h] BYREF
__int64 v19; // [rsp+30h] [rbp-F38h] BYREF
__int64 v20; // [rsp+38h] [rbp-F30h] BYREF
__int64 v21[6]; // [rsp+40h] [rbp-F28h] BYREF
char v22[720]; // [rsp+70h] [rbp-EF8h] BYREF
char s[1024]; // [rsp+340h] [rbp-C28h] BYREF
char v24[2088]; // [rsp+740h] [rbp-828h] BYREF

v12 = -1;
v13 = -1;
haystack = 0LL;
v14 = 0;
v18 = 0LL;
v19 = 0LL;
v20 = 0LL;
v15 = 0;
if ( !a1 || !*a1 )
{
v9 = 42LL;
goto LABEL_20;
}
if ( !a2 || !*a2 )
{
v9 = 43LL;
goto LABEL_20;
}
if ( !a3 || !*a3 )
{
v9 = 44LL;
LABEL_20:
v4 = -1;
fprintf(stderr, "Line %3d of File %s \n", v9, "g_add_fld.c");
goto LABEL_22;
}
v4 = chk_fld_name(a2);
if ( v4 < 0 )
{
fprintf(stderr, "Line %3d of File %s \n", 45LL, "g_add_fld.c");
}
else
{
v4 = unstr_fldtype(a3, &v16);
if ( v4 < 0 )
{
fprintf(stderr, "Line %3d of File %s \n", 47LL, "g_add_fld.c");
}
else if ( (unsigned int)is_fldtype_goodfor_gpu(v16) )
{
v4 = is_tbl(a1, &v12, v21);
if ( v4 < 0 )
{
fprintf(stderr, "Line %3d of File %s \n", 49LL, "g_add_fld.c");
}
else
{
v5 = v21[0];
v4 = get_fld_sz(v16, &v14);
if ( v4 < 0 )
{
fprintf(stderr, "Line %3d of File %s \n", 51LL, "g_add_fld.c");
}
else
{
v6 = v14;
zero_string(v24, (const char *)2048);
zero_string(v24, "ile %s \n", v7);
sprintf(
s,
"add_fld filesz=%lld nR=%lld fldtype=%s tbl=%s d_fld=%s h_fld=undefined filename=undefined",
v5 * v6,
v5,
a3,
a1,
a2);
v4 = g_make_url(s, v24);
if ( v4 < 0 )
{
fprintf(stderr, "Line %3d of File %s \n", 60LL, "g_add_fld.c");
}
else
{
v4 = g_call_gpu(v24, &haystack, v11);
if ( v4 < 0 )
{
fprintf(stderr, "Line %3d of File %s \n", 61LL, "g_add_fld.c");
}
else
{
v8 = haystack;
if ( haystack && !strstr(haystack, "\"\"") )
fprintf(stderr, "Response from GPU = [%s]\n", v8);
g_mmap_meta_data(&g_docroot, &v18, &v19, &v20, &v15);
v4 = g_is_fld(v20, v15, a2, &v13, v22);
if ( v4 >= 0 )
{
if ( v13 >= 0 )
goto LABEL_22;
v9 = 72LL;
goto LABEL_20;
}
fprintf(stderr, "Line %3d of File %s \n", 71LL, "g_add_fld.c");
}
}
}
}
}
else
{
v4 = -1;
fprintf(stderr, "Line %3d of File %s \n", 48LL, "g_add_fld.c");
}
}
LABEL_22:
if ( haystack )
{
free(haystack);
haystack = 0LL;
}
g_unmap_meta_data(v18, v19);
return (unsigned int)v4;
}

original_code:
int
g_add_fld(
    char *tbl,
    char *d_fld,
    char *str_fldtype
    )
{
  int status = 0;
  int tbl_id = -1; TBL_REC_TYPE tbl_rec;
  int d_fld_id = -1; GPU_REG_TYPE d_fld_rec;
  char *curl_response = ((void *)0);
  int fldsz = 0; size_t filesz = 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;
  if ( ( tbl == ((void *)0) ) || ( *tbl == '\0' ) ) { { { fprintf(stderr, "Line %3d of File %s \n", 42, "g_add_fld.c"); }; status = -1 ; goto BYE; }; }
  if ( ( d_fld == ((void *)0) ) || ( *d_fld == '\0' ) ) { { { fprintf(stderr, "Line %3d of File %s \n", 43, "g_add_fld.c"); }; status = -1 ; goto BYE; }; }
  if ( ( str_fldtype == ((void *)0) ) || ( *str_fldtype == '\0' ) ) { { { fprintf(stderr, "Line %3d of File %s \n", 44, "g_add_fld.c"); }; status = -1 ; goto BYE; }; }
  status = chk_fld_name(d_fld); { if ( (status) < 0 ) { { { fprintf(stderr, "Line %3d of File %s \n", 45, "g_add_fld.c"); }; status = (status) ; goto BYE; } } };
  FLD_TYPE fldtype;
  status = unstr_fldtype(str_fldtype, &fldtype); { if ( (status) < 0 ) { { { fprintf(stderr, "Line %3d of File %s \n", 47, "g_add_fld.c"); }; status = (status) ; goto BYE; } } };
  if ( is_fldtype_goodfor_gpu(fldtype) == 0 ) { { { fprintf(stderr, "Line %3d of File %s \n", 48, "g_add_fld.c"); }; status = -1 ; goto BYE; }; }
  status = is_tbl(tbl, &tbl_id, &tbl_rec); { if ( (status) < 0 ) { { { fprintf(stderr, "Line %3d of File %s \n", 49, "g_add_fld.c"); }; status = (status) ; goto BYE; } } };
  long long nR = tbl_rec.nR;
  status = get_fld_sz(fldtype, &fldsz); { if ( (status) < 0 ) { { { fprintf(stderr, "Line %3d of File %s \n", 51, "g_add_fld.c"); }; status = (status) ; goto BYE; } } };
  filesz = nR * fldsz;
  char url[2048]; zero_string(url, 2048);
  char command[1024]; zero_string(url, 1024);
  sprintf(command, "add_fld filesz=%lld nR=%lld fldtype=%s tbl=%s d_fld=%s h_fld=undefined filename=undefined",
      (unsigned long long)filesz, nR, str_fldtype, tbl, d_fld);
  status = g_make_url(command, url); { if ( (status) < 0 ) { { { fprintf(stderr, "Line %3d of File %s \n", 60, "g_add_fld.c"); }; status = (status) ; goto BYE; } } };
  status = g_call_gpu(url, &curl_response); { if ( (status) < 0 ) { { { fprintf(stderr, "Line %3d of File %s \n", 61, "g_add_fld.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);
    }
  }
  status = g_mmap_meta_data(g_docroot, &gpu_reg_X, &gpu_reg_nX,
      &gpu_reg, &n_gpu_reg);
  status = g_is_fld(gpu_reg, n_gpu_reg, d_fld, &d_fld_id, &d_fld_rec);
  { if ( (status) < 0 ) { { { fprintf(stderr, "Line %3d of File %s \n", 71, "g_add_fld.c"); }; status = (status) ; goto BYE; } } };
  if ( d_fld_id < 0 ) { { { fprintf(stderr, "Line %3d of File %s \n", 72, "g_add_fld.c"); }; status = -1 ; goto BYE; }; }
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_add_fld(char *tbl, char *d_fld, char *str_fldtype)
{
  int status = 0;
  int tbl_id = -1; struct _TBL_REC_TYPE tbl_rec;
  int d_fld_id = -1; struct _GPU_REG_TYPE d_fld_rec;
  char *curl_response = ((void *)0);
  int fldsz = 0; unsigned long filesz = 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;
  if ( ( tbl == ((void *)0) ) || ( *tbl == '\0' ) ) { { { fprintf(stderr, "Line %3d of File %s \n", 42, "g_add_fld.c"); }; status = -1 ; goto BYE; }; }
  if ( ( d_fld == ((void *)0) ) || ( *d_fld == '\0' ) ) { { { fprintf(stderr, "Line %3d of File %s \n", 43, "g_add_fld.c"); }; status = -1 ; goto BYE; }; }
  if ( ( str_fldtype == ((void *)0) ) || ( *str_fldtype == '\0' ) ) { { { fprintf(stderr, "Line %3d of File %s \n", 44, "g_add_fld.c"); }; status = -1 ; goto BYE; }; }
  status = chk_fld_name(d_fld); { if ( (status) < 0 ) { { { fprintf(stderr, "Line %3d of File %s \n", 45, "g_add_fld.c"); }; status = (status) ; goto BYE; } } };
  enum _FLD_TYPE fldtype;
  status = unstr_fldtype(str_fldtype, &fldtype); { if ( (status) < 0 ) { { { fprintf(stderr, "Line %3d of File %s \n", 47, "g_add_fld.c"); }; status = (status) ; goto BYE; } } };
  if ( is_fldtype_goodfor_gpu(fldtype) == 0 ) { { { fprintf(stderr, "Line %3d of File %s \n", 48, "g_add_fld.c"); }; status = -1 ; goto BYE; }; }
  status = is_tbl(tbl, &tbl_id, &tbl_rec); { if ( (status) < 0 ) { { { fprintf(stderr, "Line %3d of File %s \n", 49, "g_add_fld.c"); }; status = (status) ; goto BYE; } } };
  long long nR = tbl_rec.nR;
  status = get_fld_sz(fldtype, &fldsz); { if ( (status) < 0 ) { { { fprintf(stderr, "Line %3d of File %s \n", 51, "g_add_fld.c"); }; status = (status) ; goto BYE; } } };
  filesz = nR * fldsz;
  char url[2048]; zero_string(url, 2048);
  char command[1024]; zero_string(url, 1024);
  sprintf(command, "add_fld filesz=%lld nR=%lld fldtype=%s tbl=%s d_fld=%s h_fld=undefined filename=undefined",
      (unsigned long long)filesz, nR, str_fldtype, tbl, d_fld);
  status = g_make_url(command, url); { if ( (status) < 0 ) { { { fprintf(stderr, "Line %3d of File %s \n", 60, "g_add_fld.c"); }; status = (status) ; goto BYE; } } };
  status = g_call_gpu(url, &curl_response); { if ( (status) < 0 ) { { { fprintf(stderr, "Line %3d of File %s \n", 61, "g_add_fld.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);
    }
  }
  status = g_mmap_meta_data(g_docroot, &gpu_reg_X, &gpu_reg_nX,
      &gpu_reg, &n_gpu_reg);
  status = g_is_fld(gpu_reg, n_gpu_reg, d_fld, &d_fld_id, &d_fld_rec);
  { if ( (status) < 0 ) { { { fprintf(stderr, "Line %3d of File %s \n", 71, "g_add_fld.c"); }; status = (status) ; goto BYE; } } };
  if ( d_fld_id < 0 ) { { { fprintf(stderr, "Line %3d of File %s \n", 72, "g_add_fld.c"); }; status = -1 ; goto BYE; }; }
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:
tbl
char *

variable_types: status int

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

variable_types:
filesz
unsigned long

variable_types:
nR
long long

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


original_code:
void
qsort_asc_I1 (
     void *const pbase,
     size_t total_elems,
     size_t size,
     __compar_fn_t cmp
     )
{
  register char *base_ptr = (char *) pbase;
  if ( size != sizeof(char) ) { 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 ( *((char *)mid) < *((char *)lo) ) {
 { char *ia = (char *)mid; char *ib = (char *)lo; char itmp = *ia; *ia = *ib; *ib = itmp; };
      }
      if ( *((char *)hi) < *((char *)mid) ) {
 { char *ia = (char *)mid; char *ib = (char *)hi; char itmp = *ia; *ia = *ib; *ib = itmp; };
      }
      else {
 goto jump_over;
      }
      if ( *((char *)mid) < *((char *)lo) ) {
 { char *ia = (char *)mid; char *ib = (char *)lo; char itmp = *ia; *ia = *ib; *ib = itmp; };
      }
    jump_over:;
      left_ptr = lo + size;
      right_ptr = hi - size;
      do {
 while ( *((char *)left_ptr) < *((char *)mid) ) {
   left_ptr += size;
 }
 while ( *((char *)mid) < *((char *)right_ptr) ) {
   right_ptr -= size;
 }
 if (left_ptr < right_ptr) {
   { char *ia = (char *)left_ptr; char *ib = (char *)right_ptr; char 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 ( *((char *)run_ptr) < *((char *) tmp_ptr) ) {
        tmp_ptr = run_ptr;
      }
    }
    if (tmp_ptr != base_ptr) {
      { char *ia = (char *)tmp_ptr; char *ib = (char *)base_ptr; char itmp = *ia; *ia = *ib; *ib = itmp; };
    }
    run_ptr = base_ptr + size;
    while ((run_ptr += size) <= end_ptr) {
      tmp_ptr = run_ptr - size;
      while ( *((char *)run_ptr) < *((char *)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_I1(void *pbase, unsigned long total_elems, unsigned long size, int (*cmp)(void *, void *))
{
  register char *base_ptr = (char *) pbase;
  if ( size != sizeof(char) ) { 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 ( *((char *)mid) < *((char *)lo) ) {
 { char *ia = (char *)mid; char *ib = (char *)lo; char itmp = *ia; *ia = *ib; *ib = itmp; };
      }
      if ( *((char *)hi) < *((char *)mid) ) {
 { char *ia = (char *)mid; char *ib = (char *)hi; char itmp = *ia; *ia = *ib; *ib = itmp; };
      }
      else {
 goto jump_over;
      }
      if ( *((char *)mid) < *((char *)lo) ) {
 { char *ia = (char *)mid; char *ib = (char *)lo; char itmp = *ia; *ia = *ib; *ib = itmp; };
      }
    jump_over:;
      left_ptr = lo + size;
      right_ptr = hi - size;
      do {
 while ( *((char *)left_ptr) < *((char *)mid) ) {
   left_ptr += size;
 }
 while ( *((char *)mid) < *((char *)right_ptr) ) {
   right_ptr -= size;
 }
 if (left_ptr < right_ptr) {
   { char *ia = (char *)left_ptr; char *ib = (char *)right_ptr; char 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 ( *((char *)run_ptr) < *((char *) tmp_ptr) ) {
        tmp_ptr = run_ptr;
      }
    }
    if (tmp_ptr != base_ptr) {
      { char *ia = (char *)tmp_ptr; char *ib = (char *)base_ptr; char itmp = *ia; *ia = *ib; *ib = itmp; };
    }
    run_ptr = base_ptr + size;
    while ((run_ptr += size) <= end_ptr) {
      tmp_ptr = run_ptr - size;
      while ( *((char *)run_ptr) < *((char *)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
char *

variable_types:
ib
char *

variable_types: itmp char

variable_types:
thresh
char *

variable_types:
trav
char *

variable_types: c char

return_type: void


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

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

variable_types:
n
long long

variable_types:
cfld
char *

variable_types:
cnt
long long *

variable_types: status int

variable_types:
cptr
char *

variable_types:
i
long long

variable_types: idx int

variable_types: val int


original_code:
int
pos_sel_aux_copy_I4_I4(
    int *f1_select,
    int *f1_copy,
    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", 35, "./AUX/pos_sel_aux_copy_I4_I4.c"); }; status = -1 ; goto BYE; }; }
    int val = f1_select[f1idx];
    if ( ( val >= lb ) && ( val <= ub ) ) {
      val = f1_copy[f1idx];
      f3[i3++] = val;
      cnt++;
    }
  }
  *ptr_cnt = cnt;
BYE:
  return(status);
}

canonical_original_code:
int pos_sel_aux_copy_I4_I4(int *f1_select, int *f1_copy, 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", 35, "./AUX/pos_sel_aux_copy_I4_I4.c"); }; status = -1 ; goto BYE; }; }
    int val = f1_select[f1idx];
    if ( ( val >= lb ) && ( val <= ub ) ) {
      val = f1_copy[f1idx];
      f3[i3++] = val;
      cnt++;
    }
  }
  *ptr_cnt = cnt;
BYE:
  return(status);
}

variable_types: lb int

variable_types: ub int

variable_types:
cnt
long long


original_code:
void
core_wisifxthenyelsez_I1(
      char *X,
      char *nn_X,
      long long nR,
      char yval,
      char *in_Y,
      char *nn_Y,
      char zval,
      char *in_Z,
      char *nn_Z,
      char *in_W,
      char *nn_W,
      _Bool *ptr_is_some_null
      )
{
  char *W = (char *)in_W;
  char *Y = (char *)in_Y;
  char *Z = (char *)in_Z;
  for ( long long i = 0; i < nR; i++ ) {
    if ( ( nn_X == ((void *)0) ) || ( nn_X[i] == 1 ) ) {
      if ( X[i] == 1 ) {
 if ( in_Y == ((void *)0) ) {
   W[i] = yval;
   nn_W[i] = 1;
 }
 else {
   if ( ( nn_Y == ((void *)0) ) || ( nn_Y[i] == 1 ) ) {
     W[i] = Y[i];
     nn_W[i] = 1;
   }
   else {
     W[i] = 0;
     nn_W[i] = 0;
     *ptr_is_some_null = 0;
   }
 }
      }
      else if ( X[i] == 0 ) {
 if ( in_Z == ((void *)0) ) {
   W[i] = zval;
   nn_W[i] = 1;
 }
 else {
   if ( ( nn_Z == ((void *)0) ) || ( nn_Z[i] == 1 ) ) {
     W[i] = Z[i];
     nn_W[i] = 1;
   }
   else {
     W[i] = 0;
     nn_W[i] = 0;
     *ptr_is_some_null = 0;
   }
 }
      }
      else {
 exit(-1);
      }
    }
    else {
      W[i] = 0;
      nn_W[i] = 0;
      *ptr_is_some_null = 0;
    }
  }
}

canonical_original_code:
void core_wisifxthenyelsez_I1(char *X, char *nn_X, long long nR, char yval, char *in_Y, char *nn_Y, char zval, char *in_Z, char *nn_Z, char *in_W, char *nn_W, _Bool *ptr_is_some_null)
{
  char *W = (char *)in_W;
  char *Y = (char *)in_Y;
  char *Z = (char *)in_Z;
  for ( long long i = 0; i < nR; i++ ) {
    if ( ( nn_X == ((void *)0) ) || ( nn_X[i] == 1 ) ) {
      if ( X[i] == 1 ) {
 if ( in_Y == ((void *)0) ) {
   W[i] = yval;
   nn_W[i] = 1;
 }
 else {
   if ( ( nn_Y == ((void *)0) ) || ( nn_Y[i] == 1 ) ) {
     W[i] = Y[i];
     nn_W[i] = 1;
   }
   else {
     W[i] = 0;
     nn_W[i] = 0;
     *ptr_is_some_null = 0;
   }
 }
      }
      else if ( X[i] == 0 ) {
 if ( in_Z == ((void *)0) ) {
   W[i] = zval;
   nn_W[i] = 1;
 }
 else {
   if ( ( nn_Z == ((void *)0) ) || ( nn_Z[i] == 1 ) ) {
     W[i] = Z[i];
     nn_W[i] = 1;
   }
   else {
     W[i] = 0;
     nn_W[i] = 0;
     *ptr_is_some_null = 0;
   }
 }
      }
      else {
 exit(-1);
      }
    }
    else {
      W[i] = 0;
      nn_W[i] = 0;
      *ptr_is_some_null = 0;
    }
  }
}

variable_types:
X
char *

variable_types:
nR
long long

variable_types: yval char

variable_types: zval char

variable_types:
W
char *

variable_types:
Y
char *

variable_types:
Z
char *


decompiled_code:
__int64 __fastcall is_s_in_f(__int64 a1, __int64 a2, unsigned int a3, const char *a4, __int64 a5, __int64 a6, _QWORD *a7)
{
int v9; // er12
__int64 v10; // rdx
__int64 v12; // rdx
char v13; // [rsp+9h] [rbp-4Fh] BYREF
__int16 v14; // [rsp+Ah] [rbp-4Eh] BYREF
unsigned int v15; // [rsp+Ch] [rbp-4Ch] BYREF
__int64 v16; // [rsp+10h] [rbp-48h] BYREF
__int64 v17[8]; // [rsp+18h] [rbp-40h] BYREF

v16 = -1LL;
*a7 = -1LL;
if ( !a1 )
{
v12 = 37LL;
goto LABEL_19;
}
if ( !a5 )
{
v12 = 38LL;
goto LABEL_19;
}
if ( !a4 )
{
v12 = 39LL;
goto LABEL_19;
}
if ( a3 == 4 )
{
v9 = stoI4(a5, &v15);
if ( v9 < 0 )
{
fprintf(stderr, "Line %3d of File %s \n", 44LL, "is_s_in_f.c");
return (unsigned int)v9;
}
if ( !strcmp(a4, "ascending") )
{
v9 = bin_search_I4(a1, a6, v15, &v16, &unk_41B);
if ( v9 < 0 )
{
fprintf(stderr, "Line %3d of File %s \n", 58LL, "is_s_in_f.c");
return (unsigned int)v9;
}
}
else
{
is_s_in_f_seq_I4(a1, a2, v15, a6, &v16);
}
goto LABEL_16;
}
if ( a3 > 4 )
{
if ( a3 == 5 )
{
v9 = stoI8(a5, v17);
if ( v9 < 0 )
{
fprintf(stderr, "Line %3d of File %s \n", 45LL, "is_s_in_f.c");
return (unsigned int)v9;
}
if ( !strcmp(a4, "ascending") )
{
v9 = bin_search_I8(a1, a6, v17[0], &v16, &unk_41B);
if ( v9 < 0 )
{
fprintf(stderr, "Line %3d of File %s \n", 61LL, "is_s_in_f.c");
return (unsigned int)v9;
}
}
else
{
is_s_in_f_seq_I8(a1, a2, v17[0], a6, &v16);
}
goto LABEL_16;
}
goto LABEL_18;
}
if ( a3 == 2 )
{
v9 = stoI1(a5, &v13);
if ( v9 < 0 )
{
fprintf(stderr, "Line %3d of File %s \n", 42LL, "is_s_in_f.c");
return (unsigned int)v9;
}
if ( !strcmp(a4, "ascending") )
{
v9 = bin_search_I1(a1, a6, (unsigned int)v13, &v16, &unk_41B);
if ( v9 < 0 )
{
fprintf(stderr, "Line %3d of File %s \n", 52LL, "is_s_in_f.c");
return (unsigned int)v9;
}
}
else
{
is_s_in_f_seq_I1(a1, a2, (unsigned int)v13, a6, &v16);
}
goto LABEL_16;
}
if ( a3 != 3 )
{
LABEL_18:
v12 = 46LL;
LABEL_19:
v9 = -1;
fprintf(stderr, "Line %3d of File %s \n", v12, "is_s_in_f.c");
return (unsigned int)v9;
}
v9 = stoI2(a5, &v14);
if ( v9 < 0 )
{
fprintf(stderr, "Line %3d of File %s \n", 43LL, "is_s_in_f.c");
return (unsigned int)v9;
}
v10 = (unsigned int)v14;
if ( strcmp(a4, "ascending") )
{
is_s_in_f_seq_I2(a1, a2, v10, a6, &v16);
goto LABEL_16;
}
v9 = bin_search_I2(a1, a6, v10, &v16, &unk_41B);
if ( v9 >= 0 )
{
LABEL_16:
*a7 = v16;
return (unsigned int)v9;
}
fprintf(stderr, "Line %3d of File %s \n", 55LL, "is_s_in_f.c");
return (unsigned int)v9;
}

canonical_decompiled_code:
__int64 __fastcall func0(__int64 a1, __int64 a2, unsigned int a3, const char *a4, __int64 a5, __int64 a6, _QWORD *a7)
{
int v9; // er12
__int64 v10; // rdx
__int64 v12; // rdx
char v13; // [rsp+9h] [rbp-4Fh] BYREF
__int16 v14; // [rsp+Ah] [rbp-4Eh] BYREF
unsigned int v15; // [rsp+Ch] [rbp-4Ch] BYREF
__int64 v16; // [rsp+10h] [rbp-48h] BYREF
__int64 v17[8]; // [rsp+18h] [rbp-40h] BYREF

v16 = -1LL;
*a7 = -1LL;
if ( !a1 )
{
v12 = 37LL;
goto LABEL_19;
}
if ( !a5 )
{
v12 = 38LL;
goto LABEL_19;
}
if ( !a4 )
{
v12 = 39LL;
goto LABEL_19;
}
if ( a3 == 4 )
{
v9 = stoI4(a5, &v15);
if ( v9 < 0 )
{
fprintf(stderr, "Line %3d of File %s \n", 44LL, "is_s_in_f.c");
return (unsigned int)v9;
}
if ( !strcmp(a4, "ascending") )
{
v9 = bin_search_I4(a1, a6, v15, &v16, &unk_41B);
if ( v9 < 0 )
{
fprintf(stderr, "Line %3d of File %s \n", 58LL, "is_s_in_f.c");
return (unsigned int)v9;
}
}
else
{
is_s_in_f_seq_I4(a1, a2, v15, a6, &v16);
}
goto LABEL_16;
}
if ( a3 > 4 )
{
if ( a3 == 5 )
{
v9 = stoI8(a5, v17);
if ( v9 < 0 )
{
fprintf(stderr, "Line %3d of File %s \n", 45LL, "is_s_in_f.c");
return (unsigned int)v9;
}
if ( !strcmp(a4, "ascending") )
{
v9 = bin_search_I8(a1, a6, v17[0], &v16, &unk_41B);
if ( v9 < 0 )
{
fprintf(stderr, "Line %3d of File %s \n", 61LL, "is_s_in_f.c");
return (unsigned int)v9;
}
}
else
{
is_s_in_f_seq_I8(a1, a2, v17[0], a6, &v16);
}
goto LABEL_16;
}
goto LABEL_18;
}
if ( a3 == 2 )
{
v9 = stoI1(a5, &v13);
if ( v9 < 0 )
{
fprintf(stderr, "Line %3d of File %s \n", 42LL, "is_s_in_f.c");
return (unsigned int)v9;
}
if ( !strcmp(a4, "ascending") )
{
v9 = bin_search_I1(a1, a6, (unsigned int)v13, &v16, &unk_41B);
if ( v9 < 0 )
{
fprintf(stderr, "Line %3d of File %s \n", 52LL, "is_s_in_f.c");
return (unsigned int)v9;
}
}
else
{
is_s_in_f_seq_I1(a1, a2, (unsigned int)v13, a6, &v16);
}
goto LABEL_16;
}
if ( a3 != 3 )
{
LABEL_18:
v12 = 46LL;
LABEL_19:
v9 = -1;
fprintf(stderr, "Line %3d of File %s \n", v12, "is_s_in_f.c");
return (unsigned int)v9;
}
v9 = stoI2(a5, &v14);
if ( v9 < 0 )
{
fprintf(stderr, "Line %3d of File %s \n", 43LL, "is_s_in_f.c");
return (unsigned int)v9;
}
v10 = (unsigned int)v14;
if ( strcmp(a4, "ascending") )
{
is_s_in_f_seq_I2(a1, a2, v10, a6, &v16);
goto LABEL_16;
}
v9 = bin_search_I2(a1, a6, v10, &v16, &unk_41B);
if ( v9 >= 0 )
{
LABEL_16:
*a7 = v16;
return (unsigned int)v9;
}
fprintf(stderr, "Line %3d of File %s \n", 55LL, "is_s_in_f.c");
return (unsigned int)v9;
}

original_code:
int
is_s_in_f(
    char *X,
    char *nn_X,
    FLD_TYPE fldtype,
    char *str_srttype,
    char *str_val,
    long long nR,
    long long *ptr_idx
    )
{
  int status = 0;
  long long idx = -1;
  char I1val, *I1ptr = (char *)X;
  short I2val, *I2ptr = (short *)X;
  int I4val, *I4ptr = (int *)X;
  long long I8val, *I8ptr = (long long *)X;
  *ptr_idx = -1;
  if ( X == ((void *)0) ) { { { fprintf(stderr, "Line %3d of File %s \n", 37, "is_s_in_f.c"); }; status = -1 ; goto BYE; }; }
  if ( str_val == ((void *)0) ) { { { fprintf(stderr, "Line %3d of File %s \n", 38, "is_s_in_f.c"); }; status = -1 ; goto BYE; }; }
  if ( str_srttype == ((void *)0) ) { { { fprintf(stderr, "Line %3d of File %s \n", 39, "is_s_in_f.c"); }; status = -1 ; goto BYE; }; }
  switch ( fldtype ) {
    case I1 : status = stoI1(str_val, &I1val); { if ( (status) < 0 ) { { { fprintf(stderr, "Line %3d of File %s \n", 42, "is_s_in_f.c"); }; status = (status) ; goto BYE; } } }; break;
    case I2 : status = stoI2(str_val, &I2val); { if ( (status) < 0 ) { { { fprintf(stderr, "Line %3d of File %s \n", 43, "is_s_in_f.c"); }; status = (status) ; goto BYE; } } }; break;
    case I4 : status = stoI4(str_val, &I4val); { if ( (status) < 0 ) { { { fprintf(stderr, "Line %3d of File %s \n", 44, "is_s_in_f.c"); }; status = (status) ; goto BYE; } } }; break;
    case I8 : status = stoI8(str_val, &I8val); { if ( (status) < 0 ) { { { fprintf(stderr, "Line %3d of File %s \n", 45, "is_s_in_f.c"); }; status = (status) ; goto BYE; } } }; break;
    default : { { fprintf(stderr, "Line %3d of File %s \n", 46, "is_s_in_f.c"); }; status = -1 ; goto BYE; }; break;
  }
  if ( strcmp(str_srttype, "ascending") == 0 ) {
    switch ( fldtype ) {
      case I1 :
 status = bin_search_I1(I1ptr, nR, I1val, &idx, ""); { if ( (status) < 0 ) { { { fprintf(stderr, "Line %3d of File %s \n", 52, "is_s_in_f.c"); }; status = (status) ; goto BYE; } } };
 break;
      case I2 :
 status = bin_search_I2(I2ptr, nR, I2val, &idx, ""); { if ( (status) < 0 ) { { { fprintf(stderr, "Line %3d of File %s \n", 55, "is_s_in_f.c"); }; status = (status) ; goto BYE; } } };
 break;
      case I4 :
 status = bin_search_I4(I4ptr, nR, I4val, &idx, ""); { if ( (status) < 0 ) { { { fprintf(stderr, "Line %3d of File %s \n", 58, "is_s_in_f.c"); }; status = (status) ; goto BYE; } } };
 break;
      case I8 :
 status = bin_search_I8(I8ptr, nR, I8val, &idx, ""); { if ( (status) < 0 ) { { { fprintf(stderr, "Line %3d of File %s \n", 61, "is_s_in_f.c"); }; status = (status) ; goto BYE; } } };
 break;
      default :
 { { fprintf(stderr, "Line %3d of File %s \n", 64, "is_s_in_f.c"); }; status = -1 ; goto BYE; };
 break;
    }
  }
  else {
    switch ( fldtype ) {
      case I1 :
        is_s_in_f_seq_I1(I1ptr, nn_X, I1val, nR, &idx);{ if ( (status) < 0 ) { { { fprintf(stderr, "Line %3d of File %s \n", 71, "is_s_in_f.c"); }; status = (status) ; goto BYE; } } };
 break;
      case I2 :
        is_s_in_f_seq_I2(I2ptr, nn_X, I2val, nR, &idx);{ if ( (status) < 0 ) { { { fprintf(stderr, "Line %3d of File %s \n", 74, "is_s_in_f.c"); }; status = (status) ; goto BYE; } } };
 break;
      case I4 :
        is_s_in_f_seq_I4(I4ptr, nn_X, I4val, nR, &idx);{ if ( (status) < 0 ) { { { fprintf(stderr, "Line %3d of File %s \n", 77, "is_s_in_f.c"); }; status = (status) ; goto BYE; } } };
 break;
      case I8 :
        is_s_in_f_seq_I8(I8ptr, nn_X, I8val, nR, &idx);{ if ( (status) < 0 ) { { { fprintf(stderr, "Line %3d of File %s \n", 80, "is_s_in_f.c"); }; status = (status) ; goto BYE; } } };
 break;
      default :
 { { fprintf(stderr, "Line %3d of File %s \n", 83, "is_s_in_f.c"); }; status = -1 ; goto BYE; };
 break;
    }
  }
  *ptr_idx = idx;
BYE:
  return status ;
}

canonical_original_code:
int is_s_in_f(char *X, char *nn_X, enum _FLD_TYPE fldtype, char *str_srttype, char *str_val, long long nR, long long *ptr_idx)
{
  int status = 0;
  long long idx = -1;
  char I1val; char *I1ptr = (char *)X;
  short I2val; short *I2ptr = (short *)X;
  int I4val; int *I4ptr = (int *)X;
  long long I8val; long long *I8ptr = (long long *)X;
  *ptr_idx = -1;
  if ( X == ((void *)0) ) { { { fprintf(stderr, "Line %3d of File %s \n", 37, "is_s_in_f.c"); }; status = -1 ; goto BYE; }; }
  if ( str_val == ((void *)0) ) { { { fprintf(stderr, "Line %3d of File %s \n", 38, "is_s_in_f.c"); }; status = -1 ; goto BYE; }; }
  if ( str_srttype == ((void *)0) ) { { { fprintf(stderr, "Line %3d of File %s \n", 39, "is_s_in_f.c"); }; status = -1 ; goto BYE; }; }
  switch ( fldtype ) {
    case I1 : status = stoI1(str_val, &I1val); { if ( (status) < 0 ) { { { fprintf(stderr, "Line %3d of File %s \n", 42, "is_s_in_f.c"); }; status = (status) ; goto BYE; } } }; break;
    case I2 : status = stoI2(str_val, &I2val); { if ( (status) < 0 ) { { { fprintf(stderr, "Line %3d of File %s \n", 43, "is_s_in_f.c"); }; status = (status) ; goto BYE; } } }; break;
    case I4 : status = stoI4(str_val, &I4val); { if ( (status) < 0 ) { { { fprintf(stderr, "Line %3d of File %s \n", 44, "is_s_in_f.c"); }; status = (status) ; goto BYE; } } }; break;
    case I8 : status = stoI8(str_val, &I8val); { if ( (status) < 0 ) { { { fprintf(stderr, "Line %3d of File %s \n", 45, "is_s_in_f.c"); }; status = (status) ; goto BYE; } } }; break;
    default : { { fprintf(stderr, "Line %3d of File %s \n", 46, "is_s_in_f.c"); }; status = -1 ; goto BYE; }; break;
  }
  if ( strcmp(str_srttype, "ascending") == 0 ) {
    switch ( fldtype ) {
      case I1 :
 status = bin_search_I1(I1ptr, nR, I1val, &idx, ""); { if ( (status) < 0 ) { { { fprintf(stderr, "Line %3d of File %s \n", 52, "is_s_in_f.c"); }; status = (status) ; goto BYE; } } };
 break;
      case I2 :
 status = bin_search_I2(I2ptr, nR, I2val, &idx, ""); { if ( (status) < 0 ) { { { fprintf(stderr, "Line %3d of File %s \n", 55, "is_s_in_f.c"); }; status = (status) ; goto BYE; } } };
 break;
      case I4 :
 status = bin_search_I4(I4ptr, nR, I4val, &idx, ""); { if ( (status) < 0 ) { { { fprintf(stderr, "Line %3d of File %s \n", 58, "is_s_in_f.c"); }; status = (status) ; goto BYE; } } };
 break;
      case I8 :
 status = bin_search_I8(I8ptr, nR, I8val, &idx, ""); { if ( (status) < 0 ) { { { fprintf(stderr, "Line %3d of File %s \n", 61, "is_s_in_f.c"); }; status = (status) ; goto BYE; } } };
 break;
      default :
 { { fprintf(stderr, "Line %3d of File %s \n", 64, "is_s_in_f.c"); }; status = -1 ; goto BYE; };
 break;
    }
  }
  else {
    switch ( fldtype ) {
      case I1 :
        is_s_in_f_seq_I1(I1ptr, nn_X, I1val, nR, &idx);{ if ( (status) < 0 ) { { { fprintf(stderr, "Line %3d of File %s \n", 71, "is_s_in_f.c"); }; status = (status) ; goto BYE; } } };
 break;
      case I2 :
        is_s_in_f_seq_I2(I2ptr, nn_X, I2val, nR, &idx);{ if ( (status) < 0 ) { { { fprintf(stderr, "Line %3d of File %s \n", 74, "is_s_in_f.c"); }; status = (status) ; goto BYE; } } };
 break;
      case I4 :
        is_s_in_f_seq_I4(I4ptr, nn_X, I4val, nR, &idx);{ if ( (status) < 0 ) { { { fprintf(stderr, "Line %3d of File %s \n", 77, "is_s_in_f.c"); }; status = (status) ; goto BYE; } } };
 break;
      case I8 :
        is_s_in_f_seq_I8(I8ptr, nn_X, I8val, nR, &idx);{ if ( (status) < 0 ) { { { fprintf(stderr, "Line %3d of File %s \n", 80, "is_s_in_f.c"); }; status = (status) ; goto BYE; } } };
 break;
      default :
 { { fprintf(stderr, "Line %3d of File %s \n", 83, "is_s_in_f.c"); }; status = -1 ; goto BYE; };
 break;
    }
  }
  *ptr_idx = idx;
BYE:
  return status ;
}

variable_types:
idx
long long


decompiled_code:
__int64 __fastcall sort3_asc_F4(float *a1, float *a2)
{
__int64 result; // rax
float v3; // xmm2_4
float v4; // xmm4_4
float v5; // xmm3_4
float v6; // xmm5_4

result = 1LL;
v3 = a1[1];
v4 = a1[2];
v5 = a2[1];
v6 = a2[2];
if ( *a1 <= *a2 )
{
result = 0xFFFFFFFFLL;
if ( *a2 <= *a1 )
{
result = 1LL;
if ( v3 <= v5 )
{
result = 0xFFFFFFFFLL;
if ( v5 <= v3 )
{
result = 1LL;
if ( v4 <= v6 )
result = (unsigned int)-(v6 > v4);
}
}
}
}
return result;
}

canonical_decompiled_code:
__int64 __fastcall func0(float *a1, float *a2)
{
__int64 result; // rax
float v3; // xmm2_4
float v4; // xmm4_4
float v5; // xmm3_4
float v6; // xmm5_4

result = 1LL;
v3 = a1[1];
v4 = a1[2];
v5 = a2[1];
v6 = a2[2];
if ( *a1 <= *a2 )
{
result = 0xFFFFFFFFLL;
if ( *a2 <= *a1 )
{
result = 1LL;
if ( v3 <= v5 )
{
result = 0xFFFFFFFFLL;
if ( v5 <= v3 )
{
result = 1LL;
if ( v4 <= v6 )
result = (unsigned int)-(v6 > v4);
}
}
}
}
return result;
}

original_code:
int sort3_asc_F4(
     const void *ii,
     const void *jj
     )
{
  float val11, val12, val13, val21,val22, val23;
  float *ptr1, *ptr2;
  ptr1 = (float *)ii;
  ptr2 = (float *)jj;
  val11 = *ptr1++;
  val12 = *ptr1++;
  val13 = *ptr1++;
  val21 = *ptr2++;
  val22 = *ptr2++;
  val23 = *ptr2++;
  if ( val11 > val21 ) {
    return (1);
  }
  else if ( val11 < val21 ) {
    return (-1);
  }
  else {
    if ( val12 > val22 ) {
      return (1);
    }
    else if ( val12 < val22 ) {
      return (-1);
    }
    else {
      if ( val13 > val23 ) {
 return (1);
      }
      else if ( val13 < val23 ) {
 return (-1);
      }
      else {
 return(0);
      }
    }
  }
}

canonical_original_code:
int sort3_asc_F4(void *ii, void *jj)
{
  float val11; float val12; float val13; float val21; float val22; float val23;
  float *ptr1; float *ptr2;
  ptr1 = (float *)ii;
  ptr2 = (float *)jj;
  val11 = *ptr1++;
  val12 = *ptr1++;
  val13 = *ptr1++;
  val21 = *ptr2++;
  val22 = *ptr2++;
  val23 = *ptr2++;
  if ( val11 > val21 ) {
    return (1);
  }
  else if ( val11 < val21 ) {
    return (-1);
  }
  else {
    if ( val12 > val22 ) {
      return (1);
    }
    else if ( val12 < val22 ) {
      return (-1);
    }
    else {
      if ( val13 > val23 ) {
 return (1);
      }
      else if ( val13 < val23 ) {
 return (-1);
      }
      else {
 return(0);
      }
    }
  }
}

variable_types:
ii
void *

variable_types:
jj
void *


original_code:
void
sub2_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 sub2_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


qtils

decompiled_code:
__int64 __fastcall qtils(unsigned int a1, _QWORD *a2, char *a3, unsigned int a4)
{
const char *v4; // r14
__int64 v8; // rdx
int v9; // er12
bool v10; // cf
bool v11; // zf
const char *v12; // rdx
const char *v13; // rdi
__int64 v14; // rcx
const char *v15; // rsi
char v16; // al
bool v17; // cf
bool v18; // zf
const char *v19; // rdi
__int64 v20; // rcx
const char *v21; // rsi
_BYTE *v23; // rbp
__int64 v24; // rdx
const char *v25; // r13
const char *v26; // r14
const char *v27; // r15
char *v28; // rax
char *v29; // rax
__int64 v30; // rax
bool v31; // al
bool v32; // cf
bool v33; // zf
const char *v34; // rdi
__int64 v35; // rcx
const char *v36; // rsi
bool v37; // al
bool v38; // cf
bool v39; // zf
const char *v40; // rdi
__int64 v41; // rcx
const char *v42; // rsi
char *v43; // rax
int v44; // [rsp+Ch] [rbp-103Ch] BYREF
char dest[8]; // [rsp+10h] [rbp-1038h] BYREF

if ( a1 - 2 > 0xB )
{
v24 = 39LL;
goto LABEL_33;
}
v4 = (const char *)a2[1];
v8 = a4;
v11 = strcmp(v4, "time_since_epoch") == 0;
v9 = !v11;
if ( v11 )
{
v10 = a1 < 3;
v11 = a1 == 3;
if ( a1 == 3 )
{
v12 = (const char *)a2[2];
v13 = "usec";
v14 = 5LL;
v15 = v12;
do
{
if ( !v14 )
break;
v10 = *v15 < (unsigned int)*v13;
v11 = *v15++ == *v13++;
--v14;
}
while ( v11 );
v16 = (!v10 && !v11) - v10;
v17 = 0;
v18 = v16 == 0;
if ( v16 )
{
v19 = "sec";
v20 = 4LL;
v21 = (const char *)a2[2];
do
{
if ( !v20 )
break;
v17 = *v21 < (unsigned int)*v19;
v18 = *v21++ == *v19++;
--v20;
}
while ( v18 );
if ( (!v17 && !v18) == v17 )
{
v9 = time1(dest, v21, v12, v20);
if ( v9 < 0 )
fprintf(stderr, "Line %3d of File %s \n", 46LL, "qtils.c");
else
sprintf(a3, "%d", *(unsigned int *)dest);
}
}
else
{
v30 = get_time_usec(v13, v15, v12, v14);
sprintf(a3, "%llu", v30);
}
return (unsigned int)v9;
}
v24 = 41LL;
LABEL_33:
v9 = -1;
fprintf(stderr, "Line %3d of File %s \n", v24, "qtils.c");
return (unsigned int)v9;
}
if ( !strcmp(v4, "hdfs_get") )
{
if ( a1 != 11 )
{
fprintf(stderr, "argc = %d \n", a1);
v24 = 51LL;
goto LABEL_33;
}
zero_string(dest, 4096LL, a4);
v23 = (_BYTE *)a2[2];
v24 = 58LL;
if ( !*v23 )
goto LABEL_33;
v25 = (const char *)a2[3];
v24 = 59LL;
if ( !*v25 )
goto LABEL_33;
v26 = (const char *)a2[4];
v24 = 60LL;
if ( !*v26 )
goto LABEL_33;
v27 = (const char *)a2[5];
if ( !*v27 )
{
v9 = -1;
fprintf(stderr, "Line %3d of File %s \n", 61LL, "qtils.c");
return (unsigned int)v9;
}
if ( *v27 != 47 )
{
v24 = 63LL;
goto LABEL_33;
}
v9 = stoI4(a2[4], &v44, 60LL, "qtils.c");
if ( v9 < 0 )
{
fprintf(stderr, "Line %3d of File %s \n", 64LL, "qtils.c");
return (unsigned int)v9;
}
v24 = 65LL;
if ( v44 <= 1023 )
goto LABEL_33;
strcpy(dest, "http://");
v28 = stpcpy(&dest[7], v25);
*v28 = 58;
v29 = stpcpy(v28 + 1, v26);
strcpy(v29, "/webhdfs/v1");
strcpy(v29 + 11, v27);
v9 = hdfs_get(v23, dest, a2[6], a2[7], a2[8], a2[9], a2[10]);
if ( v9 < 0 )
fprintf(stderr, "Line %3d of File %s \n", 74LL, "qtils.c");
}
else if ( !strcmp(v4, "replace_char") )
{
if ( a1 == 5 )
{
v9 = replace_char(a2[2], a2[3], a2[4]);
if ( v9 < 0 )
fprintf(stderr, "Line %3d of File %s \n", 78LL, "qtils.c");
}
else
{
v9 = -1;
fprintf(stderr, "Line %3d of File %s \n", 77LL, "qtils.c");
}
}
else if ( !strcmp(v4, "tab_split") )
{
if ( a1 == 7 )
{
v9 = tab_split(a2[2], a2[3], a2[4], a2[5], a2[6]);
if ( v9 < 0 )
fprintf(stderr, "Line %3d of File %s \n", 82LL, "qtils.c");
}
else
{
v9 = -1;
fprintf(stderr, "Line %3d of File %s \n", 81LL, "qtils.c");
}
}
else
{
v31 = strcmp(v4, "qhead") != 0;
v32 = 0;
v33 = !v31;
if ( v31 )
{
v34 = "chk_ascii";
v35 = 10LL;
v36 = v4;
do
{
if ( !v35 )
break;
v32 = *v36 < (unsigned int)*v34;
v33 = *v36++ == *v34++;
--v35;
}
while ( v33 );
if ( (!v32 && !v33) == v32 )
{
if ( a1 == 3 )
{
v9 = chk_ascii(a2[2], v36, v8);
if ( v9 < 0 )
fprintf(stderr, "Line %3d of File %s \n", 90LL, "qtils.c");
}
else
{
v9 = -1;
fprintf(stderr, "Line %3d of File %s \n", 89LL, "qtils.c");
}
}
else if ( !strcmp(v4, "urlencode") )
{
if ( a1 == 3 )
{
v9 = ext_url_encode(a2[2], a3, v8);
if ( v9 < 0 )
fprintf(stderr, "Line %3d of File %s \n", 94LL, "qtils.c");
}
else
{
v9 = -1;
fprintf(stderr, "Line %3d of File %s \n", 93LL, "qtils.c");
}
}
else
{
v37 = strcmp(v4, "urldecode") != 0;
v38 = 0;
v39 = !v37;
if ( v37 )
{
v40 = "esc_for_latex";
v41 = 14LL;
v42 = v4;
do
{
if ( !v41 )
break;
v38 = *v42 < (unsigned int)*v40;
v39 = *v42++ == *v40++;
--v41;
}
while ( v39 );
if ( (!v38 && !v39) == v38 )
{
if ( a1 == 2 )
{
v9 = esc_for_latex(v40, v42, v8);
if ( v9 < 0 )
fprintf(stderr, "Line %3d of File %s \n", 102LL, "qtils.c");
}
else
{
v9 = -1;
fprintf(stderr, "Line %3d of File %s \n", 101LL, "qtils.c");
}
}
else if ( !strcmp(v4, "hash_string") )
{
if ( a1 == 4 )
{
v9 = ext_hash_string(a2[2], a2[3], v8);
if ( v9 < 0 )
fprintf(stderr, "Line %3d of File %s \n", 106LL, "qtils.c");
}
else
{
v9 = -1;
fprintf(stderr, "Line %3d of File %s \n", 105LL, "qtils.c");
}
}
else if ( !strcmp(v4, "txt_sub") )
{
if ( a1 == 4 )
{
v9 = txt_sub(a2[2], a2[3]);
if ( v9 < 0 )
fprintf(stderr, "Line %3d of File %s \n", 110LL, "qtils.c");
}
else
{
v9 = -1;
fprintf(stderr, "Line %3d of File %s \n", 109LL, "qtils.c");
}
}
else if ( !strcmp(v4, "asc2bin") )
{
if ( a1 == 5 )
{
v9 = asc2bin(a2[2], a2[3], a2[4]);
if ( v9 < 0 )
fprintf(stderr, "Line %3d of File %s \n", 114LL, "qtils.c");
}
else
{
v9 = -1;
fprintf(stderr, "Line %3d of File %s \n", 113LL, "qtils.c");
}
}
else if ( !strcmp(v4, "bin2asc") )
{
if ( a1 == 6 )
{
v9 = bin2asc(a2[2], a2[3], a2[4], a2[5]);
if ( v9 < 0 )
fprintf(stderr, "Line %3d of File %s \n", 118LL, "qtils.c");
}
else
{
v9 = -1;
fprintf(stderr, "Line %3d of File %s \n", 117LL, "qtils.c");
}
}
else if ( !strcmp(v4, "date_to_I4") )
{
if ( a1 == 6 )
{
v9 = date_to_I4(a2[2], a2[3], a2[4], a2[5]);
if ( v9 < 0 )
fprintf(stderr, "Line %3d of File %s \n", 122LL, "qtils.c");
}
else
{
v9 = -1;
fprintf(stderr, "Line %3d of File %s \n", 121LL, "qtils.c");
}
}
else if ( !strcmp(v4, "sortbindmp") )
{
if ( a1 == 5 )
{
v9 = sortbindmp(a2[2], a2[3], a2[4]);
if ( v9 < 0 )
fprintf(stderr, "Line %3d of File %s \n", 126LL, "qtils.c");
}
else
{
v9 = -1;
fprintf(stderr, "Line %3d of File %s \n", 125LL, "qtils.c");
}
}
else
{
if ( strcmp(v4, "mk_ldb_dict") )
{
v24 = 139LL;
goto LABEL_33;
}
if ( a1 == 9 )
{
v43 = getenv("Q_DATA_DIR");
if ( v43 )
{
v9 = mk_ldb_dict(a2[2], a2[3], a2[4], a2[5], a2[6], a2[7], a2[8], v43);
if ( v9 < 0 )
fprintf(stderr, "Line %3d of File %s \n", 134LL, "qtils.c");
}
else
{
v9 = -1;
fprintf(stderr, "Line %3d of File %s \n", 131LL, "qtils.c");
}
}
else
{
v9 = -1;
fprintf(stderr, "Line %3d of File %s \n", 129LL, "qtils.c");
}
}
}
else if ( a1 == 3 )
{
v9 = ext_url_decode(a2[2], a3, v8);
if ( v9 < 0 )
fprintf(stderr, "Line %3d of File %s \n", 98LL, "qtils.c");
}
else
{
v9 = -1;
fprintf(stderr, "Line %3d of File %s \n", 97LL, "qtils.c");
}
}
}
else if ( a1 == 5 )
{
v9 = qhead(a2[2], a2[3], a2[4]);
if ( v9 < 0 )
fprintf(stderr, "Line %3d of File %s \n", 86LL, "qtils.c");
}
else
{
v9 = -1;
fprintf(stderr, "Line %3d of File %s \n", 85LL, "qtils.c");
}
}
return (unsigned int)v9;
}

canonical_decompiled_code:
__int64 __fastcall func0(unsigned int a1, _QWORD *a2, char *a3, unsigned int a4)
{
const char *v4; // r14
__int64 v8; // rdx
int v9; // er12
bool v10; // cf
bool v11; // zf
const char *v12; // rdx
const char *v13; // rdi
__int64 v14; // rcx
const char *v15; // rsi
char v16; // al
bool v17; // cf
bool v18; // zf
const char *v19; // rdi
__int64 v20; // rcx
const char *v21; // rsi
_BYTE *v23; // rbp
__int64 v24; // rdx
const char *v25; // r13
const char *v26; // r14
const char *v27; // r15
char *v28; // rax
char *v29; // rax
__int64 v30; // rax
bool v31; // al
bool v32; // cf
bool v33; // zf
const char *v34; // rdi
__int64 v35; // rcx
const char *v36; // rsi
bool v37; // al
bool v38; // cf
bool v39; // zf
const char *v40; // rdi
__int64 v41; // rcx
const char *v42; // rsi
char *v43; // rax
int v44; // [rsp+Ch] [rbp-103Ch] BYREF
char dest[8]; // [rsp+10h] [rbp-1038h] BYREF

if ( a1 - 2 > 0xB )
{
v24 = 39LL;
goto LABEL_33;
}
v4 = (const char *)a2[1];
v8 = a4;
v11 = strcmp(v4, "time_since_epoch") == 0;
v9 = !v11;
if ( v11 )
{
v10 = a1 < 3;
v11 = a1 == 3;
if ( a1 == 3 )
{
v12 = (const char *)a2[2];
v13 = "usec";
v14 = 5LL;
v15 = v12;
do
{
if ( !v14 )
break;
v10 = *v15 < (unsigned int)*v13;
v11 = *v15++ == *v13++;
--v14;
}
while ( v11 );
v16 = (!v10 && !v11) - v10;
v17 = 0;
v18 = v16 == 0;
if ( v16 )
{
v19 = "sec";
v20 = 4LL;
v21 = (const char *)a2[2];
do
{
if ( !v20 )
break;
v17 = *v21 < (unsigned int)*v19;
v18 = *v21++ == *v19++;
--v20;
}
while ( v18 );
if ( (!v17 && !v18) == v17 )
{
v9 = time1(dest, v21, v12, v20);
if ( v9 < 0 )
fprintf(stderr, "Line %3d of File %s \n", 46LL, "qtils.c");
else
sprintf(a3, "%d", *(unsigned int *)dest);
}
}
else
{
v30 = get_time_usec(v13, v15, v12, v14);
sprintf(a3, "%llu", v30);
}
return (unsigned int)v9;
}
v24 = 41LL;
LABEL_33:
v9 = -1;
fprintf(stderr, "Line %3d of File %s \n", v24, "qtils.c");
return (unsigned int)v9;
}
if ( !strcmp(v4, "hdfs_get") )
{
if ( a1 != 11 )
{
fprintf(stderr, "argc = %d \n", a1);
v24 = 51LL;
goto LABEL_33;
}
zero_string(dest, 4096LL, a4);
v23 = (_BYTE *)a2[2];
v24 = 58LL;
if ( !*v23 )
goto LABEL_33;
v25 = (const char *)a2[3];
v24 = 59LL;
if ( !*v25 )
goto LABEL_33;
v26 = (const char *)a2[4];
v24 = 60LL;
if ( !*v26 )
goto LABEL_33;
v27 = (const char *)a2[5];
if ( !*v27 )
{
v9 = -1;
fprintf(stderr, "Line %3d of File %s \n", 61LL, "qtils.c");
return (unsigned int)v9;
}
if ( *v27 != 47 )
{
v24 = 63LL;
goto LABEL_33;
}
v9 = stoI4(a2[4], &v44, 60LL, "qtils.c");
if ( v9 < 0 )
{
fprintf(stderr, "Line %3d of File %s \n", 64LL, "qtils.c");
return (unsigned int)v9;
}
v24 = 65LL;
if ( v44 <= 1023 )
goto LABEL_33;
strcpy(dest, "http://");
v28 = stpcpy(&dest[7], v25);
*v28 = 58;
v29 = stpcpy(v28 + 1, v26);
strcpy(v29, "/webhdfs/v1");
strcpy(v29 + 11, v27);
v9 = hdfs_get(v23, dest, a2[6], a2[7], a2[8], a2[9], a2[10]);
if ( v9 < 0 )
fprintf(stderr, "Line %3d of File %s \n", 74LL, "qtils.c");
}
else if ( !strcmp(v4, "replace_char") )
{
if ( a1 == 5 )
{
v9 = replace_char(a2[2], a2[3], a2[4]);
if ( v9 < 0 )
fprintf(stderr, "Line %3d of File %s \n", 78LL, "qtils.c");
}
else
{
v9 = -1;
fprintf(stderr, "Line %3d of File %s \n", 77LL, "qtils.c");
}
}
else if ( !strcmp(v4, "tab_split") )
{
if ( a1 == 7 )
{
v9 = tab_split(a2[2], a2[3], a2[4], a2[5], a2[6]);
if ( v9 < 0 )
fprintf(stderr, "Line %3d of File %s \n", 82LL, "qtils.c");
}
else
{
v9 = -1;
fprintf(stderr, "Line %3d of File %s \n", 81LL, "qtils.c");
}
}
else
{
v31 = strcmp(v4, "qhead") != 0;
v32 = 0;
v33 = !v31;
if ( v31 )
{
v34 = "chk_ascii";
v35 = 10LL;
v36 = v4;
do
{
if ( !v35 )
break;
v32 = *v36 < (unsigned int)*v34;
v33 = *v36++ == *v34++;
--v35;
}
while ( v33 );
if ( (!v32 && !v33) == v32 )
{
if ( a1 == 3 )
{
v9 = chk_ascii(a2[2], v36, v8);
if ( v9 < 0 )
fprintf(stderr, "Line %3d of File %s \n", 90LL, "qtils.c");
}
else
{
v9 = -1;
fprintf(stderr, "Line %3d of File %s \n", 89LL, "qtils.c");
}
}
else if ( !strcmp(v4, "urlencode") )
{
if ( a1 == 3 )
{
v9 = ext_url_encode(a2[2], a3, v8);
if ( v9 < 0 )
fprintf(stderr, "Line %3d of File %s \n", 94LL, "qtils.c");
}
else
{
v9 = -1;
fprintf(stderr, "Line %3d of File %s \n", 93LL, "qtils.c");
}
}
else
{
v37 = strcmp(v4, "urldecode") != 0;
v38 = 0;
v39 = !v37;
if ( v37 )
{
v40 = "esc_for_latex";
v41 = 14LL;
v42 = v4;
do
{
if ( !v41 )
break;
v38 = *v42 < (unsigned int)*v40;
v39 = *v42++ == *v40++;
--v41;
}
while ( v39 );
if ( (!v38 && !v39) == v38 )
{
if ( a1 == 2 )
{
v9 = esc_for_latex(v40, v42, v8);
if ( v9 < 0 )
fprintf(stderr, "Line %3d of File %s \n", 102LL, "qtils.c");
}
else
{
v9 = -1;
fprintf(stderr, "Line %3d of File %s \n", 101LL, "qtils.c");
}
}
else if ( !strcmp(v4, "hash_string") )
{
if ( a1 == 4 )
{
v9 = ext_hash_string(a2[2], a2[3], v8);
if ( v9 < 0 )
fprintf(stderr, "Line %3d of File %s \n", 106LL, "qtils.c");
}
else
{
v9 = -1;
fprintf(stderr, "Line %3d of File %s \n", 105LL, "qtils.c");
}
}
else if ( !strcmp(v4, "txt_sub") )
{
if ( a1 == 4 )
{
v9 = txt_sub(a2[2], a2[3]);
if ( v9 < 0 )
fprintf(stderr, "Line %3d of File %s \n", 110LL, "qtils.c");
}
else
{
v9 = -1;
fprintf(stderr, "Line %3d of File %s \n", 109LL, "qtils.c");
}
}
else if ( !strcmp(v4, "asc2bin") )
{
if ( a1 == 5 )
{
v9 = asc2bin(a2[2], a2[3], a2[4]);
if ( v9 < 0 )
fprintf(stderr, "Line %3d of File %s \n", 114LL, "qtils.c");
}
else
{
v9 = -1;
fprintf(stderr, "Line %3d of File %s \n", 113LL, "qtils.c");
}
}
else if ( !strcmp(v4, "bin2asc") )
{
if ( a1 == 6 )
{
v9 = bin2asc(a2[2], a2[3], a2[4], a2[5]);
if ( v9 < 0 )
fprintf(stderr, "Line %3d of File %s \n", 118LL, "qtils.c");
}
else
{
v9 = -1;
fprintf(stderr, "Line %3d of File %s \n", 117LL, "qtils.c");
}
}
else if ( !strcmp(v4, "date_to_I4") )
{
if ( a1 == 6 )
{
v9 = date_to_I4(a2[2], a2[3], a2[4], a2[5]);
if ( v9 < 0 )
fprintf(stderr, "Line %3d of File %s \n", 122LL, "qtils.c");
}
else
{
v9 = -1;
fprintf(stderr, "Line %3d of File %s \n", 121LL, "qtils.c");
}
}
else if ( !strcmp(v4, "sortbindmp") )
{
if ( a1 == 5 )
{
v9 = sortbindmp(a2[2], a2[3], a2[4]);
if ( v9 < 0 )
fprintf(stderr, "Line %3d of File %s \n", 126LL, "qtils.c");
}
else
{
v9 = -1;
fprintf(stderr, "Line %3d of File %s \n", 125LL, "qtils.c");
}
}
else
{
if ( strcmp(v4, "mk_ldb_dict") )
{
v24 = 139LL;
goto LABEL_33;
}
if ( a1 == 9 )
{
v43 = getenv("Q_DATA_DIR");
if ( v43 )
{
v9 = mk_ldb_dict(a2[2], a2[3], a2[4], a2[5], a2[6], a2[7], a2[8], v43);
if ( v9 < 0 )
fprintf(stderr, "Line %3d of File %s \n", 134LL, "qtils.c");
}
else
{
v9 = -1;
fprintf(stderr, "Line %3d of File %s \n", 131LL, "qtils.c");
}
}
else
{
v9 = -1;
fprintf(stderr, "Line %3d of File %s \n", 129LL, "qtils.c");
}
}
}
else if ( a1 == 3 )
{
v9 = ext_url_decode(a2[2], a3, v8);
if ( v9 < 0 )
fprintf(stderr, "Line %3d of File %s \n", 98LL, "qtils.c");
}
else
{
v9 = -1;
fprintf(stderr, "Line %3d of File %s \n", 97LL, "qtils.c");
}
}
}
else if ( a1 == 5 )
{
v9 = qhead(a2[2], a2[3], a2[4]);
if ( v9 < 0 )
fprintf(stderr, "Line %3d of File %s \n", 86LL, "qtils.c");
}
else
{
v9 = -1;
fprintf(stderr, "Line %3d of File %s \n", 85LL, "qtils.c");
}
}
return (unsigned int)v9;
}

original_code:
int
qtils(
      int argc,
      char **argv,
      char *rslt_buf,
      int sz_rslt_buf
      )
{
  int status = 0;
  int itemp;
  if ( ( argc <= 1 ) || ( argc >= 14 ) ) {{ { fprintf(stderr, "Line %3d of File %s \n", 39, "qtils.c"); }; status = -1 ; goto BYE; }; }
  if ( strcmp(argv[1], "time_since_epoch") == 0 ) {
    if ( argc != 3 ) { { { fprintf(stderr, "Line %3d of File %s \n", 41, "qtils.c"); }; status = -1 ; goto BYE; }; }
    if ( strcmp(argv[2], "usec") == 0 ) {
      sprintf(rslt_buf, "%llu", get_time_usec());
    }
    else if ( strcmp(argv[2], "sec") == 0 ) {
      status = time1(&itemp); { if ( (status) < 0 ) { { { fprintf(stderr, "Line %3d of File %s \n", 46, "qtils.c"); }; status = (status) ; goto BYE; } } };
      sprintf(rslt_buf, "%d", itemp);
    }
  }
  else if ( strcmp(argv[1], "hdfs_get") == 0 ) {
    if ( argc != 11 ) { fprintf(stderr, "argc = %d \n", argc); { { fprintf(stderr, "Line %3d of File %s \n", 51, "qtils.c"); }; status = -1 ; goto BYE; }; }
    char url[4096]; zero_string(url, 4096); int port;
    char *username = argv[2];
    char *server = argv[3];
    char *str_port = argv[4];
    char *from = argv[5];
    if ( *username == '\0' ) { { { fprintf(stderr, "Line %3d of File %s \n", 58, "qtils.c"); }; status = -1 ; goto BYE; }; }
    if ( *server == '\0' ) { { { fprintf(stderr, "Line %3d of File %s \n", 59, "qtils.c"); }; status = -1 ; goto BYE; }; }
    if ( *str_port == '\0' ) { { { fprintf(stderr, "Line %3d of File %s \n", 60, "qtils.c"); }; status = -1 ; goto BYE; }; }
    if ( *from == '\0' ) { { { fprintf(stderr, "Line %3d of File %s \n", 61, "qtils.c"); }; status = -1 ; goto BYE; }; }
    if ( *from != '/' ) { { { fprintf(stderr, "Line %3d of File %s \n", 63, "qtils.c"); }; status = -1 ; goto BYE; }; }
    status = stoI4(str_port, &port); { if ( (status) < 0 ) { { { fprintf(stderr, "Line %3d of File %s \n", 64, "qtils.c"); }; status = (status) ; goto BYE; } } };
    if ( port < 1024 ) { { { fprintf(stderr, "Line %3d of File %s \n", 65, "qtils.c"); }; status = -1 ; goto BYE; }; }
    strcpy(url, "http://");
    strcat(url, server);
    strcat(url, ":");
    strcat(url, str_port);
    strcat(url, "/webhdfs/v1");
    strcat(url, from);
    status = hdfs_get(username, url, argv[6], argv[7], argv[8], argv[9], argv[10]);
    { if ( (status) < 0 ) { { { fprintf(stderr, "Line %3d of File %s \n", 74, "qtils.c"); }; status = (status) ; goto BYE; } } };
  }
  else if ( strcmp(argv[1], "replace_char") == 0 ) {
    if ( argc != 5 ) { { { fprintf(stderr, "Line %3d of File %s \n", 77, "qtils.c"); }; status = -1 ; goto BYE; }; }
    status = replace_char(argv[2], argv[3], argv[4]); { if ( (status) < 0 ) { { { fprintf(stderr, "Line %3d of File %s \n", 78, "qtils.c"); }; status = (status) ; goto BYE; } } };
  }
  else if ( strcmp(argv[1], "tab_split") == 0 ) {
    if ( argc != 7 ) { { { fprintf(stderr, "Line %3d of File %s \n", 81, "qtils.c"); }; status = -1 ; goto BYE; }; }
    status = tab_split(argv[2], argv[3], argv[4], argv[5], argv[6]); { if ( (status) < 0 ) { { { fprintf(stderr, "Line %3d of File %s \n", 82, "qtils.c"); }; status = (status) ; goto BYE; } } };
  }
  else if ( strcmp(argv[1], "qhead") == 0 ) {
    if ( argc != 5 ) { { { fprintf(stderr, "Line %3d of File %s \n", 85, "qtils.c"); }; status = -1 ; goto BYE; }; }
    status = qhead(argv[2], argv[3], argv[4]); { if ( (status) < 0 ) { { { fprintf(stderr, "Line %3d of File %s \n", 86, "qtils.c"); }; status = (status) ; goto BYE; } } };
  }
  else if ( strcmp(argv[1], "chk_ascii") == 0 ) {
    if ( argc != 3 ) { { { fprintf(stderr, "Line %3d of File %s \n", 89, "qtils.c"); }; status = -1 ; goto BYE; }; }
    status = chk_ascii(argv[2]); { if ( (status) < 0 ) { { { fprintf(stderr, "Line %3d of File %s \n", 90, "qtils.c"); }; status = (status) ; goto BYE; } } };
  }
  else if ( strcmp(argv[1], "urlencode") == 0 ) {
    if ( argc != 3 ) { { { fprintf(stderr, "Line %3d of File %s \n", 93, "qtils.c"); }; status = -1 ; goto BYE; }; }
    status = ext_url_encode(argv[2], rslt_buf, sz_rslt_buf); { if ( (status) < 0 ) { { { fprintf(stderr, "Line %3d of File %s \n", 94, "qtils.c"); }; status = (status) ; goto BYE; } } };
  }
  else if ( strcmp(argv[1], "urldecode") == 0 ) {
    if ( argc != 3 ) { { { fprintf(stderr, "Line %3d of File %s \n", 97, "qtils.c"); }; status = -1 ; goto BYE; }; }
    status = ext_url_decode(argv[2], rslt_buf, sz_rslt_buf); { if ( (status) < 0 ) { { { fprintf(stderr, "Line %3d of File %s \n", 98, "qtils.c"); }; status = (status) ; goto BYE; } } };
  }
  else if ( strcmp(argv[1], "esc_for_latex") == 0 ) {
    if ( argc != 2 ) { { { fprintf(stderr, "Line %3d of File %s \n", 101, "qtils.c"); }; status = -1 ; goto BYE; }; }
    status = esc_for_latex(); { if ( (status) < 0 ) { { { fprintf(stderr, "Line %3d of File %s \n", 102, "qtils.c"); }; status = (status) ; goto BYE; } } };
  }
  else if ( strcmp(argv[1], "hash_string") == 0 ) {
    if ( argc != 4 ) { { { fprintf(stderr, "Line %3d of File %s \n", 105, "qtils.c"); }; status = -1 ; goto BYE; }; }
    status = ext_hash_string(argv[2], argv[3]); { if ( (status) < 0 ) { { { fprintf(stderr, "Line %3d of File %s \n", 106, "qtils.c"); }; status = (status) ; goto BYE; } } };
  }
  else if ( strcmp(argv[1], "txt_sub") == 0 ) {
    if ( argc != 4 ) { { { fprintf(stderr, "Line %3d of File %s \n", 109, "qtils.c"); }; status = -1 ; goto BYE; }; }
    status = txt_sub(argv[2], argv[3]); { if ( (status) < 0 ) { { { fprintf(stderr, "Line %3d of File %s \n", 110, "qtils.c"); }; status = (status) ; goto BYE; } } };
  }
  else if ( strcmp(argv[1], "asc2bin") == 0 ) {
    if ( argc != 5 ) { { { fprintf(stderr, "Line %3d of File %s \n", 113, "qtils.c"); }; status = -1 ; goto BYE; }; }
    status = asc2bin(argv[2], argv[3], argv[4]); { if ( (status) < 0 ) { { { fprintf(stderr, "Line %3d of File %s \n", 114, "qtils.c"); }; status = (status) ; goto BYE; } } };
  }
  else if ( strcmp(argv[1], "bin2asc") == 0 ) {
    if ( argc != 6 ) { { { fprintf(stderr, "Line %3d of File %s \n", 117, "qtils.c"); }; status = -1 ; goto BYE; }; }
    status = bin2asc(argv[2], argv[3], argv[4], argv[5]); { if ( (status) < 0 ) { { { fprintf(stderr, "Line %3d of File %s \n", 118, "qtils.c"); }; status = (status) ; goto BYE; } } };
  }
  else if ( strcmp(argv[1], "date_to_I4") == 0 ) {
    if ( argc != 6 ) { { { fprintf(stderr, "Line %3d of File %s \n", 121, "qtils.c"); }; status = -1 ; goto BYE; }; }
    status = date_to_I4 (argv[2], argv[3], argv[4], argv[5]); { if ( (status) < 0 ) { { { fprintf(stderr, "Line %3d of File %s \n", 122, "qtils.c"); }; status = (status) ; goto BYE; } } };
  }
  else if ( strcmp(argv[1], "sortbindmp") == 0 ) {
    if ( argc != 5 ) { { { fprintf(stderr, "Line %3d of File %s \n", 125, "qtils.c"); }; status = -1 ; goto BYE; }; }
    status = sortbindmp(argv[2], argv[3], argv[4]); { if ( (status) < 0 ) { { { fprintf(stderr, "Line %3d of File %s \n", 126, "qtils.c"); }; status = (status) ; goto BYE; } } };
  }
  else if ( strcmp(argv[1], "mk_ldb_dict") == 0 ) {
    if ( argc != 9 ) { { { fprintf(stderr, "Line %3d of File %s \n", 129, "qtils.c"); }; status = -1 ; goto BYE; }; }
    char *q_data_dir = getenv("Q_DATA_DIR");
    if ( q_data_dir == ((void *)0) ) { { { fprintf(stderr, "Line %3d of File %s \n", 131, "qtils.c"); }; status = -1 ; goto BYE; }; }
    status = mk_ldb_dict(argv[2], argv[3], argv[4], argv[5], argv[6],
 argv[7], argv[8], q_data_dir);
    { if ( (status) < 0 ) { { { fprintf(stderr, "Line %3d of File %s \n", 134, "qtils.c"); }; status = (status) ; goto BYE; } } };
  }
  else { { { fprintf(stderr, "Line %3d of File %s \n", 139, "qtils.c"); }; status = -1 ; goto BYE; }; }
 BYE:
  return(status);
}

canonical_original_code:
int qtils(int argc, char **argv, char *rslt_buf, int sz_rslt_buf)
{
  int status = 0;
  int itemp;
  if ( ( argc <= 1 ) || ( argc >= 14 ) ) {{ { fprintf(stderr, "Line %3d of File %s \n", 39, "qtils.c"); }; status = -1 ; goto BYE; }; }
  if ( strcmp(argv[1], "time_since_epoch") == 0 ) {
    if ( argc != 3 ) { { { fprintf(stderr, "Line %3d of File %s \n", 41, "qtils.c"); }; status = -1 ; goto BYE; }; }
    if ( strcmp(argv[2], "usec") == 0 ) {
      sprintf(rslt_buf, "%llu", get_time_usec());
    }
    else if ( strcmp(argv[2], "sec") == 0 ) {
      status = time1(&itemp); { if ( (status) < 0 ) { { { fprintf(stderr, "Line %3d of File %s \n", 46, "qtils.c"); }; status = (status) ; goto BYE; } } };
      sprintf(rslt_buf, "%d", itemp);
    }
  }
  else if ( strcmp(argv[1], "hdfs_get") == 0 ) {
    if ( argc != 11 ) { fprintf(stderr, "argc = %d \n", argc); { { fprintf(stderr, "Line %3d of File %s \n", 51, "qtils.c"); }; status = -1 ; goto BYE; }; }
    char url[4096]; zero_string(url, 4096); int port;
    char *username = argv[2];
    char *server = argv[3];
    char *str_port = argv[4];
    char *from = argv[5];
    if ( *username == '\0' ) { { { fprintf(stderr, "Line %3d of File %s \n", 58, "qtils.c"); }; status = -1 ; goto BYE; }; }
    if ( *server == '\0' ) { { { fprintf(stderr, "Line %3d of File %s \n", 59, "qtils.c"); }; status = -1 ; goto BYE; }; }
    if ( *str_port == '\0' ) { { { fprintf(stderr, "Line %3d of File %s \n", 60, "qtils.c"); }; status = -1 ; goto BYE; }; }
    if ( *from == '\0' ) { { { fprintf(stderr, "Line %3d of File %s \n", 61, "qtils.c"); }; status = -1 ; goto BYE; }; }
    if ( *from != '/' ) { { { fprintf(stderr, "Line %3d of File %s \n", 63, "qtils.c"); }; status = -1 ; goto BYE; }; }
    status = stoI4(str_port, &port); { if ( (status) < 0 ) { { { fprintf(stderr, "Line %3d of File %s \n", 64, "qtils.c"); }; status = (status) ; goto BYE; } } };
    if ( port < 1024 ) { { { fprintf(stderr, "Line %3d of File %s \n", 65, "qtils.c"); }; status = -1 ; goto BYE; }; }
    strcpy(url, "http://");
    strcat(url, server);
    strcat(url, ":");
    strcat(url, str_port);
    strcat(url, "/webhdfs/v1");
    strcat(url, from);
    status = hdfs_get(username, url, argv[6], argv[7], argv[8], argv[9], argv[10]);
    { if ( (status) < 0 ) { { { fprintf(stderr, "Line %3d of File %s \n", 74, "qtils.c"); }; status = (status) ; goto BYE; } } };
  }
  else if ( strcmp(argv[1], "replace_char") == 0 ) {
    if ( argc != 5 ) { { { fprintf(stderr, "Line %3d of File %s \n", 77, "qtils.c"); }; status = -1 ; goto BYE; }; }
    status = replace_char(argv[2], argv[3], argv[4]); { if ( (status) < 0 ) { { { fprintf(stderr, "Line %3d of File %s \n", 78, "qtils.c"); }; status = (status) ; goto BYE; } } };
  }
  else if ( strcmp(argv[1], "tab_split") == 0 ) {
    if ( argc != 7 ) { { { fprintf(stderr, "Line %3d of File %s \n", 81, "qtils.c"); }; status = -1 ; goto BYE; }; }
    status = tab_split(argv[2], argv[3], argv[4], argv[5], argv[6]); { if ( (status) < 0 ) { { { fprintf(stderr, "Line %3d of File %s \n", 82, "qtils.c"); }; status = (status) ; goto BYE; } } };
  }
  else if ( strcmp(argv[1], "qhead") == 0 ) {
    if ( argc != 5 ) { { { fprintf(stderr, "Line %3d of File %s \n", 85, "qtils.c"); }; status = -1 ; goto BYE; }; }
    status = qhead(argv[2], argv[3], argv[4]); { if ( (status) < 0 ) { { { fprintf(stderr, "Line %3d of File %s \n", 86, "qtils.c"); }; status = (status) ; goto BYE; } } };
  }
  else if ( strcmp(argv[1], "chk_ascii") == 0 ) {
    if ( argc != 3 ) { { { fprintf(stderr, "Line %3d of File %s \n", 89, "qtils.c"); }; status = -1 ; goto BYE; }; }
    status = chk_ascii(argv[2]); { if ( (status) < 0 ) { { { fprintf(stderr, "Line %3d of File %s \n", 90, "qtils.c"); }; status = (status) ; goto BYE; } } };
  }
  else if ( strcmp(argv[1], "urlencode") == 0 ) {
    if ( argc != 3 ) { { { fprintf(stderr, "Line %3d of File %s \n", 93, "qtils.c"); }; status = -1 ; goto BYE; }; }
    status = ext_url_encode(argv[2], rslt_buf, sz_rslt_buf); { if ( (status) < 0 ) { { { fprintf(stderr, "Line %3d of File %s \n", 94, "qtils.c"); }; status = (status) ; goto BYE; } } };
  }
  else if ( strcmp(argv[1], "urldecode") == 0 ) {
    if ( argc != 3 ) { { { fprintf(stderr, "Line %3d of File %s \n", 97, "qtils.c"); }; status = -1 ; goto BYE; }; }
    status = ext_url_decode(argv[2], rslt_buf, sz_rslt_buf); { if ( (status) < 0 ) { { { fprintf(stderr, "Line %3d of File %s \n", 98, "qtils.c"); }; status = (status) ; goto BYE; } } };
  }
  else if ( strcmp(argv[1], "esc_for_latex") == 0 ) {
    if ( argc != 2 ) { { { fprintf(stderr, "Line %3d of File %s \n", 101, "qtils.c"); }; status = -1 ; goto BYE; }; }
    status = esc_for_latex(); { if ( (status) < 0 ) { { { fprintf(stderr, "Line %3d of File %s \n", 102, "qtils.c"); }; status = (status) ; goto BYE; } } };
  }
  else if ( strcmp(argv[1], "hash_string") == 0 ) {
    if ( argc != 4 ) { { { fprintf(stderr, "Line %3d of File %s \n", 105, "qtils.c"); }; status = -1 ; goto BYE; }; }
    status = ext_hash_string(argv[2], argv[3]); { if ( (status) < 0 ) { { { fprintf(stderr, "Line %3d of File %s \n", 106, "qtils.c"); }; status = (status) ; goto BYE; } } };
  }
  else if ( strcmp(argv[1], "txt_sub") == 0 ) {
    if ( argc != 4 ) { { { fprintf(stderr, "Line %3d of File %s \n", 109, "qtils.c"); }; status = -1 ; goto BYE; }; }
    status = txt_sub(argv[2], argv[3]); { if ( (status) < 0 ) { { { fprintf(stderr, "Line %3d of File %s \n", 110, "qtils.c"); }; status = (status) ; goto BYE; } } };
  }
  else if ( strcmp(argv[1], "asc2bin") == 0 ) {
    if ( argc != 5 ) { { { fprintf(stderr, "Line %3d of File %s \n", 113, "qtils.c"); }; status = -1 ; goto BYE; }; }
    status = asc2bin(argv[2], argv[3], argv[4]); { if ( (status) < 0 ) { { { fprintf(stderr, "Line %3d of File %s \n", 114, "qtils.c"); }; status = (status) ; goto BYE; } } };
  }
  else if ( strcmp(argv[1], "bin2asc") == 0 ) {
    if ( argc != 6 ) { { { fprintf(stderr, "Line %3d of File %s \n", 117, "qtils.c"); }; status = -1 ; goto BYE; }; }
    status = bin2asc(argv[2], argv[3], argv[4], argv[5]); { if ( (status) < 0 ) { { { fprintf(stderr, "Line %3d of File %s \n", 118, "qtils.c"); }; status = (status) ; goto BYE; } } };
  }
  else if ( strcmp(argv[1], "date_to_I4") == 0 ) {
    if ( argc != 6 ) { { { fprintf(stderr, "Line %3d of File %s \n", 121, "qtils.c"); }; status = -1 ; goto BYE; }; }
    status = date_to_I4 (argv[2], argv[3], argv[4], argv[5]); { if ( (status) < 0 ) { { { fprintf(stderr, "Line %3d of File %s \n", 122, "qtils.c"); }; status = (status) ; goto BYE; } } };
  }
  else if ( strcmp(argv[1], "sortbindmp") == 0 ) {
    if ( argc != 5 ) { { { fprintf(stderr, "Line %3d of File %s \n", 125, "qtils.c"); }; status = -1 ; goto BYE; }; }
    status = sortbindmp(argv[2], argv[3], argv[4]); { if ( (status) < 0 ) { { { fprintf(stderr, "Line %3d of File %s \n", 126, "qtils.c"); }; status = (status) ; goto BYE; } } };
  }
  else if ( strcmp(argv[1], "mk_ldb_dict") == 0 ) {
    if ( argc != 9 ) { { { fprintf(stderr, "Line %3d of File %s \n", 129, "qtils.c"); }; status = -1 ; goto BYE; }; }
    char *q_data_dir = getenv("Q_DATA_DIR");
    if ( q_data_dir == ((void *)0) ) { { { fprintf(stderr, "Line %3d of File %s \n", 131, "qtils.c"); }; status = -1 ; goto BYE; }; }
    status = mk_ldb_dict(argv[2], argv[3], argv[4], argv[5], argv[6],
 argv[7], argv[8], q_data_dir);
    { if ( (status) < 0 ) { { { fprintf(stderr, "Line %3d of File %s \n", 134, "qtils.c"); }; status = (status) ; goto BYE; } } };
  }
  else { { { fprintf(stderr, "Line %3d of File %s \n", 139, "qtils.c"); }; status = -1 ; goto BYE; }; }
 BYE:
  return(status);
}

variable_types: argc int

variable_types:
argv
char **

variable_types: status int

variable_types: itemp int

variable_types:
url
char [4096]

variable_types: port int

variable_types:
username
char *

variable_types:
server
char *

variable_types:
from
char *


original_code:
void
core_wisifxthenyelsez_F4(
      char *X,
      char *nn_X,
      long long nR,
      float yval,
      char *in_Y,
      char *nn_Y,
      float zval,
      char *in_Z,
      char *nn_Z,
      char *in_W,
      char *nn_W,
      _Bool *ptr_is_some_null
      )
{
  float *W = (float *)in_W;
  float *Y = (float *)in_Y;
  float *Z = (float *)in_Z;
  for ( long long i = 0; i < nR; i++ ) {
    if ( ( nn_X == ((void *)0) ) || ( nn_X[i] == 1 ) ) {
      if ( X[i] == 1 ) {
 if ( in_Y == ((void *)0) ) {
   W[i] = yval;
   nn_W[i] = 1;
 }
 else {
   if ( ( nn_Y == ((void *)0) ) || ( nn_Y[i] == 1 ) ) {
     W[i] = Y[i];
     nn_W[i] = 1;
   }
   else {
     W[i] = 0;
     nn_W[i] = 0;
     *ptr_is_some_null = 0;
   }
 }
      }
      else if ( X[i] == 0 ) {
 if ( in_Z == ((void *)0) ) {
   W[i] = zval;
   nn_W[i] = 1;
 }
 else {
   if ( ( nn_Z == ((void *)0) ) || ( nn_Z[i] == 1 ) ) {
     W[i] = Z[i];
     nn_W[i] = 1;
   }
   else {
     W[i] = 0;
     nn_W[i] = 0;
     *ptr_is_some_null = 0;
   }
 }
      }
      else {
 exit(-1);
      }
    }
    else {
      W[i] = 0;
      nn_W[i] = 0;
      *ptr_is_some_null = 0;
    }
  }
}

canonical_original_code:
void core_wisifxthenyelsez_F4(char *X, char *nn_X, long long nR, float yval, char *in_Y, char *nn_Y, float zval, char *in_Z, char *nn_Z, char *in_W, char *nn_W, _Bool *ptr_is_some_null)
{
  float *W = (float *)in_W;
  float *Y = (float *)in_Y;
  float *Z = (float *)in_Z;
  for ( long long i = 0; i < nR; i++ ) {
    if ( ( nn_X == ((void *)0) ) || ( nn_X[i] == 1 ) ) {
      if ( X[i] == 1 ) {
 if ( in_Y == ((void *)0) ) {
   W[i] = yval;
   nn_W[i] = 1;
 }
 else {
   if ( ( nn_Y == ((void *)0) ) || ( nn_Y[i] == 1 ) ) {
     W[i] = Y[i];
     nn_W[i] = 1;
   }
   else {
     W[i] = 0;
     nn_W[i] = 0;
     *ptr_is_some_null = 0;
   }
 }
      }
      else if ( X[i] == 0 ) {
 if ( in_Z == ((void *)0) ) {
   W[i] = zval;
   nn_W[i] = 1;
 }
 else {
   if ( ( nn_Z == ((void *)0) ) || ( nn_Z[i] == 1 ) ) {
     W[i] = Z[i];
     nn_W[i] = 1;
   }
   else {
     W[i] = 0;
     nn_W[i] = 0;
     *ptr_is_some_null = 0;
   }
 }
      }
      else {
 exit(-1);
      }
    }
    else {
      W[i] = 0;
      nn_W[i] = 0;
      *ptr_is_some_null = 0;
    }
  }
}

variable_types:
X
char *

variable_types:
nR
long long

variable_types: yval float

variable_types: zval float

variable_types:
W
float *

variable_types:
Y
float *

variable_types:
Z
float *

variable_types:
i
long long