// File: /workspace/github_cpp_makefile_star2_O2/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 0x13673
movq %rdx, %r14
movq %rsi, %r15
movq %rdi, %rbx
leaq 0xbfe3(%rip), %rsi      # 0x1f618
leaq 0xbcf4(%rip), %rdx      # 0x1f330
movq %r15, %rdi
xorl %ecx, %ecx
callq 0x51f0
testq %rax, %rax
je 0x1367b
movq %rax, %r12
leaq -0xf0(%rbp), %r15
movq %r15, %rdi
movq %r14, %rsi
callq 0xa87a
movq %rbx, %rdi
movq %r12, %rsi
movq %r15, %rdx
callq 0x13552
jmp 0x13745
xorl %r12d, %r12d
jmp 0x13750
leaq 0xbf96(%rip), %rsi      # 0x1f618
leaq 0xbdc7(%rip), %rdx      # 0x1f450
movq %r15, %rdi
xorl %ecx, %ecx
callq 0x51f0
testq %rax, %rax
je 0x136c1
movq 0x10(%rax), %r12
leaq -0xd0(%rbp), %r15
movq %r15, %rdi
movq %r14, %rsi
callq 0xa87a
movq %rbx, %rdi
movq %r12, %rsi
movq %r15, %rdx
callq 0x13552
jmp 0x13745
leaq 0xbf50(%rip), %rsi      # 0x1f618
leaq 0xbdc9(%rip), %rdx      # 0x1f498
movq %r15, %rdi
xorl %ecx, %ecx
callq 0x51f0
testq %rax, %rax
je 0x13704
movq 0x38(%rax), %r12
leaq -0xb0(%rbp), %r15
movq %r15, %rdi
movq %r14, %rsi
callq 0xa87a
movq %rbx, %rdi
movq %r12, %rsi
movq %r15, %rdx
callq 0x13552
jmp 0x13745
leaq 0xbf0d(%rip), %rsi      # 0x1f618
leaq 0xbcae(%rip), %rdx      # 0x1f3c0
movq %r15, %rdi
xorl %ecx, %ecx
callq 0x51f0
testq %rax, %rax
je 0x13765
movq 0x10(%rax), %r12
leaq -0x90(%rbp), %r15
movq %r15, %rdi
movq %r14, %rsi
callq 0xa87a
movq %rbx, %rdi
movq %r12, %rsi
movq %r15, %rdx
callq 0x13552
movl %eax, %r12d
movq %r15, %rdi
callq 0xa8c8
movl %r12d, %eax
addq $0xc8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0xbeac(%rip), %rsi      # 0x1f618
leaq 0xbc95(%rip), %rdx      # 0x1f408
xorl %r12d, %r12d
movq %r15, %rdi
xorl %ecx, %ecx
callq 0x51f0
testq %rax, %rax
je 0x13750
movq %rax, %r13
movq 0x10(%rax), %r15
leaq -0x70(%rbp), %r12
movq %r12, %rdi
movq %r14, %rsi
callq 0xa87a
movq %rbx, %rdi
movq %r15, %rsi
movq %r12, -0x30(%rbp)
movq %r12, %rdx
callq 0x13552
movb $0x1, %r12b
leaq -0x70(%rbp), %r15
testb %al, %al
jne 0x13748
movq 0x18(%r13), %r12
leaq -0x50(%rbp), %rdi
movq %r14, %rsi
callq 0xa87a
leaq -0x50(%rbp), %rdx
movq %rbx, %rdi
movq %r12, %rsi
callq 0x13552
movl %eax, %r12d
leaq -0x50(%rbp), %rdi
callq 0xa8c8
jmp 0x13748
movq %rax, %rbx
leaq -0x50(%rbp), %rdi
callq 0xa8c8
leaq -0x70(%rbp), %rax
jmp 0x1382d
movq %rax, %rbx
jmp 0x13831
movq %rax, %rbx
leaq -0x90(%rbp), %rax
jmp 0x1382d
movq %rax, %rbx
leaq -0xb0(%rbp), %rax
jmp 0x1382d
movq %rax, %rbx
leaq -0xd0(%rbp), %rax
jmp 0x1382d
movq %rax, %rbx
leaq -0xf0(%rbp), %rax
movq %rax, -0x30(%rbp)
movq -0x30(%rbp), %rdi
callq 0xa8c8
movq %rbx, %rdi
callq 0x5390