user: 这段汇编代码用C语言表示是什么样的:

```asm
<get_ip_from_ifname>:
  endbr64
  push   %r12
  pxor   %xmm0,%xmm0
  mov    %edi,%r12d
  push   %rbp
  push   %rbx
  mov    %rsi,%rbx
  sub    $0x60,%rsp
  mov    %fs:0x28,%rax
  mov    %rax,0x58(%rsp)
  xor    %eax,%eax
  lea    0x8(%rsp),%rdi
  movaps %xmm0,0x10(%rsp)
  movaps %xmm0,0x20(%rsp)
  movaps %xmm0,0x30(%rsp)
  movaps %xmm0,0x40(%rsp)
  call   <getifaddrs@plt>
  test   %rax,%rax
  jne    L121
  lea    -0x80(%r12),%eax
  cmp    $0x1,%eax
  ja     L121
  mov    0x8(%rsp),%rbp
  test   %rbp,%rbp
  jne    L51
  jmp    L119
  nopw   0x0(%rax,%rax,1)
L177:
  cmpl   $0x80,(%rsi)
  je     L76
  nopl   0x0(%rax)
L22:
  mov    0x18(%rbp),%rbp
  test   %rbp,%rbp
  je     L174
L51:
  cmpq   $0x0,0x8(%rbp)
  je     L22
  mov    D0(%rip),%rdx
  mov    0x0(%rbp),%eax
  and    (%rdx),%eax
  je     L22
  mov    0x10(%rbp),%esi
  mov    %rbx,%rdi
  call   <strcmp@plt>
  test   %rax,%rax
  jne    L22
  mov    0x8(%rbp),%rsi
  cmp    $0x81,%r12d
  jne    L177
  cmpl   $0x81,(%rsi)
  jne    L22
  lea    0x10(%rsp),%rbp
  mov    $0x40,%ecx
  mov    $0x81,%edi
  mov    %rbp,%rdx
  call   <inet_ntop@plt>
  mov    %rax,%r12
  test   %rax,%rax
  je     L170
L95:
  mov    %rbp,%rdi
  call   <strdup@plt>
  mov    0x8(%rsp),%rdi
  mov    %rax,%r12
  call   <freeifaddrs@plt>
  test   %r12,%r12
  je     L121
  cmpb   $0x0,(%r12)
  jne    L155
  mov    %r12,%rdi
  xor    %r12d,%r12d
  call   <free@plt>
  jmp    L155
  nopl   0x0(%rax,%rax,1)
L174:
  mov    0x8(%rsp),%rbp
L119:
  mov    %rbp,%rdi
  call   <freeifaddrs@plt>
  nopl   (%rax)
L121:
  xor    %r12d,%r12d
L155:
  mov    0x58(%rsp),%rax
  sub    %fs:0x28,%rax
  jne    L106
  add    $0x60,%rsp
  mov    %r12,%rax
  pop    %rbx
  pop    %rbp
  pop    %r12
  ret
L76:
  lea    0x10(%rsp),%rbp
  mov    $0x40,%ecx
  mov    $0x80,%edi
  mov    %rbp,%rdx
  call   <inet_ntop@plt>
  mov    %rax,%r12
  test   %rax,%rax
  jne    L95
L170:
  mov    0x8(%rsp),%rdi
  call   <freeifaddrs@plt>
  jmp    L155
L106:
  call   <__stack_chk_fail@plt>
```

assistant: ```c
char *get_ip_from_ifname(const int inet_family, const char *const ifname) {
  char *retv = NULL;
  struct ifaddrs *myaddrs;
  struct ifaddrs *ifa;
  struct sockaddr_in *s4;
  struct sockaddr_in6 *s6;
  char buf[64] = {'\0'};
  if (getifaddrs(&myaddrs))
    return NULL;
  switch (inet_family) {
  case AF_INET:
  case AF_INET6:
    break;
  default:
    return NULL;
  }
  for (ifa = myaddrs; ifa != NULL; ifa = ifa->ifa_next) {
    if (NULL == ifa->ifa_addr)
      continue;
    if (0 == (ifa->ifa_flags & IFF_UP))
      continue;
    if (strcmp(ifname, ifa->ifa_name))
      continue;
    if (AF_INET == inet_family) {
      if (ifa->ifa_addr->sa_family == AF_INET) {
        s4 = (struct sockaddr_in *)(ifa->ifa_addr);
        if (inet_ntop(ifa->ifa_addr->sa_family, (void *)&(s4->sin_addr), buf, sizeof(buf)) == NULL) {
          break;
        } else {
          retv = strdup(buf);
          break;
        }
      }
    }
    if (AF_INET6 == inet_family) {
      if (ifa->ifa_addr->sa_family == AF_INET6) {
        s6 = (struct sockaddr_in6 *)(ifa->ifa_addr);
        if (inet_ntop(ifa->ifa_addr->sa_family, (void *)&(s6->sin6_addr), buf, sizeof(buf)) == NULL) {
          break;
        } else {
          retv = strdup(buf);
          break;
        }
      }
    }
  }
  freeifaddrs(myaddrs);
  if (retv && ('\0' == retv[0])) {
    free(retv);
    retv = NULL;
  }
  return retv;
}
```