#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 accept_stat { ____Placeholder_accept_stat } accept_stat;

/* Variables and functions */
#define GARBAGE_ARGS 133
scalar_t__ MSG_ACCEPTED;
#define PROC_UNAVAIL 132
#define PROG_MISMATCH 131
#define PROG_UNAVAIL 130
int /*<<< orphan*/ RPC_CANTDECODEARGS;
int /*<<< orphan*/ RPC_FAILED;
int /*<<< orphan*/ RPC_PROCUNAVAIL;
int /*<<< orphan*/ RPC_PROGUNAVAIL;
int /*<<< orphan*/ RPC_PROGVERSMISMATCH;
int /*<<< orphan*/ RPC_SUCCESS;
int /*<<< orphan*/ RPC_SYSTEMERROR;
#define SUCCESS 129
#define SYSTEM_ERR 128
int /*<<< orphan*/ assert(int /*<<< orphan*/);
void accepted(enum accept_stat acpt_stat, struct rpc_err *error) {
  assert(error != NULL);
  switch (acpt_stat) {
  case PROG_UNAVAIL:
    error->re_status = RPC_PROGUNAVAIL;
    return;
  case PROG_MISMATCH:
    error->re_status = RPC_PROGVERSMISMATCH;
    return;
  case PROC_UNAVAIL:
    error->re_status = RPC_PROCUNAVAIL;
    return;
  case GARBAGE_ARGS:
    error->re_status = RPC_CANTDECODEARGS;
    return;
  case SYSTEM_ERR:
    error->re_status = RPC_SYSTEMERROR;
    return;
  case SUCCESS:
    error->re_status = RPC_SUCCESS;
    return;
  }
  error->re_status = RPC_FAILED;
  error->re_lb.s1 = (int32_t)MSG_ACCEPTED;
  error->re_lb.s2 = (int32_t)acpt_stat;
}


x86 assembly (clang, -O0):
<accepted>:
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
add    $0xffffff80,%eax
mov    %eax,%ecx
mov    %rcx,-0x18(%rbp)
sub    $0x5,%eax
ja     11d8 <accepted+0xc8>
mov    -0x18(%rbp),%rax
lea    0xeaf(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
mov    0x2e3f(%rip),%rax
mov    (%rax),%ecx
mov    -0x10(%rbp),%rax
mov    %ecx,0x10(%rax)
jmp    1206 <accepted+0xf6>
mov    0x2e7a(%rip),%rax
mov    (%rax),%ecx
mov    -0x10(%rbp),%rax
mov    %ecx,0x10(%rax)
jmp    1206 <accepted+0xf6>
mov    0x2e3d(%rip),%rax
mov    (%rax),%ecx
mov    -0x10(%rbp),%rax
mov    %ecx,0x10(%rax)
jmp    1206 <accepted+0xf6>
mov    0x2e20(%rip),%rax
mov    (%rax),%ecx
mov    -0x10(%rbp),%rax
mov    %ecx,0x10(%rax)
jmp    1206 <accepted+0xf6>
mov    0x2e2b(%rip),%rax
mov    (%rax),%ecx
mov    -0x10(%rbp),%rax
mov    %ecx,0x10(%rax)
jmp    1206 <accepted+0xf6>
mov    0x2e0e(%rip),%rax
mov    (%rax),%ecx
mov    -0x10(%rbp),%rax
mov    %ecx,0x10(%rax)
jmp    1206 <accepted+0xf6>
mov    0x2dd9(%rip),%rax
mov    (%rax),%ecx
mov    -0x10(%rbp),%rax
mov    %ecx,0x10(%rax)
mov    0x2db9(%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):
<accepted>:
push   %r14
push   %rbx
push   %rax
mov    %rsi,%r14
mov    %edi,%ebx
xor    %edi,%edi
test   %rsi,%rsi
setne  %dil
call   1030 <assert@plt>
lea    -0x80(%rbx),%eax
cmp    $0x5,%eax
ja     1148 <accepted+0x38>
lea    0xeca(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
mov    0x2e9a(%rip),%rax
jmp    1195 <accepted+0x85>
mov    0x2e69(%rip),%rax
mov    (%rax),%eax
mov    %eax,0x10(%r14)
mov    0x2e4c(%rip),%rax
mov    (%rax),%rax
mov    %rax,0x8(%r14)
mov    %ebx,%eax
mov    %rax,(%r14)
jmp    119b <accepted+0x8b>
mov    0x2e67(%rip),%rax
jmp    1195 <accepted+0x85>
mov    0x2e26(%rip),%rax
jmp    1195 <accepted+0x85>
mov    0x2e6d(%rip),%rax
jmp    1195 <accepted+0x85>
mov    0x2e3c(%rip),%rax
jmp    1195 <accepted+0x85>
mov    0x2e2b(%rip),%rax
mov    (%rax),%eax
mov    %eax,0x10(%r14)
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
%struct.rpc_err = type { %struct.TYPE_2__, i32 }
%struct.TYPE_2__ = type { i8*, i8* }
@RPC_PROGUNAVAIL = global i32 0
@RPC_PROGVERSMISMATCH = global i32 0
@RPC_PROCUNAVAIL = global i32 0
@RPC_CANTDECODEARGS = global i32 0
@RPC_SYSTEMERROR = global i32 0
@RPC_SUCCESS = global i32 0
@RPC_FAILED = global i32 0
@MSG_ACCEPTED = global i64 0
define void @accepted(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 %34 [
i32 130, label %10
i32 131, label %14
i32 132, label %18
i32 133, label %22
i32 128, label %26
i32 129, label %30
]
10: ; preds = %2
%11 = load i32, i32* @RPC_PROGUNAVAIL
%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 %49
14: ; preds = %2
%15 = load i32, i32* @RPC_PROGVERSMISMATCH
%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 %49
18: ; preds = %2
%19 = load i32, i32* @RPC_PROCUNAVAIL
%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
br label %49
22: ; preds = %2
%23 = load i32, i32* @RPC_CANTDECODEARGS
%24 = load %struct.rpc_err*, %struct.rpc_err** %4
%25 = getelementptr inbounds %struct.rpc_err, %struct.rpc_err* %24, i32 0, i32 1
store i32 %23, i32* %25
br label %49
26: ; preds = %2
%27 = load i32, i32* @RPC_SYSTEMERROR
%28 = load %struct.rpc_err*, %struct.rpc_err** %4
%29 = getelementptr inbounds %struct.rpc_err, %struct.rpc_err* %28, i32 0, i32 1
store i32 %27, i32* %29
br label %49
30: ; preds = %2
%31 = load i32, i32* @RPC_SUCCESS
%32 = load %struct.rpc_err*, %struct.rpc_err** %4
%33 = getelementptr inbounds %struct.rpc_err, %struct.rpc_err* %32, i32 0, i32 1
store i32 %31, i32* %33
br label %49
34: ; preds = %2
%35 = load i32, i32* @RPC_FAILED
%36 = load %struct.rpc_err*, %struct.rpc_err** %4
%37 = getelementptr inbounds %struct.rpc_err, %struct.rpc_err* %36, i32 0, i32 1
store i32 %35, i32* %37
%38 = load i64, i64* @MSG_ACCEPTED
%39 = inttoptr i64 %38 to i8*
%40 = load %struct.rpc_err*, %struct.rpc_err** %4
%41 = getelementptr inbounds %struct.rpc_err, %struct.rpc_err* %40, i32 0, i32 0
%42 = getelementptr inbounds %struct.TYPE_2__, %struct.TYPE_2__* %41, i32 0, i32 1
store i8* %39, i8** %42
%43 = load i32, i32* %3
%44 = zext i32 %43 to i64
%45 = inttoptr i64 %44 to i8*
%46 = load %struct.rpc_err*, %struct.rpc_err** %4
%47 = getelementptr inbounds %struct.rpc_err, %struct.rpc_err* %46, i32 0, i32 0
%48 = getelementptr inbounds %struct.TYPE_2__, %struct.TYPE_2__* %47, i32 0, i32 0
store i8* %45, i8** %48
br label %49
49: ; preds = %34, %30, %26, %22, %18, %14, %10
ret void
}

LLVM IR (-O2):
%struct.rpc_err = type { %struct.TYPE_2__, i32 }
%struct.TYPE_2__ = type { i8*, i8* }
@RPC_PROGUNAVAIL = global i32 0
@RPC_PROGVERSMISMATCH = global i32 0
@RPC_PROCUNAVAIL = global i32 0
@RPC_CANTDECODEARGS = global i32 0
@RPC_SYSTEMERROR = global i32 0
@RPC_SUCCESS = global i32 0
@RPC_FAILED = global i32 0
@MSG_ACCEPTED = global i64 0
define void @accepted(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 %24 [
i32 130, label %6
i32 131, label %9
i32 132, label %12
i32 133, label %15
i32 128, label %18
i32 129, label %21
]
6: ; preds = %2
%7 = load i32, i32* @RPC_PROGUNAVAIL
%8 = getelementptr inbounds %struct.rpc_err, %struct.rpc_err* %1, i64 0, i32 1
store i32 %7, i32* %8
br label %33
9: ; preds = %2
%10 = load i32, i32* @RPC_PROGVERSMISMATCH
%11 = getelementptr inbounds %struct.rpc_err, %struct.rpc_err* %1, i64 0, i32 1
store i32 %10, i32* %11
br label %33
12: ; preds = %2
%13 = load i32, i32* @RPC_PROCUNAVAIL
%14 = getelementptr inbounds %struct.rpc_err, %struct.rpc_err* %1, i64 0, i32 1
store i32 %13, i32* %14
br label %33
15: ; preds = %2
%16 = load i32, i32* @RPC_CANTDECODEARGS
%17 = getelementptr inbounds %struct.rpc_err, %struct.rpc_err* %1, i64 0, i32 1
store i32 %16, i32* %17
br label %33
18: ; preds = %2
%19 = load i32, i32* @RPC_SYSTEMERROR
%20 = getelementptr inbounds %struct.rpc_err, %struct.rpc_err* %1, i64 0, i32 1
store i32 %19, i32* %20
br label %33
21: ; preds = %2
%22 = load i32, i32* @RPC_SUCCESS
%23 = getelementptr inbounds %struct.rpc_err, %struct.rpc_err* %1, i64 0, i32 1
store i32 %22, i32* %23
br label %33
24: ; preds = %2
%25 = load i32, i32* @RPC_FAILED
%26 = getelementptr inbounds %struct.rpc_err, %struct.rpc_err* %1, i64 0, i32 1
store i32 %25, i32* %26
%27 = load i64, i64* @MSG_ACCEPTED
%28 = inttoptr i64 %27 to i8*
%29 = getelementptr inbounds %struct.rpc_err, %struct.rpc_err* %1, i64 0, i32 0, i32 1
store i8* %28, i8** %29
%30 = zext i32 %0 to i64
%31 = inttoptr i64 %30 to i8*
%32 = getelementptr inbounds %struct.rpc_err, %struct.rpc_err* %1, i64 0, i32 0, i32 0
store i8* %31, i8** %32
br label %33
33: ; preds = %24, %21, %18, %15, %12, %9, %6
ret void
}