int startingMenu(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 > 1) {
          choice--;
        }
        printLogo(choice);
        printMenu(choice);
        break;
      case 80:
        if (choice < 3) {
          choice++;
        }
        printLogo(choice);
        printMenu(choice);
        break;
      default:
        break;
      }
    }
  }
}


x86 assembly (clang, -O0):
<startingMenu>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    $0x0,%al
call   1030 <printLogo@plt>
mov    -0x4(%rbp),%edi
mov    $0x0,%al
call   1040 <printMenu@plt>
mov    $0x0,%al
call   1050 <getch@plt>
mov    %eax,-0x8(%rbp)
cmpl   $0xd,-0x8(%rbp)
jne    1169 <startingMenu+0x39>
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret
cmpl   $0xe0,-0x8(%rbp)
jne    1207 <startingMenu+0xd7>
xor    %eax,%eax
call   1050 <getch@plt>
mov    %eax,-0x8(%rbp)
mov    -0x8(%rbp),%eax
mov    %eax,-0xc(%rbp)
sub    $0x48,%eax
je     11a5 <startingMenu+0x75>
jmp    1194 <startingMenu+0x64>
mov    -0xc(%rbp),%eax
sub    $0x50,%eax
je     11d1 <startingMenu+0xa1>
jmp    11fd <startingMenu+0xcd>
cmpl   $0x1,-0x4(%rbp)
jle    11b8 <startingMenu+0x88>
mov    -0x4(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%edi
mov    $0x0,%al
call   1030 <printLogo@plt>
mov    -0x4(%rbp),%edi
mov    $0x0,%al
call   1040 <printMenu@plt>
jmp    1202 <startingMenu+0xd2>
cmpl   $0x3,-0x4(%rbp)
jge    11e4 <startingMenu+0xb4>
mov    -0x4(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%edi
mov    $0x0,%al
call   1030 <printLogo@plt>
mov    -0x4(%rbp),%edi
mov    $0x0,%al
call   1040 <printMenu@plt>
jmp    1202 <startingMenu+0xd2>
jmp    1202 <startingMenu+0xd2>
jmp    1207 <startingMenu+0xd7>
jmp    114c <startingMenu+0x1c>

x86 assembly (clang, -O2):
<startingMenu>:
push   %rbx
mov    %edi,%ebx
xor    %eax,%eax
call   1030 <printLogo@plt>
mov    %ebx,%edi
xor    %eax,%eax
call   1040 <printMenu@plt>
jmp    1155 <startingMenu+0x25>
cs nopw 0x0(%rax,%rax,1)
nop
cmp    $0xd,%eax
je     1195 <startingMenu+0x65>
xor    %eax,%eax
call   1050 <getch@plt>
cmp    $0xe0,%eax
jne    1150 <startingMenu+0x20>
xor    %eax,%eax
call   1050 <getch@plt>
cmp    $0x50,%eax
je     1180 <startingMenu+0x50>
cmp    $0x48,%eax
jne    1155 <startingMenu+0x25>
xor    %eax,%eax
cmp    $0x2,%ebx
setge  %al
neg    %eax
jmp    1188 <startingMenu+0x58>
xor    %eax,%eax
cmp    $0x3,%ebx
setl   %al
add    %eax,%ebx
mov    %ebx,%edi
xor    %eax,%eax
call   1030 <printLogo@plt>
jmp    113a <startingMenu+0xa>
mov    %ebx,%eax
pop    %rbx
ret

LLVM IR (-O0):
define i32 @startingMenu(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 (i32, ...) bitcast (i32 (...)* @printMenu to i32 (i32, ...)*)(i32 %5)
br label %7
7: ; preds = %1, %43
%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 %43
16: ; preds = %13
%17 = call i32 (...) @getch()
store i32 %17, i32* %3
%18 = load i32, i32* %3
switch i32 %18, label %41 [
i32 72, label %19
i32 80, label %30
]
19: ; preds = %16
%20 = load i32, i32* %2
%21 = icmp sgt i32 %20, 1
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 = load i32, i32* %2
%27 = call i32 (i32, ...) bitcast (i32 (...)* @printLogo to i32 (i32, ...)*)(i32 %26)
%28 = load i32, i32* %2
%29 = call i32 (i32, ...) bitcast (i32 (...)* @printMenu to i32 (i32, ...)*)(i32 %28)
br label %42
30: ; preds = %16
%31 = load i32, i32* %2
%32 = icmp slt i32 %31, 3
br i1 %32, label %33, label %36
33: ; preds = %30
%34 = load i32, i32* %2
%35 = add nsw i32 %34, 1
store i32 %35, i32* %2
br label %36
36: ; preds = %33, %30
%37 = load i32, i32* %2
%38 = call i32 (i32, ...) bitcast (i32 (...)* @printLogo to i32 (i32, ...)*)(i32 %37)
%39 = load i32, i32* %2
%40 = call i32 (i32, ...) bitcast (i32 (...)* @printMenu to i32 (i32, ...)*)(i32 %39)
br label %42
41: ; preds = %16
br label %42
42: ; preds = %41, %36, %25
br label %43
43: ; preds = %42, %13
br label %7
}

LLVM IR (-O2):
define i32 @startingMenu(i32 %0) {
%2 = tail call i32 (...) @printLogo()
br label %3
3: ; preds = %1, %18
%4 = phi i32 [ %20, %18 ], [ %0, %1 ]
%5 = tail call i32 (i32, ...) bitcast (i32 (...)* @printMenu to i32 (i32, ...)*)(i32 %4)
br label %6
6: ; preds = %8, %3
%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 %4
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 %4, 1
%14 = sext i1 %13 to i32
br label %18
15: ; preds = %10
%16 = icmp slt i32 %4, 3
%17 = zext i1 %16 to i32
br label %18
18: ; preds = %15, %12
%19 = phi i32 [ %17, %15 ], [ %14, %12 ]
%20 = add nsw i32 %4, %19
%21 = tail call i32 (i32, ...) bitcast (i32 (...)* @printLogo to i32 (i32, ...)*)(i32 %20)
br label %3
}