// File: ndsol[P]git-mine/git-mine.cpp
// Function: MineBoss::printProgressAt1Hz()
int printProgressAt1Hz() {
    long long total_work = (ctime_hint - atime_hint) / COUNT_DIVISOR;
    auto t0 = Clock::now();
    // lock is needed for cond.wait_until.
    std::unique_lock<std::mutex> lock(bossMutex);
    for (auto t1 = t0 + std::chrono::seconds(1);;) {
      long long total = 0;
      cond.wait_until(lock, t1);
      if (searchDone) {
        return 1;
      }

      // Check threads to see who is still running.
      int r = 1;
      size_t best = 0;
      for (size_t i = 0; i < pool.size(); i++) {
        if (pool.at(i)->best > best) {
          best = pool.at(i)->best;
        }
        if (pool.at(i)->go) {
          r = 0;  // At least 1 thread is still running.
          total += pool.at(i)->count;
        } else if (pool.at(i)->bossSaidGo) {
          pool.at(i)->bossSaidGo = false;
          //fprintf(stderr, "Thread %zu quit.\n", i);
          // In stop, do join(). Not here.
        }
      }
      if (r) return r;
      t0 = Clock::now();
      if (t0 < t1) continue;

      // Report progress if a full second passed.
      std::chrono::duration<float> elapsed_sec = t0 - start_t;
      fprintf(stderr, "%4.1fs progress: %7.2f%%   best:%zu  100%%=%.2f MHash\n",
              elapsed_sec.count(),
              100.0f*float(total)/float(total_work), best,
              float(total_work) * COUNT_DIVISOR / 1e6);
      if (best > last_best) {
        last_best = best;
        dumpMatchAt(best);
      }
      break;
    }
    return 0;
  }

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x100, %rsp            # imm = 0x100
movq %rdi, -0x10(%rbp)
movq -0x10(%rbp), %rax
movq %rax, -0x98(%rbp)
movq 0x130(%rax), %rcx
movq 0x138(%rax), %rax
subq %rcx, %rax
movq %rax, %rcx
addq $0x3fff, %rcx           # imm = 0x3FFF
testq %rax, %rax
cmovsq %rcx, %rax
sarq $0xe, %rax
movq %rax, -0x18(%rbp)
callq 0x4430
movq -0x98(%rbp), %rsi
movq %rax, -0x20(%rbp)
addq $0x150, %rsi            # imm = 0x150
leaq -0x30(%rbp), %rdi
callq 0x8560
movl $0x1, -0x44(%rbp)
leaq -0x40(%rbp), %rdi
leaq -0x44(%rbp), %rsi
callq 0xb930
jmp 0x57ba
leaq -0x20(%rbp), %rdi
leaq -0x40(%rbp), %rsi
callq 0xb8e0
movq %rax, -0xa0(%rbp)
jmp 0x57d0
movq -0xa0(%rbp), %rax
movq %rax, -0x38(%rbp)
movq -0x98(%rbp), %rdi
movq $0x0, -0x60(%rbp)
addq $0x178, %rdi            # imm = 0x178
leaq -0x30(%rbp), %rsi
leaq -0x38(%rbp), %rdx
callq 0xb950
jmp 0x5800
movq -0x98(%rbp), %rax
testb $0x1, 0x1a9(%rax)
je 0x583d
movl $0x1, -0x4(%rbp)
movl $0x1, -0x64(%rbp)
jmp 0x5b4e
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x50(%rbp)
movl %eax, -0x54(%rbp)
leaq -0x30(%rbp), %rdi
callq 0x8790
jmp 0x5b63
movl $0x1, -0x68(%rbp)
movq $0x0, -0x70(%rbp)
movq $0x0, -0x78(%rbp)
movq -0x98(%rbp), %rdi
movq -0x78(%rbp), %rax
movq %rax, -0xa8(%rbp)
addq $0x1b0, %rdi            # imm = 0x1B0
callq 0x8500
movq %rax, %rcx
movq -0xa8(%rbp), %rax
cmpq %rcx, %rax
jae 0x59eb
movq -0x98(%rbp), %rdi
addq $0x1b0, %rdi            # imm = 0x1B0
movq -0x78(%rbp), %rsi
callq 0xb980
movq %rax, -0xb0(%rbp)
jmp 0x58a5
movq -0xb0(%rbp), %rdi
callq 0xb9c0
movq 0x168(%rax), %rax
cmpq -0x70(%rbp), %rax
jbe 0x58f5
movq -0x98(%rbp), %rdi
addq $0x1b0, %rdi            # imm = 0x1B0
movq -0x78(%rbp), %rsi
callq 0xb980
movq %rax, -0xb8(%rbp)
jmp 0x58de
movq -0xb8(%rbp), %rdi
callq 0xb9c0
movq 0x168(%rax), %rax
movq %rax, -0x70(%rbp)
movq -0x98(%rbp), %rdi
addq $0x1b0, %rdi            # imm = 0x1B0
movq -0x78(%rbp), %rsi
callq 0xb980
movq %rax, -0xc0(%rbp)
jmp 0x5915
movq -0xc0(%rbp), %rdi
callq 0xb9c0
testb $0x1, 0x148(%rax)
je 0x596e
movq -0x98(%rbp), %rdi
movl $0x0, -0x68(%rbp)
addq $0x1b0, %rdi            # imm = 0x1B0
movq -0x78(%rbp), %rsi
callq 0xb980
movq %rax, -0xc8(%rbp)
jmp 0x5951
movq -0xc8(%rbp), %rdi
callq 0xb9c0
movq 0x338(%rax), %rax
addq -0x60(%rbp), %rax
movq %rax, -0x60(%rbp)
jmp 0x59d8
movq -0x98(%rbp), %rdi
addq $0x1b0, %rdi            # imm = 0x1B0
movq -0x78(%rbp), %rsi
callq 0xb980
movq %rax, -0xd0(%rbp)
jmp 0x598e
movq -0xd0(%rbp), %rdi
callq 0xb9c0
testb $0x1, 0x149(%rax)
je 0x59d6
movq -0x98(%rbp), %rdi
addq $0x1b0, %rdi            # imm = 0x1B0
movq -0x78(%rbp), %rsi
callq 0xb980
movq %rax, -0xd8(%rbp)
jmp 0x59c3
movq -0xd8(%rbp), %rdi
callq 0xb9c0
movb $0x0, 0x149(%rax)
jmp 0x59d8
jmp 0x59da
movq -0x78(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x78(%rbp)
jmp 0x5854
cmpl $0x0, -0x68(%rbp)
je 0x5a03
movl -0x68(%rbp), %eax
movl %eax, -0x4(%rbp)
movl $0x1, -0x64(%rbp)
jmp 0x5b4e
callq 0x4430
movq %rax, -0x80(%rbp)
movq -0x80(%rbp), %rax
movq %rax, -0x20(%rbp)
leaq -0x20(%rbp), %rdi
leaq -0x38(%rbp), %rsi
callq 0xb9e0
movb %al, -0xd9(%rbp)
jmp 0x5a29
movb -0xd9(%rbp), %al
testb $0x1, %al
jne 0x5a35
jmp 0x5a3a
jmp 0x57db
movq -0x98(%rbp), %rsi
addq $0x140, %rsi            # imm = 0x140
leaq -0x20(%rbp), %rdi
callq 0xba20
movq %rax, -0xe8(%rbp)
jmp 0x5a5a
movq -0xe8(%rbp), %rax
movq %rax, -0x90(%rbp)
leaq -0x84(%rbp), %rdi
leaq -0x90(%rbp), %rsi
callq 0xba70
jmp 0x5a7d
movq 0x1a554(%rip), %rax     # 0x1ffd8
movq (%rax), %rax
movq %rax, -0xf8(%rbp)
leaq -0x84(%rbp), %rdi
callq 0xbab0
movss %xmm0, -0xec(%rbp)
jmp 0x5aa4
movq -0xf8(%rbp), %rdi
movss -0xec(%rbp), %xmm0
cvtss2sd %xmm0, %xmm0
cvtsi2ssq -0x60(%rbp), %xmm2
movss 0x1254f(%rip), %xmm1    # 0x18014
mulss %xmm2, %xmm1
cvtsi2ssq -0x18(%rbp), %xmm2
divss %xmm2, %xmm1
cvtss2sd %xmm1, %xmm1
movq -0x70(%rbp), %rdx
cvtsi2ssq -0x18(%rbp), %xmm2
movss 0x12527(%rip), %xmm3    # 0x18010
mulss %xmm3, %xmm2
cvtss2sd %xmm2, %xmm2
movsd 0x1250f(%rip), %xmm3    # 0x18008
divsd %xmm3, %xmm2
leaq 0x128ce(%rip), %rsi     # 0x183d2
movb $0x3, %al
callq 0x44c0
movq -0x98(%rbp), %rcx
movq -0x70(%rbp), %rax
cmpq 0x148(%rcx), %rax
jbe 0x5b3e
movq -0x98(%rbp), %rdi
movq -0x70(%rbp), %rax
movq %rax, 0x148(%rdi)
movq -0x70(%rbp), %rsi
callq 0xbad0
jmp 0x5b3c
jmp 0x5b3e
jmp 0x5b40
movl $0x0, -0x4(%rbp)
movl $0x1, -0x64(%rbp)
leaq -0x30(%rbp), %rdi
callq 0x8790
movl -0x4(%rbp), %eax
addq $0x100, %rsp            # imm = 0x100
popq %rbp
retq
movq -0x50(%rbp), %rdi
callq 0x4600
nopl (%rax)