#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 /*<<< orphan*/ exit(int);
int /*<<< orphan*/ puts(char *);
void quit(int rsn) {
  switch (rsn) {
  case 1:
    puts("Could not open file\n");
    break;
  case 2:
    puts("Could not read file\n");
    break;
  case 3:
    puts("Could not write file\n");
    break;
  case 4:
    puts("Not enough memory\n");
    break;
  case 5:
    puts("Could not open temporary\n");
    break;
  case 6:
    puts("Could not write temporary\n");
    break;
  case 7:
    puts("Could not read target\n");
    break;
  case 8:
    puts("Unsupported operation\n");
    break;
  }
  exit(-1);
}


x86 assembly (clang, -O0):
<quit>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,%ecx
mov    %rcx,-0x10(%rbp)
sub    $0x7,%eax
ja     11d7 <quit+0xb7>
mov    -0x10(%rbp),%rax
lea    0xeb5(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
lea    0xec5(%rip),%rdi
call   1030 <puts@plt>
jmp    11d7 <quit+0xb7>
lea    0xec9(%rip),%rdi
call   1030 <puts@plt>
jmp    11d7 <quit+0xb7>
lea    0xecd(%rip),%rdi
call   1030 <puts@plt>
jmp    11d7 <quit+0xb7>
lea    0xed2(%rip),%rdi
call   1030 <puts@plt>
jmp    11d7 <quit+0xb7>
lea    0xed4(%rip),%rdi
call   1030 <puts@plt>
jmp    11d7 <quit+0xb7>
lea    0xedd(%rip),%rdi
call   1030 <puts@plt>
jmp    11d7 <quit+0xb7>
lea    0xee7(%rip),%rdi
call   1030 <puts@plt>
jmp    11d7 <quit+0xb7>
lea    0xeed(%rip),%rdi
call   1030 <puts@plt>
mov    $0xffffffff,%edi
call   1040 <exit@plt>

x86 assembly (clang, -O2):
<quit>:
push   %rax
add    $0xffffffff,%edi
cmp    $0x7,%edi
ja     113f <quit+0x1f>
movslq %edi,%rax
lea    0xf85(%rip),%rcx
movslq (%rcx,%rax,4),%rdi
add    %rcx,%rdi
call   1030 <puts@plt>
mov    $0xffffffff,%edi
call   1040 <exit@plt>

LLVM IR (-O0):
@.str = [21 x i8] c"Could not open file\0A\00"
@.str.1 = [21 x i8] c"Could not read file\0A\00"
@.str.2 = [22 x i8] c"Could not write file\0A\00"
@.str.3 = [19 x i8] c"Not enough memory\0A\00"
@.str.4 = [26 x i8] c"Could not open temporary\0A\00"
@.str.5 = [27 x i8] c"Could not write temporary\0A\00"
@.str.6 = [23 x i8] c"Could not read target\0A\00"
@.str.7 = [23 x i8] c"Unsupported operation\0A\00"
define void @quit(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
switch i32 %3, label %20 [
i32 1, label %4
i32 2, label %6
i32 3, label %8
i32 4, label %10
i32 5, label %12
i32 6, label %14
i32 7, label %16
i32 8, label %18
]
4: ; preds = %1
%5 = call i32 @puts(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str, i64 0, i64 0))
br label %20
6: ; preds = %1
%7 = call i32 @puts(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.1, i64 0, i64 0))
br label %20
8: ; preds = %1
%9 = call i32 @puts(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.2, i64 0, i64 0))
br label %20
10: ; preds = %1
%11 = call i32 @puts(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.3, i64 0, i64 0))
br label %20
12: ; preds = %1
%13 = call i32 @puts(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.4, i64 0, i64 0))
br label %20
14: ; preds = %1
%15 = call i32 @puts(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.5, i64 0, i64 0))
br label %20
16: ; preds = %1
%17 = call i32 @puts(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.6, i64 0, i64 0))
br label %20
18: ; preds = %1
%19 = call i32 @puts(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.7, i64 0, i64 0))
br label %20
20: ; preds = %1, %18, %16, %14, %12, %10, %8, %6, %4
%21 = call i32 @exit(i32 -1)
unreachable
}

LLVM IR (-O2):
@.str = [21 x i8] c"Could not open file\0A\00"
@.str.1 = [21 x i8] c"Could not read file\0A\00"
@.str.2 = [22 x i8] c"Could not write file\0A\00"
@.str.3 = [19 x i8] c"Not enough memory\0A\00"
@.str.4 = [26 x i8] c"Could not open temporary\0A\00"
@.str.5 = [27 x i8] c"Could not write temporary\0A\00"
@.str.6 = [23 x i8] c"Could not read target\0A\00"
@.str.7 = [23 x i8] c"Unsupported operation\0A\00"
@reltable.quit = [8 x i32] [i32 trunc (i64 sub (i64 ptrtoint ([21 x i8]* @.str to i64), i64 ptrtoint ([8 x i32]* @reltable.quit to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([21 x i8]* @.str.1 to i64), i64 ptrtoint ([8 x i32]* @reltable.quit to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([22 x i8]* @.str.2 to i64), i64 ptrtoint ([8 x i32]* @reltable.quit to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([19 x i8]* @.str.3 to i64), i64 ptrtoint ([8 x i32]* @reltable.quit to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([26 x i8]* @.str.4 to i64), i64 ptrtoint ([8 x i32]* @reltable.quit to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([27 x i8]* @.str.5 to i64), i64 ptrtoint ([8 x i32]* @reltable.quit to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([23 x i8]* @.str.6 to i64), i64 ptrtoint ([8 x i32]* @reltable.quit to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([23 x i8]* @.str.7 to i64), i64 ptrtoint ([8 x i32]* @reltable.quit to i64)) to i32)]
define void @quit(i32 %0) {
%2 = add i32 %0, -1
%3 = icmp ult i32 %2, 8
br i1 %3, label %4, label %9
4: ; preds = %1
%5 = sext i32 %2 to i64
%6 = shl i64 %5, 2
%7 = call i8* @llvm.load.relative.i64(i8* bitcast ([8 x i32]* @reltable.quit to i8*), i64 %6)
%8 = tail call i32 @puts(i8* dereferenceable(1) %7)
br label %9
9: ; preds = %1, %4
%10 = tail call i32 @exit(i32 -1)
unreachable
}