decompiled_code:
__int64 __fastcall break_nn_fld(_BYTE *a1, const char *a2, _BYTE *a3, const char *a4)
{
int v6; // er12
__int64 v7; // rbx
__int64 v9; // rdx
unsigned int v10; // [rsp+Ch] [rbp-21Ch] BYREF
unsigned int v11; // [rsp+10h] [rbp-218h] BYREF
int v12; // [rsp+14h] [rbp-214h] BYREF
int v13; // [rsp+18h] [rbp-210h] BYREF
int v14; // [rsp+1Ch] [rbp-20Ch] BYREF
__int64 v15[6]; // [rsp+20h] [rbp-208h] BYREF
__int64 v16[6]; // [rsp+50h] [rbp-1D8h] BYREF
char v17[128]; // [rsp+80h] [rbp-1A8h] BYREF
char v18[2]; // [rsp+100h] [rbp-128h] BYREF
__int16 v19; // [rsp+102h] [rbp-126h]
int v20; // [rsp+120h] [rbp-108h]
unsigned int v21; // [rsp+148h] [rbp-E0h]
char v22[32]; // [rsp+180h] [rbp-A8h] BYREF
int v23; // [rsp+1A0h] [rbp-88h]

v10 = 0x80000000;
v11 = 0x80000000;
v12 = 0x80000000;
v13 = 0x80000000;
v14 = 0x80000000;
if ( !a1 || !*a1 )
{
v9 = 37LL;
LABEL_26:
v6 = -1;
fprintf(stderr, "Line %3d of File %s \n", v9, "break_nn_fld.c");
return (unsigned int)v6;
}
if ( !a2 || !*a2 )
{
v9 = 38LL;
goto LABEL_26;
}
if ( !a3 || !*a3 )
{
v9 = 39LL;
goto LABEL_26;
}
if ( !a4 || !*a4 )
{
v9 = 40LL;
goto LABEL_26;
}
if ( !strcmp(a2, a4) )
{
v6 = -1;
fprintf(stderr, "Line %3d of File %s \n", 41LL, "break_nn_fld.c");
return (unsigned int)v6;
}
v6 = is_tbl(a1, &v10, v15);
if ( v6 < 0 )
{
fprintf(stderr, "Line %3d of File %s \n", 43LL, "break_nn_fld.c");
return (unsigned int)v6;
}
if ( (v10 & 0x80000000) != 0 )
{
v9 = 44LL;
goto LABEL_26;
}
v7 = v15[0];
v6 = is_fld(0LL, v10, a2, &v12, v17, &v14, v18);
if ( v6 < 0 )
{
fprintf(stderr, "Line %3d of File %s \n", 47LL, "break_nn_fld.c");
return (unsigned int)v6;
}
if ( v12 < 0 )
{
v9 = 48LL;
goto LABEL_26;
}
if ( v14 < 0 )
{
v9 = 49LL;
goto LABEL_26;
}
v6 = is_tbl(a3, &v11, v16);
if ( v6 < 0 )
{
fprintf(stderr, "Line %3d of File %s \n", 51LL, "break_nn_fld.c");
return (unsigned int)v6;
}
if ( (v11 & 0x80000000) != 0 )
{
v9 = 52LL;
goto LABEL_26;
}
if ( v7 != v16[0] )
{
v9 = 54LL;
goto LABEL_26;
}
zero_fld_rec(v22);
v23 = v20;
v6 = add_fld(v11, a4, (unsigned int)v19, v21, &v13, v22);
if ( v6 < 0 )
{
fprintf(stderr, "Line %3d of File %s \n", 59LL, "break_nn_fld.c");
}
else
{
zero_fld_rec(g_flds + 120LL * v14);
*(_WORD *)(g_flds + 120LL * v12 + 6) = -1;
}
return (unsigned int)v6;
}

canonical_decompiled_code:
__int64 __fastcall func0(_BYTE *a1, const char *a2, _BYTE *a3, const char *a4)
{
int v6; // er12
__int64 v7; // rbx
__int64 v9; // rdx
unsigned int v10; // [rsp+Ch] [rbp-21Ch] BYREF
unsigned int v11; // [rsp+10h] [rbp-218h] BYREF
int v12; // [rsp+14h] [rbp-214h] BYREF
int v13; // [rsp+18h] [rbp-210h] BYREF
int v14; // [rsp+1Ch] [rbp-20Ch] BYREF
__int64 v15[6]; // [rsp+20h] [rbp-208h] BYREF
__int64 v16[6]; // [rsp+50h] [rbp-1D8h] BYREF
char v17[128]; // [rsp+80h] [rbp-1A8h] BYREF
char v18[2]; // [rsp+100h] [rbp-128h] BYREF
__int16 v19; // [rsp+102h] [rbp-126h]
int v20; // [rsp+120h] [rbp-108h]
unsigned int v21; // [rsp+148h] [rbp-E0h]
char v22[32]; // [rsp+180h] [rbp-A8h] BYREF
int v23; // [rsp+1A0h] [rbp-88h]

v10 = 0x80000000;
v11 = 0x80000000;
v12 = 0x80000000;
v13 = 0x80000000;
v14 = 0x80000000;
if ( !a1 || !*a1 )
{
v9 = 37LL;
LABEL_26:
v6 = -1;
fprintf(stderr, "Line %3d of File %s \n", v9, "break_nn_fld.c");
return (unsigned int)v6;
}
if ( !a2 || !*a2 )
{
v9 = 38LL;
goto LABEL_26;
}
if ( !a3 || !*a3 )
{
v9 = 39LL;
goto LABEL_26;
}
if ( !a4 || !*a4 )
{
v9 = 40LL;
goto LABEL_26;
}
if ( !strcmp(a2, a4) )
{
v6 = -1;
fprintf(stderr, "Line %3d of File %s \n", 41LL, "break_nn_fld.c");
return (unsigned int)v6;
}
v6 = is_tbl(a1, &v10, v15);
if ( v6 < 0 )
{
fprintf(stderr, "Line %3d of File %s \n", 43LL, "break_nn_fld.c");
return (unsigned int)v6;
}
if ( (v10 & 0x80000000) != 0 )
{
v9 = 44LL;
goto LABEL_26;
}
v7 = v15[0];
v6 = is_fld(0LL, v10, a2, &v12, v17, &v14, v18);
if ( v6 < 0 )
{
fprintf(stderr, "Line %3d of File %s \n", 47LL, "break_nn_fld.c");
return (unsigned int)v6;
}
if ( v12 < 0 )
{
v9 = 48LL;
goto LABEL_26;
}
if ( v14 < 0 )
{
v9 = 49LL;
goto LABEL_26;
}
v6 = is_tbl(a3, &v11, v16);
if ( v6 < 0 )
{
fprintf(stderr, "Line %3d of File %s \n", 51LL, "break_nn_fld.c");
return (unsigned int)v6;
}
if ( (v11 & 0x80000000) != 0 )
{
v9 = 52LL;
goto LABEL_26;
}
if ( v7 != v16[0] )
{
v9 = 54LL;
goto LABEL_26;
}
zero_fld_rec(v22);
v23 = v20;
v6 = add_fld(v11, a4, (unsigned int)v19, v21, &v13, v22);
if ( v6 < 0 )
{
fprintf(stderr, "Line %3d of File %s \n", 59LL, "break_nn_fld.c");
}
else
{
zero_fld_rec(g_flds + 120LL * v14);
*(_WORD *)(g_flds + 120LL * v12 + 6) = -1;
}
return (unsigned int)v6;
}

original_code:
int
break_nn_fld(
  char *src_tbl,
  char *src_fld,
  char *dst_tbl,
  char *dst_fld
  )
{
  int status = 0;
  TBL_REC_TYPE src_tbl_rec, dst_tbl_rec;
  FLD_REC_TYPE src_fld_rec, nn_src_fld_rec;
  FLD_REC_TYPE dst_fld_rec; long long nR1 = (-0x7fffffffffffffffLL - 1LL), nR2 = (-0x7fffffffffffffffLL - 1LL);
  int src_tbl_id = (-0x7fffffff - 1), dst_tbl_id = (-0x7fffffff - 1);
  int src_fld_id = (-0x7fffffff - 1), dst_fld_id = (-0x7fffffff - 1);
  int nn_src_fld_id = (-0x7fffffff - 1);
  if ( ( src_tbl == ((void *)0) ) || ( *src_tbl == '\0' ) ) { { { fprintf(stderr, "Line %3d of File %s \n", 37, "break_nn_fld.c"); }; status = -1 ; goto BYE; }; }
  if ( ( src_fld == ((void *)0) ) || ( *src_fld == '\0' ) ) { { { fprintf(stderr, "Line %3d of File %s \n", 38, "break_nn_fld.c"); }; status = -1 ; goto BYE; }; }
  if ( ( dst_tbl == ((void *)0) ) || ( *dst_tbl == '\0' ) ) { { { fprintf(stderr, "Line %3d of File %s \n", 39, "break_nn_fld.c"); }; status = -1 ; goto BYE; }; }
  if ( ( dst_fld == ((void *)0) ) || ( *dst_fld == '\0' ) ) { { { fprintf(stderr, "Line %3d of File %s \n", 40, "break_nn_fld.c"); }; status = -1 ; goto BYE; }; }
  if ( strcmp(src_fld, dst_fld) == 0 ) { { { fprintf(stderr, "Line %3d of File %s \n", 41, "break_nn_fld.c"); }; status = -1 ; goto BYE; }; }
  status = is_tbl(src_tbl, &src_tbl_id, &src_tbl_rec); { if ( (status) < 0 ) { { { fprintf(stderr, "Line %3d of File %s \n", 43, "break_nn_fld.c"); }; status = (status) ; goto BYE; } } };
  if ( src_tbl_id < 0 ) { { { fprintf(stderr, "Line %3d of File %s \n", 44, "break_nn_fld.c"); }; status = -1 ; goto BYE; }; }
  nR1 = src_tbl_rec.nR;
  status = is_fld(((void *)0), src_tbl_id, src_fld, &src_fld_id, &src_fld_rec,
    &nn_src_fld_id, &nn_src_fld_rec); { if ( (status) < 0 ) { { { fprintf(stderr, "Line %3d of File %s \n", 47, "break_nn_fld.c"); }; status = (status) ; goto BYE; } } };
  if ( src_fld_id < 0 ) { { { fprintf(stderr, "Line %3d of File %s \n", 48, "break_nn_fld.c"); }; status = -1 ; goto BYE; }; }
  if ( nn_src_fld_id < 0 ) { { { fprintf(stderr, "Line %3d of File %s \n", 49, "break_nn_fld.c"); }; status = -1 ; goto BYE; }; }
  status = is_tbl(dst_tbl, &dst_tbl_id, &dst_tbl_rec); { if ( (status) < 0 ) { { { fprintf(stderr, "Line %3d of File %s \n", 51, "break_nn_fld.c"); }; status = (status) ; goto BYE; } } };
  if ( dst_tbl_id < 0 ) { { { fprintf(stderr, "Line %3d of File %s \n", 52, "break_nn_fld.c"); }; status = -1 ; goto BYE; }; }
  nR2 = dst_tbl_rec.nR;
  if ( nR1 != nR2 ) { { { fprintf(stderr, "Line %3d of File %s \n", 54, "break_nn_fld.c"); }; status = -1 ; goto BYE; }; }
  zero_fld_rec(&dst_fld_rec); dst_fld_rec.fldtype = nn_src_fld_rec.fldtype;
  status = add_fld(dst_tbl_id, dst_fld, nn_src_fld_rec.ddir_id,
      nn_src_fld_rec.fileno, &dst_fld_id, &dst_fld_rec);
  { if ( (status) < 0 ) { { { fprintf(stderr, "Line %3d of File %s \n", 59, "break_nn_fld.c"); }; status = (status) ; goto BYE; } } };
  zero_fld_rec(&(g_flds[nn_src_fld_id]));
  g_flds[src_fld_id].nn_fld_id = -1;
 BYE:
  return status ;
}

canonical_original_code:
int break_nn_fld(char *src_tbl, char *src_fld, char *dst_tbl, char *dst_fld)
{
  int status = 0;
  struct _TBL_REC_TYPE src_tbl_rec; struct _TBL_REC_TYPE dst_tbl_rec;
  struct _FLD_REC_TYPE src_fld_rec; struct _FLD_REC_TYPE nn_src_fld_rec;
  struct _FLD_REC_TYPE dst_fld_rec; long long nR1 = (-0x7fffffffffffffffLL - 1LL); long long nR2 = (-0x7fffffffffffffffLL - 1LL);
  int src_tbl_id = (-0x7fffffff - 1); int dst_tbl_id = (-0x7fffffff - 1);
  int src_fld_id = (-0x7fffffff - 1); int dst_fld_id = (-0x7fffffff - 1);
  int nn_src_fld_id = (-0x7fffffff - 1);
  if ( ( src_tbl == ((void *)0) ) || ( *src_tbl == '\0' ) ) { { { fprintf(stderr, "Line %3d of File %s \n", 37, "break_nn_fld.c"); }; status = -1 ; goto BYE; }; }
  if ( ( src_fld == ((void *)0) ) || ( *src_fld == '\0' ) ) { { { fprintf(stderr, "Line %3d of File %s \n", 38, "break_nn_fld.c"); }; status = -1 ; goto BYE; }; }
  if ( ( dst_tbl == ((void *)0) ) || ( *dst_tbl == '\0' ) ) { { { fprintf(stderr, "Line %3d of File %s \n", 39, "break_nn_fld.c"); }; status = -1 ; goto BYE; }; }
  if ( ( dst_fld == ((void *)0) ) || ( *dst_fld == '\0' ) ) { { { fprintf(stderr, "Line %3d of File %s \n", 40, "break_nn_fld.c"); }; status = -1 ; goto BYE; }; }
  if ( strcmp(src_fld, dst_fld) == 0 ) { { { fprintf(stderr, "Line %3d of File %s \n", 41, "break_nn_fld.c"); }; status = -1 ; goto BYE; }; }
  status = is_tbl(src_tbl, &src_tbl_id, &src_tbl_rec); { if ( (status) < 0 ) { { { fprintf(stderr, "Line %3d of File %s \n", 43, "break_nn_fld.c"); }; status = (status) ; goto BYE; } } };
  if ( src_tbl_id < 0 ) { { { fprintf(stderr, "Line %3d of File %s \n", 44, "break_nn_fld.c"); }; status = -1 ; goto BYE; }; }
  nR1 = src_tbl_rec.nR;
  status = is_fld(((void *)0), src_tbl_id, src_fld, &src_fld_id, &src_fld_rec,
    &nn_src_fld_id, &nn_src_fld_rec); { if ( (status) < 0 ) { { { fprintf(stderr, "Line %3d of File %s \n", 47, "break_nn_fld.c"); }; status = (status) ; goto BYE; } } };
  if ( src_fld_id < 0 ) { { { fprintf(stderr, "Line %3d of File %s \n", 48, "break_nn_fld.c"); }; status = -1 ; goto BYE; }; }
  if ( nn_src_fld_id < 0 ) { { { fprintf(stderr, "Line %3d of File %s \n", 49, "break_nn_fld.c"); }; status = -1 ; goto BYE; }; }
  status = is_tbl(dst_tbl, &dst_tbl_id, &dst_tbl_rec); { if ( (status) < 0 ) { { { fprintf(stderr, "Line %3d of File %s \n", 51, "break_nn_fld.c"); }; status = (status) ; goto BYE; } } };
  if ( dst_tbl_id < 0 ) { { { fprintf(stderr, "Line %3d of File %s \n", 52, "break_nn_fld.c"); }; status = -1 ; goto BYE; }; }
  nR2 = dst_tbl_rec.nR;
  if ( nR1 != nR2 ) { { { fprintf(stderr, "Line %3d of File %s \n", 54, "break_nn_fld.c"); }; status = -1 ; goto BYE; }; }
  zero_fld_rec(&dst_fld_rec); dst_fld_rec.fldtype = nn_src_fld_rec.fldtype;
  status = add_fld(dst_tbl_id, dst_fld, nn_src_fld_rec.ddir_id,
      nn_src_fld_rec.fileno, &dst_fld_id, &dst_fld_rec);
  { if ( (status) < 0 ) { { { fprintf(stderr, "Line %3d of File %s \n", 59, "break_nn_fld.c"); }; status = (status) ; goto BYE; } } };
  zero_fld_rec(&(g_flds[nn_src_fld_id]));
  g_flds[src_fld_id].nn_fld_id = -1;
 BYE:
  return status ;
}

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

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


repo: linkedin/datacl

decompiled_code:
__int64 __fastcall g_f_to_s(const char *a1, const char *a2, char *a3, int a4)
{
int v6; // er12
char *v7; // rbp
__int64 v9; // rdx
_BYTE v10[712]; // [rsp-2D0h] [rbp-1208h] BYREF
int v11; // [rsp+8h] [rbp-F30h] BYREF
unsigned int v12; // [rsp+Ch] [rbp-F2Ch] BYREF
char *src; // [rsp+10h] [rbp-F28h] BYREF
__int64 v14; // [rsp+18h] [rbp-F20h] BYREF
__int64 v15; // [rsp+20h] [rbp-F18h] BYREF
__int64 v16; // [rsp+28h] [rbp-F10h] BYREF
__int64 v17[90]; // [rsp+30h] [rbp-F08h] BYREF
char s[1024]; // [rsp+300h] [rbp-C38h] BYREF
char v19[2104]; // [rsp+700h] [rbp-838h] BYREF

v11 = -1;
src = 0LL;
v14 = 0LL;
v15 = 0LL;
v16 = 0LL;
v12 = 0;
g_mmap_meta_data(&g_docroot, &v14, &v15, &v16, &v12);
if ( !a2 || !*a2 )
{
v9 = 41LL;
goto LABEL_23;
}
if ( !a1 || !*a1 )
{
v9 = 43LL;
LABEL_23:
v6 = -1;
fprintf(stderr, "Line %3d of File %s \n", v9, "g_f_to_s.c");
goto LABEL_16;
}
v6 = g_is_fld(v16, v12, a1, &v11, v17);
if ( v6 < 0 )
{
fprintf(stderr, "Line %3d of File %s \n", 45LL, "g_f_to_s.c");
goto LABEL_16;
}
if ( v11 < 0 )
{
v9 = 46LL;
goto LABEL_23;
}
if ( !(unsigned int)is_fldtype_goodfor_gpu(LODWORD(v17[4])) )
{
v6 = -1;
fprintf(stderr, "Line %3d of File %s \n", 47LL, "g_f_to_s.c");
LABEL_16:
v7 = src;
if ( src )
goto LABEL_17;
goto LABEL_18;
}
if ( !v17[1] )
{
v9 = 49LL;
goto LABEL_23;
}
if ( !v17[3] )
{
v9 = 50LL;
goto LABEL_23;
}
qmemcpy(v10, v17, sizeof(v10));
v6 = g_chk_f_to_s(a2);
if ( v6 < 0 )
{
fprintf(stderr, "Line %3d of File %s \n", 51LL, "g_f_to_s.c");
goto LABEL_16;
}
zero_string(v19, 2048LL);
zero_string(s, 1024LL);
sprintf(s, "f_to_s d_fld1=%s op=%s ", a1, a2);
v6 = g_make_url(s, v19);
if ( v6 < 0 )
{
fprintf(stderr, "Line %3d of File %s \n", 56LL, "g_f_to_s.c");
goto LABEL_16;
}
v6 = g_call_gpu(v19, &src);
if ( v6 < 0 )
{
fprintf(stderr, "Line %3d of File %s \n", 57LL, "g_f_to_s.c");
goto LABEL_16;
}
v7 = src;
if ( src )
{
strncpy(a3, src, a4);
LABEL_17:
free(v7);
src = 0LL;
}
LABEL_18:
g_unmap_meta_data(v14, v15);
return (unsigned int)v6;
}

canonical_decompiled_code:
__int64 __fastcall func0(const char *a1, const char *a2, char *a3, int a4)
{
int v6; // er12
char *v7; // rbp
__int64 v9; // rdx
_BYTE v10[712]; // [rsp-2D0h] [rbp-1208h] BYREF
int v11; // [rsp+8h] [rbp-F30h] BYREF
unsigned int v12; // [rsp+Ch] [rbp-F2Ch] BYREF
char *src; // [rsp+10h] [rbp-F28h] BYREF
__int64 v14; // [rsp+18h] [rbp-F20h] BYREF
__int64 v15; // [rsp+20h] [rbp-F18h] BYREF
__int64 v16; // [rsp+28h] [rbp-F10h] BYREF
__int64 v17[90]; // [rsp+30h] [rbp-F08h] BYREF
char s[1024]; // [rsp+300h] [rbp-C38h] BYREF
char v19[2104]; // [rsp+700h] [rbp-838h] BYREF

v11 = -1;
src = 0LL;
v14 = 0LL;
v15 = 0LL;
v16 = 0LL;
v12 = 0;
g_mmap_meta_data(&g_docroot, &v14, &v15, &v16, &v12);
if ( !a2 || !*a2 )
{
v9 = 41LL;
goto LABEL_23;
}
if ( !a1 || !*a1 )
{
v9 = 43LL;
LABEL_23:
v6 = -1;
fprintf(stderr, "Line %3d of File %s \n", v9, "g_f_to_s.c");
goto LABEL_16;
}
v6 = g_is_fld(v16, v12, a1, &v11, v17);
if ( v6 < 0 )
{
fprintf(stderr, "Line %3d of File %s \n", 45LL, "g_f_to_s.c");
goto LABEL_16;
}
if ( v11 < 0 )
{
v9 = 46LL;
goto LABEL_23;
}
if ( !(unsigned int)is_fldtype_goodfor_gpu(LODWORD(v17[4])) )
{
v6 = -1;
fprintf(stderr, "Line %3d of File %s \n", 47LL, "g_f_to_s.c");
LABEL_16:
v7 = src;
if ( src )
goto LABEL_17;
goto LABEL_18;
}
if ( !v17[1] )
{
v9 = 49LL;
goto LABEL_23;
}
if ( !v17[3] )
{
v9 = 50LL;
goto LABEL_23;
}
qmemcpy(v10, v17, sizeof(v10));
v6 = g_chk_f_to_s(a2);
if ( v6 < 0 )
{
fprintf(stderr, "Line %3d of File %s \n", 51LL, "g_f_to_s.c");
goto LABEL_16;
}
zero_string(v19, 2048LL);
zero_string(s, 1024LL);
sprintf(s, "f_to_s d_fld1=%s op=%s ", a1, a2);
v6 = g_make_url(s, v19);
if ( v6 < 0 )
{
fprintf(stderr, "Line %3d of File %s \n", 56LL, "g_f_to_s.c");
goto LABEL_16;
}
v6 = g_call_gpu(v19, &src);
if ( v6 < 0 )
{
fprintf(stderr, "Line %3d of File %s \n", 57LL, "g_f_to_s.c");
goto LABEL_16;
}
v7 = src;
if ( src )
{
strncpy(a3, src, a4);
LABEL_17:
free(v7);
src = 0LL;
}
LABEL_18:
g_unmap_meta_data(v14, v15);
return (unsigned int)v6;
}

original_code:
int
g_f_to_s(
    char *f1,
    char *str_op,
    char *rslt_buf,
    int sz_rslt_buf
    )
{
  int status = 0;
  int f1_id = -1; GPU_REG_TYPE f1_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", 41, "g_f_to_s.c"); }; status = -1 ; goto BYE; }; }
  if ( ( str_op == ((void *)0) ) || ( *str_op == '\0' ) ) { { { fprintf(stderr, "Line %3d of File %s \n", 42, "g_f_to_s.c"); }; status = -1 ; goto BYE; }; }
  if ( ( f1 == ((void *)0) ) || ( *f1 == '\0' ) ) { { { fprintf(stderr, "Line %3d of File %s \n", 43, "g_f_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", 45, "g_f_to_s.c"); }; status = (status) ; goto BYE; } } };
  if ( f1_id < 0 ) { { { fprintf(stderr, "Line %3d of File %s \n", 46, "g_f_to_s.c"); }; status = -1 ; goto BYE; }; }
  if ( is_fldtype_goodfor_gpu(f1_rec.fldtype) == 0 ) { { { fprintf(stderr, "Line %3d of File %s \n", 47, "g_f_to_s.c"); }; status = -1 ; goto BYE; }; }
  if ( f1_rec.filesz == 0 ) { { { fprintf(stderr, "Line %3d of File %s \n", 49, "g_f_to_s.c"); }; status = -1 ; goto BYE; }; }
  if ( f1_rec.nR == 0 ) { { { fprintf(stderr, "Line %3d of File %s \n", 50, "g_f_to_s.c"); }; status = -1 ; goto BYE; }; }
  status = g_chk_f_to_s(f1_rec, str_op); { if ( (status) < 0 ) { { { fprintf(stderr, "Line %3d of File %s \n", 51, "g_f_to_s.c"); }; status = (status) ; goto BYE; } } };
  char url[2048]; zero_string(url, 2048);
  char command[1024]; zero_string(command, 1024);
  sprintf(command, "f_to_s d_fld1=%s op=%s ", f1, str_op);
  status = g_make_url(command, url); { if ( (status) < 0 ) { { { fprintf(stderr, "Line %3d of File %s \n", 56, "g_f_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", 57, "g_f_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_f_to_s(char *f1, char *str_op, char *rslt_buf, int sz_rslt_buf)
{
  int status = 0;
  int f1_id = -1; struct _GPU_REG_TYPE f1_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", 41, "g_f_to_s.c"); }; status = -1 ; goto BYE; }; }
  if ( ( str_op == ((void *)0) ) || ( *str_op == '\0' ) ) { { { fprintf(stderr, "Line %3d of File %s \n", 42, "g_f_to_s.c"); }; status = -1 ; goto BYE; }; }
  if ( ( f1 == ((void *)0) ) || ( *f1 == '\0' ) ) { { { fprintf(stderr, "Line %3d of File %s \n", 43, "g_f_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", 45, "g_f_to_s.c"); }; status = (status) ; goto BYE; } } };
  if ( f1_id < 0 ) { { { fprintf(stderr, "Line %3d of File %s \n", 46, "g_f_to_s.c"); }; status = -1 ; goto BYE; }; }
  if ( is_fldtype_goodfor_gpu(f1_rec.fldtype) == 0 ) { { { fprintf(stderr, "Line %3d of File %s \n", 47, "g_f_to_s.c"); }; status = -1 ; goto BYE; }; }
  if ( f1_rec.filesz == 0 ) { { { fprintf(stderr, "Line %3d of File %s \n", 49, "g_f_to_s.c"); }; status = -1 ; goto BYE; }; }
  if ( f1_rec.nR == 0 ) { { { fprintf(stderr, "Line %3d of File %s \n", 50, "g_f_to_s.c"); }; status = -1 ; goto BYE; }; }
  status = g_chk_f_to_s(f1_rec, str_op); { if ( (status) < 0 ) { { { fprintf(stderr, "Line %3d of File %s \n", 51, "g_f_to_s.c"); }; status = (status) ; goto BYE; } } };
  char url[2048]; zero_string(url, 2048);
  char command[1024]; zero_string(command, 1024);
  sprintf(command, "f_to_s d_fld1=%s op=%s ", f1, str_op);
  status = g_make_url(command, url); { if ( (status) < 0 ) { { { fprintf(stderr, "Line %3d of File %s \n", 56, "g_f_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", 57, "g_f_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: status int

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]

return_type: int

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


original_code:
void
hash_I8(
       unsigned long long *in,
       long long nR,
       unsigned long long seed,
       unsigned long long * restrict out
       )
{
  for ( long long i = 0; i < nR; i++ ) {
    *out = spooky_hash64(in, sizeof(long long), seed);
    in++;
    out++;
  }
}

canonical_original_code:
void hash_I8(unsigned long long *in, long long nR, unsigned long long seed, unsigned long long *out)
{
  for ( long long i = 0; i < nR; i++ ) {
    *out = spooky_hash64(in, sizeof(long long), seed);
    in++;
    out++;
  }
}

variable_types:
in
unsigned long long *

variable_types:
nR
long long

variable_types:
seed
unsigned long long

variable_types:
out
unsigned long long *

variable_types:
i
long long

return_type: void


original_code:
void
is_sorted_alldef_I8(
    long long *iX,
    long long nR,
    SORT_TYPE *ptr_is_sorted
    )
{
  long long first_val, second_val, prev_val, curr_val;
  SORT_TYPE sort_order;
  _Bool second_val_seen = 0;
  long long i = 0;
  if ( nR == 0 ) { *ptr_is_sorted = unknown; return; }
  if ( nR == 1 ) { *ptr_is_sorted = ascending; return; }
  first_val = iX[0];
  for ( i = 1; i < nR; i++ ) {
    if ( iX[i] != first_val ) {
      second_val = iX[i];
      second_val_seen = 1;
      break;
    }
  }
  if ( !second_val_seen ) { *ptr_is_sorted = ascending; return; }
  if ( first_val < second_val ) {
    sort_order = ascending;
  }
  else {
    sort_order = descending;
  }
  if ( i == nR ) { return; }
  prev_val = second_val;
  iX += i;
  nR -= i;
  for ( ; i < nR; i++ ) {
    curr_val = iX[i];
    switch ( sort_order ) {
      case ascending :
 if ( curr_val < prev_val ) { *ptr_is_sorted = unsorted; return; } break;
 if ( curr_val > prev_val ) { prev_val = curr_val; }
 break;
      case descending :
 if ( curr_val > prev_val ) { *ptr_is_sorted = unsorted; return; } break;
 if ( curr_val < prev_val ) { prev_val = curr_val; }
      default :
 exit(-1);
    }
    prev_val = curr_val;
  }
  *ptr_is_sorted = sort_order;
}

canonical_original_code:
void is_sorted_alldef_I8(long long *iX, long long nR, enum _SORT_TYPE *ptr_is_sorted)
{
  long long first_val; long long second_val; long long prev_val; long long curr_val;
  enum _SORT_TYPE sort_order;
  _Bool second_val_seen = 0;
  long long i = 0;
  if ( nR == 0 ) { *ptr_is_sorted = unknown; return; }
  if ( nR == 1 ) { *ptr_is_sorted = ascending; return; }
  first_val = iX[0];
  for ( i = 1; i < nR; i++ ) {
    if ( iX[i] != first_val ) {
      second_val = iX[i];
      second_val_seen = 1;
      break;
    }
  }
  if ( !second_val_seen ) { *ptr_is_sorted = ascending; return; }
  if ( first_val < second_val ) {
    sort_order = ascending;
  }
  else {
    sort_order = descending;
  }
  if ( i == nR ) { return; }
  prev_val = second_val;
  iX += i;
  nR -= i;
  for ( ; i < nR; i++ ) {
    curr_val = iX[i];
    switch ( sort_order ) {
      case ascending :
 if ( curr_val < prev_val ) { *ptr_is_sorted = unsorted; return; } break;
 if ( curr_val > prev_val ) { prev_val = curr_val; }
 break;
      case descending :
 if ( curr_val > prev_val ) { *ptr_is_sorted = unsorted; return; } break;
 if ( curr_val < prev_val ) { prev_val = curr_val; }
      default :
 exit(-1);
    }
    prev_val = curr_val;
  }
  *ptr_is_sorted = sort_order;
}

variable_types:
iX
long long *

variable_types: enum _SORT_TYPE { unknown=0, ascending=1, descending=2, unsorted=3 } *


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

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

variable_types:
n
long long

variable_types:
cnt
long long *

variable_types: idx char

variable_types: val int


decompiled_code:
__int64 __fastcall par_s_to_f(__int64 a1, __int64 a2, __int64 a3, __int64 a4)
{
int v8; // eax
unsigned int v9; // er12
__int64 v10; // rdx
int v12; // eax
__int64 v13; // rbx
__int64 v14; // rsi
__int64 v15; // rdi
__int64 v16; // rdx
__int64 v17; // rdx
__int64 v18; // rdx
char v19; // [rsp+2h] [rbp-B6h] BYREF
char v20; // [rsp+3h] [rbp-B5h] BYREF
char v21; // [rsp+4h] [rbp-B4h] BYREF
char v22; // [rsp+5h] [rbp-B3h] BYREF
__int16 v23; // [rsp+6h] [rbp-B2h] BYREF
__int16 v24; // [rsp+8h] [rbp-B0h] BYREF
__int16 v25; // [rsp+Ah] [rbp-AEh] BYREF
unsigned int v26; // [rsp+Ch] [rbp-ACh] BYREF
int v27; // [rsp+10h] [rbp-A8h] BYREF
unsigned int v28; // [rsp+14h] [rbp-A4h] BYREF
int v29; // [rsp+18h] [rbp-A0h] BYREF
int v30; // [rsp+1Ch] [rbp-9Ch] BYREF
__int64 v31; // [rsp+20h] [rbp-98h] BYREF
__int64 v32; // [rsp+28h] [rbp-90h] BYREF
__int64 v33; // [rsp+30h] [rbp-88h] BYREF
__int64 v34; // [rsp+38h] [rbp-80h] BYREF
int v35; // [rsp+40h] [rbp-78h] BYREF
__int16 v36; // [rsp+44h] [rbp-74h]
__int16 v37; // [rsp+60h] [rbp-58h] BYREF
char v38; // [rsp+62h] [rbp-56h]

v31 = 0x7FFFFFFFFFFFFFFFLL;
v26 = 0x7FFFFFFF;
v29 = 2139095039;
v22 = 1;
zero_string(&v35, 32LL);
zero_string(&v37, 32LL);
v8 = extract_S(a4, "op=[", &unk_BEB, &v35, 32LL, &v22);
if ( v8 < 0 )
{
v9 = v8;
fprintf(stderr, "Line %3d of File %s \n", 57LL, "./dir_helpers/par_s_to_f.c");
return v9;
}
if ( v22 )
{
v10 = 57LL;
goto LABEL_8;
}
v9 = extract_S(a4, "fldtype=[", &unk_BEB, &v37, 32LL, &v22);
if ( (v9 & 0x80000000) != 0 )
{
fprintf(stderr, "Line %3d of File %s \n", 60LL, "./dir_helpers/par_s_to_f.c");
return v9;
}
if ( v22 )
{
v10 = 60LL;
goto LABEL_8;
}
v9 = partition(a3 - a2, 1024LL, 0xFFFFFFFFLL, &v34, &v30);
if ( (v9 & 0x80000000) != 0 )
{
fprintf(stderr, "Line %3d of File %s \n", 61LL, "./dir_helpers/par_s_to_f.c");
return v9;
}
if ( v35 == 1936617315 && v36 == 116 )
{
if ( v37 == 12617 && !v38 )
{
v9 = extract_I1(a4, "val=[", &unk_BEB, &v19, &v22);
if ( (v9 & 0x80000000) != 0 )
{
fprintf(stderr, "Line %3d of File %s \n", 66LL, "./dir_helpers/par_s_to_f.c");
return v9;
}
if ( v22 )
{
fprintf(stderr, "Line %3d of File %s \n", 67LL, "./dir_helpers/par_s_to_f.c");
return v9;
}
goto LABEL_25;
}
if ( v37 == 12873 && !v38 )
{
v9 = extract_I2(a4, "val=[", &unk_BEB, &v23, &v22);
if ( (v9 & 0x80000000) != 0 )
{
fprintf(stderr, "Line %3d of File %s \n", 71LL, "./dir_helpers/par_s_to_f.c");
return v9;
}
if ( v22 )
{
fprintf(stderr, "Line %3d of File %s \n", 72LL, "./dir_helpers/par_s_to_f.c");
return v9;
}
goto LABEL_25;
}
if ( v37 == 13385 && !v38 )
{
v9 = extract_I4(a4, "val=[", &unk_BEB, &v26, &v22);
if ( (v9 & 0x80000000) != 0 )
{
fprintf(stderr, "Line %3d of File %s \n", 76LL, "./dir_helpers/par_s_to_f.c");
return v9;
}
if ( v22 )
{
fprintf(stderr, "Line %3d of File %s \n", 77LL, "./dir_helpers/par_s_to_f.c");
return v9;
}
goto LABEL_25;
}
if ( v37 == 13382 && !v38 )
{
v9 = extract_F4(a4, "val=[", &unk_BEB, &v29, &v22);
if ( (v9 & 0x80000000) != 0 )
{
fprintf(stderr, "Line %3d of File %s \n", 81LL, "./dir_helpers/par_s_to_f.c");
return v9;
}
if ( v22 )
{
fprintf(stderr, "Line %3d of File %s \n", 82LL, "./dir_helpers/par_s_to_f.c");
return v9;
}
goto LABEL_25;
}
if ( v37 == 14409 && !v38 )
{
v9 = extract_I8(a4, "val=[", &unk_BEB, &v31, &v22);
if ( (v9 & 0x80000000) != 0 )
{
fprintf(stderr, "Line %3d of File %s \n", 86LL, "./dir_helpers/par_s_to_f.c");
return v9;
}
if ( v22 )
{
fprintf(stderr, "Line %3d of File %s \n", 87LL, "./dir_helpers/par_s_to_f.c");
return v9;
}
goto LABEL_25;
}
v10 = 90LL;
LABEL_8:
v9 = -1;
fprintf(stderr, "Line %3d of File %s \n", v10, "./dir_helpers/par_s_to_f.c");
return v9;
}
v10 = 131LL;
if ( v35 != 7431539 )
goto LABEL_8;
if ( v37 == 12617 && !v38 )
{
v9 = extract_I1(a4, "start=[", &unk_BEB, &v20, &v22);
if ( (v9 & 0x80000000) != 0 )
{
fprintf(stderr, "Line %3d of File %s \n", 96LL, "./dir_helpers/par_s_to_f.c");
return v9;
}
if ( v22 )
{
fprintf(stderr, "Line %3d of File %s \n", 97LL, "./dir_helpers/par_s_to_f.c");
return v9;
}
v9 = extract_I1(a4, "incr=[", &unk_BEB, &v21, &v22);
if ( (v9 & 0x80000000) != 0 )
{
fprintf(stderr, "Line %3d of File %s \n", 99LL, "./dir_helpers/par_s_to_f.c");
return v9;
}
if ( v22 )
{
fprintf(stderr, "Line %3d of File %s \n", 100LL, "./dir_helpers/par_s_to_f.c");
return v9;
}
goto LABEL_25;
}
if ( v37 == 12873 && !v38 )
{
v9 = extract_I2(a4, "start=[", &unk_BEB, &v24, &v22);
if ( (v9 & 0x80000000) != 0 )
{
fprintf(stderr, "Line %3d of File %s \n", 104LL, "./dir_helpers/par_s_to_f.c");
return v9;
}
if ( v22 )
{
fprintf(stderr, "Line %3d of File %s \n", 105LL, "./dir_helpers/par_s_to_f.c");
return v9;
}
v9 = extract_I2(a4, "incr=[", &unk_BEB, &v25, &v22);
if ( (v9 & 0x80000000) != 0 )
{
fprintf(stderr, "Line %3d of File %s \n", 107LL, "./dir_helpers/par_s_to_f.c");
return v9;
}
if ( v22 )
{
fprintf(stderr, "Line %3d of File %s \n", 108LL, "./dir_helpers/par_s_to_f.c");
return v9;
}
goto LABEL_25;
}
if ( v37 == 13385 && !v38 )
{
v9 = extract_I4(a4, "start=[", &unk_BEB, &v27, &v22);
if ( (v9 & 0x80000000) != 0 )
{
fprintf(stderr, "Line %3d of File %s \n", 112LL, "./dir_helpers/par_s_to_f.c");
return v9;
}
if ( v22 )
{
fprintf(stderr, "Line %3d of File %s \n", 113LL, "./dir_helpers/par_s_to_f.c");
return v9;
}
v9 = extract_I4(a4, "incr=[", &unk_BEB, &v28, &v22);
if ( (v9 & 0x80000000) != 0 )
{
fprintf(stderr, "Line %3d of File %s \n", 115LL, "./dir_helpers/par_s_to_f.c");
return v9;
}
if ( v22 )
{
fprintf(stderr, "Line %3d of File %s \n", 116LL, "./dir_helpers/par_s_to_f.c");
return v9;
}
goto LABEL_25;
}
if ( v37 != 14409 || v38 )
{
v10 = 127LL;
goto LABEL_8;
}
v9 = extract_I8(a4, "start=[", &unk_BEB, &v32, &v22);
if ( (v9 & 0x80000000) != 0 )
{
fprintf(stderr, "Line %3d of File %s \n", 120LL, "./dir_helpers/par_s_to_f.c");
return v9;
}
if ( v22 )
{
fprintf(stderr, "Line %3d of File %s \n", 121LL, "./dir_helpers/par_s_to_f.c");
return v9;
}
v9 = extract_I8(a4, "incr=[", &unk_BEB, &v33, &v22);
if ( (v9 & 0x80000000) != 0 )
{
fprintf(stderr, "Line %3d of File %s \n", 123LL, "./dir_helpers/par_s_to_f.c");
return v9;
}
if ( v22 )
{
fprintf(stderr, "Line %3d of File %s \n", 124LL, "./dir_helpers/par_s_to_f.c");
return v9;
}
LABEL_25:
v12 = v30;
v13 = 0LL;
if ( v30 <= 0 )
return v9;
do
{
while ( 1 )
{
v14 = v34;
v15 = a2 + v34 * v13;
if ( v12 - 1 == (_DWORD)v13 )
v14 = a3 - v15;
if ( v35 == 1936617315 && v36 == 116 )
break;
if ( v35 == 7431539 )
{
if ( v37 != 12617 || v38 )
{
if ( v37 != 12873 || v38 )
{
if ( v37 != 13385 || v38 )
{
if ( v37 == 14409 && !v38 )
{
s_to_f_seq_I8(a1 + 8 * v15, v14, v32 + v15 * v33);
v12 = v30;
}
goto LABEL_29;
}
v18 = v27 + v15 * (int)v28;
if ( v18 < 0x80000000LL )
{
s_to_f_seq_I4(a1 + 4 * v15, v14, v18, v28);
v12 = v30;
goto LABEL_29;
}
}
else
{
v17 = v24 + v15 * v25;
if ( v17 <= 0x7FFF )
{
s_to_f_seq_I2(a1 + 2 * v15, v14, (unsigned int)(__int16)v17, (unsigned int)v25);
v12 = v30;
goto LABEL_29;
}
}
}
else
{
v16 = v20 + v15 * v21;
if ( v16 <= 127 )
{
s_to_f_seq_I1(a1 + v15, v14, (unsigned int)(char)v16, (unsigned int)v21);
v12 = v30;
goto LABEL_29;
}
}
}
v9 = -1;
LABEL_29:
if ( v12 <= (int)++v13 )
goto LABEL_49;
}
if ( v37 != 12617 || v38 )
{
if ( v37 != 12873 || v38 )
{
if ( v37 != 13385 || v38 )
{
if ( v37 != 13382 || v38 )
{
if ( v37 == 14409 && !v38 )
{
s_to_f_const_I8(a1 + 8 * v15, v14, v31);
v12 = v30;
}
}
else
{
s_to_f_const_F4(a1 + 4 * v15, v14, *(float *)&v29);
v12 = v30;
}
}
else
{
s_to_f_const_I4(a1 + 4 * v15, v14, v26);
v12 = v30;
}
}
else
{
s_to_f_const_I2(a1 + 2 * v15, v14, (unsigned int)v23);
v12 = v30;
}
goto LABEL_29;
}
++v13;
s_to_f_const_I1(a1 + v15, v14, (unsigned int)v19);
v12 = v30;
}
while ( v30 > (int)v13 );
LABEL_49:
if ( v9 == -1 )
fprintf(stderr, "Line %3d of File %s \n", 187LL, "./dir_helpers/par_s_to_f.c");
return v9;
}

canonical_decompiled_code:
__int64 __fastcall func0(__int64 a1, __int64 a2, __int64 a3, __int64 a4)
{
int v8; // eax
unsigned int v9; // er12
__int64 v10; // rdx
int v12; // eax
__int64 v13; // rbx
__int64 v14; // rsi
__int64 v15; // rdi
__int64 v16; // rdx
__int64 v17; // rdx
__int64 v18; // rdx
char v19; // [rsp+2h] [rbp-B6h] BYREF
char v20; // [rsp+3h] [rbp-B5h] BYREF
char v21; // [rsp+4h] [rbp-B4h] BYREF
char v22; // [rsp+5h] [rbp-B3h] BYREF
__int16 v23; // [rsp+6h] [rbp-B2h] BYREF
__int16 v24; // [rsp+8h] [rbp-B0h] BYREF
__int16 v25; // [rsp+Ah] [rbp-AEh] BYREF
unsigned int v26; // [rsp+Ch] [rbp-ACh] BYREF
int v27; // [rsp+10h] [rbp-A8h] BYREF
unsigned int v28; // [rsp+14h] [rbp-A4h] BYREF
int v29; // [rsp+18h] [rbp-A0h] BYREF
int v30; // [rsp+1Ch] [rbp-9Ch] BYREF
__int64 v31; // [rsp+20h] [rbp-98h] BYREF
__int64 v32; // [rsp+28h] [rbp-90h] BYREF
__int64 v33; // [rsp+30h] [rbp-88h] BYREF
__int64 v34; // [rsp+38h] [rbp-80h] BYREF
int v35; // [rsp+40h] [rbp-78h] BYREF
__int16 v36; // [rsp+44h] [rbp-74h]
__int16 v37; // [rsp+60h] [rbp-58h] BYREF
char v38; // [rsp+62h] [rbp-56h]

v31 = 0x7FFFFFFFFFFFFFFFLL;
v26 = 0x7FFFFFFF;
v29 = 2139095039;
v22 = 1;
zero_string(&v35, 32LL);
zero_string(&v37, 32LL);
v8 = extract_S(a4, "op=[", &unk_BEB, &v35, 32LL, &v22);
if ( v8 < 0 )
{
v9 = v8;
fprintf(stderr, "Line %3d of File %s \n", 57LL, "./dir_helpers/par_s_to_f.c");
return v9;
}
if ( v22 )
{
v10 = 57LL;
goto LABEL_8;
}
v9 = extract_S(a4, "fldtype=[", &unk_BEB, &v37, 32LL, &v22);
if ( (v9 & 0x80000000) != 0 )
{
fprintf(stderr, "Line %3d of File %s \n", 60LL, "./dir_helpers/par_s_to_f.c");
return v9;
}
if ( v22 )
{
v10 = 60LL;
goto LABEL_8;
}
v9 = partition(a3 - a2, 1024LL, 0xFFFFFFFFLL, &v34, &v30);
if ( (v9 & 0x80000000) != 0 )
{
fprintf(stderr, "Line %3d of File %s \n", 61LL, "./dir_helpers/par_s_to_f.c");
return v9;
}
if ( v35 == 1936617315 && v36 == 116 )
{
if ( v37 == 12617 && !v38 )
{
v9 = extract_I1(a4, "val=[", &unk_BEB, &v19, &v22);
if ( (v9 & 0x80000000) != 0 )
{
fprintf(stderr, "Line %3d of File %s \n", 66LL, "./dir_helpers/par_s_to_f.c");
return v9;
}
if ( v22 )
{
fprintf(stderr, "Line %3d of File %s \n", 67LL, "./dir_helpers/par_s_to_f.c");
return v9;
}
goto LABEL_25;
}
if ( v37 == 12873 && !v38 )
{
v9 = extract_I2(a4, "val=[", &unk_BEB, &v23, &v22);
if ( (v9 & 0x80000000) != 0 )
{
fprintf(stderr, "Line %3d of File %s \n", 71LL, "./dir_helpers/par_s_to_f.c");
return v9;
}
if ( v22 )
{
fprintf(stderr, "Line %3d of File %s \n", 72LL, "./dir_helpers/par_s_to_f.c");
return v9;
}
goto LABEL_25;
}
if ( v37 == 13385 && !v38 )
{
v9 = extract_I4(a4, "val=[", &unk_BEB, &v26, &v22);
if ( (v9 & 0x80000000) != 0 )
{
fprintf(stderr, "Line %3d of File %s \n", 76LL, "./dir_helpers/par_s_to_f.c");
return v9;
}
if ( v22 )
{
fprintf(stderr, "Line %3d of File %s \n", 77LL, "./dir_helpers/par_s_to_f.c");
return v9;
}
goto LABEL_25;
}
if ( v37 == 13382 && !v38 )
{
v9 = extract_F4(a4, "val=[", &unk_BEB, &v29, &v22);
if ( (v9 & 0x80000000) != 0 )
{
fprintf(stderr, "Line %3d of File %s \n", 81LL, "./dir_helpers/par_s_to_f.c");
return v9;
}
if ( v22 )
{
fprintf(stderr, "Line %3d of File %s \n", 82LL, "./dir_helpers/par_s_to_f.c");
return v9;
}
goto LABEL_25;
}
if ( v37 == 14409 && !v38 )
{
v9 = extract_I8(a4, "val=[", &unk_BEB, &v31, &v22);
if ( (v9 & 0x80000000) != 0 )
{
fprintf(stderr, "Line %3d of File %s \n", 86LL, "./dir_helpers/par_s_to_f.c");
return v9;
}
if ( v22 )
{
fprintf(stderr, "Line %3d of File %s \n", 87LL, "./dir_helpers/par_s_to_f.c");
return v9;
}
goto LABEL_25;
}
v10 = 90LL;
LABEL_8:
v9 = -1;
fprintf(stderr, "Line %3d of File %s \n", v10, "./dir_helpers/par_s_to_f.c");
return v9;
}
v10 = 131LL;
if ( v35 != 7431539 )
goto LABEL_8;
if ( v37 == 12617 && !v38 )
{
v9 = extract_I1(a4, "start=[", &unk_BEB, &v20, &v22);
if ( (v9 & 0x80000000) != 0 )
{
fprintf(stderr, "Line %3d of File %s \n", 96LL, "./dir_helpers/par_s_to_f.c");
return v9;
}
if ( v22 )
{
fprintf(stderr, "Line %3d of File %s \n", 97LL, "./dir_helpers/par_s_to_f.c");
return v9;
}
v9 = extract_I1(a4, "incr=[", &unk_BEB, &v21, &v22);
if ( (v9 & 0x80000000) != 0 )
{
fprintf(stderr, "Line %3d of File %s \n", 99LL, "./dir_helpers/par_s_to_f.c");
return v9;
}
if ( v22 )
{
fprintf(stderr, "Line %3d of File %s \n", 100LL, "./dir_helpers/par_s_to_f.c");
return v9;
}
goto LABEL_25;
}
if ( v37 == 12873 && !v38 )
{
v9 = extract_I2(a4, "start=[", &unk_BEB, &v24, &v22);
if ( (v9 & 0x80000000) != 0 )
{
fprintf(stderr, "Line %3d of File %s \n", 104LL, "./dir_helpers/par_s_to_f.c");
return v9;
}
if ( v22 )
{
fprintf(stderr, "Line %3d of File %s \n", 105LL, "./dir_helpers/par_s_to_f.c");
return v9;
}
v9 = extract_I2(a4, "incr=[", &unk_BEB, &v25, &v22);
if ( (v9 & 0x80000000) != 0 )
{
fprintf(stderr, "Line %3d of File %s \n", 107LL, "./dir_helpers/par_s_to_f.c");
return v9;
}
if ( v22 )
{
fprintf(stderr, "Line %3d of File %s \n", 108LL, "./dir_helpers/par_s_to_f.c");
return v9;
}
goto LABEL_25;
}
if ( v37 == 13385 && !v38 )
{
v9 = extract_I4(a4, "start=[", &unk_BEB, &v27, &v22);
if ( (v9 & 0x80000000) != 0 )
{
fprintf(stderr, "Line %3d of File %s \n", 112LL, "./dir_helpers/par_s_to_f.c");
return v9;
}
if ( v22 )
{
fprintf(stderr, "Line %3d of File %s \n", 113LL, "./dir_helpers/par_s_to_f.c");
return v9;
}
v9 = extract_I4(a4, "incr=[", &unk_BEB, &v28, &v22);
if ( (v9 & 0x80000000) != 0 )
{
fprintf(stderr, "Line %3d of File %s \n", 115LL, "./dir_helpers/par_s_to_f.c");
return v9;
}
if ( v22 )
{
fprintf(stderr, "Line %3d of File %s \n", 116LL, "./dir_helpers/par_s_to_f.c");
return v9;
}
goto LABEL_25;
}
if ( v37 != 14409 || v38 )
{
v10 = 127LL;
goto LABEL_8;
}
v9 = extract_I8(a4, "start=[", &unk_BEB, &v32, &v22);
if ( (v9 & 0x80000000) != 0 )
{
fprintf(stderr, "Line %3d of File %s \n", 120LL, "./dir_helpers/par_s_to_f.c");
return v9;
}
if ( v22 )
{
fprintf(stderr, "Line %3d of File %s \n", 121LL, "./dir_helpers/par_s_to_f.c");
return v9;
}
v9 = extract_I8(a4, "incr=[", &unk_BEB, &v33, &v22);
if ( (v9 & 0x80000000) != 0 )
{
fprintf(stderr, "Line %3d of File %s \n", 123LL, "./dir_helpers/par_s_to_f.c");
return v9;
}
if ( v22 )
{
fprintf(stderr, "Line %3d of File %s \n", 124LL, "./dir_helpers/par_s_to_f.c");
return v9;
}
LABEL_25:
v12 = v30;
v13 = 0LL;
if ( v30 <= 0 )
return v9;
do
{
while ( 1 )
{
v14 = v34;
v15 = a2 + v34 * v13;
if ( v12 - 1 == (_DWORD)v13 )
v14 = a3 - v15;
if ( v35 == 1936617315 && v36 == 116 )
break;
if ( v35 == 7431539 )
{
if ( v37 != 12617 || v38 )
{
if ( v37 != 12873 || v38 )
{
if ( v37 != 13385 || v38 )
{
if ( v37 == 14409 && !v38 )
{
s_to_f_seq_I8(a1 + 8 * v15, v14, v32 + v15 * v33);
v12 = v30;
}
goto LABEL_29;
}
v18 = v27 + v15 * (int)v28;
if ( v18 < 0x80000000LL )
{
s_to_f_seq_I4(a1 + 4 * v15, v14, v18, v28);
v12 = v30;
goto LABEL_29;
}
}
else
{
v17 = v24 + v15 * v25;
if ( v17 <= 0x7FFF )
{
s_to_f_seq_I2(a1 + 2 * v15, v14, (unsigned int)(__int16)v17, (unsigned int)v25);
v12 = v30;
goto LABEL_29;
}
}
}
else
{
v16 = v20 + v15 * v21;
if ( v16 <= 127 )
{
s_to_f_seq_I1(a1 + v15, v14, (unsigned int)(char)v16, (unsigned int)v21);
v12 = v30;
goto LABEL_29;
}
}
}
v9 = -1;
LABEL_29:
if ( v12 <= (int)++v13 )
goto LABEL_49;
}
if ( v37 != 12617 || v38 )
{
if ( v37 != 12873 || v38 )
{
if ( v37 != 13385 || v38 )
{
if ( v37 != 13382 || v38 )
{
if ( v37 == 14409 && !v38 )
{
s_to_f_const_I8(a1 + 8 * v15, v14, v31);
v12 = v30;
}
}
else
{
s_to_f_const_F4(a1 + 4 * v15, v14, *(float *)&v29);
v12 = v30;
}
}
else
{
s_to_f_const_I4(a1 + 4 * v15, v14, v26);
v12 = v30;
}
}
else
{
s_to_f_const_I2(a1 + 2 * v15, v14, (unsigned int)v23);
v12 = v30;
}
goto LABEL_29;
}
++v13;
s_to_f_const_I1(a1 + v15, v14, (unsigned int)v19);
v12 = v30;
}
while ( v30 > (int)v13 );
LABEL_49:
if ( v9 == -1 )
fprintf(stderr, "Line %3d of File %s \n", 187LL, "./dir_helpers/par_s_to_f.c");
return v9;
}

original_code:
int
par_s_to_f(
    char *X,
    long long in_lb,
    long long in_ub,
    const char *str_scalar
    )
{
  int status = 0;
  int val4 = 0x7fffffff, start4, incr4;
  long long val8 = 0x7fffffffffffffffLL, start8, incr8;
  float valF4 = 3.40282346638528859811704183484516925e+38F;
  char val1, start1, incr1;
  short val2, start2, incr2;
  char op[32];
  char fldtype[32];
  _Bool is_null = 1;
  int nT; long long block_size;
  zero_string(op, 32);
  zero_string(fldtype, 32);
  status = extract_S(str_scalar, "op=[", "]", op, 32, &is_null);
  { if ( (status) < 0 ) { { { fprintf(stderr, "Line %3d of File %s \n", 57, "./dir_helpers/par_s_to_f.c"); }; status = (status) ; goto BYE; } } }; if ( is_null ) { { { fprintf(stderr, "Line %3d of File %s \n", 57, "./dir_helpers/par_s_to_f.c"); }; status = -1 ; goto BYE; }; }
  status = extract_S(str_scalar, "fldtype=[", "]", fldtype, 32, &is_null);
  { if ( (status) < 0 ) { { { fprintf(stderr, "Line %3d of File %s \n", 60, "./dir_helpers/par_s_to_f.c"); }; status = (status) ; goto BYE; } } }; if ( is_null ) { { { fprintf(stderr, "Line %3d of File %s \n", 60, "./dir_helpers/par_s_to_f.c"); }; status = -1 ; goto BYE; }; }
  status = partition((in_ub - in_lb), 1024, -1, &block_size, &nT); { if ( (status) < 0 ) { { { fprintf(stderr, "Line %3d of File %s \n", 61, "./dir_helpers/par_s_to_f.c"); }; status = (status) ; goto BYE; } } };
  if ( strcmp(op, "const") == 0 ) {
    if ( strcmp(fldtype, "I1") == 0 ) {
      status = extract_I1(str_scalar, "val=[", "]", &val1, &is_null);
      { if ( (status) < 0 ) { { { fprintf(stderr, "Line %3d of File %s \n", 66, "./dir_helpers/par_s_to_f.c"); }; status = (status) ; goto BYE; } } };
      if ( is_null ) { { { fprintf(stderr, "Line %3d of File %s \n", 67, "./dir_helpers/par_s_to_f.c"); }; status = status ; goto BYE; }; }
    }
    else if ( strcmp(fldtype, "I2") == 0 ) {
      status = extract_I2(str_scalar, "val=[", "]", &val2, &is_null);
      { if ( (status) < 0 ) { { { fprintf(stderr, "Line %3d of File %s \n", 71, "./dir_helpers/par_s_to_f.c"); }; status = (status) ; goto BYE; } } };
      if ( is_null ) { { { fprintf(stderr, "Line %3d of File %s \n", 72, "./dir_helpers/par_s_to_f.c"); }; status = status ; goto BYE; }; }
    }
    else if ( strcmp(fldtype, "I4") == 0 ) {
      status = extract_I4(str_scalar, "val=[", "]", &val4, &is_null);
      { if ( (status) < 0 ) { { { fprintf(stderr, "Line %3d of File %s \n", 76, "./dir_helpers/par_s_to_f.c"); }; status = (status) ; goto BYE; } } };
      if ( is_null ) { { { fprintf(stderr, "Line %3d of File %s \n", 77, "./dir_helpers/par_s_to_f.c"); }; status = status ; goto BYE; }; }
    }
    else if ( strcmp(fldtype, "F4") == 0 ) {
      status = extract_F4(str_scalar, "val=[", "]", &valF4, &is_null);
      { if ( (status) < 0 ) { { { fprintf(stderr, "Line %3d of File %s \n", 81, "./dir_helpers/par_s_to_f.c"); }; status = (status) ; goto BYE; } } };
      if ( is_null ) { { { fprintf(stderr, "Line %3d of File %s \n", 82, "./dir_helpers/par_s_to_f.c"); }; status = status ; goto BYE; }; }
    }
    else if ( strcmp(fldtype, "I8") == 0 ) {
      status = extract_I8(str_scalar, "val=[", "]", &val8, &is_null);
      { if ( (status) < 0 ) { { { fprintf(stderr, "Line %3d of File %s \n", 86, "./dir_helpers/par_s_to_f.c"); }; status = (status) ; goto BYE; } } };
      if ( is_null ) { { { fprintf(stderr, "Line %3d of File %s \n", 87, "./dir_helpers/par_s_to_f.c"); }; status = status ; goto BYE; }; }
    }
    else {
      { { fprintf(stderr, "Line %3d of File %s \n", 90, "./dir_helpers/par_s_to_f.c"); }; status = -1 ; goto BYE; };
    }
  }
  else if ( strcmp(op, "seq") == 0 ) {
    if ( strcmp(fldtype, "I1") == 0 ) {
      status = extract_I1(str_scalar, "start=[", "]", &start1, &is_null);
      { if ( (status) < 0 ) { { { fprintf(stderr, "Line %3d of File %s \n", 96, "./dir_helpers/par_s_to_f.c"); }; status = (status) ; goto BYE; } } };
      if ( is_null ) { { { fprintf(stderr, "Line %3d of File %s \n", 97, "./dir_helpers/par_s_to_f.c"); }; status = status ; goto BYE; }; }
      status = extract_I1(str_scalar, "incr=[", "]", &incr1, &is_null);
      { if ( (status) < 0 ) { { { fprintf(stderr, "Line %3d of File %s \n", 99, "./dir_helpers/par_s_to_f.c"); }; status = (status) ; goto BYE; } } };
      if ( is_null ) { { { fprintf(stderr, "Line %3d of File %s \n", 100, "./dir_helpers/par_s_to_f.c"); }; status = status ; goto BYE; }; }
    }
    else if ( strcmp(fldtype, "I2") == 0 ) {
      status = extract_I2(str_scalar, "start=[", "]", &start2, &is_null);
      { if ( (status) < 0 ) { { { fprintf(stderr, "Line %3d of File %s \n", 104, "./dir_helpers/par_s_to_f.c"); }; status = (status) ; goto BYE; } } };
      if ( is_null ) { { { fprintf(stderr, "Line %3d of File %s \n", 105, "./dir_helpers/par_s_to_f.c"); }; status = status ; goto BYE; }; }
      status = extract_I2(str_scalar, "incr=[", "]", &incr2, &is_null);
      { if ( (status) < 0 ) { { { fprintf(stderr, "Line %3d of File %s \n", 107, "./dir_helpers/par_s_to_f.c"); }; status = (status) ; goto BYE; } } };
      if ( is_null ) { { { fprintf(stderr, "Line %3d of File %s \n", 108, "./dir_helpers/par_s_to_f.c"); }; status = status ; goto BYE; }; }
    }
    else if ( strcmp(fldtype, "I4") == 0 ) {
      status = extract_I4(str_scalar, "start=[", "]", &start4, &is_null);
      { if ( (status) < 0 ) { { { fprintf(stderr, "Line %3d of File %s \n", 112, "./dir_helpers/par_s_to_f.c"); }; status = (status) ; goto BYE; } } };
      if ( is_null ) { { { fprintf(stderr, "Line %3d of File %s \n", 113, "./dir_helpers/par_s_to_f.c"); }; status = status ; goto BYE; }; }
      status = extract_I4(str_scalar, "incr=[", "]", &incr4, &is_null);
      { if ( (status) < 0 ) { { { fprintf(stderr, "Line %3d of File %s \n", 115, "./dir_helpers/par_s_to_f.c"); }; status = (status) ; goto BYE; } } };
      if ( is_null ) { { { fprintf(stderr, "Line %3d of File %s \n", 116, "./dir_helpers/par_s_to_f.c"); }; status = status ; goto BYE; }; }
    }
    else if ( strcmp(fldtype, "I8") == 0 ) {
      status = extract_I8(str_scalar, "start=[", "]", &start8, &is_null);
      { if ( (status) < 0 ) { { { fprintf(stderr, "Line %3d of File %s \n", 120, "./dir_helpers/par_s_to_f.c"); }; status = (status) ; goto BYE; } } };
      if ( is_null ) { { { fprintf(stderr, "Line %3d of File %s \n", 121, "./dir_helpers/par_s_to_f.c"); }; status = status ; goto BYE; }; }
      status = extract_I8(str_scalar, "incr=[", "]", &incr8, &is_null);
      { if ( (status) < 0 ) { { { fprintf(stderr, "Line %3d of File %s \n", 123, "./dir_helpers/par_s_to_f.c"); }; status = (status) ; goto BYE; } } };
      if ( is_null ) { { { fprintf(stderr, "Line %3d of File %s \n", 124, "./dir_helpers/par_s_to_f.c"); }; status = status ; goto BYE; }; }
    }
    else {
      { { fprintf(stderr, "Line %3d of File %s \n", 127, "./dir_helpers/par_s_to_f.c"); }; status = -1 ; goto BYE; };
    }
  }
  else {
    { { fprintf(stderr, "Line %3d of File %s \n", 131, "./dir_helpers/par_s_to_f.c"); }; status = -1 ; goto BYE; };
  }
  for ( int tid = 0; tid < nT; tid++ ) {
    long long lb = in_lb + (tid * block_size);
    long long ub = lb + block_size;
    if ( tid == (nT-1) ) { ub = in_ub; }
    long long nX = (ub -lb);
    if ( strcmp(op, "const") == 0 ) {
      if ( strcmp(fldtype, "I1") == 0 ) {
 char *XI1 = (char *)X; XI1 += lb;
 s_to_f_const_I1(XI1, nX, val1);
      }
      else if ( strcmp(fldtype, "I2") == 0 ) {
 short *XI2 = (short *)X; XI2 += lb;
 s_to_f_const_I2(XI2, nX, val2);
      }
      else if ( strcmp(fldtype, "I4") == 0 ) {
 int *XI4 = (int *)X; XI4 += lb;
 s_to_f_const_I4(XI4, nX, val4);
      }
      else if ( strcmp(fldtype, "F4") == 0 ) {
 float *XF4 = (float *)X; XF4 += lb;
 s_to_f_const_F4(XF4, nX, valF4);
      }
      else if ( strcmp(fldtype, "I8") == 0 ) {
 long long *XI8 = (long long *) X; XI8 += lb;
 s_to_f_const_I8(XI8, nX, val8);
      }
    }
    else if ( strcmp(op, "seq") == 0 ) {
      if ( strcmp(fldtype, "I1") == 0 ) {
        long long l_start = start1 + (lb * incr1);
 if ( l_start > 0x7f ) { status = -1; continue; }
 s_to_f_seq_I1(((char *)X)+lb, nX, (char)l_start, incr1);
      }
      else if ( strcmp(fldtype, "I2") == 0 ) {
        long long l_start = start2 + (lb * incr2);
 if ( l_start > 0x7fff ) { status = -1; continue; }
 s_to_f_seq_I2(((short *)X)+lb, nX, (short)l_start, incr2);
      }
      else if ( strcmp(fldtype, "I4") == 0 ) {
        long long l_start = start4 + (lb * incr4);
 if ( l_start > 0x7fffffff ) { status = -1; continue; }
 s_to_f_seq_I4(((int *)X)+lb, nX, (int)l_start, incr4);
      }
      else if ( strcmp(fldtype, "I8") == 0 ) {
        long long l_start = start8 + (lb * incr8);
 s_to_f_seq_I8(((long long *)X)+lb, nX, (long long)l_start, incr8);
      }
    }
    else {
      status = -1; continue;
    }
  }
  { if ( (status) < 0 ) { { { fprintf(stderr, "Line %3d of File %s \n", 187, "./dir_helpers/par_s_to_f.c"); }; status = (status) ; goto BYE; } } };
 BYE:
  return(status);
}

canonical_original_code:
int par_s_to_f(char *X, long long in_lb, long long in_ub, char *str_scalar)
{
  int status = 0;
  int val4 = 0x7fffffff; int start4; int incr4;
  long long val8 = 0x7fffffffffffffffLL; long long start8; long long incr8;
  float valF4 = 3.40282346638528859811704183484516925e+38F;
  char val1; char start1; char incr1;
  short val2; short start2; short incr2;
  char op[32];
  char fldtype[32];
  _Bool is_null = 1;
  int nT; long long block_size;
  zero_string(op, 32);
  zero_string(fldtype, 32);
  status = extract_S(str_scalar, "op=[", "]", op, 32, &is_null);
  { if ( (status) < 0 ) { { { fprintf(stderr, "Line %3d of File %s \n", 57, "./dir_helpers/par_s_to_f.c"); }; status = (status) ; goto BYE; } } }; if ( is_null ) { { { fprintf(stderr, "Line %3d of File %s \n", 57, "./dir_helpers/par_s_to_f.c"); }; status = -1 ; goto BYE; }; }
  status = extract_S(str_scalar, "fldtype=[", "]", fldtype, 32, &is_null);
  { if ( (status) < 0 ) { { { fprintf(stderr, "Line %3d of File %s \n", 60, "./dir_helpers/par_s_to_f.c"); }; status = (status) ; goto BYE; } } }; if ( is_null ) { { { fprintf(stderr, "Line %3d of File %s \n", 60, "./dir_helpers/par_s_to_f.c"); }; status = -1 ; goto BYE; }; }
  status = partition((in_ub - in_lb), 1024, -1, &block_size, &nT); { if ( (status) < 0 ) { { { fprintf(stderr, "Line %3d of File %s \n", 61, "./dir_helpers/par_s_to_f.c"); }; status = (status) ; goto BYE; } } };
  if ( strcmp(op, "const") == 0 ) {
    if ( strcmp(fldtype, "I1") == 0 ) {
      status = extract_I1(str_scalar, "val=[", "]", &val1, &is_null);
      { if ( (status) < 0 ) { { { fprintf(stderr, "Line %3d of File %s \n", 66, "./dir_helpers/par_s_to_f.c"); }; status = (status) ; goto BYE; } } };
      if ( is_null ) { { { fprintf(stderr, "Line %3d of File %s \n", 67, "./dir_helpers/par_s_to_f.c"); }; status = status ; goto BYE; }; }
    }
    else if ( strcmp(fldtype, "I2") == 0 ) {
      status = extract_I2(str_scalar, "val=[", "]", &val2, &is_null);
      { if ( (status) < 0 ) { { { fprintf(stderr, "Line %3d of File %s \n", 71, "./dir_helpers/par_s_to_f.c"); }; status = (status) ; goto BYE; } } };
      if ( is_null ) { { { fprintf(stderr, "Line %3d of File %s \n", 72, "./dir_helpers/par_s_to_f.c"); }; status = status ; goto BYE; }; }
    }
    else if ( strcmp(fldtype, "I4") == 0 ) {
      status = extract_I4(str_scalar, "val=[", "]", &val4, &is_null);
      { if ( (status) < 0 ) { { { fprintf(stderr, "Line %3d of File %s \n", 76, "./dir_helpers/par_s_to_f.c"); }; status = (status) ; goto BYE; } } };
      if ( is_null ) { { { fprintf(stderr, "Line %3d of File %s \n", 77, "./dir_helpers/par_s_to_f.c"); }; status = status ; goto BYE; }; }
    }
    else if ( strcmp(fldtype, "F4") == 0 ) {
      status = extract_F4(str_scalar, "val=[", "]", &valF4, &is_null);
      { if ( (status) < 0 ) { { { fprintf(stderr, "Line %3d of File %s \n", 81, "./dir_helpers/par_s_to_f.c"); }; status = (status) ; goto BYE; } } };
      if ( is_null ) { { { fprintf(stderr, "Line %3d of File %s \n", 82, "./dir_helpers/par_s_to_f.c"); }; status = status ; goto BYE; }; }
    }
    else if ( strcmp(fldtype, "I8") == 0 ) {
      status = extract_I8(str_scalar, "val=[", "]", &val8, &is_null);
      { if ( (status) < 0 ) { { { fprintf(stderr, "Line %3d of File %s \n", 86, "./dir_helpers/par_s_to_f.c"); }; status = (status) ; goto BYE; } } };
      if ( is_null ) { { { fprintf(stderr, "Line %3d of File %s \n", 87, "./dir_helpers/par_s_to_f.c"); }; status = status ; goto BYE; }; }
    }
    else {
      { { fprintf(stderr, "Line %3d of File %s \n", 90, "./dir_helpers/par_s_to_f.c"); }; status = -1 ; goto BYE; };
    }
  }
  else if ( strcmp(op, "seq") == 0 ) {
    if ( strcmp(fldtype, "I1") == 0 ) {
      status = extract_I1(str_scalar, "start=[", "]", &start1, &is_null);
      { if ( (status) < 0 ) { { { fprintf(stderr, "Line %3d of File %s \n", 96, "./dir_helpers/par_s_to_f.c"); }; status = (status) ; goto BYE; } } };
      if ( is_null ) { { { fprintf(stderr, "Line %3d of File %s \n", 97, "./dir_helpers/par_s_to_f.c"); }; status = status ; goto BYE; }; }
      status = extract_I1(str_scalar, "incr=[", "]", &incr1, &is_null);
      { if ( (status) < 0 ) { { { fprintf(stderr, "Line %3d of File %s \n", 99, "./dir_helpers/par_s_to_f.c"); }; status = (status) ; goto BYE; } } };
      if ( is_null ) { { { fprintf(stderr, "Line %3d of File %s \n", 100, "./dir_helpers/par_s_to_f.c"); }; status = status ; goto BYE; }; }
    }
    else if ( strcmp(fldtype, "I2") == 0 ) {
      status = extract_I2(str_scalar, "start=[", "]", &start2, &is_null);
      { if ( (status) < 0 ) { { { fprintf(stderr, "Line %3d of File %s \n", 104, "./dir_helpers/par_s_to_f.c"); }; status = (status) ; goto BYE; } } };
      if ( is_null ) { { { fprintf(stderr, "Line %3d of File %s \n", 105, "./dir_helpers/par_s_to_f.c"); }; status = status ; goto BYE; }; }
      status = extract_I2(str_scalar, "incr=[", "]", &incr2, &is_null);
      { if ( (status) < 0 ) { { { fprintf(stderr, "Line %3d of File %s \n", 107, "./dir_helpers/par_s_to_f.c"); }; status = (status) ; goto BYE; } } };
      if ( is_null ) { { { fprintf(stderr, "Line %3d of File %s \n", 108, "./dir_helpers/par_s_to_f.c"); }; status = status ; goto BYE; }; }
    }
    else if ( strcmp(fldtype, "I4") == 0 ) {
      status = extract_I4(str_scalar, "start=[", "]", &start4, &is_null);
      { if ( (status) < 0 ) { { { fprintf(stderr, "Line %3d of File %s \n", 112, "./dir_helpers/par_s_to_f.c"); }; status = (status) ; goto BYE; } } };
      if ( is_null ) { { { fprintf(stderr, "Line %3d of File %s \n", 113, "./dir_helpers/par_s_to_f.c"); }; status = status ; goto BYE; }; }
      status = extract_I4(str_scalar, "incr=[", "]", &incr4, &is_null);
      { if ( (status) < 0 ) { { { fprintf(stderr, "Line %3d of File %s \n", 115, "./dir_helpers/par_s_to_f.c"); }; status = (status) ; goto BYE; } } };
      if ( is_null ) { { { fprintf(stderr, "Line %3d of File %s \n", 116, "./dir_helpers/par_s_to_f.c"); }; status = status ; goto BYE; }; }
    }
    else if ( strcmp(fldtype, "I8") == 0 ) {
      status = extract_I8(str_scalar, "start=[", "]", &start8, &is_null);
      { if ( (status) < 0 ) { { { fprintf(stderr, "Line %3d of File %s \n", 120, "./dir_helpers/par_s_to_f.c"); }; status = (status) ; goto BYE; } } };
      if ( is_null ) { { { fprintf(stderr, "Line %3d of File %s \n", 121, "./dir_helpers/par_s_to_f.c"); }; status = status ; goto BYE; }; }
      status = extract_I8(str_scalar, "incr=[", "]", &incr8, &is_null);
      { if ( (status) < 0 ) { { { fprintf(stderr, "Line %3d of File %s \n", 123, "./dir_helpers/par_s_to_f.c"); }; status = (status) ; goto BYE; } } };
      if ( is_null ) { { { fprintf(stderr, "Line %3d of File %s \n", 124, "./dir_helpers/par_s_to_f.c"); }; status = status ; goto BYE; }; }
    }
    else {
      { { fprintf(stderr, "Line %3d of File %s \n", 127, "./dir_helpers/par_s_to_f.c"); }; status = -1 ; goto BYE; };
    }
  }
  else {
    { { fprintf(stderr, "Line %3d of File %s \n", 131, "./dir_helpers/par_s_to_f.c"); }; status = -1 ; goto BYE; };
  }
  for ( int tid = 0; tid < nT; tid++ ) {
    long long lb = in_lb + (tid * block_size);
    long long ub = lb + block_size;
    if ( tid == (nT-1) ) { ub = in_ub; }
    long long nX = (ub -lb);
    if ( strcmp(op, "const") == 0 ) {
      if ( strcmp(fldtype, "I1") == 0 ) {
 char *XI1 = (char *)X; XI1 += lb;
 s_to_f_const_I1(XI1, nX, val1);
      }
      else if ( strcmp(fldtype, "I2") == 0 ) {
 short *XI2 = (short *)X; XI2 += lb;
 s_to_f_const_I2(XI2, nX, val2);
      }
      else if ( strcmp(fldtype, "I4") == 0 ) {
 int *XI4 = (int *)X; XI4 += lb;
 s_to_f_const_I4(XI4, nX, val4);
      }
      else if ( strcmp(fldtype, "F4") == 0 ) {
 float *XF4 = (float *)X; XF4 += lb;
 s_to_f_const_F4(XF4, nX, valF4);
      }
      else if ( strcmp(fldtype, "I8") == 0 ) {
 long long *XI8 = (long long *) X; XI8 += lb;
 s_to_f_const_I8(XI8, nX, val8);
      }
    }
    else if ( strcmp(op, "seq") == 0 ) {
      if ( strcmp(fldtype, "I1") == 0 ) {
        long long l_start = start1 + (lb * incr1);
 if ( l_start > 0x7f ) { status = -1; continue; }
 s_to_f_seq_I1(((char *)X)+lb, nX, (char)l_start, incr1);
      }
      else if ( strcmp(fldtype, "I2") == 0 ) {
        long long l_start = start2 + (lb * incr2);
 if ( l_start > 0x7fff ) { status = -1; continue; }
 s_to_f_seq_I2(((short *)X)+lb, nX, (short)l_start, incr2);
      }
      else if ( strcmp(fldtype, "I4") == 0 ) {
        long long l_start = start4 + (lb * incr4);
 if ( l_start > 0x7fffffff ) { status = -1; continue; }
 s_to_f_seq_I4(((int *)X)+lb, nX, (int)l_start, incr4);
      }
      else if ( strcmp(fldtype, "I8") == 0 ) {
        long long l_start = start8 + (lb * incr8);
 s_to_f_seq_I8(((long long *)X)+lb, nX, (long long)l_start, incr8);
      }
    }
    else {
      status = -1; continue;
    }
  }
  { if ( (status) < 0 ) { { { fprintf(stderr, "Line %3d of File %s \n", 187, "./dir_helpers/par_s_to_f.c"); }; status = (status) ; goto BYE; } } };
 BYE:
  return(status);
}

variable_types:
X
char *

variable_types:
op
char [32]

variable_types:
fldtype
char [32]

variable_types: nT int

variable_types: tid int

variable_types:
lb
long long

variable_types:
ub
long long

variable_types:
nX
long long


decompiled_code:
__int64 __fastcall count_I8(__int64 a1, __int64 a2, __int64 a3, int a4)
{
__int64 v7; // rdx
__int64 v8; // rax

if ( a2 <= 0 )
return 0LL;
v7 = 0LL;
while ( 1 )
{
v8 = *(_QWORD *)(a1 + 8 * v7);
if ( v8 < 0 || a4 <= v8 )
break;
++v7;
++*(_QWORD *)(a3 + 8LL * (int)v8);
if ( a2 == v7 )
return 0LL;
}
fprintf(stderr, "Line %3d of File %s \n", 30LL, "./AUX/count_I8.c");
return 0xFFFFFFFFLL;
}

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

if ( a2 <= 0 )
return 0LL;
v7 = 0LL;
while ( 1 )
{
v8 = *(_QWORD *)(a1 + 8 * v7);
if ( v8 < 0 || a4 <= v8 )
break;
++v7;
++*(_QWORD *)(a3 + 8LL * (int)v8);
if ( a2 == v7 )
return 0LL;
}
fprintf(stderr, "Line %3d of File %s \n", 30LL, "./AUX/count_I8.c");
return 0xFFFFFFFFLL;
}

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

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

variable_types:
in
long long *

variable_types: status int

variable_types:
idx
long long


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

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

variable_types:
cnt
long long

variable_types:
i
long long

variable_types: ival int


decompiled_code:
__int64 __fastcall sort_dsc_F4(float *a1, float *a2)
{
__int64 result; // rax

result = 1LL;
if ( *a2 <= *a1 )
result = (unsigned int)-(*a1 > *a2);
return result;
}

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

result = 1LL;
if ( *a2 <= *a1 )
result = (unsigned int)-(*a1 > *a2);
return result;
}

original_code:
int sort_dsc_F4(
         const void *ii,
         const void *jj
         )
{
  float val1, val2;
  float *ptr1, *ptr2;
  ptr1 = (float *)ii;
  ptr2 = (float *)jj;
  val1 = *ptr1;
  val2 = *ptr2;
  if ( val1 < val2 ) {
    return (1);
  }
  else if ( val1 > val2 ) {
    return (-1);
  }
  else {
    return(0);
  }
}

canonical_original_code:
int sort_dsc_F4(void *ii, void *jj)
{
  float val1; float val2;
  float *ptr1; float *ptr2;
  ptr1 = (float *)ii;
  ptr2 = (float *)jj;
  val1 = *ptr1;
  val2 = *ptr2;
  if ( val1 < val2 ) {
    return (1);
  }
  else if ( val1 > val2 ) {
    return (-1);
  }
  else {
    return(0);
  }
}

variable_types:
ii
void *

variable_types:
jj
void *


Collapse

original_code:
int
Collapse(
  int *buf1,
  int *buf2,
  int *ptr_weight,
  int bufidx1,
  int bufidx2,
  int b,
  long long k
  )
{
  int status = 0;
  int flag = 0;
  if ( buf1 == ((void *)0) ) { { { fprintf(stderr, "Line %3d of File %s \n", 50, "Collapse.c"); }; status = -1 ; goto BYE; }; }
  if ( buf2 == ((void *)0) ) { { { fprintf(stderr, "Line %3d of File %s \n", 51, "Collapse.c"); }; status = -1 ; goto BYE; }; }
  if ( ptr_weight == ((void *)0) ) { { { fprintf(stderr, "Line %3d of File %s \n", 52, "Collapse.c"); }; status = -1 ; goto BYE; }; }
  if ( bufidx1 < 0 || bufidx1 >= b ) { { { fprintf(stderr, "Line %3d of File %s \n", 53, "Collapse.c"); }; status = -1 ; goto BYE; }; }
  if ( bufidx2 < 0 || bufidx2 >= b ) { { { fprintf(stderr, "Line %3d of File %s \n", 54, "Collapse.c"); }; status = -1 ; goto BYE; }; }
  if ( ptr_weight[bufidx1] <= 0 || ptr_weight[bufidx2] <= 0 ) { { { fprintf(stderr, "Line %3d of File %s \n", 55, "Collapse.c"); }; status = -1 ; goto BYE; }; }
  int* tempBuffer = ((void *)0);
  int* tempWeight = ((void *)0);
  flag = 1;
  tempBuffer = malloc( 2*k * sizeof(int) );
  { if ( tempBuffer == ((void *)0) ) { fprintf(stderr, "Unable to allocate memory\n"); { { fprintf(stderr, "Line %3d of File %s \n", 67, "Collapse.c"); }; status = -1 ; goto BYE; }; } };
  tempWeight = malloc( 2*k * sizeof(int) );
  { if ( tempWeight == ((void *)0) ) { fprintf(stderr, "Unable to allocate memory\n"); { { fprintf(stderr, "Line %3d of File %s \n", 69, "Collapse.c"); }; status = -1 ; goto BYE; }; } };
  long long ii = 0, jj = 0, kk = 0;
  while(1) {
    if ( ii < k && jj < k ) {
      if ( buf1[ii] <= buf2[jj] ) {
 tempBuffer[kk] = buf1[ii++];
 tempWeight[kk++] = ptr_weight[bufidx1];
      }
      else {
        tempBuffer[kk] = buf2[jj++];
 tempWeight[kk++] = ptr_weight[bufidx2];
      }
    }
    else if ( ii < k && jj == k ) {
      tempBuffer[kk] = buf1[ii++];
      tempWeight[kk++] = ptr_weight[bufidx1];
    }
    else if ( ii == k && jj < k ) {
      tempBuffer[kk] = buf2[jj++];
      tempWeight[kk++] = ptr_weight[bufidx2];
    }
    else
      break;
  }
  ii = 0; jj = 0; kk = 0;
  int outWeight = ptr_weight[bufidx1]+ptr_weight[bufidx2];
  int offSet = outWeight/2;
  while ( ii < 2*k ) {
    kk += tempWeight[ii];
    while ( kk >= offSet+jj*outWeight ) {
      buf1[jj++] = tempBuffer[ii];
    }
    ii++;
  }
  ptr_weight[bufidx1] = outWeight;
  ptr_weight[bufidx2] = 0;
 BYE:
  if ( flag == 1 ) {
    { if ( (tempBuffer) != ((void *)0) ) { free((tempBuffer)); (tempBuffer) = ((void *)0); } };
    { if ( (tempWeight) != ((void *)0) ) { free((tempWeight)); (tempWeight) = ((void *)0); } };
  }
  return status ;
}

canonical_original_code:
int Collapse(int *buf1, int *buf2, int *ptr_weight, int bufidx1, int bufidx2, int b, long long k)
{
  int status = 0;
  int flag = 0;
  if ( buf1 == ((void *)0) ) { { { fprintf(stderr, "Line %3d of File %s \n", 50, "Collapse.c"); }; status = -1 ; goto BYE; }; }
  if ( buf2 == ((void *)0) ) { { { fprintf(stderr, "Line %3d of File %s \n", 51, "Collapse.c"); }; status = -1 ; goto BYE; }; }
  if ( ptr_weight == ((void *)0) ) { { { fprintf(stderr, "Line %3d of File %s \n", 52, "Collapse.c"); }; status = -1 ; goto BYE; }; }
  if ( bufidx1 < 0 || bufidx1 >= b ) { { { fprintf(stderr, "Line %3d of File %s \n", 53, "Collapse.c"); }; status = -1 ; goto BYE; }; }
  if ( bufidx2 < 0 || bufidx2 >= b ) { { { fprintf(stderr, "Line %3d of File %s \n", 54, "Collapse.c"); }; status = -1 ; goto BYE; }; }
  if ( ptr_weight[bufidx1] <= 0 || ptr_weight[bufidx2] <= 0 ) { { { fprintf(stderr, "Line %3d of File %s \n", 55, "Collapse.c"); }; status = -1 ; goto BYE; }; }
  int *tempBuffer = ((void *)0);
  int *tempWeight = ((void *)0);
  flag = 1;
  tempBuffer = malloc( 2*k * sizeof(int) );
  { if ( tempBuffer == ((void *)0) ) { fprintf(stderr, "Unable to allocate memory\n"); { { fprintf(stderr, "Line %3d of File %s \n", 67, "Collapse.c"); }; status = -1 ; goto BYE; }; } };
  tempWeight = malloc( 2*k * sizeof(int) );
  { if ( tempWeight == ((void *)0) ) { fprintf(stderr, "Unable to allocate memory\n"); { { fprintf(stderr, "Line %3d of File %s \n", 69, "Collapse.c"); }; status = -1 ; goto BYE; }; } };
  long long ii = 0; long long jj = 0; long long kk = 0;
  while(1) {
    if ( ii < k && jj < k ) {
      if ( buf1[ii] <= buf2[jj] ) {
 tempBuffer[kk] = buf1[ii++];
 tempWeight[kk++] = ptr_weight[bufidx1];
      }
      else {
        tempBuffer[kk] = buf2[jj++];
 tempWeight[kk++] = ptr_weight[bufidx2];
      }
    }
    else if ( ii < k && jj == k ) {
      tempBuffer[kk] = buf1[ii++];
      tempWeight[kk++] = ptr_weight[bufidx1];
    }
    else if ( ii == k && jj < k ) {
      tempBuffer[kk] = buf2[jj++];
      tempWeight[kk++] = ptr_weight[bufidx2];
    }
    else
      break;
  }
  ii = 0; jj = 0; kk = 0;
  int outWeight = ptr_weight[bufidx1]+ptr_weight[bufidx2];
  int offSet = outWeight/2;
  while ( ii < 2*k ) {
    kk += tempWeight[ii];
    while ( kk >= offSet+jj*outWeight ) {
      buf1[jj++] = tempBuffer[ii];
    }
    ii++;
  }
  ptr_weight[bufidx1] = outWeight;
  ptr_weight[bufidx2] = 0;
 BYE:
  if ( flag == 1 ) {
    { if ( (tempBuffer) != ((void *)0) ) { free((tempBuffer)); (tempBuffer) = ((void *)0); } };
    { if ( (tempWeight) != ((void *)0) ) { free((tempWeight)); (tempWeight) = ((void *)0); } };
  }
  return status ;
}

variable_types: b int

variable_types:
k
long long

variable_types: flag int

variable_types:
tempBuffer
int *

variable_types:
tempWeight
int *

variable_types:
ii
long long

variable_types:
jj
long long

variable_types:
kk
long long

variable_types: outWeight int

variable_types: offSet int


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

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

variable_types: status int

variable_types:
delta
long long


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

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

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

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

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

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

variable_types:
lb
long long

variable_types:
ub
long long