#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 stat {
  int /*<<< orphan*/ st_mode;
};
struct dirent {
  char *d_name;
};
typedef int /*<<< orphan*/ mode_t;
typedef int /*<<< orphan*/ DIR;

/* Variables and functions */
int /*<<< orphan*/ S_ISDIR(int /*<<< orphan*/);
scalar_t__ closedir(int /*<<< orphan*/ *);
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, ...);
int /*<<< orphan*/ fputc(char, int /*<<< orphan*/);
int /*<<< orphan*/ free(char *);
char *malloc(int);
int /*<<< orphan*/ *opendir(char *);
struct dirent *readdir(int /*<<< orphan*/ *);
scalar_t__ stat(char *, struct stat *);
int /*<<< orphan*/ stderr;
int /*<<< orphan*/ stdout;
int /*<<< orphan*/ strcat(char *, char *);
scalar_t__ strcmp(char *, char *);
int /*<<< orphan*/ strcpy(char *, char *);
int strlen(char *);
void recursiveVisit(char *folder, int level) {
  char *fname;
  int i, malloc_size;
  struct stat stat_buf, temp_stat_buf;
  mode_t stat_mode;
  DIR *dir_stream;
  struct dirent *dir_entry;
  for (i = 0; i < level - 1; i++)
    fputc(' ', stdout);
  fprintf(stdout, "+%s\n", folder);
  if (stat(folder, &stat_buf) != 0) {
    fprintf(stdout, "Error while getting info on %s\n", folder);
    return;
  }
  dir_stream = opendir(folder);
  if (dir_stream == NULL) {
    fprintf(stdout, "Error while opening stream of %s\n", folder);
    return;
  }
  dir_entry = readdir(dir_stream);
  while (dir_entry != NULL) {
    malloc_size = (strlen(folder) + strlen(dir_entry->d_name) + 1 + 1);
    fname = malloc(malloc_size * sizeof(char));
    strcpy(fname, folder);
    strcat(fname, "/");
    strcat(fname, dir_entry->d_name);
    if (stat(fname, &temp_stat_buf) != 0) {
      fprintf(stdout, "Generic stat error?");
      return;
    }
    if (!S_ISDIR(temp_stat_buf.st_mode)) {
      for (i = 0; i < level; i++)
        fputc(' ', stdout);
      fprintf(stdout, "%s\n", dir_entry->d_name);
    } else {
      if (!(strcmp(dir_entry->d_name, ".") == 0 ||
            strcmp(dir_entry->d_name, "..") == 0)) {
        recursiveVisit(fname, level + 1);
      }
    }
    free(fname);
    dir_entry = readdir(dir_stream);
  }
  if (closedir(dir_stream)) {
    fprintf(stderr, "Error while closing DIR* stream\n");
    exit(1);
  }
  for (i = 0; i < level - 1; i++)
    fputc(' ', stdout);
  fprintf(stdout, "-%s\n\n", folder);
  return;
}


x86 assembly (clang, -O0):
<recursiveVisit>:
push   %rbp
mov    %rsp,%rbp
sub    $0x50,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
movl   $0x0,-0x1c(%rbp)
mov    -0x1c(%rbp),%eax
mov    -0xc(%rbp),%ecx
sub    $0x1,%ecx
cmp    %ecx,%eax
jge    1238 <recursiveVisit+0x48>
mov    0x2dba(%rip),%rax
mov    (%rax),%esi
mov    $0x20,%edi
call   1090 <fputc@plt>
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
jmp    1206 <recursiveVisit+0x16>
mov    0x2d99(%rip),%rax
mov    (%rax),%edi
mov    -0x8(%rbp),%rdx
lea    0xdb4(%rip),%rsi
mov    $0x0,%al
call   10b0 <fprintf@plt>
mov    -0x8(%rbp),%rdi
lea    -0x28(%rbp),%rsi
call   10c0 <stat@plt>
cmp    $0x0,%rax
je     128a <recursiveVisit+0x9a>
mov    0x2d67(%rip),%rax
mov    (%rax),%edi
mov    -0x8(%rbp),%rdx
lea    0xd87(%rip),%rsi
mov    $0x0,%al
call   10b0 <fprintf@plt>
jmp    14ce <recursiveVisit+0x2de>
mov    -0x8(%rbp),%rdi
call   1050 <opendir@plt>
mov    %rax,-0x40(%rbp)
cmpq   $0x0,-0x40(%rbp)
jne    12c2 <recursiveVisit+0xd2>
mov    0x2d2f(%rip),%rax
mov    (%rax),%edi
mov    -0x8(%rbp),%rdx
lea    0xd6f(%rip),%rsi
mov    $0x0,%al
call   10b0 <fprintf@plt>
jmp    14ce <recursiveVisit+0x2de>
mov    -0x40(%rbp),%rdi
call   10d0 <readdir@plt>
mov    %rax,-0x48(%rbp)
cmpq   $0x0,-0x48(%rbp)
je     1446 <recursiveVisit+0x256>
mov    -0x8(%rbp),%rdi
call   1060 <strlen@plt>
mov    %eax,-0x4c(%rbp)
mov    -0x48(%rbp),%rax
mov    (%rax),%rdi
call   1060 <strlen@plt>
mov    %eax,%ecx
mov    -0x4c(%rbp),%eax
add    %ecx,%eax
add    $0x1,%eax
add    $0x1,%eax
mov    %eax,-0x20(%rbp)
movslq -0x20(%rbp),%rax
shl    $0x0,%rax
mov    %eax,%edi
call   10e0 <malloc@plt>
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rdi
mov    -0x8(%rbp),%rsi
call   1040 <strcpy@plt>
mov    -0x18(%rbp),%rdi
lea    0xd1a(%rip),%rsi
call   10f0 <strcat@plt>
mov    -0x18(%rbp),%rdi
mov    -0x48(%rbp),%rax
mov    (%rax),%rsi
call   10f0 <strcat@plt>
mov    -0x18(%rbp),%rdi
lea    -0x30(%rbp),%rsi
call   10c0 <stat@plt>
cmp    $0x0,%rax
je     1375 <recursiveVisit+0x185>
mov    0x2c78(%rip),%rax
mov    (%rax),%edi
lea    0xce0(%rip),%rsi
mov    $0x0,%al
call   10b0 <fprintf@plt>
jmp    14ce <recursiveVisit+0x2de>
mov    -0x30(%rbp),%edi
call   1070 <S_ISDIR@plt>
cmp    $0x0,%eax
jne    13dd <recursiveVisit+0x1ed>
movl   $0x0,-0x1c(%rbp)
mov    -0x1c(%rbp),%eax
cmp    -0xc(%rbp),%eax
jge    13ba <recursiveVisit+0x1ca>
mov    0x2c38(%rip),%rax
mov    (%rax),%esi
mov    $0x20,%edi
call   1090 <fputc@plt>
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
jmp    138d <recursiveVisit+0x19d>
mov    0x2c17(%rip),%rax
mov    (%rax),%edi
mov    -0x48(%rbp),%rax
mov    (%rax),%rdx
lea    0xc72(%rip),%rsi
mov    $0x0,%al
call   10b0 <fprintf@plt>
jmp    142b <recursiveVisit+0x23b>
mov    -0x48(%rbp),%rax
mov    (%rax),%rdi
lea    0xc73(%rip),%rsi
call   10a0 <strcmp@plt>
cmp    $0x0,%rax
je     1426 <recursiveVisit+0x236>
mov    -0x48(%rbp),%rax
mov    (%rax),%rdi
lea    0xc55(%rip),%rsi
call   10a0 <strcmp@plt>
cmp    $0x0,%rax
je     1426 <recursiveVisit+0x236>
mov    -0x18(%rbp),%rdi
mov    -0xc(%rbp),%esi
add    $0x1,%esi
call   1110 <recursiveVisit@plt>
jmp    142b <recursiveVisit+0x23b>
mov    -0x18(%rbp),%rdi
call   1030 <free@plt>
mov    -0x40(%rbp),%rdi
call   10d0 <readdir@plt>
mov    %rax,-0x48(%rbp)
jmp    12cf <recursiveVisit+0xdf>
mov    -0x40(%rbp),%rdi
call   1080 <closedir@plt>
cmp    $0x0,%rax
je     147a <recursiveVisit+0x28a>
mov    0x2b80(%rip),%rax
mov    (%rax),%edi
lea    0xbf7(%rip),%rsi
mov    $0x0,%al
call   10b0 <fprintf@plt>
mov    $0x1,%edi
call   1100 <exit@plt>
movl   $0x0,-0x1c(%rbp)
mov    -0x1c(%rbp),%eax
mov    -0xc(%rbp),%ecx
sub    $0x1,%ecx
cmp    %ecx,%eax
jge    14b3 <recursiveVisit+0x2c3>
mov    0x2b3f(%rip),%rax
mov    (%rax),%esi
mov    $0x20,%edi
call   1090 <fputc@plt>
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
jmp    1481 <recursiveVisit+0x291>
mov    0x2b1e(%rip),%rax
mov    (%rax),%edi
mov    -0x8(%rbp),%rdx
lea    0xbba(%rip),%rsi
mov    $0x0,%al
call   10b0 <fprintf@plt>
add    $0x50,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<recursiveVisit>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x28,%rsp
mov    %rdi,0x8(%rsp)
lea    -0x1(%rsi),%r15d
mov    %rsi,(%rsp)
cmp    $0x2,%esi
jl     1232 <recursiveVisit+0x42>
mov    0x2dc1(%rip),%rbp
mov    %r15d,%ebx
nopw   0x0(%rax,%rax,1)
mov    0x0(%rbp),%esi
mov    $0x20,%edi
call   1090 <fputc@plt>
add    $0xffffffff,%ebx
jne    1220 <recursiveVisit+0x30>
mov    0x2d9f(%rip),%rbp
mov    0x0(%rbp),%edi
lea    0xdbd(%rip),%rsi
mov    0x8(%rsp),%rbx
mov    %rbx,%rdx
xor    %eax,%eax
call   10b0 <fprintf@plt>
lea    0x20(%rsp),%rsi
mov    %rbx,%rdi
call   10c0 <stat@plt>
test   %rax,%rax
je     1287 <recursiveVisit+0x97>
mov    0x0(%rbp),%edi
lea    0xd97(%rip),%rsi
mov    %rbx,%rdx
xor    %eax,%eax
call   10b0 <fprintf@plt>
add    $0x28,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
mov    %rbx,%rdi
call   1050 <opendir@plt>
test   %rax,%rax
je     1444 <recursiveVisit+0x254>
mov    %rax,%r14
mov    %r15d,0x18(%rsp)
mov    %rax,%rdi
call   10d0 <readdir@plt>
test   %rax,%rax
je     13f7 <recursiveVisit+0x207>
mov    %rax,%r12
mov    (%rsp),%rax
add    $0x1,%eax
mov    %eax,0x1c(%rsp)
jmp    1301 <recursiveVisit+0x111>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
mov    0x0(%rbp),%edi
mov    (%r12),%rdx
lea    0xd65(%rip),%rsi
xor    %eax,%eax
call   10b0 <fprintf@plt>
mov    %r13,%rdi
call   1030 <free@plt>
mov    %r14,%rdi
call   10d0 <readdir@plt>
mov    %rax,%r12
test   %rax,%rax
je     13f7 <recursiveVisit+0x207>
mov    %rbp,%r15
mov    %r14,%rbx
mov    0x8(%rsp),%r14
mov    %r14,%rdi
call   1060 <strlen@plt>
mov    %eax,%ebp
mov    (%r12),%rdi
call   1060 <strlen@plt>
lea    (%rax,%rbp,1),%edi
add    $0x2,%edi
call   10e0 <malloc@plt>
mov    %rax,%r13
mov    %rax,%rdi
mov    %r14,%rsi
call   1040 <strcpy@plt>
mov    %r13,%rdi
lea    0xd05(%rip),%rsi
call   10f0 <strcat@plt>
mov    (%r12),%rsi
mov    %r13,%rdi
call   10f0 <strcat@plt>
mov    %r13,%rdi
lea    0x10(%rsp),%rsi
call   10c0 <stat@plt>
test   %rax,%rax
jne    1453 <recursiveVisit+0x263>
mov    0x10(%rsp),%edi
call   1070 <S_ISDIR@plt>
test   %eax,%eax
mov    %r15,%rbp
je     13c0 <recursiveVisit+0x1d0>
mov    (%r12),%rdi
lea    0xcda(%rip),%rsi
call   10a0 <strcmp@plt>
test   %rax,%rax
mov    %rbx,%r14
je     12e5 <recursiveVisit+0xf5>
mov    (%r12),%rdi
lea    0xcbd(%rip),%rsi
call   10a0 <strcmp@plt>
test   %rax,%rax
je     12e5 <recursiveVisit+0xf5>
mov    %r13,%rdi
mov    0x1c(%rsp),%esi
call   1110 <recursiveVisit@plt>
jmp    12e5 <recursiveVisit+0xf5>
nop
cmpl   $0x0,(%rsp)
mov    %rbx,%r14
jle    12d0 <recursiveVisit+0xe0>
mov    (%rsp),%rax
mov    %eax,%ebx
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
mov    0x0(%rbp),%esi
mov    $0x20,%edi
call   1090 <fputc@plt>
add    $0xffffffff,%ebx
jne    13e0 <recursiveVisit+0x1f0>
jmp    12d0 <recursiveVisit+0xe0>
mov    %r14,%rdi
call   1080 <closedir@plt>
test   %rax,%rax
jne    1469 <recursiveVisit+0x279>
cmpl   $0x2,(%rsp)
mov    0x8(%rsp),%r14
mov    0x18(%rsp),%ebx
jl     1432 <recursiveVisit+0x242>
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
mov    0x0(%rbp),%esi
mov    $0x20,%edi
call   1090 <fputc@plt>
add    $0xffffffff,%ebx
jne    1420 <recursiveVisit+0x230>
mov    0x0(%rbp),%edi
lea    0xc45(%rip),%rsi
mov    %r14,%rdx
jmp    1271 <recursiveVisit+0x81>
mov    0x0(%rbp),%edi
lea    0xbd7(%rip),%rsi
jmp    126e <recursiveVisit+0x7e>
mov    (%r15),%edi
lea    0xbec(%rip),%rsi
xor    %eax,%eax
call   10b0 <fprintf@plt>
jmp    1278 <recursiveVisit+0x88>
mov    0x2b70(%rip),%rax
mov    (%rax),%edi
lea    0xbe7(%rip),%rsi
xor    %eax,%eax
call   10b0 <fprintf@plt>
mov    $0x1,%edi
call   1100 <exit@plt>

LLVM IR (-O0):
%struct.stat = type { i32 }
%struct.dirent = type { i8* }
@stdout = global i32 0
@.str = [5 x i8] c"+%s\0A\00"
@.str.1 = [32 x i8] c"Error while getting info on %s\0A\00"
@.str.2 = [34 x i8] c"Error while opening stream of %s\0A\00"
@.str.3 = [2 x i8] c"/\00"
@.str.4 = [20 x i8] c"Generic stat error?\00"
@.str.5 = [4 x i8] c"%s\0A\00"
@.str.6 = [2 x i8] c".\00"
@.str.7 = [3 x i8] c"..\00"
@stderr = global i32 0
@.str.8 = [33 x i8] c"Error while closing DIR* stream\0A\00"
@.str.9 = [6 x i8] c"-%s\0A\0A\00"
define void @recursiveVisit(i8* %0, i32 %1) {
%3 = alloca i8*
%4 = alloca i32
%5 = alloca i8*
%6 = alloca i32
%7 = alloca i32
%8 = alloca %struct.stat
%9 = alloca %struct.stat
%10 = alloca i32
%11 = alloca i32*
%12 = alloca %struct.dirent*
store i8* %0, i8** %3
store i32 %1, i32* %4
store i32 0, i32* %6
br label %13
13: ; preds = %21, %2
%14 = load i32, i32* %6
%15 = load i32, i32* %4
%16 = sub nsw i32 %15, 1
%17 = icmp slt i32 %14, %16
br i1 %17, label %18, label %24
18: ; preds = %13
%19 = load i32, i32* @stdout
%20 = call i32 @fputc(i8 signext 32, i32 %19)
br label %21
21: ; preds = %18
%22 = load i32, i32* %6
%23 = add nsw i32 %22, 1
store i32 %23, i32* %6
br label %13
24: ; preds = %13
%25 = load i32, i32* @stdout
%26 = load i8*, i8** %3
%27 = call i32 (i32, i8*, ...) @fprintf(i32 %25, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i8* %26)
%28 = load i8*, i8** %3
%29 = call i64 @stat(i8* %28, %struct.stat* %8)
%30 = icmp ne i64 %29, 0
br i1 %30, label %31, label %35
31: ; preds = %24
%32 = load i32, i32* @stdout
%33 = load i8*, i8** %3
%34 = call i32 (i32, i8*, ...) @fprintf(i32 %32, i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str.1, i64 0, i64 0), i8* %33)
br label %149
35: ; preds = %24
%36 = load i8*, i8** %3
%37 = call i32* @opendir(i8* %36)
store i32* %37, i32** %11
%38 = load i32*, i32** %11
%39 = icmp eq i32* %38, null
br i1 %39, label %40, label %44
40: ; preds = %35
%41 = load i32, i32* @stdout
%42 = load i8*, i8** %3
%43 = call i32 (i32, i8*, ...) @fprintf(i32 %41, i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str.2, i64 0, i64 0), i8* %42)
br label %149
44: ; preds = %35
%45 = load i32*, i32** %11
%46 = call %struct.dirent* @readdir(i32* %45)
store %struct.dirent* %46, %struct.dirent** %12
br label %47
47: ; preds = %120, %44
%48 = load %struct.dirent*, %struct.dirent** %12
%49 = icmp ne %struct.dirent* %48, null
br i1 %49, label %50, label %125
50: ; preds = %47
%51 = load i8*, i8** %3
%52 = call i32 @strlen(i8* %51)
%53 = load %struct.dirent*, %struct.dirent** %12
%54 = getelementptr inbounds %struct.dirent, %struct.dirent* %53, i32 0, i32 0
%55 = load i8*, i8** %54
%56 = call i32 @strlen(i8* %55)
%57 = add nsw i32 %52, %56
%58 = add nsw i32 %57, 1
%59 = add nsw i32 %58, 1
store i32 %59, i32* %7
%60 = load i32, i32* %7
%61 = sext i32 %60 to i64
%62 = mul i64 %61, 1
%63 = trunc i64 %62 to i32
%64 = call i8* @malloc(i32 %63)
store i8* %64, i8** %5
%65 = load i8*, i8** %5
%66 = load i8*, i8** %3
%67 = call i32 @strcpy(i8* %65, i8* %66)
%68 = load i8*, i8** %5
%69 = call i32 @strcat(i8* %68, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i64 0, i64 0))
%70 = load i8*, i8** %5
%71 = load %struct.dirent*, %struct.dirent** %12
%72 = getelementptr inbounds %struct.dirent, %struct.dirent* %71, i32 0, i32 0
%73 = load i8*, i8** %72
%74 = call i32 @strcat(i8* %70, i8* %73)
%75 = load i8*, i8** %5
%76 = call i64 @stat(i8* %75, %struct.stat* %9)
%77 = icmp ne i64 %76, 0
br i1 %77, label %78, label %81
78: ; preds = %50
%79 = load i32, i32* @stdout
%80 = call i32 (i32, i8*, ...) @fprintf(i32 %79, i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.4, i64 0, i64 0))
br label %149
81: ; preds = %50
%82 = getelementptr inbounds %struct.stat, %struct.stat* %9, i32 0, i32 0
%83 = load i32, i32* %82
%84 = call i32 @S_ISDIR(i32 %83)
%85 = icmp ne i32 %84, 0
br i1 %85, label %103, label %86
86: ; preds = %81
store i32 0, i32* %6
br label %87
87: ; preds = %94, %86
%88 = load i32, i32* %6
%89 = load i32, i32* %4
%90 = icmp slt i32 %88, %89
br i1 %90, label %91, label %97
91: ; preds = %87
%92 = load i32, i32* @stdout
%93 = call i32 @fputc(i8 signext 32, i32 %92)
br label %94
94: ; preds = %91
%95 = load i32, i32* %6
%96 = add nsw i32 %95, 1
store i32 %96, i32* %6
br label %87
97: ; preds = %87
%98 = load i32, i32* @stdout
%99 = load %struct.dirent*, %struct.dirent** %12
%100 = getelementptr inbounds %struct.dirent, %struct.dirent* %99, i32 0, i32 0
%101 = load i8*, i8** %100
%102 = call i32 (i32, i8*, ...) @fprintf(i32 %98, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.5, i64 0, i64 0), i8* %101)
br label %120
103: ; preds = %81
%104 = load %struct.dirent*, %struct.dirent** %12
%105 = getelementptr inbounds %struct.dirent, %struct.dirent* %104, i32 0, i32 0
%106 = load i8*, i8** %105
%107 = call i64 @strcmp(i8* %106, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.6, i64 0, i64 0))
%108 = icmp eq i64 %107, 0
br i1 %108, label %119, label %109
109: ; preds = %103
%110 = load %struct.dirent*, %struct.dirent** %12
%111 = getelementptr inbounds %struct.dirent, %struct.dirent* %110, i32 0, i32 0
%112 = load i8*, i8** %111
%113 = call i64 @strcmp(i8* %112, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.7, i64 0, i64 0))
%114 = icmp eq i64 %113, 0
br i1 %114, label %119, label %115
115: ; preds = %109
%116 = load i8*, i8** %5
%117 = load i32, i32* %4
%118 = add nsw i32 %117, 1
br label %119
119: ; preds = %115, %109, %103
br label %120
120: ; preds = %119, %97
%121 = load i8*, i8** %5
%122 = call i32 @free(i8* %121)
%123 = load i32*, i32** %11
%124 = call %struct.dirent* @readdir(i32* %123)
store %struct.dirent* %124, %struct.dirent** %12
br label %47
125: ; preds = %47
%126 = load i32*, i32** %11
%127 = call i64 @closedir(i32* %126)
%128 = icmp ne i64 %127, 0
br i1 %128, label %129, label %133
129: ; preds = %125
%130 = load i32, i32* @stderr
%131 = call i32 (i32, i8*, ...) @fprintf(i32 %130, i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str.8, i64 0, i64 0))
%132 = call i32 @exit(i32 1)
unreachable
133: ; preds = %125
store i32 0, i32* %6
br label %134
134: ; preds = %142, %133
%135 = load i32, i32* %6
%136 = load i32, i32* %4
%137 = sub nsw i32 %136, 1
%138 = icmp slt i32 %135, %137
br i1 %138, label %139, label %145
139: ; preds = %134
%140 = load i32, i32* @stdout
%141 = call i32 @fputc(i8 signext 32, i32 %140)
br label %142
142: ; preds = %139
%143 = load i32, i32* %6
%144 = add nsw i32 %143, 1
store i32 %144, i32* %6
br label %134
145: ; preds = %134
%146 = load i32, i32* @stdout
%147 = load i8*, i8** %3
%148 = call i32 (i32, i8*, ...) @fprintf(i32 %146, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.9, i64 0, i64 0), i8* %147)
br label %149
149: ; preds = %145, %78, %40, %31
ret void
}

LLVM IR (-O2):
%struct.stat = type { i32 }
%struct.dirent = type { i8* }
@stdout = global i32 0
@.str = [5 x i8] c"+%s\0A\00"
@.str.1 = [32 x i8] c"Error while getting info on %s\0A\00"
@.str.2 = [34 x i8] c"Error while opening stream of %s\0A\00"
@.str.3 = [2 x i8] c"/\00"
@.str.4 = [20 x i8] c"Generic stat error?\00"
@.str.5 = [4 x i8] c"%s\0A\00"
@.str.6 = [2 x i8] c".\00"
@.str.7 = [3 x i8] c"..\00"
@stderr = global i32 0
@.str.8 = [33 x i8] c"Error while closing DIR* stream\0A\00"
@.str.9 = [6 x i8] c"-%s\0A\0A\00"
define void @recursiveVisit(i8* %0, i32 %1) {
%3 = alloca %struct.stat
%4 = alloca %struct.stat
%5 = bitcast %struct.stat* %3 to i8*
%6 = bitcast %struct.stat* %4 to i8*
%7 = add i32 %1, -1
%8 = icmp sgt i32 %1, 1
br i1 %8, label %9, label %15
9: ; preds = %2, %9
%10 = phi i32 [ %13, %9 ], [ 0, %2 ]
%11 = load i32, i32* @stdout
%12 = tail call i32 @fputc(i8 signext 32, i32 %11)
%13 = add nuw nsw i32 %10, 1
%14 = icmp eq i32 %13, %7
br i1 %14, label %15, label %9
15: ; preds = %9, %2
%16 = load i32, i32* @stdout
%17 = tail call i32 (i32, i8*, ...) @fprintf(i32 %16, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i8* %0)
%18 = call i64 @stat(i8* %0, %struct.stat* %3)
%19 = icmp eq i64 %18, 0
br i1 %19, label %23, label %20
20: ; preds = %15
%21 = load i32, i32* @stdout
%22 = call i32 (i32, i8*, ...) @fprintf(i32 %21, i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str.1, i64 0, i64 0), i8* %0)
br label %99
23: ; preds = %15
%24 = call i32* @opendir(i8* %0)
%25 = icmp eq i32* %24, null
br i1 %25, label %26, label %29
26: ; preds = %23
%27 = load i32, i32* @stdout
%28 = call i32 (i32, i8*, ...) @fprintf(i32 %27, i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str.2, i64 0, i64 0), i8* %0)
br label %99
29: ; preds = %23
%30 = call %struct.dirent* @readdir(i32* %24)
%31 = icmp eq %struct.dirent* %30, null
br i1 %31, label %82, label %32
32: ; preds = %29
%33 = getelementptr inbounds %struct.stat, %struct.stat* %4, i64 0, i32 0
%34 = add nsw i32 %1, 1
%35 = icmp sgt i32 %1, 0
br label %36
36: ; preds = %32, %78
%37 = phi %struct.dirent* [ %30, %32 ], [ %80, %78 ]
%38 = call i32 @strlen(i8* %0)
%39 = getelementptr inbounds %struct.dirent, %struct.dirent* %37, i64 0, i32 0
%40 = load i8*, i8** %39
%41 = call i32 @strlen(i8* %40)
%42 = add i32 %38, 2
%43 = add i32 %42, %41
%44 = call i8* @malloc(i32 %43)
%45 = call i32 @strcpy(i8* %44, i8* %0)
%46 = call i32 @strcat(i8* %44, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i64 0, i64 0))
%47 = load i8*, i8** %39
%48 = call i32 @strcat(i8* %44, i8* %47)
%49 = call i64 @stat(i8* %44, %struct.stat* %4)
%50 = icmp eq i64 %49, 0
br i1 %50, label %54, label %51
51: ; preds = %36
%52 = load i32, i32* @stdout
%53 = call i32 (i32, i8*, ...) @fprintf(i32 %52, i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.4, i64 0, i64 0))
br label %99
54: ; preds = %36
%55 = load i32, i32* %33
%56 = call i32 @S_ISDIR(i32 %55)
%57 = icmp eq i32 %56, 0
br i1 %57, label %58, label %69
58: ; preds = %54
br i1 %35, label %59, label %65
59: ; preds = %58, %59
%60 = phi i32 [ %63, %59 ], [ 0, %58 ]
%61 = load i32, i32* @stdout
%62 = call i32 @fputc(i8 signext 32, i32 %61)
%63 = add nuw nsw i32 %60, 1
%64 = icmp eq i32 %63, %1
br i1 %64, label %65, label %59
65: ; preds = %59, %58
%66 = load i32, i32* @stdout
%67 = load i8*, i8** %39
%68 = call i32 (i32, i8*, ...) @fprintf(i32 %66, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.5, i64 0, i64 0), i8* %67)
br label %78
69: ; preds = %54
%70 = load i8*, i8** %39
%71 = call i64 @strcmp(i8* %70, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.6, i64 0, i64 0))
%72 = icmp eq i64 %71, 0
br i1 %72, label %78, label %73
73: ; preds = %69
%74 = load i8*, i8** %39
%75 = call i64 @strcmp(i8* %74, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.7, i64 0, i64 0))
%76 = icmp eq i64 %75, 0
br i1 %76, label %78, label %77
77: ; preds = %73
br label %78
78: ; preds = %69, %73, %77, %65
%79 = call i32 @free(i8* %44)
%80 = call %struct.dirent* @readdir(i32* %24)
%81 = icmp eq %struct.dirent* %80, null
br i1 %81, label %82, label %36
82: ; preds = %78, %29
%83 = call i64 @closedir(i32* %24)
%84 = icmp eq i64 %83, 0
br i1 %84, label %85, label %86
85: ; preds = %82
br i1 %8, label %90, label %96
86: ; preds = %82
%87 = load i32, i32* @stderr
%88 = call i32 (i32, i8*, ...) @fprintf(i32 %87, i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str.8, i64 0, i64 0))
%89 = call i32 @exit(i32 1)
unreachable
90: ; preds = %85, %90
%91 = phi i32 [ %94, %90 ], [ 0, %85 ]
%92 = load i32, i32* @stdout
%93 = call i32 @fputc(i8 signext 32, i32 %92)
%94 = add nuw nsw i32 %91, 1
%95 = icmp eq i32 %94, %7
br i1 %95, label %96, label %90
96: ; preds = %90, %85
%97 = load i32, i32* @stdout
%98 = call i32 (i32, i8*, ...) @fprintf(i32 %97, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.9, i64 0, i64 0), i8* %0)
br label %99
99: ; preds = %96, %51, %26, %20
ret void
}