#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 */
typedef int uint32_t;
typedef int uint16_t;

/* Variables and functions */
char *get_abi(uint16_t e_machine, int width, uint32_t e_flags) {
  switch (e_machine) {
  case 0x9026:
    return "alpha_64";
  case 40:
    if (e_flags & 0XFF000000)
      return "arm_eabi";
    else
      return "arm_oabi";
  case 183:
    return "arm_64";
  case 4:
    return "m68k_32";
  case 8:
    if (width == 64)
      return "mips_n64";
    else if (e_flags & 0x00000020)
      return "mips_n32";
    else
      return "mips_o32";
  case 50:
    return "ia_64";
  case 15:
    return "hppa_32";
  case 20:
    return "ppc_32";
  case 21:
    return "ppc_64";
  case 22:
    if (width == 64)
      return "s390_64";
    else
      return "s390_32";
  case 42:
    return "sh_32";
  case 18:
    return "sparc_32";
  case 43:
    return "sparc_64";
  case 3:
    return "x86_32";
  case 62:
    if (width == 64)
      return "x86_64";
    else
      return "x86_x32";
  default:
    return "unknown";
  }
}


x86 assembly (clang, -O0):
<get_abi>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0xc(%rbp)
mov    %esi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
mov    -0xc(%rbp),%eax
mov    %eax,-0x18(%rbp)
sub    $0x3,%eax
je     1357 <get_abi+0x257>
jmp    1121 <get_abi+0x21>
mov    -0x18(%rbp),%eax
sub    $0x4,%eax
je     1264 <get_abi+0x164>
jmp    1132 <get_abi+0x32>
mov    -0x18(%rbp),%eax
sub    $0x8,%eax
je     1274 <get_abi+0x174>
jmp    1143 <get_abi+0x43>
mov    -0x18(%rbp),%eax
sub    $0xf,%eax
je     12cd <get_abi+0x1cd>
jmp    1154 <get_abi+0x54>
mov    -0x18(%rbp),%eax
sub    $0x12,%eax
je     1337 <get_abi+0x237>
jmp    1165 <get_abi+0x65>
mov    -0x18(%rbp),%eax
sub    $0x14,%eax
je     12dd <get_abi+0x1dd>
jmp    1176 <get_abi+0x76>
mov    -0x18(%rbp),%eax
sub    $0x15,%eax
je     12ed <get_abi+0x1ed>
jmp    1187 <get_abi+0x87>
mov    -0x18(%rbp),%eax
sub    $0x16,%eax
je     12fd <get_abi+0x1fd>
jmp    1198 <get_abi+0x98>
mov    -0x18(%rbp),%eax
sub    $0x28,%eax
je     1223 <get_abi+0x123>
jmp    11a9 <get_abi+0xa9>
mov    -0x18(%rbp),%eax
sub    $0x2a,%eax
je     1327 <get_abi+0x227>
jmp    11ba <get_abi+0xba>
mov    -0x18(%rbp),%eax
sub    $0x2b,%eax
je     1347 <get_abi+0x247>
jmp    11cb <get_abi+0xcb>
mov    -0x18(%rbp),%eax
sub    $0x32,%eax
je     12bd <get_abi+0x1bd>
jmp    11dc <get_abi+0xdc>
mov    -0x18(%rbp),%eax
sub    $0x3e,%eax
je     1367 <get_abi+0x267>
jmp    11ed <get_abi+0xed>
mov    -0x18(%rbp),%eax
sub    $0xb7,%eax
je     1254 <get_abi+0x154>
jmp    1200 <get_abi+0x100>
mov    -0x18(%rbp),%eax
sub    $0x9026,%eax
jne    1391 <get_abi+0x291>
jmp    1213 <get_abi+0x113>
lea    0xde6(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    139c <get_abi+0x29c>
mov    -0x14(%rbp),%eax
and    $0xff000000,%eax
cmp    $0x0,%eax
je     1244 <get_abi+0x144>
lea    0xdce(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    139c <get_abi+0x29c>
lea    0xdc7(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    139c <get_abi+0x29c>
lea    0xdc0(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    139c <get_abi+0x29c>
lea    0xdb7(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    139c <get_abi+0x29c>
cmpl   $0x40,-0x10(%rbp)
jne    128e <get_abi+0x18e>
lea    0xda5(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    139c <get_abi+0x29c>
mov    -0x14(%rbp),%eax
and    $0x20,%eax
cmp    $0x0,%eax
je     12ad <get_abi+0x1ad>
lea    0xd8f(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    139c <get_abi+0x29c>
lea    0xd88(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    139c <get_abi+0x29c>
lea    0xd81(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    139c <get_abi+0x29c>
lea    0xd77(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    139c <get_abi+0x29c>
lea    0xd6f(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    139c <get_abi+0x29c>
lea    0xd66(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    139c <get_abi+0x29c>
cmpl   $0x40,-0x10(%rbp)
jne    1317 <get_abi+0x217>
lea    0xd53(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    139c <get_abi+0x29c>
lea    0xd4b(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    139c <get_abi+0x29c>
lea    0xd43(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    139c <get_abi+0x29c>
lea    0xd39(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    139c <get_abi+0x29c>
lea    0xd32(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    139c <get_abi+0x29c>
lea    0xd2b(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    139c <get_abi+0x29c>
cmpl   $0x40,-0x10(%rbp)
jne    1381 <get_abi+0x281>
lea    0xd18(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    139c <get_abi+0x29c>
lea    0xd0f(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    139c <get_abi+0x29c>
lea    0xd07(%rip),%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<get_abi>:
lea    -0x3(%rdi),%eax
cmp    $0x3b,%eax
ja     1120 <get_abi+0x20>
lea    0xef1(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
lea    0x105a(%rip),%rax
ret
cmp    $0xb7,%edi
je     11d6 <get_abi+0xd6>
cmp    $0x9026,%edi
jne    113c <get_abi+0x3c>
lea    0xfb5(%rip),%rax
ret
lea    0x104c(%rip),%rax
ret
lea    0xfc7(%rip),%rax
ret
lea    0x1014(%rip),%rax
ret
lea    0xfe8(%rip),%rax
ret
cmp    $0x40,%esi
lea    0xfeb(%rip),%rcx
lea    0xfec(%rip),%rax
cmove  %rcx,%rax
ret
lea    0xfbc(%rip),%rax
ret
cmp    $0x40,%esi
lea    0xffc(%rip),%rcx
lea    0xffc(%rip),%rax
cmove  %rcx,%rax
ret
cmp    $0x40,%esi
jne    11de <get_abi+0xde>
lea    0xf7e(%rip),%rax
ret
lea    0xf97(%rip),%rax
ret
lea    0xf9e(%rip),%rax
ret
cmp    $0x1000000,%edx
lea    0xf48(%rip),%rcx
lea    0xf38(%rip),%rax
cmovb  %rcx,%rax
ret
lea    0xf94(%rip),%rax
ret
lea    0xf9b(%rip),%rax
ret
lea    0xf2e(%rip),%rax
ret
test   $0x20,%dl
lea    0xf44(%rip),%rcx
lea    0xf34(%rip),%rax
cmove  %rcx,%rax
ret

LLVM IR (-O0):
@.str = [9 x i8] c"alpha_64\00"
@.str.1 = [9 x i8] c"arm_eabi\00"
@.str.2 = [9 x i8] c"arm_oabi\00"
@.str.3 = [7 x i8] c"arm_64\00"
@.str.4 = [8 x i8] c"m68k_32\00"
@.str.5 = [9 x i8] c"mips_n64\00"
@.str.6 = [9 x i8] c"mips_n32\00"
@.str.7 = [9 x i8] c"mips_o32\00"
@.str.8 = [6 x i8] c"ia_64\00"
@.str.9 = [8 x i8] c"hppa_32\00"
@.str.10 = [7 x i8] c"ppc_32\00"
@.str.11 = [7 x i8] c"ppc_64\00"
@.str.12 = [8 x i8] c"s390_64\00"
@.str.13 = [8 x i8] c"s390_32\00"
@.str.14 = [6 x i8] c"sh_32\00"
@.str.15 = [9 x i8] c"sparc_32\00"
@.str.16 = [9 x i8] c"sparc_64\00"
@.str.17 = [7 x i8] c"x86_32\00"
@.str.18 = [7 x i8] c"x86_64\00"
@.str.19 = [8 x i8] c"x86_x32\00"
@.str.20 = [8 x i8] c"unknown\00"
define i8* @get_abi(i32 %0, i32 %1, i32 %2) {
%4 = alloca i8*
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
store i32 %0, i32* %5
store i32 %1, i32* %6
store i32 %2, i32* %7
%8 = load i32, i32* %5
switch i32 %8, label %46 [
i32 36902, label %9
i32 40, label %10
i32 183, label %16
i32 4, label %17
i32 8, label %18
i32 50, label %28
i32 15, label %29
i32 20, label %30
i32 21, label %31
i32 22, label %32
i32 42, label %37
i32 18, label %38
i32 43, label %39
i32 3, label %40
i32 62, label %41
]
9: ; preds = %3
store i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0), i8** %4
br label %47
10: ; preds = %3
%11 = load i32, i32* %7
%12 = and i32 %11, -16777216
%13 = icmp ne i32 %12, 0
br i1 %13, label %14, label %15
14: ; preds = %10
store i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.1, i64 0, i64 0), i8** %4
br label %47
15: ; preds = %10
store i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.2, i64 0, i64 0), i8** %4
br label %47
16: ; preds = %3
store i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.3, i64 0, i64 0), i8** %4
br label %47
17: ; preds = %3
store i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.4, i64 0, i64 0), i8** %4
br label %47
18: ; preds = %3
%19 = load i32, i32* %6
%20 = icmp eq i32 %19, 64
br i1 %20, label %21, label %22
21: ; preds = %18
store i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.5, i64 0, i64 0), i8** %4
br label %47
22: ; preds = %18
%23 = load i32, i32* %7
%24 = and i32 %23, 32
%25 = icmp ne i32 %24, 0
br i1 %25, label %26, label %27
26: ; preds = %22
store i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.6, i64 0, i64 0), i8** %4
br label %47
27: ; preds = %22
store i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.7, i64 0, i64 0), i8** %4
br label %47
28: ; preds = %3
store i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.8, i64 0, i64 0), i8** %4
br label %47
29: ; preds = %3
store i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.9, i64 0, i64 0), i8** %4
br label %47
30: ; preds = %3
store i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.10, i64 0, i64 0), i8** %4
br label %47
31: ; preds = %3
store i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.11, i64 0, i64 0), i8** %4
br label %47
32: ; preds = %3
%33 = load i32, i32* %6
%34 = icmp eq i32 %33, 64
br i1 %34, label %35, label %36
35: ; preds = %32
store i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.12, i64 0, i64 0), i8** %4
br label %47
36: ; preds = %32
store i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.13, i64 0, i64 0), i8** %4
br label %47
37: ; preds = %3
store i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.14, i64 0, i64 0), i8** %4
br label %47
38: ; preds = %3
store i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.15, i64 0, i64 0), i8** %4
br label %47
39: ; preds = %3
store i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.16, i64 0, i64 0), i8** %4
br label %47
40: ; preds = %3
store i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.17, i64 0, i64 0), i8** %4
br label %47
41: ; preds = %3
%42 = load i32, i32* %6
%43 = icmp eq i32 %42, 64
br i1 %43, label %44, label %45
44: ; preds = %41
store i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.18, i64 0, i64 0), i8** %4
br label %47
45: ; preds = %41
store i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.19, i64 0, i64 0), i8** %4
br label %47
46: ; preds = %3
store i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.20, i64 0, i64 0), i8** %4
br label %47
47: ; preds = %46, %45, %44, %40, %39, %38, %37, %36, %35, %31, %30, %29, %28, %27, %26, %21, %17, %16, %15, %14, %9
%48 = load i8*, i8** %4
ret i8* %48
}

LLVM IR (-O2):
@.str = [9 x i8] c"alpha_64\00"
@.str.1 = [9 x i8] c"arm_eabi\00"
@.str.2 = [9 x i8] c"arm_oabi\00"
@.str.3 = [7 x i8] c"arm_64\00"
@.str.4 = [8 x i8] c"m68k_32\00"
@.str.5 = [9 x i8] c"mips_n64\00"
@.str.6 = [9 x i8] c"mips_n32\00"
@.str.7 = [9 x i8] c"mips_o32\00"
@.str.8 = [6 x i8] c"ia_64\00"
@.str.9 = [8 x i8] c"hppa_32\00"
@.str.10 = [7 x i8] c"ppc_32\00"
@.str.11 = [7 x i8] c"ppc_64\00"
@.str.12 = [8 x i8] c"s390_64\00"
@.str.13 = [8 x i8] c"s390_32\00"
@.str.14 = [6 x i8] c"sh_32\00"
@.str.15 = [9 x i8] c"sparc_32\00"
@.str.16 = [9 x i8] c"sparc_64\00"
@.str.17 = [7 x i8] c"x86_32\00"
@.str.18 = [7 x i8] c"x86_64\00"
@.str.19 = [8 x i8] c"x86_x32\00"
@.str.20 = [8 x i8] c"unknown\00"
define i8* @get_abi(i32 %0, i32 %1, i32 %2) {
switch i32 %0, label %29 [
i32 36902, label %30
i32 40, label %4
i32 183, label %7
i32 4, label %8
i32 8, label %9
i32 50, label %15
i32 15, label %16
i32 20, label %17
i32 21, label %18
i32 22, label %19
i32 42, label %22
i32 18, label %23
i32 43, label %24
i32 3, label %25
i32 62, label %26
]
4: ; preds = %3
%5 = icmp ult i32 %2, 16777216
%6 = select i1 %5, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.1, i64 0, i64 0)
br label %30
7: ; preds = %3
br label %30
8: ; preds = %3
br label %30
9: ; preds = %3
%10 = icmp eq i32 %1, 64
br i1 %10, label %30, label %11
11: ; preds = %9
%12 = and i32 %2, 32
%13 = icmp eq i32 %12, 0
%14 = select i1 %13, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.7, i64 0, i64 0), i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.6, i64 0, i64 0)
br label %30
15: ; preds = %3
br label %30
16: ; preds = %3
br label %30
17: ; preds = %3
br label %30
18: ; preds = %3
br label %30
19: ; preds = %3
%20 = icmp eq i32 %1, 64
%21 = select i1 %20, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.12, i64 0, i64 0), i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.13, i64 0, i64 0)
br label %30
22: ; preds = %3
br label %30
23: ; preds = %3
br label %30
24: ; preds = %3
br label %30
25: ; preds = %3
br label %30
26: ; preds = %3
%27 = icmp eq i32 %1, 64
%28 = select i1 %27, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.18, i64 0, i64 0), i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.19, i64 0, i64 0)
br label %30
29: ; preds = %3
br label %30
30: ; preds = %26, %19, %11, %9, %4, %3, %29, %25, %24, %23, %22, %18, %17, %16, %15, %8, %7
%31 = phi i8* [ getelementptr inbounds ([8 x i8], [8 x i8]* @.str.20, i64 0, i64 0), %29 ], [ getelementptr inbounds ([7 x i8], [7 x i8]* @.str.17, i64 0, i64 0), %25 ], [ getelementptr inbounds ([9 x i8], [9 x i8]* @.str.16, i64 0, i64 0), %24 ], [ getelementptr inbounds ([9 x i8], [9 x i8]* @.str.15, i64 0, i64 0), %23 ], [ getelementptr inbounds ([6 x i8], [6 x i8]* @.str.14, i64 0, i64 0), %22 ], [ getelementptr inbounds ([7 x i8], [7 x i8]* @.str.11, i64 0, i64 0), %18 ], [ getelementptr inbounds ([7 x i8], [7 x i8]* @.str.10, i64 0, i64 0), %17 ], [ getelementptr inbounds ([8 x i8], [8 x i8]* @.str.9, i64 0, i64 0), %16 ], [ getelementptr inbounds ([6 x i8], [6 x i8]* @.str.8, i64 0, i64 0), %15 ], [ getelementptr inbounds ([8 x i8], [8 x i8]* @.str.4, i64 0, i64 0), %8 ], [ getelementptr inbounds ([7 x i8], [7 x i8]* @.str.3, i64 0, i64 0), %7 ], [ getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0), %3 ], [ %6, %4 ], [ getelementptr inbounds ([9 x i8], [9 x i8]* @.str.5, i64 0, i64 0), %9 ], [ %14, %11 ], [ %21, %19 ], [ %28, %26 ]
ret i8* %31
}