#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 */

/* Type definitions */

/* Variables and functions */
int SEGV_ACCERR;
int SEGV_MAPERR;
char *si_code_str(int si_code) {
  if (si_code == SEGV_MAPERR)
    return "SEGV_MAPERR";
  if (si_code == SEGV_ACCERR)
    return "SEGV_ACCERR";
  if (si_code == 3)
    return "SEGV_BNDERR";
  if (si_code == 4)
    return "SEGV_PKUERR";
  return "UNKNOWN";
}


x86 assembly (clang, -O0):
<si_code_str>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0xc(%rbp)
mov    -0xc(%rbp),%eax
mov    0x2ec7(%rip),%rcx
cmp    (%rcx),%eax
jne    1129 <si_code_str+0x29>
lea    0xee0(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    118a <si_code_str+0x8a>
mov    -0xc(%rbp),%eax
mov    0x2eb5(%rip),%rcx
cmp    (%rcx),%eax
jne    114b <si_code_str+0x4b>
lea    0xeca(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    118a <si_code_str+0x8a>
cmpl   $0x3,-0xc(%rbp)
jne    1165 <si_code_str+0x65>
lea    0xebc(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    118a <si_code_str+0x8a>
cmpl   $0x4,-0xc(%rbp)
jne    117f <si_code_str+0x7f>
lea    0xeae(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    118a <si_code_str+0x8a>
lea    0xeaa(%rip),%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<si_code_str>:
mov    0x2ed1(%rip),%rax
cmp    %edi,(%rax)
jne    1113 <si_code_str+0x13>
lea    0xeee(%rip),%rax
ret
mov    0x2ece(%rip),%rax
cmp    %edi,(%rax)
jne    1126 <si_code_str+0x26>
lea    0xee7(%rip),%rax
ret
cmp    $0x4,%edi
lea    0xef4(%rip),%rax
lea    0xef9(%rip),%rcx
cmove  %rax,%rcx
cmp    $0x3,%edi
lea    0xed3(%rip),%rax
cmovne %rcx,%rax
ret

LLVM IR (-O0):
@SEGV_MAPERR = global i32 0
@.str = [12 x i8] c"SEGV_MAPERR\00"
@SEGV_ACCERR = global i32 0
@.str.1 = [12 x i8] c"SEGV_ACCERR\00"
@.str.2 = [12 x i8] c"SEGV_BNDERR\00"
@.str.3 = [12 x i8] c"SEGV_PKUERR\00"
@.str.4 = [8 x i8] c"UNKNOWN\00"
define i8* @si_code_str(i32 %0) {
%2 = alloca i8*
%3 = alloca i32
store i32 %0, i32* %3
%4 = load i32, i32* %3
%5 = load i32, i32* @SEGV_MAPERR
%6 = icmp eq i32 %4, %5
br i1 %6, label %7, label %8
7: ; preds = %1
store i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0), i8** %2
br label %22
8: ; preds = %1
%9 = load i32, i32* %3
%10 = load i32, i32* @SEGV_ACCERR
%11 = icmp eq i32 %9, %10
br i1 %11, label %12, label %13
12: ; preds = %8
store i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.1, i64 0, i64 0), i8** %2
br label %22
13: ; preds = %8
%14 = load i32, i32* %3
%15 = icmp eq i32 %14, 3
br i1 %15, label %16, label %17
16: ; preds = %13
store i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.2, i64 0, i64 0), i8** %2
br label %22
17: ; preds = %13
%18 = load i32, i32* %3
%19 = icmp eq i32 %18, 4
br i1 %19, label %20, label %21
20: ; preds = %17
store i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.3, i64 0, i64 0), i8** %2
br label %22
21: ; preds = %17
store i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.4, i64 0, i64 0), i8** %2
br label %22
22: ; preds = %21, %20, %16, %12, %7
%23 = load i8*, i8** %2
ret i8* %23
}

LLVM IR (-O2):
@SEGV_MAPERR = global i32 0
@.str = [12 x i8] c"SEGV_MAPERR\00"
@SEGV_ACCERR = global i32 0
@.str.1 = [12 x i8] c"SEGV_ACCERR\00"
@.str.2 = [12 x i8] c"SEGV_BNDERR\00"
@.str.3 = [12 x i8] c"SEGV_PKUERR\00"
@.str.4 = [8 x i8] c"UNKNOWN\00"
define i8* @si_code_str(i32 %0) {
%2 = load i32, i32* @SEGV_MAPERR
%3 = icmp eq i32 %2, %0
br i1 %3, label %12, label %4
4: ; preds = %1
%5 = load i32, i32* @SEGV_ACCERR
%6 = icmp eq i32 %5, %0
br i1 %6, label %12, label %7
7: ; preds = %4
%8 = icmp eq i32 %0, 4
%9 = select i1 %8, i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.3, i64 0, i64 0), i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.4, i64 0, i64 0)
%10 = icmp eq i32 %0, 3
%11 = select i1 %10, i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.2, i64 0, i64 0), i8* %9
br label %12
12: ; preds = %7, %4, %1
%13 = phi i8* [ getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0), %1 ], [ getelementptr inbounds ([12 x i8], [12 x i8]* @.str.1, i64 0, i64 0), %4 ], [ %11, %7 ]
ret i8* %13
}