// File: 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:
subq $0x208, %rsp            # imm = 0x208
movl $0x0, 0x204(%rsp)
callq 0x10fa0
movq %rax, 0x17bfa(%rip)     # 0x1a268
movq 0x17bf3(%rip), %rdi     # 0x1a268
callq 0x11010
callq 0x2be0
movq 0x17be2(%rip), %rax     # 0x1a268
movq %rax, 0x78(%rsp)
leaq 0x17f(%rsp), %rdi
movq %rdi, 0x80(%rsp)
callq 0x2410
movq 0x80(%rsp), %rdx
leaq 0xfb81(%rip), %rsi      # 0x12230
leaq 0x180(%rsp), %rdi
callq 0x2340
jmp 0x26be
movq 0x78(%rsp), %rsi
leaq 0x1a0(%rsp), %rdi
leaq 0x180(%rsp), %rdx
callq 0xf400
jmp 0x26da
leaq 0x180(%rsp), %rdi
callq 0x2180
leaq 0x17f(%rsp), %rdi
callq 0x22a0
movb $0x1, 0xec(%rsp)
leaq 0xf8(%rsp), %rax
movq %rax, 0x68(%rsp)
movq %rax, 0xf0(%rsp)
leaq 0xef(%rsp), %rdi
movq %rdi, 0x70(%rsp)
callq 0x2410
movq 0x68(%rsp), %rdi
movq 0x70(%rsp), %rdx
leaq 0xfb1d(%rip), %rsi      # 0x12251
callq 0x2340
jmp 0x273b
leaq 0x118(%rsp), %rax
movq %rax, 0x58(%rsp)
movq %rax, 0xf0(%rsp)
leaq 0xee(%rsp), %rdi
movq %rdi, 0x60(%rsp)
callq 0x2410
movq 0x58(%rsp), %rdi
movq 0x60(%rsp), %rdx
leaq 0xfaea(%rip), %rsi      # 0x1225d
callq 0x2340
jmp 0x277a
leaq 0x138(%rsp), %rax
movq %rax, 0x48(%rsp)
movq %rax, 0xf0(%rsp)
leaq 0xed(%rsp), %rdi
movq %rdi, 0x50(%rsp)
callq 0x2410
movq 0x48(%rsp), %rdi
movq 0x50(%rsp), %rdx
leaq 0xfab7(%rip), %rsi      # 0x12269
callq 0x2340
jmp 0x27b9
movb $0x0, 0xec(%rsp)
leaq 0xf8(%rsp), %rax
movq %rax, 0x158(%rsp)
movq $0x3, 0x160(%rsp)
movq 0x158(%rsp), %rsi
movq 0x160(%rsp), %rdx
leaq 0x1a0(%rsp), %rdi
callq 0xf460
jmp 0x27fc
leaq 0xf8(%rsp), %rax
movq %rax, 0x38(%rsp)
addq $0x60, %rax
movq %rax, 0x40(%rsp)
movq 0x40(%rsp), %rdi
addq $-0x20, %rdi
movq %rdi, 0x30(%rsp)
callq 0x2180
movq 0x38(%rsp), %rcx
movq 0x30(%rsp), %rax
cmpq %rcx, %rax
movq %rax, 0x40(%rsp)
jne 0x2812
leaq 0xed(%rsp), %rdi
callq 0x22a0
leaq 0xee(%rsp), %rdi
callq 0x22a0
leaq 0xef(%rsp), %rdi
callq 0x22a0
leaq 0x1a0(%rsp), %rdi
callq 0xf4f0
movl %eax, 0x2c(%rsp)
jmp 0x2873
movl 0x2c(%rsp), %eax
movl %eax, 0xe8(%rsp)
movl 0xe8(%rsp), %eax
movl %eax, 0x28(%rsp)
testl %eax, %eax
je 0x2a2a
jmp 0x2893
movl 0x28(%rsp), %eax
subl $0x1, %eax
je 0x2b85
jmp 0x28a2
movl 0x28(%rsp), %eax
subl $0x2, %eax
je 0x2b8e
jmp 0x2b97
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x170(%rsp)
movl %eax, 0x16c(%rsp)
jmp 0x28eb
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x170(%rsp)
movl %eax, 0x16c(%rsp)
leaq 0x180(%rsp), %rdi
callq 0x2180
leaq 0x17f(%rsp), %rdi
callq 0x22a0
jmp 0x2bd2
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x170(%rsp)
movl %eax, 0x16c(%rsp)
jmp 0x29af
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x170(%rsp)
movl %eax, 0x16c(%rsp)
jmp 0x29a2
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x170(%rsp)
movl %eax, 0x16c(%rsp)
jmp 0x2995
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x170(%rsp)
movl %eax, 0x16c(%rsp)
leaq 0xf8(%rsp), %rax
movq %rax, 0x18(%rsp)
addq $0x60, %rax
movq %rax, 0x20(%rsp)
movq 0x20(%rsp), %rdi
addq $-0x20, %rdi
movq %rdi, 0x10(%rsp)
callq 0x2180
movq 0x18(%rsp), %rcx
movq 0x10(%rsp), %rax
cmpq %rcx, %rax
movq %rax, 0x20(%rsp)
jne 0x296c
jmp 0x2995
leaq 0xed(%rsp), %rdi
callq 0x22a0
leaq 0xee(%rsp), %rdi
callq 0x22a0
leaq 0xef(%rsp), %rdi
callq 0x22a0
testb $0x1, 0xec(%rsp)
jne 0x29c8
jmp 0x2a0c
movq 0xf0(%rsp), %rax
leaq 0xf8(%rsp), %rcx
cmpq %rax, %rcx
movq %rax, 0x8(%rsp)
je 0x2a0a
movq 0x8(%rsp), %rdi
addq $-0x20, %rdi
movq %rdi, (%rsp)
callq 0x2180
movq (%rsp), %rax
leaq 0xf8(%rsp), %rcx
cmpq %rcx, %rax
movq %rax, 0x8(%rsp)
jne 0x29e2
jmp 0x2a0c
jmp 0x2bc5
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x170(%rsp)
movl %eax, 0x16c(%rsp)
jmp 0x2bc5
movq 0x17837(%rip), %rdi     # 0x1a268
callq 0x11110
jmp 0x2a38
leaq 0xf82f(%rip), %rdi      # 0x1226e
xorl %eax, %eax
movl $0x9, %esi
movl $0x3c, %edx
callq 0x2040
jmp 0x2a52
movq 0x1755f(%rip), %rax     # 0x19fb8
movq (%rax), %rdi
callq 0x22f0
jmp 0x2a63
leaq 0xf820(%rip), %rdi      # 0x1228a
xorl %eax, %eax
leaq 0xe4(%rsp), %rsi
callq 0x22c0
jmp 0x2a7b
leaq 0xf80b(%rip), %rdi      # 0x1228d
xorl %eax, %eax
movl $0x9, %esi
movl $0x14, %edx
callq 0x2040
jmp 0x2a95
movq 0x1751c(%rip), %rax     # 0x19fb8
movq (%rax), %rdi
callq 0x22f0
jmp 0x2aa6
leaq 0xf7dd(%rip), %rdi      # 0x1228a
xorl %eax, %eax
leaq 0xe0(%rsp), %rsi
callq 0x22c0
jmp 0x2abe
cmpl $0x9, 0xe4(%rsp)
jge 0x2ad3
movl $0x9, 0xe4(%rsp)
cmpl $0x3c, 0xe4(%rsp)
jle 0x2ae8
movl $0x3c, 0xe4(%rsp)
cmpl $0x9, 0xe0(%rsp)
jge 0x2afd
movl $0x9, 0xe0(%rsp)
cmpl $0x14, 0xe0(%rsp)
jle 0x2b12
movl $0x14, 0xe0(%rsp)
movq 0x1774f(%rip), %rdi     # 0x1a268
callq 0x11010
jmp 0x2b20
movq 0x17741(%rip), %rsi     # 0x1a268
movl 0xe0(%rsp), %edx
movl 0xe4(%rsp), %ecx
leaq 0x88(%rsp), %rdi
callq 0xb9a0
jmp 0x2b44
leaq 0x88(%rsp), %rdi
callq 0xbb60
jmp 0x2b53
leaq 0x88(%rsp), %rdi
callq 0xbb40
jmp 0x2b97
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x170(%rsp)
movl %eax, 0x16c(%rsp)
leaq 0x88(%rsp), %rdi
callq 0xbb40
jmp 0x2bc5
callq 0x2d00
jmp 0x2b8c
jmp 0x2b97
callq 0x3520
jmp 0x2b95
jmp 0x2b97
callq 0x3520
jmp 0x2b9e
movl $0x0, 0x204(%rsp)
leaq 0x1a0(%rsp), %rdi
callq 0x8a70
movl 0x204(%rsp), %eax
addq $0x208, %rsp            # imm = 0x208
retq
leaq 0x1a0(%rsp), %rdi
callq 0x8a70
movq 0x170(%rsp), %rdi
callq 0x2400
nop