// File: CastellanZhang[P]lambdaFM/./src/FTRL/ftrl_trainer.h
// Function: ftrl_trainer::trainPairFastMode(fm_sample&, fm_sample&, double&, double&, std::map<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>, std::vector<double, std::allocator<double>>, std::less<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>>, std::allocator<std::pair<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>> const, std::vector<double, std::allocator<double>>>>>&, std::map<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>, std::vector<double, std::allocator<double>>, std::less<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>>, std::allocator<std::pair<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>> const, std::vector<double, std::allocator<double>>>>>&, double)
void ftrl_trainer::trainPairFastMode(fm_sample& sample1, fm_sample& sample2, double& pred1, double& pred2,
    map<string, vector<double> >& grad1, map<string, vector<double> >& grad2, const double deltaNDCG)
{
    unordered_map<string, ftrl_model_unit*> theta;
    for(unordered_map<string, double>::iterator iter = sample1.x.begin(); iter != sample1.x.end(); ++iter)
    {
        const string& index = iter->first;
        if(theta.find(index) == theta.end())
        {
            theta[index] = pModel->getOrInitModelUnit(index);
        }
    }
    for(unordered_map<string, double>::iterator iter = sample2.x.begin(); iter != sample2.x.end(); ++iter)
    {
        const string& index = iter->first;
        if(theta.find(index) == theta.end())
        {
            theta[index] = pModel->getOrInitModelUnit(index);
        }
    }
    //update w via FTRL
    if(k1)
    {
        for(unordered_map<string, ftrl_model_unit*>::iterator iter = theta.begin(); iter != theta.end(); ++iter)
        {
            ftrl_model_unit& mu = *(iter->second);
            mu.mtx.lock();
            if(fabs(mu.w_zi) <= w_l1)
            {
                mu.wi = 0.0;
            }
            else
            {
                if(force_v_sparse && mu.w_ni > 0 && 0.0 == mu.wi)
                {
                    mu.reinit_vi(pModel->init_mean, pModel->init_stdev);
                }
                mu.wi = (-1) *
                    (1 / (w_l2 + (w_beta + sqrt(mu.w_ni)) / w_alpha)) *
                    (mu.w_zi - utils::sgn(mu.w_zi) * w_l1);
            }
            mu.mtx.unlock();
        }
    }
    //update v via FTRL
    for(unordered_map<string, ftrl_model_unit*>::iterator iter = theta.begin(); iter != theta.end(); ++iter)
    {
        ftrl_model_unit& mu = *(iter->second);
        for(int f = 0; f < pModel->factor_num; ++f)
        {
            mu.mtx.lock();
            double& vif = mu.vi[f];
            double& v_nif = mu.v_ni[f];
            double& v_zif = mu.v_zi[f];
            if(v_nif > 0)
            {
                if(force_v_sparse && 0.0 == mu.wi)
                {
                    vif = 0.0;
                }
                else if(fabs(v_zif) <= v_l1)
                {
                    vif = 0.0;
                }
                else
                {
                    vif = (-1) *
                        (1 / (v_l2 + (v_beta + sqrt(v_nif)) / v_alpha)) *
                        (v_zif - utils::sgn(v_zif) * v_l1);
                }
            }
            mu.mtx.unlock();
        }
    }
    double lambda12 = -1 / (1 + exp(pred1 - pred2)) * deltaNDCG;
    //update w_n, w_z
    if(k1)
    {
        for(unordered_map<string, ftrl_model_unit*>::iterator iter = theta.begin(); iter != theta.end(); ++iter)
        {
            ftrl_model_unit& mu = *(iter->second);
            const string& index = iter->first;
            unordered_map<string, double>::iterator iter_x1 = sample1.x.find(index);
            double xi1 = (iter_x1 == sample1.x.end()) ? 0 : iter_x1->second;
            unordered_map<string, double>::iterator iter_x2 = sample2.x.find(index);
            double xi2 = (iter_x2 == sample2.x.end()) ? 0 : iter_x2->second;
            double xi = xi1 - xi2;
            if(xi != 0)
            {
                mu.mtx.lock();
                double w_gi = lambda12 * xi;
                double w_si = 1 / w_alpha * (sqrt(mu.w_ni + w_gi * w_gi) - sqrt(mu.w_ni));
                mu.w_zi += w_gi - w_si * mu.wi;
                mu.w_ni += w_gi * w_gi;
                mu.mtx.unlock();
            }
        }
    }
    //update v_n, v_z
    vector<double> vecZero(pModel->factor_num, 0);
    for(unordered_map<string, ftrl_model_unit*>::iterator iter = theta.begin(); iter != theta.end(); ++iter)
    {
        ftrl_model_unit& mu = *(iter->second);
        const string& index = iter->first;
        unordered_map<string, double>::iterator iter_x1 = sample1.x.find(index);
        double xi1 = (iter_x1 == sample1.x.end()) ? 0 : iter_x1->second;
        unordered_map<string, double>::iterator iter_x2 = sample2.x.find(index);
        double xi2 = (iter_x2 == sample2.x.end()) ? 0 : iter_x2->second;
        vector<double>* pGrad1Index = &vecZero;
        map<string, vector<double> >::iterator gradIter1 = grad1.find(index);
        if(gradIter1 != grad1.end())
        {
            pGrad1Index = &(gradIter1->second);
        }
        vector<double>* pGrad2Index = &vecZero;
        map<string, vector<double> >::iterator gradIter2 = grad2.find(index);
        if(gradIter2 != grad2.end())
        {
            pGrad2Index = &(gradIter2->second);
        }
        for(int f = 0; f < pModel->factor_num; ++f)
        {
            mu.mtx.lock();
            double& vif = mu.vi[f];
            double& v_nif = mu.v_ni[f];
            double& v_zif = mu.v_zi[f];
            double v_gif = lambda12 * ((*pGrad1Index)[f] - (*pGrad2Index)[f]);
            double v_sif = 1 / v_alpha * (sqrt(v_nif + v_gif * v_gif) - sqrt(v_nif));
            v_zif += v_gif - v_sif * vif;
            v_nif += v_gif * v_gif;
            //有的特征在整个训练集中只出现一次，这里还需要对vif做一次处理
            if(force_v_sparse && v_nif > 0 && 0.0 == mu.wi)
            {
                vif = 0.0;
            }
            mu.mtx.unlock();
        }
    }
}

// Assembly:
subq $0x3e8, %rsp            # imm = 0x3E8
movq 0x3f0(%rsp), %rax
movq %rdi, 0x3e0(%rsp)
movq %rsi, 0x3d8(%rsp)
movq %rdx, 0x3d0(%rsp)
movq %rcx, 0x3c8(%rsp)
movq %r8, 0x3c0(%rsp)
movq %r9, 0x3b8(%rsp)
movsd %xmm0, 0x3b0(%rsp)
movq 0x3e0(%rsp), %rax
movq %rax, 0x138(%rsp)
leaq 0x378(%rsp), %rdi
callq 0x8360
movq 0x3d8(%rsp), %rdi
addq $0x28, %rdi
callq 0x8690
movq %rax, 0x370(%rsp)
movq 0x3d8(%rsp), %rdi
addq $0x28, %rdi
callq 0x86e0
movq %rax, 0x368(%rsp)
leaq 0x370(%rsp), %rdi
leaq 0x368(%rsp), %rsi
callq 0x86c0
testb $0x1, %al
jne 0x6b35
jmp 0x6c8a
leaq 0x370(%rsp), %rdi
callq 0x8710
movq %rax, 0x360(%rsp)
movq 0x360(%rsp), %rsi
leaq 0x378(%rsp), %rdi
callq 0x8380
movq %rax, 0x130(%rsp)
jmp 0x6b69
movq 0x130(%rsp), %rax
movq %rax, 0x358(%rsp)
leaq 0x378(%rsp), %rdi
callq 0x83d0
movq %rax, 0x340(%rsp)
leaq 0x358(%rsp), %rdi
leaq 0x340(%rsp), %rsi
callq 0x83b0
testb $0x1, %al
jne 0x6bac
jmp 0x6c76
movq 0x138(%rsp), %rax
movq 0x8(%rax), %rax
movq %rax, 0x128(%rsp)
movq 0x360(%rsp), %rsi
leaq 0x320(%rsp), %rdi
callq 0x3120
jmp 0x6bd7
movq 0x128(%rsp), %rdi
leaq 0x320(%rsp), %rsi
callq 0x3960
movq %rax, 0x120(%rsp)
jmp 0x6bf6
movq 0x360(%rsp), %rsi
leaq 0x378(%rsp), %rdi
callq 0x8730
movq %rax, 0x118(%rsp)
jmp 0x6c15
movq 0x118(%rsp), %rax
movq 0x120(%rsp), %rcx
movq %rcx, (%rax)
leaq 0x320(%rsp), %rdi
callq 0x3518
jmp 0x6c76
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x350(%rsp)
movl %eax, 0x34c(%rsp)
jmp 0x7c81
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x350(%rsp)
movl %eax, 0x34c(%rsp)
leaq 0x320(%rsp), %rdi
callq 0x3518
jmp 0x7c81
jmp 0x6c78
leaq 0x370(%rsp), %rdi
callq 0x8760
jmp 0x6afe
movq 0x3d0(%rsp), %rdi
addq $0x28, %rdi
callq 0x8690
movq %rax, 0x318(%rsp)
movq 0x3d0(%rsp), %rdi
addq $0x28, %rdi
callq 0x86e0
movq %rax, 0x310(%rsp)
leaq 0x318(%rsp), %rdi
leaq 0x310(%rsp), %rsi
callq 0x86c0
testb $0x1, %al
jne 0x6cda
jmp 0x6e16
leaq 0x318(%rsp), %rdi
callq 0x8710
movq %rax, 0x308(%rsp)
movq 0x308(%rsp), %rsi
leaq 0x378(%rsp), %rdi
callq 0x8380
movq %rax, 0x110(%rsp)
jmp 0x6d0e
movq 0x110(%rsp), %rax
movq %rax, 0x300(%rsp)
leaq 0x378(%rsp), %rdi
callq 0x83d0
movq %rax, 0x2f8(%rsp)
leaq 0x300(%rsp), %rdi
leaq 0x2f8(%rsp), %rsi
callq 0x83b0
testb $0x1, %al
jne 0x6d51
jmp 0x6e02
movq 0x138(%rsp), %rax
movq 0x8(%rax), %rax
movq %rax, 0x108(%rsp)
movq 0x308(%rsp), %rsi
leaq 0x2d8(%rsp), %rdi
callq 0x3120
jmp 0x6d7c
movq 0x108(%rsp), %rdi
leaq 0x2d8(%rsp), %rsi
callq 0x3960
movq %rax, 0x100(%rsp)
jmp 0x6d9b
movq 0x308(%rsp), %rsi
leaq 0x378(%rsp), %rdi
callq 0x8730
movq %rax, 0xf8(%rsp)
jmp 0x6dba
movq 0xf8(%rsp), %rax
movq 0x100(%rsp), %rcx
movq %rcx, (%rax)
leaq 0x2d8(%rsp), %rdi
callq 0x3518
jmp 0x6e02
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x350(%rsp)
movl %eax, 0x34c(%rsp)
leaq 0x2d8(%rsp), %rdi
callq 0x3518
jmp 0x7c81
jmp 0x6e04
leaq 0x318(%rsp), %rdi
callq 0x8760
jmp 0x6ca3
movq 0x138(%rsp), %rax
testb $0x1, 0x50(%rax)
je 0x7058
leaq 0x378(%rsp), %rdi
callq 0x87b0
movq %rax, 0x2d0(%rsp)
leaq 0x378(%rsp), %rdi
callq 0x83d0
movq %rax, 0x2c8(%rsp)
leaq 0x2d0(%rsp), %rdi
leaq 0x2c8(%rsp), %rsi
callq 0x87e0
testb $0x1, %al
jne 0x6e70
jmp 0x7056
leaq 0x2d0(%rsp), %rdi
callq 0x8670
movq 0x20(%rax), %rax
movq %rax, 0x2c0(%rsp)
movq 0x2c0(%rsp), %rdi
addq $0x60, %rdi
callq 0x8400
jmp 0x6e9c
movq 0x138(%rsp), %rax
movq 0x2c0(%rsp), %rcx
movsd 0x10(%rcx), %xmm1
movaps 0x14178(%rip), %xmm0    # 0x1b030
pand %xmm0, %xmm1
movsd 0x20(%rax), %xmm0
ucomisd %xmm1, %xmm0
jb 0x6edb
movq 0x2c0(%rsp), %rax
xorps %xmm0, %xmm0
movsd %xmm0, (%rax)
jmp 0x702f
movq 0x138(%rsp), %rax
testb $0x1, 0x51(%rax)
je 0x6f39
movq 0x2c0(%rsp), %rax
movsd 0x8(%rax), %xmm0
xorps %xmm1, %xmm1
ucomisd %xmm1, %xmm0
jbe 0x6f39
movq 0x2c0(%rsp), %rax
xorps %xmm0, %xmm0
ucomisd (%rax), %xmm0
jne 0x6f39
jp 0x6f39
movq 0x138(%rsp), %rax
movq 0x2c0(%rsp), %rdi
movq 0x8(%rax), %rax
movsd 0x40(%rax), %xmm1
movsd 0x48(%rax), %xmm0
callq 0x91b0
jmp 0x6f37
jmp 0x6f39
movq 0x138(%rsp), %rax
movsd 0x18(%rax), %xmm0
movsd %xmm0, 0xd8(%rsp)
movsd 0x28(%rax), %xmm0
movsd %xmm0, 0xd0(%rsp)
movq 0x2c0(%rsp), %rax
movsd 0x8(%rax), %xmm0
callq 0x3220
movq 0x138(%rsp), %rax
movsd 0xd0(%rsp), %xmm1
movaps %xmm0, %xmm2
movsd 0xd8(%rsp), %xmm0
addsd %xmm2, %xmm0
movsd 0x10(%rax), %xmm2
divsd %xmm2, %xmm0
addsd %xmm0, %xmm1
movsd 0x1407b(%rip), %xmm0    # 0x1b020
divsd %xmm1, %xmm0
movsd %xmm0, 0xe0(%rsp)
movq 0x2c0(%rsp), %rax
movsd 0x10(%rax), %xmm0
movsd %xmm0, 0xe8(%rsp)
callq 0x1a130
movl %eax, 0xf4(%rsp)
jmp 0x6fd6
movsd 0xe0(%rsp), %xmm0
movsd 0xe8(%rsp), %xmm2
movq 0x138(%rsp), %rax
movl 0xf4(%rsp), %ecx
cvtsi2sd %ecx, %xmm1
movsd 0x20(%rax), %xmm3
movq %xmm1, %rax
movabsq $-0x8000000000000000, %rcx # imm = 0x8000000000000000
xorq %rcx, %rax
movq %rax, %xmm1
mulsd %xmm3, %xmm1
addsd %xmm2, %xmm1
mulsd %xmm1, %xmm0
movq 0x2c0(%rsp), %rax
movsd %xmm0, (%rax)
movq 0x2c0(%rsp), %rdi
addq $0x60, %rdi
callq 0x8660
jmp 0x7042
jmp 0x7044
leaq 0x2d0(%rsp), %rdi
callq 0x89d0
jmp 0x6e3d
jmp 0x7058
leaq 0x378(%rsp), %rdi
callq 0x87b0
movq %rax, 0x2b8(%rsp)
leaq 0x378(%rsp), %rdi
callq 0x83d0
movq %rax, 0x2b0(%rsp)
leaq 0x2b8(%rsp), %rdi
leaq 0x2b0(%rsp), %rsi
callq 0x87e0
testb $0x1, %al
jne 0x70a0
jmp 0x7319
leaq 0x2b8(%rsp), %rdi
callq 0x8670
movq 0x20(%rax), %rax
movq %rax, 0x2a8(%rsp)
movl $0x0, 0x2a4(%rsp)
movq 0x138(%rsp), %rcx
movl 0x2a4(%rsp), %eax
movq 0x8(%rcx), %rcx
cmpl 0x38(%rcx), %eax
jge 0x7305
movq 0x2a8(%rsp), %rdi
addq $0x60, %rdi
callq 0x8400
jmp 0x70f3
movq 0x2a8(%rsp), %rdi
addq $0x18, %rdi
movslq 0x2a4(%rsp), %rsi
callq 0x8790
movq %rax, 0x298(%rsp)
movq 0x2a8(%rsp), %rdi
addq $0x30, %rdi
movslq 0x2a4(%rsp), %rsi
callq 0x8790
movq %rax, 0x290(%rsp)
movq 0x2a8(%rsp), %rdi
addq $0x48, %rdi
movslq 0x2a4(%rsp), %rsi
callq 0x8790
movq %rax, 0x288(%rsp)
movq 0x290(%rsp), %rax
movsd (%rax), %xmm0
xorps %xmm1, %xmm1
ucomisd %xmm1, %xmm0
jbe 0x72da
movq 0x138(%rsp), %rax
testb $0x1, 0x51(%rax)
je 0x71a4
movq 0x2a8(%rsp), %rax
xorps %xmm0, %xmm0
ucomisd (%rax), %xmm0
jne 0x71a4
jp 0x71a4
movq 0x298(%rsp), %rax
xorps %xmm0, %xmm0
movsd %xmm0, (%rax)
jmp 0x72d8
movq 0x138(%rsp), %rax
movq 0x288(%rsp), %rcx
movsd (%rcx), %xmm1
movaps 0x13e71(%rip), %xmm0    # 0x1b030
pand %xmm0, %xmm1
movsd 0x40(%rax), %xmm0
ucomisd %xmm1, %xmm0
jb 0x71e2
movq 0x298(%rsp), %rax
xorps %xmm0, %xmm0
movsd %xmm0, (%rax)
jmp 0x72d6
movq 0x138(%rsp), %rax
movsd 0x38(%rax), %xmm0
movsd %xmm0, 0xb0(%rsp)
movsd 0x48(%rax), %xmm0
movsd %xmm0, 0xa8(%rsp)
movq 0x290(%rsp), %rax
movsd (%rax), %xmm0
callq 0x3220
movq 0x138(%rsp), %rax
movsd 0xa8(%rsp), %xmm1
movaps %xmm0, %xmm2
movsd 0xb0(%rsp), %xmm0
addsd %xmm2, %xmm0
movsd 0x30(%rax), %xmm2
divsd %xmm2, %xmm0
addsd %xmm0, %xmm1
movsd 0x13dd3(%rip), %xmm0    # 0x1b020
divsd %xmm1, %xmm0
movsd %xmm0, 0xb8(%rsp)
movq 0x288(%rsp), %rax
movsd (%rax), %xmm0
movsd %xmm0, 0xc0(%rsp)
callq 0x1a130
movl %eax, 0xcc(%rsp)
jmp 0x727d
movsd 0xb8(%rsp), %xmm0
movsd 0xc0(%rsp), %xmm2
movq 0x138(%rsp), %rax
movl 0xcc(%rsp), %ecx
cvtsi2sd %ecx, %xmm1
movsd 0x40(%rax), %xmm3
movq %xmm1, %rax
movabsq $-0x8000000000000000, %rcx # imm = 0x8000000000000000
xorq %rcx, %rax
movq %rax, %xmm1
mulsd %xmm3, %xmm1
addsd %xmm2, %xmm1
mulsd %xmm1, %xmm0
movq 0x298(%rsp), %rax
movsd %xmm0, (%rax)
jmp 0x72d8
jmp 0x72da
movq 0x2a8(%rsp), %rdi
addq $0x60, %rdi
callq 0x8660
jmp 0x72ed
jmp 0x72ef
movl 0x2a4(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x2a4(%rsp)
jmp 0x70c4
jmp 0x7307
leaq 0x2b8(%rsp), %rdi
callq 0x89d0
jmp 0x706d
movq 0x3c8(%rsp), %rax
movsd (%rax), %xmm0
movq 0x3c0(%rsp), %rax
subsd (%rax), %xmm0
callq 0x34c0
movq 0x138(%rsp), %rax
movsd 0x13cd2(%rip), %xmm1    # 0x1b018
addsd %xmm0, %xmm1
movsd 0x13cce(%rip), %xmm0    # 0x1b020
divsd %xmm1, %xmm0
mulsd 0x3b0(%rsp), %xmm0
movsd %xmm0, 0x280(%rsp)
testb $0x1, 0x50(%rax)
je 0x7696
leaq 0x378(%rsp), %rdi
callq 0x87b0
movq %rax, 0x278(%rsp)
leaq 0x378(%rsp), %rdi
callq 0x83d0
movq %rax, 0x270(%rsp)
leaq 0x278(%rsp), %rdi
leaq 0x270(%rsp), %rsi
callq 0x87e0
testb $0x1, %al
jne 0x73ba
jmp 0x7694
leaq 0x278(%rsp), %rdi
movq %rdi, 0x98(%rsp)
callq 0x8670
movq 0x98(%rsp), %rdi
movq 0x20(%rax), %rax
movq %rax, 0x268(%rsp)
callq 0x8670
movq %rax, 0x260(%rsp)
movq 0x3d8(%rsp), %rdi
addq $0x28, %rdi
movq 0x260(%rsp), %rsi
callq 0x92e0
movq %rax, 0xa0(%rsp)
jmp 0x7413
movq 0xa0(%rsp), %rax
movq %rax, 0x258(%rsp)
movq 0x3d8(%rsp), %rdi
addq $0x28, %rdi
callq 0x86e0
movq %rax, 0x248(%rsp)
leaq 0x258(%rsp), %rdi
leaq 0x248(%rsp), %rsi
callq 0x9310
testb $0x1, %al
jne 0x7457
jmp 0x7465
xorps %xmm0, %xmm0
movsd %xmm0, 0x90(%rsp)
jmp 0x7480
leaq 0x258(%rsp), %rdi
callq 0x8710
movsd 0x20(%rax), %xmm0
movsd %xmm0, 0x90(%rsp)
movsd 0x90(%rsp), %xmm0
movsd %xmm0, 0x250(%rsp)
movq 0x3d0(%rsp), %rdi
addq $0x28, %rdi
movq 0x260(%rsp), %rsi
callq 0x92e0
movq %rax, 0x88(%rsp)
jmp 0x74b5
movq 0x88(%rsp), %rax
movq %rax, 0x240(%rsp)
movq 0x3d0(%rsp), %rdi
addq $0x28, %rdi
callq 0x86e0
movq %rax, 0x230(%rsp)
leaq 0x240(%rsp), %rdi
leaq 0x230(%rsp), %rsi
callq 0x9310
testb $0x1, %al
jne 0x74f9
jmp 0x7507
xorps %xmm0, %xmm0
movsd %xmm0, 0x80(%rsp)
jmp 0x7522
leaq 0x240(%rsp), %rdi
callq 0x8710
movsd 0x20(%rax), %xmm0
movsd %xmm0, 0x80(%rsp)
movsd 0x80(%rsp), %xmm0
movsd %xmm0, 0x238(%rsp)
movsd 0x250(%rsp), %xmm0
subsd 0x238(%rsp), %xmm0
movsd %xmm0, 0x228(%rsp)
movsd 0x228(%rsp), %xmm0
xorps %xmm1, %xmm1
ucomisd %xmm1, %xmm0
jne 0x7568
jp 0x7568
jmp 0x7680
movq 0x268(%rsp), %rdi
addq $0x60, %rdi
callq 0x8400
jmp 0x757b
movq 0x138(%rsp), %rax
movsd 0x280(%rsp), %xmm0
movsd 0x228(%rsp), %xmm1
mulsd %xmm1, %xmm0
movsd %xmm0, 0x220(%rsp)
movsd 0x10(%rax), %xmm1
movsd 0x13a69(%rip), %xmm0    # 0x1b018
divsd %xmm1, %xmm0
movsd %xmm0, 0x78(%rsp)
movq 0x268(%rsp), %rax
movsd 0x8(%rax), %xmm1
movsd 0x220(%rsp), %xmm0
mulsd %xmm0, %xmm0
addsd %xmm1, %xmm0
callq 0x3220
movsd %xmm0, 0x70(%rsp)
movq 0x268(%rsp), %rax
movsd 0x8(%rax), %xmm0
callq 0x3220
movsd 0x70(%rsp), %xmm1
movaps %xmm0, %xmm2
movsd 0x78(%rsp), %xmm0
subsd %xmm2, %xmm1
mulsd %xmm1, %xmm0
movsd %xmm0, 0x218(%rsp)
movsd 0x220(%rsp), %xmm1
movsd 0x218(%rsp), %xmm2
movq 0x268(%rsp), %rax
movsd (%rax), %xmm3
movsd 0x10(%rax), %xmm0
mulsd %xmm3, %xmm2
subsd %xmm2, %xmm1
addsd %xmm1, %xmm0
movsd %xmm0, 0x10(%rax)
movsd 0x220(%rsp), %xmm0
movq 0x268(%rsp), %rax
movsd 0x8(%rax), %xmm1
mulsd %xmm0, %xmm0
addsd %xmm1, %xmm0
movsd %xmm0, 0x8(%rax)
movq 0x268(%rsp), %rdi
addq $0x60, %rdi
callq 0x8660
jmp 0x767e
jmp 0x7680
jmp 0x7682
leaq 0x278(%rsp), %rdi
callq 0x89d0
jmp 0x7387
jmp 0x7696
movq 0x138(%rsp), %rax
movq 0x8(%rax), %rax
movslq 0x38(%rax), %rax
movq %rax, 0x60(%rsp)
movq $0x0, 0x1f8(%rsp)
leaq 0x1f7(%rsp), %rdi
movq %rdi, 0x68(%rsp)
callq 0x9240
movq 0x60(%rsp), %rsi
movq 0x68(%rsp), %rcx
leaq 0x200(%rsp), %rdi
leaq 0x1f8(%rsp), %rdx
callq 0x9590
jmp 0x76ea
leaq 0x1f7(%rsp), %rdi
callq 0x92d0
leaq 0x378(%rsp), %rdi
callq 0x87b0
movq %rax, 0x1e8(%rsp)
leaq 0x378(%rsp), %rdi
callq 0x83d0
movq %rax, 0x1e0(%rsp)
leaq 0x1e8(%rsp), %rdi
leaq 0x1e0(%rsp), %rsi
callq 0x87e0
testb $0x1, %al
jne 0x773f
jmp 0x7c5f
leaq 0x1e8(%rsp), %rdi
movq %rdi, 0x50(%rsp)
callq 0x8670
movq 0x50(%rsp), %rdi
movq 0x20(%rax), %rax
movq %rax, 0x1d8(%rsp)
callq 0x8670
movq %rax, 0x1d0(%rsp)
movq 0x3d8(%rsp), %rdi
addq $0x28, %rdi
movq 0x1d0(%rsp), %rsi
callq 0x92e0
movq %rax, 0x58(%rsp)
jmp 0x778f
movq 0x58(%rsp), %rax
movq %rax, 0x1c8(%rsp)
movq 0x3d8(%rsp), %rdi
addq $0x28, %rdi
callq 0x86e0
movq %rax, 0x1b8(%rsp)
leaq 0x1c8(%rsp), %rdi
leaq 0x1b8(%rsp), %rsi
callq 0x9310
testb $0x1, %al
jne 0x77d0
jmp 0x77db
xorps %xmm0, %xmm0
movsd %xmm0, 0x48(%rsp)
jmp 0x77f3
leaq 0x1c8(%rsp), %rdi
callq 0x8710
movsd 0x20(%rax), %xmm0
movsd %xmm0, 0x48(%rsp)
movsd 0x48(%rsp), %xmm0
movsd %xmm0, 0x1c0(%rsp)
movq 0x3d0(%rsp), %rdi
addq $0x28, %rdi
movq 0x1d0(%rsp), %rsi
callq 0x92e0
movq %rax, 0x40(%rsp)
jmp 0x7822
movq 0x40(%rsp), %rax
movq %rax, 0x1b0(%rsp)
movq 0x3d0(%rsp), %rdi
addq $0x28, %rdi
callq 0x86e0
movq %rax, 0x1a0(%rsp)
leaq 0x1b0(%rsp), %rdi
leaq 0x1a0(%rsp), %rsi
callq 0x9310
testb $0x1, %al
jne 0x7863
jmp 0x786e
xorps %xmm0, %xmm0
movsd %xmm0, 0x38(%rsp)
jmp 0x7886
leaq 0x1b0(%rsp), %rdi
callq 0x8710
movsd 0x20(%rax), %xmm0
movsd %xmm0, 0x38(%rsp)
movsd 0x38(%rsp), %xmm0
movsd %xmm0, 0x1a8(%rsp)
leaq 0x200(%rsp), %rax
movq %rax, 0x198(%rsp)
movq 0x3b8(%rsp), %rdi
movq 0x1d0(%rsp), %rsi
callq 0x9610
movq %rax, 0x30(%rsp)
jmp 0x78c1
movq 0x30(%rsp), %rax
movq %rax, 0x190(%rsp)
movq 0x3b8(%rsp), %rdi
callq 0x9660
movq %rax, 0x188(%rsp)
leaq 0x190(%rsp), %rdi
leaq 0x188(%rsp), %rsi
callq 0x9640
testb $0x1, %al
jne 0x78fe
jmp 0x7965
leaq 0x190(%rsp), %rdi
callq 0x9690
addq $0x20, %rax
movq %rax, 0x198(%rsp)
jmp 0x7965
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x350(%rsp)
movl %eax, 0x34c(%rsp)
leaq 0x1f7(%rsp), %rdi
callq 0x92d0
jmp 0x7c81
movq %rax, %rcx
movl %edx, %eax
movq %rcx, 0x350(%rsp)
movl %eax, 0x34c(%rsp)
leaq 0x200(%rsp), %rdi
callq 0x8ec0
jmp 0x7c81
leaq 0x200(%rsp), %rax
movq %rax, 0x180(%rsp)
movq 0x3f0(%rsp), %rdi
movq 0x1d0(%rsp), %rsi
callq 0x9610
movq %rax, 0x28(%rsp)
jmp 0x7991
movq 0x28(%rsp), %rax
movq %rax, 0x178(%rsp)
movq 0x3f0(%rsp), %rdi
callq 0x9660
movq %rax, 0x170(%rsp)
leaq 0x178(%rsp), %rdi
leaq 0x170(%rsp), %rsi
callq 0x9640
testb $0x1, %al
jne 0x79ce
jmp 0x79e7
leaq 0x178(%rsp), %rdi
callq 0x9690
addq $0x20, %rax
movq %rax, 0x180(%rsp)
movl $0x0, 0x16c(%rsp)
movq 0x138(%rsp), %rcx
movl 0x16c(%rsp), %eax
movq 0x8(%rcx), %rcx
cmpl 0x38(%rcx), %eax
jge 0x7c4b
movq 0x1d8(%rsp), %rdi
addq $0x60, %rdi
callq 0x8400
jmp 0x7a21
movq 0x1d8(%rsp), %rdi
addq $0x18, %rdi
movslq 0x16c(%rsp), %rsi
callq 0x8790
movq %rax, 0x160(%rsp)
movq 0x1d8(%rsp), %rdi
addq $0x30, %rdi
movslq 0x16c(%rsp), %rsi
callq 0x8790
movq %rax, 0x158(%rsp)
movq 0x1d8(%rsp), %rdi
addq $0x48, %rdi
movslq 0x16c(%rsp), %rsi
callq 0x8790
movq %rax, 0x150(%rsp)
movsd 0x280(%rsp), %xmm0
movsd %xmm0, 0x10(%rsp)
movq 0x198(%rsp), %rdi
movslq 0x16c(%rsp), %rsi
callq 0x8790
movsd (%rax), %xmm0
movsd %xmm0, 0x8(%rsp)
movq 0x180(%rsp), %rdi
movslq 0x16c(%rsp), %rsi
callq 0x8790
movsd 0x8(%rsp), %xmm1
movsd 0x10(%rsp), %xmm0
movq %rax, %rcx
movq 0x138(%rsp), %rax
subsd (%rcx), %xmm1
mulsd %xmm1, %xmm0
movsd %xmm0, 0x148(%rsp)
movsd 0x13521(%rip), %xmm0    # 0x1b018
divsd 0x30(%rax), %xmm0
movsd %xmm0, 0x20(%rsp)
movq 0x158(%rsp), %rax
movsd (%rax), %xmm1
movsd 0x148(%rsp), %xmm0
movsd 0x148(%rsp), %xmm2
mulsd %xmm2, %xmm0
addsd %xmm1, %xmm0
callq 0x3220
movsd %xmm0, 0x18(%rsp)
movq 0x158(%rsp), %rax
movsd (%rax), %xmm0
callq 0x3220
movsd 0x18(%rsp), %xmm1
movq 0x138(%rsp), %rax
movaps %xmm0, %xmm2
movsd 0x20(%rsp), %xmm0
subsd %xmm2, %xmm1
mulsd %xmm1, %xmm0
movsd %xmm0, 0x140(%rsp)
movsd 0x148(%rsp), %xmm1
movsd 0x140(%rsp), %xmm0
movq 0x160(%rsp), %rcx
movsd (%rcx), %xmm2
movq %xmm0, %rcx
movabsq $-0x8000000000000000, %rdx # imm = 0x8000000000000000
xorq %rdx, %rcx
movq %rcx, %xmm0
mulsd %xmm2, %xmm0
addsd %xmm1, %xmm0
movq 0x150(%rsp), %rcx
addsd (%rcx), %xmm0
movsd %xmm0, (%rcx)
movsd 0x148(%rsp), %xmm0
movsd 0x148(%rsp), %xmm2
movq 0x158(%rsp), %rcx
movsd (%rcx), %xmm1
mulsd %xmm2, %xmm0
addsd %xmm1, %xmm0
movsd %xmm0, (%rcx)
testb $0x1, 0x51(%rax)
je 0x7c20
movq 0x158(%rsp), %rax
movsd (%rax), %xmm0
xorps %xmm1, %xmm1
ucomisd %xmm1, %xmm0
jbe 0x7c20
movq 0x1d8(%rsp), %rax
xorps %xmm0, %xmm0
ucomisd (%rax), %xmm0
jne 0x7c20
jp 0x7c20
movq 0x160(%rsp), %rax
xorps %xmm0, %xmm0
movsd %xmm0, (%rax)
movq 0x1d8(%rsp), %rdi
addq $0x60, %rdi
callq 0x8660
jmp 0x7c33
jmp 0x7c35
movl 0x16c(%rsp), %eax
addl $0x1, %eax
movl %eax, 0x16c(%rsp)
jmp 0x79f2
jmp 0x7c4d
leaq 0x1e8(%rsp), %rdi
callq 0x89d0
jmp 0x770c
leaq 0x200(%rsp), %rdi
callq 0x8ec0
leaq 0x378(%rsp), %rdi
callq 0x9330
addq $0x3e8, %rsp            # imm = 0x3E8
retq
leaq 0x378(%rsp), %rdi
callq 0x9330
movq 0x350(%rsp), %rdi
callq 0x3490
nopl (%rax,%rax)