#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? (x,y)\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("\t>>> GHOSTS <<<\n");
    printf("\n");
    printf("1.BLINK  2.PINK  3.INKY  4.CLYDE\n");
    printf("\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    $0x8,%eax
ja     1225 <out+0x115>
mov    -0x10(%rbp),%rax
lea    0xec2(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
lea    0xed6(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    1225 <out+0x115>
lea    0xee8(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    1225 <out+0x115>
lea    0xeb5(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    1225 <out+0x115>
lea    0xec4(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    1225 <out+0x115>
lea    0xeb7(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    1225 <out+0x115>
lea    0xea8(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    1225 <out+0x115>
mov    -0x8(%rbp),%esi
lea    0xe9a(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    1225 <out+0x115>
mov    -0x8(%rbp),%esi
mov    %esi,%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
lea    0xe80(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    1225 <out+0x115>
lea    0xe72(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xe47(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xe67(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xe2b(%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    $0x8,%edi
ja     1152 <out+0x22>
lea    0xec0(%rip),%rax
movslq (%rax,%rdi,4),%rcx
add    %rax,%rcx
jmp    *%rcx
lea    0xed4(%rip),%rdi
jmp    117a <out+0x4a>
pop    %rax
ret
lea    0xf1a(%rip),%rdi
pop    %rax
jmp    1040 <puts@plt>
lea    0xec1(%rip),%rdi
jmp    117a <out+0x4a>
lea    0xebe(%rip),%rdi
jmp    117a <out+0x4a>
lea    0xeb9(%rip),%rdi
xor    %eax,%eax
pop    %rcx
jmp    1050 <printf@plt>
lea    0xeb2(%rip),%rdi
jmp    1192 <out+0x62>
lea    0xead(%rip),%rdi
xor    %eax,%eax
pop    %rcx
jmp    1050 <printf@plt>
lea    0xea3(%rip),%rdi
call   1040 <puts@plt>
mov    $0xa,%edi
call   1030 <putchar@plt>
lea    0xe9d(%rip),%rdi
call   1040 <puts@plt>
mov    $0xa,%edi
pop    %rax
jmp    1030 <putchar@plt>

LLVM IR (-O0):
@.str = [5 x i8] c" \00"
@.str.1 = [2 x i8] c"\0A\00"
@.str.2 = [34 x i8] c"Qual a posi\C3\A7\C3\A3o do GHOST? (x,y)\0A\00"
@.str.3 = [6 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 = [17 x i8] c"\09>>> GHOSTS <<<\0A\00"
@.str.9 = [34 x i8] c"1.BLINK 2.PINK 3.INKY 4.CLYDE\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 %30 [
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
]
6: ; preds = %2
%7 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0))
br label %30
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 %30
10: ; preds = %2
%11 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str.2, i64 0, i64 0))
br label %30
12: ; preds = %2
%13 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.3, i64 0, i64 0))
br label %30
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 %30
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 %30
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 %30
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 %30
25: ; preds = %2
%26 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.8, i64 0, i64 0))
%27 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
%28 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str.9, i64 0, i64 0))
%29 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
br label %30
30: ; preds = %2, %25, %21, %18, %16, %14, %12, %10, %8, %6
ret void
}

LLVM IR (-O2):
@.str = [5 x i8] c" \00"
@.str.3 = [6 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 = [16 x i8] c"\09>>> GHOSTS <<<\00"
@str.10 = [33 x i8] c"1.BLINK 2.PINK 3.INKY 4.CLYDE\00"
@str.11 = [33 x i8] c"Qual a posi\C3\A7\C3\A3o do GHOST? (x,y)\00"
define void @out(i32 %0, i32 %1) {
switch i32 %0, label %24 [
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
]
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 %24
5: ; preds = %2
%6 = tail call i32 @putchar(i32 10)
br label %24
7: ; preds = %2
%8 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([33 x i8], [33 x i8]* @str.11, i64 0, i64 0))
br label %24
9: ; preds = %2
%10 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @.str.3, i64 0, i64 0))
br label %24
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 %24
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 %24
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 %24
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 %24
19: ; preds = %2
%20 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([16 x i8], [16 x i8]* @str, i64 0, i64 0))
%21 = tail call i32 @putchar(i32 10)
%22 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([33 x i8], [33 x i8]* @str.10, i64 0, i64 0))
%23 = tail call i32 @putchar(i32 10)
br label %24
24: ; preds = %2, %19, %17, %15, %13, %11, %9, %7, %5, %3
ret void
}