// File: /workspace/github_cpp_makefile_star2_O3/Dalgona[P]mine/mine.cpp
// Function: arcade_leaderboard()
void arcade_leaderboard(void)
{
  FILE *data = fopen("scores.dat", "rb");
  int fd = fileno(data);
  flock(fd, LOCK_EX);
  for (int i = 0; i < 3; i++)
  {
    scores[i].resize(5);
    for (int j = 0; j < 5; j++)
    {
      fread(scores[i][j].name, 11, 1, data);
      fread(&scores[i][j].time, 4, 1, data);
    }
  }
  flock(fd, LOCK_UN);
  fclose(data);

  refresh();
  WINDOW *lbw = newwin(9, 78, 8, 1);

  wattron(lbw, A_BOLD);
  LBC(14, mvwprintw(lbw, 0, 27, " H A L L   O F   F A M E "););
  LBC(15, mvwprintw(lbw, 2, 8, "BEGINNER"););
  LBC(16, mvwprintw(lbw, 2, 33, "INTERMEDIATE"););
  LBC(17, mvwprintw(lbw, 2, 63, "EXPERT"););
  wattroff(lbw, A_BOLD);

  const char *nth[] { "1st", "2nd", "3rd", "4th", "5th" };
  int iPart, dPart;
  for (int i = 0; i < 3; i++)
  {
    int col = 27 * i;
    for (int j = 0; j < 5; j++)
    {
      score_t &sc = scores[i][j];
      if (sc.time > 999999) iPart = 9999, dPart = 99;
      else iPart = sc.time / 100, dPart = sc.time % 100;
      LBC(20 + j, mvwprintw(lbw, 4 + j, col, "%s", nth[j]););
      wprintw(lbw, "  %10s  %04d.%02d", sc.name, iPart, dPart);
    }
  }

  wrefresh(lbw);
  delwin(lbw);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0xf8, %rsp
leaq 0x441e(%rip), %rdi      # 0x7294
leaq 0x4425(%rip), %rsi      # 0x72a2
callq 0x22c0
movq %rax, %rbx
movq %rax, %rdi
callq 0x2260
movl %eax, %ebp
movl %eax, %edi
movl $0x2, %esi
callq 0x23f0
xorl %r15d, %r15d
leaq 0x83ab(%rip), %r13      # 0xb250
leaq (%r15,%r15,2), %rax
leaq (,%rax,8), %r14
addq %r13, %r14
movl $0x5, %esi
movq %r14, %rdi
callq 0x46ac
xorl %r12d, %r12d
movq (%r14), %rdi
addq %r12, %rdi
movl $0xb, %esi
movl $0x1, %edx
movq %rbx, %rcx
callq 0x2330
movq (%r14), %rax
leaq (%rax,%r12), %rdi
addq $0xc, %rdi
movl $0x4, %esi
movl $0x1, %edx
movq %rbx, %rcx
callq 0x2330
addq $0x10, %r12
cmpq $0x50, %r12
jne 0x2ec4
incq %r15
cmpq $0x3, %r15
jne 0x2ea5
movl %ebp, %edi
movl $0x8, %esi
callq 0x23f0
movq %rbx, %rdi
callq 0x2210
callq 0x23a0
movl $0x9, %edi
movl $0x4e, %esi
movl $0x8, %edx
movl $0x1, %ecx
callq 0x2230
movq %rax, %rbx
leaq 0x8(%rsp), %r14
movq %rax, (%r14)
movq %rax, %rdi
movl $0x200000, %esi         # imm = 0x200000
xorl %edx, %edx
callq 0x2120
movq 0x82e9(%rip), %rdi      # 0xb248
leaq 0xb0(%rsp), %rcx
movq $0x0, 0x8(%rcx)
movq %r14, (%rcx)
leaq 0x13b9(%rip), %rax      # 0x4332
movq %rax, 0x18(%rcx)
leaq 0x13ca(%rip), %rax      # 0x434e
movq %rax, 0x10(%rcx)
movq %rbx, %rsi
movl $0xe, %edx
callq 0x66ae
movq 0xc0(%rsp), %rax
testq %rax, %rax
je 0x2fb4
leaq 0xb0(%rsp), %rdi
movq %rdi, %rsi
movl $0x3, %edx
callq *%rax
movq 0x828d(%rip), %rdi      # 0xb248
movq 0x8(%rsp), %rsi
leaq 0x90(%rsp), %rcx
movq $0x0, 0x8(%rcx)
leaq 0x8(%rsp), %rax
movq %rax, (%rcx)
leaq 0x1395(%rip), %rax      # 0x4374
movq %rax, 0x18(%rcx)
leaq 0x13a8(%rip), %rax      # 0x4392
movq %rax, 0x10(%rcx)
movl $0xf, %edx
callq 0x66ae
movq 0xa0(%rsp), %rax
testq %rax, %rax
je 0x3017
leaq 0x90(%rsp), %rdi
movq %rdi, %rsi
movl $0x3, %edx
callq *%rax
movq 0x822a(%rip), %rdi      # 0xb248
movq 0x8(%rsp), %rsi
leaq 0x70(%rsp), %rcx
movq $0x0, 0x8(%rcx)
leaq 0x8(%rsp), %rax
movq %rax, (%rcx)
leaq 0x1379(%rip), %rax      # 0x43b8
movq %rax, 0x18(%rcx)
leaq 0x138c(%rip), %rax      # 0x43d6
movq %rax, 0x10(%rcx)
movl $0x10, %edx
callq 0x66ae
movq 0x80(%rsp), %rax
testq %rax, %rax
je 0x3074
leaq 0x70(%rsp), %rdi
movq %rdi, %rsi
movl $0x3, %edx
callq *%rax
movq 0x81cd(%rip), %rdi      # 0xb248
movq 0x8(%rsp), %rsi
leaq 0x50(%rsp), %rcx
movq $0x0, 0x8(%rcx)
leaq 0x8(%rsp), %rax
movq %rax, (%rcx)
leaq 0x1360(%rip), %rax      # 0x43fc
movq %rax, 0x18(%rcx)
leaq 0x1373(%rip), %rax      # 0x441a
movq %rax, 0x10(%rcx)
movl $0x11, %edx
callq 0x66ae
movq 0x60(%rsp), %rax
testq %rax, %rax
je 0x30ce
leaq 0x50(%rsp), %rdi
movq %rdi, %rsi
movl $0x3, %edx
callq *%rax
movq 0x8(%rsp), %rdi
movl $0x200000, %esi         # imm = 0x200000
xorl %edx, %edx
callq 0x22e0
movq 0x7b3a(%rip), %rax      # 0xac20
leaq 0xd0(%rsp), %rcx
movq %rax, 0x20(%rcx)
movaps 0x7b17(%rip), %xmm0     # 0xac10
movaps %xmm0, 0x10(%rcx)
movaps 0x7afc(%rip), %xmm0     # 0xac00
movaps %xmm0, (%rcx)
xorl %ecx, %ecx
leal (%rcx,%rcx,8), %eax
leal (%rax,%rax,2), %eax
movl %eax, 0x14(%rsp)
movq %rcx, 0x38(%rsp)
leaq (%rcx,%rcx,2), %rax
leaq (,%rax,8), %rax
addq %r13, %rax
movq %rax, 0x40(%rsp)
movl $0x0, 0x10(%rsp)
xorl %r13d, %r13d
movslq %r13d, %rbx
movq 0x40(%rsp), %rax
movq (%rax), %r15
shlq $0x4, %rbx
movl 0xc(%r15,%rbx), %ebp
cmpl $0xf423f, %ebp          # imm = 0xF423F
jle 0x3160
movl $0x63, %ebp
movl $0x270f, %r12d          # imm = 0x270F
jmp 0x317e
movslq %ebp, %rax
imulq $0x51eb851f, %rax, %r12 # imm = 0x51EB851F
movq %r12, %rax
shrq $0x3f, %rax
sarq $0x25, %r12
addl %eax, %r12d
imull $0x64, %r12d, %eax
subl %eax, %ebp
movq 0x80c3(%rip), %r14      # 0xb248
movq 0x8(%rsp), %rax
movq %rax, 0x48(%rsp)
addl $0x14, %r13d
movq $0x0, 0x20(%rsp)
movl $0x20, %edi
callq 0x2220
leaq 0x8(%rsp), %rcx
movq %rcx, (%rax)
leaq 0x10(%rsp), %rcx
movq %rcx, 0x8(%rax)
leaq 0x14(%rsp), %rcx
movq %rcx, 0x10(%rax)
leaq 0xd0(%rsp), %rcx
movq %rcx, 0x18(%rax)
movq %rax, 0x18(%rsp)
leaq 0x1268(%rip), %rax      # 0x4440
movq %rax, 0x30(%rsp)
leaq 0x128c(%rip), %rax      # 0x4470
movq %rax, 0x28(%rsp)
movq %r14, %rdi
movq 0x48(%rsp), %rsi
movl %r13d, %edx
leaq 0x18(%rsp), %rcx
callq 0x66ae
movq 0x28(%rsp), %rax
testq %rax, %rax
je 0x3217
leaq 0x18(%rsp), %rdi
movq %rdi, %rsi
movl $0x3, %edx
callq *%rax
addq %rbx, %r15
movq 0x8(%rsp), %rdi
leaq 0x4093(%rip), %rsi      # 0x72b9
movq %r15, %rdx
movl %r12d, %ecx
movl %ebp, %r8d
xorl %eax, %eax
callq 0x2050
movl 0x10(%rsp), %eax
leal 0x1(%rax), %r13d
movl %r13d, 0x10(%rsp)
cmpl $0x4, %eax
jl 0x3137
movq 0x38(%rsp), %rcx
incq %rcx
cmpq $0x3, %rcx
leaq 0x7ff1(%rip), %r13      # 0xb250
jne 0x3109
movq 0x8(%rsp), %rdi
callq 0x2270
movq 0x8(%rsp), %rdi
callq 0x2060
addq $0xf8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0x335e
jmp 0x335e
jmp 0x335e
jmp 0x335e
movq %rax, %rbx
movq 0x60(%rsp), %rax
testq %rax, %rax
je 0x3356
leaq 0x50(%rsp), %rdi
movq %rdi, %rsi
movl $0x3, %edx
callq *%rax
jmp 0x3356
jmp 0x335e
movq %rax, %rbx
movq 0x80(%rsp), %rax
testq %rax, %rax
je 0x3356
leaq 0x70(%rsp), %rdi
movq %rdi, %rsi
movl $0x3, %edx
callq *%rax
jmp 0x3356
jmp 0x335e
movq %rax, %rbx
movq 0xa0(%rsp), %rax
testq %rax, %rax
je 0x3356
leaq 0x90(%rsp), %rdi
movq %rdi, %rsi
movl $0x3, %edx
callq *%rax
jmp 0x3356
jmp 0x335e
movq %rax, %rbx
movq 0xc0(%rsp), %rax
testq %rax, %rax
je 0x3356
leaq 0xb0(%rsp), %rdi
movq %rdi, %rsi
movl $0x3, %edx
callq *%rax
jmp 0x3356
jmp 0x335e
jmp 0x335e
movq %rax, %rbx
movq 0x28(%rsp), %rax
testq %rax, %rax
je 0x3356
leaq 0x18(%rsp), %rdi
movq %rdi, %rsi
movl $0x3, %edx
callq *%rax
movq %rbx, %rdi
callq 0x23c0
movq %rax, %rdi
callq 0x4729