#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_2__ TYPE_1__;

/* Type definitions */
struct TYPE_2__ {
  void *s2;
  void *s1;
};
struct rpc_err {
  TYPE_1__ re_lb;
  int /*<<< orphan*/ re_status;
};
typedef void *int32_t;
typedef enum reject_stat { ____Placeholder_reject_stat } reject_stat;

/* Variables and functions */
#define AUTH_ERROR 129
scalar_t__ MSG_DENIED;
int /*<<< orphan*/ RPC_AUTHERROR;
int /*<<< orphan*/ RPC_FAILED;
#define RPC_MISMATCH 128
int /*<<< orphan*/ RPC_VERSMISMATCH;
int /*<<< orphan*/ assert(int /*<<< orphan*/);
void rejected(enum reject_stat rjct_stat, struct rpc_err *error) {
  assert(error != NULL);
  switch (rjct_stat) {
  case RPC_MISMATCH:
    error->re_status = RPC_VERSMISMATCH;
    return;
  case AUTH_ERROR:
    error->re_status = RPC_AUTHERROR;
    return;
  }
  error->re_status = RPC_FAILED;
  error->re_lb.s1 = (int32_t)MSG_DENIED;
  error->re_lb.s2 = (int32_t)rjct_stat;
}


x86 assembly (clang, -O0):
<rejected>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x10(%rbp),%rax
test   %rax,%rax
setne  %al
movzbl %al,%edi
call   1030 <assert@plt>
mov    -0x4(%rbp),%eax
mov    %eax,-0x14(%rbp)
sub    $0x80,%eax
je     115a <rejected+0x4a>
jmp    1147 <rejected+0x37>
mov    -0x14(%rbp),%eax
sub    $0x81,%eax
je     116f <rejected+0x5f>
jmp    1184 <rejected+0x74>
mov    0x2e67(%rip),%rax
mov    (%rax),%ecx
mov    -0x10(%rbp),%rax
mov    %ecx,0x10(%rax)
jmp    11b2 <rejected+0xa2>
mov    0x2e62(%rip),%rax
mov    (%rax),%ecx
mov    -0x10(%rbp),%rax
mov    %ecx,0x10(%rax)
jmp    11b2 <rejected+0xa2>
mov    0x2e45(%rip),%rax
mov    (%rax),%ecx
mov    -0x10(%rbp),%rax
mov    %ecx,0x10(%rax)
mov    0x2e45(%rip),%rax
mov    (%rax),%rcx
mov    -0x10(%rbp),%rax
mov    %rcx,0x8(%rax)
mov    -0x4(%rbp),%eax
mov    %eax,%ecx
mov    -0x10(%rbp),%rax
mov    %rcx,(%rax)
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<rejected>:
push   %rbp
push   %rbx
push   %rax
mov    %rsi,%rbx
mov    %edi,%ebp
xor    %edi,%edi
test   %rsi,%rsi
setne  %dil
call   1030 <assert@plt>
cmp    $0x81,%ebp
je     113f <rejected+0x2f>
cmp    $0x80,%ebp
jne    114d <rejected+0x3d>
mov    0x2e8b(%rip),%rax
jmp    1146 <rejected+0x36>
mov    0x2e92(%rip),%rax
mov    (%rax),%eax
mov    %eax,0x10(%rbx)
jmp    116c <rejected+0x5c>
mov    0x2e7c(%rip),%rax
mov    (%rax),%eax
mov    %eax,0x10(%rbx)
mov    0x2e80(%rip),%rax
mov    (%rax),%rax
mov    %rax,0x8(%rbx)
mov    %ebp,%eax
mov    %rax,(%rbx)
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
%struct.rpc_err = type { %struct.TYPE_2__, i32 }
%struct.TYPE_2__ = type { i8*, i8* }
@RPC_VERSMISMATCH = global i32 0
@RPC_AUTHERROR = global i32 0
@RPC_FAILED = global i32 0
@MSG_DENIED = global i64 0
define void @rejected(i32 %0, %struct.rpc_err* %1) {
%3 = alloca i32
%4 = alloca %struct.rpc_err*
store i32 %0, i32* %3
store %struct.rpc_err* %1, %struct.rpc_err** %4
%5 = load %struct.rpc_err*, %struct.rpc_err** %4
%6 = icmp ne %struct.rpc_err* %5, null
%7 = zext i1 %6 to i32
%8 = call i32 @assert(i32 %7)
%9 = load i32, i32* %3
switch i32 %9, label %18 [
i32 128, label %10
i32 129, label %14
]
10: ; preds = %2
%11 = load i32, i32* @RPC_VERSMISMATCH
%12 = load %struct.rpc_err*, %struct.rpc_err** %4
%13 = getelementptr inbounds %struct.rpc_err, %struct.rpc_err* %12, i32 0, i32 1
store i32 %11, i32* %13
br label %33
14: ; preds = %2
%15 = load i32, i32* @RPC_AUTHERROR
%16 = load %struct.rpc_err*, %struct.rpc_err** %4
%17 = getelementptr inbounds %struct.rpc_err, %struct.rpc_err* %16, i32 0, i32 1
store i32 %15, i32* %17
br label %33
18: ; preds = %2
%19 = load i32, i32* @RPC_FAILED
%20 = load %struct.rpc_err*, %struct.rpc_err** %4
%21 = getelementptr inbounds %struct.rpc_err, %struct.rpc_err* %20, i32 0, i32 1
store i32 %19, i32* %21
%22 = load i64, i64* @MSG_DENIED
%23 = inttoptr i64 %22 to i8*
%24 = load %struct.rpc_err*, %struct.rpc_err** %4
%25 = getelementptr inbounds %struct.rpc_err, %struct.rpc_err* %24, i32 0, i32 0
%26 = getelementptr inbounds %struct.TYPE_2__, %struct.TYPE_2__* %25, i32 0, i32 1
store i8* %23, i8** %26
%27 = load i32, i32* %3
%28 = zext i32 %27 to i64
%29 = inttoptr i64 %28 to i8*
%30 = load %struct.rpc_err*, %struct.rpc_err** %4
%31 = getelementptr inbounds %struct.rpc_err, %struct.rpc_err* %30, i32 0, i32 0
%32 = getelementptr inbounds %struct.TYPE_2__, %struct.TYPE_2__* %31, i32 0, i32 0
store i8* %29, i8** %32
br label %33
33: ; preds = %18, %14, %10
ret void
}

LLVM IR (-O2):
%struct.rpc_err = type { %struct.TYPE_2__, i32 }
%struct.TYPE_2__ = type { i8*, i8* }
@RPC_VERSMISMATCH = global i32 0
@RPC_AUTHERROR = global i32 0
@RPC_FAILED = global i32 0
@MSG_DENIED = global i64 0
define void @rejected(i32 %0, %struct.rpc_err* writeonly %1) {
%3 = icmp ne %struct.rpc_err* %1, null
%4 = zext i1 %3 to i32
%5 = tail call i32 @assert(i32 %4)
switch i32 %0, label %12 [
i32 128, label %6
i32 129, label %9
]
6: ; preds = %2
%7 = load i32, i32* @RPC_VERSMISMATCH
%8 = getelementptr inbounds %struct.rpc_err, %struct.rpc_err* %1, i64 0, i32 1
store i32 %7, i32* %8
br label %21
9: ; preds = %2
%10 = load i32, i32* @RPC_AUTHERROR
%11 = getelementptr inbounds %struct.rpc_err, %struct.rpc_err* %1, i64 0, i32 1
store i32 %10, i32* %11
br label %21
12: ; preds = %2
%13 = load i32, i32* @RPC_FAILED
%14 = getelementptr inbounds %struct.rpc_err, %struct.rpc_err* %1, i64 0, i32 1
store i32 %13, i32* %14
%15 = load i64, i64* @MSG_DENIED
%16 = inttoptr i64 %15 to i8*
%17 = getelementptr inbounds %struct.rpc_err, %struct.rpc_err* %1, i64 0, i32 0, i32 1
store i8* %16, i8** %17
%18 = zext i32 %0 to i64
%19 = inttoptr i64 %18 to i8*
%20 = getelementptr inbounds %struct.rpc_err, %struct.rpc_err* %1, i64 0, i32 0, i32 0
store i8* %19, i8** %20
br label %21
21: ; preds = %12, %9, %6
ret void
}