user: Demonstrate the C code that generates the assembly output below:

```asm
<getLocalHostIp>:
  endbr64
  push   %r14
  push   %r13
  push   %r12
  push   %rbp
  push   %rbx
  sub    $0x470,%rsp
  mov    %rdi,%r12
  mov    %fs:0x28,%rax
  mov    %rax,0x468(%rsp)
  xor    %eax,%eax
  movq   $0x0,0x8(%rsp)
  lea    0x8(%rsp),%rdi
  call   <getifaddrs@plt>
  test   %rax,%rax
  jne    L80
  movq   $0x0,0x10(%rsp)
  movq   $0x0,0x18(%rsp)
  mov    0x8(%rsp),%rbx
  test   %rbx,%rbx
  je     L139
  mov    $0x0,%r13d
  mov    D1(%rip),%rbp
  jmp    L61
L46:
  mov    %r14,%rdi
  call   <ipAddressLevel@plt>
  cmp    %r13d,%eax
  jle    L28
  movdqu (%r14),%xmm1
  movaps %xmm1,0x10(%rsp)
  mov    %eax,%r13d
L28:
  mov    0x10(%rbx),%rbx
  test   %rbx,%rbx
  je     L139
L61:
  mov    0x8(%rbx),%rdi
  mov    0x0(%rbp),%rax
  cmp    %rax,(%rdi)
  jne    L28
  mov    (%rbx),%eax
  test   $0x1,%al
  je     L28
  test   $0x8,%al
  jne    L28
  lea    0x60(%rsp),%rdx
  sub    $0x8,%rsp
  push   $0x2
  mov    $0x0,%r9d
  mov    $0x0,%r8d
  mov    $0x401,%ecx
  mov    $0x10,%esi
  call   <getnameinfo@plt>
  mov    0x8(%rbx),%r14
  lea    0x30(%rsp),%rdx
  mov    $0x10,%ecx
  mov    %r14,%rsi
  mov    D1(%rip),%rax
  mov    (%rax),%rdi
  call   <inet_ntop@plt>
  add    $0x10,%rsp
  test   %rax,%rax
  je     L28
  lea    0x60(%rsp),%rsi
  lea    0x20(%rsp),%rdi
  call   <strcmp@plt>
  test   %rax,%rax
  setne  %sil
  movzbl %sil,%esi
  cmpq   $0x0,0x10(%rsp)
  jne    L46
  movdqu (%r14),%xmm0
  movaps %xmm0,0x10(%rsp)
  lea    0x10(%rsp),%rdi
  call   <ipAddressLevel@plt>
  mov    %eax,%r13d
  jmp    L28
L139:
  mov    0x8(%rsp),%rdi
  call   <freeifaddrs@plt>
  cmpq   $0x0,0x10(%rsp)
  je     L146
  lea    0x10(%rsp),%rsi
  mov    $0x10,%ecx
  mov    %r12,%rdx
  mov    D1(%rip),%rax
  mov    (%rax),%rdi
  call   <inet_ntop@plt>
  cmp    $0x1,%rax
  sbb    %eax,%eax
L17:
  mov    0x468(%rsp),%rdx
  sub    %fs:0x28,%rdx
  jne    L96
  add    $0x470,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  ret
L80:
  mov    $0xffffffff,%eax
  jmp    L17
L146:
  mov    $0xffffffff,%eax
  jmp    L17
L96:
  call   <__stack_chk_fail@plt>
```

assistant: ```c
int getLocalHostIp(char *ip) {
  struct ifaddrs *ifaddrs = NULL;
  if (getifaddrs(&ifaddrs)) {
    return -1;
  }
  struct in_addr res = {0};
  int res_level = 0, tmp_level = 0;
  char ipBuf[64];
  struct ifaddrs *ifa;
  for (ifa = ifaddrs; NULL != ifa; ifa = ifa->ifa_next) {
    char hostname[1025];
    if (ifa->ifa_addr->sa_family == AF_INET) {
      if (!(ifa->ifa_flags & 0x1)) {
        continue;
      }
      if (ifa->ifa_flags & 0x8) {
        continue;
      }
      getnameinfo(ifa->ifa_addr, sizeof(struct sockaddr_in), hostname, 1025, NULL, 0, 0x00000002);
      struct in_addr *addr = &((struct sockaddr_in *)ifa->ifa_addr)->sin_addr;
      if (NULL == inet_ntop(AF_INET, addr, ipBuf, 16)) {
        continue;
      }
      int offset = strcmp(ipBuf, hostname) == 0 ? 0 : 1;
      if (0 == res.s_addr) {
        res = *addr;
        res_level = ipAddressLevel(&res, offset);
      } else if (res_level < (tmp_level = ipAddressLevel(addr, offset))) {
        res = *addr;
        res_level = tmp_level;
      }
    }
  }
  freeifaddrs(ifaddrs);
  if (0 == res.s_addr) {
    return -1;
  } else {
    return NULL == inet_ntop(AF_INET, &res, ip, 16) ? -1 : 0;
  }
}
```