// File: 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
movq %rsp, %rbp
subq $0x80, %rsp
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
movq %rdx, -0x20(%rbp)
movq -0x10(%rbp), %rdi
movq %rdi, -0x70(%rbp)
addq $0x8, %rdi
callq 0x67d0
movq -0x70(%rbp), %rdi
addq $0x20, %rdi
callq 0x4410
movq -0x70(%rbp), %rax
movl $0x0, (%rax)
movq -0x18(%rbp), %rax
movq %rax, -0x28(%rbp)
movq -0x18(%rbp), %rdi
leaq 0x11dd6(%rip), %rsi     # 0x18168
movl $0x7, %edx
callq 0x4160
cmpl $0x0, %eax
jne 0x63b9
movq -0x70(%rbp), %rax
movl $0x1, (%rax)
movq -0x28(%rbp), %rax
addq $0x7, %rax
movq %rax, -0x28(%rbp)
jmp 0x641a
movq -0x18(%rbp), %rdi
leaq 0x11dac(%rip), %rsi     # 0x18170
movl $0x5, %edx
callq 0x4160
cmpl $0x0, %eax
jne 0x63eb
movq -0x70(%rbp), %rax
movl $0x2, (%rax)
movq -0x28(%rbp), %rax
addq $0x5, %rax
movq %rax, -0x28(%rbp)
jmp 0x6418
movq 0x19be6(%rip), %rax     # 0x1ffd8
movq (%rax), %rdi
movq -0x18(%rbp), %rcx
leaq 0x11d76(%rip), %rsi     # 0x18176
movl $0x4, %edx
movb $0x0, %al
callq 0x44c0
movl $0x1, -0x4(%rbp)
jmp 0x67bc
jmp 0x641a
movq $0x0, -0x38(%rbp)
movq -0x28(%rbp), %rdi
leaq 0x11d6d(%rip), %rsi     # 0x1819a
leaq -0x38(%rbp), %rdx
leaq -0x2c(%rbp), %rcx
movb $0x0, %al
callq 0x42f0
cmpl $0x1, %eax
je 0x6469
movq 0x19b90(%rip), %rax     # 0x1ffd8
movq (%rax), %rdi
movq -0x18(%rbp), %rdx
leaq 0x11d4a(%rip), %rsi     # 0x181a0
movb $0x0, %al
callq 0x44c0
movl $0x1, -0x4(%rbp)
jmp 0x67bc
movq -0x28(%rbp), %rax
movslq -0x2c(%rbp), %rcx
movsbl (%rax,%rcx), %eax
cmpl $0x0, %eax
je 0x649e
movq 0x19b57(%rip), %rax     # 0x1ffd8
movq (%rax), %rdi
leaq 0x11d36(%rip), %rsi     # 0x181c1
movb $0x0, %al
callq 0x44c0
movl $0x1, -0x4(%rbp)
jmp 0x67bc
movl -0x2c(%rbp), %ecx
addl $0x1, %ecx
movq -0x28(%rbp), %rax
movslq %ecx, %rcx
addq %rcx, %rax
movq %rax, -0x28(%rbp)
movq -0x20(%rbp), %rax
movq -0x28(%rbp), %rcx
movq -0x18(%rbp), %rdx
subq %rdx, %rcx
subq %rcx, %rax
cmpq -0x38(%rbp), %rax
je 0x6504
movq 0x19b07(%rip), %rax     # 0x1ffd8
movq (%rax), %rdi
movq -0x38(%rbp), %rdx
movq -0x20(%rbp), %rcx
movq -0x28(%rbp), %rax
movq -0x18(%rbp), %rsi
subq %rsi, %rax
subq %rax, %rcx
leaq 0x11cf2(%rip), %rsi     # 0x181e3
movb $0x0, %al
callq 0x44c0
movl $0x1, -0x4(%rbp)
jmp 0x67bc
movq -0x28(%rbp), %rdi
leaq 0x11c61(%rip), %rsi     # 0x18170
movl $0x5, %edx
callq 0x4160
cmpl $0x0, %eax
jne 0x6550
movq -0x28(%rbp), %rdi
leaq 0x11cee(%rip), %rsi     # 0x18217
callq 0x4040
addq -0x28(%rbp), %rax
movq %rax, -0x28(%rbp)
movq -0x28(%rbp), %rdi
leaq 0x11cd6(%rip), %rsi     # 0x18217
callq 0x4120
addq -0x28(%rbp), %rax
movq %rax, -0x28(%rbp)
jmp 0x6578
movq 0x19a81(%rip), %rax     # 0x1ffd8
movq (%rax), %rdi
movq -0x28(%rbp), %rdx
leaq 0x11cb5(%rip), %rsi     # 0x1821a
movb $0x0, %al
callq 0x44c0
movl $0x1, -0x4(%rbp)
jmp 0x67bc
movq -0x70(%rbp), %rdi
movq %rdi, %rax
addq $0x8, %rax
movq %rax, -0x78(%rbp)
addq $0x8, %rdi
callq 0x6890
movq %rax, -0x48(%rbp)
leaq -0x40(%rbp), %rdi
leaq -0x48(%rbp), %rsi
callq 0x68c0
movq -0x78(%rbp), %rdi
movq -0x18(%rbp), %rdx
movq -0x28(%rbp), %rcx
movq -0x40(%rbp), %rsi
callq 0x67f0
movq %rax, -0x50(%rbp)
movq -0x28(%rbp), %rdi
leaq 0x11c75(%rip), %rsi     # 0x1823a
movl $0x7, %edx
callq 0x4160
cmpl $0x0, %eax
jne 0x6621
movq -0x28(%rbp), %rax
movq %rax, -0x58(%rbp)
movq -0x28(%rbp), %rdi
leaq 0x11c30(%rip), %rsi     # 0x18217
callq 0x4040
addq -0x28(%rbp), %rax
movq %rax, -0x28(%rbp)
movq -0x28(%rbp), %rdi
leaq 0x11c18(%rip), %rsi     # 0x18217
callq 0x4120
movq -0x70(%rbp), %rdi
addq -0x28(%rbp), %rax
movq %rax, -0x28(%rbp)
addq $0x20, %rdi
movq -0x58(%rbp), %rsi
movq -0x28(%rbp), %rdx
callq 0x6900
movq -0x28(%rbp), %rdi
leaq 0x11c16(%rip), %rsi     # 0x18242
movl $0x7, %edx
callq 0x4160
cmpl $0x0, %eax
jne 0x6688
movq -0x28(%rbp), %rax
movq %rax, -0x60(%rbp)
movq -0x28(%rbp), %rdi
leaq 0x11bc9(%rip), %rsi     # 0x18217
callq 0x4040
addq -0x28(%rbp), %rax
movq %rax, -0x28(%rbp)
movq -0x28(%rbp), %rdi
leaq 0x11bb1(%rip), %rsi     # 0x18217
callq 0x4120
movq -0x70(%rbp), %rdi
addq -0x28(%rbp), %rax
movq %rax, -0x28(%rbp)
addq $0x40, %rdi
movq -0x60(%rbp), %rsi
movq -0x28(%rbp), %rdx
callq 0x6900
movq -0x28(%rbp), %rdi
leaq 0x11bb7(%rip), %rsi     # 0x1824a
movl $0xa, %edx
callq 0x4160
cmpl $0x0, %eax
jne 0x66f4
movq -0x28(%rbp), %rax
movq %rax, -0x68(%rbp)
movq -0x28(%rbp), %rdi
leaq 0x11b62(%rip), %rsi     # 0x18217
callq 0x4040
addq -0x28(%rbp), %rax
movq %rax, -0x28(%rbp)
movq -0x28(%rbp), %rdi
leaq 0x11b4a(%rip), %rsi     # 0x18217
callq 0x4120
movq -0x70(%rbp), %rdi
addq -0x28(%rbp), %rax
movq %rax, -0x28(%rbp)
addq $0xa0, %rdi
movq -0x68(%rbp), %rsi
movq -0x28(%rbp), %rdx
callq 0x6900
jmp 0x671c
movq 0x198dd(%rip), %rax     # 0x1ffd8
movq (%rax), %rdi
movq -0x28(%rbp), %rdx
leaq 0x11b4c(%rip), %rsi     # 0x18255
movb $0x0, %al
callq 0x44c0
movl $0x1, -0x4(%rbp)
jmp 0x67bc
movq -0x70(%rbp), %rdi
addq $0x100, %rdi            # imm = 0x100
movq -0x28(%rbp), %rsi
callq 0x4650
movq -0x70(%rbp), %rdi
addq $0x40, %rdi
callq 0x45c0
testb $0x1, %al
jne 0x6779
movq -0x70(%rbp), %rcx
movq %rcx, %rdi
addq $0x40, %rdi
movq %rcx, %rsi
addq $0x60, %rsi
movq %rcx, %rdx
addq $0x80, %rdx
addq $0x120, %rcx            # imm = 0x120
callq 0x6970
cmpl $0x0, %eax
je 0x6777
movl $0x1, -0x4(%rbp)
jmp 0x67bc
jmp 0x6779
movq -0x70(%rbp), %rcx
movq %rcx, %rdi
addq $0xa0, %rdi
movq %rcx, %rsi
addq $0xc0, %rsi
movq %rcx, %rdx
addq $0xe0, %rdx
addq $0x128, %rcx            # imm = 0x128
callq 0x6970
cmpl $0x0, %eax
je 0x67b5
movl $0x1, -0x4(%rbp)
jmp 0x67bc
movl $0x0, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0x80, %rsp
popq %rbp
retq
nopl (%rax,%rax)