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

```asm
<send_arping>:
  endbr64
  push   %r12
  push   %rbp
  mov    %rsi,%rbp
  sub    $0xff8,%rsp
  mov    %fs:0x28,%rax
  mov    %rax,0xfe8(%rsp)
  xor    %eax,%eax
  mov    D35(%rip),%rax
  movl   $0x1,0x4(%rsp)
  mov    (%rax),%esi
  mov    D44(%rip),%rax
  mov    (%rax),%edi
  mov    %esi,%edx
  call   <socket@plt>
  xor    %eax,%eax
  call   <getuid@plt>
  mov    %eax,%edi
  call   <setuid@plt>
  mov    %rax,%r8
  mov    $0xf,%eax
  test   %r8,%r8
  jne    L28
  lea    0x40(%rsp),%r12
  mov    $0x6,%edx
  lea    0x18(%rsp),%rsi
  movabs $0xffffffffffff,%rax
  mov    %rax,0x18(%rsp)
  mov    %r12,%rdi
  xor    %eax,%eax
  call   <memcpy@plt>
  mov    0x38(%rsp),%edi
  mov    %rbp,%rsi
  call   <strcpy@plt>
  mov    D14(%rip),%rax
  lea    0x30(%rsp),%rdx
  xor    %edi,%edi
  mov    (%rax),%esi
  call   <ioctl@plt>
  mov    %rax,%r8
  mov    $0x10,%eax
  test   %r8,%r8
  js     L28
  mov    0x30(%rsp),%rsi
  lea    0x58(%rsp),%rdi
  mov    $0x6,%edx
  xor    %eax,%eax
  call   <memcpy@plt>
  lea    0x8(%rsp),%rsi
  lea    0x70(%rsp),%rdi
  xor    %eax,%eax
  mov    $0x2,%edx
  movl   $0x806,0x8(%rsp)
  call   <memcpy@plt>
  lea    0xc(%rsp),%rsi
  lea    0x78(%rsp),%rdi
  xor    %eax,%eax
  mov    $0x2,%edx
  movl   $0x1,0xc(%rsp)
  movl   $0x800,0x10(%rsp)
  movl   $0x1,0x14(%rsp)
  call   <memcpy@plt>
  lea    0x10(%rsp),%rsi
  mov    $0x2,%edx
  xor    %eax,%eax
  lea    0x80(%rsp),%rdi
  call   <memcpy@plt>
  lea    0x14(%rsp),%rsi
  mov    $0x2,%edx
  movabs $0x400000006,%rax
  mov    %rax,0x88(%rsp)
  lea    0x90(%rsp),%rdi
  xor    %eax,%eax
  call   <memcpy@plt>
  mov    0x30(%rsp),%rsi
  mov    $0x6,%edx
  xor    %eax,%eax
  lea    0x98(%rsp),%rdi
  call   <memcpy@plt>
  mov    D26(%rip),%rax
  mov    $0x4,%r8d
  xor    %edi,%edi
  lea    0x4(%rsp),%rcx
  mov    (%rax),%edx
  mov    D2(%rip),%rax
  mov    (%rax),%esi
  call   <setsockopt@plt>
  mov    %rax,%r8
  mov    $0x11,%eax
  test   %r8,%r8
  js     L28
  movq   $0x0,0x28(%rsp)
  mov    0x20(%rsp),%edi
  mov    %rbp,%rsi
  call   <strcpy@plt>
  lea    0x20(%rsp),%r8
  xor    %ecx,%ecx
  mov    %r12,%rsi
  mov    $0x10,%r9d
  mov    $0x1c,%edx
  xor    %edi,%edi
  call   <sendto@plt>
  mov    %eax,%r8d
  mov    $0x12,%eax
  test   %r8d,%r8d
  js     L28
  xor    %edi,%edi
  call   <close@plt>
  xor    %eax,%eax
L28:
  mov    0xfe8(%rsp),%rdx
  sub    %fs:0x28,%rdx
  jne    L15
  add    $0xff8,%rsp
  pop    %rbp
  pop    %r12
  ret
L15:
  call   <__stack_chk_fail@plt>
```

assistant: ```c
int send_arping(const struct cfgData *data, char *ifname) {
  u_char outpack[1000];
  struct sockaddr whereto;
  int sd;
  int one = 1;
  int offset = 0;
  if ((sd == socket(AF_INET, SOCK_PACKET, SOCK_PACKET)) < 0) {
    if (errno == EPERM)
      return 14;
    return 10;
  }
  if (setuid(getuid()) != 0) {
    return 15;
  }
  struct ifreq if_hwaddr;
  unsigned long destaddr = 0xFFFFFFFFFFFF;
  memcpy(outpack, &destaddr, 6);
  offset += 6;
  strcpy(if_hwaddr.ifr_name, ifname);
  if (ioctl(sd, SIOCGIFHWADDR, &if_hwaddr) < 0) {
    return 16;
  }
  memcpy(outpack + offset, if_hwaddr.ifr_hwaddr.sa_data, 6);
  offset += 6;
  unsigned int protocol = 0x0806;
  memcpy(outpack + offset, &protocol, 2);
  offset += 2;
  unsigned int hwtype = 0x0001;
  unsigned int protype = 0x0800;
  unsigned int opcode = 0x0001;
  memcpy(outpack + offset, &hwtype, 2);
  offset += 2;
  memcpy(outpack + offset, &protype, 2);
  offset += 2;
  outpack[offset] = 0x06;
  outpack[offset + 1] = 0x04;
  offset += 2;
  memcpy(outpack + offset, &opcode, 2);
  offset += 2;
  memcpy(outpack + offset, if_hwaddr.ifr_hwaddr.sa_data, 6);
  if (setsockopt(sd, SOL_SOCKET, SO_BROADCAST, (char *)&one, sizeof(one)) < 0)
    return 17;
  offset += 6;
  whereto.sa_family = 0;
  strcpy(whereto.sa_data, ifname);
  int i;
  if ((i = sendto(sd, outpack, offset, 0, &whereto, sizeof(whereto))) < 0)
    return 18;
  else
    ;
  close(sd);
  return 0;
}
```