// File: /workspace/github_c_makefile_star2_O3/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 0x10(%rsp), %rdi
callq 0x87a0
testl %eax, %eax
je 0x739eb
leaq 0x20(%rsp), %rdi
movl $0x1, %esi
callq 0x6fef2
leaq 0x28(%rsp), %rdi
leaq 0xbeac(%rip), %rsi      # 0x7f861
movl $0x1e, %edx
callq 0x8470
leaq 0x20(%rsp), %rdi
callq 0x70392
leaq 0x10(%rbx), %rax
movq %rax, (%rbx)
leaq 0xa90e(%rip), %rsi      # 0x7e2e5
leaq 0xa90b(%rip), %rdx      # 0x7e2e9
movq %rbx, %rdi
callq 0x68bce
jmp 0x73dab
callq 0x69cd0
movq %rax, %r14
leaq 0x30(%rsp), %rax
movq %rax, -0x10(%rax)
leaq 0xbe7d(%rip), %rsi      # 0x7f880
leaq 0xbe83(%rip), %rdx      # 0x7f88d
leaq 0x20(%rsp), %rdi
callq 0x68bce
leaq 0x20(%rsp), %rsi
movq %r14, %rdi
xorl %edx, %edx
callq 0x69b74
movl %eax, %ebp
movq 0x20(%rsp), %rdi
leaq 0x30(%rsp), %rax
cmpq %rax, %rdi
je 0x73a39
callq 0x8390
leaq 0x338(%rsp), %rdi
callq 0x8290
movq 0x10(%rsp), %r15
testq %r15, %r15
je 0x73d7a
movq %r14, 0x8(%rsp)
movq %rbx, 0x18(%rsp)
xorl %ebx, %ebx
leaq 0x20(%rsp), %r13
movq 0x18(%r15), %r12
testq %r12, %r12
je 0x73b3e
testb %bpl, %bpl
je 0x73aca
cmpq $0x0, 0x8(%r15)
je 0x73aca
leaq 0x30(%rsp), %rax
movq %rax, 0x20(%rsp)
movq %r13, %rdi
leaq 0xbe1c(%rip), %rsi      # 0x7f8ae
leaq 0xbe17(%rip), %rdx      # 0x7f8b0
callq 0x68bce
movq 0x8(%r15), %rsi
movq %r13, %rdi
callq 0x80f0
movl %eax, %r14d
movq 0x20(%rsp), %rdi
leaq 0x30(%rsp), %rax
cmpq %rax, %rdi
je 0x73ac1
callq 0x8390
testl %r14d, %r14d
je 0x73c69
movzwl (%r12), %eax
cmpl $0xa, %eax
je 0x73b6e
cmpl $0x2, %eax
jne 0x73d26
leaq 0x30(%rsp), %rax
movq %rax, 0x20(%rsp)
movq %r13, %rdi
leaq 0xbde7(%rip), %rsi      # 0x7f8dc
leaq 0xbde8(%rip), %rdx      # 0x7f8e4
callq 0x68bce
movq 0x8(%rsp), %rdi
movq %r13, %rsi
xorl %edx, %edx
callq 0x69b74
movl %eax, %r14d
movq 0x20(%rsp), %rdi
leaq 0x30(%rsp), %rax
cmpq %rax, %rdi
je 0x73b27
callq 0x8390
testb %r14b, %r14b
je 0x73bdc
addq $0x4, %r12
movl $0x2, %edi
jmp 0x73bc2
movq %r13, %rdi
movl $0x2, %esi
callq 0x6fef2
movl $0x1f, %edx
leaq 0x28(%rsp), %rdi
leaq 0xbd32(%rip), %rsi      # 0x7f88e
callq 0x8470
movq %r13, %rdi
callq 0x70392
jmp 0x73d26
leaq 0x30(%rsp), %rax
movq %rax, 0x20(%rsp)
movq %r13, %rdi
leaq 0xbd81(%rip), %rsi      # 0x7f903
leaq 0xbd82(%rip), %rdx      # 0x7f90b
callq 0x68bce
movq 0x8(%rsp), %rdi
movq %r13, %rsi
xorl %edx, %edx
callq 0x69b74
movl %eax, %r14d
movq 0x20(%rsp), %rdi
leaq 0x30(%rsp), %rax
cmpq %rax, %rdi
je 0x73bb4
callq 0x8390
testb %r14b, %r14b
je 0x73c26
addq $0x8, %r12
movl $0xa, %edi
movq %r12, %rsi
leaq 0x4c0(%rsp), %rdx
movl $0x100, %ecx            # imm = 0x100
callq 0x8440
jmp 0x73ce4
movq %r13, %rdi
xorl %esi, %esi
callq 0x6fef2
movl $0x1d, %edx
leaq 0x28(%rsp), %rdi
leaq 0xbcee(%rip), %rsi      # 0x7f8e5
callq 0x8470
movq 0x8(%r15), %r14
testq %r14, %r14
je 0x73c96
movq %r14, %rdi
callq 0x8190
leaq 0x28(%rsp), %rdi
movq %r14, %rsi
movq %rax, %rdx
callq 0x8470
jmp 0x73cb4
movq %r13, %rdi
xorl %esi, %esi
callq 0x6fef2
movl $0x1d, %edx
leaq 0x28(%rsp), %rdi
leaq 0xbccb(%rip), %rsi      # 0x7f90c
callq 0x8470
movq 0x8(%r15), %r14
testq %r14, %r14
je 0x73cbe
movq %r14, %rdi
callq 0x8190
leaq 0x28(%rsp), %rdi
movq %r14, %rsi
movq %rax, %rdx
callq 0x8470
jmp 0x73cdc
movq %r13, %rdi
xorl %esi, %esi
callq 0x6fef2
movl $0x2a, %edx
leaq 0x28(%rsp), %rdi
leaq 0xbc2d(%rip), %rsi      # 0x7f8b1
callq 0x8470
movq %r13, %rdi
callq 0x70392
jmp 0x73d26
movq 0x28(%rsp), %rax
movq -0x18(%rax), %rax
leaq 0x28(%rsp), %rcx
leaq (%rcx,%rax), %rdi
movl 0x48(%rsp,%rax), %esi
orl $0x1, %esi
callq 0x86b0
movq %r13, %rdi
callq 0x70392
jmp 0x73ce4
movq 0x28(%rsp), %rax
movq -0x18(%rax), %rax
leaq 0x28(%rsp), %rcx
leaq (%rcx,%rax), %rdi
movl 0x48(%rsp,%rax), %esi
orl $0x1, %esi
callq 0x86b0
movq %r13, %rdi
callq 0x70392
testl %ebx, %ebx
jle 0x73d01
movl $0x1, %edx
leaq 0x348(%rsp), %rdi
leaq 0x7656(%rip), %rsi      # 0x7b352
callq 0x8470
leaq 0x4c0(%rsp), %r14
movq %r14, %rdi
callq 0x8190
leaq 0x348(%rsp), %rdi
movq %r14, %rsi
movq %rax, %rdx
callq 0x8470
incl %ebx
movq (%r15), %r15
testq %r15, %r15
jne 0x73a65
movq 0x10(%rsp), %rdi
callq 0x8710
testl %ebx, %ebx
movq 0x18(%rsp), %rbx
je 0x73d81
leaq 0x350(%rsp), %rsi
leaq 0x20(%rsp), %rdi
callq 0x8630
leaq 0x20(%rsp), %rsi
movq %rbx, %rdi
callq 0x6a49a
movq 0x20(%rsp), %rdi
leaq 0x30(%rsp), %rax
cmpq %rax, %rdi
je 0x73d9e
callq 0x8390
jmp 0x73d9e
xorl %edi, %edi
callq 0x8710
leaq 0x10(%rbx), %rax
movq %rax, (%rbx)
leaq 0xa556(%rip), %rsi      # 0x7e2e5
leaq 0xa553(%rip), %rdx      # 0x7e2e9
movq %rbx, %rdi
callq 0x68bce
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 0x73e3e
jmp 0x73e6a
jmp 0x73e6a
movq %rax, %r14
movq 0x20(%rsp), %rdi
leaq 0x30(%rsp), %rax
cmpq %rax, %rdi
je 0x73e7a
callq 0x8390
jmp 0x73e7a
movq %rax, %r14
jmp 0x73e7a
movq %rax, %r14
leaq 0x20(%rsp), %rdi
callq 0x70392
jmp 0x73e6d
movq %rax, %r14
leaq 0x20(%rsp), %rdi
callq 0x70392
jmp 0x73e7a
jmp 0x73e6a
jmp 0x73e6a
movq %rax, %r14
leaq 0x20(%rsp), %rdi
callq 0x70392
jmp 0x73e6d
jmp 0x73e3e
jmp 0x73e6a
jmp 0x73e6a
movq %rax, %r14
leaq 0x20(%rsp), %rdi
callq 0x70392
jmp 0x73e6d
jmp 0x73e3e
jmp 0x73e6a
movq %rax, %r14
movq 0x20(%rsp), %rdi
leaq 0x30(%rsp), %rax
cmpq %rax, %rdi
je 0x73e6d
callq 0x8390
jmp 0x73e6d
jmp 0x73e6a
movq %rax, %r14
leaq 0x20(%rsp), %rdi
callq 0x70392
jmp 0x73e6d
jmp 0x73e6a
movq %rax, %r14
leaq 0x338(%rsp), %rdi
callq 0x87e8
movq %r14, %rdi
callq 0x8720
movq %rax, %rdi
callq 0x68a31