user: 请从给定的汇编指令推导出C源代码：

```asm
<parsepasswd>:
  endbr64
  push   %r15
  push   %r14
  push   %r13
  push   %r12
  push   %rbp
  push   %rbx
  sub    $0x48,%rsp
  mov    %rdi,%rbp
  mov    %rsi,%r13
  mov    %rdx,%r12
  mov    %rcx,%rbx
  mov    %fs:0x28,%rax
  mov    %rax,0x38(%rsp)
  xor    %eax,%eax
  movq   $0x0,0x10(%rsp)
  movq   $0x0,0x18(%rsp)
  movq   $0x0,0x20(%rsp)
  movl   $0x0,0x28(%rsp)
  call   <strlen@plt>
  add    $0x1,%eax
  mov    %eax,0x2c(%rsp)
  mov    %ebx,0x8(%rsp)
  cmp    %ebx,%eax
  jg     L48
  mov    $0x0,%edx
  mov    $0x1,%ecx
  test   %eax,%eax
  jg     L31
  jmp    L23
L48:
  mov    D16(%rip),%rax
  mov    (%rax),%eax
  jmp    L37
L80:
  mov    0x2c(%rsp),%ebx
  add    $0x1,%rdx
  cmp    %edx,%ebx
  jle    L18
L31:
  cmpb   $0x3a,0x0(%rbp,%rdx,1)
  jne    L80
  movslq %ecx,%rax
  lea    0x1(%rdx),%esi
  mov    %esi,0x10(%rsp,%rax,4)
  lea    0x1(%rcx),%ecx
  jmp    L80
L18:
  cmp    $0x7,%ecx
  je     L40
L23:
  mov    D5(%rip),%rax
  mov    (%rax),%eax
L37:
  mov    0x38(%rsp),%rdx
  sub    %fs:0x28,%rdx
  jne    L38
  add    $0x48,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
L40:
  mov    0x8(%rsp),%edx
  mov    $0x0,%esi
  mov    %r12,%rdi
  call   <memset@plt>
  mov    0x1c(%rsp),%r14d
  mov    0x18(%rsp),%r15d
  mov    %r14d,%eax
  sub    %r15d,%eax
  mov    %eax,0xc(%rsp)
  lea    -0x1(%rax),%edx
  movslq %r15d,%rsi
  add    %rbp,%rsi
  mov    %r12,%rdi
  call   <memcpy@plt>
  movslq 0xc(%rsp),%rax
  movb   $0x0,(%r12,%rax,1)
  mov    %r12,%rdi
  call   <atoi@plt>
  mov    %rax,0x30(%r13)
  mov    0x8(%rsp),%edx
  mov    $0x0,%esi
  mov    %r12,%rdi
  call   <memset@plt>
  mov    0x20(%rsp),%eax
  mov    %eax,0x8(%rsp)
  mov    %eax,%edi
  sub    %r14d,%edi
  mov    %edi,0xc(%rsp)
  lea    -0x1(%rdi),%edx
  movslq %r14d,%rsi
  add    %rbp,%rsi
  mov    %r12,%rdi
  call   <memcpy@plt>
  movslq 0xc(%rsp),%rax
  movb   $0x0,(%r12,%rax,1)
  mov    %r12,%rdi
  call   <atoi@plt>
  mov    %rax,0x28(%r13)
  mov    %ebx,%edx
  mov    $0x0,%esi
  mov    %r12,%rdi
  call   <memset@plt>
  mov    %r12,0x0(%r13)
  mov    0x14(%rsp),%r14d
  mov    0x10(%rsp),%eax
  mov    %r14d,%ecx
  sub    %eax,%ecx
  mov    %ecx,0xc(%rsp)
  lea    -0x1(%rcx),%edx
  cltq
  lea    0x0(%rbp,%rax,1),%rsi
  mov    %r12,%rdi
  call   <memcpy@plt>
  movslq 0xc(%rsp),%rax
  add    %rax,%r12
  movb   $0x0,(%r12)
  mov    %r12,0x8(%r13)
  sub    %r14d,%r15d
  lea    -0x1(%r15),%edx
  movslq %r14d,%rsi
  add    %rbp,%rsi
  mov    %r12,%rdi
  call   <memcpy@plt>
  movslq %r15d,%r15
  add    %r12,%r15
  movb   $0x0,(%r15)
  mov    %r15,0x10(%r13)
  mov    0x24(%rsp),%r12d
  mov    %r12d,%r14d
  mov    0x8(%rsp),%eax
  sub    %eax,%r14d
  lea    -0x1(%r14),%edx
  movslq %eax,%rsi
  add    %rbp,%rsi
  mov    %r15,%rdi
  call   <memcpy@plt>
  movslq %r14d,%r14
  add    %r15,%r14
  movb   $0x0,(%r14)
  mov    %r14,0x18(%r13)
  mov    0x28(%rsp),%r15d
  mov    %r15d,%eax
  sub    %r12d,%eax
  mov    %eax,0x8(%rsp)
  lea    -0x1(%rax),%edx
  movslq %r12d,%rsi
  add    %rbp,%rsi
  mov    %r14,%rdi
  call   <memcpy@plt>
  movslq 0x8(%rsp),%r12
  add    %r14,%r12
  movb   $0x0,(%r12)
  mov    %r12,0x20(%r13)
  sub    %r15d,%ebx
  lea    -0x1(%rbx),%edx
  movslq %r15d,%r15
  lea    0x0(%rbp,%r15,1),%rsi
  mov    %r12,%rdi
  call   <memcpy@plt>
  movslq %ebx,%rbx
  movb   $0x0,(%r12,%rbx,1)
  mov    $0x0,%eax
  jmp    L37
L38:
  call   <__stack_chk_fail@plt>
```

assistant: ```c
int parsepasswd(char *str, struct passwd *result, char *buffer, size_t buflen) {
  int fields[7 + 1] = {0};
  fields[7] = strlen(str) + 1;
  if (fields[7] > (int)buflen) {
    return ERANGE;
  }
  int i, field;
  for (field = 1, i = 0; i < fields[7]; i++) {
    if (str[i] == ':') {
      fields[field++] = i + 1;
    }
  }
  if (field != 7) {
    return ENOENT;
  }
  do {
    memset(buffer, 0, buflen);
    memcpy(buffer, &str[fields[2]], ((fields[2 + 1] - fields[2]) - 1));
    buffer[((fields[2 + 1] - fields[2]) - 1) + 1] = '\0';
    result->pw_uid = atoi(buffer);
  } while (0);
  do {
    memset(buffer, 0, buflen);
    memcpy(buffer, &str[fields[3]], ((fields[3 + 1] - fields[3]) - 1));
    buffer[((fields[3 + 1] - fields[3]) - 1) + 1] = '\0';
    result->pw_gid = atoi(buffer);
  } while (0);
  memset(buffer, 0, fields[7]);
  do {
    result->pw_name = buffer;
    memcpy(buffer, &str[fields[0]], ((fields[0 + 1] - fields[0]) - 1));
    buffer[((fields[0 + 1] - fields[0]) - 1) + 1] = '\0';
    buffer += ((fields[0 + 1] - fields[0]) - 1) + 1;
  } while (0);
  do {
    result->pw_passwd = buffer;
    memcpy(buffer, &str[fields[1]], ((fields[1 + 1] - fields[1]) - 1));
    buffer[((fields[1 + 1] - fields[1]) - 1) + 1] = '\0';
    buffer += ((fields[1 + 1] - fields[1]) - 1) + 1;
  } while (0);
  do {
    result->pw_gecos = buffer;
    memcpy(buffer, &str[fields[4]], ((fields[4 + 1] - fields[4]) - 1));
    buffer[((fields[4 + 1] - fields[4]) - 1) + 1] = '\0';
    buffer += ((fields[4 + 1] - fields[4]) - 1) + 1;
  } while (0);
  do {
    result->pw_dir = buffer;
    memcpy(buffer, &str[fields[5]], ((fields[5 + 1] - fields[5]) - 1));
    buffer[((fields[5 + 1] - fields[5]) - 1) + 1] = '\0';
    buffer += ((fields[5 + 1] - fields[5]) - 1) + 1;
  } while (0);
  do {
    result->pw_shell = buffer;
    memcpy(buffer, &str[fields[6]], ((fields[6 + 1] - fields[6]) - 1));
    buffer[((fields[6 + 1] - fields[6]) - 1) + 1] = '\0';
    buffer += ((fields[6 + 1] - fields[6]) - 1) + 1;
  } while (0);
  return 0;
}
```