#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 dirent {
  char *d_name;
};
typedef int /*<<< orphan*/ name;
typedef int /*<<< orphan*/ filename;
typedef int /*<<< orphan*/ buffer;
typedef int /*<<< orphan*/ FILE;
typedef int /*<<< orphan*/ DIR;

/* Variables and functions */
int errno;
int /*<<< orphan*/ fclose(int /*<<< orphan*/ *);
int /*<<< orphan*/ *fgets(char *, int, int /*<<< orphan*/ *);
int /*<<< orphan*/ *fopen(char *, char *);
int /*<<< orphan*/ isdigit(char);
int /*<<< orphan*/ memset(char *, int /*<<< orphan*/, int);
int /*<<< orphan*/ *opendir(char *);
int /*<<< orphan*/ printf(char *, int);
struct dirent *readdir(int /*<<< orphan*/ *);
long *realloc(long *, int);
int /*<<< orphan*/ snprintf(char *, int, char *, char *);
int /*<<< orphan*/ sscanf(char *, char *, char *);
scalar_t__ strcmp(char *, char *);
long strtol(char *, int /*<<< orphan*/ *, int /*<<< orphan*/);
long *find_pid_by_name(char *pidName) {
  DIR *dir = NULL;
  struct dirent *next = NULL;
  long *pidList = NULL;
  FILE *status = NULL;
  char filename[(1024)] = {0};
  char buffer[(1024)] = {0};
  char name[(1024)] = {0};
  int i = 0;
  if (NULL == pidName) {
    return NULL;
  }
  dir = opendir("/proc");
  if (!dir) {
    printf("Open /proc failed. errno = %d.\n", errno);
    return NULL;
  }
  while ((next = readdir(dir)) != NULL) {
    if (strcmp(next->d_name, "..") == 0) {
      continue;
    }
    if (!isdigit(*next->d_name)) {
      continue;
    }
    memset(filename, 0, sizeof(filename));
    snprintf(filename, sizeof(filename), "/proc/%s/status", next->d_name);
    if (!(status = fopen(filename, "r"))) {
      continue;
    }
    memset(buffer, 0, sizeof(buffer));
    if (fgets(buffer, (1024) - 1, status) == NULL) {
      fclose(status);
      continue;
    }
    fclose(status);
    memset(name, 0, sizeof(name));
    sscanf(buffer, "%*s %s", name);
    if (strcmp(name, pidName) == 0) {
      pidList = realloc(pidList, sizeof(long) * (i + 2));
      pidList[i++] = strtol(next->d_name, NULL, 0);
    }
  }
  if (pidList) {
    pidList[i] = 0;
  } else {
    pidList = realloc(pidList, sizeof(long));
    pidList[0] = -1;
  }
  return pidList;
}


x86 assembly (clang, -O0):
<find_pid_by_name>:
push   %rbp
mov    %rsp,%rbp
sub    $0xc40,%rsp
mov    %rdi,-0x10(%rbp)
movq   $0x0,-0x18(%rbp)
movq   $0x0,-0x20(%rbp)
movq   $0x0,-0x28(%rbp)
movq   $0x0,-0x30(%rbp)
lea    -0x430(%rbp),%rdi
xor    %esi,%esi
mov    $0x400,%edx
call   1080 <memset@plt>
lea    -0x830(%rbp),%rdi
xor    %esi,%esi
mov    $0x400,%edx
call   1080 <memset@plt>
lea    -0xc30(%rbp),%rdi
xor    %esi,%esi
mov    $0x400,%edx
call   1080 <memset@plt>
movl   $0x0,-0xc34(%rbp)
xor    %eax,%eax
cmp    -0x10(%rbp),%rax
jne    125b <find_pid_by_name+0x8b>
movq   $0x0,-0x8(%rbp)
jmp    1477 <find_pid_by_name+0x2a7>
lea    0xd9e(%rip),%rdi
call   1050 <opendir@plt>
mov    %rax,-0x18(%rbp)
cmpq   $0x0,-0x18(%rbp)
jne    1298 <find_pid_by_name+0xc8>
mov    0x2d63(%rip),%rax
mov    (%rax),%esi
lea    0xd80(%rip),%rdi
call   1060 <printf@plt>
movq   $0x0,-0x8(%rbp)
jmp    1477 <find_pid_by_name+0x2a7>
jmp    129d <find_pid_by_name+0xcd>
mov    -0x18(%rbp),%rdi
call   10c0 <readdir@plt>
mov    %rax,-0x20(%rbp)
cmp    $0x0,%rax
je     142f <find_pid_by_name+0x25f>
mov    -0x20(%rbp),%rax
mov    (%rax),%rdi
lea    0xd64(%rip),%rsi
call   10a0 <strcmp@plt>
cmp    $0x0,%rax
jne    12d6 <find_pid_by_name+0x106>
jmp    129d <find_pid_by_name+0xcd>
mov    -0x20(%rbp),%rax
mov    (%rax),%rax
movsbl (%rax),%edi
call   1030 <isdigit@plt>
cmp    $0x0,%eax
jne    12f3 <find_pid_by_name+0x123>
jmp    129d <find_pid_by_name+0xcd>
lea    -0x430(%rbp),%rdi
xor    %esi,%esi
mov    $0x400,%edx
call   1080 <memset@plt>
lea    -0x430(%rbp),%rdi
mov    -0x20(%rbp),%rax
mov    (%rax),%rcx
mov    $0x400,%esi
lea    0xd09(%rip),%rdx
call   1070 <snprintf@plt>
lea    -0x430(%rbp),%rdi
lea    0xd06(%rip),%rsi
call   10f0 <fopen@plt>
mov    %rax,-0x30(%rbp)
cmp    $0x0,%rax
jne    134b <find_pid_by_name+0x17b>
jmp    129d <find_pid_by_name+0xcd>
lea    -0x830(%rbp),%rdi
xor    %esi,%esi
mov    $0x400,%edx
call   1080 <memset@plt>
lea    -0x830(%rbp),%rdi
mov    -0x30(%rbp),%rdx
mov    $0x3ff,%esi
call   1090 <fgets@plt>
cmp    $0x0,%rax
jne    138b <find_pid_by_name+0x1bb>
mov    -0x30(%rbp),%rdi
call   1040 <fclose@plt>
jmp    129d <find_pid_by_name+0xcd>
mov    -0x30(%rbp),%rdi
call   1040 <fclose@plt>
lea    -0xc30(%rbp),%rdi
xor    %esi,%esi
mov    $0x400,%edx
call   1080 <memset@plt>
lea    -0x830(%rbp),%rdi
lea    -0xc30(%rbp),%rdx
lea    0xc7f(%rip),%rsi
call   10d0 <sscanf@plt>
lea    -0xc30(%rbp),%rdi
mov    -0x10(%rbp),%rsi
call   10a0 <strcmp@plt>
cmp    $0x0,%rax
jne    142a <find_pid_by_name+0x25a>
mov    -0x28(%rbp),%rdi
mov    -0xc34(%rbp),%eax
add    $0x2,%eax
cltq
shl    $0x3,%rax
mov    %eax,%esi
call   10e0 <realloc@plt>
mov    %rax,-0x28(%rbp)
mov    -0x20(%rbp),%rax
mov    (%rax),%rdi
xor    %eax,%eax
mov    %eax,%esi
xor    %edx,%edx
call   10b0 <strtol@plt>
mov    %rax,%rdx
mov    -0x28(%rbp),%rax
mov    -0xc34(%rbp),%ecx
mov    %ecx,%esi
add    $0x1,%esi
mov    %esi,-0xc34(%rbp)
movslq %ecx,%rcx
mov    %rdx,(%rax,%rcx,8)
jmp    129d <find_pid_by_name+0xcd>
cmpq   $0x0,-0x28(%rbp)
je     1452 <find_pid_by_name+0x282>
mov    -0x28(%rbp),%rax
movslq -0xc34(%rbp),%rcx
movq   $0x0,(%rax,%rcx,8)
jmp    146f <find_pid_by_name+0x29f>
mov    -0x28(%rbp),%rdi
mov    $0x8,%esi
call   10e0 <realloc@plt>
mov    %rax,-0x28(%rbp)
mov    -0x28(%rbp),%rax
movq   $0xffffffffffffffff,(%rax)
mov    -0x28(%rbp),%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
add    $0xc40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<find_pid_by_name>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0xc28,%rsp
mov    %rdi,%rbp
lea    0x820(%rsp),%rdi
xor    %ebx,%ebx
mov    $0x400,%edx
xor    %esi,%esi
call   1080 <memset@plt>
lea    0x20(%rsp),%rdi
mov    $0x400,%edx
xor    %esi,%esi
call   1080 <memset@plt>
lea    0x420(%rsp),%rdi
mov    $0x400,%edx
xor    %esi,%esi
call   1080 <memset@plt>
test   %rbp,%rbp
je     13f8 <find_pid_by_name+0x228>
lea    0xdd1(%rip),%rdi
call   1050 <opendir@plt>
test   %rax,%rax
je     13e1 <find_pid_by_name+0x211>
mov    %rax,%r12
mov    %rax,%rdi
call   10c0 <readdir@plt>
test   %rax,%rax
je     13c9 <find_pid_by_name+0x1f9>
mov    %rax,%r14
mov    %rbp,0x18(%rsp)
xor    %eax,%eax
mov    %rax,0x8(%rsp)
lea    0xdbf(%rip),%rbx
lea    0x820(%rsp),%r13
xor    %eax,%eax
mov    %rax,0x10(%rsp)
jmp    1294 <find_pid_by_name+0xc4>
nopl   0x0(%rax,%rax,1)
mov    %r12,%rdi
call   10c0 <readdir@plt>
mov    %rax,%r14
test   %rax,%rax
je     13b0 <find_pid_by_name+0x1e0>
mov    (%r14),%rdi
mov    %rbx,%rsi
call   10a0 <strcmp@plt>
test   %rax,%rax
je     1280 <find_pid_by_name+0xb0>
mov    (%r14),%rax
movsbl (%rax),%edi
call   1030 <isdigit@plt>
test   %eax,%eax
je     1280 <find_pid_by_name+0xb0>
mov    %r13,%rdi
xor    %esi,%esi
mov    $0x400,%edx
call   1080 <memset@plt>
mov    (%r14),%rcx
mov    %r13,%rdi
mov    $0x400,%esi
lea    0xd55(%rip),%rdx
call   1070 <snprintf@plt>
mov    %r13,%rdi
lea    0xd56(%rip),%rsi
call   10f0 <fopen@plt>
test   %rax,%rax
je     1280 <find_pid_by_name+0xb0>
mov    %rax,%rbp
mov    %rbx,%r15
lea    0x20(%rsp),%rbx
mov    %rbx,%rdi
xor    %esi,%esi
mov    $0x400,%edx
call   1080 <memset@plt>
mov    %rbx,%rdi
mov    %r15,%rbx
mov    $0x3ff,%esi
mov    %rbp,%rdx
call   1090 <fgets@plt>
mov    %rax,%r15
mov    %rbp,%rdi
call   1040 <fclose@plt>
test   %r15,%r15
je     1280 <find_pid_by_name+0xb0>
lea    0x420(%rsp),%rbp
mov    %rbp,%rdi
xor    %esi,%esi
mov    $0x400,%edx
call   1080 <memset@plt>
lea    0x20(%rsp),%rdi
lea    0xcea(%rip),%rsi
mov    %rbp,%rdx
call   10d0 <sscanf@plt>
mov    %rbp,%rdi
mov    0x18(%rsp),%rsi
call   10a0 <strcmp@plt>
test   %rax,%rax
jne    1280 <find_pid_by_name+0xb0>
mov    0x8(%rsp),%rbp
lea    0x10(,%rbp,8),%esi
mov    0x10(%rsp),%rdi
call   10e0 <realloc@plt>
mov    %rax,%r15
mov    (%r14),%rdi
xor    %esi,%esi
xor    %edx,%edx
call   10b0 <strtol@plt>
movslq %ebp,%rcx
add    $0x1,%ebp
mov    %rbp,0x8(%rsp)
mov    %r15,%rdx
mov    %r15,0x10(%rsp)
mov    %rax,(%r15,%rcx,8)
jmp    1280 <find_pid_by_name+0xb0>
mov    0x10(%rsp),%rbx
test   %rbx,%rbx
je     13c9 <find_pid_by_name+0x1f9>
movslq 0x8(%rsp),%rax
movq   $0x0,(%rbx,%rax,8)
jmp    13f8 <find_pid_by_name+0x228>
xor    %edi,%edi
mov    $0x8,%esi
call   10e0 <realloc@plt>
mov    %rax,%rbx
movq   $0xffffffffffffffff,(%rax)
jmp    13f8 <find_pid_by_name+0x228>
mov    0x2bf8(%rip),%rax
mov    (%rax),%esi
lea    0xc15(%rip),%rdi
call   1060 <printf@plt>
xor    %ebx,%ebx
mov    %rbx,%rax
add    $0xc28,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
%struct.dirent = type { i8* }
@.str = [6 x i8] c"/proc\00"
@.str.1 = [32 x i8] c"Open /proc failed. errno = %d.\0A\00"
@errno = global i32 0
@.str.2 = [3 x i8] c"..\00"
@.str.3 = [16 x i8] c"/proc/%s/status\00"
@.str.4 = [2 x i8] c"r\00"
@.str.5 = [7 x i8] c"%*s %s\00"
define i64* @find_pid_by_name(i8* %0) {
%2 = alloca i64*
%3 = alloca i8*
%4 = alloca i32*
%5 = alloca %struct.dirent*
%6 = alloca i64*
%7 = alloca i32*
%8 = alloca [1024 x i8]
%9 = alloca [1024 x i8]
%10 = alloca [1024 x i8]
%11 = alloca i32
store i8* %0, i8** %3
store i32* null, i32** %4
store %struct.dirent* null, %struct.dirent** %5
store i64* null, i64** %6
store i32* null, i32** %7
%12 = bitcast [1024 x i8]* %8 to i8*
%13 = bitcast [1024 x i8]* %9 to i8*
%14 = bitcast [1024 x i8]* %10 to i8*
store i32 0, i32* %11
%15 = load i8*, i8** %3
%16 = icmp eq i8* null, %15
br i1 %16, label %17, label %18
17: ; preds = %1
store i64* null, i64** %2
br label %112
18: ; preds = %1
%19 = call i32* @opendir(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0))
store i32* %19, i32** %4
%20 = load i32*, i32** %4
%21 = icmp ne i32* %20, null
br i1 %21, label %25, label %22
22: ; preds = %18
%23 = load i32, i32* @errno
%24 = call i32 @printf(i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str.1, i64 0, i64 0), i32 %23)
store i64* null, i64** %2
br label %112
25: ; preds = %18
br label %26
26: ; preds = %96, %64, %56, %44, %36, %25
%27 = load i32*, i32** %4
%28 = call %struct.dirent* @readdir(i32* %27)
store %struct.dirent* %28, %struct.dirent** %5
%29 = icmp ne %struct.dirent* %28, null
br i1 %29, label %30, label %97
30: ; preds = %26
%31 = load %struct.dirent*, %struct.dirent** %5
%32 = getelementptr inbounds %struct.dirent, %struct.dirent* %31, i32 0, i32 0
%33 = load i8*, i8** %32
%34 = call i64 @strcmp(i8* %33, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0))
%35 = icmp eq i64 %34, 0
br i1 %35, label %36, label %37
36: ; preds = %30
br label %26
37: ; preds = %30
%38 = load %struct.dirent*, %struct.dirent** %5
%39 = getelementptr inbounds %struct.dirent, %struct.dirent* %38, i32 0, i32 0
%40 = load i8*, i8** %39
%41 = load i8, i8* %40
%42 = call i32 @isdigit(i8 signext %41)
%43 = icmp ne i32 %42, 0
br i1 %43, label %45, label %44
44: ; preds = %37
br label %26
45: ; preds = %37
%46 = getelementptr inbounds [1024 x i8], [1024 x i8]* %8, i64 0, i64 0
%47 = call i32 @memset(i8* %46, i32 0, i32 1024)
%48 = getelementptr inbounds [1024 x i8], [1024 x i8]* %8, i64 0, i64 0
%49 = load %struct.dirent*, %struct.dirent** %5
%50 = getelementptr inbounds %struct.dirent, %struct.dirent* %49, i32 0, i32 0
%51 = load i8*, i8** %50
%52 = call i32 @snprintf(i8* %48, i32 1024, i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.3, i64 0, i64 0), i8* %51)
%53 = getelementptr inbounds [1024 x i8], [1024 x i8]* %8, i64 0, i64 0
%54 = call i32* @fopen(i8* %53, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.4, i64 0, i64 0))
store i32* %54, i32** %7
%55 = icmp ne i32* %54, null
br i1 %55, label %57, label %56
56: ; preds = %45
br label %26
57: ; preds = %45
%58 = getelementptr inbounds [1024 x i8], [1024 x i8]* %9, i64 0, i64 0
%59 = call i32 @memset(i8* %58, i32 0, i32 1024)
%60 = getelementptr inbounds [1024 x i8], [1024 x i8]* %9, i64 0, i64 0
%61 = load i32*, i32** %7
%62 = call i32* @fgets(i8* %60, i32 1023, i32* %61)
%63 = icmp eq i32* %62, null
br i1 %63, label %64, label %67
64: ; preds = %57
%65 = load i32*, i32** %7
%66 = call i32 @fclose(i32* %65)
br label %26
67: ; preds = %57
%68 = load i32*, i32** %7
%69 = call i32 @fclose(i32* %68)
%70 = getelementptr inbounds [1024 x i8], [1024 x i8]* %10, i64 0, i64 0
%71 = call i32 @memset(i8* %70, i32 0, i32 1024)
%72 = getelementptr inbounds [1024 x i8], [1024 x i8]* %9, i64 0, i64 0
%73 = getelementptr inbounds [1024 x i8], [1024 x i8]* %10, i64 0, i64 0
%74 = call i32 @sscanf(i8* %72, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.5, i64 0, i64 0), i8* %73)
%75 = getelementptr inbounds [1024 x i8], [1024 x i8]* %10, i64 0, i64 0
%76 = load i8*, i8** %3
%77 = call i64 @strcmp(i8* %75, i8* %76)
%78 = icmp eq i64 %77, 0
br i1 %78, label %79, label %96
79: ; preds = %67
%80 = load i64*, i64** %6
%81 = load i32, i32* %11
%82 = add nsw i32 %81, 2
%83 = sext i32 %82 to i64
%84 = mul i64 8, %83
%85 = trunc i64 %84 to i32
%86 = call i64* @realloc(i64* %80, i32 %85)
store i64* %86, i64** %6
%87 = load %struct.dirent*, %struct.dirent** %5
%88 = getelementptr inbounds %struct.dirent, %struct.dirent* %87, i32 0, i32 0
%89 = load i8*, i8** %88
%90 = call i64 @strtol(i8* %89, i32* null, i32 0)
%91 = load i64*, i64** %6
%92 = load i32, i32* %11
%93 = add nsw i32 %92, 1
store i32 %93, i32* %11
%94 = sext i32 %92 to i64
%95 = getelementptr inbounds i64, i64* %91, i64 %94
store i64 %90, i64* %95
br label %96
96: ; preds = %79, %67
br label %26
97: ; preds = %26
%98 = load i64*, i64** %6
%99 = icmp ne i64* %98, null
br i1 %99, label %100, label %105
100: ; preds = %97
%101 = load i64*, i64** %6
%102 = load i32, i32* %11
%103 = sext i32 %102 to i64
%104 = getelementptr inbounds i64, i64* %101, i64 %103
store i64 0, i64* %104
br label %110
105: ; preds = %97
%106 = load i64*, i64** %6
%107 = call i64* @realloc(i64* %106, i32 8)
store i64* %107, i64** %6
%108 = load i64*, i64** %6
%109 = getelementptr inbounds i64, i64* %108, i64 0
store i64 -1, i64* %109
br label %110
110: ; preds = %105, %100
%111 = load i64*, i64** %6
store i64* %111, i64** %2
br label %112
112: ; preds = %110, %22, %17
%113 = load i64*, i64** %2
ret i64* %113
}

LLVM IR (-O2):
%struct.dirent = type { i8* }
@.str = [6 x i8] c"/proc\00"
@.str.1 = [32 x i8] c"Open /proc failed. errno = %d.\0A\00"
@errno = global i32 0
@.str.2 = [3 x i8] c"..\00"
@.str.3 = [16 x i8] c"/proc/%s/status\00"
@.str.4 = [2 x i8] c"r\00"
@.str.5 = [7 x i8] c"%*s %s\00"
define i64* @find_pid_by_name(i8* %0) {
%2 = alloca [1024 x i8]
%3 = alloca [1024 x i8]
%4 = alloca [1024 x i8]
%5 = getelementptr inbounds [1024 x i8], [1024 x i8]* %2, i64 0, i64 0
%6 = getelementptr inbounds [1024 x i8], [1024 x i8]* %3, i64 0, i64 0
%7 = getelementptr inbounds [1024 x i8], [1024 x i8]* %4, i64 0, i64 0
%8 = icmp eq i8* %0, null
br i1 %8, label %75, label %9
9: ; preds = %1
%10 = tail call i32* @opendir(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0))
%11 = icmp eq i32* %10, null
br i1 %11, label %15, label %12
12: ; preds = %9
%13 = call %struct.dirent* @readdir(i32* %10)
%14 = icmp eq %struct.dirent* %13, null
br i1 %14, label %73, label %62
15: ; preds = %9
%16 = load i32, i32* @errno
%17 = tail call i32 @printf(i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str.1, i64 0, i64 0), i32 %16)
br label %75
18: ; preds = %62, %40
%19 = phi %struct.dirent* [ %63, %62 ], [ %41, %40 ]
%20 = getelementptr inbounds %struct.dirent, %struct.dirent* %19, i64 0, i32 0
%21 = load i8*, i8** %20
%22 = call i64 @strcmp(i8* %21, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0))
%23 = icmp eq i64 %22, 0
br i1 %23, label %40, label %24
24: ; preds = %18
%25 = load i8*, i8** %20
%26 = load i8, i8* %25
%27 = call i32 @isdigit(i8 signext %26)
%28 = icmp eq i32 %27, 0
br i1 %28, label %40, label %29
29: ; preds = %24
%30 = call i32 @memset(i8* %5, i32 0, i32 1024)
%31 = load i8*, i8** %20
%32 = call i32 @snprintf(i8* %5, i32 1024, i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.3, i64 0, i64 0), i8* %31)
%33 = call i32* @fopen(i8* %5, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.4, i64 0, i64 0))
%34 = icmp eq i32* %33, null
br i1 %34, label %40, label %35
35: ; preds = %29
%36 = call i32 @memset(i8* %6, i32 0, i32 1024)
%37 = call i32* @fgets(i8* %6, i32 1023, i32* %33)
%38 = icmp eq i32* %37, null
%39 = call i32 @fclose(i32* %33)
br i1 %38, label %40, label %43
40: ; preds = %35, %18, %24, %29
%41 = call %struct.dirent* @readdir(i32* %10)
%42 = icmp eq %struct.dirent* %41, null
br i1 %42, label %66, label %18
43: ; preds = %35
%44 = call i32 @memset(i8* %7, i32 0, i32 1024)
%45 = call i32 @sscanf(i8* %6, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.5, i64 0, i64 0), i8* %7)
%46 = call i64 @strcmp(i8* %7, i8* %0)
%47 = icmp eq i64 %46, 0
br i1 %47, label %48, label %57
48: ; preds = %43
%49 = shl i32 %64, 3
%50 = add i32 %49, 16
%51 = call i64* @realloc(i64* %65, i32 %50)
%52 = load i8*, i8** %20
%53 = call i64 @strtol(i8* nocapture %52, i32* null, i32 0)
%54 = add nsw i32 %64, 1
%55 = sext i32 %64 to i64
%56 = getelementptr inbounds i64, i64* %51, i64 %55
store i64 %53, i64* %56
br label %57
57: ; preds = %48, %43
%58 = phi i64* [ %51, %48 ], [ %65, %43 ]
%59 = phi i32 [ %54, %48 ], [ %64, %43 ]
%60 = call %struct.dirent* @readdir(i32* %10)
%61 = icmp eq %struct.dirent* %60, null
br i1 %61, label %66, label %62
62: ; preds = %12, %57
%63 = phi %struct.dirent* [ %60, %57 ], [ %13, %12 ]
%64 = phi i32 [ %59, %57 ], [ 0, %12 ]
%65 = phi i64* [ %58, %57 ], [ null, %12 ]
br label %18
66: ; preds = %57, %40
%67 = phi i64* [ %65, %40 ], [ %58, %57 ]
%68 = phi i32 [ %64, %40 ], [ %59, %57 ]
%69 = icmp eq i64* %67, null
br i1 %69, label %73, label %70
70: ; preds = %66
%71 = sext i32 %68 to i64
%72 = getelementptr inbounds i64, i64* %67, i64 %71
store i64 0, i64* %72
br label %75
73: ; preds = %12, %66
%74 = call i64* @realloc(i64* null, i32 8)
store i64 -1, i64* %74
br label %75
75: ; preds = %70, %73, %1, %15
%76 = phi i64* [ null, %15 ], [ null, %1 ], [ %67, %70 ], [ %74, %73 ]
ret i64* %76
}