#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*/ printf(char *, ...);
void print_exit_error(unsigned int error_code, char *error_string) {
  switch (error_code) {
  case 2:
    printf("[ERROR 2] - Can't open file.\n");
    exit(2);
  case 3:
    printf("[ERROR 3] - File size is invalid.\n");
    exit(3);
  case 4:
    printf("[ERROR 4] - Not enough arguments.\n");
    exit(4);
  case 5:
    printf("[ERROR 5] - Unable to init SDL: %s.\n", error_string);
    exit(5);
  case 6:
    printf("[ERROR 6] - Unable to set video: %s.\n", error_string);
    exit(6);
  }
}


x86 assembly (clang, -O0):
<print_exit_error>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x4(%rbp),%eax
add    $0xfffffffe,%eax
mov    %eax,%ecx
mov    %rcx,-0x18(%rbp)
sub    $0x4,%eax
ja     11d8 <print_exit_error+0xb8>
mov    -0x18(%rbp),%rax
lea    0xeb1(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
lea    0xeb5(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    $0x2,%edi
call   1040 <exit@plt>
lea    0xebb(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    $0x3,%edi
call   1040 <exit@plt>
lea    0xec6(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    $0x4,%edi
call   1040 <exit@plt>
mov    -0x10(%rbp),%rsi
lea    0xecd(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    $0x5,%edi
call   1040 <exit@plt>
mov    -0x10(%rbp),%rsi
lea    0xed6(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    $0x6,%edi
call   1040 <exit@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<print_exit_error>:
push   %rax
add    $0xfffffffe,%edi
cmp    $0x4,%edi
jbe    113b <print_exit_error+0xb>
pop    %rax
ret
lea    0xebe(%rip),%rax
movslq (%rax,%rdi,4),%rcx
add    %rax,%rcx
jmp    *%rcx
lea    0xf51(%rip),%rdi
call   1030 <puts@plt>
mov    $0x2,%edi
call   1050 <exit@plt>
lea    0xf19(%rip),%rdi
call   1030 <puts@plt>
mov    $0x3,%edi
call   1050 <exit@plt>
lea    0xee1(%rip),%rdi
call   1030 <puts@plt>
mov    $0x4,%edi
call   1050 <exit@plt>
lea    0xe80(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
mov    $0x5,%edi
call   1050 <exit@plt>
lea    0xe8d(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
mov    $0x6,%edi
call   1050 <exit@plt>

LLVM IR (-O0):
@.str = [30 x i8] c"[ERROR 2] - Can't open file.\0A\00"
@.str.1 = [35 x i8] c"[ERROR 3] - File size is invalid.\0A\00"
@.str.2 = [35 x i8] c"[ERROR 4] - Not enough arguments.\0A\00"
@.str.3 = [37 x i8] c"[ERROR 5] - Unable to init SDL: %s.\0A\00"
@.str.4 = [38 x i8] c"[ERROR 6] - Unable to set video: %s.\0A\00"
define void @print_exit_error(i32 %0, i8* %1) {
%3 = alloca i32
%4 = alloca i8*
store i32 %0, i32* %3
store i8* %1, i8** %4
%5 = load i32, i32* %3
switch i32 %5, label %23 [
i32 2, label %6
i32 3, label %9
i32 4, label %12
i32 5, label %15
i32 6, label %19
]
6: ; preds = %2
%7 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str, i64 0, i64 0))
%8 = call i32 @exit(i32 2)
unreachable
9: ; preds = %2
%10 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str.1, i64 0, i64 0))
%11 = call i32 @exit(i32 3)
unreachable
12: ; preds = %2
%13 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str.2, i64 0, i64 0))
%14 = call i32 @exit(i32 4)
unreachable
15: ; preds = %2
%16 = load i8*, i8** %4
%17 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([37 x i8], [37 x i8]* @.str.3, i64 0, i64 0), i8* %16)
%18 = call i32 @exit(i32 5)
unreachable
19: ; preds = %2
%20 = load i8*, i8** %4
%21 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([38 x i8], [38 x i8]* @.str.4, i64 0, i64 0), i8* %20)
%22 = call i32 @exit(i32 6)
unreachable
23: ; preds = %2
ret void
}

LLVM IR (-O2):
@.str.3 = [37 x i8] c"[ERROR 5] - Unable to init SDL: %s.\0A\00"
@.str.4 = [38 x i8] c"[ERROR 6] - Unable to set video: %s.\0A\00"
@str = [34 x i8] c"[ERROR 4] - Not enough arguments.\00"
@str.5 = [34 x i8] c"[ERROR 3] - File size is invalid.\00"
@str.6 = [29 x i8] c"[ERROR 2] - Can't open file.\00"
define void @print_exit_error(i32 %0, i8* %1) {
switch i32 %0, label %18 [
i32 2, label %3
i32 3, label %6
i32 4, label %9
i32 5, label %12
i32 6, label %15
]
3: ; preds = %2
%4 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([29 x i8], [29 x i8]* @str.6, i64 0, i64 0))
%5 = tail call i32 @exit(i32 2)
unreachable
6: ; preds = %2
%7 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([34 x i8], [34 x i8]* @str.5, i64 0, i64 0))
%8 = tail call i32 @exit(i32 3)
unreachable
9: ; preds = %2
%10 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([34 x i8], [34 x i8]* @str, i64 0, i64 0))
%11 = tail call i32 @exit(i32 4)
unreachable
12: ; preds = %2
%13 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([37 x i8], [37 x i8]* @.str.3, i64 0, i64 0), i8* %1)
%14 = tail call i32 @exit(i32 5)
unreachable
15: ; preds = %2
%16 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([38 x i8], [38 x i8]* @.str.4, i64 0, i64 0), i8* %1)
%17 = tail call i32 @exit(i32 6)
unreachable
18: ; preds = %2
ret void
}