wfaDecodeTLV

decompiled_code:
__int64 __fastcall wfaDecodeTLV(__int64 a1, int a2, _BYTE *a3, _DWORD *a4, _QWORD *a5)
{
__int64 v5; // rdx
unsigned int v6; // er9
__int64 result; // rax
__int64 v8; // rsi

if ( a5 )
{
*a3 = *(_WORD *)a1;
v5 = *(unsigned __int16 *)(a1 + 2);
*a4 = v5;
if ( (int)v5 > a2 )
return (unsigned int)-1;
v6 = 0;
if ( (unsigned __int16)(v5 - 1) > 0x1FEu )
return v6;
v8 = a1 + 4;
if ( (unsigned int)v5 >= 8 )
{
*a5 = *(_QWORD *)(a1 + 4);
*(_QWORD *)((char *)a5 + v5 - 8) = *(_QWORD *)(v8 + v5 - 8);
qmemcpy(
(void *)((unsigned __int64)(a5 + 1) & 0xFFFFFFFFFFFFFFF8LL),
(const void *)(v8 - ((_QWORD)a5 - ((unsigned __int64)(a5 + 1) & 0xFFFFFFFFFFFFFFF8LL))),
8LL * (((unsigned int)a5 - (((_DWORD)a5 + 8) & 0xFFFFFFF8) + (unsigned int)v5) >> 3));
}
else if ( (v5 & 4) != 0 )
{
*(_DWORD *)a5 = *(_DWORD *)(a1 + 4);
*(_DWORD *)((char *)a5 + v5 - 4) = *(_DWORD *)(a1 + v5);
}
else if ( (_DWORD)v5 )
{
*(_BYTE *)a5 = *(_BYTE *)(a1 + 4);
if ( (v5 & 2) != 0 )
*(_WORD *)((char *)a5 + v5 - 2) = *(_WORD *)(v8 + v5 - 2);
}
result = 0LL;
}
else
{
fprintf(stderr, "File %s, Line %ld: ", "wfa_tlv.c", 122LL);
fwrite("Parm buf invalid\n", 1uLL, 0x11uLL, stderr);
result = 0xFFFFFFFFLL;
}
return result;
}

canonical_decompiled_code:
__int64 __fastcall func1(__int64 a1, int a2, _BYTE *a3, _DWORD *a4, _QWORD *a5)
{
__int64 v5; // rdx
unsigned int v6; // er9
__int64 result; // rax
__int64 v8; // rsi

if ( a5 )
{
*a3 = *(_WORD *)a1;
v5 = *(unsigned __int16 *)(a1 + 2);
*a4 = v5;
if ( (int)v5 > a2 )
return (unsigned int)-1;
v6 = 0;
if ( (unsigned __int16)(v5 - 1) > 0x1FEu )
return v6;
v8 = a1 + 4;
if ( (unsigned int)v5 >= 8 )
{
*a5 = *(_QWORD *)(a1 + 4);
*(_QWORD *)((char *)a5 + v5 - 8) = *(_QWORD *)(v8 + v5 - 8);
qmemcpy(
(void *)((unsigned __int64)(a5 + 1) & 0xFFFFFFFFFFFFFFF8LL),
(const void *)(v8 - ((_QWORD)a5 - ((unsigned __int64)(a5 + 1) & 0xFFFFFFFFFFFFFFF8LL))),
8LL * (((unsigned int)a5 - (((_DWORD)a5 + 8) & 0xFFFFFFF8) + (unsigned int)v5) >> 3));
}
else if ( (v5 & 4) != 0 )
{
*(_DWORD *)a5 = *(_DWORD *)(a1 + 4);
*(_DWORD *)((char *)a5 + v5 - 4) = *(_DWORD *)(a1 + v5);
}
else if ( (_DWORD)v5 )
{
*(_BYTE *)a5 = *(_BYTE *)(a1 + 4);
if ( (v5 & 2) != 0 )
*(_WORD *)((char *)a5 + v5 - 2) = *(_WORD *)(v8 + v5 - 2);
}
result = 0LL;
}
else
{
fprintf(stderr, "File %s, Line %ld: ", "wfa_tlv.c", 122LL);
fwrite("Parm buf invalid\n", 1uLL, 0x11uLL, stderr);
result = 0xFFFFFFFFLL;
}
return result;
}

original_code:
BOOL wfaDecodeTLV(BYTE *tlv_data, int tlv_len, BYTE *ptag, int *pval_len, BYTE *pvalue)
{
   wfaTLV *data = (wfaTLV *)tlv_data;
   if(pvalue == ((void *)0))
   {
       fprintf(stderr, "File %s, Line %ld: ", "wfa_tlv.c", (long)122); fprintf(stderr, "Parm buf invalid\n");
       return -1;
   }
   *ptag = (BYTE)data->tag;
   *pval_len = data->len;
   if(tlv_len < *pval_len)
       return -1;
   if(*pval_len != 0 && *pval_len < 512)
   {
      memcpy(pvalue, tlv_data+4, *pval_len);
   }
   return 0;
}

canonical_original_code:
int wfaDecodeTLV(unsigned char *tlv_data, int tlv_len, unsigned char *ptag, int *pval_len, unsigned char *pvalue)
{
   struct _wfatlvHdr *data = (wfaTLV *)tlv_data;
   if(pvalue == ((void *)0))
   {
       fprintf(stderr, "File %s, Line %ld: ", "wfa_tlv.c", (long)122); fprintf(stderr, "Parm buf invalid\n");
       return -1;
   }
   *ptag = (unsigned char)data->tag;
   *pval_len = data->len;
   if(tlv_len < *pval_len)
       return -1;
   if(*pval_len != 0 && *pval_len < 512)
   {
      memcpy(pvalue, tlv_data+4, *pval_len);
   }
   return 0;
}

variable_types:
ptag
unsigned char *

variable_types:
pvalue
unsigned char *

variable_types: struct _wfatlvHdr { unsigned short tag; unsigned short len; } *


wfaGetTLVTag

decompiled_code:
__int64 __fastcall wfaGetTLVTag(unsigned __int16 *a1)
{
__int64 result; // rax

result = 0LL;
if ( a1 )
result = *a1;
return result;
}

canonical_decompiled_code:
__int64 __fastcall func2(unsigned __int16 *a1)
{
__int64 result; // rax

result = 0LL;
if ( a1 )
result = *a1;
return result;
}

original_code:
WORD wfaGetTLVTag(BYTE *tlv_data)
{
   wfaTLV *ptlv = (wfaTLV *)tlv_data;
   if(ptlv != ((void *)0))
      return ptlv->tag;
   return 0;
}

canonical_original_code:
unsigned short wfaGetTLVTag(unsigned char *tlv_data)
{
   struct _wfatlvHdr *ptlv = (wfaTLV *)tlv_data;
   if(ptlv != ((void *)0))
      return ptlv->tag;
   return 0;
}

return_type: unsigned short

user_defined_types: struct _wfatlvHdr { unsigned short tag; unsigned short len; }


wfaSetTLVTag

decompiled_code:
__int64 __fastcall wfaSetTLVTag(unsigned __int8 a1, _WORD *a2)
{
__int64 result; // rax

if ( !a2 )
return 0xFFFFFFFFLL;
result = 0LL;
*a2 = a1;
return result;
}

canonical_decompiled_code:
__int64 __fastcall func3(unsigned __int8 a1, _WORD *a2)
{
__int64 result; // rax

if ( !a2 )
return 0xFFFFFFFFLL;
result = 0LL;
*a2 = a1;
return result;
}

original_code:
BOOL wfaSetTLVTag(BYTE new_tag, BYTE *tlv_data)
{
   wfaTLV *ptlv = (wfaTLV *)tlv_data;
   if(tlv_data == ((void *)0))
      return -1;
   ptlv->tag = new_tag;
   return 0;
}

canonical_original_code:
int wfaSetTLVTag(unsigned char new_tag, unsigned char *tlv_data)
{
   struct _wfatlvHdr *ptlv = (wfaTLV *)tlv_data;
   if(tlv_data == ((void *)0))
      return -1;
   ptlv->tag = new_tag;
   return 0;
}

return_type: int


wfaGetTLVLen

decompiled_code:
__int64 __fastcall wfaGetTLVLen(__int64 a1)
{
__int64 result; // rax

if ( a1 )
result = *(unsigned __int16 *)(a1 + 2);
else
result = 0xFFFFFFFFLL;
return result;
}

canonical_decompiled_code:
__int64 __fastcall func4(__int64 a1)
{
__int64 result; // rax

if ( a1 )
result = *(unsigned __int16 *)(a1 + 2);
else
result = 0xFFFFFFFFLL;
return result;
}

original_code:
WORD wfaGetTLVLen(BYTE *tlv_data)
{
   wfaTLV *ptlv = (wfaTLV *)tlv_data;
   if(tlv_data == ((void *)0))
     return -1;
   return ptlv->len;
}

canonical_original_code:
unsigned short wfaGetTLVLen(unsigned char *tlv_data)
{
   struct _wfatlvHdr *ptlv = (wfaTLV *)tlv_data;
   if(tlv_data == ((void *)0))
     return -1;
   return ptlv->len;
}


wfaGetTLVvalue

decompiled_code:
__int64 __fastcall wfaGetTLVvalue(int a1, __int64 a2, void *a3)
{
if ( !a2 )
return 0xFFFFFFFFLL;
memcpy(a3, (const void *)(a2 + 3), a1);
return 0LL;
}

canonical_decompiled_code:
__int64 __fastcall func5(int a1, __int64 a2, void *a3)
{
if ( !a2 )
return 0xFFFFFFFFLL;
memcpy(a3, (const void *)(a2 + 3), a1);
return 0LL;
}

original_code:
BOOL wfaGetTLVvalue(int value_len, BYTE *tlv_data, BYTE *pvalue)
{
    if(tlv_data == ((void *)0))
      return -1;
    memcpy(pvalue, tlv_data+1+2, value_len);
    return 0;
}

canonical_original_code:
int wfaGetTLVvalue(int value_len, unsigned char *tlv_data, unsigned char *pvalue)
{
    if(tlv_data == ((void *)0))
      return -1;
    memcpy(pvalue, tlv_data+1+2, value_len);
    return 0;
}


decompiled_code:
__int64 wl_set()
{
return 0LL;
}

canonical_decompiled_code:
__int64 func0()
{
return 0LL;
}

original_code:
int wl_set(void *wl, int cmd, void *buf, int len)
{
 return 0;
}

variable_types:
wl
void *

variable_types: cmd int

variable_types:
buf
void *

variable_types: len int


printProfile

decompiled_code:
int __fastcall printProfile(const char *a1)
{
int result; // eax

if ( (wfa_defined_debug & 2) != 0 )
result = fprintf(
stdout,
"profile type %i direction %i Dest ipAddr %s Dest port %i So ipAddr %s So port %i rate %i duration %i pksize %i\n",
*(unsigned int *)a1,
*((unsigned int *)a1 + 1),
a1 + 8,
*((unsigned __int16 *)a1 + 12),
a1 + 26,
*((unsigned __int16 *)a1 + 21),
*((unsigned int *)a1 + 11),
*((unsigned int *)a1 + 12),
*((unsigned int *)a1 + 13));
return result;
}

canonical_decompiled_code:
int __fastcall func0(const char *a1)
{
int result; // eax

if ( (wfa_defined_debug & 2) != 0 )
result = fprintf(
stdout,
"profile type %i direction %i Dest ipAddr %s Dest port %i So ipAddr %s So port %i rate %i duration %i pksize %i\n",
*(unsigned int *)a1,
*((unsigned int *)a1 + 1),
a1 + 8,
*((unsigned __int16 *)a1 + 12),
a1 + 26,
*((unsigned __int16 *)a1 + 21),
*((unsigned int *)a1 + 11),
*((unsigned int *)a1 + 12),
*((unsigned int *)a1 + 13));
return result;
}

original_code:
void printProfile(tgProfile_t *pf)
{
 if(wfa_defined_debug & 0x0002) fprintf(stdout, "profile type %i direction %i Dest ipAddr %s Dest port %i So ipAddr %s So port %i rate %i duration %i pksize %i\n", pf->profile, pf->direction, pf->dipaddr, pf->dport, pf->sipaddr, pf->sport, pf->rate, pf->duration, pf->pksize);
}

canonical_original_code:
void printProfile(struct _tg_profile *pf)
{
 if(wfa_defined_debug & 0x0002) fprintf(stdout, "profile type %i direction %i Dest ipAddr %s Dest port %i So ipAddr %s So port %i rate %i duration %i pksize %i\n", pf->profile, pf->direction, pf->dipaddr, pf->dport, pf->sipaddr, pf->sport, pf->rate, pf->duration, pf->pksize);
}

variable_types: struct _tg_profile { int profile; int direction; char dipaddr[16]; unsigned short dport; char sipaddr[16]; unsigned short sport; int rate; int duration; int pksize; short trafficClass; int startdelay; } *

return_type: void


isString

decompiled_code:
__int64 __fastcall isString(_BYTE *a1)
{
__int64 result; // rax

result = 0LL;
if ( *a1 )
result = ((unsigned __int8)(*a1 - 66) <= 0x17u) | (unsigned __int8)((unsigned __int8)(*a1 - 97) <= 0x19u);
return result;
}

canonical_decompiled_code:
__int64 __fastcall func1(_BYTE *a1)
{
__int64 result; // rax

result = 0LL;
if ( *a1 )
result = ((unsigned __int8)(*a1 - 66) <= 0x17u) | (unsigned __int8)((unsigned __int8)(*a1 - 97) <= 0x19u);
return result;
}

original_code:
int isString(char *str)
{
 if(*str == '\0')
  return 0;
 if((str[0] >= 'a' && str[0] <= 'z')
  || (str[0] > 'A' && str[0] < 'Z'))
  return 1;
 else
  return 0;
}

variable_types:
str
char *


isNumber

decompiled_code:
_BOOL8 __fastcall isNumber(_BYTE *a1)
{
return (unsigned __int8)(*a1 - 48) <= 9u;
}

canonical_decompiled_code:
_BOOL8 __fastcall func2(_BYTE *a1)
{
return (unsigned __int8)(*a1 - 48) <= 9u;
}

original_code:
int isNumber(char *str)
{
 if(*str == '\0')
  return 0;
 if (str[0] >= '0' && str[0] <= '9')
  return 1;
 else
  return 0;
}


original_code:
int isIpV4Addr(char *str)
{
 int dots = 0;
 char *tmpstr = str;
 if(*str == '\0')
  return 0;
 while(*tmpstr != '\0')
 {
  if(*tmpstr == '.')
  {
   dots++;
  }
  tmpstr++;
 }
 if(dots <3)
  return 0;
 else
  return 1;
}

variable_types: dots int

variable_types:
tmpstr
char *


decompiled_code:
double __fastcall wfa_timeval2double(_QWORD *a1)
{
return (double)(int)a1[1] * 0.000001 + (double)(int)*a1;
}

canonical_decompiled_code:
double __fastcall func4(_QWORD *a1)
{
return (double)(int)a1[1] * 0.000001 + (double)(int)*a1;
}

original_code:
inline double wfa_timeval2double(struct timeval *tval)
{
 return ((double) tval->tv_sec + (double) tval->tv_usec*1e-6);
}

variable_types: struct timeval { long tv_sec; long tv_usec; } *

return_type: double


original_code:
int wfa_itime_diff(struct timeval *t1, struct timeval *t2)
{
 int dtime;
 int sec = t2->tv_sec - t1->tv_sec;
 int usec = t2->tv_usec - t1->tv_usec;
 if(usec < 0)
 {
  sec -=1;
  usec += 1000000;
 }
 dtime = sec*1000000 + usec;
 return dtime;
}

variable_types: dtime int

variable_types: sec int

variable_types: usec int

user_defined_types: struct timeval { long tv_sec; long tv_usec; }


decompiled_code:
void __fastcall int2BuffBigEndian(unsigned int a1, _DWORD *a2)
{
*a2 = _byteswap_ulong(a1);
}

canonical_decompiled_code:
void __fastcall func7(unsigned int a1, _DWORD *a2)
{
*a2 = _byteswap_ulong(a1);
}

original_code:
inline void int2BuffBigEndian(int val, char *buf)
{
 char *littleEn = (char *)&val;
 buf[0] = littleEn[3];
 buf[1] = littleEn[2];
 buf[2] = littleEn[1];
 buf[3] = littleEn[0];
}

variable_types: val int

variable_types:
buf
char *

variable_types:
littleEn
char *


decompiled_code:
__int64 __fastcall bigEndianBuff2Int(unsigned int *a1)
{
return _byteswap_ulong(*a1);
}

canonical_decompiled_code:
__int64 __fastcall func8(unsigned int *a1)
{
return _byteswap_ulong(*a1);
}

original_code:
int bigEndianBuff2Int(char *buff)
{
 int val;
 char *strval = (char *)&val;
 strval[0] = buff[3];
 strval[1] = buff[2];
 strval[2] = buff[1];
 strval[3] = buff[0];
 return val;
}

variable_types:
buff
char *

variable_types:
strval
char *


wfaCreateUDPSock

decompiled_code:
__int64 __fastcall wfaCreateUDPSock(__int64 a1, unsigned __int16 a2)
{
int v2; // eax
unsigned int v3; // er12
socklen_t v4; // edx
__int64 result; // rax
struct sockaddr v6; // [rsp+0h] [rbp-28h] BYREF

v2 = socket(2, 2, 17);
if ( v2 < 0 )
{
fprintf(stderr, "File %s, Line %ld: ", "wfa_sock.c", 194LL);
fwrite("createUDPSock socket() failed", 1uLL, 0x1DuLL, stderr);
result = 0LL;
}
else
{
v3 = v2;
v6 = 0LL;
v6.sa_family = 2;
*(_DWORD *)&v6.sa_data[2] = _bswap_32_constprop_0(2LL, 2LL);
if ( (wfa_defined_debug & 2) != 0 )
fprintf(stdout, "UDP port %i\n", a2);
*(_WORD *)v6.sa_data = _bswap_16(a2);
bind(v3, &v6, v4);
result = v3;
}
return result;
}

canonical_decompiled_code:
__int64 __fastcall func2(__int64 a1, unsigned __int16 a2)
{
int v2; // eax
unsigned int v3; // er12
socklen_t v4; // edx
__int64 result; // rax
struct sockaddr v6; // [rsp+0h] [rbp-28h] BYREF

v2 = socket(2, 2, 17);
if ( v2 < 0 )
{
fprintf(stderr, "File %s, Line %ld: ", "wfa_sock.c", 194LL);
fwrite("createUDPSock socket() failed", 1uLL, 0x1DuLL, stderr);
result = 0LL;
}
else
{
v3 = v2;
v6 = 0LL;
v6.sa_family = 2;
*(_DWORD *)&v6.sa_data[2] = func1(2LL, 2LL);
if ( (wfa_defined_debug & 2) != 0 )
fprintf(stdout, "UDP port %i\n", a2);
*(_WORD *)v6.sa_data = func0(a2);
bind(v3, &v6, v4);
result = v3;
}
return result;
}

original_code:
int wfaCreateUDPSock(char *ipaddr, unsigned short port)
{
    int udpsock;
    struct sockaddr_in servAddr;
    if((udpsock = socket(2, SOCK_DGRAM, IPPROTO_UDP)) < 0)
    {
        fprintf(stderr, "File %s, Line %ld: ", "wfa_sock.c", (long)194); fprintf(stderr, "createUDPSock socket() failed");
        return 0;
    }
 memset(&servAddr, 0, sizeof(servAddr));
    servAddr.sin_family = 2;
    servAddr.sin_addr.s_addr = htonl(((in_addr_t) 0x00000000));
    if(wfa_defined_debug & 0x0002) fprintf(stdout, "UDP port %i\n", port);
    servAddr.sin_port = htons(port);
   bind(udpsock, (struct sockaddr *) &servAddr, sizeof(servAddr));
    return udpsock;
}

canonical_original_code:
int wfaCreateUDPSock(char *ipaddr, unsigned short port)
{
    int udpsock;
    struct sockaddr_in servAddr;
    if((udpsock = socket(2, SOCK_DGRAM, IPPROTO_UDP)) < 0)
    {
        fprintf(stderr, "File %s, Line %ld: ", "wfa_sock.c", (long)194); fprintf(stderr, "createUDPSock socket() failed");
        return 0;
    }
 memset(&servAddr, 0, sizeof(servAddr));
    servAddr.sin_family = 2;
    servAddr.sin_addr.s_addr = htonl(((unsigned int) 0x00000000));
    if(wfa_defined_debug & 0x0002) fprintf(stdout, "UDP port %i\n", port);
    servAddr.sin_port = htons(port);
   bind(udpsock, (struct sockaddr *) &servAddr, sizeof(servAddr));
    return udpsock;
}

variable_types:
ipaddr
char *

variable_types:
port
unsigned short

variable_types: udpsock int

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

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

user_defined_types: struct sockaddr { unsigned short sa_family; char sa_data[14]; }


wfaSetSockMcastSendOpt

decompiled_code:
int __fastcall wfaSetSockMcastSendOpt(int a1)
{
char optval[9]; // [rsp+Fh] [rbp-9h] BYREF

optval[0] = 1;
return setsockopt(a1, 0, 33, optval, 1u);
}

canonical_decompiled_code:
int __fastcall func3(int a1)
{
char optval[9]; // [rsp+Fh] [rbp-9h] BYREF

optval[0] = 1;
return setsockopt(a1, 0, 33, optval, 1u);
}

original_code:
int wfaSetSockMcastSendOpt(int sockfd)
{
 unsigned char ttlval = 1;
 return setsockopt(sockfd, IPPROTO_IP, 33, &ttlval, sizeof(ttlval));
}

variable_types: sockfd int

variable_types:
ttlval
unsigned char


wfaSetSockMcastRecvOpt

decompiled_code:
int __fastcall wfaSetSockMcastRecvOpt(unsigned int a1, const char *a2)
{
int v2; // edx
const void *v3; // rcx
socklen_t v4; // er8

inet_addr(a2);
_bswap_32_constprop_0(a1, 0LL);
return setsockopt(a1, 0, v2, v3, v4);
}

canonical_decompiled_code:
int __fastcall func4(unsigned int a1, const char *a2)
{
int v2; // edx
const void *v3; // rcx
socklen_t v4; // er8

inet_addr(a2);
func1(a1, 0LL);
return setsockopt(a1, 0, v2, v3, v4);
}

original_code:
int wfaSetSockMcastRecvOpt(int sockfd, char *mcastgroup)
{
    struct ip_mreq mcreq;
    int so;
    mcreq.imr_multiaddr.s_addr = inet_addr(mcastgroup);
    mcreq.imr_interface.s_addr = htonl(((in_addr_t) 0x00000000));
      so = setsockopt(sockfd, IPPROTO_IP, 35,
                  (void *)&mcreq, sizeof(mcreq));
    return so;
}

canonical_original_code:
int wfaSetSockMcastRecvOpt(int sockfd, char *mcastgroup)
{
    struct ip_mreq mcreq;
    int so;
    mcreq.imr_multiaddr.s_addr = inet_addr(mcastgroup);
    mcreq.imr_interface.s_addr = htonl(((unsigned int) 0x00000000));
      so = setsockopt(sockfd, IPPROTO_IP, 35,
                  (void *)&mcreq, sizeof(mcreq));
    return so;
}

variable_types:
mcastgroup
char *

variable_types: struct ip_mreq { struct in_addr { unsigned int s_addr; } imr_multiaddr; struct in_addr imr_interface; }

variable_types: so int

user_defined_types: struct ip_mreq { struct in_addr imr_multiaddr; struct in_addr imr_interface; }


wfaConnectUDPPeer

decompiled_code:
__int64 __fastcall wfaConnectUDPPeer(int fd, char *cp, __int16 a3)
{
socklen_t v4; // edx
struct sockaddr v6[2]; // [rsp+0h] [rbp-28h] BYREF

v6[0] = 0LL;
v6[0].sa_family = 2;
inet_aton(cp, (struct in_addr *)&v6[0].sa_data[2]);
*(_WORD *)v6[0].sa_data = _bswap_16(a3);
connect(fd, v6, v4);
return (unsigned int)fd;
}

canonical_decompiled_code:
__int64 __fastcall func5(int fd, char *cp, __int16 a3)
{
socklen_t v4; // edx
struct sockaddr v6[2]; // [rsp+0h] [rbp-28h] BYREF

v6[0] = 0LL;
v6[0].sa_family = 2;
inet_aton(cp, (struct in_addr *)&v6[0].sa_data[2]);
*(_WORD *)v6[0].sa_data = func0(a3);
connect(fd, v6, v4);
return (unsigned int)fd;
}

original_code:
int wfaConnectUDPPeer(int mysock, char *daddr, unsigned short dport)
{
    struct sockaddr_in peerAddr;
    memset(&peerAddr, 0, sizeof(peerAddr));
    peerAddr.sin_family = 2;
 inet_aton(daddr, &peerAddr.sin_addr);
    peerAddr.sin_port = htons(dport);
    connect(mysock, (struct sockaddr *)&peerAddr, sizeof(peerAddr));
    return mysock;
}

variable_types: mysock int

variable_types:
daddr
char *

variable_types:
dport
unsigned short


wfaAcceptTCPConn

decompiled_code:
int __fastcall wfaAcceptTCPConn(int a1)
{
int result; // eax
socklen_t addr_len; // [rsp+Ch] [rbp-1Ch] BYREF
struct sockaddr addr; // [rsp+10h] [rbp-18h] BYREF

addr_len = 16;
result = accept(a1, &addr, &addr_len);
if ( result < 0 )
{
fprintf(stderr, "File %s, Line %ld: ", "wfa_sock.c", 279LL);
fwrite("accept() failed", 1uLL, 0xFuLL, stderr);
exit(1);
}
return result;
}

canonical_decompiled_code:
int __fastcall func6(int a1)
{
int result; // eax
socklen_t addr_len; // [rsp+Ch] [rbp-1Ch] BYREF
struct sockaddr addr; // [rsp+10h] [rbp-18h] BYREF

addr_len = 16;
result = accept(a1, &addr, &addr_len);
if ( result < 0 )
{
fprintf(stderr, "File %s, Line %ld: ", "wfa_sock.c", 279LL);
fwrite("accept() failed", 1uLL, 0xFuLL, stderr);
exit(1);
}
return result;
}

original_code:
int wfaAcceptTCPConn(int servSock)
{
    int clntSock;
    struct sockaddr_in clntAddr;
    unsigned int clntLen;
    clntLen = sizeof(clntAddr);
    if ((clntSock = accept(servSock, (struct sockaddr *) &clntAddr,
           &clntLen)) < 0)
    {
        fprintf(stderr, "File %s, Line %ld: ", "wfa_sock.c", (long)279); fprintf(stderr, "accept() failed");
        exit(1);
    }
    return clntSock;
}

variable_types: servSock int

variable_types: clntSock int

variable_types:
clntLen
unsigned int


wfaSetSockFiDesc

original_code:
void wfaSetSockFiDesc(fd_set *fdset, int *maxfdn1, struct sockfds *fds)
{
    int i;
    do { int __d0, __d1; __asm__ __volatile__ ("cld; rep; " "stosq" : "=c" (__d0), "=D" (__d1) : "a" (0), "0" (sizeof (fd_set) / sizeof (__fd_mask)), "1" (&((fdset)->__fds_bits)[0]) : "memory"); } while (0);
    if(fdset != ((void *)0))
       ((void) (((fdset)->__fds_bits)[((*fds->agtfd) / (8 * (int) sizeof (__fd_mask)))] |= ((__fd_mask) (1UL << ((*fds->agtfd) % (8 * (int) sizeof (__fd_mask)))))));
    if(*fds->tgfd > 0)
    {
         ((void) (((fdset)->__fds_bits)[((*fds->tgfd) / (8 * (int) sizeof (__fd_mask)))] |= ((__fd_mask) (1UL << ((*fds->tgfd) % (8 * (int) sizeof (__fd_mask)))))));
         *maxfdn1 = ((*maxfdn1-1) > ((int)*fds->tgfd) ? (*maxfdn1-1) : ((int)*fds->tgfd)) + 1;
    }
    if(*fds->tgRevfd > 0)
    {
  ((void) (((fdset)->__fds_bits)[((*fds->tgRevfd) / (8 * (int) sizeof (__fd_mask)))] |= ((__fd_mask) (1UL << ((*fds->tgRevfd) % (8 * (int) sizeof (__fd_mask)))))));
         *maxfdn1 = ((*maxfdn1-1) > ((int)*fds->tgRevfd) ? (*maxfdn1-1) : ((int)*fds->tgRevfd)) + 1;
    }
    if(*fds->cafd >0)
    {
        ((void) (((fdset)->__fds_bits)[((*fds->cafd) / (8 * (int) sizeof (__fd_mask)))] |= ((__fd_mask) (1UL << ((*fds->cafd) % (8 * (int) sizeof (__fd_mask)))))));
         *maxfdn1 = ((*maxfdn1-1) > ((int)*fds->cafd) ? (*maxfdn1-1) : ((int)*fds->cafd)) + 1;
    }
    for(i = 0; i < 6; i++)
    {
        if(fds->wmmfds[i] > 0)
        {
            if(fds->wmmfds[i] > 1024)
            {
            }
            ((void) (((fdset)->__fds_bits)[((fds->wmmfds[i]) / (8 * (int) sizeof (__fd_mask)))] |= ((__fd_mask) (1UL << ((fds->wmmfds[i]) % (8 * (int) sizeof (__fd_mask)))))));
            *maxfdn1 = ((*maxfdn1-1) > ((int)fds->wmmfds[i]) ? (*maxfdn1-1) : ((int)fds->wmmfds[i])) +1;
        }
    }
    if(*fds->psfd > 0)
    {
         ((void) (((fdset)->__fds_bits)[((*fds->psfd) / (8 * (int) sizeof (__fd_mask)))] |= ((__fd_mask) (1UL << ((*fds->psfd) % (8 * (int) sizeof (__fd_mask)))))));
         *maxfdn1 = ((*maxfdn1-1) > ((int)*fds->psfd) ? (*maxfdn1-1) : ((int)*fds->psfd)) + 1;
    }
    return;
}

canonical_original_code:
void wfaSetSockFiDesc(struct fd_set *fdset, int *maxfdn1, struct sockfds *fds)
{
    int i;
    do { int __d0; int __d1; __asm__ __volatile__ ("cld; rep; " "stosq" : "=c" (__d0), "=D" (__d1) : "a" (0), "0" (sizeof (fd_set) / sizeof (__fd_mask)), "1" (&((fdset)->__fds_bits)[0]) : "memory"); } while (0);
    if(fdset != ((void *)0))
       ((void) (((fdset)->__fds_bits)[((*fds->agtfd) / (8 * (int) sizeof (__fd_mask)))] |= ((__fd_mask) (1UL << ((*fds->agtfd) % (8 * (int) sizeof (__fd_mask)))))));
    if(*fds->tgfd > 0)
    {
         ((void) (((fdset)->__fds_bits)[((*fds->tgfd) / (8 * (int) sizeof (__fd_mask)))] |= ((__fd_mask) (1UL << ((*fds->tgfd) % (8 * (int) sizeof (__fd_mask)))))));
         *maxfdn1 = ((*maxfdn1-1) > ((int)*fds->tgfd) ? (*maxfdn1-1) : ((int)*fds->tgfd)) + 1;
    }
    if(*fds->tgRevfd > 0)
    {
  ((void) (((fdset)->__fds_bits)[((*fds->tgRevfd) / (8 * (int) sizeof (__fd_mask)))] |= ((__fd_mask) (1UL << ((*fds->tgRevfd) % (8 * (int) sizeof (__fd_mask)))))));
         *maxfdn1 = ((*maxfdn1-1) > ((int)*fds->tgRevfd) ? (*maxfdn1-1) : ((int)*fds->tgRevfd)) + 1;
    }
    if(*fds->cafd >0)
    {
        ((void) (((fdset)->__fds_bits)[((*fds->cafd) / (8 * (int) sizeof (__fd_mask)))] |= ((__fd_mask) (1UL << ((*fds->cafd) % (8 * (int) sizeof (__fd_mask)))))));
         *maxfdn1 = ((*maxfdn1-1) > ((int)*fds->cafd) ? (*maxfdn1-1) : ((int)*fds->cafd)) + 1;
    }
    for(i = 0; i < 6; i++)
    {
        if(fds->wmmfds[i] > 0)
        {
            if(fds->wmmfds[i] > 1024)
            {
            }
            ((void) (((fdset)->__fds_bits)[((fds->wmmfds[i]) / (8 * (int) sizeof (__fd_mask)))] |= ((__fd_mask) (1UL << ((fds->wmmfds[i]) % (8 * (int) sizeof (__fd_mask)))))));
            *maxfdn1 = ((*maxfdn1-1) > ((int)fds->wmmfds[i]) ? (*maxfdn1-1) : ((int)fds->wmmfds[i])) +1;
        }
    }
    if(*fds->psfd > 0)
    {
         ((void) (((fdset)->__fds_bits)[((*fds->psfd) / (8 * (int) sizeof (__fd_mask)))] |= ((__fd_mask) (1UL << ((*fds->psfd) % (8 * (int) sizeof (__fd_mask)))))));
         *maxfdn1 = ((*maxfdn1-1) > ((int)*fds->psfd) ? (*maxfdn1-1) : ((int)*fds->psfd)) + 1;
    }
    return;
}

variable_types: struct fd_set { long __fds_bits[-1]; } *

variable_types: struct sockfds { int *agtfd; int *cafd; int *tgfd; int *tgRevfd; int *wmmfds; int *psfd; } *

variable_types: i int


wfaCtrlSend

decompiled_code:
__int64 __fastcall wfaCtrlSend(int fd, void *buf, int a3)
{
unsigned int v3; // er13

v3 = 0;
if ( a3 )
{
if ( !buf && (wfa_defined_debug & 2) != 0 )
fwrite("wfaCtrlSend: Buffer null\r\n", 1uLL, 0x1AuLL, stdout);
v3 = send(fd, buf, a3, 0);
if ( v3 == -1 && (wfa_defined_debug & 4) != 0 )
fwrite("Error sending tcp packet\n", 1uLL, 0x19uLL, stdout);
}
return v3;
}

canonical_decompiled_code:
__int64 __fastcall func8(int fd, void *buf, int a3)
{
unsigned int v3; // er13

v3 = 0;
if ( a3 )
{
if ( !buf && (wfa_defined_debug & 2) != 0 )
fwrite("wfaCtrlSend: Buffer null\r\n", 1uLL, 0x1AuLL, stdout);
v3 = send(fd, buf, a3, 0);
if ( v3 == -1 && (wfa_defined_debug & 4) != 0 )
fwrite("Error sending tcp packet\n", 1uLL, 0x19uLL, stdout);
}
return v3;
}

original_code:
int wfaCtrlSend(int sock, unsigned char *buf, int bufLen)
{
    int bytesSent = 0;
    if(bufLen == 0)
        return 0;
    if(buf == ((void *)0))
 if(wfa_defined_debug & 0x0002) fprintf(stdout, "wfaCtrlSend: Buffer null\r\n");
    bytesSent = send(sock, buf, bufLen, 0);
    if(bytesSent == -1)
    {
       if(wfa_defined_debug & 0x0004) fprintf(stdout, "Error sending tcp packet\n");
    }
    return bytesSent;
}

variable_types: sock int

variable_types:
buf
unsigned char *

variable_types: bufLen int

variable_types: bytesSent int


wfaCtrlRecv

decompiled_code:
ssize_t __fastcall wfaCtrlRecv(int a1, void *a2)
{
return recv(a1, a2, 0x3FFuLL, 0);
}

canonical_decompiled_code:
ssize_t __fastcall func9(int a1, void *a2)
{
return recv(a1, a2, 0x3FFuLL, 0);
}

original_code:
int wfaCtrlRecv(int sock, unsigned char *buf)
{
   int bytesRecvd = 0;
   bytesRecvd = recv(sock, buf, 1024 -1, 0);
   return bytesRecvd;
}

variable_types: bytesRecvd int


wfaTrafficSendTo

decompiled_code:
ssize_t __fastcall wfaTrafficSendTo(int a1, const void *a2, int a3, const struct sockaddr *a4)
{
return sendto(a1, a2, a3, 64, a4, 0x10u);
}

canonical_decompiled_code:
ssize_t __fastcall func10(int a1, const void *a2, int a3, const struct sockaddr *a4)
{
return sendto(a1, a2, a3, 64, a4, 0x10u);
}

original_code:
int wfaTrafficSendTo(int sock, char *buf, int bufLen, struct sockaddr *to)
{
   int bytesSent;
   bytesSent = sendto(sock, buf, bufLen, MSG_DONTWAIT, to, sizeof(struct sockaddr));
   return bytesSent;
}

variable_types:
buf
char *

variable_types: struct sockaddr { unsigned short sa_family; char sa_data[14]; } *


wfaTrafficRecv

decompiled_code:
ssize_t __fastcall wfaTrafficRecv(int fd, void *buf, struct sockaddr *addr)
{
unsigned int v4; // eax
socklen_t addr_len[7]; // [rsp+Ch] [rbp-1Ch] BYREF

v4 = fcntl(fd, 3, 0LL);
BYTE1(v4) |= 8u;
fcntl(fd, 4, v4);
return recvfrom(fd, buf, 0x800uLL, 0, addr, addr_len);
}

canonical_decompiled_code:
ssize_t __fastcall func11(int fd, void *buf, struct sockaddr *addr)
{
unsigned int v4; // eax
socklen_t addr_len[7]; // [rsp+Ch] [rbp-1Ch] BYREF

v4 = fcntl(fd, 3, 0LL);
BYTE1(v4) |= 8u;
fcntl(fd, 4, v4);
return recvfrom(fd, buf, 0x800uLL, 0, addr, addr_len);
}

original_code:
int wfaTrafficRecv(int sock, char *buf, struct sockaddr *from)
{
   int bytesRecvd =0;
   socklen_t addrLen;
   int ioflags = fcntl(sock, 3, 0);
   fcntl(sock, 4, ioflags | 04000);
   bytesRecvd = recvfrom(sock, buf, 2048, 0, from, &addrLen);
   return bytesRecvd;
}

canonical_original_code:
int wfaTrafficRecv(int sock, char *buf, struct sockaddr *from)
{
   int bytesRecvd = 0;
   unsigned int addrLen;
   int ioflags = fcntl(sock, 3, 0);
   fcntl(sock, 4, ioflags | 04000);
   bytesRecvd = recvfrom(sock, buf, 2048, 0, from, &addrLen);
   return bytesRecvd;
}

variable_types:
addrLen
unsigned int

variable_types: ioflags int


wfaGetifAddr

decompiled_code:
__int64 __fastcall wfaGetifAddr(char *src, __m128i *a2)
{
int v2; // eax
unsigned int v3; // ebp
size_t v4; // rax
__int64 result; // rax
char v6[16]; // [rsp+0h] [rbp-48h] BYREF
__m128i v7[3]; // [rsp+10h] [rbp-38h] BYREF

v2 = socket(2, 2, 0);
if ( v2 < 0 )
{
fprintf(stderr, "File %s, Line %ld: ", "wfa_sock.c", 471LL);
fwrite("socket open error\n", 1uLL, 0x12uLL, stderr);
result = 0LL;
}
else
{
v3 = v2;
v4 = strlen(src);
strncpy(v6, src, v4);
v7[0].m128i_i16[0] = 2;
if ( !ioctl(v3, 0x8915uLL, v6) )
{
*a2 = _mm_loadu_si128(v7);
asd_closeSocket(v3);
}
result = 0LL;
}
return result;
}

canonical_decompiled_code:
__int64 __fastcall func12(char *src, __m128i *a2)
{
int v2; // eax
unsigned int v3; // ebp
size_t v4; // rax
__int64 result; // rax
char v6[16]; // [rsp+0h] [rbp-48h] BYREF
__m128i v7[3]; // [rsp+10h] [rbp-38h] BYREF

v2 = socket(2, 2, 0);
if ( v2 < 0 )
{
fprintf(stderr, "File %s, Line %ld: ", "wfa_sock.c", 471LL);
fwrite("socket open error\n", 1uLL, 0x12uLL, stderr);
result = 0LL;
}
else
{
v3 = v2;
v4 = strlen(src);
strncpy(v6, src, v4);
v7[0].m128i_i16[0] = 2;
if ( !ioctl(v3, 0x8915uLL, v6) )
{
*a2 = _mm_loadu_si128(v7);
asd_closeSocket(v3);
}
result = 0LL;
}
return result;
}

original_code:
int wfaGetifAddr(char *ifname, struct sockaddr_in *sa)
{
    struct ifreq ifr;
    int fd = socket(2, SOCK_DGRAM, IPPROTO_IP);
    if(fd < 0)
    {
       fprintf(stderr, "File %s, Line %ld: ", "wfa_sock.c", (long)471); fprintf(stderr, "socket open error\n");
       return 0;
    }
    strncpy(ifr.ifr_ifrn.ifrn_name, ifname, strlen(ifname));
    ifr.ifr_ifru.ifru_addr.sa_family = 2;
    if(ioctl(fd, 0x8915, &ifr) == 0)
    {
         memcpy(sa, (struct sockaddr_in *)&ifr.ifr_ifru.ifru_addr, sizeof(struct sockaddr_in));
    }
    else
    {
         return 0;
    }
    asd_closeSocket(fd);
    return 0;
}

variable_types:
ifname
char *

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

variable_types: struct ifreq { union { char ifrn_name[16]; } ifr_ifrn; union { struct sockaddr { unsigned short sa_family; char sa_data[14]; } ifru_addr; struct sockaddr ifru_dstaddr; struct sockaddr ifru_broadaddr; struct sockaddr ifru_netmask; struct sockaddr ifru_hwaddr; short ifru_flags; int ifru_ivalue; int ifru_mtu; struct ifmap { unsigned long mem_start; unsigned long mem_end; unsigned short base_addr; unsigned char irq; unsigned char dma; unsigned char port; } ifru_map; char ifru_slave[16]; char ifru_newname[16]; void *ifru_data; struct if_settings { unsigned int type; unsigned int size; union { struct raw_hdlc_proto { unsigned short encoding; unsigned short parity; } *raw_hdlc; struct cisco_proto { unsigned int interval; unsigned int timeout; } *cisco; struct fr_proto { unsigned int t391; unsigned int t392; unsigned int n391; unsigned int n392; unsigned int n393; unsigned short lmi; unsigned short dce; } *fr; struct fr_proto_pvc { unsigned int dlci; } *fr_pvc; struct fr_proto_pvc_info { unsigned int dlci; char master[16]; } *fr_pvc_info; struct sync_serial_settings { unsigned int clock_rate; unsigned int clock_type; unsigned short loopback; } *sync; struct te1_settings { unsigned int clock_rate; unsigned int clock_type; unsigned short loopback; unsigned int slot_map; } *te1; } ifs_ifsu; } ifru_settings; } ifr_ifru; }

variable_types: fd int

user_defined_types: struct ifreq { union { char ifrn_name[16]; } ifr_ifrn; union { struct sockaddr ifru_addr; struct sockaddr ifru_dstaddr; struct sockaddr ifru_broadaddr; struct sockaddr ifru_netmask; struct sockaddr ifru_hwaddr; short ifru_flags; int ifru_ivalue; int ifru_mtu; struct ifmap ifru_map; char ifru_slave[16]; char ifru_newname[16]; void *ifru_data; struct if_settings ifru_settings; } ifr_ifru; }

user_defined_types: struct if_settings { unsigned int type; unsigned int size; union { struct raw_hdlc_proto *raw_hdlc; struct cisco_proto *cisco; struct fr_proto *fr; struct fr_proto_pvc *fr_pvc; struct fr_proto_pvc_info *fr_pvc_info; struct sync_serial_settings *sync; struct te1_settings *te1; } ifs_ifsu; }


wfaCreateTCPServSock

decompiled_code:
__int64 __fastcall wfaCreateTCPServSock(__int16 a1)
{
int v1; // eax
unsigned int v2; // er12
int v3; // edx
const void *v4; // rcx
socklen_t v5; // er8
__int64 result; // rax
struct sockaddr addr; // [rsp+10h] [rbp-28h] BYREF

v1 = socket(2, 1, 6);
if ( v1 < 0 )
{
fprintf(stderr, "File %s, Line %ld: ", "wfa_sock.c", 143LL);
fwrite("createTCPServSock socket() failed", 1uLL, 0x21uLL, stderr);
result = 0LL;
}
else
{
v2 = v1;
addr = 0LL;
wfaGetifAddr(&gnetIf, (__m128i *)&addr);
addr.sa_family = 2;
*(_WORD *)addr.sa_data = _bswap_16(a1);
setsockopt(v2, 1, v3, v4, v5);
if ( bind(v2, &addr, 0x10u) < 0 )
{
fprintf(stderr, "File %s, Line %ld: ", "wfa_sock.c", 163LL);
fwrite("bind() failed", 1uLL, 0xDuLL, stderr);
result = 0LL;
}
else
{
if ( listen(v2, 2) < 0 )
{
v2 = 0;
fprintf(stderr, "File %s, Line %ld: ", "wfa_sock.c", 170LL);
fwrite("listen() failed", 1uLL, 0xFuLL, stderr);
}
result = v2;
}
}
return result;
}

canonical_decompiled_code:
__int64 __fastcall func13(__int16 a1)
{
int v1; // eax
unsigned int v2; // er12
int v3; // edx
const void *v4; // rcx
socklen_t v5; // er8
__int64 result; // rax
struct sockaddr addr; // [rsp+10h] [rbp-28h] BYREF

v1 = socket(2, 1, 6);
if ( v1 < 0 )
{
fprintf(stderr, "File %s, Line %ld: ", "wfa_sock.c", 143LL);
fwrite("createTCPServSock socket() failed", 1uLL, 0x21uLL, stderr);
result = 0LL;
}
else
{
v2 = v1;
addr = 0LL;
func12(&gnetIf, (__m128i *)&addr);
addr.sa_family = 2;
*(_WORD *)addr.sa_data = func0(a1);
setsockopt(v2, 1, v3, v4, v5);
if ( bind(v2, &addr, 0x10u) < 0 )
{
fprintf(stderr, "File %s, Line %ld: ", "wfa_sock.c", 163LL);
fwrite("bind() failed", 1uLL, 0xDuLL, stderr);
result = 0LL;
}
else
{
if ( listen(v2, 2) < 0 )
{
v2 = 0;
fprintf(stderr, "File %s, Line %ld: ", "wfa_sock.c", 170LL);
fwrite("listen() failed", 1uLL, 0xFuLL, stderr);
}
result = v2;
}
}
return result;
}

original_code:
int wfaCreateTCPServSock(unsigned short port)
{
    int sock;
    struct sockaddr_in servAddr;
    const int on = 1;
    if ((sock = socket(2, SOCK_STREAM, IPPROTO_TCP)) < 0)
    {
        fprintf(stderr, "File %s, Line %ld: ", "wfa_sock.c", (long)143); fprintf(stderr, "createTCPServSock socket() failed");
        return 0;
    }
    memset(&servAddr, 0, sizeof(servAddr));
    wfaGetifAddr(gnetIf, &servAddr);
    servAddr.sin_family = 2;
    servAddr.sin_port = htons(port);
    setsockopt(sock, 1, 2, (const char *)&on, sizeof(on));
    if (bind(sock, (struct sockaddr *) &servAddr, sizeof(servAddr)) < 0)
    {
        fprintf(stderr, "File %s, Line %ld: ", "wfa_sock.c", (long)163); fprintf(stderr, "bind() failed");
        return 0;
    }
    if (listen(sock, 2) < 0)
    {
        fprintf(stderr, "File %s, Line %ld: ", "wfa_sock.c", (long)170); fprintf(stderr, "listen() failed");
        return 0;
    }
    return sock;
}

canonical_original_code:
int wfaCreateTCPServSock(unsigned short port)
{
    int sock;
    struct sockaddr_in servAddr;
    int on = 1;
    if ((sock = socket(2, SOCK_STREAM, IPPROTO_TCP)) < 0)
    {
        fprintf(stderr, "File %s, Line %ld: ", "wfa_sock.c", (long)143); fprintf(stderr, "createTCPServSock socket() failed");
        return 0;
    }
    memset(&servAddr, 0, sizeof(servAddr));
    wfaGetifAddr(gnetIf, &servAddr);
    servAddr.sin_family = 2;
    servAddr.sin_port = htons(port);
    setsockopt(sock, 1, 2, (char *)&on, sizeof(on));
    if (bind(sock, (struct sockaddr *) &servAddr, sizeof(servAddr)) < 0)
    {
        fprintf(stderr, "File %s, Line %ld: ", "wfa_sock.c", (long)163); fprintf(stderr, "bind() failed");
        return 0;
    }
    if (listen(sock, 2) < 0)
    {
        fprintf(stderr, "File %s, Line %ld: ", "wfa_sock.c", (long)170); fprintf(stderr, "listen() failed");
        return 0;
    }
    return sock;
}

variable_types:
port
unsigned short

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

variable_types: on int


wfaSetProcPriority

decompiled_code:
__int64 __fastcall wfaSetProcPriority(int a1)
{
unsigned int v1; // er12
int v2; // eax
struct sched_param param; // [rsp+Ch] [rbp-1Ch] BYREF

param.__sched_priority = 0;
sched_getparam(0, &param);
v1 = param.__sched_priority;
if ( a1 )
{
if ( geteuid() )
{
LABEL_5:
mlockall(3);
return v1;
}
v2 = sched_get_priority_max(1);
if ( v2 != -1 )
{
param.__sched_priority = v2;
sched_setscheduler(0, 1, &param);
goto LABEL_5;
}
v1 = 0;
}
else
{
if ( !geteuid() )
{
param.__sched_priority = 0;
sched_setscheduler(0, 0, &param);
}
munlockall();
}
return v1;
}

canonical_decompiled_code:
__int64 __fastcall func14(int a1)
{
unsigned int v1; // er12
int v2; // eax
struct sched_param param; // [rsp+Ch] [rbp-1Ch] BYREF

param.__sched_priority = 0;
sched_getparam(0, &param);
v1 = param.__sched_priority;
if ( a1 )
{
if ( geteuid() )
{
LABEL_5:
mlockall(3);
return v1;
}
v2 = sched_get_priority_max(1);
if ( v2 != -1 )
{
param.__sched_priority = v2;
sched_setscheduler(0, 1, &param);
goto LABEL_5;
}
v1 = 0;
}
else
{
if ( !geteuid() )
{
param.__sched_priority = 0;
sched_setscheduler(0, 0, &param);
}
munlockall();
}
return v1;
}

original_code:
int wfaSetProcPriority(int set)
{
    int maxprio, currprio;
    struct sched_param schp;
    memset(&schp, 0, sizeof(schp));
    sched_getparam(0, &schp);
    currprio = schp.sched_priority;
    if(set != 0)
    {
        if(geteuid() == 0)
        {
           maxprio = sched_get_priority_max(1);
           if(maxprio == -1)
           {
              return 0;
           }
           schp.sched_priority = maxprio;
           if(sched_setscheduler(0, 1, &schp) != 0)
           {
           }
        }
        if(mlockall(1 | 2) != 0)
        {
        }
    }
    else
    {
        if(geteuid() == 0)
        {
           schp.sched_priority = 0;
           if(sched_setscheduler(0, 0, &schp) != 0)
           {
           }
        }
        munlockall();
    }
    return currprio;
}

canonical_original_code:
int wfaSetProcPriority(int set)
{
    int maxprio; int currprio;
    struct sched_param schp;
    memset(&schp, 0, sizeof(schp));
    sched_getparam(0, &schp);
    currprio = schp.sched_priority;
    if(set != 0)
    {
        if(geteuid() == 0)
        {
           maxprio = sched_get_priority_max(1);
           if(maxprio == -1)
           {
              return 0;
           }
           schp.sched_priority = maxprio;
           if(sched_setscheduler(0, 1, &schp) != 0)
           {
           }
        }
        if(mlockall(1 | 2) != 0)
        {
        }
    }
    else
    {
        if(geteuid() == 0)
        {
           schp.sched_priority = 0;
           if(sched_setscheduler(0, 0, &schp) != 0)
           {
           }
        }
        munlockall();
    }
    return currprio;
}

variable_types: set int

variable_types: maxprio int

variable_types: currprio int

variable_types: struct sched_param { int sched_priority; }


decompiled_code:
char *__fastcall get_rwl_exe_path(char *a1, int a2)
{
return strncpy(a1, "./wl", a2);
}

canonical_decompiled_code:
char *__fastcall func0(char *a1, int a2)
{
return strncpy(a1, "./wl", a2);
}

original_code:
void
get_rwl_exe_path(char *rwl_exe_path, int exe_path_len)
{
 strncpy(rwl_exe_path, "./wl", exe_path_len);
}


decompiled_code:
__int64 error_check()
{
return (unsigned int)-(*_errno_location() != 4);
}

canonical_decompiled_code:
__int64 func1()
{
return (unsigned int)-(*_errno_location() != 4);
}

original_code:
int
error_check(int errno_defined)
{
 if ((*__errno_location ()) == 4)
  return 0;
 else
  return -1;
}


decompiled_code:
// attributes: thunk
__int64 interface_validation()
{
return isString();
}

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

original_code:
int
interface_validation(char *interfac)
{
 return isString(interfac);
}

variable_types:
interfac
char *


NotDefinedYet

decompiled_code:
__int64 NotDefinedYet()
{
if ( (wfa_defined_debug & 4) != 0 )
fwrite("The command processing function not defined.\n", 1uLL, 0x2DuLL, stdout);
return 1LL;
}

canonical_decompiled_code:
__int64 func0()
{
if ( (wfa_defined_debug & 4) != 0 )
fwrite("The command processing function not defined.\n", 1uLL, 0x2DuLL, stdout);
return 1LL;
}

original_code:
int NotDefinedYet(int len, unsigned char *params, int *respLen, BYTE *respBuf)
{
    if(wfa_defined_debug & 0x0004) fprintf(stdout, "The command processing function not defined.\n");
    return 1;
}

canonical_original_code:
int NotDefinedYet(int len, unsigned char *params, int *respLen, unsigned char *respBuf)
{
    if(wfa_defined_debug & 0x0004) fprintf(stdout, "The command processing function not defined.\n");
    return 1;
}

variable_types: len int

variable_types:
params
unsigned char *

variable_types:
respLen
int *

variable_types:
respBuf
unsigned char *


decompiled_code:
int print_usage()
{
return puts("Usage: encrypt_passwd PASSWORD [SALT]");
}

canonical_decompiled_code:
int func0()
{
return puts("Usage: encrypt_passwd PASSWORD [SALT]");
}

original_code:
void print_usage()
{
 printf("Usage: encrypt_passwd PASSWORD [SALT]\n");
}


main

canonical_name: main

decompiled_code:
int __cdecl main(int argc, const char **argv, const char **envp)
{
const char *v3; // rdi
const char *v4; // rsi
const char *v5; // rdi
int result; // eax

if ( argc == 2 )
{
v3 = argv[1];
v4 = 0LL;
}
else
{
if ( argc != 3 )
{
print_usage();
return -1;
}
v3 = argv[1];
v4 = argv[2];
}
v5 = (const char *)generate_encrypted_password(v3, v4, envp);
if ( v5 )
{
puts(v5);
result = 0;
}
else
{
puts("An error occured.");
result = -1;
}
return result;
}

canonical_decompiled_code:
int __cdecl main(int argc, const char **argv, const char **envp)
{
const char *v3; // rdi
const char *v4; // rsi
const char *v5; // rdi
int result; // eax

if ( argc == 2 )
{
v3 = argv[1];
v4 = 0LL;
}
else
{
if ( argc != 3 )
{
func0();
return -1;
}
v3 = argv[1];
v4 = argv[2];
}
v5 = (const char *)generate_encrypted_password(v3, v4, envp);
if ( v5 )
{
puts(v5);
result = 0;
}
else
{
puts("An error occured.");
result = -1;
}
return result;
}

original_code:
int main(int argc, char *argv[])
{
 char *passwd;
 char *salt;
 if(argc == 2) {
  passwd = argv[1];
  salt = ((void *)0);
 } else if(argc == 3) {
  passwd = argv[1];
  salt = argv[2];
 } else {
  print_usage();
  return -1;
 }
 char *encrypted_passwd = generate_encrypted_password(passwd, salt);
 if(encrypted_passwd == ((void *)0)) {
  printf("An error occured.\n");
  return -1;
 }
 printf("%s\n", encrypted_passwd);
 return 0;
}

variable_types: argc int

variable_types:
argv
char *[]

variable_types:
passwd
char *

variable_types:
salt
char *


decompiled_code:
__int64 __fastcall storage_connect(char *name, unsigned int a2)
{
int v2; // ebx
int v3; // er8
__int64 result; // rax
struct addrinfo *v5; // [rsp+0h] [rbp-C8h] BYREF
char service[8]; // [rsp+8h] [rbp-C0h] BYREF
struct addrinfo req; // [rsp+10h] [rbp-B8h] BYREF
char s[136]; // [rsp+40h] [rbp-88h] BYREF

if ( !name
|| (unsigned int)my_strvalidate(name, 3LL)
|| (sprintf(s, "Attempting to connect to server '%s'\n", name), v2 = socket(2, 1, 0), v2 < 0)
|| (*(_OWORD *)&req.ai_flags = 0LL,
*(_OWORD *)&req.ai_addrlen = 0LL,
req.ai_socktype = 1,
*(_OWORD *)&req.ai_canonname = 0LL,
snprintf(service, 8uLL, "%d", a2),
getaddrinfo(name, service, &req, &v5)) )
{
*_errno_location() = 1;
result = 0LL;
}
else
{
v3 = connect(v2, v5->ai_addr, v5->ai_addrlen);
result = v2;
if ( v3 )
{
*_errno_location() = 2;
result = 0LL;
}
}
return result;
}

canonical_decompiled_code:
__int64 __fastcall func0(char *name, unsigned int a2)
{
int v2; // ebx
int v3; // er8
__int64 result; // rax
struct addrinfo *v5; // [rsp+0h] [rbp-C8h] BYREF
char service[8]; // [rsp+8h] [rbp-C0h] BYREF
struct addrinfo req; // [rsp+10h] [rbp-B8h] BYREF
char s[136]; // [rsp+40h] [rbp-88h] BYREF

if ( !name
|| (unsigned int)my_strvalidate(name, 3LL)
|| (sprintf(s, "Attempting to connect to server '%s'\n", name), v2 = socket(2, 1, 0), v2 < 0)
|| (*(_OWORD *)&req.ai_flags = 0LL,
*(_OWORD *)&req.ai_addrlen = 0LL,
req.ai_socktype = 1,
*(_OWORD *)&req.ai_canonname = 0LL,
snprintf(service, 8uLL, "%d", a2),
getaddrinfo(name, service, &req, &v5)) )
{
*_errno_location() = 1;
result = 0LL;
}
else
{
v3 = connect(v2, v5->ai_addr, v5->ai_addrlen);
result = v2;
if ( v3 )
{
*_errno_location() = 2;
result = 0LL;
}
}
return result;
}

original_code:
void* storage_connect(const char *hostname, const int port)
{
 char buff[100];
 if (hostname == ((void *)0)) {
  (*__errno_location ()) = 1;
  return ((void *)0);
 }
 if (my_strvalidate(hostname, 3)) {
  (*__errno_location ())=1;
  return ((void *)0);
 }
 sprintf(buff, "Attempting to connect to server '%s'\n",
   hostname);
 if (0 == 1) logger(stdout, buff);
 else if (0 == 2) logger(file, buff);
 int sock = socket(2, SOCK_STREAM, 0);
 if (sock < 0){
  (*__errno_location ())=1;
  return ((void *)0);
 }
 struct addrinfo serveraddr, *res;
 memset(&serveraddr, 0, sizeof serveraddr);
 serveraddr.ai_family = 0;
 serveraddr.ai_socktype = SOCK_STREAM;
 char portstr[8];
 snprintf(portstr, sizeof portstr, "%d", port);
 int status = getaddrinfo(hostname, portstr, &serveraddr, &res);
 if (status != 0){
  (*__errno_location ())=1;
  return ((void *)0);
 }
 status = connect(sock, res->ai_addr, res->ai_addrlen);
 if (status != 0){
  (*__errno_location ())=2;
  return ((void *)0);
 }
 return (void*) sock;
}

canonical_original_code:
void *storage_connect(char *hostname, int port)
{
 char buff[100];
 if (hostname == ((void *)0)) {
  (*__errno_location ()) = 1;
  return ((void *)0);
 }
 if (my_strvalidate(hostname, 3)) {
  (*__errno_location ())=1;
  return ((void *)0);
 }
 sprintf(buff, "Attempting to connect to server '%s'\n",
   hostname);
 if (0 == 1) logger(stdout, buff);
 else if (0 == 2) logger(file, buff);
 int sock = socket(2, SOCK_STREAM, 0);
 if (sock < 0){
  (*__errno_location ())=1;
  return ((void *)0);
 }
 struct addrinfo serveraddr; struct addrinfo *res;
 memset(&serveraddr, 0, sizeof serveraddr);
 serveraddr.ai_family = 0;
 serveraddr.ai_socktype = SOCK_STREAM;
 char portstr[8];
 snprintf(portstr, sizeof portstr, "%d", port);
 int status = getaddrinfo(hostname, portstr, &serveraddr, &res);
 if (status != 0){
  (*__errno_location ())=1;
  return ((void *)0);
 }
 status = connect(sock, res->ai_addr, res->ai_addrlen);
 if (status != 0){
  (*__errno_location ())=2;
  return ((void *)0);
 }
 return (void *) sock;
}

variable_types:
hostname
char *

variable_types: port int

variable_types:
buff
char [100]

variable_types: sock int

variable_types: struct addrinfo { int ai_flags; int ai_family; int ai_socktype; int ai_protocol; unsigned int ai_addrlen; struct sockaddr { unsigned short sa_family; char sa_data[14]; } *ai_addr; char *ai_canonname; struct addrinfo *ai_next; } *

variable_types:
portstr
char [8]

variable_types: status int

return_type: void *

user_defined_types: struct addrinfo { int ai_flags; int ai_family; int ai_socktype; int ai_protocol; unsigned int ai_addrlen; struct sockaddr *ai_addr; char *ai_canonname; struct addrinfo *ai_next; }


decompiled_code:
__int64 __fastcall storage_auth(const char *a1, __int64 a2, __int64 a3)
{
unsigned int v3; // ebx
const char *v4; // rax
size_t v5; // rax
__int64 result; // rax
char v7[112]; // [rsp+0h] [rbp-2098h] BYREF
char s[8232]; // [rsp+70h] [rbp-2028h] BYREF

if ( a3 )
{
if ( a1 && a2 )
{
v3 = a3;
sprintf(v7, "Attempting to Login with username '%s'\n", a1);
memset(s, 0, 0x2000uLL);
v4 = (const char *)generate_encrypted_password(a2, 0LL);
snprintf(s, 0x2000uLL, "AUTH %s %s\n", a1, v4);
v5 = strlen(s);
if ( (unsigned int)sendall(v3, s, v5)
|| (result = recvline(v3, s, 0x2000LL), (_DWORD)result)
|| s[0] == 45 && s[1] == 49 && !s[2] )
{
auth = 0;
*_errno_location() = 4;
result = 0xFFFFFFFFLL;
}
else
{
auth = 1;
}
}
else
{
*_errno_location() = 1;
result = 0xFFFFFFFFLL;
}
}
else
{
*_errno_location() = 2;
result = 0xFFFFFFFFLL;
}
return result;
}

canonical_decompiled_code:
__int64 __fastcall func1(const char *a1, __int64 a2, __int64 a3)
{
unsigned int v3; // ebx
const char *v4; // rax
size_t v5; // rax
__int64 result; // rax
char v7[112]; // [rsp+0h] [rbp-2098h] BYREF
char s[8232]; // [rsp+70h] [rbp-2028h] BYREF

if ( a3 )
{
if ( a1 && a2 )
{
v3 = a3;
sprintf(v7, "Attempting to Login with username '%s'\n", a1);
memset(s, 0, 0x2000uLL);
v4 = (const char *)generate_encrypted_password(a2, 0LL);
snprintf(s, 0x2000uLL, "AUTH %s %s\n", a1, v4);
v5 = strlen(s);
if ( (unsigned int)sendall(v3, s, v5)
|| (result = recvline(v3, s, 0x2000LL), (_DWORD)result)
|| s[0] == 45 && s[1] == 49 && !s[2] )
{
auth = 0;
*_errno_location() = 4;
result = 0xFFFFFFFFLL;
}
else
{
auth = 1;
}
}
else
{
*_errno_location() = 1;
result = 0xFFFFFFFFLL;
}
}
else
{
*_errno_location() = 2;
result = 0xFFFFFFFFLL;
}
return result;
}

original_code:
int storage_auth(const char *username, const char *passwd, void *conn)
{
 if (!conn) {
  (*__errno_location ()) = 2;
  return -1;
 }
 if (username == ((void *)0)) {
  (*__errno_location ()) = 1;
  return -1;
 }
 if (passwd == ((void *)0)) {
  (*__errno_location ()) = 1;
  return -1;
 }
 char buff[100];
 sprintf(buff, "Attempting to Login with username  '%s'\n",username);
 if (0 == 1) logger(stdout, buff);
 else if (0 == 2) logger(file, buff);
 int sock = (int)conn;
 char buf[(1024 * 8)];
 memset(buf, 0, sizeof buf);
 char *encrypted_passwd = generate_encrypted_password(passwd, ((void *)0));
 snprintf(buf, sizeof buf, "AUTH %s %s\n", username, encrypted_passwd);
 if (sendall(sock, buf, strlen(buf)) == 0 && recvline(sock, buf, sizeof buf) == 0) {
  if (strcmp (buf, "-1") == 0) {
   auth = 0;
   (*__errno_location ()) = 4;
   return -1;
  }
  auth=1;
  return 0;
 }
 auth=0;
 (*__errno_location ())=4;
 return -1;
}

canonical_original_code:
int storage_auth(char *username, char *passwd, void *conn)
{
 if (!conn) {
  (*__errno_location ()) = 2;
  return -1;
 }
 if (username == ((void *)0)) {
  (*__errno_location ()) = 1;
  return -1;
 }
 if (passwd == ((void *)0)) {
  (*__errno_location ()) = 1;
  return -1;
 }
 char buff[100];
 sprintf(buff, "Attempting to Login with username  '%s'\n",username);
 if (0 == 1) logger(stdout, buff);
 else if (0 == 2) logger(file, buff);
 int sock = (int)conn;
 char buf[-1];
 memset(buf, 0, sizeof buf);
 char *encrypted_passwd = generate_encrypted_password(passwd, ((void *)0));
 snprintf(buf, sizeof buf, "AUTH %s %s\n", username, encrypted_passwd);
 if (sendall(sock, buf, strlen(buf)) == 0 && recvline(sock, buf, sizeof buf) == 0) {
  if (strcmp (buf, "-1") == 0) {
   auth = 0;
   (*__errno_location ()) = 4;
   return -1;
  }
  auth=1;
  return 0;
 }
 auth=0;
 (*__errno_location ())=4;
 return -1;
}

variable_types:
username
char *

variable_types:
conn
void *

variable_types:
buf
char [-1]


decompiled_code:
__int64 __fastcall storage_disconnect(__int64 a1)
{
unsigned int v1; // er12

if ( a1 && (int)a1 >= 0 )
{
auth = 0;
v1 = close(a1);
if ( v1 == -1 )
*_errno_location() = 7;
else
v1 = 0;
}
else
{
v1 = -1;
*_errno_location() = 1;
}
return v1;
}

canonical_decompiled_code:
__int64 __fastcall func5(__int64 a1)
{
unsigned int v1; // er12

if ( a1 && (int)a1 >= 0 )
{
auth = 0;
v1 = close(a1);
if ( v1 == -1 )
*_errno_location() = 7;
else
v1 = 0;
}
else
{
v1 = -1;
*_errno_location() = 1;
}
return v1;
}

original_code:
int storage_disconnect(void *conn)
{
 if (!conn) {
  (*__errno_location ()) = 1;
  return -1;
 }
 int sock = (int)conn;
 if (sock < 0){
  (*__errno_location ())=1;
  return -1;
 }
 auth = 0;
 int status = close(sock);
 if (status == -1) {
  (*__errno_location ()) = 7;
  return -1;
 }
 return 0;
}


repo: QCaudron/iterated-inference-pipeline

decompiled_code:
__int64 __fastcall send_par(__int64 a1, unsigned int *a2, __int64 a3, unsigned int a4)
{
__int64 result; // rax
__int64 v8; // rbx
__int64 v9; // rsi
__int64 v10; // rdx

result = *a2;
if ( (int)result > 0 )
{
v8 = 0LL;
do
{
v9 = *(_QWORD *)(*((_QWORD *)a2 + 1) + 8 * v8);
v10 = 8LL * *(int *)(*(_QWORD *)(*(_QWORD *)(a3 + 80) + 8 * v8++) + 4LL);
result = zmq_send(a1, v9, v10, a4);
}
while ( (int)*a2 > (int)v8 );
}
return result;
}

canonical_decompiled_code:
__int64 __fastcall func0(__int64 a1, unsigned int *a2, __int64 a3, unsigned int a4)
{
__int64 result; // rax
__int64 v8; // rbx
__int64 v9; // rsi
__int64 v10; // rdx

result = *a2;
if ( (int)result > 0 )
{
v8 = 0LL;
do
{
v9 = *(_QWORD *)(*((_QWORD *)a2 + 1) + 8 * v8);
v10 = 8LL * *(int *)(*(_QWORD *)(*(_QWORD *)(a3 + 80) + 8 * v8++) + 4LL);
result = zmq_send(a1, v9, v10, a4);
}
while ( (int)*a2 > (int)v8 );
}
return result;
}

original_code:
void send_par(void *socket, const struct s_par *p_par, struct s_data *p_data, int zmq_options)
{
    int i;
    for(i=0; i< p_par->size_natural; i++) {
 zmq_send(socket, p_par->natural[i], p_data->routers[i]->n_gp *sizeof (double), zmq_options);
    }
}

canonical_original_code:
void send_par(void *socket, struct s_par *p_par, struct s_data *p_data, int zmq_options)
{
    int i;
    for(i=0; i< p_par->size_natural; i++) {
 zmq_send(socket, p_par->natural[i], p_data->routers[i]->n_gp *sizeof (double), zmq_options);
    }
}

variable_types:
socket
void *

variable_types: struct s_par { int size_natural; double **natural; } *

variable_types: struct s_data { char **ts_name; char **cac_name; char *remainder_name; char u_data[2]; enum plom_implementations { PLOM_ODE=0, PLOM_SDE=1, PLOM_PSR=2 } implementation; enum plom_noises_off { PLOM_NO_DEM_STO=expr, PLOM_NO_ENV_STO=expr, PLOM_NO_DRIFT=expr } noises_off; double **data; unsigned int *indn_data_nonan; unsigned int *times; struct s_data_ind { int n_nonan; unsigned int *ind_nonan; } **data_ind; struct s_obs2ts { int n_ts_unique; unsigned int *n_stream; unsigned int *n_cac; unsigned int ***cac; int offset; } **obs2ts; struct s_router { int p; int n_gp; unsigned int *map; char *name; char **group_name; double (**f)(double, double, double); double (**f_inv)(double, double, double); double (**f_scale)(double); double (**f_derivative)(double, double, double); double (**f_inv_derivative)(double, double, double); double multiplier; int is_duration; double *min; double *max; double *min_z; double *max_z; } **routers; struct s_drift { int ind_par_Xdrift_applied; int ind_volatility_Xdrift; int offset; } **drift; struct s_iterator { int length; unsigned int *ind; unsigned int *offset; int nbtot; } *p_it_all; struct s_iterator *p_it_only_drift; struct s_iterator *p_it_par_sv; struct s_iterator *p_it_all_no_drift; struct s_iterator *p_it_par_proc_par_obs_no_drift; struct s_iterator *p_it_par_sv_and_drift; struct s_iterator *p_it_noise; struct s_iterator *p_it_all_no_theta_remainder; struct s_iterator *p_it_theta_remainder; int nb_obs; int nb_obs_nonan; unsigned int *n_terms; double *prop_school; double ***school_terms; double **waifw; void *method_specific_data; } *

variable_types: i int

user_defined_types: struct s_data { char **ts_name; char **cac_name; char *remainder_name; char u_data[2]; enum plom_implementations implementation; enum plom_noises_off noises_off; double **data; unsigned int *indn_data_nonan; unsigned int *times; struct s_data_ind **data_ind; struct s_obs2ts **obs2ts; struct s_router **routers; struct s_drift **drift; struct s_iterator *p_it_all; struct s_iterator *p_it_only_drift; struct s_iterator *p_it_par_sv; struct s_iterator *p_it_all_no_drift; struct s_iterator *p_it_par_proc_par_obs_no_drift; struct s_iterator *p_it_par_sv_and_drift; struct s_iterator *p_it_noise; struct s_iterator *p_it_all_no_theta_remainder; struct s_iterator *p_it_theta_remainder; int nb_obs; int nb_obs_nonan; unsigned int *n_terms; double *prop_school; double ***school_terms; double **waifw; void *method_specific_data; }


decompiled_code:
__int64 __fastcall recv_par(unsigned int *a1, __int64 a2, __int64 a3)
{
__int64 result; // rax
__int64 v6; // rbx
__int64 v7; // rsi
__int64 v8; // rdx

result = *a1;
if ( (int)result > 0 )
{
v6 = 0LL;
do
{
v7 = *(_QWORD *)(*((_QWORD *)a1 + 1) + 8 * v6);
v8 = 8LL * *(int *)(*(_QWORD *)(*(_QWORD *)(a2 + 80) + 8 * v6++) + 4LL);
result = zmq_recv(a3, v7, v8, 0LL);
}
while ( (int)*a1 > (int)v6 );
}
return result;
}

canonical_decompiled_code:
__int64 __fastcall func1(unsigned int *a1, __int64 a2, __int64 a3)
{
__int64 result; // rax
__int64 v6; // rbx
__int64 v7; // rsi
__int64 v8; // rdx

result = *a1;
if ( (int)result > 0 )
{
v6 = 0LL;
do
{
v7 = *(_QWORD *)(*((_QWORD *)a1 + 1) + 8 * v6);
v8 = 8LL * *(int *)(*(_QWORD *)(*(_QWORD *)(a2 + 80) + 8 * v6++) + 4LL);
result = zmq_recv(a3, v7, v8, 0LL);
}
while ( (int)*a1 > (int)v6 );
}
return result;
}

original_code:
void recv_par(struct s_par *p_par, struct s_data *p_data, void *socket)
{
    int i;
    for(i=0; i< p_par->size_natural; i++) {
 zmq_recv(socket, p_par->natural[i], p_data->routers[i]->n_gp * sizeof (double), 0);
    }
}

user_defined_types: struct s_par { int size_natural; double **natural; }

user_defined_types: enum plom_implementations { PLOM_ODE=0, PLOM_SDE=1, PLOM_PSR=2 }

user_defined_types: enum plom_noises_off { PLOM_NO_DEM_STO=expr, PLOM_NO_ENV_STO=expr, PLOM_NO_DRIFT=expr }

user_defined_types: struct s_iterator { int length; unsigned int *ind; unsigned int *offset; int nbtot; }

user_defined_types: struct s_data_ind { int n_nonan; unsigned int *ind_nonan; }

user_defined_types: struct s_obs2ts { int n_ts_unique; unsigned int *n_stream; unsigned int *n_cac; unsigned int ***cac; int offset; }

user_defined_types: struct s_router { int p; int n_gp; unsigned int *map; char *name; char **group_name; double (**f)(double, double, double); double (**f_inv)(double, double, double); double (**f_scale)(double); double (**f_derivative)(double, double, double); double (**f_inv_derivative)(double, double, double); double multiplier; int is_duration; double *min; double *max; double *min_z; double *max_z; }

user_defined_types: struct s_drift { int ind_par_Xdrift_applied; int ind_volatility_Xdrift; int offset; }


decompiled_code:
__int64 __fastcall send_X(__int64 a1, _QWORD *a2, __int64 a3, unsigned int a4)
{
int v5; // ebx

v5 = N_TS_INC_UNIQUE + *(_DWORD *)(*(_QWORD *)(a3 + 104) + 24LL) + N_CAC * N_PAR_SV;
zmq_send(a1, a2 + 2, 8LL, 2LL);
zmq_send(a1, a2[1], 8LL * N_TS, 2LL);
return zmq_send(a1, *a2, 8LL * v5, a4);
}

canonical_decompiled_code:
__int64 __fastcall func2(__int64 a1, _QWORD *a2, __int64 a3, unsigned int a4)
{
int v5; // ebx

v5 = N_TS_INC_UNIQUE + *(_DWORD *)(*(_QWORD *)(a3 + 104) + 24LL) + N_CAC * N_PAR_SV;
zmq_send(a1, a2 + 2, 8LL, 2LL);
zmq_send(a1, a2[1], 8LL * N_TS, 2LL);
return zmq_send(a1, *a2, 8LL * v5, a4);
}

original_code:
void send_X(void *socket, const struct s_X *p_X, struct s_data *p_data, int zmq_options)
{
    int size_proj = N_PAR_SV*N_CAC + p_data->p_it_only_drift->nbtot + N_TS_INC_UNIQUE;
    zmq_send(socket, &(p_X->dt), sizeof (double), 2);
    zmq_send(socket, p_X->obs, N_TS * sizeof (double), 2);
    zmq_send(socket, p_X->proj, size_proj * sizeof (double), zmq_options);
}

canonical_original_code:
void send_X(void *socket, struct s_X *p_X, struct s_data *p_data, int zmq_options)
{
    int size_proj = N_PAR_SV*N_CAC + p_data->p_it_only_drift->nbtot + N_TS_INC_UNIQUE;
    zmq_send(socket, &(p_X->dt), sizeof (double), 2);
    zmq_send(socket, p_X->obs, N_TS * sizeof (double), 2);
    zmq_send(socket, p_X->proj, size_proj * sizeof (double), zmq_options);
}

variable_types: struct s_X { double *proj; double *obs; double dt; double dt0; } *


decompiled_code:
__int64 __fastcall recv_X(_QWORD *a1, __int64 a2, __int64 a3)
{
int v4; // ebx

v4 = N_TS_INC_UNIQUE + *(_DWORD *)(*(_QWORD *)(a2 + 104) + 24LL) + N_CAC * N_PAR_SV;
zmq_recv(a3, a1 + 2, 8LL, 0LL);
zmq_recv(a3, a1[1], 8LL * N_TS, 0LL);
return zmq_recv(a3, *a1, 8LL * v4, 0LL);
}

canonical_decompiled_code:
__int64 __fastcall func3(_QWORD *a1, __int64 a2, __int64 a3)
{
int v4; // ebx

v4 = N_TS_INC_UNIQUE + *(_DWORD *)(*(_QWORD *)(a2 + 104) + 24LL) + N_CAC * N_PAR_SV;
zmq_recv(a3, a1 + 2, 8LL, 0LL);
zmq_recv(a3, a1[1], 8LL * N_TS, 0LL);
return zmq_recv(a3, *a1, 8LL * v4, 0LL);
}

original_code:
void recv_X(struct s_X *p_X, struct s_data *p_data, void *socket)
{
    int size_proj = N_PAR_SV*N_CAC + p_data->p_it_only_drift->nbtot + N_TS_INC_UNIQUE;
    zmq_recv(socket, &(p_X->dt), sizeof (double), 0);
    zmq_recv(socket, p_X->obs, N_TS * sizeof (double), 0);
    zmq_recv(socket, p_X->proj, size_proj * sizeof (double), 0);
}

user_defined_types: struct s_X { double *proj; double *obs; double dt; double dt0; }


decompiled_code:
__time_t s_clock()
{
struct timeval v1; // [rsp+0h] [rbp-18h] BYREF

gettimeofday(&v1, 0LL);
return 1000 * v1.tv_sec + v1.tv_usec / 1000;
}

canonical_decompiled_code:
__time_t func0()
{
struct timeval v1; // [rsp+0h] [rbp-18h] BYREF

gettimeofday(&v1, 0LL);
return 1000 * v1.tv_sec + v1.tv_usec / 1000;
}

original_code:
int64_t s_clock (void)
{
    struct timeval tv;
    gettimeofday (&tv, ((void *)0));
    return (int64_t) (tv.tv_sec * 1000 + tv.tv_usec / 1000);
}

canonical_original_code:
long s_clock()
{
    struct timeval tv;
    gettimeofday (&tv, ((void *)0));
    return (long) (tv.tv_sec * 1000 + tv.tv_usec / 1000);
}

variable_types: struct timeval { long tv_sec; long tv_usec; }

return_type: long


original_code:
struct s_duration time_exec(int64_t s1, int64_t s2)
{
    struct s_duration t_exec;
    double duration = ((double) (s2 - s1) / 1000.0);
    t_exec.d = (unsigned int) floor(duration / 86400.0);
    duration -= t_exec.d * 86400.0;
    t_exec.h = (unsigned int) floor(duration / 3600.0);
    duration -= t_exec.h * 3600.0;
    t_exec.m = (unsigned int) floor(duration / 60.0);
    t_exec.s = duration - t_exec.m * 60.0;
    return t_exec;
}

canonical_original_code:
struct s_duration time_exec(long s1, long s2)
{
    struct s_duration t_exec;
    double duration = ((double) (s2 - s1) / 1000.0);
    t_exec.d = (unsigned int) floor(duration / 86400.0);
    duration -= t_exec.d * 86400.0;
    t_exec.h = (unsigned int) floor(duration / 3600.0);
    duration -= t_exec.h * 3600.0;
    t_exec.m = (unsigned int) floor(duration / 60.0);
    t_exec.s = duration - t_exec.m * 60.0;
    return t_exec;
}

variable_types: struct s_duration { unsigned int d; unsigned int h; unsigned int m; double s; }

variable_types: duration double


decompiled_code:
__int64 __fastcall sum1u(_DWORD *a1, int a2)
{
__int64 v2; // rdx
__int64 result; // rax

if ( a2 <= 0 )
return 0LL;
v2 = (__int64)&a1[a2 - 1 + 1];
LODWORD(result) = 0;
do
result = (unsigned int)(*a1++ + result);
while ( a1 != (_DWORD *)v2 );
return result;
}

canonical_decompiled_code:
__int64 __fastcall func2(_DWORD *a1, int a2)
{
__int64 v2; // rdx
__int64 result; // rax

if ( a2 <= 0 )
return 0LL;
v2 = (__int64)&a1[a2 - 1 + 1];
LODWORD(result) = 0;
do
result = (unsigned int)(*a1++ + result);
while ( a1 != (_DWORD *)v2 );
return result;
}

original_code:
unsigned int sum1u(unsigned int *tab, int length_tab)
{
    int i;
    unsigned int res;
    res=0;
    for(i=0; i< length_tab ; i++)
        res+=tab[i];
    return res;
}

variable_types:
tab
unsigned int *

variable_types:
res
unsigned int

return_type: unsigned int


original_code:
void online_mean_var(double *x, int N_x, double *mean, double *var)
{
    int k;
    double n=0.0;
    *mean=0.0;
    double M2=0.0;
    double delta;
    for(k=0;k<N_x;k++)
        {
            n = n + 1.0;
            delta = x[k] - *mean;
            *mean += delta/n;
            M2 += delta*(x[k] - *mean);
        }
    *var = M2/(n - 1.0);
}

canonical_original_code:
void online_mean_var(double *x, int N_x, double *mean, double *var)
{
    int k;
    double n = 0.0;
    *mean=0.0;
    double M2 = 0.0;
    double delta;
    for(k=0;k<N_x;k++)
        {
            n = n + 1.0;
            delta = x[k] - *mean;
            *mean += delta/n;
            M2 += delta*(x[k] - *mean);
        }
    *var = M2/(n - 1.0);
}

variable_types:
x
double *

variable_types:
mean
double *

variable_types:
var
double *

variable_types: k int

variable_types: n double

variable_types: delta double


decompiled_code:
__int64 get_thread_id()
{
return 0LL;
}

canonical_decompiled_code:
__int64 func4()
{
return 0LL;
}

original_code:
int get_thread_id(void)
{
    int thread_id;
    thread_id=0;
    return thread_id;
}

canonical_original_code:
int get_thread_id()
{
    int thread_id;
    thread_id=0;
    return thread_id;
}


decompiled_code:
__int64 __fastcall get_min_u(unsigned int *a1, int a2)
{
unsigned int v2; // edx
__int64 result; // rax
unsigned int *v4; // rdi
unsigned int *v5; // rcx

v2 = *a1;
result = *a1;
if ( a2 > 0 )
{
v4 = a1 + 1;
v5 = &v4[a2 - 1];
while ( 1 )
{
if ( (unsigned int)result > v2 )
result = v2;
if ( v4 == v5 )
break;
v2 = *v4++;
}
}
return result;
}

canonical_decompiled_code:
__int64 __fastcall func5(unsigned int *a1, int a2)
{
unsigned int v2; // edx
__int64 result; // rax
unsigned int *v4; // rdi
unsigned int *v5; // rcx

v2 = *a1;
result = *a1;
if ( a2 > 0 )
{
v4 = a1 + 1;
v5 = &v4[a2 - 1];
while ( 1 )
{
if ( (unsigned int)result > v2 )
result = v2;
if ( v4 == v5 )
break;
v2 = *v4++;
}
}
return result;
}

original_code:
int get_min_u(unsigned int *tab, int length_tab)
{
    int i;
    int min=tab[0];
    for (i=0 ; i<length_tab ;i++){
        if (tab[i]<min) {
            min=tab[i];
        }
    }
    return (min);
}

canonical_original_code:
int get_min_u(unsigned int *tab, int length_tab)
{
    int i;
    int min = tab[0];
    for (i=0 ; i<length_tab ;i++){
        if (tab[i]<min) {
            min=tab[i];
        }
    }
    return (min);
}

variable_types: min int


decompiled_code:
__int64 __fastcall get_max_u(unsigned int *a1, int a2)
{
unsigned int v2; // edx
__int64 result; // rax
unsigned int *v4; // rdi
unsigned int *v5; // rcx

v2 = *a1;
result = *a1;
if ( a2 > 0 )
{
v4 = a1 + 1;
v5 = &v4[a2 - 1];
while ( 1 )
{
if ( (unsigned int)result < v2 )
result = v2;
if ( v4 == v5 )
break;
v2 = *v4++;
}
}
return result;
}

canonical_decompiled_code:
__int64 __fastcall func6(unsigned int *a1, int a2)
{
unsigned int v2; // edx
__int64 result; // rax
unsigned int *v4; // rdi
unsigned int *v5; // rcx

v2 = *a1;
result = *a1;
if ( a2 > 0 )
{
v4 = a1 + 1;
v5 = &v4[a2 - 1];
while ( 1 )
{
if ( (unsigned int)result < v2 )
result = v2;
if ( v4 == v5 )
break;
v2 = *v4++;
}
}
return result;
}

original_code:
int get_max_u(unsigned int *tab, int length_tab)
{
    int i;
    int max=tab[0];
    for (i=0 ; i<length_tab ;i++){
        if (tab[i]>max){
            max=tab[i];
        }
    }
    return (max);
}

canonical_original_code:
int get_max_u(unsigned int *tab, int length_tab)
{
    int i;
    int max = tab[0];
    for (i=0 ; i<length_tab ;i++){
        if (tab[i]>max){
            max=tab[i];
        }
    }
    return (max);
}

variable_types: max int


original_code:
void update_to_be_estimated(struct s_best *p_best)
{
    int k;
    p_best->n_to_be_estimated = 0;
    for(k=0; k<p_best->length; k++) {
        if( (gsl_matrix_get(p_best->var, k, k) > 0.0) && (p_best->is_follower[k] == 0) ) {
            p_best->to_be_estimated[ p_best->n_to_be_estimated ] = k;
            p_best->is_estimated[k] = 1;
            p_best->n_to_be_estimated++;
        } else {
            gsl_matrix_set(p_best->var, k, k, 0.0);
            p_best->is_estimated[k] = 0;
        }
    }
}

variable_types: struct s_best { int length; struct gsl_vector { unsigned long size; unsigned long stride; double *data; struct gsl_block_struct { unsigned long size; double *data; } *block; int owner; } *mean; struct gsl_vector *proposed; struct gsl_matrix { unsigned long size1; unsigned long size2; unsigned long tda; double *data; struct gsl_block_struct *block; int owner; } *var; int n_to_be_estimated; unsigned int *to_be_estimated; unsigned int *is_estimated; int n_follow; unsigned int *follower; unsigned int *follow; unsigned int *is_follower; double *mean_sampling; struct gsl_matrix *var_sampling; double **par_prior; double (**prior)(double x, double a, double b); } *

user_defined_types: struct s_best { int length; struct gsl_vector *mean; struct gsl_vector *proposed; struct gsl_matrix *var; int n_to_be_estimated; unsigned int *to_be_estimated; unsigned int *is_estimated; int n_follow; unsigned int *follower; unsigned int *follow; unsigned int *is_follower; double *mean_sampling; struct gsl_matrix *var_sampling; double **par_prior; double (**prior)(double x, double a, double b); }

user_defined_types: struct gsl_vector { unsigned long size; unsigned long stride; double *data; struct gsl_block_struct *block; int owner; }


decompiled_code:
__int64 __fastcall sanitize_n_threads(unsigned int a1, unsigned int a2)
{
if ( (int)a1 <= (int)a2 )
return a1;
print_warning("N_TREADS > J, N_THREADS has been set to J");
return a2;
}

canonical_decompiled_code:
__int64 __fastcall func8(unsigned int a1, unsigned int a2)
{
if ( (int)a1 <= (int)a2 )
return a1;
print_warning("N_TREADS > J, N_THREADS has been set to J");
return a2;
}

original_code:
int sanitize_n_threads(int n_threads, int J)
{
    if(n_threads > J){
        print_warning("N_TREADS > J, N_THREADS has been set to J");
        return J;
    } else {
        return n_threads;
    }
}

variable_types: J int


decompiled_code:
__int64 __fastcall in_u(int a1, _DWORD *a2, int a3)
{
__int64 v3; // rax

if ( a3 <= 0 )
return 0LL;
v3 = (__int64)&a2[a3 - 1 + 1];
while ( *a2 != a1 )
{
if ( ++a2 == (_DWORD *)v3 )
return 0LL;
}
return 1LL;
}

canonical_decompiled_code:
__int64 __fastcall func9(int a1, _DWORD *a2, int a3)
{
__int64 v3; // rax

if ( a3 <= 0 )
return 0LL;
v3 = (__int64)&a2[a3 - 1 + 1];
while ( *a2 != a1 )
{
if ( ++a2 == (_DWORD *)v3 )
return 0LL;
}
return 1LL;
}

original_code:
int in_u(int i, unsigned int *tab, int length){
    int k;
    for (k=0 ; k< length; k++) {
        if (tab[k] == i) {
            return 1;
        }
    }
    return 0;
}

variable_types: i int

variable_types: length int


decompiled_code:
__int64 __fastcall in_drift(int a1, _DWORD **a2)
{
_DWORD **v2; // rdx

if ( N_DRIFT <= 0 )
return 0LL;
v2 = &a2[N_DRIFT - 1];
while ( **a2 != a1 )
{
if ( a2 == v2 )
return 0LL;
++a2;
}
return 1LL;
}

canonical_decompiled_code:
__int64 __fastcall func10(int a1, _DWORD **a2)
{
_DWORD **v2; // rdx

if ( N_DRIFT <= 0 )
return 0LL;
v2 = &a2[N_DRIFT - 1];
while ( **a2 != a1 )
{
if ( a2 == v2 )
return 0LL;
++a2;
}
return 1LL;
}

original_code:
int in_drift(int i, struct s_drift **drift){
    int k;
    for (k=0; k< N_DRIFT; k++) {
        if (drift[k]->ind_par_Xdrift_applied == i) {
            return 1;
        }
    }
    return 0;
}

variable_types: struct s_drift { int ind_par_Xdrift_applied; int ind_volatility_Xdrift; int offset; } **


decompiled_code:
__int64 __fastcall plom_sanitize_nb_obs(int a1, int a2)
{
__int64 result; // rax

result = (unsigned int)a2;
if ( a1 >= 0 && a2 > a1 )
result = (unsigned int)a1;
return result;
}

canonical_decompiled_code:
__int64 __fastcall func11(int a1, int a2)
{
__int64 result; // rax

result = (unsigned int)a2;
if ( a1 >= 0 && a2 > a1 )
result = (unsigned int)a1;
return result;
}

original_code:
int plom_sanitize_nb_obs(int nb_obs, int n_data){
    if(nb_obs >= 0){
 return (nb_obs < n_data) ? nb_obs : n_data;
    }
    return n_data;
}


decompiled_code:
__int64 __fastcall json_decref(__int64 a1)
{
__int64 result; // rax

if ( a1 )
{
result = *(_QWORD *)(a1 + 8);
if ( result != -1 && !_InterlockedSub64((volatile signed __int64 *)(a1 + 8), 1uLL) )
result = json_delete();
}
return result;
}

canonical_decompiled_code:
__int64 __fastcall func0(__int64 a1)
{
__int64 result; // rax

if ( a1 )
{
result = *(_QWORD *)(a1 + 8);
if ( result != -1 && !_InterlockedSub64((volatile signed __int64 *)(a1 + 8), 1uLL) )
result = json_delete();
}
return result;
}

original_code:
static inline
void json_decref(json_t *json)
{
    if(json && json->refcount != (size_t)-1 && __atomic_sub_fetch(&json->refcount, 1, 3) == 0)
        json_delete(json);
}

canonical_original_code:
static inline void json_decref(struct json_t *json)
{
    if(json && json->refcount != (unsigned long)-1 && __atomic_sub_fetch(&json->refcount, 1, 3) == 0)
        json_delete(json);
}

variable_types: struct json_t { enum json_type { JSON_OBJECT=0, JSON_ARRAY=1, JSON_STRING=2, JSON_INTEGER=3, JSON_REAL=4, JSON_TRUE=5, JSON_FALSE=6, JSON_NULL=7 } type; unsigned long refcount; } *

user_defined_types: struct json_t { enum json_type type; unsigned long refcount; }


decompiled_code:
__int64 ask_update()
{
__int64 v0; // rbp

v0 = json_pack("{s,s}", "flag", &unk_2A8);
json_dumpf(v0, stderr, 0LL);
fputc(10, stderr);
fflush(stderr);
return json_decref(v0);
}

canonical_decompiled_code:
__int64 func1()
{
__int64 v0; // rbp

v0 = json_pack("{s,s}", "flag", &unk_2A8);
json_dumpf(v0, stderr, 0LL);
fputc(10, stderr);
fflush(stderr);
return func0(v0);
}

original_code:
void ask_update()
{
    json_t *root;
    root = json_pack("{s,s}", "flag", "upd");
    json_dumpf(root, stderr, 0); fprintf(stderr, "\n");
    fflush(stderr);
    json_decref(root);
}

canonical_original_code:
void ask_update()
{
    struct json_t *root;
    root = json_pack("{s,s}", "flag", "upd");
    json_dumpf(root, stderr, 0); fprintf(stderr, "\n");
    fflush(stderr);
    json_decref(root);
}

user_defined_types: enum json_type { JSON_OBJECT=0, JSON_ARRAY=1, JSON_STRING=2, JSON_INTEGER=3, JSON_REAL=4, JSON_TRUE=5, JSON_FALSE=6, JSON_NULL=7 }


block

decompiled_code:
char *block()
{
char s[12]; // [rsp+Ch] [rbp-Ch] BYREF

ask_update();
return fgets(s, 4, stdin);
}

canonical_decompiled_code:
char *func2()
{
char s[12]; // [rsp+Ch] [rbp-Ch] BYREF

func1();
return fgets(s, 4, stdin);
}

original_code:
void block()
{
    ask_update();
    char tmp[4];
    fgets(tmp, 4, stdin);
}

variable_types:
tmp
char [4]


decompiled_code:
__int64 __fastcall update_walk_rates(__int64 a1, __int64 a2)
{
__int64 v2; // rbp

ask_update();
fflush(stderr);
v2 = load_json();
if ( json_object_size(v2) )
{
load_best(a1, a2, v2, 0LL);
print_err("data integrated");
}
return json_decref(v2);
}

canonical_decompiled_code:
__int64 __fastcall func3(__int64 a1, __int64 a2)
{
__int64 v2; // rbp

func1();
fflush(stderr);
v2 = load_json();
if ( json_object_size(v2) )
{
load_best(a1, a2, v2, 0LL);
print_err("data integrated");
}
return func0(v2);
}

original_code:
void update_walk_rates(struct s_best *p_best, struct s_data *p_data)
{
    ask_update();
    fflush(stderr);
    json_t *theta = load_json();
    if(json_object_size(theta)) {
        load_best(p_best, p_data, theta, 0);
        print_err("data integrated");
    }
    json_decref(theta);
}

canonical_original_code:
void update_walk_rates(struct s_best *p_best, struct s_data *p_data)
{
    ask_update();
    fflush(stderr);
    struct json_t *theta = load_json();
    if(json_object_size(theta)) {
        load_best(p_best, p_data, theta, 0);
        print_err("data integrated");
    }
    json_decref(theta);
}

variable_types: struct s_data { char **ts_name; char **cac_name; char *remainder_name; char u_data[2]; enum plom_implementations { PLOM_ODE=0, PLOM_SDE=1, PLOM_PSR=2 } implementation; enum plom_noises_off { PLOM_NO_DEM_STO=expr, PLOM_NO_ENV_STO=expr, PLOM_NO_DRIFT=expr } noises_off; double **data; unsigned int *indn_data_nonan; unsigned int *times; struct s_data_ind { int n_nonan; unsigned int *ind_nonan; } **data_ind; struct s_obs2ts { int n_ts_unique; unsigned int *n_stream; unsigned int *n_cac; unsigned int ***cac; int offset; } **obs2ts; struct s_router { int p; int n_gp; unsigned int *map; char *name; char **group_name; double (**f)(double, double, double); double (**f_inv)(double, double, double); double (**f_scale)(double); double (**f_derivative)(double, double, double); double (**f_inv_derivative)(double, double, double); double multiplier; int is_duration; double *min; double *max; double *min_z; double *max_z; } **routers; struct s_drift { int ind_par_Xdrift_applied; int ind_volatility_Xdrift; int offset; } **drift; struct s_iterator { int length; unsigned int *ind; unsigned int *offset; int nbtot; } *p_it_all; struct s_iterator *p_it_only_drift; struct s_iterator *p_it_par_sv; struct s_iterator *p_it_all_no_drift; struct s_iterator *p_it_par_proc_par_obs_no_drift; struct s_iterator *p_it_par_sv_and_drift; struct s_iterator *p_it_noise; struct s_iterator *p_it_all_no_theta_remainder; struct s_iterator *p_it_theta_remainder; int nb_obs; int nb_obs_nonan; unsigned int *n_terms; double *prop_school; double ***school_terms; double **waifw; void *method_specific_data; } *

user_defined_types: struct gsl_matrix { unsigned long size1; unsigned long size2; unsigned long tda; double *data; struct gsl_block_struct *block; int owner; }

user_defined_types: struct gsl_block_struct { unsigned long size; double *data; }


decompiled_code:
double __fastcall f_prediction_ode(__int64 *a1, __int64 a2, double result, double a4, __int64 a5, _QWORD *a6)
{
__int64 v7; // xmm2_8
__int64 v8; // rbp
unsigned int v9; // eax
double v10; // [rsp+10h] [rbp-128h] BYREF
__int64 v11; // [rsp+18h] [rbp-120h] BYREF
char s[280]; // [rsp+20h] [rbp-118h] BYREF

v7 = a1[2];
v8 = *a1;
a6[20] = a2;
v10 = result;
v11 = v7;
while ( a4 > result )
{
v9 = gsl_odeiv2_evolve_apply(a6[7], a6[5], a6[6], a6 + 8, &v10, &v11, a4, v8);
if ( v9 )
{
sprintf(s, "error (%d) integration time step is too large to match desired precision", v9);
print_err(s, a4, a4);
exit(1);
}
result = v10;
}
return result;
}

canonical_decompiled_code:
double __fastcall func0(__int64 *a1, __int64 a2, double result, double a4, __int64 a5, _QWORD *a6)
{
__int64 v7; // xmm2_8
__int64 v8; // rbp
unsigned int v9; // eax
double v10; // [rsp+10h] [rbp-128h] BYREF
__int64 v11; // [rsp+18h] [rbp-120h] BYREF
char s[280]; // [rsp+20h] [rbp-118h] BYREF

v7 = a1[2];
v8 = *a1;
a6[20] = a2;
v10 = result;
v11 = v7;
while ( a4 > result )
{
v9 = gsl_odeiv2_evolve_apply(a6[7], a6[5], a6[6], a6 + 8, &v10, &v11, a4, v8);
if ( v9 )
{
sprintf(s, "error (%d) integration time step is too large to match desired precision", v9);
print_err(s, a4, a4);
exit(1);
}
result = v10;
}
return result;
}

original_code:
void f_prediction_ode(struct s_X *p_X, double t0, double t1, struct s_par *p_par, struct s_data *p_data, struct s_calc *p_calc)
{
    double t=t0;
    double h = p_X->dt;
    p_calc->p_par = p_par;
    double *y = p_X->proj;
    while (t < t1) {
        int status = gsl_odeiv2_evolve_apply (p_calc->evolve, p_calc->control, p_calc->step, &(p_calc->sys), &t, t1, &h, y);
        if (status != GSL_SUCCESS) {
            char str[255];
            sprintf(str, "error (%d) integration time step is too large to match desired precision", status);
            print_err(str);
            exit(1);
        }
    }
}

canonical_original_code:
void f_prediction_ode(struct s_X *p_X, double t0, double t1, struct s_par *p_par, struct s_data *p_data, struct s_calc *p_calc)
{
    double t = t0;
    double h = p_X->dt;
    p_calc->p_par = p_par;
    double *y = p_X->proj;
    while (t < t1) {
        int status = gsl_odeiv2_evolve_apply (p_calc->evolve, p_calc->control, p_calc->step, &(p_calc->sys), &t, t1, &h, y);
        if (status != GSL_SUCCESS) {
            char str[255];
            sprintf(str, "error (%d) integration time step is too large to match desired precision", status);
            print_err(str);
            exit(1);
        }
    }
}

variable_types: struct s_X { double *proj; double *obs; double dt; double dt0; } *

variable_types: struct s_par { int size_natural; double **natural; } *

variable_types: struct s_calc { int n_threads; int thread_id; struct gsl_rng { struct gsl_rng_type { char *name; unsigned long max; unsigned long min; unsigned long size; void (*set)(void *state, unsigned long seed); unsigned long (*get)(void *state); double (*get_double)(void *state); } *type; void *state; } *randgsl; double **prob; unsigned int ***inc; struct gsl_odeiv2_step_type { char *name; int can_use_dydt_in; int gives_exact_dydt_out; void *(*alloc)(unsigned long dim); int (*apply)(void *state, unsigned long dim, double t, double h, double y[], double yerr[], double dydt_in[], double dydt_out[], struct gsl_odeiv2_system { int (*function)(double t, double y[], double dydt[], void *params); int (*jacobian)(double t, double y[], double *dfdy, double dfdt[], void *params); unsigned long dimension; void *params; } *dydt); int (*set_driver)(void *state, struct gsl_odeiv2_driver_struct { struct gsl_odeiv2_system *sys; struct gsl_odeiv2_step_struct { struct gsl_odeiv2_step_type *type; unsigned long dimension; void *state; } *s; struct gsl_odeiv2_control_struct { struct gsl_odeiv2_control_type { char *name; void *(*alloc)(); int (*init)(void *state, double eps_abs, double eps_rel, double a_y, double a_dydt); int (*hadjust)(void *state, unsigned long dim, unsigned int ord, double y[], double yerr[], double yp[], double *h); int (*errlevel)(void *state, double y, double dydt, double h, unsigned long ind, double *errlev); int (*set_driver)(void *state, struct gsl_odeiv2_driver_struct *d); void (*free)(void *state); } *type; void *state; } *c; struct gsl_odeiv2_evolve_struct { unsigned long dimension; double *y0; double *yerr; double *dydt_in; double *dydt_out; double last_step; unsigned long count; unsigned long failed_steps; struct gsl_odeiv2_driver_struct *driver; } *e; double h; double hmin; double hmax; unsigned long n; unsigned long nmax; } *d); int (*reset)(void *state, unsigned long dim); unsigned int (*order)(void *state); void (*free)(void *state); } *T; struct gsl_odeiv2_control_struct *control; struct gsl_odeiv2_step_struct *step; struct gsl_odeiv2_evolve_struct *evolve; struct gsl_odeiv2_system sys; double *yerr; double *y_pred; double *to_be_sorted; unsigned long *index_sorted; struct gsl_interp_accel { unsigned long cache; unsigned long miss_count; unsigned long hit_count; } ***acc; struct gsl_spline { struct gsl_interp { struct gsl_interp_type { char *name; unsigned int min_size; void *(*alloc)(unsigned long size); int (*init)(void *, double xa[], double ya[], unsigned long size); int (*eval)(void *, double xa[], double ya[], unsigned long size, double x, struct gsl_interp_accel *, double *y); int (*eval_deriv)(void *, double xa[], double ya[], unsigned long size, double x, struct gsl_interp_accel *, double *y_p); int (*eval_deriv2)(void *, double xa[], double ya[], unsigned long size, double x, struct gsl_interp_accel *, double *y_pp); int (*eval_integ)(void *, double xa[], double ya[], unsigned long size, struct gsl_interp_accel *, double a, double b, double *result); void (*free)(void *); } *type; double xmin; double xmax; unsigned long size; void *state; } *interp; double *x; double *y; unsigned long size; } ***spline; unsigned int *n_spline; double *pop_size_t0; struct s_par *p_par; struct s_data *p_data; void *method_specific_thread_safe_data; void *method_specific_shared_data; } *

variable_types: t double

variable_types: h double

variable_types:
y
double *

variable_types: status int

variable_types:
str
char [255]

user_defined_types: struct s_calc { int n_threads; int thread_id; struct gsl_rng *randgsl; double **prob; unsigned int ***inc; struct gsl_odeiv2_step_type *T; struct gsl_odeiv2_control_struct *control; struct gsl_odeiv2_step_struct *step; struct gsl_odeiv2_evolve_struct *evolve; struct gsl_odeiv2_system sys; double *yerr; double *y_pred; double *to_be_sorted; unsigned long *index_sorted; struct gsl_interp_accel ***acc; struct gsl_spline ***spline; unsigned int *n_spline; double *pop_size_t0; struct s_par *p_par; struct s_data *p_data; void *method_specific_thread_safe_data; void *method_specific_shared_data; }

user_defined_types: struct gsl_rng { struct gsl_rng_type *type; void *state; }

user_defined_types: struct gsl_odeiv2_step_type { char *name; int can_use_dydt_in; int gives_exact_dydt_out; void *(*alloc)(unsigned long dim); int (*apply)(void *state, unsigned long dim, double t, double h, double y[], double yerr[], double dydt_in[], double dydt_out[], struct gsl_odeiv2_system *dydt); int (*set_driver)(void *state, struct gsl_odeiv2_driver_struct *d); int (*reset)(void *state, unsigned long dim); unsigned int (*order)(void *state); void (*free)(void *state); }

user_defined_types: struct gsl_spline { struct gsl_interp *interp; double *x; double *y; unsigned long size; }

user_defined_types: struct gsl_odeiv2_driver_struct { struct gsl_odeiv2_system *sys; struct gsl_odeiv2_step_struct *s; struct gsl_odeiv2_control_struct *c; struct gsl_odeiv2_evolve_struct *e; double h; double hmin; double hmax; unsigned long n; unsigned long nmax; }

user_defined_types: struct gsl_interp { struct gsl_interp_type *type; double xmin; double xmax; unsigned long size; void *state; }

user_defined_types: struct gsl_odeiv2_control_struct { struct gsl_odeiv2_control_type *type; void *state; }


decompiled_code:
__int64 __fastcall f_prediction_sde_no_dem_sto_no_env_sto(__int64 a1, __int64 a2, __int64 a3, __int64 a4, double a5, double a6)
{
__int64 result; // rax

for ( ; a6 > a5; a5 = a5 + *(double *)(a1 + 16) )
{
while ( 1 )
{
step_sde_no_dem_sto_no_env_sto(a1, a2, a3, a4);
result = (unsigned int)N_DRIFT;
if ( N_DRIFT )
break;
a5 = a5 + *(double *)(a1 + 16);
if ( a6 <= a5 )
return result;
}
result = compute_drift(a1, a2, a3, a4, a5);
}
return result;
}

canonical_decompiled_code:
__int64 __fastcall func1(__int64 a1, __int64 a2, __int64 a3, __int64 a4, double a5, double a6)
{
__int64 result; // rax

for ( ; a6 > a5; a5 = a5 + *(double *)(a1 + 16) )
{
while ( 1 )
{
step_sde_no_dem_sto_no_env_sto(a1, a2, a3, a4);
result = (unsigned int)N_DRIFT;
if ( N_DRIFT )
break;
a5 = a5 + *(double *)(a1 + 16);
if ( a6 <= a5 )
return result;
}
result = compute_drift(a1, a2, a3, a4, a5);
}
return result;
}

original_code:
void f_prediction_sde_no_dem_sto_no_env_sto(struct s_X *p_X, double t0, double t1, struct s_par *p_par, struct s_data *p_data, struct s_calc *p_calc)
{
    double t = t0;
    while (t < t1) {
 step_sde_no_dem_sto_no_env_sto(p_X, t, p_par, p_data, p_calc);
        if (N_DRIFT) {
            compute_drift(p_X, p_par, p_data, p_calc);
        }
 t += p_X->dt;
    }
}

user_defined_types: struct s_par { int size_natural; double **natural; }

user_defined_types: struct s_data { char **ts_name; char **cac_name; char *remainder_name; char u_data[2]; enum plom_implementations implementation; enum plom_noises_off noises_off; double **data; unsigned int *indn_data_nonan; unsigned int *times; struct s_data_ind **data_ind; struct s_obs2ts **obs2ts; struct s_router **routers; struct s_drift **drift; struct s_iterator *p_it_all; struct s_iterator *p_it_only_drift; struct s_iterator *p_it_par_sv; struct s_iterator *p_it_all_no_drift; struct s_iterator *p_it_par_proc_par_obs_no_drift; struct s_iterator *p_it_par_sv_and_drift; struct s_iterator *p_it_noise; struct s_iterator *p_it_all_no_theta_remainder; struct s_iterator *p_it_theta_remainder; int nb_obs; int nb_obs_nonan; unsigned int *n_terms; double *prop_school; double ***school_terms; double **waifw; void *method_specific_data; }

user_defined_types: enum plom_implementations { PLOM_ODE=0, PLOM_SDE=1, PLOM_PSR=2 }

user_defined_types: enum plom_noises_off { PLOM_NO_DEM_STO=expr, PLOM_NO_ENV_STO=expr, PLOM_NO_DRIFT=expr }

user_defined_types: struct s_iterator { int length; unsigned int *ind; unsigned int *offset; int nbtot; }

user_defined_types: struct s_data_ind { int n_nonan; unsigned int *ind_nonan; }

user_defined_types: struct s_obs2ts { int n_ts_unique; unsigned int *n_stream; unsigned int *n_cac; unsigned int ***cac; int offset; }

user_defined_types: struct gsl_rng_type { char *name; unsigned long max; unsigned long min; unsigned long size; void (*set)(void *state, unsigned long seed); unsigned long (*get)(void *state); double (*get_double)(void *state); }

user_defined_types: struct gsl_interp_accel { unsigned long cache; unsigned long miss_count; unsigned long hit_count; }

user_defined_types: struct gsl_odeiv2_system { int (*function)(double t, double y[], double dydt[], void *params); int (*jacobian)(double t, double y[], double *dfdy, double dfdt[], void *params); unsigned long dimension; void *params; }

user_defined_types: struct gsl_odeiv2_step_struct { struct gsl_odeiv2_step_type *type; unsigned long dimension; void *state; }

user_defined_types: struct gsl_odeiv2_evolve_struct { unsigned long dimension; double *y0; double *yerr; double *dydt_in; double *dydt_out; double last_step; unsigned long count; unsigned long failed_steps; struct gsl_odeiv2_driver_struct *driver; }

user_defined_types: struct gsl_interp_type { char *name; unsigned int min_size; void *(*alloc)(unsigned long size); int (*init)(void *, double xa[], double ya[], unsigned long size); int (*eval)(void *, double xa[], double ya[], unsigned long size, double x, struct gsl_interp_accel *, double *y); int (*eval_deriv)(void *, double xa[], double ya[], unsigned long size, double x, struct gsl_interp_accel *, double *y_p); int (*eval_deriv2)(void *, double xa[], double ya[], unsigned long size, double x, struct gsl_interp_accel *, double *y_pp); int (*eval_integ)(void *, double xa[], double ya[], unsigned long size, struct gsl_interp_accel *, double a, double b, double *result); void (*free)(void *); }

user_defined_types: struct gsl_odeiv2_control_type { char *name; void *(*alloc)(); int (*init)(void *state, double eps_abs, double eps_rel, double a_y, double a_dydt); int (*hadjust)(void *state, unsigned long dim, unsigned int ord, double y[], double yerr[], double yp[], double *h); int (*errlevel)(void *state, double y, double dydt, double h, unsigned long ind, double *errlev); int (*set_driver)(void *state, struct gsl_odeiv2_driver_struct *d); void (*free)(void *state); }


decompiled_code:
__int64 __fastcall f_prediction_sde_no_dem_sto_no_drift(__int64 a1, __int64 a2, __int64 a3, __int64 a4, double a5, double a6)
{
__int64 result; // rax

for ( ; a6 > a5; a5 = a5 + *(double *)(a1 + 16) )
result = step_sde_no_dem_sto(a1, a2, a3, a4);
return result;
}

canonical_decompiled_code:
__int64 __fastcall func2(__int64 a1, __int64 a2, __int64 a3, __int64 a4, double a5, double a6)
{
__int64 result; // rax

for ( ; a6 > a5; a5 = a5 + *(double *)(a1 + 16) )
result = step_sde_no_dem_sto(a1, a2, a3, a4);
return result;
}

original_code:
void f_prediction_sde_no_dem_sto_no_drift(struct s_X *p_X, double t0, double t1, struct s_par *p_par, struct s_data *p_data, struct s_calc *p_calc)
{
    double t = t0;
    while (t < t1) {
 step_sde_no_dem_sto(p_X, t, p_par, p_data, p_calc);
 t += p_X->dt;
    }
}

user_defined_types: struct s_X { double *proj; double *obs; double dt; double dt0; }

user_defined_types: struct s_calc { int n_threads; int thread_id; struct gsl_rng *randgsl; double **prob; unsigned int ***inc; struct gsl_odeiv2_step_type *T; struct gsl_odeiv2_control_struct *control; struct gsl_odeiv2_step_struct *step; struct gsl_odeiv2_evolve_struct *evolve; struct gsl_odeiv2_system sys; double *yerr; double *y_pred; double *to_be_sorted; unsigned long *index_sorted; struct gsl_interp_accel ***acc; struct gsl_spline ***spline; unsigned int *n_spline; double *pop_size_t0; struct s_par *p_par; struct s_data *p_data; void *method_specific_thread_safe_data; void *method_specific_shared_data; }

user_defined_types: struct gsl_rng { struct gsl_rng_type *type; void *state; }

user_defined_types: struct gsl_odeiv2_step_type { char *name; int can_use_dydt_in; int gives_exact_dydt_out; void *(*alloc)(unsigned long dim); int (*apply)(void *state, unsigned long dim, double t, double h, double y[], double yerr[], double dydt_in[], double dydt_out[], struct gsl_odeiv2_system *dydt); int (*set_driver)(void *state, struct gsl_odeiv2_driver_struct *d); int (*reset)(void *state, unsigned long dim); unsigned int (*order)(void *state); void (*free)(void *state); }

user_defined_types: struct s_router { int p; int n_gp; unsigned int *map; char *name; char **group_name; double (**f)(double, double, double); double (**f_inv)(double, double, double); double (**f_scale)(double); double (**f_derivative)(double, double, double); double (**f_inv_derivative)(double, double, double); double multiplier; int is_duration; double *min; double *max; double *min_z; double *max_z; }

user_defined_types: struct s_drift { int ind_par_Xdrift_applied; int ind_volatility_Xdrift; int offset; }

user_defined_types: struct gsl_spline { struct gsl_interp *interp; double *x; double *y; unsigned long size; }

user_defined_types: struct gsl_odeiv2_driver_struct { struct gsl_odeiv2_system *sys; struct gsl_odeiv2_step_struct *s; struct gsl_odeiv2_control_struct *c; struct gsl_odeiv2_evolve_struct *e; double h; double hmin; double hmax; unsigned long n; unsigned long nmax; }


decompiled_code:
__int64 __fastcall f_prediction_sde_no_dem_sto(__int64 a1, __int64 a2, __int64 a3, __int64 a4, double a5, double a6)
{
__int64 result; // rax

for ( ; a6 > a5; a5 = a5 + *(double *)(a1 + 16) )
{
while ( 1 )
{
step_sde_no_dem_sto(a1, a2, a3, a4);
result = (unsigned int)N_DRIFT;
if ( N_DRIFT )
break;
a5 = a5 + *(double *)(a1 + 16);
if ( a6 <= a5 )
return result;
}
result = compute_drift(a1, a2, a3, a4, a5);
}
return result;
}

canonical_decompiled_code:
__int64 __fastcall func3(__int64 a1, __int64 a2, __int64 a3, __int64 a4, double a5, double a6)
{
__int64 result; // rax

for ( ; a6 > a5; a5 = a5 + *(double *)(a1 + 16) )
{
while ( 1 )
{
step_sde_no_dem_sto(a1, a2, a3, a4);
result = (unsigned int)N_DRIFT;
if ( N_DRIFT )
break;
a5 = a5 + *(double *)(a1 + 16);
if ( a6 <= a5 )
return result;
}
result = compute_drift(a1, a2, a3, a4, a5);
}
return result;
}

original_code:
void f_prediction_sde_no_dem_sto(struct s_X *p_X, double t0, double t1, struct s_par *p_par, struct s_data *p_data, struct s_calc *p_calc)
{
    double t = t0;
    while (t < t1) {
 step_sde_no_dem_sto(p_X, t, p_par, p_data, p_calc);
        if (N_DRIFT) {
            compute_drift(p_X, p_par, p_data, p_calc);
        }
 t += p_X->dt;
    }
}

user_defined_types: struct s_par { int size_natural; double **natural; }

user_defined_types: struct s_data { char **ts_name; char **cac_name; char *remainder_name; char u_data[2]; enum plom_implementations implementation; enum plom_noises_off noises_off; double **data; unsigned int *indn_data_nonan; unsigned int *times; struct s_data_ind **data_ind; struct s_obs2ts **obs2ts; struct s_router **routers; struct s_drift **drift; struct s_iterator *p_it_all; struct s_iterator *p_it_only_drift; struct s_iterator *p_it_par_sv; struct s_iterator *p_it_all_no_drift; struct s_iterator *p_it_par_proc_par_obs_no_drift; struct s_iterator *p_it_par_sv_and_drift; struct s_iterator *p_it_noise; struct s_iterator *p_it_all_no_theta_remainder; struct s_iterator *p_it_theta_remainder; int nb_obs; int nb_obs_nonan; unsigned int *n_terms; double *prop_school; double ***school_terms; double **waifw; void *method_specific_data; }

user_defined_types: enum plom_implementations { PLOM_ODE=0, PLOM_SDE=1, PLOM_PSR=2 }

user_defined_types: enum plom_noises_off { PLOM_NO_DEM_STO=expr, PLOM_NO_ENV_STO=expr, PLOM_NO_DRIFT=expr }

user_defined_types: struct s_iterator { int length; unsigned int *ind; unsigned int *offset; int nbtot; }

user_defined_types: struct s_data_ind { int n_nonan; unsigned int *ind_nonan; }

user_defined_types: struct gsl_interp { struct gsl_interp_type *type; double xmin; double xmax; unsigned long size; void *state; }

user_defined_types: struct gsl_odeiv2_control_struct { struct gsl_odeiv2_control_type *type; void *state; }


decompiled_code:
__int64 __fastcall f_prediction_sde_no_env_sto_no_drift(__int64 a1, __int64 a2, __int64 a3, __int64 a4, double a5, double a6)
{
__int64 result; // rax

for ( ; a6 > a5; a5 = a5 + *(double *)(a1 + 16) )
result = step_sde_no_env_sto(a1, a2, a3, a4);
return result;
}

canonical_decompiled_code:
__int64 __fastcall func4(__int64 a1, __int64 a2, __int64 a3, __int64 a4, double a5, double a6)
{
__int64 result; // rax

for ( ; a6 > a5; a5 = a5 + *(double *)(a1 + 16) )
result = step_sde_no_env_sto(a1, a2, a3, a4);
return result;
}

original_code:
void f_prediction_sde_no_env_sto_no_drift(struct s_X *p_X, double t0, double t1, struct s_par *p_par, struct s_data *p_data, struct s_calc *p_calc)
{
    double t = t0;
    while (t < t1) {
 step_sde_no_env_sto(p_X, t, p_par, p_data, p_calc);
 t += p_X->dt;
    }
}

user_defined_types: struct s_obs2ts { int n_ts_unique; unsigned int *n_stream; unsigned int *n_cac; unsigned int ***cac; int offset; }

user_defined_types: struct gsl_rng_type { char *name; unsigned long max; unsigned long min; unsigned long size; void (*set)(void *state, unsigned long seed); unsigned long (*get)(void *state); double (*get_double)(void *state); }

user_defined_types: struct gsl_interp_accel { unsigned long cache; unsigned long miss_count; unsigned long hit_count; }

user_defined_types: struct gsl_odeiv2_system { int (*function)(double t, double y[], double dydt[], void *params); int (*jacobian)(double t, double y[], double *dfdy, double dfdt[], void *params); unsigned long dimension; void *params; }

user_defined_types: struct gsl_odeiv2_step_struct { struct gsl_odeiv2_step_type *type; unsigned long dimension; void *state; }

user_defined_types: struct gsl_odeiv2_evolve_struct { unsigned long dimension; double *y0; double *yerr; double *dydt_in; double *dydt_out; double last_step; unsigned long count; unsigned long failed_steps; struct gsl_odeiv2_driver_struct *driver; }

user_defined_types: struct gsl_interp_type { char *name; unsigned int min_size; void *(*alloc)(unsigned long size); int (*init)(void *, double xa[], double ya[], unsigned long size); int (*eval)(void *, double xa[], double ya[], unsigned long size, double x, struct gsl_interp_accel *, double *y); int (*eval_deriv)(void *, double xa[], double ya[], unsigned long size, double x, struct gsl_interp_accel *, double *y_p); int (*eval_deriv2)(void *, double xa[], double ya[], unsigned long size, double x, struct gsl_interp_accel *, double *y_pp); int (*eval_integ)(void *, double xa[], double ya[], unsigned long size, struct gsl_interp_accel *, double a, double b, double *result); void (*free)(void *); }

user_defined_types: struct gsl_odeiv2_control_type { char *name; void *(*alloc)(); int (*init)(void *state, double eps_abs, double eps_rel, double a_y, double a_dydt); int (*hadjust)(void *state, unsigned long dim, unsigned int ord, double y[], double yerr[], double yp[], double *h); int (*errlevel)(void *state, double y, double dydt, double h, unsigned long ind, double *errlev); int (*set_driver)(void *state, struct gsl_odeiv2_driver_struct *d); void (*free)(void *state); }