// File: /workspace/github_cpp_makefile_star2_O2/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 0x17f3(%rip), %rcx      # 0x6548
xorl %esi, %esi
xorl %edx, %edx
xorl %eax, %eax
callq 0x5d4c
movq (%rbx), %rdi
cmpb $0x1, 0x3c(%rbx)
jne 0x4da0
leaq 0x28(%rsp), %rdx
andq $0x0, 0x8(%rdx)
movq %rbx, (%rdx)
leaq 0x587(%rip), %rax       # 0x5304
movq %rax, 0x18(%rdx)
leaq 0x590(%rip), %rax       # 0x5318
movq %rax, 0x10(%rdx)
pushq $0x4
popq %rsi
callq 0x5e02
leaq 0x28(%rsp), %rdi
callq 0x4200
jmp 0x4dbc
movl 0x34(%rbx), %edx
movl 0x30(%rbx), %ecx
movl 0x28(%rbx), %r9d
movl 0x2c(%rbx), %r8d
leaq 0x17a4(%rip), %rsi      # 0x6559
xorl %eax, %eax
callq 0x5cbe
movq 0x8(%rbx), %r13
movq 0x10(%rbx), %r15
xorl %ebp, %ebp
leaq 0x8(%rsp), %r14
cmpq %r15, %r13
je 0x4eca
movl 0x24(%rbx), %esi
movl %ebp, %edi
callq 0x21e0
movq %rax, %rcx
shrq $0x20, %rcx
jne 0x4df4
addl $0x2, %eax
movl %eax, %edi
pushq $0x8
popq %rsi
callq 0x2160
movl (%r13), %eax
btl $0x10, %eax
jb 0x4e30
btl $0x12, %eax
jb 0x4e3d
btl $0x13, %eax
jb 0x4e4a
btl $0x11, %eax
jb 0x4e57
btl $0x1e, %eax
jb 0x4e64
btl $0x14, %eax
jb 0x4e76
testl $0xe00000, %eax         # imm = 0xE00000
je 0x4e81
movb $0x40, 0x7(%rsp)
movl $0xcd, %r12d
jmp 0x4e81
movb $0x2e, 0x7(%rsp)
movl $0xc8, %r12d
jmp 0x4e81
movb $0x46, 0x7(%rsp)
movl $0xc9, %r12d
jmp 0x4e81
movb $0x3f, 0x7(%rsp)
movl $0xca, %r12d
jmp 0x4e81
movb $0x20, 0x7(%rsp)
movl $0xcb, %r12d
jmp 0x4e81
shrl $0x18, %eax
andl $0xf, %eax
leal 0x64(%rax), %r12d
orb $0x30, %al
movb %al, 0x7(%rsp)
jmp 0x4e81
movb $0x40, 0x7(%rsp)
movl $0xcc, %r12d
movq (%rbx), %rdi
andq $0x0, 0x10(%rsp)
leaq 0x7(%rsp), %rax
movq %rax, 0x8(%rsp)
leaq 0x4a3(%rip), %rax       # 0x533e
movq %rax, 0x20(%rsp)
leaq 0x4af(%rip), %rax       # 0x5356
movq %rax, 0x18(%rsp)
movl %r12d, %esi
movq %r14, %rdx
callq 0x5e02
movq %r14, %rdi
callq 0x4200
addq $0x4, %r13
incl %ebp
jmp 0x4dcb
movq (%rbx), %rdi
leaq 0x48(%rsp), %r14
andq $0x0, 0x8(%r14)
movq %rbx, (%r14)
leaq 0x49b(%rip), %rax       # 0x537c
movq %rax, 0x18(%r14)
leaq 0x4aa(%rip), %rax       # 0x5396
movq %rax, 0x10(%r14)
pushq $0x1
popq %rsi
movq %r14, %rdx
callq 0x5e02
leaq 0x48(%rsp), %rdi
callq 0x4200
movl 0x28(%rbx), %edi
movl 0x2c(%rbx), %esi
addl $0x2, %edi
addl $0x8, %esi
callq 0x2160
callq 0x23b0
addq $0x68, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %rax, %rbx
leaq 0x28(%rsp), %rdi
jmp 0x4f3c
jmp 0x4f36
movq %rax, %rbx
movq %r14, %rdi
callq 0x4200
movq %rbx, %rdi
callq 0x23d0
nop