#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 */
struct TYPE_4__ {
  int /*<<< orphan*/ cred;
};
struct TYPE_5__ {
  int status;
  TYPE_1__ getcredres_u;
};
typedef TYPE_2__ getcredres;
typedef int /*<<< orphan*/ bool_t;
typedef int /*<<< orphan*/ XDR;

/* Variables and functions */
int /*<<< orphan*/ FALSE;
#define KEY_SUCCESS 128
int /*<<< orphan*/ TRUE;
int /*<<< orphan*/ xdr_keystatus(int /*<<< orphan*/ *, int *);
int /*<<< orphan*/ xdr_unixcred(int /*<<< orphan*/ *, int /*<<< orphan*/ *);
bool_t xdr_getcredres(register XDR *xdrs, getcredres *objp) {
  if (!xdr_keystatus(xdrs, &objp->status))
    return (FALSE);
  switch (objp->status) {
  case KEY_SUCCESS:
    if (!xdr_unixcred(xdrs, &objp->getcredres_u.cred))
      return (FALSE);
    break;
  default:
    break;
  }
  return (TRUE);
}


x86 assembly (clang, -O0):
<xdr_getcredres>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    -0x10(%rbp),%rdi
mov    -0x18(%rbp),%rsi
call   1040 <xdr_keystatus@plt>
cmp    $0x0,%eax
jne    1157 <xdr_getcredres+0x37>
mov    0x2e8b(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x4(%rbp)
jmp    11ae <xdr_getcredres+0x8e>
mov    -0x18(%rbp),%rax
mov    (%rax),%eax
sub    $0x80,%eax
jne    119d <xdr_getcredres+0x7d>
jmp    116d <xdr_getcredres+0x4d>
mov    -0x10(%rbp),%rdi
mov    -0x18(%rbp),%rsi
add    $0x4,%rsi
call   1030 <xdr_unixcred@plt>
cmp    $0x0,%eax
jne    1198 <xdr_getcredres+0x78>
mov    0x2e4a(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x4(%rbp)
jmp    11ae <xdr_getcredres+0x8e>
jmp    11a2 <xdr_getcredres+0x82>
jmp    11a2 <xdr_getcredres+0x82>
mov    0x2e3f(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<xdr_getcredres>:
push   %r15
push   %r14
push   %rbx
mov    %rsi,%rbx
mov    %rdi,%r14
call   1040 <xdr_keystatus@plt>
mov    0x2ea1(%rip),%r15
test   %eax,%eax
je     115d <xdr_getcredres+0x3d>
cmpl   $0x80,(%rbx)
jne    1156 <xdr_getcredres+0x36>
add    $0x4,%rbx
mov    %r14,%rdi
mov    %rbx,%rsi
call   1030 <xdr_unixcred@plt>
test   %eax,%eax
je     115d <xdr_getcredres+0x3d>
mov    0x2e8b(%rip),%r15
mov    (%r15),%eax
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
%struct.TYPE_5__ = type { i32, %struct.TYPE_4__ }
%struct.TYPE_4__ = type { i32 }
@FALSE = global i32 0
@TRUE = global i32 0
define i32 @xdr_getcredres(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 0
%9 = call i32 @xdr_keystatus(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 %30
13: ; preds = %2
%14 = load %struct.TYPE_5__*, %struct.TYPE_5__** %5
%15 = getelementptr inbounds %struct.TYPE_5__, %struct.TYPE_5__* %14, i32 0, i32 0
%16 = load i32, i32* %15
switch i32 %16, label %27 [
i32 128, label %17
]
17: ; preds = %13
%18 = load i32*, i32** %4
%19 = load %struct.TYPE_5__*, %struct.TYPE_5__** %5
%20 = getelementptr inbounds %struct.TYPE_5__, %struct.TYPE_5__* %19, i32 0, i32 1
%21 = getelementptr inbounds %struct.TYPE_4__, %struct.TYPE_4__* %20, i32 0, i32 0
%22 = call i32 @xdr_unixcred(i32* %18, i32* %21)
%23 = icmp ne i32 %22, 0
br i1 %23, label %26, label %24
24: ; preds = %17
%25 = load i32, i32* @FALSE
store i32 %25, i32* %3
br label %30
26: ; preds = %17
br label %28
27: ; preds = %13
br label %28
28: ; preds = %27, %26
%29 = load i32, i32* @TRUE
store i32 %29, i32* %3
br label %30
30: ; preds = %28, %24, %11
%31 = load i32, i32* %3
ret i32 %31
}

LLVM IR (-O2):
%struct.TYPE_5__ = type { i32, %struct.TYPE_4__ }
%struct.TYPE_4__ = type { i32 }
@FALSE = global i32 0
@TRUE = global i32 0
define i32 @xdr_getcredres(i32* %0, %struct.TYPE_5__* %1) {
%3 = getelementptr inbounds %struct.TYPE_5__, %struct.TYPE_5__* %1, i64 0, i32 0
%4 = tail call i32 @xdr_keystatus(i32* %0, i32* %3)
%5 = icmp eq i32 %4, 0
br i1 %5, label %14, label %6
6: ; preds = %2
%7 = load i32, i32* %3
%8 = icmp eq i32 %7, 128
br i1 %8, label %9, label %13
9: ; preds = %6
%10 = getelementptr inbounds %struct.TYPE_5__, %struct.TYPE_5__* %1, i64 0, i32 1, i32 0
%11 = tail call i32 @xdr_unixcred(i32* %0, i32* %10)
%12 = icmp eq i32 %11, 0
br i1 %12, label %14, label %13
13: ; preds = %6, %9
br label %14
14: ; preds = %9, %2, %13
%15 = phi i32* [ @TRUE, %13 ], [ @FALSE, %2 ], [ @FALSE, %9 ]
%16 = load i32, i32* %15
ret i32 %16
}