// File: /workspace/github_cpp_makefile_star2_O2/ndsol[P]git-mine/./hashapi.h
// Function: CommitMessage::set(char*, unsigned long)
int set(char* message, size_t len) {
    header.clear();
    parent.clear();
    type = MessageUNKNOWN;

    // Parse message.
    char* p = message;
    if (!strncmp(message, "commit ", 7)) {
      type = MessageCOMMIT;
      p += 7;
    } else if (!strncmp(message, "tree ", 5)) {
      type = MessageTREE;
      p += 5;
    } else {
      fprintf(stderr, "CommitMessage: invalid type \"%.*s\"\n", 4, message);
      return 1;
    }

    int n;
    size_t declared_len = 0;
    if (sscanf(p, "%zu%n", &declared_len, &n) != 1) {
      fprintf(stderr, "CommitMessage: invalid len \"%s\"\n", message);
      return 1;
    }
    if (p[n] != 0) {
      fprintf(stderr, "CommitMessage: missing null byte\n");
      return 1;
    }
    p += n + 1;
    if (len - (p - message) != declared_len) {
      fprintf(stderr, "CommitMessage: bad declared_len: got %zu, want %zu\n",
              declared_len, len - (p - message));
      return 1;
    }

    if (!strncmp(p, "tree ", 5)) {
      p += strcspn(p, "\r\n");
      p += strspn(p, "\r\n");
    } else {
      fprintf(stderr, "CommitMessage: missing tree:\n%s", p);
      return 1;
    }
    header.insert(header.end(), message, p);
    if (!strncmp(p, "parent ", 7)) {
      char* first = p;
      p += strcspn(p, "\r\n");
      p += strspn(p, "\r\n");
      parent.assign(first, p);
    }
    if (!strncmp(p, "author ", 7)) {
      char* first = p;
      p += strcspn(p, "\r\n");
      p += strspn(p, "\r\n");
      author.assign(first, p);
    }
    // Note that committer has the extra \n between committer and log.
    if (!strncmp(p, "committer ", 10)) {
      char* first = p;
      p += strcspn(p, "\r\n");
      p += strspn(p, "\r\n");
      committer.assign(first, p);
    } else {
      fprintf(stderr, "CommitMessage: missing committer:\n%s", p);
      return 1;
    }
    log.assign(p);

    // Parse timestamps
    if (!author.empty()) {
      if (CommitMessage::parseTimestamp(&author, &author_time, &author_tz,
                                        &author_btime)) {
        return 1;
      }
    }
    if (CommitMessage::parseTimestamp(&committer, &committer_time,
                                      &committer_tz, &committer_btime)) {
      return 1;
    }
    return 0;
  }

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
movq %rdx, %r15
movq %rsi, %r14
movq %rdi, %rbx
movq 0x8(%rdi), %rax
cmpq %rax, 0x10(%rdi)
je 0x4457
movq %rax, 0x10(%rbx)
andq $0x0, 0x28(%rbx)
movq 0x20(%rbx), %rax
movb $0x0, (%rax)
andl $0x0, (%rbx)
leaq 0x5d0b(%rip), %rsi      # 0xa178
pushq $0x7
popq %r12
movq %r14, %rdi
movq %r12, %rdx
callq 0x3130
testl %eax, %eax
je 0x44a2
leaq 0x5cf9(%rip), %rsi      # 0xa180
pushq $0x5
popq %r12
movq %r14, %rdi
movq %r12, %rdx
callq 0x3130
testl %eax, %eax
jne 0x4748
pushq $0x2
jmp 0x44a4
pushq $0x1
popq %rax
movl %eax, (%rbx)
addq %r14, %r12
leaq 0x10(%rsp), %rdx
andq $0x0, (%rdx)
leaq 0x5cf0(%rip), %rsi      # 0xa1aa
leaq 0xc(%rsp), %rcx
movq %r12, %rdi
xorl %eax, %eax
callq 0x3230
cmpl $0x1, %eax
jne 0x46b7
movslq 0xc(%rsp), %rax
cmpb $0x0, (%r12,%rax)
jne 0x46cd
addq %rax, %r12
incq %r12
movq %r14, %rcx
subq %r12, %rcx
addq %r15, %rcx
movq 0x10(%rsp), %rdx
cmpq %rdx, %rcx
jne 0x46eb
leaq 0x5c7a(%rip), %rsi      # 0xa180
pushq $0x5
popq %rdx
movq %r12, %rdi
callq 0x3130
testl %eax, %eax
jne 0x4705
leaq 0x8(%rbx), %r13
leaq 0x5d03(%rip), %r15      # 0xa227
movq %r12, %rdi
movq %r15, %rsi
callq 0x3040
movq %rax, %rbp
addq %r12, %rbp
movq %rbp, %rdi
movq %r15, %rsi
callq 0x30f0
movq %rax, %r15
addq %rbp, %r15
movq 0x10(%rbx), %rsi
movq %r13, %rdi
movq %r14, %rdx
movq %r15, %rcx
callq 0x4768
leaq 0x5ceb(%rip), %rsi      # 0xa24a
pushq $0x7
popq %rdx
movq %r15, %rdi
callq 0x3130
testl %eax, %eax
jne 0x45ac
leaq 0x20(%rbx), %r14
leaq 0x5cae(%rip), %r12      # 0xa227
movq %r15, %rdi
movq %r12, %rsi
callq 0x3040
movq %rax, %r13
addq %r15, %r13
movq %r13, %rdi
movq %r12, %rsi
callq 0x30f0
movq %rax, %r12
addq %r13, %r12
movq %r14, %rdi
movq %r15, %rsi
movq %r12, %rdx
callq 0x4788
movq %r12, %r15
leaq 0x5c9f(%rip), %rsi      # 0xa252
pushq $0x7
popq %rdx
movq %r15, %rdi
callq 0x3130
testl %eax, %eax
jne 0x45fd
leaq 0x5c5e(%rip), %r14      # 0xa227
movq %r15, %rdi
movq %r14, %rsi
callq 0x3040
movq %rax, %r12
addq %r15, %r12
movq %r12, %rdi
movq %r14, %rsi
callq 0x30f0
movq %rax, %r14
addq %r12, %r14
leaq 0x40(%rbx), %rdi
movq %r15, %rsi
movq %r14, %rdx
callq 0x4788
movq %r14, %r15
leaq 0x5c56(%rip), %rsi      # 0xa25a
pushq $0xa
popq %rdx
movq %r15, %rdi
callq 0x3130
testl %eax, %eax
jne 0x471b
leaq 0x5c09(%rip), %r14      # 0xa227
movq %r15, %rdi
movq %r14, %rsi
callq 0x3040
leaq (%rax,%r15), %r12
movq %r12, %rdi
movq %r14, %rsi
callq 0x30f0
addq %rax, %r12
leaq 0xa0(%rbx), %r14
movq %r14, %rdi
movq %r15, %rsi
movq %r12, %rdx
callq 0x4788
leaq 0x100(%rbx), %rdi
movq %r12, %rsi
callq 0x34f0
cmpq $0x0, 0x48(%rbx)
je 0x4689
leaq 0x40(%rbx), %rdi
leaq 0x60(%rbx), %rsi
leaq 0x80(%rbx), %rdx
leaq 0x120(%rbx), %rcx
callq 0x479e
testl %eax, %eax
jne 0x4736
leaq 0xc0(%rbx), %rsi
leaq 0xe0(%rbx), %rdx
addq $0x128, %rbx            # imm = 0x128
movq %r14, %rdi
movq %rbx, %rcx
callq 0x479e
movl %eax, %ecx
xorl %eax, %eax
testl %ecx, %ecx
setne %al
jmp 0x4739
movq 0xa91a(%rip), %rax      # 0xefd8
movq (%rax), %rdi
leaq 0x5ae8(%rip), %rsi      # 0xa1b0
movq %r14, %rdx
jmp 0x472f
movq 0xa904(%rip), %rax      # 0xefd8
movq (%rax), %rcx
leaq 0x5af3(%rip), %rdi      # 0xa1d1
pushq $0x21
popq %rsi
pushq $0x1
popq %rdx
callq 0x3510
jmp 0x4736
movq 0xa8e6(%rip), %rax      # 0xefd8
movq (%rax), %rdi
leaq 0x5af7(%rip), %rsi      # 0xa1f3
xorl %eax, %eax
callq 0x33a0
jmp 0x4736
movq 0xa8cc(%rip), %rax      # 0xefd8
movq (%rax), %rdi
leaq 0x5b14(%rip), %rsi      # 0xa22a
movq %r12, %rdx
jmp 0x472f
movq 0xa8b6(%rip), %rax      # 0xefd8
movq (%rax), %rdi
leaq 0x5b39(%rip), %rsi      # 0xa265
movq %r15, %rdx
xorl %eax, %eax
callq 0x33a0
pushq $0x1
popq %rax
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq 0xa889(%rip), %rax      # 0xefd8
movq (%rax), %rdi
leaq 0x5a2d(%rip), %rsi      # 0xa186
pushq $0x4
popq %rdx
movq %r14, %rcx
xorl %eax, %eax
callq 0x33a0
jmp 0x4736