// File: /workspace/github_cpp_makefile_star2_O3/Dalgona[P]mine/mine.cpp
// Function: main
int main(void)
{
  scr = screen::getInstance();
  scr->enable();
  initColors();

  menu mainMenu(scr, "[ MINESWEEPER ] Select game mode");
  mainMenu.add({ "Custom Mode", "Arcade Mode", "Exit" });
  int sel = mainMenu.start_menu();
  switch (sel)
  {
  case 0:
  {
    scr->disable();

    int fW, fH;
    printf("Hosizontal size (%d ~ %d)> ", MF_W_MIN, MF_W_MAX);
    fflush(stdout);
    scanf("%d", &fW);
    printf("Vertical size (%d ~ %d)> ", MF_H_MIN, MF_H_MAX);
    fflush(stdout);
    scanf("%d", &fH);

    if (fW < MF_W_MIN) fW = MF_W_MIN;
    if (fW > MF_W_MAX) fW = MF_W_MAX;
    if (fH < MF_H_MIN) fH = MF_H_MIN;
    if (fH > MF_H_MAX) fH = MF_H_MAX;

    scr->enable();
    game theGame(scr, fH, fW);
    theGame.start();
  } break;
  case 1: begin_arcade(); break;
  case 2: exit_game(); break;
  }

  exit_game();

  return 0;
}

// Assembly:
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
subq $0xe8, %rsp
callq 0x6400
movq %rax, 0x8c32(%rip)      # 0xb248
movq %rax, %rdi
callq 0x6428
callq 0x28ba
movq 0x8c1e(%rip), %rbx      # 0xb248
leaq 0x78(%rsp), %r15
movq %r15, -0x10(%r15)
leaq 0x4b65(%rip), %rsi      # 0x719f
leaq 0x4b7e(%rip), %rdx      # 0x71bf
leaq 0x68(%rsp), %r14
movq %r14, %rdi
callq 0x4734
leaq 0x88(%rsp), %rdi
movq %rbx, %rsi
movq %r14, %rdx
callq 0x5c9c
movq 0x68(%rsp), %rdi
cmpq %r15, %rdi
je 0x2670
callq 0x21e0
leaq 0x18(%rsp), %rax
movq %rax, -0x10(%rax)
leaq 0x4b40(%rip), %rsi      # 0x71c0
leaq 0x4b44(%rip), %rdx      # 0x71cb
leaq 0x8(%rsp), %r14
movq %r14, %rdi
callq 0x4734
leaq 0x28(%rsp), %r15
leaq 0x38(%rsp), %rax
movq %rax, -0x10(%rax)
leaq 0x4b23(%rip), %rsi      # 0x71cc
leaq 0x4b27(%rip), %rdx      # 0x71d7
movq %r15, %rdi
callq 0x4734
leaq 0x48(%rsp), %r15
leaq 0x58(%rsp), %r12
movq %r12, -0x10(%r12)
leaq 0x4b0a(%rip), %rsi      # 0x71d8
leaq 0x4b07(%rip), %rdx      # 0x71dc
movq %r15, %rdi
callq 0x4734
leaq 0x88(%rsp), %rdi
leaq 0x8(%rsp), %rsi
movl $0x3, %edx
callq 0x5ce2
leaq 0x58(%rsp), %rbx
xorl %r14d, %r14d
movq 0x48(%rsp,%r14), %rdi
leaq (%rbx,%r14), %rax
cmpq %rdi, %rax
je 0x270f
callq 0x21e0
addq $-0x20, %r14
cmpq $-0x60, %r14
jne 0x26fc
leaq 0x88(%rsp), %rdi
callq 0x5d18
testl %eax, %eax
je 0x2739
cmpl $0x1, %eax
jne 0x2734
callq 0x29d8
callq 0x2e3e
movq 0x8b08(%rip), %rdi      # 0xb248
callq 0x64cc
leaq 0x4a91(%rip), %rdi      # 0x71dd
movl $0x9, %esi
movl $0x3c, %edx
xorl %eax, %eax
callq 0x2040
movq 0x8854(%rip), %r15      # 0xafb8
movq (%r15), %rdi
callq 0x22b0
leaq 0x4a86(%rip), %rbx      # 0x71f9
leaq 0x4(%rsp), %r14
movq %rbx, %rdi
movq %r14, %rsi
xorl %eax, %eax
callq 0x2280
leaq 0x4a70(%rip), %rdi      # 0x71fc
movl $0x9, %esi
movl $0x14, %edx
xorl %eax, %eax
callq 0x2040
movq (%r15), %rdi
callq 0x22b0
movq %rsp, %rsi
movq %rbx, %rdi
xorl %eax, %eax
callq 0x2280
movl (%r14), %eax
cmpl $0x8, %eax
jg 0x27c4
movl $0x9, 0x4(%rsp)
jmp 0x27d1
cmpl $0x3d, %eax
jb 0x27d1
movl $0x3c, 0x4(%rsp)
movl (%rsp), %eax
cmpl $0x8, %eax
jg 0x27e2
movl $0x9, (%rsp)
jmp 0x27ee
cmpl $0x15, %eax
jb 0x27ee
movl $0x14, (%rsp)
movq 0x8a53(%rip), %rdi      # 0xb248
callq 0x6428
movq 0x8a47(%rip), %rsi      # 0xb248
movl (%rsp), %edx
movl 0x4(%rsp), %ecx
leaq 0x8(%rsp), %rdi
callq 0x4d60
leaq 0x8(%rsp), %rdi
callq 0x4f34
leaq 0x8(%rsp), %rdi
callq 0x4f26
jmp 0x2734
movq %rax, %rbx
leaq 0x8(%rsp), %rdi
callq 0x4f26
jmp 0x2891
jmp 0x288e
jmp 0x288e
jmp 0x288e
movq %rax, %rbx
movq $-0x60, %r14
movq -0x10(%r12), %rdi
cmpq %rdi, %r12
je 0x2859
callq 0x21e0
addq $-0x20, %r12
addq $0x20, %r14
jne 0x284a
jmp 0x2891
jmp 0x2867
movq %rax, %rbx
addq $-0x10, %r15
movq -0x10(%r15), %rdi
cmpq %rdi, %r15
je 0x287c
callq 0x21e0
leaq -0x20(%r15), %rax
addq $-0x10, %r15
cmpq %r14, %r15
movq %rax, %r15
jne 0x286e
jmp 0x2891
movq %rax, %rbx
leaq 0x88(%rsp), %rdi
callq 0x45f8
jmp 0x28b2
movq %rax, %rbx
movq 0x68(%rsp), %rdi
cmpq %r15, %rdi
je 0x28b2
callq 0x21e0
movq %rbx, %rdi
callq 0x23c0