// File: /workspace/github_cpp_makefile_star2_O1/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 $0x78, %rsp
movq %rdi, %rbx
movq (%rdi), %rdi
leaq 0x2167(%rip), %rcx      # 0x75a4
xorl %esi, %esi
xorl %edx, %edx
xorl %eax, %eax
callq 0x65f2
movq (%rbx), %rdi
cmpb $0x1, 0x3c(%rbx)
jne 0x549e
xorps %xmm0, %xmm0
leaq 0x50(%rsp), %rdx
movaps %xmm0, (%rdx)
movaps %xmm0, 0x10(%rdx)
movq %rbx, (%rdx)
leaq 0x634(%rip), %rax       # 0x5a9e
movq %rax, 0x18(%rdx)
leaq 0x63d(%rip), %rax       # 0x5ab2
movq %rax, 0x10(%rdx)
movl $0x4, %esi
callq 0x66a8
movq 0x60(%rsp), %rax
testq %rax, %rax
je 0x54ba
leaq 0x50(%rsp), %rdi
movq %rdi, %rsi
movl $0x3, %edx
callq *%rax
jmp 0x54ba
movl 0x34(%rbx), %edx
movl 0x30(%rbx), %ecx
movl 0x28(%rbx), %r9d
movl 0x2c(%rbx), %r8d
leaq 0x2102(%rip), %rsi      # 0x75b5
xorl %eax, %eax
callq 0x6564
movq 0x8(%rbx), %r12
movq 0x10(%rbx), %r13
cmpq %r13, %r12
je 0x55e4
xorl %ebp, %ebp
leaq 0x10(%rsp), %r14
movl 0x24(%rbx), %esi
movl %ebp, %edi
callq 0x21f0
movq %rax, %rcx
shrq $0x20, %rcx
jne 0x54f4
addl $0x2, %eax
movl %eax, %edi
movl $0x8, %esi
callq 0x2150
movl (%r12), %eax
btl $0x10, %eax
jb 0x5530
btl $0x12, %eax
jb 0x553d
btl $0x13, %eax
jb 0x554a
btl $0x11, %eax
jb 0x5557
btl $0x1e, %eax
jb 0x5564
btl $0x14, %eax
jb 0x5576
testl $0xe00000, %eax         # imm = 0xE00000
je 0x5581
movb $0x40, 0xf(%rsp)
movl $0xcd, %r15d
jmp 0x5581
movb $0x2e, 0xf(%rsp)
movl $0xc8, %r15d
jmp 0x5581
movb $0x46, 0xf(%rsp)
movl $0xc9, %r15d
jmp 0x5581
movb $0x3f, 0xf(%rsp)
movl $0xca, %r15d
jmp 0x5581
movb $0x20, 0xf(%rsp)
movl $0xcb, %r15d
jmp 0x5581
shrl $0x18, %eax
andl $0xf, %eax
leal 0x64(%rax), %r15d
orb $0x30, %al
movb %al, 0xf(%rsp)
jmp 0x5581
movb $0x40, 0xf(%rsp)
movl $0xcc, %r15d
movq (%rbx), %rdi
xorps %xmm0, %xmm0
movaps %xmm0, 0x10(%rsp)
movaps %xmm0, 0x20(%rsp)
leaq 0xf(%rsp), %rax
movq %rax, 0x10(%rsp)
leaq 0x536(%rip), %rax       # 0x5ad8
movq %rax, 0x28(%rsp)
leaq 0x542(%rip), %rax       # 0x5af0
movq %rax, 0x20(%rsp)
movl %r15d, %esi
movq %r14, %rdx
callq 0x66a8
movq 0x20(%rsp), %rax
testq %rax, %rax
je 0x55d5
movq %r14, %rdi
movq %r14, %rsi
movl $0x3, %edx
callq *%rax
addq $0x4, %r12
incl %ebp
cmpq %r13, %r12
jne 0x54d2
movq (%rbx), %rdi
xorps %xmm0, %xmm0
leaq 0x30(%rsp), %rdx
movaps %xmm0, (%rdx)
movaps %xmm0, 0x10(%rdx)
movq %rbx, (%rdx)
leaq 0x516(%rip), %rax       # 0x5b16
movq %rax, 0x18(%rdx)
leaq 0x527(%rip), %rax       # 0x5b32
movq %rax, 0x10(%rdx)
movl $0x1, %esi
callq 0x66a8
movq 0x40(%rsp), %rax
testq %rax, %rax
je 0x5632
leaq 0x30(%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 $0x78, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0x56c1
movq %rax, %rbx
movq 0x60(%rsp), %rax
testq %rax, %rax
je 0x56b9
leaq 0x50(%rsp), %rdi
movq %rdi, %rsi
movl $0x3, %edx
callq *%rax
jmp 0x56b9
jmp 0x56c1
jmp 0x56c1
movq %rax, %rbx
movq 0x40(%rsp), %rax
testq %rax, %rax
je 0x56b9
leaq 0x30(%rsp), %rdi
movq %rdi, %rsi
movl $0x3, %edx
callq *%rax
jmp 0x56b9
jmp 0x56c1
jmp 0x56c1
movq %rax, %rbx
movq 0x20(%rsp), %rax
testq %rax, %rax
je 0x56b9
leaq 0x10(%rsp), %rdi
movq %rdi, %rsi
movl $0x3, %edx
callq *%rax
movq %rbx, %rdi
callq 0x23c0
movq %rax, %rdi
callq 0x4739
nop