#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 error(int n) {
  if (n != 0)
    printf("Error: ");
  switch (n) {
  case 1:
    printf("File not found.\n");
    break;
  case 2:
    printf("Must be a .SP, .SNA or .Z80 file.\n");
    break;
  case 3:
    printf("It doesn't seem to be a PAW game.\n");
    break;
  case 4:
    printf("Parameter missing.\n");
    break;
  case 5:
    printf("The .Z80 format version of this file is not valid. Try using "
           "spconv to convert to .SNA or .SP\n");
    break;
  case 6:
    printf("The .Z80 file is not a 48K snapshot.\n");
    break;
  }
  exit(n);
}


x86 assembly (clang, -O0):
<error>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
cmpl   $0x0,-0x4(%rbp)
je     1141 <error+0x21>
lea    0xedc(%rip),%rdi
call   1030 <printf@plt>
mov    -0x4(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,%ecx
mov    %rcx,-0x10(%rbp)
sub    $0x5,%eax
ja     11cb <error+0xab>
mov    -0x10(%rbp),%rax
lea    0xe9f(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
lea    0xeaf(%rip),%rdi
call   1030 <printf@plt>
jmp    11cb <error+0xab>
lea    0xeaf(%rip),%rdi
call   1030 <printf@plt>
jmp    11cb <error+0xab>
lea    0xec1(%rip),%rdi
call   1030 <printf@plt>
jmp    11cb <error+0xab>
lea    0xed3(%rip),%rdi
call   1030 <printf@plt>
jmp    11cb <error+0xab>
lea    0xed6(%rip),%rdi
call   1030 <printf@plt>
jmp    11cb <error+0xab>
lea    0xf24(%rip),%rdi
call   1030 <printf@plt>
mov    -0x4(%rbp),%edi
call   1040 <exit@plt>

x86 assembly (clang, -O2):
<error>:
push   %rbx
mov    %edi,%ebx
test   %edi,%edi
je     1160 <error+0x30>
lea    0xec2(%rip),%rdi
call   1040 <printf@plt>
lea    -0x1(%rbx),%eax
cmp    $0x5,%eax
ja     1160 <error+0x30>
cltq
lea    0xfa0(%rip),%rcx
movslq (%rcx,%rax,4),%rdi
add    %rcx,%rdi
call   1030 <puts@plt>
mov    %ebx,%edi
call   1050 <exit@plt>

LLVM IR (-O0):
@.str = [8 x i8] c"Error: \00"
@.str.1 = [17 x i8] c"File not found.\0A\00"
@.str.2 = [35 x i8] c"Must be a .SP, .SNA or .Z80 file.\0A\00"
@.str.3 = [35 x i8] c"It doesn't seem to be a PAW game.\0A\00"
@.str.4 = [20 x i8] c"Parameter missing.\0A\00"
@.str.5 = [95 x i8] c"The .Z80 format version of this file is not valid. Try using spconv to convert to .SNA or .SP\0A\00"
@.str.6 = [38 x i8] c"The .Z80 file is not a 48K snapshot.\0A\00"
define void @error(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = icmp ne i32 %3, 0
br i1 %4, label %5, label %7
5: ; preds = %1
%6 = call i32 @printf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0))
br label %7
7: ; preds = %5, %1
%8 = load i32, i32* %2
switch i32 %8, label %21 [
i32 1, label %9
i32 2, label %11
i32 3, label %13
i32 4, label %15
i32 5, label %17
i32 6, label %19
]
9: ; preds = %7
%10 = call i32 @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.1, i64 0, i64 0))
br label %21
11: ; preds = %7
%12 = call i32 @printf(i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str.2, i64 0, i64 0))
br label %21
13: ; preds = %7
%14 = call i32 @printf(i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str.3, i64 0, i64 0))
br label %21
15: ; preds = %7
%16 = call i32 @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.4, i64 0, i64 0))
br label %21
17: ; preds = %7
%18 = call i32 @printf(i8* getelementptr inbounds ([95 x i8], [95 x i8]* @.str.5, i64 0, i64 0))
br label %21
19: ; preds = %7
%20 = call i32 @printf(i8* getelementptr inbounds ([38 x i8], [38 x i8]* @.str.6, i64 0, i64 0))
br label %21
21: ; preds = %7, %19, %17, %15, %13, %11, %9
%22 = load i32, i32* %2
%23 = call i32 @exit(i32 %22)
unreachable
}

LLVM IR (-O2):
@.str = [8 x i8] c"Error: \00"
@str = [37 x i8] c"The .Z80 file is not a 48K snapshot.\00"
@str.7 = [94 x i8] c"The .Z80 format version of this file is not valid. Try using spconv to convert to .SNA or .SP\00"
@str.8 = [19 x i8] c"Parameter missing.\00"
@str.9 = [34 x i8] c"It doesn't seem to be a PAW game.\00"
@str.10 = [34 x i8] c"Must be a .SP, .SNA or .Z80 file.\00"
@str.11 = [16 x i8] c"File not found.\00"
@reltable.error = [6 x i32] [i32 trunc (i64 sub (i64 ptrtoint ([16 x i8]* @str.11 to i64), i64 ptrtoint ([6 x i32]* @reltable.error to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([34 x i8]* @str.10 to i64), i64 ptrtoint ([6 x i32]* @reltable.error to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([34 x i8]* @str.9 to i64), i64 ptrtoint ([6 x i32]* @reltable.error to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([19 x i8]* @str.8 to i64), i64 ptrtoint ([6 x i32]* @reltable.error to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([94 x i8]* @str.7 to i64), i64 ptrtoint ([6 x i32]* @reltable.error to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([37 x i8]* @str to i64), i64 ptrtoint ([6 x i32]* @reltable.error to i64)) to i32)]
define void @error(i32 %0) {
%2 = icmp eq i32 %0, 0
br i1 %2, label %12, label %3
3: ; preds = %1
%4 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0))
%5 = add i32 %0, -1
%6 = icmp ult i32 %5, 6
br i1 %6, label %7, label %12
7: ; preds = %3
%8 = sext i32 %5 to i64
%9 = shl i64 %8, 2
%10 = call i8* @llvm.load.relative.i64(i8* bitcast ([6 x i32]* @reltable.error to i8*), i64 %9)
%11 = tail call i32 @puts(i8* dereferenceable(1) %10)
br label %12
12: ; preds = %3, %7, %1
%13 = tail call i32 @exit(i32 %0)
unreachable
}