processClient

decompiled_code:
int __fastcall processClient(int fd, __int64 a2)
{
int v2; // eax
int v3; // ebx
char *v4; // rax
char *v5; // rdx
char v6; // cl
size_t v7; // rax
int result; // eax
char v9; // [rsp+1h] [rbp-C19h] BYREF
char v10[1024]; // [rsp+2h] [rbp-C18h] BYREF
char s[1024]; // [rsp+402h] [rbp-818h] BYREF
char buf[1048]; // [rsp+802h] [rbp-418h] BYREF

inet_ntoa(*(struct in_addr *)((char *)&a2 + 4));
echo("[SERVICE] Accept a connect from %s.\n", v10[0]);
v2 = recv(fd, buf, 0x400uLL, 0);
if ( v2 )
{
buf[v2 - 1] = 0;
echo("[SERVICE] Client name is: %s.\n", v10[0]);
while ( 1 )
{
v3 = recv(fd, v10, 0x400uLL, 0);
if ( !v3 )
break;
v10[v3] = 0;
echo("[SERVICE] Received client (%s) message: %s", v10[0]);
if ( v3 - 1 > 0 )
{
v4 = &v10[v3];
v5 = s;
do
{
v6 = *(v4 - 2);
--v4;
*v5++ = v6;
}
while ( v4 != &v9 + v3 - (unsigned int)(v3 - 2) );
}
s[v3 - 1] = 0;
v7 = strlen(s);
send(fd, s, v7, 0);
}
result = close(fd);
}
else
{
close(fd);
result = echo("[SERVICE] Client disconnected.\n", v10[0]);
}
return result;
}

canonical_decompiled_code:
int __fastcall func9(int fd, __int64 a2)
{
int v2; // eax
int v3; // ebx
char *v4; // rax
char *v5; // rdx
char v6; // cl
size_t v7; // rax
int result; // eax
char v9; // [rsp+1h] [rbp-C19h] BYREF
char v10[1024]; // [rsp+2h] [rbp-C18h] BYREF
char s[1024]; // [rsp+402h] [rbp-818h] BYREF
char buf[1048]; // [rsp+802h] [rbp-418h] BYREF

inet_ntoa(*(struct in_addr *)((char *)&a2 + 4));
func13("[SERVICE] Accept a connect from %s.\n", v10[0]);
v2 = recv(fd, buf, 0x400uLL, 0);
if ( v2 )
{
buf[v2 - 1] = 0;
func13("[SERVICE] Client name is: %s.\n", v10[0]);
while ( 1 )
{
v3 = recv(fd, v10, 0x400uLL, 0);
if ( !v3 )
break;
v10[v3] = 0;
func13("[SERVICE] Received client (%s) message: %s", v10[0]);
if ( v3 - 1 > 0 )
{
v4 = &v10[v3];
v5 = s;
do
{
v6 = *(v4 - 2);
--v4;
*v5++ = v6;
}
while ( v4 != &v9 + v3 - (unsigned int)(v3 - 2) );
}
s[v3 - 1] = 0;
v7 = strlen(s);
send(fd, s, v7, 0);
}
result = close(fd);
}
else
{
close(fd);
result = func13("[SERVICE] Client disconnected.\n", v10[0]);
}
return result;
}

original_code:
void processClient(int connectfd, struct sockaddr_in client)
{
    int num, i;
    char recvbuf[1024], sendbuf[1024], clientName[1024];
    int len;
    echo("[SERVICE] Accept a connect from %s.\n", inet_ntoa(client.sin_addr));
    num = recv(connectfd, clientName, 1024, 0);
    if (num == 0)
    {
        close(connectfd);
        echo("[SERVICE] Client disconnected.\n");
        return;
    }
    clientName[num - 1] = '\0';
    echo("[SERVICE] Client name is: %s.\n", clientName);
    while (num = recv(connectfd, recvbuf, 1024, 0))
    {
        recvbuf[num] = '\0';
        echo("[SERVICE] Received client (%s) message: %s", clientName, recvbuf);
        for (i = 0; i < num - 1; i++)
        {
            sendbuf[i] = recvbuf[num - i - 2];
        }
        sendbuf[num - 1] = '\0';
        len = strlen(sendbuf);
        send(connectfd, sendbuf, len, 0);
    }
    close(connectfd);
}

canonical_original_code:
void processClient(int connectfd, struct sockaddr_in client)
{
    int num; int i;
    char recvbuf[1024]; char sendbuf[1024]; char clientName[1024];
    int len;
    echo("[SERVICE] Accept a connect from %s.\n", inet_ntoa(client.sin_addr));
    num = recv(connectfd, clientName, 1024, 0);
    if (num == 0)
    {
        close(connectfd);
        echo("[SERVICE] Client disconnected.\n");
        return;
    }
    clientName[num - 1] = '\0';
    echo("[SERVICE] Client name is: %s.\n", clientName);
    while (num = recv(connectfd, recvbuf, 1024, 0))
    {
        recvbuf[num] = '\0';
        echo("[SERVICE] Received client (%s) message: %s", clientName, recvbuf);
        for (i = 0; i < num - 1; i++)
        {
            sendbuf[i] = recvbuf[num - i - 2];
        }
        sendbuf[num - 1] = '\0';
        len = strlen(sendbuf);
        send(connectfd, sendbuf, len, 0);
    }
    close(connectfd);
}

variable_types: connectfd int

variable_types: num int

variable_types: i int

variable_types:
recvbuf
char [1024]

variable_types:
sendbuf
char [1024]

variable_types:
clientName
char [1024]

variable_types: len int


startRoutine

repo: linfan/TCP-IP-Network-basic-examples

decompiled_code:
void __fastcall __noreturn startRoutine(void *a1)
{
char v1; // [rsp+0h] [rbp-8h]

processClient(*(_DWORD *)a1, *(_QWORD *)((char *)a1 + 4));
free(a1);
pthread_self();
echo("[SERVICE] thread %d terminated\n", v1);
pthread_exit(0LL);
}

canonical_decompiled_code:
void __fastcall __noreturn func10(void *a1)
{
char v1; // [rsp+0h] [rbp-8h]

func9(*(_DWORD *)a1, *(_QWORD *)((char *)a1 + 4));
free(a1);
pthread_self();
func13("[SERVICE] thread %d terminated\n", v1);
pthread_exit(0LL);
}

original_code:
void* startRoutine(void* arg)
{
    ARG* info = (ARG*)arg;
    processClient(info->connectfd, info->client);
    free(info);
    echo("[SERVICE] thread %d terminated\n", pthread_self());
    pthread_exit(((void *)0));
}

canonical_original_code:
void *startRoutine(void *arg)
{
    struct ARG *info = (ARG*)arg;
    processClient(info->connectfd, info->client);
    free(info);
    echo("[SERVICE] thread %d terminated\n", pthread_self());
    pthread_exit(((void *)0));
}

variable_types:
arg
void *

variable_types: struct ARG { int connectfd; struct sockaddr_in { unsigned short sin_family; unsigned short sin_port; struct in_addr { unsigned int s_addr; } sin_addr; unsigned char sin_zero[-1]; } client; } *

return_type: void *

user_defined_types: struct ARG { int connectfd; struct sockaddr_in client; }

user_defined_types: struct sockaddr_in { unsigned short sin_family; unsigned short sin_port; struct in_addr sin_addr; unsigned char sin_zero[-1]; }


errexit

decompiled_code:
void __noreturn errexit(char *format, ...)
{
gcc_va_list arg; // [rsp+8h] [rbp-D0h] BYREF

va_start(arg, format);
vfprintf(_bss_start, format, arg);
exit(1);
}

canonical_decompiled_code:
void __noreturn func12(char *format, ...)
{
gcc_va_list arg; // [rsp+8h] [rbp-D0h] BYREF

va_start(arg, format);
vfprintf(_bss_start, format, arg);
exit(1);
}

original_code:
int errexit(const char* format, ...)
{
    va_list args;
    __builtin_va_start(args,format);
    vfprintf(stderr, format, args);
    __builtin_va_end(args);
    exit(1);
}

canonical_original_code:
int errexit(char *format, ...)
{
    __builtin_va_list args;
    __builtin_va_start(args,format);
    vfprintf(stderr, format, args);
    __builtin_va_end(args);
    exit(1);
}

variable_types:
format
char *

return_type: int


echo

decompiled_code:
int echo(char *format, ...)
{
gcc_va_list arg; // [rsp+8h] [rbp-D0h] BYREF

va_start(arg, format);
return vfprintf(_bss_start, format, arg);
}

canonical_decompiled_code:
int func13(char *format, ...)
{
gcc_va_list arg; // [rsp+8h] [rbp-D0h] BYREF

va_start(arg, format);
return vfprintf(_bss_start, format, arg);
}

original_code:
void echo(const char* format, ...)
{
    va_list args;
    __builtin_va_start(args,format);
    vfprintf(stderr, format, args);
    __builtin_va_end(args);
}

canonical_original_code:
void echo(char *format, ...)
{
    __builtin_va_list args;
    __builtin_va_start(args,format);
    vfprintf(stderr, format, args);
    __builtin_va_end(args);
}

return_type: void


decompiled_code:
void sig_child()
{
char v0; // [rsp+0h] [rbp-18h]
int stat_loc[3]; // [rsp+Ch] [rbp-Ch] BYREF

while ( waitpid(-1, stat_loc, 1) > 0 )
echo("[SERVICE] Child %d terminated\n", v0);
}

canonical_decompiled_code:
void func7()
{
char v0; // [rsp+0h] [rbp-18h]
int stat_loc[3]; // [rsp+Ch] [rbp-Ch] BYREF

while ( waitpid(-1, stat_loc, 1) > 0 )
func13("[SERVICE] Child %d terminated\n", v0);
}

original_code:
void sig_child(int sig)
{
    pid_t pid;
    int stat;
    while ((pid = waitpid(-1, &stat, 1)) > 0)
        echo("[SERVICE] Child %d terminated\n", pid);
    return;
}

canonical_original_code:
void sig_child(int sig)
{
    int pid;
    int stat;
    while ((pid = waitpid(-1, &stat, 1)) > 0)
        echo("[SERVICE] Child %d terminated\n", pid);
    return;
}

variable_types: sig int

variable_types: pid int

variable_types: stat int


processClient

canonical_decompiled_code:
int __fastcall func10(int fd, __int64 a2)
{
int v2; // eax
int v3; // ebx
char *v4; // rax
char *v5; // rdx
char v6; // cl
size_t v7; // rax
int result; // eax
char v9; // [rsp+1h] [rbp-C19h] BYREF
char v10[1024]; // [rsp+2h] [rbp-C18h] BYREF
char s[1024]; // [rsp+402h] [rbp-818h] BYREF
char buf[1048]; // [rsp+802h] [rbp-418h] BYREF

inet_ntoa(*(struct in_addr *)((char *)&a2 + 4));
func13("[SERVICE] Accept a connect from %s.\n", v10[0]);
v2 = recv(fd, buf, 0x400uLL, 0);
if ( v2 )
{
buf[v2 - 1] = 0;
func13("[SERVICE] Client name is: %s.\n", v10[0]);
while ( 1 )
{
v3 = recv(fd, v10, 0x400uLL, 0);
if ( !v3 )
break;
v10[v3] = 0;
func13("[SERVICE] Received client (%s) message: %s", v10[0]);
if ( v3 - 1 > 0 )
{
v4 = &v10[v3];
v5 = s;
do
{
v6 = *(v4 - 2);
--v4;
*v5++ = v6;
}
while ( v4 != &v9 + v3 - (unsigned int)(v3 - 2) );
}
s[v3 - 1] = 0;
v7 = strlen(s);
send(fd, s, v7, 0);
}
result = close(fd);
}
else
{
close(fd);
result = func13("[SERVICE] Client disconnected.\n", v10[0]);
}
return result;
}

variable_types: struct sockaddr_in { unsigned short sin_family; unsigned short sin_port; struct in_addr { unsigned int s_addr; } sin_addr; unsigned char sin_zero[-1]; }


errexit

decompiled_code:
void __noreturn errexit(char *format, ...)
{
gcc_va_list arg; // [rsp+8h] [rbp-D0h] BYREF

va_start(arg, format);
vfprintf(stderr, format, arg);
exit(1);
}

canonical_decompiled_code:
void __noreturn func12(char *format, ...)
{
gcc_va_list arg; // [rsp+8h] [rbp-D0h] BYREF

va_start(arg, format);
vfprintf(stderr, format, arg);
exit(1);
}


echo

decompiled_code:
int echo(char *format, ...)
{
gcc_va_list arg; // [rsp+8h] [rbp-D0h] BYREF

va_start(arg, format);
return vfprintf(stderr, format, arg);
}

canonical_decompiled_code:
int func13(char *format, ...)
{
gcc_va_list arg; // [rsp+8h] [rbp-D0h] BYREF

va_start(arg, format);
return vfprintf(stderr, format, arg);
}


repo: linkedin/datacl

original_code:
void
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 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:
nR
long long

variable_types:
out
char *

variable_types: outv char

variable_types:
i
long long


decompiled_code:
__int64 __fastcall sort_iL_aa_compare(__int64 a1, int *a2)
{
__int64 v2; // rdx
__int64 v3; // rcx
__int64 result; // rax
int v5; // esi

v2 = *(_QWORD *)(a2 + 1);
v3 = *(_QWORD *)(a1 + 4);
result = 1LL;
v5 = *a2;
if ( *(_DWORD *)a1 <= v5 )
{
result = 0xFFFFFFFFLL;
if ( *(_DWORD *)a1 >= v5 )
{
result = (unsigned int)-(v3 < v2);
if ( v3 > v2 )
result = 1LL;
}
}
return result;
}

canonical_decompiled_code:
__int64 __fastcall func0(__int64 a1, int *a2)
{
__int64 v2; // rdx
__int64 v3; // rcx
__int64 result; // rax
int v5; // esi

v2 = *(_QWORD *)(a2 + 1);
v3 = *(_QWORD *)(a1 + 4);
result = 1LL;
v5 = *a2;
if ( *(_DWORD *)a1 <= v5 )
{
result = 0xFFFFFFFFLL;
if ( *(_DWORD *)a1 >= v5 )
{
result = (unsigned int)-(v3 < v2);
if ( v3 > v2 )
result = 1LL;
}
}
return result;
}

original_code:
int sort_iL_aa_compare(
         const void *in1,
         const void *in2
         )
{
  char *cptr1, *cptr2;
  int *iptr; long long *llptr;
  int x1, x2; long long y1, y2;
  cptr1 = (char *)in1;
  cptr2 = (char *)in2;
  iptr = (int *)cptr1; x1 = *iptr; cptr1 += sizeof(int);
  llptr = (long long *)cptr1; y1 = *llptr; cptr1 += sizeof(long long);
  iptr = (int *)cptr2; x2 = *iptr; cptr2 += sizeof(int);
  llptr = (long long *)cptr2; y2 = *llptr; cptr2 += sizeof(long long);
  if ( x1 > x2 ) {
    return (1);
  }
  else if ( x1 < x2 ) {
    return (-1);
  }
  else {
    if ( y1 > y2 ) {
      return (1);
    }
    else if ( y1 < y2 ) {
      return (-1);
    }
    else {
      return(0);
    }
  }
}

canonical_original_code:
int sort_iL_aa_compare(void *in1, void *in2)
{
  char *cptr1; char *cptr2;
  int *iptr; long long *llptr;
  int x1; int x2; long long y1; long long y2;
  cptr1 = (char *)in1;
  cptr2 = (char *)in2;
  iptr = (int *)cptr1; x1 = *iptr; cptr1 += sizeof(int);
  llptr = (long long *)cptr1; y1 = *llptr; cptr1 += sizeof(long long);
  iptr = (int *)cptr2; x2 = *iptr; cptr2 += sizeof(int);
  llptr = (long long *)cptr2; y2 = *llptr; cptr2 += sizeof(long long);
  if ( x1 > x2 ) {
    return (1);
  }
  else if ( x1 < x2 ) {
    return (-1);
  }
  else {
    if ( y1 > y2 ) {
      return (1);
    }
    else if ( y1 < y2 ) {
      return (-1);
    }
    else {
      return(0);
    }
  }
}

variable_types:
iptr
int *

variable_types:
llptr
long long *


decompiled_code:
__int64 __fastcall sort_Li_aa_compare(__int64 a1, __int64 *a2)
{
int v2; // edx
int v3; // ecx
__int64 result; // rax
__int64 v5; // rsi

v2 = *((_DWORD *)a2 + 2);
v3 = *(_DWORD *)(a1 + 8);
result = 1LL;
v5 = *a2;
if ( *(_QWORD *)a1 <= v5 )
{
result = 0xFFFFFFFFLL;
if ( *(_QWORD *)a1 >= v5 )
{
result = (unsigned int)-(v3 < v2);
if ( v3 > v2 )
result = 1LL;
}
}
return result;
}

canonical_decompiled_code:
__int64 __fastcall func1(__int64 a1, __int64 *a2)
{
int v2; // edx
int v3; // ecx
__int64 result; // rax
__int64 v5; // rsi

v2 = *((_DWORD *)a2 + 2);
v3 = *(_DWORD *)(a1 + 8);
result = 1LL;
v5 = *a2;
if ( *(_QWORD *)a1 <= v5 )
{
result = 0xFFFFFFFFLL;
if ( *(_QWORD *)a1 >= v5 )
{
result = (unsigned int)-(v3 < v2);
if ( v3 > v2 )
result = 1LL;
}
}
return result;
}

original_code:
int sort_Li_aa_compare(
         const void *in1,
         const void *in2
         )
{
  char *cptr1, *cptr2;
  long long *llptr1, *llptr2;
  int *iptr1, *iptr2;
  long long ll1, ll2;
  int i1, i2;
  cptr1 = (char *)in1;
  cptr2 = (char *)in2;
  llptr1 = (long long *)cptr1; ll1 = *llptr1; cptr1 += sizeof(long long);
  iptr1 = (int *)cptr1; i1 = *iptr1; cptr1 += sizeof(int);
  llptr2 = (long long *)cptr2; ll2 = *llptr2; cptr2 += sizeof(long long);
  iptr2 = (int *)cptr2; i2 = *iptr2; cptr2 += sizeof(int);
  if ( ll1 > ll2 ) {
    return (1);
  }
  else if ( ll1 < ll2 ) {
    return (-1);
  }
  else {
    if ( i1 > i2 ) {
      return (1);
    }
    else if ( i1 < i2 ) {
      return (-1);
    }
    else {
      return(0);
    }
  }
}

canonical_original_code:
int sort_Li_aa_compare(void *in1, void *in2)
{
  char *cptr1; char *cptr2;
  long long *llptr1; long long *llptr2;
  int *iptr1; int *iptr2;
  long long ll1; long long ll2;
  int i1; int i2;
  cptr1 = (char *)in1;
  cptr2 = (char *)in2;
  llptr1 = (long long *)cptr1; ll1 = *llptr1; cptr1 += sizeof(long long);
  iptr1 = (int *)cptr1; i1 = *iptr1; cptr1 += sizeof(int);
  llptr2 = (long long *)cptr2; ll2 = *llptr2; cptr2 += sizeof(long long);
  iptr2 = (int *)cptr2; i2 = *iptr2; cptr2 += sizeof(int);
  if ( ll1 > ll2 ) {
    return (1);
  }
  else if ( ll1 < ll2 ) {
    return (-1);
  }
  else {
    if ( i1 > i2 ) {
      return (1);
    }
    else if ( i1 < i2 ) {
      return (-1);
    }
    else {
      return(0);
    }
  }
}


decompiled_code:
__int64 __fastcall str_compare(char *a1, char *a2)
{
char v2; // al
char v4; // dl

v2 = *a1;
if ( !*a1 )
return *a2 != 0;
while ( 1 )
{
v4 = *a2;
if ( !*a2 )
return 0xFFFFFFFFLL;
if ( v4 > v2 )
break;
if ( v4 < v2 )
return 0xFFFFFFFFLL;
v2 = *++a1;
++a2;
if ( !v2 )
return *a2 != 0;
}
return 1LL;
}

canonical_decompiled_code:
__int64 __fastcall func2(char *a1, char *a2)
{
char v2; // al
char v4; // dl

v2 = *a1;
if ( !*a1 )
return *a2 != 0;
while ( 1 )
{
v4 = *a2;
if ( !*a2 )
return 0xFFFFFFFFLL;
if ( v4 > v2 )
break;
if ( v4 < v2 )
return 0xFFFFFFFFLL;
v2 = *++a1;
++a2;
if ( !v2 )
return *a2 != 0;
}
return 1LL;
}

original_code:
int str_compare(
         const void *in1,
         const void *in2
         )
{
  char *cptr1, *cptr2;
  cptr1 = (char *)in1;
  cptr2 = (char *)in2;
  for ( ; ; cptr1++, cptr2++ ) {
    if ( ( *cptr1 == '\0' ) && ( *cptr2 == '\0' ) ) {
      return(0);
    }
    if ( *cptr1 == '\0' ) { return(1); }
    if ( *cptr2 == '\0' ) { return(-1); }
    if ( *cptr1 < *cptr2 ) { return(1); }
    if ( *cptr2 < *cptr1 ) { return(-1); }
  }
}

canonical_original_code:
int str_compare(void *in1, void *in2)
{
  char *cptr1; char *cptr2;
  cptr1 = (char *)in1;
  cptr2 = (char *)in2;
  for ( ; ; cptr1++, cptr2++ ) {
    if ( ( *cptr1 == '\0' ) && ( *cptr2 == '\0' ) ) {
      return(0);
    }
    if ( *cptr1 == '\0' ) { return(1); }
    if ( *cptr2 == '\0' ) { return(-1); }
    if ( *cptr1 < *cptr2 ) { return(1); }
    if ( *cptr2 < *cptr1 ) { return(-1); }
  }
}


original_code:
void
qsort_asc_I4 (
     void *const pbase,
     size_t total_elems,
     size_t size,
     __compar_fn_t cmp
     )
{
  register char *base_ptr = (char *) pbase;
  if ( size != sizeof(int) ) { exit(1); }
  const size_t max_thresh = 4 * size;
  if (total_elems == 0) {
    return;
  }
  if ( total_elems > 4 ) {
    char *lo = base_ptr;
    char *hi = &lo[size * (total_elems - 1)];
    stack_node stack[(8 * sizeof(size_t))];
    stack_node *top = stack;
    ((void) ((top->lo = (((void *)0))), (top->hi = (((void *)0))), ++top));
    while ((stack < top)) {
      char *left_ptr;
      char *right_ptr;
      char *mid = lo + size * ((hi - lo) / size >> 1);
      if ( *((int *)mid) < *((int *)lo) ) {
 { int *ia = (int *)mid; int *ib = (int *)lo; int itmp = *ia; *ia = *ib; *ib = itmp; };
      }
      if ( *((int *)hi) < *((int *)mid) ) {
 { int *ia = (int *)mid; int *ib = (int *)hi; int itmp = *ia; *ia = *ib; *ib = itmp; };
      }
      else {
 goto jump_over;
      }
      if ( *((int *)mid) < *((int *)lo) ) {
 { int *ia = (int *)mid; int *ib = (int *)lo; int itmp = *ia; *ia = *ib; *ib = itmp; };
      }
    jump_over:;
      left_ptr = lo + size;
      right_ptr = hi - size;
      do {
 while ( *((int *)left_ptr) < *((int *)mid) ) {
   left_ptr += size;
 }
 while ( *((int *)mid) < *((int *)right_ptr) ) {
   right_ptr -= size;
 }
 if (left_ptr < right_ptr) {
   { int *ia = (int *)left_ptr; int *ib = (int *)right_ptr; int itmp = *ia; *ia = *ib; *ib = itmp; };
   if (mid == left_ptr) {
     mid = right_ptr;
   }
   else if (mid == right_ptr) {
     mid = left_ptr;
   }
   left_ptr += size;
   right_ptr -= size;
 }
 else if (left_ptr == right_ptr) {
   left_ptr += size;
   right_ptr -= size;
   break;
 }
      } while (left_ptr <= right_ptr);
      if ((size_t) (right_ptr - lo) <= max_thresh) {
 if ((size_t) (hi - left_ptr) <= max_thresh) {
   ((void) (--top, (lo = top->lo), (hi = top->hi)));
 }
 else {
   lo = left_ptr;
 }
      }
      else if ((size_t) (hi - left_ptr) <= max_thresh) {
 hi = right_ptr;
      }
      else if ((right_ptr - lo) > (hi - left_ptr)) {
 ((void) ((top->lo = (lo)), (top->hi = (right_ptr)), ++top));
 lo = left_ptr;
      }
      else {
 ((void) ((top->lo = (left_ptr)), (top->hi = (hi)), ++top));
 hi = right_ptr;
      }
    }
  }
  {
    char *const end_ptr = &base_ptr[size * (total_elems - 1)];
    char *tmp_ptr = base_ptr;
    char *thresh = ((end_ptr) < (base_ptr + max_thresh) ? (end_ptr) : (base_ptr + max_thresh));
    register char *run_ptr;
    for (run_ptr = tmp_ptr + size; run_ptr <= thresh; run_ptr += size) {
      if ( *((int *)run_ptr) < *((int *) tmp_ptr) ) {
        tmp_ptr = run_ptr;
      }
    }
    if (tmp_ptr != base_ptr) {
      { int *ia = (int *)tmp_ptr; int *ib = (int *)base_ptr; int itmp = *ia; *ia = *ib; *ib = itmp; };
    }
    run_ptr = base_ptr + size;
    while ((run_ptr += size) <= end_ptr) {
      tmp_ptr = run_ptr - size;
      while ( *((int *)run_ptr) < *((int *)tmp_ptr) ) {
 tmp_ptr -= size;
      }
      tmp_ptr += size;
      if (tmp_ptr != run_ptr) {
 char *trav;
 trav = run_ptr + size;
 while (--trav >= run_ptr) {
   char c = *trav;
   char *hi, *lo;
   for (hi = lo = trav; (lo -= size) >= tmp_ptr; hi = lo) {
     *hi = *lo;
   }
   *hi = c;
 }
      }
    }
  }
}

canonical_original_code:
void qsort_asc_I4(void *pbase, unsigned long total_elems, unsigned long size, int (*cmp)(void *, void *))
{
  register char *base_ptr = (char *) pbase;
  if ( size != sizeof(int) ) { exit(1); }
  unsigned long max_thresh = 4 * size;
  if (total_elems == 0) {
    return;
  }
  if ( total_elems > 4 ) {
    char *lo = base_ptr;
    char *hi = &lo[size * (total_elems - 1)];
    struct stack_node stack[-1];
    struct stack_node *top = stack;
    ((void) ((top->lo = (((void *)0))), (top->hi = (((void *)0))), ++top));
    while ((stack < top)) {
      char *left_ptr;
      char *right_ptr;
      char *mid = lo + size * ((hi - lo) / size >> 1);
      if ( *((int *)mid) < *((int *)lo) ) {
 { int *ia = (int *)mid; int *ib = (int *)lo; int itmp = *ia; *ia = *ib; *ib = itmp; };
      }
      if ( *((int *)hi) < *((int *)mid) ) {
 { int *ia = (int *)mid; int *ib = (int *)hi; int itmp = *ia; *ia = *ib; *ib = itmp; };
      }
      else {
 goto jump_over;
      }
      if ( *((int *)mid) < *((int *)lo) ) {
 { int *ia = (int *)mid; int *ib = (int *)lo; int itmp = *ia; *ia = *ib; *ib = itmp; };
      }
    jump_over:;
      left_ptr = lo + size;
      right_ptr = hi - size;
      do {
 while ( *((int *)left_ptr) < *((int *)mid) ) {
   left_ptr += size;
 }
 while ( *((int *)mid) < *((int *)right_ptr) ) {
   right_ptr -= size;
 }
 if (left_ptr < right_ptr) {
   { int *ia = (int *)left_ptr; int *ib = (int *)right_ptr; int itmp = *ia; *ia = *ib; *ib = itmp; };
   if (mid == left_ptr) {
     mid = right_ptr;
   }
   else if (mid == right_ptr) {
     mid = left_ptr;
   }
   left_ptr += size;
   right_ptr -= size;
 }
 else if (left_ptr == right_ptr) {
   left_ptr += size;
   right_ptr -= size;
   break;
 }
      } while (left_ptr <= right_ptr);
      if ((unsigned long) (right_ptr - lo) <= max_thresh) {
 if ((unsigned long) (hi - left_ptr) <= max_thresh) {
   ((void) (--top, (lo = top->lo), (hi = top->hi)));
 }
 else {
   lo = left_ptr;
 }
      }
      else if ((unsigned long) (hi - left_ptr) <= max_thresh) {
 hi = right_ptr;
      }
      else if ((right_ptr - lo) > (hi - left_ptr)) {
 ((void) ((top->lo = (lo)), (top->hi = (right_ptr)), ++top));
 lo = left_ptr;
      }
      else {
 ((void) ((top->lo = (left_ptr)), (top->hi = (hi)), ++top));
 hi = right_ptr;
      }
    }
  }
  {
    char *end_ptr = &base_ptr[size * (total_elems - 1)];
    char *tmp_ptr = base_ptr;
    char *thresh = ((end_ptr) < (base_ptr + max_thresh) ? (end_ptr) : (base_ptr + max_thresh));
    register char *run_ptr;
    for (run_ptr = tmp_ptr + size; run_ptr <= thresh; run_ptr += size) {
      if ( *((int *)run_ptr) < *((int *) tmp_ptr) ) {
        tmp_ptr = run_ptr;
      }
    }
    if (tmp_ptr != base_ptr) {
      { int *ia = (int *)tmp_ptr; int *ib = (int *)base_ptr; int itmp = *ia; *ia = *ib; *ib = itmp; };
    }
    run_ptr = base_ptr + size;
    while ((run_ptr += size) <= end_ptr) {
      tmp_ptr = run_ptr - size;
      while ( *((int *)run_ptr) < *((int *)tmp_ptr) ) {
 tmp_ptr -= size;
      }
      tmp_ptr += size;
      if (tmp_ptr != run_ptr) {
 char *trav;
 trav = run_ptr + size;
 while (--trav >= run_ptr) {
   char c = *trav;
   char *hi; char *lo;
   for (hi = lo = trav; (lo -= size) >= tmp_ptr; hi = lo) {
     *hi = *lo;
   }
   *hi = c;
 }
      }
    }
  }
}

variable_types:
pbase
void *

variable_types:
size
unsigned long

variable_types:
cmp
int (*)(void *, void *)

variable_types:
lo
char *

variable_types:
hi
char *

variable_types: struct stack_node { char *lo; char *hi; } [-1]

variable_types: struct stack_node { char *lo; char *hi; } *

variable_types:
mid
char *

variable_types:
ia
int *

variable_types:
ib
int *

variable_types: itmp int

variable_types:
thresh
char *

variable_types:
trav
char *

variable_types: c char


decompiled_code:
__int64 __fastcall div2_I4(__int64 a1, __int64 a2, __int64 a3, __int64 a4)
{
__int64 i; // rcx
__int64 result; // rax

if ( a3 > 0 )
{
for ( i = 0LL; i != a3; ++i )
{
result = (unsigned int)(*(_DWORD *)(a1 + 4 * i) / *(_DWORD *)(a2 + 4 * i));
*(_DWORD *)(a4 + 4 * i) = result;
}
}
return result;
}

canonical_decompiled_code:
__int64 __fastcall func0(__int64 a1, __int64 a2, __int64 a3, __int64 a4)
{
__int64 i; // rcx
__int64 result; // rax

if ( a3 > 0 )
{
for ( i = 0LL; i != a3; ++i )
{
result = (unsigned int)(*(_DWORD *)(a1 + 4 * i) / *(_DWORD *)(a2 + 4 * i));
*(_DWORD *)(a4 + 4 * i) = result;
}
}
return result;
}

original_code:
void
div2_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 div2_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:
nR
long long

variable_types:
out
int *

variable_types: outv int

variable_types:
i
long long


decompiled_code:
__int64 __fastcall cmp_eq_mult_scalar_I2(__int64 a1, __int64 a2, __int64 a3, int a4)
{
__int64 result; // rax

if ( a4 > 8 )
result = cmp_eq_mult_scalar_log_I2();
else
result = cmp_eq_mult_scalar_simple_I2();
return result;
}

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

if ( a4 > 8 )
result = cmp_eq_mult_scalar_log_I2();
else
result = cmp_eq_mult_scalar_simple_I2();
return result;
}

original_code:
void
cmp_eq_mult_scalar_I2(
         short *in1,
         long long n1,
         short *in2,
         int n2,
         char * restrict out
          )
{
  if ( n2 <= 8 ) {
    cmp_eq_mult_scalar_simple_I2( in1, n1, in2, n2, out);
  }
  else
    cmp_eq_mult_scalar_log_I2( in1, n1, in2, n2, out);
}

canonical_original_code:
void cmp_eq_mult_scalar_I2(short *in1, long long n1, short *in2, int n2, char *out)
{
  if ( n2 <= 8 ) {
    cmp_eq_mult_scalar_simple_I2( in1, n1, in2, n2, out);
  }
  else
    cmp_eq_mult_scalar_log_I2( in1, n1, in2, n2, out);
}

variable_types:
out
char *


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

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

variable_types:
out
long long *

variable_types:
outv
long long


decompiled_code:
// attributes: thunk
__int64 mk_dict()
{
return mk_dict_cc();
}

canonical_decompiled_code:
__int64 func0()
{
return mk_dict_cc();
}

original_code:
int mk_dict(const char * name, const char * pathname)
{
  return mk_dict_cc(name,pathname);
}

canonical_original_code:
int mk_dict(char *name, char *pathname)
{
  return mk_dict_cc(name,pathname);
}

variable_types:
name
char *

variable_types:
pathname
char *


decompiled_code:
// attributes: thunk
__int64 del_dict()
{
return del_dict_cc();
}

canonical_decompiled_code:
__int64 func1()
{
return del_dict_cc();
}

original_code:
int del_dict(const char * name,const char * pathname)
{
  return del_dict_cc(name,pathname);
}

canonical_original_code:
int del_dict(char *name, char *pathname)
{
  return del_dict_cc(name,pathname);
}


decompiled_code:
// attributes: thunk
__int64 is_dict()
{
return is_dict_cc();
}

canonical_decompiled_code:
__int64 func2()
{
return is_dict_cc();
}

original_code:
int is_dict(const char * name, const char * pathname, int * dict_exists)
{
  return is_dict_cc(name, pathname, dict_exists);
}

canonical_original_code:
int is_dict(char *name, char *pathname, int *dict_exists)
{
  return is_dict_cc(name, pathname, dict_exists);
}


decompiled_code:
// attributes: thunk
__int64 add_to_dict_1()
{
return add_to_dict_cc();
}

canonical_decompiled_code:
__int64 func3()
{
return add_to_dict_cc();
}

original_code:
int add_to_dict_1(const char * name, const char * pathname, const char * key,const char * value)
{
  return add_to_dict_cc(name,pathname,key,value);
}

canonical_original_code:
int add_to_dict_1(char *name, char *pathname, char *key, char *value)
{
  return add_to_dict_cc(name,pathname,key,value);
}

variable_types:
key
char *

variable_types:
value
char *


decompiled_code:
// attributes: thunk
__int64 add_to_dict_2()
{
return add_to_dict_2_cc();
}

canonical_decompiled_code:
__int64 func4()
{
return add_to_dict_2_cc();
}

original_code:
int add_to_dict_2(const char * name, const char * pathname, const char * key,const int value)
{
  return add_to_dict_2_cc(name,pathname,key,value);
}

canonical_original_code:
int add_to_dict_2(char *name, char *pathname, char *key, int value)
{
  return add_to_dict_2_cc(name,pathname,key,value);
}

variable_types: value int


decompiled_code:
// attributes: thunk
__int64 add_to_dict_3()
{
return add_to_dict_3_cc();
}

canonical_decompiled_code:
__int64 func5()
{
return add_to_dict_3_cc();
}

original_code:
int add_to_dict_3(const char * name, const char * pathname, const int key,char * value)
{
  return add_to_dict_3_cc(name,pathname,key,value);
}

canonical_original_code:
int add_to_dict_3(char *name, char *pathname, int key, char *value)
{
  return add_to_dict_3_cc(name,pathname,key,value);
}

variable_types: key int


decompiled_code:
// attributes: thunk
__int64 add_to_dict_4()
{
return add_to_dict_4_cc();
}

canonical_decompiled_code:
__int64 func6()
{
return add_to_dict_4_cc();
}

original_code:
int add_to_dict_4(const char * name, const char * pathname, const int key, const int value)
{
  return add_to_dict_4_cc (name, pathname, key,value);
}

canonical_original_code:
int add_to_dict_4(char *name, char *pathname, int key, int value)
{
  return add_to_dict_4_cc (name, pathname, key,value);
}


decompiled_code:
// attributes: thunk
__int64 add_batch_to_dict_1()
{
return add_batch_to_dict_cc();
}

canonical_decompiled_code:
__int64 func7()
{
return add_batch_to_dict_cc();
}

original_code:
int add_batch_to_dict_1(const char * name, const char * pathname, char ** batch_key, char ** batch_value, int batch_size)
{
  return add_batch_to_dict_cc(name,pathname,batch_key, batch_value, batch_size);
}

canonical_original_code:
int add_batch_to_dict_1(char *name, char *pathname, char **batch_key, char **batch_value, int batch_size)
{
  return add_batch_to_dict_cc(name,pathname,batch_key, batch_value, batch_size);
}


decompiled_code:
// attributes: thunk
__int64 add_batch_to_dict_2()
{
return add_batch_to_dict_2_cc();
}

canonical_decompiled_code:
__int64 func8()
{
return add_batch_to_dict_2_cc();
}

original_code:
int add_batch_to_dict_2(const char * name, const char * pathname, char ** batch_key, int * batch_value, int batch_size)
{
  return add_batch_to_dict_2_cc(name,pathname,batch_key, batch_value, batch_size);
}

canonical_original_code:
int add_batch_to_dict_2(char *name, char *pathname, char **batch_key, int *batch_value, int batch_size)
{
  return add_batch_to_dict_2_cc(name,pathname,batch_key, batch_value, batch_size);
}


decompiled_code:
// attributes: thunk
__int64 add_batch_to_dict_3()
{
return add_batch_to_dict_3_cc();
}

canonical_decompiled_code:
__int64 func9()
{
return add_batch_to_dict_3_cc();
}

original_code:
int add_batch_to_dict_3(const char * name, const char * pathname, int * batch_key, char ** batch_value, int batch_size)
{
  return add_batch_to_dict_3_cc(name,pathname,batch_key, batch_value, batch_size);
}

canonical_original_code:
int add_batch_to_dict_3(char *name, char *pathname, int *batch_key, char **batch_value, int batch_size)
{
  return add_batch_to_dict_3_cc(name,pathname,batch_key, batch_value, batch_size);
}


decompiled_code:
// attributes: thunk
__int64 add_batch_to_dict_4()
{
return add_batch_to_dict_4_cc();
}

canonical_decompiled_code:
__int64 func10()
{
return add_batch_to_dict_4_cc();
}

original_code:
int add_batch_to_dict_4(const char * name, const char * pathname, int * batch_key, int * batch_value, int batch_size)
{
  return add_batch_to_dict_4_cc(name,pathname,batch_key, batch_value, batch_size);
}

canonical_original_code:
int add_batch_to_dict_4(char *name, char *pathname, int *batch_key, int *batch_value, int batch_size)
{
  return add_batch_to_dict_4_cc(name,pathname,batch_key, batch_value, batch_size);
}


decompiled_code:
// attributes: thunk
__int64 get_from_dict_1()
{
return get_from_dict_cc();
}

canonical_decompiled_code:
__int64 func11()
{
return get_from_dict_cc();
}

original_code:
int get_from_dict_1(const char * name, const char * pathname, const char * key,char * value, int value_size, int *key_exists)
{
  return get_from_dict_cc(name,pathname,key,value,value_size, key_exists);
}

canonical_original_code:
int get_from_dict_1(char *name, char *pathname, char *key, char *value, int value_size, int *key_exists)
{
  return get_from_dict_cc(name,pathname,key,value,value_size, key_exists);
}


decompiled_code:
// attributes: thunk
__int64 get_from_dict_2()
{
return get_from_dict_2_cc();
}

canonical_decompiled_code:
__int64 func12()
{
return get_from_dict_2_cc();
}

original_code:
int get_from_dict_2(const char * name, const char * pathname, const char * key,int * value, int * key_exists)
{
  return get_from_dict_2_cc(name,pathname,key,value, key_exists);
}

canonical_original_code:
int get_from_dict_2(char *name, char *pathname, char *key, int *value, int *key_exists)
{
  return get_from_dict_2_cc(name,pathname,key,value, key_exists);
}

variable_types:
value
int *


decompiled_code:
// attributes: thunk
__int64 get_from_dict_3()
{
return get_from_dict_3_cc();
}

canonical_decompiled_code:
__int64 func13()
{
return get_from_dict_3_cc();
}

original_code:
int get_from_dict_3(const char * name, const char * pathname, const int key,char * value,int value_size, int* key_exists)
{
  return get_from_dict_3_cc(name,pathname,key,value,value_size, key_exists);
}

canonical_original_code:
int get_from_dict_3(char *name, char *pathname, int key, char *value, int value_size, int *key_exists)
{
  return get_from_dict_3_cc(name,pathname,key,value,value_size, key_exists);
}


decompiled_code:
// attributes: thunk
__int64 get_from_dict_4()
{
return get_from_dict_4_cc();
}

canonical_decompiled_code:
__int64 func14()
{
return get_from_dict_4_cc();
}

original_code:
int get_from_dict_4(const char * name, const char * pathname, const int key, int * value, int * key_exists)
{
  return get_from_dict_4_cc(name, pathname, key, value, key_exists);
}

canonical_original_code:
int get_from_dict_4(char *name, char *pathname, int key, int *value, int *key_exists)
{
  return get_from_dict_4_cc(name, pathname, key, value, key_exists);
}


decompiled_code:
// attributes: thunk
__int64 get_first_key_val_from_dict_1()
{
return get_first_key_val_from_dict_cc();
}

canonical_decompiled_code:
__int64 func15()
{
return get_first_key_val_from_dict_cc();
}

original_code:
int get_first_key_val_from_dict_1(const char * name, const char * pathname, char * key, const int key_size, char * value, const int value_size, int * first_exists)
{
  return get_first_key_val_from_dict_cc(name, pathname, key, key_size, value, value_size, first_exists);
}

canonical_original_code:
int get_first_key_val_from_dict_1(char *name, char *pathname, char *key, int key_size, char *value, int value_size, int *first_exists)
{
  return get_first_key_val_from_dict_cc(name, pathname, key, key_size, value, value_size, first_exists);
}


decompiled_code:
// attributes: thunk
__int64 get_first_key_val_from_dict_2()
{
return get_first_key_val_from_dict_2_cc();
}

canonical_decompiled_code:
__int64 func16()
{
return get_first_key_val_from_dict_2_cc();
}

original_code:
int get_first_key_val_from_dict_2(const char * name, const char * pathname, char * key, const int key_size, int * value, int * first_exists)
{
  return get_first_key_val_from_dict_2_cc(name, pathname, key, key_size, value, first_exists);
}

canonical_original_code:
int get_first_key_val_from_dict_2(char *name, char *pathname, char *key, int key_size, int *value, int *first_exists)
{
  return get_first_key_val_from_dict_2_cc(name, pathname, key, key_size, value, first_exists);
}


decompiled_code:
// attributes: thunk
__int64 get_first_key_val_from_dict_3()
{
return get_first_key_val_from_dict_3_cc();
}

canonical_decompiled_code:
__int64 func17()
{
return get_first_key_val_from_dict_3_cc();
}

original_code:
int get_first_key_val_from_dict_3(const char * name, const char * pathname, int * key, char * value, const int value_size, int * first_exists)
{
  return get_first_key_val_from_dict_3_cc(name, pathname, key, value, value_size, first_exists);
}

canonical_original_code:
int get_first_key_val_from_dict_3(char *name, char *pathname, int *key, char *value, int value_size, int *first_exists)
{
  return get_first_key_val_from_dict_3_cc(name, pathname, key, value, value_size, first_exists);
}

variable_types:
key
int *


decompiled_code:
// attributes: thunk
__int64 get_first_key_val_from_dict_4()
{
return get_first_key_val_from_dict_4_cc();
}

canonical_decompiled_code:
__int64 func18()
{
return get_first_key_val_from_dict_4_cc();
}

original_code:
int get_first_key_val_from_dict_4(const char * name, const char * pathname, int * key, int * value, int * first_exists)
{
  return get_first_key_val_from_dict_4_cc(name, pathname, key, value, first_exists);
}

canonical_original_code:
int get_first_key_val_from_dict_4(char *name, char *pathname, int *key, int *value, int *first_exists)
{
  return get_first_key_val_from_dict_4_cc(name, pathname, key, value, first_exists);
}


decompiled_code:
// attributes: thunk
__int64 get_next_key_val_from_dict_1()
{
return get_next_key_val_from_dict_cc();
}

canonical_decompiled_code:
__int64 func19()
{
return get_next_key_val_from_dict_cc();
}

original_code:
int get_next_key_val_from_dict_1(const char * name, const char * pathname, char * current_key, char * key, const int key_size, char * value, const int value_size, int * next_exists)
{
  return get_next_key_val_from_dict_cc(name, pathname, current_key, key, key_size, value, value_size, next_exists);
}

canonical_original_code:
int get_next_key_val_from_dict_1(char *name, char *pathname, char *current_key, char *key, int key_size, char *value, int value_size, int *next_exists)
{
  return get_next_key_val_from_dict_cc(name, pathname, current_key, key, key_size, value, value_size, next_exists);
}


decompiled_code:
// attributes: thunk
__int64 get_next_key_val_from_dict_2()
{
return get_next_key_val_from_dict_2_cc();
}

canonical_decompiled_code:
__int64 func20()
{
return get_next_key_val_from_dict_2_cc();
}

original_code:
int get_next_key_val_from_dict_2(const char * name, const char * pathname, char * current_key, char * key, const int key_size, int * value, int * next_exists)
{
  return get_next_key_val_from_dict_2_cc(name, pathname, current_key, key, key_size, value, next_exists);
}

canonical_original_code:
int get_next_key_val_from_dict_2(char *name, char *pathname, char *current_key, char *key, int key_size, int *value, int *next_exists)
{
  return get_next_key_val_from_dict_2_cc(name, pathname, current_key, key, key_size, value, next_exists);
}


decompiled_code:
// attributes: thunk
__int64 get_next_key_val_from_dict_3()
{
return get_next_key_val_from_dict_3_cc();
}

canonical_decompiled_code:
__int64 func21()
{
return get_next_key_val_from_dict_3_cc();
}

original_code:
int get_next_key_val_from_dict_3(const char * name, const char * pathname, int current_key, int * key, char * value, const int value_size, int * next_exists)
{
  return get_next_key_val_from_dict_3_cc(name, pathname, current_key, key, value, value_size, next_exists);
}

canonical_original_code:
int get_next_key_val_from_dict_3(char *name, char *pathname, int current_key, int *key, char *value, int value_size, int *next_exists)
{
  return get_next_key_val_from_dict_3_cc(name, pathname, current_key, key, value, value_size, next_exists);
}


decompiled_code:
// attributes: thunk
__int64 get_next_key_val_from_dict_4()
{
return get_next_key_val_from_dict_4_cc();
}

canonical_decompiled_code:
__int64 func22()
{
return get_next_key_val_from_dict_4_cc();
}

original_code:
int get_next_key_val_from_dict_4(const char * name, const char * pathname, int current_key, int * key, int * value, int * next_exists)
{
  return get_next_key_val_from_dict_4_cc(name, pathname, current_key, key, value, next_exists);
}

canonical_original_code:
int get_next_key_val_from_dict_4(char *name, char *pathname, int current_key, int *key, int *value, int *next_exists)
{
  return get_next_key_val_from_dict_4_cc(name, pathname, current_key, key, value, next_exists);
}


decompiled_code:
// attributes: thunk
__int64 del_from_dict_1()
{
return del_from_dict_cc();
}

canonical_decompiled_code:
__int64 func23()
{
return del_from_dict_cc();
}

original_code:
int del_from_dict_1(const char * name, const char * pathname, const char * key)
{
  return del_from_dict_cc(name,pathname,key);
}

canonical_original_code:
int del_from_dict_1(char *name, char *pathname, char *key)
{
  return del_from_dict_cc(name,pathname,key);
}


decompiled_code:
// attributes: thunk
__int64 del_from_dict_2()
{
return del_from_dict_1();
}

canonical_decompiled_code:
__int64 func24()
{
return func23();
}

original_code:
int del_from_dict_2(const char * name, const char * pathname, const char * key)
{
  return del_from_dict_cc(name,pathname,key);
}

canonical_original_code:
int del_from_dict_2(char *name, char *pathname, char *key)
{
  return del_from_dict_cc(name,pathname,key);
}


decompiled_code:
// attributes: thunk
__int64 del_from_dict_3()
{
return del_from_dict_3_cc();
}

canonical_decompiled_code:
__int64 func25()
{
return del_from_dict_3_cc();
}

original_code:
int del_from_dict_3(const char * name, const char * pathname, const int key)
{
  return del_from_dict_3_cc(name,pathname,key);
}

canonical_original_code:
int del_from_dict_3(char *name, char *pathname, int key)
{
  return del_from_dict_3_cc(name,pathname,key);
}


decompiled_code:
// attributes: thunk
__int64 del_from_dict_4()
{
return del_from_dict_3();
}

canonical_decompiled_code:
__int64 func26()
{
return func25();
}

original_code:
int del_from_dict_4(const char * name, const char * pathname, const int key)
{
  return del_from_dict_3_cc(name,pathname,key);
}

canonical_original_code:
int del_from_dict_4(char *name, char *pathname, int key)
{
  return del_from_dict_3_cc(name,pathname,key);
}


cleanUp

decompiled_code:
__int64 cleanUp()
{
return cleanUp_cc();
}

canonical_decompiled_code:
__int64 func27()
{
return cleanUp_cc();
}

original_code:
void cleanUp()
{
  cleanUp_cc();
}

canonical_original_code:
void cleanUp()
{
  cleanUp_cc();
}


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

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

variable_types: lb int

variable_types: ub int

variable_types: status int

variable_types:
cnt
long long

variable_types: val int


decompiled_code:
__int64 __fastcall stride_I4(__int64 a1, __int64 a2, __int64 a3, __int64 a4, __int64 a5, __int64 a6)
{
__int64 v7; // rax
int v8; // ecx

if ( a6 <= 0 )
return 0LL;
if ( a3 >= 0 && a3 < a2 )
{
v7 = 0LL;
do
{
v8 = *(_DWORD *)(a1 + 4 * a3);
a3 += a4;
*(_DWORD *)(a5 + 4 * v7++) = v8;
if ( a6 == v7 )
return 0LL;
}
while ( a3 >= 0 && a2 > a3 );
}
fprintf(stderr, "Line %3d of File %s \n", 35LL, "stride.c");
return 0xFFFFFFFFLL;
}

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

if ( a6 <= 0 )
return 0LL;
if ( a3 >= 0 && a3 < a2 )
{
v7 = 0LL;
do
{
v8 = *(_DWORD *)(a1 + 4 * a3);
a3 += a4;
*(_DWORD *)(a5 + 4 * v7++) = v8;
if ( a6 == v7 )
return 0LL;
}
while ( a3 >= 0 && a2 > a3 );
}
fprintf(stderr, "Line %3d of File %s \n", 35LL, "stride.c");
return 0xFFFFFFFFLL;
}

original_code:
int
stride_I4(
    int *f1,
    long long nR1,
    long long start,
    long long stride,
    int *f2,
    long long nR2
    )
{
  int status = 0;
  long long f1_idx = start;
  for ( long long i = 0; i < nR2; i++ ) {
    if ( ( f1_idx < 0 ) || ( f1_idx >= nR1 ) ) { { { fprintf(stderr, "Line %3d of File %s \n", 35, "stride.c"); }; status = -1 ; goto BYE; }; }
    f2[i] = f1[f1_idx];
    f1_idx += stride;
  }
BYE:
  return status ;
}

canonical_original_code:
int stride_I4(int *f1, long long nR1, long long start, long long stride, int *f2, long long nR2)
{
  int status = 0;
  long long f1_idx = start;
  for ( long long i = 0; i < nR2; i++ ) {
    if ( ( f1_idx < 0 ) || ( f1_idx >= nR1 ) ) { { { fprintf(stderr, "Line %3d of File %s \n", 35, "stride.c"); }; status = -1 ; goto BYE; }; }
    f2[i] = f1[f1_idx];
    f1_idx += stride;
  }
BYE:
  return status ;
}

variable_types:
start
long long

variable_types:
stride
long long

variable_types:
i
long long


decompiled_code:
__int64 __fastcall stride_I8(__int64 a1, __int64 a2, __int64 a3, __int64 a4, __int64 a5, __int64 a6)
{
__int64 v7; // rax
__int64 v8; // rcx

if ( a6 <= 0 )
return 0LL;
if ( a3 >= 0 && a3 < a2 )
{
v7 = 0LL;
do
{
v8 = *(_QWORD *)(a1 + 8 * a3);
a3 += a4;
*(_QWORD *)(a5 + 8 * v7++) = v8;
if ( a6 == v7 )
return 0LL;
}
while ( a3 >= 0 && a2 > a3 );
}
fprintf(stderr, "Line %3d of File %s \n", 58LL, "stride.c");
return 0xFFFFFFFFLL;
}

original_code:
int
stride_I8(
    long long *f1,
    long long nR1,
    long long start,
    long long stride,
    long long *f2,
    long long nR2
    )
{
  int status = 0;
  long long f1_idx = start;
  for ( long long i = 0; i < nR2; i++ ) {
    if ( ( f1_idx < 0 ) || ( f1_idx >= nR1 ) ) { { { fprintf(stderr, "Line %3d of File %s \n", 58, "stride.c"); }; status = -1 ; goto BYE; }; }
    f2[i] = f1[f1_idx];
    f1_idx += stride;
  }
BYE:
  return status ;
}

canonical_original_code:
int stride_I8(long long *f1, long long nR1, long long start, long long stride, long long *f2, long long nR2)
{
  int status = 0;
  long long f1_idx = start;
  for ( long long i = 0; i < nR2; i++ ) {
    if ( ( f1_idx < 0 ) || ( f1_idx >= nR1 ) ) { { { fprintf(stderr, "Line %3d of File %s \n", 58, "stride.c"); }; status = -1 ; goto BYE; }; }
    f2[i] = f1[f1_idx];
    f1_idx += stride;
  }
BYE:
  return status ;
}


decompiled_code:
__int64 __fastcall ext_stride(const char *a1, _BYTE *a2, __int64 a3, __int64 a4, const char *a5, _BYTE *a6, __int64 a7)
{
int v10; // er13
__int64 v11; // rbx
__int64 v12; // rdx
__int64 v13; // rax
__int64 v14; // r8
__int64 v16; // rdx
char v18[4]; // [rsp+18h] [rbp-270h] BYREF
unsigned int v19; // [rsp+1Ch] [rbp-26Ch] BYREF
char v20[4]; // [rsp+20h] [rbp-268h] BYREF
int v21; // [rsp+24h] [rbp-264h] BYREF
char v22[4]; // [rsp+28h] [rbp-260h] BYREF
unsigned int v23; // [rsp+2Ch] [rbp-25Ch] BYREF
unsigned int v24; // [rsp+30h] [rbp-258h] BYREF
int v25; // [rsp+34h] [rbp-254h] BYREF
void *addr; // [rsp+38h] [rbp-250h] BYREF
size_t len; // [rsp+40h] [rbp-248h] BYREF
void *v28; // [rsp+48h] [rbp-240h] BYREF
size_t v29; // [rsp+50h] [rbp-238h] BYREF
__int64 v30; // [rsp+58h] [rbp-230h] BYREF
__int64 v31; // [rsp+60h] [rbp-228h] BYREF
__int64 v32; // [rsp+68h] [rbp-220h] BYREF
__int64 v33[6]; // [rsp+70h] [rbp-218h] BYREF
char v34[48]; // [rsp+A0h] [rbp-1E8h] BYREF
__int64 v35; // [rsp+D0h] [rbp-1B8h] BYREF
__int64 v36; // [rsp+F0h] [rbp-198h]
char v37[128]; // [rsp+150h] [rbp-138h] BYREF
char v38[32]; // [rsp+1D0h] [rbp-B8h] BYREF
int v39; // [rsp+1F0h] [rbp-98h]

addr = 0LL;
len = 0LL;
v28 = 0LL;
v29 = 0LL;
v23 = -1;
v24 = 0x7FFFFFFF;
v25 = 0x7FFFFFFF;
if ( !a1 || !*a1 )
{
v12 = 95LL;
goto LABEL_33;
}
if ( !a2 || !*a2 )
{
v12 = 96LL;
goto LABEL_33;
}
if ( !a5 || !*a5 )
{
v12 = 97LL;
goto LABEL_33;
}
if ( !a6 || !*a6 )
{
v12 = 98LL;
goto LABEL_33;
}
if ( !strcmp(a1, a5) )
{
v10 = -1;
fprintf(stderr, "Line %3d of File %s \n", 99LL, "stride.c");
goto LABEL_34;
}
v10 = stoI8(a3, &v31);
if ( v10 < 0 )
{
fprintf(stderr, "Line %3d of File %s \n", 100LL, "stride.c");
goto LABEL_34;
}
v10 = stoI8(a4, &v32);
if ( v10 < 0 )
{
fprintf(stderr, "Line %3d of File %s \n", 101LL, "stride.c");
goto LABEL_34;
}
v30 = (int)stoI8(a7, &v30);
v10 = is_tbl(a1, v18, v33);
if ( v10 < 0 )
{
fprintf(stderr, "Line %3d of File %s \n", 104LL, "stride.c");
goto LABEL_34;
}
v11 = v33[0];
v10 = is_fld(a1, 0xFFFFFFFFLL, a2, v20, &v35, &v21, v37);
if ( v10 < 0 )
{
fprintf(stderr, "Line %3d of File %s \n", 107LL, "stride.c");
goto LABEL_34;
}
v10 = get_data(&addr, &len, 0LL);
if ( v10 < 0 )
{
fprintf(stderr, "Line %3d of File %s \n", 108LL, "stride.c");
goto LABEL_34;
}
v12 = 109LL;
if ( v21 >= 0 )
goto LABEL_33;
v10 = del_tbl(a5, 0xFFFFFFFFLL, 109LL, "stride.c");
if ( v10 < 0 )
{
fprintf(stderr, "Line %3d of File %s \n", 110LL, "stride.c");
goto LABEL_34;
}
v12 = 115LL;
if ( (unsigned int)(v36 - 4) > 1 )
{
LABEL_33:
v10 = -1;
fprintf(stderr, "Line %3d of File %s \n", v12, "stride.c");
goto LABEL_34;
}
if ( v31 >= v11 || v31 < 0 )
{
v12 = 118LL;
goto LABEL_33;
}
if ( v32 <= 1 || v32 >= v11 )
{
v12 = 119LL;
goto LABEL_33;
}
if ( v30 <= 0 )
{
v12 = 120LL;
goto LABEL_33;
}
v12 = v30 - 1;
v13 = v31 + v30 * v32 - v32;
if ( v11 < v31 + v30 * v32 )
{
do
{
v13 -= v32;
v14 = v12--;
}
while ( v32 + v13 > v11 );
v30 = v14;
v12 = 124LL;
if ( v14 <= 0 )
goto LABEL_33;
}
v10 = get_fld_sz((unsigned int)v36, &v25, v12);
if ( v10 < 0 )
{
fprintf(stderr, "Line %3d of File %s \n", 127LL, "stride.c");
goto LABEL_34;
}
v10 = mk_temp_file(v30 * v25, &v24, &v23);
if ( v10 < 0 )
{
fprintf(stderr, "Line %3d of File %s \n", 129LL, "stride.c");
goto LABEL_34;
}
v10 = q_mmap(v24, v23, &v28, &v29, 1LL);
if ( v10 < 0 )
{
fprintf(stderr, "Line %3d of File %s \n", 130LL, "stride.c");
goto LABEL_34;
}
if ( (_DWORD)v36 == 4 )
{
v10 = stride_I4((__int64)addr, v11, v31, v32, (__int64)v28, v30);
if ( v10 < 0 )
{
fprintf(stderr, "Line %3d of File %s \n", 136LL, "stride.c");
goto LABEL_34;
}
}
else
{
if ( (_DWORD)v36 != 5 )
{
v12 = 144LL;
goto LABEL_33;
}
v10 = stride_I8((__int64)addr, v11, v31, v32, (__int64)v28, v30);
if ( v10 < 0 )
{
fprintf(stderr, "Line %3d of File %s \n", 141LL, "stride.c");
goto LABEL_34;
}
}
v10 = add_tbl(a5, a7, &v19, v34);
if ( v10 < 0 )
{
fprintf(stderr, "Line %3d of File %s \n", 149LL, "stride.c");
}
else
{
zero_fld_rec(v38);
v39 = v36;
v10 = add_fld(v19, a6, v24, v23, v22, v38);
if ( v10 < 0 )
fprintf(stderr, "Line %3d of File %s \n", 152LL, "stride.c");
}
LABEL_34:
if ( addr )
{
if ( len )
{
munmap(addr, len);
addr = 0LL;
len = 0LL;
goto LABEL_37;
}
LABEL_43:
v16 = 155LL;
LABEL_44:
v10 = -1;
fprintf(stderr, "Line %3d of File %s \n", v16, "stride.c");
return (unsigned int)v10;
}
if ( len )
goto LABEL_43;
LABEL_37:
if ( !v28 )
{
if ( !v29 )
return (unsigned int)v10;
goto LABEL_46;
}
if ( !v29 )
{
LABEL_46:
v16 = 156LL;
goto LABEL_44;
}
munmap(v28, v29);
return (unsigned int)v10;
}

canonical_decompiled_code:
__int64 __fastcall func2(const char *a1, _BYTE *a2, __int64 a3, __int64 a4, const char *a5, _BYTE *a6, __int64 a7)
{
int v10; // er13
__int64 v11; // rbx
__int64 v12; // rdx
__int64 v13; // rax
__int64 v14; // r8
__int64 v16; // rdx
char v18[4]; // [rsp+18h] [rbp-270h] BYREF
unsigned int v19; // [rsp+1Ch] [rbp-26Ch] BYREF
char v20[4]; // [rsp+20h] [rbp-268h] BYREF
int v21; // [rsp+24h] [rbp-264h] BYREF
char v22[4]; // [rsp+28h] [rbp-260h] BYREF
unsigned int v23; // [rsp+2Ch] [rbp-25Ch] BYREF
unsigned int v24; // [rsp+30h] [rbp-258h] BYREF
int v25; // [rsp+34h] [rbp-254h] BYREF
void *addr; // [rsp+38h] [rbp-250h] BYREF
size_t len; // [rsp+40h] [rbp-248h] BYREF
void *v28; // [rsp+48h] [rbp-240h] BYREF
size_t v29; // [rsp+50h] [rbp-238h] BYREF
__int64 v30; // [rsp+58h] [rbp-230h] BYREF
__int64 v31; // [rsp+60h] [rbp-228h] BYREF
__int64 v32; // [rsp+68h] [rbp-220h] BYREF
__int64 v33[6]; // [rsp+70h] [rbp-218h] BYREF
char v34[48]; // [rsp+A0h] [rbp-1E8h] BYREF
__int64 v35; // [rsp+D0h] [rbp-1B8h] BYREF
__int64 v36; // [rsp+F0h] [rbp-198h]
char v37[128]; // [rsp+150h] [rbp-138h] BYREF
char v38[32]; // [rsp+1D0h] [rbp-B8h] BYREF
int v39; // [rsp+1F0h] [rbp-98h]

addr = 0LL;
len = 0LL;
v28 = 0LL;
v29 = 0LL;
v23 = -1;
v24 = 0x7FFFFFFF;
v25 = 0x7FFFFFFF;
if ( !a1 || !*a1 )
{
v12 = 95LL;
goto LABEL_33;
}
if ( !a2 || !*a2 )
{
v12 = 96LL;
goto LABEL_33;
}
if ( !a5 || !*a5 )
{
v12 = 97LL;
goto LABEL_33;
}
if ( !a6 || !*a6 )
{
v12 = 98LL;
goto LABEL_33;
}
if ( !strcmp(a1, a5) )
{
v10 = -1;
fprintf(stderr, "Line %3d of File %s \n", 99LL, "stride.c");
goto LABEL_34;
}
v10 = stoI8(a3, &v31);
if ( v10 < 0 )
{
fprintf(stderr, "Line %3d of File %s \n", 100LL, "stride.c");
goto LABEL_34;
}
v10 = stoI8(a4, &v32);
if ( v10 < 0 )
{
fprintf(stderr, "Line %3d of File %s \n", 101LL, "stride.c");
goto LABEL_34;
}
v30 = (int)stoI8(a7, &v30);
v10 = is_tbl(a1, v18, v33);
if ( v10 < 0 )
{
fprintf(stderr, "Line %3d of File %s \n", 104LL, "stride.c");
goto LABEL_34;
}
v11 = v33[0];
v10 = is_fld(a1, 0xFFFFFFFFLL, a2, v20, &v35, &v21, v37);
if ( v10 < 0 )
{
fprintf(stderr, "Line %3d of File %s \n", 107LL, "stride.c");
goto LABEL_34;
}
v10 = get_data(&addr, &len, 0LL);
if ( v10 < 0 )
{
fprintf(stderr, "Line %3d of File %s \n", 108LL, "stride.c");
goto LABEL_34;
}
v12 = 109LL;
if ( v21 >= 0 )
goto LABEL_33;
v10 = del_tbl(a5, 0xFFFFFFFFLL, 109LL, "stride.c");
if ( v10 < 0 )
{
fprintf(stderr, "Line %3d of File %s \n", 110LL, "stride.c");
goto LABEL_34;
}
v12 = 115LL;
if ( (unsigned int)(v36 - 4) > 1 )
{
LABEL_33:
v10 = -1;
fprintf(stderr, "Line %3d of File %s \n", v12, "stride.c");
goto LABEL_34;
}
if ( v31 >= v11 || v31 < 0 )
{
v12 = 118LL;
goto LABEL_33;
}
if ( v32 <= 1 || v32 >= v11 )
{
v12 = 119LL;
goto LABEL_33;
}
if ( v30 <= 0 )
{
v12 = 120LL;
goto LABEL_33;
}
v12 = v30 - 1;
v13 = v31 + v30 * v32 - v32;
if ( v11 < v31 + v30 * v32 )
{
do
{
v13 -= v32;
v14 = v12--;
}
while ( v32 + v13 > v11 );
v30 = v14;
v12 = 124LL;
if ( v14 <= 0 )
goto LABEL_33;
}
v10 = get_fld_sz((unsigned int)v36, &v25, v12);
if ( v10 < 0 )
{
fprintf(stderr, "Line %3d of File %s \n", 127LL, "stride.c");
goto LABEL_34;
}
v10 = mk_temp_file(v30 * v25, &v24, &v23);
if ( v10 < 0 )
{
fprintf(stderr, "Line %3d of File %s \n", 129LL, "stride.c");
goto LABEL_34;
}
v10 = q_mmap(v24, v23, &v28, &v29, 1LL);
if ( v10 < 0 )
{
fprintf(stderr, "Line %3d of File %s \n", 130LL, "stride.c");
goto LABEL_34;
}
if ( (_DWORD)v36 == 4 )
{
v10 = func0((__int64)addr, v11, v31, v32, (__int64)v28, v30);
if ( v10 < 0 )
{
fprintf(stderr, "Line %3d of File %s \n", 136LL, "stride.c");
goto LABEL_34;
}
}
else
{
if ( (_DWORD)v36 != 5 )
{
v12 = 144LL;
goto LABEL_33;
}
v10 = func1((__int64)addr, v11, v31, v32, (__int64)v28, v30);
if ( v10 < 0 )
{
fprintf(stderr, "Line %3d of File %s \n", 141LL, "stride.c");
goto LABEL_34;
}
}
v10 = add_tbl(a5, a7, &v19, v34);
if ( v10 < 0 )
{
fprintf(stderr, "Line %3d of File %s \n", 149LL, "stride.c");
}
else
{
zero_fld_rec(v38);
v39 = v36;
v10 = add_fld(v19, a6, v24, v23, v22, v38);
if ( v10 < 0 )
fprintf(stderr, "Line %3d of File %s \n", 152LL, "stride.c");
}
LABEL_34:
if ( addr )
{
if ( len )
{
munmap(addr, len);
addr = 0LL;
len = 0LL;
goto LABEL_37;
}
LABEL_43:
v16 = 155LL;
LABEL_44:
v10 = -1;
fprintf(stderr, "Line %3d of File %s \n", v16, "stride.c");
return (unsigned int)v10;
}
if ( len )
goto LABEL_43;
LABEL_37:
if ( !v28 )
{
if ( !v29 )
return (unsigned int)v10;
goto LABEL_46;
}
if ( !v29 )
{
LABEL_46:
v16 = 156LL;
goto LABEL_44;
}
munmap(v28, v29);
return (unsigned int)v10;
}

original_code:
int
ext_stride(
    const char *t1,
    const char *f1,
    char *str_start,
    char *str_stride,
    const char *t2,
    const char *f2,
    char *str_nR2
    )
{
  int status = 0;
  char *f1_X = ((void *)0); size_t f1_nX = 0;
  char *f2_X = ((void *)0); size_t f2_nX = 0;
  long long nR1, nR2;
  TBL_REC_TYPE t1_rec; int t1_id;
  TBL_REC_TYPE t2_rec; int t2_id;
  FLD_REC_TYPE f1_rec; int f1_id;
  FLD_REC_TYPE nn_f1_rec; int nn_f1_id;
  FLD_REC_TYPE f2_rec; int f2_id;
  long long start, stride;
  int fileno = -1, ddir_id = 0x7fffffff;
  int fldsz = 0x7fffffff; size_t filesz = 0;
  int *f1I4 = ((void *)0), *f2I4 = ((void *)0);
  long long *f1I8 = ((void *)0), *f2I8 = ((void *)0);
  if ( ( t1 == ((void *)0) ) || ( *t1 == '\0' ) ) { { { fprintf(stderr, "Line %3d of File %s \n", 95, "stride.c"); }; status = -1 ; goto BYE; }; }
  if ( ( f1 == ((void *)0) ) || ( *f1 == '\0' ) ) { { { fprintf(stderr, "Line %3d of File %s \n", 96, "stride.c"); }; status = -1 ; goto BYE; }; }
  if ( ( t2 == ((void *)0) ) || ( *t2 == '\0' ) ) { { { fprintf(stderr, "Line %3d of File %s \n", 97, "stride.c"); }; status = -1 ; goto BYE; }; }
  if ( ( f2 == ((void *)0) ) || ( *f2 == '\0' ) ) { { { fprintf(stderr, "Line %3d of File %s \n", 98, "stride.c"); }; status = -1 ; goto BYE; }; }
  if ( strcmp(t1, t2) == 0 ) { { { fprintf(stderr, "Line %3d of File %s \n", 99, "stride.c"); }; status = -1 ; goto BYE; }; }
  status = stoI8(str_start, &start); { if ( (status) < 0 ) { { { fprintf(stderr, "Line %3d of File %s \n", 100, "stride.c"); }; status = (status) ; goto BYE; } } };
  status = stoI8(str_stride, &stride); { if ( (status) < 0 ) { { { fprintf(stderr, "Line %3d of File %s \n", 101, "stride.c"); }; status = (status) ; goto BYE; } } };
  nR2 = stoI8(str_nR2, &nR2); { if ( (status) < 0 ) { { { fprintf(stderr, "Line %3d of File %s \n", 102, "stride.c"); }; status = (status) ; goto BYE; } } };
  status = is_tbl(t1, &t1_id, &t1_rec); { if ( (status) < 0 ) { { { fprintf(stderr, "Line %3d of File %s \n", 104, "stride.c"); }; status = (status) ; goto BYE; } } };
  nR1 = t1_rec.nR;
  status = is_fld(t1, -1, f1, &f1_id, &f1_rec, &nn_f1_id, &nn_f1_rec);
  { if ( (status) < 0 ) { { { fprintf(stderr, "Line %3d of File %s \n", 107, "stride.c"); }; status = (status) ; goto BYE; } } };
  status = get_data(f1_rec, &f1_X, &f1_nX, 0); { if ( (status) < 0 ) { { { fprintf(stderr, "Line %3d of File %s \n", 108, "stride.c"); }; status = (status) ; goto BYE; } } };
  if ( nn_f1_id >= 0 ) { { { fprintf(stderr, "Line %3d of File %s \n", 109, "stride.c"); }; status = -1 ; goto BYE; }; }
  status = del_tbl(t2, -1); { if ( (status) < 0 ) { { { fprintf(stderr, "Line %3d of File %s \n", 110, "stride.c"); }; status = (status) ; goto BYE; } } };
  if ( ( f1_rec.fldtype == I4 ) || ( f1_rec.fldtype == I8 ) ) {
  }
  else {
    { { fprintf(stderr, "Line %3d of File %s \n", 115, "stride.c"); }; status = -1 ; goto BYE; };
  }
  if ( ( start < 0 ) || ( start >= nR1 ) ) { { { fprintf(stderr, "Line %3d of File %s \n", 118, "stride.c"); }; status = -1 ; goto BYE; }; }
  if ( ( stride <= 1 ) || ( stride >= nR1 ) ) { { { fprintf(stderr, "Line %3d of File %s \n", 119, "stride.c"); }; status = -1 ; goto BYE; }; }
  if ( nR2 < 1 ) { { { fprintf(stderr, "Line %3d of File %s \n", 120, "stride.c"); }; status = -1 ; goto BYE; }; }
  while ( start + (stride * nR2) > nR1 ) { nR2--; }
  if ( nR2 < 1 ) { { { fprintf(stderr, "Line %3d of File %s \n", 124, "stride.c"); }; status = -1 ; goto BYE; }; }
  status = get_fld_sz(f1_rec.fldtype, &fldsz); { if ( (status) < 0 ) { { { fprintf(stderr, "Line %3d of File %s \n", 127, "stride.c"); }; status = (status) ; goto BYE; } } };
  filesz = fldsz * nR2;
  status = mk_temp_file(filesz, &ddir_id, &fileno); { if ( (status) < 0 ) { { { fprintf(stderr, "Line %3d of File %s \n", 129, "stride.c"); }; status = (status) ; goto BYE; } } };
  status = q_mmap(ddir_id, fileno, &f2_X, &f2_nX, 1); { if ( (status) < 0 ) { { { fprintf(stderr, "Line %3d of File %s \n", 130, "stride.c"); }; status = (status) ; goto BYE; } } };
  switch ( f1_rec.fldtype ) {
    case I4 :
      f1I4 = (int *)f1_X;
      f2I4 = (int *)f2_X;
      status = stride_I4(f1I4, nR1, start, stride, f2I4, nR2); { if ( (status) < 0 ) { { { fprintf(stderr, "Line %3d of File %s \n", 136, "stride.c"); }; status = (status) ; goto BYE; } } };
      break;
    case I8 :
      f1I8 = (long long *)f1_X;
      f2I8 = (long long *)f2_X;
      status = stride_I8(f1I8, nR1, start, stride, f2I8, nR2); { if ( (status) < 0 ) { { { fprintf(stderr, "Line %3d of File %s \n", 141, "stride.c"); }; status = (status) ; goto BYE; } } };
      break;
    default :
      { { fprintf(stderr, "Line %3d of File %s \n", 144, "stride.c"); }; status = -1 ; goto BYE; };
      break;
  }
  { if ( (status) < 0 ) { { { fprintf(stderr, "Line %3d of File %s \n", 147, "stride.c"); }; status = (status) ; goto BYE; } } };
  status = add_tbl(t2, str_nR2, &t2_id, &t2_rec); { if ( (status) < 0 ) { { { fprintf(stderr, "Line %3d of File %s \n", 149, "stride.c"); }; status = (status) ; goto BYE; } } };
  zero_fld_rec(&f2_rec); f2_rec.fldtype = f1_rec.fldtype;
  status = add_fld(t2_id, f2, ddir_id, fileno, &f2_id, &f2_rec);
  { if ( (status) < 0 ) { { { fprintf(stderr, "Line %3d of File %s \n", 152, "stride.c"); }; status = (status) ; goto BYE; } } };
 BYE:
  { if ( ( f1_X == ((void *)0) ) && ( f1_nX != 0 ) ) { { fprintf(stderr, "Line %3d of File %s \n", 155, "stride.c"); }; return(-1); } if ( ( f1_X != ((void *)0) ) && ( f1_nX == 0 ) ) { { fprintf(stderr, "Line %3d of File %s \n", 155, "stride.c"); }; return(-1); } if ( f1_X != ((void *)0) ) { munmap(f1_X, f1_nX); f1_X = ((void *)0); f1_nX = 0; } };
  { if ( ( f2_X == ((void *)0) ) && ( f2_nX != 0 ) ) { { fprintf(stderr, "Line %3d of File %s \n", 156, "stride.c"); }; return(-1); } if ( ( f2_X != ((void *)0) ) && ( f2_nX == 0 ) ) { { fprintf(stderr, "Line %3d of File %s \n", 156, "stride.c"); }; return(-1); } if ( f2_X != ((void *)0) ) { munmap(f2_X, f2_nX); f2_X = ((void *)0); f2_nX = 0; } };
  return status ;
}

canonical_original_code:
int ext_stride(char *t1, char *f1, char *str_start, char *str_stride, char *t2, char *f2, char *str_nR2)
{
  int status = 0;
  char *f1_X = ((void *)0); unsigned long f1_nX = 0;
  char *f2_X = ((void *)0); unsigned long f2_nX = 0;
  long long nR1; long long nR2;
  struct _TBL_REC_TYPE t1_rec; int t1_id;
  struct _TBL_REC_TYPE t2_rec; int t2_id;
  struct _FLD_REC_TYPE f1_rec; int f1_id;
  struct _FLD_REC_TYPE nn_f1_rec; int nn_f1_id;
  struct _FLD_REC_TYPE f2_rec; int f2_id;
  long long start; long long stride;
  int fileno = -1; int ddir_id = 0x7fffffff;
  int fldsz = 0x7fffffff; unsigned long filesz = 0;
  int *f1I4 = ((void *)0); int *f2I4 = ((void *)0);
  long long *f1I8 = ((void *)0); long long *f2I8 = ((void *)0);
  if ( ( t1 == ((void *)0) ) || ( *t1 == '\0' ) ) { { { fprintf(stderr, "Line %3d of File %s \n", 95, "stride.c"); }; status = -1 ; goto BYE; }; }
  if ( ( f1 == ((void *)0) ) || ( *f1 == '\0' ) ) { { { fprintf(stderr, "Line %3d of File %s \n", 96, "stride.c"); }; status = -1 ; goto BYE; }; }
  if ( ( t2 == ((void *)0) ) || ( *t2 == '\0' ) ) { { { fprintf(stderr, "Line %3d of File %s \n", 97, "stride.c"); }; status = -1 ; goto BYE; }; }
  if ( ( f2 == ((void *)0) ) || ( *f2 == '\0' ) ) { { { fprintf(stderr, "Line %3d of File %s \n", 98, "stride.c"); }; status = -1 ; goto BYE; }; }
  if ( strcmp(t1, t2) == 0 ) { { { fprintf(stderr, "Line %3d of File %s \n", 99, "stride.c"); }; status = -1 ; goto BYE; }; }
  status = stoI8(str_start, &start); { if ( (status) < 0 ) { { { fprintf(stderr, "Line %3d of File %s \n", 100, "stride.c"); }; status = (status) ; goto BYE; } } };
  status = stoI8(str_stride, &stride); { if ( (status) < 0 ) { { { fprintf(stderr, "Line %3d of File %s \n", 101, "stride.c"); }; status = (status) ; goto BYE; } } };
  nR2 = stoI8(str_nR2, &nR2); { if ( (status) < 0 ) { { { fprintf(stderr, "Line %3d of File %s \n", 102, "stride.c"); }; status = (status) ; goto BYE; } } };
  status = is_tbl(t1, &t1_id, &t1_rec); { if ( (status) < 0 ) { { { fprintf(stderr, "Line %3d of File %s \n", 104, "stride.c"); }; status = (status) ; goto BYE; } } };
  nR1 = t1_rec.nR;
  status = is_fld(t1, -1, f1, &f1_id, &f1_rec, &nn_f1_id, &nn_f1_rec);
  { if ( (status) < 0 ) { { { fprintf(stderr, "Line %3d of File %s \n", 107, "stride.c"); }; status = (status) ; goto BYE; } } };
  status = get_data(f1_rec, &f1_X, &f1_nX, 0); { if ( (status) < 0 ) { { { fprintf(stderr, "Line %3d of File %s \n", 108, "stride.c"); }; status = (status) ; goto BYE; } } };
  if ( nn_f1_id >= 0 ) { { { fprintf(stderr, "Line %3d of File %s \n", 109, "stride.c"); }; status = -1 ; goto BYE; }; }
  status = del_tbl(t2, -1); { if ( (status) < 0 ) { { { fprintf(stderr, "Line %3d of File %s \n", 110, "stride.c"); }; status = (status) ; goto BYE; } } };
  if ( ( f1_rec.fldtype == I4 ) || ( f1_rec.fldtype == I8 ) ) {
  }
  else {
    { { fprintf(stderr, "Line %3d of File %s \n", 115, "stride.c"); }; status = -1 ; goto BYE; };
  }
  if ( ( start < 0 ) || ( start >= nR1 ) ) { { { fprintf(stderr, "Line %3d of File %s \n", 118, "stride.c"); }; status = -1 ; goto BYE; }; }
  if ( ( stride <= 1 ) || ( stride >= nR1 ) ) { { { fprintf(stderr, "Line %3d of File %s \n", 119, "stride.c"); }; status = -1 ; goto BYE; }; }
  if ( nR2 < 1 ) { { { fprintf(stderr, "Line %3d of File %s \n", 120, "stride.c"); }; status = -1 ; goto BYE; }; }
  while ( start + (stride * nR2) > nR1 ) { nR2--; }
  if ( nR2 < 1 ) { { { fprintf(stderr, "Line %3d of File %s \n", 124, "stride.c"); }; status = -1 ; goto BYE; }; }
  status = get_fld_sz(f1_rec.fldtype, &fldsz); { if ( (status) < 0 ) { { { fprintf(stderr, "Line %3d of File %s \n", 127, "stride.c"); }; status = (status) ; goto BYE; } } };
  filesz = fldsz * nR2;
  status = mk_temp_file(filesz, &ddir_id, &fileno); { if ( (status) < 0 ) { { { fprintf(stderr, "Line %3d of File %s \n", 129, "stride.c"); }; status = (status) ; goto BYE; } } };
  status = q_mmap(ddir_id, fileno, &f2_X, &f2_nX, 1); { if ( (status) < 0 ) { { { fprintf(stderr, "Line %3d of File %s \n", 130, "stride.c"); }; status = (status) ; goto BYE; } } };
  switch ( f1_rec.fldtype ) {
    case I4 :
      f1I4 = (int *)f1_X;
      f2I4 = (int *)f2_X;
      status = stride_I4(f1I4, nR1, start, stride, f2I4, nR2); { if ( (status) < 0 ) { { { fprintf(stderr, "Line %3d of File %s \n", 136, "stride.c"); }; status = (status) ; goto BYE; } } };
      break;
    case I8 :
      f1I8 = (long long *)f1_X;
      f2I8 = (long long *)f2_X;
      status = stride_I8(f1I8, nR1, start, stride, f2I8, nR2); { if ( (status) < 0 ) { { { fprintf(stderr, "Line %3d of File %s \n", 141, "stride.c"); }; status = (status) ; goto BYE; } } };
      break;
    default :
      { { fprintf(stderr, "Line %3d of File %s \n", 144, "stride.c"); }; status = -1 ; goto BYE; };
      break;
  }
  { if ( (status) < 0 ) { { { fprintf(stderr, "Line %3d of File %s \n", 147, "stride.c"); }; status = (status) ; goto BYE; } } };
  status = add_tbl(t2, str_nR2, &t2_id, &t2_rec); { if ( (status) < 0 ) { { { fprintf(stderr, "Line %3d of File %s \n", 149, "stride.c"); }; status = (status) ; goto BYE; } } };
  zero_fld_rec(&f2_rec); f2_rec.fldtype = f1_rec.fldtype;
  status = add_fld(t2_id, f2, ddir_id, fileno, &f2_id, &f2_rec);
  { if ( (status) < 0 ) { { { fprintf(stderr, "Line %3d of File %s \n", 152, "stride.c"); }; status = (status) ; goto BYE; } } };
 BYE:
  { if ( ( f1_X == ((void *)0) ) && ( f1_nX != 0 ) ) { { fprintf(stderr, "Line %3d of File %s \n", 155, "stride.c"); }; return(-1); } if ( ( f1_X != ((void *)0) ) && ( f1_nX == 0 ) ) { { fprintf(stderr, "Line %3d of File %s \n", 155, "stride.c"); }; return(-1); } if ( f1_X != ((void *)0) ) { munmap(f1_X, f1_nX); f1_X = ((void *)0); f1_nX = 0; } };
  { if ( ( f2_X == ((void *)0) ) && ( f2_nX != 0 ) ) { { fprintf(stderr, "Line %3d of File %s \n", 156, "stride.c"); }; return(-1); } if ( ( f2_X != ((void *)0) ) && ( f2_nX == 0 ) ) { { fprintf(stderr, "Line %3d of File %s \n", 156, "stride.c"); }; return(-1); } if ( f2_X != ((void *)0) ) { munmap(f2_X, f2_nX); f2_X = ((void *)0); f2_nX = 0; } };
  return status ;
}

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

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

variable_types: fileno int

variable_types: fldsz int

variable_types:
filesz
unsigned long

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 g_shift(const char *a1, const char *a2, const char *a3, const char *a4)
{
int v6; // er15
char *v7; // rax
char *v8; // rdi
__int64 v10; // rdx
_BYTE v11[712]; // [rsp-590h] [rbp-17B8h] BYREF
_BYTE v12[712]; // [rsp-2C8h] [rbp-14F0h] BYREF
char *v13; // [rsp+8h] [rbp-1220h]
int v14; // [rsp+14h] [rbp-1214h] BYREF
int v15; // [rsp+18h] [rbp-1210h] BYREF
unsigned int v16; // [rsp+1Ch] [rbp-120Ch] BYREF
char *haystack; // [rsp+20h] [rbp-1208h] BYREF
__int64 v18; // [rsp+28h] [rbp-1200h] BYREF
__int64 v19; // [rsp+30h] [rbp-11F8h] BYREF
__int64 v20; // [rsp+38h] [rbp-11F0h] BYREF
__int64 v21; // [rsp+40h] [rbp-11E8h] BYREF
__int64 v22; // [rsp+48h] [rbp-11E0h] BYREF
__int64 v23[90]; // [rsp+50h] [rbp-11D8h] BYREF
__int64 v24[90]; // [rsp+320h] [rbp-F08h] BYREF
char s[1024]; // [rsp+5F0h] [rbp-C38h] BYREF
char v26[2104]; // [rsp+9F0h] [rbp-838h] BYREF

v14 = -1;
v15 = -1;
haystack = 0LL;
v18 = 0LL;
v19 = 0LL;
v20 = 0LL;
v21 = 0LL;
v22 = 0LL;
v16 = 0;
g_mmap_meta_data(&g_docroot, &v20, &v21, &v22, &v16);
if ( !a3 || !*a3 )
{
v10 = 43LL;
goto LABEL_41;
}
if ( !a4 || !*a4 )
{
v10 = 44LL;
goto LABEL_41;
}
if ( !a1 || !*a1 )
{
v10 = 45LL;
goto LABEL_41;
}
if ( !a2 || !*a2 )
{
v10 = 46LL;
LABEL_41:
v6 = -1;
fprintf(stderr, "Line %3d of File %s \n", v10, "g_shift.c");
goto LABEL_30;
}
v6 = g_is_fld(v22, v16, a1, &v14, v23);
if ( v6 < 0 )
{
fprintf(stderr, "Line %3d of File %s \n", 48LL, "g_shift.c");
goto LABEL_30;
}
if ( v14 < 0 )
{
v10 = 49LL;
goto LABEL_41;
}
if ( !(unsigned int)is_fldtype_goodfor_gpu(LODWORD(v23[4])) )
{
v6 = -1;
fprintf(stderr, "Line %3d of File %s \n", 50LL, "g_shift.c");
goto LABEL_30;
}
v6 = g_is_fld(v22, v16, a2, &v15, v24);
if ( v6 < 0 )
{
fprintf(stderr, "Line %3d of File %s \n", 52LL, "g_shift.c");
goto LABEL_30;
}
if ( v15 < 0 )
{
v10 = 53LL;
goto LABEL_41;
}
if ( !(unsigned int)is_fldtype_goodfor_gpu(LODWORD(v24[4])) )
{
v6 = -1;
fprintf(stderr, "Line %3d of File %s \n", 54LL, "g_shift.c");
goto LABEL_30;
}
if ( !v23[1] )
{
v10 = 56LL;
goto LABEL_41;
}
if ( !v23[3] )
{
v10 = 57LL;
goto LABEL_41;
}
if ( !v24[1] )
{
v10 = 58LL;
goto LABEL_41;
}
if ( !v24[3] )
{
v10 = 59LL;
goto LABEL_41;
}
v6 = stoI8(a3, &v18);
if ( v6 < 0 )
{
fprintf(stderr, "Line %3d of File %s \n", 60LL, "g_shift.c");
goto LABEL_30;
}
qmemcpy(v12, v24, sizeof(v12));
qmemcpy(v11, v23, sizeof(v11));
v6 = g_chk_shift(v18, v19);
if ( v6 < 0 )
{
fprintf(stderr, "Line %3d of File %s \n", 61LL, "g_shift.c");
goto LABEL_30;
}
v6 = stoI8(a3, &v18);
if ( v6 < 0 )
{
fprintf(stderr, "Line %3d of File %s \n", 62LL, "g_shift.c");
goto LABEL_30;
}
if ( (unsigned __int64)(v18 + 16) > 0x20 )
{
v10 = 64LL;
goto LABEL_41;
}
v6 = stoI8(a4, &v19);
if ( v6 < 0 )
{
fprintf(stderr, "Line %3d of File %s \n", 66LL, "g_shift.c");
}
else
{
zero_string(v26, 2048LL);
zero_string(s, 1024LL);
sprintf(s, "f1_shift_f2 d_fld1=%s d_fld2=%s shift_amt=%s newval=%s", a1, a2, a3, a4);
v6 = g_make_url(s, v26);
if ( v6 < 0 )
{
fprintf(stderr, "Line %3d of File %s \n", 72LL, "g_shift.c");
}
else
{
v6 = g_call_gpu(v26, &haystack);
if ( v6 < 0 )
{
fprintf(stderr, "Line %3d of File %s \n", 73LL, "g_shift.c");
}
else
{
if ( !haystack )
goto LABEL_32;
v13 = haystack;
v7 = strstr(haystack, "\"\"");
v8 = v13;
if ( v7 )
{
LABEL_31:
free(v8);
haystack = 0LL;
goto LABEL_32;
}
fprintf(stderr, "Response from GPU = [%s]\n", v13);
}
}
}
LABEL_30:
v8 = haystack;
if ( haystack )
goto LABEL_31;
LABEL_32:
g_unmap_meta_data(v20, v21);
return (unsigned int)v6;
}

canonical_decompiled_code:
__int64 __fastcall func0(const char *a1, const char *a2, const char *a3, const char *a4)
{
int v6; // er15
char *v7; // rax
char *v8; // rdi
__int64 v10; // rdx
_BYTE v11[712]; // [rsp-590h] [rbp-17B8h] BYREF
_BYTE v12[712]; // [rsp-2C8h] [rbp-14F0h] BYREF
char *v13; // [rsp+8h] [rbp-1220h]
int v14; // [rsp+14h] [rbp-1214h] BYREF
int v15; // [rsp+18h] [rbp-1210h] BYREF
unsigned int v16; // [rsp+1Ch] [rbp-120Ch] BYREF
char *haystack; // [rsp+20h] [rbp-1208h] BYREF
__int64 v18; // [rsp+28h] [rbp-1200h] BYREF
__int64 v19; // [rsp+30h] [rbp-11F8h] BYREF
__int64 v20; // [rsp+38h] [rbp-11F0h] BYREF
__int64 v21; // [rsp+40h] [rbp-11E8h] BYREF
__int64 v22; // [rsp+48h] [rbp-11E0h] BYREF
__int64 v23[90]; // [rsp+50h] [rbp-11D8h] BYREF
__int64 v24[90]; // [rsp+320h] [rbp-F08h] BYREF
char s[1024]; // [rsp+5F0h] [rbp-C38h] BYREF
char v26[2104]; // [rsp+9F0h] [rbp-838h] BYREF

v14 = -1;
v15 = -1;
haystack = 0LL;
v18 = 0LL;
v19 = 0LL;
v20 = 0LL;
v21 = 0LL;
v22 = 0LL;
v16 = 0;
g_mmap_meta_data(&g_docroot, &v20, &v21, &v22, &v16);
if ( !a3 || !*a3 )
{
v10 = 43LL;
goto LABEL_41;
}
if ( !a4 || !*a4 )
{
v10 = 44LL;
goto LABEL_41;
}
if ( !a1 || !*a1 )
{
v10 = 45LL;
goto LABEL_41;
}
if ( !a2 || !*a2 )
{
v10 = 46LL;
LABEL_41:
v6 = -1;
fprintf(stderr, "Line %3d of File %s \n", v10, "g_shift.c");
goto LABEL_30;
}
v6 = g_is_fld(v22, v16, a1, &v14, v23);
if ( v6 < 0 )
{
fprintf(stderr, "Line %3d of File %s \n", 48LL, "g_shift.c");
goto LABEL_30;
}
if ( v14 < 0 )
{
v10 = 49LL;
goto LABEL_41;
}
if ( !(unsigned int)is_fldtype_goodfor_gpu(LODWORD(v23[4])) )
{
v6 = -1;
fprintf(stderr, "Line %3d of File %s \n", 50LL, "g_shift.c");
goto LABEL_30;
}
v6 = g_is_fld(v22, v16, a2, &v15, v24);
if ( v6 < 0 )
{
fprintf(stderr, "Line %3d of File %s \n", 52LL, "g_shift.c");
goto LABEL_30;
}
if ( v15 < 0 )
{
v10 = 53LL;
goto LABEL_41;
}
if ( !(unsigned int)is_fldtype_goodfor_gpu(LODWORD(v24[4])) )
{
v6 = -1;
fprintf(stderr, "Line %3d of File %s \n", 54LL, "g_shift.c");
goto LABEL_30;
}
if ( !v23[1] )
{
v10 = 56LL;
goto LABEL_41;
}
if ( !v23[3] )
{
v10 = 57LL;
goto LABEL_41;
}
if ( !v24[1] )
{
v10 = 58LL;
goto LABEL_41;
}
if ( !v24[3] )
{
v10 = 59LL;
goto LABEL_41;
}
v6 = stoI8(a3, &v18);
if ( v6 < 0 )
{
fprintf(stderr, "Line %3d of File %s \n", 60LL, "g_shift.c");
goto LABEL_30;
}
qmemcpy(v12, v24, sizeof(v12));
qmemcpy(v11, v23, sizeof(v11));
v6 = g_chk_shift(v18, v19);
if ( v6 < 0 )
{
fprintf(stderr, "Line %3d of File %s \n", 61LL, "g_shift.c");
goto LABEL_30;
}
v6 = stoI8(a3, &v18);
if ( v6 < 0 )
{
fprintf(stderr, "Line %3d of File %s \n", 62LL, "g_shift.c");
goto LABEL_30;
}
if ( (unsigned __int64)(v18 + 16) > 0x20 )
{
v10 = 64LL;
goto LABEL_41;
}
v6 = stoI8(a4, &v19);
if ( v6 < 0 )
{
fprintf(stderr, "Line %3d of File %s \n", 66LL, "g_shift.c");
}
else
{
zero_string(v26, 2048LL);
zero_string(s, 1024LL);
sprintf(s, "f1_shift_f2 d_fld1=%s d_fld2=%s shift_amt=%s newval=%s", a1, a2, a3, a4);
v6 = g_make_url(s, v26);
if ( v6 < 0 )
{
fprintf(stderr, "Line %3d of File %s \n", 72LL, "g_shift.c");
}
else
{
v6 = g_call_gpu(v26, &haystack);
if ( v6 < 0 )
{
fprintf(stderr, "Line %3d of File %s \n", 73LL, "g_shift.c");
}
else
{
if ( !haystack )
goto LABEL_32;
v13 = haystack;
v7 = strstr(haystack, "\"\"");
v8 = v13;
if ( v7 )
{
LABEL_31:
free(v8);
haystack = 0LL;
goto LABEL_32;
}
fprintf(stderr, "Response from GPU = [%s]\n", v13);
}
}
}
LABEL_30:
v8 = haystack;
if ( haystack )
goto LABEL_31;
LABEL_32:
g_unmap_meta_data(v20, v21);
return (unsigned int)v6;
}

original_code:
int
g_shift(
    char *f1,
    char *f2,
    char *str_shift_amt,
    char *str_newval
    )
{
  int status = 0;
  int f1_id = -1; GPU_REG_TYPE f1_rec;
  int f2_id = -1; GPU_REG_TYPE f2_rec;
  char *curl_response = ((void *)0);
  long long shift_amt = 0, newval = 0;
  char *gpu_reg_X = ((void *)0);
  size_t gpu_reg_nX = 0;
  GPU_REG_TYPE *gpu_reg = ((void *)0);
  int n_gpu_reg = 0;
  status = g_mmap_meta_data(g_docroot, &gpu_reg_X, &gpu_reg_nX,
      &gpu_reg, &n_gpu_reg);
  if ( ( str_shift_amt == ((void *)0) ) || ( *str_shift_amt == '\0' ) ) { { { fprintf(stderr, "Line %3d of File %s \n", 43, "g_shift.c"); }; status = -1 ; goto BYE; }; }
  if ( ( str_newval == ((void *)0) ) || ( *str_newval == '\0' ) ) { { { fprintf(stderr, "Line %3d of File %s \n", 44, "g_shift.c"); }; status = -1 ; goto BYE; }; }
  if ( ( f1 == ((void *)0) ) || ( *f1 == '\0' ) ) { { { fprintf(stderr, "Line %3d of File %s \n", 45, "g_shift.c"); }; status = -1 ; goto BYE; }; }
  if ( ( f2 == ((void *)0) ) || ( *f2 == '\0' ) ) { { { fprintf(stderr, "Line %3d of File %s \n", 46, "g_shift.c"); }; status = -1 ; goto BYE; }; }
  status = g_is_fld(gpu_reg, n_gpu_reg, f1, &f1_id, &f1_rec); { if ( (status) < 0 ) { { { fprintf(stderr, "Line %3d of File %s \n", 48, "g_shift.c"); }; status = (status) ; goto BYE; } } };
  if ( f1_id < 0 ) { { { fprintf(stderr, "Line %3d of File %s \n", 49, "g_shift.c"); }; status = -1 ; goto BYE; }; }
  if ( is_fldtype_goodfor_gpu(f1_rec.fldtype) == 0 ) { { { fprintf(stderr, "Line %3d of File %s \n", 50, "g_shift.c"); }; status = -1 ; goto BYE; }; }
  status = g_is_fld(gpu_reg, n_gpu_reg, f2, &f2_id, &f2_rec); { if ( (status) < 0 ) { { { fprintf(stderr, "Line %3d of File %s \n", 52, "g_shift.c"); }; status = (status) ; goto BYE; } } };
  if ( f2_id < 0 ) { { { fprintf(stderr, "Line %3d of File %s \n", 53, "g_shift.c"); }; status = -1 ; goto BYE; }; }
  if ( is_fldtype_goodfor_gpu(f2_rec.fldtype) == 0 ) { { { fprintf(stderr, "Line %3d of File %s \n", 54, "g_shift.c"); }; status = -1 ; goto BYE; }; }
  if ( f1_rec.filesz == 0 ) { { { fprintf(stderr, "Line %3d of File %s \n", 56, "g_shift.c"); }; status = -1 ; goto BYE; }; }
  if ( f1_rec.nR == 0 ) { { { fprintf(stderr, "Line %3d of File %s \n", 57, "g_shift.c"); }; status = -1 ; goto BYE; }; }
  if ( f2_rec.filesz == 0 ) { { { fprintf(stderr, "Line %3d of File %s \n", 58, "g_shift.c"); }; status = -1 ; goto BYE; }; }
  if ( f2_rec.nR == 0 ) { { { fprintf(stderr, "Line %3d of File %s \n", 59, "g_shift.c"); }; status = -1 ; goto BYE; }; }
 status = stoI8(str_shift_amt, &shift_amt); { if ( (status) < 0 ) { { { fprintf(stderr, "Line %3d of File %s \n", 60, "g_shift.c"); }; status = (status) ; goto BYE; } } };
  status = g_chk_shift(f1_rec, f2_rec, shift_amt, newval); { if ( (status) < 0 ) { { { fprintf(stderr, "Line %3d of File %s \n", 61, "g_shift.c"); }; status = (status) ; goto BYE; } } };
  status = stoI8(str_shift_amt, &shift_amt); { if ( (status) < 0 ) { { { fprintf(stderr, "Line %3d of File %s \n", 62, "g_shift.c"); }; status = (status) ; goto BYE; } } };
  if ( ( shift_amt < (-1 * 16) ) || ( shift_amt > 16 ) ) {
    { { fprintf(stderr, "Line %3d of File %s \n", 64, "g_shift.c"); }; status = -1 ; goto BYE; };
  }
  status = stoI8(str_newval, &newval); { if ( (status) < 0 ) { { { fprintf(stderr, "Line %3d of File %s \n", 66, "g_shift.c"); }; status = (status) ; goto BYE; } } };
  char url[2048]; zero_string(url, 2048);
  char command[1024]; zero_string(command, 1024);
  sprintf(command, "f1_shift_f2 d_fld1=%s d_fld2=%s shift_amt=%s newval=%s",
      f1, f2, str_shift_amt, str_newval);
  status = g_make_url(command, url); { if ( (status) < 0 ) { { { fprintf(stderr, "Line %3d of File %s \n", 72, "g_shift.c"); }; status = (status) ; goto BYE; } } };
  status = g_call_gpu(url, &curl_response); { if ( (status) < 0 ) { { { fprintf(stderr, "Line %3d of File %s \n", 73, "g_shift.c"); }; status = (status) ; goto BYE; } } };
  if ( curl_response != ((void *)0) ) {
    if ( strstr(curl_response, "\"\"") == ((void *)0) ) {
      fprintf(stderr, "Response from GPU = [%s]\n", curl_response);
    }
  }
BYE:
  { if ( (curl_response) != ((void *)0) ) { free((curl_response)); (curl_response) = ((void *)0); } };
  g_unmap_meta_data(gpu_reg_X, gpu_reg_nX);
  return(status);
}

canonical_original_code:
int g_shift(char *f1, char *f2, char *str_shift_amt, char *str_newval)
{
  int status = 0;
  int f1_id = -1; struct _GPU_REG_TYPE f1_rec;
  int f2_id = -1; struct _GPU_REG_TYPE f2_rec;
  char *curl_response = ((void *)0);
  long long shift_amt = 0; long long newval = 0;
  char *gpu_reg_X = ((void *)0);
  unsigned long gpu_reg_nX = 0;
  struct _GPU_REG_TYPE *gpu_reg = ((void *)0);
  int n_gpu_reg = 0;
  status = g_mmap_meta_data(g_docroot, &gpu_reg_X, &gpu_reg_nX,
      &gpu_reg, &n_gpu_reg);
  if ( ( str_shift_amt == ((void *)0) ) || ( *str_shift_amt == '\0' ) ) { { { fprintf(stderr, "Line %3d of File %s \n", 43, "g_shift.c"); }; status = -1 ; goto BYE; }; }
  if ( ( str_newval == ((void *)0) ) || ( *str_newval == '\0' ) ) { { { fprintf(stderr, "Line %3d of File %s \n", 44, "g_shift.c"); }; status = -1 ; goto BYE; }; }
  if ( ( f1 == ((void *)0) ) || ( *f1 == '\0' ) ) { { { fprintf(stderr, "Line %3d of File %s \n", 45, "g_shift.c"); }; status = -1 ; goto BYE; }; }
  if ( ( f2 == ((void *)0) ) || ( *f2 == '\0' ) ) { { { fprintf(stderr, "Line %3d of File %s \n", 46, "g_shift.c"); }; status = -1 ; goto BYE; }; }
  status = g_is_fld(gpu_reg, n_gpu_reg, f1, &f1_id, &f1_rec); { if ( (status) < 0 ) { { { fprintf(stderr, "Line %3d of File %s \n", 48, "g_shift.c"); }; status = (status) ; goto BYE; } } };
  if ( f1_id < 0 ) { { { fprintf(stderr, "Line %3d of File %s \n", 49, "g_shift.c"); }; status = -1 ; goto BYE; }; }
  if ( is_fldtype_goodfor_gpu(f1_rec.fldtype) == 0 ) { { { fprintf(stderr, "Line %3d of File %s \n", 50, "g_shift.c"); }; status = -1 ; goto BYE; }; }
  status = g_is_fld(gpu_reg, n_gpu_reg, f2, &f2_id, &f2_rec); { if ( (status) < 0 ) { { { fprintf(stderr, "Line %3d of File %s \n", 52, "g_shift.c"); }; status = (status) ; goto BYE; } } };
  if ( f2_id < 0 ) { { { fprintf(stderr, "Line %3d of File %s \n", 53, "g_shift.c"); }; status = -1 ; goto BYE; }; }
  if ( is_fldtype_goodfor_gpu(f2_rec.fldtype) == 0 ) { { { fprintf(stderr, "Line %3d of File %s \n", 54, "g_shift.c"); }; status = -1 ; goto BYE; }; }
  if ( f1_rec.filesz == 0 ) { { { fprintf(stderr, "Line %3d of File %s \n", 56, "g_shift.c"); }; status = -1 ; goto BYE; }; }
  if ( f1_rec.nR == 0 ) { { { fprintf(stderr, "Line %3d of File %s \n", 57, "g_shift.c"); }; status = -1 ; goto BYE; }; }
  if ( f2_rec.filesz == 0 ) { { { fprintf(stderr, "Line %3d of File %s \n", 58, "g_shift.c"); }; status = -1 ; goto BYE; }; }
  if ( f2_rec.nR == 0 ) { { { fprintf(stderr, "Line %3d of File %s \n", 59, "g_shift.c"); }; status = -1 ; goto BYE; }; }
 status = stoI8(str_shift_amt, &shift_amt); { if ( (status) < 0 ) { { { fprintf(stderr, "Line %3d of File %s \n", 60, "g_shift.c"); }; status = (status) ; goto BYE; } } };
  status = g_chk_shift(f1_rec, f2_rec, shift_amt, newval); { if ( (status) < 0 ) { { { fprintf(stderr, "Line %3d of File %s \n", 61, "g_shift.c"); }; status = (status) ; goto BYE; } } };
  status = stoI8(str_shift_amt, &shift_amt); { if ( (status) < 0 ) { { { fprintf(stderr, "Line %3d of File %s \n", 62, "g_shift.c"); }; status = (status) ; goto BYE; } } };
  if ( ( shift_amt < (-1 * 16) ) || ( shift_amt > 16 ) ) {
    { { fprintf(stderr, "Line %3d of File %s \n", 64, "g_shift.c"); }; status = -1 ; goto BYE; };
  }
  status = stoI8(str_newval, &newval); { if ( (status) < 0 ) { { { fprintf(stderr, "Line %3d of File %s \n", 66, "g_shift.c"); }; status = (status) ; goto BYE; } } };
  char url[2048]; zero_string(url, 2048);
  char command[1024]; zero_string(command, 1024);
  sprintf(command, "f1_shift_f2 d_fld1=%s d_fld2=%s shift_amt=%s newval=%s",
      f1, f2, str_shift_amt, str_newval);
  status = g_make_url(command, url); { if ( (status) < 0 ) { { { fprintf(stderr, "Line %3d of File %s \n", 72, "g_shift.c"); }; status = (status) ; goto BYE; } } };
  status = g_call_gpu(url, &curl_response); { if ( (status) < 0 ) { { { fprintf(stderr, "Line %3d of File %s \n", 73, "g_shift.c"); }; status = (status) ; goto BYE; } } };
  if ( curl_response != ((void *)0) ) {
    if ( strstr(curl_response, "\"\"") == ((void *)0) ) {
      fprintf(stderr, "Response from GPU = [%s]\n", curl_response);
    }
  }
BYE:
  { if ( (curl_response) != ((void *)0) ) { free((curl_response)); (curl_response) = ((void *)0); } };
  g_unmap_meta_data(gpu_reg_X, gpu_reg_nX);
  return(status);
}

variable_types:
newval
long long

variable_types: struct _GPU_REG_TYPE { void *reg; unsigned long filesz; _Bool is_busy; long long nR; enum _FLD_TYPE { undef_fldtype=0, B=1, I1=2, I2=3, I4=4, I8=5, F4=6, F8=7, SC=8, SV=9 } fldtype; char filename[-1]; char tbl[-1]; char h_fld[-1]; char d_fld[-1]; } *

variable_types:
url
char [2048]

variable_types:
command
char [1024]

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


original_code:
void
mul2_F8(
       double *in1,
       double *in2,
       long long nR,
       double * restrict out
       )
{
  double 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 mul2_F8(double *in1, double *in2, long long nR, double *out)
{
  double inv1; double inv2; double 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
double *

variable_types: outv double