// File: /workspace/github_cpp_makefile_star2_O3/Razakhel[P]RaZonogram/main.cpp
// Function: main
int main(int argc, char* argv[]) {
  Game game;
  Grid grid;

  if (argc == 2) {
    if (!grid.loadFromFile(argv[1]))
      std::cerr << "Error while opening the file." << std::endl;
  } else {
    std::cerr << "No input file provided, exiting." << std::endl;
    return 1;
  }

  std::cout << "Original grid:" << std::endl;
  std::cout << grid << std::endl;
  game.setGrid(grid);

  int choice = 0;

  do {
    std::cout << std::endl;
    std::cout << "1 - Play" << std::endl;
    std::cout << "2 - How to play" << std::endl;
    std::cout << "3 - Solve" << std::endl;
    std::cout << "4 - Quit" << std::endl;
    std::cin >> choice;

    if (choice == 1) { // Playing the game
      std::cout << "Implementation in progress." << std::endl;
      game.play();
    } else if (choice == 2) { // Printing the game explanations
      std::cout << "Implementation in progress." << std::endl;
    } else if (choice == 3) { // Solving the grid
      std::cout << "Solved grid:" << std::endl << grid.solve() << std::endl;
    } else if (choice == 4) { // Exiting the game
      std::cout << "Bye then!" << std::endl;
    } else { // Number entered nonexistant
      std::cout << "Wrong choice, try again." << std::endl;
    }
  } while (choice != 4);

  return 0;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0xc8, %rsp
movq %rsi, %rbx
movl %edi, %ebp
leaq 0x78(%rsp), %rdi
callq 0x249c
leaq 0x28(%rsp), %rdi
callq 0x2620
cmpl $0x2, %ebp
jne 0x44fa
movq 0x8(%rbx), %rsi
leaq 0x8(%rsp), %rdi
leaq 0x7(%rsp), %rdx
callq 0x45e6
leaq 0x28(%rsp), %rdi
leaq 0x8(%rsp), %rsi
callq 0x263c
movl %eax, %ebx
leaq 0x18(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x41a2
movq 0x18(%rsp), %rsi
incq %rsi
callq 0x2180
testb %bl, %bl
jne 0x41ec
movq 0x3e43(%rip), %rbx      # 0x7ff0
leaq 0xfb4(%rip), %rsi       # 0x5168
movl $0x1d, %edx
movq %rbx, %rdi
callq 0x2190
movq (%rbx), %rax
addq -0x18(%rax), %rbx
movq %rbx, %rdi
movl $0xa, %esi
callq 0x2160
movsbl %al, %esi
movq 0x3e11(%rip), %rdi      # 0x7ff0
callq 0x2030
movq %rax, %rdi
callq 0x20e0
movq 0x3dd5(%rip), %rbx      # 0x7fc8
leaq 0xfad(%rip), %rsi       # 0x51a7
movl $0xe, %edx
movq %rbx, %rdi
callq 0x2190
movq (%rbx), %rax
addq -0x18(%rax), %rbx
movq %rbx, %rdi
movl $0xa, %esi
callq 0x2160
movsbl %al, %esi
movq 0x3da3(%rip), %rdi      # 0x7fc8
callq 0x2030
movq %rax, %rdi
callq 0x20e0
movq 0x3d8f(%rip), %r12      # 0x7fc8
leaq 0x28(%rsp), %rsi
movq %r12, %rdi
callq 0x2ec4
movq %rax, %rbx
movq (%rax), %rax
movq -0x18(%rax), %rdi
addq %rbx, %rdi
movl $0xa, %esi
callq 0x2160
movsbl %al, %esi
movq %rbx, %rdi
callq 0x2030
movq %rax, %rdi
callq 0x20e0
leaq 0x78(%rsp), %rdi
leaq 0x28(%rsp), %rsi
callq 0x4624
leaq 0x8(%rsp), %r14
movl $0x0, (%r14)
leaq 0xf47(%rip), %rbp       # 0x51d9
movq 0x3d3f(%rip), %r15      # 0x7fd8
leaq 0xeb8(%rip), %r13       # 0x5158
movq (%r12), %rax
movq -0x18(%rax), %rdi
addq %r12, %rdi
movl $0xa, %esi
callq 0x2160
movsbl %al, %esi
movq %r12, %rdi
callq 0x2030
movq %rax, %rdi
callq 0x20e0
movl $0x8, %edx
movq %r12, %rdi
leaq 0xedf(%rip), %rsi       # 0x51b6
callq 0x2190
movq (%r12), %rax
movq -0x18(%rax), %rdi
addq %r12, %rdi
movl $0xa, %esi
callq 0x2160
movsbl %al, %esi
movq %r12, %rdi
callq 0x2030
movq %rax, %rdi
callq 0x20e0
movl $0xf, %edx
movq %r12, %rdi
leaq 0xeac(%rip), %rsi       # 0x51bf
callq 0x2190
movq (%r12), %rax
movq -0x18(%rax), %rdi
addq %r12, %rdi
movl $0xa, %esi
callq 0x2160
movsbl %al, %esi
movq %r12, %rdi
callq 0x2030
movq %rax, %rdi
callq 0x20e0
movl $0x9, %edx
movq %r12, %rdi
leaq 0xe80(%rip), %rsi       # 0x51cf
callq 0x2190
movq (%r12), %rax
movq -0x18(%rax), %rdi
addq %r12, %rdi
movl $0xa, %esi
callq 0x2160
movsbl %al, %esi
movq %r12, %rdi
callq 0x2030
movq %rax, %rdi
callq 0x20e0
movl $0x8, %edx
movq %r12, %rdi
movq %rbp, %rsi
callq 0x2190
movq (%r12), %rax
movq -0x18(%rax), %rdi
addq %r12, %rdi
movl $0xa, %esi
callq 0x2160
movsbl %al, %esi
movq %r12, %rdi
callq 0x2030
movq %rax, %rdi
callq 0x20e0
movq %r15, %rdi
movq %r14, %rsi
callq 0x20c0
movl 0x8(%rsp), %eax
decl %eax
cmpl $0x3, %eax
ja 0x44ac
movslq (%r13,%rax,4), %rax
addq %r13, %rax
jmpq *%rax
movl $0x1b, %edx
movq %r12, %rdi
leaq 0xdfb(%rip), %rsi       # 0x51e2
callq 0x2190
movq (%r12), %rax
movq -0x18(%rax), %rdi
addq %r12, %rdi
movl $0xa, %esi
callq 0x2160
movsbl %al, %esi
movq %r12, %rdi
callq 0x2030
movq %rax, %rdi
callq 0x20e0
leaq 0x78(%rsp), %rdi
callq 0x24a2
jmp 0x44eb
movl $0xc, %edx
movq %r12, %rdi
leaq 0xdcc(%rip), %rsi       # 0x51fe
callq 0x2190
movq (%r12), %rax
movq -0x18(%rax), %rdi
addq %r12, %rdi
movl $0xa, %esi
callq 0x2160
movsbl %al, %esi
movq %r12, %rdi
callq 0x2030
movq %rax, %rdi
callq 0x20e0
movq %rax, %rbx
leaq 0x28(%rsp), %rdi
callq 0x2aee
movq %rbx, %rdi
movq %rax, %rsi
callq 0x2ec4
movq %rax, %rbx
movq (%rax), %rax
movq -0x18(%rax), %rdi
addq %rbx, %rdi
movl $0xa, %esi
callq 0x2160
jmp 0x44d8
movl $0x9, %edx
leaq 0xd6f(%rip), %rsi       # 0x520b
jmp 0x44b8
movl $0x1b, %edx
leaq 0xd38(%rip), %rsi       # 0x51e2
jmp 0x44b8
movl $0x18, %edx
leaq 0xd5d(%rip), %rsi       # 0x5215
movq %r12, %rdi
callq 0x2190
movq (%r12), %rax
movq -0x18(%rax), %rdi
addq %r12, %rdi
movl $0xa, %esi
callq 0x2160
movq %r12, %rbx
movsbl %al, %esi
movq %rbx, %rdi
callq 0x2030
movq %rax, %rdi
callq 0x20e0
cmpl $0x4, 0x8(%rsp)
jne 0x42a0
xorl %ebx, %ebx
jmp 0x4545
movq 0x3aef(%rip), %rbx      # 0x7ff0
leaq 0xc7e(%rip), %rsi       # 0x5186
movl $0x20, %edx
movq %rbx, %rdi
callq 0x2190
movq (%rbx), %rax
addq -0x18(%rax), %rbx
movq %rbx, %rdi
movl $0xa, %esi
callq 0x2160
movsbl %al, %esi
movq 0x3abd(%rip), %rdi      # 0x7ff0
callq 0x2030
movl $0x1, %ebx
movq %rax, %rdi
callq 0x20e0
leaq 0x60(%rsp), %rdi
callq 0x4edc
leaq 0x48(%rsp), %rdi
callq 0x35a4
leaq 0x30(%rsp), %rdi
callq 0x35a4
leaq 0xb0(%rsp), %rdi
callq 0x4edc
leaq 0x98(%rsp), %rdi
callq 0x35a4
leaq 0x80(%rsp), %rdi
callq 0x35a4
movl %ebx, %eax
addq $0xc8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %rax, %rbx
leaq 0x18(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x45ca
movq 0x18(%rsp), %rsi
incq %rsi
callq 0x2180
jmp 0x45ca
jmp 0x45c7
movq %rax, %rbx
jmp 0x45d4
jmp 0x45c7
movq %rax, %rbx
leaq 0x28(%rsp), %rdi
callq 0x4668
leaq 0x78(%rsp), %rdi
callq 0x468c
movq %rbx, %rdi
callq 0x2230