// File: /workspace/github_cpp_makefile_star2_O1/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
movq %rdx, %r14
movq %rsi, %r15
movq %rdi, %rbx
testq %rsi, %rsi
je 0x18e63
leaq 0xe1db(%rip), %rsi      # 0x27028
leaq 0xe49c(%rip), %rdx      # 0x272f0
movq %r15, %rdi
xorl %ecx, %ecx
callq 0x5240
movq %rax, %r12
jmp 0x18e66
xorl %r12d, %r12d
testq %r12, %r12
je 0x18eb6
leaq -0xe8(%rbp), %r15
movq %r15, %rdi
movq %r14, %rsi
callq 0xebc4
movq %rbx, %rdi
movq %r12, %rsi
movq %r15, %rdx
callq 0x18d22
movl %eax, %r15d
movq -0xd8(%rbp), %rax
movb $0x1, %bl
testq %rax, %rax
je 0x190c6
leaq -0xe8(%rbp), %rdi
movq %rdi, %rsi
movl $0x3, %edx
callq *%rax
jmp 0x190c6
testq %r15, %r15
je 0x18ed5
leaq 0xe166(%rip), %rsi      # 0x27028
leaq 0xe547(%rip), %rdx      # 0x27410
movq %r15, %rdi
xorl %ecx, %ecx
callq 0x5240
jmp 0x18ed7
xorl %eax, %eax
testq %rax, %rax
je 0x18f2b
movq 0x10(%rax), %r15
leaq -0xc8(%rbp), %r12
movq %r12, %rdi
movq %r14, %rsi
callq 0xebc4
movq %rbx, %rdi
movq %r15, %rsi
movq %r12, %rdx
callq 0x18d22
movl %eax, %r15d
movq -0xb8(%rbp), %rax
movb $0x1, %bl
testq %rax, %rax
je 0x190c6
leaq -0xc8(%rbp), %rdi
movq %rdi, %rsi
movl $0x3, %edx
callq *%rax
jmp 0x190c6
testq %r15, %r15
je 0x18f4a
leaq 0xe0f1(%rip), %rsi      # 0x27028
leaq 0xe51a(%rip), %rdx      # 0x27458
movq %r15, %rdi
xorl %ecx, %ecx
callq 0x5240
jmp 0x18f4c
xorl %eax, %eax
testq %rax, %rax
je 0x18fa0
movq 0x38(%rax), %r15
leaq -0xa8(%rbp), %r12
movq %r12, %rdi
movq %r14, %rsi
callq 0xebc4
movq %rbx, %rdi
movq %r15, %rsi
movq %r12, %rdx
callq 0x18d22
movl %eax, %r15d
movq -0x98(%rbp), %rax
movb $0x1, %bl
testq %rax, %rax
je 0x190c6
leaq -0xa8(%rbp), %rdi
movq %rdi, %rsi
movl $0x3, %edx
callq *%rax
jmp 0x190c6
testq %r15, %r15
je 0x18fbf
leaq 0xe07c(%rip), %rsi      # 0x27028
leaq 0xe3cd(%rip), %rdx      # 0x27380
movq %r15, %rdi
xorl %ecx, %ecx
callq 0x5240
jmp 0x18fc1
xorl %eax, %eax
testq %rax, %rax
je 0x19012
movq 0x10(%rax), %r15
leaq -0x88(%rbp), %r12
movq %r12, %rdi
movq %r14, %rsi
callq 0xebc4
movq %rbx, %rdi
movq %r15, %rsi
movq %r12, %rdx
callq 0x18d22
movl %eax, %r15d
movq -0x78(%rbp), %rax
movb $0x1, %bl
testq %rax, %rax
je 0x190c6
leaq -0x88(%rbp), %rdi
movq %rdi, %rsi
movl $0x3, %edx
callq *%rax
jmp 0x190c6
testq %r15, %r15
je 0x19034
leaq 0xe00a(%rip), %rsi      # 0x27028
leaq 0xe3a3(%rip), %rdx      # 0x273c8
movq %r15, %rdi
xorl %ecx, %ecx
callq 0x5240
movq %rax, %r13
jmp 0x19037
xorl %r13d, %r13d
testq %r13, %r13
je 0x190c4
movq 0x10(%r13), %r15
leaq -0x68(%rbp), %r12
movq %r12, %rdi
movq %r14, %rsi
callq 0xebc4
movq %rbx, %rdi
movq %r15, %rsi
movq %r12, %rdx
callq 0x18d22
movl %eax, %r12d
movb $0x1, %r15b
testb %al, %al
jne 0x1908d
movq 0x18(%r13), %r15
leaq -0x48(%rbp), %rdi
movq %r14, %rsi
callq 0xebc4
leaq -0x48(%rbp), %rdx
movq %rbx, %rdi
movq %r15, %rsi
callq 0x18d22
movl %eax, %r15d
testb %r12b, %r12b
jne 0x190a9
movq -0x38(%rbp), %rax
testq %rax, %rax
je 0x190a9
leaq -0x48(%rbp), %rdi
movq %rdi, %rsi
movl $0x3, %edx
callq *%rax
movq -0x58(%rbp), %rax
movb $0x1, %bl
testq %rax, %rax
je 0x190c6
leaq -0x68(%rbp), %rdi
movq %rdi, %rsi
movl $0x3, %edx
callq *%rax
jmp 0x190c6
xorl %ebx, %ebx
andb %r15b, %bl
movl %ebx, %eax
addq $0xc8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0x191d0
movq %rax, %rbx
movq -0x38(%rbp), %rax
testq %rax, %rax
je 0x1910b
leaq -0x48(%rbp), %rdi
movq %rdi, %rsi
movl $0x3, %edx
callq *%rax
jmp 0x1910b
jmp 0x191d0
jmp 0x191d0
movq %rax, %rbx
movq -0x58(%rbp), %rax
testq %rax, %rax
je 0x191c8
leaq -0x68(%rbp), %rdi
movq %rdi, %rsi
movl $0x3, %edx
callq *%rax
jmp 0x191c8
jmp 0x191d0
jmp 0x191d0
movq %rax, %rbx
movq -0x78(%rbp), %rax
testq %rax, %rax
je 0x191c8
leaq -0x88(%rbp), %rdi
movq %rdi, %rsi
movl $0x3, %edx
callq *%rax
jmp 0x191c8
jmp 0x191d0
jmp 0x191d0
movq %rax, %rbx
movq -0x98(%rbp), %rax
testq %rax, %rax
je 0x191c8
leaq -0xa8(%rbp), %rdi
movq %rdi, %rsi
movl $0x3, %edx
callq *%rax
jmp 0x191c8
jmp 0x191d0
jmp 0x191d0
movq %rax, %rbx
movq -0xb8(%rbp), %rax
testq %rax, %rax
je 0x191c8
leaq -0xc8(%rbp), %rdi
movq %rdi, %rsi
movl $0x3, %edx
callq *%rax
jmp 0x191c8
jmp 0x191d0
jmp 0x191d0
movq %rax, %rbx
movq -0xd8(%rbp), %rax
testq %rax, %rax
je 0x191c8
leaq -0xe8(%rbp), %rdi
movq %rdi, %rsi
movl $0x3, %edx
callq *%rax
movq %rbx, %rdi
callq 0x53d0
movq %rax, %rdi
callq 0xec29