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

/* Variables and functions */
char *Catenate(char *, char *, char *, char *);
char *PathTo(char *);
char *Root(char *, char *);
int /*<<< orphan*/ closedir(int /*<<< orphan*/ *);
int /*<<< orphan*/ free(char *);
int /*<<< orphan*/ *opendir(char *);
struct dirent *readdir(int /*<<< orphan*/ *);
int /*<<< orphan*/ rewinddir(int /*<<< orphan*/ *);
scalar_t__ strcasecmp(char *, char *);
scalar_t__ strcmp(char *, char *);
int strlen(char *);
scalar_t__ strncmp(char *, char *, int);
int /*<<< orphan*/ strncpy(char *, char *, int);
int List_DB_Files(char *path, void foreach (char *path, char *extension)) {
  int status, rlen, dlen;
  char *root, *pwd, *name;
  DIR *dirp;
  struct dirent *dp;
  status = 0;
  pwd = PathTo(path);
  root = Root(path, ".db");
  rlen = strlen(root);
  if (root == NULL || pwd == NULL) {
    status = 1;
    goto exit;
  }
  if ((dirp = opendir(pwd)) == NULL) {
    status = 1;
    goto exit;
  }
  while ((dp = readdir(dirp)) != NULL) {
    name = dp->d_name;
    if (strcmp(name, Catenate("", "", root, ".db")) == 0)
      break;
    if (strcasecmp(name, Catenate("", "", root, ".db")) == 0) {
      strncpy(root, name, rlen);
      break;
    }
  }
  if (dp == NULL) {
    status = 1;
    closedir(dirp);
    goto exit;
  }
  foreach (Catenate(pwd, "/", root, ".db"), "db")
    ;
  rewinddir(dirp);
  while ((dp = readdir(dirp)) != NULL) {
    name = dp->d_name;
    dlen = strlen(name);
    if (name[0] != '.')
      continue;
    dlen -= 1;
    name += 1;
    if (dlen < rlen + 1)
      continue;
    if (name[rlen] != '.')
      continue;
    if (strncmp(name, root, rlen) != 0)
      continue;
    foreach (Catenate(pwd, "/.", name, ""), name + (rlen + 1))
      ;
  }
  closedir(dirp);
exit:
  free(pwd);
  free(root);
  return (status);
}


x86 assembly (clang, -O0):
<List_DB_Files>:
push   %rbp
mov    %rsp,%rbp
sub    $0x70,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movl   $0x0,-0x14(%rbp)
mov    -0x8(%rbp),%rdi
call   1030 <PathTo@plt>
mov    %rax,-0x30(%rbp)
mov    -0x8(%rbp),%rdi
lea    0xe01(%rip),%rsi
call   10c0 <Root@plt>
mov    %rax,-0x28(%rbp)
mov    -0x28(%rbp),%rdi
call   1090 <strlen@plt>
mov    %eax,-0x18(%rbp)
cmpq   $0x0,-0x28(%rbp)
je     122a <List_DB_Files+0x5a>
cmpq   $0x0,-0x30(%rbp)
jne    1236 <List_DB_Files+0x66>
movl   $0x1,-0x14(%rbp)
jmp    145c <List_DB_Files+0x28c>
mov    -0x30(%rbp),%rdi
call   1080 <opendir@plt>
mov    %rax,-0x40(%rbp)
cmp    $0x0,%rax
jne    1259 <List_DB_Files+0x89>
movl   $0x1,-0x14(%rbp)
jmp    145c <List_DB_Files+0x28c>
jmp    125e <List_DB_Files+0x8e>
mov    -0x40(%rbp),%rdi
call   10e0 <readdir@plt>
mov    %rax,-0x48(%rbp)
cmp    $0x0,%rax
je     130f <List_DB_Files+0x13f>
mov    -0x48(%rbp),%rax
mov    (%rax),%rax
mov    %rax,-0x38(%rbp)
mov    -0x38(%rbp),%rax
mov    %rax,-0x50(%rbp)
mov    -0x28(%rbp),%rdx
lea    0xd75(%rip),%rsi
lea    0xd66(%rip),%rcx
mov    %rsi,%rdi
call   10f0 <Catenate@plt>
mov    -0x50(%rbp),%rdi
mov    %rax,%rsi
call   10d0 <strcmp@plt>
cmp    $0x0,%rax
jne    12bd <List_DB_Files+0xed>
jmp    130f <List_DB_Files+0x13f>
mov    -0x38(%rbp),%rax
mov    %rax,-0x58(%rbp)
mov    -0x28(%rbp),%rdx
lea    0xd38(%rip),%rsi
lea    0xd29(%rip),%rcx
mov    %rsi,%rdi
call   10f0 <Catenate@plt>
mov    -0x58(%rbp),%rdi
mov    %rax,%rsi
call   1050 <strcasecmp@plt>
cmp    $0x0,%rax
jne    130a <List_DB_Files+0x13a>
mov    -0x28(%rbp),%rdi
mov    -0x38(%rbp),%rsi
mov    -0x18(%rbp),%edx
call   1060 <strncpy@plt>
jmp    130f <List_DB_Files+0x13f>
jmp    125e <List_DB_Files+0x8e>
cmpq   $0x0,-0x48(%rbp)
jne    132f <List_DB_Files+0x15f>
movl   $0x1,-0x14(%rbp)
mov    -0x40(%rbp),%rdi
call   10b0 <closedir@plt>
jmp    145c <List_DB_Files+0x28c>
mov    -0x10(%rbp),%rax
mov    %rax,-0x60(%rbp)
mov    -0x30(%rbp),%rdi
mov    -0x28(%rbp),%rdx
lea    0xcbe(%rip),%rsi
lea    0xcb3(%rip),%rcx
call   10f0 <Catenate@plt>
mov    %rax,%rdi
mov    -0x60(%rbp),%rax
lea    0xca1(%rip),%rsi
call   *%rax
mov    -0x40(%rbp),%rdi
call   10a0 <rewinddir@plt>
mov    -0x40(%rbp),%rdi
call   10e0 <readdir@plt>
mov    %rax,-0x48(%rbp)
cmp    $0x0,%rax
je     1453 <List_DB_Files+0x283>
mov    -0x48(%rbp),%rax
mov    (%rax),%rax
mov    %rax,-0x38(%rbp)
mov    -0x38(%rbp),%rdi
call   1090 <strlen@plt>
mov    %eax,-0x1c(%rbp)
mov    -0x38(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x2e,%eax
je     13ae <List_DB_Files+0x1de>
jmp    136b <List_DB_Files+0x19b>
mov    -0x1c(%rbp),%eax
sub    $0x1,%eax
mov    %eax,-0x1c(%rbp)
mov    -0x38(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x38(%rbp)
mov    -0x1c(%rbp),%eax
mov    -0x18(%rbp),%ecx
add    $0x1,%ecx
cmp    %ecx,%eax
jge    13d9 <List_DB_Files+0x209>
jmp    136b <List_DB_Files+0x19b>
mov    -0x38(%rbp),%rax
movslq -0x18(%rbp),%rcx
movsbl (%rax,%rcx,1),%eax
cmp    $0x2e,%eax
je     13f3 <List_DB_Files+0x223>
jmp    136b <List_DB_Files+0x19b>
mov    -0x38(%rbp),%rdi
mov    -0x28(%rbp),%rsi
mov    -0x18(%rbp),%edx
call   1070 <strncmp@plt>
cmp    $0x0,%rax
je     1412 <List_DB_Files+0x242>
jmp    136b <List_DB_Files+0x19b>
mov    -0x10(%rbp),%rax
mov    %rax,-0x68(%rbp)
mov    -0x30(%rbp),%rdi
mov    -0x38(%rbp),%rdx
lea    0xbdd(%rip),%rsi
lea    0xbd8(%rip),%rcx
call   10f0 <Catenate@plt>
mov    %rax,%rdi
mov    -0x68(%rbp),%rax
mov    -0x38(%rbp),%rsi
mov    -0x18(%rbp),%ecx
add    $0x1,%ecx
movslq %ecx,%rcx
add    %rcx,%rsi
call   *%rax
jmp    136b <List_DB_Files+0x19b>
mov    -0x40(%rbp),%rdi
call   10b0 <closedir@plt>
mov    -0x30(%rbp),%rdi
call   1040 <free@plt>
mov    -0x28(%rbp),%rdi
call   1040 <free@plt>
mov    -0x14(%rbp),%eax
add    $0x70,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<List_DB_Files>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x28,%rsp
mov    %rsi,%rbp
mov    %rdi,%rbx
call   1030 <PathTo@plt>
mov    %rax,%r14
lea    0xe0d(%rip),%rsi
mov    %rbx,%rdi
call   10c0 <Root@plt>
mov    %rax,%rbx
mov    %rax,%rdi
call   1090 <strlen@plt>
mov    %eax,0xc(%rsp)
mov    $0x1,%r15d
test   %rbx,%rbx
je     139f <List_DB_Files+0x1cf>
test   %r14,%r14
je     139f <List_DB_Files+0x1cf>
mov    %r14,%rdi
call   1080 <opendir@plt>
test   %rax,%rax
je     139f <List_DB_Files+0x1cf>
mov    %rax,%r12
mov    %rbp,0x10(%rsp)
lea    0xdc6(%rip),%rbp
lea    0xdb7(%rip),%r15
nopl   0x0(%rax)
mov    %r12,%rdi
call   10e0 <readdir@plt>
test   %rax,%rax
je     1391 <List_DB_Files+0x1c1>
mov    (%rax),%r13
mov    %rbp,%rdi
mov    %rbp,%rsi
mov    %rbx,%rdx
mov    %r15,%rcx
call   10f0 <Catenate@plt>
mov    %r13,%rdi
mov    %rax,%rsi
call   10d0 <strcmp@plt>
test   %rax,%rax
je     12b5 <List_DB_Files+0xe5>
mov    %rbp,%rdi
mov    %rbp,%rsi
mov    %rbx,%rdx
mov    %r15,%rcx
call   10f0 <Catenate@plt>
mov    %r13,%rdi
mov    %rax,%rsi
call   1050 <strcasecmp@plt>
test   %rax,%rax
jne    1250 <List_DB_Files+0x80>
mov    %rbx,%rdi
mov    %r13,%rsi
mov    0xc(%rsp),%edx
call   1060 <strncpy@plt>
lea    0xd48(%rip),%rsi
lea    0xd3d(%rip),%rcx
mov    %r14,%rdi
mov    %rbx,%rdx
call   10f0 <Catenate@plt>
lea    0xd2c(%rip),%rsi
mov    %rax,%rdi
call   *0x10(%rsp)
mov    %r12,%rdi
call   10a0 <rewinddir@plt>
mov    %r12,%rdi
call   10e0 <readdir@plt>
xor    %r15d,%r15d
test   %rax,%rax
je     1397 <List_DB_Files+0x1c7>
mov    0xc(%rsp),%r13d
movslq %r13d,%rcx
mov    %rcx,0x20(%rsp)
add    $0x1,%r13d
movslq %r13d,%rcx
mov    %rcx,0x18(%rsp)
jmp    132d <List_DB_Files+0x15d>
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
mov    %r12,%rdi
call   10e0 <readdir@plt>
test   %rax,%rax
je     1397 <List_DB_Files+0x1c7>
mov    (%rax),%rbp
mov    %rbp,%rdi
call   1090 <strlen@plt>
cmpb   $0x2e,0x0(%rbp)
jne    1320 <List_DB_Files+0x150>
cmp    %r13d,%eax
jle    1320 <List_DB_Files+0x150>
add    $0x1,%rbp
mov    0x20(%rsp),%rax
cmpb   $0x2e,0x0(%rbp,%rax,1)
jne    1320 <List_DB_Files+0x150>
mov    %rbp,%rdi
mov    %rbx,%rsi
mov    0xc(%rsp),%edx
call   1070 <strncmp@plt>
test   %rax,%rax
jne    1320 <List_DB_Files+0x150>
mov    %r14,%rdi
lea    0xc95(%rip),%rsi
mov    %rbp,%rdx
lea    0xc8d(%rip),%rcx
call   10f0 <Catenate@plt>
add    0x18(%rsp),%rbp
mov    %rax,%rdi
mov    %rbp,%rsi
call   *0x10(%rsp)
jmp    1320 <List_DB_Files+0x150>
mov    $0x1,%r15d
mov    %r12,%rdi
call   10b0 <closedir@plt>
mov    %r14,%rdi
call   1040 <free@plt>
mov    %rbx,%rdi
call   1040 <free@plt>
mov    %r15d,%eax
add    $0x28,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

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

LLVM IR (-O2):
%struct.dirent = type { i8* }
@.str = [4 x i8] c".db\00"
@.str.1 = [1 x i8] zeroinitializer
@.str.2 = [2 x i8] c"/\00"
@.str.3 = [3 x i8] c"db\00"
@.str.4 = [3 x i8] c"/.\00"
define i32 @List_DB_Files(i8* %0, void (i8*, i8*)* nocapture %1) {
%3 = tail call i8* @PathTo(i8* %0)
%4 = tail call i8* @Root(i8* %0, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0))
%5 = tail call i32 @strlen(i8* %4)
%6 = icmp eq i8* %4, null
%7 = icmp eq i8* %3, null
%8 = select i1 %6, i1 true, i1 %7
br i1 %8, label %62, label %9
9: ; preds = %2
%10 = tail call i32* @opendir(i8* %3)
%11 = icmp eq i32* %10, null
br i1 %11, label %62, label %12
12: ; preds = %9, %21
%13 = tail call %struct.dirent* @readdir(i32* %10)
%14 = icmp eq %struct.dirent* %13, null
br i1 %14, label %59, label %15
15: ; preds = %12
%16 = getelementptr inbounds %struct.dirent, %struct.dirent* %13, i64 0, i32 0
%17 = load i8*, i8** %16
%18 = tail call i8* @Catenate(i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.1, i64 0, i64 0), i8* %4, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0))
%19 = tail call i64 @strcmp(i8* %17, i8* %18)
%20 = icmp eq i64 %19, 0
br i1 %20, label %27, label %21
21: ; preds = %15
%22 = tail call i8* @Catenate(i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.1, i64 0, i64 0), i8* %4, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0))
%23 = tail call i64 @strcasecmp(i8* %17, i8* %22)
%24 = icmp eq i64 %23, 0
br i1 %24, label %25, label %12
25: ; preds = %21
%26 = tail call i32 @strncpy(i8* %4, i8* %17, i32 %5)
br label %27
27: ; preds = %15, %25
%28 = tail call i8* @Catenate(i8* %3, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0), i8* %4, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0))
tail call void %1(i8* %28, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0))
%29 = tail call i32 @rewinddir(i32* %10)
%30 = tail call %struct.dirent* @readdir(i32* %10)
%31 = icmp eq %struct.dirent* %30, null
br i1 %31, label %59, label %32
32: ; preds = %27
%33 = add nsw i32 %5, 1
%34 = sext i32 %5 to i64
%35 = sext i32 %33 to i64
br label %36
36: ; preds = %32, %56
%37 = phi %struct.dirent* [ %30, %32 ], [ %57, %56 ]
%38 = getelementptr inbounds %struct.dirent, %struct.dirent* %37, i64 0, i32 0
%39 = load i8*, i8** %38
%40 = tail call i32 @strlen(i8* %39)
%41 = load i8, i8* %39
%42 = icmp eq i8 %41, 46
br i1 %42, label %43, label %56
43: ; preds = %36
%44 = getelementptr inbounds i8, i8* %39, i64 1
%45 = icmp sgt i32 %40, %33
br i1 %45, label %46, label %56
46: ; preds = %43
%47 = getelementptr inbounds i8, i8* %44, i64 %34
%48 = load i8, i8* %47
%49 = icmp eq i8 %48, 46
br i1 %49, label %50, label %56
50: ; preds = %46
%51 = tail call i64 @strncmp(i8* %44, i8* %4, i32 %5)
%52 = icmp eq i64 %51, 0
br i1 %52, label %53, label %56
53: ; preds = %50
%54 = tail call i8* @Catenate(i8* %3, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0), i8* %44, i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.1, i64 0, i64 0))
%55 = getelementptr inbounds i8, i8* %44, i64 %35
tail call void %1(i8* %54, i8* %55)
br label %56
56: ; preds = %53, %36, %43, %46, %50
%57 = tail call %struct.dirent* @readdir(i32* %10)
%58 = icmp eq %struct.dirent* %57, null
br i1 %58, label %59, label %36
59: ; preds = %12, %56, %27
%60 = phi i32 [ 0, %27 ], [ 0, %56 ], [ 1, %12 ]
%61 = tail call i32 @closedir(i32* %10)
br label %62
62: ; preds = %59, %9, %2
%63 = phi i32 [ 1, %2 ], [ 1, %9 ], [ %60, %59 ]
%64 = tail call i32 @free(i8* %3)
%65 = tail call i32 @free(i8* %4)
ret i32 %63
}