// File: ndsol[P]git-mine/git-mine.cpp
// Function: MineBoss::ThreadLocal::search(long long)
int search(long long atime) {
      float total_work = float(noodle.ctime() - atime);
      // Use floats to trade off accuracy for avoiding overflow.
      long long my_work_start =
          (long long) ((float(id) * total_work) / float(idMax)) + atime;
      long long my_work_end =
          (long long) ((float(id + 1) * total_work) / float(idMax)) + atime;
      int my_count = 1;
      for (long long t = my_work_start; t < my_work_end; t++, my_count++) {
        if ((my_count & (COUNT_DIVISOR - 1)) == 0) {
          my_count = 0;
          std::unique_lock<std::mutex> lock(parent->bossMutex);
          count++;
          if (parent->stopRequested) {
            return 1;
          }
        }
        noodle.set_atime(t);
        noodle.hash(sha, b2h);
        size_t matchlen = 0;
        int match = b2h.instr(sha.result, sizeof(sha.result), &matchlen);
        if (match != -1) {
          if (matchlen > best) {
            best = matchlen;
            best_atime = t;
            best_ctime = noodle.ctime();
          }
          if (matchlen >= terminateAt) {
            // Signal that a match was found.
            std::unique_lock<std::mutex> lock(parent->bossMutex);
            matchFound = 1;
            parent->searchDone = true;
            parent->cond.notify_all();
            return 1;
          }
        }
      }
      return 0;
    }

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0xc0, %rsp
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
movq -0x10(%rbp), %rdi
movq %rdi, -0x90(%rbp)
addq $0x18, %rdi
callq 0x8540
movq -0x90(%rbp), %rcx
movq -0x18(%rbp), %rdx
subq %rdx, %rax
cvtsi2ss %rax, %xmm0
movss %xmm0, -0x1c(%rbp)
movq 0x150(%rcx), %rax
movq 0x158(%rcx), %rcx
movq %rcx, -0x88(%rbp)
movq %rax, %rdx
shrq %rdx
movl %eax, %ecx
andl $0x1, %ecx
orq %rdx, %rcx
cvtsi2ss %rcx, %xmm0
addss %xmm0, %xmm0
cvtsi2ss %rax, %xmm1
movss %xmm1, -0x80(%rbp)
testq %rax, %rax
movss %xmm0, -0x7c(%rbp)
js 0xa419
movss -0x80(%rbp), %xmm0
movss %xmm0, -0x7c(%rbp)
movq -0x88(%rbp), %rax
movss -0x7c(%rbp), %xmm0
movss -0x1c(%rbp), %xmm1
mulss %xmm1, %xmm0
movss %xmm0, -0x9c(%rbp)
movq %rax, %rdx
shrq %rdx
movl %eax, %ecx
andl $0x1, %ecx
orq %rdx, %rcx
cvtsi2ss %rcx, %xmm0
addss %xmm0, %xmm0
cvtsi2ss %rax, %xmm1
movss %xmm1, -0x98(%rbp)
testq %rax, %rax
movss %xmm0, -0x94(%rbp)
js 0xa477
movss -0x98(%rbp), %xmm0
movss %xmm0, -0x94(%rbp)
movq -0x90(%rbp), %rcx
movss -0x9c(%rbp), %xmm0
movss -0x94(%rbp), %xmm1
divss %xmm1, %xmm0
cvttss2si %xmm0, %rax
movq -0x18(%rbp), %rdx
addq %rdx, %rax
movq %rax, -0x28(%rbp)
movq 0x150(%rcx), %rax
movq 0x158(%rcx), %rcx
movq %rcx, -0xb0(%rbp)
incq %rax
movq %rax, %rdx
shrq %rdx
movl %eax, %ecx
andl $0x1, %ecx
orq %rdx, %rcx
cvtsi2ss %rcx, %xmm0
addss %xmm0, %xmm0
cvtsi2ss %rax, %xmm1
movss %xmm1, -0xa4(%rbp)
testq %rax, %rax
movss %xmm0, -0xa0(%rbp)
js 0xa4fb
movss -0xa4(%rbp), %xmm0
movss %xmm0, -0xa0(%rbp)
movq -0xb0(%rbp), %rax
movss -0xa0(%rbp), %xmm0
movss -0x1c(%rbp), %xmm1
mulss %xmm1, %xmm0
movss %xmm0, -0xbc(%rbp)
movq %rax, %rdx
shrq %rdx
movl %eax, %ecx
andl $0x1, %ecx
orq %rdx, %rcx
cvtsi2ss %rcx, %xmm0
addss %xmm0, %xmm0
cvtsi2ss %rax, %xmm1
movss %xmm1, -0xb8(%rbp)
testq %rax, %rax
movss %xmm0, -0xb4(%rbp)
js 0xa55c
movss -0xb8(%rbp), %xmm0
movss %xmm0, -0xb4(%rbp)
movss -0xbc(%rbp), %xmm0
movss -0xb4(%rbp), %xmm1
divss %xmm1, %xmm0
cvttss2si %xmm0, %rax
addq -0x18(%rbp), %rax
movq %rax, -0x30(%rbp)
movl $0x1, -0x34(%rbp)
movq -0x28(%rbp), %rax
movq %rax, -0x40(%rbp)
movq -0x40(%rbp), %rax
cmpq -0x30(%rbp), %rax
jge 0xa761
movl -0x34(%rbp), %eax
andl $0x3fff, %eax           # imm = 0x3FFF
cmpl $0x0, %eax
jne 0xa61d
movq -0x90(%rbp), %rax
movl $0x0, -0x34(%rbp)
movq (%rax), %rsi
addq $0x150, %rsi            # imm = 0x150
leaq -0x50(%rbp), %rdi
callq 0x8560
movq -0x90(%rbp), %rax
movq 0x338(%rax), %rcx
addq $0x1, %rcx
movq %rcx, 0x338(%rax)
movq (%rax), %rax
testb $0x1, 0x1a8(%rax)
je 0xa5fd
movl $0x1, -0x4(%rbp)
movl $0x1, -0x54(%rbp)
jmp 0xa604
movl $0x0, -0x54(%rbp)
leaq -0x50(%rbp), %rdi
callq 0x8790
movl -0x54(%rbp), %eax
testl %eax, %eax
je 0xa61b
jmp 0xa616
jmp 0xa768
jmp 0xa61d
movq -0x90(%rbp), %rdi
addq $0x18, %rdi
movq -0x40(%rbp), %rsi
callq 0xaad0
movq -0x90(%rbp), %rdx
movq %rdx, %rdi
addq $0x18, %rdi
movq %rdx, %rsi
addq $0x180, %rsi            # imm = 0x180
addq $0x1f8, %rdx            # imm = 0x1F8
callq 0x5080
movq -0x90(%rbp), %rsi
movq $0x0, -0x60(%rbp)
movq %rsi, %rdi
addq $0x1f8, %rdi            # imm = 0x1F8
addq $0x180, %rsi            # imm = 0x180
movl $0x14, %edx
leaq -0x60(%rbp), %rcx
callq 0xab20
movl %eax, -0x64(%rbp)
cmpl $-0x1, -0x64(%rbp)
je 0xa745
movq -0x90(%rbp), %rcx
movq -0x60(%rbp), %rax
movq 0x168(%rcx), %rcx
cmpq %rcx, %rax
jbe 0xa6de
movq -0x90(%rbp), %rdi
movq -0x60(%rbp), %rax
movq %rax, 0x168(%rdi)
movq -0x40(%rbp), %rax
movq %rax, 0x170(%rdi)
addq $0x18, %rdi
callq 0x8540
movq %rax, %rcx
movq -0x90(%rbp), %rax
movq %rcx, 0x178(%rax)
cmpq $0x5, -0x60(%rbp)
jb 0xa743
movq -0x90(%rbp), %rax
movq (%rax), %rsi
addq $0x150, %rsi            # imm = 0x150
leaq -0x78(%rbp), %rdi
callq 0x8560
movq -0x90(%rbp), %rax
movq $0x1, 0x160(%rax)
movq (%rax), %rcx
movb $0x1, 0x1a9(%rcx)
movq (%rax), %rdi
addq $0x178, %rdi            # imm = 0x178
callq 0x45d0
movl $0x1, -0x4(%rbp)
movl $0x1, -0x54(%rbp)
leaq -0x78(%rbp), %rdi
callq 0x8790
jmp 0xa768
jmp 0xa745
jmp 0xa747
movq -0x40(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x40(%rbp)
movl -0x34(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x34(%rbp)
jmp 0xa58c
movl $0x0, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0xc0, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)
nop