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

/* Variables and functions */
int /*<<< orphan*/ closedir(int /*<<< orphan*/ *);
int /*<<< orphan*/ exechelp_logerrv(char *, int, char *);
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ free(char *);
scalar_t__ getpid();
int /*<<< orphan*/ *opendir(char *);
char *pid_proc_cmdline(scalar_t__);
char *pid_proc_comm(scalar_t__);
struct dirent *readdir(int /*<<< orphan*/ *);
int /*<<< orphan*/ sleep(int);
char *strchr(char *, char);
int strcmp(char *, char const *);
char *strstr(char *, char *);
scalar_t__ strtol(char *, char **, int);
int name2pid(const char *name, pid_t *pid) {
  pid_t parent = getpid();
  DIR *dir;
  if (!(dir = opendir("/proc"))) {
    sleep(2);
    if (!(dir = opendir("/proc"))) {
      exechelp_logerrv("firejail", 1, "Error: cannot open /proc directory\n");
      exit(1);
    }
  }
  struct dirent *entry;
  char *end;
  while ((entry = readdir(dir))) {
    pid_t newpid = strtol(entry->d_name, &end, 10);
    if (end == entry->d_name || *end)
      continue;
    if (newpid == parent)
      continue;
    char *comm = pid_proc_comm(newpid);
    if (comm) {
      char *ptr = strchr(comm, '\n');
      if (ptr)
        *ptr = '\0';
      if (strcmp(comm, "firejail")) {
        free(comm);
        continue;
      }
      free(comm);
    }
    char *cmd = pid_proc_cmdline(newpid);
    if (cmd) {
      char *ptr = strstr(cmd, "--name=");
      char *start = ptr;
      if (!ptr) {
        free(cmd);
        continue;
      }
      char *next_for_sure = strstr(ptr, " --");
      if (next_for_sure)
        *next_for_sure = '\0';
      else {
        while (*ptr != ' ' && *ptr != '\t' && *ptr != '\0')
          ptr++;
        *ptr = '\0';
      }
      int rv = strcmp(start + 7, name);
      if (rv == 0) {
        free(cmd);
        *pid = newpid;
        closedir(dir);
        return 0;
      }
      free(cmd);
    }
  }
  closedir(dir);
  return 1;
}


x86 assembly (clang, -O0):
<name2pid>:
push   %rbp
mov    %rsp,%rbp
sub    $0x80,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    $0x0,%al
call   1050 <getpid@plt>
mov    %rax,-0x20(%rbp)
lea    0xdfb(%rip),%rdi
call   1060 <opendir@plt>
mov    %rax,-0x28(%rbp)
cmp    $0x0,%rax
jne    1263 <name2pid+0x83>
mov    $0x2,%edi
call   10f0 <sleep@plt>
lea    0xdd7(%rip),%rdi
call   1060 <opendir@plt>
mov    %rax,-0x28(%rbp)
cmp    $0x0,%rax
jne    125e <name2pid+0x7e>
lea    0xdc3(%rip),%rdi
mov    $0x1,%esi
lea    0xdc0(%rip),%rdx
call   1070 <exechelp_logerrv@plt>
mov    $0x1,%edi
call   10e0 <exit@plt>
jmp    1263 <name2pid+0x83>
jmp    1268 <name2pid+0x88>
mov    -0x28(%rbp),%rdi
call   10d0 <readdir@plt>
mov    %rax,-0x30(%rbp)
cmp    $0x0,%rax
je     1471 <name2pid+0x291>
mov    -0x30(%rbp),%rax
mov    (%rax),%rdi
lea    -0x38(%rbp),%rsi
mov    $0xa,%edx
call   10c0 <strtol@plt>
mov    %rax,-0x40(%rbp)
mov    -0x38(%rbp),%rax
mov    -0x30(%rbp),%rcx
cmp    (%rcx),%rax
je     12b9 <name2pid+0xd9>
mov    -0x38(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x0,%eax
je     12be <name2pid+0xde>
jmp    1268 <name2pid+0x88>
mov    -0x40(%rbp),%rax
cmp    -0x20(%rbp),%rax
jne    12d1 <name2pid+0xf1>
jmp    1268 <name2pid+0x88>
mov    -0x40(%rbp),%rdi
call   1040 <pid_proc_comm@plt>
mov    %rax,-0x48(%rbp)
cmpq   $0x0,-0x48(%rbp)
je     133d <name2pid+0x15d>
mov    -0x48(%rbp),%rdi
mov    $0xa,%esi
call   1080 <strchr@plt>
mov    %rax,-0x50(%rbp)
cmpq   $0x0,-0x50(%rbp)
je     130d <name2pid+0x12d>
mov    -0x50(%rbp),%rax
movb   $0x0,(%rax)
mov    -0x48(%rbp),%rdi
lea    0xcee(%rip),%rsi
call   10a0 <strcmp@plt>
cmp    $0x0,%eax
je     1334 <name2pid+0x154>
mov    -0x48(%rbp),%rdi
call   1030 <free@plt>
jmp    1268 <name2pid+0x88>
mov    -0x48(%rbp),%rdi
call   1030 <free@plt>
mov    -0x40(%rbp),%rdi
call   10b0 <pid_proc_cmdline@plt>
mov    %rax,-0x58(%rbp)
cmpq   $0x0,-0x58(%rbp)
je     146c <name2pid+0x28c>
mov    -0x58(%rbp),%rdi
lea    0xcd3(%rip),%rsi
call   1100 <strstr@plt>
mov    %rax,-0x60(%rbp)
mov    -0x60(%rbp),%rax
mov    %rax,-0x68(%rbp)
cmpq   $0x0,-0x60(%rbp)
jne    138a <name2pid+0x1aa>
mov    -0x58(%rbp),%rdi
call   1030 <free@plt>
jmp    1268 <name2pid+0x88>
mov    -0x60(%rbp),%rdi
lea    0xca6(%rip),%rsi
call   1100 <strstr@plt>
mov    %rax,-0x70(%rbp)
cmpq   $0x0,-0x70(%rbp)
je     13b5 <name2pid+0x1d5>
mov    -0x70(%rbp),%rax
movb   $0x0,(%rax)
jmp    141c <name2pid+0x23c>
jmp    13ba <name2pid+0x1da>
mov    -0x60(%rbp),%rax
movsbl (%rax),%ecx
xor    %eax,%eax
cmp    $0x20,%ecx
mov    %al,-0x75(%rbp)
je     13f4 <name2pid+0x214>
mov    -0x60(%rbp),%rax
movsbl (%rax),%ecx
xor    %eax,%eax
cmp    $0x9,%ecx
mov    %al,-0x75(%rbp)
je     13f4 <name2pid+0x214>
mov    -0x60(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x0,%eax
setne  %al
mov    %al,-0x75(%rbp)
mov    -0x75(%rbp),%al
test   $0x1,%al
jne    1404 <name2pid+0x224>
jmp    1415 <name2pid+0x235>
mov    -0x60(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x60(%rbp)
jmp    13ba <name2pid+0x1da>
mov    -0x60(%rbp),%rax
movb   $0x0,(%rax)
mov    -0x68(%rbp),%rdi
add    $0x7,%rdi
mov    -0x10(%rbp),%rsi
call   10a0 <strcmp@plt>
mov    %eax,-0x74(%rbp)
cmpl   $0x0,-0x74(%rbp)
jne    1463 <name2pid+0x283>
mov    -0x58(%rbp),%rdi
call   1030 <free@plt>
mov    -0x40(%rbp),%rcx
mov    -0x18(%rbp),%rax
mov    %rcx,(%rax)
mov    -0x28(%rbp),%rdi
call   1090 <closedir@plt>
movl   $0x0,-0x4(%rbp)
jmp    1481 <name2pid+0x2a1>
mov    -0x58(%rbp),%rdi
call   1030 <free@plt>
jmp    1268 <name2pid+0x88>
mov    -0x28(%rbp),%rdi
call   1090 <closedir@plt>
movl   $0x1,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x80,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<name2pid>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x18,%rsp
mov    %rsi,%r15
mov    %rdi,0x10(%rsp)
xor    %eax,%eax
call   1050 <getpid@plt>
mov    %rax,%r14
lea    0xdf9(%rip),%rdi
call   1060 <opendir@plt>
mov    %rax,%r12
test   %rax,%rax
jne    1236 <name2pid+0x56>
mov    $0x2,%edi
call   10f0 <sleep@plt>
lea    0xddb(%rip),%rdi
call   1060 <opendir@plt>
mov    %rax,%r12
test   %rax,%rax
je     13ba <name2pid+0x1da>
mov    %r12,%rdi
call   10d0 <readdir@plt>
mov    $0x1,%ebx
test   %rax,%rax
je     138d <name2pid+0x1ad>
mov    %rax,%rbp
mov    %r15,0x8(%rsp)
mov    %rsp,%rbx
jmp    12a4 <name2pid+0xc4>
movb   $0x0,(%rax)
add    $0x7,%r14
mov    %r14,%rdi
mov    0x10(%rsp),%rsi
call   10a0 <strcmp@plt>
test   %eax,%eax
je     13a6 <name2pid+0x1c6>
mov    %r15,%rdi
call   1030 <free@plt>
mov    %rbx,%r14
mov    %rsp,%rbx
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
mov    %r12,%rdi
call   10d0 <readdir@plt>
mov    %rax,%rbp
test   %rax,%rax
je     1388 <name2pid+0x1a8>
mov    0x0(%rbp),%rdi
mov    %rbx,%rsi
mov    $0xa,%edx
call   10c0 <strtol@plt>
mov    %rax,%r13
mov    (%rsp),%rax
cmp    0x0(%rbp),%rax
je     1290 <name2pid+0xb0>
cmpb   $0x0,(%rax)
jne    1290 <name2pid+0xb0>
cmp    %r14,%r13
je     1290 <name2pid+0xb0>
mov    %r13,%rdi
call   1040 <pid_proc_comm@plt>
test   %rax,%rax
je     1315 <name2pid+0x135>
mov    %rax,%rbp
mov    %rax,%rdi
mov    $0xa,%esi
call   1080 <strchr@plt>
test   %rax,%rax
je     12f1 <name2pid+0x111>
movb   $0x0,(%rax)
mov    %rbp,%rdi
lea    0xd0b(%rip),%rsi
call   10a0 <strcmp@plt>
mov    %eax,%ebx
mov    %rbp,%rdi
call   1030 <free@plt>
test   %ebx,%ebx
mov    %rsp,%rbx
jne    1290 <name2pid+0xb0>
mov    %r13,%rdi
call   10b0 <pid_proc_cmdline@plt>
test   %rax,%rax
je     1290 <name2pid+0xb0>
mov    %rax,%r15
mov    %r14,%rbx
mov    %rax,%rdi
lea    0xcfd(%rip),%rsi
call   1100 <strstr@plt>
test   %rax,%rax
je     1275 <name2pid+0x95>
mov    %rax,%r14
mov    %rax,%rdi
lea    0xcea(%rip),%rsi
call   1100 <strstr@plt>
test   %rax,%rax
jne    1259 <name2pid+0x79>
mov    %r14,%rax
movabs $0x100000201,%rdx
jmp    1374 <name2pid+0x194>
xchg   %ax,%ax
add    $0x1,%rax
movzbl (%rax),%ecx
cmp    $0x20,%rcx
ja     1370 <name2pid+0x190>
bt     %rcx,%rdx
jae    1370 <name2pid+0x190>
jmp    1259 <name2pid+0x79>
mov    $0x1,%ebx
mov    %r12,%rdi
call   1090 <closedir@plt>
mov    %ebx,%eax
add    $0x18,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
mov    %r15,%rdi
call   1030 <free@plt>
mov    0x8(%rsp),%rax
mov    %r13,(%rax)
xor    %ebx,%ebx
jmp    138d <name2pid+0x1ad>
lea    0xc45(%rip),%rdi
lea    0xc47(%rip),%rdx
mov    $0x1,%esi
call   1070 <exechelp_logerrv@plt>
mov    $0x1,%edi
call   10e0 <exit@plt>

LLVM IR (-O0):
%struct.dirent = type { i8* }
@.str = [6 x i8] c"/proc\00"
@.str.1 = [9 x i8] c"firejail\00"
@.str.2 = [36 x i8] c"Error: cannot open /proc directory\0A\00"
@.str.3 = [8 x i8] c"--name=\00"
@.str.4 = [4 x i8] c" --\00"
define i32 @name2pid(i8* %0, i64* %1) {
%3 = alloca i32
%4 = alloca i8*
%5 = alloca i64*
%6 = alloca i64
%7 = alloca i32*
%8 = alloca %struct.dirent*
%9 = alloca i8*
%10 = alloca i64
%11 = alloca i8*
%12 = alloca i8*
%13 = alloca i8*
%14 = alloca i8*
%15 = alloca i8*
%16 = alloca i8*
%17 = alloca i32
store i8* %0, i8** %4
store i64* %1, i64** %5
%18 = call i64 (...) @getpid()
store i64 %18, i64* %6
%19 = call i32* @opendir(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0))
store i32* %19, i32** %7
%20 = icmp ne i32* %19, null
br i1 %20, label %29, label %21
21: ; preds = %2
%22 = call i32 @sleep(i32 2)
%23 = call i32* @opendir(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0))
store i32* %23, i32** %7
%24 = icmp ne i32* %23, null
br i1 %24, label %28, label %25
25: ; preds = %21
%26 = call i32 @exechelp_logerrv(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.1, i64 0, i64 0), i32 1, i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str.2, i64 0, i64 0))
%27 = call i32 @exit(i32 1)
unreachable
28: ; preds = %21
br label %29
29: ; preds = %28, %2
br label %30
30: ; preds = %138, %88, %71, %54, %49, %29
%31 = load i32*, i32** %7
%32 = call %struct.dirent* @readdir(i32* %31)
store %struct.dirent* %32, %struct.dirent** %8
%33 = icmp ne %struct.dirent* %32, null
br i1 %33, label %34, label %139
34: ; preds = %30
%35 = load %struct.dirent*, %struct.dirent** %8
%36 = getelementptr inbounds %struct.dirent, %struct.dirent* %35, i32 0, i32 0
%37 = load i8*, i8** %36
%38 = call i64 @strtol(i8* %37, i8** %9, i32 10)
store i64 %38, i64* %10
%39 = load i8*, i8** %9
%40 = load %struct.dirent*, %struct.dirent** %8
%41 = getelementptr inbounds %struct.dirent, %struct.dirent* %40, i32 0, i32 0
%42 = load i8*, i8** %41
%43 = icmp eq i8* %39, %42
br i1 %43, label %49, label %44
44: ; preds = %34
%45 = load i8*, i8** %9
%46 = load i8, i8* %45
%47 = sext i8 %46 to i32
%48 = icmp ne i32 %47, 0
br i1 %48, label %49, label %50
49: ; preds = %44, %34
br label %30
50: ; preds = %44
%51 = load i64, i64* %10
%52 = load i64, i64* %6
%53 = icmp eq i64 %51, %52
br i1 %53, label %54, label %55
54: ; preds = %50
br label %30
55: ; preds = %50
%56 = load i64, i64* %10
%57 = call i8* @pid_proc_comm(i64 %56)
store i8* %57, i8** %11
%58 = load i8*, i8** %11
%59 = icmp ne i8* %58, null
br i1 %59, label %60, label %77
60: ; preds = %55
%61 = load i8*, i8** %11
%62 = call i8* @strchr(i8* %61, i8 signext 10)
store i8* %62, i8** %12
%63 = load i8*, i8** %12
%64 = icmp ne i8* %63, null
br i1 %64, label %65, label %67
65: ; preds = %60
%66 = load i8*, i8** %12
store i8 0, i8* %66
br label %67
67: ; preds = %65, %60
%68 = load i8*, i8** %11
%69 = call i32 @strcmp(i8* %68, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.1, i64 0, i64 0))
%70 = icmp ne i32 %69, 0
br i1 %70, label %71, label %74
71: ; preds = %67
%72 = load i8*, i8** %11
%73 = call i32 @free(i8* %72)
br label %30
74: ; preds = %67
%75 = load i8*, i8** %11
%76 = call i32 @free(i8* %75)
br label %77
77: ; preds = %74, %55
%78 = load i64, i64* %10
%79 = call i8* @pid_proc_cmdline(i64 %78)
store i8* %79, i8** %13
%80 = load i8*, i8** %13
%81 = icmp ne i8* %80, null
br i1 %81, label %82, label %138
82: ; preds = %77
%83 = load i8*, i8** %13
%84 = call i8* @strstr(i8* %83, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.3, i64 0, i64 0))
store i8* %84, i8** %14
%85 = load i8*, i8** %14
store i8* %85, i8** %15
%86 = load i8*, i8** %14
%87 = icmp ne i8* %86, null
br i1 %87, label %91, label %88
88: ; preds = %82
%89 = load i8*, i8** %13
%90 = call i32 @free(i8* %89)
br label %30
91: ; preds = %82
%92 = load i8*, i8** %14
%93 = call i8* @strstr(i8* %92, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.4, i64 0, i64 0))
store i8* %93, i8** %16
%94 = load i8*, i8** %16
%95 = icmp ne i8* %94, null
br i1 %95, label %96, label %98
96: ; preds = %91
%97 = load i8*, i8** %16
store i8 0, i8* %97
br label %121
98: ; preds = %91
br label %99
99: ; preds = %116, %98
%100 = load i8*, i8** %14
%101 = load i8, i8* %100
%102 = sext i8 %101 to i32
%103 = icmp ne i32 %102, 32
br i1 %103, label %104, label %114
104: ; preds = %99
%105 = load i8*, i8** %14
%106 = load i8, i8* %105
%107 = sext i8 %106 to i32
%108 = icmp ne i32 %107, 9
br i1 %108, label %109, label %114
109: ; preds = %104
%110 = load i8*, i8** %14
%111 = load i8, i8* %110
%112 = sext i8 %111 to i32
%113 = icmp ne i32 %112, 0
br label %114
114: ; preds = %109, %104, %99
%115 = phi i1 [ false, %104 ], [ false, %99 ], [ %113, %109 ]
br i1 %115, label %116, label %119
116: ; preds = %114
%117 = load i8*, i8** %14
%118 = getelementptr inbounds i8, i8* %117, i32 1
store i8* %118, i8** %14
br label %99
119: ; preds = %114
%120 = load i8*, i8** %14
store i8 0, i8* %120
br label %121
121: ; preds = %119, %96
%122 = load i8*, i8** %15
%123 = getelementptr inbounds i8, i8* %122, i64 7
%124 = load i8*, i8** %4
%125 = call i32 @strcmp(i8* %123, i8* %124)
store i32 %125, i32* %17
%126 = load i32, i32* %17
%127 = icmp eq i32 %126, 0
br i1 %127, label %128, label %135
128: ; preds = %121
%129 = load i8*, i8** %13
%130 = call i32 @free(i8* %129)
%131 = load i64, i64* %10
%132 = load i64*, i64** %5
store i64 %131, i64* %132
%133 = load i32*, i32** %7
%134 = call i32 @closedir(i32* %133)
store i32 0, i32* %3
br label %142
135: ; preds = %121
%136 = load i8*, i8** %13
%137 = call i32 @free(i8* %136)
br label %138
138: ; preds = %135, %77
br label %30
139: ; preds = %30
%140 = load i32*, i32** %7
%141 = call i32 @closedir(i32* %140)
store i32 1, i32* %3
br label %142
142: ; preds = %139, %128
%143 = load i32, i32* %3
ret i32 %143
}

LLVM IR (-O2):
%struct.dirent = type { i8* }
@.str = [6 x i8] c"/proc\00"
@.str.1 = [9 x i8] c"firejail\00"
@.str.2 = [36 x i8] c"Error: cannot open /proc directory\0A\00"
@.str.3 = [8 x i8] c"--name=\00"
@.str.4 = [4 x i8] c" --\00"
define i32 @name2pid(i8* nocapture %0, i64* nocapture writeonly %1) {
%3 = alloca i8*
%4 = tail call i64 (...) @getpid()
%5 = tail call i32* @opendir(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0))
%6 = icmp eq i32* %5, null
br i1 %6, label %7, label %14
7: ; preds = %2
%8 = tail call i32 @sleep(i32 2)
%9 = tail call i32* @opendir(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0))
%10 = icmp eq i32* %9, null
br i1 %10, label %11, label %14
11: ; preds = %7
%12 = tail call i32 @exechelp_logerrv(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.1, i64 0, i64 0), i32 1, i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str.2, i64 0, i64 0))
%13 = tail call i32 @exit(i32 1)
unreachable
14: ; preds = %7, %2
%15 = phi i32* [ %5, %2 ], [ %9, %7 ]
%16 = bitcast i8** %3 to i8*
%17 = tail call %struct.dirent* @readdir(i32* %15)
%18 = icmp eq %struct.dirent* %17, null
br i1 %18, label %69, label %19
19: ; preds = %14, %66
%20 = phi %struct.dirent* [ %67, %66 ], [ %17, %14 ]
%21 = getelementptr inbounds %struct.dirent, %struct.dirent* %20, i64 0, i32 0
%22 = load i8*, i8** %21
%23 = call i64 @strtol(i8* %22, i8** %3, i32 10)
%24 = load i8*, i8** %3
%25 = load i8*, i8** %21
%26 = icmp eq i8* %24, %25
br i1 %26, label %66, label %27
27: ; preds = %19
%28 = load i8, i8* %24
%29 = icmp ne i8 %28, 0
%30 = icmp eq i64 %23, %4
%31 = select i1 %29, i1 true, i1 %30
br i1 %31, label %66, label %32
32: ; preds = %27
%33 = tail call i8* @pid_proc_comm(i64 %23)
%34 = icmp eq i8* %33, null
br i1 %34, label %43, label %35
35: ; preds = %32
%36 = tail call i8* @strchr(i8* %33, 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 = tail call i32 @strcmp(i8* %33, i8* dereferenceable(9) getelementptr inbounds ([9 x i8], [9 x i8]* @.str.1, i64 0, i64 0))
%41 = icmp eq i32 %40, 0
%42 = tail call i32 @free(i8* %33)
br i1 %41, label %43, label %66
43: ; preds = %39, %32
%44 = tail call i8* @pid_proc_cmdline(i64 %23)
%45 = icmp eq i8* %44, null
br i1 %45, label %66, label %46
46: ; preds = %43
%47 = tail call i8* @strstr(i8* %44, i8* dereferenceable(1) getelementptr inbounds ([8 x i8], [8 x i8]* @.str.3, i64 0, i64 0))
%48 = icmp eq i8* %47, null
br i1 %48, label %64, label %49
49: ; preds = %46
%50 = tail call i8* @strstr(i8* %47, i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.4, i64 0, i64 0))
%51 = icmp eq i8* %50, null
br i1 %51, label %52, label %57
52: ; preds = %49, %55
%53 = phi i8* [ %56, %55 ], [ %47, %49 ]
%54 = load i8, i8* %53
switch i8 %54, label %55 [
i8 32, label %57
i8 9, label %57
i8 0, label %57
]
55: ; preds = %52
%56 = getelementptr inbounds i8, i8* %53, i64 1
br label %52
57: ; preds = %52, %52, %52, %49
%58 = phi i8* [ %50, %49 ], [ %53, %52 ], [ %53, %52 ], [ %53, %52 ]
store i8 0, i8* %58
%59 = getelementptr inbounds i8, i8* %47, i64 7
%60 = tail call i32 @strcmp(i8* %59, i8* dereferenceable(1) %0)
%61 = icmp eq i32 %60, 0
br i1 %61, label %62, label %64
62: ; preds = %57
%63 = tail call i32 @free(i8* %44)
store i64 %23, i64* %1
br label %69
64: ; preds = %57, %46
%65 = tail call i32 @free(i8* %44)
br label %66
66: ; preds = %64, %39, %43, %19, %27
%67 = tail call %struct.dirent* @readdir(i32* %15)
%68 = icmp eq %struct.dirent* %67, null
br i1 %68, label %69, label %19
69: ; preds = %66, %14, %62
%70 = phi i32 [ 0, %62 ], [ 1, %14 ], [ 1, %66 ]
%71 = tail call i32 @closedir(i32* %15)
ret i32 %70
}