#define NULL ((void *)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t;
typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1

/* Forward declarations */
typedef struct TYPE_5__ TYPE_2__;
typedef struct TYPE_4__ TYPE_1__;

/* Type definitions */
typedef int /*<<< orphan*/ xdrproc_t;
struct TYPE_4__ {
  int /*<<< orphan*/ gids_len;
  int /*<<< orphan*/ *gids_val;
};
struct TYPE_5__ {
  TYPE_1__ gids;
  int /*<<< orphan*/ gid;
  int /*<<< orphan*/ uid;
};
typedef TYPE_2__ unixcred;
typedef int /*<<< orphan*/ u_int;
typedef int /*<<< orphan*/ bool_t;
typedef int /*<<< orphan*/ XDR;

/* Variables and functions */
int /*<<< orphan*/ FALSE;
int /*<<< orphan*/ MAXGIDS;
int /*<<< orphan*/ TRUE;
int /*<<< orphan*/ xdr_array(int /*<<< orphan*/ *, char **,
                             int /*<<< orphan*/ *, int /*<<< orphan*/, int,
                             int /*<<< orphan*/);
int /*<<< orphan*/ xdr_u_int(int /*<<< orphan*/ *, int /*<<< orphan*/ *);
bool_t xdr_unixcred(register XDR *xdrs, unixcred *objp) {
  u_int **pgids_val;
  if (!xdr_u_int(xdrs, &objp->uid))
    return (FALSE);
  if (!xdr_u_int(xdrs, &objp->gid))
    return (FALSE);
  pgids_val = &objp->gids.gids_val;
  if (!xdr_array(xdrs, (char **)pgids_val, (u_int *)&objp->gids.gids_len,
                 MAXGIDS, sizeof(u_int), (xdrproc_t)xdr_u_int))
    return (FALSE);
  return (TRUE);
}


x86 assembly (clang, -O0):
<xdr_unixcred>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    -0x10(%rbp),%rdi
mov    -0x18(%rbp),%rsi
add    $0x14,%rsi
call   1040 <xdr_u_int@plt>
cmp    $0x0,%eax
jne    114b <xdr_unixcred+0x3b>
mov    0x2e87(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x4(%rbp)
jmp    11d2 <xdr_unixcred+0xc2>
mov    -0x10(%rbp),%rdi
mov    -0x18(%rbp),%rsi
add    $0x10,%rsi
call   1040 <xdr_u_int@plt>
cmp    $0x0,%eax
jne    1176 <xdr_unixcred+0x66>
mov    0x2e5c(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x4(%rbp)
jmp    11d2 <xdr_unixcred+0xc2>
mov    -0x18(%rbp),%rax
add    $0x8,%rax
mov    %rax,-0x20(%rbp)
mov    -0x10(%rbp),%rdi
mov    -0x20(%rbp),%rsi
mov    -0x18(%rbp),%rdx
mov    0x2e4b(%rip),%rax
mov    (%rax),%ecx
mov    $0x4,%r8d
mov    0x2e4c(%rip),%rax
mov    %eax,%r9d
call   1030 <xdr_array@plt>
cmp    $0x0,%eax
jne    11c6 <xdr_unixcred+0xb6>
mov    0x2e0c(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x4(%rbp)
jmp    11d2 <xdr_unixcred+0xc2>
mov    0x2e0b(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<xdr_unixcred>:
push   %r15
push   %r14
push   %rbx
mov    %rsi,%rbx
mov    %rdi,%r14
add    $0x14,%rsi
call   1040 <xdr_u_int@plt>
mov    0x2e9d(%rip),%r15
test   %eax,%eax
je     1178 <xdr_unixcred+0x68>
lea    0x10(%rbx),%rsi
mov    %r14,%rdi
call   1040 <xdr_u_int@plt>
test   %eax,%eax
je     1178 <xdr_unixcred+0x68>
lea    0x8(%rbx),%rsi
mov    0x2e96(%rip),%rax
mov    (%rax),%ecx
mov    0x2e9d(%rip),%r9d
mov    %r14,%rdi
mov    %rbx,%rdx
mov    $0x4,%r8d
call   1030 <xdr_array@plt>
test   %eax,%eax
jne    1171 <xdr_unixcred+0x61>
mov    0x2e59(%rip),%r15
jmp    1178 <xdr_unixcred+0x68>
mov    0x2e60(%rip),%r15
mov    (%r15),%eax
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
%struct.TYPE_5__ = type { %struct.TYPE_4__, i32, i32 }
%struct.TYPE_4__ = type { i32, i32* }
@FALSE = global i32 0
@MAXGIDS = global i32 0
@TRUE = global i32 0
define i32 @xdr_unixcred(i32* %0, %struct.TYPE_5__* %1) {
%3 = alloca i32
%4 = alloca i32*
%5 = alloca %struct.TYPE_5__*
%6 = alloca i32**
store i32* %0, i32** %4
store %struct.TYPE_5__* %1, %struct.TYPE_5__** %5
%7 = load i32*, i32** %4
%8 = load %struct.TYPE_5__*, %struct.TYPE_5__** %5
%9 = getelementptr inbounds %struct.TYPE_5__, %struct.TYPE_5__* %8, i32 0, i32 2
%10 = call i32 @xdr_u_int(i32* %7, i32* %9)
%11 = icmp ne i32 %10, 0
br i1 %11, label %14, label %12
12: ; preds = %2
%13 = load i32, i32* @FALSE
store i32 %13, i32* %3
br label %39
14: ; preds = %2
%15 = load i32*, i32** %4
%16 = load %struct.TYPE_5__*, %struct.TYPE_5__** %5
%17 = getelementptr inbounds %struct.TYPE_5__, %struct.TYPE_5__* %16, i32 0, i32 1
%18 = call i32 @xdr_u_int(i32* %15, i32* %17)
%19 = icmp ne i32 %18, 0
br i1 %19, label %22, label %20
20: ; preds = %14
%21 = load i32, i32* @FALSE
store i32 %21, i32* %3
br label %39
22: ; preds = %14
%23 = load %struct.TYPE_5__*, %struct.TYPE_5__** %5
%24 = getelementptr inbounds %struct.TYPE_5__, %struct.TYPE_5__* %23, i32 0, i32 0
%25 = getelementptr inbounds %struct.TYPE_4__, %struct.TYPE_4__* %24, i32 0, i32 1
store i32** %25, i32*** %6
%26 = load i32*, i32** %4
%27 = load i32**, i32*** %6
%28 = bitcast i32** %27 to i8**
%29 = load %struct.TYPE_5__*, %struct.TYPE_5__** %5
%30 = getelementptr inbounds %struct.TYPE_5__, %struct.TYPE_5__* %29, i32 0, i32 0
%31 = getelementptr inbounds %struct.TYPE_4__, %struct.TYPE_4__* %30, i32 0, i32 0
%32 = load i32, i32* @MAXGIDS
%33 = call i32 @xdr_array(i32* %26, i8** %28, i32* %31, i32 %32, i32 4, i32 ptrtoint (i32 (i32*, i32*)* @xdr_u_int to i32))
%34 = icmp ne i32 %33, 0
br i1 %34, label %37, label %35
35: ; preds = %22
%36 = load i32, i32* @FALSE
store i32 %36, i32* %3
br label %39
37: ; preds = %22
%38 = load i32, i32* @TRUE
store i32 %38, i32* %3
br label %39
39: ; preds = %37, %35, %20, %12
%40 = load i32, i32* %3
ret i32 %40
}

LLVM IR (-O2):
%struct.TYPE_5__ = type { %struct.TYPE_4__, i32, i32 }
%struct.TYPE_4__ = type { i32, i32* }
@FALSE = global i32 0
@MAXGIDS = global i32 0
@TRUE = global i32 0
define i32 @xdr_unixcred(i32* %0, %struct.TYPE_5__* %1) {
%3 = getelementptr inbounds %struct.TYPE_5__, %struct.TYPE_5__* %1, i64 0, i32 2
%4 = tail call i32 @xdr_u_int(i32* %0, i32* %3)
%5 = icmp eq i32 %4, 0
br i1 %5, label %18, label %6
6: ; preds = %2
%7 = getelementptr inbounds %struct.TYPE_5__, %struct.TYPE_5__* %1, i64 0, i32 1
%8 = tail call i32 @xdr_u_int(i32* %0, i32* %7)
%9 = icmp eq i32 %8, 0
br i1 %9, label %18, label %10
10: ; preds = %6
%11 = getelementptr inbounds %struct.TYPE_5__, %struct.TYPE_5__* %1, i64 0, i32 0, i32 1
%12 = bitcast i32** %11 to i8**
%13 = getelementptr inbounds %struct.TYPE_5__, %struct.TYPE_5__* %1, i64 0, i32 0, i32 0
%14 = load i32, i32* @MAXGIDS
%15 = tail call i32 @xdr_array(i32* %0, i8** %12, i32* %13, i32 %14, i32 4, i32 ptrtoint (i32 (i32*, i32*)* @xdr_u_int to i32))
%16 = icmp eq i32 %15, 0
%17 = select i1 %16, i32* @FALSE, i32* @TRUE
br label %18
18: ; preds = %10, %6, %2
%19 = phi i32* [ @FALSE, %2 ], [ @FALSE, %6 ], [ %17, %10 ]
%20 = load i32, i32* %19
ret i32 %20
}