#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*/ fprintf(int /*<<< orphan*/, char *);
int /*<<< orphan*/ stderr;
void print_error_message(int errval) {
  if (errval < 0) {
    switch (errval) {
    case 0:
      break;
    case -2:
      fprintf(stderr, "Drive not ready.\n");
      break;
    case -3:
      fprintf(stderr, "Image file has changed on disk.\n");
      break;
    case -4:
      fprintf(stderr, "Cannot read file.\n");
      break;
    case -5:
      fprintf(stderr, "Cannot write file.\n");
      break;
    case -6:
      fprintf(stderr, "Floppy write failed.\n");
      break;
    case -7:
      fprintf(stderr, "Floppy read failed.\n");
      break;
    case -8:
      fprintf(stderr, "Incompatible DOS version.\n");
      break;
    case -9:
      fprintf(stderr, "Invalid image.\n");
      break;
    case -10:
      fprintf(stderr, "Invalid filename.\n");
      break;
    case -11:
      fprintf(stderr, "Illegal value.\n");
      break;
    case -12:
      fprintf(stderr, "Illegal device number.\n");
      break;
    case -13:
      fprintf(stderr, "Inaccessible Track or Sector.\n");
      break;
    default:
      fprintf(stderr, "Unknown error.\n");
    }
  }
}


x86 assembly (clang, -O0):
<print_error_message>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
cmpl   $0x0,-0x4(%rbp)
jge    12a5 <print_error_message+0x195>
mov    -0x4(%rbp),%eax
add    $0xd,%eax
mov    %eax,%ecx
mov    %rcx,-0x10(%rbp)
sub    $0xd,%eax
ja     128b <print_error_message+0x17b>
mov    -0x10(%rbp),%rax
lea    0xebb(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
jmp    12a0 <print_error_message+0x190>
mov    0x2e86(%rip),%rax
mov    (%rax),%edi
lea    0xed5(%rip),%rsi
call   1030 <fprintf@plt>
jmp    12a0 <print_error_message+0x190>
mov    0x2e6c(%rip),%rax
mov    (%rax),%edi
lea    0xecd(%rip),%rsi
call   1030 <fprintf@plt>
jmp    12a0 <print_error_message+0x190>
mov    0x2e52(%rip),%rax
mov    (%rax),%edi
lea    0xed4(%rip),%rsi
call   1030 <fprintf@plt>
jmp    12a0 <print_error_message+0x190>
mov    0x2e38(%rip),%rax
mov    (%rax),%edi
lea    0xecd(%rip),%rsi
call   1030 <fprintf@plt>
jmp    12a0 <print_error_message+0x190>
mov    0x2e1e(%rip),%rax
mov    (%rax),%edi
lea    0xec7(%rip),%rsi
call   1030 <fprintf@plt>
jmp    12a0 <print_error_message+0x190>
mov    0x2e04(%rip),%rax
mov    (%rax),%edi
lea    0xec3(%rip),%rsi
call   1030 <fprintf@plt>
jmp    12a0 <print_error_message+0x190>
mov    0x2dea(%rip),%rax
mov    (%rax),%edi
lea    0xebe(%rip),%rsi
call   1030 <fprintf@plt>
jmp    12a0 <print_error_message+0x190>
mov    0x2dd0(%rip),%rax
mov    (%rax),%edi
lea    0xebf(%rip),%rsi
call   1030 <fprintf@plt>
jmp    12a0 <print_error_message+0x190>
mov    0x2db6(%rip),%rax
mov    (%rax),%edi
lea    0xeb5(%rip),%rsi
call   1030 <fprintf@plt>
jmp    12a0 <print_error_message+0x190>
mov    0x2d9c(%rip),%rax
mov    (%rax),%edi
lea    0xeae(%rip),%rsi
call   1030 <fprintf@plt>
jmp    12a0 <print_error_message+0x190>
mov    0x2d82(%rip),%rax
mov    (%rax),%edi
lea    0xea4(%rip),%rsi
call   1030 <fprintf@plt>
jmp    12a0 <print_error_message+0x190>
mov    0x2d68(%rip),%rax
mov    (%rax),%edi
lea    0xea2(%rip),%rsi
call   1030 <fprintf@plt>
jmp    12a0 <print_error_message+0x190>
mov    0x2d4e(%rip),%rax
mov    (%rax),%edi
lea    0xea7(%rip),%rsi
call   1030 <fprintf@plt>
jmp    12a5 <print_error_message+0x195>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<print_error_message>:
test   %edi,%edi
js     1115 <print_error_message+0x5>
ret
add    $0xd,%edi
cmp    $0xb,%edi
ja     1130 <print_error_message+0x20>
movslq %edi,%rax
lea    0xff5(%rip),%rcx
movslq (%rcx,%rax,4),%rsi
add    %rcx,%rsi
jmp    1137 <print_error_message+0x27>
lea    0xfd3(%rip),%rsi
mov    0x2ea2(%rip),%rax
mov    (%rax),%edi
jmp    1030 <fprintf@plt>

LLVM IR (-O0):
@stderr = global i32 0
@.str = [18 x i8] c"Drive not ready.\0A\00"
@.str.1 = [33 x i8] c"Image file has changed on disk.\0A\00"
@.str.2 = [19 x i8] c"Cannot read file.\0A\00"
@.str.3 = [20 x i8] c"Cannot write file.\0A\00"
@.str.4 = [22 x i8] c"Floppy write failed.\0A\00"
@.str.5 = [21 x i8] c"Floppy read failed.\0A\00"
@.str.6 = [27 x i8] c"Incompatible DOS version.\0A\00"
@.str.7 = [16 x i8] c"Invalid image.\0A\00"
@.str.8 = [19 x i8] c"Invalid filename.\0A\00"
@.str.9 = [16 x i8] c"Illegal value.\0A\00"
@.str.10 = [24 x i8] c"Illegal device number.\0A\00"
@.str.11 = [31 x i8] c"Inaccessible Track or Sector.\0A\00"
@.str.12 = [16 x i8] c"Unknown error.\0A\00"
define void @print_error_message(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 %48
5: ; preds = %1
%6 = load i32, i32* %2
switch i32 %6, label %44 [
i32 0, label %7
i32 -2, label %8
i32 -3, label %11
i32 -4, label %14
i32 -5, label %17
i32 -6, label %20
i32 -7, label %23
i32 -8, label %26
i32 -9, label %29
i32 -10, label %32
i32 -11, label %35
i32 -12, label %38
i32 -13, label %41
]
7: ; preds = %5
br label %47
8: ; preds = %5
%9 = load i32, i32* @stderr
%10 = call i32 @fprintf(i32 %9, i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str, i64 0, i64 0))
br label %47
11: ; preds = %5
%12 = load i32, i32* @stderr
%13 = call i32 @fprintf(i32 %12, i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str.1, i64 0, i64 0))
br label %47
14: ; preds = %5
%15 = load i32, i32* @stderr
%16 = call i32 @fprintf(i32 %15, i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.2, i64 0, i64 0))
br label %47
17: ; preds = %5
%18 = load i32, i32* @stderr
%19 = call i32 @fprintf(i32 %18, i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.3, i64 0, i64 0))
br label %47
20: ; preds = %5
%21 = load i32, i32* @stderr
%22 = call i32 @fprintf(i32 %21, i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.4, i64 0, i64 0))
br label %47
23: ; preds = %5
%24 = load i32, i32* @stderr
%25 = call i32 @fprintf(i32 %24, i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.5, i64 0, i64 0))
br label %47
26: ; preds = %5
%27 = load i32, i32* @stderr
%28 = call i32 @fprintf(i32 %27, i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.6, i64 0, i64 0))
br label %47
29: ; preds = %5
%30 = load i32, i32* @stderr
%31 = call i32 @fprintf(i32 %30, i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.7, i64 0, i64 0))
br label %47
32: ; preds = %5
%33 = load i32, i32* @stderr
%34 = call i32 @fprintf(i32 %33, i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.8, i64 0, i64 0))
br label %47
35: ; preds = %5
%36 = load i32, i32* @stderr
%37 = call i32 @fprintf(i32 %36, i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.9, i64 0, i64 0))
br label %47
38: ; preds = %5
%39 = load i32, i32* @stderr
%40 = call i32 @fprintf(i32 %39, i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.10, i64 0, i64 0))
br label %47
41: ; preds = %5
%42 = load i32, i32* @stderr
%43 = call i32 @fprintf(i32 %42, i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str.11, i64 0, i64 0))
br label %47
44: ; preds = %5
%45 = load i32, i32* @stderr
%46 = call i32 @fprintf(i32 %45, i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.12, i64 0, i64 0))
br label %47
47: ; preds = %44, %41, %38, %35, %32, %29, %26, %23, %20, %17, %14, %11, %8, %7
br label %48
48: ; preds = %47, %1
ret void
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [18 x i8] c"Drive not ready.\0A\00"
@.str.1 = [33 x i8] c"Image file has changed on disk.\0A\00"
@.str.2 = [19 x i8] c"Cannot read file.\0A\00"
@.str.3 = [20 x i8] c"Cannot write file.\0A\00"
@.str.4 = [22 x i8] c"Floppy write failed.\0A\00"
@.str.5 = [21 x i8] c"Floppy read failed.\0A\00"
@.str.6 = [27 x i8] c"Incompatible DOS version.\0A\00"
@.str.7 = [16 x i8] c"Invalid image.\0A\00"
@.str.8 = [19 x i8] c"Invalid filename.\0A\00"
@.str.9 = [16 x i8] c"Illegal value.\0A\00"
@.str.10 = [24 x i8] c"Illegal device number.\0A\00"
@.str.11 = [31 x i8] c"Inaccessible Track or Sector.\0A\00"
@.str.12 = [16 x i8] c"Unknown error.\0A\00"
@reltable.print_error_message = [12 x i32] [i32 trunc (i64 sub (i64 ptrtoint ([31 x i8]* @.str.11 to i64), i64 ptrtoint ([12 x i32]* @reltable.print_error_message to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([24 x i8]* @.str.10 to i64), i64 ptrtoint ([12 x i32]* @reltable.print_error_message to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([16 x i8]* @.str.9 to i64), i64 ptrtoint ([12 x i32]* @reltable.print_error_message to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([19 x i8]* @.str.8 to i64), i64 ptrtoint ([12 x i32]* @reltable.print_error_message to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([16 x i8]* @.str.7 to i64), i64 ptrtoint ([12 x i32]* @reltable.print_error_message to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([27 x i8]* @.str.6 to i64), i64 ptrtoint ([12 x i32]* @reltable.print_error_message to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([21 x i8]* @.str.5 to i64), i64 ptrtoint ([12 x i32]* @reltable.print_error_message to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([22 x i8]* @.str.4 to i64), i64 ptrtoint ([12 x i32]* @reltable.print_error_message to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([20 x i8]* @.str.3 to i64), i64 ptrtoint ([12 x i32]* @reltable.print_error_message to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([19 x i8]* @.str.2 to i64), i64 ptrtoint ([12 x i32]* @reltable.print_error_message to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([33 x i8]* @.str.1 to i64), i64 ptrtoint ([12 x i32]* @reltable.print_error_message to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([18 x i8]* @.str to i64), i64 ptrtoint ([12 x i32]* @reltable.print_error_message to i64)) to i32)]
define void @print_error_message(i32 %0) {
%2 = icmp slt i32 %0, 0
br i1 %2, label %3, label %14
3: ; preds = %1
%4 = add i32 %0, 13
%5 = icmp ult i32 %4, 12
br i1 %5, label %6, label %10
6: ; preds = %3
%7 = sext i32 %4 to i64
%8 = shl i64 %7, 2
%9 = call i8* @llvm.load.relative.i64(i8* bitcast ([12 x i32]* @reltable.print_error_message to i8*), i64 %8)
br label %10
10: ; preds = %3, %6
%11 = phi i8* [ %9, %6 ], [ getelementptr inbounds ([16 x i8], [16 x i8]* @.str.12, i64 0, i64 0), %3 ]
%12 = load i32, i32* @stderr
%13 = tail call i32 @fprintf(i32 %12, i8* %11)
br label %14
14: ; preds = %10, %1
ret void
}