user: Translate the below assembly code into C programming language:

```asm
<nstrread_dup>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  sub    $0x30,%rsp
  mov    %edi,-0x24(%rbp)
  mov    %rsi,-0x30(%rbp)
  mov    %fs:0x28,%rax
  mov    %rax,-0x8(%rbp)
  xor    %eax,%eax
  movq   $0x0,-0x18(%rbp)
  lea    -0x10(%rbp),%rsi
  mov    -0x24(%rbp),%eax
  mov    $0x0,%ecx
  mov    $0x4,%edx
  mov    %eax,%edi
  call   <jelio_read@plt>
  cmp    $0x4,%rax
  je     L10
  mov    $0xffffffffffffffff,%rax
  jmp    L96
L10:
  movzbl -0xd(%rbp),%eax
  cmp    $0x3a,%al
  je     L165
  lea    -0x10(%rbp),%rax
  add    $0x4,%rax
  mov    -0x24(%rbp),%edi
  mov    $0x0,%ecx
  mov    $0x4,%edx
  mov    %rax,%rsi
  call   <jelio_read@plt>
  cmp    $0x4,%rax
  je     L39
  mov    $0xffffffffffffffff,%rax
  jmp    L96
L39:
  movzbl -0x9(%rbp),%eax
  cmp    $0x3a,%al
  je     L26
  mov    $0xffffffffffffffff,%rax
  jmp    L96
L26:
  movb   $0x0,-0x9(%rbp)
  jmp    L48
L165:
  movb   $0x0,-0xd(%rbp)
L48:
  lea    -0x10(%rbp),%rax
  mov    %rax,-0x20(%rbp)
  jmp    L14
L144:
  mov    -0x18(%rbp),%rdx
  mov    %rdx,%rax
  shl    $0x2,%rax
  add    %rdx,%rax
  add    %rax,%rax
  mov    %rax,-0x18(%rbp)
  mov    -0x20(%rbp),%rax
  movzbl (%rax),%eax
  movsbl %al,%eax
  sub    $0x30,%eax
  cltq
  add    %rax,-0x18(%rbp)
  addq   $0x1,-0x20(%rbp)
L14:
  mov    -0x20(%rbp),%rax
  movzbl (%rax),%eax
  test   %al,%al
  jne    L144
  mov    -0x18(%rbp),%rax
  add    $0x2,%rax
  mov    %rax,%rdi
  call   <malloc@plt>
  mov    %rax,%rdx
  mov    -0x30(%rbp),%rax
  mov    %rdx,(%rax)
  mov    -0x30(%rbp),%rax
  mov    (%rax),%rax
  test   %rax,%rax
  jne    L127
  mov    $0xffffffffffffffff,%rax
  jmp    L96
L127:
  mov    -0x18(%rbp),%rax
  lea    0x1(%rax),%rdx
  mov    -0x30(%rbp),%rax
  mov    (%rax),%rsi
  mov    -0x24(%rbp),%eax
  mov    $0x0,%ecx
  mov    %eax,%edi
  call   <jelio_read@plt>
  mov    -0x18(%rbp),%rdx
  add    $0x1,%rdx
  cmp    %rdx,%rax
  je     L88
  mov    -0x30(%rbp),%rax
  mov    (%rax),%rax
  mov    %rax,%rdi
  call   <free@plt>
  mov    -0x30(%rbp),%rax
  movq   $0x0,(%rax)
  mov    $0xffffffffffffffff,%rax
  jmp    L96
L88:
  mov    -0x30(%rbp),%rax
  mov    (%rax),%rdx
  mov    -0x18(%rbp),%rax
  add    %rdx,%rax
  movzbl (%rax),%eax
  cmp    $0x2c,%al
  je     L31
  mov    -0x30(%rbp),%rax
  mov    (%rax),%rax
  mov    %rax,%rdi
  call   <free@plt>
  mov    -0x30(%rbp),%rax
  movq   $0x0,(%rax)
  mov    $0xffffffffffffffff,%rax
  jmp    L96
L31:
  mov    -0x30(%rbp),%rax
  mov    (%rax),%rdx
  mov    -0x18(%rbp),%rax
  add    %rdx,%rax
  movb   $0x0,(%rax)
  mov    -0x18(%rbp),%rax
L96:
  mov    -0x8(%rbp),%rdx
  sub    %fs:0x28,%rdx
  je     L98
  call   <__stack_chk_fail@plt>
L98:
  leave
  ret
```

assistant: ```c
size_t nstrread_dup(int fd, char **s) {
  char buf[8], *p;
  size_t len = 0;
  if (jelio_read(fd, buf, 4, NULL) != 4)
    return -1;
  if (buf[3] != ':') {
    if (jelio_read(fd, buf + 4, 4, NULL) != 4)
      return -1;
    if (buf[7] != ':')
      return -1;
    buf[7] = 0;
  } else
    buf[3] = 0;
  for (p = buf; *p; p++) {
    len *= 10;
    len += *p - '0';
  }
  *s = malloc(len + 2);
  if (!*s)
    return -1;
  if (jelio_read(fd, *s, len + 1, NULL) != len + 1) {
    free(*s);
    *s = NULL;
    return -1;
  }
  if (*(*s + len) != ',') {
    free(*s);
    *s = NULL;
    return -1;
  }
  *(*s + len) = 0;
  return len;
}
```