// File: /workspace/github_c_makefile_star2_O0/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:
subq $0x13b8, %rsp           # imm = 0x13B8
movq %rdi, 0x88(%rsp)
movq %rdi, %rax
movq %rax, 0x90(%rsp)
movq %rdi, 0x13b0(%rsp)
leaq 0x13a8(%rsp), %rdi
callq 0x8880
cmpl $0x0, %eax
je 0xa82b2
leaq 0x1090(%rsp), %rdi
movq %rdi, 0x80(%rsp)
movl $0x1, %esi
callq 0xa1800
movq 0x80(%rsp), %rdi
leaq 0xc149(%rip), %rsi      # 0xb435a
callq 0x945b0
jmp 0xa8218
leaq 0x1090(%rsp), %rdi
callq 0xa1f50
leaq 0x1083(%rsp), %rdi
movq %rdi, 0x78(%rsp)
callq 0x87f0
movq 0x88(%rsp), %rdi
movq 0x78(%rsp), %rdx
leaq 0xaaed(%rip), %rsi      # 0xb2d38
callq 0x85b0
jmp 0xa8252
leaq 0x1083(%rsp), %rdi
callq 0x84a0
jmp 0xa8acb
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x1088(%rsp)
movl %eax, 0x1084(%rsp)
leaq 0x1090(%rsp), %rdi
callq 0xa1f50
jmp 0xa8287
jmp 0xa8adb
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x1088(%rsp)
movl %eax, 0x1084(%rsp)
leaq 0x1083(%rsp), %rdi
callq 0x84a0
jmp 0xa8adb
callq 0x90ab0
movq %rax, 0x1078(%rsp)
movq 0x1078(%rsp), %rax
movq %rax, 0x68(%rsp)
leaq 0x104f(%rsp), %rdi
movq %rdi, 0x70(%rsp)
callq 0x87f0
movq 0x70(%rsp), %rdx
leaq 0xc08f(%rip), %rsi      # 0xb4379
leaq 0x1050(%rsp), %rdi
callq 0x85b0
jmp 0xa82f9
movq 0x68(%rsp), %rdi
leaq 0x1050(%rsp), %rsi
xorl %edx, %edx
callq 0x90700
movb %al, 0x67(%rsp)
jmp 0xa8313
leaq 0x1050(%rsp), %rdi
callq 0x88f8
jmp 0xa8322
leaq 0x104f(%rsp), %rdi
callq 0x84a0
movb 0x67(%rsp), %al
andb $0x1, %al
movb %al, 0x1077(%rsp)
movl $0x0, 0x1048(%rsp)
leaq 0xec0(%rsp), %rdi
callq 0x82a0
movq 0x13a8(%rsp), %rax
movq %rax, 0xdb8(%rsp)
cmpq $0x0, 0xdb8(%rsp)
je 0xa89b8
movq 0xdb8(%rsp), %rax
movq 0x18(%rax), %rax
movq %rax, 0xdb0(%rsp)
cmpq $0x0, 0xdb0(%rsp)
jne 0xa8462
leaq 0xa98(%rsp), %rdi
movl $0x2, %esi
callq 0xa1800
jmp 0xa83aa
leaq 0xbfd6(%rip), %rsi      # 0xb4387
leaq 0xa98(%rsp), %rdi
callq 0x945b0
jmp 0xa83c0
leaq 0xa98(%rsp), %rdi
callq 0xa1f50
jmp 0xa83cf
jmp 0xa89a0
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x1088(%rsp)
movl %eax, 0x1084(%rsp)
jmp 0xa840f
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x1088(%rsp)
movl %eax, 0x1084(%rsp)
leaq 0x1050(%rsp), %rdi
callq 0x88f8
jmp 0xa840d
jmp 0xa840f
leaq 0x104f(%rsp), %rdi
callq 0x84a0
jmp 0xa8adb
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x1088(%rsp)
movl %eax, 0x1084(%rsp)
jmp 0xa8aba
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x1088(%rsp)
movl %eax, 0x1084(%rsp)
leaq 0xa98(%rsp), %rdi
callq 0xa1f50
jmp 0xa845d
jmp 0xa8aba
movb 0x1077(%rsp), %cl
movb $0x0, 0xa76(%rsp)
movb $0x0, 0xa75(%rsp)
xorl %eax, %eax
testb $0x1, %cl
movb %al, 0x66(%rsp)
je 0xa84ff
movq 0xdb8(%rsp), %rcx
xorl %eax, %eax
cmpq $0x0, 0x8(%rcx)
movb %al, 0x66(%rsp)
je 0xa84ff
leaq 0xa77(%rsp), %rdi
movq %rdi, 0x58(%rsp)
callq 0x87f0
movq 0x58(%rsp), %rdx
movb $0x1, 0xa76(%rsp)
leaq 0xbee8(%rip), %rsi      # 0xb43a7
leaq 0xa78(%rsp), %rdi
callq 0x85b0
jmp 0xa84ce
movb $0x1, 0xa75(%rsp)
movq 0xdb8(%rsp), %rax
movq 0x8(%rax), %rsi
leaq 0xa78(%rsp), %rdi
callq 0x8d0c0
movb %al, 0x57(%rsp)
jmp 0xa84f5
movb 0x57(%rsp), %al
movb %al, 0x66(%rsp)
jmp 0xa84ff
movb 0x66(%rsp), %al
movb %al, 0x56(%rsp)
testb $0x1, 0xa75(%rsp)
jne 0xa8513
jmp 0xa8524
leaq 0xa78(%rsp), %rdi
callq 0x88f8
jmp 0xa8522
jmp 0xa8524
testb $0x1, 0xa76(%rsp)
jne 0xa8530
jmp 0xa853d
leaq 0xa77(%rsp), %rdi
callq 0x84a0
movb 0x56(%rsp), %al
testb $0x1, %al
jne 0xa854a
jmp 0xa8614
leaq 0x758(%rsp), %rdi
xorl %esi, %esi
callq 0xa1800
jmp 0xa855b
leaq 0xbe48(%rip), %rsi      # 0xb43aa
leaq 0x758(%rsp), %rdi
callq 0x945b0
jmp 0xa8571
leaq 0x758(%rsp), %rdi
callq 0xa1f50
jmp 0xa8580
jmp 0xa89a0
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x1088(%rsp)
movl %eax, 0x1084(%rsp)
jmp 0xa85ce
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x1088(%rsp)
movl %eax, 0x1084(%rsp)
testb $0x1, 0xa75(%rsp)
jne 0xa85bb
jmp 0xa85cc
leaq 0xa78(%rsp), %rdi
callq 0x88f8
jmp 0xa85ca
jmp 0xa85cc
jmp 0xa85ce
testb $0x1, 0xa76(%rsp)
jne 0xa85da
jmp 0xa85e7
leaq 0xa77(%rsp), %rdi
callq 0x84a0
jmp 0xa8aba
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x1088(%rsp)
movl %eax, 0x1084(%rsp)
leaq 0x758(%rsp), %rdi
callq 0xa1f50
jmp 0xa860f
jmp 0xa8aba
movq 0xdb0(%rsp), %rax
movw (%rax), %ax
movw %ax, 0x756(%rsp)
movzwl 0x756(%rsp), %eax
movl %eax, 0x50(%rsp)
subl $0x2, %eax
je 0xa864c
jmp 0xa863a
movl 0x50(%rsp), %eax
subl $0xa, %eax
je 0xa87d3
jmp 0xa8957
movq 0x1078(%rsp), %rax
movq %rax, 0x40(%rsp)
leaq 0x72f(%rsp), %rdi
movq %rdi, 0x48(%rsp)
callq 0x87f0
movq 0x48(%rsp), %rdx
leaq 0xbd5e(%rip), %rsi      # 0xb43d5
leaq 0x730(%rsp), %rdi
callq 0x85b0
jmp 0xa8686
movq 0x40(%rsp), %rdi
leaq 0x730(%rsp), %rsi
xorl %edx, %edx
callq 0x90700
movb %al, 0x3f(%rsp)
jmp 0xa86a0
leaq 0x730(%rsp), %rdi
callq 0x88f8
jmp 0xa86af
leaq 0x72f(%rsp), %rdi
callq 0x84a0
movb 0x3f(%rsp), %al
testb $0x1, %al
jne 0xa86c9
jmp 0xa8751
movq 0xdb0(%rsp), %rax
movq %rax, 0x720(%rsp)
movzwl 0x756(%rsp), %edi
movq 0x720(%rsp), %rsi
addq $0x4, %rsi
leaq 0xdc0(%rsp), %rdx
movl $0x100, %ecx            # imm = 0x100
callq 0x8480
jmp 0xa87ce
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x1088(%rsp)
movl %eax, 0x1084(%rsp)
jmp 0xa873f
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x1088(%rsp)
movl %eax, 0x1084(%rsp)
leaq 0x730(%rsp), %rdi
callq 0x88f8
jmp 0xa873d
jmp 0xa873f
leaq 0x72f(%rsp), %rdi
callq 0x84a0
jmp 0xa8aba
leaq 0x408(%rsp), %rdi
xorl %esi, %esi
callq 0xa1800
jmp 0xa8762
leaq 0xbc75(%rip), %rsi      # 0xb43de
leaq 0x408(%rsp), %rdi
callq 0x945b0
movq %rax, 0x30(%rsp)
jmp 0xa877d
movq 0x30(%rsp), %rdi
movq 0xdb8(%rsp), %rax
movq 0x8(%rax), %rsi
callq 0x8400
jmp 0xa8795
leaq 0x408(%rsp), %rdi
callq 0xa1f50
jmp 0xa87a4
jmp 0xa87ce
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x1088(%rsp)
movl %eax, 0x1084(%rsp)
leaq 0x408(%rsp), %rdi
callq 0xa1f50
jmp 0xa87c9
jmp 0xa8aba
jmp 0xa8959
movq 0x1078(%rsp), %rax
movq %rax, 0x20(%rsp)
leaq 0x3e7(%rsp), %rdi
movq %rdi, 0x28(%rsp)
callq 0x87f0
movq 0x28(%rsp), %rdx
leaq 0xbbfe(%rip), %rsi      # 0xb43fc
leaq 0x3e8(%rsp), %rdi
callq 0x85b0
jmp 0xa880d
movq 0x20(%rsp), %rdi
leaq 0x3e8(%rsp), %rsi
xorl %edx, %edx
callq 0x90700
movb %al, 0x1f(%rsp)
jmp 0xa8827
leaq 0x3e8(%rsp), %rdi
callq 0x88f8
jmp 0xa8836
leaq 0x3e7(%rsp), %rdi
callq 0x84a0
movb 0x1f(%rsp), %al
testb $0x1, %al
jne 0xa8850
jmp 0xa88d8
movq 0xdb0(%rsp), %rax
movq %rax, 0x3d8(%rsp)
movzwl 0x756(%rsp), %edi
movq 0x3d8(%rsp), %rsi
addq $0x8, %rsi
leaq 0xdc0(%rsp), %rdx
movl $0x100, %ecx            # imm = 0x100
callq 0x8480
jmp 0xa8955
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x1088(%rsp)
movl %eax, 0x1084(%rsp)
jmp 0xa88c6
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x1088(%rsp)
movl %eax, 0x1084(%rsp)
leaq 0x3e8(%rsp), %rdi
callq 0x88f8
jmp 0xa88c4
jmp 0xa88c6
leaq 0x3e7(%rsp), %rdi
callq 0x84a0
jmp 0xa8aba
leaq 0xc0(%rsp), %rdi
xorl %esi, %esi
callq 0xa1800
jmp 0xa88e9
leaq 0xbb15(%rip), %rsi      # 0xb4405
leaq 0xc0(%rsp), %rdi
callq 0x945b0
movq %rax, 0x10(%rsp)
jmp 0xa8904
movq 0x10(%rsp), %rdi
movq 0xdb8(%rsp), %rax
movq 0x8(%rax), %rsi
callq 0x8400
jmp 0xa891c
leaq 0xc0(%rsp), %rdi
callq 0xa1f50
jmp 0xa892b
jmp 0xa8955
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x1088(%rsp)
movl %eax, 0x1084(%rsp)
leaq 0xc0(%rsp), %rdi
callq 0xa1f50
jmp 0xa8950
jmp 0xa8aba
jmp 0xa8959
jmp 0xa89a0
movl 0x1048(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x1048(%rsp)
cmpl $0x1, %eax
jle 0xa8987
leaq 0xed0(%rsp), %rdi
leaq 0x74d0(%rip), %rsi      # 0xafe4e
callq 0x8400
jmp 0xa8985
jmp 0xa8987
leaq 0xed0(%rsp), %rdi
leaq 0xdc0(%rsp), %rsi
callq 0x8400
jmp 0xa899e
jmp 0xa89a0
movq 0xdb8(%rsp), %rax
movq (%rax), %rax
movq %rax, 0xdb8(%rsp)
jmp 0xa8364
movq 0x13a8(%rsp), %rdi
callq 0x87c0
cmpl $0x0, 0x1048(%rsp)
jne 0xa8a3c
leaq 0xbf(%rsp), %rdi
movq %rdi, 0x8(%rsp)
callq 0x87f0
movq 0x88(%rsp), %rdi
movq 0x8(%rsp), %rdx
leaq 0xa343(%rip), %rsi      # 0xb2d38
callq 0x85b0
jmp 0xa89fc
leaq 0xbf(%rsp), %rdi
callq 0x84a0
movl $0x1, 0xb8(%rsp)
jmp 0xa8aab
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x1088(%rsp)
movl %eax, 0x1084(%rsp)
leaq 0xbf(%rsp), %rdi
callq 0x84a0
jmp 0xa8aba
leaq 0x98(%rsp), %rdi
leaq 0xec0(%rsp), %rsi
callq 0x83e0
jmp 0xa8a53
movq 0x88(%rsp), %rdi
leaq 0x98(%rsp), %rsi
callq 0x91920
jmp 0xa8a6a
leaq 0x98(%rsp), %rdi
callq 0x88f8
jmp 0xa8a79
movl $0x1, 0xb8(%rsp)
jmp 0xa8aab
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x1088(%rsp)
movl %eax, 0x1084(%rsp)
leaq 0x98(%rsp), %rdi
callq 0x88f8
jmp 0xa8aa9
jmp 0xa8aba
leaq 0xec0(%rsp), %rdi
callq 0x8900
jmp 0xa8acb
leaq 0xec0(%rsp), %rdi
callq 0x8900
jmp 0xa8ac9
jmp 0xa8adb
movq 0x90(%rsp), %rax
addq $0x13b8, %rsp           # imm = 0x13B8
retq
movq 0x1088(%rsp), %rdi
callq 0x87d0
movq %rax, %rdi
callq 0x8cf60