// File: /workspace/github_cpp_makefile_star2_O3/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 %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 0x1313(%rip), %rdx      # 0x45bb
xorl %edi, %edi
xorl %esi, %esi
xorl %eax, %eax
callq 0x21e0
leaq 0x1334(%rip), %rdx      # 0x45ee
movl $0x1, %edi
xorl %esi, %esi
xorl %eax, %eax
callq 0x21e0
leaq 0x1352(%rip), %rdx      # 0x4621
movl $0x2, %edi
xorl %esi, %esi
xorl %eax, %eax
callq 0x21e0
leaq 0x136f(%rip), %rdx      # 0x4653
movl $0x3, %edi
xorl %esi, %esi
xorl %eax, %eax
callq 0x21e0
leaq 0x138b(%rip), %rdx      # 0x4684
movl $0x4, %edi
xorl %esi, %esi
xorl %eax, %eax
callq 0x21e0
leaq 0x1388(%rip), %rcx      # 0x4696
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 0x2f66
movl (%rax), %r8d
leaq 0x142a(%rip), %rcx      # 0x4779
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 0x2f66
movl (%rax), %r8d
leaq 0x1410(%rip), %rcx      # 0x478d
movq %r15, %rdi
movl $0x8, %esi
xorl %edx, %edx
xorl %eax, %eax
callq 0x2040
movq 0x20(%rbx), %rax
movl (%rax), %r8d
leaq 0x1405(%rip), %rcx      # 0x47a1
movq %r15, %rdi
movl $0x9, %esi
xorl %edx, %edx
xorl %eax, %eax
callq 0x2040
movq %r15, %rdi
callq 0x2190
leaq 0x13f8(%rip), %r12      # 0x47b4
movl $0x1, %r15d
movq %r14, %rdi
callq 0x2080
cmpl $0xa, %eax
je 0x3404
cmpl $0x102, %eax            # imm = 0x102
je 0x33ec
cmpl $0x103, %eax            # imm = 0x103
jne 0x3409
cmpl $0x1, %r15d
leal -0x1(%r15), %eax
movl $0x3, %ecx
jmp 0x33f9
cmpl $0x3, %r15d
leal 0x1(%r15), %eax
movl $0x1, %ecx
cmovel %ecx, %eax
movb $0x1, %r13b
movl %eax, %r15d
jmp 0x3411
xorl %r13d, %r13d
jmp 0x3411
callq 0x2240
movb $0x1, %r13b
leal -0x1(%r15), %eax
movl (%r12,%rax,4), %eax
movl %eax, 0x10(%rbx)
movq (%rbx), %rax
movq %rbx, %rdi
movq %r14, %rsi
movl %r15d, %edx
callq *0x10(%rax)
testb %r13b, %r13b
jne 0x33c2
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