decompiled_code:
__int64 __fastcall unset_min_max_sum(const char *a1, int a2)
{
__int64 v2; // rax

if ( !strcmp(a1, "sum") )
{
v2 = g_flds + 120LL * a2;
*(_QWORD *)(v2 + 80) = 0LL;
*(_BYTE *)(v2 + 104) = 0;
goto LABEL_3;
}
if ( !strcmp(a1, "min") )
{
v2 = g_flds + 120LL * a2;
*(_QWORD *)(v2 + 88) = 0LL;
*(_BYTE *)(v2 + 105) = 0;
LABEL_3:
if ( *(_BYTE *)(v2 + 106) )
return 0LL;
goto LABEL_8;
}
if ( !strcmp(a1, "max") )
{
v2 = g_flds + 120LL * a2;
*(_QWORD *)(v2 + 96) = 0LL;
*(_BYTE *)(v2 + 106) = 0;
LABEL_8:
*(_QWORD *)(v2 + 112) = -1LL;
return 0LL;
}
fprintf(stderr, "Line %3d of File %s \n", 32LL, "unset_meta.c");
return 0xFFFFFFFFLL;
}

canonical_decompiled_code:
__int64 __fastcall func0(const char *a1, int a2)
{
__int64 v2; // rax

if ( !strcmp(a1, "sum") )
{
v2 = g_flds + 120LL * a2;
*(_QWORD *)(v2 + 80) = 0LL;
*(_BYTE *)(v2 + 104) = 0;
goto LABEL_3;
}
if ( !strcmp(a1, "min") )
{
v2 = g_flds + 120LL * a2;
*(_QWORD *)(v2 + 88) = 0LL;
*(_BYTE *)(v2 + 105) = 0;
LABEL_3:
if ( *(_BYTE *)(v2 + 106) )
return 0LL;
goto LABEL_8;
}
if ( !strcmp(a1, "max") )
{
v2 = g_flds + 120LL * a2;
*(_QWORD *)(v2 + 96) = 0LL;
*(_BYTE *)(v2 + 106) = 0;
LABEL_8:
*(_QWORD *)(v2 + 112) = -1LL;
return 0LL;
}
fprintf(stderr, "Line %3d of File %s \n", 32LL, "unset_meta.c");
return 0xFFFFFFFFLL;
}

original_code:
int unset_min_max_sum(
      const char *attr,
      int fld_id
      )
{
  int status = 0;
  if ( strcmp(attr, "sum") == 0 ) {
    g_flds[fld_id].sumval.sumI8 = g_flds[fld_id].sumval.sumF8 = 0;
    g_flds[fld_id].is_sum_nn = 0;
  }
  else if ( strcmp(attr, "min") == 0 ) {
    g_flds[fld_id].minval.minI8 = g_flds[fld_id].minval.minF8 = 0;
    g_flds[fld_id].is_min_nn = 0;
  }
  else if ( strcmp(attr, "max") == 0 ) {
    g_flds[fld_id].maxval.maxI8 = g_flds[fld_id].maxval.maxF8 = 0;
    g_flds[fld_id].is_max_nn = 0;
  }
  else {
    { { fprintf(stderr, "Line %3d of File %s \n", 32, "unset_meta.c"); }; status = -1 ; goto BYE; };
  }
  if ( ( g_flds[fld_id].is_max_nn == 0 ) &&
       ( g_flds[fld_id].is_max_nn == 0 ) &&
       ( g_flds[fld_id].is_max_nn == 0 ) ) {
     g_flds[fld_id].num_nn = -1;
  }
 BYE:
  return status ;
}

canonical_original_code:
int unset_min_max_sum(char *attr, int fld_id)
{
  int status = 0;
  if ( strcmp(attr, "sum") == 0 ) {
    g_flds[fld_id].sumval.sumI8 = g_flds[fld_id].sumval.sumF8 = 0;
    g_flds[fld_id].is_sum_nn = 0;
  }
  else if ( strcmp(attr, "min") == 0 ) {
    g_flds[fld_id].minval.minI8 = g_flds[fld_id].minval.minF8 = 0;
    g_flds[fld_id].is_min_nn = 0;
  }
  else if ( strcmp(attr, "max") == 0 ) {
    g_flds[fld_id].maxval.maxI8 = g_flds[fld_id].maxval.maxF8 = 0;
    g_flds[fld_id].is_max_nn = 0;
  }
  else {
    { { fprintf(stderr, "Line %3d of File %s \n", 32, "unset_meta.c"); }; status = -1 ; goto BYE; };
  }
  if ( ( g_flds[fld_id].is_max_nn == 0 ) &&
       ( g_flds[fld_id].is_max_nn == 0 ) &&
       ( g_flds[fld_id].is_max_nn == 0 ) ) {
     g_flds[fld_id].num_nn = -1;
  }
 BYE:
  return status ;
}

variable_types:
attr
char *


repo: linkedin/datacl

decompiled_code:
__int64 __fastcall int_unset_meta(int a1, int a2, const char *a3)
{
__int64 v3; // rbp
bool v4; // cf
bool v5; // zf
const char *v7; // rdi
__int64 v8; // rcx
const char *v9; // rsi
__int64 v10; // rsi
int v11; // er12
__int64 v12; // rsi
bool v14; // al
bool v15; // cf
bool v16; // zf
const char *v17; // rdi
__int64 v18; // rcx
__int64 v19; // rdx

if ( !a3 || !*a3 )
{
v19 = 54LL;
LABEL_31:
v11 = -1;
fprintf(stderr, "Line %3d of File %s \n", v19, "unset_meta.c");
return (unsigned int)v11;
}
v3 = a1;
v4 = 0;
v5 = a1 == 0;
if ( a1 < 0 )
{
v19 = 55LL;
goto LABEL_31;
}
v7 = "tbltype";
v8 = 8LL;
v9 = a3;
do
{
if ( !v8 )
break;
v4 = *v9 < (unsigned int)*v7;
v5 = *v9++ == *v7++;
--v8;
}
while ( v5 );
if ( (!v4 && !v5) == v4 )
{
*(_DWORD *)(g_tbls + 48LL * (int)v3 + 44) = 0;
v11 = chk_tbl_meta((unsigned int)v3, v9);
if ( v11 < 0 )
goto LABEL_28;
if ( a2 >= 0 )
{
v12 = *(_QWORD *)(g_tbls + 48LL * (int)v3);
LABEL_15:
v11 = chk_fld_meta((unsigned int)a2, v12);
if ( v11 < 0 )
fprintf(stderr, "Line %3d of File %s \n", 81LL, "unset_meta.c");
return (unsigned int)v11;
}
return (unsigned int)v11;
}
if ( a2 < 0 )
{
v19 = 57LL;
goto LABEL_31;
}
if ( strcmp(a3, "dict_fld") )
{
if ( strcmp(a3, "sum") )
{
if ( strcmp(a3, "min") )
{
v14 = strcmp(a3, "max") != 0;
v15 = 0;
v16 = !v14;
if ( v14 )
{
v17 = "srttype";
v18 = 8LL;
v10 = (__int64)a3;
do
{
if ( !v18 )
break;
v15 = *(_BYTE *)v10 < *v17;
v16 = *(_BYTE *)v10++ == *v17++;
--v18;
}
while ( v16 );
if ( (!v15 && !v16) == v15 )
{
*(_DWORD *)(g_flds + 120LL * a2 + 28) = 0;
goto LABEL_13;
}
fprintf(stderr, "NOT IMPLEMENTED. attr = [%s] \n", a3);
v19 = 76LL;
goto LABEL_31;
}
}
}
v10 = (unsigned int)a2;
v11 = unset_min_max_sum(a3, a2);
if ( v11 >= 0 )
goto LABEL_13;
fprintf(stderr, "Line %3d of File %s \n", 69LL, "unset_meta.c");
return (unsigned int)v11;
}
v10 = 1LL;
v11 = del_from_fld_info_1((unsigned int)a2, 1LL);
if ( v11 < 0 )
{
fprintf(stderr, "Line %3d of File %s \n", 64LL, "unset_meta.c");
return (unsigned int)v11;
}
LABEL_13:
v11 = chk_tbl_meta((unsigned int)v3, v10);
if ( v11 >= 0 )
{
v12 = *(_QWORD *)(g_tbls + 48 * v3);
goto LABEL_15;
}
LABEL_28:
fprintf(stderr, "Line %3d of File %s \n", 78LL, "unset_meta.c");
return (unsigned int)v11;
}

canonical_decompiled_code:
__int64 __fastcall func1(int a1, int a2, const char *a3)
{
__int64 v3; // rbp
bool v4; // cf
bool v5; // zf
const char *v7; // rdi
__int64 v8; // rcx
const char *v9; // rsi
__int64 v10; // rsi
int v11; // er12
__int64 v12; // rsi
bool v14; // al
bool v15; // cf
bool v16; // zf
const char *v17; // rdi
__int64 v18; // rcx
__int64 v19; // rdx

if ( !a3 || !*a3 )
{
v19 = 54LL;
LABEL_31:
v11 = -1;
fprintf(stderr, "Line %3d of File %s \n", v19, "unset_meta.c");
return (unsigned int)v11;
}
v3 = a1;
v4 = 0;
v5 = a1 == 0;
if ( a1 < 0 )
{
v19 = 55LL;
goto LABEL_31;
}
v7 = "tbltype";
v8 = 8LL;
v9 = a3;
do
{
if ( !v8 )
break;
v4 = *v9 < (unsigned int)*v7;
v5 = *v9++ == *v7++;
--v8;
}
while ( v5 );
if ( (!v4 && !v5) == v4 )
{
*(_DWORD *)(g_tbls + 48LL * (int)v3 + 44) = 0;
v11 = chk_tbl_meta((unsigned int)v3, v9);
if ( v11 < 0 )
goto LABEL_28;
if ( a2 >= 0 )
{
v12 = *(_QWORD *)(g_tbls + 48LL * (int)v3);
LABEL_15:
v11 = chk_fld_meta((unsigned int)a2, v12);
if ( v11 < 0 )
fprintf(stderr, "Line %3d of File %s \n", 81LL, "unset_meta.c");
return (unsigned int)v11;
}
return (unsigned int)v11;
}
if ( a2 < 0 )
{
v19 = 57LL;
goto LABEL_31;
}
if ( strcmp(a3, "dict_fld") )
{
if ( strcmp(a3, "sum") )
{
if ( strcmp(a3, "min") )
{
v14 = strcmp(a3, "max") != 0;
v15 = 0;
v16 = !v14;
if ( v14 )
{
v17 = "srttype";
v18 = 8LL;
v10 = (__int64)a3;
do
{
if ( !v18 )
break;
v15 = *(_BYTE *)v10 < *v17;
v16 = *(_BYTE *)v10++ == *v17++;
--v18;
}
while ( v16 );
if ( (!v15 && !v16) == v15 )
{
*(_DWORD *)(g_flds + 120LL * a2 + 28) = 0;
goto LABEL_13;
}
fprintf(stderr, "NOT IMPLEMENTED. attr = [%s] \n", a3);
v19 = 76LL;
goto LABEL_31;
}
}
}
v10 = (unsigned int)a2;
v11 = func0(a3, a2);
if ( v11 >= 0 )
goto LABEL_13;
fprintf(stderr, "Line %3d of File %s \n", 69LL, "unset_meta.c");
return (unsigned int)v11;
}
v10 = 1LL;
v11 = del_from_fld_info_1((unsigned int)a2, 1LL);
if ( v11 < 0 )
{
fprintf(stderr, "Line %3d of File %s \n", 64LL, "unset_meta.c");
return (unsigned int)v11;
}
LABEL_13:
v11 = chk_tbl_meta((unsigned int)v3, v10);
if ( v11 >= 0 )
{
v12 = *(_QWORD *)(g_tbls + 48 * v3);
goto LABEL_15;
}
LABEL_28:
fprintf(stderr, "Line %3d of File %s \n", 78LL, "unset_meta.c");
return (unsigned int)v11;
}

original_code:
int
int_unset_meta(
      int tbl_id,
      int fld_id,
      const char *attr
      )
{
  int status = 0;
  if ( ( attr == ((void *)0) ) || ( *attr == '\0' ) ) { { { fprintf(stderr, "Line %3d of File %s \n", 54, "unset_meta.c"); }; status = -1 ; goto BYE; }; }
  if ( tbl_id < 0 ) { { { fprintf(stderr, "Line %3d of File %s \n", 55, "unset_meta.c"); }; status = -1 ; goto BYE; }; }
  if ( strcmp(attr, "tbltype") != 0 ) {
    if ( fld_id < 0 ) { { { fprintf(stderr, "Line %3d of File %s \n", 57, "unset_meta.c"); }; status = -1 ; goto BYE; }; }
  }
  if ( strcmp(attr, "tbltype") == 0 ) {
    g_tbls[tbl_id].tbltype = undef_tbl;
  }
  else if ( strcmp(attr, "dict_fld") == 0 ) {
    status = del_from_fld_info_1(fld_id, fk_fld_txt_lkp); { if ( (status) < 0 ) { { { fprintf(stderr, "Line %3d of File %s \n", 64, "unset_meta.c"); }; status = (status) ; goto BYE; } } };
  }
  else if ( ( strcmp(attr, "sum") == 0 ) ||
            ( strcmp(attr, "min") == 0 ) ||
            ( strcmp(attr, "max") == 0 ) ) {
    status = unset_min_max_sum(attr, fld_id); { if ( (status) < 0 ) { { { fprintf(stderr, "Line %3d of File %s \n", 69, "unset_meta.c"); }; status = (status) ; goto BYE; } } };
  }
  else if ( strcmp(attr, "srttype") == 0 ) {
    g_flds[fld_id].srttype = unknown;
  }
  else {
    fprintf(stderr, "NOT IMPLEMENTED. attr = [%s] \n", attr);
    { { fprintf(stderr, "Line %3d of File %s \n", 76, "unset_meta.c"); }; status = -1 ; goto BYE; };
  }
  status = chk_tbl_meta(tbl_id); { if ( (status) < 0 ) { { { fprintf(stderr, "Line %3d of File %s \n", 78, "unset_meta.c"); }; status = (status) ; goto BYE; } } };
  long long nR = g_tbls[tbl_id].nR;
  if ( fld_id >= 0 ) {
    status = chk_fld_meta(fld_id, nR); { if ( (status) < 0 ) { { { fprintf(stderr, "Line %3d of File %s \n", 81, "unset_meta.c"); }; status = (status) ; goto BYE; } } };
  }
 BYE:
  return status ;
}

canonical_original_code:
int int_unset_meta(int tbl_id, int fld_id, char *attr)
{
  int status = 0;
  if ( ( attr == ((void *)0) ) || ( *attr == '\0' ) ) { { { fprintf(stderr, "Line %3d of File %s \n", 54, "unset_meta.c"); }; status = -1 ; goto BYE; }; }
  if ( tbl_id < 0 ) { { { fprintf(stderr, "Line %3d of File %s \n", 55, "unset_meta.c"); }; status = -1 ; goto BYE; }; }
  if ( strcmp(attr, "tbltype") != 0 ) {
    if ( fld_id < 0 ) { { { fprintf(stderr, "Line %3d of File %s \n", 57, "unset_meta.c"); }; status = -1 ; goto BYE; }; }
  }
  if ( strcmp(attr, "tbltype") == 0 ) {
    g_tbls[tbl_id].tbltype = undef_tbl;
  }
  else if ( strcmp(attr, "dict_fld") == 0 ) {
    status = del_from_fld_info_1(fld_id, fk_fld_txt_lkp); { if ( (status) < 0 ) { { { fprintf(stderr, "Line %3d of File %s \n", 64, "unset_meta.c"); }; status = (status) ; goto BYE; } } };
  }
  else if ( ( strcmp(attr, "sum") == 0 ) ||
            ( strcmp(attr, "min") == 0 ) ||
            ( strcmp(attr, "max") == 0 ) ) {
    status = unset_min_max_sum(attr, fld_id); { if ( (status) < 0 ) { { { fprintf(stderr, "Line %3d of File %s \n", 69, "unset_meta.c"); }; status = (status) ; goto BYE; } } };
  }
  else if ( strcmp(attr, "srttype") == 0 ) {
    g_flds[fld_id].srttype = unknown;
  }
  else {
    fprintf(stderr, "NOT IMPLEMENTED. attr = [%s] \n", attr);
    { { fprintf(stderr, "Line %3d of File %s \n", 76, "unset_meta.c"); }; status = -1 ; goto BYE; };
  }
  status = chk_tbl_meta(tbl_id); { if ( (status) < 0 ) { { { fprintf(stderr, "Line %3d of File %s \n", 78, "unset_meta.c"); }; status = (status) ; goto BYE; } } };
  long long nR = g_tbls[tbl_id].nR;
  if ( fld_id >= 0 ) {
    status = chk_fld_meta(fld_id, nR); { if ( (status) < 0 ) { { { fprintf(stderr, "Line %3d of File %s \n", 81, "unset_meta.c"); }; status = (status) ; goto BYE; } } };
  }
 BYE:
  return status ;
}

variable_types: status int

variable_types:
nR
long long

return_type: int


decompiled_code:
__int64 __fastcall unset_meta(_BYTE *a1, _BYTE *a2, const char *a3)
{
int v4; // er12
__int64 v6; // rdx
int v7; // [rsp+4h] [rbp-154h] BYREF
int v8; // [rsp+8h] [rbp-150h] BYREF
char v9[4]; // [rsp+Ch] [rbp-14Ch] BYREF
char v10[48]; // [rsp+10h] [rbp-148h] BYREF
char v11[128]; // [rsp+40h] [rbp-118h] BYREF
char v12[152]; // [rsp+C0h] [rbp-98h] BYREF

if ( !a1 || !*a1 )
{
v6 = 101LL;
goto LABEL_19;
}
if ( !a3 )
{
v6 = 102LL;
goto LABEL_19;
}
v4 = is_tbl(a1, &v7, v10);
if ( v4 < 0 )
{
fprintf(stderr, "Line %3d of File %s \n", 104LL, "unset_meta.c");
return (unsigned int)v4;
}
if ( v7 < 0 || v7 >= g_n_tbl )
{
v6 = 105LL;
goto LABEL_19;
}
if ( a2 && *a2 )
{
v4 = is_fld(0LL, (unsigned int)v7, a2, &v8, v11, v9, v12);
if ( v4 < 0 )
{
fprintf(stderr, "Line %3d of File %s \n", 112LL, "unset_meta.c");
return (unsigned int)v4;
}
if ( v8 >= 0 && v8 < g_n_fld )
{
v4 = int_unset_meta(v7, v8, a3);
if ( v4 >= 0 )
return (unsigned int)v4;
LABEL_15:
fprintf(stderr, "Line %3d of File %s \n", 115LL, "unset_meta.c");
return (unsigned int)v4;
}
v6 = 113LL;
LABEL_19:
v4 = -1;
fprintf(stderr, "Line %3d of File %s \n", v6, "unset_meta.c");
return (unsigned int)v4;
}
v8 = -1;
v4 = int_unset_meta(v7, -1, a3);
if ( v4 < 0 )
goto LABEL_15;
return (unsigned int)v4;
}

canonical_decompiled_code:
__int64 __fastcall func2(_BYTE *a1, _BYTE *a2, const char *a3)
{
int v4; // er12
__int64 v6; // rdx
int v7; // [rsp+4h] [rbp-154h] BYREF
int v8; // [rsp+8h] [rbp-150h] BYREF
char v9[4]; // [rsp+Ch] [rbp-14Ch] BYREF
char v10[48]; // [rsp+10h] [rbp-148h] BYREF
char v11[128]; // [rsp+40h] [rbp-118h] BYREF
char v12[152]; // [rsp+C0h] [rbp-98h] BYREF

if ( !a1 || !*a1 )
{
v6 = 101LL;
goto LABEL_19;
}
if ( !a3 )
{
v6 = 102LL;
goto LABEL_19;
}
v4 = is_tbl(a1, &v7, v10);
if ( v4 < 0 )
{
fprintf(stderr, "Line %3d of File %s \n", 104LL, "unset_meta.c");
return (unsigned int)v4;
}
if ( v7 < 0 || v7 >= g_n_tbl )
{
v6 = 105LL;
goto LABEL_19;
}
if ( a2 && *a2 )
{
v4 = is_fld(0LL, (unsigned int)v7, a2, &v8, v11, v9, v12);
if ( v4 < 0 )
{
fprintf(stderr, "Line %3d of File %s \n", 112LL, "unset_meta.c");
return (unsigned int)v4;
}
if ( v8 >= 0 && v8 < g_n_fld )
{
v4 = func1(v7, v8, a3);
if ( v4 >= 0 )
return (unsigned int)v4;
LABEL_15:
fprintf(stderr, "Line %3d of File %s \n", 115LL, "unset_meta.c");
return (unsigned int)v4;
}
v6 = 113LL;
LABEL_19:
v4 = -1;
fprintf(stderr, "Line %3d of File %s \n", v6, "unset_meta.c");
return (unsigned int)v4;
}
v8 = -1;
v4 = func1(v7, -1, a3);
if ( v4 < 0 )
goto LABEL_15;
return (unsigned int)v4;
}

original_code:
int
unset_meta(
  const char *tbl,
  const char *fld,
  const char *attr
  )
{
  int status = 0;
  TBL_REC_TYPE tbl_rec; int tbl_id;
  FLD_REC_TYPE fld_rec; int fld_id;
  FLD_REC_TYPE nn_fld_rec; int nn_fld_id;
  if ( ( tbl == ((void *)0) ) || ( *tbl == '\0' ) ) { { { fprintf(stderr, "Line %3d of File %s \n", 101, "unset_meta.c"); }; status = -1 ; goto BYE; }; }
  if ( ( attr == ((void *)0) ) || ( * tbl == '\0' ) ) { { { fprintf(stderr, "Line %3d of File %s \n", 102, "unset_meta.c"); }; status = -1 ; goto BYE; }; }
  status = is_tbl(tbl, &tbl_id, &tbl_rec); { if ( (status) < 0 ) { { { fprintf(stderr, "Line %3d of File %s \n", 104, "unset_meta.c"); }; status = (status) ; goto BYE; } } };
  { if ( ( (tbl_id) < (0) ) || ( (tbl_id) >= (g_n_tbl ) ) ) { { { fprintf(stderr, "Line %3d of File %s \n", 105, "unset_meta.c"); }; status = -1 ; goto BYE; }; } };
  if ( ( fld == ((void *)0) ) || ( *fld == '\0' ) ) {
    fld_id = -1;
  }
  else {
    status = is_fld(((void *)0), tbl_id, fld, &fld_id, &fld_rec,
      &nn_fld_id, &nn_fld_rec);
    { if ( (status) < 0 ) { { { fprintf(stderr, "Line %3d of File %s \n", 112, "unset_meta.c"); }; status = (status) ; goto BYE; } } };
    { if ( ( (fld_id) < (0) ) || ( (fld_id) >= (g_n_fld ) ) ) { { { fprintf(stderr, "Line %3d of File %s \n", 113, "unset_meta.c"); }; status = -1 ; goto BYE; }; } };
  }
  status = int_unset_meta(tbl_id, fld_id, attr); { if ( (status) < 0 ) { { { fprintf(stderr, "Line %3d of File %s \n", 115, "unset_meta.c"); }; status = (status) ; goto BYE; } } };
 BYE:
  return status ;
}

canonical_original_code:
int unset_meta(char *tbl, char *fld, char *attr)
{
  int status = 0;
  struct _TBL_REC_TYPE tbl_rec; int tbl_id;
  struct _FLD_REC_TYPE fld_rec; int fld_id;
  struct _FLD_REC_TYPE nn_fld_rec; int nn_fld_id;
  if ( ( tbl == ((void *)0) ) || ( *tbl == '\0' ) ) { { { fprintf(stderr, "Line %3d of File %s \n", 101, "unset_meta.c"); }; status = -1 ; goto BYE; }; }
  if ( ( attr == ((void *)0) ) || ( * tbl == '\0' ) ) { { { fprintf(stderr, "Line %3d of File %s \n", 102, "unset_meta.c"); }; status = -1 ; goto BYE; }; }
  status = is_tbl(tbl, &tbl_id, &tbl_rec); { if ( (status) < 0 ) { { { fprintf(stderr, "Line %3d of File %s \n", 104, "unset_meta.c"); }; status = (status) ; goto BYE; } } };
  { if ( ( (tbl_id) < (0) ) || ( (tbl_id) >= (g_n_tbl ) ) ) { { { fprintf(stderr, "Line %3d of File %s \n", 105, "unset_meta.c"); }; status = -1 ; goto BYE; }; } };
  if ( ( fld == ((void *)0) ) || ( *fld == '\0' ) ) {
    fld_id = -1;
  }
  else {
    status = is_fld(((void *)0), tbl_id, fld, &fld_id, &fld_rec,
      &nn_fld_id, &nn_fld_rec);
    { if ( (status) < 0 ) { { { fprintf(stderr, "Line %3d of File %s \n", 112, "unset_meta.c"); }; status = (status) ; goto BYE; } } };
    { if ( ( (fld_id) < (0) ) || ( (fld_id) >= (g_n_fld ) ) ) { { { fprintf(stderr, "Line %3d of File %s \n", 113, "unset_meta.c"); }; status = -1 ; goto BYE; }; } };
  }
  status = int_unset_meta(tbl_id, fld_id, attr); { if ( (status) < 0 ) { { { fprintf(stderr, "Line %3d of File %s \n", 115, "unset_meta.c"); }; status = (status) ; goto BYE; } } };
 BYE:
  return status ;
}

variable_types:
tbl
char *

variable_types:
fld
char *

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

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

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


xfer

decompiled_code:
__int64 __fastcall xfer(_BYTE *a1, _BYTE *a2, _BYTE *a3, const char *a4, const char *a5)
{
int v8; // er15
int v9; // eax
__int64 v10; // rcx
__int64 v11; // r8
__int64 v12; // rbp
__int64 v13; // r8
__int64 v14; // rcx
char *v15; // rsi
_DWORD *v16; // rdi
__int64 v17; // r8
char v18; // r12
__int64 v19; // rcx
_DWORD *v20; // rdi
char *v21; // rsi
const char *v22; // rcx
__int64 v23; // rdx
__int64 v25; // rdx
__int64 v26; // rcx
char *v27; // rsi
_DWORD *v28; // rdi
__int64 v29; // rax
_QWORD v30[27]; // [rsp-E0h] [rbp-8A8h] BYREF
__int64 v31; // [rsp-8h] [rbp-7D0h]
__int64 v32; // [rsp+8h] [rbp-7C0h]
unsigned int v33; // [rsp+1Ch] [rbp-7ACh] BYREF
unsigned int v34; // [rsp+20h] [rbp-7A8h] BYREF
int v35; // [rsp+24h] [rbp-7A4h] BYREF
int v36; // [rsp+28h] [rbp-7A0h] BYREF
int v37; // [rsp+2Ch] [rbp-79Ch] BYREF
int v38; // [rsp+30h] [rbp-798h] BYREF
unsigned int v39; // [rsp+34h] [rbp-794h] BYREF
int v40; // [rsp+38h] [rbp-790h] BYREF
int v41; // [rsp+3Ch] [rbp-78Ch] BYREF
unsigned int v42; // [rsp+40h] [rbp-788h] BYREF
unsigned int v43; // [rsp+44h] [rbp-784h] BYREF
void *addr; // [rsp+48h] [rbp-780h] BYREF
size_t len; // [rsp+50h] [rbp-778h] BYREF
void *v46; // [rsp+58h] [rbp-770h] BYREF
size_t v47; // [rsp+60h] [rbp-768h] BYREF
void *v48; // [rsp+68h] [rbp-760h] BYREF
size_t v49; // [rsp+70h] [rbp-758h] BYREF
void *v50; // [rsp+78h] [rbp-750h] BYREF
size_t v51; // [rsp+80h] [rbp-748h] BYREF
void *v52; // [rsp+88h] [rbp-740h] BYREF
size_t v53; // [rsp+90h] [rbp-738h] BYREF
void *v54; // [rsp+98h] [rbp-730h] BYREF
size_t v55; // [rsp+A0h] [rbp-728h] BYREF
char *endptr; // [rsp+A8h] [rbp-720h] BYREF
char v57[16]; // [rsp+B0h] [rbp-718h] BYREF
char v58[16]; // [rsp+C0h] [rbp-708h] BYREF
char nptr[32]; // [rsp+D0h] [rbp-6F8h] BYREF
char v60[176]; // [rsp+F0h] [rbp-6D8h] BYREF
char v61[176]; // [rsp+1A0h] [rbp-628h] BYREF
__int64 v62[3]; // [rsp+250h] [rbp-578h] BYREF
__int64 v63; // [rsp+268h] [rbp-560h]
__int64 v64; // [rsp+270h] [rbp-558h]
__int64 v65; // [rsp+278h] [rbp-550h]
__int64 v66; // [rsp+280h] [rbp-548h]
__int64 v67; // [rsp+288h] [rbp-540h]
__int64 v68; // [rsp+290h] [rbp-538h]
__int64 v69; // [rsp+298h] [rbp-530h]
__int64 v70; // [rsp+2A0h] [rbp-528h]
__int64 v71; // [rsp+2A8h] [rbp-520h]
__int64 v72; // [rsp+2B0h] [rbp-518h]
__int64 v73; // [rsp+2B8h] [rbp-510h]
__int64 v74; // [rsp+2C0h] [rbp-508h]
__int64 v75; // [rsp+2C8h] [rbp-500h]
__int64 v76; // [rsp+2D0h] [rbp-4F8h]
__int64 v77; // [rsp+2D8h] [rbp-4F0h]
__int64 v78; // [rsp+2E0h] [rbp-4E8h]
__int64 v79; // [rsp+2E8h] [rbp-4E0h]
__int64 v80; // [rsp+2F0h] [rbp-4D8h]
__int64 v81; // [rsp+2F8h] [rbp-4D0h]
__int64 v82; // [rsp+300h] [rbp-4C8h]
__int64 v83; // [rsp+308h] [rbp-4C0h]
__int64 v84; // [rsp+310h] [rbp-4B8h]
__int64 v85; // [rsp+318h] [rbp-4B0h]
__int64 v86; // [rsp+320h] [rbp-4A8h]
__int64 v87; // [rsp+328h] [rbp-4A0h]
char v88[24]; // [rsp+330h] [rbp-498h] BYREF
int v89; // [rsp+348h] [rbp-480h]
char v90[224]; // [rsp+410h] [rbp-3B8h] BYREF
char v91[224]; // [rsp+4F0h] [rbp-2D8h] BYREF
char v92[224]; // [rsp+5D0h] [rbp-1F8h] BYREF
char v93[280]; // [rsp+6B0h] [rbp-118h] BYREF

addr = 0LL;
len = 0LL;
v46 = 0LL;
v47 = 0LL;
v48 = 0LL;
v49 = 0LL;
v50 = 0LL;
v51 = 0LL;
v52 = 0LL;
v53 = 0LL;
v54 = 0LL;
v55 = 0LL;
v33 = 0x80000000;
v34 = 0x80000000;
v35 = 0x80000000;
v36 = 0x80000000;
v37 = 0x80000000;
v38 = 0x80000000;
v39 = 0x80000000;
v40 = 0x80000000;
zero_string(v57, 16LL);
zero_string(v58, 16LL);
if ( !a1 || !*a1 )
{
v22 = "./dir_wr_verbs/xfer.c";
v23 = 73LL;
goto LABEL_41;
}
if ( !a3 || !*a3 )
{
v22 = "./dir_wr_verbs/xfer.c";
v23 = 74LL;
LABEL_41:
v8 = -1;
fprintf(stderr, "Line %3d of File %s \n", v23, v22);
goto LABEL_42;
}
if ( !a2 || !*a2 )
{
v22 = "./dir_wr_verbs/xfer.c";
v23 = 75LL;
goto LABEL_41;
}
if ( !a4 || !*a4 )
{
v22 = "./dir_wr_verbs/xfer.c";
v23 = 76LL;
goto LABEL_41;
}
if ( !a5 || !*a5 )
{
v22 = "./dir_wr_verbs/xfer.c";
v23 = 77LL;
goto LABEL_41;
}
if ( !strcmp(a4, a5) )
{
v8 = -1;
fprintf(stderr, "Line %3d of File %s \n", 78LL, "./dir_wr_verbs/xfer.c");
goto LABEL_42;
}
v8 = is_tbl(a1, &v33, v60);
if ( v8 < 0 )
{
fprintf(stderr, "Line %3d of File %s \n", 80LL, "./dir_wr_verbs/xfer.c");
goto LABEL_42;
}
if ( (v33 & 0x80000000) != 0 || (int)v33 >= g_n_tbl )
{
v22 = "./dir_wr_verbs/xfer.c";
v23 = 81LL;
goto LABEL_41;
}
v32 = *(_QWORD *)(g_tbls + 176LL * (int)v33);
v9 = is_fld(0LL, v33, a2, &v35, v62, &v36, v91);
v11 = v31;
v8 = v9;
if ( v9 < 0 )
{
fprintf(stderr, "Line %3d of File %s \n", 86LL, "./dir_wr_verbs/xfer.c");
goto LABEL_42;
}
if ( v35 < 0 || v35 >= g_n_fld )
{
v22 = "./dir_wr_verbs/xfer.c";
v23 = 87LL;
goto LABEL_41;
}
v31 = v87;
v30[26] = v86;
v30[25] = v85;
v30[24] = v84;
v30[23] = v83;
v30[22] = v82;
v30[21] = v81;
v30[20] = v80;
v30[19] = v79;
v30[18] = v78;
v30[17] = v77;
v30[16] = v76;
v30[15] = v75;
v30[14] = v74;
v30[13] = v73;
v30[12] = v72;
v30[11] = v71;
v30[10] = v70;
v30[9] = v69;
v30[8] = v68;
v30[7] = v67;
v30[6] = v66;
v30[5] = v65;
v30[4] = v64;
v30[3] = v63;
v30[2] = v62[2];
v30[1] = v62[1];
v30[0] = v62[0];
v8 = get_data(&addr, &len, 0LL, v10, v11);
if ( v8 < 0 )
{
fprintf(stderr, "Line %3d of File %s \n", 89LL, "./dir_wr_verbs/xfer.c");
goto LABEL_42;
}
v8 = is_tbl(a3, &v34, v61);
if ( v8 < 0 )
{
fprintf(stderr, "Line %3d of File %s \n", 91LL, "./dir_wr_verbs/xfer.c");
goto LABEL_42;
}
if ( (v34 & 0x80000000) != 0 || (int)v34 >= g_n_tbl )
{
v22 = "./dir_wr_verbs/xfer.c";
v23 = 92LL;
goto LABEL_41;
}
v12 = *(_QWORD *)(g_tbls + 176LL * (int)v34);
v8 = is_fld(0LL, v34, a4, &v37, v88, &v38, v92);
if ( v8 < 0 )
{
fprintf(stderr, "Line %3d of File %s \n", 97LL, "./dir_wr_verbs/xfer.c");
goto LABEL_42;
}
if ( v37 < 0 || v37 >= g_n_fld )
{
v22 = "./dir_wr_verbs/xfer.c";
v23 = 98LL;
goto LABEL_41;
}
v14 = 56LL;
v15 = v88;
v16 = v30;
while ( v14 )
{
*v16 = *(_DWORD *)v15;
v15 += 4;
++v16;
--v14;
}
v8 = get_data(&v48, &v49, 0LL, 0LL, v13);
if ( v8 < 0 )
{
fprintf(stderr, "Line %3d of File %s \n", 99LL, "./dir_wr_verbs/xfer.c");
goto LABEL_42;
}
v18 = 0;
if ( v36 >= 0 )
{
v26 = 56LL;
v27 = v91;
v18 = 1;
v28 = v30;
while ( v26 )
{
*v28 = *(_DWORD *)v27;
v27 += 4;
++v28;
--v26;
}
v8 = get_data(&v50, &v51, 0LL, 0LL, v17);
if ( v8 < 0 )
{
fprintf(stderr, "Line %3d of File %s \n", 104LL, "./dir_wr_verbs/xfer.c");
goto LABEL_42;
}
}
if ( v38 < 0 )
goto LABEL_35;
v19 = 56LL;
v18 = 1;
v20 = v30;
v21 = v92;
while ( v19 )
{
*v20 = *(_DWORD *)v21;
v21 += 4;
++v20;
--v19;
}
v8 = get_data(&v52, &v53, 0LL, 0LL, v17);
if ( v8 < 0 )
{
fprintf(stderr, "Line %3d of File %s \n", 109LL, "./dir_wr_verbs/xfer.c");
}
else
{
LABEL_35:
v41 = 0x7FFFFFFF;
v42 = 0x7FFFFFFF;
v43 = 0x7FFFFFFF;
v8 = get_fld_sz((unsigned int)v63, &v41);
if ( v8 < 0 )
{
fprintf(stderr, "Line %3d of File %s \n", 115LL, "./dir_wr_verbs/xfer.c");
goto LABEL_42;
}
v8 = mk_temp_file(v57, v12 * v41, &v42);
if ( v8 < 0 )
{
fprintf(stderr, "Line %3d of File %s \n", 117LL, "./dir_wr_verbs/xfer.c");
goto LABEL_42;
}
v8 = q_mmap(v42, v57, &v46, &v47, 1LL);
if ( v8 < 0 )
{
fprintf(stderr, "Line %3d of File %s \n", 118LL, "./dir_wr_verbs/xfer.c");
goto LABEL_42;
}
if ( v18 )
{
v8 = mk_temp_file(v58, v12, &v43);
if ( v8 < 0 )
{
fprintf(stderr, "Line %3d of File %s \n", 121LL, "./dir_wr_verbs/xfer.c");
goto LABEL_42;
}
v8 = q_mmap(v43, v58, &v54, &v55, 1LL);
if ( v8 < 0 )
{
fprintf(stderr, "Line %3d of File %s \n", 122LL, "./dir_wr_verbs/xfer.c");
goto LABEL_42;
}
}
switch ( (int)v63 )
{
case 2:
if ( v89 == 4 )
{
xfer_I1_I4(addr, v50, v32, v48, v52, v12, v46, v54);
goto LABEL_104;
}
v22 = "./dir_wr_verbs/incl_xfer_I1.c";
v23 = 8LL;
goto LABEL_41;
case 3:
if ( v89 == 4 )
{
xfer_I2_I4(addr, v50, v32, v48, v52, v12, v46, v54);
goto LABEL_104;
}
v22 = "./dir_wr_verbs/incl_xfer_I2.c";
v23 = 8LL;
goto LABEL_41;
case 4:
if ( v89 == 4 )
{
xfer_I4_I4(addr, v50, v32, v48, v52, v12, v46, v54);
goto LABEL_104;
}
v22 = "./dir_wr_verbs/incl_xfer_I4.c";
v23 = 8LL;
goto LABEL_41;
case 5:
if ( v89 == 4 )
{
xfer_I8_I4(addr, v50, v32, v48, v52, v12, v46, v54);
goto LABEL_104;
}
v22 = "./dir_wr_verbs/incl_xfer_I8.c";
v23 = 8LL;
goto LABEL_41;
case 6:
if ( v89 == 4 )
{
xfer_F4_I4(addr, v50, v32, v48, v52, v12, v46, v54);
goto LABEL_104;
}
v22 = "./dir_wr_verbs/incl_xfer_F4.c";
v23 = 8LL;
goto LABEL_41;
case 7:
if ( v89 != 4 )
{
v22 = "./dir_wr_verbs/incl_xfer_F8.c";
v23 = 8LL;
goto LABEL_41;
}
xfer_F8_I4(addr, v50, v32, v48, v52, v12, v46, v54);
LABEL_104:
v29 = add_fld(v34, a5, v42, v57, (unsigned int)v63, 0xFFFFFFFFLL, &v39, v90);
v8 = v29;
if ( (int)v29 < 0 )
{
fprintf(stderr, "Line %3d of File %s \n", 140LL, "./dir_wr_verbs/xfer.c");
}
else
{
if ( v18 )
add_aux_fld(0LL, v34, 0LL, v39, v43, v58, "nn", &v40, v93, v29);
v8 = int_get_meta(v33, (unsigned int)v35, "dict_tbl_id", nptr);
if ( v8 < 0 )
{
fprintf(stderr, "Line %3d of File %s \n", 150LL, "./dir_wr_verbs/xfer.c");
}
else if ( (int)strtoll(nptr, &endptr, 10) > 0 )
{
v8 = int_set_meta(v34, v39, "dict_tbl_id", nptr);
if ( v8 < 0 )
fprintf(stderr, "Line %3d of File %s \n", 155LL, "./dir_wr_verbs/xfer.c");
}
}
break;
default:
v22 = "./dir_wr_verbs/xfer.c";
v23 = 135LL;
goto LABEL_41;
}
}
LABEL_42:
if ( addr )
{
if ( len )
{
munmap(addr, len);
addr = 0LL;
len = 0LL;
goto LABEL_45;
}
LABEL_63:
v25 = 158LL;
LABEL_64:
v8 = -1;
fprintf(stderr, "Line %3d of File %s \n", v25, "./dir_wr_verbs/xfer.c");
return (unsigned int)v8;
}
if ( len )
goto LABEL_63;
LABEL_45:
if ( v48 )
{
if ( v49 )
{
munmap(v48, v49);
v48 = 0LL;
v49 = 0LL;
goto LABEL_48;
}
goto LABEL_66;
}
if ( v49 )
{
LABEL_66:
v25 = 159LL;
goto LABEL_64;
}
LABEL_48:
if ( v46 )
{
if ( v47 )
{
munmap(v46, v47);
v46 = 0LL;
v47 = 0LL;
goto LABEL_51;
}
goto LABEL_68;
}
if ( v47 )
{
LABEL_68:
v25 = 160LL;
goto LABEL_64;
}
LABEL_51:
if ( v50 )
{
if ( v51 )
{
munmap(v50, v51);
v50 = 0LL;
v51 = 0LL;
goto LABEL_54;
}
goto LABEL_70;
}
if ( v51 )
{
LABEL_70:
v25 = 161LL;
goto LABEL_64;
}
LABEL_54:
if ( v52 )
{
if ( v53 )
{
munmap(v52, v53);
v52 = 0LL;
v53 = 0LL;
goto LABEL_57;
}
goto LABEL_72;
}
if ( v53 )
{
LABEL_72:
v25 = 162LL;
goto LABEL_64;
}
LABEL_57:
if ( !v54 )
{
if ( !v55 )
return (unsigned int)v8;
goto LABEL_74;
}
if ( !v55 )
{
LABEL_74:
v25 = 163LL;
goto LABEL_64;
}
munmap(v54, v55);
return (unsigned int)v8;
}

canonical_decompiled_code:
__int64 __fastcall func0(_BYTE *a1, _BYTE *a2, _BYTE *a3, const char *a4, const char *a5)
{
int v8; // er15
int v9; // eax
__int64 v10; // rcx
__int64 v11; // r8
__int64 v12; // rbp
__int64 v13; // r8
__int64 v14; // rcx
char *v15; // rsi
_DWORD *v16; // rdi
__int64 v17; // r8
char v18; // r12
__int64 v19; // rcx
_DWORD *v20; // rdi
char *v21; // rsi
const char *v22; // rcx
__int64 v23; // rdx
__int64 v25; // rdx
__int64 v26; // rcx
char *v27; // rsi
_DWORD *v28; // rdi
__int64 v29; // rax
_QWORD v30[27]; // [rsp-E0h] [rbp-8A8h] BYREF
__int64 v31; // [rsp-8h] [rbp-7D0h]
__int64 v32; // [rsp+8h] [rbp-7C0h]
unsigned int v33; // [rsp+1Ch] [rbp-7ACh] BYREF
unsigned int v34; // [rsp+20h] [rbp-7A8h] BYREF
int v35; // [rsp+24h] [rbp-7A4h] BYREF
int v36; // [rsp+28h] [rbp-7A0h] BYREF
int v37; // [rsp+2Ch] [rbp-79Ch] BYREF
int v38; // [rsp+30h] [rbp-798h] BYREF
unsigned int v39; // [rsp+34h] [rbp-794h] BYREF
int v40; // [rsp+38h] [rbp-790h] BYREF
int v41; // [rsp+3Ch] [rbp-78Ch] BYREF
unsigned int v42; // [rsp+40h] [rbp-788h] BYREF
unsigned int v43; // [rsp+44h] [rbp-784h] BYREF
void *addr; // [rsp+48h] [rbp-780h] BYREF
size_t len; // [rsp+50h] [rbp-778h] BYREF
void *v46; // [rsp+58h] [rbp-770h] BYREF
size_t v47; // [rsp+60h] [rbp-768h] BYREF
void *v48; // [rsp+68h] [rbp-760h] BYREF
size_t v49; // [rsp+70h] [rbp-758h] BYREF
void *v50; // [rsp+78h] [rbp-750h] BYREF
size_t v51; // [rsp+80h] [rbp-748h] BYREF
void *v52; // [rsp+88h] [rbp-740h] BYREF
size_t v53; // [rsp+90h] [rbp-738h] BYREF
void *v54; // [rsp+98h] [rbp-730h] BYREF
size_t v55; // [rsp+A0h] [rbp-728h] BYREF
char *endptr; // [rsp+A8h] [rbp-720h] BYREF
char v57[16]; // [rsp+B0h] [rbp-718h] BYREF
char v58[16]; // [rsp+C0h] [rbp-708h] BYREF
char nptr[32]; // [rsp+D0h] [rbp-6F8h] BYREF
char v60[176]; // [rsp+F0h] [rbp-6D8h] BYREF
char v61[176]; // [rsp+1A0h] [rbp-628h] BYREF
__int64 v62[3]; // [rsp+250h] [rbp-578h] BYREF
__int64 v63; // [rsp+268h] [rbp-560h]
__int64 v64; // [rsp+270h] [rbp-558h]
__int64 v65; // [rsp+278h] [rbp-550h]
__int64 v66; // [rsp+280h] [rbp-548h]
__int64 v67; // [rsp+288h] [rbp-540h]
__int64 v68; // [rsp+290h] [rbp-538h]
__int64 v69; // [rsp+298h] [rbp-530h]
__int64 v70; // [rsp+2A0h] [rbp-528h]
__int64 v71; // [rsp+2A8h] [rbp-520h]
__int64 v72; // [rsp+2B0h] [rbp-518h]
__int64 v73; // [rsp+2B8h] [rbp-510h]
__int64 v74; // [rsp+2C0h] [rbp-508h]
__int64 v75; // [rsp+2C8h] [rbp-500h]
__int64 v76; // [rsp+2D0h] [rbp-4F8h]
__int64 v77; // [rsp+2D8h] [rbp-4F0h]
__int64 v78; // [rsp+2E0h] [rbp-4E8h]
__int64 v79; // [rsp+2E8h] [rbp-4E0h]
__int64 v80; // [rsp+2F0h] [rbp-4D8h]
__int64 v81; // [rsp+2F8h] [rbp-4D0h]
__int64 v82; // [rsp+300h] [rbp-4C8h]
__int64 v83; // [rsp+308h] [rbp-4C0h]
__int64 v84; // [rsp+310h] [rbp-4B8h]
__int64 v85; // [rsp+318h] [rbp-4B0h]
__int64 v86; // [rsp+320h] [rbp-4A8h]
__int64 v87; // [rsp+328h] [rbp-4A0h]
char v88[24]; // [rsp+330h] [rbp-498h] BYREF
int v89; // [rsp+348h] [rbp-480h]
char v90[224]; // [rsp+410h] [rbp-3B8h] BYREF
char v91[224]; // [rsp+4F0h] [rbp-2D8h] BYREF
char v92[224]; // [rsp+5D0h] [rbp-1F8h] BYREF
char v93[280]; // [rsp+6B0h] [rbp-118h] BYREF

addr = 0LL;
len = 0LL;
v46 = 0LL;
v47 = 0LL;
v48 = 0LL;
v49 = 0LL;
v50 = 0LL;
v51 = 0LL;
v52 = 0LL;
v53 = 0LL;
v54 = 0LL;
v55 = 0LL;
v33 = 0x80000000;
v34 = 0x80000000;
v35 = 0x80000000;
v36 = 0x80000000;
v37 = 0x80000000;
v38 = 0x80000000;
v39 = 0x80000000;
v40 = 0x80000000;
zero_string(v57, 16LL);
zero_string(v58, 16LL);
if ( !a1 || !*a1 )
{
v22 = "./dir_wr_verbs/xfer.c";
v23 = 73LL;
goto LABEL_41;
}
if ( !a3 || !*a3 )
{
v22 = "./dir_wr_verbs/xfer.c";
v23 = 74LL;
LABEL_41:
v8 = -1;
fprintf(stderr, "Line %3d of File %s \n", v23, v22);
goto LABEL_42;
}
if ( !a2 || !*a2 )
{
v22 = "./dir_wr_verbs/xfer.c";
v23 = 75LL;
goto LABEL_41;
}
if ( !a4 || !*a4 )
{
v22 = "./dir_wr_verbs/xfer.c";
v23 = 76LL;
goto LABEL_41;
}
if ( !a5 || !*a5 )
{
v22 = "./dir_wr_verbs/xfer.c";
v23 = 77LL;
goto LABEL_41;
}
if ( !strcmp(a4, a5) )
{
v8 = -1;
fprintf(stderr, "Line %3d of File %s \n", 78LL, "./dir_wr_verbs/xfer.c");
goto LABEL_42;
}
v8 = is_tbl(a1, &v33, v60);
if ( v8 < 0 )
{
fprintf(stderr, "Line %3d of File %s \n", 80LL, "./dir_wr_verbs/xfer.c");
goto LABEL_42;
}
if ( (v33 & 0x80000000) != 0 || (int)v33 >= g_n_tbl )
{
v22 = "./dir_wr_verbs/xfer.c";
v23 = 81LL;
goto LABEL_41;
}
v32 = *(_QWORD *)(g_tbls + 176LL * (int)v33);
v9 = is_fld(0LL, v33, a2, &v35, v62, &v36, v91);
v11 = v31;
v8 = v9;
if ( v9 < 0 )
{
fprintf(stderr, "Line %3d of File %s \n", 86LL, "./dir_wr_verbs/xfer.c");
goto LABEL_42;
}
if ( v35 < 0 || v35 >= g_n_fld )
{
v22 = "./dir_wr_verbs/xfer.c";
v23 = 87LL;
goto LABEL_41;
}
v31 = v87;
v30[26] = v86;
v30[25] = v85;
v30[24] = v84;
v30[23] = v83;
v30[22] = v82;
v30[21] = v81;
v30[20] = v80;
v30[19] = v79;
v30[18] = v78;
v30[17] = v77;
v30[16] = v76;
v30[15] = v75;
v30[14] = v74;
v30[13] = v73;
v30[12] = v72;
v30[11] = v71;
v30[10] = v70;
v30[9] = v69;
v30[8] = v68;
v30[7] = v67;
v30[6] = v66;
v30[5] = v65;
v30[4] = v64;
v30[3] = v63;
v30[2] = v62[2];
v30[1] = v62[1];
v30[0] = v62[0];
v8 = get_data(&addr, &len, 0LL, v10, v11);
if ( v8 < 0 )
{
fprintf(stderr, "Line %3d of File %s \n", 89LL, "./dir_wr_verbs/xfer.c");
goto LABEL_42;
}
v8 = is_tbl(a3, &v34, v61);
if ( v8 < 0 )
{
fprintf(stderr, "Line %3d of File %s \n", 91LL, "./dir_wr_verbs/xfer.c");
goto LABEL_42;
}
if ( (v34 & 0x80000000) != 0 || (int)v34 >= g_n_tbl )
{
v22 = "./dir_wr_verbs/xfer.c";
v23 = 92LL;
goto LABEL_41;
}
v12 = *(_QWORD *)(g_tbls + 176LL * (int)v34);
v8 = is_fld(0LL, v34, a4, &v37, v88, &v38, v92);
if ( v8 < 0 )
{
fprintf(stderr, "Line %3d of File %s \n", 97LL, "./dir_wr_verbs/xfer.c");
goto LABEL_42;
}
if ( v37 < 0 || v37 >= g_n_fld )
{
v22 = "./dir_wr_verbs/xfer.c";
v23 = 98LL;
goto LABEL_41;
}
v14 = 56LL;
v15 = v88;
v16 = v30;
while ( v14 )
{
*v16 = *(_DWORD *)v15;
v15 += 4;
++v16;
--v14;
}
v8 = get_data(&v48, &v49, 0LL, 0LL, v13);
if ( v8 < 0 )
{
fprintf(stderr, "Line %3d of File %s \n", 99LL, "./dir_wr_verbs/xfer.c");
goto LABEL_42;
}
v18 = 0;
if ( v36 >= 0 )
{
v26 = 56LL;
v27 = v91;
v18 = 1;
v28 = v30;
while ( v26 )
{
*v28 = *(_DWORD *)v27;
v27 += 4;
++v28;
--v26;
}
v8 = get_data(&v50, &v51, 0LL, 0LL, v17);
if ( v8 < 0 )
{
fprintf(stderr, "Line %3d of File %s \n", 104LL, "./dir_wr_verbs/xfer.c");
goto LABEL_42;
}
}
if ( v38 < 0 )
goto LABEL_35;
v19 = 56LL;
v18 = 1;
v20 = v30;
v21 = v92;
while ( v19 )
{
*v20 = *(_DWORD *)v21;
v21 += 4;
++v20;
--v19;
}
v8 = get_data(&v52, &v53, 0LL, 0LL, v17);
if ( v8 < 0 )
{
fprintf(stderr, "Line %3d of File %s \n", 109LL, "./dir_wr_verbs/xfer.c");
}
else
{
LABEL_35:
v41 = 0x7FFFFFFF;
v42 = 0x7FFFFFFF;
v43 = 0x7FFFFFFF;
v8 = get_fld_sz((unsigned int)v63, &v41);
if ( v8 < 0 )
{
fprintf(stderr, "Line %3d of File %s \n", 115LL, "./dir_wr_verbs/xfer.c");
goto LABEL_42;
}
v8 = mk_temp_file(v57, v12 * v41, &v42);
if ( v8 < 0 )
{
fprintf(stderr, "Line %3d of File %s \n", 117LL, "./dir_wr_verbs/xfer.c");
goto LABEL_42;
}
v8 = q_mmap(v42, v57, &v46, &v47, 1LL);
if ( v8 < 0 )
{
fprintf(stderr, "Line %3d of File %s \n", 118LL, "./dir_wr_verbs/xfer.c");
goto LABEL_42;
}
if ( v18 )
{
v8 = mk_temp_file(v58, v12, &v43);
if ( v8 < 0 )
{
fprintf(stderr, "Line %3d of File %s \n", 121LL, "./dir_wr_verbs/xfer.c");
goto LABEL_42;
}
v8 = q_mmap(v43, v58, &v54, &v55, 1LL);
if ( v8 < 0 )
{
fprintf(stderr, "Line %3d of File %s \n", 122LL, "./dir_wr_verbs/xfer.c");
goto LABEL_42;
}
}
switch ( (int)v63 )
{
case 2:
if ( v89 == 4 )
{
xfer_I1_I4(addr, v50, v32, v48, v52, v12, v46, v54);
goto LABEL_104;
}
v22 = "./dir_wr_verbs/incl_xfer_I1.c";
v23 = 8LL;
goto LABEL_41;
case 3:
if ( v89 == 4 )
{
xfer_I2_I4(addr, v50, v32, v48, v52, v12, v46, v54);
goto LABEL_104;
}
v22 = "./dir_wr_verbs/incl_xfer_I2.c";
v23 = 8LL;
goto LABEL_41;
case 4:
if ( v89 == 4 )
{
xfer_I4_I4(addr, v50, v32, v48, v52, v12, v46, v54);
goto LABEL_104;
}
v22 = "./dir_wr_verbs/incl_xfer_I4.c";
v23 = 8LL;
goto LABEL_41;
case 5:
if ( v89 == 4 )
{
xfer_I8_I4(addr, v50, v32, v48, v52, v12, v46, v54);
goto LABEL_104;
}
v22 = "./dir_wr_verbs/incl_xfer_I8.c";
v23 = 8LL;
goto LABEL_41;
case 6:
if ( v89 == 4 )
{
xfer_F4_I4(addr, v50, v32, v48, v52, v12, v46, v54);
goto LABEL_104;
}
v22 = "./dir_wr_verbs/incl_xfer_F4.c";
v23 = 8LL;
goto LABEL_41;
case 7:
if ( v89 != 4 )
{
v22 = "./dir_wr_verbs/incl_xfer_F8.c";
v23 = 8LL;
goto LABEL_41;
}
xfer_F8_I4(addr, v50, v32, v48, v52, v12, v46, v54);
LABEL_104:
v29 = add_fld(v34, a5, v42, v57, (unsigned int)v63, 0xFFFFFFFFLL, &v39, v90);
v8 = v29;
if ( (int)v29 < 0 )
{
fprintf(stderr, "Line %3d of File %s \n", 140LL, "./dir_wr_verbs/xfer.c");
}
else
{
if ( v18 )
add_aux_fld(0LL, v34, 0LL, v39, v43, v58, "nn", &v40, v93, v29);
v8 = int_get_meta(v33, (unsigned int)v35, "dict_tbl_id", nptr);
if ( v8 < 0 )
{
fprintf(stderr, "Line %3d of File %s \n", 150LL, "./dir_wr_verbs/xfer.c");
}
else if ( (int)strtoll(nptr, &endptr, 10) > 0 )
{
v8 = int_set_meta(v34, v39, "dict_tbl_id", nptr);
if ( v8 < 0 )
fprintf(stderr, "Line %3d of File %s \n", 155LL, "./dir_wr_verbs/xfer.c");
}
}
break;
default:
v22 = "./dir_wr_verbs/xfer.c";
v23 = 135LL;
goto LABEL_41;
}
}
LABEL_42:
if ( addr )
{
if ( len )
{
munmap(addr, len);
addr = 0LL;
len = 0LL;
goto LABEL_45;
}
LABEL_63:
v25 = 158LL;
LABEL_64:
v8 = -1;
fprintf(stderr, "Line %3d of File %s \n", v25, "./dir_wr_verbs/xfer.c");
return (unsigned int)v8;
}
if ( len )
goto LABEL_63;
LABEL_45:
if ( v48 )
{
if ( v49 )
{
munmap(v48, v49);
v48 = 0LL;
v49 = 0LL;
goto LABEL_48;
}
goto LABEL_66;
}
if ( v49 )
{
LABEL_66:
v25 = 159LL;
goto LABEL_64;
}
LABEL_48:
if ( v46 )
{
if ( v47 )
{
munmap(v46, v47);
v46 = 0LL;
v47 = 0LL;
goto LABEL_51;
}
goto LABEL_68;
}
if ( v47 )
{
LABEL_68:
v25 = 160LL;
goto LABEL_64;
}
LABEL_51:
if ( v50 )
{
if ( v51 )
{
munmap(v50, v51);
v50 = 0LL;
v51 = 0LL;
goto LABEL_54;
}
goto LABEL_70;
}
if ( v51 )
{
LABEL_70:
v25 = 161LL;
goto LABEL_64;
}
LABEL_54:
if ( v52 )
{
if ( v53 )
{
munmap(v52, v53);
v52 = 0LL;
v53 = 0LL;
goto LABEL_57;
}
goto LABEL_72;
}
if ( v53 )
{
LABEL_72:
v25 = 162LL;
goto LABEL_64;
}
LABEL_57:
if ( !v54 )
{
if ( !v55 )
return (unsigned int)v8;
goto LABEL_74;
}
if ( !v55 )
{
LABEL_74:
v25 = 163LL;
goto LABEL_64;
}
munmap(v54, v55);
return (unsigned int)v8;
}

original_code:
int
xfer(
     char *src_tbl,
     char *src_fld,
     char *dst_tbl,
     char *dst_idx,
     char *dst_fld
     )
{
  int status = 0;
  TBL_REC_TYPE src_tbl_rec, dst_tbl_rec;
  FLD_REC_TYPE src_fld_rec, dst_idx_meta, dst_fld_rec;
  FLD_REC_TYPE nn_src_fld_rec, nn_dst_idx_meta, nn_dst_fld_rec;
  char opfile[15 +1];
  char nn_opfile[15 +1];
  long long src_nR, dst_nR;
  char *src_fld_X = ((void *)0); size_t src_fld_nX = 0;
  char *dst_fld_X = ((void *)0); size_t dst_fld_nX = 0;
  char *dst_idx_X = ((void *)0); size_t dst_idx_nX = 0;
  char *nn_src_fld_X = ((void *)0); size_t nn_src_fld_nX = 0;
  char *nn_dst_idx_X = ((void *)0); size_t nn_dst_idx_nX = 0;
  char *nn_dst_fld_X = ((void *)0); size_t nn_dst_fld_nX = 0;
  int src_tbl_id = (-0x7fffffff - 1), dst_tbl_id = (-0x7fffffff - 1);
  int src_fld_id = (-0x7fffffff - 1), nn_src_fld_id = (-0x7fffffff - 1);
  int dst_idx_id = (-0x7fffffff - 1), nn_dst_idx_id = (-0x7fffffff - 1);
  int dst_fld_id = (-0x7fffffff - 1), nn_dst_fld_id = (-0x7fffffff - 1);
  zero_string(opfile, 15 +1);
  zero_string(nn_opfile, 15 +1);
  if ( ( src_tbl == ((void *)0) ) || ( *src_tbl == '\0' ) ) { { { fprintf(stderr, "Line %3d of File %s \n", 73, "./dir_wr_verbs/xfer.c"); }; status = -1 ; goto BYE; }; }
  if ( ( dst_tbl == ((void *)0) ) || ( *dst_tbl == '\0' ) ) { { { fprintf(stderr, "Line %3d of File %s \n", 74, "./dir_wr_verbs/xfer.c"); }; status = -1 ; goto BYE; }; }
  if ( ( src_fld == ((void *)0) ) || ( *src_fld == '\0' ) ) { { { fprintf(stderr, "Line %3d of File %s \n", 75, "./dir_wr_verbs/xfer.c"); }; status = -1 ; goto BYE; }; }
  if ( ( dst_idx == ((void *)0) ) || ( *dst_idx == '\0' ) ) { { { fprintf(stderr, "Line %3d of File %s \n", 76, "./dir_wr_verbs/xfer.c"); }; status = -1 ; goto BYE; }; }
  if ( ( dst_fld == ((void *)0) ) || ( *dst_fld == '\0' ) ) { { { fprintf(stderr, "Line %3d of File %s \n", 77, "./dir_wr_verbs/xfer.c"); }; status = -1 ; goto BYE; }; }
  if ( strcmp(dst_idx, dst_fld) == 0 ) { { { fprintf(stderr, "Line %3d of File %s \n", 78, "./dir_wr_verbs/xfer.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", 80, "./dir_wr_verbs/xfer.c"); }; status = (status) ; goto BYE; } } };
  { if ( ( (src_tbl_id) < (0) ) || ( (src_tbl_id) >= (g_n_tbl ) ) ) { { { fprintf(stderr, "Line %3d of File %s \n", 81, "./dir_wr_verbs/xfer.c"); }; status = -1 ; goto BYE; }; } };
  src_nR = g_tbls[src_tbl_id].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", 86, "./dir_wr_verbs/xfer.c"); }; status = (status) ; goto BYE; } } };
  { if ( ( (src_fld_id) < (0) ) || ( (src_fld_id) >= (g_n_fld ) ) ) { { { fprintf(stderr, "Line %3d of File %s \n", 87, "./dir_wr_verbs/xfer.c"); }; status = -1 ; goto BYE; }; } };
  status = get_data(src_fld_rec, &src_fld_X, &src_fld_nX, 0); { if ( (status) < 0 ) { { { fprintf(stderr, "Line %3d of File %s \n", 89, "./dir_wr_verbs/xfer.c"); }; status = (status) ; goto BYE; } } };
  status = is_tbl(dst_tbl, &dst_tbl_id, &dst_tbl_rec); { if ( (status) < 0 ) { { { fprintf(stderr, "Line %3d of File %s \n", 91, "./dir_wr_verbs/xfer.c"); }; status = (status) ; goto BYE; } } };
  { if ( ( (dst_tbl_id) < (0) ) || ( (dst_tbl_id) >= (g_n_tbl ) ) ) { { { fprintf(stderr, "Line %3d of File %s \n", 92, "./dir_wr_verbs/xfer.c"); }; status = -1 ; goto BYE; }; } };
  dst_nR = g_tbls[dst_tbl_id].nR;
  status = is_fld(((void *)0), dst_tbl_id, dst_idx, &dst_idx_id, &dst_idx_meta,
      &nn_dst_idx_id, &nn_dst_idx_meta);
  { if ( (status) < 0 ) { { { fprintf(stderr, "Line %3d of File %s \n", 97, "./dir_wr_verbs/xfer.c"); }; status = (status) ; goto BYE; } } };
  { if ( ( (dst_idx_id) < (0) ) || ( (dst_idx_id) >= (g_n_fld ) ) ) { { { fprintf(stderr, "Line %3d of File %s \n", 98, "./dir_wr_verbs/xfer.c"); }; status = -1 ; goto BYE; }; } };
  status = get_data(dst_idx_meta, &dst_idx_X, &dst_idx_nX, 0); { if ( (status) < 0 ) { { { fprintf(stderr, "Line %3d of File %s \n", 99, "./dir_wr_verbs/xfer.c"); }; status = (status) ; goto BYE; } } };
  _Bool is_nn_needed = 0;
  if ( nn_src_fld_id >= 0 ) {
    status = get_data(nn_src_fld_rec, &nn_src_fld_X, &nn_src_fld_nX, 0);
    { if ( (status) < 0 ) { { { fprintf(stderr, "Line %3d of File %s \n", 104, "./dir_wr_verbs/xfer.c"); }; status = (status) ; goto BYE; } } };
    is_nn_needed = 1;
  }
  if ( nn_dst_idx_id >= 0 ) {
    status = get_data(nn_dst_idx_meta, &nn_dst_idx_X, &nn_dst_idx_nX, 0);
    { if ( (status) < 0 ) { { { fprintf(stderr, "Line %3d of File %s \n", 109, "./dir_wr_verbs/xfer.c"); }; status = (status) ; goto BYE; } } };
    is_nn_needed = 1;
  }
  int fldsz = 0x7fffffff, ddir_id = 0x7fffffff, nn_ddir_id = 0x7fffffff;
  status = get_fld_sz(src_fld_rec.fldtype, &fldsz); { if ( (status) < 0 ) { { { fprintf(stderr, "Line %3d of File %s \n", 115, "./dir_wr_verbs/xfer.c"); }; status = (status) ; goto BYE; } } };
  status = mk_temp_file(opfile, (dst_nR * fldsz), &ddir_id); { if ( (status) < 0 ) { { { fprintf(stderr, "Line %3d of File %s \n", 117, "./dir_wr_verbs/xfer.c"); }; status = (status) ; goto BYE; } } };
  status = q_mmap(ddir_id, opfile, &dst_fld_X, &dst_fld_nX, 1); { if ( (status) < 0 ) { { { fprintf(stderr, "Line %3d of File %s \n", 118, "./dir_wr_verbs/xfer.c"); }; status = (status) ; goto BYE; } } };
  if ( is_nn_needed ) {
    status = mk_temp_file(nn_opfile, (dst_nR * sizeof(char)), &nn_ddir_id); { if ( (status) < 0 ) { { { fprintf(stderr, "Line %3d of File %s \n", 121, "./dir_wr_verbs/xfer.c"); }; status = (status) ; goto BYE; } } };
    status = q_mmap(nn_ddir_id, nn_opfile, &nn_dst_fld_X, &nn_dst_fld_nX, 1); { if ( (status) < 0 ) { { { fprintf(stderr, "Line %3d of File %s \n", 122, "./dir_wr_verbs/xfer.c"); }; status = (status) ; goto BYE; } } };
  }
  switch ( src_fld_rec.fldtype ) {
    case I1 :
      switch ( dst_idx_meta.fldtype ) {
 case I4 :
   xfer_I1_I4(src_fld_X, nn_src_fld_X, src_nR,
                      dst_idx_X, nn_dst_idx_X, dst_nR,
        dst_fld_X, nn_dst_fld_X);
   break;
 default : { { fprintf(stderr, "Line %3d of File %s \n", 8, "./dir_wr_verbs/incl_xfer_I1.c"); }; status = -1 ; goto BYE; }; break;
      }
      break;
    case I2 :
      switch ( dst_idx_meta.fldtype ) {
 case I4 :
   xfer_I2_I4(src_fld_X, nn_src_fld_X, src_nR,
                      dst_idx_X, nn_dst_idx_X, dst_nR,
        dst_fld_X, nn_dst_fld_X);
   break;
 default : { { fprintf(stderr, "Line %3d of File %s \n", 8, "./dir_wr_verbs/incl_xfer_I2.c"); }; status = -1 ; goto BYE; }; break;
      }
      break;
    case I4 :
      switch ( dst_idx_meta.fldtype ) {
 case I4 :
   xfer_I4_I4(src_fld_X, nn_src_fld_X, src_nR,
                      dst_idx_X, nn_dst_idx_X, dst_nR,
        dst_fld_X, nn_dst_fld_X);
   break;
 default : { { fprintf(stderr, "Line %3d of File %s \n", 8, "./dir_wr_verbs/incl_xfer_I4.c"); }; status = -1 ; goto BYE; }; break;
      }
      break;
    case I8 :
      switch ( dst_idx_meta.fldtype ) {
 case I4 :
   xfer_I8_I4(src_fld_X, nn_src_fld_X, src_nR,
                      dst_idx_X, nn_dst_idx_X, dst_nR,
        dst_fld_X, nn_dst_fld_X);
   break;
 default : { { fprintf(stderr, "Line %3d of File %s \n", 8, "./dir_wr_verbs/incl_xfer_I8.c"); }; status = -1 ; goto BYE; }; break;
      }
      break;
    case F4 :
      switch ( dst_idx_meta.fldtype ) {
 case I4 :
   xfer_F4_I4(src_fld_X, nn_src_fld_X, src_nR,
                      dst_idx_X, nn_dst_idx_X, dst_nR,
        dst_fld_X, nn_dst_fld_X);
   break;
 default : { { fprintf(stderr, "Line %3d of File %s \n", 8, "./dir_wr_verbs/incl_xfer_F4.c"); }; status = -1 ; goto BYE; }; break;
      }
      break;
    case F8 :
      switch ( dst_idx_meta.fldtype ) {
 case I4 :
   xfer_F8_I4(src_fld_X, nn_src_fld_X, src_nR,
                      dst_idx_X, nn_dst_idx_X, dst_nR,
        dst_fld_X, nn_dst_fld_X);
   break;
 default : { { fprintf(stderr, "Line %3d of File %s \n", 8, "./dir_wr_verbs/incl_xfer_F8.c"); }; status = -1 ; goto BYE; }; break;
      }
      break;
    default :
      { { fprintf(stderr, "Line %3d of File %s \n", 135, "./dir_wr_verbs/xfer.c"); }; status = -1 ; goto BYE; };
      break;
  }
  status = add_fld(dst_tbl_id, dst_fld, ddir_id, opfile, src_fld_rec.fldtype,
      -1, &dst_fld_id, &dst_fld_rec);
  { if ( (status) < 0 ) { { { fprintf(stderr, "Line %3d of File %s \n", 140, "./dir_wr_verbs/xfer.c"); }; status = (status) ; goto BYE; } } };
  if ( is_nn_needed ) {
    status = add_aux_fld(((void *)0), dst_tbl_id, ((void *)0), dst_fld_id, nn_ddir_id,
 nn_opfile, "nn", &nn_dst_fld_id, &nn_dst_fld_rec);
  }
  char strbuf[32];
  status = int_get_meta(src_tbl_id, src_fld_id, "dict_tbl_id", strbuf);
  { if ( (status) < 0 ) { { { fprintf(stderr, "Line %3d of File %s \n", 150, "./dir_wr_verbs/xfer.c"); }; status = (status) ; goto BYE; } } };
  char *endptr;
  int dict_tbl_id = strtoll(strbuf, &endptr, 10);
  if ( dict_tbl_id > 0 ) {
    status = int_set_meta(dst_tbl_id, dst_fld_id, "dict_tbl_id", strbuf);
    { if ( (status) < 0 ) { { { fprintf(stderr, "Line %3d of File %s \n", 155, "./dir_wr_verbs/xfer.c"); }; status = (status) ; goto BYE; } } };
  }
 BYE:
  { if ( ( src_fld_X == ((void *)0) ) && ( src_fld_nX != 0 ) ) { { fprintf(stderr, "Line %3d of File %s \n", 158, "./dir_wr_verbs/xfer.c"); }; return(-1); } if ( ( src_fld_X != ((void *)0) ) && ( src_fld_nX == 0 ) ) { { fprintf(stderr, "Line %3d of File %s \n", 158, "./dir_wr_verbs/xfer.c"); }; return(-1); } if ( src_fld_X != ((void *)0) ) { munmap(src_fld_X, src_fld_nX); src_fld_X = ((void *)0); src_fld_nX = 0; } };
  { if ( ( dst_idx_X == ((void *)0) ) && ( dst_idx_nX != 0 ) ) { { fprintf(stderr, "Line %3d of File %s \n", 159, "./dir_wr_verbs/xfer.c"); }; return(-1); } if ( ( dst_idx_X != ((void *)0) ) && ( dst_idx_nX == 0 ) ) { { fprintf(stderr, "Line %3d of File %s \n", 159, "./dir_wr_verbs/xfer.c"); }; return(-1); } if ( dst_idx_X != ((void *)0) ) { munmap(dst_idx_X, dst_idx_nX); dst_idx_X = ((void *)0); dst_idx_nX = 0; } };
  { if ( ( dst_fld_X == ((void *)0) ) && ( dst_fld_nX != 0 ) ) { { fprintf(stderr, "Line %3d of File %s \n", 160, "./dir_wr_verbs/xfer.c"); }; return(-1); } if ( ( dst_fld_X != ((void *)0) ) && ( dst_fld_nX == 0 ) ) { { fprintf(stderr, "Line %3d of File %s \n", 160, "./dir_wr_verbs/xfer.c"); }; return(-1); } if ( dst_fld_X != ((void *)0) ) { munmap(dst_fld_X, dst_fld_nX); dst_fld_X = ((void *)0); dst_fld_nX = 0; } };
  { if ( ( nn_src_fld_X == ((void *)0) ) && ( nn_src_fld_nX != 0 ) ) { { fprintf(stderr, "Line %3d of File %s \n", 161, "./dir_wr_verbs/xfer.c"); }; return(-1); } if ( ( nn_src_fld_X != ((void *)0) ) && ( nn_src_fld_nX == 0 ) ) { { fprintf(stderr, "Line %3d of File %s \n", 161, "./dir_wr_verbs/xfer.c"); }; return(-1); } if ( nn_src_fld_X != ((void *)0) ) { munmap(nn_src_fld_X, nn_src_fld_nX); nn_src_fld_X = ((void *)0); nn_src_fld_nX = 0; } };
  { if ( ( nn_dst_idx_X == ((void *)0) ) && ( nn_dst_idx_nX != 0 ) ) { { fprintf(stderr, "Line %3d of File %s \n", 162, "./dir_wr_verbs/xfer.c"); }; return(-1); } if ( ( nn_dst_idx_X != ((void *)0) ) && ( nn_dst_idx_nX == 0 ) ) { { fprintf(stderr, "Line %3d of File %s \n", 162, "./dir_wr_verbs/xfer.c"); }; return(-1); } if ( nn_dst_idx_X != ((void *)0) ) { munmap(nn_dst_idx_X, nn_dst_idx_nX); nn_dst_idx_X = ((void *)0); nn_dst_idx_nX = 0; } };
  { if ( ( nn_dst_fld_X == ((void *)0) ) && ( nn_dst_fld_nX != 0 ) ) { { fprintf(stderr, "Line %3d of File %s \n", 163, "./dir_wr_verbs/xfer.c"); }; return(-1); } if ( ( nn_dst_fld_X != ((void *)0) ) && ( nn_dst_fld_nX == 0 ) ) { { fprintf(stderr, "Line %3d of File %s \n", 163, "./dir_wr_verbs/xfer.c"); }; return(-1); } if ( nn_dst_fld_X != ((void *)0) ) { munmap(nn_dst_fld_X, nn_dst_fld_nX); nn_dst_fld_X = ((void *)0); nn_dst_fld_nX = 0; } };
  return(status);
}

canonical_original_code:
int xfer(char *src_tbl, char *src_fld, char *dst_tbl, char *dst_idx, 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 dst_idx_meta; struct _FLD_REC_TYPE dst_fld_rec;
  struct _FLD_REC_TYPE nn_src_fld_rec; struct _FLD_REC_TYPE nn_dst_idx_meta; struct _FLD_REC_TYPE nn_dst_fld_rec;
  char opfile[-1];
  char nn_opfile[-1];
  long long src_nR; long long dst_nR;
  char *src_fld_X = ((void *)0); unsigned long src_fld_nX = 0;
  char *dst_fld_X = ((void *)0); unsigned long dst_fld_nX = 0;
  char *dst_idx_X = ((void *)0); unsigned long dst_idx_nX = 0;
  char *nn_src_fld_X = ((void *)0); unsigned long nn_src_fld_nX = 0;
  char *nn_dst_idx_X = ((void *)0); unsigned long nn_dst_idx_nX = 0;
  char *nn_dst_fld_X = ((void *)0); unsigned long nn_dst_fld_nX = 0;
  int src_tbl_id = (-0x7fffffff - 1); int dst_tbl_id = (-0x7fffffff - 1);
  int src_fld_id = (-0x7fffffff - 1); int nn_src_fld_id = (-0x7fffffff - 1);
  int dst_idx_id = (-0x7fffffff - 1); int nn_dst_idx_id = (-0x7fffffff - 1);
  int dst_fld_id = (-0x7fffffff - 1); int nn_dst_fld_id = (-0x7fffffff - 1);
  zero_string(opfile, 15 +1);
  zero_string(nn_opfile, 15 +1);
  if ( ( src_tbl == ((void *)0) ) || ( *src_tbl == '\0' ) ) { { { fprintf(stderr, "Line %3d of File %s \n", 73, "./dir_wr_verbs/xfer.c"); }; status = -1 ; goto BYE; }; }
  if ( ( dst_tbl == ((void *)0) ) || ( *dst_tbl == '\0' ) ) { { { fprintf(stderr, "Line %3d of File %s \n", 74, "./dir_wr_verbs/xfer.c"); }; status = -1 ; goto BYE; }; }
  if ( ( src_fld == ((void *)0) ) || ( *src_fld == '\0' ) ) { { { fprintf(stderr, "Line %3d of File %s \n", 75, "./dir_wr_verbs/xfer.c"); }; status = -1 ; goto BYE; }; }
  if ( ( dst_idx == ((void *)0) ) || ( *dst_idx == '\0' ) ) { { { fprintf(stderr, "Line %3d of File %s \n", 76, "./dir_wr_verbs/xfer.c"); }; status = -1 ; goto BYE; }; }
  if ( ( dst_fld == ((void *)0) ) || ( *dst_fld == '\0' ) ) { { { fprintf(stderr, "Line %3d of File %s \n", 77, "./dir_wr_verbs/xfer.c"); }; status = -1 ; goto BYE; }; }
  if ( strcmp(dst_idx, dst_fld) == 0 ) { { { fprintf(stderr, "Line %3d of File %s \n", 78, "./dir_wr_verbs/xfer.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", 80, "./dir_wr_verbs/xfer.c"); }; status = (status) ; goto BYE; } } };
  { if ( ( (src_tbl_id) < (0) ) || ( (src_tbl_id) >= (g_n_tbl ) ) ) { { { fprintf(stderr, "Line %3d of File %s \n", 81, "./dir_wr_verbs/xfer.c"); }; status = -1 ; goto BYE; }; } };
  src_nR = g_tbls[src_tbl_id].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", 86, "./dir_wr_verbs/xfer.c"); }; status = (status) ; goto BYE; } } };
  { if ( ( (src_fld_id) < (0) ) || ( (src_fld_id) >= (g_n_fld ) ) ) { { { fprintf(stderr, "Line %3d of File %s \n", 87, "./dir_wr_verbs/xfer.c"); }; status = -1 ; goto BYE; }; } };
  status = get_data(src_fld_rec, &src_fld_X, &src_fld_nX, 0); { if ( (status) < 0 ) { { { fprintf(stderr, "Line %3d of File %s \n", 89, "./dir_wr_verbs/xfer.c"); }; status = (status) ; goto BYE; } } };
  status = is_tbl(dst_tbl, &dst_tbl_id, &dst_tbl_rec); { if ( (status) < 0 ) { { { fprintf(stderr, "Line %3d of File %s \n", 91, "./dir_wr_verbs/xfer.c"); }; status = (status) ; goto BYE; } } };
  { if ( ( (dst_tbl_id) < (0) ) || ( (dst_tbl_id) >= (g_n_tbl ) ) ) { { { fprintf(stderr, "Line %3d of File %s \n", 92, "./dir_wr_verbs/xfer.c"); }; status = -1 ; goto BYE; }; } };
  dst_nR = g_tbls[dst_tbl_id].nR;
  status = is_fld(((void *)0), dst_tbl_id, dst_idx, &dst_idx_id, &dst_idx_meta,
      &nn_dst_idx_id, &nn_dst_idx_meta);
  { if ( (status) < 0 ) { { { fprintf(stderr, "Line %3d of File %s \n", 97, "./dir_wr_verbs/xfer.c"); }; status = (status) ; goto BYE; } } };
  { if ( ( (dst_idx_id) < (0) ) || ( (dst_idx_id) >= (g_n_fld ) ) ) { { { fprintf(stderr, "Line %3d of File %s \n", 98, "./dir_wr_verbs/xfer.c"); }; status = -1 ; goto BYE; }; } };
  status = get_data(dst_idx_meta, &dst_idx_X, &dst_idx_nX, 0); { if ( (status) < 0 ) { { { fprintf(stderr, "Line %3d of File %s \n", 99, "./dir_wr_verbs/xfer.c"); }; status = (status) ; goto BYE; } } };
  _Bool is_nn_needed = 0;
  if ( nn_src_fld_id >= 0 ) {
    status = get_data(nn_src_fld_rec, &nn_src_fld_X, &nn_src_fld_nX, 0);
    { if ( (status) < 0 ) { { { fprintf(stderr, "Line %3d of File %s \n", 104, "./dir_wr_verbs/xfer.c"); }; status = (status) ; goto BYE; } } };
    is_nn_needed = 1;
  }
  if ( nn_dst_idx_id >= 0 ) {
    status = get_data(nn_dst_idx_meta, &nn_dst_idx_X, &nn_dst_idx_nX, 0);
    { if ( (status) < 0 ) { { { fprintf(stderr, "Line %3d of File %s \n", 109, "./dir_wr_verbs/xfer.c"); }; status = (status) ; goto BYE; } } };
    is_nn_needed = 1;
  }
  int fldsz = 0x7fffffff; int ddir_id = 0x7fffffff; int nn_ddir_id = 0x7fffffff;
  status = get_fld_sz(src_fld_rec.fldtype, &fldsz); { if ( (status) < 0 ) { { { fprintf(stderr, "Line %3d of File %s \n", 115, "./dir_wr_verbs/xfer.c"); }; status = (status) ; goto BYE; } } };
  status = mk_temp_file(opfile, (dst_nR * fldsz), &ddir_id); { if ( (status) < 0 ) { { { fprintf(stderr, "Line %3d of File %s \n", 117, "./dir_wr_verbs/xfer.c"); }; status = (status) ; goto BYE; } } };
  status = q_mmap(ddir_id, opfile, &dst_fld_X, &dst_fld_nX, 1); { if ( (status) < 0 ) { { { fprintf(stderr, "Line %3d of File %s \n", 118, "./dir_wr_verbs/xfer.c"); }; status = (status) ; goto BYE; } } };
  if ( is_nn_needed ) {
    status = mk_temp_file(nn_opfile, (dst_nR * sizeof(char)), &nn_ddir_id); { if ( (status) < 0 ) { { { fprintf(stderr, "Line %3d of File %s \n", 121, "./dir_wr_verbs/xfer.c"); }; status = (status) ; goto BYE; } } };
    status = q_mmap(nn_ddir_id, nn_opfile, &nn_dst_fld_X, &nn_dst_fld_nX, 1); { if ( (status) < 0 ) { { { fprintf(stderr, "Line %3d of File %s \n", 122, "./dir_wr_verbs/xfer.c"); }; status = (status) ; goto BYE; } } };
  }
  switch ( src_fld_rec.fldtype ) {
    case I1 :
      switch ( dst_idx_meta.fldtype ) {
 case I4 :
   xfer_I1_I4(src_fld_X, nn_src_fld_X, src_nR,
                      dst_idx_X, nn_dst_idx_X, dst_nR,
        dst_fld_X, nn_dst_fld_X);
   break;
 default : { { fprintf(stderr, "Line %3d of File %s \n", 8, "./dir_wr_verbs/incl_xfer_I1.c"); }; status = -1 ; goto BYE; }; break;
      }
      break;
    case I2 :
      switch ( dst_idx_meta.fldtype ) {
 case I4 :
   xfer_I2_I4(src_fld_X, nn_src_fld_X, src_nR,
                      dst_idx_X, nn_dst_idx_X, dst_nR,
        dst_fld_X, nn_dst_fld_X);
   break;
 default : { { fprintf(stderr, "Line %3d of File %s \n", 8, "./dir_wr_verbs/incl_xfer_I2.c"); }; status = -1 ; goto BYE; }; break;
      }
      break;
    case I4 :
      switch ( dst_idx_meta.fldtype ) {
 case I4 :
   xfer_I4_I4(src_fld_X, nn_src_fld_X, src_nR,
                      dst_idx_X, nn_dst_idx_X, dst_nR,
        dst_fld_X, nn_dst_fld_X);
   break;
 default : { { fprintf(stderr, "Line %3d of File %s \n", 8, "./dir_wr_verbs/incl_xfer_I4.c"); }; status = -1 ; goto BYE; }; break;
      }
      break;
    case I8 :
      switch ( dst_idx_meta.fldtype ) {
 case I4 :
   xfer_I8_I4(src_fld_X, nn_src_fld_X, src_nR,
                      dst_idx_X, nn_dst_idx_X, dst_nR,
        dst_fld_X, nn_dst_fld_X);
   break;
 default : { { fprintf(stderr, "Line %3d of File %s \n", 8, "./dir_wr_verbs/incl_xfer_I8.c"); }; status = -1 ; goto BYE; }; break;
      }
      break;
    case F4 :
      switch ( dst_idx_meta.fldtype ) {
 case I4 :
   xfer_F4_I4(src_fld_X, nn_src_fld_X, src_nR,
                      dst_idx_X, nn_dst_idx_X, dst_nR,
        dst_fld_X, nn_dst_fld_X);
   break;
 default : { { fprintf(stderr, "Line %3d of File %s \n", 8, "./dir_wr_verbs/incl_xfer_F4.c"); }; status = -1 ; goto BYE; }; break;
      }
      break;
    case F8 :
      switch ( dst_idx_meta.fldtype ) {
 case I4 :
   xfer_F8_I4(src_fld_X, nn_src_fld_X, src_nR,
                      dst_idx_X, nn_dst_idx_X, dst_nR,
        dst_fld_X, nn_dst_fld_X);
   break;
 default : { { fprintf(stderr, "Line %3d of File %s \n", 8, "./dir_wr_verbs/incl_xfer_F8.c"); }; status = -1 ; goto BYE; }; break;
      }
      break;
    default :
      { { fprintf(stderr, "Line %3d of File %s \n", 135, "./dir_wr_verbs/xfer.c"); }; status = -1 ; goto BYE; };
      break;
  }
  status = add_fld(dst_tbl_id, dst_fld, ddir_id, opfile, src_fld_rec.fldtype,
      -1, &dst_fld_id, &dst_fld_rec);
  { if ( (status) < 0 ) { { { fprintf(stderr, "Line %3d of File %s \n", 140, "./dir_wr_verbs/xfer.c"); }; status = (status) ; goto BYE; } } };
  if ( is_nn_needed ) {
    status = add_aux_fld(((void *)0), dst_tbl_id, ((void *)0), dst_fld_id, nn_ddir_id,
 nn_opfile, "nn", &nn_dst_fld_id, &nn_dst_fld_rec);
  }
  char strbuf[32];
  status = int_get_meta(src_tbl_id, src_fld_id, "dict_tbl_id", strbuf);
  { if ( (status) < 0 ) { { { fprintf(stderr, "Line %3d of File %s \n", 150, "./dir_wr_verbs/xfer.c"); }; status = (status) ; goto BYE; } } };
  char *endptr;
  int dict_tbl_id = strtoll(strbuf, &endptr, 10);
  if ( dict_tbl_id > 0 ) {
    status = int_set_meta(dst_tbl_id, dst_fld_id, "dict_tbl_id", strbuf);
    { if ( (status) < 0 ) { { { fprintf(stderr, "Line %3d of File %s \n", 155, "./dir_wr_verbs/xfer.c"); }; status = (status) ; goto BYE; } } };
  }
 BYE:
  { if ( ( src_fld_X == ((void *)0) ) && ( src_fld_nX != 0 ) ) { { fprintf(stderr, "Line %3d of File %s \n", 158, "./dir_wr_verbs/xfer.c"); }; return(-1); } if ( ( src_fld_X != ((void *)0) ) && ( src_fld_nX == 0 ) ) { { fprintf(stderr, "Line %3d of File %s \n", 158, "./dir_wr_verbs/xfer.c"); }; return(-1); } if ( src_fld_X != ((void *)0) ) { munmap(src_fld_X, src_fld_nX); src_fld_X = ((void *)0); src_fld_nX = 0; } };
  { if ( ( dst_idx_X == ((void *)0) ) && ( dst_idx_nX != 0 ) ) { { fprintf(stderr, "Line %3d of File %s \n", 159, "./dir_wr_verbs/xfer.c"); }; return(-1); } if ( ( dst_idx_X != ((void *)0) ) && ( dst_idx_nX == 0 ) ) { { fprintf(stderr, "Line %3d of File %s \n", 159, "./dir_wr_verbs/xfer.c"); }; return(-1); } if ( dst_idx_X != ((void *)0) ) { munmap(dst_idx_X, dst_idx_nX); dst_idx_X = ((void *)0); dst_idx_nX = 0; } };
  { if ( ( dst_fld_X == ((void *)0) ) && ( dst_fld_nX != 0 ) ) { { fprintf(stderr, "Line %3d of File %s \n", 160, "./dir_wr_verbs/xfer.c"); }; return(-1); } if ( ( dst_fld_X != ((void *)0) ) && ( dst_fld_nX == 0 ) ) { { fprintf(stderr, "Line %3d of File %s \n", 160, "./dir_wr_verbs/xfer.c"); }; return(-1); } if ( dst_fld_X != ((void *)0) ) { munmap(dst_fld_X, dst_fld_nX); dst_fld_X = ((void *)0); dst_fld_nX = 0; } };
  { if ( ( nn_src_fld_X == ((void *)0) ) && ( nn_src_fld_nX != 0 ) ) { { fprintf(stderr, "Line %3d of File %s \n", 161, "./dir_wr_verbs/xfer.c"); }; return(-1); } if ( ( nn_src_fld_X != ((void *)0) ) && ( nn_src_fld_nX == 0 ) ) { { fprintf(stderr, "Line %3d of File %s \n", 161, "./dir_wr_verbs/xfer.c"); }; return(-1); } if ( nn_src_fld_X != ((void *)0) ) { munmap(nn_src_fld_X, nn_src_fld_nX); nn_src_fld_X = ((void *)0); nn_src_fld_nX = 0; } };
  { if ( ( nn_dst_idx_X == ((void *)0) ) && ( nn_dst_idx_nX != 0 ) ) { { fprintf(stderr, "Line %3d of File %s \n", 162, "./dir_wr_verbs/xfer.c"); }; return(-1); } if ( ( nn_dst_idx_X != ((void *)0) ) && ( nn_dst_idx_nX == 0 ) ) { { fprintf(stderr, "Line %3d of File %s \n", 162, "./dir_wr_verbs/xfer.c"); }; return(-1); } if ( nn_dst_idx_X != ((void *)0) ) { munmap(nn_dst_idx_X, nn_dst_idx_nX); nn_dst_idx_X = ((void *)0); nn_dst_idx_nX = 0; } };
  { if ( ( nn_dst_fld_X == ((void *)0) ) && ( nn_dst_fld_nX != 0 ) ) { { fprintf(stderr, "Line %3d of File %s \n", 163, "./dir_wr_verbs/xfer.c"); }; return(-1); } if ( ( nn_dst_fld_X != ((void *)0) ) && ( nn_dst_fld_nX == 0 ) ) { { fprintf(stderr, "Line %3d of File %s \n", 163, "./dir_wr_verbs/xfer.c"); }; return(-1); } if ( nn_dst_fld_X != ((void *)0) ) { munmap(nn_dst_fld_X, nn_dst_fld_nX); nn_dst_fld_X = ((void *)0); nn_dst_fld_nX = 0; } };
  return(status);
}

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:
strbuf
char [32]

variable_types:
endptr
char *

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


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

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

variable_types:
in
int *

variable_types:
n
long long

variable_types:
cfld
char *

variable_types:
cnt
long long *

variable_types:
cptr
char *

variable_types:
i
long long

variable_types: idx int


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

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

variable_types: status int

variable_types:
minval
long long

variable_types:
maxval
long long

variable_types:
sum
long long

variable_types:
cnt
long long


decompiled_code:
__int64 __fastcall set_nR(_BYTE *a1, const char *a2)
{
__int64 v2; // rbx
unsigned int v3; // er12
__int64 v5; // rdx
int v6; // [rsp+4h] [rbp-D4h] BYREF
char *endptr; // [rsp+8h] [rbp-D0h] BYREF
char v8[200]; // [rsp+10h] [rbp-C8h] BYREF

if ( !a2 || !*a2 )
{
v5 = 32LL;
goto LABEL_13;
}
v2 = strtoll(a2, &endptr, 10);
if ( v2 <= 0 )
{
v5 = 34LL;
goto LABEL_13;
}
if ( !a1 || !*a1 )
{
v5 = 35LL;
goto LABEL_13;
}
v3 = is_tbl(a1, &v6, v8);
if ( (v3 & 0x80000000) == 0 )
{
if ( v6 >= 0 && v6 < g_n_tbl )
{
*(_QWORD *)(g_tbls + 176LL * v6) = v2;
return v3;
}
v5 = 39LL;
LABEL_13:
v3 = -1;
fprintf(stderr, "Line %3d of File %s \n", v5, "./dir_wr_verbs/set_nR.c");
return v3;
}
fprintf(stderr, "Line %3d of File %s \n", 38LL, "./dir_wr_verbs/set_nR.c");
return v3;
}

canonical_decompiled_code:
__int64 __fastcall func0(_BYTE *a1, const char *a2)
{
__int64 v2; // rbx
unsigned int v3; // er12
__int64 v5; // rdx
int v6; // [rsp+4h] [rbp-D4h] BYREF
char *endptr; // [rsp+8h] [rbp-D0h] BYREF
char v8[200]; // [rsp+10h] [rbp-C8h] BYREF

if ( !a2 || !*a2 )
{
v5 = 32LL;
goto LABEL_13;
}
v2 = strtoll(a2, &endptr, 10);
if ( v2 <= 0 )
{
v5 = 34LL;
goto LABEL_13;
}
if ( !a1 || !*a1 )
{
v5 = 35LL;
goto LABEL_13;
}
v3 = is_tbl(a1, &v6, v8);
if ( (v3 & 0x80000000) == 0 )
{
if ( v6 >= 0 && v6 < g_n_tbl )
{
*(_QWORD *)(g_tbls + 176LL * v6) = v2;
return v3;
}
v5 = 39LL;
LABEL_13:
v3 = -1;
fprintf(stderr, "Line %3d of File %s \n", v5, "./dir_wr_verbs/set_nR.c");
return v3;
}
fprintf(stderr, "Line %3d of File %s \n", 38LL, "./dir_wr_verbs/set_nR.c");
return v3;
}

original_code:
int
set_nR(
 char *tbl,
 char *str_nR
 )
{
  int status = 0;
  int tbl_id; TBL_REC_TYPE tbl_rec;
  long long nR; char *endptr;
  if ( ( str_nR == ((void *)0) ) || ( *str_nR == '\0' ) ) { { { fprintf(stderr, "Line %3d of File %s \n", 32, "./dir_wr_verbs/set_nR.c"); }; status = -1 ; goto BYE; }; }
  nR = strtoll(str_nR, &endptr, 10);
  if ( nR <= 0 ) { { { fprintf(stderr, "Line %3d of File %s \n", 34, "./dir_wr_verbs/set_nR.c"); }; status = -1 ; goto BYE; };}
  if ( ( tbl == ((void *)0) ) || ( *tbl == '\0' ) ) { { { fprintf(stderr, "Line %3d of File %s \n", 35, "./dir_wr_verbs/set_nR.c"); }; status = -1 ; goto BYE; }; }
  status = is_tbl(tbl, &tbl_id, &tbl_rec);
  { if ( (status) < 0 ) { { { fprintf(stderr, "Line %3d of File %s \n", 38, "./dir_wr_verbs/set_nR.c"); }; status = (status) ; goto BYE; } } };
  { if ( ( (tbl_id) < (0) ) || ( (tbl_id) >= (g_n_tbl ) ) ) { { { fprintf(stderr, "Line %3d of File %s \n", 39, "./dir_wr_verbs/set_nR.c"); }; status = -1 ; goto BYE; }; } };
  g_tbls[tbl_id].nR = nR;
 BYE:
  return(status);
}

canonical_original_code:
int set_nR(char *tbl, char *str_nR)
{
  int status = 0;
  int tbl_id; struct _TBL_REC_TYPE tbl_rec;
  long long nR; char *endptr;
  if ( ( str_nR == ((void *)0) ) || ( *str_nR == '\0' ) ) { { { fprintf(stderr, "Line %3d of File %s \n", 32, "./dir_wr_verbs/set_nR.c"); }; status = -1 ; goto BYE; }; }
  nR = strtoll(str_nR, &endptr, 10);
  if ( nR <= 0 ) { { { fprintf(stderr, "Line %3d of File %s \n", 34, "./dir_wr_verbs/set_nR.c"); }; status = -1 ; goto BYE; };}
  if ( ( tbl == ((void *)0) ) || ( *tbl == '\0' ) ) { { { fprintf(stderr, "Line %3d of File %s \n", 35, "./dir_wr_verbs/set_nR.c"); }; status = -1 ; goto BYE; }; }
  status = is_tbl(tbl, &tbl_id, &tbl_rec);
  { if ( (status) < 0 ) { { { fprintf(stderr, "Line %3d of File %s \n", 38, "./dir_wr_verbs/set_nR.c"); }; status = (status) ; goto BYE; } } };
  { if ( ( (tbl_id) < (0) ) || ( (tbl_id) >= (g_n_tbl ) ) ) { { { fprintf(stderr, "Line %3d of File %s \n", 39, "./dir_wr_verbs/set_nR.c"); }; status = -1 ; goto BYE; }; } };
  g_tbls[tbl_id].nR = nR;
 BYE:
  return(status);
}

variable_types:
tbl
char *

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

variable_types:
nR
long long


original_code:
void
bwise_or2_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 bwise_or2_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:
out
char *

variable_types: outv char

return_type: void


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

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

variable_types: ival char


decompiled_code:
__int64 __fastcall drop_aux_fld(const char *a1, const char *a2, __int64 a3, int a4)
{
int v5; // eax
int v6; // er12
__int64 v8; // rdx
int v9; // [rsp+0h] [rbp-168h] BYREF
int v10; // [rsp+4h] [rbp-164h] BYREF
int v11; // [rsp+8h] [rbp-160h] BYREF
unsigned int v12; // [rsp+Ch] [rbp-15Ch] BYREF
char v13[48]; // [rsp+10h] [rbp-158h] BYREF
char v14[128]; // [rsp+40h] [rbp-128h] BYREF
char v15[168]; // [rsp+C0h] [rbp-A8h] BYREF

v9 = 0x80000000;
v10 = 0x80000000;
v11 = 0x80000000;
v5 = unstr_auxtype(a3, &v12);
if ( v5 < 0 )
{
v6 = v5;
fprintf(stderr, "Line %3d of File %s \n", 28LL, "drop_aux_fld.c");
return (unsigned int)v6;
}
if ( a4 < 0 )
{
if ( !a1 || !*a1 )
{
v8 = 33LL;
goto LABEL_22;
}
if ( !a2 || !*a2 )
{
v8 = 34LL;
goto LABEL_22;
}
v6 = is_tbl(a1, &v9, v13);
if ( v6 < 0 )
{
fprintf(stderr, "Line %3d of File %s \n", 35LL, "drop_aux_fld.c");
return (unsigned int)v6;
}
if ( v9 < 0 || v9 >= g_n_tbl )
{
v8 = 36LL;
goto LABEL_22;
}
v6 = is_fld(0LL, (unsigned int)v9, a2, &v10, v14, &v11, v15);
if ( v6 < 0 )
{
fprintf(stderr, "Line %3d of File %s \n", 37LL, "drop_aux_fld.c");
return (unsigned int)v6;
}
a4 = v10;
if ( v10 < 0 )
{
fprintf(stderr, "Field %s in Table %s does not exist\n", a2, a1);
fprintf(stderr, "Line %3d of File %s \n", 40LL, "drop_aux_fld.c");
return (unsigned int)v6;
}
}
else
{
v10 = a4;
}
if ( g_n_fld <= a4 )
{
v8 = 44LL;
LABEL_22:
v6 = -1;
fprintf(stderr, "Line %3d of File %s \n", v8, "drop_aux_fld.c");
return (unsigned int)v6;
}
v6 = del_aux_fld((unsigned int)a4, v12);
if ( v6 < 0 )
fprintf(stderr, "Line %3d of File %s \n", 45LL, "drop_aux_fld.c");
return (unsigned int)v6;
}

canonical_decompiled_code:
__int64 __fastcall func0(const char *a1, const char *a2, __int64 a3, int a4)
{
int v5; // eax
int v6; // er12
__int64 v8; // rdx
int v9; // [rsp+0h] [rbp-168h] BYREF
int v10; // [rsp+4h] [rbp-164h] BYREF
int v11; // [rsp+8h] [rbp-160h] BYREF
unsigned int v12; // [rsp+Ch] [rbp-15Ch] BYREF
char v13[48]; // [rsp+10h] [rbp-158h] BYREF
char v14[128]; // [rsp+40h] [rbp-128h] BYREF
char v15[168]; // [rsp+C0h] [rbp-A8h] BYREF

v9 = 0x80000000;
v10 = 0x80000000;
v11 = 0x80000000;
v5 = unstr_auxtype(a3, &v12);
if ( v5 < 0 )
{
v6 = v5;
fprintf(stderr, "Line %3d of File %s \n", 28LL, "drop_aux_fld.c");
return (unsigned int)v6;
}
if ( a4 < 0 )
{
if ( !a1 || !*a1 )
{
v8 = 33LL;
goto LABEL_22;
}
if ( !a2 || !*a2 )
{
v8 = 34LL;
goto LABEL_22;
}
v6 = is_tbl(a1, &v9, v13);
if ( v6 < 0 )
{
fprintf(stderr, "Line %3d of File %s \n", 35LL, "drop_aux_fld.c");
return (unsigned int)v6;
}
if ( v9 < 0 || v9 >= g_n_tbl )
{
v8 = 36LL;
goto LABEL_22;
}
v6 = is_fld(0LL, (unsigned int)v9, a2, &v10, v14, &v11, v15);
if ( v6 < 0 )
{
fprintf(stderr, "Line %3d of File %s \n", 37LL, "drop_aux_fld.c");
return (unsigned int)v6;
}
a4 = v10;
if ( v10 < 0 )
{
fprintf(stderr, "Field %s in Table %s does not exist\n", a2, a1);
fprintf(stderr, "Line %3d of File %s \n", 40LL, "drop_aux_fld.c");
return (unsigned int)v6;
}
}
else
{
v10 = a4;
}
if ( g_n_fld <= a4 )
{
v8 = 44LL;
LABEL_22:
v6 = -1;
fprintf(stderr, "Line %3d of File %s \n", v8, "drop_aux_fld.c");
return (unsigned int)v6;
}
v6 = del_aux_fld((unsigned int)a4, v12);
if ( v6 < 0 )
fprintf(stderr, "Line %3d of File %s \n", 45LL, "drop_aux_fld.c");
return (unsigned int)v6;
}

original_code:
int
drop_aux_fld(
    char *tbl,
    char *fld,
    char *str_auxtype,
    int in_fld_id
    )
{
  int status = 0;
  int tbl_id = (-0x7fffffff - 1), fld_id = (-0x7fffffff - 1), nn_fld_id = (-0x7fffffff - 1);
  TBL_REC_TYPE tbl_rec; FLD_REC_TYPE fld_rec, nn_fld_rec;
  AUX_TYPE auxtype;
  status = unstr_auxtype(str_auxtype, &auxtype); { if ( (status) < 0 ) { { { fprintf(stderr, "Line %3d of File %s \n", 28, "drop_aux_fld.c"); }; status = (status) ; goto BYE; } } };
  if ( in_fld_id >= 0 ) {
    fld_id = in_fld_id;
  }
  else {
    if ( ( tbl == ((void *)0) ) || ( *tbl == '\0' ) ) { { { fprintf(stderr, "Line %3d of File %s \n", 33, "drop_aux_fld.c"); }; status = -1 ; goto BYE; }; }
    if ( ( fld == ((void *)0) ) || ( *fld == '\0' ) ) { { { fprintf(stderr, "Line %3d of File %s \n", 34, "drop_aux_fld.c"); }; status = -1 ; goto BYE; }; }
    status = is_tbl(tbl, &tbl_id, &tbl_rec); { if ( (status) < 0 ) { { { fprintf(stderr, "Line %3d of File %s \n", 35, "drop_aux_fld.c"); }; status = (status) ; goto BYE; } } };
    { if ( ( (tbl_id) < (0) ) || ( (tbl_id) >= (g_n_tbl ) ) ) { { { fprintf(stderr, "Line %3d of File %s \n", 36, "drop_aux_fld.c"); }; status = -1 ; goto BYE; }; } };
    status = is_fld(((void *)0), tbl_id, fld, &fld_id, &fld_rec, &nn_fld_id, &nn_fld_rec); { if ( (status) < 0 ) { { { fprintf(stderr, "Line %3d of File %s \n", 37, "drop_aux_fld.c"); }; status = (status) ; goto BYE; } } };
    if ( fld_id < 0 ) {
      fprintf(stderr, "Field %s in Table %s does not exist\n", fld, tbl);
      { fprintf(stderr, "Line %3d of File %s \n", 40, "drop_aux_fld.c"); };
      return status ;
    }
  }
  { if ( ( (fld_id) < (0) ) || ( (fld_id) >= (g_n_fld ) ) ) { { { fprintf(stderr, "Line %3d of File %s \n", 44, "drop_aux_fld.c"); }; status = -1 ; goto BYE; }; } };
  status = del_aux_fld(fld_id, auxtype); { if ( (status) < 0 ) { { { fprintf(stderr, "Line %3d of File %s \n", 45, "drop_aux_fld.c"); }; status = (status) ; goto BYE; } } };
 BYE:
  return status ;
}

canonical_original_code:
int drop_aux_fld(char *tbl, char *fld, char *str_auxtype, int in_fld_id)
{
  int status = 0;
  int tbl_id = (-0x7fffffff - 1); int fld_id = (-0x7fffffff - 1); int nn_fld_id = (-0x7fffffff - 1);
  struct _TBL_REC_TYPE tbl_rec; struct _FLD_REC_TYPE fld_rec; struct _FLD_REC_TYPE nn_fld_rec;
  enum _AUX_TYPE auxtype;
  status = unstr_auxtype(str_auxtype, &auxtype); { if ( (status) < 0 ) { { { fprintf(stderr, "Line %3d of File %s \n", 28, "drop_aux_fld.c"); }; status = (status) ; goto BYE; } } };
  if ( in_fld_id >= 0 ) {
    fld_id = in_fld_id;
  }
  else {
    if ( ( tbl == ((void *)0) ) || ( *tbl == '\0' ) ) { { { fprintf(stderr, "Line %3d of File %s \n", 33, "drop_aux_fld.c"); }; status = -1 ; goto BYE; }; }
    if ( ( fld == ((void *)0) ) || ( *fld == '\0' ) ) { { { fprintf(stderr, "Line %3d of File %s \n", 34, "drop_aux_fld.c"); }; status = -1 ; goto BYE; }; }
    status = is_tbl(tbl, &tbl_id, &tbl_rec); { if ( (status) < 0 ) { { { fprintf(stderr, "Line %3d of File %s \n", 35, "drop_aux_fld.c"); }; status = (status) ; goto BYE; } } };
    { if ( ( (tbl_id) < (0) ) || ( (tbl_id) >= (g_n_tbl ) ) ) { { { fprintf(stderr, "Line %3d of File %s \n", 36, "drop_aux_fld.c"); }; status = -1 ; goto BYE; }; } };
    status = is_fld(((void *)0), tbl_id, fld, &fld_id, &fld_rec, &nn_fld_id, &nn_fld_rec); { if ( (status) < 0 ) { { { fprintf(stderr, "Line %3d of File %s \n", 37, "drop_aux_fld.c"); }; status = (status) ; goto BYE; } } };
    if ( fld_id < 0 ) {
      fprintf(stderr, "Field %s in Table %s does not exist\n", fld, tbl);
      { fprintf(stderr, "Line %3d of File %s \n", 40, "drop_aux_fld.c"); };
      return status ;
    }
  }
  { if ( ( (fld_id) < (0) ) || ( (fld_id) >= (g_n_fld ) ) ) { { { fprintf(stderr, "Line %3d of File %s \n", 44, "drop_aux_fld.c"); }; status = -1 ; goto BYE; }; } };
  status = del_aux_fld(fld_id, auxtype); { if ( (status) < 0 ) { { { fprintf(stderr, "Line %3d of File %s \n", 45, "drop_aux_fld.c"); }; status = (status) ; goto BYE; } } };
 BYE:
  return status ;
}

variable_types:
fld
char *

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


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

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

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

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

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

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

variable_types:
scalars
long long *

variable_types:
hashes
long long *

variable_types:
used
unsigned char *

variable_types:
n
unsigned int

variable_types:
a
unsigned int

variable_types:
b
unsigned int

variable_types: iter int

variable_types: i int

variable_types:
val
unsigned long long

variable_types:
ltemp
unsigned long long

variable_types:
loc
unsigned short


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

variable_types:
lb
long long

variable_types:
ub
long long

variable_types: status int

variable_types:
cnt
long long

variable_types:
val
long long


original_code:
int
core_srt_join_I_I_I(
          int *src_lnk,
          int *src_val,
          long long src_nR,
          int *dst_lnk,
          int *dst_val,
          char *nn_dst_val,
          long long dst_lb,
          long long dst_ub,
          int ijoin_op,
          _Bool *ptr_is_any_null
          )
{
  int status = 0;
  long long src_idx;
  int v_dst_lnk;
  int v_src_val;
  int v_src_lnk;
  _Bool found, prev_val_known = 0;
  status = set_init(nn_dst_val, dst_val, dst_lb, dst_ub, ijoin_op);
  { if ( (status) < 0 ) { { { fprintf(stderr, "Line %3d of File %s \n", 117, "./AUX/core_srt_join_I_I_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_I_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_I_I(int *src_lnk, int *src_val, long long src_nR, int *dst_lnk, int *dst_val, char *nn_dst_val, long long dst_lb, long long dst_ub, int ijoin_op, _Bool *ptr_is_any_null)
{
  int status = 0;
  long long src_idx;
  int v_dst_lnk;
  int v_src_val;
  int v_src_lnk;
  _Bool found; _Bool prev_val_known = 0;
  status = set_init(nn_dst_val, dst_val, dst_lb, dst_ub, ijoin_op);
  { if ( (status) < 0 ) { { { fprintf(stderr, "Line %3d of File %s \n", 117, "./AUX/core_srt_join_I_I_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_I_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:
delta
long long