#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 error(int code, const char *function) {
  fprintf(stderr, "%s: ", function);
  switch (code) {
  case 10:
    fprintf(stderr, "Out of memory\n");
    break;
  case 20:
    fprintf(stderr, "Empty queue\n");
    break;
  case 30:
    fprintf(stderr, "Empty stack\n");
    break;
  case 21:
    fprintf(stderr, "Unitialized queue\n");
    break;
  case 31:
    fprintf(stderr, "Unitialized stack\n");
    break;
  case 40:
    fprintf(stderr, "Brackets don't match\n");
    break;
  case 50:
    fprintf(stderr, "File doesn't exist\n");
    break;
  case 60:
    fprintf(stderr, "Input string is too short\n");
  default:
    break;
  }
  exit(code);
}


x86 assembly (clang, -O0):
<error>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    0x2eaa(%rip),%rax
mov    (%rax),%edi
mov    -0x10(%rbp),%rdx
lea    0xf89(%rip),%rsi
xor    %eax,%eax
call   1030 <fprintf@plt>
mov    -0x4(%rbp),%eax
add    $0xfffffff6,%eax
mov    %eax,%ecx
mov    %rcx,-0x18(%rbp)
sub    $0x32,%eax
ja     124e <error+0x12e>
mov    -0x18(%rbp),%rax
lea    0xe96(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
mov    0x2e66(%rip),%rax
mov    (%rax),%edi
lea    0xf4e(%rip),%rsi
mov    $0x0,%al
call   1030 <fprintf@plt>
jmp    1253 <error+0x133>
mov    0x2e4a(%rip),%rax
mov    (%rax),%edi
lea    0xf41(%rip),%rsi
mov    $0x0,%al
call   1030 <fprintf@plt>
jmp    1253 <error+0x133>
mov    0x2e2e(%rip),%rax
mov    (%rax),%edi
lea    0xf32(%rip),%rsi
mov    $0x0,%al
call   1030 <fprintf@plt>
jmp    1253 <error+0x133>
mov    0x2e12(%rip),%rax
mov    (%rax),%edi
lea    0xf23(%rip),%rsi
mov    $0x0,%al
call   1030 <fprintf@plt>
jmp    1253 <error+0x133>
mov    0x2df6(%rip),%rax
mov    (%rax),%edi
lea    0xf1a(%rip),%rsi
mov    $0x0,%al
call   1030 <fprintf@plt>
jmp    1253 <error+0x133>
mov    0x2dda(%rip),%rax
mov    (%rax),%edi
lea    0xf11(%rip),%rsi
mov    $0x0,%al
call   1030 <fprintf@plt>
jmp    1253 <error+0x133>
mov    0x2dbe(%rip),%rax
mov    (%rax),%edi
lea    0xf0b(%rip),%rsi
mov    $0x0,%al
call   1030 <fprintf@plt>
jmp    1253 <error+0x133>
mov    0x2da2(%rip),%rax
mov    (%rax),%edi
lea    0xf03(%rip),%rsi
mov    $0x0,%al
call   1030 <fprintf@plt>
jmp    1253 <error+0x133>
mov    -0x4(%rbp),%edi
call   1040 <exit@plt>

x86 assembly (clang, -O2):
<error>:
push   %r14
push   %rbx
push   %rax
mov    %rsi,%rdx
mov    %edi,%ebx
mov    0x2eb0(%rip),%r14
mov    (%r14),%edi
lea    0xf92(%rip),%rsi
xor    %eax,%eax
call   1030 <fprintf@plt>
lea    -0xa(%rbx),%eax
cmp    $0x32,%eax
ja     11a7 <error+0x87>
lea    0xf81(%rip),%rsi
lea    0xea9(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
lea    0xf79(%rip),%rsi
jmp    119d <error+0x7d>
lea    0xf8a(%rip),%rsi
jmp    119d <error+0x7d>
lea    0xf74(%rip),%rsi
jmp    119d <error+0x7d>
lea    0xf8b(%rip),%rsi
jmp    119d <error+0x7d>
lea    0xf95(%rip),%rsi
jmp    119d <error+0x7d>
lea    0xfa2(%rip),%rsi
jmp    119d <error+0x7d>
lea    0xfad(%rip),%rsi
mov    (%r14),%edi
xor    %eax,%eax
call   1030 <fprintf@plt>
mov    %ebx,%edi
call   1040 <exit@plt>

LLVM IR (-O0):
@stderr = global i32 0
@.str = [5 x i8] c"%s: \00"
@.str.1 = [15 x i8] c"Out of memory\0A\00"
@.str.2 = [13 x i8] c"Empty queue\0A\00"
@.str.3 = [13 x i8] c"Empty stack\0A\00"
@.str.4 = [19 x i8] c"Unitialized queue\0A\00"
@.str.5 = [19 x i8] c"Unitialized stack\0A\00"
@.str.6 = [22 x i8] c"Brackets don't match\0A\00"
@.str.7 = [20 x i8] c"File doesn't exist\0A\00"
@.str.8 = [27 x i8] c"Input string is too short\0A\00"
define void @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* @stderr
%6 = load i8*, i8** %4
%7 = call i32 (i32, i8*, ...) @fprintf(i32 %5, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i8* %6)
%8 = load i32, i32* %3
switch i32 %8, label %33 [
i32 10, label %9
i32 20, label %12
i32 30, label %15
i32 21, label %18
i32 31, label %21
i32 40, label %24
i32 50, label %27
i32 60, label %30
]
9: ; preds = %2
%10 = load i32, i32* @stderr
%11 = call i32 (i32, i8*, ...) @fprintf(i32 %10, i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.1, i64 0, i64 0))
br label %34
12: ; preds = %2
%13 = load i32, i32* @stderr
%14 = call i32 (i32, i8*, ...) @fprintf(i32 %13, i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.2, i64 0, i64 0))
br label %34
15: ; preds = %2
%16 = load i32, i32* @stderr
%17 = call i32 (i32, i8*, ...) @fprintf(i32 %16, i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.3, i64 0, i64 0))
br label %34
18: ; preds = %2
%19 = load i32, i32* @stderr
%20 = call i32 (i32, i8*, ...) @fprintf(i32 %19, i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.4, i64 0, i64 0))
br label %34
21: ; preds = %2
%22 = load i32, i32* @stderr
%23 = call i32 (i32, i8*, ...) @fprintf(i32 %22, i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.5, i64 0, i64 0))
br label %34
24: ; preds = %2
%25 = load i32, i32* @stderr
%26 = call i32 (i32, i8*, ...) @fprintf(i32 %25, i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.6, i64 0, i64 0))
br label %34
27: ; preds = %2
%28 = load i32, i32* @stderr
%29 = call i32 (i32, i8*, ...) @fprintf(i32 %28, i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.7, i64 0, i64 0))
br label %34
30: ; preds = %2
%31 = load i32, i32* @stderr
%32 = call i32 (i32, i8*, ...) @fprintf(i32 %31, i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.8, i64 0, i64 0))
br label %33
33: ; preds = %2, %30
br label %34
34: ; preds = %33, %27, %24, %21, %18, %15, %12, %9
%35 = load i32, i32* %3
%36 = call i32 @exit(i32 %35)
unreachable
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [5 x i8] c"%s: \00"
@.str.1 = [15 x i8] c"Out of memory\0A\00"
@.str.2 = [13 x i8] c"Empty queue\0A\00"
@.str.3 = [13 x i8] c"Empty stack\0A\00"
@.str.4 = [19 x i8] c"Unitialized queue\0A\00"
@.str.5 = [19 x i8] c"Unitialized stack\0A\00"
@.str.6 = [22 x i8] c"Brackets don't match\0A\00"
@.str.7 = [20 x i8] c"File doesn't exist\0A\00"
@.str.8 = [27 x i8] c"Input string is too short\0A\00"
define void @error(i32 %0, i8* %1) {
%3 = load i32, i32* @stderr
%4 = tail call i32 (i32, i8*, ...) @fprintf(i32 %3, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i8* %1)
switch i32 %0, label %16 [
i32 10, label %12
i32 20, label %5
i32 30, label %6
i32 21, label %7
i32 31, label %8
i32 40, label %9
i32 50, label %10
i32 60, label %11
]
5: ; preds = %2
br label %12
6: ; preds = %2
br label %12
7: ; preds = %2
br label %12
8: ; preds = %2
br label %12
9: ; preds = %2
br label %12
10: ; preds = %2
br label %12
11: ; preds = %2
br label %12
12: ; preds = %2, %5, %6, %7, %8, %9, %10, %11
%13 = phi i8* [ getelementptr inbounds ([27 x i8], [27 x i8]* @.str.8, i64 0, i64 0), %11 ], [ getelementptr inbounds ([20 x i8], [20 x i8]* @.str.7, i64 0, i64 0), %10 ], [ getelementptr inbounds ([22 x i8], [22 x i8]* @.str.6, i64 0, i64 0), %9 ], [ getelementptr inbounds ([19 x i8], [19 x i8]* @.str.5, i64 0, i64 0), %8 ], [ getelementptr inbounds ([19 x i8], [19 x i8]* @.str.4, i64 0, i64 0), %7 ], [ getelementptr inbounds ([13 x i8], [13 x i8]* @.str.3, i64 0, i64 0), %6 ], [ getelementptr inbounds ([13 x i8], [13 x i8]* @.str.2, i64 0, i64 0), %5 ], [ getelementptr inbounds ([15 x i8], [15 x i8]* @.str.1, i64 0, i64 0), %2 ]
%14 = load i32, i32* @stderr
%15 = tail call i32 (i32, i8*, ...) @fprintf(i32 %14, i8* %13)
br label %16
16: ; preds = %12, %2
%17 = tail call i32 @exit(i32 %0)
unreachable
}