user: 请显示与下面列出的汇编代码相匹配的C语言实现:

```asm
<if_nameindex>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  sub    $0x60,%rsp
  mov    %fs:0x28,%rax
  mov    %rax,-0x8(%rbp)
  xor    %eax,%eax
  movq   $0x0,-0x50(%rbp)
  mov    D74(%rip),%rax
  mov    (%rax),%ecx
  mov    D88(%rip),%rax
  mov    (%rax),%eax
  mov    $0x0,%edx
  mov    %ecx,%esi
  mov    %eax,%edi
  call   <socket@plt>
  mov    %eax,-0x5c(%rbp)
  cmpl   $0x0,-0x5c(%rbp)
  jns    L0
  mov    D74(%rip),%rax
  mov    (%rax),%ecx
  mov    D65(%rip),%rax
  mov    (%rax),%eax
  mov    $0x0,%edx
  mov    %ecx,%esi
  mov    %eax,%edi
  call   <socket@plt>
  mov    %eax,-0x5c(%rbp)
L0:
  movq   $0x0,-0x10(%rbp)
  movl   $0x0,-0x30(%rbp)
  mov    D14(%rip),%rax
  mov    (%rax),%ecx
  lea    -0x30(%rbp),%rdx
  mov    -0x5c(%rbp),%eax
  mov    %ecx,%esi
  mov    %eax,%edi
  call   <ioctl@plt>
  test   %eax,%eax
  js     L32
  mov    -0x30(%rbp),%eax
  cltq
  mov    %rax,%rdi
  call   <alloca@plt>
  mov    %rax,-0x10(%rbp)
  mov    D14(%rip),%rax
  mov    (%rax),%ecx
  lea    -0x30(%rbp),%rdx
  mov    -0x5c(%rbp),%eax
  mov    %ecx,%esi
  mov    %eax,%edi
  call   <ioctl@plt>
  test   %eax,%eax
  js     L76
  mov    -0x30(%rbp),%eax
  cltq
  movabs $0xcccccccccccccccd,%rdx
  mul    %rdx
  mov    %rdx,%rax
  shr    $0x5,%rax
  mov    %eax,-0x54(%rbp)
  mov    -0x54(%rbp),%eax
  add    $0x1,%eax
  cltq
  shl    $0x4,%eax
  mov    %eax,%edx
  mov    D5(%rip),%rax
  mov    (%rax),%eax
  imul   -0x54(%rbp),%eax
  add    %edx,%eax
  mov    %eax,%edi
  call   <malloc@plt>
  mov    %rax,-0x50(%rbp)
  cmpq   $0x0,-0x50(%rbp)
  je     L31
  mov    -0x54(%rbp),%eax
  cltq
  add    $0x1,%rax
  shl    $0x4,%rax
  mov    %rax,%rdx
  mov    -0x50(%rbp),%rax
  add    %rdx,%rax
  mov    %rax,-0x40(%rbp)
  mov    -0x50(%rbp),%rax
  mov    %rax,-0x48(%rbp)
  movl   $0x0,-0x58(%rbp)
  jmp    L27
L53:
  mov    -0x18(%rbp),%rdx
  mov    -0x58(%rbp),%eax
  cltq
  shl    $0x2,%rax
  add    %rdx,%rax
  mov    %rax,-0x38(%rbp)
  mov    -0x48(%rbp),%rax
  mov    -0x40(%rbp),%rdx
  mov    %rdx,(%rax)
  mov    D5(%rip),%rax
  mov    (%rax),%edx
  mov    -0x38(%rbp),%rax
  mov    0x10(%rax),%ecx
  mov    -0x40(%rbp),%rax
  mov    %ecx,%esi
  mov    %rax,%rdi
  call   <memcpy@plt>
  mov    D97(%rip),%rax
  mov    (%rax),%ecx
  mov    -0x38(%rbp),%rdx
  mov    -0x5c(%rbp),%eax
  mov    %ecx,%esi
  mov    %eax,%edi
  call   <ioctl@plt>
  cmp    $0xffffffff,%eax
  je     L87
  mov    -0x38(%rbp),%rax
  mov    0x8(%rax),%rdx
  mov    -0x48(%rbp),%rax
  mov    %rdx,0x8(%rax)
  mov    D5(%rip),%rax
  mov    (%rax),%eax
  cltq
  add    %rax,-0x40(%rbp)
  addq   $0x10,-0x48(%rbp)
  jmp    L51
L87:
  nop
L51:
  addl   $0x1,-0x58(%rbp)
L27:
  mov    -0x58(%rbp),%eax
  cmp    -0x54(%rbp),%eax
  jl     L53
  mov    -0x48(%rbp),%rax
  movq   $0x0,(%rax)
  mov    -0x48(%rbp),%rax
  movq   $0x0,0x8(%rax)
  jmp    L81
L32:
  nop
  jmp    L81
L76:
  nop
  jmp    L81
L31:
  nop
L81:
  mov    -0x5c(%rbp),%eax
  mov    %eax,%edi
  call   <close@plt>
  mov    -0x50(%rbp),%rax
  mov    -0x8(%rbp),%rdx
  sub    %fs:0x28,%rdx
  je     L55
  call   <__stack_chk_fail@plt>
L55:
  leave
  ret
```

assistant: ```c
struct if_nameindex *if_nameindex(void) {
  struct ifconf ic;
  int fd, len, i;
  struct if_nameindex *x = 0, *y;
  char *dest;
  fd = socket(AF_INET6, SOCK_DGRAM, 0);
  if (fd < 0)
    fd = socket(AF_INET, SOCK_DGRAM, 0);
  ic.ifc_buf = 0;
  ic.ifc_len = 0;
  if (ioctl(fd, SIOCGIFCONF, &ic) < 0)
    goto b0rken;
  ic.ifc_buf = alloca((size_t)ic.ifc_len);
  if (ioctl(fd, SIOCGIFCONF, &ic) < 0)
    goto b0rken;
  len = (ic.ifc_len / sizeof(struct ifreq));
  x = (struct if_nameindex *)malloc((len + 1) * sizeof(struct if_nameindex) + len * IFNAMSIZ);
  if (!x)
    goto b0rken;
  dest = (char *)(x + len + 1);
  y = x;
  for (i = 0; i < len; ++i) {
    struct ifreq *ir = (struct ifreq *)&ic.ifc_req[i];
    y->if_name = dest;
    memcpy(dest, ir->ifr_name, IFNAMSIZ);
    if (ioctl(fd, SIOCGIFINDEX, ir) == -1)
      continue;
    y->if_index = ir->ifr_ifindex;
    dest += IFNAMSIZ;
    ++y;
  }
  y->if_name = 0;
  y->if_index = 0;
b0rken:
  close(fd);
  return x;
}
```