#define NULL ((void *)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t;
typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1

/* Forward declarations */
typedef struct TYPE_2__ TYPE_1__;

/* Type definitions */
struct sockaddr_in {
  int /*<<< orphan*/ sin_addr;
};
struct TYPE_2__ {
  int /*<<< orphan*/ sa_data;
};
struct ifreq {
  int ifc_len;
  char *ifc_buf;
  int ifr_flags;
  char *ifr_name;
  TYPE_1__ ifr_hwaddr;
  int /*<<< orphan*/ ifr_netmask;
  int /*<<< orphan*/ ifr_addr;
  struct ifreq *ifc_req;
};
struct ifconf {
  int ifc_len;
  char *ifc_buf;
  int ifr_flags;
  char *ifr_name;
  TYPE_1__ ifr_hwaddr;
  int /*<<< orphan*/ ifr_netmask;
  int /*<<< orphan*/ ifr_addr;
  struct ifconf *ifc_req;
};

/* Variables and functions */
int /*<<< orphan*/ AF_INET;
int IFF_LOOPBACK;
int IFF_UP;
int /*<<< orphan*/ SIOCGIFCONF;
int /*<<< orphan*/ SIOCGIFFLAGS;
int /*<<< orphan*/ SIOCGIFHWADDR;
int /*<<< orphan*/ SIOCGIFNETMASK;
int /*<<< orphan*/ SOCK_STREAM;
int /*<<< orphan*/ exit(int);
char *inet_ntoa(int /*<<< orphan*/);
int ioctl(int, int /*<<< orphan*/, struct ifreq *);
int /*<<< orphan*/ memcpy(unsigned char *, int /*<<< orphan*/, int);
int /*<<< orphan*/ perror(char *);
int /*<<< orphan*/ printf(char *, ...);
int socket(int /*<<< orphan*/, int /*<<< orphan*/, int /*<<< orphan*/);
int main() {
  int sock;
  sock = socket(AF_INET, SOCK_STREAM, 0);
  if (sock == -1) {
    perror("socket");
    exit(1);
  }
  struct ifconf ifc;
  struct ifreq *ifr;
  int len = 50 * (sizeof(struct ifreq));
  char buf[len];
  struct sockaddr_in *sin;
  ifc.ifc_len = len;
  ifc.ifc_buf = buf;
  if (ioctl(sock, SIOCGIFCONF, &ifc) == -1) {
    perror("CGIFCONF");
    exit(1);
  }
  ifr = ifc.ifc_req;
  int i;
  len = ifc.ifc_len / (sizeof(struct ifreq));
  for (i = 0; i < len; i++) {
    sin = (struct sockaddr_in *)&ifr->ifr_addr;
    if (ioctl(sock, SIOCGIFFLAGS, ifr) == -1) {
      perror("CGIFFLAGS");
      exit(1);
    }
    if (((ifr->ifr_flags & IFF_LOOPBACK) == 0) && (ifr->ifr_flags & IFF_UP)) {
      printf("%s ", ifr->ifr_name);
      printf("%s ", inet_ntoa(sin->sin_addr));
      if (ioctl(sock, SIOCGIFNETMASK, ifr) == -1) {
        perror("CGIFNETMASK");
        exit(1);
      }
      sin = (struct sockaddr_in *)&ifr->ifr_netmask;
      printf(" %s ", inet_ntoa(sin->sin_addr));
      if (ioctl(sock, SIOCGIFHWADDR, ifr) == -1) {
        perror("CGIFHWADDR");
        exit(1);
      }
      unsigned char mac[6];
      memcpy(mac, (ifr->ifr_hwaddr).sa_data, 6);
      printf(" %02X:%02X:%02X:%02X:%02X:%02X\n", mac[0], mac[1], mac[2], mac[3],
             mac[4], mac[5]);
    }
    ifr++;
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x80,%rsp
movl   $0x0,-0x4(%rbp)
mov    0x2e57(%rip),%rax
mov    (%rax),%edi
mov    0x2e1e(%rip),%rax
mov    (%rax),%esi
xor    %edx,%edx
call   1090 <socket@plt>
mov    %eax,-0x8(%rbp)
cmpl   $0xffffffff,-0x8(%rbp)
jne    11be <main+0x4e>
lea    0xe51(%rip),%rdi
call   1070 <perror@plt>
mov    $0x1,%edi
call   1080 <exit@plt>
movl   $0xaf0,-0x4c(%rbp)
mov    -0x4c(%rbp),%eax
mov    %eax,%ecx
mov    %rsp,%rax
mov    %rax,-0x58(%rbp)
mov    %rcx,%rdx
add    $0xf,%rdx
and    $0xfffffffffffffff0,%rdx
mov    %rsp,%rax
sub    %rdx,%rax
mov    %rax,%rsp
mov    %rcx,-0x60(%rbp)
mov    -0x4c(%rbp),%ecx
mov    %ecx,-0x40(%rbp)
mov    %rax,-0x38(%rbp)
mov    -0x8(%rbp),%edi
mov    0x2dab(%rip),%rax
mov    (%rax),%esi
lea    -0x40(%rbp),%rdx
call   1050 <ioctl@plt>
cmp    $0xffffffff,%eax
jne    1227 <main+0xb7>
lea    0xdef(%rip),%rdi
call   1070 <perror@plt>
mov    $0x1,%edi
call   1080 <exit@plt>
mov    -0x10(%rbp),%rax
mov    %rax,-0x48(%rbp)
movslq -0x40(%rbp),%rax
mov    $0x38,%ecx
xor    %edx,%edx
div    %rcx
mov    %eax,-0x4c(%rbp)
movl   $0x0,-0x6c(%rbp)
mov    -0x6c(%rbp),%eax
cmp    -0x4c(%rbp),%eax
jge    13e9 <main+0x279>
mov    -0x48(%rbp),%rax
add    $0x28,%rax
mov    %rax,-0x68(%rbp)
mov    -0x8(%rbp),%edi
mov    0x2d5f(%rip),%rax
mov    (%rax),%esi
mov    -0x48(%rbp),%rdx
call   1050 <ioctl@plt>
cmp    $0xffffffff,%eax
jne    1293 <main+0x123>
lea    0xd8c(%rip),%rdi
call   1070 <perror@plt>
mov    $0x1,%edi
call   1080 <exit@plt>
mov    -0x48(%rbp),%rax
mov    0x10(%rax),%eax
mov    0x2d57(%rip),%rcx
and    (%rcx),%eax
cmp    $0x0,%eax
jne    13cf <main+0x25f>
mov    -0x48(%rbp),%rax
mov    0x10(%rax),%eax
mov    0x2d16(%rip),%rcx
and    (%rcx),%eax
cmp    $0x0,%eax
je     13cf <main+0x25f>
mov    -0x48(%rbp),%rax
mov    0x18(%rax),%rsi
lea    0xd53(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x68(%rbp),%rax
mov    (%rax),%edi
call   1030 <inet_ntoa@plt>
mov    %rax,%rsi
lea    0xd37(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x8(%rbp),%edi
mov    0x2cd7(%rip),%rax
mov    (%rax),%esi
mov    -0x48(%rbp),%rdx
call   1050 <ioctl@plt>
cmp    $0xffffffff,%eax
jne    132b <main+0x1bb>
lea    0xcfe(%rip),%rdi
call   1070 <perror@plt>
mov    $0x1,%edi
call   1080 <exit@plt>
mov    -0x48(%rbp),%rax
add    $0x24,%rax
mov    %rax,-0x68(%rbp)
mov    -0x68(%rbp),%rax
mov    (%rax),%edi
call   1030 <inet_ntoa@plt>
mov    %rax,%rsi
lea    0xcda(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x8(%rbp),%edi
mov    0x2c5b(%rip),%rax
mov    (%rax),%esi
mov    -0x48(%rbp),%rdx
call   1050 <ioctl@plt>
cmp    $0xffffffff,%eax
jne    1387 <main+0x217>
lea    0xcb3(%rip),%rdi
call   1070 <perror@plt>
mov    $0x1,%edi
call   1080 <exit@plt>
lea    -0x72(%rbp),%rdi
mov    -0x48(%rbp),%rax
mov    0x20(%rax),%esi
mov    $0x6,%edx
call   1060 <memcpy@plt>
movzbl -0x72(%rbp),%esi
movzbl -0x71(%rbp),%edx
movzbl -0x70(%rbp),%ecx
movzbl -0x6f(%rbp),%r8d
movzbl -0x6e(%rbp),%r9d
movzbl -0x6d(%rbp),%eax
lea    0xc79(%rip),%rdi
sub    $0x10,%rsp
mov    %eax,(%rsp)
mov    $0x0,%al
call   1040 <printf@plt>
add    $0x10,%rsp
mov    -0x48(%rbp),%rax
add    $0x38,%rax
mov    %rax,-0x48(%rbp)
mov    -0x6c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x6c(%rbp)
jmp    1247 <main+0xd7>
movl   $0x0,-0x4(%rbp)
mov    -0x58(%rbp),%rax
mov    %rax,%rsp
mov    -0x4(%rbp),%eax
mov    %rbp,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
mov    %rsp,%rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x48,%rsp
mov    0x2e58(%rip),%rax
mov    (%rax),%edi
mov    0x2e1f(%rip),%rax
mov    (%rax),%esi
xor    %edx,%edx
call   1090 <socket@plt>
cmp    $0xffffffff,%eax
je     1369 <main+0x1f9>
mov    %eax,%r13d
mov    %rsp,-0x38(%rbp)
mov    %rsp,%rax
add    $0xfffffffffffff510,%rax
mov    %rax,%rsp
movl   $0xaf0,-0x70(%rbp)
mov    %rax,-0x68(%rbp)
mov    0x2de0(%rip),%rax
mov    (%rax),%esi
lea    -0x70(%rbp),%rdx
mov    %r13d,%edi
call   1050 <ioctl@plt>
cmp    $0xffffffff,%eax
je     1372 <main+0x202>
movslq -0x70(%rbp),%rax
shr    $0x3,%rax
movabs $0x2492492492492493,%rcx
49 92 24
mul    %rcx
mov    %rdx,%r15
test   %r15d,%r15d
jle    132c <main+0x1bc>
mov    -0x40(%rbp),%rbx
mov    0x2dbd(%rip),%r12
mov    0x2de6(%rip),%r14
jmp    122e <main+0xbe>
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
add    $0x38,%rbx
add    $0xffffffff,%r15d
je     132c <main+0x1bc>
mov    (%r12),%esi
mov    %r13d,%edi
mov    %rbx,%rdx
call   1050 <ioctl@plt>
cmp    $0xffffffff,%eax
je     1341 <main+0x1d1>
mov    0x10(%rbx),%eax
test   %eax,(%r14)
jne    1220 <main+0xb0>
mov    0x2d7b(%rip),%rcx
test   %eax,(%rcx)
je     1220 <main+0xb0>
mov    0x18(%rbx),%rsi
mov    %r13d,%r14d
lea    0xdc0(%rip),%r13
mov    %r13,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
mov    0x28(%rbx),%edi
call   1030 <inet_ntoa@plt>
mov    %r13,%rdi
mov    %r14d,%r13d
mov    %rax,%rsi
xor    %eax,%eax
call   1040 <printf@plt>
mov    0x2d48(%rip),%rax
mov    (%rax),%esi
mov    %r14d,%edi
mov    %rbx,%rdx
call   1050 <ioctl@plt>
cmp    $0xffffffff,%eax
je     1357 <main+0x1e7>
mov    0x24(%rbx),%edi
call   1030 <inet_ntoa@plt>
lea    0xd71(%rip),%rdi
mov    %rax,%rsi
xor    %eax,%eax
call   1040 <printf@plt>
mov    0x2cf2(%rip),%rax
mov    (%rax),%esi
mov    %r13d,%edi
mov    %rbx,%rdx
call   1050 <ioctl@plt>
cmp    $0xffffffff,%eax
je     1360 <main+0x1f0>
mov    0x20(%rbx),%esi
lea    -0x2e(%rbp),%rdi
mov    $0x6,%edx
call   1060 <memcpy@plt>
movzbl -0x2e(%rbp),%esi
movzbl -0x2d(%rbp),%edx
movzbl -0x2c(%rbp),%ecx
movzbl -0x2b(%rbp),%r8d
movzbl -0x2a(%rbp),%r9d
movzbl -0x29(%rbp),%r10d
sub    $0x8,%rsp
lea    0xd23(%rip),%rdi
xor    %eax,%eax
push   %r10
call   1040 <printf@plt>
add    $0x10,%rsp
mov    0x2cd1(%rip),%r14
jmp    1220 <main+0xb0>
mov    -0x38(%rbp),%rsp
xor    %eax,%eax
lea    -0x28(%rbp),%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
lea    0xcc8(%rip),%rdi
call   1070 <perror@plt>
mov    $0x1,%edi
call   1080 <exit@plt>
lea    0xcbc(%rip),%rdi
jmp    1348 <main+0x1d8>
lea    0xcc4(%rip),%rdi
jmp    1348 <main+0x1d8>
lea    0xc90(%rip),%rdi
jmp    1348 <main+0x1d8>
lea    0xc8e(%rip),%rdi
jmp    1348 <main+0x1d8>

LLVM IR (-O0):
%struct.ifconf = type { i32, i8*, i32, i8*, %struct.TYPE_2__, i32, i32, %struct.ifconf* }
%struct.TYPE_2__ = type { i32 }
%struct.ifreq = type { i32, i8*, i32, i8*, %struct.TYPE_2__, i32, i32, %struct.ifreq* }
%struct.sockaddr_in = type { i32 }
@AF_INET = global i32 0
@SOCK_STREAM = global i32 0
@.str = [7 x i8] c"socket\00"
@SIOCGIFCONF = global i32 0
@.str.1 = [9 x i8] c"CGIFCONF\00"
@SIOCGIFFLAGS = global i32 0
@.str.2 = [10 x i8] c"CGIFFLAGS\00"
@IFF_LOOPBACK = global i32 0
@IFF_UP = global i32 0
@.str.3 = [4 x i8] c"%s \00"
@SIOCGIFNETMASK = global i32 0
@.str.4 = [12 x i8] c"CGIFNETMASK\00"
@.str.5 = [5 x i8] c" %s \00"
@SIOCGIFHWADDR = global i32 0
@.str.6 = [11 x i8] c"CGIFHWADDR\00"
@.str.7 = [32 x i8] c" %02X:%02X:%02X:%02X:%02X:%02X\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca %struct.ifconf
%4 = alloca %struct.ifreq*
%5 = alloca i32
%6 = alloca i8*
%7 = alloca i64
%8 = alloca %struct.sockaddr_in*
%9 = alloca i32
%10 = alloca [6 x i8]
store i32 0, i32* %1
%11 = load i32, i32* @AF_INET
%12 = load i32, i32* @SOCK_STREAM
%13 = call i32 @socket(i32 %11, i32 %12, i32 0)
store i32 %13, i32* %2
%14 = load i32, i32* %2
%15 = icmp eq i32 %14, -1
br i1 %15, label %16, label %19
16: ; preds = %0
%17 = call i32 @perror(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0))
%18 = call i32 @exit(i32 1)
unreachable
19: ; preds = %0
store i32 2800, i32* %5
%20 = load i32, i32* %5
%21 = zext i32 %20 to i64
%22 = call i8* @llvm.stacksave()
store i8* %22, i8** %6
%23 = alloca i8, i64 %21
store i64 %21, i64* %7
%24 = load i32, i32* %5
%25 = getelementptr inbounds %struct.ifconf, %struct.ifconf* %3, i32 0, i32 0
store i32 %24, i32* %25
%26 = getelementptr inbounds %struct.ifconf, %struct.ifconf* %3, i32 0, i32 1
store i8* %23, i8** %26
%27 = load i32, i32* %2
%28 = load i32, i32* @SIOCGIFCONF
%29 = bitcast %struct.ifconf* %3 to %struct.ifreq*
%30 = call i32 @ioctl(i32 %27, i32 %28, %struct.ifreq* %29)
%31 = icmp eq i32 %30, -1
br i1 %31, label %32, label %35
32: ; preds = %19
%33 = call i32 @perror(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.1, i64 0, i64 0))
%34 = call i32 @exit(i32 1)
unreachable
35: ; preds = %19
%36 = getelementptr inbounds %struct.ifconf, %struct.ifconf* %3, i32 0, i32 7
%37 = load %struct.ifconf*, %struct.ifconf** %36
%38 = bitcast %struct.ifconf* %37 to %struct.ifreq*
store %struct.ifreq* %38, %struct.ifreq** %4
%39 = getelementptr inbounds %struct.ifconf, %struct.ifconf* %3, i32 0, i32 0
%40 = load i32, i32* %39
%41 = sext i32 %40 to i64
%42 = udiv i64 %41, 56
%43 = trunc i64 %42 to i32
store i32 %43, i32* %5
store i32 0, i32* %9
br label %44
44: ; preds = %138, %35
%45 = load i32, i32* %9
%46 = load i32, i32* %5
%47 = icmp slt i32 %45, %46
br i1 %47, label %48, label %141
48: ; preds = %44
%49 = load %struct.ifreq*, %struct.ifreq** %4
%50 = getelementptr inbounds %struct.ifreq, %struct.ifreq* %49, i32 0, i32 6
%51 = bitcast i32* %50 to %struct.sockaddr_in*
store %struct.sockaddr_in* %51, %struct.sockaddr_in** %8
%52 = load i32, i32* %2
%53 = load i32, i32* @SIOCGIFFLAGS
%54 = load %struct.ifreq*, %struct.ifreq** %4
%55 = call i32 @ioctl(i32 %52, i32 %53, %struct.ifreq* %54)
%56 = icmp eq i32 %55, -1
br i1 %56, label %57, label %60
57: ; preds = %48
%58 = call i32 @perror(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.2, i64 0, i64 0))
%59 = call i32 @exit(i32 1)
unreachable
60: ; preds = %48
%61 = load %struct.ifreq*, %struct.ifreq** %4
%62 = getelementptr inbounds %struct.ifreq, %struct.ifreq* %61, i32 0, i32 2
%63 = load i32, i32* %62
%64 = load i32, i32* @IFF_LOOPBACK
%65 = and i32 %63, %64
%66 = icmp eq i32 %65, 0
br i1 %66, label %67, label %135
67: ; preds = %60
%68 = load %struct.ifreq*, %struct.ifreq** %4
%69 = getelementptr inbounds %struct.ifreq, %struct.ifreq* %68, i32 0, i32 2
%70 = load i32, i32* %69
%71 = load i32, i32* @IFF_UP
%72 = and i32 %70, %71
%73 = icmp ne i32 %72, 0
br i1 %73, label %74, label %135
74: ; preds = %67
%75 = load %struct.ifreq*, %struct.ifreq** %4
%76 = getelementptr inbounds %struct.ifreq, %struct.ifreq* %75, i32 0, i32 3
%77 = load i8*, i8** %76
%78 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.3, i64 0, i64 0), i8* %77)
%79 = load %struct.sockaddr_in*, %struct.sockaddr_in** %8
%80 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %79, i32 0, i32 0
%81 = load i32, i32* %80
%82 = call i8* @inet_ntoa(i32 %81)
%83 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.3, i64 0, i64 0), i8* %82)
%84 = load i32, i32* %2
%85 = load i32, i32* @SIOCGIFNETMASK
%86 = load %struct.ifreq*, %struct.ifreq** %4
%87 = call i32 @ioctl(i32 %84, i32 %85, %struct.ifreq* %86)
%88 = icmp eq i32 %87, -1
br i1 %88, label %89, label %92
89: ; preds = %74
%90 = call i32 @perror(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.4, i64 0, i64 0))
%91 = call i32 @exit(i32 1)
unreachable
92: ; preds = %74
%93 = load %struct.ifreq*, %struct.ifreq** %4
%94 = getelementptr inbounds %struct.ifreq, %struct.ifreq* %93, i32 0, i32 5
%95 = bitcast i32* %94 to %struct.sockaddr_in*
store %struct.sockaddr_in* %95, %struct.sockaddr_in** %8
%96 = load %struct.sockaddr_in*, %struct.sockaddr_in** %8
%97 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %96, i32 0, i32 0
%98 = load i32, i32* %97
%99 = call i8* @inet_ntoa(i32 %98)
%100 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.5, i64 0, i64 0), i8* %99)
%101 = load i32, i32* %2
%102 = load i32, i32* @SIOCGIFHWADDR
%103 = load %struct.ifreq*, %struct.ifreq** %4
%104 = call i32 @ioctl(i32 %101, i32 %102, %struct.ifreq* %103)
%105 = icmp eq i32 %104, -1
br i1 %105, label %106, label %109
106: ; preds = %92
%107 = call i32 @perror(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.6, i64 0, i64 0))
%108 = call i32 @exit(i32 1)
unreachable
109: ; preds = %92
%110 = getelementptr inbounds [6 x i8], [6 x i8]* %10, i64 0, i64 0
%111 = load %struct.ifreq*, %struct.ifreq** %4
%112 = getelementptr inbounds %struct.ifreq, %struct.ifreq* %111, i32 0, i32 4
%113 = getelementptr inbounds %struct.TYPE_2__, %struct.TYPE_2__* %112, i32 0, i32 0
%114 = load i32, i32* %113
%115 = call i32 @memcpy(i8* %110, i32 %114, i32 6)
%116 = getelementptr inbounds [6 x i8], [6 x i8]* %10, i64 0, i64 0
%117 = load i8, i8* %116
%118 = zext i8 %117 to i32
%119 = getelementptr inbounds [6 x i8], [6 x i8]* %10, i64 0, i64 1
%120 = load i8, i8* %119
%121 = zext i8 %120 to i32
%122 = getelementptr inbounds [6 x i8], [6 x i8]* %10, i64 0, i64 2
%123 = load i8, i8* %122
%124 = zext i8 %123 to i32
%125 = getelementptr inbounds [6 x i8], [6 x i8]* %10, i64 0, i64 3
%126 = load i8, i8* %125
%127 = zext i8 %126 to i32
%128 = getelementptr inbounds [6 x i8], [6 x i8]* %10, i64 0, i64 4
%129 = load i8, i8* %128
%130 = zext i8 %129 to i32
%131 = getelementptr inbounds [6 x i8], [6 x i8]* %10, i64 0, i64 5
%132 = load i8, i8* %131
%133 = zext i8 %132 to i32
%134 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str.7, i64 0, i64 0), i32 %118, i32 %121, i32 %124, i32 %127, i32 %130, i32 %133)
br label %135
135: ; preds = %109, %67, %60
%136 = load %struct.ifreq*, %struct.ifreq** %4
%137 = getelementptr inbounds %struct.ifreq, %struct.ifreq* %136, i32 1
store %struct.ifreq* %137, %struct.ifreq** %4
br label %138
138: ; preds = %135
%139 = load i32, i32* %9
%140 = add nsw i32 %139, 1
store i32 %140, i32* %9
br label %44
141: ; preds = %44
store i32 0, i32* %1
%142 = load i8*, i8** %6
%143 = load i32, i32* %1
ret i32 %143
}

LLVM IR (-O2):
%struct.ifconf = type { i32, i8*, i32, i8*, %struct.TYPE_2__, i32, i32, %struct.ifconf* }
%struct.TYPE_2__ = type { i32 }
%struct.ifreq = type { i32, i8*, i32, i8*, %struct.TYPE_2__, i32, i32, %struct.ifreq* }
@AF_INET = global i32 0
@SOCK_STREAM = global i32 0
@.str = [7 x i8] c"socket\00"
@SIOCGIFCONF = global i32 0
@.str.1 = [9 x i8] c"CGIFCONF\00"
@SIOCGIFFLAGS = global i32 0
@.str.2 = [10 x i8] c"CGIFFLAGS\00"
@IFF_LOOPBACK = global i32 0
@IFF_UP = global i32 0
@.str.3 = [4 x i8] c"%s \00"
@SIOCGIFNETMASK = global i32 0
@.str.4 = [12 x i8] c"CGIFNETMASK\00"
@.str.5 = [5 x i8] c" %s \00"
@SIOCGIFHWADDR = global i32 0
@.str.6 = [11 x i8] c"CGIFHWADDR\00"
@.str.7 = [32 x i8] c" %02X:%02X:%02X:%02X:%02X:%02X\0A\00"
define i32 @main() {
%1 = alloca %struct.ifconf
%2 = alloca [6 x i8]
%3 = load i32, i32* @AF_INET
%4 = load i32, i32* @SOCK_STREAM
%5 = tail call i32 @socket(i32 %3, i32 %4, i32 0)
%6 = icmp eq i32 %5, -1
br i1 %6, label %7, label %10
7: ; preds = %0
%8 = tail call i32 @perror(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0))
%9 = tail call i32 @exit(i32 1)
unreachable
10: ; preds = %0
%11 = bitcast %struct.ifconf* %1 to i8*
%12 = tail call i8* @llvm.stacksave()
%13 = alloca [2800 x i8]
%14 = getelementptr inbounds [2800 x i8], [2800 x i8]* %13, i64 0, i64 0
%15 = getelementptr inbounds %struct.ifconf, %struct.ifconf* %1, i64 0, i32 0
store i32 2800, i32* %15
%16 = getelementptr inbounds %struct.ifconf, %struct.ifconf* %1, i64 0, i32 1
store i8* %14, i8** %16
%17 = load i32, i32* @SIOCGIFCONF
%18 = bitcast %struct.ifconf* %1 to %struct.ifreq*
%19 = call i32 @ioctl(i32 %5, i32 %17, %struct.ifreq* %18)
%20 = icmp eq i32 %19, -1
br i1 %20, label %21, label %24
21: ; preds = %10
%22 = call i32 @perror(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.1, i64 0, i64 0))
%23 = call i32 @exit(i32 1)
unreachable
24: ; preds = %10
%25 = load i32, i32* %15
%26 = sext i32 %25 to i64
%27 = udiv i64 %26, 56
%28 = trunc i64 %27 to i32
%29 = icmp sgt i32 %28, 0
br i1 %29, label %30, label %105
30: ; preds = %24
%31 = getelementptr inbounds %struct.ifconf, %struct.ifconf* %1, i64 0, i32 7
%32 = bitcast %struct.ifconf** %31 to %struct.ifreq**
%33 = load %struct.ifreq*, %struct.ifreq** %32
%34 = getelementptr inbounds [6 x i8], [6 x i8]* %2, i64 0, i64 0
%35 = getelementptr inbounds [6 x i8], [6 x i8]* %2, i64 0, i64 1
%36 = getelementptr inbounds [6 x i8], [6 x i8]* %2, i64 0, i64 2
%37 = getelementptr inbounds [6 x i8], [6 x i8]* %2, i64 0, i64 3
%38 = getelementptr inbounds [6 x i8], [6 x i8]* %2, i64 0, i64 4
%39 = getelementptr inbounds [6 x i8], [6 x i8]* %2, i64 0, i64 5
br label %40
40: ; preds = %30, %101
%41 = phi i32 [ 0, %30 ], [ %103, %101 ]
%42 = phi %struct.ifreq* [ %33, %30 ], [ %102, %101 ]
%43 = getelementptr inbounds %struct.ifreq, %struct.ifreq* %42, i64 0, i32 6
%44 = load i32, i32* @SIOCGIFFLAGS
%45 = call i32 @ioctl(i32 %5, i32 %44, %struct.ifreq* %42)
%46 = icmp eq i32 %45, -1
br i1 %46, label %47, label %50
47: ; preds = %40
%48 = call i32 @perror(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.2, i64 0, i64 0))
%49 = call i32 @exit(i32 1)
unreachable
50: ; preds = %40
%51 = getelementptr inbounds %struct.ifreq, %struct.ifreq* %42, i64 0, i32 2
%52 = load i32, i32* %51
%53 = load i32, i32* @IFF_LOOPBACK
%54 = and i32 %53, %52
%55 = icmp eq i32 %54, 0
br i1 %55, label %56, label %101
56: ; preds = %50
%57 = load i32, i32* @IFF_UP
%58 = and i32 %57, %52
%59 = icmp eq i32 %58, 0
br i1 %59, label %101, label %60
60: ; preds = %56
%61 = getelementptr inbounds %struct.ifreq, %struct.ifreq* %42, i64 0, i32 3
%62 = load i8*, i8** %61
%63 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.3, i64 0, i64 0), i8* %62)
%64 = load i32, i32* %43
%65 = call i8* @inet_ntoa(i32 %64)
%66 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.3, i64 0, i64 0), i8* %65)
%67 = load i32, i32* @SIOCGIFNETMASK
%68 = call i32 @ioctl(i32 %5, i32 %67, %struct.ifreq* %42)
%69 = icmp eq i32 %68, -1
br i1 %69, label %70, label %73
70: ; preds = %60
%71 = call i32 @perror(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.4, i64 0, i64 0))
%72 = call i32 @exit(i32 1)
unreachable
73: ; preds = %60
%74 = getelementptr inbounds %struct.ifreq, %struct.ifreq* %42, i64 0, i32 5
%75 = load i32, i32* %74
%76 = call i8* @inet_ntoa(i32 %75)
%77 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @.str.5, i64 0, i64 0), i8* %76)
%78 = load i32, i32* @SIOCGIFHWADDR
%79 = call i32 @ioctl(i32 %5, i32 %78, %struct.ifreq* %42)
%80 = icmp eq i32 %79, -1
br i1 %80, label %81, label %84
81: ; preds = %73
%82 = call i32 @perror(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.6, i64 0, i64 0))
%83 = call i32 @exit(i32 1)
unreachable
84: ; preds = %73
%85 = getelementptr inbounds %struct.ifreq, %struct.ifreq* %42, i64 0, i32 4, i32 0
%86 = load i32, i32* %85
%87 = call i32 @memcpy(i8* %34, i32 %86, i32 6)
%88 = load i8, i8* %34
%89 = zext i8 %88 to i32
%90 = load i8, i8* %35
%91 = zext i8 %90 to i32
%92 = load i8, i8* %36
%93 = zext i8 %92 to i32
%94 = load i8, i8* %37
%95 = zext i8 %94 to i32
%96 = load i8, i8* %38
%97 = zext i8 %96 to i32
%98 = load i8, i8* %39
%99 = zext i8 %98 to i32
%100 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([32 x i8], [32 x i8]* @.str.7, i64 0, i64 0), i32 %89, i32 %91, i32 %93, i32 %95, i32 %97, i32 %99)
br label %101
101: ; preds = %84, %56, %50
%102 = getelementptr inbounds %struct.ifreq, %struct.ifreq* %42, i64 1
%103 = add nuw nsw i32 %41, 1
%104 = icmp eq i32 %103, %28
br i1 %104, label %105, label %40
105: ; preds = %101, %24
ret i32 0
}