#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 *, char *);
int /*<<< orphan*/ fputs(char *, int /*<<< orphan*/);
int /*<<< orphan*/ stderr;
void print_error_msg(int msg, char *file) {
  switch (msg) {
  case 0:
    break;
  case 1:
    fprintf(stderr, "Fehler beim Oeffnen der Datei %s.\n", file);
    break;
  case 2:
    fprintf(stderr, "Input Error beim Lesen der Datei %s.\n", file);
    break;
  case 3:
    fprintf(stderr, "General Error beim Lesen der Datei %s.\n", file);
    break;
  case 4:
    fprintf(stderr, "Output Error beim Schreiben der Datei %s.\n", file);
    break;
  case 5:
    fprintf(stderr, "Fehler beim Schliessen der Datei %s.\n", file);
    break;
  default:
    fputs("Fehler beim Ausgeben des Fehlers.\n", stderr);
    break;
  }
}


x86 assembly (clang, -O0):
<print_error_msg>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x4(%rbp),%eax
mov    %rax,-0x18(%rbp)
sub    $0x5,%rax
ja     11ef <print_error_msg+0xcf>
mov    -0x18(%rbp),%rax
lea    0xeb5(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
jmp    1204 <print_error_msg+0xe4>
mov    0x2e80(%rip),%rax
mov    (%rax),%edi
mov    -0x10(%rbp),%rdx
lea    0xeab(%rip),%rsi
call   1040 <fprintf@plt>
jmp    1204 <print_error_msg+0xe4>
mov    0x2e62(%rip),%rax
mov    (%rax),%edi
mov    -0x10(%rbp),%rdx
lea    0xeb0(%rip),%rsi
call   1040 <fprintf@plt>
jmp    1204 <print_error_msg+0xe4>
mov    0x2e44(%rip),%rax
mov    (%rax),%edi
mov    -0x10(%rbp),%rdx
lea    0xeb8(%rip),%rsi
call   1040 <fprintf@plt>
jmp    1204 <print_error_msg+0xe4>
mov    0x2e26(%rip),%rax
mov    (%rax),%edi
mov    -0x10(%rbp),%rdx
lea    0xec2(%rip),%rsi
call   1040 <fprintf@plt>
jmp    1204 <print_error_msg+0xe4>
mov    0x2e08(%rip),%rax
mov    (%rax),%edi
mov    -0x10(%rbp),%rdx
lea    0xecf(%rip),%rsi
call   1040 <fprintf@plt>
jmp    1204 <print_error_msg+0xe4>
mov    0x2dea(%rip),%rax
mov    (%rax),%esi
lea    0xedb(%rip),%rdi
call   1030 <fputs@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<print_error_msg>:
cmp    $0x5,%edi
ja     113b <print_error_msg+0x1b>
mov    %rsi,%rdx
mov    %edi,%eax
lea    0xecf(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
ret
mov    0x2e9e(%rip),%rax
mov    (%rax),%esi
lea    0xf8f(%rip),%rdi
jmp    1030 <fputs@plt>
mov    0x2e89(%rip),%rax
mov    (%rax),%edi
lea    0xeb8(%rip),%rsi
jmp    1040 <fprintf@plt>
mov    0x2e74(%rip),%rax
mov    (%rax),%edi
lea    0xec6(%rip),%rsi
jmp    1040 <fprintf@plt>
mov    0x2e5f(%rip),%rax
mov    (%rax),%edi
lea    0xed7(%rip),%rsi
jmp    1040 <fprintf@plt>
mov    0x2e4a(%rip),%rax
mov    (%rax),%edi
lea    0xeea(%rip),%rsi
jmp    1040 <fprintf@plt>
mov    0x2e35(%rip),%rax
mov    (%rax),%edi
lea    0xf00(%rip),%rsi
jmp    1040 <fprintf@plt>

LLVM IR (-O0):
@stderr = global i32 0
@.str = [35 x i8] c"Fehler beim Oeffnen der Datei %s.\0A\00"
@.str.1 = [38 x i8] c"Input Error beim Lesen der Datei %s.\0A\00"
@.str.2 = [40 x i8] c"General Error beim Lesen der Datei %s.\0A\00"
@.str.3 = [43 x i8] c"Output Error beim Schreiben der Datei %s.\0A\00"
@.str.4 = [38 x i8] c"Fehler beim Schliessen der Datei %s.\0A\00"
@.str.5 = [35 x i8] c"Fehler beim Ausgeben des Fehlers.\0A\00"
define void @print_error_msg(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 %27 [
i32 0, label %6
i32 1, label %7
i32 2, label %11
i32 3, label %15
i32 4, label %19
i32 5, label %23
]
6: ; preds = %2
br label %30
7: ; preds = %2
%8 = load i32, i32* @stderr
%9 = load i8*, i8** %4
%10 = call i32 @fprintf(i32 %8, i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str, i64 0, i64 0), i8* %9)
br label %30
11: ; preds = %2
%12 = load i32, i32* @stderr
%13 = load i8*, i8** %4
%14 = call i32 @fprintf(i32 %12, i8* getelementptr inbounds ([38 x i8], [38 x i8]* @.str.1, i64 0, i64 0), i8* %13)
br label %30
15: ; preds = %2
%16 = load i32, i32* @stderr
%17 = load i8*, i8** %4
%18 = call i32 @fprintf(i32 %16, i8* getelementptr inbounds ([40 x i8], [40 x i8]* @.str.2, i64 0, i64 0), i8* %17)
br label %30
19: ; preds = %2
%20 = load i32, i32* @stderr
%21 = load i8*, i8** %4
%22 = call i32 @fprintf(i32 %20, i8* getelementptr inbounds ([43 x i8], [43 x i8]* @.str.3, i64 0, i64 0), i8* %21)
br label %30
23: ; preds = %2
%24 = load i32, i32* @stderr
%25 = load i8*, i8** %4
%26 = call i32 @fprintf(i32 %24, i8* getelementptr inbounds ([38 x i8], [38 x i8]* @.str.4, i64 0, i64 0), i8* %25)
br label %30
27: ; preds = %2
%28 = load i32, i32* @stderr
%29 = call i32 @fputs(i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str.5, i64 0, i64 0), i32 %28)
br label %30
30: ; preds = %27, %23, %19, %15, %11, %7, %6
ret void
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [35 x i8] c"Fehler beim Oeffnen der Datei %s.\0A\00"
@.str.1 = [38 x i8] c"Input Error beim Lesen der Datei %s.\0A\00"
@.str.2 = [40 x i8] c"General Error beim Lesen der Datei %s.\0A\00"
@.str.3 = [43 x i8] c"Output Error beim Schreiben der Datei %s.\0A\00"
@.str.4 = [38 x i8] c"Fehler beim Schliessen der Datei %s.\0A\00"
@.str.5 = [35 x i8] c"Fehler beim Ausgeben des Fehlers.\0A\00"
define void @print_error_msg(i32 %0, i8* %1) {
switch i32 %0, label %18 [
i32 0, label %21
i32 1, label %3
i32 2, label %6
i32 3, label %9
i32 4, label %12
i32 5, label %15
]
3: ; preds = %2
%4 = load i32, i32* @stderr
%5 = tail call i32 @fprintf(i32 %4, i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str, i64 0, i64 0), i8* %1)
br label %21
6: ; preds = %2
%7 = load i32, i32* @stderr
%8 = tail call i32 @fprintf(i32 %7, i8* getelementptr inbounds ([38 x i8], [38 x i8]* @.str.1, i64 0, i64 0), i8* %1)
br label %21
9: ; preds = %2
%10 = load i32, i32* @stderr
%11 = tail call i32 @fprintf(i32 %10, i8* getelementptr inbounds ([40 x i8], [40 x i8]* @.str.2, i64 0, i64 0), i8* %1)
br label %21
12: ; preds = %2
%13 = load i32, i32* @stderr
%14 = tail call i32 @fprintf(i32 %13, i8* getelementptr inbounds ([43 x i8], [43 x i8]* @.str.3, i64 0, i64 0), i8* %1)
br label %21
15: ; preds = %2
%16 = load i32, i32* @stderr
%17 = tail call i32 @fprintf(i32 %16, i8* getelementptr inbounds ([38 x i8], [38 x i8]* @.str.4, i64 0, i64 0), i8* %1)
br label %21
18: ; preds = %2
%19 = load i32, i32* @stderr
%20 = tail call i32 @fputs(i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str.5, i64 0, i64 0), i32 %19)
br label %21
21: ; preds = %18, %15, %12, %9, %6, %3, %2
ret void
}