// File: /workspace/github_cpp_makefile_star2_O1/WinChua[P]MLDemo/DecisionTree.cpp
// Function: TreeNode::show_tree()
void TreeNode::show_tree()
{
    std::vector<TreeNode *> current_level = {this};
    while(!current_level.empty())
    {
        std::cout << std::endl;
        std::vector<TreeNode *> next_level;
        for(auto it : current_level)
        {
            std::cout << it->attr << ":" << it->gain <<":" << it->label << " ";
//            if(it->lchild == nullptr && it->rchild == nullptr) {
//                std::cout << "the size of the leaf is " << it->record_index.size() << std::endl;
//            }
            if(it->lchild != nullptr)
            {
                next_level.push_back(it->lchild);
            }
            if(it->rchild != nullptr)
            {
                next_level.push_back(it->rchild);
            }
        }
        swap(current_level, next_level);
        next_level.clear();
    }
    return;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x48, %rsp
leaq 0x10(%rsp), %rsi
movq %rdi, (%rsi)
leaq 0x30(%rsp), %rbx
leaq 0xf(%rsp), %rcx
movl $0x1, %edx
movq %rbx, %rdi
callq 0x3618
movq (%rbx), %rdi
cmpq 0x8(%rbx), %rdi
je 0x32ae
movq 0x5ebb(%rip), %rbx      # 0x8fd8
leaq 0x3078(%rip), %r14      # 0x619c
movq (%rbx), %rax
movq -0x18(%rax), %rdi
addq %rbx, %rdi
movl $0xa, %esi
callq 0x2180
movsbl %al, %esi
movq %rbx, %rdi
callq 0x2030
movq %rax, %rdi
callq 0x2120
xorps %xmm0, %xmm0
movaps %xmm0, 0x10(%rsp)
movq $0x0, 0x20(%rsp)
movq 0x30(%rsp), %r12
movq 0x38(%rsp), %r15
cmpq %r15, %r12
je 0x324b
movq (%r12), %r13
movq 0x20(%r13), %rsi
movq 0x28(%r13), %rdx
movq %rbx, %rdi
callq 0x21d0
movq %rax, %rbp
movl $0x1, %edx
movq %rax, %rdi
movq %r14, %rsi
callq 0x21d0
movsd 0x40(%r13), %xmm0
movq %rbp, %rdi
callq 0x2240
movq %rax, %rbp
movl $0x1, %edx
movq %rax, %rdi
movq %r14, %rsi
callq 0x21d0
movl 0x78(%r13), %esi
movq %rbp, %rdi
callq 0x2270
movl $0x1, %edx
movq %rax, %rdi
leaq 0x2f59(%rip), %rsi      # 0x612b
callq 0x21d0
movq 0x80(%r13), %rax
testq %rax, %rax
je 0x320b
movq 0x18(%rsp), %rsi
cmpq 0x20(%rsp), %rsi
je 0x31fa
movq %rax, (%rsi)
addq $0x8, 0x18(%rsp)
jmp 0x320b
leaq 0x80(%r13), %rdx
leaq 0x10(%rsp), %rdi
callq 0x406a
movq 0x88(%r13), %rax
testq %rax, %rax
je 0x3242
movq 0x18(%rsp), %rsi
cmpq 0x20(%rsp), %rsi
je 0x322e
movq %rax, (%rsi)
addq $0x8, 0x18(%rsp)
jmp 0x3242
addq $0x88, %r13
leaq 0x10(%rsp), %rdi
movq %r13, %rdx
callq 0x406a
addq $0x8, %r12
jmp 0x3166
movq 0x30(%rsp), %rdi
movq 0x38(%rsp), %rax
movq 0x40(%rsp), %rsi
movq 0x10(%rsp), %rcx
movq %rcx, 0x30(%rsp)
movq 0x18(%rsp), %rcx
movq %rcx, 0x38(%rsp)
movq 0x20(%rsp), %rcx
movq %rcx, 0x40(%rsp)
movq %rdi, 0x10(%rsp)
movq %rax, 0x18(%rsp)
movq %rsi, 0x20(%rsp)
cmpq %rdi, %rax
je 0x3291
movq %rdi, 0x18(%rsp)
testq %rdi, %rdi
je 0x329e
subq %rdi, %rsi
callq 0x21a0
movq 0x30(%rsp), %rdi
cmpq 0x38(%rsp), %rdi
jne 0x3124
testq %rdi, %rdi
je 0x32c0
movq 0x40(%rsp), %rsi
subq %rdi, %rsi
callq 0x21a0
addq $0x48, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %rax, %rbx
jmp 0x32ee
movq %rax, %rbx
movq 0x10(%rsp), %rdi
testq %rdi, %rdi
je 0x32ee
movq 0x20(%rsp), %rsi
subq %rdi, %rsi
callq 0x21a0
movq 0x30(%rsp), %rdi
testq %rdi, %rdi
je 0x3305
movq 0x40(%rsp), %rsi
subq %rdi, %rsi
callq 0x21a0
movq %rbx, %rdi
callq 0x2290
nop