// File: Matan-Vinkler[P]Basic-File-System/myfs_main.cpp
// Function: recursive_print(MyFs&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>)
static void recursive_print(MyFs &myfs, std::string path, std::string prefix="") {
	MyFs::dir_list dlist = myfs.list_dir(path);
	for (size_t i=0; i < dlist.size(); i++) {
		MyFs::dir_list_entry &curr_entry = dlist[i];

		std::string entry_prefix = prefix;
		if (i == dlist.size()-1)
			entry_prefix += "└── ";
		else
			entry_prefix += "├── ";

		std::cout << entry_prefix << curr_entry.name << std::endl;

		if (curr_entry.is_dir) {
			std::string dir_prefix = prefix;

			if (i == dlist.size()-1)
				dir_prefix += "    ";
			else
				dir_prefix += "│   ";
			recursive_print(myfs, path + "/" + curr_entry.name, dir_prefix);
		}
	}
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x160, %rsp            # imm = 0x160
movq %rsi, -0x130(%rbp)
movq %rdx, -0x128(%rbp)
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq %rdx, -0x18(%rbp)
movq -0x8(%rbp), %rax
movq %rax, -0x120(%rbp)
leaq -0x50(%rbp), %rdi
movq %rdi, -0x118(%rbp)
callq 0x3120
movq -0x120(%rbp), %rsi
movq -0x118(%rbp), %rdx
leaq -0x30(%rbp), %rdi
callq 0x4bc0
jmp 0x6e39
leaq -0x50(%rbp), %rdi
callq 0x34d8
movq $0x0, -0x68(%rbp)
movq -0x68(%rbp), %rax
movq %rax, -0x138(%rbp)
leaq -0x30(%rbp), %rdi
callq 0x4e30
movq %rax, %rcx
movq -0x138(%rbp), %rax
cmpq %rcx, %rax
jae 0x7123
movq -0x68(%rbp), %rsi
leaq -0x30(%rbp), %rdi
callq 0x4ef0
movq -0x128(%rbp), %rsi
movq %rax, -0x70(%rbp)
leaq -0x90(%rbp), %rdi
callq 0x3120
jmp 0x6e97
movq -0x68(%rbp), %rax
movq %rax, -0x140(%rbp)
leaq -0x30(%rbp), %rdi
callq 0x4e30
movq %rax, %rcx
movq -0x140(%rbp), %rax
subq $0x1, %rcx
cmpq %rcx, %rax
jne 0x6f11
leaq 0x242c(%rip), %rsi      # 0x92f1
leaq -0x90(%rbp), %rdi
callq 0x3280
jmp 0x6ed3
jmp 0x6f28
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x58(%rbp)
movl %eax, -0x5c(%rbp)
leaq -0x50(%rbp), %rdi
callq 0x34d8
jmp 0x713e
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x58(%rbp)
movl %eax, -0x5c(%rbp)
jmp 0x7135
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x58(%rbp)
movl %eax, -0x5c(%rbp)
jmp 0x7115
leaq 0x23e4(%rip), %rsi      # 0x92fc
leaq -0x90(%rbp), %rdi
callq 0x3280
jmp 0x6f26
jmp 0x6f28
movq 0x6091(%rip), %rdi      # 0xcfc0
leaq -0x90(%rbp), %rsi
callq 0x3270
movq %rax, -0x148(%rbp)
jmp 0x6f44
movq -0x148(%rbp), %rdi
movq -0x70(%rbp), %rsi
callq 0x3270
movq %rax, -0x150(%rbp)
jmp 0x6f5d
movq -0x150(%rbp), %rdi
movq 0x6035(%rip), %rsi      # 0xcfa0
callq 0x32c0
jmp 0x6f72
movq -0x70(%rbp), %rax
testb $0x1, 0x20(%rax)
je 0x70f8
movq -0x128(%rbp), %rsi
leaq -0xb0(%rbp), %rdi
callq 0x3120
jmp 0x6f95
movq -0x68(%rbp), %rax
movq %rax, -0x158(%rbp)
leaq -0x30(%rbp), %rdi
callq 0x4e30
movq %rax, %rcx
movq -0x158(%rbp), %rax
subq $0x1, %rcx
cmpq %rcx, %rax
jne 0x6fe4
leaq 0x2344(%rip), %rsi      # 0x9307
leaq -0xb0(%rbp), %rdi
callq 0x3280
jmp 0x6fd1
jmp 0x6ffb
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x58(%rbp)
movl %eax, -0x5c(%rbp)
jmp 0x70ea
leaq 0x2321(%rip), %rsi      # 0x930c
leaq -0xb0(%rbp), %rdi
callq 0x3280
jmp 0x6ff9
jmp 0x6ffb
movq -0x130(%rbp), %rsi
movq -0x8(%rbp), %rax
movq %rax, -0x160(%rbp)
leaq 0x2261(%rip), %rdx      # 0x9275
leaq -0xf0(%rbp), %rdi
callq 0x7480
jmp 0x7022
movq -0x70(%rbp), %rdx
leaq -0xd0(%rbp), %rdi
leaq -0xf0(%rbp), %rsi
callq 0x7150
jmp 0x703b
leaq -0x110(%rbp), %rdi
leaq -0xb0(%rbp), %rsi
callq 0x3120
jmp 0x7050
movq -0x160(%rbp), %rdi
leaq -0xd0(%rbp), %rsi
leaq -0x110(%rbp), %rdx
callq 0x6de0
jmp 0x706c
leaq -0x110(%rbp), %rdi
callq 0x34d8
leaq -0xd0(%rbp), %rdi
callq 0x34d8
leaq -0xf0(%rbp), %rdi
callq 0x34d8
leaq -0xb0(%rbp), %rdi
callq 0x34d8
jmp 0x70f8
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x58(%rbp)
movl %eax, -0x5c(%rbp)
jmp 0x70de
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x58(%rbp)
movl %eax, -0x5c(%rbp)
jmp 0x70d2
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x58(%rbp)
movl %eax, -0x5c(%rbp)
leaq -0x110(%rbp), %rdi
callq 0x34d8
leaq -0xd0(%rbp), %rdi
callq 0x34d8
leaq -0xf0(%rbp), %rdi
callq 0x34d8
leaq -0xb0(%rbp), %rdi
callq 0x34d8
jmp 0x7115
leaq -0x90(%rbp), %rdi
callq 0x34d8
movq -0x68(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x68(%rbp)
jmp 0x6e4a
leaq -0x90(%rbp), %rdi
callq 0x34d8
jmp 0x7135
leaq -0x30(%rbp), %rdi
callq 0x4d00
addq $0x160, %rsp            # imm = 0x160
popq %rbp
retq
leaq -0x30(%rbp), %rdi
callq 0x4d00
movq -0x58(%rbp), %rdi
callq 0x3430
nopw (%rax,%rax)