decompiled_code:
int *__fastcall do_write(void *a1)
{
unsigned int v1; // ebx
__int64 v2; // r12
__int64 v3; // r13
unsigned int v5; // [rsp+Ch] [rbp-12Ch] BYREF
char v6[296]; // [rsp+10h] [rbp-128h] BYREF

fwrite("[do_write thread]\n", 1uLL, 0x12uLL, stderr);
v1 = *((_DWORD *)a1 + 6);
v2 = *((_QWORD *)a1 + 4);
v3 = *((_QWORD *)a1 + 5);
get_chunk_path(v6, (const char *)a1);
ret_1 = wrapper_open_mode(v6, 65LL, 420LL, &v5);
if ( ret_1 >= 0 )
{
ret_1 = wrapper_pwrite(v5, v2, v1, v3);
if ( ret_1 >= 0 )
ret_1 = wrapper_close(v5);
}
return &ret_1;
}

canonical_decompiled_code:
int *__fastcall func1(void *a1)
{
unsigned int v1; // ebx
__int64 v2; // r12
__int64 v3; // r13
unsigned int v5; // [rsp+Ch] [rbp-12Ch] BYREF
char v6[296]; // [rsp+10h] [rbp-128h] BYREF

fwrite("[do_write thread]\n", 1uLL, 0x12uLL, stderr);
v1 = *((_DWORD *)a1 + 6);
v2 = *((_QWORD *)a1 + 4);
v3 = *((_QWORD *)a1 + 5);
func0(v6, (const char *)a1);
ret_1 = wrapper_open_mode(v6, 65LL, 420LL, &v5);
if ( ret_1 >= 0 )
{
ret_1 = wrapper_pwrite(v5, v2, v1, v3);
if ( ret_1 >= 0 )
ret_1 = wrapper_close(v5);
}
return &ret_1;
}

original_code:
void *do_write(void *write_arg)
{
 fprintf(stderr, "[do_write thread]\n");
 co_write_in *arg = (co_write_in*)write_arg;
 char *buf = arg->buf.buf_val;
 size_t size = arg->buf.buf_len;
 off_t offset = arg->offset;
 char path[256];
 get_chunk_path(path, arg->chunkid);
 int fd;
 static int ret = 0;
 ret = wrapper_open_mode(path, 0100 | 01, 0644, &fd);
 if(ret < 0)
  return (void*)&ret;
   ret = wrapper_pwrite(fd, buf, size, offset);
   if(ret < 0)
    return (void*)&ret;
   ret = wrapper_close(fd);
   return (void*)&ret;
}

canonical_original_code:
void *do_write(void *write_arg)
{
 fprintf(stderr, "[do_write thread]\n");
 struct co_write_in *arg = (co_write_in*)write_arg;
 char *buf = arg->buf.buf_val;
 unsigned long size = arg->buf.buf_len;
 long offset = arg->offset;
 char path[256];
 get_chunk_path(path, arg->chunkid);
 int fd;
 static int ret = 0;
 ret = wrapper_open_mode(path, 0100 | 01, 0644, &fd);
 if(ret < 0)
  return (void *)&ret;
   ret = wrapper_pwrite(fd, buf, size, offset);
   if(ret < 0)
    return (void *)&ret;
   ret = wrapper_close(fd);
   return (void *)&ret;
}

variable_types: struct co_write_in { char chunkid[20]; struct { unsigned int buf_len; char *buf_val; } buf; unsigned long offset; unsigned int ip; } *

variable_types:
buf
char *

variable_types:
size
unsigned long

variable_types: offset long

variable_types:
path
char [256]


repo: zydcom/dnfs

decompiled_code:
__int64 __fastcall rpccall_co_write(__int64 a1, __int64 a2, const char *a3)
{
CLIENT *v4; // rax
CLIENT *v5; // rbp
__int64 result; // rax
char *v7; // rax

v4 = clnt_create(a3, 0x31230002uLL, 1uLL, "tcp");
if ( v4 )
{
v5 = v4;
if ( (unsigned int)co_write_1(a1, a2, v4) )
{
v7 = clnt_sperror(v5, "call co_write_1 failed");
fprintf(stderr, v7);
result = 4294967230LL;
}
else
{
v5->cl_ops->cl_destroy(v5);
result = 0LL;
}
}
else
{
fprintf(stderr, "%s: create client handle failed\n", a3);
result = 4294967230LL;
}
return result;
}

canonical_decompiled_code:
__int64 __fastcall func2(__int64 a1, __int64 a2, const char *a3)
{
CLIENT *v4; // rax
CLIENT *v5; // rbp
__int64 result; // rax
char *v7; // rax

v4 = clnt_create(a3, 0x31230002uLL, 1uLL, "tcp");
if ( v4 )
{
v5 = v4;
if ( (unsigned int)co_write_1(a1, a2, v4) )
{
v7 = clnt_sperror(v5, "call co_write_1 failed");
fprintf(stderr, v7);
result = 4294967230LL;
}
else
{
v5->cl_ops->cl_destroy(v5);
result = 0LL;
}
}
else
{
fprintf(stderr, "%s: create client handle failed\n", a3);
result = 4294967230LL;
}
return result;
}

original_code:
int rpccall_co_write(co_write_in *arg, co_write_out *res, char *ipp)
{
 CLIENT *clnt;
 clnt = clnt_create(ipp, 0x31230002, 1, "tcp");
 if(!clnt) {
  fprintf(stderr, "%s: create client handle failed\n", ipp);
  return -66;
 }
 if(co_write_1(arg, res, clnt) != RPC_SUCCESS) {
  fprintf(stderr, clnt_sperror(clnt, "call co_write_1 failed"));
  return -66;
 }
 ((*(clnt)->cl_ops->cl_destroy)(clnt));
 return 0;
}

canonical_original_code:
int rpccall_co_write(struct co_write_in *arg, struct co_write_out *res, char *ipp)
{
 struct CLIENT *clnt;
 clnt = clnt_create(ipp, 0x31230002, 1, "tcp");
 if(!clnt) {
  fprintf(stderr, "%s: create client handle failed\n", ipp);
  return -66;
 }
 if(co_write_1(arg, res, clnt) != RPC_SUCCESS) {
  fprintf(stderr, clnt_sperror(clnt, "call co_write_1 failed"));
  return -66;
 }
 ((*(clnt)->cl_ops->cl_destroy)(clnt));
 return 0;
}

variable_types:
res
struct co_write_out { int err; } *

variable_types:
ipp
char *

variable_types: struct CLIENT { struct AUTH { struct opaque_auth { int oa_flavor; char *oa_base; unsigned int oa_length; } ah_cred; struct opaque_auth ah_verf; union des_block { struct { unsigned int high; unsigned int low; } key; char c[8]; } ah_key; struct auth_ops { void (*ah_nextverf)(struct AUTH *); int (*ah_marshal)(struct AUTH *, struct XDR { enum xdr_op { XDR_ENCODE=0, XDR_DECODE=1, XDR_FREE=2 } x_op; struct xdr_ops { int (*x_getlong)(struct XDR *__xdrs, long *__lp); int (*x_putlong)(struct XDR *__xdrs, long *__lp); int (*x_getbytes)(struct XDR *__xdrs, char *__addr, unsigned int __len); int (*x_putbytes)(struct XDR *__xdrs, char *__addr, unsigned int __len); unsigned int (*x_getpostn)(struct XDR *__xdrs); int (*x_setpostn)(struct XDR *__xdrs, unsigned int __pos); int *(*x_inline)(struct XDR *__xdrs, unsigned int __len); void (*x_destroy)(struct XDR *__xdrs); int (*x_getint32)(struct XDR *__xdrs, int *__ip); int (*x_putint32)(struct XDR *__xdrs, int *__ip); } *x_ops; char *x_public; char *x_private; char *x_base; unsigned int x_handy; } *); int (*ah_validate)(struct AUTH *, struct opaque_auth *); int (*ah_refresh)(struct AUTH *); void (*ah_destroy)(struct AUTH *); } *ah_ops; char *ah_private; } *cl_auth; struct clnt_ops { enum clnt_stat { RPC_SUCCESS=0, RPC_CANTENCODEARGS=1, RPC_CANTDECODERES=2, RPC_CANTSEND=3, RPC_CANTRECV=4, RPC_TIMEDOUT=5, RPC_VERSMISMATCH=6, RPC_AUTHERROR=7, RPC_PROGUNAVAIL=8, RPC_PROGVERSMISMATCH=9, RPC_PROCUNAVAIL=10, RPC_CANTDECODEARGS=11, RPC_SYSTEMERROR=12, RPC_NOBROADCAST=21, RPC_UNKNOWNHOST=13, RPC_UNKNOWNPROTO=17, RPC_UNKNOWNADDR=19, RPC_RPCBFAILURE=14, RPC_PROGNOTREGISTERED=15, RPC_N2AXLATEFAILURE=22, RPC_FAILED=16, RPC_INTR=18, RPC_TLIERROR=20, RPC_UDERROR=23, RPC_INPROGRESS=24, RPC_STALERACHANDLE=25 } (*cl_call)(struct CLIENT *, unsigned long, int (*)(struct XDR *, void *, ...), char *, int (*)(struct XDR *, void *, ...), char *, struct timeval { long tv_sec; long tv_usec; }); void (*cl_abort)(); void (*cl_geterr)(struct CLIENT *, struct rpc_err { enum clnt_stat { RPC_SUCCESS=0, RPC_CANTENCODEARGS=1, RPC_CANTDECODERES=2, RPC_CANTSEND=3, RPC_CANTRECV=4, RPC_TIMEDOUT=5, RPC_VERSMISMATCH=6, RPC_AUTHERROR=7, RPC_PROGUNAVAIL=8, RPC_PROGVERSMISMATCH=9, RPC_PROCUNAVAIL=10, RPC_CANTDECODEARGS=11, RPC_SYSTEMERROR=12, RPC_NOBROADCAST=21, RPC_UNKNOWNHOST=13, RPC_UNKNOWNPROTO=17, RPC_UNKNOWNADDR=19, RPC_RPCBFAILURE=14, RPC_PROGNOTREGISTERED=15, RPC_N2AXLATEFAILURE=22, RPC_FAILED=16, RPC_INTR=18, RPC_TLIERROR=20, RPC_UDERROR=23, RPC_INPROGRESS=24, RPC_STALERACHANDLE=25 } re_status; union { int RE_errno; enum auth_stat { AUTH_OK=0, AUTH_BADCRED=1, AUTH_REJECTEDCRED=2, AUTH_BADVERF=3, AUTH_REJECTEDVERF=4, AUTH_TOOWEAK=5, AUTH_INVALIDRESP=6, AUTH_FAILED=7 } RE_why; struct { unsigned long low; unsigned long high; } RE_vers; struct { long s1; long s2; } RE_lb; } ru; } *); int (*cl_freeres)(struct CLIENT *, int (*)(struct XDR *, void *, ...), char *); void (*cl_destroy)(struct CLIENT *); int (*cl_control)(struct CLIENT *, int, char *); } *cl_ops; char *cl_private; } *

return_type: int

user_defined_types: struct co_write_in { char chunkid[20]; struct { unsigned int buf_len; char *buf_val; } buf; unsigned long offset; unsigned int ip; }

user_defined_types: struct CLIENT { struct AUTH *cl_auth; struct clnt_ops *cl_ops; char *cl_private; }

user_defined_types: struct AUTH { struct opaque_auth ah_cred; struct opaque_auth ah_verf; union des_block ah_key; struct auth_ops *ah_ops; char *ah_private; }

user_defined_types: struct clnt_ops { enum clnt_stat (*cl_call)(struct CLIENT *, unsigned long, int (*)(struct XDR *, void *, ...), char *, int (*)(struct XDR *, void *, ...), char *, struct timeval); void (*cl_abort)(); void (*cl_geterr)(struct CLIENT *, struct rpc_err *); int (*cl_freeres)(struct CLIENT *, int (*)(struct XDR *, void *, ...), char *); void (*cl_destroy)(struct CLIENT *); int (*cl_control)(struct CLIENT *, int, char *); }

user_defined_types: struct auth_ops { void (*ah_nextverf)(struct AUTH *); int (*ah_marshal)(struct AUTH *, struct XDR *); int (*ah_validate)(struct AUTH *, struct opaque_auth *); int (*ah_refresh)(struct AUTH *); void (*ah_destroy)(struct AUTH *); }

user_defined_types: struct rpc_err { enum clnt_stat re_status; union { int RE_errno; enum auth_stat RE_why; struct { unsigned long low; unsigned long high; } RE_vers; struct { long s1; long s2; } RE_lb; } ru; }

user_defined_types: struct XDR { enum xdr_op x_op; struct xdr_ops *x_ops; char *x_public; char *x_private; char *x_base; unsigned int x_handy; }


decompiled_code:
__int64 __fastcall copy_data(__int64 a1, unsigned int *a2, const char *a3)
{
__int64 result; // rax

result = rpccall_co_write(a1, (__int64)a2, a3);
if ( (int)result >= 0 )
result = *a2;
return result;
}

canonical_decompiled_code:
__int64 __fastcall func3(__int64 a1, unsigned int *a2, const char *a3)
{
__int64 result; // rax

result = func2(a1, (__int64)a2, a3);
if ( (int)result >= 0 )
result = *a2;
return result;
}

original_code:
int copy_data(co_write_in *arg, co_write_out *res, char *ipp)
{
 int ret = rpccall_co_write(arg, res, ipp);
 if(ret < 0)
  return ret;
 return res->err;
}

canonical_original_code:
int copy_data(struct co_write_in *arg, struct co_write_out *res, char *ipp)
{
 int ret = rpccall_co_write(arg, res, ipp);
 if(ret < 0)
  return ret;
 return res->err;
}

variable_types: ret int


decompiled_code:
int *__fastcall do_copy(void *a1)
{
__int64 v1; // rsi
unsigned int v3; // [rsp+Ch] [rbp-2Ch] BYREF
char v4[40]; // [rsp+10h] [rbp-28h] BYREF

fwrite("[do_copy thread]\n", 1uLL, 0x11uLL, stderr);
v1 = *((unsigned int *)a1 + 12);
v3 = 0;
get_addr(v4, v1);
*((_DWORD *)a1 + 12) = 0;
ret_0 = copy_data((__int64)a1, &v3, v4);
return &ret_0;
}

canonical_decompiled_code:
int *__fastcall func4(void *a1)
{
__int64 v1; // rsi
unsigned int v3; // [rsp+Ch] [rbp-2Ch] BYREF
char v4[40]; // [rsp+10h] [rbp-28h] BYREF

fwrite("[do_copy thread]\n", 1uLL, 0x11uLL, stderr);
v1 = *((unsigned int *)a1 + 12);
v3 = 0;
get_addr(v4, v1);
*((_DWORD *)a1 + 12) = 0;
ret_0 = func3((__int64)a1, &v3, v4);
return &ret_0;
}

original_code:
void *do_copy(void *copy_arg)
{
 fprintf(stderr, "[do_copy thread]\n");
 static int ret = 0;
 co_write_in *arg = (co_write_in*)copy_arg;
 co_write_out res;
 res.err = 0;
 char ipp[20];
 get_addr(ipp, arg->ip);
 arg->ip = 0;
 ret = copy_data(arg, &res, ipp);
 return (void*)&ret;
}

canonical_original_code:
void *do_copy(void *copy_arg)
{
 fprintf(stderr, "[do_copy thread]\n");
 static int ret = 0;
 struct co_write_in *arg = (co_write_in*)copy_arg;
 struct co_write_out res;
 res.err = 0;
 char ipp[20];
 get_addr(ipp, arg->ip);
 arg->ip = 0;
 ret = copy_data(arg, &res, ipp);
 return (void *)&ret;
}

variable_types:
res
struct co_write_out { int err; }

variable_types:
ipp
char [20]

return_type: void *


decompiled_code:
__int64 __fastcall co_write_1_svc(void *arg, _DWORD *a2)
{
int v3; // eax
void *thread_return; // [rsp+8h] [rbp-30h] BYREF
pthread_t newthread; // [rsp+10h] [rbp-28h] BYREF
pthread_t th[4]; // [rsp+18h] [rbp-20h] BYREF

fprintf(
stderr,
"[co_write_1_svc] chunkid = %s, size = %u, offset = %u\n",
(const char *)arg,
*((unsigned int *)arg + 6),
*((_QWORD *)arg + 5));
*a2 = 0;
if ( pthread_create(&newthread, 0LL, (void *(*)(void *))do_write, arg) )
return 0LL;
if ( !*((_DWORD *)arg + 12) )
{
LABEL_3:
pthread_join(newthread, &thread_return);
*a2 = *(_DWORD *)thread_return;
return 1LL;
}
if ( pthread_create(th, 0LL, (void *(*)(void *))do_copy, arg) )
return 0LL;
pthread_join(th[0], &thread_return);
v3 = *(_DWORD *)thread_return;
*a2 = *(_DWORD *)thread_return;
if ( v3 >= 0 )
goto LABEL_3;
return 1LL;
}

canonical_decompiled_code:
__int64 __fastcall func5(void *arg, _DWORD *a2)
{
int v3; // eax
void *thread_return; // [rsp+8h] [rbp-30h] BYREF
pthread_t newthread; // [rsp+10h] [rbp-28h] BYREF
pthread_t th[4]; // [rsp+18h] [rbp-20h] BYREF

fprintf(
stderr,
"[co_write_1_svc] chunkid = %s, size = %u, offset = %u\n",
(const char *)arg,
*((unsigned int *)arg + 6),
*((_QWORD *)arg + 5));
*a2 = 0;
if ( pthread_create(&newthread, 0LL, (void *(*)(void *))do_write, arg) )
return 0LL;
if ( !*((_DWORD *)arg + 12) )
{
LABEL_3:
pthread_join(newthread, &thread_return);
*a2 = *(_DWORD *)thread_return;
return 1LL;
}
if ( pthread_create(th, 0LL, (void *(*)(void *))do_copy, arg) )
return 0LL;
pthread_join(th[0], &thread_return);
v3 = *(_DWORD *)thread_return;
*a2 = *(_DWORD *)thread_return;
if ( v3 >= 0 )
goto LABEL_3;
return 1LL;
}

original_code:
bool_t co_write_1_svc(co_write_in *arg, co_write_out *res, struct svc_req *rqst)
{
 fprintf(stderr, "[co_write_1_svc] chunkid = %s, size = %u, offset = %u\n", arg->chunkid, arg->buf.buf_len, arg->offset);
 res->err = 0;
 int *ret;
 pthread_t tid1, tid2;
 if(pthread_create(&tid1, ((void *)0), do_write, (void*)arg)) {
  return (0);
 }
 if(arg->ip){
  if(pthread_create(&tid2, ((void *)0), do_copy, (void*)arg)) {
   return (0);
  }
  pthread_join(tid2, (void**)&ret);
  res->err = *ret;
  do { if((res->err) < 0) return (1); } while(0);
 }
 pthread_join(tid1, (void**)&ret);
 res->err = *ret;
 return (1);
}

canonical_original_code:
int co_write_1_svc(struct co_write_in *arg, struct co_write_out *res, struct svc_req *rqst)
{
 fprintf(stderr, "[co_write_1_svc] chunkid = %s, size = %u, offset = %u\n", arg->chunkid, arg->buf.buf_len, arg->offset);
 res->err = 0;
 int *ret;
 unsigned long tid1; unsigned long tid2;
 if(pthread_create(&tid1, ((void *)0), do_write, (void *)arg)) {
  return (0);
 }
 if(arg->ip){
  if(pthread_create(&tid2, ((void *)0), do_copy, (void *)arg)) {
   return (0);
  }
  pthread_join(tid2, (void **)&ret);
  res->err = *ret;
  do { if((res->err) < 0) return (1); } while(0);
 }
 pthread_join(tid1, (void **)&ret);
 res->err = *ret;
 return (1);
}

variable_types: struct svc_req { unsigned long rq_prog; unsigned long rq_vers; unsigned long rq_proc; struct opaque_auth { int oa_flavor; char *oa_base; unsigned int oa_length; } rq_cred; char *rq_clntcred; struct SVCXPRT { int xp_sock; unsigned short xp_port; struct xp_ops { int (*xp_recv)(struct SVCXPRT *__xprt, struct rpc_msg { unsigned long rm_xid; enum msg_type { CALL=0, REPLY=1 } rm_direction; union { struct call_body { unsigned long cb_rpcvers; unsigned long cb_prog; unsigned long cb_vers; unsigned long cb_proc; struct opaque_auth cb_cred; struct opaque_auth cb_verf; } RM_cmb; struct reply_body { enum reply_stat { MSG_ACCEPTED=0, MSG_DENIED=1 } rp_stat; union { struct accepted_reply { struct opaque_auth ar_verf; enum accept_stat { SUCCESS=0, PROG_UNAVAIL=1, PROG_MISMATCH=2, PROC_UNAVAIL=3, GARBAGE_ARGS=4, SYSTEM_ERR=5 } ar_stat; union { struct { unsigned long low; unsigned long high; } AR_versions; struct { char *where; int (*proc)(struct XDR { enum xdr_op { XDR_ENCODE=0, XDR_DECODE=1, XDR_FREE=2 } x_op; struct xdr_ops { int (*x_getlong)(struct XDR *__xdrs, long *__lp); int (*x_putlong)(struct XDR *__xdrs, long *__lp); int (*x_getbytes)(struct XDR *__xdrs, char *__addr, unsigned int __len); int (*x_putbytes)(struct XDR *__xdrs, char *__addr, unsigned int __len); unsigned int (*x_getpostn)(struct XDR *__xdrs); int (*x_setpostn)(struct XDR *__xdrs, unsigned int __pos); int *(*x_inline)(struct XDR *__xdrs, unsigned int __len); void (*x_destroy)(struct XDR *__xdrs); int (*x_getint32)(struct XDR *__xdrs, int *__ip); int (*x_putint32)(struct XDR *__xdrs, int *__ip); } *x_ops; char *x_public; char *x_private; char *x_base; unsigned int x_handy; } *, void *, ...); } AR_results; } ru; } RP_ar; struct rejected_reply { enum reject_stat { RPC_MISMATCH=0, AUTH_ERROR=1 } rj_stat; union { struct { unsigned long low; unsigned long high; } RJ_versions; enum auth_stat { AUTH_OK=0, AUTH_BADCRED=1, AUTH_REJECTEDCRED=2, AUTH_BADVERF=3, AUTH_REJECTEDVERF=4, AUTH_TOOWEAK=5, AUTH_INVALIDRESP=6, AUTH_FAILED=7 } RJ_why; } ru; } RP_dr; } ru; } RM_rmb; } ru; } *__msg); enum xprt_stat { XPRT_DIED=0, XPRT_MOREREQS=1, XPRT_IDLE=2 } (*xp_stat)(struct SVCXPRT *__xprt); int (*xp_getargs)(struct SVCXPRT *__xprt, int (*__xdr_args)(struct XDR *, void *, ...), char *__args_ptr); int (*xp_reply)(struct SVCXPRT *__xprt, struct rpc_msg *__msg); int (*xp_freeargs)(struct SVCXPRT *__xprt, int (*__xdr_args)(struct XDR *, void *, ...), char *__args_ptr); void (*xp_destroy)(struct SVCXPRT *__xprt); } *xp_ops; int xp_addrlen; 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]; } xp_raddr; struct opaque_auth xp_verf; char *xp_p1; char *xp_p2; char xp_pad[256]; } *rq_xprt; } *

variable_types:
ret
int *

user_defined_types: struct svc_req { unsigned long rq_prog; unsigned long rq_vers; unsigned long rq_proc; struct opaque_auth rq_cred; char *rq_clntcred; struct SVCXPRT *rq_xprt; }

user_defined_types: struct SVCXPRT { int xp_sock; unsigned short xp_port; struct xp_ops *xp_ops; int xp_addrlen; struct sockaddr_in xp_raddr; struct opaque_auth xp_verf; char *xp_p1; char *xp_p2; char xp_pad[256]; }

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 xp_ops { int (*xp_recv)(struct SVCXPRT *__xprt, struct rpc_msg *__msg); enum xprt_stat (*xp_stat)(struct SVCXPRT *__xprt); int (*xp_getargs)(struct SVCXPRT *__xprt, int (*__xdr_args)(struct XDR *, void *, ...), char *__args_ptr); int (*xp_reply)(struct SVCXPRT *__xprt, struct rpc_msg *__msg); int (*xp_freeargs)(struct SVCXPRT *__xprt, int (*__xdr_args)(struct XDR *, void *, ...), char *__args_ptr); void (*xp_destroy)(struct SVCXPRT *__xprt); }

user_defined_types: struct rpc_msg { unsigned long rm_xid; enum msg_type rm_direction; union { struct call_body RM_cmb; struct reply_body RM_rmb; } ru; }

user_defined_types: struct reply_body { enum reply_stat rp_stat; union { struct accepted_reply RP_ar; struct rejected_reply RP_dr; } ru; }

user_defined_types: struct accepted_reply { struct opaque_auth ar_verf; enum accept_stat ar_stat; union { struct { unsigned long low; unsigned long high; } AR_versions; struct { char *where; int (*proc)(struct XDR *, void *, ...); } AR_results; } ru; }

user_defined_types: struct rejected_reply { enum reject_stat rj_stat; union { struct { unsigned long low; unsigned long high; } RJ_versions; enum auth_stat RJ_why; } ru; }


original_code:
bool_t co_read_1_svc(struct co_read_in *arg, struct co_read_out *res, struct svc_req *rqst)
{
 fprintf(stderr, "[co_read_1_svc] chunkid = %s, size = %u, offset = %u\n", arg->chunkid, arg->size, arg->offset);
 size_t size = arg->size;
 off_t offset = arg->offset;
 char path[256];
 get_chunk_path(path, arg->chunkid);
 res->err = 0;
 res->buf.buf_val = (char*)malloc(size);
 if(!res->buf.buf_val) {
  res->err = -12;
  res->buf.buf_len = 0;
  res->buf.buf_val = ((void *)0);
  return (1);
 }
 int fd;
 res->err = wrapper_open(path, 00, &fd);
 if(res->err < 0) {
  res->err = -(*__errno_location ());
  res->buf.buf_len = 0;
  res->buf.buf_val = ((void *)0);
  return 0;
 }
   res->err = wrapper_pread(fd, res->buf.buf_val, size, offset);
   do { if((res->err) < 0) return (1); } while(0);
   res->buf.buf_len = size;
   res->err = wrapper_close(fd);
 return (1);
}

canonical_original_code:
int co_read_1_svc(struct co_read_in *arg, struct co_read_out *res, struct svc_req *rqst)
{
 fprintf(stderr, "[co_read_1_svc] chunkid = %s, size = %u, offset = %u\n", arg->chunkid, arg->size, arg->offset);
 unsigned long size = arg->size;
 long offset = arg->offset;
 char path[256];
 get_chunk_path(path, arg->chunkid);
 res->err = 0;
 res->buf.buf_val = (char *)malloc(size);
 if(!res->buf.buf_val) {
  res->err = -12;
  res->buf.buf_len = 0;
  res->buf.buf_val = ((void *)0);
  return (1);
 }
 int fd;
 res->err = wrapper_open(path, 00, &fd);
 if(res->err < 0) {
  res->err = -(*__errno_location ());
  res->buf.buf_len = 0;
  res->buf.buf_val = ((void *)0);
  return 0;
 }
   res->err = wrapper_pread(fd, res->buf.buf_val, size, offset);
   do { if((res->err) < 0) return (1); } while(0);
   res->buf.buf_len = size;
   res->err = wrapper_close(fd);
 return (1);
}

variable_types: struct co_read_in { char chunkid[20]; unsigned int size; unsigned long offset; } *

variable_types: struct co_read_out { struct { unsigned int buf_len; char *buf_val; } buf; int err; } *

variable_types: fd int

user_defined_types: struct opaque_auth { int oa_flavor; char *oa_base; unsigned int oa_length; }

user_defined_types: enum xprt_stat { XPRT_DIED=0, XPRT_MOREREQS=1, XPRT_IDLE=2 }

user_defined_types: struct call_body { unsigned long cb_rpcvers; unsigned long cb_prog; unsigned long cb_vers; unsigned long cb_proc; struct opaque_auth cb_cred; struct opaque_auth cb_verf; }

user_defined_types: enum reply_stat { MSG_ACCEPTED=0, MSG_DENIED=1 }

user_defined_types: enum accept_stat { SUCCESS=0, PROG_UNAVAIL=1, PROG_MISMATCH=2, PROC_UNAVAIL=3, GARBAGE_ARGS=4, SYSTEM_ERR=5 }

user_defined_types: enum reject_stat { RPC_MISMATCH=0, AUTH_ERROR=1 }

user_defined_types: enum auth_stat { AUTH_OK=0, AUTH_BADCRED=1, AUTH_REJECTEDCRED=2, AUTH_BADVERF=3, AUTH_REJECTEDVERF=4, AUTH_TOOWEAK=5, AUTH_INVALIDRESP=6, AUTH_FAILED=7 }

user_defined_types: enum xdr_op { XDR_ENCODE=0, XDR_DECODE=1, XDR_FREE=2 }

user_defined_types: struct xdr_ops { int (*x_getlong)(struct XDR *__xdrs, long *__lp); int (*x_putlong)(struct XDR *__xdrs, long *__lp); int (*x_getbytes)(struct XDR *__xdrs, char *__addr, unsigned int __len); int (*x_putbytes)(struct XDR *__xdrs, char *__addr, unsigned int __len); unsigned int (*x_getpostn)(struct XDR *__xdrs); int (*x_setpostn)(struct XDR *__xdrs, unsigned int __pos); int *(*x_inline)(struct XDR *__xdrs, unsigned int __len); void (*x_destroy)(struct XDR *__xdrs); int (*x_getint32)(struct XDR *__xdrs, int *__ip); int (*x_putint32)(struct XDR *__xdrs, int *__ip); }


decompiled_code:
__int64 __fastcall co_unlink_1_svc(const char *a1, _DWORD *a2)
{
char v3[280]; // [rsp+0h] [rbp-118h] BYREF

fprintf(stderr, "[co_unlink_1_svc] chunkid = %s\n", a1);
get_chunk_path(v3, a1);
*a2 = 0;
*a2 = wrapper_unlink(v3);
return 1LL;
}

canonical_decompiled_code:
__int64 __fastcall func7(const char *a1, _DWORD *a2)
{
char v3[280]; // [rsp+0h] [rbp-118h] BYREF

fprintf(stderr, "[co_unlink_1_svc] chunkid = %s\n", a1);
func0(v3, a1);
*a2 = 0;
*a2 = wrapper_unlink(v3);
return 1LL;
}

original_code:
bool_t co_unlink_1_svc(struct co_unlink_in *arg, struct co_unlink_out *res, struct svc_req *rqst)
{
 fprintf(stderr, "[co_unlink_1_svc] chunkid = %s\n", arg->chunkid);
 char path[256];
 get_chunk_path(path, arg->chunkid);
 res->err = 0;
 res->err = wrapper_unlink(path);
 return (1);
}

canonical_original_code:
int co_unlink_1_svc(struct co_unlink_in *arg, struct co_unlink_out *res, struct svc_req *rqst)
{
 fprintf(stderr, "[co_unlink_1_svc] chunkid = %s\n", arg->chunkid);
 char path[256];
 get_chunk_path(path, arg->chunkid);
 res->err = 0;
 res->err = wrapper_unlink(path);
 return (1);
}

variable_types: struct co_unlink_in { char chunkid[20]; } *

variable_types:
res
struct co_unlink_out { int err; } *

user_defined_types: struct svc_req { unsigned long rq_prog; unsigned long rq_vers; unsigned long rq_proc; struct opaque_auth rq_cred; char *rq_clntcred; struct SVCXPRT *rq_xprt; }

user_defined_types: struct XDR { enum xdr_op x_op; struct xdr_ops *x_ops; char *x_public; char *x_private; char *x_base; unsigned int x_handy; }


decompiled_code:
__int64 __fastcall co_prog_1_freeresult(__int64 a1, bool_t (*a2)(XDR *, void *, ...), char *a3)
{
xdr_free(a2, a3);
return 1LL;
}

canonical_decompiled_code:
__int64 __fastcall func8(__int64 a1, bool_t (*a2)(XDR *, void *, ...), char *a3)
{
xdr_free(a2, a3);
return 1LL;
}

original_code:
int co_prog_1_freeresult(SVCXPRT *transp, xdrproc_t xdr_result, caddr_t result)
{
 xdr_free(xdr_result, result);
 return 1;
}

canonical_original_code:
int co_prog_1_freeresult(struct SVCXPRT *transp, int (*xdr_result)(struct XDR *, void *, ...), char *result)
{
 xdr_free(xdr_result, result);
 return 1;
}

variable_types: struct SVCXPRT { int xp_sock; unsigned short xp_port; struct xp_ops { int (*xp_recv)(struct SVCXPRT *__xprt, struct rpc_msg { unsigned long rm_xid; enum msg_type { CALL=0, REPLY=1 } rm_direction; union { struct call_body { unsigned long cb_rpcvers; unsigned long cb_prog; unsigned long cb_vers; unsigned long cb_proc; struct opaque_auth { int oa_flavor; char *oa_base; unsigned int oa_length; } cb_cred; struct opaque_auth cb_verf; } RM_cmb; struct reply_body { enum reply_stat { MSG_ACCEPTED=0, MSG_DENIED=1 } rp_stat; union { struct accepted_reply { struct opaque_auth ar_verf; enum accept_stat { SUCCESS=0, PROG_UNAVAIL=1, PROG_MISMATCH=2, PROC_UNAVAIL=3, GARBAGE_ARGS=4, SYSTEM_ERR=5 } ar_stat; union { struct { unsigned long low; unsigned long high; } AR_versions; struct { char *where; int (*proc)(struct XDR { enum xdr_op { XDR_ENCODE=0, XDR_DECODE=1, XDR_FREE=2 } x_op; struct xdr_ops { int (*x_getlong)(struct XDR *__xdrs, long *__lp); int (*x_putlong)(struct XDR *__xdrs, long *__lp); int (*x_getbytes)(struct XDR *__xdrs, char *__addr, unsigned int __len); int (*x_putbytes)(struct XDR *__xdrs, char *__addr, unsigned int __len); unsigned int (*x_getpostn)(struct XDR *__xdrs); int (*x_setpostn)(struct XDR *__xdrs, unsigned int __pos); int *(*x_inline)(struct XDR *__xdrs, unsigned int __len); void (*x_destroy)(struct XDR *__xdrs); int (*x_getint32)(struct XDR *__xdrs, int *__ip); int (*x_putint32)(struct XDR *__xdrs, int *__ip); } *x_ops; char *x_public; char *x_private; char *x_base; unsigned int x_handy; } *, void *, ...); } AR_results; } ru; } RP_ar; struct rejected_reply { enum reject_stat { RPC_MISMATCH=0, AUTH_ERROR=1 } rj_stat; union { struct { unsigned long low; unsigned long high; } RJ_versions; enum auth_stat { AUTH_OK=0, AUTH_BADCRED=1, AUTH_REJECTEDCRED=2, AUTH_BADVERF=3, AUTH_REJECTEDVERF=4, AUTH_TOOWEAK=5, AUTH_INVALIDRESP=6, AUTH_FAILED=7 } RJ_why; } ru; } RP_dr; } ru; } RM_rmb; } ru; } *__msg); enum xprt_stat { XPRT_DIED=0, XPRT_MOREREQS=1, XPRT_IDLE=2 } (*xp_stat)(struct SVCXPRT *__xprt); int (*xp_getargs)(struct SVCXPRT *__xprt, int (*__xdr_args)(struct XDR *, void *, ...), char *__args_ptr); int (*xp_reply)(struct SVCXPRT *__xprt, struct rpc_msg *__msg); int (*xp_freeargs)(struct SVCXPRT *__xprt, int (*__xdr_args)(struct XDR *, void *, ...), char *__args_ptr); void (*xp_destroy)(struct SVCXPRT *__xprt); } *xp_ops; int xp_addrlen; 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]; } xp_raddr; struct opaque_auth xp_verf; char *xp_p1; char *xp_p2; char xp_pad[256]; } *

variable_types:
result
char *

user_defined_types: struct SVCXPRT { int xp_sock; unsigned short xp_port; struct xp_ops *xp_ops; int xp_addrlen; struct sockaddr_in xp_raddr; struct opaque_auth xp_verf; char *xp_p1; char *xp_p2; char xp_pad[256]; }

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


decompiled_code:
__int64 __fastcall cs_getattr_1(__int64 a1, __int64 a2, __int64 a3)
{
return (**(__int64 (__fastcall ***)(__int64, __int64, void *, __int64, void *, __int64, __int64, _QWORD))(a3 + 8))(
a3,
1LL,
&xdr_cs_getattr_in,
a1,
&xdr_cs_getattr_out,
a2,
TIMEOUT,
0LL);
}

canonical_decompiled_code:
__int64 __fastcall func0(__int64 a1, __int64 a2, __int64 a3)
{
return (**(__int64 (__fastcall ***)(__int64, __int64, void *, __int64, void *, __int64, __int64, _QWORD))(a3 + 8))(
a3,
1LL,
&xdr_cs_getattr_in,
a1,
&xdr_cs_getattr_out,
a2,
TIMEOUT,
0LL);
}

original_code:
enum clnt_stat
cs_getattr_1(cs_getattr_in *argp, cs_getattr_out *clnt_res, CLIENT *clnt)
{
 return (((*(clnt)->cl_ops->cl_call)(clnt, 1, (xdrproc_t) xdr_cs_getattr_in, (caddr_t) argp, (xdrproc_t) xdr_cs_getattr_out, (caddr_t) clnt_res, TIMEOUT)));
}

canonical_original_code:
enum clnt_stat cs_getattr_1(struct cs_getattr_in *argp, struct cs_getattr_out *clnt_res, struct CLIENT *clnt)
{
 return (((*(clnt)->cl_ops->cl_call)(clnt, 1, (int (*)(struct XDR *, void *, ...)) xdr_cs_getattr_in, (char *) argp, (int (*)(struct XDR *, void *, ...)) xdr_cs_getattr_out, (char *) clnt_res, TIMEOUT)));
}

variable_types:
argp
struct cs_getattr_in { char *path; } *

variable_types: struct cs_getattr_out { struct dnfs_stat { unsigned long s_ino; unsigned int s_mode; unsigned short s_chunks; unsigned short s_copies; unsigned long s_nlink; unsigned int s_uid; unsigned int s_gid; unsigned long s_rdev; unsigned long s_size; unsigned long s_blocks; unsigned long s_atime; unsigned long s_mtime; unsigned long s_ctime; } st; int err; } *

return_type: enum clnt_stat { RPC_SUCCESS=0, RPC_CANTENCODEARGS=1, RPC_CANTDECODERES=2, RPC_CANTSEND=3, RPC_CANTRECV=4, RPC_TIMEDOUT=5, RPC_VERSMISMATCH=6, RPC_AUTHERROR=7, RPC_PROGUNAVAIL=8, RPC_PROGVERSMISMATCH=9, RPC_PROCUNAVAIL=10, RPC_CANTDECODEARGS=11, RPC_SYSTEMERROR=12, RPC_NOBROADCAST=21, RPC_UNKNOWNHOST=13, RPC_UNKNOWNPROTO=17, RPC_UNKNOWNADDR=19, RPC_RPCBFAILURE=14, RPC_PROGNOTREGISTERED=15, RPC_N2AXLATEFAILURE=22, RPC_FAILED=16, RPC_INTR=18, RPC_TLIERROR=20, RPC_UDERROR=23, RPC_INPROGRESS=24, RPC_STALERACHANDLE=25 }

user_defined_types: struct cs_getattr_out { struct dnfs_stat st; int err; }

user_defined_types: struct CLIENT { struct AUTH *cl_auth; struct clnt_ops *cl_ops; char *cl_private; }

user_defined_types: struct AUTH { struct opaque_auth ah_cred; struct opaque_auth ah_verf; union des_block ah_key; struct auth_ops *ah_ops; char *ah_private; }

user_defined_types: struct clnt_ops { enum clnt_stat (*cl_call)(struct CLIENT *, unsigned long, int (*)(struct XDR *, void *, ...), char *, int (*)(struct XDR *, void *, ...), char *, struct timeval); void (*cl_abort)(); void (*cl_geterr)(struct CLIENT *, struct rpc_err *); int (*cl_freeres)(struct CLIENT *, int (*)(struct XDR *, void *, ...), char *); void (*cl_destroy)(struct CLIENT *); int (*cl_control)(struct CLIENT *, int, char *); }

user_defined_types: union des_block { struct { unsigned int high; unsigned int low; } key; char c[8]; }

user_defined_types: struct auth_ops { void (*ah_nextverf)(struct AUTH *); int (*ah_marshal)(struct AUTH *, struct XDR *); int (*ah_validate)(struct AUTH *, struct opaque_auth *); int (*ah_refresh)(struct AUTH *); void (*ah_destroy)(struct AUTH *); }

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

user_defined_types: struct rpc_err { enum clnt_stat re_status; union { int RE_errno; enum auth_stat RE_why; struct { unsigned long low; unsigned long high; } RE_vers; struct { long s1; long s2; } RE_lb; } ru; }


decompiled_code:
__int64 __fastcall cs_access_1(__int64 a1, __int64 a2, __int64 a3)
{
return (**(__int64 (__fastcall ***)(__int64, __int64, void *, __int64, void *, __int64, __int64, _QWORD))(a3 + 8))(
a3,
2LL,
&xdr_cs_access_in,
a1,
&xdr_cs_access_out,
a2,
TIMEOUT,
0LL);
}

canonical_decompiled_code:
__int64 __fastcall func1(__int64 a1, __int64 a2, __int64 a3)
{
return (**(__int64 (__fastcall ***)(__int64, __int64, void *, __int64, void *, __int64, __int64, _QWORD))(a3 + 8))(
a3,
2LL,
&xdr_cs_access_in,
a1,
&xdr_cs_access_out,
a2,
TIMEOUT,
0LL);
}

original_code:
enum clnt_stat
cs_access_1(cs_access_in *argp, cs_access_out *clnt_res, CLIENT *clnt)
{
 return (((*(clnt)->cl_ops->cl_call)(clnt, 2, (xdrproc_t) xdr_cs_access_in, (caddr_t) argp, (xdrproc_t) xdr_cs_access_out, (caddr_t) clnt_res, TIMEOUT)));
}

canonical_original_code:
enum clnt_stat cs_access_1(struct cs_access_in *argp, struct cs_access_out *clnt_res, struct CLIENT *clnt)
{
 return (((*(clnt)->cl_ops->cl_call)(clnt, 2, (int (*)(struct XDR *, void *, ...)) xdr_cs_access_in, (char *) argp, (int (*)(struct XDR *, void *, ...)) xdr_cs_access_out, (char *) clnt_res, TIMEOUT)));
}

variable_types: struct cs_access_in { char *path; int mode; } *

user_defined_types: enum clnt_stat { RPC_SUCCESS=0, RPC_CANTENCODEARGS=1, RPC_CANTDECODERES=2, RPC_CANTSEND=3, RPC_CANTRECV=4, RPC_TIMEDOUT=5, RPC_VERSMISMATCH=6, RPC_AUTHERROR=7, RPC_PROGUNAVAIL=8, RPC_PROGVERSMISMATCH=9, RPC_PROCUNAVAIL=10, RPC_CANTDECODEARGS=11, RPC_SYSTEMERROR=12, RPC_NOBROADCAST=21, RPC_UNKNOWNHOST=13, RPC_UNKNOWNPROTO=17, RPC_UNKNOWNADDR=19, RPC_RPCBFAILURE=14, RPC_PROGNOTREGISTERED=15, RPC_N2AXLATEFAILURE=22, RPC_FAILED=16, RPC_INTR=18, RPC_TLIERROR=20, RPC_UDERROR=23, RPC_INPROGRESS=24, RPC_STALERACHANDLE=25 }

user_defined_types: struct opaque_auth { int oa_flavor; char *oa_base; unsigned int oa_length; }


decompiled_code:
__int64 __fastcall cs_mkdir_1(__int64 a1, __int64 a2, __int64 a3)
{
return (**(__int64 (__fastcall ***)(__int64, __int64, void *, __int64, void *, __int64, __int64, _QWORD))(a3 + 8))(
a3,
3LL,
&xdr_cs_mkdir_in,
a1,
&xdr_cs_mkdir_out,
a2,
TIMEOUT,
0LL);
}

canonical_decompiled_code:
__int64 __fastcall func2(__int64 a1, __int64 a2, __int64 a3)
{
return (**(__int64 (__fastcall ***)(__int64, __int64, void *, __int64, void *, __int64, __int64, _QWORD))(a3 + 8))(
a3,
3LL,
&xdr_cs_mkdir_in,
a1,
&xdr_cs_mkdir_out,
a2,
TIMEOUT,
0LL);
}

original_code:
enum clnt_stat
cs_mkdir_1(cs_mkdir_in *argp, cs_mkdir_out *clnt_res, CLIENT *clnt)
{
 return (((*(clnt)->cl_ops->cl_call)(clnt, 3, (xdrproc_t) xdr_cs_mkdir_in, (caddr_t) argp, (xdrproc_t) xdr_cs_mkdir_out, (caddr_t) clnt_res, TIMEOUT)));
}

canonical_original_code:
enum clnt_stat cs_mkdir_1(struct cs_mkdir_in *argp, struct cs_mkdir_out *clnt_res, struct CLIENT *clnt)
{
 return (((*(clnt)->cl_ops->cl_call)(clnt, 3, (int (*)(struct XDR *, void *, ...)) xdr_cs_mkdir_in, (char *) argp, (int (*)(struct XDR *, void *, ...)) xdr_cs_mkdir_out, (char *) clnt_res, TIMEOUT)));
}

variable_types: struct cs_mkdir_in { char *path; unsigned int mode; } *

user_defined_types: enum auth_stat { AUTH_OK=0, AUTH_BADCRED=1, AUTH_REJECTEDCRED=2, AUTH_BADVERF=3, AUTH_REJECTEDVERF=4, AUTH_TOOWEAK=5, AUTH_INVALIDRESP=6, AUTH_FAILED=7 }


decompiled_code:
__int64 __fastcall cs_rmdir_1(__int64 a1, __int64 a2, __int64 a3)
{
return (**(__int64 (__fastcall ***)(__int64, __int64, void *, __int64, void *, __int64, __int64, _QWORD))(a3 + 8))(
a3,
4LL,
&xdr_cs_rmdir_in,
a1,
&xdr_cs_rmdir_out,
a2,
TIMEOUT,
0LL);
}

canonical_decompiled_code:
__int64 __fastcall func3(__int64 a1, __int64 a2, __int64 a3)
{
return (**(__int64 (__fastcall ***)(__int64, __int64, void *, __int64, void *, __int64, __int64, _QWORD))(a3 + 8))(
a3,
4LL,
&xdr_cs_rmdir_in,
a1,
&xdr_cs_rmdir_out,
a2,
TIMEOUT,
0LL);
}

original_code:
enum clnt_stat
cs_rmdir_1(cs_rmdir_in *argp, cs_rmdir_out *clnt_res, CLIENT *clnt)
{
 return (((*(clnt)->cl_ops->cl_call)(clnt, 4, (xdrproc_t) xdr_cs_rmdir_in, (caddr_t) argp, (xdrproc_t) xdr_cs_rmdir_out, (caddr_t) clnt_res, TIMEOUT)));
}

canonical_original_code:
enum clnt_stat cs_rmdir_1(struct cs_rmdir_in *argp, struct cs_rmdir_out *clnt_res, struct CLIENT *clnt)
{
 return (((*(clnt)->cl_ops->cl_call)(clnt, 4, (int (*)(struct XDR *, void *, ...)) xdr_cs_rmdir_in, (char *) argp, (int (*)(struct XDR *, void *, ...)) xdr_cs_rmdir_out, (char *) clnt_res, TIMEOUT)));
}

variable_types:
argp
struct cs_rmdir_in { char *path; } *

variable_types: struct CLIENT { struct AUTH { struct opaque_auth { int oa_flavor; char *oa_base; unsigned int oa_length; } ah_cred; struct opaque_auth ah_verf; union des_block { struct { unsigned int high; unsigned int low; } key; char c[8]; } ah_key; struct auth_ops { void (*ah_nextverf)(struct AUTH *); int (*ah_marshal)(struct AUTH *, struct XDR { enum xdr_op { XDR_ENCODE=0, XDR_DECODE=1, XDR_FREE=2 } x_op; struct xdr_ops { int (*x_getlong)(struct XDR *__xdrs, long *__lp); int (*x_putlong)(struct XDR *__xdrs, long *__lp); int (*x_getbytes)(struct XDR *__xdrs, char *__addr, unsigned int __len); int (*x_putbytes)(struct XDR *__xdrs, char *__addr, unsigned int __len); unsigned int (*x_getpostn)(struct XDR *__xdrs); int (*x_setpostn)(struct XDR *__xdrs, unsigned int __pos); int *(*x_inline)(struct XDR *__xdrs, unsigned int __len); void (*x_destroy)(struct XDR *__xdrs); int (*x_getint32)(struct XDR *__xdrs, int *__ip); int (*x_putint32)(struct XDR *__xdrs, int *__ip); } *x_ops; char *x_public; char *x_private; char *x_base; unsigned int x_handy; } *); int (*ah_validate)(struct AUTH *, struct opaque_auth *); int (*ah_refresh)(struct AUTH *); void (*ah_destroy)(struct AUTH *); } *ah_ops; char *ah_private; } *cl_auth; struct clnt_ops { enum clnt_stat { RPC_SUCCESS=0, RPC_CANTENCODEARGS=1, RPC_CANTDECODERES=2, RPC_CANTSEND=3, RPC_CANTRECV=4, RPC_TIMEDOUT=5, RPC_VERSMISMATCH=6, RPC_AUTHERROR=7, RPC_PROGUNAVAIL=8, RPC_PROGVERSMISMATCH=9, RPC_PROCUNAVAIL=10, RPC_CANTDECODEARGS=11, RPC_SYSTEMERROR=12, RPC_NOBROADCAST=21, RPC_UNKNOWNHOST=13, RPC_UNKNOWNPROTO=17, RPC_UNKNOWNADDR=19, RPC_RPCBFAILURE=14, RPC_PROGNOTREGISTERED=15, RPC_N2AXLATEFAILURE=22, RPC_FAILED=16, RPC_INTR=18, RPC_TLIERROR=20, RPC_UDERROR=23, RPC_INPROGRESS=24, RPC_STALERACHANDLE=25 } (*cl_call)(struct CLIENT *, unsigned long, int (*)(struct XDR *, void *, ...), char *, int (*)(struct XDR *, void *, ...), char *, struct timeval { long tv_sec; long tv_usec; }); void (*cl_abort)(); void (*cl_geterr)(struct CLIENT *, struct rpc_err { enum clnt_stat { RPC_SUCCESS=0, RPC_CANTENCODEARGS=1, RPC_CANTDECODERES=2, RPC_CANTSEND=3, RPC_CANTRECV=4, RPC_TIMEDOUT=5, RPC_VERSMISMATCH=6, RPC_AUTHERROR=7, RPC_PROGUNAVAIL=8, RPC_PROGVERSMISMATCH=9, RPC_PROCUNAVAIL=10, RPC_CANTDECODEARGS=11, RPC_SYSTEMERROR=12, RPC_NOBROADCAST=21, RPC_UNKNOWNHOST=13, RPC_UNKNOWNPROTO=17, RPC_UNKNOWNADDR=19, RPC_RPCBFAILURE=14, RPC_PROGNOTREGISTERED=15, RPC_N2AXLATEFAILURE=22, RPC_FAILED=16, RPC_INTR=18, RPC_TLIERROR=20, RPC_UDERROR=23, RPC_INPROGRESS=24, RPC_STALERACHANDLE=25 } re_status; union { int RE_errno; enum auth_stat { AUTH_OK=0, AUTH_BADCRED=1, AUTH_REJECTEDCRED=2, AUTH_BADVERF=3, AUTH_REJECTEDVERF=4, AUTH_TOOWEAK=5, AUTH_INVALIDRESP=6, AUTH_FAILED=7 } RE_why; struct { unsigned long low; unsigned long high; } RE_vers; struct { long s1; long s2; } RE_lb; } ru; } *); int (*cl_freeres)(struct CLIENT *, int (*)(struct XDR *, void *, ...), char *); void (*cl_destroy)(struct CLIENT *); int (*cl_control)(struct CLIENT *, int, char *); } *cl_ops; char *cl_private; } *


decompiled_code:
__int64 __fastcall cs_readdir_1(__int64 a1, __int64 a2, __int64 a3)
{
return (**(__int64 (__fastcall ***)(__int64, __int64, void *, __int64, void *, __int64, __int64, _QWORD))(a3 + 8))(
a3,
5LL,
&xdr_cs_readdir_in,
a1,
&xdr_cs_readdir_out,
a2,
TIMEOUT,
0LL);
}

canonical_decompiled_code:
__int64 __fastcall func4(__int64 a1, __int64 a2, __int64 a3)
{
return (**(__int64 (__fastcall ***)(__int64, __int64, void *, __int64, void *, __int64, __int64, _QWORD))(a3 + 8))(
a3,
5LL,
&xdr_cs_readdir_in,
a1,
&xdr_cs_readdir_out,
a2,
TIMEOUT,
0LL);
}

original_code:
enum clnt_stat
cs_readdir_1(cs_readdir_in *argp, cs_readdir_out *clnt_res, CLIENT *clnt)
{
 return (((*(clnt)->cl_ops->cl_call)(clnt, 5, (xdrproc_t) xdr_cs_readdir_in, (caddr_t) argp, (xdrproc_t) xdr_cs_readdir_out, (caddr_t) clnt_res, TIMEOUT)));
}

canonical_original_code:
enum clnt_stat cs_readdir_1(struct cs_readdir_in *argp, struct cs_readdir_out *clnt_res, struct CLIENT *clnt)
{
 return (((*(clnt)->cl_ops->cl_call)(clnt, 5, (int (*)(struct XDR *, void *, ...)) xdr_cs_readdir_in, (char *) argp, (int (*)(struct XDR *, void *, ...)) xdr_cs_readdir_out, (char *) clnt_res, TIMEOUT)));
}

variable_types: struct cs_readdir_in { char *path; unsigned long dp; } *

variable_types: struct cs_readdir_out { struct { unsigned int dirs_len; struct dnfs_dir { unsigned long d_ino; unsigned char d_type; char d_name[1024]; } *dirs_val; } dirs; unsigned long dp; int err; } *

user_defined_types: struct cs_readdir_out { struct { unsigned int dirs_len; struct dnfs_dir *dirs_val; } dirs; unsigned long dp; int err; }

user_defined_types: enum xdr_op { XDR_ENCODE=0, XDR_DECODE=1, XDR_FREE=2 }


decompiled_code:
__int64 __fastcall cs_mknod_1(__int64 a1, __int64 a2, __int64 a3)
{
return (**(__int64 (__fastcall ***)(__int64, __int64, void *, __int64, void *, __int64, __int64, _QWORD))(a3 + 8))(
a3,
6LL,
&xdr_cs_mknod_in,
a1,
&xdr_cs_mknod_out,
a2,
TIMEOUT,
0LL);
}

canonical_decompiled_code:
__int64 __fastcall func5(__int64 a1, __int64 a2, __int64 a3)
{
return (**(__int64 (__fastcall ***)(__int64, __int64, void *, __int64, void *, __int64, __int64, _QWORD))(a3 + 8))(
a3,
6LL,
&xdr_cs_mknod_in,
a1,
&xdr_cs_mknod_out,
a2,
TIMEOUT,
0LL);
}

original_code:
enum clnt_stat
cs_mknod_1(cs_mknod_in *argp, cs_mknod_out *clnt_res, CLIENT *clnt)
{
 return (((*(clnt)->cl_ops->cl_call)(clnt, 6, (xdrproc_t) xdr_cs_mknod_in, (caddr_t) argp, (xdrproc_t) xdr_cs_mknod_out, (caddr_t) clnt_res, TIMEOUT)));
}

canonical_original_code:
enum clnt_stat cs_mknod_1(struct cs_mknod_in *argp, struct cs_mknod_out *clnt_res, struct CLIENT *clnt)
{
 return (((*(clnt)->cl_ops->cl_call)(clnt, 6, (int (*)(struct XDR *, void *, ...)) xdr_cs_mknod_in, (char *) argp, (int (*)(struct XDR *, void *, ...)) xdr_cs_mknod_out, (char *) clnt_res, TIMEOUT)));
}

variable_types: struct cs_mknod_in { char *path; unsigned int mode; } *

user_defined_types: struct xdr_ops { int (*x_getlong)(struct XDR *__xdrs, long *__lp); int (*x_putlong)(struct XDR *__xdrs, long *__lp); int (*x_getbytes)(struct XDR *__xdrs, char *__addr, unsigned int __len); int (*x_putbytes)(struct XDR *__xdrs, char *__addr, unsigned int __len); unsigned int (*x_getpostn)(struct XDR *__xdrs); int (*x_setpostn)(struct XDR *__xdrs, unsigned int __pos); int *(*x_inline)(struct XDR *__xdrs, unsigned int __len); void (*x_destroy)(struct XDR *__xdrs); int (*x_getint32)(struct XDR *__xdrs, int *__ip); int (*x_putint32)(struct XDR *__xdrs, int *__ip); }


decompiled_code:
__int64 __fastcall cs_open_1(__int64 a1, __int64 a2, __int64 a3)
{
return (**(__int64 (__fastcall ***)(__int64, __int64, void *, __int64, void *, __int64, __int64, _QWORD))(a3 + 8))(
a3,
7LL,
&xdr_cs_open_in,
a1,
&xdr_cs_open_out,
a2,
TIMEOUT,
0LL);
}

canonical_decompiled_code:
__int64 __fastcall func6(__int64 a1, __int64 a2, __int64 a3)
{
return (**(__int64 (__fastcall ***)(__int64, __int64, void *, __int64, void *, __int64, __int64, _QWORD))(a3 + 8))(
a3,
7LL,
&xdr_cs_open_in,
a1,
&xdr_cs_open_out,
a2,
TIMEOUT,
0LL);
}

original_code:
enum clnt_stat
cs_open_1(cs_open_in *argp, cs_open_out *clnt_res, CLIENT *clnt)
{
 return (((*(clnt)->cl_ops->cl_call)(clnt, 7, (xdrproc_t) xdr_cs_open_in, (caddr_t) argp, (xdrproc_t) xdr_cs_open_out, (caddr_t) clnt_res, TIMEOUT)));
}

canonical_original_code:
enum clnt_stat cs_open_1(struct cs_open_in *argp, struct cs_open_out *clnt_res, struct CLIENT *clnt)
{
 return (((*(clnt)->cl_ops->cl_call)(clnt, 7, (int (*)(struct XDR *, void *, ...)) xdr_cs_open_in, (char *) argp, (int (*)(struct XDR *, void *, ...)) xdr_cs_open_out, (char *) clnt_res, TIMEOUT)));
}

variable_types: struct cs_open_in { char *path; unsigned int mode; } *

variable_types: struct cs_open_out { unsigned long ino; unsigned long size; struct { unsigned int chunks_len; struct chunk_info { unsigned int ip; unsigned int bip; } *chunks_val; } chunks; int err; } *

user_defined_types: struct cs_open_out { unsigned long ino; unsigned long size; struct { unsigned int chunks_len; struct chunk_info *chunks_val; } chunks; int err; }

user_defined_types: struct XDR { enum xdr_op x_op; struct xdr_ops *x_ops; char *x_public; char *x_private; char *x_base; unsigned int x_handy; }


decompiled_code:
__int64 __fastcall cs_newchunk_1(__int64 a1, __int64 a2, __int64 a3)
{
return (**(__int64 (__fastcall ***)(__int64, __int64, void *, __int64, void *, __int64, __int64, _QWORD))(a3 + 8))(
a3,
8LL,
&xdr_cs_newchunk_in,
a1,
&xdr_cs_newchunk_out,
a2,
TIMEOUT,
0LL);
}

canonical_decompiled_code:
__int64 __fastcall func7(__int64 a1, __int64 a2, __int64 a3)
{
return (**(__int64 (__fastcall ***)(__int64, __int64, void *, __int64, void *, __int64, __int64, _QWORD))(a3 + 8))(
a3,
8LL,
&xdr_cs_newchunk_in,
a1,
&xdr_cs_newchunk_out,
a2,
TIMEOUT,
0LL);
}

original_code:
enum clnt_stat
cs_newchunk_1(cs_newchunk_in *argp, cs_newchunk_out *clnt_res, CLIENT *clnt)
{
 return (((*(clnt)->cl_ops->cl_call)(clnt, 8, (xdrproc_t) xdr_cs_newchunk_in, (caddr_t) argp, (xdrproc_t) xdr_cs_newchunk_out, (caddr_t) clnt_res, TIMEOUT)));
}

canonical_original_code:
enum clnt_stat cs_newchunk_1(struct cs_newchunk_in *argp, struct cs_newchunk_out *clnt_res, struct CLIENT *clnt)
{
 return (((*(clnt)->cl_ops->cl_call)(clnt, 8, (int (*)(struct XDR *, void *, ...)) xdr_cs_newchunk_in, (char *) argp, (int (*)(struct XDR *, void *, ...)) xdr_cs_newchunk_out, (char *) clnt_res, TIMEOUT)));
}

variable_types:
argp
struct cs_newchunk_in { char *path; } *

variable_types: struct cs_newchunk_out { struct chunk_info { unsigned int ip; unsigned int bip; } chunk; int err; } *

user_defined_types: struct cs_newchunk_out { struct chunk_info chunk; int err; }


decompiled_code:
__int64 __fastcall cs_release_1(__int64 a1, __int64 a2, __int64 a3)
{
return (**(__int64 (__fastcall ***)(__int64, __int64, void *, __int64, void *, __int64, __int64, _QWORD))(a3 + 8))(
a3,
9LL,
&xdr_cs_release_in,
a1,
&xdr_cs_release_out,
a2,
TIMEOUT,
0LL);
}

canonical_decompiled_code:
__int64 __fastcall func8(__int64 a1, __int64 a2, __int64 a3)
{
return (**(__int64 (__fastcall ***)(__int64, __int64, void *, __int64, void *, __int64, __int64, _QWORD))(a3 + 8))(
a3,
9LL,
&xdr_cs_release_in,
a1,
&xdr_cs_release_out,
a2,
TIMEOUT,
0LL);
}

original_code:
enum clnt_stat
cs_release_1(cs_release_in *argp, cs_release_out *clnt_res, CLIENT *clnt)
{
 return (((*(clnt)->cl_ops->cl_call)(clnt, 9, (xdrproc_t) xdr_cs_release_in, (caddr_t) argp, (xdrproc_t) xdr_cs_release_out, (caddr_t) clnt_res, TIMEOUT)));
}

canonical_original_code:
enum clnt_stat cs_release_1(struct cs_release_in *argp, struct cs_release_out *clnt_res, struct CLIENT *clnt)
{
 return (((*(clnt)->cl_ops->cl_call)(clnt, 9, (int (*)(struct XDR *, void *, ...)) xdr_cs_release_in, (char *) argp, (int (*)(struct XDR *, void *, ...)) xdr_cs_release_out, (char *) clnt_res, TIMEOUT)));
}

variable_types: struct cs_release_in { char *path; unsigned long size; } *


decompiled_code:
__int64 __fastcall cs_unlink_1(__int64 a1, __int64 a2, __int64 a3)
{
return (**(__int64 (__fastcall ***)(__int64, __int64, void *, __int64, void *, __int64, __int64, _QWORD))(a3 + 8))(
a3,
10LL,
&xdr_cs_unlink_in,
a1,
&xdr_cs_unlink_out,
a2,
TIMEOUT,
0LL);
}

canonical_decompiled_code:
__int64 __fastcall func9(__int64 a1, __int64 a2, __int64 a3)
{
return (**(__int64 (__fastcall ***)(__int64, __int64, void *, __int64, void *, __int64, __int64, _QWORD))(a3 + 8))(
a3,
10LL,
&xdr_cs_unlink_in,
a1,
&xdr_cs_unlink_out,
a2,
TIMEOUT,
0LL);
}

original_code:
enum clnt_stat
cs_unlink_1(cs_unlink_in *argp, cs_unlink_out *clnt_res, CLIENT *clnt)
{
 return (((*(clnt)->cl_ops->cl_call)(clnt, 10, (xdrproc_t) xdr_cs_unlink_in, (caddr_t) argp, (xdrproc_t) xdr_cs_unlink_out, (caddr_t) clnt_res, TIMEOUT)));
}

canonical_original_code:
enum clnt_stat cs_unlink_1(struct cs_unlink_in *argp, struct cs_unlink_out *clnt_res, struct CLIENT *clnt)
{
 return (((*(clnt)->cl_ops->cl_call)(clnt, 10, (int (*)(struct XDR *, void *, ...)) xdr_cs_unlink_in, (char *) argp, (int (*)(struct XDR *, void *, ...)) xdr_cs_unlink_out, (char *) clnt_res, TIMEOUT)));
}

variable_types:
argp
struct cs_unlink_in { char *path; } *


decompiled_code:
__int64 __fastcall cs_truncate_1(__int64 a1, __int64 a2, __int64 a3)
{
return (**(__int64 (__fastcall ***)(__int64, __int64, void *, __int64, void *, __int64, __int64, _QWORD))(a3 + 8))(
a3,
11LL,
&xdr_cs_truncate_in,
a1,
&xdr_cs_truncate_out,
a2,
TIMEOUT,
0LL);
}

canonical_decompiled_code:
__int64 __fastcall func10(__int64 a1, __int64 a2, __int64 a3)
{
return (**(__int64 (__fastcall ***)(__int64, __int64, void *, __int64, void *, __int64, __int64, _QWORD))(a3 + 8))(
a3,
11LL,
&xdr_cs_truncate_in,
a1,
&xdr_cs_truncate_out,
a2,
TIMEOUT,
0LL);
}

original_code:
enum clnt_stat
cs_truncate_1(cs_truncate_in *argp, cs_truncate_out *clnt_res, CLIENT *clnt)
{
 return (((*(clnt)->cl_ops->cl_call)(clnt, 11, (xdrproc_t) xdr_cs_truncate_in, (caddr_t) argp, (xdrproc_t) xdr_cs_truncate_out, (caddr_t) clnt_res, TIMEOUT)));
}

canonical_original_code:
enum clnt_stat cs_truncate_1(struct cs_truncate_in *argp, struct cs_truncate_out *clnt_res, struct CLIENT *clnt)
{
 return (((*(clnt)->cl_ops->cl_call)(clnt, 11, (int (*)(struct XDR *, void *, ...)) xdr_cs_truncate_in, (char *) argp, (int (*)(struct XDR *, void *, ...)) xdr_cs_truncate_out, (char *) clnt_res, TIMEOUT)));
}

variable_types: struct cs_truncate_in { char *path; unsigned long size; } *


decompiled_code:
__int64 __fastcall cs_chown_1(__int64 a1, __int64 a2, __int64 a3)
{
return (**(__int64 (__fastcall ***)(__int64, __int64, void *, __int64, void *, __int64, __int64, _QWORD))(a3 + 8))(
a3,
12LL,
&xdr_cs_chown_in,
a1,
&xdr_cs_chown_out,
a2,
TIMEOUT,
0LL);
}

canonical_decompiled_code:
__int64 __fastcall func11(__int64 a1, __int64 a2, __int64 a3)
{
return (**(__int64 (__fastcall ***)(__int64, __int64, void *, __int64, void *, __int64, __int64, _QWORD))(a3 + 8))(
a3,
12LL,
&xdr_cs_chown_in,
a1,
&xdr_cs_chown_out,
a2,
TIMEOUT,
0LL);
}

original_code:
enum clnt_stat
cs_chown_1(cs_chown_in *argp, cs_chown_out *clnt_res, CLIENT *clnt)
{
 return (((*(clnt)->cl_ops->cl_call)(clnt, 12, (xdrproc_t) xdr_cs_chown_in, (caddr_t) argp, (xdrproc_t) xdr_cs_chown_out, (caddr_t) clnt_res, TIMEOUT)));
}

canonical_original_code:
enum clnt_stat cs_chown_1(struct cs_chown_in *argp, struct cs_chown_out *clnt_res, struct CLIENT *clnt)
{
 return (((*(clnt)->cl_ops->cl_call)(clnt, 12, (int (*)(struct XDR *, void *, ...)) xdr_cs_chown_in, (char *) argp, (int (*)(struct XDR *, void *, ...)) xdr_cs_chown_out, (char *) clnt_res, TIMEOUT)));
}

variable_types: struct cs_chown_in { char *path; unsigned int owner; unsigned int group; } *


decompiled_code:
__int64 __fastcall cs_chmod_1(__int64 a1, __int64 a2, __int64 a3)
{
return (**(__int64 (__fastcall ***)(__int64, __int64, void *, __int64, void *, __int64, __int64, _QWORD))(a3 + 8))(
a3,
13LL,
&xdr_cs_chmod_in,
a1,
&xdr_cs_chmod_out,
a2,
TIMEOUT,
0LL);
}

canonical_decompiled_code:
__int64 __fastcall func12(__int64 a1, __int64 a2, __int64 a3)
{
return (**(__int64 (__fastcall ***)(__int64, __int64, void *, __int64, void *, __int64, __int64, _QWORD))(a3 + 8))(
a3,
13LL,
&xdr_cs_chmod_in,
a1,
&xdr_cs_chmod_out,
a2,
TIMEOUT,
0LL);
}

original_code:
enum clnt_stat
cs_chmod_1(cs_chmod_in *argp, cs_chmod_out *clnt_res, CLIENT *clnt)
{
 return (((*(clnt)->cl_ops->cl_call)(clnt, 13, (xdrproc_t) xdr_cs_chmod_in, (caddr_t) argp, (xdrproc_t) xdr_cs_chmod_out, (caddr_t) clnt_res, TIMEOUT)));
}

canonical_original_code:
enum clnt_stat cs_chmod_1(struct cs_chmod_in *argp, struct cs_chmod_out *clnt_res, struct CLIENT *clnt)
{
 return (((*(clnt)->cl_ops->cl_call)(clnt, 13, (int (*)(struct XDR *, void *, ...)) xdr_cs_chmod_in, (char *) argp, (int (*)(struct XDR *, void *, ...)) xdr_cs_chmod_out, (char *) clnt_res, TIMEOUT)));
}

variable_types: struct cs_chmod_in { char *path; unsigned int mode; } *


decompiled_code:
__int64 __fastcall cs_statfs_1(__int64 a1, __int64 a2, __int64 a3)
{
return (**(__int64 (__fastcall ***)(__int64, __int64, void *, __int64, void *, __int64, __int64, _QWORD))(a3 + 8))(
a3,
14LL,
&xdr_cs_statfs_in,
a1,
&xdr_cs_statfs_out,
a2,
TIMEOUT,
0LL);
}

canonical_decompiled_code:
__int64 __fastcall func13(__int64 a1, __int64 a2, __int64 a3)
{
return (**(__int64 (__fastcall ***)(__int64, __int64, void *, __int64, void *, __int64, __int64, _QWORD))(a3 + 8))(
a3,
14LL,
&xdr_cs_statfs_in,
a1,
&xdr_cs_statfs_out,
a2,
TIMEOUT,
0LL);
}

original_code:
enum clnt_stat
cs_statfs_1(cs_statfs_in *argp, cs_statfs_out *clnt_res, CLIENT *clnt)
{
 return (((*(clnt)->cl_ops->cl_call)(clnt, 14, (xdrproc_t) xdr_cs_statfs_in, (caddr_t) argp, (xdrproc_t) xdr_cs_statfs_out, (caddr_t) clnt_res, TIMEOUT)));
}

canonical_original_code:
enum clnt_stat cs_statfs_1(struct cs_statfs_in *argp, struct cs_statfs_out *clnt_res, struct CLIENT *clnt)
{
 return (((*(clnt)->cl_ops->cl_call)(clnt, 14, (int (*)(struct XDR *, void *, ...)) xdr_cs_statfs_in, (char *) argp, (int (*)(struct XDR *, void *, ...)) xdr_cs_statfs_out, (char *) clnt_res, TIMEOUT)));
}

variable_types:
argp
struct cs_statfs_in { char *path; } *

variable_types: struct cs_statfs_out { unsigned int f_blocks; unsigned int f_bavail; unsigned int f_bsize; int err; } *


decompiled_code:
__int64 __fastcall cs_getlist_1(__int64 a1, __int64 a2, __int64 a3)
{
return (**(__int64 (__fastcall ***)(__int64, __int64, void *, __int64, void *, __int64, __int64, _QWORD))(a3 + 8))(
a3,
15LL,
&xdr_cs_getlist_in,
a1,
&xdr_cs_getlist_out,
a2,
TIMEOUT,
0LL);
}

canonical_decompiled_code:
__int64 __fastcall func14(__int64 a1, __int64 a2, __int64 a3)
{
return (**(__int64 (__fastcall ***)(__int64, __int64, void *, __int64, void *, __int64, __int64, _QWORD))(a3 + 8))(
a3,
15LL,
&xdr_cs_getlist_in,
a1,
&xdr_cs_getlist_out,
a2,
TIMEOUT,
0LL);
}

original_code:
enum clnt_stat
cs_getlist_1(cs_getlist_in *argp, cs_getlist_out *clnt_res, CLIENT *clnt)
{
 return (((*(clnt)->cl_ops->cl_call)(clnt, 15, (xdrproc_t) xdr_cs_getlist_in, (caddr_t) argp, (xdrproc_t) xdr_cs_getlist_out, (caddr_t) clnt_res, TIMEOUT)));
}

canonical_original_code:
enum clnt_stat cs_getlist_1(struct cs_getlist_in *argp, struct cs_getlist_out *clnt_res, struct CLIENT *clnt)
{
 return (((*(clnt)->cl_ops->cl_call)(clnt, 15, (int (*)(struct XDR *, void *, ...)) xdr_cs_getlist_in, (char *) argp, (int (*)(struct XDR *, void *, ...)) xdr_cs_getlist_out, (char *) clnt_res, TIMEOUT)));
}

variable_types:
argp
struct cs_getlist_in { char *path; } *

variable_types: struct cs_getlist_out { unsigned long ino; struct { unsigned int chunks_len; struct chunk_info { unsigned int ip; unsigned int bip; } *chunks_val; } chunks; int err; } *

user_defined_types: struct cs_getlist_out { unsigned long ino; struct { unsigned int chunks_len; struct chunk_info *chunks_val; } chunks; int err; }


decompiled_code:
__int64 __fastcall cs_setwflag_1(__int64 a1, __int64 a2, __int64 a3)
{
return (**(__int64 (__fastcall ***)(__int64, __int64, void *, __int64, void *, __int64, __int64, _QWORD))(a3 + 8))(
a3,
16LL,
&xdr_cs_setwflag_in,
a1,
&xdr_cs_setwflag_out,
a2,
TIMEOUT,
0LL);
}

canonical_decompiled_code:
__int64 __fastcall func15(__int64 a1, __int64 a2, __int64 a3)
{
return (**(__int64 (__fastcall ***)(__int64, __int64, void *, __int64, void *, __int64, __int64, _QWORD))(a3 + 8))(
a3,
16LL,
&xdr_cs_setwflag_in,
a1,
&xdr_cs_setwflag_out,
a2,
TIMEOUT,
0LL);
}

original_code:
enum clnt_stat
cs_setwflag_1(cs_setwflag_in *argp, cs_setwflag_out *clnt_res, CLIENT *clnt)
{
 return (((*(clnt)->cl_ops->cl_call)(clnt, 16, (xdrproc_t) xdr_cs_setwflag_in, (caddr_t) argp, (xdrproc_t) xdr_cs_setwflag_out, (caddr_t) clnt_res, TIMEOUT)));
}

canonical_original_code:
enum clnt_stat cs_setwflag_1(struct cs_setwflag_in *argp, struct cs_setwflag_out *clnt_res, struct CLIENT *clnt)
{
 return (((*(clnt)->cl_ops->cl_call)(clnt, 16, (int (*)(struct XDR *, void *, ...)) xdr_cs_setwflag_in, (char *) argp, (int (*)(struct XDR *, void *, ...)) xdr_cs_setwflag_out, (char *) clnt_res, TIMEOUT)));
}

variable_types: struct cs_setwflag_in { char *path; int promote; } *

variable_types: struct CLIENT { struct AUTH { struct opaque_auth { int oa_flavor; char *oa_base; unsigned int oa_length; } ah_cred; struct opaque_auth ah_verf; union des_block { struct { unsigned int high; unsigned int low; } key; char c[8]; } ah_key; struct auth_ops { void (*ah_nextverf)(struct AUTH *); int (*ah_marshal)(struct AUTH *, struct XDR { enum xdr_op { XDR_ENCODE=0, XDR_DECODE=1, XDR_FREE=2 } x_op; struct xdr_ops { int (*x_getlong)(struct XDR *__xdrs, long *__lp); int (*x_putlong)(struct XDR *__xdrs, long *__lp); int (*x_getbytes)(struct XDR *__xdrs, char *__addr, unsigned int __len); int (*x_putbytes)(struct XDR *__xdrs, char *__addr, unsigned int __len); unsigned int (*x_getpostn)(struct XDR *__xdrs); int (*x_setpostn)(struct XDR *__xdrs, unsigned int __pos); int *(*x_inline)(struct XDR *__xdrs, unsigned int __len); void (*x_destroy)(struct XDR *__xdrs); int (*x_getint32)(struct XDR *__xdrs, int *__ip); int (*x_putint32)(struct XDR *__xdrs, int *__ip); } *x_ops; char *x_public; char *x_private; char *x_base; unsigned int x_handy; } *); int (*ah_validate)(struct AUTH *, struct opaque_auth *); int (*ah_refresh)(struct AUTH *); void (*ah_destroy)(struct AUTH *); } *ah_ops; char *ah_private; } *cl_auth; struct clnt_ops { enum clnt_stat { RPC_SUCCESS=0, RPC_CANTENCODEARGS=1, RPC_CANTDECODERES=2, RPC_CANTSEND=3, RPC_CANTRECV=4, RPC_TIMEDOUT=5, RPC_VERSMISMATCH=6, RPC_AUTHERROR=7, RPC_PROGUNAVAIL=8, RPC_PROGVERSMISMATCH=9, RPC_PROCUNAVAIL=10, RPC_CANTDECODEARGS=11, RPC_SYSTEMERROR=12, RPC_NOBROADCAST=21, RPC_UNKNOWNHOST=13, RPC_UNKNOWNPROTO=17, RPC_UNKNOWNADDR=19, RPC_RPCBFAILURE=14, RPC_PROGNOTREGISTERED=15, RPC_N2AXLATEFAILURE=22, RPC_FAILED=16, RPC_INTR=18, RPC_TLIERROR=20, RPC_UDERROR=23, RPC_INPROGRESS=24, RPC_STALERACHANDLE=25 } (*cl_call)(struct CLIENT *, unsigned long, int (*)(struct XDR *, void *, ...), char *, int (*)(struct XDR *, void *, ...), char *, struct timeval { long tv_sec; long tv_usec; }); void (*cl_abort)(); void (*cl_geterr)(struct CLIENT *, struct rpc_err { enum clnt_stat { RPC_SUCCESS=0, RPC_CANTENCODEARGS=1, RPC_CANTDECODERES=2, RPC_CANTSEND=3, RPC_CANTRECV=4, RPC_TIMEDOUT=5, RPC_VERSMISMATCH=6, RPC_AUTHERROR=7, RPC_PROGUNAVAIL=8, RPC_PROGVERSMISMATCH=9, RPC_PROCUNAVAIL=10, RPC_CANTDECODEARGS=11, RPC_SYSTEMERROR=12, RPC_NOBROADCAST=21, RPC_UNKNOWNHOST=13, RPC_UNKNOWNPROTO=17, RPC_UNKNOWNADDR=19, RPC_RPCBFAILURE=14, RPC_PROGNOTREGISTERED=15, RPC_N2AXLATEFAILURE=22, RPC_FAILED=16, RPC_INTR=18, RPC_TLIERROR=20, RPC_UDERROR=23, RPC_INPROGRESS=24, RPC_STALERACHANDLE=25 } re_status; union { int RE_errno; enum auth_stat { AUTH_OK=0, AUTH_BADCRED=1, AUTH_REJECTEDCRED=2, AUTH_BADVERF=3, AUTH_REJECTEDVERF=4, AUTH_TOOWEAK=5, AUTH_INVALIDRESP=6, AUTH_FAILED=7 } RE_why; struct { unsigned long low; unsigned long high; } RE_vers; struct { long s1; long s2; } RE_lb; } ru; } *); int (*cl_freeres)(struct CLIENT *, int (*)(struct XDR *, void *, ...), char *); void (*cl_destroy)(struct CLIENT *); int (*cl_control)(struct CLIENT *, int, char *); } *cl_ops; char *cl_private; } *

user_defined_types: struct CLIENT { struct AUTH *cl_auth; struct clnt_ops *cl_ops; char *cl_private; }


decompiled_code:
__int64 __fastcall cs_auth_1(__int64 a1, __int64 a2, __int64 a3)
{
return (**(__int64 (__fastcall ***)(__int64, __int64, void *, __int64, void *, __int64, __int64, _QWORD))(a3 + 8))(
a3,
17LL,
&xdr_cs_auth_in,
a1,
&xdr_cs_auth_out,
a2,
TIMEOUT,
0LL);
}

canonical_decompiled_code:
__int64 __fastcall func16(__int64 a1, __int64 a2, __int64 a3)
{
return (**(__int64 (__fastcall ***)(__int64, __int64, void *, __int64, void *, __int64, __int64, _QWORD))(a3 + 8))(
a3,
17LL,
&xdr_cs_auth_in,
a1,
&xdr_cs_auth_out,
a2,
TIMEOUT,
0LL);
}

original_code:
enum clnt_stat
cs_auth_1(cs_auth_in *argp, cs_auth_out *clnt_res, CLIENT *clnt)
{
 return (((*(clnt)->cl_ops->cl_call)(clnt, 17, (xdrproc_t) xdr_cs_auth_in, (caddr_t) argp, (xdrproc_t) xdr_cs_auth_out, (caddr_t) clnt_res, TIMEOUT)));
}

canonical_original_code:
enum clnt_stat cs_auth_1(struct cs_auth_in *argp, struct cs_auth_out *clnt_res, struct CLIENT *clnt)
{
 return (((*(clnt)->cl_ops->cl_call)(clnt, 17, (int (*)(struct XDR *, void *, ...)) xdr_cs_auth_in, (char *) argp, (int (*)(struct XDR *, void *, ...)) xdr_cs_auth_out, (char *) clnt_res, TIMEOUT)));
}

variable_types: struct cs_auth_in { char *user; char *passwd; } *

user_defined_types: struct AUTH { struct opaque_auth ah_cred; struct opaque_auth ah_verf; union des_block ah_key; struct auth_ops *ah_ops; char *ah_private; }


decompiled_code:
__int64 __fastcall os_heart_1(__int64 a1, __int64 a2, __int64 a3)
{
return (**(__int64 (__fastcall ***)(__int64, __int64, void *, __int64, void *, __int64, __int64, _QWORD))(a3 + 8))(
a3,
1LL,
&xdr_os_heart_in,
a1,
&xdr_os_heart_out,
a2,
TIMEOUT,
0LL);
}

canonical_decompiled_code:
__int64 __fastcall func17(__int64 a1, __int64 a2, __int64 a3)
{
return (**(__int64 (__fastcall ***)(__int64, __int64, void *, __int64, void *, __int64, __int64, _QWORD))(a3 + 8))(
a3,
1LL,
&xdr_os_heart_in,
a1,
&xdr_os_heart_out,
a2,
TIMEOUT,
0LL);
}

original_code:
enum clnt_stat
os_heart_1(os_heart_in *argp, os_heart_out *clnt_res, CLIENT *clnt)
{
 return (((*(clnt)->cl_ops->cl_call)(clnt, 1, (xdrproc_t) xdr_os_heart_in, (caddr_t) argp, (xdrproc_t) xdr_os_heart_out, (caddr_t) clnt_res, TIMEOUT)));
}

canonical_original_code:
enum clnt_stat os_heart_1(struct os_heart_in *argp, struct os_heart_out *clnt_res, struct CLIENT *clnt)
{
 return (((*(clnt)->cl_ops->cl_call)(clnt, 1, (int (*)(struct XDR *, void *, ...)) xdr_os_heart_in, (char *) argp, (int (*)(struct XDR *, void *, ...)) xdr_os_heart_out, (char *) clnt_res, TIMEOUT)));
}

variable_types: struct os_heart_in { unsigned int total; unsigned int avail; } *

user_defined_types: struct clnt_ops { enum clnt_stat (*cl_call)(struct CLIENT *, unsigned long, int (*)(struct XDR *, void *, ...), char *, int (*)(struct XDR *, void *, ...), char *, struct timeval); void (*cl_abort)(); void (*cl_geterr)(struct CLIENT *, struct rpc_err *); int (*cl_freeres)(struct CLIENT *, int (*)(struct XDR *, void *, ...), char *); void (*cl_destroy)(struct CLIENT *); int (*cl_control)(struct CLIENT *, int, char *); }


original_code:
static inline void list_del(struct list_head *entry)
{
        __list_del(entry->prev, entry->next);
        entry->next = ((void *) 0x00100100);
        entry->prev = ((void *) 0x00200200);
}

variable_types: struct list_head { struct list_head *next; } *

return_type: void


decompiled_code:
int cache_init()
{
cachehead.__align = (__int64)&cachehead;
*(&cachehead.__align + 1) = (__int64)&cachehead;
cachehead.__kind = 0;
return pthread_mutex_init((pthread_mutex_t *)(unsigned int)((_DWORD)&cachehead + 24), 0LL);
}

canonical_decompiled_code:
int func5()
{
cachehead.__align = (__int64)&cachehead;
*(&cachehead.__align + 1) = (__int64)&cachehead;
cachehead.__kind = 0;
return pthread_mutex_init((pthread_mutex_t *)(unsigned int)((_DWORD)&cachehead + 24), 0LL);
}

original_code:
void cache_init()
{
 do { (&cachehead.list)->next = (&cachehead.list); (&cachehead.list)->prev = (&cachehead.list); } while (0);
 cachehead.items = 0;
 pthread_mutex_init(&cachehead.lock, ((void *)0));
}


decompiled_code:
int __fastcall cache_del_item(__int64 a1)
{
pthread_mutex_lock((pthread_mutex_t *)(unsigned int)((_DWORD)&cachehead + 24));
list_del(a1);
--cachehead.__kind;
return pthread_mutex_unlock((pthread_mutex_t *)(unsigned int)((_DWORD)&cachehead + 24));
}

canonical_decompiled_code:
int __fastcall func6(__int64 a1)
{
pthread_mutex_lock((pthread_mutex_t *)(unsigned int)((_DWORD)&cachehead + 24));
func1(a1);
--cachehead.__kind;
return pthread_mutex_unlock((pthread_mutex_t *)(unsigned int)((_DWORD)&cachehead + 24));
}

original_code:
void cache_del_item(cache_item *item)
{
 pthread_mutex_lock(&cachehead.lock);
 list_del(&item->list);
 cachehead.items--;
 pthread_mutex_unlock(&cachehead.lock);
}

canonical_original_code:
void cache_del_item(struct cache_item *item)
{
 pthread_mutex_lock(&cachehead.lock);
 list_del(&item->list);
 cachehead.items--;
 pthread_mutex_unlock(&cachehead.lock);
}

variable_types: struct cache_item { struct list_head { struct list_head *next; } list; unsigned long ctime; unsigned long ino; unsigned long size; unsigned short readers; unsigned short writers; unsigned short isdirty; unsigned short chunks; struct chunk_info { unsigned int ip; unsigned int bip; } *chunklist; struct write_buffer { char *buf; unsigned int size; unsigned long offset; } wbuf; char *path; } *

user_defined_types: struct cache_item { struct list_head list; unsigned long ctime; unsigned long ino; unsigned long size; unsigned short readers; unsigned short writers; unsigned short isdirty; unsigned short chunks; struct chunk_info *chunklist; struct write_buffer wbuf; char *path; }


decompiled_code:
_QWORD *cache_get()
{
_QWORD *v0; // r12
time_t v1; // rax
_QWORD *result; // rax

v0 = malloc(0x58uLL);
if ( !v0 )
fwrite("malloc error in [cache_get]\n", 1uLL, 0x1CuLL, stderr);
v1 = time(0LL);
*v0 = v0;
v0[2] = v1;
result = v0;
v0[3] = 0LL;
v0[9] = 0LL;
v0[5] = 0LL;
v0[6] = 0LL;
v0[7] = 0LL;
*((_DWORD *)v0 + 16) = 0;
v0[10] = 0LL;
v0[1] = v0;
return result;
}

canonical_decompiled_code:
_QWORD *func9()
{
_QWORD *v0; // r12
time_t v1; // rax
_QWORD *result; // rax

v0 = malloc(0x58uLL);
if ( !v0 )
fwrite("malloc error in [cache_get]\n", 1uLL, 0x1CuLL, stderr);
v1 = time(0LL);
*v0 = v0;
v0[2] = v1;
result = v0;
v0[3] = 0LL;
v0[9] = 0LL;
v0[5] = 0LL;
v0[6] = 0LL;
v0[7] = 0LL;
*((_DWORD *)v0 + 16) = 0;
v0[10] = 0LL;
v0[1] = v0;
return result;
}

original_code:
cache_item* cache_get()
{
 cache_item *item = (cache_item*)malloc(sizeof(cache_item));
 if(!item) {
  fprintf(stderr, "malloc error in [cache_get]\n");
 }
 item->ctime = time(((void *)0));
 item->ino = 0;
 item->wbuf.size = 0;
 item->wbuf.offset = 0;
 item->readers = 0;
 item->writers = 0;
    item->isdirty = 0;
 item->chunks = 0;
 item->wbuf.buf = ((void *)0);
 item->chunklist = ((void *)0);
 item->path = ((void *)0);
 do { (&item->list)->next = (&item->list); (&item->list)->prev = (&item->list); } while (0);
 return item;
}

canonical_original_code:
struct cache_item *cache_get()
{
 struct cache_item *item = (cache_item*)malloc(sizeof(cache_item));
 if(!item) {
  fprintf(stderr, "malloc error in [cache_get]\n");
 }
 item->ctime = time(((void *)0));
 item->ino = 0;
 item->wbuf.size = 0;
 item->wbuf.offset = 0;
 item->readers = 0;
 item->writers = 0;
    item->isdirty = 0;
 item->chunks = 0;
 item->wbuf.buf = ((void *)0);
 item->chunklist = ((void *)0);
 item->path = ((void *)0);
 do { (&item->list)->next = (&item->list); (&item->list)->prev = (&item->list); } while (0);
 return item;
}

return_type: struct cache_item { struct list_head { struct list_head *next; } list; unsigned long ctime; unsigned long ino; unsigned long size; unsigned short readers; unsigned short writers; unsigned short isdirty; unsigned short chunks; struct chunk_info { unsigned int ip; unsigned int bip; } *chunklist; struct write_buffer { char *buf; unsigned int size; unsigned long offset; } wbuf; char *path; } *


decompiled_code:
void __fastcall cache_put(void *ptr)
{
void *v2; // rdi
void *v3; // rdi
void *v4; // rdi

v2 = (void *)*((_QWORD *)ptr + 6);
if ( v2 )
free(v2);
v3 = (void *)*((_QWORD *)ptr + 7);
if ( v3 )
free(v3);
v4 = (void *)*((_QWORD *)ptr + 10);
if ( v4 )
free(v4);
free(ptr);
}

canonical_decompiled_code:
void __fastcall func10(void *ptr)
{
void *v2; // rdi
void *v3; // rdi
void *v4; // rdi

v2 = (void *)*((_QWORD *)ptr + 6);
if ( v2 )
free(v2);
v3 = (void *)*((_QWORD *)ptr + 7);
if ( v3 )
free(v3);
v4 = (void *)*((_QWORD *)ptr + 10);
if ( v4 )
free(v4);
free(ptr);
}

original_code:
void cache_put(cache_item *item)
{
 if(item->chunklist) {
  free(item->chunklist);
  item->chunklist = ((void *)0);
 }
 if(item->wbuf.buf) {
  free(item->wbuf.buf);
  item->wbuf.buf = ((void *)0);
 }
 if(item->path) {
  free(item->path);
  item->path = ((void *)0);
 }
 free(item);
}

canonical_original_code:
void cache_put(struct cache_item *item)
{
 if(item->chunklist) {
  free(item->chunklist);
  item->chunklist = ((void *)0);
 }
 if(item->wbuf.buf) {
  free(item->wbuf.buf);
  item->wbuf.buf = ((void *)0);
 }
 if(item->path) {
  free(item->path);
  item->path = ((void *)0);
 }
 free(item);
}

user_defined_types: struct list_head { struct list_head *next; }

user_defined_types: struct write_buffer { char *buf; unsigned int size; unsigned long offset; }

user_defined_types: struct chunk_info { unsigned int ip; unsigned int bip; }


decompiled_code:
_BOOL8 __fastcall xdr_co_write_in(XDR *xdrs, __int64 a2)
{
_BOOL8 result; // rax

if ( xdr_opaque(xdrs, (caddr_t)a2, 0x14u)
&& xdr_bytes(xdrs, (char **)(a2 + 32), (u_int *)(a2 + 24), 0x100000u)
&& xdr_u_long(xdrs, (u_long *)(a2 + 40)) )
{
result = xdr_uint32_t(xdrs, (uint32_t *)(a2 + 48)) != 0;
}
else
{
result = 0LL;
}
return result;
}

canonical_decompiled_code:
_BOOL8 __fastcall func0(XDR *xdrs, __int64 a2)
{
_BOOL8 result; // rax

if ( xdr_opaque(xdrs, (caddr_t)a2, 0x14u)
&& xdr_bytes(xdrs, (char **)(a2 + 32), (u_int *)(a2 + 24), 0x100000u)
&& xdr_u_long(xdrs, (u_long *)(a2 + 40)) )
{
result = xdr_uint32_t(xdrs, (uint32_t *)(a2 + 48)) != 0;
}
else
{
result = 0LL;
}
return result;
}

original_code:
bool_t
xdr_co_write_in (XDR *xdrs, co_write_in *objp)
{
 register int32_t *buf;
 int i;
  if (!xdr_opaque (xdrs, objp->chunkid, 20))
   return (0);
  if (!xdr_bytes (xdrs, (char **)&objp->buf.buf_val, (u_int *) &objp->buf.buf_len, 1048576))
   return (0);
  if (!xdr_u_long (xdrs, &objp->offset))
   return (0);
  if (!xdr_uint32_t (xdrs, &objp->ip))
   return (0);
 return (1);
}

canonical_original_code:
int xdr_co_write_in(struct XDR *xdrs, struct co_write_in *objp)
{
 register int *buf;
 int i;
  if (!xdr_opaque (xdrs, objp->chunkid, 20))
   return (0);
  if (!xdr_bytes (xdrs, (char **)&objp->buf.buf_val, (unsigned int *) &objp->buf.buf_len, 1048576))
   return (0);
  if (!xdr_u_long (xdrs, &objp->offset))
   return (0);
  if (!xdr_uint32_t (xdrs, &objp->ip))
   return (0);
 return (1);
}

variable_types: struct XDR { enum xdr_op { XDR_ENCODE=0, XDR_DECODE=1, XDR_FREE=2 } x_op; struct xdr_ops { int (*x_getlong)(struct XDR *__xdrs, long *__lp); int (*x_putlong)(struct XDR *__xdrs, long *__lp); int (*x_getbytes)(struct XDR *__xdrs, char *__addr, unsigned int __len); int (*x_putbytes)(struct XDR *__xdrs, char *__addr, unsigned int __len); unsigned int (*x_getpostn)(struct XDR *__xdrs); int (*x_setpostn)(struct XDR *__xdrs, unsigned int __pos); int *(*x_inline)(struct XDR *__xdrs, unsigned int __len); void (*x_destroy)(struct XDR *__xdrs); int (*x_getint32)(struct XDR *__xdrs, int *__ip); int (*x_putint32)(struct XDR *__xdrs, int *__ip); } *x_ops; char *x_public; char *x_private; char *x_base; unsigned int x_handy; } *

variable_types: struct co_write_in { char chunkid[20]; struct { unsigned int buf_len; char *buf_val; } buf; unsigned long offset; unsigned int ip; } *

variable_types:
buf
int *

variable_types: i int


decompiled_code:
_BOOL8 __fastcall xdr_co_write_out(XDR *a1, int *a2)
{
return xdr_int(a1, a2) != 0;
}

canonical_decompiled_code:
_BOOL8 __fastcall func1(XDR *a1, int *a2)
{
return xdr_int(a1, a2) != 0;
}

original_code:
bool_t
xdr_co_write_out (XDR *xdrs, co_write_out *objp)
{
 register int32_t *buf;
  if (!xdr_int (xdrs, &objp->err))
   return (0);
 return (1);
}

canonical_original_code:
int xdr_co_write_out(struct XDR *xdrs, struct co_write_out *objp)
{
 register int *buf;
  if (!xdr_int (xdrs, &objp->err))
   return (0);
 return (1);
}

variable_types:
objp
struct co_write_out { int err; } *


decompiled_code:
_BOOL8 __fastcall xdr_co_read_in(XDR *xdrs, __int64 a2)
{
_BOOL8 result; // rax

if ( xdr_opaque(xdrs, (caddr_t)a2, 0x14u) && xdr_u_int(xdrs, (u_int *)(a2 + 20)) )
result = xdr_u_long(xdrs, (u_long *)(a2 + 24)) != 0;
else
result = 0LL;
return result;
}

canonical_decompiled_code:
_BOOL8 __fastcall func2(XDR *xdrs, __int64 a2)
{
_BOOL8 result; // rax

if ( xdr_opaque(xdrs, (caddr_t)a2, 0x14u) && xdr_u_int(xdrs, (u_int *)(a2 + 20)) )
result = xdr_u_long(xdrs, (u_long *)(a2 + 24)) != 0;
else
result = 0LL;
return result;
}

original_code:
bool_t
xdr_co_read_in (XDR *xdrs, co_read_in *objp)
{
 register int32_t *buf;
 int i;
  if (!xdr_opaque (xdrs, objp->chunkid, 20))
   return (0);
  if (!xdr_u_int (xdrs, &objp->size))
   return (0);
  if (!xdr_u_long (xdrs, &objp->offset))
   return (0);
 return (1);
}

canonical_original_code:
int xdr_co_read_in(struct XDR *xdrs, struct co_read_in *objp)
{
 register int *buf;
 int i;
  if (!xdr_opaque (xdrs, objp->chunkid, 20))
   return (0);
  if (!xdr_u_int (xdrs, &objp->size))
   return (0);
  if (!xdr_u_long (xdrs, &objp->offset))
   return (0);
 return (1);
}

variable_types: struct co_read_in { char chunkid[20]; unsigned int size; unsigned long offset; } *


decompiled_code:
bool_t __fastcall xdr_co_read_out(XDR *xdrs, u_int *sizep)
{
bool_t result; // eax

result = xdr_bytes(xdrs, (char **)sizep + 1, sizep, 0x100000u);
if ( result )
result = xdr_int(xdrs, (int *)sizep + 4) != 0;
return result;
}

canonical_decompiled_code:
bool_t __fastcall func3(XDR *xdrs, u_int *sizep)
{
bool_t result; // eax

result = xdr_bytes(xdrs, (char **)sizep + 1, sizep, 0x100000u);
if ( result )
result = xdr_int(xdrs, (int *)sizep + 4) != 0;
return result;
}

original_code:
bool_t
xdr_co_read_out (XDR *xdrs, co_read_out *objp)
{
 register int32_t *buf;
  if (!xdr_bytes (xdrs, (char **)&objp->buf.buf_val, (u_int *) &objp->buf.buf_len, 1048576))
   return (0);
  if (!xdr_int (xdrs, &objp->err))
   return (0);
 return (1);
}

canonical_original_code:
int xdr_co_read_out(struct XDR *xdrs, struct co_read_out *objp)
{
 register int *buf;
  if (!xdr_bytes (xdrs, (char **)&objp->buf.buf_val, (unsigned int *) &objp->buf.buf_len, 1048576))
   return (0);
  if (!xdr_int (xdrs, &objp->err))
   return (0);
 return (1);
}

variable_types: struct co_read_out { struct { unsigned int buf_len; char *buf_val; } buf; int err; } *


decompiled_code:
_BOOL8 __fastcall xdr_co_unlink_in(XDR *a1, char *a2)
{
return xdr_opaque(a1, a2, 0x14u) != 0;
}

canonical_decompiled_code:
_BOOL8 __fastcall func4(XDR *a1, char *a2)
{
return xdr_opaque(a1, a2, 0x14u) != 0;
}

original_code:
bool_t
xdr_co_unlink_in (XDR *xdrs, co_unlink_in *objp)
{
 register int32_t *buf;
 int i;
  if (!xdr_opaque (xdrs, objp->chunkid, 20))
   return (0);
 return (1);
}

canonical_original_code:
int xdr_co_unlink_in(struct XDR *xdrs, struct co_unlink_in *objp)
{
 register int *buf;
 int i;
  if (!xdr_opaque (xdrs, objp->chunkid, 20))
   return (0);
 return (1);
}

variable_types: struct co_unlink_in { char chunkid[20]; } *


decompiled_code:
_BOOL8 __fastcall xdr_co_unlink_out(XDR *a1, int *a2)
{
return xdr_int(a1, a2) != 0;
}

canonical_decompiled_code:
_BOOL8 __fastcall func5(XDR *a1, int *a2)
{
return xdr_int(a1, a2) != 0;
}

original_code:
bool_t
xdr_co_unlink_out (XDR *xdrs, co_unlink_out *objp)
{
 register int32_t *buf;
  if (!xdr_int (xdrs, &objp->err))
   return (0);
 return (1);
}

canonical_original_code:
int xdr_co_unlink_out(struct XDR *xdrs, struct co_unlink_out *objp)
{
 register int *buf;
  if (!xdr_int (xdrs, &objp->err))
   return (0);
 return (1);
}

variable_types:
objp
struct co_unlink_out { int err; } *


decompiled_code:
__int64 __fastcall wrapper_lstat(const char *a1, struct stat *a2)
{
int v2; // er12
int v4; // er12
char *v5; // rax

v2 = lstat(a1, a2);
if ( v2 >= 0 )
return (unsigned int)v2;
v4 = *_errno_location();
v5 = strerror(v4);
fprintf(stderr, "[wrapper_lstat]: %s\n", v5);
return (unsigned int)-v4;
}

canonical_decompiled_code:
__int64 __fastcall func0(const char *a1, struct stat *a2)
{
int v2; // er12
int v4; // er12
char *v5; // rax

v2 = lstat(a1, a2);
if ( v2 >= 0 )
return (unsigned int)v2;
v4 = *_errno_location();
v5 = strerror(v4);
fprintf(stderr, "[wrapper_lstat]: %s\n", v5);
return (unsigned int)-v4;
}

original_code:
int wrapper_lstat(const char *path, struct stat * stbuf)
{
 int res = 0;
 res = lstat(path, stbuf);
 if(res < 0) {
  res = -(*__errno_location ());
  fprintf(stderr, "[wrapper_lstat]: %s\n", strerror((*__errno_location ())));
 }
 return res;
}

canonical_original_code:
int wrapper_lstat(char *path, struct stat *stbuf)
{
 int res = 0;
 res = lstat(path, stbuf);
 if(res < 0) {
  res = -(*__errno_location ());
  fprintf(stderr, "[wrapper_lstat]: %s\n", strerror((*__errno_location ())));
 }
 return res;
}

variable_types:
path
char *

variable_types: struct stat { unsigned long st_dev; unsigned long st_ino; unsigned long st_nlink; unsigned int st_mode; unsigned int st_uid; unsigned int st_gid; int __pad0; unsigned long st_rdev; long st_size; long st_blksize; long st_blocks; struct timespec { long tv_sec; long tv_nsec; } st_atim; struct timespec st_mtim; struct timespec st_ctim; long __glibc_reserved[3]; } *

variable_types: res int

user_defined_types: struct stat { unsigned long st_dev; unsigned long st_ino; unsigned long st_nlink; unsigned int st_mode; unsigned int st_uid; unsigned int st_gid; int __pad0; unsigned long st_rdev; long st_size; long st_blksize; long st_blocks; struct timespec st_atim; struct timespec st_mtim; struct timespec st_ctim; long __glibc_reserved[3]; }


decompiled_code:
__int64 __fastcall wrapper_open(const char *a1, int a2, _DWORD *a3)
{
__int64 result; // rax
int v5; // er12
char *v6; // rax

LODWORD(result) = open(a1, a2);
*a3 = result;
if ( (int)result >= 0 )
return (unsigned int)result;
v5 = *_errno_location();
v6 = strerror(v5);
fprintf(stderr, "[wrapper_open]: %s\n", v6);
return (unsigned int)-v5;
}

canonical_decompiled_code:
__int64 __fastcall func1(const char *a1, int a2, _DWORD *a3)
{
__int64 result; // rax
int v5; // er12
char *v6; // rax

LODWORD(result) = open(a1, a2);
*a3 = result;
if ( (int)result >= 0 )
return (unsigned int)result;
v5 = *_errno_location();
v6 = strerror(v5);
fprintf(stderr, "[wrapper_open]: %s\n", v6);
return (unsigned int)-v5;
}

original_code:
int wrapper_open(const char *path, int flag, int *fd)
{
 int res = 0;
 res = open(path, flag);
 *fd = res;
 if(res < 0) {
  res = -(*__errno_location ());
  fprintf(stderr, "[wrapper_open]: %s\n", strerror((*__errno_location ())));
 }
 return res;
}

canonical_original_code:
int wrapper_open(char *path, int flag, int *fd)
{
 int res = 0;
 res = open(path, flag);
 *fd = res;
 if(res < 0) {
  res = -(*__errno_location ());
  fprintf(stderr, "[wrapper_open]: %s\n", strerror((*__errno_location ())));
 }
 return res;
}

variable_types: flag int

variable_types:
fd
int *


decompiled_code:
__int64 __fastcall wrapper_open_mode(const char *a1, int a2, __int64 a3, _DWORD *a4)
{
__int64 result; // rax
int v6; // er12
char *v7; // rax

LODWORD(result) = open(a1, a2);
*a4 = result;
if ( (int)result >= 0 )
return (unsigned int)result;
v6 = *_errno_location();
v7 = strerror(v6);
fprintf(stderr, "[wrapper_open]: %s\n", v7);
return (unsigned int)-v6;
}

canonical_decompiled_code:
__int64 __fastcall func2(const char *a1, int a2, __int64 a3, _DWORD *a4)
{
__int64 result; // rax
int v6; // er12
char *v7; // rax

LODWORD(result) = open(a1, a2);
*a4 = result;
if ( (int)result >= 0 )
return (unsigned int)result;
v6 = *_errno_location();
v7 = strerror(v6);
fprintf(stderr, "[wrapper_open]: %s\n", v7);
return (unsigned int)-v6;
}

original_code:
int wrapper_open_mode(const char *path, int flag, int mode, int *fd)
{
 int res = 0;
 res = open(path, flag, mode);
 *fd = res;
 if(res < 0) {
  res = -(*__errno_location ());
  fprintf(stderr, "[wrapper_open]: %s\n", strerror((*__errno_location ())));
 }
 return res;
}

canonical_original_code:
int wrapper_open_mode(char *path, int flag, int mode, int *fd)
{
 int res = 0;
 res = open(path, flag, mode);
 *fd = res;
 if(res < 0) {
  res = -(*__errno_location ());
  fprintf(stderr, "[wrapper_open]: %s\n", strerror((*__errno_location ())));
 }
 return res;
}

variable_types: mode int


decompiled_code:
__int64 __fastcall wrapper_pread(int a1, void *a2, size_t a3, __off_t a4)
{
int v4; // er12
int v6; // er12
char *v7; // rax

v4 = pread(a1, a2, a3, a4);
if ( v4 >= 0 )
return (unsigned int)v4;
v6 = *_errno_location();
v7 = strerror(v6);
fprintf(stderr, "[wrapper_read]: %s\n", v7);
return (unsigned int)-v6;
}

canonical_decompiled_code:
__int64 __fastcall func3(int a1, void *a2, size_t a3, __off_t a4)
{
int v4; // er12
int v6; // er12
char *v7; // rax

v4 = pread(a1, a2, a3, a4);
if ( v4 >= 0 )
return (unsigned int)v4;
v6 = *_errno_location();
v7 = strerror(v6);
fprintf(stderr, "[wrapper_read]: %s\n", v7);
return (unsigned int)-v6;
}

original_code:
int wrapper_pread(int fd, void *buf, size_t count, off_t offset)
{
 int res = 0;
 res = pread(fd, buf, count, offset);
 if(res < 0) {
  res = -(*__errno_location ());
  fprintf(stderr, "[wrapper_read]: %s\n", strerror((*__errno_location ())));
 }
 return res;
}

canonical_original_code:
int wrapper_pread(int fd, void *buf, unsigned long count, long offset)
{
 int res = 0;
 res = pread(fd, buf, count, offset);
 if(res < 0) {
  res = -(*__errno_location ());
  fprintf(stderr, "[wrapper_read]: %s\n", strerror((*__errno_location ())));
 }
 return res;
}

variable_types: fd int

variable_types:
buf
void *

variable_types:
count
unsigned long

variable_types: offset long


decompiled_code:
__int64 __fastcall wrapper_pwrite(int a1, const void *a2, size_t a3, __off_t a4)
{
int v4; // er12
int v6; // er12
char *v7; // rax

v4 = pwrite(a1, a2, a3, a4);
if ( v4 >= 0 )
return (unsigned int)v4;
v6 = *_errno_location();
v7 = strerror(v6);
fprintf(stderr, "[wrapper_pwrite]: %s\n", v7);
return (unsigned int)-v6;
}

canonical_decompiled_code:
__int64 __fastcall func4(int a1, const void *a2, size_t a3, __off_t a4)
{
int v4; // er12
int v6; // er12
char *v7; // rax

v4 = pwrite(a1, a2, a3, a4);
if ( v4 >= 0 )
return (unsigned int)v4;
v6 = *_errno_location();
v7 = strerror(v6);
fprintf(stderr, "[wrapper_pwrite]: %s\n", v7);
return (unsigned int)-v6;
}

original_code:
int wrapper_pwrite(int fd, void *buf, size_t count, off_t offset)
{
 int res = 0;
 res = pwrite(fd, buf, count, offset);
 if(res < 0) {
  res = -(*__errno_location ());
  fprintf(stderr, "[wrapper_pwrite]: %s\n", strerror((*__errno_location ())));
 }
 return res;
}

canonical_original_code:
int wrapper_pwrite(int fd, void *buf, unsigned long count, long offset)
{
 int res = 0;
 res = pwrite(fd, buf, count, offset);
 if(res < 0) {
  res = -(*__errno_location ());
  fprintf(stderr, "[wrapper_pwrite]: %s\n", strerror((*__errno_location ())));
 }
 return res;
}


decompiled_code:
__int64 __fastcall wrapper_close(int a1)
{
int v1; // er12
int v3; // er12
char *v4; // rax

v1 = close(a1);
if ( v1 >= 0 )
return (unsigned int)v1;
v3 = *_errno_location();
v4 = strerror(v3);
fprintf(stderr, "[wrapper_close]: %s\n", v4);
return (unsigned int)-v3;
}

canonical_decompiled_code:
__int64 __fastcall func5(int a1)
{
int v1; // er12
int v3; // er12
char *v4; // rax

v1 = close(a1);
if ( v1 >= 0 )
return (unsigned int)v1;
v3 = *_errno_location();
v4 = strerror(v3);
fprintf(stderr, "[wrapper_close]: %s\n", v4);
return (unsigned int)-v3;
}

original_code:
int wrapper_close(int fd)
{
 int res = 0;
 res = close(fd);
 if(res < 0) {
  res = -(*__errno_location ());
  fprintf(stderr, "[wrapper_close]: %s\n", strerror((*__errno_location ())));
 }
 return res;
}


decompiled_code:
__int64 __fastcall wrapper_access(const char *a1, int a2)
{
int v2; // er12
int v4; // er12
char *v5; // rax

v2 = access(a1, a2);
if ( v2 >= 0 )
return (unsigned int)v2;
v4 = *_errno_location();
v5 = strerror(v4);
fprintf(stderr, "[wrapper_access]: %s\n", v5);
return (unsigned int)-v4;
}

canonical_decompiled_code:
__int64 __fastcall func6(const char *a1, int a2)
{
int v2; // er12
int v4; // er12
char *v5; // rax

v2 = access(a1, a2);
if ( v2 >= 0 )
return (unsigned int)v2;
v4 = *_errno_location();
v5 = strerror(v4);
fprintf(stderr, "[wrapper_access]: %s\n", v5);
return (unsigned int)-v4;
}

original_code:
int wrapper_access(const char *path, int mode)
{
 int res = 0;
 res = access(path, mode);
 if(res < 0) {
  res = -(*__errno_location ());
  fprintf(stderr, "[wrapper_access]: %s\n", strerror((*__errno_location ())));
 }
 return res;
}

canonical_original_code:
int wrapper_access(char *path, int mode)
{
 int res = 0;
 res = access(path, mode);
 if(res < 0) {
  res = -(*__errno_location ());
  fprintf(stderr, "[wrapper_access]: %s\n", strerror((*__errno_location ())));
 }
 return res;
}


decompiled_code:
__int64 __fastcall wrapper_mkdir(const char *a1, __mode_t a2)
{
int v2; // er12
int v4; // er12
char *v5; // rax

v2 = mkdir(a1, a2);
if ( v2 >= 0 )
return (unsigned int)v2;
v4 = *_errno_location();
v5 = strerror(v4);
fprintf(stderr, "[wrapper_mkdir]: %s\n", v5);
return (unsigned int)-v4;
}

canonical_decompiled_code:
__int64 __fastcall func7(const char *a1, __mode_t a2)
{
int v2; // er12
int v4; // er12
char *v5; // rax

v2 = mkdir(a1, a2);
if ( v2 >= 0 )
return (unsigned int)v2;
v4 = *_errno_location();
v5 = strerror(v4);
fprintf(stderr, "[wrapper_mkdir]: %s\n", v5);
return (unsigned int)-v4;
}

original_code:
int wrapper_mkdir(const char *path, mode_t mode)
{
 int res = 0;
 res = mkdir(path, mode);
 if(res < 0) {
  res = -(*__errno_location ());
  fprintf(stderr, "[wrapper_mkdir]: %s\n", strerror((*__errno_location ())));
 }
 return res;
}

canonical_original_code:
int wrapper_mkdir(char *path, unsigned int mode)
{
 int res = 0;
 res = mkdir(path, mode);
 if(res < 0) {
  res = -(*__errno_location ());
  fprintf(stderr, "[wrapper_mkdir]: %s\n", strerror((*__errno_location ())));
 }
 return res;
}

variable_types:
mode
unsigned int


decompiled_code:
__int64 __fastcall wrapper_rmdir(const char *a1)
{
int v1; // er12
int v3; // er12
char *v4; // rax

v1 = rmdir(a1);
if ( v1 >= 0 )
return (unsigned int)v1;
v3 = *_errno_location();
v4 = strerror(v3);
fprintf(stderr, "[wrapper_rmdir]: %s\n", v4);
return (unsigned int)-v3;
}

canonical_decompiled_code:
__int64 __fastcall func8(const char *a1)
{
int v1; // er12
int v3; // er12
char *v4; // rax

v1 = rmdir(a1);
if ( v1 >= 0 )
return (unsigned int)v1;
v3 = *_errno_location();
v4 = strerror(v3);
fprintf(stderr, "[wrapper_rmdir]: %s\n", v4);
return (unsigned int)-v3;
}

original_code:
int wrapper_rmdir(const char *path)
{
 int res = 0;
 res = rmdir(path);
 if(res < 0) {
  res = -(*__errno_location ());
  fprintf(stderr, "[wrapper_rmdir]: %s\n", strerror((*__errno_location ())));
 }
 return res;
}

canonical_original_code:
int wrapper_rmdir(char *path)
{
 int res = 0;
 res = rmdir(path);
 if(res < 0) {
  res = -(*__errno_location ());
  fprintf(stderr, "[wrapper_rmdir]: %s\n", strerror((*__errno_location ())));
 }
 return res;
}


decompiled_code:
__int64 __fastcall wrapper_mknod(const char *a1, __mode_t a2, __dev_t a3)
{
int v3; // er12
int v5; // er12
char *v6; // rax

v3 = mknod(a1, a2, a3);
if ( v3 >= 0 )
return (unsigned int)v3;
v5 = *_errno_location();
v6 = strerror(v5);
fprintf(stderr, "[wrapper_mknod]: %s\n", v6);
return (unsigned int)-v5;
}

canonical_decompiled_code:
__int64 __fastcall func9(const char *a1, __mode_t a2, __dev_t a3)
{
int v3; // er12
int v5; // er12
char *v6; // rax

v3 = mknod(a1, a2, a3);
if ( v3 >= 0 )
return (unsigned int)v3;
v5 = *_errno_location();
v6 = strerror(v5);
fprintf(stderr, "[wrapper_mknod]: %s\n", v6);
return (unsigned int)-v5;
}

original_code:
int wrapper_mknod(const char *path, mode_t mode, dev_t dev)
{
 int res = 0;
 res = mknod(path, mode, dev);
 if(res < 0) {
  res = -(*__errno_location ());
  fprintf(stderr, "[wrapper_mknod]: %s\n", strerror((*__errno_location ())));
 }
 return res;
}

canonical_original_code:
int wrapper_mknod(char *path, unsigned int mode, unsigned long dev)
{
 int res = 0;
 res = mknod(path, mode, dev);
 if(res < 0) {
  res = -(*__errno_location ());
  fprintf(stderr, "[wrapper_mknod]: %s\n", strerror((*__errno_location ())));
 }
 return res;
}

variable_types:
dev
unsigned long


decompiled_code:
__int64 __fastcall wrapper_unlink(const char *a1)
{
int v1; // er12
int v3; // er12
char *v4; // rax

v1 = unlink(a1);
if ( v1 >= 0 )
return (unsigned int)v1;
v3 = *_errno_location();
v4 = strerror(v3);
fprintf(stderr, "[wrapper_unlink]: %s\n", v4);
return (unsigned int)-v3;
}

canonical_decompiled_code:
__int64 __fastcall func10(const char *a1)
{
int v1; // er12
int v3; // er12
char *v4; // rax

v1 = unlink(a1);
if ( v1 >= 0 )
return (unsigned int)v1;
v3 = *_errno_location();
v4 = strerror(v3);
fprintf(stderr, "[wrapper_unlink]: %s\n", v4);
return (unsigned int)-v3;
}

original_code:
int wrapper_unlink(const char *path)
{
 int res = 0;
 res = unlink(path);
 if(res < 0) {
  res = -(*__errno_location ());
  fprintf(stderr, "[wrapper_unlink]: %s\n", strerror((*__errno_location ())));
 }
 return res;
}

canonical_original_code:
int wrapper_unlink(char *path)
{
 int res = 0;
 res = unlink(path);
 if(res < 0) {
  res = -(*__errno_location ());
  fprintf(stderr, "[wrapper_unlink]: %s\n", strerror((*__errno_location ())));
 }
 return res;
}


decompiled_code:
__int64 __fastcall wrapper_truncate(const char *a1, __off_t a2)
{
int v2; // er12
int v4; // er12
char *v5; // rax

v2 = truncate(a1, a2);
if ( v2 >= 0 )
return (unsigned int)v2;
v4 = *_errno_location();
v5 = strerror(v4);
fprintf(stderr, "[wrapper_truncate]: %s\n", v5);
return (unsigned int)-v4;
}

canonical_decompiled_code:
__int64 __fastcall func11(const char *a1, __off_t a2)
{
int v2; // er12
int v4; // er12
char *v5; // rax

v2 = truncate(a1, a2);
if ( v2 >= 0 )
return (unsigned int)v2;
v4 = *_errno_location();
v5 = strerror(v4);
fprintf(stderr, "[wrapper_truncate]: %s\n", v5);
return (unsigned int)-v4;
}

original_code:
int wrapper_truncate(const char *path, off_t length)
{
 int res = 0;
 res = truncate(path, length);
 if(res < 0) {
  res = -(*__errno_location ());
  fprintf(stderr, "[wrapper_truncate]: %s\n", strerror((*__errno_location ())));
 }
 return res;
}

canonical_original_code:
int wrapper_truncate(char *path, long length)
{
 int res = 0;
 res = truncate(path, length);
 if(res < 0) {
  res = -(*__errno_location ());
  fprintf(stderr, "[wrapper_truncate]: %s\n", strerror((*__errno_location ())));
 }
 return res;
}

variable_types: length long


decompiled_code:
__int64 __fastcall wrapper_chown(const char *a1, __uid_t a2, __gid_t a3)
{
int v3; // er12
int v5; // er12
char *v6; // rax

v3 = chown(a1, a2, a3);
if ( v3 >= 0 )
return (unsigned int)v3;
v5 = *_errno_location();
v6 = strerror(v5);
fprintf(stderr, "[wrapper_chown]: %s\n", v6);
return (unsigned int)-v5;
}

canonical_decompiled_code:
__int64 __fastcall func12(const char *a1, __uid_t a2, __gid_t a3)
{
int v3; // er12
int v5; // er12
char *v6; // rax

v3 = chown(a1, a2, a3);
if ( v3 >= 0 )
return (unsigned int)v3;
v5 = *_errno_location();
v6 = strerror(v5);
fprintf(stderr, "[wrapper_chown]: %s\n", v6);
return (unsigned int)-v5;
}

original_code:
int wrapper_chown(const char *path, uid_t owner, gid_t group)
{
 int res = 0;
 res = chown(path, owner, group);
 if(res < 0) {
  res = -(*__errno_location ());
  fprintf(stderr, "[wrapper_chown]: %s\n", strerror((*__errno_location ())));
 }
 return res;
}

canonical_original_code:
int wrapper_chown(char *path, unsigned int owner, unsigned int group)
{
 int res = 0;
 res = chown(path, owner, group);
 if(res < 0) {
  res = -(*__errno_location ());
  fprintf(stderr, "[wrapper_chown]: %s\n", strerror((*__errno_location ())));
 }
 return res;
}

variable_types:
owner
unsigned int

variable_types:
group
unsigned int


decompiled_code:
__int64 __fastcall wrapper_chmod(const char *a1, __mode_t a2)
{
int v2; // er12
int v4; // er12
char *v5; // rax

v2 = chmod(a1, a2);
if ( v2 >= 0 )
return (unsigned int)v2;
v4 = *_errno_location();
v5 = strerror(v4);
fprintf(stderr, "[wrapper_chmod]: %s\n", v5);
return (unsigned int)-v4;
}

canonical_decompiled_code:
__int64 __fastcall func13(const char *a1, __mode_t a2)
{
int v2; // er12
int v4; // er12
char *v5; // rax

v2 = chmod(a1, a2);
if ( v2 >= 0 )
return (unsigned int)v2;
v4 = *_errno_location();
v5 = strerror(v4);
fprintf(stderr, "[wrapper_chmod]: %s\n", v5);
return (unsigned int)-v4;
}

original_code:
int wrapper_chmod(const char *path, mode_t mode)
{
 int res = 0;
 res = chmod(path, mode);
 if(res < 0) {
  res = -(*__errno_location ());
  fprintf(stderr, "[wrapper_chmod]: %s\n", strerror((*__errno_location ())));
 }
 return res;
}

canonical_original_code:
int wrapper_chmod(char *path, unsigned int mode)
{
 int res = 0;
 res = chmod(path, mode);
 if(res < 0) {
  res = -(*__errno_location ());
  fprintf(stderr, "[wrapper_chmod]: %s\n", strerror((*__errno_location ())));
 }
 return res;
}


decompiled_code:
int __fastcall get_space_info(_DWORD *a1, _DWORD *a2)
{
int result; // eax
int v3; // edx
struct statvfs v4; // [rsp+0h] [rbp-88h] BYREF

result = statvfs(storage_root, &v4);
if ( result )
{
perror("statfs error in [get_avail_space]");
result = -*_errno_location();
}
else
{
v3 = LODWORD(v4.f_bavail) * (v4.f_bsize >> 10);
*a1 = (v4.f_bsize >> 10) * LODWORD(v4.f_blocks);
*a2 = v3;
}
return result;
}

canonical_decompiled_code:
int __fastcall func0(_DWORD *a1, _DWORD *a2)
{
int result; // eax
int v3; // edx
struct statvfs v4; // [rsp+0h] [rbp-88h] BYREF

result = statvfs(storage_root, &v4);
if ( result )
{
perror("statfs error in [get_avail_space]");
result = -*_errno_location();
}
else
{
v3 = LODWORD(v4.f_bavail) * (v4.f_bsize >> 10);
*a1 = (v4.f_bsize >> 10) * LODWORD(v4.f_blocks);
*a2 = v3;
}
return result;
}

original_code:
int get_space_info(uint32_t *total, uint32_t *avail)
{
 struct statvfs stbuf;
 if (statvfs(storage_root, &stbuf)) {
  perror("statfs error in [get_avail_space]");
  return -(*__errno_location ());
 }
 *total = stbuf.f_blocks * (stbuf.f_bsize / 1024);
 *avail = stbuf.f_bavail * (stbuf.f_bsize / 1024);
 return 0;
}

canonical_original_code:
int get_space_info(unsigned int *total, unsigned int *avail)
{
 struct statvfs stbuf;
 if (statvfs(storage_root, &stbuf)) {
  perror("statfs error in [get_avail_space]");
  return -(*__errno_location ());
 }
 *total = stbuf.f_blocks * (stbuf.f_bsize / 1024);
 *avail = stbuf.f_bavail * (stbuf.f_bsize / 1024);
 return 0;
}

variable_types:
total
unsigned int *

variable_types:
avail
unsigned int *

variable_types: struct statvfs { unsigned long f_bsize; unsigned long f_frsize; unsigned long f_blocks; unsigned long f_bfree; unsigned long f_bavail; unsigned long f_files; unsigned long f_ffree; unsigned long f_favail; unsigned long f_fsid; unsigned long f_flag; unsigned long f_namemax; int __f_spare[6]; }


decompiled_code:
__int64 __fastcall rpccall_os_heart(__int64 a1, __int64 a2, const char *a3)
{
CLIENT *v4; // rax
CLIENT *v5; // rbp
__int64 result; // rax
char *v7; // rax

v4 = clnt_create(meta_server, 0x31230003uLL, 1uLL, "udp");
if ( v4 )
{
v5 = v4;
if ( (unsigned int)os_heart_1(a1, a2, v4) )
{
v7 = clnt_sperror(v5, "call rpc os_heart_1 error.");
fprintf(stderr, v7);
result = 4294967230LL;
}
else
{
v5->cl_ops->cl_destroy(v5);
result = 0LL;
}
}
else
{
fprintf(stderr, "%s: create client handle failed\n", a3);
result = 4294967230LL;
}
return result;
}

canonical_decompiled_code:
__int64 __fastcall func1(__int64 a1, __int64 a2, const char *a3)
{
CLIENT *v4; // rax
CLIENT *v5; // rbp
__int64 result; // rax
char *v7; // rax

v4 = clnt_create(meta_server, 0x31230003uLL, 1uLL, "udp");
if ( v4 )
{
v5 = v4;
if ( (unsigned int)os_heart_1(a1, a2, v4) )
{
v7 = clnt_sperror(v5, "call rpc os_heart_1 error.");
fprintf(stderr, v7);
result = 4294967230LL;
}
else
{
v5->cl_ops->cl_destroy(v5);
result = 0LL;
}
}
else
{
fprintf(stderr, "%s: create client handle failed\n", a3);
result = 4294967230LL;
}
return result;
}

original_code:
int rpccall_os_heart(os_heart_in *arg, os_heart_out *res, char *ipp)
{
 CLIENT *clnt;
 clnt = clnt_create(meta_server, 0x31230003, 1, "udp");
 if(!clnt) {
  fprintf(stderr, "%s: create client handle failed\n", ipp);
  return -66;
 }
 if(os_heart_1(arg, res, clnt) != RPC_SUCCESS) {
  fprintf(stderr, clnt_sperror(clnt, "call rpc os_heart_1 error."));
  return -66;
 }
 ((*(clnt)->cl_ops->cl_destroy)(clnt));
 return 0;
}

canonical_original_code:
int rpccall_os_heart(struct os_heart_in *arg, struct os_heart_out *res, char *ipp)
{
 struct CLIENT *clnt;
 clnt = clnt_create(meta_server, 0x31230003, 1, "udp");
 if(!clnt) {
  fprintf(stderr, "%s: create client handle failed\n", ipp);
  return -66;
 }
 if(os_heart_1(arg, res, clnt) != RPC_SUCCESS) {
  fprintf(stderr, clnt_sperror(clnt, "call rpc os_heart_1 error."));
  return -66;
 }
 ((*(clnt)->cl_ops->cl_destroy)(clnt));
 return 0;
}

variable_types: struct os_heart_in { unsigned int total; unsigned int avail; } *

variable_types:
res
struct os_heart_out { int err; } *

variable_types:
ipp
char *

variable_types: struct CLIENT { struct AUTH { struct opaque_auth { int oa_flavor; char *oa_base; unsigned int oa_length; } ah_cred; struct opaque_auth ah_verf; union des_block { struct { unsigned int high; unsigned int low; } key; char c[8]; } ah_key; struct auth_ops { void (*ah_nextverf)(struct AUTH *); int (*ah_marshal)(struct AUTH *, struct XDR { enum xdr_op { XDR_ENCODE=0, XDR_DECODE=1, XDR_FREE=2 } x_op; struct xdr_ops { int (*x_getlong)(struct XDR *__xdrs, long *__lp); int (*x_putlong)(struct XDR *__xdrs, long *__lp); int (*x_getbytes)(struct XDR *__xdrs, char *__addr, unsigned int __len); int (*x_putbytes)(struct XDR *__xdrs, char *__addr, unsigned int __len); unsigned int (*x_getpostn)(struct XDR *__xdrs); int (*x_setpostn)(struct XDR *__xdrs, unsigned int __pos); int *(*x_inline)(struct XDR *__xdrs, unsigned int __len); void (*x_destroy)(struct XDR *__xdrs); int (*x_getint32)(struct XDR *__xdrs, int *__ip); int (*x_putint32)(struct XDR *__xdrs, int *__ip); } *x_ops; char *x_public; char *x_private; char *x_base; unsigned int x_handy; } *); int (*ah_validate)(struct AUTH *, struct opaque_auth *); int (*ah_refresh)(struct AUTH *); void (*ah_destroy)(struct AUTH *); } *ah_ops; char *ah_private; } *cl_auth; struct clnt_ops { enum clnt_stat { RPC_SUCCESS=0, RPC_CANTENCODEARGS=1, RPC_CANTDECODERES=2, RPC_CANTSEND=3, RPC_CANTRECV=4, RPC_TIMEDOUT=5, RPC_VERSMISMATCH=6, RPC_AUTHERROR=7, RPC_PROGUNAVAIL=8, RPC_PROGVERSMISMATCH=9, RPC_PROCUNAVAIL=10, RPC_CANTDECODEARGS=11, RPC_SYSTEMERROR=12, RPC_NOBROADCAST=21, RPC_UNKNOWNHOST=13, RPC_UNKNOWNPROTO=17, RPC_UNKNOWNADDR=19, RPC_RPCBFAILURE=14, RPC_PROGNOTREGISTERED=15, RPC_N2AXLATEFAILURE=22, RPC_FAILED=16, RPC_INTR=18, RPC_TLIERROR=20, RPC_UDERROR=23, RPC_INPROGRESS=24, RPC_STALERACHANDLE=25 } (*cl_call)(struct CLIENT *, unsigned long, int (*)(struct XDR *, void *, ...), char *, int (*)(struct XDR *, void *, ...), char *, struct timeval { long tv_sec; long tv_usec; }); void (*cl_abort)(); void (*cl_geterr)(struct CLIENT *, struct rpc_err { enum clnt_stat { RPC_SUCCESS=0, RPC_CANTENCODEARGS=1, RPC_CANTDECODERES=2, RPC_CANTSEND=3, RPC_CANTRECV=4, RPC_TIMEDOUT=5, RPC_VERSMISMATCH=6, RPC_AUTHERROR=7, RPC_PROGUNAVAIL=8, RPC_PROGVERSMISMATCH=9, RPC_PROCUNAVAIL=10, RPC_CANTDECODEARGS=11, RPC_SYSTEMERROR=12, RPC_NOBROADCAST=21, RPC_UNKNOWNHOST=13, RPC_UNKNOWNPROTO=17, RPC_UNKNOWNADDR=19, RPC_RPCBFAILURE=14, RPC_PROGNOTREGISTERED=15, RPC_N2AXLATEFAILURE=22, RPC_FAILED=16, RPC_INTR=18, RPC_TLIERROR=20, RPC_UDERROR=23, RPC_INPROGRESS=24, RPC_STALERACHANDLE=25 } re_status; union { int RE_errno; enum auth_stat { AUTH_OK=0, AUTH_BADCRED=1, AUTH_REJECTEDCRED=2, AUTH_BADVERF=3, AUTH_REJECTEDVERF=4, AUTH_TOOWEAK=5, AUTH_INVALIDRESP=6, AUTH_FAILED=7 } RE_why; struct { unsigned long low; unsigned long high; } RE_vers; struct { long s1; long s2; } RE_lb; } ru; } *); int (*cl_freeres)(struct CLIENT *, int (*)(struct XDR *, void *, ...), char *); void (*cl_destroy)(struct CLIENT *); int (*cl_control)(struct CLIENT *, int, char *); } *cl_ops; char *cl_private; } *

user_defined_types: struct auth_ops { void (*ah_nextverf)(struct AUTH *); int (*ah_marshal)(struct AUTH *, struct XDR *); int (*ah_validate)(struct AUTH *, struct opaque_auth *); int (*ah_refresh)(struct AUTH *); void (*ah_destroy)(struct AUTH *); }

user_defined_types: struct rpc_err { enum clnt_stat re_status; union { int RE_errno; enum auth_stat RE_why; struct { unsigned long low; unsigned long high; } RE_vers; struct { long s1; long s2; } RE_lb; } ru; }