#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*/ A_STANDOUT;
int /*<<< orphan*/ COLOR_BLUE;
int /*<<< orphan*/ COLOR_PAIR(int);
int /*<<< orphan*/ COLOR_WHITE;
unsigned short COLS;
#define KEY_LEFT 129
#define KEY_RIGHT 128
scalar_t__ LINES;
int /*<<< orphan*/ addch(char);
int /*<<< orphan*/ addstr(char const *);
int /*<<< orphan*/ attroff(int /*<<< orphan*/);
int /*<<< orphan*/ attron(int /*<<< orphan*/);
int /*<<< orphan*/ clear();
int /*<<< orphan*/ curs_set(int /*<<< orphan*/);
int getch();
int /*<<< orphan*/ init_pair(int, int /*<<< orphan*/, int /*<<< orphan*/);
int /*<<< orphan*/ move(scalar_t__, int /*<<< orphan*/);
int /*<<< orphan*/ playGame(int, int);
int /*<<< orphan*/ printDesc(char const *);
int /*<<< orphan*/ refresh();
int /*<<< orphan*/ runCreditsMenu();
void runMainMenu() {
  curs_set(0);
  const char *buttons[5] = {
      "Multiplayer", "Local Game", "Help", "Credits", "Exit",
  };
  const char *desc[5] = {
      "Join an online game.", "Play locally against a bot or a friend.",
      "Instructions on how to play the game.",
      "Who made the game and special thanks.", "Exit this application."};
  unsigned short sel = 0;
  init_pair(1, COLOR_WHITE, COLOR_BLUE);
  bool menuLoop = true;
  do {
    clear();
    attron(COLOR_PAIR(1));
    move(LINES - 1, 0);
    for (unsigned short i = 0; i < COLS; ++i)
      addch(' ');
    move(LINES - 1, 0);
    for (unsigned char i = 0; i < 5; ++i) {
      addstr("    ");
      if (i == sel)
        attron(A_STANDOUT);
      addstr(buttons[i]);
      if (i == sel)
        attroff(A_STANDOUT);
    }
    attroff(COLOR_PAIR(1));
    printDesc(desc[sel]);
    refresh();
    int ch = getch();
    switch (ch) {
    case 'l':
    case KEY_RIGHT:
      if (sel == 4)
        sel = 0;
      else
        ++sel;
      break;
    case 'h':
    case KEY_LEFT:
      if (sel == 0)
        sel = 4;
      else
        --sel;
      break;
    case ' ':
    case '\n':
      if (sel == 0)
        ;
      else if (sel == 1)
        playGame(false, false);
      else if (sel == 2)
        ;
      else if (sel == 3)
        runCreditsMenu();
      else if (sel == 4)
        menuLoop = false;
      break;
    default:
      break;
    }
  } while (menuLoop);
}


x86 assembly (clang, -O0):
<runMainMenu>:
push   %rbp
mov    %rsp,%rbp
sub    $0x80,%rsp
xor    %edi,%edi
call   10f0 <curs_set@plt>
lea    -0x30(%rbp),%rdi
xor    %esi,%esi
mov    $0x28,%edx
call   1070 <memset@plt>
lea    0xde7(%rip),%rax
mov    %rax,-0x30(%rbp)
lea    0xde8(%rip),%rax
mov    %rax,-0x28(%rbp)
lea    0xde8(%rip),%rax
mov    %rax,-0x20(%rbp)
lea    0xde2(%rip),%rax
mov    %rax,-0x18(%rbp)
lea    0xddf(%rip),%rax
mov    %rax,-0x10(%rbp)
lea    -0x60(%rbp),%rdi
xor    %esi,%esi
mov    $0x28,%edx
call   1070 <memset@plt>
lea    0xdc9(%rip),%rax
mov    %rax,-0x60(%rbp)
lea    0xdd3(%rip),%rax
mov    %rax,-0x58(%rbp)
lea    0xdf0(%rip),%rax
mov    %rax,-0x50(%rbp)
lea    0xe0b(%rip),%rax
mov    %rax,-0x48(%rbp)
lea    0xe26(%rip),%rax
mov    %rax,-0x40(%rbp)
movw   $0x0,-0x62(%rbp)
mov    0x2d2b(%rip),%rax
mov    (%rax),%esi
mov    0x2d1a(%rip),%rax
mov    (%rax),%edx
mov    $0x1,%edi
call   1060 <init_pair@plt>
movl   $0x1,-0x68(%rbp)
mov    $0x0,%al
call   10e0 <clear@plt>
mov    $0x1,%edi
call   1090 <COLOR_PAIR@plt>
mov    %eax,%edi
call   1080 <attron@plt>
mov    0x2d10(%rip),%rax
mov    (%rax),%rdi
sub    $0x1,%rdi
xor    %esi,%esi
call   1100 <move@plt>
movw   $0x0,-0x6a(%rbp)
movzwl -0x6a(%rbp),%eax
mov    0x2ce9(%rip),%rcx
movzwl (%rcx),%ecx
cmp    %ecx,%eax
jge    131d <runMainMenu+0x12d>
mov    $0x20,%edi
call   10a0 <addch@plt>
mov    -0x6a(%rbp),%ax
add    $0x1,%ax
mov    %ax,-0x6a(%rbp)
jmp    12ec <runMainMenu+0xfc>
mov    0x2cc4(%rip),%rax
mov    (%rax),%rdi
sub    $0x1,%rdi
xor    %esi,%esi
call   1100 <move@plt>
movb   $0x0,-0x6b(%rbp)
movzbl -0x6b(%rbp),%eax
cmp    $0x5,%eax
jge    13ab <runMainMenu+0x1bb>
lea    0xd7f(%rip),%rdi
call   10d0 <addstr@plt>
movzbl -0x6b(%rbp),%eax
movzwl -0x62(%rbp),%ecx
cmp    %ecx,%eax
jne    136d <runMainMenu+0x17d>
mov    0x2c6a(%rip),%rax
mov    (%rax),%edi
call   1080 <attron@plt>
movzbl -0x6b(%rbp),%eax
mov    -0x30(%rbp,%rax,8),%rdi
call   10d0 <addstr@plt>
movzbl -0x6b(%rbp),%eax
movzwl -0x62(%rbp),%ecx
cmp    %ecx,%eax
jne    1399 <runMainMenu+0x1a9>
mov    0x2c3e(%rip),%rax
mov    (%rax),%edi
call   1030 <attroff@plt>
jmp    139e <runMainMenu+0x1ae>
mov    -0x6b(%rbp),%al
add    $0x1,%al
mov    %al,-0x6b(%rbp)
jmp    1336 <runMainMenu+0x146>
mov    $0x1,%edi
call   1090 <COLOR_PAIR@plt>
mov    %eax,%edi
call   1030 <attroff@plt>
movzwl -0x62(%rbp),%eax
mov    -0x60(%rbp,%rax,8),%rdi
call   1050 <printDesc@plt>
xor    %eax,%eax
mov    %al,-0x75(%rbp)
call   10b0 <refresh@plt>
mov    -0x75(%rbp),%al
call   10c0 <getch@plt>
mov    %eax,-0x70(%rbp)
mov    -0x70(%rbp),%eax
mov    %eax,-0x74(%rbp)
sub    $0xa,%eax
je     149e <runMainMenu+0x2ae>
jmp    13f3 <runMainMenu+0x203>
mov    -0x74(%rbp),%eax
sub    $0x20,%eax
je     149e <runMainMenu+0x2ae>
jmp    1404 <runMainMenu+0x214>
mov    -0x74(%rbp),%eax
sub    $0x68,%eax
je     1475 <runMainMenu+0x285>
jmp    1415 <runMainMenu+0x225>
mov    -0x74(%rbp),%eax
sub    $0x6c,%eax
je     144c <runMainMenu+0x25c>
jmp    1426 <runMainMenu+0x236>
mov    -0x74(%rbp),%eax
sub    $0x80,%eax
je     144c <runMainMenu+0x25c>
jmp    1439 <runMainMenu+0x249>
mov    -0x74(%rbp),%eax
sub    $0x81,%eax
je     1475 <runMainMenu+0x285>
jmp    1523 <runMainMenu+0x333>
movzwl -0x62(%rbp),%eax
cmp    $0x4,%eax
jne    1464 <runMainMenu+0x274>
movw   $0x0,-0x62(%rbp)
jmp    1470 <runMainMenu+0x280>
mov    -0x62(%rbp),%ax
add    $0x1,%ax
mov    %ax,-0x62(%rbp)
jmp    1528 <runMainMenu+0x338>
movzwl -0x62(%rbp),%eax
cmp    $0x0,%eax
jne    148d <runMainMenu+0x29d>
movw   $0x4,-0x62(%rbp)
jmp    1499 <runMainMenu+0x2a9>
mov    -0x62(%rbp),%ax
add    $0xffff,%ax
mov    %ax,-0x62(%rbp)
jmp    1528 <runMainMenu+0x338>
movzwl -0x62(%rbp),%eax
cmp    $0x0,%eax
jne    14b0 <runMainMenu+0x2c0>
jmp    151e <runMainMenu+0x32e>
movzwl -0x62(%rbp),%eax
cmp    $0x1,%eax
jne    14cb <runMainMenu+0x2db>
xor    %esi,%esi
mov    %esi,%edi
call   1110 <playGame@plt>
jmp    1519 <runMainMenu+0x329>
movzwl -0x62(%rbp),%eax
cmp    $0x2,%eax
jne    14dd <runMainMenu+0x2ed>
jmp    1514 <runMainMenu+0x324>
movzwl -0x62(%rbp),%eax
cmp    $0x3,%eax
jne    14f6 <runMainMenu+0x306>
mov    $0x0,%al
call   1040 <runCreditsMenu@plt>
jmp    150f <runMainMenu+0x31f>
movzwl -0x62(%rbp),%eax
cmp    $0x4,%eax
jne    150a <runMainMenu+0x31a>
movl   $0x0,-0x68(%rbp)
jmp    150f <runMainMenu+0x31f>
jmp    1514 <runMainMenu+0x324>
jmp    1519 <runMainMenu+0x329>
jmp    151e <runMainMenu+0x32e>
jmp    1528 <runMainMenu+0x338>
jmp    1528 <runMainMenu+0x338>
jmp    152d <runMainMenu+0x33d>
cmpl   $0x0,-0x68(%rbp)
jne    12b9 <runMainMenu+0xc9>
add    $0x80,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<runMainMenu>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x28,%rsp
xor    %edi,%edi
call   10e0 <curs_set@plt>
lea    0xe95(%rip),%rax
mov    %rax,(%rsp)
lea    0xe9f(%rip),%rax
mov    %rax,0x8(%rsp)
lea    0xebb(%rip),%rax
mov    %rax,0x10(%rsp)
lea    0xed5(%rip),%rax
mov    %rax,0x18(%rsp)
lea    0xeef(%rip),%rax
mov    %rax,0x20(%rsp)
mov    0x2d91(%rip),%rax
mov    (%rax),%esi
mov    0x2d80(%rip),%rax
mov    (%rax),%edx
mov    $0x1,%edi
call   1060 <init_pair@plt>
mov    0x2d95(%rip),%r14
mov    0x2d86(%rip),%r15
lea    0xed0(%rip),%rbx
mov    0x2d68(%rip),%r12
xor    %eax,%eax
jmp    1281 <runMainMenu+0xa1>
nopl   0x0(%rax)
sub    $0x1,%r13w
mov    $0x4,%eax
cmovb  %eax,%r13d
mov    %r13d,%eax
movzwl %ax,%r13d
cs nopw 0x0(%rax,%rax,1)
nop
xor    %eax,%eax
call   10d0 <clear@plt>
mov    $0x1,%edi
call   1080 <COLOR_PAIR@plt>
mov    %eax,%edi
call   1070 <attron@plt>
mov    (%r14),%rdi
add    $0xffffffffffffffff,%rdi
xor    %esi,%esi
call   10f0 <move@plt>
cmpw   $0x0,(%r15)
je     12d3 <runMainMenu+0xf3>
xor    %ebp,%ebp
nop
mov    $0x20,%edi
call   1090 <addch@plt>
add    $0x1,%ebp
cmp    (%r15),%bp
jb     12c0 <runMainMenu+0xe0>
mov    (%r14),%rdi
add    $0xffffffffffffffff,%rdi
xor    %esi,%esi
call   10f0 <move@plt>
mov    %rbx,%rdi
call   10c0 <addstr@plt>
test   %r13,%r13
je     1340 <runMainMenu+0x160>
lea    0xd73(%rip),%rdi
call   10c0 <addstr@plt>
mov    %rbx,%rdi
call   10c0 <addstr@plt>
cmp    $0x1,%r13w
jne    1366 <runMainMenu+0x186>
mov    (%r12),%edi
call   1070 <attron@plt>
lea    0xd5b(%rip),%rdi
call   10c0 <addstr@plt>
mov    (%r12),%edi
call   1030 <attroff@plt>
mov    %rbx,%rdi
call   10c0 <addstr@plt>
jmp    13b0 <runMainMenu+0x1d0>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
mov    (%r12),%edi
call   1070 <attron@plt>
lea    0xd18(%rip),%rdi
call   10c0 <addstr@plt>
mov    (%r12),%edi
call   1030 <attroff@plt>
mov    %rbx,%rdi
call   10c0 <addstr@plt>
lea    0xd07(%rip),%rdi
call   10c0 <addstr@plt>
mov    %rbx,%rdi
call   10c0 <addstr@plt>
cmp    $0x2,%r13w
jne    13b0 <runMainMenu+0x1d0>
mov    (%r12),%edi
call   1070 <attron@plt>
lea    0xcee(%rip),%rdi
call   10c0 <addstr@plt>
mov    (%r12),%edi
call   1030 <attroff@plt>
mov    %rbx,%rdi
call   10c0 <addstr@plt>
jmp    1400 <runMainMenu+0x220>
nopl   0x0(%rax)
lea    0xcc8(%rip),%rdi
call   10c0 <addstr@plt>
mov    %rbx,%rdi
call   10c0 <addstr@plt>
cmp    $0x3,%r13w
jne    1400 <runMainMenu+0x220>
mov    (%r12),%edi
call   1070 <attron@plt>
lea    0xca9(%rip),%rdi
call   10c0 <addstr@plt>
mov    (%r12),%edi
call   1030 <attroff@plt>
mov    %rbx,%rdi
call   10c0 <addstr@plt>
jmp    1440 <runMainMenu+0x260>
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
lea    0xc7d(%rip),%rdi
call   10c0 <addstr@plt>
mov    %rbx,%rdi
call   10c0 <addstr@plt>
cmp    $0x4,%r13w
jne    1440 <runMainMenu+0x260>
mov    (%r12),%edi
call   1070 <attron@plt>
lea    0xc61(%rip),%rdi
call   10c0 <addstr@plt>
mov    (%r12),%edi
call   1030 <attroff@plt>
jmp    144c <runMainMenu+0x26c>
nopl   0x0(%rax,%rax,1)
lea    0xc45(%rip),%rdi
call   10c0 <addstr@plt>
mov    $0x1,%edi
call   1080 <COLOR_PAIR@plt>
mov    %eax,%edi
call   1030 <attroff@plt>
mov    (%rsp,%r13,8),%rdi
call   1050 <printDesc@plt>
xor    %eax,%eax
call   10a0 <refresh@plt>
xor    %eax,%eax
call   10b0 <getch@plt>
cmp    $0xa,%eax
je     14a0 <runMainMenu+0x2c0>
cmp    $0x20,%eax
je     14a0 <runMainMenu+0x2c0>
add    $0xffffff98,%eax
cmp    $0x19,%eax
ja     1290 <runMainMenu+0xb0>
lea    0xb6f(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
nopw   0x0(%rax,%rax,1)
cmp    $0x4,%r13w
je     14f8 <runMainMenu+0x318>
cmp    $0x3,%r13w
je     14e8 <runMainMenu+0x308>
cmp    $0x1,%r13w
jne    1290 <runMainMenu+0xb0>
xor    %edi,%edi
xor    %esi,%esi
call   1100 <playGame@plt>
mov    $0x1,%ax
jmp    1281 <runMainMenu+0xa1>
nopl   0x0(%rax,%rax,1)
mov    %r13d,%eax
add    $0x1,%eax
cmp    $0x4,%r13w
mov    $0x0,%ecx
cmove  %ecx,%eax
jmp    1281 <runMainMenu+0xa1>
xor    %eax,%eax
call   1040 <runCreditsMenu@plt>
mov    $0x3,%ax
jmp    1281 <runMainMenu+0xa1>
add    $0x28,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [12 x i8] c"Multiplayer\00"
@.str.1 = [11 x i8] c"Local Game\00"
@.str.2 = [5 x i8] c"Help\00"
@.str.3 = [8 x i8] c"Credits\00"
@.str.4 = [5 x i8] c"Exit\00"
@.str.5 = [21 x i8] c"Join an online game.\00"
@.str.6 = [40 x i8] c"Play locally against a bot or a friend.\00"
@.str.7 = [38 x i8] c"Instructions on how to play the game.\00"
@.str.8 = [38 x i8] c"Who made the game and special thanks.\00"
@.str.9 = [23 x i8] c"Exit this application.\00"
@COLOR_WHITE = global i32 0
@COLOR_BLUE = global i32 0
@LINES = global i64 0
@COLS = global i16 0
@.str.10 = [5 x i8] c" \00"
@A_STANDOUT = global i32 0
define void @runMainMenu() {
%1 = alloca [5 x i8*]
%2 = alloca [5 x i8*]
%3 = alloca i16
%4 = alloca i32
%5 = alloca i16
%6 = alloca i8
%7 = alloca i32
%8 = call i32 @curs_set(i32 0)
%9 = bitcast [5 x i8*]* %1 to i8*
%10 = bitcast i8* %9 to [5 x i8*]*
%11 = getelementptr inbounds [5 x i8*], [5 x i8*]* %10, i32 0, i32 0
store i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i32 0, i32 0), i8** %11
%12 = getelementptr inbounds [5 x i8*], [5 x i8*]* %10, i32 0, i32 1
store i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.1, i32 0, i32 0), i8** %12
%13 = getelementptr inbounds [5 x i8*], [5 x i8*]* %10, i32 0, i32 2
store i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.2, i32 0, i32 0), i8** %13
%14 = getelementptr inbounds [5 x i8*], [5 x i8*]* %10, i32 0, i32 3
store i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.3, i32 0, i32 0), i8** %14
%15 = getelementptr inbounds [5 x i8*], [5 x i8*]* %10, i32 0, i32 4
store i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.4, i32 0, i32 0), i8** %15
%16 = bitcast [5 x i8*]* %2 to i8*
%17 = bitcast i8* %16 to [5 x i8*]*
%18 = getelementptr inbounds [5 x i8*], [5 x i8*]* %17, i32 0, i32 0
store i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.5, i32 0, i32 0), i8** %18
%19 = getelementptr inbounds [5 x i8*], [5 x i8*]* %17, i32 0, i32 1
store i8* getelementptr inbounds ([40 x i8], [40 x i8]* @.str.6, i32 0, i32 0), i8** %19
%20 = getelementptr inbounds [5 x i8*], [5 x i8*]* %17, i32 0, i32 2
store i8* getelementptr inbounds ([38 x i8], [38 x i8]* @.str.7, i32 0, i32 0), i8** %20
%21 = getelementptr inbounds [5 x i8*], [5 x i8*]* %17, i32 0, i32 3
store i8* getelementptr inbounds ([38 x i8], [38 x i8]* @.str.8, i32 0, i32 0), i8** %21
%22 = getelementptr inbounds [5 x i8*], [5 x i8*]* %17, i32 0, i32 4
store i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.9, i32 0, i32 0), i8** %22
store i16 0, i16* %3
%23 = load i32, i32* @COLOR_WHITE
%24 = load i32, i32* @COLOR_BLUE
%25 = call i32 @init_pair(i32 1, i32 %23, i32 %24)
store i32 1, i32* %4
br label %26
26: ; preds = %143, %0
%27 = call i32 (...) @clear()
%28 = call i32 @COLOR_PAIR(i32 1)
%29 = call i32 @attron(i32 %28)
%30 = load i64, i64* @LINES
%31 = sub nsw i64 %30, 1
%32 = call i32 @move(i64 %31, i32 0)
store i16 0, i16* %5
br label %33
33: ; preds = %41, %26
%34 = load i16, i16* %5
%35 = zext i16 %34 to i32
%36 = load i16, i16* @COLS
%37 = zext i16 %36 to i32
%38 = icmp slt i32 %35, %37
br i1 %38, label %39, label %44
39: ; preds = %33
%40 = call i32 @addch(i8 signext 32)
br label %41
41: ; preds = %39
%42 = load i16, i16* %5
%43 = add i16 %42, 1
store i16 %43, i16* %5
br label %33
44: ; preds = %33
%45 = load i64, i64* @LINES
%46 = sub nsw i64 %45, 1
%47 = call i32 @move(i64 %46, i32 0)
store i8 0, i8* %6
br label %48
48: ; preds = %77, %44
%49 = load i8, i8* %6
%50 = zext i8 %49 to i32
%51 = icmp slt i32 %50, 5
br i1 %51, label %52, label %80
52: ; preds = %48
%53 = call i32 @addstr(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.10, i64 0, i64 0))
%54 = load i8, i8* %6
%55 = zext i8 %54 to i32
%56 = load i16, i16* %3
%57 = zext i16 %56 to i32
%58 = icmp eq i32 %55, %57
br i1 %58, label %59, label %62
59: ; preds = %52
%60 = load i32, i32* @A_STANDOUT
%61 = call i32 @attron(i32 %60)
br label %62
62: ; preds = %59, %52
%63 = load i8, i8* %6
%64 = zext i8 %63 to i64
%65 = getelementptr inbounds [5 x i8*], [5 x i8*]* %1, i64 0, i64 %64
%66 = load i8*, i8** %65
%67 = call i32 @addstr(i8* %66)
%68 = load i8, i8* %6
%69 = zext i8 %68 to i32
%70 = load i16, i16* %3
%71 = zext i16 %70 to i32
%72 = icmp eq i32 %69, %71
br i1 %72, label %73, label %76
73: ; preds = %62
%74 = load i32, i32* @A_STANDOUT
%75 = call i32 @attroff(i32 %74)
br label %76
76: ; preds = %73, %62
br label %77
77: ; preds = %76
%78 = load i8, i8* %6
%79 = add i8 %78, 1
store i8 %79, i8* %6
br label %48
80: ; preds = %48
%81 = call i32 @COLOR_PAIR(i32 1)
%82 = call i32 @attroff(i32 %81)
%83 = load i16, i16* %3
%84 = zext i16 %83 to i64
%85 = getelementptr inbounds [5 x i8*], [5 x i8*]* %2, i64 0, i64 %84
%86 = load i8*, i8** %85
%87 = call i32 @printDesc(i8* %86)
%88 = call i32 (...) @refresh()
%89 = call i32 (...) @getch()
store i32 %89, i32* %7
%90 = load i32, i32* %7
switch i32 %90, label %141 [
i32 108, label %91
i32 128, label %91
i32 104, label %100
i32 129, label %100
i32 32, label %109
i32 10, label %109
]
91: ; preds = %80, %80
%92 = load i16, i16* %3
%93 = zext i16 %92 to i32
%94 = icmp eq i32 %93, 4
br i1 %94, label %95, label %96
95: ; preds = %91
store i16 0, i16* %3
br label %99
96: ; preds = %91
%97 = load i16, i16* %3
%98 = add i16 %97, 1
store i16 %98, i16* %3
br label %99
99: ; preds = %96, %95
br label %142
100: ; preds = %80, %80
%101 = load i16, i16* %3
%102 = zext i16 %101 to i32
%103 = icmp eq i32 %102, 0
br i1 %103, label %104, label %105
104: ; preds = %100
store i16 4, i16* %3
br label %108
105: ; preds = %100
%106 = load i16, i16* %3
%107 = add i16 %106, -1
store i16 %107, i16* %3
br label %108
108: ; preds = %105, %104
br label %142
109: ; preds = %80, %80
%110 = load i16, i16* %3
%111 = zext i16 %110 to i32
%112 = icmp eq i32 %111, 0
br i1 %112, label %113, label %114
113: ; preds = %109
br label %140
114: ; preds = %109
%115 = load i16, i16* %3
%116 = zext i16 %115 to i32
%117 = icmp eq i32 %116, 1
br i1 %117, label %118, label %120
118: ; preds = %114
%119 = call i32 @playGame(i32 0, i32 0)
br label %139
120: ; preds = %114
%121 = load i16, i16* %3
%122 = zext i16 %121 to i32
%123 = icmp eq i32 %122, 2
br i1 %123, label %124, label %125
124: ; preds = %120
br label %138
125: ; preds = %120
%126 = load i16, i16* %3
%127 = zext i16 %126 to i32
%128 = icmp eq i32 %127, 3
br i1 %128, label %129, label %131
129: ; preds = %125
%130 = call i32 (...) @runCreditsMenu()
br label %137
131: ; preds = %125
%132 = load i16, i16* %3
%133 = zext i16 %132 to i32
%134 = icmp eq i32 %133, 4
br i1 %134, label %135, label %136
135: ; preds = %131
store i32 0, i32* %4
br label %136
136: ; preds = %135, %131
br label %137
137: ; preds = %136, %129
br label %138
138: ; preds = %137, %124
br label %139
139: ; preds = %138, %118
br label %140
140: ; preds = %139, %113
br label %142
141: ; preds = %80
br label %142
142: ; preds = %141, %140, %108, %99
br label %143
143: ; preds = %142
%144 = load i32, i32* %4
%145 = icmp ne i32 %144, 0
br i1 %145, label %26, label %146
146: ; preds = %143
ret void
}

LLVM IR (-O2):
@.str = [12 x i8] c"Multiplayer\00"
@.str.1 = [11 x i8] c"Local Game\00"
@.str.2 = [5 x i8] c"Help\00"
@.str.3 = [8 x i8] c"Credits\00"
@.str.4 = [5 x i8] c"Exit\00"
@.str.5 = [21 x i8] c"Join an online game.\00"
@.str.6 = [40 x i8] c"Play locally against a bot or a friend.\00"
@.str.7 = [38 x i8] c"Instructions on how to play the game.\00"
@.str.8 = [38 x i8] c"Who made the game and special thanks.\00"
@.str.9 = [23 x i8] c"Exit this application.\00"
@COLOR_WHITE = global i32 0
@COLOR_BLUE = global i32 0
@LINES = global i64 0
@COLS = global i16 0
@.str.10 = [5 x i8] c" \00"
@A_STANDOUT = global i32 0
define void @runMainMenu() {
%1 = alloca [5 x i8*]
%2 = tail call i32 @curs_set(i32 0)
%3 = bitcast [5 x i8*]* %1 to i8*
%4 = getelementptr inbounds [5 x i8*], [5 x i8*]* %1, i64 0, i64 0
store i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.5, i64 0, i64 0), i8** %4
%5 = getelementptr inbounds [5 x i8*], [5 x i8*]* %1, i64 0, i64 1
store i8* getelementptr inbounds ([40 x i8], [40 x i8]* @.str.6, i64 0, i64 0), i8** %5
%6 = getelementptr inbounds [5 x i8*], [5 x i8*]* %1, i64 0, i64 2
store i8* getelementptr inbounds ([38 x i8], [38 x i8]* @.str.7, i64 0, i64 0), i8** %6
%7 = getelementptr inbounds [5 x i8*], [5 x i8*]* %1, i64 0, i64 3
store i8* getelementptr inbounds ([38 x i8], [38 x i8]* @.str.8, i64 0, i64 0), i8** %7
%8 = getelementptr inbounds [5 x i8*], [5 x i8*]* %1, i64 0, i64 4
store i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.9, i64 0, i64 0), i8** %8
%9 = load i32, i32* @COLOR_WHITE
%10 = load i32, i32* @COLOR_BLUE
%11 = tail call i32 @init_pair(i32 1, i32 %9, i32 %10)
br label %12
12: ; preds = %110, %0
%13 = phi i16 [ 0, %0 ], [ %111, %110 ]
%14 = zext i16 %13 to i64
%15 = icmp eq i16 %13, 0
%16 = icmp eq i16 %13, 1
%17 = icmp eq i16 %13, 2
%18 = icmp eq i16 %13, 3
%19 = icmp eq i16 %13, 4
%20 = getelementptr inbounds [5 x i8*], [5 x i8*]* %1, i64 0, i64 %14
br label %21
21: ; preds = %105, %12
%22 = tail call i32 (...) @clear()
%23 = tail call i32 @COLOR_PAIR(i32 1)
%24 = tail call i32 @attron(i32 %23)
%25 = load i64, i64* @LINES
%26 = add nsw i64 %25, -1
%27 = tail call i32 @move(i64 %26, i32 0)
%28 = load i16, i16* @COLS
%29 = icmp eq i16 %28, 0
br i1 %29, label %30, label %35
30: ; preds = %35, %21
%31 = load i64, i64* @LINES
%32 = add nsw i64 %31, -1
%33 = tail call i32 @move(i64 %32, i32 0)
%34 = tail call i32 @addstr(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.10, i64 0, i64 0))
br i1 %15, label %41, label %48
35: ; preds = %21, %35
%36 = phi i16 [ %38, %35 ], [ 0, %21 ]
%37 = tail call i32 @addch(i8 signext 32)
%38 = add nuw i16 %36, 1
%39 = load i16, i16* @COLS
%40 = icmp ult i16 %38, %39
br i1 %40, label %35, label %30
41: ; preds = %30
%42 = load i32, i32* @A_STANDOUT
%43 = tail call i32 @attron(i32 %42)
%44 = tail call i32 @addstr(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0))
%45 = load i32, i32* @A_STANDOUT
%46 = tail call i32 @attroff(i32 %45)
%47 = tail call i32 @addstr(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.10, i64 0, i64 0))
br label %58
48: ; preds = %30
%49 = tail call i32 @addstr(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0))
%50 = tail call i32 @addstr(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.10, i64 0, i64 0))
br i1 %16, label %51, label %58
51: ; preds = %48
%52 = load i32, i32* @A_STANDOUT
%53 = tail call i32 @attron(i32 %52)
%54 = tail call i32 @addstr(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.1, i64 0, i64 0))
%55 = load i32, i32* @A_STANDOUT
%56 = tail call i32 @attroff(i32 %55)
%57 = tail call i32 @addstr(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.10, i64 0, i64 0))
br label %68
58: ; preds = %48, %41
%59 = tail call i32 @addstr(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.1, i64 0, i64 0))
%60 = tail call i32 @addstr(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.10, i64 0, i64 0))
br i1 %17, label %61, label %68
61: ; preds = %58
%62 = load i32, i32* @A_STANDOUT
%63 = tail call i32 @attron(i32 %62)
%64 = tail call i32 @addstr(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.2, i64 0, i64 0))
%65 = load i32, i32* @A_STANDOUT
%66 = tail call i32 @attroff(i32 %65)
%67 = tail call i32 @addstr(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.10, i64 0, i64 0))
br label %78
68: ; preds = %58, %51
%69 = tail call i32 @addstr(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.2, i64 0, i64 0))
%70 = tail call i32 @addstr(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.10, i64 0, i64 0))
br i1 %18, label %71, label %78
71: ; preds = %68
%72 = load i32, i32* @A_STANDOUT
%73 = tail call i32 @attron(i32 %72)
%74 = tail call i32 @addstr(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.3, i64 0, i64 0))
%75 = load i32, i32* @A_STANDOUT
%76 = tail call i32 @attroff(i32 %75)
%77 = tail call i32 @addstr(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.10, i64 0, i64 0))
br label %81
78: ; preds = %68, %61
%79 = tail call i32 @addstr(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.3, i64 0, i64 0))
%80 = tail call i32 @addstr(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.10, i64 0, i64 0))
br i1 %19, label %83, label %81
81: ; preds = %71, %78
%82 = tail call i32 @addstr(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.4, i64 0, i64 0))
br label %89
83: ; preds = %78
%84 = load i32, i32* @A_STANDOUT
%85 = tail call i32 @attron(i32 %84)
%86 = tail call i32 @addstr(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.4, i64 0, i64 0))
%87 = load i32, i32* @A_STANDOUT
%88 = tail call i32 @attroff(i32 %87)
br label %89
89: ; preds = %83, %81
%90 = tail call i32 @COLOR_PAIR(i32 1)
%91 = tail call i32 @attroff(i32 %90)
%92 = load i8*, i8** %20
%93 = tail call i32 @printDesc(i8* %92)
%94 = tail call i32 (...) @refresh()
%95 = tail call i32 (...) @getch()
switch i32 %95, label %105 [
i32 108, label %96
i32 128, label %96
i32 104, label %100
i32 129, label %100
i32 32, label %104
i32 10, label %104
]
96: ; preds = %89, %89
%97 = icmp eq i16 %13, 4
%98 = add i16 %13, 1
%99 = select i1 %97, i16 0, i16 %98
br label %110
100: ; preds = %89, %89
%101 = icmp eq i16 %13, 0
%102 = add i16 %13, -1
%103 = select i1 %101, i16 4, i16 %102
br label %110
104: ; preds = %89, %89
switch i16 %13, label %105 [
i16 4, label %112
i16 1, label %106
i16 3, label %108
]
105: ; preds = %104, %89
br label %21
106: ; preds = %104
%107 = tail call i32 @playGame(i32 0, i32 0)
br label %110
108: ; preds = %104
%109 = tail call i32 (...) @runCreditsMenu()
br label %110
110: ; preds = %108, %106, %96, %100
%111 = phi i16 [ %103, %100 ], [ %99, %96 ], [ 1, %106 ], [ 3, %108 ]
br label %12
112: ; preds = %104
ret void
}