// File: /workspace/github_cpp_makefile_star2_O2/WinChua[P]MLDemo/DecisionTree.cpp
// Function: TreeNode::choose_attr(std::vector<int, std::allocator<int>>&, std::vector<int, std::allocator<int>>&)
struct TreeNode::FeatureGain TreeNode::choose_attr(std::vector<int> &max_l_index, std::vector<int> &max_r_index)
{
    std::string max_attr("no");
    double max_entropy=0.0;
    std::vector<int> l_index, r_index;
    for(auto feature : data.featureset)
    {
        double gain = gain_of_attr(feature, l_index, r_index);
        if(gain > max_entropy)
        {
            max_attr = feature;
            swap(max_l_index, l_index);
            swap(max_r_index, r_index);
            max_entropy = gain;
        }
        r_index.clear();
        l_index.clear();
    }
    if(max_entropy <  0.005)
    {
        return {"no divided", 0.0};
    }
    return {max_attr, max_entropy};
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0xc8, %rsp
movq %rcx, %r14
movq %rdx, %r15
movq %rsi, %rbx
movq %rdi, 0x50(%rsp)
leaq 0x27d8(%rip), %rsi      # 0x50a4
leaq 0x68(%rsp), %rdi
leaq 0x88(%rsp), %rbp
movq %rbp, %rdx
callq 0x320e
leaq 0x30(%rsp), %rax
andq $0x0, 0x10(%rax)
xorpd %xmm0, %xmm0
movapd %xmm0, (%rax)
leaq 0x10(%rsp), %rax
movapd %xmm0, (%rax)
andq $0x0, 0x10(%rax)
movq %rbx, 0x60(%rsp)
movq (%rbx), %r12
movq 0x50(%r12), %rbx
addq $0x40, %r12
xorpd %xmm0, %xmm0
movsd %xmm0, 0x8(%rsp)
leaq 0xa8(%rsp), %r13
cmpq %r12, %rbx
je 0x2a1f
leaq 0x20(%rbx), %rsi
movq %rbp, %rdi
callq 0x2220
movq %r13, %rdi
movq %rbp, %rsi
callq 0x2220
movq 0x60(%rsp), %rdi
movq %r13, %rsi
leaq 0x30(%rsp), %rdx
leaq 0x10(%rsp), %rcx
callq 0x2efc
movsd %xmm0, 0x58(%rsp)
movq %r13, %rdi
callq 0x20c0
movsd 0x58(%rsp), %xmm0
ucomisd 0x8(%rsp), %xmm0
jbe 0x29e2
leaq 0x68(%rsp), %rdi
movq %rbp, %rsi
callq 0x20f0
movq 0x10(%r15), %rax
movaps 0x30(%rsp), %xmm0
movq 0x40(%rsp), %rcx
movq %rcx, 0x10(%r15)
movups (%r15), %xmm1
movups %xmm0, (%r15)
movaps %xmm1, 0x30(%rsp)
movq %rax, 0x40(%rsp)
movq (%r14), %rax
movq 0x8(%r14), %rcx
movq 0x10(%r14), %rdx
movaps 0x10(%rsp), %xmm0
movups %xmm0, (%r14)
movq 0x20(%rsp), %rsi
movq %rsi, 0x10(%r14)
movq %rax, 0x10(%rsp)
movq %rcx, 0x18(%rsp)
movq %rdx, 0x20(%rsp)
movsd 0x58(%rsp), %xmm0
movsd %xmm0, 0x8(%rsp)
jmp 0x29ec
movq 0x10(%rsp), %rax
movq 0x18(%rsp), %rcx
cmpq %rax, %rcx
je 0x29f6
movq %rax, 0x18(%rsp)
movq 0x30(%rsp), %rax
cmpq %rax, 0x38(%rsp)
je 0x2a07
movq %rax, 0x38(%rsp)
movq %rbp, %rdi
callq 0x20c0
movq %rbx, %rdi
callq 0x21f0
movq %rax, %rbx
jmp 0x2924
movsd 0x2609(%rip), %xmm0     # 0x5030
ucomisd 0x8(%rsp), %xmm0
jbe 0x2a52
leaq 0x260e(%rip), %rsi      # 0x5044
leaq 0x88(%rsp), %rdx
movq 0x50(%rsp), %rbx
movq %rbx, %rdi
callq 0x320e
andq $0x0, 0x20(%rbx)
jmp 0x2a6f
leaq 0x68(%rsp), %rsi
movq 0x50(%rsp), %rbx
movq %rbx, %rdi
callq 0x2220
movsd 0x8(%rsp), %xmm0
movsd %xmm0, 0x20(%rbx)
leaq 0x10(%rsp), %rdi
callq 0x37b8
leaq 0x30(%rsp), %rdi
callq 0x37b8
leaq 0x68(%rsp), %rdi
callq 0x20c0
movq %rbx, %rax
addq $0xc8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0x2aa6
jmp 0x2aa6
movq %rax, %rbx
jmp 0x2acd
movq %rax, %rbx
leaq 0xa8(%rsp), %rdi
callq 0x20c0
jmp 0x2ac0
movq %rax, %rbx
leaq 0x88(%rsp), %rdi
callq 0x20c0
leaq 0x10(%rsp), %rdi
callq 0x37b8
leaq 0x30(%rsp), %rdi
callq 0x37b8
leaq 0x68(%rsp), %rdi
callq 0x20c0
movq %rbx, %rdi
callq 0x22a0
nop