// File: /workspace/github_cpp_makefile_star2_O1/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 %r13
pushq %r12
pushq %rbx
subq $0xf0, %rsp
callq 0x6478
movq %rax, 0x8c30(%rip)      # 0xb248
movq %rax, %rdi
callq 0x64a4
callq 0x28dc
movq 0x8c1c(%rip), %rbx      # 0xb248
leaq 0x80(%rsp), %r15
movq %r15, -0x10(%r15)
leaq 0x4b60(%rip), %rsi      # 0x719f
leaq 0x4b79(%rip), %rdx      # 0x71bf
leaq 0x70(%rsp), %r14
movq %r14, %rdi
callq 0x4744
leaq 0x90(%rsp), %rdi
movq %rbx, %rsi
movq %r14, %rdx
callq 0x5cd4
movq 0x70(%rsp), %rdi
cmpq %r15, %rdi
je 0x2675
callq 0x21e0
leaq 0x20(%rsp), %rax
movq %rax, -0x10(%rax)
leaq 0x4b3b(%rip), %rsi      # 0x71c0
leaq 0x4b3f(%rip), %rdx      # 0x71cb
leaq 0x10(%rsp), %r15
movq %r15, %rdi
callq 0x4744
leaq 0x30(%rsp), %r14
leaq 0x40(%rsp), %rax
movq %rax, -0x10(%rax)
leaq 0x4b1e(%rip), %rsi      # 0x71cc
leaq 0x4b22(%rip), %rdx      # 0x71d7
movq %r14, %rdi
callq 0x4744
leaq 0x50(%rsp), %r14
leaq 0x60(%rsp), %r12
movq %r12, -0x10(%r12)
leaq 0x4b05(%rip), %rsi      # 0x71d8
leaq 0x4b02(%rip), %rdx      # 0x71dc
movq %r14, %rdi
callq 0x4744
leaq 0x90(%rsp), %rdi
leaq 0x10(%rsp), %rsi
movl $0x3, %edx
callq 0x5d1a
leaq 0x60(%rsp), %rbx
xorl %r14d, %r14d
movq 0x50(%rsp,%r14), %rdi
leaq (%rbx,%r14), %rax
cmpq %rdi, %rax
je 0x2714
callq 0x21e0
addq $-0x20, %r14
cmpq $-0x60, %r14
jne 0x2701
leaq 0x90(%rsp), %rdi
callq 0x5d50
testl %eax, %eax
je 0x273e
cmpl $0x1, %eax
jne 0x2739
callq 0x29fa
callq 0x2e80
movq 0x8b03(%rip), %rdi      # 0xb248
callq 0x6544
leaq 0x4a8c(%rip), %rdi      # 0x71dd
movl $0x9, %esi
movl $0x3c, %edx
xorl %eax, %eax
callq 0x2040
movq 0x884f(%rip), %r15      # 0xafb8
movq (%r15), %rdi
callq 0x22b0
leaq 0x4a81(%rip), %rbx      # 0x71f9
leaq 0xc(%rsp), %r14
movq %rbx, %rdi
movq %r14, %rsi
xorl %eax, %eax
callq 0x2280
leaq 0x4a6b(%rip), %rdi      # 0x71fc
movl $0x9, %esi
movl $0x14, %edx
xorl %eax, %eax
callq 0x2040
movq (%r15), %rdi
callq 0x22b0
leaq 0x8(%rsp), %rsi
movq %rbx, %rdi
xorl %eax, %eax
callq 0x2280
cmpl $0x8, (%r14)
jg 0x27c7
movl $0x9, 0xc(%rsp)
cmpl $0x3d, 0xc(%rsp)
jl 0x27d6
movl $0x3c, 0xc(%rsp)
cmpl $0x8, 0x8(%rsp)
jg 0x27e5
movl $0x9, 0x8(%rsp)
cmpl $0x15, 0x8(%rsp)
jl 0x27f4
movl $0x14, 0x8(%rsp)
movq 0x8a4d(%rip), %rdi      # 0xb248
callq 0x64a4
movq 0x8a41(%rip), %rsi      # 0xb248
movl 0x8(%rsp), %edx
movl 0xc(%rsp), %ecx
leaq 0x10(%rsp), %rdi
callq 0x4d84
leaq 0x10(%rsp), %rdi
callq 0x4f68
leaq 0x10(%rsp), %rdi
callq 0x4f5a
jmp 0x2739
movq %rax, %rbx
leaq 0x10(%rsp), %rdi
callq 0x4f5a
jmp 0x28b3
jmp 0x2845
jmp 0x2845
movq %rax, %rbx
jmp 0x28b3
movq %rax, %rbx
movq $-0x60, %r13
movq -0x10(%r12), %rdi
cmpq %rdi, %r12
je 0x2863
callq 0x21e0
addq $-0x20, %r12
addq $0x20, %r13
jne 0x2854
movb $0x1, %al
jmp 0x2882
jmp 0x2873
movq %rax, %rbx
xorl %eax, %eax
jmp 0x2882
movq %rax, %rbx
xorl %eax, %eax
movq %r15, %r14
cmpq %r14, %r15
sete %cl
orb %al, %cl
jne 0x28b3
addq $-0x10, %r14
leaq 0x10(%rsp), %r15
movq -0x10(%r14), %rdi
cmpq %rdi, %r14
je 0x28a3
callq 0x21e0
leaq -0x20(%r14), %rax
addq $-0x10, %r14
cmpq %r15, %r14
movq %rax, %r14
jne 0x2895
leaq 0x90(%rsp), %rdi
callq 0x4602
jmp 0x28d4
movq %rax, %rbx
movq 0x70(%rsp), %rdi
cmpq %r15, %rdi
je 0x28d4
callq 0x21e0
movq %rbx, %rdi
callq 0x23c0