#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 */

/* Type definitions */
struct hv_kvp_ipaddr_value {
  scalar_t__ ip_addr;
  scalar_t__ adapter_id;
};
struct dirent {
  char *d_name;
};
typedef int /*<<< orphan*/ dev_id;
typedef int /*<<< orphan*/ buf;
typedef int /*<<< orphan*/ FILE;
typedef int /*<<< orphan*/ DIR;

/* Variables and functions */
int HV_E_FAIL;
int /*<<< orphan*/ KVP_OP_GET_IP_INFO;
int MAX_IP_ADDR_SIZE;
int PATH_MAX;
int /*<<< orphan*/ closedir(int /*<<< orphan*/ *);
int /*<<< orphan*/ fclose(int /*<<< orphan*/ *);
char *fgets(char *, int, int /*<<< orphan*/ *);
int /*<<< orphan*/ *fopen(char *, char *);
int kvp_get_ip_info(int /*<<< orphan*/, char *, int /*<<< orphan*/,
                    struct hv_kvp_ipaddr_value *, int);
int /*<<< orphan*/ *opendir(char *);
struct dirent *readdir(int /*<<< orphan*/ *);
int /*<<< orphan*/ snprintf(char *, int, char *, char *, char *);
char *strchr(char *, char);
scalar_t__ strcmp(char *, char *);
unsigned int strlen(char *);
char toupper(char);
int kvp_mac_to_ip(struct hv_kvp_ipaddr_value *kvp_ip_val) {
  char *mac = (char *)kvp_ip_val->adapter_id;
  DIR *dir;
  struct dirent *entry;
  FILE *file;
  char *p, *x;
  char *if_name = NULL;
  char buf[256];
  char dev_id[PATH_MAX];
  unsigned int i;
  int error = HV_E_FAIL;
  dir = opendir("/sys/class/net/");
  if (dir == NULL)
    return HV_E_FAIL;
  while ((entry = readdir(dir)) != NULL) {
    snprintf(dev_id, sizeof(dev_id), "%s%s/address", "/sys/class/net/",
             entry->d_name);
    file = fopen(dev_id, "r");
    if (file == NULL)
      continue;
    p = fgets(buf, sizeof(buf), file);
    fclose(file);
    if (!p)
      continue;
    x = strchr(p, '\n');
    if (x)
      *x = '\0';
    for (i = 0; i < strlen(p); i++)
      p[i] = toupper(p[i]);
    if (strcmp(p, mac))
      continue;
    if_name = entry->d_name;
    if (!if_name)
      continue;
    error = kvp_get_ip_info(0, if_name, KVP_OP_GET_IP_INFO, kvp_ip_val,
                            MAX_IP_ADDR_SIZE * 2);
    if (!error && strlen((char *)kvp_ip_val->ip_addr))
      break;
  }
  closedir(dir);
  return error;
}


x86 assembly (clang, -O0):
<kvp_mac_to_ip>:
push   %rbp
mov    %rsp,%rbp
sub    $0x190,%rsp
mov    %rdi,-0x10(%rbp)
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rax
mov    %rax,-0x18(%rbp)
movq   $0x0,-0x48(%rbp)
mov    0x2e06(%rip),%rax
mov    (%rax),%eax
mov    %rax,-0x180(%rbp)
mov    %rsp,%rcx
mov    %rcx,-0x158(%rbp)
mov    %rax,%rdx
add    $0xf,%rdx
and    $0xfffffffffffffff0,%rdx
mov    %rsp,%rcx
sub    %rdx,%rcx
mov    %rcx,-0x178(%rbp)
mov    %rcx,%rsp
mov    %rax,-0x160(%rbp)
mov    0x2db2(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x168(%rbp)
lea    0xdcb(%rip),%rdi
call   1050 <opendir@plt>
mov    %rax,-0x20(%rbp)
cmpq   $0x0,-0x20(%rbp)
jne    1264 <kvp_mac_to_ip+0xa4>
mov    0x2d88(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x4(%rbp)
movl   $0x1,-0x16c(%rbp)
jmp    1437 <kvp_mac_to_ip+0x277>
jmp    1269 <kvp_mac_to_ip+0xa9>
mov    -0x20(%rbp),%rdi
call   10d0 <readdir@plt>
mov    %rax,-0x28(%rbp)
cmp    $0x0,%rax
je     141b <kvp_mac_to_ip+0x25b>
mov    -0x178(%rbp),%rdi
mov    -0x180(%rbp),%rax
mov    %eax,%esi
mov    -0x28(%rbp),%rax
mov    (%rax),%r8
lea    0xd72(%rip),%rdx
lea    0xd5b(%rip),%rcx
call   1090 <snprintf@plt>
mov    -0x178(%rbp),%rdi
lea    0xd65(%rip),%rsi
call   10e0 <fopen@plt>
mov    %rax,-0x30(%rbp)
cmpq   $0x0,-0x30(%rbp)
jne    12d1 <kvp_mac_to_ip+0x111>
jmp    1269 <kvp_mac_to_ip+0xa9>
lea    -0x150(%rbp),%rdi
mov    -0x30(%rbp),%rdx
mov    $0x100,%esi
call   10b0 <fgets@plt>
mov    %rax,-0x38(%rbp)
mov    -0x30(%rbp),%rdi
call   1040 <fclose@plt>
cmpq   $0x0,-0x38(%rbp)
jne    1303 <kvp_mac_to_ip+0x143>
jmp    1269 <kvp_mac_to_ip+0xa9>
mov    -0x38(%rbp),%rdi
mov    $0xa,%esi
call   1080 <strchr@plt>
mov    %rax,-0x40(%rbp)
cmpq   $0x0,-0x40(%rbp)
je     1327 <kvp_mac_to_ip+0x167>
mov    -0x40(%rbp),%rax
movb   $0x0,(%rax)
movl   $0x0,-0x164(%rbp)
mov    -0x164(%rbp),%eax
mov    %eax,-0x184(%rbp)
mov    -0x38(%rbp),%rdi
call   1060 <strlen@plt>
mov    %eax,%ecx
mov    -0x184(%rbp),%eax
cmp    %ecx,%eax
jae    138c <kvp_mac_to_ip+0x1cc>
mov    -0x38(%rbp),%rax
mov    -0x164(%rbp),%ecx
movsbl (%rax,%rcx,1),%edi
call   1030 <toupper@plt>
mov    %al,%dl
mov    -0x38(%rbp),%rax
mov    -0x164(%rbp),%ecx
mov    %dl,(%rax,%rcx,1)
mov    -0x164(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x164(%rbp)
jmp    1331 <kvp_mac_to_ip+0x171>
mov    -0x38(%rbp),%rdi
mov    -0x18(%rbp),%rsi
call   10c0 <strcmp@plt>
cmp    $0x0,%rax
je     13a8 <kvp_mac_to_ip+0x1e8>
jmp    1269 <kvp_mac_to_ip+0xa9>
mov    -0x28(%rbp),%rax
mov    (%rax),%rax
mov    %rax,-0x48(%rbp)
cmpq   $0x0,-0x48(%rbp)
jne    13c3 <kvp_mac_to_ip+0x203>
jmp    1269 <kvp_mac_to_ip+0xa9>
mov    -0x48(%rbp),%rsi
mov    0x2c02(%rip),%rax
mov    (%rax),%edx
mov    -0x10(%rbp),%rcx
mov    0x2bed(%rip),%rax
mov    (%rax),%r8d
shl    $0x1,%r8d
xor    %edi,%edi
call   1070 <kvp_get_ip_info@plt>
mov    %eax,-0x168(%rbp)
cmpl   $0x0,-0x168(%rbp)
jne    1416 <kvp_mac_to_ip+0x256>
mov    -0x10(%rbp),%rax
mov    (%rax),%rdi
call   1060 <strlen@plt>
cmp    $0x0,%eax
je     1416 <kvp_mac_to_ip+0x256>
jmp    141b <kvp_mac_to_ip+0x25b>
jmp    1269 <kvp_mac_to_ip+0xa9>
mov    -0x20(%rbp),%rdi
call   10a0 <closedir@plt>
mov    -0x168(%rbp),%eax
mov    %eax,-0x4(%rbp)
movl   $0x1,-0x16c(%rbp)
mov    -0x158(%rbp),%rax
mov    %rax,%rsp
mov    -0x4(%rbp),%eax
mov    %rbp,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<kvp_mac_to_ip>:
push   %rbp
mov    %rsp,%rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x138,%rsp
mov    %rdi,%r12
mov    %rsp,%rbx
mov    0x8(%rdi),%rax
mov    %rax,-0x58(%rbp)
mov    0x2e07(%rip),%rax
mov    (%rax),%eax
mov    %rsp,%r14
mov    %rax,-0x48(%rbp)
add    $0xf,%rax
and    $0xfffffffffffffff0,%rax
sub    %rax,%r14
mov    %r14,%rsp
mov    0x2dd1(%rip),%r15
mov    (%r15),%r13d
lea    0xdef(%rip),%rdi
call   1050 <opendir@plt>
test   %rax,%rax
je     138c <kvp_mac_to_ip+0x1cc>
mov    %rax,-0x38(%rbp)
mov    %rax,%rdi
call   10d0 <readdir@plt>
test   %rax,%rax
je     1381 <kvp_mac_to_ip+0x1c1>
mov    %rax,%r15
mov    %rbx,-0x30(%rbp)
mov    %r12,-0x50(%rbp)
mov    %r13d,-0x3c(%rbp)
mov    -0x48(%rbp),%rbx
jmp    1265 <kvp_mac_to_ip+0xa5>
nopl   0x0(%rax)
mov    -0x38(%rbp),%rdi
call   10d0 <readdir@plt>
mov    %rax,%r15
test   %rax,%rax
je     1379 <kvp_mac_to_ip+0x1b9>
mov    (%r15),%r8
mov    %r14,%rdi
mov    %ebx,%esi
lea    0xd9c(%rip),%rdx
lea    0xd85(%rip),%rcx
call   1090 <snprintf@plt>
mov    %r14,%rdi
lea    0xd93(%rip),%rsi
call   10e0 <fopen@plt>
test   %rax,%rax
je     1250 <kvp_mac_to_ip+0x90>
mov    %rax,%r13
lea    -0x160(%rbp),%rdi
mov    $0x100,%esi
mov    %rax,%rdx
call   10b0 <fgets@plt>
mov    %rax,%r12
mov    %r13,%rdi
call   1040 <fclose@plt>
test   %r12,%r12
je     1250 <kvp_mac_to_ip+0x90>
mov    %r12,%rdi
mov    $0xa,%esi
call   1080 <strchr@plt>
test   %rax,%rax
je     12d0 <kvp_mac_to_ip+0x110>
movb   $0x0,(%rax)
mov    %r12,%rdi
call   1060 <strlen@plt>
test   %eax,%eax
je     1301 <kvp_mac_to_ip+0x141>
xor    %ebx,%ebx
xchg   %ax,%ax
movsbl (%r12,%rbx,1),%edi
call   1030 <toupper@plt>
mov    %al,(%r12,%rbx,1)
add    $0x1,%rbx
mov    %r12,%rdi
call   1060 <strlen@plt>
mov    %eax,%eax
cmp    %rax,%rbx
jb     12e0 <kvp_mac_to_ip+0x120>
mov    %r12,%rdi
mov    -0x58(%rbp),%rsi
call   10c0 <strcmp@plt>
test   %rax,%rax
mov    -0x48(%rbp),%rbx
jne    1250 <kvp_mac_to_ip+0x90>
mov    (%r15),%rsi
test   %rsi,%rsi
je     1250 <kvp_mac_to_ip+0x90>
mov    0x2ca3(%rip),%rax
mov    (%rax),%edx
mov    0x2c92(%rip),%rax
mov    (%rax),%r8d
add    %r8d,%r8d
xor    %edi,%edi
mov    -0x50(%rbp),%r12
mov    %r12,%rcx
call   1070 <kvp_get_ip_info@plt>
mov    %eax,%r13d
test   %eax,%eax
jne    135e <kvp_mac_to_ip+0x19e>
mov    (%r12),%rdi
call   1060 <strlen@plt>
test   %eax,%eax
jne    13a4 <kvp_mac_to_ip+0x1e4>
mov    -0x38(%rbp),%rdi
call   10d0 <readdir@plt>
mov    %rax,%r15
test   %rax,%rax
mov    -0x30(%rbp),%rbx
jne    123f <kvp_mac_to_ip+0x7f>
jmp    1381 <kvp_mac_to_ip+0x1c1>
mov    -0x30(%rbp),%rbx
mov    -0x3c(%rbp),%r13d
mov    -0x38(%rbp),%rdi
call   10a0 <closedir@plt>
jmp    138f <kvp_mac_to_ip+0x1cf>
mov    (%r15),%r13d
mov    %rbx,%rsp
mov    %r13d,%eax
lea    -0x28(%rbp),%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
xor    %r13d,%r13d
mov    -0x30(%rbp),%rbx
jmp    1381 <kvp_mac_to_ip+0x1c1>

LLVM IR (-O0):
%struct.hv_kvp_ipaddr_value = type { i64, i64 }
%struct.dirent = type { i8* }
@PATH_MAX = global i32 0
@HV_E_FAIL = global i32 0
@.str = [16 x i8] c"/sys/class/net/\00"
@.str.1 = [13 x i8] c"%s%s/address\00"
@.str.2 = [2 x i8] c"r\00"
@KVP_OP_GET_IP_INFO = global i32 0
@MAX_IP_ADDR_SIZE = global i32 0
define i32 @kvp_mac_to_ip(%struct.hv_kvp_ipaddr_value* %0) {
%2 = alloca i32
%3 = alloca %struct.hv_kvp_ipaddr_value*
%4 = alloca i8*
%5 = alloca i32*
%6 = alloca %struct.dirent*
%7 = alloca i32*
%8 = alloca i8*
%9 = alloca i8*
%10 = alloca i8*
%11 = alloca [256 x i8]
%12 = alloca i8*
%13 = alloca i64
%14 = alloca i32
%15 = alloca i32
%16 = alloca i32
store %struct.hv_kvp_ipaddr_value* %0, %struct.hv_kvp_ipaddr_value** %3
%17 = load %struct.hv_kvp_ipaddr_value*, %struct.hv_kvp_ipaddr_value** %3
%18 = getelementptr inbounds %struct.hv_kvp_ipaddr_value, %struct.hv_kvp_ipaddr_value* %17, i32 0, i32 1
%19 = load i64, i64* %18
%20 = inttoptr i64 %19 to i8*
store i8* %20, i8** %4
store i8* null, i8** %10
%21 = load i32, i32* @PATH_MAX
%22 = zext i32 %21 to i64
%23 = call i8* @llvm.stacksave()
store i8* %23, i8** %12
%24 = alloca i8, i64 %22
store i64 %22, i64* %13
%25 = load i32, i32* @HV_E_FAIL
store i32 %25, i32* %15
%26 = call i32* @opendir(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str, i64 0, i64 0))
store i32* %26, i32** %5
%27 = load i32*, i32** %5
%28 = icmp eq i32* %27, null
br i1 %28, label %29, label %31
29: ; preds = %1
%30 = load i32, i32* @HV_E_FAIL
store i32 %30, i32* %2
store i32 1, i32* %16
br label %117
31: ; preds = %1
br label %32
32: ; preds = %112, %94, %87, %54, %45, %31
%33 = load i32*, i32** %5
%34 = call %struct.dirent* @readdir(i32* %33)
store %struct.dirent* %34, %struct.dirent** %6
%35 = icmp ne %struct.dirent* %34, null
br i1 %35, label %36, label %113
36: ; preds = %32
%37 = trunc i64 %22 to i32
%38 = load %struct.dirent*, %struct.dirent** %6
%39 = getelementptr inbounds %struct.dirent, %struct.dirent* %38, i32 0, i32 0
%40 = load i8*, i8** %39
%41 = call i32 @snprintf(i8* %24, i32 %37, i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str, i64 0, i64 0), i8* %40)
%42 = call i32* @fopen(i8* %24, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
store i32* %42, i32** %7
%43 = load i32*, i32** %7
%44 = icmp eq i32* %43, null
br i1 %44, label %45, label %46
45: ; preds = %36
br label %32
46: ; preds = %36
%47 = getelementptr inbounds [256 x i8], [256 x i8]* %11, i64 0, i64 0
%48 = load i32*, i32** %7
%49 = call i8* @fgets(i8* %47, i32 256, i32* %48)
store i8* %49, i8** %8
%50 = load i32*, i32** %7
%51 = call i32 @fclose(i32* %50)
%52 = load i8*, i8** %8
%53 = icmp ne i8* %52, null
br i1 %53, label %55, label %54
54: ; preds = %46
br label %32
55: ; preds = %46
%56 = load i8*, i8** %8
%57 = call i8* @strchr(i8* %56, i8 signext 10)
store i8* %57, i8** %9
%58 = load i8*, i8** %9
%59 = icmp ne i8* %58, null
br i1 %59, label %60, label %62
60: ; preds = %55
%61 = load i8*, i8** %9
store i8 0, i8* %61
br label %62
62: ; preds = %60, %55
store i32 0, i32* %14
br label %63
63: ; preds = %79, %62
%64 = load i32, i32* %14
%65 = load i8*, i8** %8
%66 = call i32 @strlen(i8* %65)
%67 = icmp ult i32 %64, %66
br i1 %67, label %68, label %82
68: ; preds = %63
%69 = load i8*, i8** %8
%70 = load i32, i32* %14
%71 = zext i32 %70 to i64
%72 = getelementptr inbounds i8, i8* %69, i64 %71
%73 = load i8, i8* %72
%74 = call signext i8 @toupper(i8 signext %73)
%75 = load i8*, i8** %8
%76 = load i32, i32* %14
%77 = zext i32 %76 to i64
%78 = getelementptr inbounds i8, i8* %75, i64 %77
store i8 %74, i8* %78
br label %79
79: ; preds = %68
%80 = load i32, i32* %14
%81 = add i32 %80, 1
store i32 %81, i32* %14
br label %63
82: ; preds = %63
%83 = load i8*, i8** %8
%84 = load i8*, i8** %4
%85 = call i64 @strcmp(i8* %83, i8* %84)
%86 = icmp ne i64 %85, 0
br i1 %86, label %87, label %88
87: ; preds = %82
br label %32
88: ; preds = %82
%89 = load %struct.dirent*, %struct.dirent** %6
%90 = getelementptr inbounds %struct.dirent, %struct.dirent* %89, i32 0, i32 0
%91 = load i8*, i8** %90
store i8* %91, i8** %10
%92 = load i8*, i8** %10
%93 = icmp ne i8* %92, null
br i1 %93, label %95, label %94
94: ; preds = %88
br label %32
95: ; preds = %88
%96 = load i8*, i8** %10
%97 = load i32, i32* @KVP_OP_GET_IP_INFO
%98 = load %struct.hv_kvp_ipaddr_value*, %struct.hv_kvp_ipaddr_value** %3
%99 = load i32, i32* @MAX_IP_ADDR_SIZE
%100 = mul nsw i32 %99, 2
%101 = call i32 @kvp_get_ip_info(i32 0, i8* %96, i32 %97, %struct.hv_kvp_ipaddr_value* %98, i32 %100)
store i32 %101, i32* %15
%102 = load i32, i32* %15
%103 = icmp ne i32 %102, 0
br i1 %103, label %112, label %104
104: ; preds = %95
%105 = load %struct.hv_kvp_ipaddr_value*, %struct.hv_kvp_ipaddr_value** %3
%106 = getelementptr inbounds %struct.hv_kvp_ipaddr_value, %struct.hv_kvp_ipaddr_value* %105, i32 0, i32 0
%107 = load i64, i64* %106
%108 = inttoptr i64 %107 to i8*
%109 = call i32 @strlen(i8* %108)
%110 = icmp ne i32 %109, 0
br i1 %110, label %111, label %112
111: ; preds = %104
br label %113
112: ; preds = %104, %95
br label %32
113: ; preds = %111, %32
%114 = load i32*, i32** %5
%115 = call i32 @closedir(i32* %114)
%116 = load i32, i32* %15
store i32 %116, i32* %2
store i32 1, i32* %16
br label %117
117: ; preds = %113, %29
%118 = load i8*, i8** %12
%119 = load i32, i32* %2
ret i32 %119
}

LLVM IR (-O2):
%struct.hv_kvp_ipaddr_value = type { i64, i64 }
%struct.dirent = type { i8* }
@PATH_MAX = global i32 0
@HV_E_FAIL = global i32 0
@.str = [16 x i8] c"/sys/class/net/\00"
@.str.1 = [13 x i8] c"%s%s/address\00"
@.str.2 = [2 x i8] c"r\00"
@KVP_OP_GET_IP_INFO = global i32 0
@MAX_IP_ADDR_SIZE = global i32 0
define i32 @kvp_mac_to_ip(%struct.hv_kvp_ipaddr_value* %0) {
%2 = alloca [256 x i8]
%3 = getelementptr inbounds %struct.hv_kvp_ipaddr_value, %struct.hv_kvp_ipaddr_value* %0, i64 0, i32 1
%4 = load i64, i64* %3
%5 = inttoptr i64 %4 to i8*
%6 = getelementptr inbounds [256 x i8], [256 x i8]* %2, i64 0, i64 0
%7 = load i32, i32* @PATH_MAX
%8 = zext i32 %7 to i64
%9 = tail call i8* @llvm.stacksave()
%10 = alloca i8, i64 %8
%11 = load i32, i32* @HV_E_FAIL
%12 = tail call i32* @opendir(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str, i64 0, i64 0))
%13 = icmp eq i32* %12, null
br i1 %13, label %19, label %14
14: ; preds = %1
%15 = call %struct.dirent* @readdir(i32* %12)
%16 = icmp eq %struct.dirent* %15, null
br i1 %16, label %74, label %17
17: ; preds = %14
%18 = getelementptr inbounds %struct.hv_kvp_ipaddr_value, %struct.hv_kvp_ipaddr_value* %0, i64 0, i32 0
br label %71
19: ; preds = %1
%20 = load i32, i32* @HV_E_FAIL
br label %77
21: ; preds = %71, %28
%22 = phi %struct.dirent* [ %72, %71 ], [ %29, %28 ]
%23 = getelementptr inbounds %struct.dirent, %struct.dirent* %22, i64 0, i32 0
%24 = load i8*, i8** %23
%25 = call i32 @snprintf(i8* %10, i32 %7, i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str, i64 0, i64 0), i8* %24)
%26 = call i32* @fopen(i8* %10, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
%27 = icmp eq i32* %26, null
br i1 %27, label %28, label %31
28: ; preds = %21, %31, %51, %54
%29 = call %struct.dirent* @readdir(i32* %12)
%30 = icmp eq %struct.dirent* %29, null
br i1 %30, label %74, label %21
31: ; preds = %21
%32 = call i8* @fgets(i8* %6, i32 256, i32* %26)
%33 = call i32 @fclose(i32* %26)
%34 = icmp eq i8* %32, null
br i1 %34, label %28, label %35
35: ; preds = %31
%36 = call i8* @strchr(i8* %32, i8 signext 10)
%37 = icmp eq i8* %36, null
br i1 %37, label %39, label %38
38: ; preds = %35
store i8 0, i8* %36
br label %39
39: ; preds = %38, %35
%40 = call i32 @strlen(i8* %32)
%41 = icmp eq i32 %40, 0
br i1 %41, label %51, label %42
42: ; preds = %39, %42
%43 = phi i64 [ %47, %42 ], [ 0, %39 ]
%44 = getelementptr inbounds i8, i8* %32, i64 %43
%45 = load i8, i8* %44
%46 = call signext i8 @toupper(i8 signext %45)
store i8 %46, i8* %44
%47 = add nuw nsw i64 %43, 1
%48 = call i32 @strlen(i8* %32)
%49 = zext i32 %48 to i64
%50 = icmp ult i64 %47, %49
br i1 %50, label %42, label %51
51: ; preds = %42, %39
%52 = call i64 @strcmp(i8* %32, i8* %5)
%53 = icmp eq i64 %52, 0
br i1 %53, label %54, label %28
54: ; preds = %51
%55 = load i8*, i8** %23
%56 = icmp eq i8* %55, null
br i1 %56, label %28, label %57
57: ; preds = %54
%58 = load i32, i32* @KVP_OP_GET_IP_INFO
%59 = load i32, i32* @MAX_IP_ADDR_SIZE
%60 = shl nsw i32 %59, 1
%61 = call i32 @kvp_get_ip_info(i32 0, i8* %55, i32 %58, %struct.hv_kvp_ipaddr_value* %0, i32 %60)
%62 = icmp eq i32 %61, 0
br i1 %62, label %63, label %68
63: ; preds = %57
%64 = load i64, i64* %18
%65 = inttoptr i64 %64 to i8*
%66 = call i32 @strlen(i8* %65)
%67 = icmp eq i32 %66, 0
br i1 %67, label %68, label %74
68: ; preds = %63, %57
%69 = call %struct.dirent* @readdir(i32* %12)
%70 = icmp eq %struct.dirent* %69, null
br i1 %70, label %74, label %71
71: ; preds = %17, %68
%72 = phi %struct.dirent* [ %15, %17 ], [ %69, %68 ]
%73 = phi i32 [ %11, %17 ], [ %61, %68 ]
br label %21
74: ; preds = %63, %68, %28, %14
%75 = phi i32 [ %11, %14 ], [ %73, %28 ], [ %61, %68 ], [ 0, %63 ]
%76 = call i32 @closedir(i32* %12)
br label %77
77: ; preds = %74, %19
%78 = phi i32 [ %20, %19 ], [ %75, %74 ]
ret i32 %78
}