xfer

decompiled_code:
__int64 __fastcall xfer(_BYTE *a1, _BYTE *a2, _BYTE *a3, const char *a4, const char *a5)
{
int v8; // ebx
__int64 v10; // r15
__int64 v11; // rbp
char *v12; // rsi
__int64 v13; // rcx
_DWORD *v14; // rdi
char v15; // r12
char *v16; // rsi
__int64 v17; // rcx
_DWORD *v18; // rdi
char *v19; // rsi
__int64 v20; // rcx
_DWORD *v21; // rdi
_QWORD v22[29]; // [rsp-E0h] [rbp-898h] BYREF
char *endptr; // [rsp+8h] [rbp-7B0h] BYREF
char nptr[36]; // [rsp+10h] [rbp-7A8h] BYREF
unsigned int v25; // [rsp+34h] [rbp-784h] BYREF
unsigned int v26; // [rsp+38h] [rbp-780h] BYREF
int v27; // [rsp+3Ch] [rbp-77Ch] BYREF
int v28; // [rsp+40h] [rbp-778h] BYREF
unsigned int v29; // [rsp+44h] [rbp-774h] BYREF
int v30; // [rsp+48h] [rbp-770h] BYREF
int v31; // [rsp+4Ch] [rbp-76Ch] BYREF
int v32; // [rsp+50h] [rbp-768h] BYREF
int v33; // [rsp+54h] [rbp-764h] BYREF
unsigned int v34; // [rsp+58h] [rbp-760h] BYREF
unsigned int v35; // [rsp+5Ch] [rbp-75Ch] BYREF
size_t v36; // [rsp+60h] [rbp-758h] BYREF
void *v37; // [rsp+68h] [rbp-750h] BYREF
size_t v38; // [rsp+70h] [rbp-748h] BYREF
void *v39; // [rsp+78h] [rbp-740h] BYREF
size_t v40; // [rsp+80h] [rbp-738h] BYREF
void *v41; // [rsp+88h] [rbp-730h] BYREF
size_t v42; // [rsp+90h] [rbp-728h] BYREF
void *v43; // [rsp+98h] [rbp-720h] BYREF
size_t v44; // [rsp+A0h] [rbp-718h] BYREF
void *v45; // [rsp+A8h] [rbp-710h] BYREF
size_t len; // [rsp+B0h] [rbp-708h] BYREF
void *addr; // [rsp+B8h] [rbp-700h] BYREF
char v48[16]; // [rsp+C0h] [rbp-6F8h] BYREF
char v49[16]; // [rsp+D0h] [rbp-6E8h] BYREF
char v50[224]; // [rsp+E0h] [rbp-6D8h] BYREF
char v51[224]; // [rsp+1C0h] [rbp-5F8h] BYREF
char v52[224]; // [rsp+2A0h] [rbp-518h] BYREF
char v53[224]; // [rsp+380h] [rbp-438h] BYREF
char v54[24]; // [rsp+460h] [rbp-358h] BYREF
int v55; // [rsp+478h] [rbp-340h]
__int64 v56[3]; // [rsp+540h] [rbp-278h] BYREF
__int64 v57; // [rsp+558h] [rbp-260h]
__int64 v58; // [rsp+560h] [rbp-258h]
__int64 v59; // [rsp+568h] [rbp-250h]
__int64 v60; // [rsp+570h] [rbp-248h]
__int64 v61; // [rsp+578h] [rbp-240h]
__int64 v62; // [rsp+580h] [rbp-238h]
__int64 v63; // [rsp+588h] [rbp-230h]
__int64 v64; // [rsp+590h] [rbp-228h]
__int64 v65; // [rsp+598h] [rbp-220h]
__int64 v66; // [rsp+5A0h] [rbp-218h]
__int64 v67; // [rsp+5A8h] [rbp-210h]
__int64 v68; // [rsp+5B0h] [rbp-208h]
__int64 v69; // [rsp+5B8h] [rbp-200h]
__int64 v70; // [rsp+5C0h] [rbp-1F8h]
__int64 v71; // [rsp+5C8h] [rbp-1F0h]
__int64 v72; // [rsp+5D0h] [rbp-1E8h]
__int64 v73; // [rsp+5D8h] [rbp-1E0h]
__int64 v74; // [rsp+5E0h] [rbp-1D8h]
__int64 v75; // [rsp+5E8h] [rbp-1D0h]
__int64 v76; // [rsp+5F0h] [rbp-1C8h]
__int64 v77; // [rsp+5F8h] [rbp-1C0h]
__int64 v78; // [rsp+600h] [rbp-1B8h]
__int64 v79; // [rsp+608h] [rbp-1B0h]
__int64 v80; // [rsp+610h] [rbp-1A8h]
__int64 v81; // [rsp+618h] [rbp-1A0h]
char v82[176]; // [rsp+620h] [rbp-198h] BYREF
char v83[232]; // [rsp+6D0h] [rbp-E8h] BYREF

addr = 0LL;
len = 0LL;
v45 = 0LL;
v44 = 0LL;
v43 = 0LL;
v42 = 0LL;
v41 = 0LL;
v40 = 0LL;
v39 = 0LL;
v38 = 0LL;
v37 = 0LL;
v36 = 0LL;
v35 = 0x80000000;
v34 = 0x80000000;
v33 = 0x80000000;
v32 = 0x80000000;
v31 = 0x80000000;
v30 = 0x80000000;
v29 = 0x80000000;
v28 = 0x80000000;
zero_string(v49, 16LL);
zero_string(v48, 16LL);
if ( !a1 || !*a1 )
{
fprintf(stderr, "Line %3d of File %s \n", 73LL, "./dir_wr_verbs/xfer.c");
v8 = -1;
goto LABEL_17;
}
if ( !a3 || !*a3 )
{
fprintf(stderr, "Line %3d of File %s \n", 74LL, "./dir_wr_verbs/xfer.c");
v8 = -1;
goto LABEL_17;
}
if ( !a2 || !*a2 )
{
fprintf(stderr, "Line %3d of File %s \n", 75LL, "./dir_wr_verbs/xfer.c");
v8 = -1;
goto LABEL_17;
}
if ( !a4 || !*a4 )
{
fprintf(stderr, "Line %3d of File %s \n", 76LL, "./dir_wr_verbs/xfer.c");
v8 = -1;
goto LABEL_17;
}
if ( !a5 || !*a5 )
{
fprintf(stderr, "Line %3d of File %s \n", 77LL, "./dir_wr_verbs/xfer.c");
v8 = -1;
goto LABEL_17;
}
if ( !strcmp(a4, a5) )
{
fprintf(stderr, "Line %3d of File %s \n", 78LL, "./dir_wr_verbs/xfer.c");
v8 = -1;
goto LABEL_17;
}
v8 = is_tbl(a1, &v35, v83);
if ( v8 < 0 )
{
fprintf(stderr, "Line %3d of File %s \n", 80LL, "./dir_wr_verbs/xfer.c");
goto LABEL_17;
}
if ( (v35 & 0x80000000) != 0 || (int)v35 >= g_n_tbl )
{
fprintf(stderr, "Line %3d of File %s \n", 81LL, "./dir_wr_verbs/xfer.c");
v8 = -1;
goto LABEL_17;
}
v10 = *(_QWORD *)(g_tbls + 176LL * (int)v35);
v8 = is_fld(0LL, v35, a2, &v33, v56, &v32, v52);
if ( v8 < 0 )
{
fprintf(stderr, "Line %3d of File %s \n", 86LL, "./dir_wr_verbs/xfer.c");
goto LABEL_17;
}
if ( v33 < 0 || v33 >= g_n_fld )
{
fprintf(stderr, "Line %3d of File %s \n", 87LL, "./dir_wr_verbs/xfer.c");
v8 = -1;
goto LABEL_17;
}
v22[27] = v81;
v22[26] = v80;
v22[25] = v79;
v22[24] = v78;
v22[23] = v77;
v22[22] = v76;
v22[21] = v75;
v22[20] = v74;
v22[19] = v73;
v22[18] = v72;
v22[17] = v71;
v22[16] = v70;
v22[15] = v69;
v22[14] = v68;
v22[13] = v67;
v22[12] = v66;
v22[11] = v65;
v22[10] = v64;
v22[9] = v63;
v22[8] = v62;
v22[7] = v61;
v22[6] = v60;
v22[5] = v59;
v22[4] = v58;
v22[3] = v57;
v22[2] = v56[2];
v22[1] = v56[1];
v22[0] = v56[0];
v8 = get_data(&addr, &len, 0LL);
if ( v8 < 0 )
{
fprintf(stderr, "Line %3d of File %s \n", 89LL, "./dir_wr_verbs/xfer.c");
goto LABEL_17;
}
v8 = is_tbl(a3, &v34, v82);
if ( v8 < 0 )
{
fprintf(stderr, "Line %3d of File %s \n", 91LL, "./dir_wr_verbs/xfer.c");
goto LABEL_17;
}
if ( (v34 & 0x80000000) != 0 || (int)v34 >= g_n_tbl )
{
fprintf(stderr, "Line %3d of File %s \n", 92LL, "./dir_wr_verbs/xfer.c");
v8 = -1;
goto LABEL_17;
}
v11 = *(_QWORD *)(g_tbls + 176LL * (int)v34);
v8 = is_fld(0LL, v34, a4, &v31, v54, &v30, v51);
if ( v8 < 0 )
{
fprintf(stderr, "Line %3d of File %s \n", 97LL, "./dir_wr_verbs/xfer.c");
goto LABEL_17;
}
if ( v31 < 0 || v31 >= g_n_fld )
{
fprintf(stderr, "Line %3d of File %s \n", 98LL, "./dir_wr_verbs/xfer.c");
v8 = -1;
goto LABEL_17;
}
v12 = v54;
v13 = 56LL;
v14 = v22;
while ( v13 )
{
*v14 = *(_DWORD *)v12;
v12 += 4;
++v14;
--v13;
}
v8 = get_data(&v43, &v42, 0LL);
if ( v8 < 0 )
{
fprintf(stderr, "Line %3d of File %s \n", 99LL, "./dir_wr_verbs/xfer.c");
goto LABEL_17;
}
v15 = 0;
if ( v32 >= 0 )
{
v19 = v52;
v20 = 56LL;
v21 = v22;
while ( v20 )
{
*v21 = *(_DWORD *)v19;
v19 += 4;
++v21;
--v20;
}
v8 = get_data(&v41, &v40, 0LL);
v15 = 1;
if ( v8 < 0 )
{
fprintf(stderr, "Line %3d of File %s \n", 104LL, "./dir_wr_verbs/xfer.c");
goto LABEL_17;
}
}
if ( v30 >= 0 )
{
v16 = v51;
v17 = 56LL;
v18 = v22;
while ( v17 )
{
*v18 = *(_DWORD *)v16;
v16 += 4;
++v18;
--v17;
}
v8 = get_data(&v39, &v38, 0LL);
v15 = 1;
if ( v8 < 0 )
{
fprintf(stderr, "Line %3d of File %s \n", 109LL, "./dir_wr_verbs/xfer.c");
goto LABEL_17;
}
}
v27 = 0x7FFFFFFF;
v26 = 0x7FFFFFFF;
v25 = 0x7FFFFFFF;
v8 = get_fld_sz((unsigned int)v57, &v27);
if ( v8 < 0 )
{
fprintf(stderr, "Line %3d of File %s \n", 115LL, "./dir_wr_verbs/xfer.c");
goto LABEL_17;
}
v8 = mk_temp_file(v49, v11 * v27, &v26);
if ( v8 < 0 )
{
fprintf(stderr, "Line %3d of File %s \n", 117LL, "./dir_wr_verbs/xfer.c");
goto LABEL_17;
}
v8 = q_mmap(v26, v49, &v45, &v44, 1LL);
if ( v8 < 0 )
{
fprintf(stderr, "Line %3d of File %s \n", 118LL, "./dir_wr_verbs/xfer.c");
goto LABEL_17;
}
if ( v15 )
{
v8 = mk_temp_file(v48, v11, &v25);
if ( v8 < 0 )
{
fprintf(stderr, "Line %3d of File %s \n", 121LL, "./dir_wr_verbs/xfer.c");
goto LABEL_17;
}
v8 = q_mmap(v25, v48, &v37, &v36, 1LL);
if ( v8 < 0 )
{
fprintf(stderr, "Line %3d of File %s \n", 122LL, "./dir_wr_verbs/xfer.c");
goto LABEL_17;
}
}
switch ( (int)v57 )
{
case 2:
if ( v55 == 4 )
{
xfer_I1_I4(addr, v41, v10, v43, v39, v11, v45, v37);
goto LABEL_90;
}
fprintf(stderr, "Line %3d of File %s \n", 8LL, "./dir_wr_verbs/incl_xfer_I1.c");
v8 = -1;
break;
case 3:
if ( v55 == 4 )
{
xfer_I2_I4(addr, v41, v10, v43, v39, v11, v45, v37);
goto LABEL_90;
}
fprintf(stderr, "Line %3d of File %s \n", 8LL, "./dir_wr_verbs/incl_xfer_I2.c");
v8 = -1;
break;
case 4:
if ( v55 == 4 )
{
xfer_I4_I4(addr, v41, v10, v43, v39, v11, v45, v37);
goto LABEL_90;
}
fprintf(stderr, "Line %3d of File %s \n", 8LL, "./dir_wr_verbs/incl_xfer_I4.c");
v8 = -1;
break;
case 5:
if ( v55 == 4 )
{
xfer_I8_I4(addr, v41, v10, v43, v39, v11, v45, v37);
goto LABEL_90;
}
fprintf(stderr, "Line %3d of File %s \n", 8LL, "./dir_wr_verbs/incl_xfer_I8.c");
v8 = -1;
break;
case 6:
if ( v55 == 4 )
{
xfer_F4_I4(addr, v41, v10, v43, v39, v11, v45, v37);
goto LABEL_90;
}
fprintf(stderr, "Line %3d of File %s \n", 8LL, "./dir_wr_verbs/incl_xfer_F4.c");
v8 = -1;
break;
case 7:
if ( v55 == 4 )
{
xfer_F8_I4(addr, v41, v10, v43, v39, v11, v45, v37);
LABEL_90:
v8 = add_fld(v34, a5, v26, v49, (unsigned int)v57, 0xFFFFFFFFLL, &v29, v53);
if ( v8 < 0 )
{
fprintf(stderr, "Line %3d of File %s \n", 140LL, "./dir_wr_verbs/xfer.c");
}
else
{
if ( v15 )
add_aux_fld(0LL, v34, 0LL, v29, v25, v48, "nn", &v28, v50);
v8 = int_get_meta(v35, (unsigned int)v33, "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, v29, "dict_tbl_id", nptr);
if ( v8 < 0 )
fprintf(stderr, "Line %3d of File %s \n", 155LL, "./dir_wr_verbs/xfer.c");
}
}
}
else
{
fprintf(stderr, "Line %3d of File %s \n", 8LL, "./dir_wr_verbs/incl_xfer_F8.c");
v8 = -1;
}
break;
default:
fprintf(stderr, "Line %3d of File %s \n", 135LL, "./dir_wr_verbs/xfer.c");
v8 = -1;
break;
}
LABEL_17:
if ( addr )
{
if ( len )
{
munmap(addr, len);
addr = 0LL;
len = 0LL;
goto LABEL_20;
}
LABEL_117:
fprintf(stderr, "Line %3d of File %s \n", 158LL, "./dir_wr_verbs/xfer.c");
return (unsigned int)-1;
}
if ( len )
goto LABEL_117;
LABEL_20:
if ( v43 )
{
if ( v42 )
{
munmap(v43, v42);
v43 = 0LL;
v42 = 0LL;
goto LABEL_23;
}
LABEL_120:
fprintf(stderr, "Line %3d of File %s \n", 159LL, "./dir_wr_verbs/xfer.c");
return (unsigned int)-1;
}
if ( v42 )
goto LABEL_120;
LABEL_23:
if ( v45 )
{
if ( v44 )
{
munmap(v45, v44);
v45 = 0LL;
v44 = 0LL;
goto LABEL_26;
}
LABEL_123:
fprintf(stderr, "Line %3d of File %s \n", 160LL, "./dir_wr_verbs/xfer.c");
return (unsigned int)-1;
}
if ( v44 )
goto LABEL_123;
LABEL_26:
if ( v41 )
{
if ( v40 )
{
munmap(v41, v40);
v41 = 0LL;
v40 = 0LL;
goto LABEL_29;
}
LABEL_126:
fprintf(stderr, "Line %3d of File %s \n", 161LL, "./dir_wr_verbs/xfer.c");
return (unsigned int)-1;
}
if ( v40 )
goto LABEL_126;
LABEL_29:
if ( v39 )
{
if ( v38 )
{
munmap(v39, v38);
v39 = 0LL;
v38 = 0LL;
goto LABEL_32;
}
LABEL_129:
fprintf(stderr, "Line %3d of File %s \n", 162LL, "./dir_wr_verbs/xfer.c");
return (unsigned int)-1;
}
if ( v38 )
goto LABEL_129;
LABEL_32:
if ( !v37 )
{
if ( !v36 )
return (unsigned int)v8;
LABEL_132:
fprintf(stderr, "Line %3d of File %s \n", 163LL, "./dir_wr_verbs/xfer.c");
return (unsigned int)-1;
}
if ( !v36 )
goto LABEL_132;
munmap(v37, v36);
return (unsigned int)v8;
}

canonical_decompiled_code:
__int64 __fastcall func0(_BYTE *a1, _BYTE *a2, _BYTE *a3, const char *a4, const char *a5)
{
int v8; // ebx
__int64 v10; // r15
__int64 v11; // rbp
char *v12; // rsi
__int64 v13; // rcx
_DWORD *v14; // rdi
char v15; // r12
char *v16; // rsi
__int64 v17; // rcx
_DWORD *v18; // rdi
char *v19; // rsi
__int64 v20; // rcx
_DWORD *v21; // rdi
_QWORD v22[29]; // [rsp-E0h] [rbp-898h] BYREF
char *endptr; // [rsp+8h] [rbp-7B0h] BYREF
char nptr[36]; // [rsp+10h] [rbp-7A8h] BYREF
unsigned int v25; // [rsp+34h] [rbp-784h] BYREF
unsigned int v26; // [rsp+38h] [rbp-780h] BYREF
int v27; // [rsp+3Ch] [rbp-77Ch] BYREF
int v28; // [rsp+40h] [rbp-778h] BYREF
unsigned int v29; // [rsp+44h] [rbp-774h] BYREF
int v30; // [rsp+48h] [rbp-770h] BYREF
int v31; // [rsp+4Ch] [rbp-76Ch] BYREF
int v32; // [rsp+50h] [rbp-768h] BYREF
int v33; // [rsp+54h] [rbp-764h] BYREF
unsigned int v34; // [rsp+58h] [rbp-760h] BYREF
unsigned int v35; // [rsp+5Ch] [rbp-75Ch] BYREF
size_t v36; // [rsp+60h] [rbp-758h] BYREF
void *v37; // [rsp+68h] [rbp-750h] BYREF
size_t v38; // [rsp+70h] [rbp-748h] BYREF
void *v39; // [rsp+78h] [rbp-740h] BYREF
size_t v40; // [rsp+80h] [rbp-738h] BYREF
void *v41; // [rsp+88h] [rbp-730h] BYREF
size_t v42; // [rsp+90h] [rbp-728h] BYREF
void *v43; // [rsp+98h] [rbp-720h] BYREF
size_t v44; // [rsp+A0h] [rbp-718h] BYREF
void *v45; // [rsp+A8h] [rbp-710h] BYREF
size_t len; // [rsp+B0h] [rbp-708h] BYREF
void *addr; // [rsp+B8h] [rbp-700h] BYREF
char v48[16]; // [rsp+C0h] [rbp-6F8h] BYREF
char v49[16]; // [rsp+D0h] [rbp-6E8h] BYREF
char v50[224]; // [rsp+E0h] [rbp-6D8h] BYREF
char v51[224]; // [rsp+1C0h] [rbp-5F8h] BYREF
char v52[224]; // [rsp+2A0h] [rbp-518h] BYREF
char v53[224]; // [rsp+380h] [rbp-438h] BYREF
char v54[24]; // [rsp+460h] [rbp-358h] BYREF
int v55; // [rsp+478h] [rbp-340h]
__int64 v56[3]; // [rsp+540h] [rbp-278h] BYREF
__int64 v57; // [rsp+558h] [rbp-260h]
__int64 v58; // [rsp+560h] [rbp-258h]
__int64 v59; // [rsp+568h] [rbp-250h]
__int64 v60; // [rsp+570h] [rbp-248h]
__int64 v61; // [rsp+578h] [rbp-240h]
__int64 v62; // [rsp+580h] [rbp-238h]
__int64 v63; // [rsp+588h] [rbp-230h]
__int64 v64; // [rsp+590h] [rbp-228h]
__int64 v65; // [rsp+598h] [rbp-220h]
__int64 v66; // [rsp+5A0h] [rbp-218h]
__int64 v67; // [rsp+5A8h] [rbp-210h]
__int64 v68; // [rsp+5B0h] [rbp-208h]
__int64 v69; // [rsp+5B8h] [rbp-200h]
__int64 v70; // [rsp+5C0h] [rbp-1F8h]
__int64 v71; // [rsp+5C8h] [rbp-1F0h]
__int64 v72; // [rsp+5D0h] [rbp-1E8h]
__int64 v73; // [rsp+5D8h] [rbp-1E0h]
__int64 v74; // [rsp+5E0h] [rbp-1D8h]
__int64 v75; // [rsp+5E8h] [rbp-1D0h]
__int64 v76; // [rsp+5F0h] [rbp-1C8h]
__int64 v77; // [rsp+5F8h] [rbp-1C0h]
__int64 v78; // [rsp+600h] [rbp-1B8h]
__int64 v79; // [rsp+608h] [rbp-1B0h]
__int64 v80; // [rsp+610h] [rbp-1A8h]
__int64 v81; // [rsp+618h] [rbp-1A0h]
char v82[176]; // [rsp+620h] [rbp-198h] BYREF
char v83[232]; // [rsp+6D0h] [rbp-E8h] BYREF

addr = 0LL;
len = 0LL;
v45 = 0LL;
v44 = 0LL;
v43 = 0LL;
v42 = 0LL;
v41 = 0LL;
v40 = 0LL;
v39 = 0LL;
v38 = 0LL;
v37 = 0LL;
v36 = 0LL;
v35 = 0x80000000;
v34 = 0x80000000;
v33 = 0x80000000;
v32 = 0x80000000;
v31 = 0x80000000;
v30 = 0x80000000;
v29 = 0x80000000;
v28 = 0x80000000;
zero_string(v49, 16LL);
zero_string(v48, 16LL);
if ( !a1 || !*a1 )
{
fprintf(stderr, "Line %3d of File %s \n", 73LL, "./dir_wr_verbs/xfer.c");
v8 = -1;
goto LABEL_17;
}
if ( !a3 || !*a3 )
{
fprintf(stderr, "Line %3d of File %s \n", 74LL, "./dir_wr_verbs/xfer.c");
v8 = -1;
goto LABEL_17;
}
if ( !a2 || !*a2 )
{
fprintf(stderr, "Line %3d of File %s \n", 75LL, "./dir_wr_verbs/xfer.c");
v8 = -1;
goto LABEL_17;
}
if ( !a4 || !*a4 )
{
fprintf(stderr, "Line %3d of File %s \n", 76LL, "./dir_wr_verbs/xfer.c");
v8 = -1;
goto LABEL_17;
}
if ( !a5 || !*a5 )
{
fprintf(stderr, "Line %3d of File %s \n", 77LL, "./dir_wr_verbs/xfer.c");
v8 = -1;
goto LABEL_17;
}
if ( !strcmp(a4, a5) )
{
fprintf(stderr, "Line %3d of File %s \n", 78LL, "./dir_wr_verbs/xfer.c");
v8 = -1;
goto LABEL_17;
}
v8 = is_tbl(a1, &v35, v83);
if ( v8 < 0 )
{
fprintf(stderr, "Line %3d of File %s \n", 80LL, "./dir_wr_verbs/xfer.c");
goto LABEL_17;
}
if ( (v35 & 0x80000000) != 0 || (int)v35 >= g_n_tbl )
{
fprintf(stderr, "Line %3d of File %s \n", 81LL, "./dir_wr_verbs/xfer.c");
v8 = -1;
goto LABEL_17;
}
v10 = *(_QWORD *)(g_tbls + 176LL * (int)v35);
v8 = is_fld(0LL, v35, a2, &v33, v56, &v32, v52);
if ( v8 < 0 )
{
fprintf(stderr, "Line %3d of File %s \n", 86LL, "./dir_wr_verbs/xfer.c");
goto LABEL_17;
}
if ( v33 < 0 || v33 >= g_n_fld )
{
fprintf(stderr, "Line %3d of File %s \n", 87LL, "./dir_wr_verbs/xfer.c");
v8 = -1;
goto LABEL_17;
}
v22[27] = v81;
v22[26] = v80;
v22[25] = v79;
v22[24] = v78;
v22[23] = v77;
v22[22] = v76;
v22[21] = v75;
v22[20] = v74;
v22[19] = v73;
v22[18] = v72;
v22[17] = v71;
v22[16] = v70;
v22[15] = v69;
v22[14] = v68;
v22[13] = v67;
v22[12] = v66;
v22[11] = v65;
v22[10] = v64;
v22[9] = v63;
v22[8] = v62;
v22[7] = v61;
v22[6] = v60;
v22[5] = v59;
v22[4] = v58;
v22[3] = v57;
v22[2] = v56[2];
v22[1] = v56[1];
v22[0] = v56[0];
v8 = get_data(&addr, &len, 0LL);
if ( v8 < 0 )
{
fprintf(stderr, "Line %3d of File %s \n", 89LL, "./dir_wr_verbs/xfer.c");
goto LABEL_17;
}
v8 = is_tbl(a3, &v34, v82);
if ( v8 < 0 )
{
fprintf(stderr, "Line %3d of File %s \n", 91LL, "./dir_wr_verbs/xfer.c");
goto LABEL_17;
}
if ( (v34 & 0x80000000) != 0 || (int)v34 >= g_n_tbl )
{
fprintf(stderr, "Line %3d of File %s \n", 92LL, "./dir_wr_verbs/xfer.c");
v8 = -1;
goto LABEL_17;
}
v11 = *(_QWORD *)(g_tbls + 176LL * (int)v34);
v8 = is_fld(0LL, v34, a4, &v31, v54, &v30, v51);
if ( v8 < 0 )
{
fprintf(stderr, "Line %3d of File %s \n", 97LL, "./dir_wr_verbs/xfer.c");
goto LABEL_17;
}
if ( v31 < 0 || v31 >= g_n_fld )
{
fprintf(stderr, "Line %3d of File %s \n", 98LL, "./dir_wr_verbs/xfer.c");
v8 = -1;
goto LABEL_17;
}
v12 = v54;
v13 = 56LL;
v14 = v22;
while ( v13 )
{
*v14 = *(_DWORD *)v12;
v12 += 4;
++v14;
--v13;
}
v8 = get_data(&v43, &v42, 0LL);
if ( v8 < 0 )
{
fprintf(stderr, "Line %3d of File %s \n", 99LL, "./dir_wr_verbs/xfer.c");
goto LABEL_17;
}
v15 = 0;
if ( v32 >= 0 )
{
v19 = v52;
v20 = 56LL;
v21 = v22;
while ( v20 )
{
*v21 = *(_DWORD *)v19;
v19 += 4;
++v21;
--v20;
}
v8 = get_data(&v41, &v40, 0LL);
v15 = 1;
if ( v8 < 0 )
{
fprintf(stderr, "Line %3d of File %s \n", 104LL, "./dir_wr_verbs/xfer.c");
goto LABEL_17;
}
}
if ( v30 >= 0 )
{
v16 = v51;
v17 = 56LL;
v18 = v22;
while ( v17 )
{
*v18 = *(_DWORD *)v16;
v16 += 4;
++v18;
--v17;
}
v8 = get_data(&v39, &v38, 0LL);
v15 = 1;
if ( v8 < 0 )
{
fprintf(stderr, "Line %3d of File %s \n", 109LL, "./dir_wr_verbs/xfer.c");
goto LABEL_17;
}
}
v27 = 0x7FFFFFFF;
v26 = 0x7FFFFFFF;
v25 = 0x7FFFFFFF;
v8 = get_fld_sz((unsigned int)v57, &v27);
if ( v8 < 0 )
{
fprintf(stderr, "Line %3d of File %s \n", 115LL, "./dir_wr_verbs/xfer.c");
goto LABEL_17;
}
v8 = mk_temp_file(v49, v11 * v27, &v26);
if ( v8 < 0 )
{
fprintf(stderr, "Line %3d of File %s \n", 117LL, "./dir_wr_verbs/xfer.c");
goto LABEL_17;
}
v8 = q_mmap(v26, v49, &v45, &v44, 1LL);
if ( v8 < 0 )
{
fprintf(stderr, "Line %3d of File %s \n", 118LL, "./dir_wr_verbs/xfer.c");
goto LABEL_17;
}
if ( v15 )
{
v8 = mk_temp_file(v48, v11, &v25);
if ( v8 < 0 )
{
fprintf(stderr, "Line %3d of File %s \n", 121LL, "./dir_wr_verbs/xfer.c");
goto LABEL_17;
}
v8 = q_mmap(v25, v48, &v37, &v36, 1LL);
if ( v8 < 0 )
{
fprintf(stderr, "Line %3d of File %s \n", 122LL, "./dir_wr_verbs/xfer.c");
goto LABEL_17;
}
}
switch ( (int)v57 )
{
case 2:
if ( v55 == 4 )
{
xfer_I1_I4(addr, v41, v10, v43, v39, v11, v45, v37);
goto LABEL_90;
}
fprintf(stderr, "Line %3d of File %s \n", 8LL, "./dir_wr_verbs/incl_xfer_I1.c");
v8 = -1;
break;
case 3:
if ( v55 == 4 )
{
xfer_I2_I4(addr, v41, v10, v43, v39, v11, v45, v37);
goto LABEL_90;
}
fprintf(stderr, "Line %3d of File %s \n", 8LL, "./dir_wr_verbs/incl_xfer_I2.c");
v8 = -1;
break;
case 4:
if ( v55 == 4 )
{
xfer_I4_I4(addr, v41, v10, v43, v39, v11, v45, v37);
goto LABEL_90;
}
fprintf(stderr, "Line %3d of File %s \n", 8LL, "./dir_wr_verbs/incl_xfer_I4.c");
v8 = -1;
break;
case 5:
if ( v55 == 4 )
{
xfer_I8_I4(addr, v41, v10, v43, v39, v11, v45, v37);
goto LABEL_90;
}
fprintf(stderr, "Line %3d of File %s \n", 8LL, "./dir_wr_verbs/incl_xfer_I8.c");
v8 = -1;
break;
case 6:
if ( v55 == 4 )
{
xfer_F4_I4(addr, v41, v10, v43, v39, v11, v45, v37);
goto LABEL_90;
}
fprintf(stderr, "Line %3d of File %s \n", 8LL, "./dir_wr_verbs/incl_xfer_F4.c");
v8 = -1;
break;
case 7:
if ( v55 == 4 )
{
xfer_F8_I4(addr, v41, v10, v43, v39, v11, v45, v37);
LABEL_90:
v8 = add_fld(v34, a5, v26, v49, (unsigned int)v57, 0xFFFFFFFFLL, &v29, v53);
if ( v8 < 0 )
{
fprintf(stderr, "Line %3d of File %s \n", 140LL, "./dir_wr_verbs/xfer.c");
}
else
{
if ( v15 )
add_aux_fld(0LL, v34, 0LL, v29, v25, v48, "nn", &v28, v50);
v8 = int_get_meta(v35, (unsigned int)v33, "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, v29, "dict_tbl_id", nptr);
if ( v8 < 0 )
fprintf(stderr, "Line %3d of File %s \n", 155LL, "./dir_wr_verbs/xfer.c");
}
}
}
else
{
fprintf(stderr, "Line %3d of File %s \n", 8LL, "./dir_wr_verbs/incl_xfer_F8.c");
v8 = -1;
}
break;
default:
fprintf(stderr, "Line %3d of File %s \n", 135LL, "./dir_wr_verbs/xfer.c");
v8 = -1;
break;
}
LABEL_17:
if ( addr )
{
if ( len )
{
munmap(addr, len);
addr = 0LL;
len = 0LL;
goto LABEL_20;
}
LABEL_117:
fprintf(stderr, "Line %3d of File %s \n", 158LL, "./dir_wr_verbs/xfer.c");
return (unsigned int)-1;
}
if ( len )
goto LABEL_117;
LABEL_20:
if ( v43 )
{
if ( v42 )
{
munmap(v43, v42);
v43 = 0LL;
v42 = 0LL;
goto LABEL_23;
}
LABEL_120:
fprintf(stderr, "Line %3d of File %s \n", 159LL, "./dir_wr_verbs/xfer.c");
return (unsigned int)-1;
}
if ( v42 )
goto LABEL_120;
LABEL_23:
if ( v45 )
{
if ( v44 )
{
munmap(v45, v44);
v45 = 0LL;
v44 = 0LL;
goto LABEL_26;
}
LABEL_123:
fprintf(stderr, "Line %3d of File %s \n", 160LL, "./dir_wr_verbs/xfer.c");
return (unsigned int)-1;
}
if ( v44 )
goto LABEL_123;
LABEL_26:
if ( v41 )
{
if ( v40 )
{
munmap(v41, v40);
v41 = 0LL;
v40 = 0LL;
goto LABEL_29;
}
LABEL_126:
fprintf(stderr, "Line %3d of File %s \n", 161LL, "./dir_wr_verbs/xfer.c");
return (unsigned int)-1;
}
if ( v40 )
goto LABEL_126;
LABEL_29:
if ( v39 )
{
if ( v38 )
{
munmap(v39, v38);
v39 = 0LL;
v38 = 0LL;
goto LABEL_32;
}
LABEL_129:
fprintf(stderr, "Line %3d of File %s \n", 162LL, "./dir_wr_verbs/xfer.c");
return (unsigned int)-1;
}
if ( v38 )
goto LABEL_129;
LABEL_32:
if ( !v37 )
{
if ( !v36 )
return (unsigned int)v8;
LABEL_132:
fprintf(stderr, "Line %3d of File %s \n", 163LL, "./dir_wr_verbs/xfer.c");
return (unsigned int)-1;
}
if ( !v36 )
goto LABEL_132;
munmap(v37, v36);
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: status int

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

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

variable_types:
opfile
char [-1]

variable_types: fldsz int

variable_types:
strbuf
char [32]

variable_types:
endptr
char *


repo: linkedin/datacl

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

return_type: 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:
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; // rbp
int v3; // ebx
char *endptr; // [rsp+8h] [rbp-E0h] BYREF
char v6[188]; // [rsp+10h] [rbp-D8h] BYREF
int v7[7]; // [rsp+CCh] [rbp-1Ch] BYREF

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

canonical_decompiled_code:
__int64 __fastcall func0(_BYTE *a1, const char *a2)
{
__int64 v2; // rbp
int v3; // ebx
char *endptr; // [rsp+8h] [rbp-E0h] BYREF
char v6[188]; // [rsp+10h] [rbp-D8h] BYREF
int v7[7]; // [rsp+CCh] [rbp-1Ch] BYREF

if ( a2 && *a2 )
{
v2 = strtoll(a2, &endptr, 10);
if ( v2 <= 0 )
{
fprintf(stderr, "Line %3d of File %s \n", 34LL, "./dir_wr_verbs/set_nR.c");
v3 = -1;
}
else if ( a1 && *a1 )
{
v3 = is_tbl(a1, v7, v6);
if ( v3 < 0 )
{
fprintf(stderr, "Line %3d of File %s \n", 38LL, "./dir_wr_verbs/set_nR.c");
}
else if ( v7[0] < 0 || v7[0] >= g_n_tbl )
{
fprintf(stderr, "Line %3d of File %s \n", 39LL, "./dir_wr_verbs/set_nR.c");
v3 = -1;
}
else
{
*(_QWORD *)(g_tbls + 176LL * v7[0]) = v2;
}
}
else
{
fprintf(stderr, "Line %3d of File %s \n", 35LL, "./dir_wr_verbs/set_nR.c");
v3 = -1;
}
}
else
{
fprintf(stderr, "Line %3d of File %s \n", 32LL, "./dir_wr_verbs/set_nR.c");
v3 = -1;
}
return (unsigned int)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: status int

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; // ebx
unsigned int v8; // [rsp+Ch] [rbp-16Ch] BYREF
char v9[128]; // [rsp+10h] [rbp-168h] BYREF
char v10[128]; // [rsp+90h] [rbp-E8h] BYREF
char v11[52]; // [rsp+110h] [rbp-68h] BYREF
int v12; // [rsp+144h] [rbp-34h] BYREF
int v13; // [rsp+148h] [rbp-30h] BYREF
int v14[11]; // [rsp+14Ch] [rbp-2Ch] BYREF

v14[0] = 0x80000000;
v13 = 0x80000000;
v12 = 0x80000000;
v5 = unstr_auxtype(a3, &v8);
if ( v5 < 0 )
{
v6 = v5;
fprintf(stderr, "Line %3d of File %s \n", 28LL, "drop_aux_fld.c");
}
else
{
if ( a4 < 0 )
{
if ( !a1 || !*a1 )
{
fprintf(stderr, "Line %3d of File %s \n", 33LL, "drop_aux_fld.c");
return (unsigned int)-1;
}
if ( !a2 || !*a2 )
{
fprintf(stderr, "Line %3d of File %s \n", 34LL, "drop_aux_fld.c");
return (unsigned int)-1;
}
v6 = is_tbl(a1, v14, v11);
if ( v6 < 0 )
{
fprintf(stderr, "Line %3d of File %s \n", 35LL, "drop_aux_fld.c");
return (unsigned int)v6;
}
if ( v14[0] < 0 || v14[0] >= g_n_tbl )
{
fprintf(stderr, "Line %3d of File %s \n", 36LL, "drop_aux_fld.c");
return (unsigned int)-1;
}
v6 = is_fld(0LL, (unsigned int)v14[0], a2, &v13, v10, &v12, v9);
if ( v6 < 0 )
{
fprintf(stderr, "Line %3d of File %s \n", 37LL, "drop_aux_fld.c");
return (unsigned int)v6;
}
if ( v13 < 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
{
v13 = a4;
}
if ( g_n_fld <= v13 )
{
fprintf(stderr, "Line %3d of File %s \n", 44LL, "drop_aux_fld.c");
v6 = -1;
}
else
{
v6 = del_aux_fld((unsigned int)v13, v8);
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; // ebx
unsigned int v8; // [rsp+Ch] [rbp-16Ch] BYREF
char v9[128]; // [rsp+10h] [rbp-168h] BYREF
char v10[128]; // [rsp+90h] [rbp-E8h] BYREF
char v11[52]; // [rsp+110h] [rbp-68h] BYREF
int v12; // [rsp+144h] [rbp-34h] BYREF
int v13; // [rsp+148h] [rbp-30h] BYREF
int v14[11]; // [rsp+14Ch] [rbp-2Ch] BYREF

v14[0] = 0x80000000;
v13 = 0x80000000;
v12 = 0x80000000;
v5 = unstr_auxtype(a3, &v8);
if ( v5 < 0 )
{
v6 = v5;
fprintf(stderr, "Line %3d of File %s \n", 28LL, "drop_aux_fld.c");
}
else
{
if ( a4 < 0 )
{
if ( !a1 || !*a1 )
{
fprintf(stderr, "Line %3d of File %s \n", 33LL, "drop_aux_fld.c");
return (unsigned int)-1;
}
if ( !a2 || !*a2 )
{
fprintf(stderr, "Line %3d of File %s \n", 34LL, "drop_aux_fld.c");
return (unsigned int)-1;
}
v6 = is_tbl(a1, v14, v11);
if ( v6 < 0 )
{
fprintf(stderr, "Line %3d of File %s \n", 35LL, "drop_aux_fld.c");
return (unsigned int)v6;
}
if ( v14[0] < 0 || v14[0] >= g_n_tbl )
{
fprintf(stderr, "Line %3d of File %s \n", 36LL, "drop_aux_fld.c");
return (unsigned int)-1;
}
v6 = is_fld(0LL, (unsigned int)v14[0], a2, &v13, v10, &v12, v9);
if ( v6 < 0 )
{
fprintf(stderr, "Line %3d of File %s \n", 37LL, "drop_aux_fld.c");
return (unsigned int)v6;
}
if ( v13 < 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
{
v13 = a4;
}
if ( g_n_fld <= v13 )
{
fprintf(stderr, "Line %3d of File %s \n", 44LL, "drop_aux_fld.c");
v6 = -1;
}
else
{
v6 = del_aux_fld((unsigned int)v13, v8);
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; }

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

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


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

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

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

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

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


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

assign_const_I1(a3 + a1, 0LL, (unsigned int)(char)(a4 - a3));
result = 0LL;
if ( a2 )
{
v9 = a2 + 4 * a3;
if ( a5 == 300 )
{
assign_const_I4(v9, 0xFFFFFFFF80000000LL, (unsigned int)(a4 - a3));
return 0LL;
}
if ( a5 > 300 )
{
if ( a5 == 700 )
{
assign_const_I4(v9, 0xFFFFFFFFLL, (unsigned int)(a4 - a3));
return 0LL;
}
if ( a5 <= 700 )
{
if ( a5 != 500 && a5 != 600 )
goto LABEL_7;
}
else if ( a5 != 800 )
{
LABEL_7:
fprintf(stderr, "Line %3d of File %s \n", 67LL, "./AUX/core_srt_join_I_I_I.c");
return 0xFFFFFFFFLL;
}
goto LABEL_13;
}
if ( a5 == 100 )
{
LABEL_13:
assign_const_I4(v9, 0LL, (unsigned int)(a4 - a3));
return 0LL;
}
if ( a5 != 200 )
goto LABEL_7;
assign_const_I4(v9, 0x7FFFFFFFLL, (unsigned int)(a4 - a3));
result = 0LL;
}
return result;
}

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

assign_const_I1(a3 + a1, 0LL, (unsigned int)(char)(a4 - a3));
result = 0LL;
if ( a2 )
{
v9 = a2 + 4 * a3;
if ( a5 == 300 )
{
assign_const_I4(v9, 0xFFFFFFFF80000000LL, (unsigned int)(a4 - a3));
return 0LL;
}
if ( a5 > 300 )
{
if ( a5 == 700 )
{
assign_const_I4(v9, 0xFFFFFFFFLL, (unsigned int)(a4 - a3));
return 0LL;
}
if ( a5 <= 700 )
{
if ( a5 != 500 && a5 != 600 )
goto LABEL_7;
}
else if ( a5 != 800 )
{
LABEL_7:
fprintf(stderr, "Line %3d of File %s \n", 67LL, "./AUX/core_srt_join_I_I_I.c");
return 0xFFFFFFFFLL;
}
goto LABEL_13;
}
if ( a5 == 100 )
{
LABEL_13:
assign_const_I4(v9, 0LL, (unsigned int)(a4 - a3));
return 0LL;
}
if ( a5 != 200 )
goto LABEL_7;
assign_const_I4(v9, 0x7FFFFFFFLL, (unsigned int)(a4 - a3));
result = 0LL;
}
return result;
}

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

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


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

variable_types:
nR
long long

variable_types:
out
char *

variable_types: outv char

variable_types:
i
long long


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

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

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

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

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

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

variable_types:
ii
void *

variable_types:
jj
void *


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

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

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

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

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

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


decompiled_code:
__int64 __fastcall f1opf2_idx_with_reset(__int64 a1, __int64 a2, __int64 a3)
{
__int64 v4; // rdx
__int64 v5; // rax
__int64 result; // rax

if ( a2 <= 0 )
{
fprintf(stderr, "Line %3d of File %s \n", 16LL, "f1opf2_idx_with_reset.c");
result = 0xFFFFFFFFLL;
}
else if ( a1 )
{
if ( a3 )
{
v4 = 0LL;
v5 = 0LL;
do
{
if ( *(_BYTE *)(a1 + v4) == 1 )
v5 = 0LL;
*(_QWORD *)(a3 + 8 * v4++) = v5++;
}
while ( a2 != v4 );
result = 0LL;
}
else
{
fprintf(stderr, "Line %3d of File %s \n", 18LL, "f1opf2_idx_with_reset.c");
result = 0xFFFFFFFFLL;
}
}
else
{
fprintf(stderr, "Line %3d of File %s \n", 17LL, "f1opf2_idx_with_reset.c");
result = 0xFFFFFFFFLL;
}
return result;
}

canonical_decompiled_code:
__int64 __fastcall func0(__int64 a1, __int64 a2, __int64 a3)
{
__int64 v4; // rdx
__int64 v5; // rax
__int64 result; // rax

if ( a2 <= 0 )
{
fprintf(stderr, "Line %3d of File %s \n", 16LL, "f1opf2_idx_with_reset.c");
result = 0xFFFFFFFFLL;
}
else if ( a1 )
{
if ( a3 )
{
v4 = 0LL;
v5 = 0LL;
do
{
if ( *(_BYTE *)(a1 + v4) == 1 )
v5 = 0LL;
*(_QWORD *)(a3 + 8 * v4++) = v5++;
}
while ( a2 != v4 );
result = 0LL;
}
else
{
fprintf(stderr, "Line %3d of File %s \n", 18LL, "f1opf2_idx_with_reset.c");
result = 0xFFFFFFFFLL;
}
}
else
{
fprintf(stderr, "Line %3d of File %s \n", 17LL, "f1opf2_idx_with_reset.c");
result = 0xFFFFFFFFLL;
}
return result;
}

original_code:
int
f1opf2_idx_with_reset(
    const char *in,
    long long nR,
    long long * restrict out
    )
{
  int status = 0;
  long long idx = 0;
  if ( nR <= 0 ) { { { fprintf(stderr, "Line %3d of File %s \n", 16, "f1opf2_idx_with_reset.c"); }; status = -1 ; goto BYE; }; }
  if ( in == ((void *)0) ) { { { fprintf(stderr, "Line %3d of File %s \n", 17, "f1opf2_idx_with_reset.c"); }; status = -1 ; goto BYE; }; }
  if ( out== ((void *)0) ) { { { fprintf(stderr, "Line %3d of File %s \n", 18, "f1opf2_idx_with_reset.c"); }; status = -1 ; goto BYE; }; }
  for ( long long i = 0; i < nR; i++ ) {
    if (in[i] == 1 ) { idx = 0; }
    out[i] = idx;
    idx++;
  }
BYE:
  return(status);
}

canonical_original_code:
int f1opf2_idx_with_reset(char *in, long long nR, long long *out)
{
  int status = 0;
  long long idx = 0;
  if ( nR <= 0 ) { { { fprintf(stderr, "Line %3d of File %s \n", 16, "f1opf2_idx_with_reset.c"); }; status = -1 ; goto BYE; }; }
  if ( in == ((void *)0) ) { { { fprintf(stderr, "Line %3d of File %s \n", 17, "f1opf2_idx_with_reset.c"); }; status = -1 ; goto BYE; }; }
  if ( out== ((void *)0) ) { { { fprintf(stderr, "Line %3d of File %s \n", 18, "f1opf2_idx_with_reset.c"); }; status = -1 ; goto BYE; }; }
  for ( long long i = 0; i < nR; i++ ) {
    if (in[i] == 1 ) { idx = 0; }
    out[i] = idx;
    idx++;
  }
BYE:
  return(status);
}

variable_types:
in
char *

variable_types:
out
long long *

variable_types:
idx
long long


original_code:
void
vec_normal_cdf_inverse(
       double *in,
       int nR,
       char *nn_X,
       double *out
       )
{
  for ( int i = 0; i < nR; i++ ) {
    double outval;
    double inval = *in;
    if ( ( inval <= 0 ) || ( inval >= 1 ) ) {
      outval = 0;
      nn_X[i] = 0;
    }
    else {
      nn_X[i] = 1;
      if ( inval < 0.5 ) {
 outval = -1 * rational_approximation( sqrt(-2.0 * log(inval) ) );
      }
      else {
 outval = rational_approximation( sqrt(-2.0 * log((1.0-inval)) ) );
      }
    }
    *out = outval;
    in++;
    out++;
    nn_X++;
  }
}

canonical_original_code:
void vec_normal_cdf_inverse(double *in, int nR, char *nn_X, double *out)
{
  for ( int i = 0; i < nR; i++ ) {
    double outval;
    double inval = *in;
    if ( ( inval <= 0 ) || ( inval >= 1 ) ) {
      outval = 0;
      nn_X[i] = 0;
    }
    else {
      nn_X[i] = 1;
      if ( inval < 0.5 ) {
 outval = -1 * rational_approximation( sqrt(-2.0 * log(inval) ) );
      }
      else {
 outval = rational_approximation( sqrt(-2.0 * log((1.0-inval)) ) );
      }
    }
    *out = outval;
    in++;
    out++;
    nn_X++;
  }
}

variable_types:
in
double *

variable_types: nR int

variable_types:
out
double *

variable_types: i int

variable_types: outval double

variable_types: inval double


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

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

variable_types:
out
int *

variable_types: outv int


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

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

variable_types: status int

variable_types: minval int

variable_types: maxval int

variable_types:
sum
long long