// File: /workspace/github_cpp_makefile_star2_O1/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 0x43dc(%rip), %rdi      # 0x7294
leaq 0x43e3(%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 0x8369(%rip), %r13      # 0xb250
leaq (%r15,%r15,2), %rax
leaq (,%rax,8), %r14
addq %r13, %r14
movl $0x5, %esi
movq %r14, %rdi
callq 0x46c2
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 0x2f06
incq %r15
cmpq $0x3, %r15
jne 0x2ee7
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 %rsp, %rbx
movq %rax, (%rbx)
movq %rax, %rdi
movl $0x200000, %esi         # imm = 0x200000
xorl %edx, %edx
callq 0x2120
movq 0x82ac(%rip), %rdi      # 0xb248
movq (%rbx), %rsi
xorps %xmm0, %xmm0
leaq 0xb0(%rsp), %rcx
movaps %xmm0, (%rcx)
movaps %xmm0, 0x10(%rcx)
movq %rbx, (%rcx)
leaq 0x1373(%rip), %rax      # 0x432e
movq %rax, 0x18(%rcx)
leaq 0x1384(%rip), %rax      # 0x434a
movq %rax, 0x10(%rcx)
movl $0xe, %edx
callq 0x6726
movq 0xc0(%rsp), %rax
testq %rax, %rax
je 0x2ff3
leaq 0xb0(%rsp), %rdi
movq %rdi, %rsi
movl $0x3, %edx
callq *%rax
movq 0x824e(%rip), %rdi      # 0xb248
movq (%rsp), %rsi
xorps %xmm0, %xmm0
leaq 0x90(%rsp), %rcx
movaps %xmm0, (%rcx)
movaps %xmm0, 0x10(%rcx)
movq %rsp, %rax
movq %rax, (%rcx)
leaq 0x1353(%rip), %rax      # 0x4370
movq %rax, 0x18(%rcx)
leaq 0x1366(%rip), %rax      # 0x438e
movq %rax, 0x10(%rcx)
movl $0xf, %edx
callq 0x6726
movq 0xa0(%rsp), %rax
testq %rax, %rax
je 0x3055
leaq 0x90(%rsp), %rdi
movq %rdi, %rsi
movl $0x3, %edx
callq *%rax
movq 0x81ec(%rip), %rdi      # 0xb248
movq (%rsp), %rsi
xorps %xmm0, %xmm0
leaq 0x70(%rsp), %rcx
movaps %xmm0, (%rcx)
movaps %xmm0, 0x10(%rcx)
movq %rsp, %rax
movq %rax, (%rcx)
leaq 0x1338(%rip), %rax      # 0x43b4
movq %rax, 0x18(%rcx)
leaq 0x134b(%rip), %rax      # 0x43d2
movq %rax, 0x10(%rcx)
movl $0x10, %edx
callq 0x6726
movq 0x80(%rsp), %rax
testq %rax, %rax
je 0x30b1
leaq 0x70(%rsp), %rdi
movq %rdi, %rsi
movl $0x3, %edx
callq *%rax
movq 0x8190(%rip), %rdi      # 0xb248
movq (%rsp), %rsi
xorps %xmm0, %xmm0
leaq 0x50(%rsp), %rcx
movaps %xmm0, (%rcx)
movaps %xmm0, 0x10(%rcx)
movq %rsp, %rax
movq %rax, (%rcx)
leaq 0x1320(%rip), %rax      # 0x43f8
movq %rax, 0x18(%rcx)
leaq 0x1333(%rip), %rax      # 0x4416
movq %rax, 0x10(%rcx)
movl $0x11, %edx
callq 0x6726
movq 0x60(%rsp), %rax
testq %rax, %rax
je 0x310a
leaq 0x50(%rsp), %rdi
movq %rdi, %rsi
movl $0x3, %edx
callq *%rax
movq (%rsp), %rdi
movl $0x200000, %esi         # imm = 0x200000
xorl %edx, %edx
callq 0x22e0
movq 0x7aff(%rip), %rax      # 0xac20
leaq 0xd0(%rsp), %rcx
movq %rax, 0x20(%rcx)
movaps 0x7adc(%rip), %xmm0     # 0xac10
movaps %xmm0, 0x10(%rcx)
movaps 0x7ac1(%rip), %xmm0     # 0xac00
movaps %xmm0, (%rcx)
xorl %ecx, %ecx
leal (%rcx,%rcx,8), %eax
leal (%rax,%rax,2), %eax
movl %eax, 0xc(%rsp)
movq %rcx, 0x38(%rsp)
leaq (%rcx,%rcx,2), %rax
leaq (,%rax,8), %rax
addq %r13, %rax
movq %rax, 0x40(%rsp)
movl $0x0, 0x8(%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 0x319b
movl $0x63, %ebp
movl $0x270f, %r12d          # imm = 0x270F
jmp 0x31b9
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 0x8088(%rip), %r14      # 0xb248
movq (%rsp), %rax
movq %rax, 0x48(%rsp)
addl $0x14, %r13d
xorps %xmm0, %xmm0
movaps %xmm0, 0x10(%rsp)
movaps %xmm0, 0x20(%rsp)
movl $0x20, %edi
callq 0x2220
movq %rsp, %rcx
movq %rcx, (%rax)
leaq 0x8(%rsp), %rcx
movq %rcx, 0x8(%rax)
leaq 0xc(%rsp), %rcx
movq %rcx, 0x10(%rax)
leaq 0xd0(%rsp), %rcx
movq %rcx, 0x18(%rax)
movq %rax, 0x10(%rsp)
leaq 0x1228(%rip), %rax      # 0x443c
movq %rax, 0x28(%rsp)
leaq 0x124c(%rip), %rax      # 0x446c
movq %rax, 0x20(%rsp)
movq %r14, %rdi
movq 0x48(%rsp), %rsi
movl %r13d, %edx
leaq 0x10(%rsp), %rcx
callq 0x6726
movq 0x20(%rsp), %rax
testq %rax, %rax
je 0x3253
leaq 0x10(%rsp), %rdi
movq %rdi, %rsi
movl $0x3, %edx
callq *%rax
addq %rbx, %r15
movq (%rsp), %rdi
leaq 0x4058(%rip), %rsi      # 0x72b9
movq %r15, %rdx
movl %r12d, %ecx
movl %ebp, %r8d
xorl %eax, %eax
callq 0x2050
movl 0x8(%rsp), %eax
leal 0x1(%rax), %r13d
movl %r13d, 0x8(%rsp)
cmpl $0x4, %eax
jl 0x3172
movq 0x38(%rsp), %rcx
incq %rcx
cmpq $0x3, %rcx
leaq 0x7fb6(%rip), %r13      # 0xb250
jne 0x3144
movq (%rsp), %rdi
callq 0x2270
movq (%rsp), %rdi
callq 0x2060
addq $0xf8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0x3397
jmp 0x3397
jmp 0x3397
jmp 0x3397
movq %rax, %rbx
movq 0x60(%rsp), %rax
testq %rax, %rax
je 0x338f
leaq 0x50(%rsp), %rdi
movq %rdi, %rsi
movl $0x3, %edx
callq *%rax
jmp 0x338f
jmp 0x3397
movq %rax, %rbx
movq 0x80(%rsp), %rax
testq %rax, %rax
je 0x338f
leaq 0x70(%rsp), %rdi
movq %rdi, %rsi
movl $0x3, %edx
callq *%rax
jmp 0x338f
jmp 0x3397
movq %rax, %rbx
movq 0xa0(%rsp), %rax
testq %rax, %rax
je 0x338f
leaq 0x90(%rsp), %rdi
movq %rdi, %rsi
movl $0x3, %edx
callq *%rax
jmp 0x338f
jmp 0x3397
movq %rax, %rbx
movq 0xc0(%rsp), %rax
testq %rax, %rax
je 0x338f
leaq 0xb0(%rsp), %rdi
movq %rdi, %rsi
movl $0x3, %edx
callq *%rax
jmp 0x338f
jmp 0x3397
jmp 0x3397
movq %rax, %rbx
movq 0x20(%rsp), %rax
testq %rax, %rax
je 0x338f
leaq 0x10(%rsp), %rdi
movq %rdi, %rsi
movl $0x3, %edx
callq *%rax
movq %rbx, %rdi
callq 0x23c0
movq %rax, %rdi
callq 0x4739