// File: /workspace/github_cpp_makefile_star2_O3/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 0x6099
movq %rax, 0x10(%rbx)
movq $0x0, 0x28(%rbx)
movq 0x20(%rbx), %rax
movb $0x0, (%rax)
movl $0x0, (%rbx)
leaq 0x50c3(%rip), %rsi      # 0xb178
movl $0x7, %r12d
movl $0x7, %edx
movq %r15, %rdi
callq 0x3120
testl %eax, %eax
je 0x6114
leaq 0x50ad(%rip), %rsi      # 0xb180
movl $0x5, %r12d
movl $0x5, %edx
movq %r15, %rdi
callq 0x3120
movl $0x2, %ecx
testl %eax, %eax
je 0x6119
movq 0x8ee2(%rip), %rax      # 0xefd8
movq (%rax), %rdi
leaq 0x5086(%rip), %rsi      # 0xb186
movl $0x4, %edx
movq %r15, %rcx
xorl %eax, %eax
callq 0x3340
jmp 0x63d9
movl $0x1, %ecx
movl %ecx, (%rbx)
addq %r15, %r12
leaq 0x10(%rsp), %rdx
movq $0x0, (%rdx)
leaq 0x5079(%rip), %rsi      # 0xb1aa
leaq 0xc(%rsp), %rcx
movq %r12, %rdi
xorl %eax, %eax
callq 0x3210
cmpl $0x1, %eax
jne 0x6371
movslq 0xc(%rsp), %rax
cmpb $0x0, (%r12,%rax)
jne 0x6387
addq %rax, %r12
incq %r12
movq %r15, %rcx
subq %r12, %rcx
addq %r14, %rcx
movq 0x10(%rsp), %rdx
cmpq %rdx, %rcx
jne 0x638e
leaq 0x5003(%rip), %rsi      # 0xb180
movl $0x5, %edx
movq %r12, %rdi
callq 0x3120
testl %eax, %eax
jne 0x63a8
leaq 0x8(%rbx), %r13
leaq 0x508a(%rip), %r14      # 0xb227
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 0x6528
leaq 0x5072(%rip), %rsi      # 0xb24a
movl $0x7, %edx
movq %r14, %rdi
callq 0x3120
testl %eax, %eax
jne 0x622e
leaq 0x20(%rbx), %r15
leaq 0x5033(%rip), %r12      # 0xb227
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 0x501d(%rip), %rsi      # 0xb252
movl $0x7, %edx
movq %r14, %rdi
callq 0x3120
testl %eax, %eax
jne 0x6288
leaq 0x4fda(%rip), %r15      # 0xb227
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 0x4fcb(%rip), %rsi      # 0xb25a
movl $0xa, %edx
movq %r14, %rdi
callq 0x3120
testl %eax, %eax
jne 0x63be
leaq 0x4f7c(%rip), %r15      # 0xb227
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 0x6346
leaq 0x40(%rbx), %rdi
leaq 0x60(%rbx), %rsi
leaq 0x80(%rbx), %rdx
leaq 0x120(%rbx), %rcx
callq 0x63ee
movl %eax, %ecx
movl $0x1, %eax
testl %ecx, %ecx
jne 0x63de
leaq 0xc0(%rbx), %rsi
leaq 0xe0(%rbx), %rdx
addq $0x128, %rbx            # imm = 0x128
movq %r15, %rdi
movq %rbx, %rcx
callq 0x63ee
movl %eax, %ecx
xorl %eax, %eax
testl %ecx, %ecx
setne %al
jmp 0x63de
movq 0x8c60(%rip), %rax      # 0xefd8
movq (%rax), %rdi
leaq 0x4e2e(%rip), %rsi      # 0xb1b0
movq %r15, %rdx
jmp 0x63d2
callq 0x365f
jmp 0x63d9
movq 0x8c43(%rip), %rax      # 0xefd8
movq (%rax), %rdi
leaq 0x4e54(%rip), %rsi      # 0xb1f3
xorl %eax, %eax
callq 0x3340
jmp 0x63d9
movq 0x8c29(%rip), %rax      # 0xefd8
movq (%rax), %rdi
leaq 0x4e71(%rip), %rsi      # 0xb22a
movq %r12, %rdx
jmp 0x63d2
movq 0x8c13(%rip), %rax      # 0xefd8
movq (%rax), %rdi
leaq 0x4e96(%rip), %rsi      # 0xb265
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