#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*/ fprintf(int /*<<< orphan*/, char *);
int /*<<< orphan*/ stderr;
void exeknow_error(int type) {
  switch (type) {
  case (-1):
    fprintf(stderr, "Cannot open file.\n");
    exit(-1);
    break;
  case (-2):
    fprintf(stderr, "Cannot read file.\n");
    exit(-2);
    break;
  case (-3):
    fprintf(stderr, "Data size mismatch.\n");
    exit(-3);
    break;
  default:
    fprintf(stderr, "Unknown error.\n");
    exit(-4);
  }
}


x86 assembly (clang, -O0):
<exeknow_error>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%eax
mov    %eax,-0x8(%rbp)
sub    $0xfffffffd,%eax
je     119f <exeknow_error+0x7f>
jmp    113f <exeknow_error+0x1f>
mov    -0x8(%rbp),%eax
sub    $0xfffffffe,%eax
je     1180 <exeknow_error+0x60>
jmp    1150 <exeknow_error+0x30>
mov    -0x8(%rbp),%eax
sub    $0xffffffff,%eax
jne    11be <exeknow_error+0x9e>
jmp    1161 <exeknow_error+0x41>
mov    0x2e78(%rip),%rax
mov    (%rax),%edi
lea    0xe8f(%rip),%rsi
call   1030 <fprintf@plt>
mov    $0xffffffff,%edi
call   1040 <exit@plt>
mov    0x2e59(%rip),%rax
mov    (%rax),%edi
lea    0xe83(%rip),%rsi
call   1030 <fprintf@plt>
mov    $0xfffffffe,%edi
call   1040 <exit@plt>
mov    0x2e3a(%rip),%rax
mov    (%rax),%edi
lea    0xe77(%rip),%rsi
call   1030 <fprintf@plt>
mov    $0xfffffffd,%edi
call   1040 <exit@plt>
mov    0x2e1b(%rip),%rax
mov    (%rax),%edi
lea    0xe6d(%rip),%rsi
call   1030 <fprintf@plt>
mov    $0xfffffffc,%edi
call   1040 <exit@plt>

x86 assembly (clang, -O2):
<exeknow_error>:
push   %rax
mov    0x2eb8(%rip),%rax
cmp    $0xfffffffd,%edi
je     114f <exeknow_error+0x2f>
cmp    $0xfffffffe,%edi
je     1167 <exeknow_error+0x47>
cmp    $0xffffffff,%edi
jne    117f <exeknow_error+0x5f>
mov    (%rax),%edi
lea    0xec0(%rip),%rsi
call   1030 <fprintf@plt>
mov    $0xffffffff,%edi
call   1040 <exit@plt>
mov    (%rax),%edi
lea    0xece(%rip),%rsi
call   1030 <fprintf@plt>
mov    $0xfffffffd,%edi
call   1040 <exit@plt>
mov    (%rax),%edi
lea    0xea3(%rip),%rsi
call   1030 <fprintf@plt>
mov    $0xfffffffe,%edi
call   1040 <exit@plt>
mov    (%rax),%edi
lea    0xeb3(%rip),%rsi
call   1030 <fprintf@plt>
mov    $0xfffffffc,%edi
call   1040 <exit@plt>

LLVM IR (-O0):
@stderr = global i32 0
@.str = [19 x i8] c"Cannot open file.\0A\00"
@.str.1 = [19 x i8] c"Cannot read file.\0A\00"
@.str.2 = [21 x i8] c"Data size mismatch.\0A\00"
@.str.3 = [16 x i8] c"Unknown error.\0A\00"
define void @exeknow_error(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
switch i32 %3, label %16 [
i32 -1, label %4
i32 -2, label %8
i32 -3, label %12
]
4: ; preds = %1
%5 = load i32, i32* @stderr
%6 = call i32 @fprintf(i32 %5, i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str, i64 0, i64 0))
%7 = call i32 @exit(i32 -1)
unreachable
8: ; preds = %1
%9 = load i32, i32* @stderr
%10 = call i32 @fprintf(i32 %9, i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.1, i64 0, i64 0))
%11 = call i32 @exit(i32 -2)
unreachable
12: ; preds = %1
%13 = load i32, i32* @stderr
%14 = call i32 @fprintf(i32 %13, i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.2, i64 0, i64 0))
%15 = call i32 @exit(i32 -3)
unreachable
16: ; preds = %1
%17 = load i32, i32* @stderr
%18 = call i32 @fprintf(i32 %17, i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.3, i64 0, i64 0))
%19 = call i32 @exit(i32 -4)
unreachable
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [19 x i8] c"Cannot open file.\0A\00"
@.str.1 = [19 x i8] c"Cannot read file.\0A\00"
@.str.2 = [21 x i8] c"Data size mismatch.\0A\00"
@.str.3 = [16 x i8] c"Unknown error.\0A\00"
define void @exeknow_error(i32 %0) {
switch i32 %0, label %14 [
i32 -1, label %2
i32 -2, label %6
i32 -3, label %10
]
2: ; preds = %1
%3 = load i32, i32* @stderr
%4 = tail call i32 @fprintf(i32 %3, i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str, i64 0, i64 0))
%5 = tail call i32 @exit(i32 -1)
unreachable
6: ; preds = %1
%7 = load i32, i32* @stderr
%8 = tail call i32 @fprintf(i32 %7, i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.1, i64 0, i64 0))
%9 = tail call i32 @exit(i32 -2)
unreachable
10: ; preds = %1
%11 = load i32, i32* @stderr
%12 = tail call i32 @fprintf(i32 %11, i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.2, i64 0, i64 0))
%13 = tail call i32 @exit(i32 -3)
unreachable
14: ; preds = %1
%15 = load i32, i32* @stderr
%16 = tail call i32 @fprintf(i32 %15, i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.3, i64 0, i64 0))
%17 = tail call i32 @exit(i32 -4)
unreachable
}