// File: /workspace/github_cpp_makefile_star2_O1/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
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %rdi, %rbx
callq 0x21b0
callq 0x2240
callq 0x2210
callq 0x2250
callq 0x21a0
callq 0x2070
xorl %r12d, %r12d
xorl %edi, %edi
callq 0x2100
movl $0x1e, %edi
movl $0x3d, %esi
movl $0x5, %edx
movl $0x5, %ecx
callq 0x2150
movq %rax, %r14
movl $0x1e, %edi
movl $0x3d, %esi
movl $0x5, %edx
movl $0x44, %ecx
callq 0x2150
movq %rax, %r15
movq %r14, %rdi
movl $0x1, %esi
callq 0x2090
leaq 0x1327(%rip), %rdx      # 0x45fe
xorl %edi, %edi
xorl %esi, %esi
xorl %eax, %eax
callq 0x21e0
leaq 0x1348(%rip), %rdx      # 0x4631
movl $0x1, %edi
xorl %esi, %esi
xorl %eax, %eax
callq 0x21e0
leaq 0x1366(%rip), %rdx      # 0x4664
movl $0x2, %edi
xorl %esi, %esi
xorl %eax, %eax
callq 0x21e0
leaq 0x1383(%rip), %rdx      # 0x4696
movl $0x3, %edi
xorl %esi, %esi
xorl %eax, %eax
callq 0x21e0
leaq 0x139f(%rip), %rdx      # 0x46c7
movl $0x4, %edi
xorl %esi, %esi
xorl %eax, %eax
callq 0x21e0
leaq 0x139c(%rip), %rcx      # 0x46d9
movq %r15, %rdi
xorl %esi, %esi
xorl %edx, %edx
xorl %eax, %eax
callq 0x2040
callq 0x2240
movq (%rbx), %rax
movq %rbx, %rdi
movq %r14, %rsi
movl $0x1, %edx
callq *0x10(%rax)
movq 0x18(%rbx), %rdi
leaq -0x30(%rbp), %rsi
movl $0x0, (%rsi)
callq 0x2f94
movl (%rax), %r8d
leaq 0x143e(%rip), %rcx      # 0x47bc
movq %r15, %rdi
movl $0x7, %esi
xorl %edx, %edx
xorl %eax, %eax
callq 0x2040
movq 0x18(%rbx), %rdi
leaq -0x2c(%rbp), %rsi
movl $0x1, (%rsi)
callq 0x2f94
movl (%rax), %r8d
leaq 0x1424(%rip), %rcx      # 0x47d0
movq %r15, %rdi
movl $0x8, %esi
xorl %edx, %edx
xorl %eax, %eax
callq 0x2040
movq 0x20(%rbx), %rax
movl (%rax), %r8d
leaq 0x1419(%rip), %rcx      # 0x47e4
movq %r15, %rdi
movl $0x9, %esi
xorl %edx, %edx
xorl %eax, %eax
callq 0x2040
movq %r15, %rdi
callq 0x2190
leaq 0x140d(%rip), %r13      # 0x47f8
movl $0x1, %r15d
movq %r14, %rdi
callq 0x2080
cmpl $0xa, %eax
je 0x3430
cmpl $0x102, %eax            # imm = 0x102
je 0x341b
cmpl $0x103, %eax            # imm = 0x103
jne 0x3438
cmpl $0x1, %r15d
leal -0x1(%r15), %eax
movl $0x3, %ecx
jmp 0x3428
cmpl $0x3, %r15d
leal 0x1(%r15), %eax
movl $0x1, %ecx
cmovel %ecx, %eax
movl %eax, %r15d
jmp 0x343d
movl $0x1, %r12d
jmp 0x343d
callq 0x2240
leal -0x1(%r15), %eax
movl (%r13,%rax,4), %eax
movl %eax, 0x10(%rbx)
movq (%rbx), %rax
movq %rbx, %rdi
movq %r14, %rsi
movl %r15d, %edx
callq *0x10(%rax)
testl %r12d, %r12d
je 0x33f1
movq %r14, %rdi
callq 0x2130
callq 0x2250
callq 0x2240
movq %r14, %rdi
callq 0x2190
callq 0x21b0
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
nop