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

/* Variables and functions */
int /*<<< orphan*/ canEnter(char *);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, ...);
char getchar();
char *getenv(char *);
int listDirectory(char *, char ***);
char ***malloc(int);
char *pathConcat(char *, char *);
int /*<<< orphan*/ puts(char *);
int /*<<< orphan*/ stderr;
int /*<<< orphan*/ terminalCleanup();
int /*<<< orphan*/ terminalInit();
int main(int argc, char **argv) {
  char *currentDir = "";
  char inKey = ' ';
  int choice = 0;
  char ***files = malloc(sizeof(char **));
  int entryCount = listDirectory(currentDir, files);
  int chosen = 0;
  char *chosenFile = NULL;
  unsigned int i;
  if (argc > 1) {
    currentDir = argv[1];
  } else {
    currentDir = getenv("HOME");
  }
  terminalInit();
  while (chosen == 0) {
    if (choice >= entryCount) {
      choice = 0;
    }
    if (choice < 0) {
      choice = entryCount - 1;
    }
    for (i = ((choice - 2 > 0) ? choice - 2 : 0);
         i < ((choice + 3 < entryCount - 1) ? choice + 3 : entryCount - 1);
         i++) {
      if (i == choice) {
        fprintf(stderr, " ->%s<- ", files[0][i]);
      } else {
        fprintf(stderr, "%s ", files[0][i]);
      }
    }
    for (i = 0; i < 80; ++i) {
      fprintf(stderr, " ");
    }
    fprintf(stderr, "\r");
    inKey = getchar();
    switch (inKey) {
    case 'h':
      --choice;
      break;
    case 'l':
      ++choice;
      break;
    case 'o':
      chosenFile = pathConcat(currentDir, files[0][choice]);
      if (canEnter(chosenFile)) {
        currentDir = chosenFile;
        entryCount = listDirectory(currentDir, files);
        chosenFile = NULL;
        choice = 0;
      }
      break;
    case 'a':
      chosenFile = pathConcat(currentDir, files[0][choice]);
      chosen = 1;
      break;
    }
  }
  puts(chosenFile);
  terminalCleanup();
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x60,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
lea    0xe92(%rip),%rax
mov    %rax,-0x18(%rbp)
movb   $0x20,-0x19(%rbp)
movl   $0x0,-0x20(%rbp)
mov    $0x8,%edi
call   10c0 <malloc@plt>
mov    %rax,-0x28(%rbp)
mov    -0x18(%rbp),%rdi
mov    -0x28(%rbp),%rsi
call   10b0 <listDirectory@plt>
mov    %eax,-0x2c(%rbp)
movl   $0x0,-0x30(%rbp)
movq   $0x0,-0x38(%rbp)
cmpl   $0x1,-0x8(%rbp)
jle    1214 <main+0x74>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rax
mov    %rax,-0x18(%rbp)
jmp    1224 <main+0x84>
lea    0xe21(%rip),%rdi
call   1030 <getenv@plt>
mov    %rax,-0x18(%rbp)
mov    $0x0,%al
call   1050 <terminalInit@plt>
cmpl   $0x0,-0x30(%rbp)
jne    1458 <main+0x2b8>
mov    -0x20(%rbp),%eax
cmp    -0x2c(%rbp),%eax
jl     1248 <main+0xa8>
movl   $0x0,-0x20(%rbp)
cmpl   $0x0,-0x20(%rbp)
jge    125b <main+0xbb>
mov    -0x2c(%rbp),%eax
sub    $0x1,%eax
mov    %eax,-0x20(%rbp)
mov    -0x20(%rbp),%eax
sub    $0x2,%eax
cmp    $0x0,%eax
jle    1278 <main+0xd8>
mov    -0x20(%rbp),%eax
sub    $0x2,%eax
mov    %eax,-0x40(%rbp)
jmp    1282 <main+0xe2>
xor    %eax,%eax
mov    %eax,-0x40(%rbp)
jmp    1282 <main+0xe2>
mov    -0x40(%rbp),%eax
mov    %eax,-0x3c(%rbp)
mov    -0x3c(%rbp),%eax
mov    %eax,-0x44(%rbp)
mov    -0x20(%rbp),%eax
add    $0x3,%eax
mov    -0x2c(%rbp),%ecx
sub    $0x1,%ecx
cmp    %ecx,%eax
jge    12b0 <main+0x110>
mov    -0x20(%rbp),%eax
add    $0x3,%eax
mov    %eax,-0x48(%rbp)
jmp    12b9 <main+0x119>
mov    -0x2c(%rbp),%eax
sub    $0x1,%eax
mov    %eax,-0x48(%rbp)
mov    -0x44(%rbp),%eax
mov    -0x48(%rbp),%ecx
cmp    %ecx,%eax
jae    1335 <main+0x195>
mov    -0x3c(%rbp),%eax
cmp    -0x20(%rbp),%eax
jne    12fd <main+0x15d>
mov    0x2d06(%rip),%rax
mov    (%rax),%edi
mov    -0x28(%rbp),%rax
mov    (%rax),%rax
mov    -0x3c(%rbp),%ecx
mov    (%rax,%rcx,8),%rdx
lea    0xd50(%rip),%rsi
mov    $0x0,%al
call   10a0 <fprintf@plt>
jmp    1322 <main+0x182>
mov    0x2cdc(%rip),%rax
mov    (%rax),%edi
mov    -0x28(%rbp),%rax
mov    (%rax),%rax
mov    -0x3c(%rbp),%ecx
mov    (%rax,%rcx,8),%rdx
lea    0xd2f(%rip),%rsi
mov    $0x0,%al
call   10a0 <fprintf@plt>
jmp    1327 <main+0x187>
mov    -0x3c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x3c(%rbp)
jmp    1288 <main+0xe8>
movl   $0x0,-0x3c(%rbp)
cmpl   $0x50,-0x3c(%rbp)
jae    136b <main+0x1cb>
mov    0x2c93(%rip),%rax
mov    (%rax),%edi
lea    0xcf2(%rip),%rsi
mov    $0x0,%al
call   10a0 <fprintf@plt>
mov    -0x3c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x3c(%rbp)
jmp    133c <main+0x19c>
mov    0x2c6e(%rip),%rax
mov    (%rax),%edi
lea    0xcd3(%rip),%rsi
xor    %eax,%eax
mov    %al,-0x51(%rbp)
call   10a0 <fprintf@plt>
mov    -0x51(%rbp),%al
call   1090 <getchar@plt>
mov    %al,-0x19(%rbp)
movsbl -0x19(%rbp),%eax
add    $0xffffff9f,%eax
mov    %eax,%ecx
mov    %rcx,-0x50(%rbp)
sub    $0xe,%eax
ja     1453 <main+0x2b3>
mov    -0x50(%rbp),%rax
lea    0xc4f(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
mov    -0x20(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x20(%rbp)
jmp    1453 <main+0x2b3>
mov    -0x20(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x20(%rbp)
jmp    1453 <main+0x2b3>
mov    -0x18(%rbp),%rdi
mov    -0x28(%rbp),%rax
mov    (%rax),%rax
movslq -0x20(%rbp),%rcx
mov    (%rax,%rcx,8),%rsi
call   1040 <pathConcat@plt>
mov    %rax,-0x38(%rbp)
mov    -0x38(%rbp),%rdi
call   1080 <canEnter@plt>
cmp    $0x0,%eax
je     142b <main+0x28b>
mov    -0x38(%rbp),%rax
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rdi
mov    -0x28(%rbp),%rsi
call   10b0 <listDirectory@plt>
mov    %eax,-0x2c(%rbp)
movq   $0x0,-0x38(%rbp)
movl   $0x0,-0x20(%rbp)
jmp    1453 <main+0x2b3>
mov    -0x18(%rbp),%rdi
mov    -0x28(%rbp),%rax
mov    (%rax),%rax
movslq -0x20(%rbp),%rcx
mov    (%rax,%rcx,8),%rsi
call   1040 <pathConcat@plt>
mov    %rax,-0x38(%rbp)
movl   $0x1,-0x30(%rbp)
jmp    122b <main+0x8b>
mov    -0x38(%rbp),%rdi
call   1060 <puts@plt>
mov    $0x0,%al
call   1070 <terminalCleanup@plt>
xor    %eax,%eax
add    $0x60,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x38,%rsp
mov    %rsi,%r14
mov    %edi,%ebx
mov    $0x8,%edi
call   10c0 <malloc@plt>
mov    %rax,0x10(%rsp)
lea    0xe86(%rip),%rdi
mov    %rax,%rsi
call   10b0 <listDirectory@plt>
mov    %eax,%r15d
cmp    $0x2,%ebx
jl     11df <main+0x3f>
mov    0x8(%r14),%rax
jmp    11eb <main+0x4b>
lea    0xe56(%rip),%rdi
call   1030 <getenv@plt>
mov    %rax,0x8(%rsp)
xor    %eax,%eax
call   1050 <terminalInit@plt>
mov    0x2de2(%rip),%rbx
lea    -0x1(%r15),%eax
mov    %eax,0x1c(%rsp)
xor    %ebp,%ebp
mov    %r15,0x28(%rsp)
jmp    1213 <main+0x73>
nop
add    $0x1,%ebp
cmp    %r15d,%ebp
mov    $0x0,%eax
cmovge %eax,%ebp
test   %ebp,%ebp
mov    0x1c(%rsp),%edx
cmovs  %edx,%ebp
cmp    $0x3,%ebp
mov    $0x2,%eax
cmovge %ebp,%eax
lea    -0x2(%rax),%edi
mov    %rbp,0x20(%rsp)
lea    0x3(%rbp),%r13d
cmp    %edx,%r13d
cmovge %edx,%r13d
cmp    %r13d,%edi
lea    0xdf2(%rip),%rdx
mov    0x10(%rsp),%rbp
lea    0xdef(%rip),%r12
jae    129d <main+0xfd>
mov    %edi,%r14d
mov    0x20(%rsp),%edi
mov    %rdi,0x30(%rsp)
sub    %eax,%r13d
add    $0x2,%r13d
cmp    %r14,0x30(%rsp)
mov    (%rbx),%edi
mov    0x0(%rbp),%rax
mov    %r12,%rsi
cmove  %rdx,%rsi
mov    %rdx,%r15
mov    (%rax,%r14,8),%rdx
xor    %eax,%eax
call   10a0 <fprintf@plt>
mov    %r15,%rdx
add    $0x1,%r14
add    $0xffffffff,%r13d
jne    1270 <main+0xd0>
mov    $0x50,%ebp
lea    0xd9f(%rip),%r14
nopl   0x0(%rax)
mov    (%rbx),%edi
mov    %r14,%rsi
xor    %eax,%eax
call   10a0 <fprintf@plt>
add    $0xffffffff,%ebp
jne    12b0 <main+0x110>
mov    (%rbx),%edi
lea    0xd84(%rip),%rsi
xor    %eax,%eax
call   10a0 <fprintf@plt>
xor    %eax,%eax
call   1090 <getchar@plt>
movsbl %al,%eax
add    $0xffffff9f,%eax
cmp    $0xe,%eax
mov    0x28(%rsp),%r15
mov    0x20(%rsp),%rbp
ja     1213 <main+0x73>
lea    0xd08(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
add    $0xffffffff,%ebp
jmp    1213 <main+0x73>
nopl   0x0(%rax)
mov    0x10(%rsp),%rax
mov    (%rax),%rax
movslq %ebp,%rcx
mov    (%rax,%rcx,8),%rsi
mov    0x8(%rsp),%rdi
call   1040 <pathConcat@plt>
mov    %rax,%r14
mov    %rax,%rdi
call   1080 <canEnter@plt>
test   %eax,%eax
je     1213 <main+0x73>
mov    %r14,%rdi
mov    0x10(%rsp),%rsi
call   10b0 <listDirectory@plt>
mov    %eax,%r15d
mov    %r14,0x8(%rsp)
jmp    11fe <main+0x5e>
mov    0x10(%rsp),%rax
mov    (%rax),%rax
movslq %ebp,%rcx
mov    (%rax,%rcx,8),%rsi
mov    0x8(%rsp),%rdi
call   1040 <pathConcat@plt>
mov    %rax,%rdi
call   1060 <puts@plt>
xor    %eax,%eax
call   1070 <terminalCleanup@plt>
xor    %eax,%eax
add    $0x38,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [1 x i8] zeroinitializer
@.str.1 = [5 x i8] c"HOME\00"
@stderr = global i32 0
@.str.2 = [9 x i8] c" ->%s<- \00"
@.str.3 = [4 x i8] c"%s \00"
@.str.4 = [2 x i8] c" \00"
@.str.5 = [2 x i8] c"\0D\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i8*
%7 = alloca i8
%8 = alloca i32
%9 = alloca i8***
%10 = alloca i32
%11 = alloca i32
%12 = alloca i8*
%13 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
store i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str, i64 0, i64 0), i8** %6
store i8 32, i8* %7
store i32 0, i32* %8
%14 = call i8*** @malloc(i32 8)
store i8*** %14, i8**** %9
%15 = load i8*, i8** %6
%16 = load i8***, i8**** %9
%17 = call i32 @listDirectory(i8* %15, i8*** %16)
store i32 %17, i32* %10
store i32 0, i32* %11
store i8* null, i8** %12
%18 = load i32, i32* %4
%19 = icmp sgt i32 %18, 1
br i1 %19, label %20, label %24
20: ; preds = %2
%21 = load i8**, i8*** %5
%22 = getelementptr inbounds i8*, i8** %21, i64 1
%23 = load i8*, i8** %22
store i8* %23, i8** %6
br label %26
24: ; preds = %2
%25 = call i8* @getenv(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0))
store i8* %25, i8** %6
br label %26
26: ; preds = %24, %20
%27 = call i32 (...) @terminalInit()
br label %28
28: ; preds = %147, %26
%29 = load i32, i32* %11
%30 = icmp eq i32 %29, 0
br i1 %30, label %31, label %148
31: ; preds = %28
%32 = load i32, i32* %8
%33 = load i32, i32* %10
%34 = icmp sge i32 %32, %33
br i1 %34, label %35, label %36
35: ; preds = %31
store i32 0, i32* %8
br label %36
36: ; preds = %35, %31
%37 = load i32, i32* %8
%38 = icmp slt i32 %37, 0
br i1 %38, label %39, label %42
39: ; preds = %36
%40 = load i32, i32* %10
%41 = sub nsw i32 %40, 1
store i32 %41, i32* %8
br label %42
42: ; preds = %39, %36
%43 = load i32, i32* %8
%44 = sub nsw i32 %43, 2
%45 = icmp sgt i32 %44, 0
br i1 %45, label %46, label %49
46: ; preds = %42
%47 = load i32, i32* %8
%48 = sub nsw i32 %47, 2
br label %50
49: ; preds = %42
br label %50
50: ; preds = %49, %46
%51 = phi i32 [ %48, %46 ], [ 0, %49 ]
store i32 %51, i32* %13
br label %52
52: ; preds = %93, %50
%53 = load i32, i32* %13
%54 = load i32, i32* %8
%55 = add nsw i32 %54, 3
%56 = load i32, i32* %10
%57 = sub nsw i32 %56, 1
%58 = icmp slt i32 %55, %57
br i1 %58, label %59, label %62
59: ; preds = %52
%60 = load i32, i32* %8
%61 = add nsw i32 %60, 3
br label %65
62: ; preds = %52
%63 = load i32, i32* %10
%64 = sub nsw i32 %63, 1
br label %65
65: ; preds = %62, %59
%66 = phi i32 [ %61, %59 ], [ %64, %62 ]
%67 = icmp ult i32 %53, %66
br i1 %67, label %68, label %96
68: ; preds = %65
%69 = load i32, i32* %13
%70 = load i32, i32* %8
%71 = icmp eq i32 %69, %70
br i1 %71, label %72, label %82
72: ; preds = %68
%73 = load i32, i32* @stderr
%74 = load i8***, i8**** %9
%75 = getelementptr inbounds i8**, i8*** %74, i64 0
%76 = load i8**, i8*** %75
%77 = load i32, i32* %13
%78 = zext i32 %77 to i64
%79 = getelementptr inbounds i8*, i8** %76, i64 %78
%80 = load i8*, i8** %79
%81 = call i32 (i32, i8*, ...) @fprintf(i32 %73, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.2, i64 0, i64 0), i8* %80)
br label %92
82: ; preds = %68
%83 = load i32, i32* @stderr
%84 = load i8***, i8**** %9
%85 = getelementptr inbounds i8**, i8*** %84, i64 0
%86 = load i8**, i8*** %85
%87 = load i32, i32* %13
%88 = zext i32 %87 to i64
%89 = getelementptr inbounds i8*, i8** %86, i64 %88
%90 = load i8*, i8** %89
%91 = call i32 (i32, i8*, ...) @fprintf(i32 %83, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.3, i64 0, i64 0), i8* %90)
br label %92
92: ; preds = %82, %72
br label %93
93: ; preds = %92
%94 = load i32, i32* %13
%95 = add i32 %94, 1
store i32 %95, i32* %13
br label %52
96: ; preds = %65
store i32 0, i32* %13
br label %97
97: ; preds = %103, %96
%98 = load i32, i32* %13
%99 = icmp ult i32 %98, 80
br i1 %99, label %100, label %106
100: ; preds = %97
%101 = load i32, i32* @stderr
%102 = call i32 (i32, i8*, ...) @fprintf(i32 %101, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.4, i64 0, i64 0))
br label %103
103: ; preds = %100
%104 = load i32, i32* %13
%105 = add i32 %104, 1
store i32 %105, i32* %13
br label %97
106: ; preds = %97
%107 = load i32, i32* @stderr
%108 = call i32 (i32, i8*, ...) @fprintf(i32 %107, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.5, i64 0, i64 0))
%109 = call signext i8 (...) @getchar()
store i8 %109, i8* %7
%110 = load i8, i8* %7
%111 = sext i8 %110 to i32
switch i32 %111, label %147 [
i32 104, label %112
i32 108, label %115
i32 111, label %118
i32 97, label %137
]
112: ; preds = %106
%113 = load i32, i32* %8
%114 = add nsw i32 %113, -1
store i32 %114, i32* %8
br label %147
115: ; preds = %106
%116 = load i32, i32* %8
%117 = add nsw i32 %116, 1
store i32 %117, i32* %8
br label %147
118: ; preds = %106
%119 = load i8*, i8** %6
%120 = load i8***, i8**** %9
%121 = getelementptr inbounds i8**, i8*** %120, i64 0
%122 = load i8**, i8*** %121
%123 = load i32, i32* %8
%124 = sext i32 %123 to i64
%125 = getelementptr inbounds i8*, i8** %122, i64 %124
%126 = load i8*, i8** %125
%127 = call i8* @pathConcat(i8* %119, i8* %126)
store i8* %127, i8** %12
%128 = load i8*, i8** %12
%129 = call i32 @canEnter(i8* %128)
%130 = icmp ne i32 %129, 0
br i1 %130, label %131, label %136
131: ; preds = %118
%132 = load i8*, i8** %12
store i8* %132, i8** %6
%133 = load i8*, i8** %6
%134 = load i8***, i8**** %9
%135 = call i32 @listDirectory(i8* %133, i8*** %134)
store i32 %135, i32* %10
store i8* null, i8** %12
store i32 0, i32* %8
br label %136
136: ; preds = %131, %118
br label %147
137: ; preds = %106
%138 = load i8*, i8** %6
%139 = load i8***, i8**** %9
%140 = getelementptr inbounds i8**, i8*** %139, i64 0
%141 = load i8**, i8*** %140
%142 = load i32, i32* %8
%143 = sext i32 %142 to i64
%144 = getelementptr inbounds i8*, i8** %141, i64 %143
%145 = load i8*, i8** %144
%146 = call i8* @pathConcat(i8* %138, i8* %145)
store i8* %146, i8** %12
store i32 1, i32* %11
br label %147
147: ; preds = %106, %137, %136, %115, %112
br label %28
148: ; preds = %28
%149 = load i8*, i8** %12
%150 = call i32 @puts(i8* %149)
%151 = call i32 (...) @terminalCleanup()
ret i32 0
}

LLVM IR (-O2):
@.str = [1 x i8] zeroinitializer
@.str.1 = [5 x i8] c"HOME\00"
@stderr = global i32 0
@.str.2 = [9 x i8] c" ->%s<- \00"
@.str.3 = [4 x i8] c"%s \00"
@.str.4 = [2 x i8] c" \00"
@.str.5 = [2 x i8] c"\0D\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = tail call i8*** @malloc(i32 8)
%4 = tail call i32 @listDirectory(i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str, i64 0, i64 0), i8*** %3)
%5 = icmp sgt i32 %0, 1
br i1 %5, label %6, label %9
6: ; preds = %2
%7 = getelementptr inbounds i8*, i8** %1, i64 1
%8 = load i8*, i8** %7
br label %11
9: ; preds = %2
%10 = tail call i8* @getenv(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0))
br label %11
11: ; preds = %9, %6
%12 = phi i8* [ %8, %6 ], [ %10, %9 ]
%13 = tail call i32 (...) @terminalInit()
br label %14
14: ; preds = %72, %11
%15 = phi i32 [ %73, %72 ], [ %4, %11 ]
%16 = phi i8* [ %67, %72 ], [ %12, %11 ]
%17 = add nsw i32 %15, -1
br label %18
18: ; preds = %70, %14
%19 = phi i32 [ 0, %14 ], [ %71, %70 ]
%20 = icmp slt i32 %19, %15
%21 = select i1 %20, i32 %19, i32 0
%22 = icmp slt i32 %21, 0
%23 = select i1 %22, i32 %17, i32 %21
%24 = icmp sgt i32 %23, 2
%25 = select i1 %24, i32 %23, i32 2
%26 = add nsw i32 %25, -2
%27 = add nsw i32 %23, 3
%28 = icmp slt i32 %27, %17
%29 = select i1 %28, i32 %27, i32 %17
%30 = icmp ult i32 %26, %29
br i1 %30, label %31, label %46
31: ; preds = %18
%32 = zext i32 %26 to i64
%33 = zext i32 %23 to i64
br label %34
34: ; preds = %31, %34
%35 = phi i64 [ %32, %31 ], [ %43, %34 ]
%36 = icmp eq i64 %35, %33
%37 = load i32, i32* @stderr
%38 = load i8**, i8*** %3
%39 = select i1 %36, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.3, i64 0, i64 0)
%40 = getelementptr inbounds i8*, i8** %38, i64 %35
%41 = load i8*, i8** %40
%42 = tail call i32 (i32, i8*, ...) @fprintf(i32 %37, i8* %39, i8* %41)
%43 = add nuw nsw i64 %35, 1
%44 = trunc i64 %43 to i32
%45 = icmp eq i32 %29, %44
br i1 %45, label %46, label %34
46: ; preds = %34, %18
br label %47
47: ; preds = %46, %47
%48 = phi i32 [ %51, %47 ], [ 0, %46 ]
%49 = load i32, i32* @stderr
%50 = tail call i32 (i32, i8*, ...) @fprintf(i32 %49, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.4, i64 0, i64 0))
%51 = add nuw nsw i32 %48, 1
%52 = icmp eq i32 %51, 80
br i1 %52, label %53, label %47
53: ; preds = %47
%54 = load i32, i32* @stderr
%55 = tail call i32 (i32, i8*, ...) @fprintf(i32 %54, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.5, i64 0, i64 0))
%56 = tail call signext i8 (...) @getchar()
%57 = sext i8 %56 to i32
switch i32 %57, label %70 [
i32 104, label %58
i32 108, label %60
i32 111, label %62
i32 97, label %74
]
58: ; preds = %53
%59 = add nsw i32 %23, -1
br label %70
60: ; preds = %53
%61 = add nsw i32 %23, 1
br label %70
62: ; preds = %53
%63 = load i8**, i8*** %3
%64 = sext i32 %23 to i64
%65 = getelementptr inbounds i8*, i8** %63, i64 %64
%66 = load i8*, i8** %65
%67 = tail call i8* @pathConcat(i8* %16, i8* %66)
%68 = tail call i32 @canEnter(i8* %67)
%69 = icmp eq i32 %68, 0
br i1 %69, label %70, label %72
70: ; preds = %62, %53, %60, %58
%71 = phi i32 [ %23, %53 ], [ %23, %62 ], [ %61, %60 ], [ %59, %58 ]
br label %18
72: ; preds = %62
%73 = tail call i32 @listDirectory(i8* %67, i8*** %3)
br label %14
74: ; preds = %53
%75 = load i8**, i8*** %3
%76 = sext i32 %23 to i64
%77 = getelementptr inbounds i8*, i8** %75, i64 %76
%78 = load i8*, i8** %77
%79 = tail call i8* @pathConcat(i8* %16, i8* %78)
%80 = tail call i32 @puts(i8* dereferenceable(1) %79)
%81 = tail call i32 (...) @terminalCleanup()
ret i32 0
}