// File: /workspace/github_cpp_makefile_star2_O3/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 0x360e
movq (%rbx), %rdi
cmpq 0x8(%rbx), %rdi
je 0x32a4
movq 0x5ed5(%rip), %rbx      # 0x8fd8
leaq 0x3092(%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), %r13
movq 0x38(%rsp), %r15
cmpq %r15, %r13
je 0x324e
movq (%r13), %rbp
movq 0x20(%rbp), %rsi
movq 0x28(%rbp), %rdx
movq %rbx, %rdi
callq 0x21d0
movq %rax, %r12
movl $0x1, %edx
movq %rax, %rdi
movq %r14, %rsi
callq 0x21d0
movsd 0x40(%rbp), %xmm0
movq %r12, %rdi
callq 0x2240
movq %rax, %r12
movl $0x1, %edx
movq %rax, %rdi
movq %r14, %rsi
callq 0x21d0
movl 0x78(%rbp), %esi
movq %r12, %rdi
callq 0x2270
movl $0x1, %edx
movq %rax, %rdi
leaq 0x2f75(%rip), %rsi      # 0x612b
callq 0x21d0
movq 0x80(%rbp), %rax
testq %rax, %rax
je 0x31ef
movq 0x18(%rsp), %rsi
cmpq 0x20(%rsp), %rsi
je 0x31de
movq %rax, (%rsi)
addq $0x8, 0x18(%rsp)
jmp 0x31ef
leaq 0x80(%rbp), %rdx
leaq 0x10(%rsp), %rdi
callq 0x4066
movq 0x88(%rbp), %rax
testq %rax, %rax
je 0x3226
movq 0x18(%rsp), %rsi
cmpq 0x20(%rsp), %rsi
je 0x3212
movq %rax, (%rsi)
addq $0x8, 0x18(%rsp)
jmp 0x3226
addq $0x88, %rbp
leaq 0x10(%rsp), %rdi
movq %rbp, %rdx
callq 0x4066
addq $0x8, %r13
cmpq %r15, %r13
jne 0x3155
movq 0x30(%rsp), %r13
movq 0x38(%rsp), %r15
movq 0x10(%rsp), %rdi
movq 0x18(%rsp), %rax
movq 0x20(%rsp), %rcx
jmp 0x3254
xorl %ecx, %ecx
xorl %eax, %eax
xorl %edi, %edi
movq 0x40(%rsp), %rsi
movq %rdi, 0x30(%rsp)
movq %rax, 0x38(%rsp)
movq %rcx, 0x40(%rsp)
movq %r13, 0x10(%rsp)
movq %r15, 0x18(%rsp)
movq %rsi, 0x20(%rsp)
cmpq %r13, %r15
je 0x3281
movq %r13, 0x18(%rsp)
testq %r13, %r13
je 0x329b
subq %r13, %rsi
movq %r13, %rdi
callq 0x21a0
movq 0x30(%rsp), %rdi
movq 0x38(%rsp), %rax
cmpq %rax, %rdi
jne 0x310a
testq %rdi, %rdi
je 0x32b6
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 0x32e4
movq %rax, %rbx
movq 0x10(%rsp), %rdi
testq %rdi, %rdi
je 0x32e4
movq 0x20(%rsp), %rsi
subq %rdi, %rsi
callq 0x21a0
movq 0x30(%rsp), %rdi
testq %rdi, %rdi
je 0x32fb
movq 0x40(%rsp), %rsi
subq %rdi, %rsi
callq 0x21a0
movq %rbx, %rdi
callq 0x2290
nop