decompiled_code:
bool_t __fastcall xdr_dnfs_dir(XDR *a1, void *a2)
{
bool_t result; // eax

result = xdr_uint64_t(a1, (uint64_t *)a2);
if ( result )
{
result = xdr_uint8_t(a1, (uint8_t *)a2 + 8);
if ( result )
result = xdr_opaque(a1, (caddr_t)a2 + 9, 0x400u) != 0;
}
return result;
}

canonical_decompiled_code:
bool_t __fastcall func1(XDR *a1, void *a2)
{
bool_t result; // eax

result = xdr_uint64_t(a1, (uint64_t *)a2);
if ( result )
{
result = xdr_uint8_t(a1, (uint8_t *)a2 + 8);
if ( result )
result = xdr_opaque(a1, (caddr_t)a2 + 9, 0x400u) != 0;
}
return result;
}

original_code:
bool_t
xdr_dnfs_dir (XDR *xdrs, dnfs_dir *objp)
{
 register int32_t *buf;
 int i;
  if (!xdr_uint64_t (xdrs, &objp->d_ino))
   return (0);
  if (!xdr_uint8_t (xdrs, &objp->d_type))
   return (0);
  if (!xdr_opaque (xdrs, objp->d_name, 1024))
   return (0);
 return (1);
}

canonical_original_code:
int xdr_dnfs_dir(struct XDR *xdrs, struct dnfs_dir *objp)
{
 register int *buf;
 int i;
  if (!xdr_uint64_t (xdrs, &objp->d_ino))
   return (0);
  if (!xdr_uint8_t (xdrs, &objp->d_type))
   return (0);
  if (!xdr_opaque (xdrs, objp->d_name, 1024))
   return (0);
 return (1);
}

variable_types: struct dnfs_dir { unsigned long d_ino; unsigned char d_type; char d_name[1024]; } *

variable_types: i int

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

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


repo: zydcom/dnfs

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

result = xdr_uint64_t(xdrs, (uint64_t *)a2);
if ( result )
{
result = xdr_uint32_t(xdrs, (uint32_t *)(a2 + 8));
if ( result )
{
result = xdr_uint16_t(xdrs, (uint16_t *)(a2 + 12));
if ( result )
{
result = xdr_uint16_t(xdrs, (uint16_t *)(a2 + 14));
if ( result )
{
result = xdr_uint64_t(xdrs, (uint64_t *)(a2 + 16));
if ( result )
{
result = xdr_uint32_t(xdrs, (uint32_t *)(a2 + 24));
if ( result )
{
result = xdr_uint32_t(xdrs, (uint32_t *)(a2 + 28));
if ( result )
{
result = xdr_uint64_t(xdrs, (uint64_t *)(a2 + 32));
if ( result )
{
result = xdr_uint64_t(xdrs, (uint64_t *)(a2 + 40));
if ( result )
{
result = xdr_uint64_t(xdrs, (uint64_t *)(a2 + 48));
if ( result )
{
result = xdr_uint64_t(xdrs, (uint64_t *)(a2 + 56));
if ( result )
{
result = xdr_uint64_t(xdrs, (uint64_t *)(a2 + 64));
if ( result )
result = xdr_uint64_t(xdrs, (uint64_t *)(a2 + 72)) != 0;
}
}
}
}
}
}
}
}
}
}
}
return result;
}

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

result = xdr_uint64_t(xdrs, (uint64_t *)a2);
if ( result )
{
result = xdr_uint32_t(xdrs, (uint32_t *)(a2 + 8));
if ( result )
{
result = xdr_uint16_t(xdrs, (uint16_t *)(a2 + 12));
if ( result )
{
result = xdr_uint16_t(xdrs, (uint16_t *)(a2 + 14));
if ( result )
{
result = xdr_uint64_t(xdrs, (uint64_t *)(a2 + 16));
if ( result )
{
result = xdr_uint32_t(xdrs, (uint32_t *)(a2 + 24));
if ( result )
{
result = xdr_uint32_t(xdrs, (uint32_t *)(a2 + 28));
if ( result )
{
result = xdr_uint64_t(xdrs, (uint64_t *)(a2 + 32));
if ( result )
{
result = xdr_uint64_t(xdrs, (uint64_t *)(a2 + 40));
if ( result )
{
result = xdr_uint64_t(xdrs, (uint64_t *)(a2 + 48));
if ( result )
{
result = xdr_uint64_t(xdrs, (uint64_t *)(a2 + 56));
if ( result )
{
result = xdr_uint64_t(xdrs, (uint64_t *)(a2 + 64));
if ( result )
result = xdr_uint64_t(xdrs, (uint64_t *)(a2 + 72)) != 0;
}
}
}
}
}
}
}
}
}
}
}
return result;
}

original_code:
bool_t
xdr_dnfs_stat (XDR *xdrs, dnfs_stat *objp)
{
 register int32_t *buf;
  if (!xdr_uint64_t (xdrs, &objp->s_ino))
   return (0);
  if (!xdr_uint32_t (xdrs, &objp->s_mode))
   return (0);
  if (!xdr_uint16_t (xdrs, &objp->s_chunks))
   return (0);
  if (!xdr_uint16_t (xdrs, &objp->s_copies))
   return (0);
  if (!xdr_uint64_t (xdrs, &objp->s_nlink))
   return (0);
  if (!xdr_uint32_t (xdrs, &objp->s_uid))
   return (0);
  if (!xdr_uint32_t (xdrs, &objp->s_gid))
   return (0);
  if (!xdr_uint64_t (xdrs, &objp->s_rdev))
   return (0);
  if (!xdr_uint64_t (xdrs, &objp->s_size))
   return (0);
  if (!xdr_uint64_t (xdrs, &objp->s_blocks))
   return (0);
  if (!xdr_uint64_t (xdrs, &objp->s_atime))
   return (0);
  if (!xdr_uint64_t (xdrs, &objp->s_mtime))
   return (0);
  if (!xdr_uint64_t (xdrs, &objp->s_ctime))
   return (0);
 return (1);
}

canonical_original_code:
int xdr_dnfs_stat(struct XDR *xdrs, struct dnfs_stat *objp)
{
 register int *buf;
  if (!xdr_uint64_t (xdrs, &objp->s_ino))
   return (0);
  if (!xdr_uint32_t (xdrs, &objp->s_mode))
   return (0);
  if (!xdr_uint16_t (xdrs, &objp->s_chunks))
   return (0);
  if (!xdr_uint16_t (xdrs, &objp->s_copies))
   return (0);
  if (!xdr_uint64_t (xdrs, &objp->s_nlink))
   return (0);
  if (!xdr_uint32_t (xdrs, &objp->s_uid))
   return (0);
  if (!xdr_uint32_t (xdrs, &objp->s_gid))
   return (0);
  if (!xdr_uint64_t (xdrs, &objp->s_rdev))
   return (0);
  if (!xdr_uint64_t (xdrs, &objp->s_size))
   return (0);
  if (!xdr_uint64_t (xdrs, &objp->s_blocks))
   return (0);
  if (!xdr_uint64_t (xdrs, &objp->s_atime))
   return (0);
  if (!xdr_uint64_t (xdrs, &objp->s_mtime))
   return (0);
  if (!xdr_uint64_t (xdrs, &objp->s_ctime))
   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 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; } *

variable_types:
buf
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_cs_getattr_in(XDR *a1, char **a2)
{
return xdr_string(a1, a2, 0x400u) != 0;
}

canonical_decompiled_code:
_BOOL8 __fastcall func3(XDR *a1, char **a2)
{
return xdr_string(a1, a2, 0x400u) != 0;
}

original_code:
bool_t
xdr_cs_getattr_in (XDR *xdrs, cs_getattr_in *objp)
{
 register int32_t *buf;
  if (!xdr_string (xdrs, &objp->path, 1024))
   return (0);
 return (1);
}

canonical_original_code:
int xdr_cs_getattr_in(struct XDR *xdrs, struct cs_getattr_in *objp)
{
 register int *buf;
  if (!xdr_string (xdrs, &objp->path, 1024))
   return (0);
 return (1);
}

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


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

result = xdr_dnfs_stat(xdrs, a2);
if ( result )
result = xdr_int(xdrs, (int *)(a2 + 80)) != 0;
return result;
}

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

result = func2(xdrs, a2);
if ( result )
result = xdr_int(xdrs, (int *)(a2 + 80)) != 0;
return result;
}

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

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

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

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


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

result = xdr_string(xdrs, (char **)a2, 0x400u);
if ( result )
result = xdr_int(xdrs, (int *)(a2 + 8)) != 0;
return result;
}

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

result = xdr_string(xdrs, (char **)a2, 0x400u);
if ( result )
result = xdr_int(xdrs, (int *)(a2 + 8)) != 0;
return result;
}

original_code:
bool_t
xdr_cs_access_in (XDR *xdrs, cs_access_in *objp)
{
 register int32_t *buf;
  if (!xdr_string (xdrs, &objp->path, 1024))
   return (0);
  if (!xdr_int (xdrs, &objp->mode))
   return (0);
 return (1);
}

canonical_original_code:
int xdr_cs_access_in(struct XDR *xdrs, struct cs_access_in *objp)
{
 register int *buf;
  if (!xdr_string (xdrs, &objp->path, 1024))
   return (0);
  if (!xdr_int (xdrs, &objp->mode))
   return (0);
 return (1);
}

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


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

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

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

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

variable_types:
objp
struct cs_access_out { int err; } *


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

result = xdr_string(xdrs, (char **)a2, 0x400u);
if ( result )
result = xdr_u_int(xdrs, (u_int *)(a2 + 8)) != 0;
return result;
}

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

result = xdr_string(xdrs, (char **)a2, 0x400u);
if ( result )
result = xdr_u_int(xdrs, (u_int *)(a2 + 8)) != 0;
return result;
}

original_code:
bool_t
xdr_cs_mkdir_in (XDR *xdrs, cs_mkdir_in *objp)
{
 register int32_t *buf;
  if (!xdr_string (xdrs, &objp->path, 1024))
   return (0);
  if (!xdr_u_int (xdrs, &objp->mode))
   return (0);
 return (1);
}

canonical_original_code:
int xdr_cs_mkdir_in(struct XDR *xdrs, struct cs_mkdir_in *objp)
{
 register int *buf;
  if (!xdr_string (xdrs, &objp->path, 1024))
   return (0);
  if (!xdr_u_int (xdrs, &objp->mode))
   return (0);
 return (1);
}

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


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

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

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

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

variable_types:
objp
struct cs_mkdir_out { int err; } *


decompiled_code:
_BOOL8 __fastcall xdr_cs_rmdir_in(XDR *a1, char **a2)
{
return xdr_string(a1, a2, 0x400u) != 0;
}

canonical_decompiled_code:
_BOOL8 __fastcall func9(XDR *a1, char **a2)
{
return xdr_string(a1, a2, 0x400u) != 0;
}

original_code:
bool_t
xdr_cs_rmdir_in (XDR *xdrs, cs_rmdir_in *objp)
{
 register int32_t *buf;
  if (!xdr_string (xdrs, &objp->path, 1024))
   return (0);
 return (1);
}

canonical_original_code:
int xdr_cs_rmdir_in(struct XDR *xdrs, struct cs_rmdir_in *objp)
{
 register int *buf;
  if (!xdr_string (xdrs, &objp->path, 1024))
   return (0);
 return (1);
}

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


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

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

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

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

variable_types:
objp
struct cs_rmdir_out { int err; } *


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

result = xdr_string(xdrs, (char **)a2, 0x400u);
if ( result )
result = xdr_u_long(xdrs, (u_long *)(a2 + 8)) != 0;
return result;
}

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

result = xdr_string(xdrs, (char **)a2, 0x400u);
if ( result )
result = xdr_u_long(xdrs, (u_long *)(a2 + 8)) != 0;
return result;
}

original_code:
bool_t
xdr_cs_readdir_in (XDR *xdrs, cs_readdir_in *objp)
{
 register int32_t *buf;
  if (!xdr_string (xdrs, &objp->path, 1024))
   return (0);
  if (!xdr_u_long (xdrs, &objp->dp))
   return (0);
 return (1);
}

canonical_original_code:
int xdr_cs_readdir_in(struct XDR *xdrs, struct cs_readdir_in *objp)
{
 register int *buf;
  if (!xdr_string (xdrs, &objp->path, 1024))
   return (0);
  if (!xdr_u_long (xdrs, &objp->dp))
   return (0);
 return (1);
}

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


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

result = xdr_array(xdrs, (caddr_t *)sizep + 1, sizep, 0x1Eu, 0x410u, (xdrproc_t)xdr_dnfs_dir);
if ( result )
{
result = xdr_u_long(xdrs, (u_long *)sizep + 2);
if ( result )
result = xdr_int(xdrs, (int *)sizep + 6) != 0;
}
return result;
}

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

result = xdr_array(xdrs, (caddr_t *)sizep + 1, sizep, 0x1Eu, 0x410u, (xdrproc_t)xdr_dnfs_dir);
if ( result )
{
result = xdr_u_long(xdrs, (u_long *)sizep + 2);
if ( result )
result = xdr_int(xdrs, (int *)sizep + 6) != 0;
}
return result;
}

original_code:
bool_t
xdr_cs_readdir_out (XDR *xdrs, cs_readdir_out *objp)
{
 register int32_t *buf;
  if (!xdr_array (xdrs, (char **)&objp->dirs.dirs_val, (u_int *) &objp->dirs.dirs_len, 30,
  sizeof (dnfs_dir), (xdrproc_t) xdr_dnfs_dir))
   return (0);
  if (!xdr_u_long (xdrs, &objp->dp))
   return (0);
  if (!xdr_int (xdrs, &objp->err))
   return (0);
 return (1);
}

canonical_original_code:
int xdr_cs_readdir_out(struct XDR *xdrs, struct cs_readdir_out *objp)
{
 register int *buf;
  if (!xdr_array (xdrs, (char **)&objp->dirs.dirs_val, (unsigned int *) &objp->dirs.dirs_len, 30,
  sizeof (dnfs_dir), (int (*)(struct XDR *, void *, ...)) xdr_dnfs_dir))
   return (0);
  if (!xdr_u_long (xdrs, &objp->dp))
   return (0);
  if (!xdr_int (xdrs, &objp->err))
   return (0);
 return (1);
}

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

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


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

result = xdr_string(xdrs, (char **)a2, 0x400u);
if ( result )
result = xdr_u_int(xdrs, (u_int *)(a2 + 8)) != 0;
return result;
}

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

result = xdr_string(xdrs, (char **)a2, 0x400u);
if ( result )
result = xdr_u_int(xdrs, (u_int *)(a2 + 8)) != 0;
return result;
}

original_code:
bool_t
xdr_cs_mknod_in (XDR *xdrs, cs_mknod_in *objp)
{
 register int32_t *buf;
  if (!xdr_string (xdrs, &objp->path, 1024))
   return (0);
  if (!xdr_u_int (xdrs, &objp->mode))
   return (0);
 return (1);
}

canonical_original_code:
int xdr_cs_mknod_in(struct XDR *xdrs, struct cs_mknod_in *objp)
{
 register int *buf;
  if (!xdr_string (xdrs, &objp->path, 1024))
   return (0);
  if (!xdr_u_int (xdrs, &objp->mode))
   return (0);
 return (1);
}

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


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

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

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

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

variable_types:
objp
struct cs_mknod_out { int err; } *


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

result = xdr_string(xdrs, (char **)a2, 0x400u);
if ( result )
result = xdr_int(xdrs, (int *)(a2 + 8)) != 0;
return result;
}

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

result = xdr_string(xdrs, (char **)a2, 0x400u);
if ( result )
result = xdr_int(xdrs, (int *)(a2 + 8)) != 0;
return result;
}

original_code:
bool_t
xdr_cs_setwflag_in (XDR *xdrs, cs_setwflag_in *objp)
{
 register int32_t *buf;
  if (!xdr_string (xdrs, &objp->path, 1024))
   return (0);
  if (!xdr_int (xdrs, &objp->promote))
   return (0);
 return (1);
}

canonical_original_code:
int xdr_cs_setwflag_in(struct XDR *xdrs, struct cs_setwflag_in *objp)
{
 register int *buf;
  if (!xdr_string (xdrs, &objp->path, 1024))
   return (0);
  if (!xdr_int (xdrs, &objp->promote))
   return (0);
 return (1);
}

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


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

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

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

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

variable_types:
objp
struct cs_setwflag_out { int err; } *


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

result = xdr_string(xdrs, (char **)a2, 0x400u);
if ( result )
result = xdr_u_int(xdrs, (u_int *)(a2 + 8)) != 0;
return result;
}

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

result = xdr_string(xdrs, (char **)a2, 0x400u);
if ( result )
result = xdr_u_int(xdrs, (u_int *)(a2 + 8)) != 0;
return result;
}

original_code:
bool_t
xdr_cs_open_in (XDR *xdrs, cs_open_in *objp)
{
 register int32_t *buf;
  if (!xdr_string (xdrs, &objp->path, 1024))
   return (0);
  if (!xdr_u_int (xdrs, &objp->mode))
   return (0);
 return (1);
}

canonical_original_code:
int xdr_cs_open_in(struct XDR *xdrs, struct cs_open_in *objp)
{
 register int *buf;
  if (!xdr_string (xdrs, &objp->path, 1024))
   return (0);
  if (!xdr_u_int (xdrs, &objp->mode))
   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 cs_open_in { char *path; unsigned int mode; } *


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

result = xdr_uint64_t(xdrs, (uint64_t *)a2);
if ( result )
{
result = xdr_uint64_t(xdrs, (uint64_t *)(a2 + 8));
if ( result )
{
result = xdr_array(xdrs, (caddr_t *)(a2 + 24), (u_int *)(a2 + 16), 0x400u, 8u, (xdrproc_t)xdr_chunk_info);
if ( result )
result = xdr_int(xdrs, (int *)(a2 + 32)) != 0;
}
}
return result;
}

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

result = xdr_uint64_t(xdrs, (uint64_t *)a2);
if ( result )
{
result = xdr_uint64_t(xdrs, (uint64_t *)(a2 + 8));
if ( result )
{
result = xdr_array(xdrs, (caddr_t *)(a2 + 24), (u_int *)(a2 + 16), 0x400u, 8u, (xdrproc_t)xdr_chunk_info);
if ( result )
result = xdr_int(xdrs, (int *)(a2 + 32)) != 0;
}
}
return result;
}

original_code:
bool_t
xdr_cs_open_out (XDR *xdrs, cs_open_out *objp)
{
 register int32_t *buf;
  if (!xdr_uint64_t (xdrs, &objp->ino))
   return (0);
  if (!xdr_uint64_t (xdrs, &objp->size))
   return (0);
  if (!xdr_array (xdrs, (char **)&objp->chunks.chunks_val, (u_int *) &objp->chunks.chunks_len, 1024,
  sizeof (chunk_info), (xdrproc_t) xdr_chunk_info))
   return (0);
  if (!xdr_int (xdrs, &objp->err))
   return (0);
 return (1);
}

canonical_original_code:
int xdr_cs_open_out(struct XDR *xdrs, struct cs_open_out *objp)
{
 register int *buf;
  if (!xdr_uint64_t (xdrs, &objp->ino))
   return (0);
  if (!xdr_uint64_t (xdrs, &objp->size))
   return (0);
  if (!xdr_array (xdrs, (char **)&objp->chunks.chunks_val, (unsigned int *) &objp->chunks.chunks_len, 1024,
  sizeof (chunk_info), (int (*)(struct XDR *, void *, ...)) xdr_chunk_info))
   return (0);
  if (!xdr_int (xdrs, &objp->err))
   return (0);
 return (1);
}

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

variable_types:
buf
int *

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:
_BOOL8 __fastcall xdr_cs_newchunk_in(XDR *a1, char **a2)
{
return xdr_string(a1, a2, 0x400u) != 0;
}

canonical_decompiled_code:
_BOOL8 __fastcall func19(XDR *a1, char **a2)
{
return xdr_string(a1, a2, 0x400u) != 0;
}

original_code:
bool_t
xdr_cs_newchunk_in (XDR *xdrs, cs_newchunk_in *objp)
{
 register int32_t *buf;
  if (!xdr_string (xdrs, &objp->path, 1024))
   return (0);
 return (1);
}

canonical_original_code:
int xdr_cs_newchunk_in(struct XDR *xdrs, struct cs_newchunk_in *objp)
{
 register int *buf;
  if (!xdr_string (xdrs, &objp->path, 1024))
   return (0);
 return (1);
}

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


decompiled_code:
bool_t __fastcall xdr_cs_newchunk_out(XDR *xdrs, int *a2)
{
bool_t result; // eax

result = xdr_chunk_info(xdrs, a2);
if ( result )
result = xdr_int(xdrs, a2 + 2) != 0;
return result;
}

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

result = func0(xdrs, a2);
if ( result )
result = xdr_int(xdrs, a2 + 2) != 0;
return result;
}

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

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

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

result = xdr_string(xdrs, (char **)a2, 0x400u);
if ( result )
result = xdr_uint64_t(xdrs, (uint64_t *)(a2 + 8)) != 0;
return result;
}

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

result = xdr_string(xdrs, (char **)a2, 0x400u);
if ( result )
result = xdr_uint64_t(xdrs, (uint64_t *)(a2 + 8)) != 0;
return result;
}

original_code:
bool_t
xdr_cs_release_in (XDR *xdrs, cs_release_in *objp)
{
 register int32_t *buf;
  if (!xdr_string (xdrs, &objp->path, 1024))
   return (0);
  if (!xdr_uint64_t (xdrs, &objp->size))
   return (0);
 return (1);
}

canonical_original_code:
int xdr_cs_release_in(struct XDR *xdrs, struct cs_release_in *objp)
{
 register int *buf;
  if (!xdr_string (xdrs, &objp->path, 1024))
   return (0);
  if (!xdr_uint64_t (xdrs, &objp->size))
   return (0);
 return (1);
}

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


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

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

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

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

variable_types:
objp
struct cs_release_out { int err; } *


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

result = xdr_string(xdrs, (char **)a2, 0x400u);
if ( result )
result = xdr_uint64_t(xdrs, (uint64_t *)(a2 + 8)) != 0;
return result;
}

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

result = xdr_string(xdrs, (char **)a2, 0x400u);
if ( result )
result = xdr_uint64_t(xdrs, (uint64_t *)(a2 + 8)) != 0;
return result;
}

original_code:
bool_t
xdr_cs_truncate_in (XDR *xdrs, cs_truncate_in *objp)
{
 register int32_t *buf;
  if (!xdr_string (xdrs, &objp->path, 1024))
   return (0);
  if (!xdr_uint64_t (xdrs, &objp->size))
   return (0);
 return (1);
}

canonical_original_code:
int xdr_cs_truncate_in(struct XDR *xdrs, struct cs_truncate_in *objp)
{
 register int *buf;
  if (!xdr_string (xdrs, &objp->path, 1024))
   return (0);
  if (!xdr_uint64_t (xdrs, &objp->size))
   return (0);
 return (1);
}

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


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

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

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

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

variable_types:
objp
struct cs_truncate_out { int err; } *


decompiled_code:
_BOOL8 __fastcall xdr_cs_getlist_in(XDR *a1, char **a2)
{
return xdr_string(a1, a2, 0x400u) != 0;
}

canonical_decompiled_code:
_BOOL8 __fastcall func25(XDR *a1, char **a2)
{
return xdr_string(a1, a2, 0x400u) != 0;
}

original_code:
bool_t
xdr_cs_getlist_in (XDR *xdrs, cs_getlist_in *objp)
{
 register int32_t *buf;
  if (!xdr_string (xdrs, &objp->path, 1024))
   return (0);
 return (1);
}

canonical_original_code:
int xdr_cs_getlist_in(struct XDR *xdrs, struct cs_getlist_in *objp)
{
 register int *buf;
  if (!xdr_string (xdrs, &objp->path, 1024))
   return (0);
 return (1);
}

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


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

result = xdr_uint64_t(xdrs, (uint64_t *)a2);
if ( result )
{
result = xdr_array(xdrs, (caddr_t *)(a2 + 16), (u_int *)(a2 + 8), 0x400u, 8u, (xdrproc_t)xdr_chunk_info);
if ( result )
result = xdr_int(xdrs, (int *)(a2 + 24)) != 0;
}
return result;
}

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

result = xdr_uint64_t(xdrs, (uint64_t *)a2);
if ( result )
{
result = xdr_array(xdrs, (caddr_t *)(a2 + 16), (u_int *)(a2 + 8), 0x400u, 8u, (xdrproc_t)xdr_chunk_info);
if ( result )
result = xdr_int(xdrs, (int *)(a2 + 24)) != 0;
}
return result;
}

original_code:
bool_t
xdr_cs_getlist_out (XDR *xdrs, cs_getlist_out *objp)
{
 register int32_t *buf;
  if (!xdr_uint64_t (xdrs, &objp->ino))
   return (0);
  if (!xdr_array (xdrs, (char **)&objp->chunks.chunks_val, (u_int *) &objp->chunks.chunks_len, 1024,
  sizeof (chunk_info), (xdrproc_t) xdr_chunk_info))
   return (0);
  if (!xdr_int (xdrs, &objp->err))
   return (0);
 return (1);
}

canonical_original_code:
int xdr_cs_getlist_out(struct XDR *xdrs, struct cs_getlist_out *objp)
{
 register int *buf;
  if (!xdr_uint64_t (xdrs, &objp->ino))
   return (0);
  if (!xdr_array (xdrs, (char **)&objp->chunks.chunks_val, (unsigned int *) &objp->chunks.chunks_len, 1024,
  sizeof (chunk_info), (int (*)(struct XDR *, void *, ...)) xdr_chunk_info))
   return (0);
  if (!xdr_int (xdrs, &objp->err))
   return (0);
 return (1);
}

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:
_BOOL8 __fastcall xdr_cs_unlink_in(XDR *a1, char **a2)
{
return xdr_string(a1, a2, 0x400u) != 0;
}

canonical_decompiled_code:
_BOOL8 __fastcall func27(XDR *a1, char **a2)
{
return xdr_string(a1, a2, 0x400u) != 0;
}

original_code:
bool_t
xdr_cs_unlink_in (XDR *xdrs, cs_unlink_in *objp)
{
 register int32_t *buf;
  if (!xdr_string (xdrs, &objp->path, 1024))
   return (0);
 return (1);
}

canonical_original_code:
int xdr_cs_unlink_in(struct XDR *xdrs, struct cs_unlink_in *objp)
{
 register int *buf;
  if (!xdr_string (xdrs, &objp->path, 1024))
   return (0);
 return (1);
}

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


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

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

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

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

variable_types:
objp
struct cs_unlink_out { int err; } *


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

result = xdr_string(xdrs, (char **)a2, 0x400u);
if ( result )
{
result = xdr_u_int(xdrs, (u_int *)(a2 + 8));
if ( result )
result = xdr_u_int(xdrs, (u_int *)(a2 + 12)) != 0;
}
return result;
}

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

result = xdr_string(xdrs, (char **)a2, 0x400u);
if ( result )
{
result = xdr_u_int(xdrs, (u_int *)(a2 + 8));
if ( result )
result = xdr_u_int(xdrs, (u_int *)(a2 + 12)) != 0;
}
return result;
}

original_code:
bool_t
xdr_cs_chown_in (XDR *xdrs, cs_chown_in *objp)
{
 register int32_t *buf;
  if (!xdr_string (xdrs, &objp->path, 1024))
   return (0);
  if (!xdr_u_int (xdrs, &objp->owner))
   return (0);
  if (!xdr_u_int (xdrs, &objp->group))
   return (0);
 return (1);
}

canonical_original_code:
int xdr_cs_chown_in(struct XDR *xdrs, struct cs_chown_in *objp)
{
 register int *buf;
  if (!xdr_string (xdrs, &objp->path, 1024))
   return (0);
  if (!xdr_u_int (xdrs, &objp->owner))
   return (0);
  if (!xdr_u_int (xdrs, &objp->group))
   return (0);
 return (1);
}

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


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

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

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

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

variable_types:
objp
struct cs_chown_out { int err; } *


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

result = xdr_string(xdrs, (char **)a2, 0x400u);
if ( result )
result = xdr_u_int(xdrs, (u_int *)(a2 + 8)) != 0;
return result;
}

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

result = xdr_string(xdrs, (char **)a2, 0x400u);
if ( result )
result = xdr_u_int(xdrs, (u_int *)(a2 + 8)) != 0;
return result;
}

original_code:
bool_t
xdr_cs_chmod_in (XDR *xdrs, cs_chmod_in *objp)
{
 register int32_t *buf;
  if (!xdr_string (xdrs, &objp->path, 1024))
   return (0);
  if (!xdr_u_int (xdrs, &objp->mode))
   return (0);
 return (1);
}

canonical_original_code:
int xdr_cs_chmod_in(struct XDR *xdrs, struct cs_chmod_in *objp)
{
 register int *buf;
  if (!xdr_string (xdrs, &objp->path, 1024))
   return (0);
  if (!xdr_u_int (xdrs, &objp->mode))
   return (0);
 return (1);
}

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


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

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

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

canonical_original_code:
int xdr_cs_chmod_out(struct XDR *xdrs, struct cs_chmod_out *objp)
{
 register int *buf;
  if (!xdr_int (xdrs, &objp->err))
   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:
objp
struct cs_chmod_out { int err; } *


decompiled_code:
_BOOL8 __fastcall xdr_cs_statfs_in(XDR *a1, char **a2)
{
return xdr_string(a1, a2, 0x400u) != 0;
}

canonical_decompiled_code:
_BOOL8 __fastcall func33(XDR *a1, char **a2)
{
return xdr_string(a1, a2, 0x400u) != 0;
}

original_code:
bool_t
xdr_cs_statfs_in (XDR *xdrs, cs_statfs_in *objp)
{
 register int32_t *buf;
  if (!xdr_string (xdrs, &objp->path, 1024))
   return (0);
 return (1);
}

canonical_original_code:
int xdr_cs_statfs_in(struct XDR *xdrs, struct cs_statfs_in *objp)
{
 register int *buf;
  if (!xdr_string (xdrs, &objp->path, 1024))
   return (0);
 return (1);
}

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


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

result = xdr_uint32_t(xdrs, (uint32_t *)a2);
if ( result )
{
result = xdr_uint32_t(xdrs, (uint32_t *)(a2 + 4));
if ( result )
{
result = xdr_uint32_t(xdrs, (uint32_t *)(a2 + 8));
if ( result )
result = xdr_int(xdrs, (int *)(a2 + 12)) != 0;
}
}
return result;
}

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

result = xdr_uint32_t(xdrs, (uint32_t *)a2);
if ( result )
{
result = xdr_uint32_t(xdrs, (uint32_t *)(a2 + 4));
if ( result )
{
result = xdr_uint32_t(xdrs, (uint32_t *)(a2 + 8));
if ( result )
result = xdr_int(xdrs, (int *)(a2 + 12)) != 0;
}
}
return result;
}

original_code:
bool_t
xdr_cs_statfs_out (XDR *xdrs, cs_statfs_out *objp)
{
 register int32_t *buf;
  if (!xdr_uint32_t (xdrs, &objp->f_blocks))
   return (0);
  if (!xdr_uint32_t (xdrs, &objp->f_bavail))
   return (0);
  if (!xdr_uint32_t (xdrs, &objp->f_bsize))
   return (0);
  if (!xdr_int (xdrs, &objp->err))
   return (0);
 return (1);
}

canonical_original_code:
int xdr_cs_statfs_out(struct XDR *xdrs, struct cs_statfs_out *objp)
{
 register int *buf;
  if (!xdr_uint32_t (xdrs, &objp->f_blocks))
   return (0);
  if (!xdr_uint32_t (xdrs, &objp->f_bavail))
   return (0);
  if (!xdr_uint32_t (xdrs, &objp->f_bsize))
   return (0);
  if (!xdr_int (xdrs, &objp->err))
   return (0);
 return (1);
}

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

variable_types:
buf
int *


decompiled_code:
bool_t __fastcall xdr_cs_auth_in(XDR *xdrs, char **a2)
{
bool_t result; // eax

result = xdr_string(xdrs, a2, 0x100u);
if ( result )
result = xdr_string(xdrs, a2 + 1, 0x100u) != 0;
return result;
}

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

result = xdr_string(xdrs, a2, 0x100u);
if ( result )
result = xdr_string(xdrs, a2 + 1, 0x100u) != 0;
return result;
}

original_code:
bool_t
xdr_cs_auth_in (XDR *xdrs, cs_auth_in *objp)
{
 register int32_t *buf;
  if (!xdr_string (xdrs, &objp->user, 256))
   return (0);
  if (!xdr_string (xdrs, &objp->passwd, 256))
   return (0);
 return (1);
}

canonical_original_code:
int xdr_cs_auth_in(struct XDR *xdrs, struct cs_auth_in *objp)
{
 register int *buf;
  if (!xdr_string (xdrs, &objp->user, 256))
   return (0);
  if (!xdr_string (xdrs, &objp->passwd, 256))
   return (0);
 return (1);
}

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


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

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

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

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

variable_types:
objp
struct cs_auth_out { int err; } *


decompiled_code:
bool_t __fastcall xdr_os_heart_in(XDR *xdrs, uint32_t *a2)
{
bool_t result; // eax

result = xdr_uint32_t(xdrs, a2);
if ( result )
result = xdr_uint32_t(xdrs, a2 + 1) != 0;
return result;
}

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

result = xdr_uint32_t(xdrs, a2);
if ( result )
result = xdr_uint32_t(xdrs, a2 + 1) != 0;
return result;
}

original_code:
bool_t
xdr_os_heart_in (XDR *xdrs, os_heart_in *objp)
{
 register int32_t *buf;
  if (!xdr_uint32_t (xdrs, &objp->total))
   return (0);
  if (!xdr_uint32_t (xdrs, &objp->avail))
   return (0);
 return (1);
}

canonical_original_code:
int xdr_os_heart_in(struct XDR *xdrs, struct os_heart_in *objp)
{
 register int *buf;
  if (!xdr_uint32_t (xdrs, &objp->total))
   return (0);
  if (!xdr_uint32_t (xdrs, &objp->avail))
   return (0);
 return (1);
}

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


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

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

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

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

variable_types:
objp
struct os_heart_out { int err; } *


decompiled_code:
void __fastcall __noreturn heart_check(void *a1)
{
unsigned __int16 v1; // si
__int64 v2; // rax
int v3; // ecx
__int16 v4; // si
int v5; // ebp
__int64 v6; // r12
unsigned int *v7; // rdx
int v8; // eax
char v9[40]; // [rsp+0h] [rbp-28h] BYREF

while ( 1 )
{
fwrite("[check node state]\n", 1uLL, 0x13uLL, stderr);
if ( *((_WORD *)&nodehead + 4) )
{
v6 = 0LL;
v5 = 0;
do
{
v7 = (unsigned int *)(nodehead + v6);
v8 = *(_DWORD *)(nodehead + v6 + 12);
if ( v8 > 3 )
{
*((_QWORD *)&nodehead + 2) -= v7[1];
*((_QWORD *)&nodehead + 3) -= v7[2];
v1 = *((_WORD *)&nodehead + 4);
if ( v1 - 1 > v5 )
{
v2 = v6 + 16;
v3 = v5;
do
{
*(__m128i *)(nodehead + v2 - 16) = _mm_loadu_si128((const __m128i *)(nodehead + v2));
++v3;
v1 = *((_WORD *)&nodehead + 4);
v2 += 16LL;
}
while ( v1 - 1 > v3 );
}
v4 = v1 - 1;
*((_WORD *)&nodehead + 4) = v4;
if ( v4 == *((_WORD *)&nodehead + 5) )
*((_WORD *)&nodehead + 5) = 0;
get_addr(v9, *(unsigned int *)(nodehead + v6));
fprintf(stderr, "[node %s is down]\n", v9);
}
else if ( v8 >= 0 )
{
v7[3] = v8 + 1;
}
++v5;
v6 += 16LL;
}
while ( *((unsigned __int16 *)&nodehead + 4) > v5 );
}
sleep(5u);
}
}

canonical_decompiled_code:
void __fastcall __noreturn func3(void *a1)
{
unsigned __int16 v1; // si
__int64 v2; // rax
int v3; // ecx
__int16 v4; // si
int v5; // ebp
__int64 v6; // r12
unsigned int *v7; // rdx
int v8; // eax
char v9[40]; // [rsp+0h] [rbp-28h] BYREF

while ( 1 )
{
fwrite("[check node state]\n", 1uLL, 0x13uLL, stderr);
if ( *((_WORD *)&nodehead + 4) )
{
v6 = 0LL;
v5 = 0;
do
{
v7 = (unsigned int *)(nodehead + v6);
v8 = *(_DWORD *)(nodehead + v6 + 12);
if ( v8 > 3 )
{
*((_QWORD *)&nodehead + 2) -= v7[1];
*((_QWORD *)&nodehead + 3) -= v7[2];
v1 = *((_WORD *)&nodehead + 4);
if ( v1 - 1 > v5 )
{
v2 = v6 + 16;
v3 = v5;
do
{
*(__m128i *)(nodehead + v2 - 16) = _mm_loadu_si128((const __m128i *)(nodehead + v2));
++v3;
v1 = *((_WORD *)&nodehead + 4);
v2 += 16LL;
}
while ( v1 - 1 > v3 );
}
v4 = v1 - 1;
*((_WORD *)&nodehead + 4) = v4;
if ( v4 == *((_WORD *)&nodehead + 5) )
*((_WORD *)&nodehead + 5) = 0;
get_addr(v9, *(unsigned int *)(nodehead + v6));
fprintf(stderr, "[node %s is down]\n", v9);
}
else if ( v8 >= 0 )
{
v7[3] = v8 + 1;
}
++v5;
v6 += 16LL;
}
while ( *((unsigned __int16 *)&nodehead + 4) > v5 );
}
sleep(5u);
}
}

original_code:
void* heart_check()
{
 int i, j;
 while(1)
 {
  fprintf(stderr, "[check node state]\n");
        for(i = 0; i < nodehead.items; i++) {
         if(nodehead.list[i].hearts >= 4) {
          nodehead.total -= nodehead.list[i].total;
          nodehead.avail -= nodehead.list[i].avail;
          for(j = i; j < nodehead.items - 1; j++) {
           nodehead.list[j] = nodehead.list[j+1];
          }
          nodehead.items--;
          if(nodehead.offset == nodehead.items)
           nodehead.offset = 0;
          char ipp[16];
          get_addr(ipp, nodehead.list[i].ip);
          fprintf(stderr, "[node %s is down]\n", ipp);
         }
         else if(nodehead.list[i].hearts >= 0)
          nodehead.list[i].hearts++;
        }
        sleep(5);
    }
}

canonical_original_code:
void *heart_check()
{
 int i; int j;
 while(1)
 {
  fprintf(stderr, "[check node state]\n");
        for(i = 0; i < nodehead.items; i++) {
         if(nodehead.list[i].hearts >= 4) {
          nodehead.total -= nodehead.list[i].total;
          nodehead.avail -= nodehead.list[i].avail;
          for(j = i; j < nodehead.items - 1; j++) {
           nodehead.list[j] = nodehead.list[j+1];
          }
          nodehead.items--;
          if(nodehead.offset == nodehead.items)
           nodehead.offset = 0;
          char ipp[16];
          get_addr(ipp, nodehead.list[i].ip);
          fprintf(stderr, "[node %s is down]\n", ipp);
         }
         else if(nodehead.list[i].hearts >= 0)
          nodehead.list[i].hearts++;
        }
        sleep(5);
    }
}

variable_types: i int

variable_types: j int

variable_types:
ipp
char [16]

return_type: void *


decompiled_code:
__int64 nodehead_init()
{
*((_WORD *)&nodehead + 4) = 0;
*((_WORD *)&nodehead + 5) = 0;
*((_QWORD *)&nodehead + 2) = 0LL;
*((_QWORD *)&nodehead + 3) = 0LL;
*((_WORD *)&nodehead + 6) = 32;
nodehead = malloc(0x200uLL);
return nodehead == 0LL ? 0xFFFFFFF4 : 0;
}

canonical_decompiled_code:
__int64 func4()
{
*((_WORD *)&nodehead + 4) = 0;
*((_WORD *)&nodehead + 5) = 0;
*((_QWORD *)&nodehead + 2) = 0LL;
*((_QWORD *)&nodehead + 3) = 0LL;
*((_WORD *)&nodehead + 6) = 32;
nodehead = malloc(0x200uLL);
return nodehead == 0LL ? 0xFFFFFFF4 : 0;
}

original_code:
int nodehead_init()
{
 nodehead.items = 0;
 nodehead.offset = 0;
 nodehead.total = 0;
 nodehead.avail = 0;
 nodehead.cur_max = 32;
 nodehead.list = (node_info*)malloc(32 * sizeof(node_info));
 if(!nodehead.list)
  return -12;
 return 0;
}

canonical_original_code:
int nodehead_init()
{
 nodehead.items = 0;
 nodehead.offset = 0;
 nodehead.total = 0;
 nodehead.avail = 0;
 nodehead.cur_max = 32;
 nodehead.list = (struct node_info *)malloc(32 * sizeof(node_info));
 if(!nodehead.list)
  return -12;
 return 0;
}

user_defined_types: struct node_info { unsigned int ip; unsigned int total; unsigned int avail; int hearts; }


decompiled_code:
__int64 filehead_init()
{
__int64 i; // rbx

filehead = malloc(0x3800uLL);
if ( !filehead )
return 4294967284LL;
for ( i = 0LL; i != 14336; i += 56LL )
{
pthread_mutex_init((pthread_mutex_t *)(filehead + i + 16), 0LL);
*(_DWORD *)(filehead + i) = 0;
*(_QWORD *)(filehead + i + 8) = 0LL;
}
return 0LL;
}

canonical_decompiled_code:
__int64 func5()
{
__int64 i; // rbx

filehead = malloc(0x3800uLL);
if ( !filehead )
return 4294967284LL;
for ( i = 0LL; i != 14336; i += 56LL )
{
pthread_mutex_init((pthread_mutex_t *)(filehead + i + 16), 0LL);
*(_DWORD *)(filehead + i) = 0;
*(_QWORD *)(filehead + i + 8) = 0LL;
}
return 0LL;
}

original_code:
int filehead_init()
{
 filehead = (file_head*)malloc(256 * sizeof(file_head));
 if(!filehead)
  return -12;
 int i;
 for(i = 0; i < 256; i++) {
  pthread_mutex_init(&filehead[i].lock, ((void *)0));
  filehead[i].items = 0;
  ((&filehead[i].list)->first = ((void *)0));
 }
 return 0;
}

canonical_original_code:
int filehead_init()
{
 filehead = (struct file_head *)malloc(256 * sizeof(file_head));
 if(!filehead)
  return -12;
 int i;
 for(i = 0; i < 256; i++) {
  pthread_mutex_init(&filehead[i].lock, ((void *)0));
  filehead[i].items = 0;
  ((&filehead[i].list)->first = ((void *)0));
 }
 return 0;
}

user_defined_types: struct file_head { int items; struct hlist_head list; union pthread_mutex_t lock; }

user_defined_types: struct hlist_head { struct hlist_node *first; }

user_defined_types: union pthread_mutex_t { struct __pthread_mutex_s __data; char __size[40]; long __align; }

user_defined_types: struct __pthread_mutex_s { int __lock; unsigned int __count; int __owner; unsigned int __nusers; int __kind; short __spins; short __elision; struct __pthread_internal_list __list; }

user_defined_types: struct hlist_node { struct hlist_node *next; }

user_defined_types: struct __pthread_internal_list { struct __pthread_internal_list *__prev; struct __pthread_internal_list *__next; }


decompiled_code:
_DWORD *file_get()
{
_DWORD *result; // rax

result = malloc(0x20uLL);
if ( result )
{
result[4] = 0;
*((_QWORD *)result + 3) = 0LL;
*(_QWORD *)result = 0LL;
*((_QWORD *)result + 1) = 0LL;
}
return result;
}

canonical_decompiled_code:
_DWORD *func6()
{
_DWORD *result; // rax

result = malloc(0x20uLL);
if ( result )
{
result[4] = 0;
*((_QWORD *)result + 3) = 0LL;
*(_QWORD *)result = 0LL;
*((_QWORD *)result + 1) = 0LL;
}
return result;
}

original_code:
file_info* file_get()
{
 file_info *item = (file_info*)malloc(sizeof(file_info));
 if(!item)
  return ((void *)0);
 item->wflag = 0;
 item->path = ((void *)0);
 ((&item->list)->next = ((void *)0), (&item->list)->pprev = ((void *)0));
 return item;
}

canonical_original_code:
struct file_info *file_get()
{
 struct file_info *item = (file_info*)malloc(sizeof(file_info));
 if(!item)
  return ((void *)0);
 item->wflag = 0;
 item->path = ((void *)0);
 ((&item->list)->next = ((void *)0), (&item->list)->pprev = ((void *)0));
 return item;
}

variable_types: struct file_info { struct hlist_node { struct hlist_node *next; } list; int wflag; char *path; } *

user_defined_types: struct file_info { struct hlist_node list; int wflag; char *path; }


decompiled_code:
void __fastcall file_put(void *ptr)
{
void *v2; // rdi

v2 = (void *)*((_QWORD *)ptr + 3);
if ( v2 )
free(v2);
free(ptr);
}

canonical_decompiled_code:
void __fastcall func7(void *ptr)
{
void *v2; // rdi

v2 = (void *)*((_QWORD *)ptr + 3);
if ( v2 )
free(v2);
free(ptr);
}

original_code:
void file_put(file_info *item)
{
 if(item->path) {
  free(item->path);
  item->path = ((void *)0);
 }
 free(item);
}

canonical_original_code:
void file_put(struct file_info *item)
{
 if(item->path) {
  free(item->path);
  item->path = ((void *)0);
 }
 free(item);
}

return_type: void


hash

decompiled_code:
__int64 __fastcall hash(char *a1, int a2)
{
char *v2; // rsi
unsigned int v3; // edx

if ( a2 )
{
v2 = &a1[a2];
v3 = 1315423911;
do
v3 ^= *a1++ + (v3 >> 2) + 32 * v3;
while ( a1 != v2 );
}
else
{
LOBYTE(v3) = -89;
}
return (unsigned __int8)v3;
}

canonical_decompiled_code:
__int64 __fastcall func8(char *a1, int a2)
{
char *v2; // rsi
unsigned int v3; // edx

if ( a2 )
{
v2 = &a1[a2];
v3 = 1315423911;
do
v3 ^= *a1++ + (v3 >> 2) + 32 * v3;
while ( a1 != v2 );
}
else
{
LOBYTE(v3) = -89;
}
return (unsigned __int8)v3;
}

original_code:
unsigned int hash(char* str, unsigned int len)
{
   unsigned int hash = 1315423911;
   unsigned int i = 0;
   for(i = 0; i < len; str++, i++)
   {
      hash ^= ((hash << 5) + (*str) + (hash >> 2));
   }
   return hash % 256;
}

canonical_original_code:
unsigned int hash(char *str, unsigned int len)
{
   unsigned int hash = 1315423911;
   unsigned int i = 0;
   for(i = 0; i < len; str++, i++)
   {
      hash ^= ((hash << 5) + (*str) + (hash >> 2));
   }
   return hash % 256;
}

variable_types:
str
char *

variable_types:
len
unsigned int

variable_types:
hash
unsigned int

variable_types:
i
unsigned int

return_type: unsigned int


decompiled_code:
__int64 __fastcall file_add(__int64 *a1)
{
char *v1; // rbx
int v2; // eax
__int64 v3; // rbx

v1 = (char *)a1[3];
v2 = strlen(v1);
v3 = 56LL * (unsigned int)hash(v1, v2);
pthread_mutex_lock((pthread_mutex_t *)(filehead + v3 + 16));
hlist_add_head(a1, (__int64 *)(filehead + v3 + 8));
++*(_DWORD *)(filehead + v3);
pthread_mutex_unlock((pthread_mutex_t *)(filehead + v3 + 16));
return 0LL;
}

canonical_decompiled_code:
__int64 __fastcall func9(__int64 *a1)
{
char *v1; // rbx
int v2; // eax
__int64 v3; // rbx

v1 = (char *)a1[3];
v2 = strlen(v1);
v3 = 56LL * (unsigned int)func8(v1, v2);
pthread_mutex_lock((pthread_mutex_t *)(filehead + v3 + 16));
func2(a1, (__int64 *)(filehead + v3 + 8));
++*(_DWORD *)(filehead + v3);
pthread_mutex_unlock((pthread_mutex_t *)(filehead + v3 + 16));
return 0LL;
}

original_code:
int file_add(file_info *item)
{
 unsigned int hval = hash(item->path, strlen(item->path));
 pthread_mutex_lock(&filehead[hval].lock);
 hlist_add_head(&item->list, &filehead[hval].list);
 filehead[hval].items++;
 pthread_mutex_unlock(&filehead[hval].lock);
 return 0;
}

canonical_original_code:
int file_add(struct file_info *item)
{
 unsigned int hval = hash(item->path, strlen(item->path));
 pthread_mutex_lock(&filehead[hval].lock);
 hlist_add_head(&item->list, &filehead[hval].list);
 filehead[hval].items++;
 pthread_mutex_unlock(&filehead[hval].lock);
 return 0;
}

variable_types:
hval
unsigned int


decompiled_code:
__int64 __fastcall file_del(__int64 *a1)
{
char *v1; // rbx
int v2; // eax
__int64 v3; // rbx

v1 = (char *)a1[3];
v2 = strlen(v1);
v3 = 56LL * (unsigned int)hash(v1, v2);
pthread_mutex_lock((pthread_mutex_t *)(filehead + v3 + 16));
hlist_del(a1);
--*(_DWORD *)(filehead + v3);
pthread_mutex_unlock((pthread_mutex_t *)(filehead + v3 + 16));
return 0LL;
}

canonical_decompiled_code:
__int64 __fastcall func10(__int64 *a1)
{
char *v1; // rbx
int v2; // eax
__int64 v3; // rbx

v1 = (char *)a1[3];
v2 = strlen(v1);
v3 = 56LL * (unsigned int)func8(v1, v2);
pthread_mutex_lock((pthread_mutex_t *)(filehead + v3 + 16));
func1(a1);
--*(_DWORD *)(filehead + v3);
pthread_mutex_unlock((pthread_mutex_t *)(filehead + v3 + 16));
return 0LL;
}

original_code:
int file_del(file_info *item)
{
 unsigned int hval = hash(item->path, strlen(item->path));
 pthread_mutex_lock(&filehead[hval].lock);
 hlist_del(&item->list);
 filehead[hval].items--;
 pthread_mutex_unlock(&filehead[hval].lock);
 return 0;
}

canonical_original_code:
int file_del(struct file_info *item)
{
 unsigned int hval = hash(item->path, strlen(item->path));
 pthread_mutex_lock(&filehead[hval].lock);
 hlist_del(&item->list);
 filehead[hval].items--;
 pthread_mutex_unlock(&filehead[hval].lock);
 return 0;
}


decompiled_code:
__int64 __fastcall parse_server_cmd(int a1, __int64 a2)
{
const char **v2; // rbx
int v4; // eax

if ( a1 <= 1 )
return 0LL;
v2 = (const char **)(a2 + 16);
do
{
if ( !strcmp(*(v2 - 1), "-c") )
{
v4 = atoi(*v2);
if ( (unsigned int)(v4 - 1) > 1 )
{
LABEL_3:
usage();
return 0xFFFFFFFFLL;
}
file_copies = v4;
}
else
{
if ( strcmp(*(v2 - 1), "-r") )
goto LABEL_3;
strcpy(&meta_root, *v2);
}
v2 += 2;
}
while ( v2 != (const char **)(a2 + 16LL * ((unsigned int)(a1 - 2) >> 1) + 32) );
return 0LL;
}

canonical_decompiled_code:
__int64 __fastcall func12(int a1, __int64 a2)
{
const char **v2; // rbx
int v4; // eax

if ( a1 <= 1 )
return 0LL;
v2 = (const char **)(a2 + 16);
do
{
if ( !strcmp(*(v2 - 1), "-c") )
{
v4 = atoi(*v2);
if ( (unsigned int)(v4 - 1) > 1 )
{
LABEL_3:
func11();
return 0xFFFFFFFFLL;
}
file_copies = v4;
}
else
{
if ( strcmp(*(v2 - 1), "-r") )
goto LABEL_3;
strcpy(&meta_root, *v2);
}
v2 += 2;
}
while ( v2 != (const char **)(a2 + 16LL * ((unsigned int)(a1 - 2) >> 1) + 32) );
return 0LL;
}

original_code:
int parse_server_cmd(int argc, char *argv[])
{
 int i;
 int ret;
 int srvflag = 0;
 for(i = 1; i < argc; i += 2) {
  if(!strcmp(argv[i], "-c")) {
   int tmp = atoi(argv[i+1]);
   if(tmp != 1 && tmp != 2) {
    usage();
    return -1;
   }
   file_copies = tmp;
  }
  else if(!strcmp(argv[i], "-r")) {
   strcpy(meta_root, argv[i+1]);
  }
  else {
   usage();
   return -1;
  }
 }
 return 0;
}

variable_types: argc int

variable_types:
argv
char *[]

variable_types: ret int

variable_types: srvflag int

variable_types: tmp int


lockfile

original_code:
int lockfile(int fd)
{
    struct flock fl;
    fl.l_type = 1;
    fl.l_start = 0;
    fl.l_whence = 0;
    fl.l_len = 0;
    return(fcntl(fd, 6, &fl));
}

variable_types: fd int

variable_types: struct flock { short l_type; short l_whence; long l_start; long l_len; int l_pid; }


decompiled_code:
__int64 __fastcall already_running(const char *a1)
{
int v1; // eax
int v2; // ebx
__pid_t v3; // eax
size_t v4; // rax
__int64 result; // rax
char v6[24]; // [rsp+0h] [rbp-18h] BYREF

v1 = open(a1, 66, 420LL);
if ( v1 < 0 || (v2 = v1, lockfile(v1) < 0) )
{
printf("dnfs-server is already running!");
result = 0xFFFFFFFFLL;
}
else
{
ftruncate(v2, 0LL);
v3 = getpid();
sprintf(v6, "%ld", v3);
v4 = strlen(v6);
write(v2, v6, v4 + 1);
result = 0LL;
}
return result;
}

canonical_decompiled_code:
__int64 __fastcall func14(const char *a1)
{
int v1; // eax
int v2; // ebx
__pid_t v3; // eax
size_t v4; // rax
__int64 result; // rax
char v6[24]; // [rsp+0h] [rbp-18h] BYREF

v1 = open(a1, 66, 420LL);
if ( v1 < 0 || (v2 = v1, func13(v1) < 0) )
{
printf("dnfs-server is already running!");
result = 0xFFFFFFFFLL;
}
else
{
ftruncate(v2, 0LL);
v3 = getpid();
sprintf(v6, "%ld", v3);
v4 = strlen(v6);
write(v2, v6, v4 + 1);
result = 0LL;
}
return result;
}

original_code:
int already_running(const char *filename)
{
    int fd;
    char buf[16];
    fd = open(filename, 02 | 0100, 0644);
    if (fd < 0) {
        printf("dnfs-server is already running!");
        return -1;
    }
    if (lockfile(fd) < 0) {
        printf("dnfs-server is already running!");
        return -1;
    }
    ftruncate(fd, 0);
    sprintf(buf, "%ld", (long)getpid());
    write(fd, buf, strlen(buf) + 1);
    return 0;
}

canonical_original_code:
int already_running(char *filename)
{
    int fd;
    char buf[16];
    fd = open(filename, 02 | 0100, 0644);
    if (fd < 0) {
        printf("dnfs-server is already running!");
        return -1;
    }
    if (lockfile(fd) < 0) {
        printf("dnfs-server is already running!");
        return -1;
    }
    ftruncate(fd, 0);
    sprintf(buf, "%ld", (long)getpid());
    write(fd, buf, strlen(buf) + 1);
    return 0;
}

variable_types:
filename
char *

variable_types:
buf
char [16]


decompiled_code:
__int64 __fastcall server_init(int a1, __int64 a2)
{
int v2; // ebx
pthread_t newthread[4]; // [rsp+8h] [rbp-20h] BYREF

v2 = already_running("/var/run/dnfs-server.pid");
if ( v2 >= 0 )
{
v2 = parse_server_cmd(a1, a2);
if ( v2 >= 0 )
{
v2 = check_directory(&meta_root);
if ( v2 >= 0 )
{
v2 = nodehead_init();
if ( v2 >= 0 )
{
v2 = filehead_init();
if ( v2 >= 0 )
{
v2 = pthread_create(newthread, 0LL, (void *(*)(void *))heart_check, 0LL);
if ( v2 )
{
perror("pthread_create error in [osd_init]");
v2 = -1;
}
else
{
printf("metadata root dierctory: %s\n", &meta_root);
printf("file copy number: %d\n", file_copies);
puts("Metadata server initialized successfully!\n");
}
}
}
}
}
}
return (unsigned int)v2;
}

canonical_decompiled_code:
__int64 __fastcall func15(int a1, __int64 a2)
{
int v2; // ebx
pthread_t newthread[4]; // [rsp+8h] [rbp-20h] BYREF

v2 = func14("/var/run/dnfs-server.pid");
if ( v2 >= 0 )
{
v2 = func12(a1, a2);
if ( v2 >= 0 )
{
v2 = check_directory(&meta_root);
if ( v2 >= 0 )
{
v2 = func4();
if ( v2 >= 0 )
{
v2 = func5();
if ( v2 >= 0 )
{
v2 = pthread_create(newthread, 0LL, (void *(*)(void *))heart_check, 0LL);
if ( v2 )
{
perror("pthread_create error in [osd_init]");
v2 = -1;
}
else
{
printf("metadata root dierctory: %s\n", &meta_root);
printf("file copy number: %d\n", file_copies);
puts("Metadata server initialized successfully!\n");
}
}
}
}
}
}
return (unsigned int)v2;
}

original_code:
int server_init(int argc, char *argv[])
{
 int ret = 0;
 ret = already_running("/var/run/dnfs-server.pid");
 do {if((ret) < 0) return ret; } while(0);
 ret = parse_server_cmd(argc, argv);
 do {if((ret) < 0) return ret; } while(0);
 ret = check_directory(meta_root);
 do {if((ret) < 0) return ret; } while(0);
 ret = nodehead_init();
 do {if((ret) < 0) return ret; } while(0);
 ret = filehead_init();
 do {if((ret) < 0) return ret; } while(0);
 pthread_t tid;
 if((ret = pthread_create(&tid, ((void *)0), heart_check, ((void *)0))) != 0) {
  perror("pthread_create error in [osd_init]");
  return -1;
 }
 printf("metadata root dierctory: %s\n", meta_root);
 printf("file copy number: %d\n", file_copies);
 printf("Metadata server initialized successfully!\n\n");
 return 0;
}

canonical_original_code:
int server_init(int argc, char *argv[])
{
 int ret = 0;
 ret = already_running("/var/run/dnfs-server.pid");
 do {if((ret) < 0) return ret; } while(0);
 ret = parse_server_cmd(argc, argv);
 do {if((ret) < 0) return ret; } while(0);
 ret = check_directory(meta_root);
 do {if((ret) < 0) return ret; } while(0);
 ret = nodehead_init();
 do {if((ret) < 0) return ret; } while(0);
 ret = filehead_init();
 do {if((ret) < 0) return ret; } while(0);
 unsigned long tid;
 if((ret = pthread_create(&tid, ((void *)0), heart_check, ((void *)0))) != 0) {
  perror("pthread_create error in [osd_init]");
  return -1;
 }
 printf("metadata root dierctory: %s\n", meta_root);
 printf("file copy number: %d\n", file_copies);
 printf("Metadata server initialized successfully!\n\n");
 return 0;
}

variable_types:
tid
unsigned long


decompiled_code:
int __fastcall get_chunk_path(char *a1, const char *a2)
{
return sprintf(a1, "%s/%s", (const char *)&storage_root, a2);
}

canonical_decompiled_code:
int __fastcall func0(char *a1, const char *a2)
{
return sprintf(a1, "%s/%s", (const char *)&storage_root, a2);
}

original_code:
void get_chunk_path(char *dest, char *src)
{
 sprintf(dest, "%s/%s", storage_root, src);
}

variable_types:
dest
char *

variable_types:
src
char *


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

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

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

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

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

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

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

variable_types:
buf
char *

variable_types:
size
unsigned long

variable_types: offset long

variable_types:
path
char [256]


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

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

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

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

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

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

variable_types:
res
struct co_write_out { int err; } *

variable_types:
ipp
char *

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

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

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

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

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

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

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


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

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

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

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

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

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

variable_types: ret int


decompiled_code:
int *__fastcall do_copy(void *a1)
{
char v2[28]; // [rsp+0h] [rbp-28h] BYREF
unsigned int v3[3]; // [rsp+1Ch] [rbp-Ch] BYREF

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

canonical_decompiled_code:
int *__fastcall func4(void *a1)
{
char v2[28]; // [rsp+0h] [rbp-28h] BYREF
unsigned int v3[3]; // [rsp+1Ch] [rbp-Ch] BYREF

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

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

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

variable_types:
res
struct co_write_out { int err; }

variable_types:
ipp
char [20]


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

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

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

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

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

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

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

variable_types:
ret
int *

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

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

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

user_defined_types: struct xp_ops { int (*xp_recv)(struct SVCXPRT *__xprt, struct rpc_msg *__msg); enum xprt_stat (*xp_stat)(struct SVCXPRT *__xprt); int (*xp_getargs)(struct SVCXPRT *__xprt, int (*__xdr_args)(struct XDR *, void *, ...), char *__args_ptr); int (*xp_reply)(struct SVCXPRT *__xprt, struct rpc_msg *__msg); int (*xp_freeargs)(struct SVCXPRT *__xprt, int (*__xdr_args)(struct XDR *, void *, ...), char *__args_ptr); void (*xp_destroy)(struct SVCXPRT *__xprt); }

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

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

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

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

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


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

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

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

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

variable_types: fd int

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

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

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

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

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

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

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

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

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


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

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

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

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

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

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

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

variable_types:
res
struct co_unlink_out { int err; } *

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

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


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

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

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

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

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

variable_types:
result
char *

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

user_defined_types: struct xp_ops { int (*xp_recv)(struct SVCXPRT *__xprt, struct rpc_msg *__msg); enum xprt_stat (*xp_stat)(struct SVCXPRT *__xprt); int (*xp_getargs)(struct SVCXPRT *__xprt, int (*__xdr_args)(struct XDR *, void *, ...), char *__args_ptr); int (*xp_reply)(struct SVCXPRT *__xprt, struct rpc_msg *__msg); int (*xp_freeargs)(struct SVCXPRT *__xprt, int (*__xdr_args)(struct XDR *, void *, ...), char *__args_ptr); void (*xp_destroy)(struct SVCXPRT *__xprt); }


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

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

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

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

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

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

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

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

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

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

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

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

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

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

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


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

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

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

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

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

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

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


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

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

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

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

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

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

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 }