// File: /workspace/github_cpp_makefile_star2_O2/tsoding[P]cxx-invert-file-tree/generator.cpp
// Function: generate_tree(std::filesystem::__cxx11::path const&, unsigned long)
void generate_tree(const fs::path &root, size_t depth = 0)
{
    if (depth < DEPTH_CAPACITY) {
        int n = rand_int_range(3, 5);

        for (int i = 0; i < n; ++i) {
            const auto child_path = root / (random_fruit() + "-" + std::to_string(i));

            if (rand() % 2) {
                std::cout << "Created Folder: " << child_path << std::endl;
                fs::create_directory(child_path);
                generate_tree(child_path, depth + 1);
            } else {
                std::cout << "Created File: " << child_path << std::endl;
                std::ofstream fout(child_path);

                int words_count = rand_int_range(20, 30);
                while (words_count-- > 0) {
                    fout << random_fruit() << std::endl;
                }
            }
        }
    }
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x2c8, %rsp            # imm = 0x2C8
movq %rdi, 0x18(%rsp)
movq %rsi, 0x10(%rsp)
cmpq $0x4, %rsi
ja 0x31d3
callq 0x2070
pushq $0x3
popq %rcx
cltd
idivl %ecx
incq 0x10(%rsp)
addl $0x3, %edx
movl %edx, 0xc(%rsp)
xorl %r15d, %r15d
leaq 0xa8(%rsp), %rbx
leaq 0x60(%rsp), %r14
leaq 0xc8(%rsp), %rbp
leaq 0x80(%rsp), %r12
cmpl 0xc(%rsp), %r15d
je 0x31d3
leaq 0x40(%rsp), %r13
movq %r13, %rdi
callq 0x383c
leaq 0x20(%rsp), %rdi
movq %r13, %rsi
leaq 0xf92(%rip), %rdx       # 0x4025
callq 0x33cc
movq %rbx, %rdi
movl %r15d, %esi
callq 0x33eb
movq %r14, %rdi
leaq 0x20(%rsp), %rsi
movq %rbx, %rdx
callq 0x3365
movq %rbp, %rdi
movq %r14, %rsi
pushq $0x2
popq %rdx
callq 0x3444
movq %r12, %rdi
movq 0x18(%rsp), %rsi
movq %rbp, %rdx
callq 0x332d
movq %rbp, %rdi
callq 0x348c
movq %r14, %rdi
callq 0x20d0
movq %rbx, %rdi
callq 0x20d0
leaq 0x20(%rsp), %rdi
callq 0x20d0
leaq 0x40(%rsp), %rdi
callq 0x20d0
callq 0x2070
testb $0x1, %al
jne 0x317e
movq 0x3ec3(%rip), %rdi      # 0x6fd0
leaq 0xf24(%rip), %rsi       # 0x4038
callq 0x2180
movq %rax, %rdi
movq %r12, %rsi
callq 0x34a2
movq %rax, %rdi
callq 0x20e0
movq 0x80(%rsp), %rsi
movq %rbp, %rdi
pushq $0x10
popq %rdx
callq 0x21b0
callq 0x2070
cltd
pushq $0xb
popq %rcx
idivl %ecx
movl %edx, %r13d
addl $0x14, %r13d
testl %r13d, %r13d
jle 0x31bb
movq %r14, %rdi
callq 0x383c
movq %rbp, %rdi
movq %r14, %rsi
callq 0x2150
movq %rax, %rdi
callq 0x20e0
movq %r14, %rdi
callq 0x20d0
decl %r13d
jmp 0x3151
movq 0x3e4b(%rip), %rdi      # 0x6fd0
leaq 0xe9b(%rip), %rsi       # 0x4027
callq 0x2180
movq %rax, %rdi
movq %r12, %rsi
callq 0x34a2
movq %rax, %rdi
callq 0x20e0
movq %r12, %rdi
callq 0x20b0
movq %r12, %rdi
movq 0x10(%rsp), %rsi
callq 0x3010
jmp 0x31c3
movq %rbp, %rdi
callq 0x2220
movq %r12, %rdi
callq 0x348c
incl %r15d
jmp 0x306c
addq $0x2c8, %rsp            # imm = 0x2C8
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0x3238
movq %rax, %rbx
jmp 0x322c
movq %rax, %rbx
jmp 0x3222
movq %rax, %rbx
jmp 0x3215
movq %rax, %rbx
jmp 0x320b
movq %rax, %rbx
leaq 0xc8(%rsp), %rdi
callq 0x348c
leaq 0x60(%rsp), %rdi
callq 0x20d0
leaq 0xa8(%rsp), %rdi
callq 0x20d0
leaq 0x20(%rsp), %rdi
callq 0x20d0
leaq 0x40(%rsp), %rdi
callq 0x20d0
jmp 0x3269
movq %rax, %rbx
jmp 0x325c
movq %rax, %rbx
jmp 0x324f
movq %rax, %rbx
leaq 0x60(%rsp), %rdi
callq 0x20d0
leaq 0xc8(%rsp), %rdi
callq 0x2220
leaq 0x80(%rsp), %rdi
callq 0x348c
movq %rbx, %rdi
callq 0x2270