#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 getch();
int /*<<< orphan*/ printLogo();
int /*<<< orphan*/ printMenu(int);
int rankingMenu(int choice) {
  int c;
  printLogo();
  printMenu(choice);
  while (1) {
    c = getch();
    if (c == 13) {
      return choice;
    }
    if (c == 224) {
      c = getch();
      switch (c) {
      case 72:
        if (choice > 8) {
          choice--;
        }
        printLogo();
        printMenu(choice);
        break;
      case 80:
        if (choice < 12) {
          choice++;
        }
        printLogo();
        printMenu(choice);
        break;
      default:
        break;
      }
    }
  }
}


x86 assembly (clang, -O0):
<rankingMenu>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    $0x0,%al
call   1030 <printLogo@plt>
mov    -0x4(%rbp),%edi
call   1040 <printMenu@plt>
mov    $0x0,%al
call   1050 <getch@plt>
mov    %eax,-0x8(%rbp)
cmpl   $0xd,-0x8(%rbp)
jne    1167 <rankingMenu+0x37>
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret
cmpl   $0xe0,-0x8(%rbp)
jne    11fb <rankingMenu+0xcb>
xor    %eax,%eax
call   1050 <getch@plt>
mov    %eax,-0x8(%rbp)
mov    -0x8(%rbp),%eax
mov    %eax,-0xc(%rbp)
sub    $0x48,%eax
je     11a3 <rankingMenu+0x73>
jmp    1192 <rankingMenu+0x62>
mov    -0xc(%rbp),%eax
sub    $0x50,%eax
je     11ca <rankingMenu+0x9a>
jmp    11f1 <rankingMenu+0xc1>
cmpl   $0x8,-0x4(%rbp)
jle    11b6 <rankingMenu+0x86>
mov    -0x4(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x4(%rbp)
mov    $0x0,%al
call   1030 <printLogo@plt>
mov    -0x4(%rbp),%edi
call   1040 <printMenu@plt>
jmp    11f6 <rankingMenu+0xc6>
cmpl   $0xc,-0x4(%rbp)
jge    11dd <rankingMenu+0xad>
mov    -0x4(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x4(%rbp)
mov    $0x0,%al
call   1030 <printLogo@plt>
mov    -0x4(%rbp),%edi
call   1040 <printMenu@plt>
jmp    11f6 <rankingMenu+0xc6>
jmp    11f6 <rankingMenu+0xc6>
jmp    11fb <rankingMenu+0xcb>
jmp    114a <rankingMenu+0x1a>

x86 assembly (clang, -O2):
<rankingMenu>:
push   %rbx
mov    %edi,%ebx
xor    %eax,%eax
call   1030 <printLogo@plt>
mov    %ebx,%edi
call   1040 <printMenu@plt>
jmp    1155 <rankingMenu+0x25>
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
cmp    $0xd,%eax
je     119c <rankingMenu+0x6c>
xor    %eax,%eax
call   1050 <getch@plt>
cmp    $0xe0,%eax
jne    1150 <rankingMenu+0x20>
xor    %eax,%eax
call   1050 <getch@plt>
cmp    $0x50,%eax
je     1190 <rankingMenu+0x60>
cmp    $0x48,%eax
jne    1155 <rankingMenu+0x25>
xor    %eax,%eax
cmp    $0x9,%ebx
setge  %al
neg    %eax
add    %eax,%ebx
jmp    1133 <rankingMenu+0x3>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
xor    %eax,%eax
cmp    $0xc,%ebx
setl   %al
add    %eax,%ebx
jmp    1133 <rankingMenu+0x3>
mov    %ebx,%eax
pop    %rbx
ret

LLVM IR (-O0):
define i32 @rankingMenu(i32 %0) {
%2 = alloca i32
%3 = alloca i32
store i32 %0, i32* %2
%4 = call i32 (...) @printLogo()
%5 = load i32, i32* %2
%6 = call i32 @printMenu(i32 %5)
br label %7
7: ; preds = %1, %41
%8 = call i32 (...) @getch()
store i32 %8, i32* %3
%9 = load i32, i32* %3
%10 = icmp eq i32 %9, 13
br i1 %10, label %11, label %13
11: ; preds = %7
%12 = load i32, i32* %2
ret i32 %12
13: ; preds = %7
%14 = load i32, i32* %3
%15 = icmp eq i32 %14, 224
br i1 %15, label %16, label %41
16: ; preds = %13
%17 = call i32 (...) @getch()
store i32 %17, i32* %3
%18 = load i32, i32* %3
switch i32 %18, label %39 [
i32 72, label %19
i32 80, label %29
]
19: ; preds = %16
%20 = load i32, i32* %2
%21 = icmp sgt i32 %20, 8
br i1 %21, label %22, label %25
22: ; preds = %19
%23 = load i32, i32* %2
%24 = add nsw i32 %23, -1
store i32 %24, i32* %2
br label %25
25: ; preds = %22, %19
%26 = call i32 (...) @printLogo()
%27 = load i32, i32* %2
%28 = call i32 @printMenu(i32 %27)
br label %40
29: ; preds = %16
%30 = load i32, i32* %2
%31 = icmp slt i32 %30, 12
br i1 %31, label %32, label %35
32: ; preds = %29
%33 = load i32, i32* %2
%34 = add nsw i32 %33, 1
store i32 %34, i32* %2
br label %35
35: ; preds = %32, %29
%36 = call i32 (...) @printLogo()
%37 = load i32, i32* %2
%38 = call i32 @printMenu(i32 %37)
br label %40
39: ; preds = %16
br label %40
40: ; preds = %39, %35, %25
br label %41
41: ; preds = %40, %13
br label %7
}

LLVM IR (-O2):
define i32 @rankingMenu(i32 %0) {
br label %2
2: ; preds = %1, %18
%3 = phi i32 [ %20, %18 ], [ %0, %1 ]
%4 = tail call i32 (...) @printLogo()
%5 = tail call i32 @printMenu(i32 %3)
br label %6
6: ; preds = %8, %2
%7 = tail call i32 (...) @getch()
switch i32 %7, label %8 [
i32 13, label %9
i32 224, label %10
]
8: ; preds = %6, %10
br label %6
9: ; preds = %6
ret i32 %3
10: ; preds = %6
%11 = tail call i32 (...) @getch()
switch i32 %11, label %8 [
i32 72, label %12
i32 80, label %15
]
12: ; preds = %10
%13 = icmp sgt i32 %3, 8
%14 = sext i1 %13 to i32
br label %18
15: ; preds = %10
%16 = icmp slt i32 %3, 12
%17 = zext i1 %16 to i32
br label %18
18: ; preds = %15, %12
%19 = phi i32 [ %17, %15 ], [ %14, %12 ]
%20 = add nsw i32 %3, %19
br label %2
}