// File: drofp[P]RoadRun/src/main_menu.cc
// Function: roadrun::MainMenu::PrintMenu()
void MainMenu::PrintMenu()
  {

    endwin();
    refresh();
    WINDOW *menu_win;
    WINDOW *info_win;

    int highlight = 1;
    int choice = 0;
    int c;

    initscr();
    clear();
    noecho();
    cbreak();
    curs_set(0);

    int startx = 5; //(80 - kWidth) / 2;
    int starty = 5; //(80 - kHeight) / 2;

    menu_win = newwin(kMenuHeight, kMenuWidth, starty, startx);
    info_win = newwin(kInfoHeight, kMenuWidth, starty, kMenuWidth+7);

    keypad(menu_win, TRUE);
    mvprintw(0, 0, "Use up and down arrows to choose, enter to select.");
    mvprintw(1, 0, "==================================================");
    mvprintw(2, 0, "To play: Press left and right arrow keys to move.");
    mvprintw(3, 0, "         Dodge the obstacles as long as you can!");
    mvprintw(4, 0, "Your Character: ^");
    mvwprintw(info_win, 0, 0, R"ronmak(
    ____                  ______
   / __ \____  ____ _____/ / __ \__  ______
  / /_/ / __ \/ __ `/ __  / /_/ / / / / __ \
 / _, _/ /_/ / /_/ / /_/ / _, _/ /_/ / / / /
/_/ |_|\____/\__,_/\__,_/_/ |_|\__,_/_/ /_/
              )ronmak");
    refresh();
    RenderOptions(menu_win, highlight);

    mvwprintw(info_win, 7, 0, "Easy High Score: %d",
                            difficulty_map->operator[](SettingsItem::kRegular));
    mvwprintw(info_win, 8, 0, "Hard High Score: %d",
                          difficulty_map->operator[](SettingsItem::kLudicrous));
    mvwprintw(info_win, 9, 0, "Previous Score: %d", *prev_score);
    wrefresh(info_win);

    int enter_pressed = 0;

    while(!enter_pressed)
    {
      c = wgetch(menu_win);
      switch (c)
      {
      case KEY_UP:
        if(highlight == 1)
            highlight = 3;
        else
          --highlight;
          break;
      case KEY_DOWN:
        if(highlight == 3)
          highlight = 1;
        else
          ++highlight;
        break;
      case 10:
        choice = highlight;
        enter_pressed = 1;
        break;
      default:
        refresh();
        break;
      }
      current_choice = menu_item_list[highlight - 1];
      RenderOptions(menu_win, highlight);
    }

    wclear(menu_win);
    clear();
    refresh();
    wrefresh(menu_win);
    endwin();
  }

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x60, %rsp
movq %rdi, -0x8(%rbp)
movq -0x8(%rbp), %rax
movq %rax, -0x40(%rbp)
callq 0x21d0
callq 0x2260
movl $0x1, -0x1c(%rbp)
movl $0x0, -0x20(%rbp)
callq 0x2230
callq 0x2270
callq 0x21c0
callq 0x2070
xorl %edi, %edi
callq 0x2110
movl $0x5, -0x28(%rbp)
movl $0x5, -0x2c(%rbp)
movl -0x2c(%rbp), %edx
movl -0x28(%rbp), %ecx
movl $0x1e, %edi
movl $0x3d, %esi
callq 0x2170
movq %rax, -0x10(%rbp)
movl -0x2c(%rbp), %edx
movl $0x1e, %edi
movl $0x3d, %esi
movl $0x44, %ecx
callq 0x2170
movq %rax, -0x18(%rbp)
movq -0x10(%rbp), %rdi
movl $0x1, %esi
callq 0x20a0
xorl %esi, %esi
leaq 0x1e73(%rip), %rdx      # 0x6d43
movl %esi, %edi
movb $0x0, %al
callq 0x2200
movl $0x1, %edi
xorl %esi, %esi
leaq 0x1e8f(%rip), %rdx      # 0x6d76
movb $0x0, %al
callq 0x2200
movl $0x2, %edi
xorl %esi, %esi
leaq 0x1ead(%rip), %rdx      # 0x6da9
movb $0x0, %al
callq 0x2200
movl $0x3, %edi
xorl %esi, %esi
leaq 0x1eca(%rip), %rdx      # 0x6ddb
movb $0x0, %al
callq 0x2200
movl $0x4, %edi
xorl %esi, %esi
leaq 0x1ee6(%rip), %rdx      # 0x6e0c
movb $0x0, %al
callq 0x2200
movq -0x18(%rbp), %rdi
xorl %edx, %edx
leaq 0x1ee4(%rip), %rcx      # 0x6e1e
movl %edx, %esi
movb $0x0, %al
callq 0x2040
callq 0x2260
movq -0x40(%rbp), %rdi
movq -0x10(%rbp), %rsi
movl -0x1c(%rbp), %edx
movq (%rdi), %rax
callq *0x10(%rax)
movq -0x40(%rbp), %rax
movq -0x18(%rbp), %rcx
movq %rcx, -0x50(%rbp)
movq 0x18(%rax), %rdi
movl $0x0, -0x30(%rbp)
leaq -0x30(%rbp), %rsi
callq 0x4390
movq -0x50(%rbp), %rdi
movl (%rax), %r8d
movl $0x7, %esi
xorl %edx, %edx
leaq 0x1f73(%rip), %rcx      # 0x6f01
movb $0x0, %al
callq 0x2040
movq -0x40(%rbp), %rax
movq -0x18(%rbp), %rcx
movq %rcx, -0x48(%rbp)
movq 0x18(%rax), %rdi
movl $0x1, -0x34(%rbp)
leaq -0x34(%rbp), %rsi
callq 0x4390
movq -0x48(%rbp), %rdi
movl (%rax), %r8d
movl $0x8, %esi
xorl %edx, %edx
leaq 0x1f4b(%rip), %rcx      # 0x6f15
movb $0x0, %al
callq 0x2040
movq -0x40(%rbp), %rax
movq -0x18(%rbp), %rdi
movq 0x20(%rax), %rax
movl (%rax), %r8d
movl $0x9, %esi
xorl %edx, %edx
leaq 0x1f3b(%rip), %rcx      # 0x6f29
movb $0x0, %al
callq 0x2040
movq -0x18(%rbp), %rdi
callq 0x21b0
movl $0x0, -0x38(%rbp)
cmpl $0x0, -0x38(%rbp)
setne %al
xorb $-0x1, %al
testb $0x1, %al
jne 0x5017
jmp 0x50bc
movq -0x10(%rbp), %rdi
callq 0x2090
movl %eax, -0x24(%rbp)
movl -0x24(%rbp), %eax
movl %eax, -0x54(%rbp)
subl $0xa, %eax
je 0x507c
jmp 0x5030
movl -0x54(%rbp), %eax
subl $0x102, %eax            # imm = 0x102
je 0x5062
jmp 0x503c
movl -0x54(%rbp), %eax
subl $0x103, %eax            # imm = 0x103
jne 0x508b
jmp 0x5048
cmpl $0x1, -0x1c(%rbp)
jne 0x5057
movl $0x3, -0x1c(%rbp)
jmp 0x5060
movl -0x1c(%rbp), %eax
addl $-0x1, %eax
movl %eax, -0x1c(%rbp)
jmp 0x5090
cmpl $0x3, -0x1c(%rbp)
jne 0x5071
movl $0x1, -0x1c(%rbp)
jmp 0x507a
movl -0x1c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x1c(%rbp)
jmp 0x5090
movl -0x1c(%rbp), %eax
movl %eax, -0x20(%rbp)
movl $0x1, -0x38(%rbp)
jmp 0x5090
callq 0x2260
movq -0x40(%rbp), %rdi
movl -0x1c(%rbp), %eax
subl $0x1, %eax
movslq %eax, %rcx
leaq 0x1e98(%rip), %rax      # 0x6f3c
movl (%rax,%rcx,4), %eax
movl %eax, 0x10(%rdi)
movq -0x10(%rbp), %rsi
movl -0x1c(%rbp), %edx
movq (%rdi), %rax
callq *0x10(%rax)
jmp 0x5005
movq -0x10(%rbp), %rdi
callq 0x2150
callq 0x2270
callq 0x2260
movq -0x10(%rbp), %rdi
callq 0x21b0
callq 0x21d0
addq $0x60, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)