#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 */
char const *hxerror(int);
char const *hxmode(int mode) {
  static char const *modev[] = {
      "READ",
      "UPDATE",
      "CHECK",
      "REPAIR",
      "READ,MMAP",
      "UPDATE,MMAP",
      "INVALID:CHECK+MMAP",
      "INVALID:REPAIR+MMAP",
      "DUBIOUS:READ+MPROTECT",
      "DUBIOUS:UPDATE+MPROTECT",
      "INVALID:CHECK+MPROTECT",
      "INVALID:REPAIR+MPROTECT",
      "READ+MPROTECT",
      "UPDATE+MPROTECT",
      "INVALID:CHECK+MMAP+MPROTECT",
      "INVALID:REPAIR+MMAP+MPROTECT",
      "DUBIOUS:READ+FSYNC",
      "UPDATE,FSYNC",
      "DUBIOUS:CHECK+FSYNC",
      "REPAIR,FSYNC",
  };
  return mode < 0                                       ? hxerror(mode)
         : mode < (int)(sizeof modev / sizeof modev[0]) ? modev[mode]
                                                        : "INVALID";
}


x86 assembly (clang, -O0):
<hxmode>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
cmpl   $0x0,-0x4(%rbp)
jge    1136 <hxmode+0x26>
mov    -0x4(%rbp),%edi
call   1030 <hxerror@plt>
mov    %rax,-0x10(%rbp)
jmp    1170 <hxmode+0x60>
cmpl   $0x14,-0x4(%rbp)
jge    1158 <hxmode+0x48>
movslq -0x4(%rbp),%rcx
lea    0x2ee5(%rip),%rax
mov    (%rax,%rcx,8),%rax
mov    %rax,-0x18(%rbp)
jmp    1168 <hxmode+0x58>
lea    0xfce(%rip),%rax
mov    %rax,-0x18(%rbp)
jmp    1168 <hxmode+0x58>
mov    -0x18(%rbp),%rax
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<hxmode>:
test   %edi,%edi
js     112a <hxmode+0x1a>
cmp    $0x13,%edi
ja     112f <hxmode+0x1f>
mov    %edi,%eax
lea    0xede(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
ret
jmp    1030 <hxerror@plt>
lea    0x1047(%rip),%rax
ret

LLVM IR (-O0):
@hxmode.modev = internal global [20 x i8*] [i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i32 0, i32 0), i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i32 0, i32 0), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.2, i32 0, i32 0), i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.3, i32 0, i32 0), i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.4, i32 0, i32 0), i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.5, i32 0, i32 0), i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.6, i32 0, i32 0), i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.7, i32 0, i32 0), i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.8, i32 0, i32 0), i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.9, i32 0, i32 0), i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.10, i32 0, i32 0), i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.11, i32 0, i32 0), i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.12, i32 0, i32 0), i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.13, i32 0, i32 0), i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.14, i32 0, i32 0), i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.15, i32 0, i32 0), i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.16, i32 0, i32 0), i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.17, i32 0, i32 0), i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.18, i32 0, i32 0), i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.19, i32 0, i32 0)]
@.str = [5 x i8] c"READ\00"
@.str.1 = [7 x i8] c"UPDATE\00"
@.str.2 = [6 x i8] c"CHECK\00"
@.str.3 = [7 x i8] c"REPAIR\00"
@.str.4 = [10 x i8] c"READ,MMAP\00"
@.str.5 = [12 x i8] c"UPDATE,MMAP\00"
@.str.6 = [19 x i8] c"INVALID:CHECK+MMAP\00"
@.str.7 = [20 x i8] c"INVALID:REPAIR+MMAP\00"
@.str.8 = [22 x i8] c"DUBIOUS:READ+MPROTECT\00"
@.str.9 = [24 x i8] c"DUBIOUS:UPDATE+MPROTECT\00"
@.str.10 = [23 x i8] c"INVALID:CHECK+MPROTECT\00"
@.str.11 = [24 x i8] c"INVALID:REPAIR+MPROTECT\00"
@.str.12 = [14 x i8] c"READ+MPROTECT\00"
@.str.13 = [16 x i8] c"UPDATE+MPROTECT\00"
@.str.14 = [28 x i8] c"INVALID:CHECK+MMAP+MPROTECT\00"
@.str.15 = [29 x i8] c"INVALID:REPAIR+MMAP+MPROTECT\00"
@.str.16 = [19 x i8] c"DUBIOUS:READ+FSYNC\00"
@.str.17 = [13 x i8] c"UPDATE,FSYNC\00"
@.str.18 = [20 x i8] c"DUBIOUS:CHECK+FSYNC\00"
@.str.19 = [13 x i8] c"REPAIR,FSYNC\00"
@.str.20 = [8 x i8] c"INVALID\00"
define i8* @hxmode(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = icmp slt i32 %3, 0
br i1 %4, label %5, label %8
5: ; preds = %1
%6 = load i32, i32* %2
%7 = call i8* @hxerror(i32 %6)
br label %19
8: ; preds = %1
%9 = load i32, i32* %2
%10 = icmp slt i32 %9, 20
br i1 %10, label %11, label %16
11: ; preds = %8
%12 = load i32, i32* %2
%13 = sext i32 %12 to i64
%14 = getelementptr inbounds [20 x i8*], [20 x i8*]* @hxmode.modev, i64 0, i64 %13
%15 = load i8*, i8** %14
br label %17
16: ; preds = %8
br label %17
17: ; preds = %16, %11
%18 = phi i8* [ %15, %11 ], [ getelementptr inbounds ([8 x i8], [8 x i8]* @.str.20, i64 0, i64 0), %16 ]
br label %19
19: ; preds = %17, %5
%20 = phi i8* [ %7, %5 ], [ %18, %17 ]
ret i8* %20
}

LLVM IR (-O2):
@reltable.hxmode = internal unnamed_addr constant [20 x i32] [i32 trunc (i64 sub (i64 ptrtoint ([5 x i8]* @.str to i64), i64 ptrtoint ([20 x i32]* @reltable.hxmode to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([7 x i8]* @.str.1 to i64), i64 ptrtoint ([20 x i32]* @reltable.hxmode to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([6 x i8]* @.str.2 to i64), i64 ptrtoint ([20 x i32]* @reltable.hxmode to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([7 x i8]* @.str.3 to i64), i64 ptrtoint ([20 x i32]* @reltable.hxmode to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([10 x i8]* @.str.4 to i64), i64 ptrtoint ([20 x i32]* @reltable.hxmode to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([12 x i8]* @.str.5 to i64), i64 ptrtoint ([20 x i32]* @reltable.hxmode to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([19 x i8]* @.str.6 to i64), i64 ptrtoint ([20 x i32]* @reltable.hxmode to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([20 x i8]* @.str.7 to i64), i64 ptrtoint ([20 x i32]* @reltable.hxmode to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([22 x i8]* @.str.8 to i64), i64 ptrtoint ([20 x i32]* @reltable.hxmode to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([24 x i8]* @.str.9 to i64), i64 ptrtoint ([20 x i32]* @reltable.hxmode to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([23 x i8]* @.str.10 to i64), i64 ptrtoint ([20 x i32]* @reltable.hxmode to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([24 x i8]* @.str.11 to i64), i64 ptrtoint ([20 x i32]* @reltable.hxmode to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([14 x i8]* @.str.12 to i64), i64 ptrtoint ([20 x i32]* @reltable.hxmode to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([16 x i8]* @.str.13 to i64), i64 ptrtoint ([20 x i32]* @reltable.hxmode to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([28 x i8]* @.str.14 to i64), i64 ptrtoint ([20 x i32]* @reltable.hxmode to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([29 x i8]* @.str.15 to i64), i64 ptrtoint ([20 x i32]* @reltable.hxmode to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([19 x i8]* @.str.16 to i64), i64 ptrtoint ([20 x i32]* @reltable.hxmode to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([13 x i8]* @.str.17 to i64), i64 ptrtoint ([20 x i32]* @reltable.hxmode to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([20 x i8]* @.str.18 to i64), i64 ptrtoint ([20 x i32]* @reltable.hxmode to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([13 x i8]* @.str.19 to i64), i64 ptrtoint ([20 x i32]* @reltable.hxmode to i64)) to i32)]
@.str = [5 x i8] c"READ\00"
@.str.1 = [7 x i8] c"UPDATE\00"
@.str.2 = [6 x i8] c"CHECK\00"
@.str.3 = [7 x i8] c"REPAIR\00"
@.str.4 = [10 x i8] c"READ,MMAP\00"
@.str.5 = [12 x i8] c"UPDATE,MMAP\00"
@.str.6 = [19 x i8] c"INVALID:CHECK+MMAP\00"
@.str.7 = [20 x i8] c"INVALID:REPAIR+MMAP\00"
@.str.8 = [22 x i8] c"DUBIOUS:READ+MPROTECT\00"
@.str.9 = [24 x i8] c"DUBIOUS:UPDATE+MPROTECT\00"
@.str.10 = [23 x i8] c"INVALID:CHECK+MPROTECT\00"
@.str.11 = [24 x i8] c"INVALID:REPAIR+MPROTECT\00"
@.str.12 = [14 x i8] c"READ+MPROTECT\00"
@.str.13 = [16 x i8] c"UPDATE+MPROTECT\00"
@.str.14 = [28 x i8] c"INVALID:CHECK+MMAP+MPROTECT\00"
@.str.15 = [29 x i8] c"INVALID:REPAIR+MMAP+MPROTECT\00"
@.str.16 = [19 x i8] c"DUBIOUS:READ+FSYNC\00"
@.str.17 = [13 x i8] c"UPDATE,FSYNC\00"
@.str.18 = [20 x i8] c"DUBIOUS:CHECK+FSYNC\00"
@.str.19 = [13 x i8] c"REPAIR,FSYNC\00"
@.str.20 = [8 x i8] c"INVALID\00"
define i8* @hxmode(i32 %0) {
%2 = icmp slt i32 %0, 0
br i1 %2, label %3, label %5
3: ; preds = %1
%4 = tail call i8* @hxerror(i32 %0)
br label %11
5: ; preds = %1
%6 = icmp ult i32 %0, 20
br i1 %6, label %7, label %11
7: ; preds = %5
%8 = zext i32 %0 to i64
%9 = shl i64 %8, 2
%10 = call i8* @llvm.load.relative.i64(i8* bitcast ([20 x i32]* @reltable.hxmode to i8*), i64 %9)
br label %11
11: ; preds = %7, %5, %3
%12 = phi i8* [ %4, %3 ], [ %10, %7 ], [ getelementptr inbounds ([8 x i8], [8 x i8]* @.str.20, i64 0, i64 0), %5 ]
ret i8* %12
}