// File: /workspace/github_cpp_makefile_star2_O3/Bartor[P]kompilator/middle/ast_optimizer/ASTOptimizer.cpp
// Function: ASTOptimizer::traverse(Node*, std::function<Node* (Node*)>)
bool ASTOptimizer::traverse(Node *node, Callback callback) {
    if (auto cmdList = dynamic_cast<CommandList *>(node)) {
        return traverse(*cmdList, callback);
    } else if (auto whileNode = dynamic_cast<While *>(node)) {
        return traverse(whileNode->commands, callback);
    } else if (auto forNode = dynamic_cast<For *>(node)) {
        return traverse(forNode->commands, callback);
    } else if (auto ifNode = dynamic_cast<If *>(node)) {
        return traverse(ifNode->commands, callback);
    } else if (auto ifElse = dynamic_cast<IfElse *>(node)) {
        return traverse(ifElse->commands, callback) || traverse(ifElse->elseCommands, callback);
    }
    return false;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0xc8, %rsp
testq %rsi, %rsi
je 0x18c24
movq %rdx, %r15
movq %rsi, %r12
movq %rdi, %rbx
leaq 0xda47(%rip), %rsi      # 0x26610
leaq 0xd758(%rip), %rdx      # 0x26328
movq %r12, %rdi
xorl %ecx, %ecx
callq 0x5240
testq %rax, %rax
je 0x18c3c
movq %rax, %r14
leaq -0xe8(%rbp), %r12
movq %r12, %rdi
movq %r15, %rsi
callq 0xeab4
movq %rbx, %rdi
movq %r14, %rsi
movq %r12, %rdx
callq 0x18a94
movl %eax, %r14d
movq -0xd8(%rbp), %rax
testq %rax, %rax
je 0x18c27
leaq -0xe8(%rbp), %rdi
movq %rdi, %rsi
movl $0x3, %edx
callq *%rax
jmp 0x18c27
xorl %r14d, %r14d
movl %r14d, %eax
addq $0xc8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0xd9cd(%rip), %rsi      # 0x26610
leaq 0xd7fe(%rip), %rdx      # 0x26448
movq %r12, %rdi
xorl %ecx, %ecx
callq 0x5240
testq %rax, %rax
je 0x18c9f
movq 0x10(%rax), %r14
leaq -0xc8(%rbp), %r12
movq %r12, %rdi
movq %r15, %rsi
callq 0xeab4
movq %rbx, %rdi
movq %r14, %rsi
movq %r12, %rdx
callq 0x18a94
movl %eax, %r14d
movq -0xb8(%rbp), %rax
testq %rax, %rax
je 0x18c27
leaq -0xc8(%rbp), %rdi
movq %rdi, %rsi
movl $0x3, %edx
callq *%rax
jmp 0x18c27
leaq 0xd96a(%rip), %rsi      # 0x26610
leaq 0xd7e3(%rip), %rdx      # 0x26490
movq %r12, %rdi
xorl %ecx, %ecx
callq 0x5240
testq %rax, %rax
je 0x18d09
movq 0x38(%rax), %r14
leaq -0xa8(%rbp), %r12
movq %r12, %rdi
movq %r15, %rsi
callq 0xeab4
movq %rbx, %rdi
movq %r14, %rsi
movq %r12, %rdx
callq 0x18a94
movl %eax, %r14d
movq -0x98(%rbp), %rax
testq %rax, %rax
je 0x18c27
leaq -0xa8(%rbp), %rdi
movq %rdi, %rsi
movl $0x3, %edx
callq *%rax
jmp 0x18c27
leaq 0xd900(%rip), %rsi      # 0x26610
leaq 0xd6a1(%rip), %rdx      # 0x263b8
movq %r12, %rdi
xorl %ecx, %ecx
callq 0x5240
testq %rax, %rax
je 0x18d70
movq 0x10(%rax), %r14
leaq -0x88(%rbp), %r12
movq %r12, %rdi
movq %r15, %rsi
callq 0xeab4
movq %rbx, %rdi
movq %r14, %rsi
movq %r12, %rdx
callq 0x18a94
movl %eax, %r14d
movq -0x78(%rbp), %rax
testq %rax, %rax
je 0x18c27
leaq -0x88(%rbp), %rdi
movq %rdi, %rsi
movl $0x3, %edx
callq *%rax
jmp 0x18c27
leaq 0xd899(%rip), %rsi      # 0x26610
leaq 0xd682(%rip), %rdx      # 0x26400
xorl %r14d, %r14d
movq %r12, %rdi
xorl %ecx, %ecx
callq 0x5240
testq %rax, %rax
je 0x18c27
movq %rax, %r12
movq 0x10(%rax), %r14
leaq -0x68(%rbp), %r13
movq %r13, %rdi
movq %r15, %rsi
callq 0xeab4
movq %rbx, %rdi
movq %r14, %rsi
movq %r13, %rdx
callq 0x18a94
movb $0x1, %r14b
testb %al, %al
jne 0x18df9
movq 0x18(%r12), %r14
leaq -0x48(%rbp), %rdi
movq %r15, %rsi
callq 0xeab4
leaq -0x48(%rbp), %rdx
movq %rbx, %rdi
movq %r14, %rsi
callq 0x18a94
movl %eax, %r14d
movq -0x38(%rbp), %rax
testq %rax, %rax
je 0x18df9
leaq -0x48(%rbp), %rdi
movq %rdi, %rsi
movl $0x3, %edx
callq *%rax
movq -0x58(%rbp), %rax
testq %rax, %rax
je 0x18c27
leaq -0x68(%rbp), %rdi
movq %rdi, %rsi
movl $0x3, %edx
callq *%rax
jmp 0x18c27
jmp 0x18f0c
movq %rax, %rbx
movq -0x38(%rbp), %rax
testq %rax, %rax
je 0x18e47
leaq -0x48(%rbp), %rdi
movq %rdi, %rsi
movl $0x3, %edx
callq *%rax
jmp 0x18e47
jmp 0x18f0c
jmp 0x18f0c
movq %rax, %rbx
movq -0x58(%rbp), %rax
testq %rax, %rax
je 0x18f04
leaq -0x68(%rbp), %rdi
movq %rdi, %rsi
movl $0x3, %edx
callq *%rax
jmp 0x18f04
jmp 0x18f0c
jmp 0x18f0c
movq %rax, %rbx
movq -0x78(%rbp), %rax
testq %rax, %rax
je 0x18f04
leaq -0x88(%rbp), %rdi
movq %rdi, %rsi
movl $0x3, %edx
callq *%rax
jmp 0x18f04
jmp 0x18f0c
jmp 0x18f0c
movq %rax, %rbx
movq -0x98(%rbp), %rax
testq %rax, %rax
je 0x18f04
leaq -0xa8(%rbp), %rdi
movq %rdi, %rsi
movl $0x3, %edx
callq *%rax
jmp 0x18f04
jmp 0x18f0c
jmp 0x18f0c
movq %rax, %rbx
movq -0xb8(%rbp), %rax
testq %rax, %rax
je 0x18f04
leaq -0xc8(%rbp), %rdi
movq %rdi, %rsi
movl $0x3, %edx
callq *%rax
jmp 0x18f04
jmp 0x18f0c
jmp 0x18f0c
movq %rax, %rbx
movq -0xd8(%rbp), %rax
testq %rax, %rax
je 0x18f04
leaq -0xe8(%rbp), %rdi
movq %rdi, %rsi
movl $0x3, %edx
callq *%rax
movq %rbx, %rdi
callq 0x53d0
movq %rax, %rdi
callq 0xeb19