user: 请将这段汇编代码片段转换成等效的C代码：

```asm
<parsepasswd>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  sub    $0x60,%rsp
  mov    %rdi,-0x48(%rbp)
  mov    %rsi,-0x50(%rbp)
  mov    %rdx,-0x58(%rbp)
  mov    %rcx,-0x60(%rbp)
  mov    %fs:0x28,%rax
  mov    %rax,-0x8(%rbp)
  xor    %eax,%eax
  movq   $0x0,-0x30(%rbp)
  movq   $0x0,-0x28(%rbp)
  movq   $0x0,-0x20(%rbp)
  movq   $0x0,-0x18(%rbp)
  mov    -0x48(%rbp),%rax
  mov    %rax,%rdi
  call   <strlen@plt>
  add    $0x1,%eax
  mov    %eax,-0x14(%rbp)
  mov    -0x14(%rbp),%eax
  mov    -0x60(%rbp),%rdx
  cmp    %edx,%eax
  jle    L3
  mov    D11(%rip),%rax
  mov    (%rax),%eax
  jmp    L57
L3:
  movl   $0x1,-0x34(%rbp)
  movl   $0x0,-0x38(%rbp)
  jmp    L67
L21:
  mov    -0x38(%rbp),%eax
  movslq %eax,%rdx
  mov    -0x48(%rbp),%rax
  add    %rdx,%rax
  movzbl (%rax),%eax
  cmp    $0x3a,%al
  jne    L41
  mov    -0x34(%rbp),%eax
  lea    0x1(%rax),%edx
  mov    %edx,-0x34(%rbp)
  mov    -0x38(%rbp),%edx
  add    $0x1,%edx
  cltq
  mov    %edx,-0x30(%rbp,%rax,4)
L41:
  addl   $0x1,-0x38(%rbp)
L67:
  mov    -0x14(%rbp),%eax
  cmp    %eax,-0x38(%rbp)
  jl     L21
  cmpl   $0x7,-0x34(%rbp)
  je     L14
  mov    D5(%rip),%rax
  mov    (%rax),%eax
  jmp    L57
L14:
  mov    -0x60(%rbp),%rax
  mov    %eax,%edx
  mov    -0x58(%rbp),%rax
  mov    $0x0,%esi
  mov    %rax,%rdi
  call   <memset@plt>
  mov    -0x24(%rbp),%eax
  mov    -0x28(%rbp),%edx
  sub    %edx,%eax
  lea    -0x1(%rax),%edx
  mov    -0x28(%rbp),%eax
  movslq %eax,%rcx
  mov    -0x48(%rbp),%rax
  add    %rax,%rcx
  mov    -0x58(%rbp),%rax
  mov    %rcx,%rsi
  mov    %rax,%rdi
  call   <memcpy@plt>
  mov    -0x24(%rbp),%eax
  mov    -0x28(%rbp),%edx
  sub    %edx,%eax
  sub    $0x1,%eax
  cltq
  lea    0x1(%rax),%rdx
  mov    -0x58(%rbp),%rax
  add    %rdx,%rax
  movb   $0x0,(%rax)
  mov    -0x58(%rbp),%rax
  mov    %rax,%rdi
  call   <atoi@plt>
  mov    -0x50(%rbp),%rdx
  mov    %rax,0x30(%rdx)
  mov    -0x60(%rbp),%rax
  mov    %eax,%edx
  mov    -0x58(%rbp),%rax
  mov    $0x0,%esi
  mov    %rax,%rdi
  call   <memset@plt>
  mov    -0x20(%rbp),%eax
  mov    -0x24(%rbp),%edx
  sub    %edx,%eax
  lea    -0x1(%rax),%edx
  mov    -0x24(%rbp),%eax
  movslq %eax,%rcx
  mov    -0x48(%rbp),%rax
  add    %rax,%rcx
  mov    -0x58(%rbp),%rax
  mov    %rcx,%rsi
  mov    %rax,%rdi
  call   <memcpy@plt>
  mov    -0x20(%rbp),%eax
  mov    -0x24(%rbp),%edx
  sub    %edx,%eax
  sub    $0x1,%eax
  cltq
  lea    0x1(%rax),%rdx
  mov    -0x58(%rbp),%rax
  add    %rdx,%rax
  movb   $0x0,(%rax)
  mov    -0x58(%rbp),%rax
  mov    %rax,%rdi
  call   <atoi@plt>
  mov    -0x50(%rbp),%rdx
  mov    %rax,0x28(%rdx)
  mov    -0x14(%rbp),%edx
  mov    -0x58(%rbp),%rax
  mov    $0x0,%esi
  mov    %rax,%rdi
  call   <memset@plt>
  mov    -0x50(%rbp),%rax
  mov    -0x58(%rbp),%rdx
  mov    %rdx,(%rax)
  mov    -0x2c(%rbp),%eax
  mov    -0x30(%rbp),%edx
  sub    %edx,%eax
  lea    -0x1(%rax),%edx
  mov    -0x30(%rbp),%eax
  movslq %eax,%rcx
  mov    -0x48(%rbp),%rax
  add    %rax,%rcx
  mov    -0x58(%rbp),%rax
  mov    %rcx,%rsi
  mov    %rax,%rdi
  call   <memcpy@plt>
  mov    -0x2c(%rbp),%eax
  mov    -0x30(%rbp),%edx
  sub    %edx,%eax
  sub    $0x1,%eax
  cltq
  lea    0x1(%rax),%rdx
  mov    -0x58(%rbp),%rax
  add    %rdx,%rax
  movb   $0x0,(%rax)
  mov    -0x2c(%rbp),%eax
  mov    -0x30(%rbp),%edx
  sub    %edx,%eax
  sub    $0x1,%eax
  cltq
  add    $0x1,%rax
  add    %rax,-0x58(%rbp)
  mov    -0x50(%rbp),%rax
  mov    -0x58(%rbp),%rdx
  mov    %rdx,0x8(%rax)
  mov    -0x28(%rbp),%eax
  mov    -0x2c(%rbp),%edx
  sub    %edx,%eax
  lea    -0x1(%rax),%edx
  mov    -0x2c(%rbp),%eax
  movslq %eax,%rcx
  mov    -0x48(%rbp),%rax
  add    %rax,%rcx
  mov    -0x58(%rbp),%rax
  mov    %rcx,%rsi
  mov    %rax,%rdi
  call   <memcpy@plt>
  mov    -0x28(%rbp),%eax
  mov    -0x2c(%rbp),%edx
  sub    %edx,%eax
  sub    $0x1,%eax
  cltq
  lea    0x1(%rax),%rdx
  mov    -0x58(%rbp),%rax
  add    %rdx,%rax
  movb   $0x0,(%rax)
  mov    -0x28(%rbp),%eax
  mov    -0x2c(%rbp),%edx
  sub    %edx,%eax
  sub    $0x1,%eax
  cltq
  add    $0x1,%rax
  add    %rax,-0x58(%rbp)
  mov    -0x50(%rbp),%rax
  mov    -0x58(%rbp),%rdx
  mov    %rdx,0x10(%rax)
  mov    -0x1c(%rbp),%eax
  mov    -0x20(%rbp),%edx
  sub    %edx,%eax
  lea    -0x1(%rax),%edx
  mov    -0x20(%rbp),%eax
  movslq %eax,%rcx
  mov    -0x48(%rbp),%rax
  add    %rax,%rcx
  mov    -0x58(%rbp),%rax
  mov    %rcx,%rsi
  mov    %rax,%rdi
  call   <memcpy@plt>
  mov    -0x1c(%rbp),%eax
  mov    -0x20(%rbp),%edx
  sub    %edx,%eax
  sub    $0x1,%eax
  cltq
  lea    0x1(%rax),%rdx
  mov    -0x58(%rbp),%rax
  add    %rdx,%rax
  movb   $0x0,(%rax)
  mov    -0x1c(%rbp),%eax
  mov    -0x20(%rbp),%edx
  sub    %edx,%eax
  sub    $0x1,%eax
  cltq
  add    $0x1,%rax
  add    %rax,-0x58(%rbp)
  mov    -0x50(%rbp),%rax
  mov    -0x58(%rbp),%rdx
  mov    %rdx,0x18(%rax)
  mov    -0x18(%rbp),%eax
  mov    -0x1c(%rbp),%edx
  sub    %edx,%eax
  lea    -0x1(%rax),%edx
  mov    -0x1c(%rbp),%eax
  movslq %eax,%rcx
  mov    -0x48(%rbp),%rax
  add    %rax,%rcx
  mov    -0x58(%rbp),%rax
  mov    %rcx,%rsi
  mov    %rax,%rdi
  call   <memcpy@plt>
  mov    -0x18(%rbp),%eax
  mov    -0x1c(%rbp),%edx
  sub    %edx,%eax
  sub    $0x1,%eax
  cltq
  lea    0x1(%rax),%rdx
  mov    -0x58(%rbp),%rax
  add    %rdx,%rax
  movb   $0x0,(%rax)
  mov    -0x18(%rbp),%eax
  mov    -0x1c(%rbp),%edx
  sub    %edx,%eax
  sub    $0x1,%eax
  cltq
  add    $0x1,%rax
  add    %rax,-0x58(%rbp)
  mov    -0x50(%rbp),%rax
  mov    -0x58(%rbp),%rdx
  mov    %rdx,0x20(%rax)
  mov    -0x14(%rbp),%eax
  mov    -0x18(%rbp),%edx
  sub    %edx,%eax
  lea    -0x1(%rax),%edx
  mov    -0x18(%rbp),%eax
  movslq %eax,%rcx
  mov    -0x48(%rbp),%rax
  add    %rax,%rcx
  mov    -0x58(%rbp),%rax
  mov    %rcx,%rsi
  mov    %rax,%rdi
  call   <memcpy@plt>
  mov    -0x14(%rbp),%eax
  mov    -0x18(%rbp),%edx
  sub    %edx,%eax
  sub    $0x1,%eax
  cltq
  lea    0x1(%rax),%rdx
  mov    -0x58(%rbp),%rax
  add    %rdx,%rax
  movb   $0x0,(%rax)
  mov    -0x14(%rbp),%eax
  mov    -0x18(%rbp),%edx
  sub    %edx,%eax
  sub    $0x1,%eax
  cltq
  add    $0x1,%rax
  add    %rax,-0x58(%rbp)
  mov    $0x0,%eax
L57:
  mov    -0x8(%rbp),%rdx
  sub    %fs:0x28,%rdx
  je     L42
  call   <__stack_chk_fail@plt>
L42:
  leave
  ret
```

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;
}
```