#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*/ exit(int);
scalar_t__ mkdir(char *, int);
int /*<<< orphan*/ perror(char *);
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ recursiveDir(char *, char *, unsigned char *);
int main(int argc, char *argv[]) {
  unsigned char havemkdirs[255];
  int i;
  if (argc != 3) {
    printf("usage: ./putFilesIntoFileTree fileFolder fileTree\n");
    exit(1);
  }
  char *fileFolder = argv[1];
  char *fileTree = argv[2];
  for (i = 0; i < 255; i++) {
    printf("%i\n", i);
    havemkdirs[i] = 0;
  }
  if (mkdir(fileTree, 0755) != 0) {
    perror(fileTree);
    exit(1);
  }
  recursiveDir(fileTree, fileFolder, havemkdirs);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x130,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
cmpl   $0x3,-0x8(%rbp)
je     118b <main+0x3b>
lea    0xe86(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
mov    $0x1,%edi
call   1070 <exit@plt>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rax
mov    %rax,-0x120(%rbp)
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rax
mov    %rax,-0x128(%rbp)
movl   $0x0,-0x114(%rbp)
cmpl   $0xff,-0x114(%rbp)
jge    11fa <main+0xaa>
mov    -0x114(%rbp),%esi
lea    0xe63(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
movslq -0x114(%rbp),%rax
movb   $0x0,-0x110(%rbp,%rax,1)
mov    -0x114(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x114(%rbp)
jmp    11b3 <main+0x63>
mov    -0x128(%rbp),%rdi
mov    $0x1ed,%esi
call   1040 <mkdir@plt>
cmp    $0x0,%rax
je     122b <main+0xdb>
mov    -0x128(%rbp),%rdi
call   1060 <perror@plt>
mov    $0x1,%edi
call   1070 <exit@plt>
mov    -0x128(%rbp),%rdi
mov    -0x120(%rbp),%rsi
lea    -0x110(%rbp),%rdx
call   1030 <recursiveDir@plt>
xor    %eax,%eax
add    $0x130,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %r12
push   %rbx
sub    $0x108,%rsp
cmp    $0x3,%edi
jne    11de <main+0x7e>
mov    0x8(%rsi),%r14
mov    0x10(%rsi),%r15
lea    0xe7e(%rip),%r12
xor    %ebx,%ebx
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
mov    %r12,%rdi
mov    %ebx,%esi
xor    %eax,%eax
call   1060 <printf@plt>
movb   $0x0,(%rsp,%rbx,1)
add    $0x1,%rbx
cmp    $0xff,%rbx
jne    1190 <main+0x30>
mov    %r15,%rdi
mov    $0x1ed,%esi
call   1040 <mkdir@plt>
test   %rax,%rax
jne    11f4 <main+0x94>
mov    %rsp,%rdx
mov    %r15,%rdi
mov    %r14,%rsi
call   1030 <recursiveDir@plt>
xor    %eax,%eax
add    $0x108,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
ret
lea    0xe1f(%rip),%rdi
call   1050 <puts@plt>
mov    $0x1,%edi
call   1080 <exit@plt>
mov    %r15,%rdi
call   1070 <perror@plt>
mov    $0x1,%edi
call   1080 <exit@plt>

LLVM IR (-O0):
@.str = [51 x i8] c"usage: ./putFilesIntoFileTree fileFolder fileTree\0A\00"
@.str.1 = [4 x i8] c"%i\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca [255 x i8]
%7 = alloca i32
%8 = alloca i8*
%9 = alloca i8*
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%10 = load i32, i32* %4
%11 = icmp ne i32 %10, 3
br i1 %11, label %12, label %15
12: ; preds = %2
%13 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([51 x i8], [51 x i8]* @.str, i64 0, i64 0))
%14 = call i32 @exit(i32 1)
unreachable
15: ; preds = %2
%16 = load i8**, i8*** %5
%17 = getelementptr inbounds i8*, i8** %16, i64 1
%18 = load i8*, i8** %17
store i8* %18, i8** %8
%19 = load i8**, i8*** %5
%20 = getelementptr inbounds i8*, i8** %19, i64 2
%21 = load i8*, i8** %20
store i8* %21, i8** %9
store i32 0, i32* %7
br label %22
22: ; preds = %31, %15
%23 = load i32, i32* %7
%24 = icmp slt i32 %23, 255
br i1 %24, label %25, label %34
25: ; preds = %22
%26 = load i32, i32* %7
%27 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 %26)
%28 = load i32, i32* %7
%29 = sext i32 %28 to i64
%30 = getelementptr inbounds [255 x i8], [255 x i8]* %6, i64 0, i64 %29
store i8 0, i8* %30
br label %31
31: ; preds = %25
%32 = load i32, i32* %7
%33 = add nsw i32 %32, 1
store i32 %33, i32* %7
br label %22
34: ; preds = %22
%35 = load i8*, i8** %9
%36 = call i64 @mkdir(i8* %35, i32 493)
%37 = icmp ne i64 %36, 0
br i1 %37, label %38, label %42
38: ; preds = %34
%39 = load i8*, i8** %9
%40 = call i32 @perror(i8* %39)
%41 = call i32 @exit(i32 1)
unreachable
42: ; preds = %34
%43 = load i8*, i8** %9
%44 = load i8*, i8** %8
%45 = getelementptr inbounds [255 x i8], [255 x i8]* %6, i64 0, i64 0
%46 = call i32 @recursiveDir(i8* %43, i8* %44, i8* %45)
ret i32 0
}

LLVM IR (-O2):
@.str.1 = [4 x i8] c"%i\0A\00"
@str = [50 x i8] c"usage: ./putFilesIntoFileTree fileFolder fileTree\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = alloca [255 x i8]
%4 = getelementptr inbounds [255 x i8], [255 x i8]* %3, i64 0, i64 0
%5 = icmp eq i32 %0, 3
br i1 %5, label %9, label %6
6: ; preds = %2
%7 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([50 x i8], [50 x i8]* @str, i64 0, i64 0))
%8 = tail call i32 @exit(i32 1)
unreachable
9: ; preds = %2
%10 = getelementptr inbounds i8*, i8** %1, i64 1
%11 = load i8*, i8** %10
%12 = getelementptr inbounds i8*, i8** %1, i64 2
%13 = load i8*, i8** %12
br label %14
14: ; preds = %9, %14
%15 = phi i64 [ 0, %9 ], [ %19, %14 ]
%16 = trunc i64 %15 to i32
%17 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 %16)
%18 = getelementptr inbounds [255 x i8], [255 x i8]* %3, i64 0, i64 %15
store i8 0, i8* %18
%19 = add nuw nsw i64 %15, 1
%20 = icmp eq i64 %19, 255
br i1 %20, label %21, label %14
21: ; preds = %14
%22 = tail call i64 @mkdir(i8* %13, i32 493)
%23 = icmp eq i64 %22, 0
br i1 %23, label %27, label %24
24: ; preds = %21
%25 = tail call i32 @perror(i8* %13)
%26 = tail call i32 @exit(i32 1)
unreachable
27: ; preds = %21
%28 = call i32 @recursiveDir(i8* %13, i8* %11, i8* %4)
ret i32 0
}