#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*/ FILE;
typedef int /*<<< orphan*/ DIR;

/* Variables and functions */
int /*<<< orphan*/ closedir(int /*<<< orphan*/ *);
int /*<<< orphan*/ fclose(int /*<<< orphan*/ *);
int /*<<< orphan*/ *fopen(char *, char *);
int /*<<< orphan*/ fscanf(int /*<<< orphan*/ *, char *, char *);
void *malloc(int);
int /*<<< orphan*/ *opendir(char *);
int /*<<< orphan*/ perror(char *);
struct dirent *readdir(int /*<<< orphan*/ *);
char **realloc(char **, int);
int /*<<< orphan*/ strcat(char *, char *);
int /*<<< orphan*/ strcpy(char *, char *);
int strlen(char *);
int /*<<< orphan*/ *strstr(char *, char *);
char **pidof(char *pname) {
  DIR *dirp;
  FILE *fp;
  char **pidlist;
  struct dirent *entry = NULL;
  char path[1024], read_buf[1024];
  int pidlist_index = 1, pidlist_realloc_count = 1, str_length = 0;
  dirp = opendir("/proc/");
  if (dirp == NULL) {
    perror("Fail");
    return NULL;
  }
  pidlist = malloc(32 * sizeof(char *));
  if (pidlist == NULL)
    return NULL;
  while ((entry = readdir(dirp)) != NULL) {
    strcpy(path, "/proc/");
    strcat(path, entry->d_name);
    strcat(path, "/comm");
    fp = fopen(path, "r");
    if (fp != NULL) {
      fscanf(fp, "%s", read_buf);
      if (strstr(read_buf, pname) != NULL) {
        str_length = (strlen(read_buf) + strlen(entry->d_name)) + 2;
        pidlist[pidlist_index] = malloc(str_length * sizeof(char));
        if (pidlist[pidlist_index] == NULL)
          return NULL;
        strcpy(pidlist[pidlist_index], read_buf);
        strcat(pidlist[pidlist_index], " \0");
        strcat(pidlist[pidlist_index++], entry->d_name);
        if ((pidlist_index) == 32 * pidlist_realloc_count) {
          pidlist_realloc_count++;
          pidlist =
              realloc(pidlist, sizeof(char *) * (32 * pidlist_realloc_count));
          if (pidlist == NULL)
            return NULL;
        }
      }
      fclose(fp);
    }
  }
  pidlist[0] = malloc(sizeof(int));
  *pidlist[0] = pidlist_index - 1;
  closedir(dirp);
  return pidlist;
}


x86 assembly (clang, -O0):
<pidof>:
push   %rbp
mov    %rsp,%rbp
sub    $0x840,%rsp
mov    %rdi,-0x10(%rbp)
movq   $0x0,-0x30(%rbp)
movl   $0x1,-0x834(%rbp)
movl   $0x1,-0x838(%rbp)
movl   $0x0,-0x83c(%rbp)
lea    0xdf4(%rip),%rdi
call   1050 <opendir@plt>
mov    %rax,-0x18(%rbp)
cmpq   $0x0,-0x18(%rbp)
jne    1239 <pidof+0x69>
lea    0xde0(%rip),%rdi
call   10d0 <perror@plt>
movq   $0x0,-0x8(%rbp)
jmp    148a <pidof+0x2ba>
mov    $0x100,%edi
call   10a0 <malloc@plt>
mov    %rax,-0x28(%rbp)
cmpq   $0x0,-0x28(%rbp)
jne    125f <pidof+0x8f>
movq   $0x0,-0x8(%rbp)
jmp    148a <pidof+0x2ba>
jmp    1264 <pidof+0x94>
mov    -0x18(%rbp),%rdi
call   1090 <readdir@plt>
mov    %rax,-0x30(%rbp)
cmp    $0x0,%rax
je     1451 <pidof+0x281>
lea    -0x430(%rbp),%rdi
lea    0xd77(%rip),%rsi
call   1030 <strcpy@plt>
lea    -0x430(%rbp),%rdi
mov    -0x30(%rbp),%rax
mov    (%rax),%rsi
call   10e0 <strcat@plt>
lea    -0x430(%rbp),%rdi
lea    0xd5d(%rip),%rsi
call   10e0 <strcat@plt>
lea    -0x430(%rbp),%rdi
lea    0xd50(%rip),%rsi
call   10c0 <fopen@plt>
mov    %rax,-0x20(%rbp)
cmpq   $0x0,-0x20(%rbp)
je     144c <pidof+0x27c>
mov    -0x20(%rbp),%rdi
lea    -0x830(%rbp),%rdx
lea    0xd2c(%rip),%rsi
call   1070 <fscanf@plt>
lea    -0x830(%rbp),%rdi
mov    -0x10(%rbp),%rsi
call   10f0 <strstr@plt>
cmp    $0x0,%rax
je     1443 <pidof+0x273>
lea    -0x830(%rbp),%rdi
call   1060 <strlen@plt>
mov    %eax,-0x840(%rbp)
mov    -0x30(%rbp),%rax
mov    (%rax),%rdi
call   1060 <strlen@plt>
mov    %eax,%ecx
mov    -0x840(%rbp),%eax
add    %ecx,%eax
add    $0x2,%eax
mov    %eax,-0x83c(%rbp)
movslq -0x83c(%rbp),%rax
shl    $0x0,%rax
mov    %eax,%edi
call   10a0 <malloc@plt>
mov    %rax,%rdx
mov    -0x28(%rbp),%rax
movslq -0x834(%rbp),%rcx
mov    %rdx,(%rax,%rcx,8)
mov    -0x28(%rbp),%rax
movslq -0x834(%rbp),%rcx
cmpq   $0x0,(%rax,%rcx,8)
jne    137f <pidof+0x1af>
movq   $0x0,-0x8(%rbp)
jmp    148a <pidof+0x2ba>
mov    -0x28(%rbp),%rax
movslq -0x834(%rbp),%rcx
mov    (%rax,%rcx,8),%rdi
lea    -0x830(%rbp),%rsi
call   1030 <strcpy@plt>
mov    -0x28(%rbp),%rax
movslq -0x834(%rbp),%rcx
mov    (%rax,%rcx,8),%rdi
lea    0xc67(%rip),%rsi
call   10e0 <strcat@plt>
mov    -0x28(%rbp),%rax
mov    -0x834(%rbp),%ecx
mov    %ecx,%edx
add    $0x1,%edx
mov    %edx,-0x834(%rbp)
movslq %ecx,%rcx
mov    (%rax,%rcx,8),%rdi
mov    -0x30(%rbp),%rax
mov    (%rax),%rsi
call   10e0 <strcat@plt>
mov    -0x834(%rbp),%eax
mov    -0x838(%rbp),%ecx
shl    $0x5,%ecx
cmp    %ecx,%eax
jne    143e <pidof+0x26e>
mov    -0x838(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x838(%rbp)
mov    -0x28(%rbp),%rdi
mov    -0x838(%rbp),%eax
shl    $0x5,%eax
cltq
shl    $0x3,%rax
mov    %eax,%esi
call   10b0 <realloc@plt>
mov    %rax,-0x28(%rbp)
cmpq   $0x0,-0x28(%rbp)
jne    1439 <pidof+0x269>
movq   $0x0,-0x8(%rbp)
jmp    148a <pidof+0x2ba>
jmp    143e <pidof+0x26e>
jmp    1443 <pidof+0x273>
mov    -0x20(%rbp),%rdi
call   1040 <fclose@plt>
jmp    1264 <pidof+0x94>
mov    $0x4,%edi
call   10a0 <malloc@plt>
mov    %rax,%rcx
mov    -0x28(%rbp),%rax
mov    %rcx,(%rax)
mov    -0x834(%rbp),%eax
sub    $0x1,%eax
mov    %al,%cl
mov    -0x28(%rbp),%rax
mov    (%rax),%rax
mov    %cl,(%rax)
mov    -0x18(%rbp),%rdi
call   1080 <closedir@plt>
mov    -0x28(%rbp),%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
add    $0x840,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<pidof>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x828,%rsp
mov    %rdi,0x18(%rsp)
lea    0xe13(%rip),%rdi
call   1050 <opendir@plt>
mov    %rax,0x10(%rsp)
test   %rax,%rax
je     13c4 <pidof+0x1f4>
mov    $0x100,%edi
call   10a0 <malloc@plt>
test   %rax,%rax
je     13d0 <pidof+0x200>
mov    %rax,0x8(%rsp)
mov    0x10(%rsp),%rdi
call   1090 <readdir@plt>
test   %rax,%rax
je     1397 <pidof+0x1c7>
mov    %rax,%r12
movl   $0x1,0x4(%rsp)
lea    0xdc3(%rip),%r13
lea    0x20(%rsp),%rbp
lea    0xdc3(%rip),%r14
movl   $0x1,(%rsp)
jmp    1283 <pidof+0xb3>
lea    0xda7(%rip),%r13
lea    0x20(%rsp),%rbp
lea    0xda7(%rip),%r14
mov    %r15,%rdi
call   1040 <fclose@plt>
mov    0x10(%rsp),%rdi
call   1090 <readdir@plt>
mov    %rax,%r12
test   %rax,%rax
je     139e <pidof+0x1ce>
mov    %rbp,%rdi
mov    %r13,%rsi
call   1030 <strcpy@plt>
mov    (%r12),%rsi
mov    %rbp,%rdi
call   10e0 <strcat@plt>
mov    %rbp,%rdi
mov    %r14,%rsi
call   10e0 <strcat@plt>
mov    %rbp,%rdi
lea    0xd63(%rip),%rsi
call   10c0 <fopen@plt>
test   %rax,%rax
je     126d <pidof+0x9d>
mov    %rax,%r15
mov    %rax,%rdi
lea    0xd4e(%rip),%rsi
lea    0x420(%rsp),%rbx
mov    %rbx,%rdx
call   1070 <fscanf@plt>
mov    %rbx,%rdi
mov    0x18(%rsp),%rsi
call   10f0 <strstr@plt>
test   %rax,%rax
je     1265 <pidof+0x95>
mov    %rbx,%rdi
call   1060 <strlen@plt>
mov    %eax,%ebp
mov    (%r12),%rdi
call   1060 <strlen@plt>
lea    (%rax,%rbp,1),%edi
add    $0x2,%edi
call   10a0 <malloc@plt>
movslq (%rsp),%rbp
mov    0x8(%rsp),%r13
mov    %rax,0x0(%r13,%rbp,8)
test   %rax,%rax
je     13d0 <pidof+0x200>
mov    %rax,%rdi
mov    %rbx,%rsi
call   1030 <strcpy@plt>
mov    0x0(%r13,%rbp,8),%rdi
lea    0xcdf(%rip),%rsi
call   10e0 <strcat@plt>
lea    0x1(%rbp),%ebx
mov    0x0(%r13,%rbp,8),%rdi
mov    (%r12),%rsi
call   10e0 <strcat@plt>
mov    0x4(%rsp),%esi
mov    %esi,%eax
shl    $0x5,%eax
mov    %ebx,(%rsp)
cmp    %eax,%ebx
jne    1252 <pidof+0x82>
add    $0x1,%esi
mov    %esi,0x4(%rsp)
shl    $0x8,%esi
mov    %r13,%rdi
call   10b0 <realloc@plt>
mov    %rax,0x8(%rsp)
test   %rax,%rax
lea    0xc7d(%rip),%r13
lea    0x20(%rsp),%rbp
lea    0xc7d(%rip),%r14
jne    1265 <pidof+0x95>
jmp    13d0 <pidof+0x200>
movl   $0x1,(%rsp)
mov    $0x4,%edi
call   10a0 <malloc@plt>
mov    0x8(%rsp),%rbx
mov    %rax,(%rbx)
mov    (%rsp),%ecx
add    $0xff,%cl
mov    %cl,(%rax)
mov    0x10(%rsp),%rdi
call   1080 <closedir@plt>
jmp    13d2 <pidof+0x202>
lea    0xc3c(%rip),%rdi
call   10d0 <perror@plt>
xor    %ebx,%ebx
mov    %rbx,%rax
add    $0x828,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
%struct.dirent = type { i8* }
@.str = [7 x i8] c"/proc/\00"
@.str.1 = [5 x i8] c"Fail\00"
@.str.2 = [6 x i8] c"/comm\00"
@.str.3 = [2 x i8] c"r\00"
@.str.4 = [3 x i8] c"%s\00"
@.str.5 = [3 x i8] c" \00\00"
define i8** @pidof(i8* %0) {
%2 = alloca i8**
%3 = alloca i8*
%4 = alloca i32*
%5 = alloca i32*
%6 = alloca i8**
%7 = alloca %struct.dirent*
%8 = alloca [1024 x i8]
%9 = alloca [1024 x i8]
%10 = alloca i32
%11 = alloca i32
%12 = alloca i32
store i8* %0, i8** %3
store %struct.dirent* null, %struct.dirent** %7
store i32 1, i32* %10
store i32 1, i32* %11
store i32 0, i32* %12
%13 = call i32* @opendir(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0))
store i32* %13, i32** %4
%14 = load i32*, i32** %4
%15 = icmp eq i32* %14, null
br i1 %15, label %16, label %18
16: ; preds = %1
%17 = call i32 @perror(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0))
store i8** null, i8*** %2
br label %136
18: ; preds = %1
%19 = call i8* @malloc(i32 256)
%20 = bitcast i8* %19 to i8**
store i8** %20, i8*** %6
%21 = load i8**, i8*** %6
%22 = icmp eq i8** %21, null
br i1 %22, label %23, label %24
23: ; preds = %18
store i8** null, i8*** %2
br label %136
24: ; preds = %18
br label %25
25: ; preds = %122, %24
%26 = load i32*, i32** %4
%27 = call %struct.dirent* @readdir(i32* %26)
store %struct.dirent* %27, %struct.dirent** %7
%28 = icmp ne %struct.dirent* %27, null
br i1 %28, label %29, label %123
29: ; preds = %25
%30 = getelementptr inbounds [1024 x i8], [1024 x i8]* %8, i64 0, i64 0
%31 = call i32 @strcpy(i8* %30, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0))
%32 = getelementptr inbounds [1024 x i8], [1024 x i8]* %8, i64 0, i64 0
%33 = load %struct.dirent*, %struct.dirent** %7
%34 = getelementptr inbounds %struct.dirent, %struct.dirent* %33, i32 0, i32 0
%35 = load i8*, i8** %34
%36 = call i32 @strcat(i8* %32, i8* %35)
%37 = getelementptr inbounds [1024 x i8], [1024 x i8]* %8, i64 0, i64 0
%38 = call i32 @strcat(i8* %37, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.2, i64 0, i64 0))
%39 = getelementptr inbounds [1024 x i8], [1024 x i8]* %8, i64 0, i64 0
%40 = call i32* @fopen(i8* %39, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i64 0, i64 0))
store i32* %40, i32** %5
%41 = load i32*, i32** %5
%42 = icmp ne i32* %41, null
br i1 %42, label %43, label %122
43: ; preds = %29
%44 = load i32*, i32** %5
%45 = getelementptr inbounds [1024 x i8], [1024 x i8]* %9, i64 0, i64 0
%46 = call i32 @fscanf(i32* %44, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0), i8* %45)
%47 = getelementptr inbounds [1024 x i8], [1024 x i8]* %9, i64 0, i64 0
%48 = load i8*, i8** %3
%49 = call i32* @strstr(i8* %47, i8* %48)
%50 = icmp ne i32* %49, null
br i1 %50, label %51, label %119
51: ; preds = %43
%52 = getelementptr inbounds [1024 x i8], [1024 x i8]* %9, i64 0, i64 0
%53 = call i32 @strlen(i8* %52)
%54 = load %struct.dirent*, %struct.dirent** %7
%55 = getelementptr inbounds %struct.dirent, %struct.dirent* %54, i32 0, i32 0
%56 = load i8*, i8** %55
%57 = call i32 @strlen(i8* %56)
%58 = add nsw i32 %53, %57
%59 = add nsw i32 %58, 2
store i32 %59, i32* %12
%60 = load i32, i32* %12
%61 = sext i32 %60 to i64
%62 = mul i64 %61, 1
%63 = trunc i64 %62 to i32
%64 = call i8* @malloc(i32 %63)
%65 = load i8**, i8*** %6
%66 = load i32, i32* %10
%67 = sext i32 %66 to i64
%68 = getelementptr inbounds i8*, i8** %65, i64 %67
store i8* %64, i8** %68
%69 = load i8**, i8*** %6
%70 = load i32, i32* %10
%71 = sext i32 %70 to i64
%72 = getelementptr inbounds i8*, i8** %69, i64 %71
%73 = load i8*, i8** %72
%74 = icmp eq i8* %73, null
br i1 %74, label %75, label %76
75: ; preds = %51
store i8** null, i8*** %2
br label %136
76: ; preds = %51
%77 = load i8**, i8*** %6
%78 = load i32, i32* %10
%79 = sext i32 %78 to i64
%80 = getelementptr inbounds i8*, i8** %77, i64 %79
%81 = load i8*, i8** %80
%82 = getelementptr inbounds [1024 x i8], [1024 x i8]* %9, i64 0, i64 0
%83 = call i32 @strcpy(i8* %81, i8* %82)
%84 = load i8**, i8*** %6
%85 = load i32, i32* %10
%86 = sext i32 %85 to i64
%87 = getelementptr inbounds i8*, i8** %84, i64 %86
%88 = load i8*, i8** %87
%89 = call i32 @strcat(i8* %88, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.5, i64 0, i64 0))
%90 = load i8**, i8*** %6
%91 = load i32, i32* %10
%92 = add nsw i32 %91, 1
store i32 %92, i32* %10
%93 = sext i32 %91 to i64
%94 = getelementptr inbounds i8*, i8** %90, i64 %93
%95 = load i8*, i8** %94
%96 = load %struct.dirent*, %struct.dirent** %7
%97 = getelementptr inbounds %struct.dirent, %struct.dirent* %96, i32 0, i32 0
%98 = load i8*, i8** %97
%99 = call i32 @strcat(i8* %95, i8* %98)
%100 = load i32, i32* %10
%101 = load i32, i32* %11
%102 = mul nsw i32 32, %101
%103 = icmp eq i32 %100, %102
br i1 %103, label %104, label %118
104: ; preds = %76
%105 = load i32, i32* %11
%106 = add nsw i32 %105, 1
store i32 %106, i32* %11
%107 = load i8**, i8*** %6
%108 = load i32, i32* %11
%109 = mul nsw i32 32, %108
%110 = sext i32 %109 to i64
%111 = mul i64 8, %110
%112 = trunc i64 %111 to i32
%113 = call i8** @realloc(i8** %107, i32 %112)
store i8** %113, i8*** %6
%114 = load i8**, i8*** %6
%115 = icmp eq i8** %114, null
br i1 %115, label %116, label %117
116: ; preds = %104
store i8** null, i8*** %2
br label %136
117: ; preds = %104
br label %118
118: ; preds = %117, %76
br label %119
119: ; preds = %118, %43
%120 = load i32*, i32** %5
%121 = call i32 @fclose(i32* %120)
br label %122
122: ; preds = %119, %29
br label %25
123: ; preds = %25
%124 = call i8* @malloc(i32 4)
%125 = load i8**, i8*** %6
%126 = getelementptr inbounds i8*, i8** %125, i64 0
store i8* %124, i8** %126
%127 = load i32, i32* %10
%128 = sub nsw i32 %127, 1
%129 = trunc i32 %128 to i8
%130 = load i8**, i8*** %6
%131 = getelementptr inbounds i8*, i8** %130, i64 0
%132 = load i8*, i8** %131
store i8 %129, i8* %132
%133 = load i32*, i32** %4
%134 = call i32 @closedir(i32* %133)
%135 = load i8**, i8*** %6
store i8** %135, i8*** %2
br label %136
136: ; preds = %123, %116, %75, %23, %16
%137 = load i8**, i8*** %2
ret i8** %137
}

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