// File: ndsol[P]git-mine/git-mine.cpp
// Function: MineBoss::start()
void start() {
    size_t nCPU = 0;
    FILE* cpuinfo = fopen("/proc/cpuinfo", "r");
    if (!cpuinfo) {
      fprintf(stderr, "Failed to open /proc/cpuinfo: %d %s\n", errno, strerror(errno));
      return;
    }
    char buf[256];
    while (!feof(cpuinfo)) {
      if (!fgets(buf, sizeof(buf), cpuinfo)) {
        if (feof(cpuinfo)) break;
        fprintf(stderr, "Read /proc/cpuinfo failed: %d %s\n", errno,
                strerror(errno));
        return;
      }
      buf[strcspn(buf, "\r\n")] = 0;
      if (!strncmp(buf, "processor", strlen("processor"))) {
        int n = strcspn(buf, ":");
        if (n < (int)strlen(buf)) {
          size_t v;
          int end;
          if (sscanf(buf + n + 1, "%zu%n", &v, &end) == 1 &&
              (int)strlen(buf + n + 1) == end) {
            if (v + 1 > nCPU) {
              nCPU = v + 1;
            }
          }
        }
      }
    }
    fclose(cpuinfo);
    if (pool.size()) {
      fprintf(stderr, "pool not empty - already started?\n");
      return;
    }
    if (atime_hint < orig.atime()) {
      if (atime_hint) {
        fprintf(stderr, "invalid atime_hint %lld (must be at least %lld)\n",
                atime_hint, orig.atime());
      }
      atime_hint = orig.atime();
    }
    if (ctime_hint < orig.ctime()) {
      if (ctime_hint) {
        fprintf(stderr, "invalid ctime_hint %lld (must be at least %lld)\n",
                ctime_hint, orig.ctime());
      }
      ctime_hint = orig.ctime();
    }

    // Lock bossMutex while adding threads to pool.
    std::unique_lock<std::mutex> lock(bossMutex);
    for (size_t i = 0; i < nCPU; i++) {
      pool.emplace(pool.begin(), new ThreadLocal(this, i, nCPU));
    }
    start_t = Clock::now();
  }

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x200, %rsp            # imm = 0x200
movq %rdi, -0x8(%rbp)
movq -0x8(%rbp), %rax
movq %rax, -0x190(%rbp)
movq $0x0, -0x10(%rbp)
leaq 0x1308b(%rip), %rdi     # 0x182d4
leaq 0x130e1(%rip), %rsi     # 0x18331
callq 0x43c0
movq %rax, -0x18(%rbp)
cmpq $0x0, -0x18(%rbp)
jne 0x52ad
movq 0x1ad71(%rip), %rax     # 0x1ffd8
movq (%rax), %rax
movq %rax, -0x1a0(%rbp)
callq 0x4030
movl (%rax), %eax
movl %eax, -0x194(%rbp)
callq 0x4030
movl (%rax), %edi
callq 0x40c0
movq -0x1a0(%rbp), %rdi
movl -0x194(%rbp), %edx
movq %rax, %rcx
leaq 0x13041(%rip), %rsi     # 0x182e2
movb $0x0, %al
callq 0x44c0
jmp 0x571e
jmp 0x52af
movq -0x18(%rbp), %rdi
callq 0x4520
cmpl $0x0, %eax
setne %al
xorb $-0x1, %al
testb $0x1, %al
jne 0x52c9
jmp 0x5441
leaq -0x120(%rbp), %rdi
movq -0x18(%rbp), %rdx
movl $0x100, %esi            # imm = 0x100
callq 0x4540
cmpq $0x0, %rax
jne 0x5344
movq -0x18(%rbp), %rdi
callq 0x4520
cmpl $0x0, %eax
je 0x52f7
jmp 0x5441
movq 0x1acda(%rip), %rax     # 0x1ffd8
movq (%rax), %rax
movq %rax, -0x1b0(%rbp)
callq 0x4030
movl (%rax), %eax
movl %eax, -0x1a4(%rbp)
callq 0x4030
movl (%rax), %edi
callq 0x40c0
movq -0x1b0(%rbp), %rdi
movl -0x1a4(%rbp), %edx
movq %rax, %rcx
leaq 0x12fcf(%rip), %rsi     # 0x18307
movb $0x0, %al
callq 0x44c0
jmp 0x571e
leaq -0x120(%rbp), %rdi
leaq 0x12ec5(%rip), %rsi     # 0x18217
callq 0x4040
movb $0x0, -0x120(%rbp,%rax)
leaq -0x120(%rbp), %rdi
leaq 0x12fbc(%rip), %rsi     # 0x18329
movl $0x9, %edx
callq 0x4160
cmpl $0x0, %eax
jne 0x543c
leaq -0x120(%rbp), %rdi
leaq 0x131cb(%rip), %rsi     # 0x18559
callq 0x4040
movl %eax, -0x124(%rbp)
movl -0x124(%rbp), %eax
movl %eax, -0x1b4(%rbp)
leaq -0x120(%rbp), %rdi
callq 0x4140
movq %rax, %rcx
movl -0x1b4(%rbp), %eax
cmpl %ecx, %eax
jge 0x543a
leaq -0x120(%rbp), %rdi
movslq -0x124(%rbp), %rax
addq %rax, %rdi
addq $0x1, %rdi
leaq 0x12dc0(%rip), %rsi     # 0x1819a
leaq -0x130(%rbp), %rdx
leaq -0x134(%rbp), %rcx
movb $0x0, %al
callq 0x42f0
cmpl $0x1, %eax
jne 0x5438
leaq -0x120(%rbp), %rdi
movslq -0x124(%rbp), %rax
addq %rax, %rdi
addq $0x1, %rdi
callq 0x4140
cmpl -0x134(%rbp), %eax
jne 0x5438
movq -0x130(%rbp), %rax
addq $0x1, %rax
cmpq -0x10(%rbp), %rax
jbe 0x5436
movq -0x130(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x10(%rbp)
jmp 0x5438
jmp 0x543a
jmp 0x543c
jmp 0x52af
movq -0x18(%rbp), %rdi
callq 0x4300
movq -0x190(%rbp), %rdi
addq $0x1b0, %rdi            # imm = 0x1B0
callq 0x8500
cmpq $0x0, %rax
je 0x5480
movq 0x1ab6e(%rip), %rax     # 0x1ffd8
movq (%rax), %rdi
leaq 0x12ebf(%rip), %rsi     # 0x18333
movb $0x0, %al
callq 0x44c0
jmp 0x571e
movq -0x190(%rbp), %rdi
movq 0x130(%rdi), %rax
movq %rax, -0x1c0(%rbp)
callq 0x8520
movq %rax, %rcx
movq -0x1c0(%rbp), %rax
cmpq %rcx, %rax
jge 0x5521
movq -0x190(%rbp), %rax
cmpq $0x0, 0x130(%rax)
je 0x5504
movq -0x190(%rbp), %rdi
movq 0x1ab10(%rip), %rax     # 0x1ffd8
movq (%rax), %rax
movq %rax, -0x1d0(%rbp)
movq 0x130(%rdi), %rax
movq %rax, -0x1c8(%rbp)
callq 0x8520
movq -0x1d0(%rbp), %rdi
movq -0x1c8(%rbp), %rdx
movq %rax, %rcx
leaq 0x12e59(%rip), %rsi     # 0x18356
movb $0x0, %al
callq 0x44c0
movq -0x190(%rbp), %rdi
callq 0x8520
movq %rax, %rcx
movq -0x190(%rbp), %rax
movq %rcx, 0x130(%rax)
movq -0x190(%rbp), %rdi
movq 0x138(%rdi), %rax
movq %rax, -0x1d8(%rbp)
callq 0x8540
movq %rax, %rcx
movq -0x1d8(%rbp), %rax
cmpq %rcx, %rax
jge 0x55c2
movq -0x190(%rbp), %rax
cmpq $0x0, 0x138(%rax)
je 0x55a5
movq -0x190(%rbp), %rdi
movq 0x1aa6f(%rip), %rax     # 0x1ffd8
movq (%rax), %rax
movq %rax, -0x1e8(%rbp)
movq 0x138(%rdi), %rax
movq %rax, -0x1e0(%rbp)
callq 0x8540
movq -0x1e8(%rbp), %rdi
movq -0x1e0(%rbp), %rdx
movq %rax, %rcx
leaq 0x12de9(%rip), %rsi     # 0x18387
movb $0x0, %al
callq 0x44c0
movq -0x190(%rbp), %rdi
callq 0x8540
movq %rax, %rcx
movq -0x190(%rbp), %rax
movq %rcx, 0x138(%rax)
movq -0x190(%rbp), %rsi
addq $0x150, %rsi            # imm = 0x150
leaq -0x148(%rbp), %rdi
callq 0x8560
movq $0x0, -0x150(%rbp)
movq -0x150(%rbp), %rax
cmpq -0x10(%rbp), %rax
jae 0x56ee
movq -0x190(%rbp), %rdi
addq $0x1b0, %rdi            # imm = 0x1B0
movq %rdi, -0x1f8(%rbp)
callq 0x85e0
movq %rax, -0x160(%rbp)
leaq -0x158(%rbp), %rdi
leaq -0x160(%rbp), %rsi
callq 0x8610
movl $0x340, %edi            # imm = 0x340
callq 0x4310
movq %rax, -0x1f0(%rbp)
jmp 0x563f
movq -0x190(%rbp), %rsi
movq -0x1f0(%rbp), %rdi
movq -0x150(%rbp), %rdx
movq -0x10(%rbp), %rcx
callq 0x8650
jmp 0x565f
movq -0x1f8(%rbp), %rdi
movq -0x1f0(%rbp), %rax
movq %rax, -0x168(%rbp)
movq -0x158(%rbp), %rsi
leaq -0x168(%rbp), %rdx
callq 0x85a0
movq %rax, -0x200(%rbp)
jmp 0x5690
movq -0x200(%rbp), %rax
movq %rax, -0x180(%rbp)
movq -0x150(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x150(%rbp)
jmp 0x55e7
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x170(%rbp)
movl %eax, -0x174(%rbp)
jmp 0x5727
movq -0x1f0(%rbp), %rdi
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x170(%rbp)
movl %eax, -0x174(%rbp)
movl $0x340, %esi            # imm = 0x340
callq 0x4320
jmp 0x5727
callq 0x4430
movq %rax, %rcx
movq -0x190(%rbp), %rax
movq %rcx, -0x188(%rbp)
movq -0x188(%rbp), %rcx
movq %rcx, 0x140(%rax)
leaq -0x148(%rbp), %rdi
callq 0x8790
addq $0x200, %rsp            # imm = 0x200
popq %rbp
retq
leaq -0x148(%rbp), %rdi
callq 0x8790
movq -0x170(%rbp), %rdi
callq 0x4600
nop