decompiled_code:
__int64 __fastcall g_load(_BYTE *a1, _BYTE *a2, _BYTE *a3)
{
int v4; // er12
char *v5; // rbp
__int64 v7; // rdx
unsigned int v8; // [rsp+Ch] [rbp-145Ch] BYREF
int v9; // [rsp+10h] [rbp-1458h] BYREF
int v10; // [rsp+14h] [rbp-1454h] BYREF
int v11; // [rsp+18h] [rbp-1450h] BYREF
unsigned int v12; // [rsp+1Ch] [rbp-144Ch] BYREF
char *haystack; // [rsp+20h] [rbp-1448h] BYREF
__int64 v14; // [rsp+28h] [rbp-1440h] BYREF
__int64 v15; // [rsp+30h] [rbp-1438h] BYREF
__int64 v16; // [rsp+38h] [rbp-1430h] BYREF
__int64 v17; // [rsp+40h] [rbp-1428h] BYREF
__int64 v18; // [rsp+70h] [rbp-13F8h] BYREF
__int64 v19; // [rsp+90h] [rbp-13D8h]
char v20[128]; // [rsp+F0h] [rbp-1378h] BYREF
char v21[720]; // [rsp+170h] [rbp-12F8h] BYREF
char src[1024]; // [rsp+440h] [rbp-1028h] BYREF
_BYTE v23[5]; // [rsp+840h] [rbp-C28h] BYREF
char dest[1019]; // [rsp+845h] [rbp-C23h] BYREF
char v25[2088]; // [rsp+C40h] [rbp-828h] BYREF

v8 = -1;
v9 = -1;
v10 = -1;
v11 = -1;
haystack = 0LL;
v14 = 0LL;
v15 = 0LL;
v16 = 0LL;
v12 = 0;
g_mmap_meta_data(&g_docroot, &v14, &v15, &v16, &v12);
if ( !a1 || !*a1 )
{
v7 = 43LL;
goto LABEL_32;
}
if ( !a2 || !*a2 )
{
v7 = 44LL;
goto LABEL_32;
}
if ( !a3 || !*a3 )
{
v7 = 45LL;
LABEL_32:
v4 = -1;
fprintf(stderr, "Line %3d of File %s \n", v7, "g_load.c");
goto LABEL_23;
}
if ( !(unsigned int)g_num_free_regs(v16, v12) )
{
v4 = -1;
fprintf(stderr, "Line %3d of File %s \n", 47LL, "g_load.c");
goto LABEL_23;
}
v4 = chk_fld_name(a3);
if ( v4 < 0 )
{
fprintf(stderr, "Line %3d of File %s \n", 48LL, "g_load.c");
goto LABEL_23;
}
v4 = is_tbl(a1, &v8, &v17);
if ( v4 < 0 )
{
fprintf(stderr, "Line %3d of File %s \n", 49LL, "g_load.c");
goto LABEL_23;
}
if ( (v8 & 0x80000000) != 0 )
{
v7 = 50LL;
goto LABEL_32;
}
is_fld(0LL, v8, a2, &v9, &v18, &v11, v20);
if ( v9 < 0 )
{
v7 = 53LL;
goto LABEL_32;
}
if ( v11 >= 0 )
{
v7 = 54LL;
goto LABEL_32;
}
if ( !(unsigned int)((__int64 (__fastcall *)(_QWORD))is_fldtype_goodfor_gpu)((unsigned int)v19) )
{
v4 = -1;
fprintf(stderr, "Line %3d of File %s \n", 55LL, "g_load.c");
goto LABEL_23;
}
v4 = g_is_fld(v16, v12, a3, &v10, v21);
if ( v4 < 0 )
{
fprintf(stderr, "Line %3d of File %s \n", 57LL, "g_load.c");
goto LABEL_23;
}
if ( v10 >= 0 )
{
v7 = 58LL;
goto LABEL_32;
}
zero_string(v25, 2048LL);
zero_string(src, 1024LL);
zero_string(v23, 1024LL);
v4 = g_meta_to_str(src, a3);
if ( v4 < 0 )
{
fprintf(stderr, "Line %3d of File %s \n", 65LL, "g_load.c");
}
else
{
qmemcpy(v23, "load ", sizeof(v23));
strcpy(dest, src);
v4 = g_make_url(v23, v25);
if ( v4 < 0 )
{
fprintf(stderr, "Line %3d of File %s \n", 68LL, "g_load.c");
}
else
{
v4 = g_call_gpu(v25, &haystack);
if ( v4 < 0 )
{
fprintf(stderr, "Line %3d of File %s \n", 69LL, "g_load.c");
}
else
{
v5 = haystack;
if ( !haystack )
goto LABEL_25;
if ( strstr(haystack, "\"\"") )
{
LABEL_24:
free(v5);
haystack = 0LL;
goto LABEL_25;
}
fprintf(stderr, "Response from GPU = [%s]\n", v5);
}
}
}
LABEL_23:
v5 = haystack;
if ( haystack )
goto LABEL_24;
LABEL_25:
g_unmap_meta_data(v14, v15);
return (unsigned int)v4;
}

canonical_decompiled_code:
__int64 __fastcall func0(_BYTE *a1, _BYTE *a2, _BYTE *a3)
{
int v4; // er12
char *v5; // rbp
__int64 v7; // rdx
unsigned int v8; // [rsp+Ch] [rbp-145Ch] BYREF
int v9; // [rsp+10h] [rbp-1458h] BYREF
int v10; // [rsp+14h] [rbp-1454h] BYREF
int v11; // [rsp+18h] [rbp-1450h] BYREF
unsigned int v12; // [rsp+1Ch] [rbp-144Ch] BYREF
char *haystack; // [rsp+20h] [rbp-1448h] BYREF
__int64 v14; // [rsp+28h] [rbp-1440h] BYREF
__int64 v15; // [rsp+30h] [rbp-1438h] BYREF
__int64 v16; // [rsp+38h] [rbp-1430h] BYREF
__int64 v17; // [rsp+40h] [rbp-1428h] BYREF
__int64 v18; // [rsp+70h] [rbp-13F8h] BYREF
__int64 v19; // [rsp+90h] [rbp-13D8h]
char v20[128]; // [rsp+F0h] [rbp-1378h] BYREF
char v21[720]; // [rsp+170h] [rbp-12F8h] BYREF
char src[1024]; // [rsp+440h] [rbp-1028h] BYREF
_BYTE v23[5]; // [rsp+840h] [rbp-C28h] BYREF
char dest[1019]; // [rsp+845h] [rbp-C23h] BYREF
char v25[2088]; // [rsp+C40h] [rbp-828h] BYREF

v8 = -1;
v9 = -1;
v10 = -1;
v11 = -1;
haystack = 0LL;
v14 = 0LL;
v15 = 0LL;
v16 = 0LL;
v12 = 0;
g_mmap_meta_data(&g_docroot, &v14, &v15, &v16, &v12);
if ( !a1 || !*a1 )
{
v7 = 43LL;
goto LABEL_32;
}
if ( !a2 || !*a2 )
{
v7 = 44LL;
goto LABEL_32;
}
if ( !a3 || !*a3 )
{
v7 = 45LL;
LABEL_32:
v4 = -1;
fprintf(stderr, "Line %3d of File %s \n", v7, "g_load.c");
goto LABEL_23;
}
if ( !(unsigned int)g_num_free_regs(v16, v12) )
{
v4 = -1;
fprintf(stderr, "Line %3d of File %s \n", 47LL, "g_load.c");
goto LABEL_23;
}
v4 = chk_fld_name(a3);
if ( v4 < 0 )
{
fprintf(stderr, "Line %3d of File %s \n", 48LL, "g_load.c");
goto LABEL_23;
}
v4 = is_tbl(a1, &v8, &v17);
if ( v4 < 0 )
{
fprintf(stderr, "Line %3d of File %s \n", 49LL, "g_load.c");
goto LABEL_23;
}
if ( (v8 & 0x80000000) != 0 )
{
v7 = 50LL;
goto LABEL_32;
}
is_fld(0LL, v8, a2, &v9, &v18, &v11, v20);
if ( v9 < 0 )
{
v7 = 53LL;
goto LABEL_32;
}
if ( v11 >= 0 )
{
v7 = 54LL;
goto LABEL_32;
}
if ( !(unsigned int)((__int64 (__fastcall *)(_QWORD))is_fldtype_goodfor_gpu)((unsigned int)v19) )
{
v4 = -1;
fprintf(stderr, "Line %3d of File %s \n", 55LL, "g_load.c");
goto LABEL_23;
}
v4 = g_is_fld(v16, v12, a3, &v10, v21);
if ( v4 < 0 )
{
fprintf(stderr, "Line %3d of File %s \n", 57LL, "g_load.c");
goto LABEL_23;
}
if ( v10 >= 0 )
{
v7 = 58LL;
goto LABEL_32;
}
zero_string(v25, 2048LL);
zero_string(src, 1024LL);
zero_string(v23, 1024LL);
v4 = g_meta_to_str(src, a3);
if ( v4 < 0 )
{
fprintf(stderr, "Line %3d of File %s \n", 65LL, "g_load.c");
}
else
{
qmemcpy(v23, "load ", sizeof(v23));
strcpy(dest, src);
v4 = g_make_url(v23, v25);
if ( v4 < 0 )
{
fprintf(stderr, "Line %3d of File %s \n", 68LL, "g_load.c");
}
else
{
v4 = g_call_gpu(v25, &haystack);
if ( v4 < 0 )
{
fprintf(stderr, "Line %3d of File %s \n", 69LL, "g_load.c");
}
else
{
v5 = haystack;
if ( !haystack )
goto LABEL_25;
if ( strstr(haystack, "\"\"") )
{
LABEL_24:
free(v5);
haystack = 0LL;
goto LABEL_25;
}
fprintf(stderr, "Response from GPU = [%s]\n", v5);
}
}
}
LABEL_23:
v5 = haystack;
if ( haystack )
goto LABEL_24;
LABEL_25:
g_unmap_meta_data(v14, v15);
return (unsigned int)v4;
}

original_code:
int
g_load(
    char *tbl,
    char *h_fld,
    char *d_fld
    )
{
  int status = 0;
  int tbl_id = -1; TBL_REC_TYPE tbl_rec;
  int h_fld_id = -1; FLD_REC_TYPE h_fld_rec;
  int d_fld_id = -1;
  int nn_fld_id = -1; FLD_REC_TYPE nn_fld_rec;
  char *curl_response = ((void *)0);
  GPU_REG_TYPE d_fld_rec;
  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 ( ( tbl == ((void *)0) ) || ( *tbl == '\0' ) ) { { { fprintf(stderr, "Line %3d of File %s \n", 43, "g_load.c"); }; status = -1 ; goto BYE; }; }
  if ( ( h_fld == ((void *)0) ) || ( *h_fld == '\0' ) ) { { { fprintf(stderr, "Line %3d of File %s \n", 44, "g_load.c"); }; status = -1 ; goto BYE; }; }
  if ( ( d_fld == ((void *)0) ) || ( *d_fld == '\0' ) ) { { { fprintf(stderr, "Line %3d of File %s \n", 45, "g_load.c"); }; status = -1 ; goto BYE; }; }
  if ( g_num_free_regs(gpu_reg, n_gpu_reg) == 0 ) { { { fprintf(stderr, "Line %3d of File %s \n", 47, "g_load.c"); }; status = -1 ; goto BYE; }; }
  status = chk_fld_name(d_fld); { if ( (status) < 0 ) { { { fprintf(stderr, "Line %3d of File %s \n", 48, "g_load.c"); }; status = (status) ; goto BYE; } } };
  status = is_tbl(tbl, &tbl_id, &tbl_rec); { if ( (status) < 0 ) { { { fprintf(stderr, "Line %3d of File %s \n", 49, "g_load.c"); }; status = (status) ; goto BYE; } } };
  if ( tbl_id < 0 ) { { { fprintf(stderr, "Line %3d of File %s \n", 50, "g_load.c"); }; status = -1 ; goto BYE; }; }
  status = is_fld(((void *)0), tbl_id, h_fld, &h_fld_id, &h_fld_rec,
      &nn_fld_id, &nn_fld_rec);
  if ( h_fld_id < 0 ) { { { fprintf(stderr, "Line %3d of File %s \n", 53, "g_load.c"); }; status = -1 ; goto BYE; }; }
  if ( nn_fld_id >= 0 ) { { { fprintf(stderr, "Line %3d of File %s \n", 54, "g_load.c"); }; status = -1 ; goto BYE; }; }
  if ( is_fldtype_goodfor_gpu(h_fld_rec.fldtype) == 0 ) { { { fprintf(stderr, "Line %3d of File %s \n", 55, "g_load.c"); }; status = -1 ; goto BYE; }; }
  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", 57, "g_load.c"); }; status = (status) ; goto BYE; } } };
  if ( d_fld_id >= 0 ) { { { fprintf(stderr, "Line %3d of File %s \n", 58, "g_load.c"); }; status = -1 ; goto BYE; }; }
  char url[2048]; zero_string(url, 2048);
  char meta_str[1024]; zero_string(meta_str, 1024);
  char command[1024]; zero_string(command, 1024);
  status = g_meta_to_str(meta_str, d_fld, tbl_rec, h_fld_rec); { if ( (status) < 0 ) { { { fprintf(stderr, "Line %3d of File %s \n", 65, "g_load.c"); }; status = (status) ; goto BYE; } } };
  strcpy(command, "load "); strcat(command, meta_str);
  status = g_make_url(command, url); { if ( (status) < 0 ) { { { fprintf(stderr, "Line %3d of File %s \n", 68, "g_load.c"); }; status = (status) ; goto BYE; } } };
  status = g_call_gpu(url, &curl_response); { if ( (status) < 0 ) { { { fprintf(stderr, "Line %3d of File %s \n", 69, "g_load.c"); }; status = (status) ; goto BYE; } } };
  if ( curl_response != ((void *)0) ) {
    if ( strstr(curl_response, "\"\"") == ((void *)0) ) {
      fprintf(stderr, "Response from GPU = [%s]\n", curl_response);
    }
  }
BYE:
  { if ( (curl_response) != ((void *)0) ) { free((curl_response)); (curl_response) = ((void *)0); } };
  g_unmap_meta_data(gpu_reg_X, gpu_reg_nX);
  return(status);
}

canonical_original_code:
int g_load(char *tbl, char *h_fld, char *d_fld)
{
  int status = 0;
  int tbl_id = -1; struct _TBL_REC_TYPE tbl_rec;
  int h_fld_id = -1; struct _FLD_REC_TYPE h_fld_rec;
  int d_fld_id = -1;
  int nn_fld_id = -1; struct _FLD_REC_TYPE nn_fld_rec;
  char *curl_response = ((void *)0);
  struct _GPU_REG_TYPE d_fld_rec;
  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 ( ( tbl == ((void *)0) ) || ( *tbl == '\0' ) ) { { { fprintf(stderr, "Line %3d of File %s \n", 43, "g_load.c"); }; status = -1 ; goto BYE; }; }
  if ( ( h_fld == ((void *)0) ) || ( *h_fld == '\0' ) ) { { { fprintf(stderr, "Line %3d of File %s \n", 44, "g_load.c"); }; status = -1 ; goto BYE; }; }
  if ( ( d_fld == ((void *)0) ) || ( *d_fld == '\0' ) ) { { { fprintf(stderr, "Line %3d of File %s \n", 45, "g_load.c"); }; status = -1 ; goto BYE; }; }
  if ( g_num_free_regs(gpu_reg, n_gpu_reg) == 0 ) { { { fprintf(stderr, "Line %3d of File %s \n", 47, "g_load.c"); }; status = -1 ; goto BYE; }; }
  status = chk_fld_name(d_fld); { if ( (status) < 0 ) { { { fprintf(stderr, "Line %3d of File %s \n", 48, "g_load.c"); }; status = (status) ; goto BYE; } } };
  status = is_tbl(tbl, &tbl_id, &tbl_rec); { if ( (status) < 0 ) { { { fprintf(stderr, "Line %3d of File %s \n", 49, "g_load.c"); }; status = (status) ; goto BYE; } } };
  if ( tbl_id < 0 ) { { { fprintf(stderr, "Line %3d of File %s \n", 50, "g_load.c"); }; status = -1 ; goto BYE; }; }
  status = is_fld(((void *)0), tbl_id, h_fld, &h_fld_id, &h_fld_rec,
      &nn_fld_id, &nn_fld_rec);
  if ( h_fld_id < 0 ) { { { fprintf(stderr, "Line %3d of File %s \n", 53, "g_load.c"); }; status = -1 ; goto BYE; }; }
  if ( nn_fld_id >= 0 ) { { { fprintf(stderr, "Line %3d of File %s \n", 54, "g_load.c"); }; status = -1 ; goto BYE; }; }
  if ( is_fldtype_goodfor_gpu(h_fld_rec.fldtype) == 0 ) { { { fprintf(stderr, "Line %3d of File %s \n", 55, "g_load.c"); }; status = -1 ; goto BYE; }; }
  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", 57, "g_load.c"); }; status = (status) ; goto BYE; } } };
  if ( d_fld_id >= 0 ) { { { fprintf(stderr, "Line %3d of File %s \n", 58, "g_load.c"); }; status = -1 ; goto BYE; }; }
  char url[2048]; zero_string(url, 2048);
  char meta_str[1024]; zero_string(meta_str, 1024);
  char command[1024]; zero_string(command, 1024);
  status = g_meta_to_str(meta_str, d_fld, tbl_rec, h_fld_rec); { if ( (status) < 0 ) { { { fprintf(stderr, "Line %3d of File %s \n", 65, "g_load.c"); }; status = (status) ; goto BYE; } } };
  strcpy(command, "load "); strcat(command, meta_str);
  status = g_make_url(command, url); { if ( (status) < 0 ) { { { fprintf(stderr, "Line %3d of File %s \n", 68, "g_load.c"); }; status = (status) ; goto BYE; } } };
  status = g_call_gpu(url, &curl_response); { if ( (status) < 0 ) { { { fprintf(stderr, "Line %3d of File %s \n", 69, "g_load.c"); }; status = (status) ; goto BYE; } } };
  if ( curl_response != ((void *)0) ) {
    if ( strstr(curl_response, "\"\"") == ((void *)0) ) {
      fprintf(stderr, "Response from GPU = [%s]\n", curl_response);
    }
  }
BYE:
  { if ( (curl_response) != ((void *)0) ) { free((curl_response)); (curl_response) = ((void *)0); } };
  g_unmap_meta_data(gpu_reg_X, gpu_reg_nX);
  return(status);
}

variable_types:
tbl
char *

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

user_defined_types: enum _TBL_TYPE { undef_tbl=0, regular=1, ldb_dict=2, txt_lkp=3, min_max=4, first_last=5, bins=6 }

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

user_defined_types: enum _AUX_TYPE { undef_auxtype=0, nn=1, len=2, off=3 }

user_defined_types: union sumval { long long sumI8; double sumF8; }

user_defined_types: union minval { long long minI8; double minF8; }

user_defined_types: union maxval { long long maxI8; double maxF8; }


repo: linkedin/datacl

decompiled_code:
void __fastcall vec_sqrt_F4(float *a1, int a2, float *a3)
{
float *v3; // rbx
float v4; // xmm0_4
float v5; // xmm0_4
float *v6; // [rsp+8h] [rbp-10h]

if ( a2 > 0 )
{
v3 = &a1[a2];
do
{
v4 = *a1;
if ( *a1 < 0.0 )
{
v6 = a3;
v5 = sqrtf(v4);
a3 = v6;
}
else
{
v5 = fsqrt(v4);
}
++a1;
*a3++ = v5;
}
while ( a1 != v3 );
}
}

original_code:
void
vec_sqrt_F4(
       float *in,
       int nR,
       float *out
       )
{
  int i;
  for ( i = 0; i < nR; i++ ) {
    *out = (float)sqrt(*in);
    in++;
    out++;
  }
}

canonical_original_code:
void vec_sqrt_F4(float *in, int nR, float *out)
{
  int i;
  for ( i = 0; i < nR; i++ ) {
    *out = (float)sqrt(*in);
    in++;
    out++;
  }
}

variable_types:
in
float *

variable_types: nR int

variable_types:
out
float *

variable_types: i int

return_type: void


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

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

variable_types:
nR
long long

variable_types:
out
unsigned long long *

variable_types:
outv
long long

variable_types:
i
long long


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

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

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

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

variable_types: lb int

variable_types: ub int

variable_types:
cnt
long long

variable_types: val int

return_type: int


original_code:
int
is_A_in_b(
   char *t1,
   char *f1,
   char *t2,
   char *f2,
   char *cfld
   )
{
  int status = 0;
  char *f1_X = ((void *)0); size_t f1_nX = 0;
  char *f2_X = ((void *)0); size_t f2_nX = 0;
  char *cfX = ((void *)0); size_t cf_nX = 0;
  char *nn_f1_X = ((void *)0); size_t nn_f1_nX = 0;
  FLD_REC_TYPE f1_rec, f2_rec, cfld_rec;
  FLD_REC_TYPE nn_f1_rec, nn_f2_rec;
  TBL_REC_TYPE t1_rec, t2_rec;
  long long nR1, nR2;
  char opfile[15 +1];
  int t1_id, t2_id;
  int f1_id, nn_f1_id;
  int f2_id, nn_f2_id;
  int cfld_id = (-0x7fffffff - 1);
  int ddir_id;
  char buf[16];
  if ( ( t1 == ((void *)0) ) || ( *t1 == '\0' ) ) { { { fprintf(stderr, "Line %3d of File %s \n", 65, "./dir_wr_verbs/is_A_in_b.c"); }; status = -1 ; goto BYE; }; }
  if ( ( f1 == ((void *)0) ) || ( *f1 == '\0' ) ) { { { fprintf(stderr, "Line %3d of File %s \n", 66, "./dir_wr_verbs/is_A_in_b.c"); }; status = -1 ; goto BYE; }; }
  if ( ( t2 == ((void *)0) ) || ( *t2 == '\0' ) ) { { { fprintf(stderr, "Line %3d of File %s \n", 67, "./dir_wr_verbs/is_A_in_b.c"); }; status = -1 ; goto BYE; }; }
  if ( ( f2 == ((void *)0) ) || ( *f2 == '\0' ) ) { { { fprintf(stderr, "Line %3d of File %s \n", 68, "./dir_wr_verbs/is_A_in_b.c"); }; status = -1 ; goto BYE; }; }
  if ( strcmp(f1, cfld) == 0 ) { { { fprintf(stderr, "Line %3d of File %s \n", 69, "./dir_wr_verbs/is_A_in_b.c"); }; status = -1 ; goto BYE; }; }
  status = is_tbl(t1, &t1_id, &t1_rec); { if ( (status) < 0 ) { { { fprintf(stderr, "Line %3d of File %s \n", 71, "./dir_wr_verbs/is_A_in_b.c"); }; status = (status) ; goto BYE; } } };
  { if ( ( (t1_id) < (0) ) || ( (t1_id) >= (g_n_tbl ) ) ) { { { fprintf(stderr, "Line %3d of File %s \n", 72, "./dir_wr_verbs/is_A_in_b.c"); }; status = -1 ; goto BYE; }; } };
  nR1 = g_tbls[t1_id].nR; if ( nR1 <= 0 ) { { { fprintf(stderr, "Line %3d of File %s \n", 73, "./dir_wr_verbs/is_A_in_b.c"); }; status = -1 ; goto BYE; }; }
  status = is_fld(((void *)0), t1_id, f1, &f1_id, &f1_rec, &nn_f1_id, &nn_f1_rec);
  if ( f1_id < 0 ) {
    fprintf(stderr, "Field [%s] in Table [%s] missing\n", f1, t1);
    { { fprintf(stderr, "Line %3d of File %s \n", 77, "./dir_wr_verbs/is_A_in_b.c"); }; status = -1 ; goto BYE; };
  }
  { if ( ( (f1_id) < (0) ) || ( (f1_id) >= (g_n_fld ) ) ) { { { fprintf(stderr, "Line %3d of File %s \n", 79, "./dir_wr_verbs/is_A_in_b.c"); }; status = -1 ; goto BYE; }; } };
  status = get_data(f1_rec, &f1_X, &f1_nX, 0); { if ( (status) < 0 ) { { { fprintf(stderr, "Line %3d of File %s \n", 80, "./dir_wr_verbs/is_A_in_b.c"); }; status = (status) ; goto BYE; } } };
  status = ext_f_to_s(t1, f1, "is_sorted", buf, 16); { if ( (status) < 0 ) { { { fprintf(stderr, "Line %3d of File %s \n", 81, "./dir_wr_verbs/is_A_in_b.c"); }; status = (status) ; goto BYE; } } };
  if ( strcmp(buf, "ascending") != 0 ) { { { fprintf(stderr, "Line %3d of File %s \n", 82, "./dir_wr_verbs/is_A_in_b.c"); }; status = -1 ; goto BYE; }; }
  status = is_tbl(t2, &t2_id, &t2_rec); { if ( (status) < 0 ) { { { fprintf(stderr, "Line %3d of File %s \n", 85, "./dir_wr_verbs/is_A_in_b.c"); }; status = (status) ; goto BYE; } } };
  { if ( ( (t2_id) < (0) ) || ( (t2_id) >= (g_n_tbl ) ) ) { { { fprintf(stderr, "Line %3d of File %s \n", 86, "./dir_wr_verbs/is_A_in_b.c"); }; status = -1 ; goto BYE; }; } };
  nR2 = g_tbls[t2_id].nR;
  status = is_fld(((void *)0), t2_id, f2, &f2_id, &f2_rec, &nn_f2_id, &nn_f2_rec);
  { if ( ( (f2_id) < (0) ) || ( (f2_id) >= (g_n_fld ) ) ) { { { fprintf(stderr, "Line %3d of File %s \n", 89, "./dir_wr_verbs/is_A_in_b.c"); }; status = -1 ; goto BYE; }; } };
  status = get_data(f2_rec, &f2_X, &f2_nX, 0); { if ( (status) < 0 ) { { { fprintf(stderr, "Line %3d of File %s \n", 90, "./dir_wr_verbs/is_A_in_b.c"); }; status = (status) ; goto BYE; } } };
  status = ext_f_to_s(t2, f2, "is_sorted", buf, 16); { if ( (status) < 0 ) { { { fprintf(stderr, "Line %3d of File %s \n", 91, "./dir_wr_verbs/is_A_in_b.c"); }; status = (status) ; goto BYE; } } };
  if ( strcmp(buf, "ascending") != 0 ) { { { fprintf(stderr, "Line %3d of File %s \n", 92, "./dir_wr_verbs/is_A_in_b.c"); }; status = -1 ; goto BYE; }; }
  if (f1_rec.fldtype != f2_rec.fldtype ) { { { fprintf(stderr, "Line %3d of File %s \n", 95, "./dir_wr_verbs/is_A_in_b.c"); }; status = -1 ; goto BYE; }; }
  if ( nn_f1_id >= 0 ) {
    status = get_data(nn_f1_rec, &nn_f1_X, &nn_f1_nX, 0); { if ( (status) < 0 ) { { { fprintf(stderr, "Line %3d of File %s \n", 99, "./dir_wr_verbs/is_A_in_b.c"); }; status = (status) ; goto BYE; } } };
  }
  if ( nn_f2_id >= 0 ) { { { fprintf(stderr, "Line %3d of File %s \n", 101, "./dir_wr_verbs/is_A_in_b.c"); }; status = -1 ; goto BYE; }; }
  status = mk_temp_file(opfile, (nR1 *sizeof(char)), &ddir_id); { if ( (status) < 0 ) { { { fprintf(stderr, "Line %3d of File %s \n", 104, "./dir_wr_verbs/is_A_in_b.c"); }; status = (status) ; goto BYE; } } };
  status = q_mmap(ddir_id, opfile, &cfX, &cf_nX, 1); { if ( (status) < 0 ) { { { fprintf(stderr, "Line %3d of File %s \n", 105, "./dir_wr_verbs/is_A_in_b.c"); }; status = (status) ; goto BYE; } } };
  long long min_block_size = 8192, block_size; int nT;
  status = partition(nR1, min_block_size, -1, &block_size, &nT); { if ( (status) < 0 ) { { { fprintf(stderr, "Line %3d of File %s \n", 108, "./dir_wr_verbs/is_A_in_b.c"); }; status = (status) ; goto BYE; } } };
  for ( int tid = 0; tid < nT; tid++ ) {
    if ( status < 0 ) { continue; }
    long long lb = 0 + (tid * block_size);
    long long ub = lb + block_size;
    if ( tid == (nT-1) ) { ub = nR1; }
    int *f2_I4 = (int *)f2_X;
    char *l_cfX = cfX;
    int *f1_I4 = (int *)f1_X;
    int min_val_this_block_I4;
    long long min_f2_idx;
    switch ( f1_rec.fldtype ) {
      case I4 :
 min_val_this_block_I4 = f1_I4[lb];
 status = find_largest_leq_I4 (f2_I4, nR2, min_val_this_block_I4,
       &min_f2_idx);
 break;
      default :
        if ( status == 0 ) { { fprintf(stderr, "Line %3d of File %s \n", 127, "./dir_wr_verbs/is_A_in_b.c"); }; } status = -1;
 break;
    }
    int *l_f2_I4 = f2_I4 + min_f2_idx;
    int *l_max_f2_I4 = f2_I4 + nR2;
    for ( long long i1 = lb; i1 < ub; i1++ ) {
      if ( ( nn_f1_X != ((void *)0) ) && ( nn_f1_X[i1] == 0 ) ) {
 l_cfX[i1] = 0;
 continue;
      }
      int f1_val_I4 = f1_I4[i1];
      int found = 0;
      switch ( f1_rec.fldtype ) {
      case I4 :
      for ( ; l_f2_I4 < l_max_f2_I4; ) {
 int f2_val_I4 = *l_f2_I4;
 if ( f2_val_I4 < f1_val_I4 ) {
   l_f2_I4++;
   continue;
 }
 else if ( f2_val_I4 == f1_val_I4 ) {
   found = 1;
   break;
 }
 else {
   found = 0;
   break;
 }
      }
      break;
      default :
      if ( status == 0 ) { { fprintf(stderr, "Line %3d of File %s \n", 162, "./dir_wr_verbs/is_A_in_b.c"); }; } status = -1;
      break;
      }
      l_cfX[i1] = found;
    }
  }
  { if ( (status) < 0 ) { { { fprintf(stderr, "Line %3d of File %s \n", 168, "./dir_wr_verbs/is_A_in_b.c"); }; status = (status) ; goto BYE; } } };
  status = add_fld(t1_id, cfld, ddir_id, opfile, I1, -1, &cfld_id, &cfld_rec);
  { if ( (status) < 0 ) { { { fprintf(stderr, "Line %3d of File %s \n", 172, "./dir_wr_verbs/is_A_in_b.c"); }; status = (status) ; goto BYE; } } };
 BYE:
  { if ( ( f1_X == ((void *)0) ) && ( f1_nX != 0 ) ) { { fprintf(stderr, "Line %3d of File %s \n", 174, "./dir_wr_verbs/is_A_in_b.c"); }; return(-1); } if ( ( f1_X != ((void *)0) ) && ( f1_nX == 0 ) ) { { fprintf(stderr, "Line %3d of File %s \n", 174, "./dir_wr_verbs/is_A_in_b.c"); }; return(-1); } if ( f1_X != ((void *)0) ) { munmap(f1_X, f1_nX); f1_X = ((void *)0); f1_nX = 0; } };
  { if ( ( f2_X == ((void *)0) ) && ( f2_nX != 0 ) ) { { fprintf(stderr, "Line %3d of File %s \n", 175, "./dir_wr_verbs/is_A_in_b.c"); }; return(-1); } if ( ( f2_X != ((void *)0) ) && ( f2_nX == 0 ) ) { { fprintf(stderr, "Line %3d of File %s \n", 175, "./dir_wr_verbs/is_A_in_b.c"); }; return(-1); } if ( f2_X != ((void *)0) ) { munmap(f2_X, f2_nX); f2_X = ((void *)0); f2_nX = 0; } };
  { if ( ( cfX == ((void *)0) ) && ( cf_nX != 0 ) ) { { fprintf(stderr, "Line %3d of File %s \n", 176, "./dir_wr_verbs/is_A_in_b.c"); }; return(-1); } if ( ( cfX != ((void *)0) ) && ( cf_nX == 0 ) ) { { fprintf(stderr, "Line %3d of File %s \n", 176, "./dir_wr_verbs/is_A_in_b.c"); }; return(-1); } if ( cfX != ((void *)0) ) { munmap(cfX, cf_nX); cfX = ((void *)0); cf_nX = 0; } };
  { if ( ( nn_f1_X == ((void *)0) ) && ( nn_f1_nX != 0 ) ) { { fprintf(stderr, "Line %3d of File %s \n", 177, "./dir_wr_verbs/is_A_in_b.c"); }; return(-1); } if ( ( nn_f1_X != ((void *)0) ) && ( nn_f1_nX == 0 ) ) { { fprintf(stderr, "Line %3d of File %s \n", 177, "./dir_wr_verbs/is_A_in_b.c"); }; return(-1); } if ( nn_f1_X != ((void *)0) ) { munmap(nn_f1_X, nn_f1_nX); nn_f1_X = ((void *)0); nn_f1_nX = 0; } };
  return(status);
}

canonical_original_code:
int is_A_in_b(char *t1, char *f1, char *t2, char *f2, char *cfld)
{
  int status = 0;
  char *f1_X = ((void *)0); unsigned long f1_nX = 0;
  char *f2_X = ((void *)0); unsigned long f2_nX = 0;
  char *cfX = ((void *)0); unsigned long cf_nX = 0;
  char *nn_f1_X = ((void *)0); unsigned long nn_f1_nX = 0;
  struct _FLD_REC_TYPE f1_rec; struct _FLD_REC_TYPE f2_rec; struct _FLD_REC_TYPE cfld_rec;
  struct _FLD_REC_TYPE nn_f1_rec; struct _FLD_REC_TYPE nn_f2_rec;
  struct _TBL_REC_TYPE t1_rec; struct _TBL_REC_TYPE t2_rec;
  long long nR1; long long nR2;
  char opfile[-1];
  int t1_id; int t2_id;
  int f1_id; int nn_f1_id;
  int f2_id; int nn_f2_id;
  int cfld_id = (-0x7fffffff - 1);
  int ddir_id;
  char buf[16];
  if ( ( t1 == ((void *)0) ) || ( *t1 == '\0' ) ) { { { fprintf(stderr, "Line %3d of File %s \n", 65, "./dir_wr_verbs/is_A_in_b.c"); }; status = -1 ; goto BYE; }; }
  if ( ( f1 == ((void *)0) ) || ( *f1 == '\0' ) ) { { { fprintf(stderr, "Line %3d of File %s \n", 66, "./dir_wr_verbs/is_A_in_b.c"); }; status = -1 ; goto BYE; }; }
  if ( ( t2 == ((void *)0) ) || ( *t2 == '\0' ) ) { { { fprintf(stderr, "Line %3d of File %s \n", 67, "./dir_wr_verbs/is_A_in_b.c"); }; status = -1 ; goto BYE; }; }
  if ( ( f2 == ((void *)0) ) || ( *f2 == '\0' ) ) { { { fprintf(stderr, "Line %3d of File %s \n", 68, "./dir_wr_verbs/is_A_in_b.c"); }; status = -1 ; goto BYE; }; }
  if ( strcmp(f1, cfld) == 0 ) { { { fprintf(stderr, "Line %3d of File %s \n", 69, "./dir_wr_verbs/is_A_in_b.c"); }; status = -1 ; goto BYE; }; }
  status = is_tbl(t1, &t1_id, &t1_rec); { if ( (status) < 0 ) { { { fprintf(stderr, "Line %3d of File %s \n", 71, "./dir_wr_verbs/is_A_in_b.c"); }; status = (status) ; goto BYE; } } };
  { if ( ( (t1_id) < (0) ) || ( (t1_id) >= (g_n_tbl ) ) ) { { { fprintf(stderr, "Line %3d of File %s \n", 72, "./dir_wr_verbs/is_A_in_b.c"); }; status = -1 ; goto BYE; }; } };
  nR1 = g_tbls[t1_id].nR; if ( nR1 <= 0 ) { { { fprintf(stderr, "Line %3d of File %s \n", 73, "./dir_wr_verbs/is_A_in_b.c"); }; status = -1 ; goto BYE; }; }
  status = is_fld(((void *)0), t1_id, f1, &f1_id, &f1_rec, &nn_f1_id, &nn_f1_rec);
  if ( f1_id < 0 ) {
    fprintf(stderr, "Field [%s] in Table [%s] missing\n", f1, t1);
    { { fprintf(stderr, "Line %3d of File %s \n", 77, "./dir_wr_verbs/is_A_in_b.c"); }; status = -1 ; goto BYE; };
  }
  { if ( ( (f1_id) < (0) ) || ( (f1_id) >= (g_n_fld ) ) ) { { { fprintf(stderr, "Line %3d of File %s \n", 79, "./dir_wr_verbs/is_A_in_b.c"); }; status = -1 ; goto BYE; }; } };
  status = get_data(f1_rec, &f1_X, &f1_nX, 0); { if ( (status) < 0 ) { { { fprintf(stderr, "Line %3d of File %s \n", 80, "./dir_wr_verbs/is_A_in_b.c"); }; status = (status) ; goto BYE; } } };
  status = ext_f_to_s(t1, f1, "is_sorted", buf, 16); { if ( (status) < 0 ) { { { fprintf(stderr, "Line %3d of File %s \n", 81, "./dir_wr_verbs/is_A_in_b.c"); }; status = (status) ; goto BYE; } } };
  if ( strcmp(buf, "ascending") != 0 ) { { { fprintf(stderr, "Line %3d of File %s \n", 82, "./dir_wr_verbs/is_A_in_b.c"); }; status = -1 ; goto BYE; }; }
  status = is_tbl(t2, &t2_id, &t2_rec); { if ( (status) < 0 ) { { { fprintf(stderr, "Line %3d of File %s \n", 85, "./dir_wr_verbs/is_A_in_b.c"); }; status = (status) ; goto BYE; } } };
  { if ( ( (t2_id) < (0) ) || ( (t2_id) >= (g_n_tbl ) ) ) { { { fprintf(stderr, "Line %3d of File %s \n", 86, "./dir_wr_verbs/is_A_in_b.c"); }; status = -1 ; goto BYE; }; } };
  nR2 = g_tbls[t2_id].nR;
  status = is_fld(((void *)0), t2_id, f2, &f2_id, &f2_rec, &nn_f2_id, &nn_f2_rec);
  { if ( ( (f2_id) < (0) ) || ( (f2_id) >= (g_n_fld ) ) ) { { { fprintf(stderr, "Line %3d of File %s \n", 89, "./dir_wr_verbs/is_A_in_b.c"); }; status = -1 ; goto BYE; }; } };
  status = get_data(f2_rec, &f2_X, &f2_nX, 0); { if ( (status) < 0 ) { { { fprintf(stderr, "Line %3d of File %s \n", 90, "./dir_wr_verbs/is_A_in_b.c"); }; status = (status) ; goto BYE; } } };
  status = ext_f_to_s(t2, f2, "is_sorted", buf, 16); { if ( (status) < 0 ) { { { fprintf(stderr, "Line %3d of File %s \n", 91, "./dir_wr_verbs/is_A_in_b.c"); }; status = (status) ; goto BYE; } } };
  if ( strcmp(buf, "ascending") != 0 ) { { { fprintf(stderr, "Line %3d of File %s \n", 92, "./dir_wr_verbs/is_A_in_b.c"); }; status = -1 ; goto BYE; }; }
  if (f1_rec.fldtype != f2_rec.fldtype ) { { { fprintf(stderr, "Line %3d of File %s \n", 95, "./dir_wr_verbs/is_A_in_b.c"); }; status = -1 ; goto BYE; }; }
  if ( nn_f1_id >= 0 ) {
    status = get_data(nn_f1_rec, &nn_f1_X, &nn_f1_nX, 0); { if ( (status) < 0 ) { { { fprintf(stderr, "Line %3d of File %s \n", 99, "./dir_wr_verbs/is_A_in_b.c"); }; status = (status) ; goto BYE; } } };
  }
  if ( nn_f2_id >= 0 ) { { { fprintf(stderr, "Line %3d of File %s \n", 101, "./dir_wr_verbs/is_A_in_b.c"); }; status = -1 ; goto BYE; }; }
  status = mk_temp_file(opfile, (nR1 *sizeof(char)), &ddir_id); { if ( (status) < 0 ) { { { fprintf(stderr, "Line %3d of File %s \n", 104, "./dir_wr_verbs/is_A_in_b.c"); }; status = (status) ; goto BYE; } } };
  status = q_mmap(ddir_id, opfile, &cfX, &cf_nX, 1); { if ( (status) < 0 ) { { { fprintf(stderr, "Line %3d of File %s \n", 105, "./dir_wr_verbs/is_A_in_b.c"); }; status = (status) ; goto BYE; } } };
  long long min_block_size = 8192; long long block_size; int nT;
  status = partition(nR1, min_block_size, -1, &block_size, &nT); { if ( (status) < 0 ) { { { fprintf(stderr, "Line %3d of File %s \n", 108, "./dir_wr_verbs/is_A_in_b.c"); }; status = (status) ; goto BYE; } } };
  for ( int tid = 0; tid < nT; tid++ ) {
    if ( status < 0 ) { continue; }
    long long lb = 0 + (tid * block_size);
    long long ub = lb + block_size;
    if ( tid == (nT-1) ) { ub = nR1; }
    int *f2_I4 = (int *)f2_X;
    char *l_cfX = cfX;
    int *f1_I4 = (int *)f1_X;
    int min_val_this_block_I4;
    long long min_f2_idx;
    switch ( f1_rec.fldtype ) {
      case I4 :
 min_val_this_block_I4 = f1_I4[lb];
 status = find_largest_leq_I4 (f2_I4, nR2, min_val_this_block_I4,
       &min_f2_idx);
 break;
      default :
        if ( status == 0 ) { { fprintf(stderr, "Line %3d of File %s \n", 127, "./dir_wr_verbs/is_A_in_b.c"); }; } status = -1;
 break;
    }
    int *l_f2_I4 = f2_I4 + min_f2_idx;
    int *l_max_f2_I4 = f2_I4 + nR2;
    for ( long long i1 = lb; i1 < ub; i1++ ) {
      if ( ( nn_f1_X != ((void *)0) ) && ( nn_f1_X[i1] == 0 ) ) {
 l_cfX[i1] = 0;
 continue;
      }
      int f1_val_I4 = f1_I4[i1];
      int found = 0;
      switch ( f1_rec.fldtype ) {
      case I4 :
      for ( ; l_f2_I4 < l_max_f2_I4; ) {
 int f2_val_I4 = *l_f2_I4;
 if ( f2_val_I4 < f1_val_I4 ) {
   l_f2_I4++;
   continue;
 }
 else if ( f2_val_I4 == f1_val_I4 ) {
   found = 1;
   break;
 }
 else {
   found = 0;
   break;
 }
      }
      break;
      default :
      if ( status == 0 ) { { fprintf(stderr, "Line %3d of File %s \n", 162, "./dir_wr_verbs/is_A_in_b.c"); }; } status = -1;
      break;
      }
      l_cfX[i1] = found;
    }
  }
  { if ( (status) < 0 ) { { { fprintf(stderr, "Line %3d of File %s \n", 168, "./dir_wr_verbs/is_A_in_b.c"); }; status = (status) ; goto BYE; } } };
  status = add_fld(t1_id, cfld, ddir_id, opfile, I1, -1, &cfld_id, &cfld_rec);
  { if ( (status) < 0 ) { { { fprintf(stderr, "Line %3d of File %s \n", 172, "./dir_wr_verbs/is_A_in_b.c"); }; status = (status) ; goto BYE; } } };
 BYE:
  { if ( ( f1_X == ((void *)0) ) && ( f1_nX != 0 ) ) { { fprintf(stderr, "Line %3d of File %s \n", 174, "./dir_wr_verbs/is_A_in_b.c"); }; return(-1); } if ( ( f1_X != ((void *)0) ) && ( f1_nX == 0 ) ) { { fprintf(stderr, "Line %3d of File %s \n", 174, "./dir_wr_verbs/is_A_in_b.c"); }; return(-1); } if ( f1_X != ((void *)0) ) { munmap(f1_X, f1_nX); f1_X = ((void *)0); f1_nX = 0; } };
  { if ( ( f2_X == ((void *)0) ) && ( f2_nX != 0 ) ) { { fprintf(stderr, "Line %3d of File %s \n", 175, "./dir_wr_verbs/is_A_in_b.c"); }; return(-1); } if ( ( f2_X != ((void *)0) ) && ( f2_nX == 0 ) ) { { fprintf(stderr, "Line %3d of File %s \n", 175, "./dir_wr_verbs/is_A_in_b.c"); }; return(-1); } if ( f2_X != ((void *)0) ) { munmap(f2_X, f2_nX); f2_X = ((void *)0); f2_nX = 0; } };
  { if ( ( cfX == ((void *)0) ) && ( cf_nX != 0 ) ) { { fprintf(stderr, "Line %3d of File %s \n", 176, "./dir_wr_verbs/is_A_in_b.c"); }; return(-1); } if ( ( cfX != ((void *)0) ) && ( cf_nX == 0 ) ) { { fprintf(stderr, "Line %3d of File %s \n", 176, "./dir_wr_verbs/is_A_in_b.c"); }; return(-1); } if ( cfX != ((void *)0) ) { munmap(cfX, cf_nX); cfX = ((void *)0); cf_nX = 0; } };
  { if ( ( nn_f1_X == ((void *)0) ) && ( nn_f1_nX != 0 ) ) { { fprintf(stderr, "Line %3d of File %s \n", 177, "./dir_wr_verbs/is_A_in_b.c"); }; return(-1); } if ( ( nn_f1_X != ((void *)0) ) && ( nn_f1_nX == 0 ) ) { { fprintf(stderr, "Line %3d of File %s \n", 177, "./dir_wr_verbs/is_A_in_b.c"); }; return(-1); } if ( nn_f1_X != ((void *)0) ) { munmap(nn_f1_X, nn_f1_nX); nn_f1_X = ((void *)0); nn_f1_nX = 0; } };
  return(status);
}

variable_types:
cfld
char *

variable_types:
cfX
char *

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

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

variable_types:
opfile
char [-1]

variable_types:
buf
char [16]

variable_types: nT int

variable_types: tid int

variable_types:
lb
long long

variable_types:
ub
long long

variable_types: found int

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


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

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

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

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

variable_types:
in
int *

variable_types:
n
long long

variable_types:
cnt
long long *

variable_types: status int

variable_types: idx int


decompiled_code:
__int64 __fastcall rotl32(int a1, char a2)
{
return (unsigned int)__ROL4__(a1, a2);
}

canonical_decompiled_code:
__int64 __fastcall func0(int a1, char a2)
{
return (unsigned int)__ROL4__(a1, a2);
}

original_code:
__attribute__((always_inline)) uint32_t rotl32 ( uint32_t x, int8_t r )
{
  return (x << r) | (x >> (32 - r));
}

canonical_original_code:
unsigned int rotl32(unsigned int x, char r)
{
  return (x << r) | (x >> (32 - r));
}

variable_types:
x
unsigned int

variable_types: r char

return_type: unsigned int


decompiled_code:
__int64 __fastcall rotl64(__int64 a1, char a2)
{
return __ROL8__(a1, a2);
}

canonical_decompiled_code:
__int64 __fastcall func1(__int64 a1, char a2)
{
return __ROL8__(a1, a2);
}

original_code:
__attribute__((always_inline)) uint64_t rotl64 ( uint64_t x, int8_t r )
{
  return (x << r) | (x >> (64 - r));
}

canonical_original_code:
unsigned long rotl64(unsigned long x, char r)
{
  return (x << r) | (x >> (64 - r));
}

variable_types:
x
unsigned long

return_type: unsigned long


decompiled_code:
__int64 __fastcall getblock_32(__int64 a1, int a2)
{
return *(unsigned int *)(a1 + 4LL * a2);
}

canonical_decompiled_code:
__int64 __fastcall func2(__int64 a1, int a2)
{
return *(unsigned int *)(a1 + 4LL * a2);
}

original_code:
__attribute__((always_inline)) uint32_t getblock_32 ( const uint32_t * p, int i )
{
  return p[i];
}

canonical_original_code:
unsigned int getblock_32(unsigned int *p, int i)
{
  return p[i];
}

variable_types:
p
unsigned int *

variable_types: i int


getblock

decompiled_code:
__int64 __fastcall getblock(__int64 a1, int a2)
{
return *(_QWORD *)(a1 + 8LL * a2);
}

canonical_decompiled_code:
__int64 __fastcall func3(__int64 a1, int a2)
{
return *(_QWORD *)(a1 + 8LL * a2);
}

original_code:
__attribute__((always_inline)) uint64_t getblock ( const uint64_t * p, int i )
{
  return p[i];
}

canonical_original_code:
unsigned long getblock(unsigned long *p, int i)
{
  return p[i];
}

variable_types:
p
unsigned long *


original_code:
__attribute__((always_inline)) uint32_t fmix_32 ( uint32_t h )
{
  h ^= h >> 16;
  h *= 0x85ebca6b;
  h ^= h >> 13;
  h *= 0xc2b2ae35;
  h ^= h >> 16;
  return h;
}

canonical_original_code:
unsigned int fmix_32(unsigned int h)
{
  h ^= h >> 16;
  h *= 0x85ebca6b;
  h ^= h >> 13;
  h *= 0xc2b2ae35;
  h ^= h >> 16;
  return h;
}

variable_types:
h
unsigned int


fmix

original_code:
__attribute__((always_inline)) uint64_t fmix ( uint64_t k )
{
  k ^= k >> 33;
  k *= (0xff51afd7ed558ccdLLU);
  k ^= k >> 33;
  k *= (0xc4ceb9fe1a85ec53LLU);
  k ^= k >> 33;
  return k;
}

canonical_original_code:
unsigned long fmix(unsigned long k)
{
  k ^= k >> 33;
  k *= (0xff51afd7ed558ccdLLU);
  k ^= k >> 33;
  k *= (0xc4ceb9fe1a85ec53LLU);
  k ^= k >> 33;
  return k;
}

variable_types:
k
unsigned long


canonical_original_code:
void MurmurHash3_x86_128(void *key, int len, unsigned int seed, void *out)
{
  unsigned char *data = (const uint8_t*)key;
  int nblocks = len / 16;
  unsigned int h1 = seed;
  unsigned int h2 = seed;
  unsigned int h3 = seed;
  unsigned int h4 = seed;
  unsigned int c1 = 0x239b961b;
  unsigned int c2 = 0xab0e9789;
  unsigned int c3 = 0x38b34ae5;
  unsigned int c4 = 0xa1e38b93;
  unsigned int *blocks = (const uint32_t *)(data + nblocks*16);
  for(int i = -nblocks; i; i++)
  {
    unsigned int k1 = getblock_32(blocks,i*4+0);
    unsigned int k2 = getblock_32(blocks,i*4+1);
    unsigned int k3 = getblock_32(blocks,i*4+2);
    unsigned int k4 = getblock_32(blocks,i*4+3);
    k1 *= c1; k1 = rotl32(k1,15); k1 *= c2; h1 ^= k1;
    h1 = rotl32(h1,19); h1 += h2; h1 = h1*5+0x561ccd1b;
    k2 *= c2; k2 = rotl32(k2,16); k2 *= c3; h2 ^= k2;
    h2 = rotl32(h2,17); h2 += h3; h2 = h2*5+0x0bcaa747;
    k3 *= c3; k3 = rotl32(k3,17); k3 *= c4; h3 ^= k3;
    h3 = rotl32(h3,15); h3 += h4; h3 = h3*5+0x96cd1c35;
    k4 *= c4; k4 = rotl32(k4,18); k4 *= c1; h4 ^= k4;
    h4 = rotl32(h4,13); h4 += h1; h4 = h4*5+0x32ac3b17;
  }
  unsigned char *tail = (const uint8_t*)(data + nblocks*16);
  unsigned int k1 = 0;
  unsigned int k2 = 0;
  unsigned int k3 = 0;
  unsigned int k4 = 0;
  switch(len & 15)
  {
  case 15: k4 ^= tail[14] << 16;
  case 14: k4 ^= tail[13] << 8;
  case 13: k4 ^= tail[12] << 0;
           k4 *= c4; k4 = rotl32(k4,18); k4 *= c1; h4 ^= k4;
  case 12: k3 ^= tail[11] << 24;
  case 11: k3 ^= tail[10] << 16;
  case 10: k3 ^= tail[ 9] << 8;
  case 9: k3 ^= tail[ 8] << 0;
           k3 *= c3; k3 = rotl32(k3,17); k3 *= c4; h3 ^= k3;
  case 8: k2 ^= tail[ 7] << 24;
  case 7: k2 ^= tail[ 6] << 16;
  case 6: k2 ^= tail[ 5] << 8;
  case 5: k2 ^= tail[ 4] << 0;
           k2 *= c2; k2 = rotl32(k2,16); k2 *= c3; h2 ^= k2;
  case 4: k1 ^= tail[ 3] << 24;
  case 3: k1 ^= tail[ 2] << 16;
  case 2: k1 ^= tail[ 1] << 8;
  case 1: k1 ^= tail[ 0] << 0;
           k1 *= c1; k1 = rotl32(k1,15); k1 *= c2; h1 ^= k1;
  };
  h1 ^= len; h2 ^= len; h3 ^= len; h4 ^= len;
  h1 += h2; h1 += h3; h1 += h4;
  h2 += h1; h3 += h1; h4 += h1;
  h1 = fmix(h1);
  h2 = fmix(h2);
  h3 = fmix(h3);
  h4 = fmix(h4);
  h1 += h2; h1 += h3; h1 += h4;
  h2 += h1; h3 += h1; h4 += h1;
  ((unsigned int *)out)[0] = h1;
  ((unsigned int *)out)[1] = h2;
  ((unsigned int *)out)[2] = h3;
  ((unsigned int *)out)[3] = h4;
}

variable_types:
key
void *

variable_types: len int

variable_types:
seed
unsigned int

variable_types:
out
void *

variable_types:
data
unsigned char *

variable_types: nblocks int

variable_types:
blocks
unsigned int *

variable_types:
tail
unsigned char *


decompiled_code:
unsigned __int64 __fastcall MurmurHash3_x64_128(_QWORD *a1, int a2, unsigned int a3, unsigned __int64 *a4)
{
int v5; // esi
_QWORD *v6; // r9
__int64 v7; // rbp
int v9; // esi
__int64 *v10; // rcx
__int64 v11; // r12
int v12; // edi
__int64 v13; // rdx
__int64 v14; // rax
unsigned __int8 *v15; // r9
unsigned __int64 v16; // rdx
unsigned __int64 v17; // rdx
unsigned __int64 v18; // rax
unsigned __int64 v19; // rax
unsigned __int64 v20; // rdx
unsigned __int64 v21; // rdx
unsigned __int64 v22; // rax
unsigned __int64 v23; // rdx
unsigned __int64 v24; // rdx
unsigned __int64 v25; // rax
unsigned __int64 v26; // rax
unsigned __int64 v27; // rdx
unsigned __int64 v28; // rdx
__int64 v29; // rax
unsigned __int64 v30; // rbp
unsigned __int64 v31; // r12
unsigned __int64 v32; // rdx
unsigned __int64 v33; // rax
unsigned __int64 result; // rax

v5 = a2 + 15;
v6 = a1;
v7 = a3;
if ( a2 >= 0 )
v5 = a2;
v9 = v5 >> 4;
if ( a2 <= 15 )
{
v11 = a3;
}
else
{
v10 = a1;
v11 = a3;
v12 = 0;
do
{
v13 = *v10;
v14 = v10[1];
++v12;
v10 += 2;
v7 = 5 * (v11 + __ROL8__(v7 ^ (0x4CF5AD432745937FLL * __ROL8__(0x87C37B91114253D5LL * v13, 31)), 27)) + 1390208809;
v11 = 5 * (v7 + __ROL8__(v11 ^ (0x87C37B91114253D5LL * __ROR8__(0x4CF5AD432745937FLL * v14, 31)), 31)) + 944331445;
}
while ( v9 > v12 );
}
v15 = (unsigned __int8 *)&v6[2 * v9];
switch ( a2 & 0xF )
{
case 0:
goto LABEL_22;
case 1:
v28 = 0LL;
goto LABEL_21;
case 2:
v27 = 0LL;
goto LABEL_20;
case 3:
v26 = 0LL;
goto LABEL_19;
case 4:
v25 = 0LL;
goto LABEL_18;
case 5:
v24 = 0LL;
goto LABEL_17;
case 6:
v23 = 0LL;
goto LABEL_16;
case 7:
v22 = 0LL;
goto LABEL_15;
case 8:
goto LABEL_14;
case 9:
v21 = 0LL;
goto LABEL_13;
case 0xA:
v20 = 0LL;
goto LABEL_12;
case 0xB:
v19 = 0LL;
goto LABEL_11;
case 0xC:
v18 = 0LL;
goto LABEL_10;
case 0xD:
v17 = 0LL;
goto LABEL_9;
case 0xE:
v16 = 0LL;
goto LABEL_8;
case 0xF:
v16 = (unsigned __int64)v15[14] << 48;
LABEL_8:
v17 = ((unsigned __int64)v15[13] << 40) ^ v16;
LABEL_9:
v18 = v17 ^ ((unsigned __int64)v15[12] << 32);
LABEL_10:
v19 = ((unsigned __int64)v15[11] << 24) ^ v18;
LABEL_11:
v20 = v19 ^ ((unsigned __int64)v15[10] << 16);
LABEL_12:
v21 = ((unsigned __int64)v15[9] << 8) ^ v20;
LABEL_13:
v11 ^= 0x87C37B91114253D5LL * __ROR8__(0x4CF5AD432745937FLL * (v21 ^ v15[8]), 31);
LABEL_14:
v22 = (unsigned __int64)v15[7] << 56;
LABEL_15:
v23 = v22 ^ ((unsigned __int64)v15[6] << 48);
LABEL_16:
v24 = ((unsigned __int64)v15[5] << 40) ^ v23;
LABEL_17:
v25 = v24 ^ ((unsigned __int64)v15[4] << 32);
LABEL_18:
v26 = ((unsigned __int64)v15[3] << 24) ^ v25;
LABEL_19:
v27 = v26 ^ ((unsigned __int64)v15[2] << 16);
LABEL_20:
v28 = ((unsigned __int64)v15[1] << 8) ^ v27;
LABEL_21:
v7 ^= 0x4CF5AD432745937FLL * __ROL8__(0x87C37B91114253D5LL * (v28 ^ *v15), 31);
LABEL_22:
v29 = v11 ^ a2;
v30 = v29 + (a2 ^ (unsigned __int64)v7);
v31 = v29 + v30;
v32 = ((0xC4CEB9FE1A85EC53LL
* ((0xFF51AFD7ED558CCDLL * ((v31 >> 33) ^ v31)) ^ ((0xFF51AFD7ED558CCDLL * ((v31 >> 33) ^ v31)) >> 33))) >> 33) ^ (0xC4CEB9FE1A85EC53LL * ((0xFF51AFD7ED558CCDLL * ((v31 >> 33) ^ v31)) ^ ((0xFF51AFD7ED558CCDLL * ((v31 >> 33) ^ v31)) >> 33)));
v33 = v32
+ (((0xC4CEB9FE1A85EC53LL
* ((0xFF51AFD7ED558CCDLL * ((v30 >> 33) ^ v30)) ^ ((0xFF51AFD7ED558CCDLL * ((v30 >> 33) ^ v30)) >> 33))) >> 33) ^ (0xC4CEB9FE1A85EC53LL * ((0xFF51AFD7ED558CCDLL * ((v30 >> 33) ^ v30)) ^ ((0xFF51AFD7ED558CCDLL * ((v30 >> 33) ^ v30)) >> 33))));
*a4 = v33;
result = v32 + v33;
a4[1] = result;
return result;
}
}

canonical_decompiled_code:
unsigned __int64 __fastcall func8(_QWORD *a1, int a2, unsigned int a3, unsigned __int64 *a4)
{
int v5; // esi
_QWORD *v6; // r9
__int64 v7; // rbp
int v9; // esi
__int64 *v10; // rcx
__int64 v11; // r12
int v12; // edi
__int64 v13; // rdx
__int64 v14; // rax
unsigned __int8 *v15; // r9
unsigned __int64 v16; // rdx
unsigned __int64 v17; // rdx
unsigned __int64 v18; // rax
unsigned __int64 v19; // rax
unsigned __int64 v20; // rdx
unsigned __int64 v21; // rdx
unsigned __int64 v22; // rax
unsigned __int64 v23; // rdx
unsigned __int64 v24; // rdx
unsigned __int64 v25; // rax
unsigned __int64 v26; // rax
unsigned __int64 v27; // rdx
unsigned __int64 v28; // rdx
__int64 v29; // rax
unsigned __int64 v30; // rbp
unsigned __int64 v31; // r12
unsigned __int64 v32; // rdx
unsigned __int64 v33; // rax
unsigned __int64 result; // rax

v5 = a2 + 15;
v6 = a1;
v7 = a3;
if ( a2 >= 0 )
v5 = a2;
v9 = v5 >> 4;
if ( a2 <= 15 )
{
v11 = a3;
}
else
{
v10 = a1;
v11 = a3;
v12 = 0;
do
{
v13 = *v10;
v14 = v10[1];
++v12;
v10 += 2;
v7 = 5 * (v11 + __ROL8__(v7 ^ (0x4CF5AD432745937FLL * __ROL8__(0x87C37B91114253D5LL * v13, 31)), 27)) + 1390208809;
v11 = 5 * (v7 + __ROL8__(v11 ^ (0x87C37B91114253D5LL * __ROR8__(0x4CF5AD432745937FLL * v14, 31)), 31)) + 944331445;
}
while ( v9 > v12 );
}
v15 = (unsigned __int8 *)&v6[2 * v9];
switch ( a2 & 0xF )
{
case 0:
goto LABEL_22;
case 1:
v28 = 0LL;
goto LABEL_21;
case 2:
v27 = 0LL;
goto LABEL_20;
case 3:
v26 = 0LL;
goto LABEL_19;
case 4:
v25 = 0LL;
goto LABEL_18;
case 5:
v24 = 0LL;
goto LABEL_17;
case 6:
v23 = 0LL;
goto LABEL_16;
case 7:
v22 = 0LL;
goto LABEL_15;
case 8:
goto LABEL_14;
case 9:
v21 = 0LL;
goto LABEL_13;
case 0xA:
v20 = 0LL;
goto LABEL_12;
case 0xB:
v19 = 0LL;
goto LABEL_11;
case 0xC:
v18 = 0LL;
goto LABEL_10;
case 0xD:
v17 = 0LL;
goto LABEL_9;
case 0xE:
v16 = 0LL;
goto LABEL_8;
case 0xF:
v16 = (unsigned __int64)v15[14] << 48;
LABEL_8:
v17 = ((unsigned __int64)v15[13] << 40) ^ v16;
LABEL_9:
v18 = v17 ^ ((unsigned __int64)v15[12] << 32);
LABEL_10:
v19 = ((unsigned __int64)v15[11] << 24) ^ v18;
LABEL_11:
v20 = v19 ^ ((unsigned __int64)v15[10] << 16);
LABEL_12:
v21 = ((unsigned __int64)v15[9] << 8) ^ v20;
LABEL_13:
v11 ^= 0x87C37B91114253D5LL * __ROR8__(0x4CF5AD432745937FLL * (v21 ^ v15[8]), 31);
LABEL_14:
v22 = (unsigned __int64)v15[7] << 56;
LABEL_15:
v23 = v22 ^ ((unsigned __int64)v15[6] << 48);
LABEL_16:
v24 = ((unsigned __int64)v15[5] << 40) ^ v23;
LABEL_17:
v25 = v24 ^ ((unsigned __int64)v15[4] << 32);
LABEL_18:
v26 = ((unsigned __int64)v15[3] << 24) ^ v25;
LABEL_19:
v27 = v26 ^ ((unsigned __int64)v15[2] << 16);
LABEL_20:
v28 = ((unsigned __int64)v15[1] << 8) ^ v27;
LABEL_21:
v7 ^= 0x4CF5AD432745937FLL * __ROL8__(0x87C37B91114253D5LL * (v28 ^ *v15), 31);
LABEL_22:
v29 = v11 ^ a2;
v30 = v29 + (a2 ^ (unsigned __int64)v7);
v31 = v29 + v30;
v32 = ((0xC4CEB9FE1A85EC53LL
* ((0xFF51AFD7ED558CCDLL * ((v31 >> 33) ^ v31)) ^ ((0xFF51AFD7ED558CCDLL * ((v31 >> 33) ^ v31)) >> 33))) >> 33) ^ (0xC4CEB9FE1A85EC53LL * ((0xFF51AFD7ED558CCDLL * ((v31 >> 33) ^ v31)) ^ ((0xFF51AFD7ED558CCDLL * ((v31 >> 33) ^ v31)) >> 33)));
v33 = v32
+ (((0xC4CEB9FE1A85EC53LL
* ((0xFF51AFD7ED558CCDLL * ((v30 >> 33) ^ v30)) ^ ((0xFF51AFD7ED558CCDLL * ((v30 >> 33) ^ v30)) >> 33))) >> 33) ^ (0xC4CEB9FE1A85EC53LL * ((0xFF51AFD7ED558CCDLL * ((v30 >> 33) ^ v30)) ^ ((0xFF51AFD7ED558CCDLL * ((v30 >> 33) ^ v30)) >> 33))));
*a4 = v33;
result = v32 + v33;
a4[1] = result;
return result;
}
}

canonical_original_code:
void MurmurHash3_x64_128(void *key, int len, unsigned int seed, void *out)
{
  unsigned char *data = (const uint8_t*)key;
  int nblocks = len / 16;
  unsigned long h1 = seed;
  unsigned long h2 = seed;
  unsigned long c1 = (0x87c37b91114253d5LLU);
  unsigned long c2 = (0x4cf5ad432745937fLLU);
  unsigned long *blocks = (const uint64_t *)(data);
  for(int i = 0; i < nblocks; i++)
  {
    unsigned long k1 = getblock(blocks,i*2+0);
    unsigned long k2 = getblock(blocks,i*2+1);
    k1 *= c1; k1 = rotl64(k1,31); k1 *= c2; h1 ^= k1;
    h1 = rotl64(h1,27); h1 += h2; h1 = h1*5+0x52dce729;
    k2 *= c2; k2 = rotl64(k2,33); k2 *= c1; h2 ^= k2;
    h2 = rotl64(h2,31); h2 += h1; h2 = h2*5+0x38495ab5;
  }
  unsigned char *tail = (const uint8_t*)(data + nblocks*16);
  unsigned long k1 = 0;
  unsigned long k2 = 0;
  switch(len & 15)
  {
  case 15: k2 ^= (unsigned long)(tail[14]) << 48;
  case 14: k2 ^= (unsigned long)(tail[13]) << 40;
  case 13: k2 ^= (unsigned long)(tail[12]) << 32;
  case 12: k2 ^= (unsigned long)(tail[11]) << 24;
  case 11: k2 ^= (unsigned long)(tail[10]) << 16;
  case 10: k2 ^= (unsigned long)(tail[ 9]) << 8;
  case 9: k2 ^= (unsigned long)(tail[ 8]) << 0;
           k2 *= c2; k2 = rotl64(k2,33); k2 *= c1; h2 ^= k2;
  case 8: k1 ^= (unsigned long)(tail[ 7]) << 56;
  case 7: k1 ^= (unsigned long)(tail[ 6]) << 48;
  case 6: k1 ^= (unsigned long)(tail[ 5]) << 40;
  case 5: k1 ^= (unsigned long)(tail[ 4]) << 32;
  case 4: k1 ^= (unsigned long)(tail[ 3]) << 24;
  case 3: k1 ^= (unsigned long)(tail[ 2]) << 16;
  case 2: k1 ^= (unsigned long)(tail[ 1]) << 8;
  case 1: k1 ^= (unsigned long)(tail[ 0]) << 0;
           k1 *= c1; k1 = rotl64(k1,31); k1 *= c2; h1 ^= k1;
  };
  h1 ^= len; h2 ^= len;
  h1 += h2;
  h2 += h1;
  h1 = fmix(h1);
  h2 = fmix(h2);
  h1 += h2;
  h2 += h1;
  ((unsigned long *)out)[0] = h1;
  ((unsigned long *)out)[1] = h2;
}

variable_types:
blocks
unsigned long *


subsample

decompiled_code:
__int64 __fastcall subsample(const char *a1, _BYTE *a2, const char *a3, const char *a4, _BYTE *a5)
{
const char *v5; // r14
_BYTE *v6; // r15
__int64 v8; // rax
__int64 v9; // rdx
int v10; // er13
__int64 v11; // rcx
__int64 v12; // rdx
unsigned int v13; // er12
__int64 v14; // rbp
__int64 v15; // r13
__int64 v16; // rax
__int64 v17; // rbx
__int64 v18; // rax
__int64 v19; // rdi
__int64 v20; // r13
char *v21; // rcx
char *v22; // rbx
unsigned __int64 v23; // rbp
_QWORD *v24; // r14
_QWORD *v25; // r15
unsigned int v26; // eax
__int64 v28; // rdx
__int64 v29; // r13
char *v30; // rcx
char *v31; // rbx
unsigned __int64 v32; // rbp
_DWORD *v33; // r14
_DWORD *i; // r15
unsigned int v35; // eax
__int64 v36; // rdx
__int64 v37; // [rsp+0h] [rbp-508h]
__int64 v38; // [rsp+0h] [rbp-508h]
__int64 v39; // [rsp+8h] [rbp-500h]
__int64 v40; // [rsp+10h] [rbp-4F8h]
__int64 v41; // [rsp+18h] [rbp-4F0h]
__int64 v42; // [rsp+20h] [rbp-4E8h]
__int64 v43; // [rsp+28h] [rbp-4E0h]
__int64 v44; // [rsp+30h] [rbp-4D8h]
int v45; // [rsp+38h] [rbp-4D0h]
int v46; // [rsp+3Ch] [rbp-4CCh]
const char *v47; // [rsp+40h] [rbp-4C8h]
_BYTE *v48; // [rsp+48h] [rbp-4C0h]
unsigned int v49; // [rsp+50h] [rbp-4B8h] BYREF
unsigned int v50; // [rsp+54h] [rbp-4B4h] BYREF
int v51; // [rsp+58h] [rbp-4B0h] BYREF
int v52; // [rsp+5Ch] [rbp-4ACh] BYREF
int v53; // [rsp+60h] [rbp-4A8h] BYREF
int v54; // [rsp+64h] [rbp-4A4h] BYREF
unsigned int v55; // [rsp+68h] [rbp-4A0h] BYREF
int v56; // [rsp+6Ch] [rbp-49Ch] BYREF
void *addr; // [rsp+70h] [rbp-498h] BYREF
size_t len; // [rsp+78h] [rbp-490h] BYREF
void *v59; // [rsp+80h] [rbp-488h] BYREF
size_t v60; // [rsp+88h] [rbp-480h] BYREF
char *endptr; // [rsp+90h] [rbp-478h] BYREF
__int64 v62; // [rsp+98h] [rbp-470h] BYREF
char v63[16]; // [rsp+A0h] [rbp-468h] BYREF
char s[32]; // [rsp+B0h] [rbp-458h] BYREF
__int64 v65[22]; // [rsp+D0h] [rbp-438h] BYREF
char v66[176]; // [rsp+180h] [rbp-388h] BYREF
__int64 v67; // [rsp+230h] [rbp-2D8h] BYREF
__int64 v68; // [rsp+248h] [rbp-2C0h]
char v69[224]; // [rsp+310h] [rbp-1F8h] BYREF
char v70[280]; // [rsp+3F0h] [rbp-118h] BYREF

addr = 0LL;
len = 0LL;
v59 = 0LL;
v60 = 0LL;
v49 = 0x80000000;
v50 = 0x80000000;
v51 = 0x80000000;
v52 = 0x80000000;
v53 = 0x80000000;
v54 = 0x7FFFFFFF;
v55 = 0x7FFFFFFF;
if ( !a1 || !*a1 )
{
v9 = 61LL;
goto LABEL_47;
}
if ( !a2 || !*a2 )
{
v9 = 62LL;
goto LABEL_47;
}
v5 = a4;
if ( !a4 || !*a4 )
{
v9 = 63LL;
goto LABEL_47;
}
v6 = a5;
if ( !a5 || !*a5 )
{
v9 = 64LL;
goto LABEL_47;
}
if ( !strcmp(a1, a4) )
{
v10 = -1;
fprintf(stderr, "Line %3d of File %s \n", 65LL, "./dir_wr_verbs/subsample.c");
goto LABEL_48;
}
v8 = strtoll(a3, &endptr, 10);
v9 = 68LL;
v39 = v8;
if ( v8 <= 0 )
goto LABEL_47;
zero_string(v63, 16LL, 68LL, "./dir_wr_verbs/subsample.c");
v10 = is_tbl(a1, &v49, v65);
if ( v10 < 0 )
{
fprintf(stderr, "Line %3d of File %s \n", 71LL, "./dir_wr_verbs/subsample.c");
goto LABEL_48;
}
v9 = 72LL;
if ( (v49 & 0x80000000) != 0 )
goto LABEL_47;
v42 = v65[0];
v10 = is_fld(0LL, v49, a2, &v51, &v67, &v53, v70);
if ( v10 < 0 )
{
fprintf(stderr, "Line %3d of File %s \n", 75LL, "./dir_wr_verbs/subsample.c");
goto LABEL_48;
}
v9 = 76LL;
if ( v51 < 0 )
goto LABEL_47;
v10 = get_data(&addr, &len, 0LL, "./dir_wr_verbs/subsample.c");
if ( v10 < 0 )
{
fprintf(stderr, "Line %3d of File %s \n", 77LL, "./dir_wr_verbs/subsample.c");
goto LABEL_48;
}
v9 = 79LL;
if ( v53 >= 0 || (v9 = 80LL, (_DWORD)v68 != 4) || (v9 = 83LL, v39 >= v42) )
{
LABEL_47:
v10 = -1;
fprintf(stderr, "Line %3d of File %s \n", v9, "./dir_wr_verbs/subsample.c");
goto LABEL_48;
}
v10 = get_fld_sz(4LL, &v54, 83LL, "./dir_wr_verbs/subsample.c");
if ( v10 < 0 )
{
fprintf(stderr, "Line %3d of File %s \n", 85LL, "./dir_wr_verbs/subsample.c");
goto LABEL_48;
}
v10 = mk_temp_file(v63, v39 * v54, &v55);
if ( v10 < 0 )
{
fprintf(stderr, "Line %3d of File %s \n", 86LL, "./dir_wr_verbs/subsample.c");
goto LABEL_48;
}
v10 = q_mmap(v55, v63, &v59, &v60, 1LL);
if ( v10 < 0 )
{
fprintf(stderr, "Line %3d of File %s \n", 87LL, "./dir_wr_verbs/subsample.c");
goto LABEL_48;
}
v10 = partition(v39, 1024LL, 0xFFFFFFFFLL, &v62, &v56);
if ( v10 < 0 )
{
fprintf(stderr, "Line %3d of File %s \n", 90LL, "./dir_wr_verbs/subsample.c");
goto LABEL_48;
}
v11 = v56;
v44 = v42 / v56;
v12 = 2LL;
if ( (unsigned int)(v42 / v39) != 1 )
v12 = (unsigned int)(v42 / v39);
v13 = v12;
if ( v56 <= 0 )
{
LABEL_80:
v10 = del_tbl(v5, 0xFFFFFFFFLL, v12, v11);
if ( v10 < 0 )
{
fprintf(stderr, "Line %3d of File %s \n", 126LL, "./dir_wr_verbs/subsample.c");
}
else
{
sprintf(s, "%lld", v39);
v10 = add_tbl(v5, s, &v50, v66);
if ( v10 < 0 )
{
fprintf(stderr, "Line %3d of File %s \n", 129LL, "./dir_wr_verbs/subsample.c");
}
else
{
v10 = add_fld(v50, v6, v55, v63, (unsigned int)v68, 0xFFFFFFFFLL, &v52, v69);
if ( v10 < 0 )
fprintf(stderr, "Line %3d of File %s \n", 131LL, "./dir_wr_verbs/subsample.c");
}
}
goto LABEL_48;
}
v45 = 2059879141;
v43 = 0LL;
v41 = 0LL;
v46 = v10;
v47 = v5;
v48 = v6;
do
{
v14 = v42;
v15 = v43;
v16 = v44 + v43;
v43 += v44;
if ( v43 <= v42 )
v14 = v16;
if ( v15 >= v14 )
{
v36 = 98LL;
LABEL_78:
fprintf(stderr, "Line %3d of File %s \n", v36, "./dir_wr_verbs/subsample.c");
v46 = -1;
goto LABEL_29;
}
v17 = v62 * v41;
v18 = v39 - v62 * v41;
if ( (_DWORD)v11 - 1 != (_DWORD)v41 )
v18 = v62;
v40 = v18;
srand48(v45);
v19 = (unsigned int)mrand48();
if ( (_DWORD)v68 == 4 )
{
v29 = 4 * v15;
v30 = (char *)addr + v29;
v31 = (char *)v59 + 4 * v17;
if ( v40 > 0 )
{
v38 = 0LL;
v32 = 4 * v14;
do
{
v33 = v31;
LABEL_72:
for ( i = v30; ; i = (char *)addr + v29 )
{
v35 = mix_I4(v19);
v30 = (char *)(i + 1);
v19 = v35;
v12 = v35 % v13;
if ( !(v35 % v13) )
break;
if ( (unsigned __int64)v30 < v32 )
goto LABEL_72;
}
v31 += 4;
*v33 = *i;
if ( (unsigned __int64)v30 >= v32 )
v30 = (char *)addr + v29;
++v38;
}
while ( v40 != v38 );
}
}
else
{
if ( (_DWORD)v68 != 5 )
{
if ( v46 )
{
v46 = -1;
goto LABEL_29;
}
v36 = 120LL;
goto LABEL_78;
}
v20 = 8 * v15;
v21 = (char *)addr + v20;
v22 = (char *)v59 + 8 * v17;
if ( v40 > 0 )
{
v37 = 0LL;
v23 = 8 * v14;
do
{
v24 = v22;
v25 = v21;
while ( 1 )
{
v26 = mix_I8(v19);
v21 = (char *)(v25 + 1);
v19 = v26;
v12 = v26 % v13;
if ( !(v26 % v13) )
break;
++v25;
if ( (unsigned __int64)v21 >= v23 )
v25 = (char *)addr + v20;
}
v22 += 8;
*v24 = *v25;
if ( (unsigned __int64)v21 >= v23 )
v21 = (char *)addr + v20;
++v37;
}
while ( v40 != v37 );
}
}
LABEL_29:
++v41;
v11 = (unsigned int)v56;
v45 += 2059879141;
}
while ( v56 > (int)v41 );
v10 = v46;
v5 = v47;
v6 = v48;
if ( v46 != -1 )
goto LABEL_80;
fprintf(stderr, "Line %3d of File %s \n", 124LL, "./dir_wr_verbs/subsample.c");
LABEL_48:
if ( !addr )
{
if ( len )
goto LABEL_57;
LABEL_51:
if ( v59 )
{
if ( v60 )
{
munmap(v59, v60);
return (unsigned int)v10;
}
}
else if ( !v60 )
{
return (unsigned int)v10;
}
v28 = 134LL;
goto LABEL_58;
}
if ( len )
{
munmap(addr, len);
addr = 0LL;
len = 0LL;
goto LABEL_51;
}
LABEL_57:
v28 = 133LL;
LABEL_58:
v10 = -1;
fprintf(stderr, "Line %3d of File %s \n", v28, "./dir_wr_verbs/subsample.c");
return (unsigned int)v10;
}

canonical_decompiled_code:
__int64 __fastcall func0(const char *a1, _BYTE *a2, const char *a3, const char *a4, _BYTE *a5)
{
const char *v5; // r14
_BYTE *v6; // r15
__int64 v8; // rax
__int64 v9; // rdx
int v10; // er13
__int64 v11; // rcx
__int64 v12; // rdx
unsigned int v13; // er12
__int64 v14; // rbp
__int64 v15; // r13
__int64 v16; // rax
__int64 v17; // rbx
__int64 v18; // rax
__int64 v19; // rdi
__int64 v20; // r13
char *v21; // rcx
char *v22; // rbx
unsigned __int64 v23; // rbp
_QWORD *v24; // r14
_QWORD *v25; // r15
unsigned int v26; // eax
__int64 v28; // rdx
__int64 v29; // r13
char *v30; // rcx
char *v31; // rbx
unsigned __int64 v32; // rbp
_DWORD *v33; // r14
_DWORD *i; // r15
unsigned int v35; // eax
__int64 v36; // rdx
__int64 v37; // [rsp+0h] [rbp-508h]
__int64 v38; // [rsp+0h] [rbp-508h]
__int64 v39; // [rsp+8h] [rbp-500h]
__int64 v40; // [rsp+10h] [rbp-4F8h]
__int64 v41; // [rsp+18h] [rbp-4F0h]
__int64 v42; // [rsp+20h] [rbp-4E8h]
__int64 v43; // [rsp+28h] [rbp-4E0h]
__int64 v44; // [rsp+30h] [rbp-4D8h]
int v45; // [rsp+38h] [rbp-4D0h]
int v46; // [rsp+3Ch] [rbp-4CCh]
const char *v47; // [rsp+40h] [rbp-4C8h]
_BYTE *v48; // [rsp+48h] [rbp-4C0h]
unsigned int v49; // [rsp+50h] [rbp-4B8h] BYREF
unsigned int v50; // [rsp+54h] [rbp-4B4h] BYREF
int v51; // [rsp+58h] [rbp-4B0h] BYREF
int v52; // [rsp+5Ch] [rbp-4ACh] BYREF
int v53; // [rsp+60h] [rbp-4A8h] BYREF
int v54; // [rsp+64h] [rbp-4A4h] BYREF
unsigned int v55; // [rsp+68h] [rbp-4A0h] BYREF
int v56; // [rsp+6Ch] [rbp-49Ch] BYREF
void *addr; // [rsp+70h] [rbp-498h] BYREF
size_t len; // [rsp+78h] [rbp-490h] BYREF
void *v59; // [rsp+80h] [rbp-488h] BYREF
size_t v60; // [rsp+88h] [rbp-480h] BYREF
char *endptr; // [rsp+90h] [rbp-478h] BYREF
__int64 v62; // [rsp+98h] [rbp-470h] BYREF
char v63[16]; // [rsp+A0h] [rbp-468h] BYREF
char s[32]; // [rsp+B0h] [rbp-458h] BYREF
__int64 v65[22]; // [rsp+D0h] [rbp-438h] BYREF
char v66[176]; // [rsp+180h] [rbp-388h] BYREF
__int64 v67; // [rsp+230h] [rbp-2D8h] BYREF
__int64 v68; // [rsp+248h] [rbp-2C0h]
char v69[224]; // [rsp+310h] [rbp-1F8h] BYREF
char v70[280]; // [rsp+3F0h] [rbp-118h] BYREF

addr = 0LL;
len = 0LL;
v59 = 0LL;
v60 = 0LL;
v49 = 0x80000000;
v50 = 0x80000000;
v51 = 0x80000000;
v52 = 0x80000000;
v53 = 0x80000000;
v54 = 0x7FFFFFFF;
v55 = 0x7FFFFFFF;
if ( !a1 || !*a1 )
{
v9 = 61LL;
goto LABEL_47;
}
if ( !a2 || !*a2 )
{
v9 = 62LL;
goto LABEL_47;
}
v5 = a4;
if ( !a4 || !*a4 )
{
v9 = 63LL;
goto LABEL_47;
}
v6 = a5;
if ( !a5 || !*a5 )
{
v9 = 64LL;
goto LABEL_47;
}
if ( !strcmp(a1, a4) )
{
v10 = -1;
fprintf(stderr, "Line %3d of File %s \n", 65LL, "./dir_wr_verbs/subsample.c");
goto LABEL_48;
}
v8 = strtoll(a3, &endptr, 10);
v9 = 68LL;
v39 = v8;
if ( v8 <= 0 )
goto LABEL_47;
zero_string(v63, 16LL, 68LL, "./dir_wr_verbs/subsample.c");
v10 = is_tbl(a1, &v49, v65);
if ( v10 < 0 )
{
fprintf(stderr, "Line %3d of File %s \n", 71LL, "./dir_wr_verbs/subsample.c");
goto LABEL_48;
}
v9 = 72LL;
if ( (v49 & 0x80000000) != 0 )
goto LABEL_47;
v42 = v65[0];
v10 = is_fld(0LL, v49, a2, &v51, &v67, &v53, v70);
if ( v10 < 0 )
{
fprintf(stderr, "Line %3d of File %s \n", 75LL, "./dir_wr_verbs/subsample.c");
goto LABEL_48;
}
v9 = 76LL;
if ( v51 < 0 )
goto LABEL_47;
v10 = get_data(&addr, &len, 0LL, "./dir_wr_verbs/subsample.c");
if ( v10 < 0 )
{
fprintf(stderr, "Line %3d of File %s \n", 77LL, "./dir_wr_verbs/subsample.c");
goto LABEL_48;
}
v9 = 79LL;
if ( v53 >= 0 || (v9 = 80LL, (_DWORD)v68 != 4) || (v9 = 83LL, v39 >= v42) )
{
LABEL_47:
v10 = -1;
fprintf(stderr, "Line %3d of File %s \n", v9, "./dir_wr_verbs/subsample.c");
goto LABEL_48;
}
v10 = get_fld_sz(4LL, &v54, 83LL, "./dir_wr_verbs/subsample.c");
if ( v10 < 0 )
{
fprintf(stderr, "Line %3d of File %s \n", 85LL, "./dir_wr_verbs/subsample.c");
goto LABEL_48;
}
v10 = mk_temp_file(v63, v39 * v54, &v55);
if ( v10 < 0 )
{
fprintf(stderr, "Line %3d of File %s \n", 86LL, "./dir_wr_verbs/subsample.c");
goto LABEL_48;
}
v10 = q_mmap(v55, v63, &v59, &v60, 1LL);
if ( v10 < 0 )
{
fprintf(stderr, "Line %3d of File %s \n", 87LL, "./dir_wr_verbs/subsample.c");
goto LABEL_48;
}
v10 = partition(v39, 1024LL, 0xFFFFFFFFLL, &v62, &v56);
if ( v10 < 0 )
{
fprintf(stderr, "Line %3d of File %s \n", 90LL, "./dir_wr_verbs/subsample.c");
goto LABEL_48;
}
v11 = v56;
v44 = v42 / v56;
v12 = 2LL;
if ( (unsigned int)(v42 / v39) != 1 )
v12 = (unsigned int)(v42 / v39);
v13 = v12;
if ( v56 <= 0 )
{
LABEL_80:
v10 = del_tbl(v5, 0xFFFFFFFFLL, v12, v11);
if ( v10 < 0 )
{
fprintf(stderr, "Line %3d of File %s \n", 126LL, "./dir_wr_verbs/subsample.c");
}
else
{
sprintf(s, "%lld", v39);
v10 = add_tbl(v5, s, &v50, v66);
if ( v10 < 0 )
{
fprintf(stderr, "Line %3d of File %s \n", 129LL, "./dir_wr_verbs/subsample.c");
}
else
{
v10 = add_fld(v50, v6, v55, v63, (unsigned int)v68, 0xFFFFFFFFLL, &v52, v69);
if ( v10 < 0 )
fprintf(stderr, "Line %3d of File %s \n", 131LL, "./dir_wr_verbs/subsample.c");
}
}
goto LABEL_48;
}
v45 = 2059879141;
v43 = 0LL;
v41 = 0LL;
v46 = v10;
v47 = v5;
v48 = v6;
do
{
v14 = v42;
v15 = v43;
v16 = v44 + v43;
v43 += v44;
if ( v43 <= v42 )
v14 = v16;
if ( v15 >= v14 )
{
v36 = 98LL;
LABEL_78:
fprintf(stderr, "Line %3d of File %s \n", v36, "./dir_wr_verbs/subsample.c");
v46 = -1;
goto LABEL_29;
}
v17 = v62 * v41;
v18 = v39 - v62 * v41;
if ( (_DWORD)v11 - 1 != (_DWORD)v41 )
v18 = v62;
v40 = v18;
srand48(v45);
v19 = (unsigned int)mrand48();
if ( (_DWORD)v68 == 4 )
{
v29 = 4 * v15;
v30 = (char *)addr + v29;
v31 = (char *)v59 + 4 * v17;
if ( v40 > 0 )
{
v38 = 0LL;
v32 = 4 * v14;
do
{
v33 = v31;
LABEL_72:
for ( i = v30; ; i = (char *)addr + v29 )
{
v35 = mix_I4(v19);
v30 = (char *)(i + 1);
v19 = v35;
v12 = v35 % v13;
if ( !(v35 % v13) )
break;
if ( (unsigned __int64)v30 < v32 )
goto LABEL_72;
}
v31 += 4;
*v33 = *i;
if ( (unsigned __int64)v30 >= v32 )
v30 = (char *)addr + v29;
++v38;
}
while ( v40 != v38 );
}
}
else
{
if ( (_DWORD)v68 != 5 )
{
if ( v46 )
{
v46 = -1;
goto LABEL_29;
}
v36 = 120LL;
goto LABEL_78;
}
v20 = 8 * v15;
v21 = (char *)addr + v20;
v22 = (char *)v59 + 8 * v17;
if ( v40 > 0 )
{
v37 = 0LL;
v23 = 8 * v14;
do
{
v24 = v22;
v25 = v21;
while ( 1 )
{
v26 = mix_I8(v19);
v21 = (char *)(v25 + 1);
v19 = v26;
v12 = v26 % v13;
if ( !(v26 % v13) )
break;
++v25;
if ( (unsigned __int64)v21 >= v23 )
v25 = (char *)addr + v20;
}
v22 += 8;
*v24 = *v25;
if ( (unsigned __int64)v21 >= v23 )
v21 = (char *)addr + v20;
++v37;
}
while ( v40 != v37 );
}
}
LABEL_29:
++v41;
v11 = (unsigned int)v56;
v45 += 2059879141;
}
while ( v56 > (int)v41 );
v10 = v46;
v5 = v47;
v6 = v48;
if ( v46 != -1 )
goto LABEL_80;
fprintf(stderr, "Line %3d of File %s \n", 124LL, "./dir_wr_verbs/subsample.c");
LABEL_48:
if ( !addr )
{
if ( len )
goto LABEL_57;
LABEL_51:
if ( v59 )
{
if ( v60 )
{
munmap(v59, v60);
return (unsigned int)v10;
}
}
else if ( !v60 )
{
return (unsigned int)v10;
}
v28 = 134LL;
goto LABEL_58;
}
if ( len )
{
munmap(addr, len);
addr = 0LL;
len = 0LL;
goto LABEL_51;
}
LABEL_57:
v28 = 133LL;
LABEL_58:
v10 = -1;
fprintf(stderr, "Line %3d of File %s \n", v28, "./dir_wr_verbs/subsample.c");
return (unsigned int)v10;
}

original_code:
int
subsample(
   char *t1,
   char *f1,
   char *str_nR2,
   char *t2,
   char *f2
   )
{
  int status = 0;
  char *f1_X = ((void *)0); size_t f1_nX = 0;
  char *f2_X = ((void *)0); size_t f2_nX = 0;
  TBL_REC_TYPE t1_rec, t2_rec;
  FLD_REC_TYPE f1_rec, f2_rec;
  FLD_REC_TYPE nn_f1_rec;
  long long nR1, nR2;
  int t1_id = (-0x7fffffff - 1), t2_id = (-0x7fffffff - 1);
  int f1_id = (-0x7fffffff - 1), f2_id = (-0x7fffffff - 1);
  int nn_f1_id = (-0x7fffffff - 1);
  char opfile[15 +1];
  int fldsz = 0x7fffffff, ddir_id = 0x7fffffff;
   long long chk_nR2 = 0;
  if ( ( t1 == ((void *)0) ) || ( *t1 == '\0' ) ) { { { fprintf(stderr, "Line %3d of File %s \n", 61, "./dir_wr_verbs/subsample.c"); }; status = -1 ; goto BYE; }; }
  if ( ( f1 == ((void *)0) ) || ( *f1 == '\0' ) ) { { { fprintf(stderr, "Line %3d of File %s \n", 62, "./dir_wr_verbs/subsample.c"); }; status = -1 ; goto BYE; }; }
  if ( ( t2 == ((void *)0) ) || ( *t2 == '\0' ) ) { { { fprintf(stderr, "Line %3d of File %s \n", 63, "./dir_wr_verbs/subsample.c"); }; status = -1 ; goto BYE; }; }
  if ( ( f2 == ((void *)0) ) || ( *f2 == '\0' ) ) { { { fprintf(stderr, "Line %3d of File %s \n", 64, "./dir_wr_verbs/subsample.c"); }; status = -1 ; goto BYE; }; }
  if ( strcmp(t1, t2) == 0 ) { { { fprintf(stderr, "Line %3d of File %s \n", 65, "./dir_wr_verbs/subsample.c"); }; status = -1 ; goto BYE; }; }
  char *endptr;
  nR2 = strtoll(str_nR2, &endptr, 10);
  if ( nR2 <= 0 ) { { { fprintf(stderr, "Line %3d of File %s \n", 68, "./dir_wr_verbs/subsample.c"); }; status = -1 ; goto BYE; }; }
  zero_string(opfile, (15 +1));
  status = is_tbl(t1, &t1_id, &t1_rec); { if ( (status) < 0 ) { { { fprintf(stderr, "Line %3d of File %s \n", 71, "./dir_wr_verbs/subsample.c"); }; status = (status) ; goto BYE; } } };
  if ( t1_id < 0 ) { { { fprintf(stderr, "Line %3d of File %s \n", 72, "./dir_wr_verbs/subsample.c"); }; status = -1 ; goto BYE; }; }
  nR1 = t1_rec.nR;
  status = is_fld(((void *)0), t1_id, f1, &f1_id, &f1_rec, &nn_f1_id, &nn_f1_rec);
  { if ( (status) < 0 ) { { { fprintf(stderr, "Line %3d of File %s \n", 75, "./dir_wr_verbs/subsample.c"); }; status = (status) ; goto BYE; } } };
  if ( f1_id < 0 ) { { { fprintf(stderr, "Line %3d of File %s \n", 76, "./dir_wr_verbs/subsample.c"); }; status = -1 ; goto BYE; }; }
  status = get_data(f1_rec, &f1_X, &f1_nX, 0); { if ( (status) < 0 ) { { { fprintf(stderr, "Line %3d of File %s \n", 77, "./dir_wr_verbs/subsample.c"); }; status = (status) ; goto BYE; } } };
  if ( nn_f1_id >= 0 ) { { { fprintf(stderr, "Line %3d of File %s \n", 79, "./dir_wr_verbs/subsample.c"); }; status = -1 ; goto BYE; }; }
  if ( f1_rec.fldtype != I4 ) { { { fprintf(stderr, "Line %3d of File %s \n", 80, "./dir_wr_verbs/subsample.c"); }; status = -1 ; goto BYE; }; }
  int *max_I4f1 = (int *)f1_X; max_I4f1 += nR1;
  if ( nR1 <= nR2 ) { { { fprintf(stderr, "Line %3d of File %s \n", 83, "./dir_wr_verbs/subsample.c"); }; status = -1 ; goto BYE; }; }
  status = get_fld_sz(f1_rec.fldtype, &fldsz); { if ( (status) < 0 ) { { { fprintf(stderr, "Line %3d of File %s \n", 85, "./dir_wr_verbs/subsample.c"); }; status = (status) ; goto BYE; } } };
  status = mk_temp_file(opfile, (nR2 * fldsz), &ddir_id); { if ( (status) < 0 ) { { { fprintf(stderr, "Line %3d of File %s \n", 86, "./dir_wr_verbs/subsample.c"); }; status = (status) ; goto BYE; } } };
  status = q_mmap(ddir_id, opfile, &f2_X, &f2_nX, 1); { if ( (status) < 0 ) { { { fprintf(stderr, "Line %3d of File %s \n", 87, "./dir_wr_verbs/subsample.c"); }; status = (status) ; goto BYE; } } };
  long long block_size; int nT;
  status = partition(nR2, 1024, -1, &block_size, &nT); { if ( (status) < 0 ) { { { fprintf(stderr, "Line %3d of File %s \n", 90, "./dir_wr_verbs/subsample.c"); }; status = (status) ; goto BYE; } } };
  long long block_size_1 = (nR1 / nT);
  int ratio = nR1 / nR2; if ( ratio == 1 ) { ratio++; }
  for ( int tid = 0; tid < nT; tid++ ) {
    long long lb1 = tid * block_size_1;
    long long ub1 = lb1 + block_size_1;
    if ( ub1 > nR1 ) { ub1 = nR1; }
    if ( ub1 <= lb1 ) { { fprintf(stderr, "Line %3d of File %s \n", 98, "./dir_wr_verbs/subsample.c"); }; status = -1; continue; }
    long long lb2 = 0 + (tid * block_size);
    long long ub2 = lb2 + block_size;
    if ( tid == (nT-1) ) { ub2 = nR2; }
    long long range2 = ub2 - lb2;
    srand48(2059879141*(tid+1));
    unsigned int rnum = (unsigned int)mrand48();
    int *I4f1 = ((void *)0), *I4f2 = ((void *)0), *max_I4f1 = ((void *)0);
    long long *I8f1 = ((void *)0), *I8f2 = ((void *)0), *max_I8f1 = ((void *)0);
    max_I4f1 = I4f1 + ub1;
    max_I8f1 = I8f1 + ub1;
    switch ( f1_rec.fldtype ) {
      case I4 :
    I4f1 = (int *)f1_X; I4f1 += lb1;
    I4f2 = (int *)f2_X; I4f2 += lb2;
    for ( int i = 0; i < range2; i++ ) {
 for ( _Bool found = 0; found == 0; ) {
   rnum = mix_I4(rnum);
   int x = rnum % ratio;
   if ( x == 0 ) {
     *I4f2++ = *I4f1;
     chk_nR2++;
     found = 1;
   }
   I4f1++;
   if ( I4f1 >= max_I4f1 ) {
     I4f1 = (int *)f1_X; I4f1 += lb1;
   }
 }
      }
 break;
      case I8 :
    I8f1 = (long long *)f1_X; I8f1 += lb1;
    I8f2 = (long long *)f2_X; I8f2 += lb2;
    for ( int i = 0; i < range2; i++ ) {
 for ( _Bool found = 0; found == 0; ) {
   rnum = mix_I8(rnum);
   int x = rnum % ratio;
   if ( x == 0 ) {
     *I8f2++ = *I8f1;
     chk_nR2++;
     found = 1;
   }
   I8f1++;
   if ( I8f1 >= max_I8f1 ) {
     I8f1 = (long long *)f1_X; I8f1 += lb1;
   }
 }
      }
 break;
      default :
 if ( status == 0 ) { { fprintf(stderr, "Line %3d of File %s \n", 120, "./dir_wr_verbs/subsample.c"); }; } status = -1; continue;
 break;
    }
  }
  { if ( (status) < 0 ) { { { fprintf(stderr, "Line %3d of File %s \n", 124, "./dir_wr_verbs/subsample.c"); }; status = (status) ; goto BYE; } } };
  status = del_tbl(t2, -1); { if ( (status) < 0 ) { { { fprintf(stderr, "Line %3d of File %s \n", 126, "./dir_wr_verbs/subsample.c"); }; status = (status) ; goto BYE; } } };
  char strbuf[32];
  sprintf(strbuf, "%lld", nR2);
  status = add_tbl(t2, strbuf, &t2_id, &t2_rec); { if ( (status) < 0 ) { { { fprintf(stderr, "Line %3d of File %s \n", 129, "./dir_wr_verbs/subsample.c"); }; status = (status) ; goto BYE; } } };
  status = add_fld(t2_id, f2, ddir_id, opfile, f1_rec.fldtype, -1, &f2_id, &f2_rec);
  { if ( (status) < 0 ) { { { fprintf(stderr, "Line %3d of File %s \n", 131, "./dir_wr_verbs/subsample.c"); }; status = (status) ; goto BYE; } } };
 BYE:
  { if ( ( f1_X == ((void *)0) ) && ( f1_nX != 0 ) ) { { fprintf(stderr, "Line %3d of File %s \n", 133, "./dir_wr_verbs/subsample.c"); }; return(-1); } if ( ( f1_X != ((void *)0) ) && ( f1_nX == 0 ) ) { { fprintf(stderr, "Line %3d of File %s \n", 133, "./dir_wr_verbs/subsample.c"); }; return(-1); } if ( f1_X != ((void *)0) ) { munmap(f1_X, f1_nX); f1_X = ((void *)0); f1_nX = 0; } };
  { if ( ( f2_X == ((void *)0) ) && ( f2_nX != 0 ) ) { { fprintf(stderr, "Line %3d of File %s \n", 134, "./dir_wr_verbs/subsample.c"); }; return(-1); } if ( ( f2_X != ((void *)0) ) && ( f2_nX == 0 ) ) { { fprintf(stderr, "Line %3d of File %s \n", 134, "./dir_wr_verbs/subsample.c"); }; return(-1); } if ( f2_X != ((void *)0) ) { munmap(f2_X, f2_nX); f2_X = ((void *)0); f2_nX = 0; } };
  return(status);
}

canonical_original_code:
int subsample(char *t1, char *f1, char *str_nR2, char *t2, char *f2)
{
  int status = 0;
  char *f1_X = ((void *)0); unsigned long f1_nX = 0;
  char *f2_X = ((void *)0); unsigned long f2_nX = 0;
  struct _TBL_REC_TYPE t1_rec; struct _TBL_REC_TYPE t2_rec;
  struct _FLD_REC_TYPE f1_rec; struct _FLD_REC_TYPE f2_rec;
  struct _FLD_REC_TYPE nn_f1_rec;
  long long nR1; long long nR2;
  int t1_id = (-0x7fffffff - 1); int t2_id = (-0x7fffffff - 1);
  int f1_id = (-0x7fffffff - 1); int f2_id = (-0x7fffffff - 1);
  int nn_f1_id = (-0x7fffffff - 1);
  char opfile[-1];
  int fldsz = 0x7fffffff; int ddir_id = 0x7fffffff;
   long long chk_nR2 = 0;
  if ( ( t1 == ((void *)0) ) || ( *t1 == '\0' ) ) { { { fprintf(stderr, "Line %3d of File %s \n", 61, "./dir_wr_verbs/subsample.c"); }; status = -1 ; goto BYE; }; }
  if ( ( f1 == ((void *)0) ) || ( *f1 == '\0' ) ) { { { fprintf(stderr, "Line %3d of File %s \n", 62, "./dir_wr_verbs/subsample.c"); }; status = -1 ; goto BYE; }; }
  if ( ( t2 == ((void *)0) ) || ( *t2 == '\0' ) ) { { { fprintf(stderr, "Line %3d of File %s \n", 63, "./dir_wr_verbs/subsample.c"); }; status = -1 ; goto BYE; }; }
  if ( ( f2 == ((void *)0) ) || ( *f2 == '\0' ) ) { { { fprintf(stderr, "Line %3d of File %s \n", 64, "./dir_wr_verbs/subsample.c"); }; status = -1 ; goto BYE; }; }
  if ( strcmp(t1, t2) == 0 ) { { { fprintf(stderr, "Line %3d of File %s \n", 65, "./dir_wr_verbs/subsample.c"); }; status = -1 ; goto BYE; }; }
  char *endptr;
  nR2 = strtoll(str_nR2, &endptr, 10);
  if ( nR2 <= 0 ) { { { fprintf(stderr, "Line %3d of File %s \n", 68, "./dir_wr_verbs/subsample.c"); }; status = -1 ; goto BYE; }; }
  zero_string(opfile, (15 +1));
  status = is_tbl(t1, &t1_id, &t1_rec); { if ( (status) < 0 ) { { { fprintf(stderr, "Line %3d of File %s \n", 71, "./dir_wr_verbs/subsample.c"); }; status = (status) ; goto BYE; } } };
  if ( t1_id < 0 ) { { { fprintf(stderr, "Line %3d of File %s \n", 72, "./dir_wr_verbs/subsample.c"); }; status = -1 ; goto BYE; }; }
  nR1 = t1_rec.nR;
  status = is_fld(((void *)0), t1_id, f1, &f1_id, &f1_rec, &nn_f1_id, &nn_f1_rec);
  { if ( (status) < 0 ) { { { fprintf(stderr, "Line %3d of File %s \n", 75, "./dir_wr_verbs/subsample.c"); }; status = (status) ; goto BYE; } } };
  if ( f1_id < 0 ) { { { fprintf(stderr, "Line %3d of File %s \n", 76, "./dir_wr_verbs/subsample.c"); }; status = -1 ; goto BYE; }; }
  status = get_data(f1_rec, &f1_X, &f1_nX, 0); { if ( (status) < 0 ) { { { fprintf(stderr, "Line %3d of File %s \n", 77, "./dir_wr_verbs/subsample.c"); }; status = (status) ; goto BYE; } } };
  if ( nn_f1_id >= 0 ) { { { fprintf(stderr, "Line %3d of File %s \n", 79, "./dir_wr_verbs/subsample.c"); }; status = -1 ; goto BYE; }; }
  if ( f1_rec.fldtype != I4 ) { { { fprintf(stderr, "Line %3d of File %s \n", 80, "./dir_wr_verbs/subsample.c"); }; status = -1 ; goto BYE; }; }
  int *max_I4f1 = (int *)f1_X; max_I4f1 += nR1;
  if ( nR1 <= nR2 ) { { { fprintf(stderr, "Line %3d of File %s \n", 83, "./dir_wr_verbs/subsample.c"); }; status = -1 ; goto BYE; }; }
  status = get_fld_sz(f1_rec.fldtype, &fldsz); { if ( (status) < 0 ) { { { fprintf(stderr, "Line %3d of File %s \n", 85, "./dir_wr_verbs/subsample.c"); }; status = (status) ; goto BYE; } } };
  status = mk_temp_file(opfile, (nR2 * fldsz), &ddir_id); { if ( (status) < 0 ) { { { fprintf(stderr, "Line %3d of File %s \n", 86, "./dir_wr_verbs/subsample.c"); }; status = (status) ; goto BYE; } } };
  status = q_mmap(ddir_id, opfile, &f2_X, &f2_nX, 1); { if ( (status) < 0 ) { { { fprintf(stderr, "Line %3d of File %s \n", 87, "./dir_wr_verbs/subsample.c"); }; status = (status) ; goto BYE; } } };
  long long block_size; int nT;
  status = partition(nR2, 1024, -1, &block_size, &nT); { if ( (status) < 0 ) { { { fprintf(stderr, "Line %3d of File %s \n", 90, "./dir_wr_verbs/subsample.c"); }; status = (status) ; goto BYE; } } };
  long long block_size_1 = (nR1 / nT);
  int ratio = nR1 / nR2; if ( ratio == 1 ) { ratio++; }
  for ( int tid = 0; tid < nT; tid++ ) {
    long long lb1 = tid * block_size_1;
    long long ub1 = lb1 + block_size_1;
    if ( ub1 > nR1 ) { ub1 = nR1; }
    if ( ub1 <= lb1 ) { { fprintf(stderr, "Line %3d of File %s \n", 98, "./dir_wr_verbs/subsample.c"); }; status = -1; continue; }
    long long lb2 = 0 + (tid * block_size);
    long long ub2 = lb2 + block_size;
    if ( tid == (nT-1) ) { ub2 = nR2; }
    long long range2 = ub2 - lb2;
    srand48(2059879141*(tid+1));
    unsigned int rnum = (unsigned int)mrand48();
    int *I4f1 = ((void *)0); int *I4f2 = ((void *)0); int *max_I4f1 = ((void *)0);
    long long *I8f1 = ((void *)0); long long *I8f2 = ((void *)0); long long *max_I8f1 = ((void *)0);
    max_I4f1 = I4f1 + ub1;
    max_I8f1 = I8f1 + ub1;
    switch ( f1_rec.fldtype ) {
      case I4 :
    I4f1 = (int *)f1_X; I4f1 += lb1;
    I4f2 = (int *)f2_X; I4f2 += lb2;
    for ( int i = 0; i < range2; i++ ) {
 for ( _Bool found = 0; found == 0; ) {
   rnum = mix_I4(rnum);
   int x = rnum % ratio;
   if ( x == 0 ) {
     *I4f2++ = *I4f1;
     chk_nR2++;
     found = 1;
   }
   I4f1++;
   if ( I4f1 >= max_I4f1 ) {
     I4f1 = (int *)f1_X; I4f1 += lb1;
   }
 }
      }
 break;
      case I8 :
    I8f1 = (long long *)f1_X; I8f1 += lb1;
    I8f2 = (long long *)f2_X; I8f2 += lb2;
    for ( int i = 0; i < range2; i++ ) {
 for ( _Bool found = 0; found == 0; ) {
   rnum = mix_I8(rnum);
   int x = rnum % ratio;
   if ( x == 0 ) {
     *I8f2++ = *I8f1;
     chk_nR2++;
     found = 1;
   }
   I8f1++;
   if ( I8f1 >= max_I8f1 ) {
     I8f1 = (long long *)f1_X; I8f1 += lb1;
   }
 }
      }
 break;
      default :
 if ( status == 0 ) { { fprintf(stderr, "Line %3d of File %s \n", 120, "./dir_wr_verbs/subsample.c"); }; } status = -1; continue;
 break;
    }
  }
  { if ( (status) < 0 ) { { { fprintf(stderr, "Line %3d of File %s \n", 124, "./dir_wr_verbs/subsample.c"); }; status = (status) ; goto BYE; } } };
  status = del_tbl(t2, -1); { if ( (status) < 0 ) { { { fprintf(stderr, "Line %3d of File %s \n", 126, "./dir_wr_verbs/subsample.c"); }; status = (status) ; goto BYE; } } };
  char strbuf[32];
  sprintf(strbuf, "%lld", nR2);
  status = add_tbl(t2, strbuf, &t2_id, &t2_rec); { if ( (status) < 0 ) { { { fprintf(stderr, "Line %3d of File %s \n", 129, "./dir_wr_verbs/subsample.c"); }; status = (status) ; goto BYE; } } };
  status = add_fld(t2_id, f2, ddir_id, opfile, f1_rec.fldtype, -1, &f2_id, &f2_rec);
  { if ( (status) < 0 ) { { { fprintf(stderr, "Line %3d of File %s \n", 131, "./dir_wr_verbs/subsample.c"); }; status = (status) ; goto BYE; } } };
 BYE:
  { if ( ( f1_X == ((void *)0) ) && ( f1_nX != 0 ) ) { { fprintf(stderr, "Line %3d of File %s \n", 133, "./dir_wr_verbs/subsample.c"); }; return(-1); } if ( ( f1_X != ((void *)0) ) && ( f1_nX == 0 ) ) { { fprintf(stderr, "Line %3d of File %s \n", 133, "./dir_wr_verbs/subsample.c"); }; return(-1); } if ( f1_X != ((void *)0) ) { munmap(f1_X, f1_nX); f1_X = ((void *)0); f1_nX = 0; } };
  { if ( ( f2_X == ((void *)0) ) && ( f2_nX != 0 ) ) { { fprintf(stderr, "Line %3d of File %s \n", 134, "./dir_wr_verbs/subsample.c"); }; return(-1); } if ( ( f2_X != ((void *)0) ) && ( f2_nX == 0 ) ) { { fprintf(stderr, "Line %3d of File %s \n", 134, "./dir_wr_verbs/subsample.c"); }; return(-1); } if ( f2_X != ((void *)0) ) { munmap(f2_X, f2_nX); f2_X = ((void *)0); f2_nX = 0; } };
  return(status);
}

variable_types: status int

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

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

variable_types:
opfile
char [-1]

variable_types: fldsz int

variable_types:
endptr
char *

variable_types: nT int

variable_types: ratio int

variable_types: tid int

variable_types:
rnum
unsigned int

variable_types: x int

variable_types:
strbuf
char [32]


original_code:
void
a_and_not_b_I1(
       char *in1,
       char *in2,
       long long nR,
       char * restrict out
       )
{
  char 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 a_and_not_b_I1(char *in1, char *in2, long long nR, char *out)
{
  char inv1; char inv2; char outv;
  for ( long long i = 0; i < nR; i++ ) {
    inv1 = *in1;
    inv2 = ~ (*in2);
    outv = inv1 & inv2;
    *out = outv;
    in1++;
    in2++;
    out++;
  }
}

variable_types:
nR
long long

variable_types:
out
char *

variable_types: outv char

variable_types:
i
long long


original_code:
void
and2_I1(
       char *in1,
       char *in2,
       long long nR,
       char * restrict out
       )
{
  char 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 and2_I1(char *in1, char *in2, long long nR, char *out)
{
  char inv1; char inv2; char outv;
  for ( long long i = 0; i < nR; i++ ) {
    inv1 = *in1;
    inv2 = *in2;
    outv = inv1 && inv2;
    *out = outv;
    in1++;
    in2++;
    out++;
  }
}


original_code:
int
pos_sel_aux_nn_copy_I8_I8(
    long long *f1_select,
    char *nn_f1_select,
    long long *f1_copy,
    char *nn_f1_copy,
    long long nR1,
    long long *f2,
    char *nn_f2,
    long long nR2,
    long long lb,
    long long ub,
    long long *f3,
    long long *ptr_cnt
    )
{
  int status = 0;
  long long cnt = 0;
  long long i3 = 0;
  for ( long long i2 = 0; i2 < nR2; i2++ ) {
    if ( ( nn_f2 != ((void *)0) ) && ( nn_f2[i2] == 0 ) ) { continue; }
    long long f1idx = f2[i2];
    if ( ( f1idx < 0 ) || ( f1idx >= nR1 ) ) { { { fprintf(stderr, "Line %3d of File %s \n", 39, "./AUX/pos_sel_aux_nn_copy_I8_I8.c"); }; status = -1 ; goto BYE; }; }
    if ( ( nn_f1_select != ((void *)0) ) && ( nn_f1_select[f1idx] == 0 ) ) { continue; }
    long long val = f1_select[f1idx];
    if ( ( val >= lb ) && ( val <= ub ) ) {
      if ( ( nn_f1_copy != ((void *)0) ) && ( nn_f1_copy[f1idx] == 0 ) ) {
      }
      else {
        val = f1_copy[f1idx];
        f3[i3++] = val;
        cnt++;
      }
    }
  }
  *ptr_cnt = cnt;
BYE:
  return(status);
}

canonical_original_code:
int pos_sel_aux_nn_copy_I8_I8(long long *f1_select, char *nn_f1_select, long long *f1_copy, char *nn_f1_copy, long long nR1, long long *f2, char *nn_f2, long long nR2, long long lb, long long ub, long long *f3, long long *ptr_cnt)
{
  int status = 0;
  long long cnt = 0;
  long long i3 = 0;
  for ( long long i2 = 0; i2 < nR2; i2++ ) {
    if ( ( nn_f2 != ((void *)0) ) && ( nn_f2[i2] == 0 ) ) { continue; }
    long long f1idx = f2[i2];
    if ( ( f1idx < 0 ) || ( f1idx >= nR1 ) ) { { { fprintf(stderr, "Line %3d of File %s \n", 39, "./AUX/pos_sel_aux_nn_copy_I8_I8.c"); }; status = -1 ; goto BYE; }; }
    if ( ( nn_f1_select != ((void *)0) ) && ( nn_f1_select[f1idx] == 0 ) ) { continue; }
    long long val = f1_select[f1idx];
    if ( ( val >= lb ) && ( val <= ub ) ) {
      if ( ( nn_f1_copy != ((void *)0) ) && ( nn_f1_copy[f1idx] == 0 ) ) {
      }
      else {
        val = f1_copy[f1idx];
        f3[i3++] = val;
        cnt++;
      }
    }
  }
  *ptr_cnt = cnt;
BYE:
  return(status);
}

variable_types:
lb
long long

variable_types:
ub
long long

variable_types:
cnt
long long

variable_types:
val
long long