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

```asm
<receive_fd>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  push   %r15
  push   %r14
  push   %r12
  push   %rbx
  sub    $0xa0,%rsp
  mov    %edi,-0x94(%rbp)
  mov    %rsi,-0xa0(%rbp)
  mov    %rdx,-0xa8(%rbp)
  mov    %rcx,-0xb0(%rbp)
  mov    %fs:0x28,%rax
  mov    %rax,-0x28(%rbp)
  xor    %eax,%eax
  cmpq   $0x0,-0xa0(%rbp)
  je     L72
  mov    %rsp,%rax
  mov    %rax,%r12
  mov    $0x4,%edi
  call   <CMSG_SPACE@plt>
  mov    %eax,%ecx
  movslq %ecx,%rax
  sub    $0x1,%rax
  mov    %rax,-0x88(%rbp)
  movslq %ecx,%rax
  mov    %rax,-0xc0(%rbp)
  movq   $0x0,-0xb8(%rbp)
  movslq %ecx,%rax
  mov    %rax,%r14
  mov    $0x0,%r15d
  movslq %ecx,%rax
  mov    $0x10,%edx
  sub    $0x1,%rdx
  add    %rdx,%rax
  mov    $0x10,%ebx
  mov    $0x0,%edx
  div    %rbx
  imul   $0x10,%rax,%rax
  mov    %rax,%rsi
  and    $0xfffffffffffff000,%rsi
  mov    %rsp,%rdx
  sub    %rsi,%rdx
L80:
  cmp    %rdx,%rsp
  je     L37
  sub    $0x1000,%rsp
  orq    $0x0,0xff8(%rsp)
  jmp    L80
L37:
  mov    %rax,%rdx
  and    $0xfff,%edx
  sub    %rdx,%rsp
  mov    %rax,%rdx
  and    $0xfff,%edx
  test   %rdx,%rdx
  je     L92
  and    $0xfff,%eax
  sub    $0x8,%rax
  add    %rsp,%rax
  orq    $0x0,(%rax)
L92:
  mov    %rsp,%rax
  add    $0x0,%rax
  mov    %rax,-0x80(%rbp)
  mov    -0xa8(%rbp),%rax
  mov    %rax,-0x70(%rbp)
  mov    -0xb0(%rbp),%rax
  mov    %rax,-0x68(%rbp)
  movl   $0x1,-0x60(%rbp)
  mov    -0x80(%rbp),%rax
  mov    %rax,-0x58(%rbp)
  mov    %ecx,-0x50(%rbp)
  lea    -0x70(%rbp),%rax
  mov    %rax,-0x48(%rbp)
  movl   $0x0,-0x40(%rbp)
  movq   $0x0,-0x38(%rbp)
  lea    -0x60(%rbp),%rcx
  mov    -0x94(%rbp),%eax
  mov    $0x0,%edx
  mov    %rcx,%rsi
  mov    %eax,%edi
  call   <recvmsg@plt>
  mov    %rax,-0x90(%rbp)
  cmpq   $0x0,-0x90(%rbp)
  js     L38
  lea    -0x60(%rbp),%rax
  mov    %rax,%rdi
  call   <CMSG_FIRSTHDR@plt>
  mov    %rax,-0x78(%rbp)
  cmpq   $0x0,-0x78(%rbp)
  je     L47
  mov    -0x78(%rbp),%rax
  mov    (%rax),%rbx
  mov    $0x4,%edi
  call   <CMSG_LEN@plt>
  cmp    %rax,%rbx
  jne    L47
  mov    -0x78(%rbp),%rax
  mov    0x8(%rax),%rdx
  mov    D14(%rip),%rax
  mov    (%rax),%rax
  cmp    %rax,%rdx
  jne    L47
  mov    -0x78(%rbp),%rax
  mov    0x10(%rax),%rdx
  mov    D4(%rip),%rax
  mov    (%rax),%rax
  cmp    %rax,%rdx
  jne    L47
  mov    -0x78(%rbp),%rax
  mov    %rax,%rdi
  call   <CMSG_DATA@plt>
  mov    %eax,%ecx
  mov    -0xa0(%rbp),%rax
  mov    $0x4,%edx
  mov    %ecx,%esi
  mov    %rax,%rdi
  call   <memcpy@plt>
  mov    %r12,%rsp
  jmp    L3
L47:
  nop
L38:
  mov    %r12,%rsp
  mov    -0xa0(%rbp),%rax
  movl   $0xffffffff,(%rax)
  jmp    L15
L72:
  mov    -0xb0(%rbp),%rdx
  mov    -0xa8(%rbp),%rsi
  mov    -0x94(%rbp),%eax
  mov    $0x0,%ecx
  mov    %eax,%edi
  call   <recv@plt>
  mov    %rax,-0x90(%rbp)
L3:
  nop
L15:
  mov    -0x90(%rbp),%rax
  mov    -0x28(%rbp),%rdx
  sub    %fs:0x28,%rdx
  je     L108
  call   <__stack_chk_fail@plt>
L108:
  lea    -0x20(%rbp),%rsp
  pop    %rbx
  pop    %r12
  pop    %r14
  pop    %r15
  pop    %rbp
  ret
```

assistant: ```c
ssize_t receive_fd(int socket, int *fd, void *buffer, ssize_t buffer_size) {
  ssize_t size;
  if (fd) {
    char control[CMSG_SPACE(sizeof(int))];
    struct iovec iov = {.iov_base = buffer, .iov_len = buffer_size};
    struct msghdr message = {.msg_name = NULL, .msg_namelen = 0, .msg_iov = &iov, .msg_iovlen = 1, .msg_control = &control, .msg_controllen = sizeof control};
    struct cmsghdr *cmsg;
    size = recvmsg(socket, &message, 0);
    if (size < 0)
      goto nofd;
    cmsg = CMSG_FIRSTHDR(&message);
    if (!cmsg || cmsg->cmsg_len != CMSG_LEN(sizeof(int)) || cmsg->cmsg_level != SOL_SOCKET || cmsg->cmsg_type != SCM_RIGHTS) {
      goto nofd;
    }
    memcpy(fd, CMSG_DATA(cmsg), sizeof *fd);
  } else {
    size = recv(socket, buffer, buffer_size, 0);
  }
  goto done;
nofd:
  *fd = -1;
done:
  return size;
}
```