user: Converte this assembly snippet into its equivalent C code:

```asm
<ns_initparse>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  sub    $0x30,%rsp
  mov    %rdi,-0x18(%rbp)
  mov    %esi,-0x1c(%rbp)
  mov    %rdx,-0x28(%rbp)
  mov    -0x1c(%rbp),%eax
  cltq
  lea    0x0(,%rax,4),%rdx
  mov    -0x18(%rbp),%rax
  add    %rdx,%rax
  mov    %rax,-0x8(%rbp)
  mov    -0x28(%rbp),%rax
  mov    $0x30,%edx
  mov    $0x5e,%esi
  mov    %rax,%rdi
  call   <memset@plt>
  mov    -0x28(%rbp),%rax
  mov    -0x18(%rbp),%rdx
  mov    %rdx,0x28(%rax)
  mov    -0x28(%rbp),%rax
  mov    -0x8(%rbp),%rdx
  mov    %rdx,0x20(%rax)
  mov    D109(%rip),%rax
  mov    (%rax),%eax
  cltq
  lea    0x0(,%rax,4),%rdx
  mov    -0x18(%rbp),%rax
  add    %rdx,%rax
  cmp    %rax,-0x8(%rbp)
  jae    L40
  mov    D18(%rip),%rax
  mov    (%rax),%edx
  mov    D49(%rip),%rax
  mov    %edx,(%rax)
  mov    $0xffffffff,%eax
  jmp    L93
L40:
  mov    -0x28(%rbp),%rax
  mov    (%rax),%rax
  mov    -0x18(%rbp),%rdx
  mov    %rdx,%rsi
  mov    %rax,%rdi
  call   <NS_GET16@plt>
  mov    D109(%rip),%rax
  mov    (%rax),%eax
  cltq
  lea    0x0(,%rax,4),%rdx
  mov    -0x18(%rbp),%rax
  add    %rdx,%rax
  cmp    %rax,-0x8(%rbp)
  jae    L48
  mov    D18(%rip),%rax
  mov    (%rax),%edx
  mov    D49(%rip),%rax
  mov    %edx,(%rax)
  mov    $0xffffffff,%eax
  jmp    L93
L48:
  mov    -0x28(%rbp),%rax
  mov    0x8(%rax),%rax
  mov    -0x18(%rbp),%rdx
  mov    %rdx,%rsi
  mov    %rax,%rdi
  call   <NS_GET16@plt>
  movl   $0x0,-0x10(%rbp)
  jmp    L126
L62:
  mov    D109(%rip),%rax
  mov    (%rax),%eax
  cltq
  lea    0x0(,%rax,4),%rdx
  mov    -0x18(%rbp),%rax
  add    %rdx,%rax
  cmp    %rax,-0x8(%rbp)
  jae    L75
  mov    D18(%rip),%rax
  mov    (%rax),%edx
  mov    D49(%rip),%rax
  mov    %edx,(%rax)
  mov    $0xffffffff,%eax
  jmp    L93
L75:
  mov    -0x28(%rbp),%rax
  mov    0x10(%rax),%rdx
  mov    -0x10(%rbp),%eax
  cltq
  shl    $0x3,%rax
  add    %rdx,%rax
  mov    (%rax),%rax
  mov    -0x18(%rbp),%rdx
  mov    %rdx,%rsi
  mov    %rax,%rdi
  call   <NS_GET16@plt>
  addl   $0x1,-0x10(%rbp)
L126:
  mov    D131(%rip),%rax
  mov    (%rax),%eax
  cmp    %eax,-0x10(%rbp)
  jl     L62
  movl   $0x0,-0x10(%rbp)
  jmp    L152
L65:
  mov    -0x28(%rbp),%rax
  mov    0x10(%rax),%rdx
  mov    -0x10(%rbp),%eax
  cltq
  shl    $0x3,%rax
  add    %rdx,%rax
  mov    (%rax),%rax
  test   %rax,%rax
  jne    L94
  mov    -0x28(%rbp),%rax
  mov    0x18(%rax),%rdx
  mov    -0x10(%rbp),%eax
  cltq
  shl    $0x3,%rax
  add    %rdx,%rax
  movq   $0x0,(%rax)
  jmp    L97
L94:
  mov    -0x28(%rbp),%rax
  mov    0x10(%rax),%rdx
  mov    -0x10(%rbp),%eax
  cltq
  shl    $0x3,%rax
  add    %rdx,%rax
  mov    (%rax),%rcx
  mov    -0x10(%rbp),%edx
  mov    -0x8(%rbp),%rsi
  mov    -0x18(%rbp),%rax
  mov    %rax,%rdi
  call   <ns_skiprr@plt>
  mov    %eax,-0xc(%rbp)
  cmpl   $0x0,-0xc(%rbp)
  jns    L21
  mov    $0xffffffff,%eax
  jmp    L93
L21:
  mov    -0x28(%rbp),%rax
  mov    0x18(%rax),%rdx
  mov    -0x10(%rbp),%eax
  cltq
  shl    $0x3,%rax
  add    %rax,%rdx
  mov    -0x18(%rbp),%rax
  mov    %rax,(%rdx)
  mov    -0xc(%rbp),%eax
  cltq
  shl    $0x2,%rax
  add    %rax,-0x18(%rbp)
L97:
  addl   $0x1,-0x10(%rbp)
L152:
  mov    D131(%rip),%rax
  mov    (%rax),%eax
  cmp    %eax,-0x10(%rbp)
  jl     L65
  mov    -0x18(%rbp),%rax
  cmp    -0x8(%rbp),%rax
  je     L0
  mov    D18(%rip),%rax
  mov    (%rax),%edx
  mov    D49(%rip),%rax
  mov    %edx,(%rax)
  mov    $0xffffffff,%eax
  jmp    L93
L0:
  mov    D131(%rip),%rax
  mov    (%rax),%edx
  mov    -0x28(%rbp),%rax
  mov    %edx,%esi
  mov    %rax,%rdi
  call   <setsection@plt>
  mov    $0x0,%eax
L93:
  leave
  ret
```

assistant: ```c
int ns_initparse(const u_char *msg, int msglen, ns_msg *handle) {
  const u_char *eom = msg + msglen;
  int i;
  memset(handle, 0x5e, sizeof *handle);
  handle->_msg = msg;
  handle->_eom = eom;
  if (msg + NS_INT16SZ > eom)
    do {
      errno = (EMSGSIZE);
      return (-1);
    } while (0);
  NS_GET16(handle->_id, msg);
  if (msg + NS_INT16SZ > eom)
    do {
      errno = (EMSGSIZE);
      return (-1);
    } while (0);
  NS_GET16(handle->_flags, msg);
  for (i = 0; i < ns_s_max; i++) {
    if (msg + NS_INT16SZ > eom)
      do {
        errno = (EMSGSIZE);
        return (-1);
      } while (0);
    NS_GET16(handle->_counts[i], msg);
  }
  for (i = 0; i < ns_s_max; i++)
    if (handle->_counts[i] == 0)
      handle->_sections[i] = NULL;
    else {
      int b = ns_skiprr(msg, eom, (ns_sect)i, handle->_counts[i]);
      if (b < 0)
        return (-1);
      handle->_sections[i] = msg;
      msg += b;
    }
  if (msg != eom)
    do {
      errno = (EMSGSIZE);
      return (-1);
    } while (0);
  setsection(handle, ns_s_max);
  return (0);
}
```