// File: /workspace/github_cpp_makefile_star2_O1/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, %r14
movq %rsi, %r15
movq %rdi, %rbx
movq 0x8(%rdi), %rax
cmpq %rax, 0x10(%rdi)
je 0x6205
movq %rax, 0x10(%rbx)
movq $0x0, 0x28(%rbx)
movq 0x20(%rbx), %rax
movb $0x0, (%rax)
movl $0x0, (%rbx)
leaq 0x5f57(%rip), %rsi      # 0xc178
movl $0x7, %r12d
movl $0x7, %edx
movq %r15, %rdi
callq 0x3120
testl %eax, %eax
je 0x6280
leaq 0x5f41(%rip), %rsi      # 0xc180
movl $0x5, %r12d
movl $0x5, %edx
movq %r15, %rdi
callq 0x3120
movl $0x2, %ecx
testl %eax, %eax
je 0x6285
movq 0x9d6e(%rip), %rax      # 0xffd0
movq (%rax), %rdi
leaq 0x5f1a(%rip), %rsi      # 0xc186
movl $0x4, %edx
movq %r15, %rcx
xorl %eax, %eax
callq 0x3340
jmp 0x6545
movl $0x1, %ecx
movl %ecx, (%rbx)
addq %r15, %r12
leaq 0x10(%rsp), %rdx
movq $0x0, (%rdx)
leaq 0x5f0d(%rip), %rsi      # 0xc1aa
leaq 0xc(%rsp), %rcx
movq %r12, %rdi
xorl %eax, %eax
callq 0x3210
cmpl $0x1, %eax
jne 0x64dd
movslq 0xc(%rsp), %rax
cmpb $0x0, (%r12,%rax)
jne 0x64f3
addq %rax, %r12
incq %r12
movq %r15, %rcx
subq %r12, %rcx
addq %r14, %rcx
movq 0x10(%rsp), %rdx
cmpq %rdx, %rcx
jne 0x64fa
leaq 0x5e97(%rip), %rsi      # 0xc180
movl $0x5, %edx
movq %r12, %rdi
callq 0x3120
testl %eax, %eax
jne 0x6514
leaq 0x8(%rbx), %r13
leaq 0x5f1e(%rip), %r14      # 0xc227
movq %r12, %rdi
movq %r14, %rsi
callq 0x3040
movq %rax, %rbp
addq %r12, %rbp
movq %rbp, %rdi
movq %r14, %rsi
callq 0x30f0
movq %rax, %r14
addq %rbp, %r14
movq 0x10(%rbx), %rsi
movq %r13, %rdi
movq %r15, %rdx
movq %r14, %rcx
callq 0x66ac
leaq 0x5f06(%rip), %rsi      # 0xc24a
movl $0x7, %edx
movq %r14, %rdi
callq 0x3120
testl %eax, %eax
jne 0x639a
leaq 0x20(%rbx), %r15
leaq 0x5ec7(%rip), %r12      # 0xc227
movq %r14, %rdi
movq %r12, %rsi
callq 0x3040
movq %rax, %r13
leaq (%r14,%rax), %rbp
movq %rbp, %rdi
movq %r12, %rsi
callq 0x30f0
addq %rax, %rbp
movq 0x28(%rbx), %rdx
addq %rax, %r13
movq %r15, %rdi
xorl %esi, %esi
movq %r14, %rcx
movq %r13, %r8
callq 0x3280
movq %rbp, %r14
leaq 0x5eb1(%rip), %rsi      # 0xc252
movl $0x7, %edx
movq %r14, %rdi
callq 0x3120
testl %eax, %eax
jne 0x63f4
leaq 0x5e6e(%rip), %r15      # 0xc227
movq %r14, %rdi
movq %r15, %rsi
callq 0x3040
movq %rax, %r12
leaq (%r14,%rax), %r13
movq %r13, %rdi
movq %r15, %rsi
callq 0x30f0
addq %rax, %r13
leaq 0x40(%rbx), %rdi
movq 0x48(%rbx), %rdx
addq %rax, %r12
xorl %esi, %esi
movq %r14, %rcx
movq %r12, %r8
callq 0x3280
movq %r13, %r14
leaq 0x5e5f(%rip), %rsi      # 0xc25a
movl $0xa, %edx
movq %r14, %rdi
callq 0x3120
testl %eax, %eax
jne 0x652a
leaq 0x5e10(%rip), %r15      # 0xc227
movq %r14, %rdi
movq %r15, %rsi
callq 0x3040
movq %rax, %r13
leaq (%r14,%rax), %r12
movq %r12, %rdi
movq %r15, %rsi
callq 0x30f0
addq %rax, %r12
leaq 0xa0(%rbx), %r15
movq 0xa8(%rbx), %rdx
addq %rax, %r13
movq %r15, %rdi
xorl %esi, %esi
movq %r14, %rcx
movq %r13, %r8
callq 0x3280
leaq 0x100(%rbx), %r14
movq 0x108(%rbx), %r13
movq %r12, %rdi
callq 0x3100
movq %r14, %rdi
xorl %esi, %esi
movq %r13, %rdx
movq %r12, %rcx
movq %rax, %r8
callq 0x33a0
cmpq $0x0, 0x48(%rbx)
je 0x64b2
leaq 0x40(%rbx), %rdi
leaq 0x60(%rbx), %rsi
leaq 0x80(%rbx), %rdx
leaq 0x120(%rbx), %rcx
callq 0x655a
movl %eax, %ecx
movl $0x1, %eax
testl %ecx, %ecx
jne 0x654a
leaq 0xc0(%rbx), %rsi
leaq 0xe0(%rbx), %rdx
addq $0x128, %rbx            # imm = 0x128
movq %r15, %rdi
movq %rbx, %rcx
callq 0x655a
movl %eax, %ecx
xorl %eax, %eax
testl %ecx, %ecx
setne %al
jmp 0x654a
movq 0x9aec(%rip), %rax      # 0xffd0
movq (%rax), %rdi
leaq 0x5cc2(%rip), %rsi      # 0xc1b0
movq %r15, %rdx
jmp 0x653e
callq 0x3685
jmp 0x6545
movq 0x9acf(%rip), %rax      # 0xffd0
movq (%rax), %rdi
leaq 0x5ce8(%rip), %rsi      # 0xc1f3
xorl %eax, %eax
callq 0x3340
jmp 0x6545
movq 0x9ab5(%rip), %rax      # 0xffd0
movq (%rax), %rdi
leaq 0x5d05(%rip), %rsi      # 0xc22a
movq %r12, %rdx
jmp 0x653e
movq 0x9a9f(%rip), %rax      # 0xffd0
movq (%rax), %rdi
leaq 0x5d2a(%rip), %rsi      # 0xc265
movq %r14, %rdx
xorl %eax, %eax
callq 0x3340
movl $0x1, %eax
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
nop