// File: /workspace/github_cpp_makefile_star2_O2/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 $0xf8, %rsp
callq 0x5c00
movq %rax, 0x7c72(%rip)      # 0xa248
movq %rax, %rdi
callq 0x5c26
callq 0x2825
movq 0x7c5e(%rip), %rbx      # 0xa248
leaq 0x3bae(%rip), %rsi      # 0x619f
leaq 0x18(%rsp), %rdi
leaq 0x38(%rsp), %rdx
callq 0x2110
leaq 0x98(%rsp), %rdi
leaq 0x18(%rsp), %rdx
movq %rbx, %rsi
callq 0x561c
leaq 0x18(%rsp), %rdi
callq 0x2130
leaq 0x3b9a(%rip), %rsi      # 0x61c0
leaq 0x38(%rsp), %r14
leaq 0x10(%rsp), %rdx
movq %r14, %rdi
callq 0x2110
leaq 0x58(%rsp), %r15
leaq 0x3b88(%rip), %rsi      # 0x61cc
leaq 0xc(%rsp), %rdx
movq %r15, %rdi
callq 0x2110
leaq 0x78(%rsp), %r15
leaq 0x3b7b(%rip), %rsi      # 0x61d8
leaq 0x17(%rsp), %rdx
movq %r15, %rdi
callq 0x2110
leaq 0x98(%rsp), %rdi
leaq 0x38(%rsp), %rsi
pushq $0x3
popq %rdx
callq 0x5652
pushq $0x40
popq %rbx
leaq (%rsp,%rbx), %rdi
addq $0x38, %rdi
callq 0x2130
addq $-0x20, %rbx
cmpq $-0x20, %rbx
jne 0x2682
leaq 0x98(%rsp), %rdi
callq 0x5688
testl %eax, %eax
je 0x26b9
cmpl $0x1, %eax
jne 0x26b4
callq 0x2920
callq 0x2ce7
movq 0x7b88(%rip), %rdi      # 0xa248
callq 0x5c9e
leaq 0x3b11(%rip), %rdi      # 0x61dd
pushq $0x9
popq %rbx
pushq $0x3c
popq %rdx
movl %ebx, %esi
xorl %eax, %eax
callq 0x2040
movq 0x78d6(%rip), %r12      # 0x9fb8
movq (%r12), %rdi
callq 0x22a0
leaq 0x3b07(%rip), %r14      # 0x61f9
leaq 0x10(%rsp), %r15
movq %r14, %rdi
movq %r15, %rsi
xorl %eax, %eax
callq 0x2270
leaq 0x3af1(%rip), %rdi      # 0x61fc
pushq $0x14
popq %rdx
movl %ebx, %esi
xorl %eax, %eax
callq 0x2040
movq (%r12), %rdi
callq 0x22a0
leaq 0xc(%rsp), %rsi
movq %r14, %rdi
xorl %eax, %eax
callq 0x2270
movl (%r15), %eax
cmpl $0x8, %eax
jg 0x2741
movl $0x9, 0x10(%rsp)
jmp 0x274e
cmpl $0x3d, %eax
jb 0x274e
movl $0x3c, 0x10(%rsp)
movl 0xc(%rsp), %eax
cmpl $0x8, %eax
jg 0x2761
movl $0x9, 0xc(%rsp)
jmp 0x276e
cmpl $0x15, %eax
jb 0x276e
movl $0x14, 0xc(%rsp)
movq 0x7ad3(%rip), %rdi      # 0xa248
callq 0x5c26
movq 0x7ac7(%rip), %rsi      # 0xa248
movl 0xc(%rsp), %edx
movl 0x10(%rsp), %ecx
leaq 0x38(%rsp), %rdi
callq 0x488c
leaq 0x38(%rsp), %rdi
callq 0x492e
leaq 0x38(%rsp), %rdi
callq 0x4924
jmp 0x26b4
movq %rax, %rbx
leaq 0x38(%rsp), %rdi
callq 0x4924
jmp 0x27fc
jmp 0x27f9
jmp 0x27f9
jmp 0x27f9
movq %rax, %rbx
pushq $0x40
popq %r14
leaq (%rsp,%r14), %rdi
addq $0x38, %rdi
callq 0x2130
addq $-0x20, %r14
cmpq $-0x20, %r14
jne 0x27c8
jmp 0x27fc
jmp 0x27e3
movq %rax, %rbx
addq $-0x20, %r15
movq %r15, %rdi
callq 0x2130
cmpq %r14, %r15
jne 0x27e6
jmp 0x27fc
movq %rax, %rbx
leaq 0x98(%rsp), %rdi
callq 0x413c
jmp 0x281d
movq %rax, %rbx
leaq 0x18(%rsp), %rdi
callq 0x2130
jmp 0x281d
movq %rax, %rbx
movq %rbx, %rdi
callq 0x23d0