#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 ifaddrs {
  TYPE_1__ *ifa_addr;
  int /*<<< orphan*/ ifa_name;
  struct ifaddrs *ifa_next;
};
struct TYPE_2__ {
  scalar_t__ sa_family;
};

/* Variables and functions */
scalar_t__ AF_INET;
int INET_ADDRSTRLEN;
int /*<<< orphan*/ freeifaddrs(struct ifaddrs *);
int /*<<< orphan*/ getifaddrs(struct ifaddrs **);
int /*<<< orphan*/ inet_ntop(scalar_t__, int /*<<< orphan*/ *, char *, int);
int /*<<< orphan*/ printf(char *, char *);
int /*<<< orphan*/ strcmp(int /*<<< orphan*/, char *);
void printWlanIpPort() {
  struct ifaddrs *ifaddr = NULL;
  char host[INET_ADDRSTRLEN];
  getifaddrs(&ifaddr);
  for (struct ifaddrs *ifa = ifaddr; ifa != NULL; ifa = ifa->ifa_next) {
    if (!strcmp(ifa->ifa_name, "wlan0")) {
      if (ifa->ifa_addr->sa_family == AF_INET) {
        struct sockaddr_in *sa = (struct sockaddr_in *)ifa->ifa_addr;
        inet_ntop(AF_INET, &(sa->sin_addr), host, INET_ADDRSTRLEN);
        printf("WiFi: %s:2015 (74:DA:38:33:AF:EC)\n", host);
        break;
      }
    }
  }
  freeifaddrs(ifaddr);
}


x86 assembly (clang, -O0):
<printWlanIpPort>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movq   $0x0,-0x8(%rbp)
mov    0x2e71(%rip),%rax
mov    (%rax),%eax
mov    %rsp,%rcx
mov    %rcx,-0x10(%rbp)
mov    %rax,%rdx
add    $0xf,%rdx
and    $0xfffffffffffffff0,%rdx
mov    %rsp,%rcx
sub    %rdx,%rcx
mov    %rcx,-0x30(%rbp)
mov    %rcx,%rsp
mov    %rax,-0x18(%rbp)
lea    -0x8(%rbp),%rdi
call   1060 <getifaddrs@plt>
mov    -0x8(%rbp),%rax
mov    %rax,-0x20(%rbp)
cmpq   $0x0,-0x20(%rbp)
je     1239 <printWlanIpPort+0xe9>
mov    -0x20(%rbp),%rax
mov    0x8(%rax),%edi
lea    0xe4a(%rip),%rsi
call   1050 <strcmp@plt>
cmp    $0x0,%eax
jne    1223 <printWlanIpPort+0xd3>
mov    -0x20(%rbp),%rax
mov    (%rax),%rax
mov    (%rax),%rax
mov    0x2e13(%rip),%rcx
cmp    (%rcx),%rax
jne    121e <printWlanIpPort+0xce>
mov    -0x30(%rbp),%rdx
mov    -0x20(%rbp),%rax
mov    (%rax),%rax
mov    %rax,-0x28(%rbp)
mov    0x2df4(%rip),%rax
mov    (%rax),%rdi
mov    -0x28(%rbp),%rsi
mov    0x2dd6(%rip),%rax
mov    (%rax),%ecx
call   1030 <inet_ntop@plt>
mov    -0x30(%rbp),%rsi
lea    0xdf2(%rip),%rdi
call   1040 <printf@plt>
jmp    1239 <printWlanIpPort+0xe9>
jmp    1223 <printWlanIpPort+0xd3>
jmp    1228 <printWlanIpPort+0xd8>
mov    -0x20(%rbp),%rax
mov    0x10(%rax),%rax
mov    %rax,-0x20(%rbp)
jmp    119d <printWlanIpPort+0x4d>
mov    -0x8(%rbp),%rdi
call   1070 <freeifaddrs@plt>
mov    -0x10(%rbp),%rax
mov    %rax,%rsp
mov    %rbp,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<printWlanIpPort>:
push   %rbp
mov    %rsp,%rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
mov    %rsp,%r15
movq   $0x0,-0x30(%rbp)
mov    0x2e68(%rip),%rax
mov    (%rax),%eax
mov    %rsp,%r14
add    $0xf,%rax
and    $0xfffffffffffffff0,%rax
sub    %rax,%r14
mov    %r14,%rsp
lea    -0x30(%rbp),%rdi
call   1060 <getifaddrs@plt>
mov    -0x30(%rbp),%rbx
test   %rbx,%rbx
je     11f4 <printWlanIpPort+0xa4>
lea    0xe64(%rip),%r13
mov    0x2e45(%rip),%r12
jmp    11b9 <printWlanIpPort+0x69>
cs nopw 0x0(%rax,%rax,1)
nop
mov    0x10(%rbx),%rbx
test   %rbx,%rbx
je     11f4 <printWlanIpPort+0xa4>
mov    0x8(%rbx),%edi
mov    %r13,%rsi
call   1050 <strcmp@plt>
test   %eax,%eax
jne    11b0 <printWlanIpPort+0x60>
mov    (%rbx),%rsi
mov    (%rsi),%rdi
cmp    (%r12),%rdi
jne    11b0 <printWlanIpPort+0x60>
mov    0x2dfd(%rip),%rax
mov    (%rax),%ecx
mov    %r14,%rdx
call   1030 <inet_ntop@plt>
lea    0xe1a(%rip),%rdi
mov    %r14,%rsi
call   1040 <printf@plt>
mov    -0x30(%rbp),%rdi
call   1070 <freeifaddrs@plt>
mov    %r15,%rsp
lea    -0x28(%rbp),%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
%struct.ifaddrs = type { %struct.TYPE_2__*, i32, %struct.ifaddrs* }
%struct.TYPE_2__ = type { i64 }
%struct.sockaddr_in = type { i32 }
@INET_ADDRSTRLEN = global i32 0
@.str = [6 x i8] c"wlan0\00"
@AF_INET = global i64 0
@.str.1 = [35 x i8] c"WiFi: %s:2015 (74:DA:38:33:AF:EC)\0A\00"
define void @printWlanIpPort() {
%1 = alloca %struct.ifaddrs*
%2 = alloca i8*
%3 = alloca i64
%4 = alloca %struct.ifaddrs*
%5 = alloca %struct.sockaddr_in*
store %struct.ifaddrs* null, %struct.ifaddrs** %1
%6 = load i32, i32* @INET_ADDRSTRLEN
%7 = zext i32 %6 to i64
%8 = call i8* @llvm.stacksave()
store i8* %8, i8** %2
%9 = alloca i8, i64 %7
store i64 %7, i64* %3
%10 = call i32 @getifaddrs(%struct.ifaddrs** %1)
%11 = load %struct.ifaddrs*, %struct.ifaddrs** %1
store %struct.ifaddrs* %11, %struct.ifaddrs** %4
br label %12
12: ; preds = %42, %0
%13 = load %struct.ifaddrs*, %struct.ifaddrs** %4
%14 = icmp ne %struct.ifaddrs* %13, null
br i1 %14, label %15, label %46
15: ; preds = %12
%16 = load %struct.ifaddrs*, %struct.ifaddrs** %4
%17 = getelementptr inbounds %struct.ifaddrs, %struct.ifaddrs* %16, i32 0, i32 1
%18 = load i32, i32* %17
%19 = call i32 @strcmp(i32 %18, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0))
%20 = icmp ne i32 %19, 0
br i1 %20, label %41, label %21
21: ; preds = %15
%22 = load %struct.ifaddrs*, %struct.ifaddrs** %4
%23 = getelementptr inbounds %struct.ifaddrs, %struct.ifaddrs* %22, i32 0, i32 0
%24 = load %struct.TYPE_2__*, %struct.TYPE_2__** %23
%25 = getelementptr inbounds %struct.TYPE_2__, %struct.TYPE_2__* %24, i32 0, i32 0
%26 = load i64, i64* %25
%27 = load i64, i64* @AF_INET
%28 = icmp eq i64 %26, %27
br i1 %28, label %29, label %40
29: ; preds = %21
%30 = load %struct.ifaddrs*, %struct.ifaddrs** %4
%31 = getelementptr inbounds %struct.ifaddrs, %struct.ifaddrs* %30, i32 0, i32 0
%32 = load %struct.TYPE_2__*, %struct.TYPE_2__** %31
%33 = bitcast %struct.TYPE_2__* %32 to %struct.sockaddr_in*
store %struct.sockaddr_in* %33, %struct.sockaddr_in** %5
%34 = load i64, i64* @AF_INET
%35 = load %struct.sockaddr_in*, %struct.sockaddr_in** %5
%36 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %35, i32 0, i32 0
%37 = load i32, i32* @INET_ADDRSTRLEN
%38 = call i32 @inet_ntop(i64 %34, i32* %36, i8* %9, i32 %37)
%39 = call i32 @printf(i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str.1, i64 0, i64 0), i8* %9)
br label %46
40: ; preds = %21
br label %41
41: ; preds = %40, %15
br label %42
42: ; preds = %41
%43 = load %struct.ifaddrs*, %struct.ifaddrs** %4
%44 = getelementptr inbounds %struct.ifaddrs, %struct.ifaddrs* %43, i32 0, i32 2
%45 = load %struct.ifaddrs*, %struct.ifaddrs** %44
store %struct.ifaddrs* %45, %struct.ifaddrs** %4
br label %12
46: ; preds = %29, %12
%47 = load %struct.ifaddrs*, %struct.ifaddrs** %1
%48 = call i32 @freeifaddrs(%struct.ifaddrs* %47)
%49 = load i8*, i8** %2
ret void
}

LLVM IR (-O2):
%struct.ifaddrs = type { %struct.TYPE_2__*, i32, %struct.ifaddrs* }
%struct.TYPE_2__ = type { i64 }
@INET_ADDRSTRLEN = global i32 0
@.str = [6 x i8] c"wlan0\00"
@AF_INET = global i64 0
@.str.1 = [35 x i8] c"WiFi: %s:2015 (74:DA:38:33:AF:EC)\0A\00"
define void @printWlanIpPort() {
%1 = alloca %struct.ifaddrs*
%2 = bitcast %struct.ifaddrs** %1 to i8*
store %struct.ifaddrs* null, %struct.ifaddrs** %1
%3 = load i32, i32* @INET_ADDRSTRLEN
%4 = zext i32 %3 to i64
%5 = tail call i8* @llvm.stacksave()
%6 = alloca i8, i64 %4
%7 = call i32 @getifaddrs(%struct.ifaddrs** %1)
%8 = load %struct.ifaddrs*, %struct.ifaddrs** %1
%9 = icmp eq %struct.ifaddrs* %8, null
br i1 %9, label %32, label %10
10: ; preds = %0, %28
%11 = phi %struct.ifaddrs* [ %30, %28 ], [ %8, %0 ]
%12 = getelementptr inbounds %struct.ifaddrs, %struct.ifaddrs* %11, i64 0, i32 1
%13 = load i32, i32* %12
%14 = call i32 @strcmp(i32 %13, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0))
%15 = icmp eq i32 %14, 0
br i1 %15, label %16, label %28
16: ; preds = %10
%17 = getelementptr inbounds %struct.ifaddrs, %struct.ifaddrs* %11, i64 0, i32 0
%18 = load %struct.TYPE_2__*, %struct.TYPE_2__** %17
%19 = getelementptr inbounds %struct.TYPE_2__, %struct.TYPE_2__* %18, i64 0, i32 0
%20 = load i64, i64* %19
%21 = load i64, i64* @AF_INET
%22 = icmp eq i64 %20, %21
br i1 %22, label %23, label %28
23: ; preds = %16
%24 = bitcast %struct.TYPE_2__* %18 to i32*
%25 = load i32, i32* @INET_ADDRSTRLEN
%26 = call i32 @inet_ntop(i64 %20, i32* %24, i8* %6, i32 %25)
%27 = call i32 @printf(i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str.1, i64 0, i64 0), i8* %6)
br label %32
28: ; preds = %10, %16
%29 = getelementptr inbounds %struct.ifaddrs, %struct.ifaddrs* %11, i64 0, i32 2
%30 = load %struct.ifaddrs*, %struct.ifaddrs** %29
%31 = icmp eq %struct.ifaddrs* %30, null
br i1 %31, label %32, label %10
32: ; preds = %28, %0, %23
%33 = load %struct.ifaddrs*, %struct.ifaddrs** %1
%34 = call i32 @freeifaddrs(%struct.ifaddrs* %33)
ret void
}