// File: /workspace/github_cpp_makefile_star2_O3/Dalgona[P]mine/game.cpp
// Function: game::updateDisplay()
void game::updateDisplay()
{
  scr->mvprintw(0, 0, "[ MINESWEEPER ] ");
  if (newGame)
  {
    scr->with_color(4, [&]() {
      scr->printw("Step anywhere to start the game!");
    });
  }
  else
    scr->printw("%03d mines out of %03d (%02d, %02d)", nFlags, nMines, cX, cY);

  int num, color, c = 0;
  std::div_t d;
  char ch;
  for (const auto &i : field)
  {
    d = std::div(c++, cols);
    if (d.rem == 0) move(2 + d.quot, 8);

    if      (i & MF_DISP_UNKNOWN)  color = 200, ch = '.';
    else if (i & MF_DISP_FLAG)     color = 201, ch = 'F';
    else if (i & MF_DISP_QUESTION) color = 202, ch = '?';
    else if (i & MF_DISP_EMPTY)    color = 203, ch = ' ';
    else if (i & MF_DISP_NUMBER)
    {
      num = (i & 0x0FFFFFFF) >> 24;
      color = 100 + num, ch = '0' + num;
    }
    else if (i & MF_DISP_MINE)     color = 204, ch = '@';
    else if (i & MF_DISP_MINE_CLR) color = 205, ch = '@';

    scr->with_color(color, [&]() { addch(ch); });
  }

  scr->with_color(1, [&]() {
    scr->mvprintw(-1, 0, "ARROW/hjkl: MOVE    f: FLAG    q: NOTSURE    s: STEP");
  });
  move(2 + cY, 8 + cX);
  refresh();
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x68, %rsp
movq %rdi, %rbx
movq (%rdi), %rdi
leaq 0x2197(%rip), %rcx      # 0x75a4
xorl %esi, %esi
xorl %edx, %edx
xorl %eax, %eax
callq 0x657a
movq (%rbx), %rdi
cmpb $0x1, 0x3c(%rbx)
jne 0x546c
leaq 0x48(%rsp), %rdx
movq $0x0, 0x8(%rdx)
movq %rbx, (%rdx)
leaq 0x62e(%rip), %rax       # 0x5a66
movq %rax, 0x18(%rdx)
leaq 0x637(%rip), %rax       # 0x5a7a
movq %rax, 0x10(%rdx)
movl $0x4, %esi
callq 0x6630
movq 0x58(%rsp), %rax
testq %rax, %rax
je 0x5488
leaq 0x48(%rsp), %rdi
movq %rdi, %rsi
movl $0x3, %edx
callq *%rax
jmp 0x5488
movl 0x34(%rbx), %edx
movl 0x30(%rbx), %ecx
movl 0x28(%rbx), %r9d
movl 0x2c(%rbx), %r8d
leaq 0x2134(%rip), %rsi      # 0x75b5
xorl %eax, %eax
callq 0x64ec
movq 0x8(%rbx), %r12
movq 0x10(%rbx), %r13
cmpq %r13, %r12
je 0x55ae
xorl %ebp, %ebp
leaq 0x8(%rsp), %r14
movl 0x24(%rbx), %esi
movl %ebp, %edi
callq 0x21f0
movq %rax, %rcx
shrq $0x20, %rcx
jne 0x54c2
addl $0x2, %eax
movl %eax, %edi
movl $0x8, %esi
callq 0x2150
movl (%r12), %eax
btl $0x10, %eax
jb 0x54fe
btl $0x12, %eax
jb 0x550b
btl $0x13, %eax
jb 0x5518
btl $0x11, %eax
jb 0x5525
btl $0x1e, %eax
jb 0x5532
btl $0x14, %eax
jb 0x5544
testl $0xe00000, %eax         # imm = 0xE00000
je 0x554f
movb $0x40, 0x7(%rsp)
movl $0xcd, %r15d
jmp 0x554f
movb $0x2e, 0x7(%rsp)
movl $0xc8, %r15d
jmp 0x554f
movb $0x46, 0x7(%rsp)
movl $0xc9, %r15d
jmp 0x554f
movb $0x3f, 0x7(%rsp)
movl $0xca, %r15d
jmp 0x554f
movb $0x20, 0x7(%rsp)
movl $0xcb, %r15d
jmp 0x554f
shrl $0x18, %eax
andl $0xf, %eax
leal 0x64(%rax), %r15d
orb $0x30, %al
movb %al, 0x7(%rsp)
jmp 0x554f
movb $0x40, 0x7(%rsp)
movl $0xcc, %r15d
movq (%rbx), %rdi
movq $0x0, 0x10(%rsp)
leaq 0x7(%rsp), %rax
movq %rax, 0x8(%rsp)
leaq 0x534(%rip), %rax       # 0x5aa0
movq %rax, 0x20(%rsp)
leaq 0x53e(%rip), %rax       # 0x5ab6
movq %rax, 0x18(%rsp)
movl %r15d, %esi
movq %r14, %rdx
callq 0x6630
movq 0x18(%rsp), %rax
testq %rax, %rax
je 0x559f
movq %r14, %rdi
movq %r14, %rsi
movl $0x3, %edx
callq *%rax
addq $0x4, %r12
incl %ebp
cmpq %r13, %r12
jne 0x54a0
movq (%rbx), %rdi
leaq 0x28(%rsp), %rdx
movq $0x0, 0x8(%rdx)
movq %rbx, (%rdx)
leaq 0x514(%rip), %rax       # 0x5adc
movq %rax, 0x18(%rdx)
leaq 0x525(%rip), %rax       # 0x5af8
movq %rax, 0x10(%rdx)
movl $0x1, %esi
callq 0x6630
movq 0x38(%rsp), %rax
testq %rax, %rax
je 0x55fa
leaq 0x28(%rsp), %rdi
movq %rdi, %rsi
movl $0x3, %edx
callq *%rax
movl 0x28(%rbx), %edi
movl 0x2c(%rbx), %esi
addl $0x2, %edi
addl $0x8, %esi
callq 0x2150
callq 0x23a0
addq $0x68, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0x5689
movq %rax, %rbx
movq 0x58(%rsp), %rax
testq %rax, %rax
je 0x5681
leaq 0x48(%rsp), %rdi
movq %rdi, %rsi
movl $0x3, %edx
callq *%rax
jmp 0x5681
jmp 0x5689
jmp 0x5689
movq %rax, %rbx
movq 0x38(%rsp), %rax
testq %rax, %rax
je 0x5681
leaq 0x28(%rsp), %rdi
movq %rdi, %rsi
movl $0x3, %edx
callq *%rax
jmp 0x5681
jmp 0x5689
jmp 0x5689
movq %rax, %rbx
movq 0x18(%rsp), %rax
testq %rax, %rax
je 0x5681
leaq 0x8(%rsp), %rdi
movq %rdi, %rsi
movl $0x3, %edx
callq *%rax
movq %rbx, %rdi
callq 0x23c0
movq %rax, %rdi
callq 0x4729
nop