#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*/ printf(char *, ...);
void out(int id, int extra) {
  switch (id) {
  case 1:
    printf("    ");
    break;
  case 2:
    printf("\n");
    break;
  case 3:
    printf("Qual a posição do GHOST?\n");
    break;
  case 4:
    printf("x: ");
    break;
  case 5:
    printf("y: ");
    break;
  case 6:
    printf("Ghost: ");
    break;
  case 7:
    printf("%d ", extra);
    break;
  case 8:
    printf("%d  ", extra++);
    break;
  case 9:
    printf("Direção do Pac-mam: ");
    break;
  case 10:
    printf("Qual a posição do Pacman? (x,y)\n");
    break;
  case 11:
    printf("Qual numero do Ghost");
    break;
  case 12:
    printf("\t>>> GHOSTS <<<\n");
    printf("\n");
    printf("1.BLINK  2.PINK  3.INKY  4.CLYDE\n");
    printf("\n");
    break;
  case 13:
    printf("Direção do Ghost: \n");
    break;
  }
}


x86 assembly (clang, -O0):
<out>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    -0x4(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,%ecx
mov    %rcx,-0x10(%rbp)
sub    $0xc,%eax
ja     1271 <out+0x161>
mov    -0x10(%rbp),%rax
lea    0xec2(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
lea    0xee6(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    1271 <out+0x161>
lea    0xfa3(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    1271 <out+0x161>
lea    0xec5(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    1271 <out+0x161>
lea    0xece(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    1271 <out+0x161>
lea    0xebf(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    1271 <out+0x161>
lea    0xeb0(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    1271 <out+0x161>
mov    -0x8(%rbp),%esi
lea    0xea2(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    1271 <out+0x161>
mov    -0x8(%rbp),%esi
mov    %esi,%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
lea    0xe88(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    1271 <out+0x161>
lea    0xe7a(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    1271 <out+0x161>
lea    0xe7e(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    1271 <out+0x161>
lea    0xe8e(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    1271 <out+0x161>
lea    0xe90(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xec9(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xe85(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xead(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    1271 <out+0x161>
lea    0xe86(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<out>:
push   %rax
add    $0xffffffff,%edi
cmp    $0xc,%edi
ja     1152 <out+0x22>
lea    0xec0(%rip),%rax
movslq (%rax,%rdi,4),%rcx
add    %rax,%rcx
jmp    *%rcx
lea    0xee4(%rip),%rdi
jmp    11b1 <out+0x81>
pop    %rax
ret
lea    0xf83(%rip),%rdi
pop    %rax
jmp    1040 <puts@plt>
lea    0xed1(%rip),%rdi
jmp    11b1 <out+0x81>
lea    0xecc(%rip),%rdi
jmp    11b1 <out+0x81>
lea    0xf09(%rip),%rdi
jmp    11b1 <out+0x81>
lea    0xebe(%rip),%rdi
jmp    118c <out+0x5c>
lea    0xeb9(%rip),%rdi
xor    %eax,%eax
pop    %rcx
jmp    1050 <printf@plt>
lea    0xeaf(%rip),%rdi
jmp    11b1 <out+0x81>
lea    0xf18(%rip),%rdi
pop    %rax
jmp    1040 <puts@plt>
lea    0xeb0(%rip),%rdi
xor    %eax,%eax
pop    %rcx
jmp    1050 <printf@plt>
lea    0xecb(%rip),%rdi
call   1040 <puts@plt>
mov    $0xa,%edi
call   1030 <putchar@plt>
lea    0xec5(%rip),%rdi
call   1040 <puts@plt>
mov    $0xa,%edi
pop    %rax
jmp    1030 <putchar@plt>
lea    0xe89(%rip),%rdi
pop    %rax
jmp    1040 <puts@plt>

LLVM IR (-O0):
@.str = [5 x i8] c" \00"
@.str.1 = [2 x i8] c"\0A\00"
@.str.2 = [28 x i8] c"Qual a posi\C3\A7\C3\A3o do GHOST?\0A\00"
@.str.3 = [4 x i8] c"x: \00"
@.str.4 = [4 x i8] c"y: \00"
@.str.5 = [8 x i8] c"Ghost: \00"
@.str.6 = [4 x i8] c"%d \00"
@.str.7 = [5 x i8] c"%d \00"
@.str.8 = [23 x i8] c"Dire\C3\A7\C3\A3o do Pac-mam: \00"
@.str.9 = [35 x i8] c"Qual a posi\C3\A7\C3\A3o do Pacman? (x,y)\0A\00"
@.str.10 = [21 x i8] c"Qual numero do Ghost\00"
@.str.11 = [17 x i8] c"\09>>> GHOSTS <<<\0A\00"
@.str.12 = [34 x i8] c"1.BLINK 2.PINK 3.INKY 4.CLYDE\0A\00"
@.str.13 = [22 x i8] c"Dire\C3\A7\C3\A3o do Ghost: \0A\00"
define void @out(i32 %0, i32 %1) {
%3 = alloca i32
%4 = alloca i32
store i32 %0, i32* %3
store i32 %1, i32* %4
%5 = load i32, i32* %3
switch i32 %5, label %38 [
i32 1, label %6
i32 2, label %8
i32 3, label %10
i32 4, label %12
i32 5, label %14
i32 6, label %16
i32 7, label %18
i32 8, label %21
i32 9, label %25
i32 10, label %27
i32 11, label %29
i32 12, label %31
i32 13, label %36
]
6: ; preds = %2
%7 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0))
br label %38
8: ; preds = %2
%9 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
br label %38
10: ; preds = %2
%11 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.2, i64 0, i64 0))
br label %38
12: ; preds = %2
%13 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.3, i64 0, i64 0))
br label %38
14: ; preds = %2
%15 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.4, i64 0, i64 0))
br label %38
16: ; preds = %2
%17 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.5, i64 0, i64 0))
br label %38
18: ; preds = %2
%19 = load i32, i32* %4
%20 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.6, i64 0, i64 0), i32 %19)
br label %38
21: ; preds = %2
%22 = load i32, i32* %4
%23 = add nsw i32 %22, 1
store i32 %23, i32* %4
%24 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.7, i64 0, i64 0), i32 %22)
br label %38
25: ; preds = %2
%26 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.8, i64 0, i64 0))
br label %38
27: ; preds = %2
%28 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str.9, i64 0, i64 0))
br label %38
29: ; preds = %2
%30 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.10, i64 0, i64 0))
br label %38
31: ; preds = %2
%32 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.11, i64 0, i64 0))
%33 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
%34 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str.12, i64 0, i64 0))
%35 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
br label %38
36: ; preds = %2
%37 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.13, i64 0, i64 0))
br label %38
38: ; preds = %2, %36, %31, %29, %27, %25, %21, %18, %16, %14, %12, %10, %8, %6
ret void
}

LLVM IR (-O2):
@.str = [5 x i8] c" \00"
@.str.3 = [4 x i8] c"x: \00"
@.str.4 = [4 x i8] c"y: \00"
@.str.5 = [8 x i8] c"Ghost: \00"
@.str.6 = [4 x i8] c"%d \00"
@.str.7 = [5 x i8] c"%d \00"
@.str.8 = [23 x i8] c"Dire\C3\A7\C3\A3o do Pac-mam: \00"
@.str.10 = [21 x i8] c"Qual numero do Ghost\00"
@str = [21 x i8] c"Dire\C3\A7\C3\A3o do Ghost: \00"
@str.14 = [16 x i8] c"\09>>> GHOSTS <<<\00"
@str.15 = [33 x i8] c"1.BLINK 2.PINK 3.INKY 4.CLYDE\00"
@str.16 = [34 x i8] c"Qual a posi\C3\A7\C3\A3o do Pacman? (x,y)\00"
@str.17 = [27 x i8] c"Qual a posi\C3\A7\C3\A3o do GHOST?\00"
define void @out(i32 %0, i32 %1) {
switch i32 %0, label %32 [
i32 1, label %3
i32 2, label %5
i32 3, label %7
i32 4, label %9
i32 5, label %11
i32 6, label %13
i32 7, label %15
i32 8, label %17
i32 9, label %19
i32 10, label %21
i32 11, label %23
i32 12, label %25
i32 13, label %30
]
3: ; preds = %2
%4 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0))
br label %32
5: ; preds = %2
%6 = tail call i32 @putchar(i32 10)
br label %32
7: ; preds = %2
%8 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([27 x i8], [27 x i8]* @str.17, i64 0, i64 0))
br label %32
9: ; preds = %2
%10 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.3, i64 0, i64 0))
br label %32
11: ; preds = %2
%12 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.4, i64 0, i64 0))
br label %32
13: ; preds = %2
%14 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([8 x i8], [8 x i8]* @.str.5, i64 0, i64 0))
br label %32
15: ; preds = %2
%16 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.6, i64 0, i64 0), i32 %1)
br label %32
17: ; preds = %2
%18 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @.str.7, i64 0, i64 0), i32 %1)
br label %32
19: ; preds = %2
%20 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([23 x i8], [23 x i8]* @.str.8, i64 0, i64 0))
br label %32
21: ; preds = %2
%22 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([34 x i8], [34 x i8]* @str.16, i64 0, i64 0))
br label %32
23: ; preds = %2
%24 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([21 x i8], [21 x i8]* @.str.10, i64 0, i64 0))
br label %32
25: ; preds = %2
%26 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([16 x i8], [16 x i8]* @str.14, i64 0, i64 0))
%27 = tail call i32 @putchar(i32 10)
%28 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([33 x i8], [33 x i8]* @str.15, i64 0, i64 0))
%29 = tail call i32 @putchar(i32 10)
br label %32
30: ; preds = %2
%31 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([21 x i8], [21 x i8]* @str, i64 0, i64 0))
br label %32
32: ; preds = %2, %30, %25, %23, %21, %19, %17, %15, %13, %11, %9, %7, %5, %3
ret void
}