#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_8__ TYPE_4__;
typedef struct TYPE_7__ TYPE_3__;
typedef struct TYPE_6__ TYPE_2__;
typedef struct TYPE_5__ TYPE_1__;

/* Type definitions */
struct TYPE_8__ {
  int oa_flavor;
};
struct svc_req {
  TYPE_4__ rq_cred;
  TYPE_3__ *rq_xprt;
};
struct TYPE_5__ {
  TYPE_4__ cb_cred;
};
struct rpc_msg {
  TYPE_1__ rm_call;
};
typedef enum auth_stat { ____Placeholder_auth_stat } auth_stat;
struct TYPE_6__ {
  scalar_t__ oa_length;
  int /*<<< orphan*/ oa_flavor;
};
struct TYPE_7__ {
  TYPE_2__ xp_verf;
};

/* Variables and functions */
int /*<<< orphan*/ AUTH_NULL;
int AUTH_REJECTEDCRED;
int AUTH_UNIX;
int svcbyz_auth_unix(struct svc_req *, struct rpc_msg *);
enum auth_stat svcbyz_authenticate(struct svc_req *rqst, struct rpc_msg *msg) {
  register int cred_flavor;
  rqst->rq_cred = msg->rm_call.cb_cred;
  rqst->rq_xprt->xp_verf.oa_flavor = AUTH_NULL;
  rqst->rq_xprt->xp_verf.oa_length = 0;
  cred_flavor = rqst->rq_cred.oa_flavor;
  if (cred_flavor == AUTH_UNIX) {
    return svcbyz_auth_unix(rqst, msg);
  }
  return (AUTH_REJECTEDCRED);
}


x86 assembly (clang, -O0):
<svcbyz_authenticate>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    -0x10(%rbp),%rax
mov    -0x18(%rbp),%rcx
mov    (%rcx),%ecx
mov    %ecx,(%rax)
mov    0x2ebd(%rip),%rax
mov    (%rax),%ecx
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rax
mov    %ecx,0x8(%rax)
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rax
movq   $0x0,(%rax)
mov    -0x10(%rbp),%rax
mov    (%rax),%eax
mov    %eax,-0x1c(%rbp)
mov    -0x1c(%rbp),%eax
mov    0x2e76(%rip),%rcx
cmp    (%rcx),%eax
jne    117f <svcbyz_authenticate+0x6f>
mov    -0x10(%rbp),%rdi
mov    -0x18(%rbp),%rsi
call   1030 <svcbyz_auth_unix@plt>
mov    %eax,-0x4(%rbp)
jmp    118b <svcbyz_authenticate+0x7b>
mov    0x2e4a(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<svcbyz_authenticate>:
mov    (%rsi),%eax
mov    %eax,(%rdi)
mov    0x2ed5(%rip),%rcx
mov    (%rcx),%ecx
mov    0x8(%rdi),%rdx
mov    %ecx,0x8(%rdx)
movq   $0x0,(%rdx)
mov    0x2ea6(%rip),%rcx
cmp    (%rcx),%eax
jne    113b <svcbyz_authenticate+0x2b>
jmp    1030 <svcbyz_auth_unix@plt>
mov    0x2e8e(%rip),%rax
mov    (%rax),%eax
ret

LLVM IR (-O0):
%struct.svc_req = type { %struct.TYPE_8__, %struct.TYPE_7__* }
%struct.TYPE_8__ = type { i32 }
%struct.TYPE_7__ = type { %struct.TYPE_6__ }
%struct.TYPE_6__ = type { i64, i32 }
%struct.rpc_msg = type { %struct.TYPE_5__ }
%struct.TYPE_5__ = type { %struct.TYPE_8__ }
@AUTH_NULL = global i32 0
@AUTH_UNIX = global i32 0
@AUTH_REJECTEDCRED = global i32 0
define i32 @svcbyz_authenticate(%struct.svc_req* %0, %struct.rpc_msg* %1) {
%3 = alloca i32
%4 = alloca %struct.svc_req*
%5 = alloca %struct.rpc_msg*
%6 = alloca i32
store %struct.svc_req* %0, %struct.svc_req** %4
store %struct.rpc_msg* %1, %struct.rpc_msg** %5
%7 = load %struct.svc_req*, %struct.svc_req** %4
%8 = getelementptr inbounds %struct.svc_req, %struct.svc_req* %7, i32 0, i32 0
%9 = load %struct.rpc_msg*, %struct.rpc_msg** %5
%10 = getelementptr inbounds %struct.rpc_msg, %struct.rpc_msg* %9, i32 0, i32 0
%11 = getelementptr inbounds %struct.TYPE_5__, %struct.TYPE_5__* %10, i32 0, i32 0
%12 = bitcast %struct.TYPE_8__* %8 to i8*
%13 = bitcast %struct.TYPE_8__* %11 to i8*
%14 = load i32, i32* @AUTH_NULL
%15 = load %struct.svc_req*, %struct.svc_req** %4
%16 = getelementptr inbounds %struct.svc_req, %struct.svc_req* %15, i32 0, i32 1
%17 = load %struct.TYPE_7__*, %struct.TYPE_7__** %16
%18 = getelementptr inbounds %struct.TYPE_7__, %struct.TYPE_7__* %17, i32 0, i32 0
%19 = getelementptr inbounds %struct.TYPE_6__, %struct.TYPE_6__* %18, i32 0, i32 1
store i32 %14, i32* %19
%20 = load %struct.svc_req*, %struct.svc_req** %4
%21 = getelementptr inbounds %struct.svc_req, %struct.svc_req* %20, i32 0, i32 1
%22 = load %struct.TYPE_7__*, %struct.TYPE_7__** %21
%23 = getelementptr inbounds %struct.TYPE_7__, %struct.TYPE_7__* %22, i32 0, i32 0
%24 = getelementptr inbounds %struct.TYPE_6__, %struct.TYPE_6__* %23, i32 0, i32 0
store i64 0, i64* %24
%25 = load %struct.svc_req*, %struct.svc_req** %4
%26 = getelementptr inbounds %struct.svc_req, %struct.svc_req* %25, i32 0, i32 0
%27 = getelementptr inbounds %struct.TYPE_8__, %struct.TYPE_8__* %26, i32 0, i32 0
%28 = load i32, i32* %27
store i32 %28, i32* %6
%29 = load i32, i32* %6
%30 = load i32, i32* @AUTH_UNIX
%31 = icmp eq i32 %29, %30
br i1 %31, label %32, label %36
32: ; preds = %2
%33 = load %struct.svc_req*, %struct.svc_req** %4
%34 = load %struct.rpc_msg*, %struct.rpc_msg** %5
%35 = call i32 @svcbyz_auth_unix(%struct.svc_req* %33, %struct.rpc_msg* %34)
store i32 %35, i32* %3
br label %38
36: ; preds = %2
%37 = load i32, i32* @AUTH_REJECTEDCRED
store i32 %37, i32* %3
br label %38
38: ; preds = %36, %32
%39 = load i32, i32* %3
ret i32 %39
}

LLVM IR (-O2):
%struct.svc_req = type { %struct.TYPE_8__, %struct.TYPE_7__* }
%struct.TYPE_8__ = type { i32 }
%struct.TYPE_7__ = type { %struct.TYPE_6__ }
%struct.TYPE_6__ = type { i64, i32 }
%struct.rpc_msg = type { %struct.TYPE_5__ }
%struct.TYPE_5__ = type { %struct.TYPE_8__ }
@AUTH_NULL = global i32 0
@AUTH_UNIX = global i32 0
@AUTH_REJECTEDCRED = global i32 0
define i32 @svcbyz_authenticate(%struct.svc_req* %0, %struct.rpc_msg* %1) {
%3 = getelementptr %struct.rpc_msg, %struct.rpc_msg* %1, i64 0, i32 0, i32 0, i32 0
%4 = getelementptr %struct.svc_req, %struct.svc_req* %0, i64 0, i32 0, i32 0
%5 = load i32, i32* %3
store i32 %5, i32* %4
%6 = load i32, i32* @AUTH_NULL
%7 = getelementptr inbounds %struct.svc_req, %struct.svc_req* %0, i64 0, i32 1
%8 = load %struct.TYPE_7__*, %struct.TYPE_7__** %7
%9 = getelementptr inbounds %struct.TYPE_7__, %struct.TYPE_7__* %8, i64 0, i32 0, i32 1
store i32 %6, i32* %9
%10 = getelementptr inbounds %struct.TYPE_7__, %struct.TYPE_7__* %8, i64 0, i32 0, i32 0
store i64 0, i64* %10
%11 = load i32, i32* @AUTH_UNIX
%12 = icmp eq i32 %5, %11
br i1 %12, label %13, label %15
13: ; preds = %2
%14 = tail call i32 @svcbyz_auth_unix(%struct.svc_req* %0, %struct.rpc_msg* %1)
br label %17
15: ; preds = %2
%16 = load i32, i32* @AUTH_REJECTEDCRED
br label %17
17: ; preds = %15, %13
%18 = phi i32 [ %14, %13 ], [ %16, %15 ]
ret i32 %18
}