// File: /workspace/github_c_makefile_star2_O1/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 $0x5e8, %rsp            # imm = 0x5E8
movq %rdi, %rbx
leaq 0x8(%rsp), %rdi
callq 0x87a0
testl %eax, %eax
je 0x73d59
leaq 0x40(%rsp), %rdi
movl $0x1, %esi
callq 0x70186
leaq 0x48(%rsp), %rdi
leaq 0xbaee(%rip), %rsi      # 0x7f811
movl $0x1e, %edx
callq 0x8470
leaq 0x40(%rsp), %rdi
callq 0x70626
leaq 0x10(%rbx), %rax
movq %rax, (%rbx)
leaq 0xa550(%rip), %rsi      # 0x7e295
leaq 0xa54d(%rip), %rdx      # 0x7e299
movq %rbx, %rdi
callq 0x68de4
jmp 0x74133
callq 0x69ef2
movq %rax, %r14
leaq 0x50(%rsp), %rax
movq %rax, -0x10(%rax)
leaq 0xbabf(%rip), %rsi      # 0x7f830
leaq 0xbac5(%rip), %rdx      # 0x7f83d
leaq 0x40(%rsp), %rdi
callq 0x68de4
leaq 0x40(%rsp), %rsi
movq %r14, %rdi
xorl %edx, %edx
callq 0x69d80
movb %al, 0x7(%rsp)
movq 0x40(%rsp), %rdi
leaq 0x50(%rsp), %rax
cmpq %rax, %rdi
je 0x73da9
callq 0x8390
leaq 0x358(%rsp), %rdi
callq 0x8290
movq 0x8(%rsp), %r12
testq %r12, %r12
je 0x740ff
movq %r14, 0x10(%rsp)
movq %rbx, 0x38(%rsp)
xorl %ebx, %ebx
leaq 0x40(%rsp), %r13
leaq 0x18(%rsp), %rbp
movq 0x18(%r12), %r15
testq %r15, %r15
je 0x73e87
cmpb $0x0, 0x7(%rsp)
je 0x73e2f
cmpq $0x0, 0x8(%r12)
je 0x73e2f
leaq 0x28(%rsp), %rax
movq %rax, 0x18(%rsp)
movq %rbp, %rdi
leaq 0xba53(%rip), %rsi      # 0x7f85e
leaq 0xba4e(%rip), %rdx      # 0x7f860
callq 0x68de4
movq 0x8(%r12), %rsi
movq %rbp, %rdi
callq 0x80f0
testl %eax, %eax
sete %bpl
movb $0x1, %r14b
jmp 0x73e34
xorl %r14d, %r14d
xorl %ebp, %ebp
testb %r14b, %r14b
je 0x73e50
movq 0x18(%rsp), %rdi
leaq 0x28(%rsp), %rax
cmpq %rax, %rdi
je 0x73e4d
callq 0x8390
testb %r14b, %r14b
testb %bpl, %bpl
je 0x73eb7
movq %r13, %rdi
xorl %esi, %esi
callq 0x70186
leaq 0x18(%rsp), %rbp
movl $0x2a, %edx
leaq 0x48(%rsp), %rdi
leaq 0xb9ec(%rip), %rsi      # 0x7f861
callq 0x8470
movq %r13, %rdi
callq 0x70626
jmp 0x740aa
movq %r13, %rdi
movl $0x2, %esi
callq 0x70186
movl $0x1f, %edx
leaq 0x48(%rsp), %rdi
leaq 0xb999(%rip), %rsi      # 0x7f83e
callq 0x8470
movq %r13, %rdi
callq 0x70626
jmp 0x740aa
movzwl (%r15), %eax
cmpl $0xa, %eax
leaq 0x18(%rsp), %rbp
je 0x73f24
cmpl $0x2, %eax
jne 0x740aa
leaq 0x50(%rsp), %rax
movq %rax, 0x40(%rsp)
movq %r13, %rdi
leaq 0xb9aa(%rip), %rsi      # 0x7f88c
leaq 0xb9ab(%rip), %rdx      # 0x7f894
callq 0x68de4
movq 0x10(%rsp), %rdi
movq %r13, %rsi
xorl %edx, %edx
callq 0x69d80
movl %eax, %r14d
movq 0x40(%rsp), %rdi
leaq 0x50(%rsp), %rax
cmpq %rax, %rdi
je 0x73f14
callq 0x8390
testb %r14b, %r14b
je 0x73f92
addq $0x4, %r15
movl $0x2, %edi
jmp 0x73f78
leaq 0x50(%rsp), %rax
movq %rax, 0x40(%rsp)
movq %r13, %rdi
leaq 0xb97b(%rip), %rsi      # 0x7f8b3
leaq 0xb97c(%rip), %rdx      # 0x7f8bb
callq 0x68de4
movq 0x10(%rsp), %rdi
movq %r13, %rsi
xorl %edx, %edx
callq 0x69d80
movl %eax, %r14d
movq 0x40(%rsp), %rdi
leaq 0x50(%rsp), %rax
cmpq %rax, %rdi
je 0x73f6a
callq 0x8390
testb %r14b, %r14b
je 0x73fd6
addq $0x8, %r15
movl $0xa, %edi
movq %r15, %rsi
leaq 0x4e0(%rsp), %rdx
movl $0x100, %ecx            # imm = 0x100
callq 0x8440
jmp 0x74068
movq %r13, %rdi
xorl %esi, %esi
callq 0x70186
movl $0x1d, %edx
leaq 0x48(%rsp), %rdi
leaq 0xb8e8(%rip), %rsi      # 0x7f895
callq 0x8470
movq 0x8(%r12), %r14
testq %r14, %r14
je 0x7401a
movq %r14, %rdi
callq 0x8190
leaq 0x48(%rsp), %rdi
movq %r14, %rsi
movq %rax, %rdx
callq 0x8470
jmp 0x74038
movq %r13, %rdi
xorl %esi, %esi
callq 0x70186
movl $0x1d, %edx
leaq 0x48(%rsp), %rdi
leaq 0xb8cb(%rip), %rsi      # 0x7f8bc
callq 0x8470
movq 0x8(%r12), %r14
testq %r14, %r14
je 0x74042
movq %r14, %rdi
callq 0x8190
leaq 0x48(%rsp), %rdi
movq %r14, %rsi
movq %rax, %rdx
callq 0x8470
jmp 0x74060
movq 0x48(%rsp), %rax
movq -0x18(%rax), %rax
leaq 0x48(%rsp), %rcx
leaq (%rcx,%rax), %rdi
movl 0x68(%rsp,%rax), %esi
orl $0x1, %esi
callq 0x86b0
movq %r13, %rdi
callq 0x70626
jmp 0x74068
movq 0x48(%rsp), %rax
movq -0x18(%rax), %rax
leaq 0x48(%rsp), %rcx
leaq (%rcx,%rax), %rdi
movl 0x68(%rsp,%rax), %esi
orl $0x1, %esi
callq 0x86b0
movq %r13, %rdi
callq 0x70626
testl %ebx, %ebx
jle 0x74085
movl $0x1, %edx
leaq 0x368(%rsp), %rdi
leaq 0x72d2(%rip), %rsi      # 0x7b352
callq 0x8470
leaq 0x4e0(%rsp), %r14
movq %r14, %rdi
callq 0x8190
leaq 0x368(%rsp), %rdi
movq %r14, %rsi
movq %rax, %rdx
callq 0x8470
incl %ebx
movq (%r12), %r12
testq %r12, %r12
jne 0x73dda
movq 0x8(%rsp), %rdi
callq 0x8710
testl %ebx, %ebx
movq 0x38(%rsp), %rbx
je 0x74109
leaq 0x370(%rsp), %rsi
leaq 0x40(%rsp), %rdi
callq 0x8630
leaq 0x40(%rsp), %rsi
movq %rbx, %rdi
callq 0x6a6be
movq 0x40(%rsp), %rdi
leaq 0x50(%rsp), %rax
cmpq %rax, %rdi
je 0x74126
callq 0x8390
jmp 0x74126
movq 0x8(%rsp), %rdi
callq 0x8710
leaq 0x10(%rbx), %rax
movq %rax, (%rbx)
leaq 0xa17e(%rip), %rsi      # 0x7e295
leaq 0xa17b(%rip), %rdx      # 0x7e299
movq %rbx, %rdi
callq 0x68de4
leaq 0x358(%rsp), %rdi
callq 0x87e8
movq %rbx, %rax
addq $0x5e8, %rsp            # imm = 0x5E8
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0x741b2
jmp 0x74202
jmp 0x74202
movq %rax, %rbx
movq 0x40(%rsp), %rdi
leaq 0x50(%rsp), %rax
cmpq %rax, %rdi
je 0x74212
callq 0x8390
jmp 0x74212
movq %rax, %rbx
jmp 0x74212
movq %rax, %rbx
leaq 0x40(%rsp), %rdi
callq 0x70626
jmp 0x74212
movq %rax, %rbx
leaq 0x40(%rsp), %rdi
callq 0x70626
jmp 0x74205
jmp 0x741b2
jmp 0x74202
jmp 0x74202
movq %rax, %rbx
leaq 0x40(%rsp), %rdi
callq 0x70626
jmp 0x74205
movq %rax, %rbx
movq 0x40(%rsp), %rdi
leaq 0x50(%rsp), %rax
jmp 0x741d2
jmp 0x74202
jmp 0x74202
movq %rax, %rbx
movq 0x18(%rsp), %rdi
leaq 0x28(%rsp), %rax
cmpq %rax, %rdi
je 0x74205
callq 0x8390
jmp 0x74205
jmp 0x74202
movq %rax, %rbx
leaq 0x40(%rsp), %rdi
callq 0x70626
jmp 0x74205
jmp 0x74202
movq %rax, %rbx
leaq 0x40(%rsp), %rdi
callq 0x70626
jmp 0x74205
jmp 0x74202
movq %rax, %rbx
leaq 0x358(%rsp), %rdi
callq 0x87e8
movq %rbx, %rdi
callq 0x8720
movq %rax, %rdi
callq 0x68c53