// File: 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
movq %rsp, %rbp
subq $0x360, %rsp            # imm = 0x360
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
cmpq $0x5, -0x10(%rbp)
jae 0x64da
movl $0x3, %edi
movl $0x5, %esi
callq 0x6110
movl %eax, -0x14(%rbp)
movl $0x0, -0x18(%rbp)
movl -0x18(%rbp), %eax
cmpl -0x14(%rbp), %eax
jge 0x64d8
movq -0x8(%rbp), %rax
movq %rax, -0x330(%rbp)
leaq -0xc8(%rbp), %rdi
movq %rdi, -0x328(%rbp)
callq 0x7530
movq -0x328(%rbp), %rsi
leaq 0x2e76(%rip), %rdx      # 0x9025
leaq -0xa8(%rbp), %rdi
callq 0x6760
jmp 0x61bd
movl -0x18(%rbp), %esi
leaq -0xf8(%rbp), %rdi
callq 0x67b0
jmp 0x61ce
leaq -0x88(%rbp), %rdi
leaq -0xa8(%rbp), %rsi
leaq -0xf8(%rbp), %rdx
callq 0x6690
jmp 0x61ea
leaq -0x68(%rbp), %rdi
leaq -0x88(%rbp), %rsi
movl $0x2, %edx
callq 0x68d0
jmp 0x6201
movq -0x330(%rbp), %rsi
leaq -0x40(%rbp), %rdi
leaq -0x68(%rbp), %rdx
callq 0x6610
jmp 0x6217
leaq -0x68(%rbp), %rdi
callq 0x6960
leaq -0x88(%rbp), %rdi
callq 0x3150
leaq -0xf8(%rbp), %rdi
callq 0x3150
leaq -0xa8(%rbp), %rdi
callq 0x3150
leaq -0xc8(%rbp), %rdi
callq 0x3150
callq 0x3090
movl $0x2, %ecx
cltd
idivl %ecx
cmpl $0x0, %edx
je 0x6389
movq 0x5d63(%rip), %rdi      # 0xbfd0
leaq 0x2db3(%rip), %rsi      # 0x9027
callq 0x3220
movq %rax, -0x338(%rbp)
jmp 0x6282
movq -0x338(%rbp), %rdi
leaq -0x40(%rbp), %rsi
callq 0x6990
movq %rax, -0x340(%rbp)
jmp 0x629b
movq -0x340(%rbp), %rdi
movq 0x5d17(%rip), %rsi      # 0xbfc0
callq 0x3260
jmp 0x62b0
leaq -0x40(%rbp), %rdi
callq 0x30f0
jmp 0x62bb
movq -0x10(%rbp), %rsi
incq %rsi
leaq -0x40(%rbp), %rdi
callq 0x6140
jmp 0x62cd
jmp 0x64b6
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0xd0(%rbp)
movl %eax, -0xd4(%rbp)
jmp 0x6361
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0xd0(%rbp)
movl %eax, -0xd4(%rbp)
jmp 0x6355
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0xd0(%rbp)
movl %eax, -0xd4(%rbp)
jmp 0x6349
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0xd0(%rbp)
movl %eax, -0xd4(%rbp)
jmp 0x633d
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0xd0(%rbp)
movl %eax, -0xd4(%rbp)
leaq -0x68(%rbp), %rdi
callq 0x6960
leaq -0x88(%rbp), %rdi
callq 0x3150
leaq -0xf8(%rbp), %rdi
callq 0x3150
leaq -0xa8(%rbp), %rdi
callq 0x3150
leaq -0xc8(%rbp), %rdi
callq 0x3150
jmp 0x64e3
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0xd0(%rbp)
movl %eax, -0xd4(%rbp)
jmp 0x64cd
movq 0x5c40(%rip), %rdi      # 0xbfd0
leaq 0x2ca1(%rip), %rsi      # 0x9038
callq 0x3220
movq %rax, -0x348(%rbp)
jmp 0x63a5
movq -0x348(%rbp), %rdi
leaq -0x40(%rbp), %rsi
callq 0x6990
movq %rax, -0x350(%rbp)
jmp 0x63be
movq -0x350(%rbp), %rdi
movq 0x5bf4(%rip), %rsi      # 0xbfc0
callq 0x3260
jmp 0x63d3
leaq -0x2f8(%rbp), %rdi
leaq -0x40(%rbp), %rsi
movl $0x10, %edx
callq 0x6a80
jmp 0x63ea
movl $0x14, %edi
movl $0x1e, %esi
callq 0x6110
movl %eax, -0x2fc(%rbp)
movl -0x2fc(%rbp), %eax
movl %eax, %ecx
addl $-0x1, %ecx
movl %ecx, -0x2fc(%rbp)
cmpl $0x0, %eax
jle 0x649a
leaq -0x320(%rbp), %rdi
callq 0x7530
jmp 0x6427
leaq -0x2f8(%rbp), %rdi
leaq -0x320(%rbp), %rsi
callq 0x31e0
movq %rax, -0x358(%rbp)
jmp 0x6443
movq -0x358(%rbp), %rdi
movq 0x5b6f(%rip), %rsi      # 0xbfc0
callq 0x3260
jmp 0x6458
leaq -0x320(%rbp), %rdi
callq 0x3150
jmp 0x63ff
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0xd0(%rbp)
movl %eax, -0xd4(%rbp)
jmp 0x64a8
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0xd0(%rbp)
movl %eax, -0xd4(%rbp)
leaq -0x320(%rbp), %rdi
callq 0x3150
jmp 0x64a8
leaq -0x2f8(%rbp), %rdi
callq 0x3330
jmp 0x64b6
leaq -0x2f8(%rbp), %rdi
callq 0x3330
jmp 0x64cd
leaq -0x40(%rbp), %rdi
callq 0x6960
movl -0x18(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x18(%rbp)
jmp 0x6177
leaq -0x40(%rbp), %rdi
callq 0x6960
jmp 0x64e3
jmp 0x64da
addq $0x360, %rsp            # imm = 0x360
popq %rbp
retq
movq -0xd0(%rbp), %rdi
callq 0x3380
nop