// File: /workspace/github_c_makefile_star2_O2/barabo[P]advanced-shell-history/src/unix.cpp
// Function: ash::unix::host_ip[abi:cxx11]()
const string unix::host_ip() {
  struct ifaddrs * addrs;
  if (getifaddrs(&addrs)) {
    LOG(INFO) << "No network addresses detected.";
    return "null";
  }

  Config & config = Config::instance();
  bool skip_lo = config.sets("SKIP_LOOPBACK");

  int ips = 0;
  stringstream ss;
  char buffer[256];
  for (struct ifaddrs * i = addrs; i; i = i -> ifa_next) {
    struct sockaddr * address = i -> ifa_addr;
    if (address == NULL) {
      LOG(WARNING) << "Skipped a null network address.";
      continue;
    }
    if (skip_lo && i -> ifa_name && string("lo") == i -> ifa_name) {
      LOG(DEBUG) << "Skipped a loopback address, as configured.";
      continue;
    }

    sa_family_t family = address -> sa_family;
    switch (family) {
      case AF_INET: {
        if (config.sets("LOG_IPV4")) {
          struct sockaddr_in * a = (struct sockaddr_in *) address;
          inet_ntop(family, &(a -> sin_addr), buffer, sizeof(buffer));
        } else {
          LOG(DEBUG) << "Skipped an IPv4 address for: " << i -> ifa_name;
        }
        break;
      }
      case AF_INET6: {
        if (config.sets("LOG_IPV6")) {
          struct sockaddr_in6 * a = (struct sockaddr_in6 *) address;
          inet_ntop(family, &(a -> sin6_addr), buffer, sizeof(buffer));
        } else {
          LOG(DEBUG) << "Skipped an IPv6 address for: " << i -> ifa_name;
        }
        break;
      }
      default:
        continue;
    }
    if (++ips > 1) ss << " ";
    ss << buffer;
  }
  freeifaddrs(addrs);
  if (ips == 0) return "null";
  return DBObject::quote(ss.str());
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x5c8, %rsp            # imm = 0x5C8
movq %rdi, %rbx
leaq 0x18(%rsp), %r14
movq %r14, %rdi
callq 0x8770
testl %eax, %eax
je 0x66111
leaq 0x20(%rsp), %rdi
pushq $0x1
popq %rsi
callq 0x62c92
leaq 0x28(%rsp), %rdi
leaq 0xb732(%rip), %rsi      # 0x7181b
callq 0x83a0
leaq 0x20(%rsp), %rdi
callq 0x62fc8
leaq 0xa162(%rip), %rsi      # 0x70261
leaq 0x20(%rsp), %rdx
movq %rbx, %rdi
callq 0x8150
jmp 0x663a7
callq 0x5d6d2
movq %rax, %r15
leaq 0xb71a(%rip), %rsi      # 0x7183a
leaq 0x20(%rsp), %rdi
leaq 0x338(%rsp), %rdx
callq 0x8150
leaq 0x20(%rsp), %rsi
movq %r15, %rdi
xorl %edx, %edx
callq 0x5d5c8
movl %eax, %ebp
leaq 0x20(%rsp), %rdi
callq 0x84b0
movq %r15, 0x8(%rsp)
movq %rbx, 0x10(%rsp)
leaq 0x338(%rsp), %rdi
callq 0x8260
xorl %r15d, %r15d
leaq 0x20(%rsp), %r12
movq (%r14), %r14
testq %r14, %r14
je 0x66342
movq 0x18(%r14), %r13
testq %r13, %r13
je 0x66234
testb %bpl, %bpl
je 0x661e4
cmpq $0x0, 0x8(%r14)
je 0x661e4
movq %r12, %rdi
leaq 0xb6cd(%rip), %rsi      # 0x71868
leaq 0x7(%rsp), %rdx
callq 0x8150
movq 0x8(%r14), %rsi
movq %r12, %rdi
callq 0x5c510
movl %eax, %ebx
movq %r12, %rdi
callq 0x84b0
testb %bl, %bl
je 0x661e4
movq %r12, %rdi
xorl %esi, %esi
callq 0x62c92
leaq 0x28(%rsp), %rdi
leaq 0xb696(%rip), %rsi      # 0x7186b
callq 0x83a0
movq %r12, %rdi
callq 0x62fc8
jmp 0x6616c
movzwl (%r13), %eax
cmpl $0xa, %eax
je 0x6625d
cmpl $0x2, %eax
jne 0x6616c
movq %r12, %rdi
leaq 0xb695(%rip), %rsi      # 0x71896
leaq 0x7(%rsp), %rdx
callq 0x8150
movq 0x8(%rsp), %rdi
movq %r12, %rsi
xorl %edx, %edx
callq 0x5d5c8
movl %eax, %ebx
movq %r12, %rdi
callq 0x84b0
testb %bl, %bl
je 0x662ac
addq $0x4, %r13
pushq $0x2
jmp 0x66294
movq %r12, %rdi
pushq $0x2
popq %rsi
callq 0x62c92
leaq 0x28(%rsp), %rdi
leaq 0xb5fd(%rip), %rsi      # 0x71848
callq 0x83a0
movq %r12, %rdi
callq 0x62fc8
jmp 0x6616c
movq %r12, %rdi
leaq 0xb656(%rip), %rsi      # 0x718bd
leaq 0x7(%rsp), %rdx
callq 0x8150
movq 0x8(%rsp), %rdi
movq %r12, %rsi
xorl %edx, %edx
callq 0x5d5c8
movl %eax, %ebx
movq %r12, %rdi
callq 0x84b0
testb %bl, %bl
je 0x662dd
addq $0x8, %r13
pushq $0xa
popq %rdi
movq %r13, %rsi
leaq 0x4c0(%rsp), %rdx
movl $0x100, %ecx            # imm = 0x100
callq 0x8410
jmp 0x6630c
movq %r12, %rdi
xorl %esi, %esi
callq 0x62c92
leaq 0x28(%rsp), %rdi
leaq 0xb5dd(%rip), %rsi      # 0x7189f
callq 0x83a0
movq 0x8(%r14), %rsi
movq %rax, %rdi
callq 0x83a0
movq %r12, %rdi
callq 0x62fc8
jmp 0x6630c
movq %r12, %rdi
xorl %esi, %esi
callq 0x62c92
leaq 0x28(%rsp), %rdi
leaq 0xb5d3(%rip), %rsi      # 0x718c6
callq 0x83a0
movq 0x8(%r14), %rsi
movq %rax, %rdi
callq 0x83a0
movq %r12, %rdi
callq 0x62fc8
testl %r15d, %r15d
je 0x66325
leaq 0x348(%rsp), %rdi
leaq 0x7052(%rip), %rsi      # 0x6d372
callq 0x83a0
incl %r15d
leaq 0x348(%rsp), %rdi
leaq 0x4c0(%rsp), %rsi
callq 0x83a0
jmp 0x6616c
movq 0x18(%rsp), %rdi
callq 0x86e0
testl %r15d, %r15d
je 0x66381
leaq 0x350(%rsp), %rsi
leaq 0x20(%rsp), %rdi
callq 0x8610
movq 0x10(%rsp), %rbx
leaq 0x20(%rsp), %rsi
movq %rbx, %rdi
callq 0x5dd76
leaq 0x20(%rsp), %rdi
callq 0x84b0
jmp 0x6639a
leaq 0x9ed9(%rip), %rsi      # 0x70261
leaq 0x20(%rsp), %rdx
movq 0x10(%rsp), %rbx
movq %rbx, %rdi
callq 0x8150
leaq 0x338(%rsp), %rdi
callq 0x87e8
movq %rbx, %rax
addq $0x5c8, %rsp            # imm = 0x5C8
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0x66478
jmp 0x66478
movq %rax, %rbx
leaq 0x20(%rsp), %rdi
callq 0x62fc8
jmp 0x6647b
movq %rax, %rbx
leaq 0x20(%rsp), %rdi
callq 0x84b0
jmp 0x6647b
jmp 0x66478
movq %rax, %rbx
leaq 0x20(%rsp), %rdi
callq 0x62fc8
jmp 0x6647b
movq %rax, %rbx
leaq 0x20(%rsp), %rdi
callq 0x84b0
jmp 0x6647b
movq %rax, %rbx
leaq 0x20(%rsp), %rdi
callq 0x84b0
jmp 0x6647b
jmp 0x66478
jmp 0x66478
movq %rax, %rbx
leaq 0x20(%rsp), %rdi
callq 0x84b0
jmp 0x66488
jmp 0x66478
jmp 0x66478
movq %rax, %rbx
leaq 0x20(%rsp), %rdi
callq 0x62fc8
jmp 0x66488
movq %rax, %rbx
jmp 0x66488
movq %rax, %rbx
leaq 0x20(%rsp), %rdi
callq 0x62fc8
jmp 0x6647b
jmp 0x66478
movq %rax, %rbx
leaq 0x20(%rsp), %rdi
callq 0x84b0
jmp 0x6647b
movq %rax, %rbx
leaq 0x20(%rsp), %rdi
callq 0x62fc8
jmp 0x6647b
jmp 0x66478
movq %rax, %rbx
leaq 0x338(%rsp), %rdi
callq 0x87e8
movq %rbx, %rdi
callq 0x86f0
movq %rax, %rdi
callq 0x5c505