// File: /workspace/github_cpp_makefile_star2_O1/ndsol[P]git-mine/git-mine.cpp
// Function: main
int main(int argc, char ** argv) {
  if (argc != 3 && argc != 1) {
    // This utility must be called from a post-commit hook
    // with $GIT_TOPLEVEL as the only argument.
    fprintf(stderr, "Usage: %s [ atime_hint ctime_hint ]\n",
            argv[0]);
    return 1;
  }
  long long atime_hint = 0;
  long long ctime_hint = 0;
  if (argc == 3) {
    int n;
    if (sscanf(argv[1], "%lld%n", &atime_hint, &n) != 1 ||
        (int)strlen(argv[1]) != n) {
      fprintf(stderr, "Invalid atime_hint: \"%s\"\n", argv[2]);
      return 1;
    }
    if (sscanf(argv[2], "%lld%n", &ctime_hint, &n) != 1 ||
        (int)strlen(argv[2]) != n) {
      fprintf(stderr, "Invalid ctime_hint: \"%s\"\n", argv[2]);
      return 1;
    }
  }

  MineBoss boss;
  boss.atime_hint = atime_hint;
  boss.ctime_hint = ctime_hint;
  {
    FILE* f = stdin;
    CommitReader reader(argv[0]);
    if (reader.read_from(f, &boss.orig)) {
      return 1;
    }
    Sha1Hash sha;
    Blake2Hash b2h;
    if (boss.orig.hash(sha, b2h)) {
      return 1;
    }
    char shabuf[1024];
    if (sha.dump(shabuf, sizeof(shabuf))) {
      return 1;
    }
    fprintf(stderr, "Signing commit: %s\n", shabuf);
  }

  boss.start();
  for (size_t i = 90;;) {
    if (boss.printProgressAt1Hz()) break;
    i--;
    i++;
    if (!i) {
      fprintf(stderr, "\ntimed out\n");
      break;
    }
  }
  if (boss.getSearchDone()) {
    boss.commitMatch();
  }
  boss.stop();
  return 0;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
subq $0x7a0, %rsp            # imm = 0x7A0
movq %rsi, %r15
movl %edi, %eax
andl $-0x3, %eax
cmpl $0x1, %eax
jne 0x54b0
xorl %r14d, %r14d
movq %r14, 0x10(%rsp)
movq %r14, 0x8(%rsp)
cmpl $0x3, %edi
jne 0x54db
movq 0x8(%r15), %rdi
leaq 0x6c20(%rip), %rsi      # 0xc05d
leaq 0x10(%rsp), %rdx
leaq 0x260(%rsp), %rcx
xorl %eax, %eax
callq 0x3210
cmpl $0x1, %eax
jne 0x54c3
movq 0x8(%r15), %rdi
callq 0x3100
cmpl %eax, 0x260(%rsp)
jne 0x54c3
leaq 0x10(%r15), %rbx
movq 0x10(%r15), %rdi
leaq 0x6be6(%rip), %rsi      # 0xc05d
xorl %r14d, %r14d
leaq 0x8(%rsp), %rdx
leaq 0x260(%rsp), %rcx
xorl %eax, %eax
callq 0x3210
cmpl $0x1, %eax
jne 0x54a6
movq (%rbx), %rdi
callq 0x3100
movb $0x1, %cl
cmpl %eax, 0x260(%rsp)
je 0x54d3
movq %rbx, %rdi
callq 0x3535
jmp 0x54cb
movq %r15, %rdi
callq 0x34f2
movl $0x1, %r14d
jmp 0x56a6
movq %r15, %rdi
callq 0x3510
movl $0x1, %r14d
xorl %ecx, %ecx
testb %cl, %cl
je 0x56a6
xorps %xmm0, %xmm0
leaq 0x50(%rsp), %rax
movups %xmm0, -0x28(%rax)
xorl %r12d, %r12d
movq %r12, -0x18(%rax)
movq %rax, -0x10(%rax)
movq %r12, -0x8(%rax)
movb %r12b, (%rax)
leaq 0x70(%rsp), %rax
movq %rax, -0x10(%rax)
movq %r12, -0x8(%rax)
movb %r12b, (%rax)
leaq 0x90(%rsp), %rax
movq %rax, -0x10(%rax)
movq %r12, -0x8(%rax)
movb %r12b, (%rax)
leaq 0xb0(%rsp), %rax
movq %rax, -0x10(%rax)
movq %r12, -0x8(%rax)
movb %r12b, (%rax)
leaq 0xd0(%rsp), %rax
movq %rax, -0x10(%rax)
movq %r12, -0x8(%rax)
movb %r12b, (%rax)
leaq 0xf0(%rsp), %rax
movq %rax, -0x10(%rax)
movq %r12, -0x8(%rax)
movb %r12b, (%rax)
leaq 0x110(%rsp), %rax
movq %rax, -0x10(%rax)
movq %r12, -0x8(%rax)
movb %r12b, (%rax)
leaq 0x130(%rsp), %rax
movq %rax, -0x10(%rax)
movq %r12, -0x8(%rax)
movb %r12b, (%rax)
leaq 0x198(%rsp), %rbx
movq %r12, -0x8(%rbx)
movups %xmm0, -0x18(%rbx)
movups %xmm0, -0x28(%rbx)
movups %xmm0, -0x38(%rbx)
movq %rbx, %rdi
callq 0x3330
movw $0x0, 0x30(%rbx)
xorps %xmm0, %xmm0
movups %xmm0, 0x38(%rbx)
movq %r12, 0x48(%rbx)
movq 0x10(%rsp), %rax
movq %rax, -0x48(%rbx)
movq 0x8(%rsp), %rax
movq %rax, -0x40(%rbx)
movq 0xa9fb(%rip), %rax      # 0xffc0
movq (%rax), %rsi
movq (%r15), %rax
leaq 0x18(%rsp), %rdi
movq %rax, (%rdi)
leaq 0x20(%rsp), %rdx
callq 0x572e
testl %eax, %eax
jne 0x560b
xorl %eax, %eax
leaq 0x1e8(%rsp), %rsi
movb %al, 0x74(%rsi)
leaq 0x660(%rsp), %rdx
movb %al, 0x40(%rdx)
leaq 0x20(%rsp), %rdi
callq 0x59d2
testl %eax, %eax
je 0x56b9
movl $0x1, %ebp
xorl %r15d, %r15d
testb %r15b, %r15b
je 0x5684
leaq 0x20(%rsp), %rdi
callq 0x5ab4
leaq 0x20(%rsp), %r14
movq %r14, %rdi
callq 0x5d6a
testl %eax, %eax
je 0x5627
leaq 0x170(%rsp), %rax
leaq 0x260(%rsp), %rdi
movq %rax, (%rdi)
movb $0x0, 0x8(%rdi)
callq 0x6e94
leaq 0x260(%rsp), %rdi
movb $0x1, 0x8(%rdi)
movb 0x1c9(%rsp), %bpl
callq 0x6e7e
cmpb $0x1, %bpl
jne 0x5678
leaq 0x20(%rsp), %rdi
callq 0x5f80
xorl %ebp, %ebp
leaq 0x20(%rsp), %rdi
callq 0x6006
leaq 0x1d0(%rsp), %rdi
callq 0x80cc
movq %rbx, %rdi
callq 0x34a0
leaq 0x20(%rsp), %rdi
callq 0x60da
movl %ebp, %r14d
movl %r14d, %eax
addq $0x7a0, %rsp            # imm = 0x7A0
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
leaq 0x260(%rsp), %rdi
leaq 0x1e8(%rsp), %rdx
movl $0x400, %esi            # imm = 0x400
movl $0x14, %ecx
callq 0xaf20
movl $0x1, %ebp
testl %eax, %eax
sete %r15b
jne 0x5613
movq 0xa8e0(%rip), %rax      # 0xffd0
movq (%rax), %rdi
leaq 0x699e(%rip), %rsi      # 0xc098
leaq 0x260(%rsp), %rdx
xorl %eax, %eax
callq 0x3340
movl %r14d, %ebp
jmp 0x5613
jmp 0x5719
jmp 0x5719
jmp 0x5719
jmp 0x5719
movq %rax, %rbx
leaq 0x20(%rsp), %rdi
callq 0x60b4
movq %rbx, %rdi
callq 0x3480