// File: liujan[P]randomforest/Tree.cpp
// Function: Tree::selectBestPart(Node*)
pair<Node*, Node*> Tree::selectBestPart(Node *current){
    if (current == NULL)
        return pair<Node *, Node *>(NULL, NULL);
    
    vector<int> features = this->randomSelect(); //随机选出所有属性的60%作为分裂的候选属性
    vector<pair<int, vector<double> > > samples = current->samples;
    map<int, set<double> > values; //保存每个候选属性所能取到的值
    map<int, pair<double, double> > max_min; //保存每个候选属性的最大取值和最小取值
    
    for (int j = 0; j < features.size(); j++){
        int index = features[j];
        max_min[index].first = -1000;
        max_min[index].second = 1000;
    }
    
    //拿到所有候选属性的最大取值和最小取值
    for (int i = 0; i < samples.size(); i++){
        for (int j = 0; j < features.size(); j++){
            int index = features[j];
            double value = samples[i].second[index];
            
            if (value < max_min[index].second)
                max_min[index].second = value;
            if (value > max_min[index].first)
                max_min[index].first = value;
        }
    }
    
    
    map<int, pair<double, double> >::iterator it_value = max_min.begin();
    int numOfPart = 10;
    for (; it_value != max_min.end(); it_value++){
        double max = it_value->second.first;
        double min = it_value->second.second;
        int index = it_value->first;
        double step = (max - min) / numOfPart;
        if ((max - min) < 1e-5) {
            values[index].insert(min);
            continue;
        }
        for (int i = 1; i < numOfPart; i++){
            values[index].insert(min + step * i);
        }
    }
    
    
    //选出最好分裂属性的最好取值
    map<pair<int, double>, double> gini;
    map<int, set<double> >::iterator it = values.begin();
    
    for (; it != values.end(); it++){
        int attr = it->first;
        set<double>::iterator  it1 = it->second.begin();
        
        for (; it1 != it->second.end(); it1++){
            double value = *it1;
            int small[numOfTypes + 1];
            int large[numOfTypes + 1];
            int small_sum = 0;
            int large_sum = 0;
            memset(small, 0, sizeof(small));
            memset(large, 0, sizeof(large));
            for (int i = 0; i < samples.size(); i++){
                int type = samples[i].first;
                if (samples[i].second[attr] < value) {
                    small[type]++;
                    small_sum++;
                }
                else {
                    large[type]++;
                    large_sum++;
                }
            }
            double sumgini_small = 0.0;
            double sumgini_large = 0.0;
            
            for (int i = 0; i < numOfTypes + 1; i++){
                sumgini_small += ((small[i] * 1.0 / small_sum) * (small[i] * 1.0 / small_sum));
                sumgini_large += ((large[i] * 1.0 / large_sum) * (large[i] * 1.0 / large_sum));
            }
            gini[make_pair(attr, value)] = small_sum * 1.0 / samples.size() * (1 - sumgini_small) + large_sum * 1.0 / samples.size() * (1 - sumgini_large);
        }
    }
    
    
    int attr = 0;
    double value = 0;
    double min_value = 10000;
    //出分裂后基尼系数最小的分裂属性的值
    map<pair<int, double>, double>::iterator it_gini = gini.begin();
    for (; it_gini != gini.end(); it_gini++){
        if (it_gini->second <= min_value){
            min_value = it_gini->second;
            attr = it_gini->first.first;
            value = it_gini->first.second;
        }
    }
    
    Node *small = new Node();
    Node *large = new Node();
    //根据上面找出的基尼系数最小的属性和值，分裂成两个节点
    for (int i = 0; i < samples.size(); i++){
        //cout << attr << " " << samples[i].second[attr] << " " << value << endl;
        if (samples[i].second[attr] <= value) {
            small->samples.push_back(samples[i]);
            int type = samples[i].first;
            small->num[type - 1]++;
            small->sum++;
        }
        else {
            large->samples.push_back(samples[i]);
            int type = samples[i].first;
            large->num[type - 1]++;
            large->sum++;
        }
    }
    
    current->attribute = attr;
    current->value = value;
    small->depth = current->depth + 1;
    large->depth = current->depth + 1;
    return pair<Node *, Node *>(small, large);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x480, %rsp            # imm = 0x480
movq %rdi, -0x18(%rbp)
movq %rsi, -0x20(%rbp)
movq -0x18(%rbp), %rax
movq %rax, -0x340(%rbp)
cmpq $0x0, -0x20(%rbp)
jne 0x4edb
movq $0x0, -0x28(%rbp)
movq $0x0, -0x30(%rbp)
leaq -0x10(%rbp), %rdi
leaq -0x28(%rbp), %rsi
leaq -0x30(%rbp), %rdx
callq 0x6200
jmp 0x5c87
movq -0x340(%rbp), %rsi
leaq -0x48(%rbp), %rdi
callq 0x5e50
movq -0x20(%rbp), %rsi
addq $0x90, %rsi
leaq -0x60(%rbp), %rdi
callq 0x6230
jmp 0x4f01
leaq -0xa0(%rbp), %rdi
callq 0x6320
leaq -0xd0(%rbp), %rdi
callq 0x6340
movl $0x0, -0xd4(%rbp)
movslq -0xd4(%rbp), %rax
movq %rax, -0x348(%rbp)
leaq -0x48(%rbp), %rdi
callq 0x6360
movq %rax, %rcx
movq -0x348(%rbp), %rax
cmpq %rcx, %rax
jae 0x4ffb
movslq -0xd4(%rbp), %rsi
leaq -0x48(%rbp), %rdi
callq 0x6380
movl (%rax), %eax
movl %eax, -0xd8(%rbp)
leaq -0xd0(%rbp), %rdi
leaq -0xd8(%rbp), %rsi
callq 0x63a0
movq %rax, -0x350(%rbp)
jmp 0x4f81
movq -0x350(%rbp), %rax
movabsq $-0x3f70c00000000000, %rcx # imm = 0xC08F400000000000
movq %rcx, (%rax)
leaq -0xd0(%rbp), %rdi
leaq -0xd8(%rbp), %rsi
callq 0x63a0
movq %rax, -0x358(%rbp)
jmp 0x4fb1
movq -0x358(%rbp), %rax
movsd 0xb070(%rip), %xmm0     # 0x10030
movsd %xmm0, 0x8(%rax)
movl -0xd4(%rbp), %eax
addl $0x1, %eax
movl %eax, -0xd4(%rbp)
jmp 0x4f23
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x68(%rbp)
movl %eax, -0x6c(%rbp)
jmp 0x5c7c
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x68(%rbp)
movl %eax, -0x6c(%rbp)
jmp 0x5c5b
movl $0x0, -0xdc(%rbp)
movslq -0xdc(%rbp), %rax
movq %rax, -0x360(%rbp)
leaq -0x60(%rbp), %rdi
callq 0x2e50
movq %rax, %rcx
movq -0x360(%rbp), %rax
cmpq %rcx, %rax
jae 0x51dc
movl $0x0, -0xe0(%rbp)
movslq -0xe0(%rbp), %rax
movq %rax, -0x368(%rbp)
leaq -0x48(%rbp), %rdi
callq 0x6360
movq %rax, %rcx
movq -0x368(%rbp), %rax
cmpq %rcx, %rax
jae 0x51c6
movslq -0xe0(%rbp), %rsi
leaq -0x48(%rbp), %rdi
callq 0x6380
movl (%rax), %eax
movl %eax, -0xe4(%rbp)
movslq -0xdc(%rbp), %rsi
leaq -0x60(%rbp), %rdi
callq 0x60e0
movq %rax, %rdi
addq $0x8, %rdi
movslq -0xe4(%rbp), %rsi
callq 0x61e0
movsd (%rax), %xmm0
movsd %xmm0, -0xf0(%rbp)
movsd -0xf0(%rbp), %xmm0
movsd %xmm0, -0x378(%rbp)
leaq -0xd0(%rbp), %rdi
leaq -0xe4(%rbp), %rsi
callq 0x63a0
movq %rax, -0x370(%rbp)
jmp 0x50d6
movsd -0x378(%rbp), %xmm1
movq -0x370(%rbp), %rax
movsd 0x8(%rax), %xmm0
ucomisd %xmm1, %xmm0
jbe 0x5130
movsd -0xf0(%rbp), %xmm0
movsd %xmm0, -0x388(%rbp)
leaq -0xd0(%rbp), %rdi
leaq -0xe4(%rbp), %rsi
callq 0x63a0
movq %rax, -0x380(%rbp)
jmp 0x511c
movq -0x380(%rbp), %rax
movsd -0x388(%rbp), %xmm0
movsd %xmm0, 0x8(%rax)
movsd -0xf0(%rbp), %xmm0
movsd %xmm0, -0x398(%rbp)
leaq -0xd0(%rbp), %rdi
leaq -0xe4(%rbp), %rsi
callq 0x63a0
movq %rax, -0x390(%rbp)
jmp 0x515c
movsd -0x398(%rbp), %xmm0
movq -0x390(%rbp), %rax
ucomisd (%rax), %xmm0
jbe 0x51b0
movsd -0xf0(%rbp), %xmm0
movsd %xmm0, -0x3a8(%rbp)
leaq -0xd0(%rbp), %rdi
leaq -0xe4(%rbp), %rsi
callq 0x63a0
movq %rax, -0x3a0(%rbp)
jmp 0x519d
movq -0x3a0(%rbp), %rax
movsd -0x3a8(%rbp), %xmm0
movsd %xmm0, (%rax)
jmp 0x51b2
movl -0xe0(%rbp), %eax
addl $0x1, %eax
movl %eax, -0xe0(%rbp)
jmp 0x5039
jmp 0x51c8
movl -0xdc(%rbp), %eax
addl $0x1, %eax
movl %eax, -0xdc(%rbp)
jmp 0x5005
leaq -0xd0(%rbp), %rdi
callq 0x6480
movq %rax, -0xf8(%rbp)
movl $0xa, -0xfc(%rbp)
leaq -0xd0(%rbp), %rdi
callq 0x64e0
movq %rax, -0x108(%rbp)
leaq -0xf8(%rbp), %rdi
leaq -0x108(%rbp), %rsi
callq 0x64b0
testb $0x1, %al
jne 0x5228
jmp 0x53d9
leaq -0xf8(%rbp), %rdi
callq 0x6510
movsd 0x8(%rax), %xmm0
movsd %xmm0, -0x110(%rbp)
leaq -0xf8(%rbp), %rdi
callq 0x6510
movsd 0x10(%rax), %xmm0
movsd %xmm0, -0x118(%rbp)
leaq -0xf8(%rbp), %rdi
callq 0x6510
movl (%rax), %eax
movl %eax, -0x11c(%rbp)
movsd -0x110(%rbp), %xmm0
subsd -0x118(%rbp), %xmm0
cvtsi2sdl -0xfc(%rbp), %xmm1
divsd %xmm1, %xmm0
movsd %xmm0, -0x128(%rbp)
movsd -0x110(%rbp), %xmm1
subsd -0x118(%rbp), %xmm1
movsd 0xad7e(%rip), %xmm0     # 0x10028
ucomisd %xmm1, %xmm0
jbe 0x530d
leaq -0xa0(%rbp), %rdi
leaq -0x11c(%rbp), %rsi
callq 0x6530
movq %rax, -0x3b0(%rbp)
jmp 0x52cc
movq -0x3b0(%rbp), %rdi
leaq -0x118(%rbp), %rsi
callq 0x6610
movb %dl, -0x3b9(%rbp)
movq %rax, -0x3b8(%rbp)
jmp 0x52ee
movb -0x3b9(%rbp), %al
movq -0x3b8(%rbp), %rcx
movq %rcx, -0x138(%rbp)
movb %al, -0x130(%rbp)
jmp 0x53bf
movl $0x1, -0x13c(%rbp)
movl -0x13c(%rbp), %eax
cmpl -0xfc(%rbp), %eax
jge 0x53bd
leaq -0xa0(%rbp), %rdi
leaq -0x11c(%rbp), %rsi
callq 0x6530
movq %rax, -0x3c8(%rbp)
jmp 0x5345
movq -0x3c8(%rbp), %rdi
movsd -0x118(%rbp), %xmm1
movsd -0x128(%rbp), %xmm0
cvtsi2sdl -0x13c(%rbp), %xmm2
mulsd %xmm2, %xmm0
addsd %xmm1, %xmm0
movsd %xmm0, -0x148(%rbp)
leaq -0x148(%rbp), %rsi
callq 0x6660
movb %dl, -0x3d1(%rbp)
movq %rax, -0x3d0(%rbp)
jmp 0x538f
movb -0x3d1(%rbp), %al
movq -0x3d0(%rbp), %rcx
movq %rcx, -0x158(%rbp)
movb %al, -0x150(%rbp)
movl -0x13c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x13c(%rbp)
jmp 0x5317
jmp 0x53bf
leaq -0xf8(%rbp), %rdi
xorl %esi, %esi
callq 0x66b0
movq %rax, -0x160(%rbp)
jmp 0x51f9
leaq -0x190(%rbp), %rdi
callq 0x66f0
leaq -0xa0(%rbp), %rdi
callq 0x6710
movq %rax, -0x198(%rbp)
leaq -0xa0(%rbp), %rdi
callq 0x6770
movq %rax, -0x1a0(%rbp)
leaq -0x198(%rbp), %rdi
leaq -0x1a0(%rbp), %rsi
callq 0x6740
testb $0x1, %al
jne 0x5427
jmp 0x58a7
leaq -0x198(%rbp), %rdi
callq 0x67a0
movl (%rax), %eax
movl %eax, -0x1a4(%rbp)
leaq -0x198(%rbp), %rdi
callq 0x67a0
movq %rax, %rdi
addq $0x8, %rdi
callq 0x67c0
movq %rax, -0x1b0(%rbp)
leaq -0x198(%rbp), %rdi
callq 0x67a0
movq %rax, %rdi
addq $0x8, %rdi
callq 0x6820
movq %rax, -0x1b8(%rbp)
leaq -0x1b0(%rbp), %rdi
leaq -0x1b8(%rbp), %rsi
callq 0x67f0
testb $0x1, %al
jne 0x5495
jmp 0x588b
leaq -0x1b0(%rbp), %rdi
callq 0x6850
movsd (%rax), %xmm0
movsd %xmm0, -0x1c0(%rbp)
movl $0x0, -0x2a4(%rbp)
movl $0x0, -0x2a8(%rbp)
leaq -0x230(%rbp), %rdi
xorl %esi, %esi
movl $0x6c, %edx
callq 0x20f0
leaq -0x2a0(%rbp), %rdi
xorl %esi, %esi
movl $0x6c, %edx
callq 0x20f0
movl $0x0, -0x2ac(%rbp)
movslq -0x2ac(%rbp), %rax
movq %rax, -0x3e0(%rbp)
leaq -0x60(%rbp), %rdi
callq 0x2e50
movq %rax, %rcx
movq -0x3e0(%rbp), %rax
cmpq %rcx, %rax
jae 0x55ce
movslq -0x2ac(%rbp), %rsi
leaq -0x60(%rbp), %rdi
callq 0x60e0
movl (%rax), %eax
movl %eax, -0x2b0(%rbp)
movslq -0x2ac(%rbp), %rsi
leaq -0x60(%rbp), %rdi
callq 0x60e0
movq %rax, %rdi
addq $0x8, %rdi
movslq -0x1a4(%rbp), %rsi
callq 0x61e0
movsd (%rax), %xmm1
movsd -0x1c0(%rbp), %xmm0
ucomisd %xmm1, %xmm0
jbe 0x5591
movslq -0x2b0(%rbp), %rax
movl -0x230(%rbp,%rax,4), %ecx
addl $0x1, %ecx
movl %ecx, -0x230(%rbp,%rax,4)
movl -0x2a4(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x2a4(%rbp)
jmp 0x55b8
movslq -0x2b0(%rbp), %rax
movl -0x2a0(%rbp,%rax,4), %ecx
addl $0x1, %ecx
movl %ecx, -0x2a0(%rbp,%rax,4)
movl -0x2a8(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x2a8(%rbp)
jmp 0x55ba
movl -0x2ac(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x2ac(%rbp)
jmp 0x54f1
xorps %xmm0, %xmm0
movsd %xmm0, -0x2b8(%rbp)
xorps %xmm0, %xmm0
movsd %xmm0, -0x2c0(%rbp)
movl $0x0, -0x2c4(%rbp)
cmpl $0x1b, -0x2c4(%rbp)
jge 0x56df
movslq -0x2c4(%rbp), %rax
cvtsi2sdl -0x230(%rbp,%rax,4), %xmm0
movsd 0xaa05(%rip), %xmm1     # 0x10018
mulsd %xmm1, %xmm0
cvtsi2sdl -0x2a4(%rbp), %xmm1
divsd %xmm1, %xmm0
movslq -0x2c4(%rbp), %rax
cvtsi2sdl -0x230(%rbp,%rax,4), %xmm2
movsd 0xa9dd(%rip), %xmm1     # 0x10018
mulsd %xmm1, %xmm2
cvtsi2sdl -0x2a4(%rbp), %xmm1
divsd %xmm1, %xmm2
movsd -0x2b8(%rbp), %xmm1
mulsd %xmm2, %xmm0
addsd %xmm1, %xmm0
movsd %xmm0, -0x2b8(%rbp)
movslq -0x2c4(%rbp), %rax
cvtsi2sdl -0x2a0(%rbp,%rax,4), %xmm0
movsd 0xa99d(%rip), %xmm1     # 0x10018
mulsd %xmm1, %xmm0
cvtsi2sdl -0x2a8(%rbp), %xmm1
divsd %xmm1, %xmm0
movslq -0x2c4(%rbp), %rax
cvtsi2sdl -0x2a0(%rbp,%rax,4), %xmm2
movsd 0xa975(%rip), %xmm1     # 0x10018
mulsd %xmm1, %xmm2
cvtsi2sdl -0x2a8(%rbp), %xmm1
divsd %xmm1, %xmm2
movsd -0x2c0(%rbp), %xmm1
mulsd %xmm2, %xmm0
addsd %xmm1, %xmm0
movsd %xmm0, -0x2c0(%rbp)
movl -0x2c4(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x2c4(%rbp)
jmp 0x55ee
cvtsi2sdl -0x2a4(%rbp), %xmm0
movsd %xmm0, -0x450(%rbp)
leaq -0x60(%rbp), %rdi
movq %rdi, -0x448(%rbp)
callq 0x2e50
movsd -0x450(%rbp), %xmm0
movq -0x448(%rbp), %rdi
movq %rax, %xmm1
movaps 0xa926(%rip), %xmm2     # 0x10040
movaps %xmm2, -0x440(%rbp)
punpckldq %xmm2, %xmm1    # xmm1 = xmm1[0],xmm2[0],xmm1[1],xmm2[1]
movapd 0xa923(%rip), %xmm2     # 0x10050
movaps %xmm2, -0x430(%rbp)
subpd %xmm2, %xmm1
movaps %xmm1, %xmm2
unpckhpd %xmm1, %xmm1            # xmm1 = xmm1[1,1]
addsd %xmm2, %xmm1
divsd %xmm1, %xmm0
movsd %xmm0, -0x408(%rbp)
movsd -0x2b8(%rbp), %xmm1
movsd 0xa8b9(%rip), %xmm0     # 0x10018
movsd %xmm0, -0x410(%rbp)
subsd %xmm1, %xmm0
movsd %xmm0, -0x400(%rbp)
cvtsi2sdl -0x2a8(%rbp), %xmm0
movsd %xmm0, -0x418(%rbp)
callq 0x2e50
movaps -0x440(%rbp), %xmm6
movaps -0x430(%rbp), %xmm5
movsd -0x418(%rbp), %xmm1
movsd -0x410(%rbp), %xmm3
movsd -0x408(%rbp), %xmm0
movsd -0x400(%rbp), %xmm2
movq %rax, %xmm4
punpckldq %xmm6, %xmm4    # xmm4 = xmm4[0],xmm6[0],xmm4[1],xmm6[1]
subpd %xmm5, %xmm4
movaps %xmm4, %xmm5
unpckhpd %xmm4, %xmm4            # xmm4 = xmm4[1,1]
addsd %xmm5, %xmm4
divsd %xmm4, %xmm1
movsd -0x2c0(%rbp), %xmm4
subsd %xmm4, %xmm3
mulsd %xmm3, %xmm1
mulsd %xmm2, %xmm0
addsd %xmm1, %xmm0
movsd %xmm0, -0x3f8(%rbp)
leaq -0x1a4(%rbp), %rdi
leaq -0x1c0(%rbp), %rsi
callq 0x6950
movsd %xmm0, -0x3f0(%rbp)
movl %eax, -0x3e4(%rbp)
jmp 0x5815
movsd -0x3f0(%rbp), %xmm0
movl -0x3e4(%rbp), %eax
movl %eax, -0x2d8(%rbp)
movsd %xmm0, -0x2d0(%rbp)
leaq -0x190(%rbp), %rdi
leaq -0x2d8(%rbp), %rsi
callq 0x6870
movq %rax, -0x458(%rbp)
jmp 0x584d
movq -0x458(%rbp), %rax
movsd -0x3f8(%rbp), %xmm0
movsd %xmm0, (%rax)
leaq -0x1b0(%rbp), %rdi
xorl %esi, %esi
callq 0x6980
movq %rax, -0x2e0(%rbp)
jmp 0x545a
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x68(%rbp)
movl %eax, -0x6c(%rbp)
jmp 0x5c4f
jmp 0x588d
leaq -0x198(%rbp), %rdi
xorl %esi, %esi
callq 0x69c0
movq %rax, -0x2e8(%rbp)
jmp 0x53f8
movl $0x0, -0x2ec(%rbp)
xorps %xmm0, %xmm0
movsd %xmm0, -0x2f8(%rbp)
movsd 0xa75c(%rip), %xmm0     # 0x10020
movsd %xmm0, -0x300(%rbp)
leaq -0x190(%rbp), %rdi
callq 0x6a00
movq %rax, -0x308(%rbp)
leaq -0x190(%rbp), %rdi
callq 0x6a60
movq %rax, -0x310(%rbp)
leaq -0x308(%rbp), %rdi
leaq -0x310(%rbp), %rsi
callq 0x6a30
testb $0x1, %al
jne 0x590e
jmp 0x598f
leaq -0x308(%rbp), %rdi
callq 0x6a90
movsd 0x10(%rax), %xmm1
movsd -0x300(%rbp), %xmm0
ucomisd %xmm1, %xmm0
jb 0x5973
leaq -0x308(%rbp), %rdi
callq 0x6a90
movsd 0x10(%rax), %xmm0
movsd %xmm0, -0x300(%rbp)
leaq -0x308(%rbp), %rdi
callq 0x6a90
movl (%rax), %eax
movl %eax, -0x2ec(%rbp)
leaq -0x308(%rbp), %rdi
callq 0x6a90
movsd 0x8(%rax), %xmm0
movsd %xmm0, -0x2f8(%rbp)
jmp 0x5975
leaq -0x308(%rbp), %rdi
xorl %esi, %esi
callq 0x6ab0
movq %rax, -0x318(%rbp)
jmp 0x58df
movl $0xa8, %edi
callq 0x21d0
movq %rax, -0x460(%rbp)
jmp 0x59a2
movq -0x460(%rbp), %rdi
callq 0x2550
jmp 0x59b0
movq -0x460(%rbp), %rax
movq %rax, -0x320(%rbp)
movl $0xa8, %edi
callq 0x21d0
movq %rax, -0x468(%rbp)
jmp 0x59d1
movq -0x468(%rbp), %rdi
callq 0x2550
jmp 0x59df
movq -0x468(%rbp), %rax
movq %rax, -0x328(%rbp)
movl $0x0, -0x32c(%rbp)
movslq -0x32c(%rbp), %rax
movq %rax, -0x470(%rbp)
leaq -0x60(%rbp), %rdi
callq 0x2e50
movq %rax, %rcx
movq -0x470(%rbp), %rax
cmpq %rcx, %rax
jae 0x5baf
movslq -0x32c(%rbp), %rsi
leaq -0x60(%rbp), %rdi
callq 0x60e0
movq %rax, %rdi
addq $0x8, %rdi
movslq -0x2ec(%rbp), %rsi
callq 0x61e0
movsd (%rax), %xmm1
movsd -0x2f8(%rbp), %xmm0
ucomisd %xmm1, %xmm0
jb 0x5b1e
movq -0x320(%rbp), %rax
addq $0x90, %rax
movq %rax, -0x478(%rbp)
movslq -0x32c(%rbp), %rsi
leaq -0x60(%rbp), %rdi
callq 0x60e0
movq -0x478(%rbp), %rdi
movq %rax, %rsi
callq 0x6070
jmp 0x5a8f
movslq -0x32c(%rbp), %rsi
leaq -0x60(%rbp), %rdi
callq 0x60e0
movl (%rax), %eax
movl %eax, -0x330(%rbp)
movq -0x320(%rbp), %rax
movl -0x330(%rbp), %ecx
subl $0x1, %ecx
movslq %ecx, %rcx
movl 0x24(%rax,%rcx,4), %edx
addl $0x1, %edx
movl %edx, 0x24(%rax,%rcx,4)
movq -0x320(%rbp), %rax
movl 0x20(%rax), %ecx
addl $0x1, %ecx
movl %ecx, 0x20(%rax)
jmp 0x5b99
movq -0x460(%rbp), %rdi
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x68(%rbp)
movl %eax, -0x6c(%rbp)
movl $0xa8, %esi
callq 0x21e0
jmp 0x5c4f
movq -0x468(%rbp), %rdi
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x68(%rbp)
movl %eax, -0x6c(%rbp)
movl $0xa8, %esi
callq 0x21e0
jmp 0x5c4f
movq -0x328(%rbp), %rax
addq $0x90, %rax
movq %rax, -0x480(%rbp)
movslq -0x32c(%rbp), %rsi
leaq -0x60(%rbp), %rdi
callq 0x60e0
movq -0x480(%rbp), %rdi
movq %rax, %rsi
callq 0x6070
jmp 0x5b53
movslq -0x32c(%rbp), %rsi
leaq -0x60(%rbp), %rdi
callq 0x60e0
movl (%rax), %eax
movl %eax, -0x334(%rbp)
movq -0x328(%rbp), %rax
movl -0x334(%rbp), %ecx
subl $0x1, %ecx
movslq %ecx, %rcx
movl 0x24(%rax,%rcx,4), %edx
addl $0x1, %edx
movl %edx, 0x24(%rax,%rcx,4)
movq -0x328(%rbp), %rax
movl 0x20(%rax), %ecx
addl $0x1, %ecx
movl %ecx, 0x20(%rax)
jmp 0x5b9b
movl -0x32c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x32c(%rbp)
jmp 0x59f7
movl -0x2ec(%rbp), %ecx
movq -0x20(%rbp), %rax
movl %ecx, (%rax)
movsd -0x2f8(%rbp), %xmm0
movq -0x20(%rbp), %rax
movsd %xmm0, 0x8(%rax)
movq -0x20(%rbp), %rax
movl 0x8c(%rax), %ecx
incl %ecx
movq -0x320(%rbp), %rax
movl %ecx, 0x8c(%rax)
movq -0x20(%rbp), %rax
movl 0x8c(%rax), %ecx
incl %ecx
movq -0x328(%rbp), %rax
movl %ecx, 0x8c(%rax)
leaq -0x10(%rbp), %rdi
leaq -0x320(%rbp), %rsi
leaq -0x328(%rbp), %rdx
callq 0x6af0
jmp 0x5c17
leaq -0x190(%rbp), %rdi
callq 0x6b20
leaq -0xd0(%rbp), %rdi
callq 0x6b40
leaq -0xa0(%rbp), %rdi
callq 0x6b60
leaq -0x60(%rbp), %rdi
callq 0x2920
leaq -0x48(%rbp), %rdi
callq 0x6b80
jmp 0x5c87
leaq -0x190(%rbp), %rdi
callq 0x6b20
leaq -0xd0(%rbp), %rdi
callq 0x6b40
leaq -0xa0(%rbp), %rdi
callq 0x6b60
leaq -0x60(%rbp), %rdi
callq 0x2920
leaq -0x48(%rbp), %rdi
callq 0x6b80
jmp 0x5c98
movq -0x10(%rbp), %rax
movq -0x8(%rbp), %rdx
addq $0x480, %rsp            # imm = 0x480
popq %rbp
retq
movq -0x68(%rbp), %rdi
callq 0x2330
nopw %cs:(%rax,%rax)