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


repo: zydcom/dnfs

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

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_readdir_out { struct { unsigned int dirs_len; struct dnfs_dir *dirs_val; } dirs; unsigned long dp; 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: 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; }

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

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

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

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

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

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_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: 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 }


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


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


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


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


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));
func3(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; }


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:
bool_t __fastcall xdr_co_write_in(XDR *xdrs, __int64 a2)
{
bool_t result; // eax

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

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

result = xdr_opaque(xdrs, (caddr_t)a2, 0x14u);
if ( result )
{
result = xdr_bytes(xdrs, (char **)(a2 + 32), (u_int *)(a2 + 24), 0x100000u);
if ( result )
{
result = xdr_u_long(xdrs, (u_long *)(a2 + 40));
if ( result )
result = xdr_uint32_t(xdrs, (uint32_t *)(a2 + 48)) != 0;
}
}
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

return_type: int

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:
_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:
bool_t __fastcall xdr_co_read_in(XDR *xdrs, __int64 a2)
{
bool_t result; // eax

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

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

result = xdr_opaque(xdrs, (caddr_t)a2, 0x14u);
if ( result )
{
result = xdr_u_int(xdrs, (u_int *)(a2 + 20));
if ( result )
result = xdr_u_long(xdrs, (u_long *)(a2 + 24)) != 0;
}
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; // ebx
int *v4; // rax
char *v5; // rax

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

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

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

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, int *a3)
{
int v4; // ebx
int *v6; // rax
char *v7; // rax

v4 = open(a1, a2);
*a3 = v4;
if ( v4 < 0 )
{
v6 = _errno_location();
v4 = -*v6;
v7 = strerror(*v6);
fprintf(stderr, "[wrapper_open]: %s\n", v7);
}
return (unsigned int)v4;
}

canonical_decompiled_code:
__int64 __fastcall func1(const char *a1, int a2, int *a3)
{
int v4; // ebx
int *v6; // rax
char *v7; // rax

v4 = open(a1, a2);
*a3 = v4;
if ( v4 < 0 )
{
v6 = _errno_location();
v4 = -*v6;
v7 = strerror(*v6);
fprintf(stderr, "[wrapper_open]: %s\n", v7);
}
return (unsigned int)v4;
}

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, int *a4)
{
int v5; // ebx
int *v7; // rax
char *v8; // rax

v5 = open(a1, a2);
*a4 = v5;
if ( v5 < 0 )
{
v7 = _errno_location();
v5 = -*v7;
v8 = strerror(*v7);
fprintf(stderr, "[wrapper_open]: %s\n", v8);
}
return (unsigned int)v5;
}

canonical_decompiled_code:
__int64 __fastcall func2(const char *a1, int a2, __int64 a3, int *a4)
{
int v5; // ebx
int *v7; // rax
char *v8; // rax

v5 = open(a1, a2);
*a4 = v5;
if ( v5 < 0 )
{
v7 = _errno_location();
v5 = -*v7;
v8 = strerror(*v7);
fprintf(stderr, "[wrapper_open]: %s\n", v8);
}
return (unsigned int)v5;
}

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; // ebx
int *v6; // rax
char *v7; // rax

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

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

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

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; // ebx
int *v6; // rax
char *v7; // rax

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

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

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

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; // ebx
int *v3; // rax
char *v4; // rax

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

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

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

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; // ebx
int *v4; // rax
char *v5; // rax

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

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

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

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; // ebx
int *v4; // rax
char *v5; // rax

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

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

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

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; // ebx
int *v3; // rax
char *v4; // rax

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

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

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

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; // ebx
int *v5; // rax
char *v6; // rax

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

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

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

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; // ebx
int *v3; // rax
char *v4; // rax

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

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

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

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; // ebx
int *v4; // rax
char *v5; // rax

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

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

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

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; // ebx
int *v5; // rax
char *v6; // rax

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

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

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

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; // ebx
int *v4; // rax
char *v5; // rax

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

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

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

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
unsigned __int64 v3; // rdx
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 = v4.f_bsize >> 10;
*a1 = LODWORD(v4.f_blocks) * (v4.f_bsize >> 10);
*a2 = LODWORD(v4.f_bavail) * v3;
}
return result;
}

canonical_decompiled_code:
int __fastcall func0(_DWORD *a1, _DWORD *a2)
{
int result; // eax
unsigned __int64 v3; // rdx
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 = v4.f_bsize >> 10;
*a1 = LODWORD(v4.f_blocks) * (v4.f_bsize >> 10);
*a2 = LODWORD(v4.f_bavail) * 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; // rbx
__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; // rbx
__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 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 *); }


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

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

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

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

original_code:
int rpc_os_heart(os_heart_in *arg, os_heart_out *res, char *ipp)
{
 int ret = rpccall_os_heart(arg, res, ipp);
 if(ret < 0)
  return ret;
 return res->err;
}

canonical_original_code:
int rpc_os_heart(struct os_heart_in *arg, struct os_heart_out *res, char *ipp)
{
 int ret = rpccall_os_heart(arg, res, ipp);
 if(ret < 0)
  return ret;
 return res->err;
}

variable_types: ret int

user_defined_types: struct os_heart_in { unsigned int total; unsigned int avail; }


decompiled_code:
__int64 __fastcall heart_state(void *a1)
{
__int64 result; // rax
unsigned int v2; // [rsp+4h] [rbp-14h] BYREF
unsigned int v3; // [rsp+8h] [rbp-10h] BYREF
unsigned int v4[3]; // [rsp+Ch] [rbp-Ch] BYREF

while ( 1 )
{
LODWORD(result) = get_space_info(&v3, v4);
if ( (int)result < 0 )
break;
fprintf(stderr, "[hear report]: total=%uKB, avail = %uKB\n", v3, v4[0]);
rpc_os_heart((__int64)&v3, &v2, meta_server);
sleep(heart_itval);
}
return (int)result;
}

canonical_decompiled_code:
__int64 __fastcall func3(void *a1)
{
__int64 result; // rax
unsigned int v2; // [rsp+4h] [rbp-14h] BYREF
unsigned int v3; // [rsp+8h] [rbp-10h] BYREF
unsigned int v4[3]; // [rsp+Ch] [rbp-Ch] BYREF

while ( 1 )
{
LODWORD(result) = func0(&v3, v4);
if ( (int)result < 0 )
break;
fprintf(stderr, "[hear report]: total=%uKB, avail = %uKB\n", v3, v4[0]);
func2((__int64)&v3, &v2, meta_server);
sleep(heart_itval);
}
return (int)result;
}

original_code:
void *heart_state()
{
 uint32_t space;
 os_heart_in arg;
 os_heart_out res;
 int ret;
 while(1) {
  ret = get_space_info(&arg.total, &arg.avail);
  do { if((ret) < 0) return (void*)ret; } while(0);
  fprintf(stderr, "[hear report]: total=%uKB, avail = %uKB\n", arg.total, arg.avail);
  rpc_os_heart(&arg, &res, meta_server);
  sleep(heart_itval);
 }
}

canonical_original_code:
void *heart_state()
{
 unsigned int space;
 struct os_heart_in arg;
 struct os_heart_out res;
 int ret;
 while(1) {
  ret = get_space_info(&arg.total, &arg.avail);
  do { if((ret) < 0) return (void *)ret; } while(0);
  fprintf(stderr, "[hear report]: total=%uKB, avail = %uKB\n", arg.total, arg.avail);
  rpc_os_heart(&arg, &res, meta_server);
  sleep(heart_itval);
 }
}

variable_types:
space
unsigned int

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

variable_types:
res
struct os_heart_out { int err; }

return_type: void *


decompiled_code:
__int64 __fastcall parse_storage_cmd(char a1, __int64 a2)
{
const char **v2; // rbx
int v3; // er13
__int64 result; // rax

if ( a1 <= 1 )
goto LABEL_17;
v2 = (const char **)(a2 + 16);
v3 = 0;
do
{
if ( !strcmp(*(v2 - 1), "-s") )
{
if ( !(unsigned int)is_ipv4(*v2) )
{
puts("invaild ip address.");
return 0xFFFFFFFFLL;
}
strcpy(meta_server, *v2);
v3 = 1;
}
else if ( !strcmp(*(v2 - 1), "-r") )
{
result = check_directory(*v2);
if ( (int)result < 0 )
return result;
strcpy(storage_root, *v2);
}
else
{
if ( strcmp(*(v2 - 1), "-i") )
goto LABEL_17;
heart_itval = atoi(*v2);
}
v2 += 2;
}
while ( v2 != (const char **)(a2 + 16LL * ((unsigned int)(a1 - 2) >> 1) + 32) );
if ( v3 )
return 0LL;
LABEL_17:
usage();
return 0xFFFFFFFFLL;
}

canonical_decompiled_code:
__int64 __fastcall func5(char a1, __int64 a2)
{
const char **v2; // rbx
int v3; // er13
__int64 result; // rax

if ( a1 <= 1 )
goto LABEL_17;
v2 = (const char **)(a2 + 16);
v3 = 0;
do
{
if ( !strcmp(*(v2 - 1), "-s") )
{
if ( !(unsigned int)is_ipv4(*v2) )
{
puts("invaild ip address.");
return 0xFFFFFFFFLL;
}
strcpy(meta_server, *v2);
v3 = 1;
}
else if ( !strcmp(*(v2 - 1), "-r") )
{
result = check_directory(*v2);
if ( (int)result < 0 )
return result;
strcpy(storage_root, *v2);
}
else
{
if ( strcmp(*(v2 - 1), "-i") )
goto LABEL_17;
heart_itval = atoi(*v2);
}
v2 += 2;
}
while ( v2 != (const char **)(a2 + 16LL * ((unsigned int)(a1 - 2) >> 1) + 32) );
if ( v3 )
return 0LL;
LABEL_17:
func4();
return 0xFFFFFFFFLL;
}

original_code:
int parse_storage_cmd(char argc, char *argv[])
{
 int i;
 int ret;
 int srvflag = 0;
 for(i = 1; i < argc; i += 2) {
  if(!strcmp(argv[i], "-s")) {
   if(!is_ipv4(argv[i+1])) {
    printf("invaild ip address.\n");
    return -1;
   }
   strcpy(meta_server, argv[i+1]);
   srvflag = 1;
  }
  else if(!strcmp(argv[i], "-r")) {
   ret = check_directory(argv[i+1]);
   do {if((ret) < 0) return ret; } while(0);
   strcpy(storage_root, argv[i+1]);
  }
  else if(!strcmp(argv[i], "-i")) {
   heart_itval = atoi(argv[i+1]);
  }
  else {
   usage();
   return -1;
  }
 }
 if(!srvflag) {
  usage();
  return -1;
 }
 return 0;
}

variable_types: argc char

variable_types:
argv
char *[]

variable_types: i int

variable_types: srvflag int


decompiled_code:
__int64 __fastcall storage_init(char a1, __int64 a2)
{
int v2; // ebx
pthread_t newthread[2]; // [rsp+8h] [rbp-10h] BYREF

v2 = parse_storage_cmd(a1, a2);
if ( v2 >= 0 )
{
v2 = check_directory(storage_root);
if ( v2 >= 0 )
{
v2 = pthread_create(newthread, 0LL, (void *(*)(void *))heart_state, 0LL);
if ( v2 )
{
perror("pthread_create error in [osd_init]");
v2 = -1;
}
else
{
printf("metadata server: %s\n", meta_server);
printf("storage root dierctory: %s\n", storage_root);
printf("heart interval: %d seconds\n", heart_itval);
puts("Storage node initialized successfully!\n");
}
}
}
return (unsigned int)v2;
}

canonical_decompiled_code:
__int64 __fastcall func6(char a1, __int64 a2)
{
int v2; // ebx
pthread_t newthread[2]; // [rsp+8h] [rbp-10h] BYREF

v2 = func5(a1, a2);
if ( v2 >= 0 )
{
v2 = check_directory(storage_root);
if ( v2 >= 0 )
{
v2 = pthread_create(newthread, 0LL, (void *(*)(void *))heart_state, 0LL);
if ( v2 )
{
perror("pthread_create error in [osd_init]");
v2 = -1;
}
else
{
printf("metadata server: %s\n", meta_server);
printf("storage root dierctory: %s\n", storage_root);
printf("heart interval: %d seconds\n", heart_itval);
puts("Storage node initialized successfully!\n");
}
}
}
return (unsigned int)v2;
}

original_code:
int storage_init(int argc, char *argv[])
{
 int ret;
 ret = parse_storage_cmd(argc, argv);
 do {if((ret) < 0) return ret; } while(0);
 ret = check_directory(storage_root);
 do {if((ret) < 0) return ret; } while(0);
 pthread_t tid;
 if((ret = pthread_create(&tid, ((void *)0), heart_state, ((void *)0))) != 0) {
  perror("pthread_create error in [osd_init]");
  return -1;
 }
 printf("metadata server: %s\n", meta_server);
 printf("storage root dierctory: %s\n", storage_root);
 printf("heart interval: %d seconds\n", heart_itval);
 printf("Storage node initialized successfully!\n\n");
 return 0;
}

canonical_original_code:
int storage_init(int argc, char *argv[])
{
 int ret;
 ret = parse_storage_cmd(argc, argv);
 do {if((ret) < 0) return ret; } while(0);
 ret = check_directory(storage_root);
 do {if((ret) < 0) return ret; } while(0);
 unsigned long tid;
 if((ret = pthread_create(&tid, ((void *)0), heart_state, ((void *)0))) != 0) {
  perror("pthread_create error in [osd_init]");
  return -1;
 }
 printf("metadata server: %s\n", meta_server);
 printf("storage root dierctory: %s\n", storage_root);
 printf("heart interval: %d seconds\n", heart_itval);
 printf("Storage node initialized successfully!\n\n");
 return 0;
}

variable_types: argc int

variable_types:
tid
unsigned long


usage

decompiled_code:
int usage()
{
return puts("dnfs-node -s server-ip [-r root-directory] [-i heart-interval]");
}

canonical_decompiled_code:
int func4()
{
return puts("dnfs-node -s server-ip [-r root-directory] [-i heart-interval]");
}

original_code:
void usage()
{
 printf("dnfs-node -s server-ip [-r root-directory] [-i heart-interval]\n");
}


decompiled_code:
__int64 __fastcall co_write_1(__int64 a1, __int64 a2, __int64 a3)
{
return (**(__int64 (__fastcall ***)(__int64, __int64, void *, __int64, void *, __int64, __int64, _QWORD))(a3 + 8))(
a3,
1LL,
&xdr_co_write_in,
a1,
&xdr_co_write_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_co_write_in,
a1,
&xdr_co_write_out,
a2,
TIMEOUT,
0LL);
}

original_code:
enum clnt_stat
co_write_1(co_write_in *argp, co_write_out *clnt_res, CLIENT *clnt)
{
 return (((*(clnt)->cl_ops->cl_call)(clnt, 1, (xdrproc_t) xdr_co_write_in, (caddr_t) argp, (xdrproc_t) xdr_co_write_out, (caddr_t) clnt_res, TIMEOUT)));
}

canonical_original_code:
enum clnt_stat co_write_1(struct co_write_in *argp, struct co_write_out *clnt_res, struct CLIENT *clnt)
{
 return (((*(clnt)->cl_ops->cl_call)(clnt, 1, (int (*)(struct XDR *, void *, ...)) xdr_co_write_in, (char *) argp, (int (*)(struct XDR *, void *, ...)) xdr_co_write_out, (char *) clnt_res, TIMEOUT)));
}

variable_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 opaque_auth { int oa_flavor; char *oa_base; unsigned int oa_length; }

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

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

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

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


decompiled_code:
__int64 __fastcall co_read_1(__int64 a1, __int64 a2, __int64 a3)
{
return (**(__int64 (__fastcall ***)(__int64, __int64, void *, __int64, void *, __int64, __int64, _QWORD))(a3 + 8))(
a3,
2LL,
&xdr_co_read_in,
a1,
&xdr_co_read_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_co_read_in,
a1,
&xdr_co_read_out,
a2,
TIMEOUT,
0LL);
}

original_code:
enum clnt_stat
co_read_1(co_read_in *argp, co_read_out *clnt_res, CLIENT *clnt)
{
 return (((*(clnt)->cl_ops->cl_call)(clnt, 2, (xdrproc_t) xdr_co_read_in, (caddr_t) argp, (xdrproc_t) xdr_co_read_out, (caddr_t) clnt_res, TIMEOUT)));
}

canonical_original_code:
enum clnt_stat co_read_1(struct co_read_in *argp, struct co_read_out *clnt_res, struct CLIENT *clnt)
{
 return (((*(clnt)->cl_ops->cl_call)(clnt, 2, (int (*)(struct XDR *, void *, ...)) xdr_co_read_in, (char *) argp, (int (*)(struct XDR *, void *, ...)) xdr_co_read_out, (char *) clnt_res, TIMEOUT)));
}

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

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 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: 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 co_unlink_1(__int64 a1, __int64 a2, __int64 a3)
{
return (**(__int64 (__fastcall ***)(__int64, __int64, void *, __int64, void *, __int64, __int64, _QWORD))(a3 + 8))(
a3,
3LL,
&xdr_co_unlink_in,
a1,
&xdr_co_unlink_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_co_unlink_in,
a1,
&xdr_co_unlink_out,
a2,
TIMEOUT,
0LL);
}

original_code:
enum clnt_stat
co_unlink_1(co_unlink_in *argp, co_unlink_out *clnt_res, CLIENT *clnt)
{
 return (((*(clnt)->cl_ops->cl_call)(clnt, 3, (xdrproc_t) xdr_co_unlink_in, (caddr_t) argp, (xdrproc_t) xdr_co_unlink_out, (caddr_t) clnt_res, TIMEOUT)));
}

canonical_original_code:
enum clnt_stat co_unlink_1(struct co_unlink_in *argp, struct co_unlink_out *clnt_res, struct CLIENT *clnt)
{
 return (((*(clnt)->cl_ops->cl_call)(clnt, 3, (int (*)(struct XDR *, void *, ...)) xdr_co_unlink_in, (char *) argp, (int (*)(struct XDR *, void *, ...)) xdr_co_unlink_out, (char *) clnt_res, TIMEOUT)));
}

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


original_code:
void set_dnfs_attr(struct stat stbuf, dnfs_stat *st)
{
   st->s_ino = stbuf.st_ino;
   st->s_mode = stbuf.st_mode;
   st->s_nlink = stbuf.st_nlink;
   st->s_uid = stbuf.st_uid;
   st->s_gid = stbuf.st_gid;
   st->s_rdev = stbuf.st_rdev;
   st->s_size = stbuf.st_size;
   st->s_blocks = stbuf.st_blocks;
   st->s_atime = stbuf.st_atim.tv_sec;
   st->s_mtime = stbuf.st_mtim.tv_sec;
   st->s_ctime = stbuf.st_ctim.tv_sec;
}

canonical_original_code:
void set_dnfs_attr(struct stat stbuf, struct dnfs_stat *st)
{
   st->s_ino = stbuf.st_ino;
   st->s_mode = stbuf.st_mode;
   st->s_nlink = stbuf.st_nlink;
   st->s_uid = stbuf.st_uid;
   st->s_gid = stbuf.st_gid;
   st->s_rdev = stbuf.st_rdev;
   st->s_size = stbuf.st_size;
   st->s_blocks = stbuf.st_blocks;
   st->s_atime = stbuf.st_atim.tv_sec;
   st->s_mtime = stbuf.st_mtim.tv_sec;
   st->s_ctime = stbuf.st_ctim.tv_sec;
}

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


original_code:
void get_dnfs_attr(struct stat *stbuf, dnfs_stat st)
{
   stbuf->st_ino = st.s_ino;
   stbuf->st_mode = st.s_mode;
   stbuf->st_nlink = st.s_nlink;
   stbuf->st_uid = st.s_uid;
   stbuf->st_gid = st.s_gid;
   stbuf->st_rdev = st.s_rdev;
   stbuf->st_size = st.s_size;
   stbuf->st_blocks = st.s_blocks;
   stbuf->st_atim.tv_sec = st.s_atime;
   stbuf->st_mtim.tv_sec = st.s_mtime;
   stbuf->st_ctim.tv_sec = st.s_ctime;
   stbuf->st_dev = 0;
   stbuf->st_blksize = 0;
}

canonical_original_code:
void get_dnfs_attr(struct stat *stbuf, struct dnfs_stat st)
{
   stbuf->st_ino = st.s_ino;
   stbuf->st_mode = st.s_mode;
   stbuf->st_nlink = st.s_nlink;
   stbuf->st_uid = st.s_uid;
   stbuf->st_gid = st.s_gid;
   stbuf->st_rdev = st.s_rdev;
   stbuf->st_size = st.s_size;
   stbuf->st_blocks = st.s_blocks;
   stbuf->st_atim.tv_sec = st.s_atime;
   stbuf->st_mtim.tv_sec = st.s_mtime;
   stbuf->st_ctim.tv_sec = st.s_ctime;
   stbuf->st_dev = 0;
   stbuf->st_blksize = 0;
}

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


decompiled_code:
__int64 __fastcall is_ipv4(__int64 a1)
{
int v1; // edx
__int64 result; // rax
unsigned int v3; // [rsp+0h] [rbp-18h] BYREF
unsigned int v4; // [rsp+4h] [rbp-14h] BYREF
unsigned int v5; // [rsp+8h] [rbp-10h] BYREF
int v6; // [rsp+Ch] [rbp-Ch] BYREF

v1 = _isoc99_sscanf(a1, "%u.%u.%u.%u", &v6, &v5, &v4, &v3);
result = 0LL;
if ( v1 == 4 && v5 <= 0xFF && v4 <= 0xFF )
result = ((unsigned int)(v6 - 1) <= 0xFE) & (unsigned __int8)(v3 <= 0xFF);
return result;
}

canonical_decompiled_code:
__int64 __fastcall func2(__int64 a1)
{
int v1; // edx
__int64 result; // rax
unsigned int v3; // [rsp+0h] [rbp-18h] BYREF
unsigned int v4; // [rsp+4h] [rbp-14h] BYREF
unsigned int v5; // [rsp+8h] [rbp-10h] BYREF
int v6; // [rsp+Ch] [rbp-Ch] BYREF

v1 = _isoc99_sscanf(a1, "%u.%u.%u.%u", &v6, &v5, &v4, &v3);
result = 0LL;
if ( v1 == 4 && v5 <= 0xFF && v4 <= 0xFF )
result = ((unsigned int)(v6 - 1) <= 0xFE) & (unsigned __int8)(v3 <= 0xFF);
return result;
}

variable_types:
ip
char *


decompiled_code:
int __fastcall get_addr(char *a1, unsigned int a2)
{
return sprintf(a1, "%u.%u.%u.%u", HIBYTE(a2), (a2 & 0xFFFFFF) >> 16, BYTE1(a2), (unsigned __int8)a2);
}

canonical_decompiled_code:
int __fastcall func4(char *a1, unsigned int a2)
{
return sprintf(a1, "%u.%u.%u.%u", HIBYTE(a2), (a2 & 0xFFFFFF) >> 16, BYTE1(a2), (unsigned __int8)a2);
}

canonical_original_code:
void get_addr(char *ipp, unsigned int ip)
{
    unsigned int p1; unsigned int p2; unsigned int p3; unsigned int p4;
    p1 = ip / 0x1000000;
    p2 = ip % 0x1000000 / 0x10000;
    p3 = ip % 0x10000 / 0x100;
    p4 = ip % 0x100;
    sprintf(ipp, "%u.%u.%u.%u", p1, p2, p3, p4);
}

variable_types:
ipp
char *

variable_types:
ip
unsigned int


decompiled_code:
__int64 __fastcall check_directory(const char *a1)
{
int v1; // edx
__int64 result; // rax
char v3[1032]; // [rsp+0h] [rbp-408h] BYREF

v1 = access(a1, 0);
result = 0LL;
if ( v1 < 0 )
{
sprintf(v3, "mkdir -p %s", a1);
result = (unsigned int)(system(v3) >> 31);
}
return result;
}

canonical_decompiled_code:
__int64 __fastcall func5(const char *a1)
{
int v1; // edx
__int64 result; // rax
char v3[1032]; // [rsp+0h] [rbp-408h] BYREF

v1 = access(a1, 0);
result = 0LL;
if ( v1 < 0 )
{
sprintf(v3, "mkdir -p %s", a1);
result = (unsigned int)(system(v3) >> 31);
}
return result;
}

original_code:
int check_directory(char *path)
{
 int res = 0;
 res = access(path, 0);
 if(res < 0) {
  char root_dir[1024];
  sprintf(root_dir, "mkdir -p %s", path);
  if(system(root_dir) < 0)
   return -1;
 }
 return 0;
}

variable_types:
path
char *

variable_types: res int


main

canonical_name: main

decompiled_code:
int __cdecl main(int argc, const char **argv, const char **envp)
{
printf("c99int:\t%u, %u, %u, %lu\n", 255LL, 0xFFFFLL, 0xFFFFFFFFLL, -1LL);
return 0;
}

canonical_original_code:
int main(int argc, char *argv[]) {
 unsigned char i8 = (uint8_t)-1;
 unsigned short i16 = (uint16_t)-1;
 unsigned int i32 = (uint32_t)-1;
 unsigned long i64 = (uint64_t)-1L;
 printf("c99int:\t%" "u" ", %" "u" ", %" "u" ", %" "l" "u" "\n", i8, i16, i32, i64);
 return 0;
}

variable_types:
argv
char *[]


parameter

repo: zyoung/passgen

decompiled_code:
__int64 __fastcall parameter(char *s)
{
size_t v1; // rbx
int v2; // ebp
int v3; // er13
__int64 result; // rax
char v5[104]; // [rsp+0h] [rbp-68h] BYREF

if ( *s )
{
v1 = 0LL;
v2 = 0;
v3 = 0;
while ( strlen(s) > v1 )
{
if ( v2 )
v5[v3++] = s[v1];
if ( s[v1] == 61 )
v2 = 1;
++v1;
}
v5[v3] = 0;
result = strtol(v5, 0LL, 10);
}
else
{
puts("Error resolving parameters.");
result = 0xFFFFFFFFLL;
}
return result;
}

canonical_decompiled_code:
__int64 __fastcall func7(char *s)
{
size_t v1; // rbx
int v2; // ebp
int v3; // er13
__int64 result; // rax
char v5[104]; // [rsp+0h] [rbp-68h] BYREF

if ( *s )
{
v1 = 0LL;
v2 = 0;
v3 = 0;
while ( strlen(s) > v1 )
{
if ( v2 )
v5[v3++] = s[v1];
if ( s[v1] == 61 )
v2 = 1;
++v1;
}
v5[v3] = 0;
result = strtol(v5, 0LL, 10);
}
else
{
puts("Error resolving parameters.");
result = 0xFFFFFFFFLL;
}
return result;
}

original_code:
int parameter(char *arg) {
    int value = 1;
    int lcv;
    int index = 0;
    int record = 0;
    char temp[50];
    if (strlen(arg)) {
        for (lcv = 0; lcv < strlen(arg); lcv++) {
            if (record) {
                temp[index] = arg[lcv];
                index++;
            }
            if (arg[lcv] == '=') {
                record = 1;
            }
        }
        temp[index] = '\0';
        value = strtol(temp, ((void *)0), 10);
    } else {
        printf("Error resolving parameters.\n");
        value = -1;
    }
    return value;
}

variable_types:
arg
char *

variable_types: value int

variable_types: lcv int

variable_types: index int

variable_types: record int

variable_types:
temp
char [50]


main

decompiled_code:
int __cdecl main(int argc, const char **argv, const char **envp)
{
char **v4; // rbx
const char **v5; // rbp
char *v6; // rdi
char v7; // al

if ( argc > 1 )
{
v4 = (char **)(argv + 1);
v5 = &argv[(unsigned int)(argc - 2) + 2];
while ( 1 )
{
v6 = *v4;
if ( **v4 == 45 )
{
v7 = v6[1];
if ( v7 == 110 || v7 == 115 || v7 == 108 )
parameter(v6);
}
if ( ++v4 == (char **)v5 )
{
puts("There was an error processing your parameters");
puts("Valid input is:");
puts("\t-n=<number of passwords>");
puts("\t-l=<length of password>");
puts("\t-s=<strength 1 being weakest and 4 being strongest>");
exit(1);
}
}
}
intro(argc, argv, envp);
printf("NUM: %d", 20LL);
printf(" LENGTH: %d", 12LL);
printf(" STRENGTH %d\n", 4LL);
passgen(20LL, 12LL, 4LL);
return 0;
}

canonical_decompiled_code:
int __cdecl main(int argc, const char **argv, const char **envp)
{
char **v4; // rbx
const char **v5; // rbp
char *v6; // rdi
char v7; // al

if ( argc > 1 )
{
v4 = (char **)(argv + 1);
v5 = &argv[(unsigned int)(argc - 2) + 2];
while ( 1 )
{
v6 = *v4;
if ( **v4 == 45 )
{
v7 = v6[1];
if ( v7 == 110 || v7 == 115 || v7 == 108 )
func7(v6);
}
if ( ++v4 == (char **)v5 )
{
puts("There was an error processing your parameters");
puts("Valid input is:");
puts("\t-n=<number of passwords>");
puts("\t-l=<length of password>");
puts("\t-s=<strength 1 being weakest and 4 being strongest>");
exit(1);
}
}
}
func8(argc, argv, envp);
printf("NUM: %d", 20LL);
printf(" LENGTH: %d", 12LL);
printf(" STRENGTH %d\n", 4LL);
func11(20LL, 12LL, 4LL);
return 0;
}

original_code:
int main(int argv, char *argc[]) {
    int num = 20;
    int length = 12;
    int strength = 4;
    int idx;
    int error;
    if (argv > 1) {
 for (idx = 1; idx < argv; idx++) {
     if (argc[idx][0] == '-') {
  switch (argc[idx][1]) {
  case 's':
      strength = parameter(argc[idx]);
      break;
  case 'n':
      num = parameter(argc[idx]);
      break;
  case 'l':
      length = parameter(argc[idx]);
      break;
  default:
      strength = -1;
      break;
  }
     } else {
  error = 1;
     }
 }
 if (error == 1 || strength == -1 || num == -1 || length == -1) {
     printf("There was an error processing your parameters\n");
     printf("Valid input is:\n");
     printf("\t-n=<number of passwords>\n");
     printf("\t-l=<length of password>\n");
     printf
  ("\t-s=<strength 1 being weakest and 4 being strongest>\n");
     exit(1);
 }
    }
    intro();
    printf("NUM: %d", num);
    printf(" LENGTH: %d", length);
    printf(" STRENGTH %d\n", strength);
    passgen(num, length, strength);
    return 0;
}

variable_types: argv int

variable_types:
argc
char *[]

variable_types: num int

variable_types: length int

variable_types: strength int

variable_types: idx int

variable_types: error int


intro

decompiled_code:
int intro()
{
puts("Passgen 2.0");
puts("Written by Zach Young");
puts("Copyright 2004, 2005, 2006 Zach Young");
puts("This is free software; see the source for copying conditions. There is NO");
return puts("warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.\n");
}

canonical_decompiled_code:
int func8()
{
puts("Passgen 2.0");
puts("Written by Zach Young");
puts("Copyright 2004, 2005, 2006 Zach Young");
puts("This is free software; see the source for copying conditions. There is NO");
return puts("warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.\n");
}

original_code:
void intro()
{
    printf("Passgen 2.0\n");
    printf("Written by Zach Young\n");
    printf("Copyright 2004, 2005, 2006 Zach Young\n");
    printf("This is free software; see the source for copying conditions.  There is NO\n");
    printf("warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.\n\n");
    return;
}


getValue

original_code:
char getValue(int s)
{
    char c;
    int idx;
    int l;
    int o;
    int type = rand() % s;
    switch (type) {
        case 0:
            l = 10;
            o = 48;
            break;
        case 1:
            l = 26;
            o = 97;
            break;
        case 2:
            l = 26;
            o = 65;
            break;
        case 3:
            l = 15;
            o = 33;
            break;
        default:
            l = 26;
            o = 97;
    }
 return rand() % l + o;
}

variable_types: s int

variable_types: c char

variable_types: l int

variable_types: o int

variable_types: type int

return_type: char


generate

decompiled_code:
int __fastcall generate(int a1, int a2)
{
int i; // ebx
char v3; // al

if ( a1 > 0 )
{
for ( i = 0; i != a1; ++i )
{
v3 = getValue(a2);
putchar(v3);
}
}
return putchar(10);
}

canonical_decompiled_code:
int __fastcall func10(int a1, int a2)
{
int i; // ebx
char v3; // al

if ( a1 > 0 )
{
for ( i = 0; i != a1; ++i )
{
v3 = func9(a2);
putchar(v3);
}
}
return putchar(10);
}

original_code:
void generate(int l, int s)
{
    int idx;
    for (idx = 0; idx < l; idx++) {
        printf("%c", getValue(s));
    }
    printf("\n");
    return;
}


passgen

decompiled_code:
void __fastcall passgen(int a1, int a2, int a3)
{
unsigned int v4; // eax
int i; // ebx

v4 = time(0LL);
srand(v4);
if ( a1 > 0 )
{
for ( i = 0; i != a1; ++i )
generate(a2, a3);
}
}

canonical_decompiled_code:
void __fastcall func11(int a1, int a2, int a3)
{
unsigned int v4; // eax
int i; // ebx

v4 = time(0LL);
srand(v4);
if ( a1 > 0 )
{
for ( i = 0; i != a1; ++i )
func10(a2, a3);
}
}

original_code:
void passgen(int num, int length, int strength)
{
    int idx;
    srand(time(((void *)0)));
    for (idx = 0; idx < num; idx++) {
        generate(length, strength);
    }
    return;
}


backtrace

repo: zzmfish/tracegraph

decompiled_code:
int *__fastcall backtrace()
{
_QWORD *v0; // rbp
int *result; // rax
_QWORD *v2; // rbx
int v3; // er12
unsigned __int64 v4; // rsi
_QWORD *v5; // r13
unsigned __int64 v6; // rbp
_QWORD v7[5]; // [rsp-28h] [rbp-28h] BYREF

result = *(int **)&addr_start;
if ( addr_end > *(_QWORD *)&addr_start )
{
v7[1] = v0;
v2 = v0;
v3 = 0;
v4 = 0LL;
while ( v2 >= v7 )
{
v5 = (_QWORD *)*v2;
v6 = v2[1];
if ( v6 >= *(_QWORD *)&addr_start && v6 < addr_end && v4 < addr_end && v4 >= *(_QWORD *)&addr_start )
call_table_set((unsigned int)(v6 - addr_start), (unsigned int)(v4 - addr_start), v3 == 1);
result = &max_frame_size;
if ( (int)abs32((_DWORD)v2 - (_DWORD)v5) > max_frame_size )
break;
++v3;
result = &max_frame_depth;
if ( max_frame_depth < v3 )
break;
v4 = v6;
v2 = v5;
}
}
return result;
}

canonical_decompiled_code:
int *__fastcall func7()
{
_QWORD *v0; // rbp
int *result; // rax
_QWORD *v2; // rbx
int v3; // er12
unsigned __int64 v4; // rsi
_QWORD *v5; // r13
unsigned __int64 v6; // rbp
_QWORD v7[5]; // [rsp-28h] [rbp-28h] BYREF

result = *(int **)&addr_start;
if ( addr_end > *(_QWORD *)&addr_start )
{
v7[1] = v0;
v2 = v0;
v3 = 0;
v4 = 0LL;
while ( v2 >= v7 )
{
v5 = (_QWORD *)*v2;
v6 = v2[1];
if ( v6 >= *(_QWORD *)&addr_start && v6 < addr_end && v4 < addr_end && v4 >= *(_QWORD *)&addr_start )
call_table_set((unsigned int)(v6 - addr_start), (unsigned int)(v4 - addr_start), v3 == 1);
result = &max_frame_size;
if ( (int)abs32((_DWORD)v2 - (_DWORD)v5) > max_frame_size )
break;
++v3;
result = &max_frame_depth;
if ( max_frame_depth < v3 )
break;
v4 = v6;
v2 = v5;
}
}
return result;
}

original_code:
void backtrace()
{
  if (addr_end <= addr_start)
    return;
  void *bp = 0, *ip = 0, *sp = 0, *prev_bp = 0, *prev_ip = 0;
  __asm__("movq %%rbp, %0;" : "=r"(bp));
  __asm__("movq %%rsp, %0;" : "=r"(sp));
  int i = 0;
  while (bp >= sp) {
    prev_bp = *((void**)bp);
    prev_ip = *((void**)bp + 1);
    if ((unsigned long)prev_ip >= addr_start && (unsigned long)prev_ip < addr_end
        && (unsigned long)ip >= addr_start && (unsigned long)ip < addr_end) {
      call_table_set((unsigned long)prev_ip - addr_start, (unsigned long)ip - addr_start, i == 1);
    }
    if (abs(bp - prev_bp) > max_frame_size)
      break;
    i ++;
    if (i > max_frame_depth)
      break;
    bp = prev_bp;
    ip = prev_ip;
  }
}

canonical_original_code:
void backtrace()
{
  if (addr_end <= addr_start)
    return;
  void *bp = 0; void *ip = 0; void *sp = 0; void *prev_bp = 0; void *prev_ip = 0;
  __asm__("movq %%rbp, %0;" : "=r"(bp));
  __asm__("movq %%rsp, %0;" : "=r"(sp));
  int i = 0;
  while (bp >= sp) {
    prev_bp = *((void **)bp);
    prev_ip = *((void **)bp + 1);
    if ((unsigned long)prev_ip >= addr_start && (unsigned long)prev_ip < addr_end
        && (unsigned long)ip >= addr_start && (unsigned long)ip < addr_end) {
      call_table_set((unsigned long)prev_ip - addr_start, (unsigned long)ip - addr_start, i == 1);
    }
    if (abs(bp - prev_bp) > max_frame_size)
      break;
    i ++;
    if (i > max_frame_depth)
      break;
    bp = prev_bp;
    ip = prev_ip;
  }
}

variable_types:
bp
void *

variable_types:
ip
void *

variable_types:
sp
void *

variable_types: i int


decompiled_code:
__int64 __fastcall mcu_sort_list(unsigned __int8 *a1, __int64 a2)
{
char *v2; // rdx
__int64 result; // rax
int v4; // eax

v2 = (char *)&unk_37A1;
do
{
result = *a1;
if ( *a1 <= 0x1Fu )
{
v4 = 2 * result;
*(_BYTE *)(a2 + v4) = *(v2 - 1);
result = v4 + 1;
*(_BYTE *)(a2 + result) = *v2;
}
++a1;
v2 += 2;
}
while ( v2 != (char *)&unk_37A1 + 64 );
return result;
}

canonical_decompiled_code:
__int64 __fastcall func0(unsigned __int8 *a1, __int64 a2)
{
char *v2; // rdx
__int64 result; // rax
int v4; // eax

v2 = (char *)&unk_37A1;
do
{
result = *a1;
if ( *a1 <= 0x1Fu )
{
v4 = 2 * result;
*(_BYTE *)(a2 + v4) = *(v2 - 1);
result = v4 + 1;
*(_BYTE *)(a2 + result) = *v2;
}
++a1;
v2 += 2;
}
while ( v2 != (char *)&unk_37A1 + 64 );
return result;
}

original_code:
static void mcu_sort_list( unsigned char *src, unsigned char *dst ) {
 int i;
 for ( i = 0; i < 0x20; i++ ) {
  int where = src[i];
  if ( where < 0x20 ) {
   int offs = ( i << 1 );
   where <<= 1;
   dst[where] = mcu_table3[offs];
   dst[where+1] = mcu_table3[offs+1];
  }
 }
}

canonical_original_code:
static void mcu_sort_list(unsigned char *src, unsigned char *dst) {
 int i;
 for ( i = 0; i < 0x20; i++ ) {
  int where = src[i];
  if ( where < 0x20 ) {
   int offs = ( i << 1 );
   where <<= 1;
   dst[where] = mcu_table3[offs];
   dst[where+1] = mcu_table3[offs+1];
  }
 }
}

variable_types:
src
unsigned char *

variable_types:
dst
unsigned char *

variable_types: where int

variable_types: offs int