#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) {
  if (!xdr_u_int(xdrs, &objp->uid))
    return (FALSE);
  if (!xdr_u_int(xdrs, &objp->gid))
    return (FALSE);
  if (!xdr_array(xdrs, (char **)&objp->gids.gids_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    $0xc,%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    11ca <xdr_unixcred+0xba>
mov    -0x10(%rbp),%rdi
mov    -0x18(%rbp),%rsi
add    $0x8,%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    11ca <xdr_unixcred+0xba>
mov    -0x10(%rbp),%rdi
mov    -0x18(%rbp),%rsi
add    $0x4,%rsi
mov    -0x18(%rbp),%rdx
mov    0x2e53(%rip),%rax
mov    (%rax),%ecx
mov    $0x4,%r8d
mov    0x2e54(%rip),%rax
mov    %eax,%r9d
call   1030 <xdr_array@plt>
cmp    $0x0,%eax
jne    11be <xdr_unixcred+0xae>
mov    0x2e14(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x4(%rbp)
jmp    11ca <xdr_unixcred+0xba>
mov    0x2e13(%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    $0xc,%rsi
call   1040 <xdr_u_int@plt>
mov    0x2e9d(%rip),%r15
test   %eax,%eax
je     1178 <xdr_unixcred+0x68>
lea    0x8(%rbx),%rsi
mov    %r14,%rdi
call   1040 <xdr_u_int@plt>
test   %eax,%eax
je     1178 <xdr_unixcred+0x68>
lea    0x4(%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__*
store i32* %0, i32** %4
store %struct.TYPE_5__* %1, %struct.TYPE_5__** %5
%6 = load i32*, i32** %4
%7 = load %struct.TYPE_5__*, %struct.TYPE_5__** %5
%8 = getelementptr inbounds %struct.TYPE_5__, %struct.TYPE_5__* %7, i32 0, i32 2
%9 = call i32 @xdr_u_int(i32* %6, i32* %8)
%10 = icmp ne i32 %9, 0
br i1 %10, label %13, label %11
11: ; preds = %2
%12 = load i32, i32* @FALSE
store i32 %12, i32* %3
br label %37
13: ; preds = %2
%14 = load i32*, i32** %4
%15 = load %struct.TYPE_5__*, %struct.TYPE_5__** %5
%16 = getelementptr inbounds %struct.TYPE_5__, %struct.TYPE_5__* %15, i32 0, i32 1
%17 = call i32 @xdr_u_int(i32* %14, i32* %16)
%18 = icmp ne i32 %17, 0
br i1 %18, label %21, label %19
19: ; preds = %13
%20 = load i32, i32* @FALSE
store i32 %20, i32* %3
br label %37
21: ; preds = %13
%22 = load i32*, i32** %4
%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
%26 = bitcast i32* %25 to i8**
%27 = load %struct.TYPE_5__*, %struct.TYPE_5__** %5
%28 = getelementptr inbounds %struct.TYPE_5__, %struct.TYPE_5__* %27, i32 0, i32 0
%29 = getelementptr inbounds %struct.TYPE_4__, %struct.TYPE_4__* %28, i32 0, i32 0
%30 = load i32, i32* @MAXGIDS
%31 = call i32 @xdr_array(i32* %22, i8** %26, i32* %29, i32 %30, i32 4, i32 ptrtoint (i32 (i32*, i32*)* @xdr_u_int to i32))
%32 = icmp ne i32 %31, 0
br i1 %32, label %35, label %33
33: ; preds = %21
%34 = load i32, i32* @FALSE
store i32 %34, i32* %3
br label %37
35: ; preds = %21
%36 = load i32, i32* @TRUE
store i32 %36, i32* %3
br label %37
37: ; preds = %35, %33, %19, %11
%38 = load i32, i32* %3
ret i32 %38
}

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
}