// File: /workspace/github_cpp_makefile_star2_O2/poseidon1214[P]logistic-regression-ftrl-mpi/src/ftrl.h
// Function: FTRL::update()
void update(){// only for master node
            //reduce global gradient
            for(int j = 0; j < data->glo_fea_dim; j++){//store local gradient to glo_g;
                glo_g[j] = loc_g[j];
            }
            for(int rankid = 1; rankid < num_proc; rankid++){//receive other node`s gradient and store to glo_g;
                MPI_Recv(loc_g, data->glo_fea_dim, MPI_FLOAT, rankid, 99, MPI_COMM_WORLD, &status);
                for(int j = 0; j < data->glo_fea_dim; j++){
                    glo_g[j] += loc_g[j];
                }
            }
            for(int j = 0; j < data->glo_fea_dim; j++){
                glo_g[j] /= num_proc;
            }
            //update parameter
            for(int col = 0; col < data->glo_fea_dim; col++){
                //the first update sigma, z, n
                loc_sigma[col] = ( sqrt (loc_n[col] + glo_g[col] * glo_g[col]) - sqrt(loc_n[col]) ) / alpha;
                loc_z[col] += glo_g[col] - loc_sigma[col] * loc_w[col];
                loc_n[col] += glo_g[col] * glo_g[col];
                //the secondary update w
                if(abs(loc_z[col]) <= lambda1){
                    loc_w[col] = 0.0;
                }
                else{
                    float tmpr= 0.0;
                    if(loc_z[col] >= 0) tmpr = loc_z[col] - lambda1;
                    else tmpr = loc_z[col] + lambda1;
                    float tmpl = -1 * ( ( beta + sqrt(loc_n[col]) ) / alpha  + lambda2);
                    loc_w[col] = tmpr / tmpl;
                }
            }
        }

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x48, %rsp
movq %rdi, %rbx
movq 0x40(%rdi), %rax
movq 0x58(%rdi), %rdi
movq 0x2a0(%rax), %rsi
movq 0x60(%rbx), %rax
xorl %ecx, %ecx
testq %rsi, %rsi
movl $0x0, %edx
cmovgq %rsi, %rdx
cmpq %rcx, %rdx
je 0x36f9
movss (%rdi,%rcx,4), %xmm0
movss %xmm0, (%rax,%rcx,4)
incq %rcx
jmp 0x36e5
leaq 0x28(%rbx), %r15
pushq $0x1
popq %r14
movq 0x28a8(%rip), %r12      # 0x5fb0
pushq $0x63
popq %r13
movl 0x80(%rbx), %eax
cmpl %eax, %r14d
jge 0x376f
movq %r15, (%rsp)
movq 0x289e(%rip), %rdx      # 0x5fc0
movl %r14d, %ecx
movl %r13d, %r8d
movq %r12, %r9
callq 0x2160
movq 0x40(%rbx), %rax
movq 0x58(%rbx), %rdi
movq 0x2a0(%rax), %rsi
movq 0x60(%rbx), %rax
testq %rsi, %rsi
movl $0x0, %ecx
cmovgq %rsi, %rcx
xorl %edx, %edx
cmpq %rdx, %rcx
je 0x376a
movss (%rdi,%rdx,4), %xmm0
addss (%rax,%rdx,4), %xmm0
movss %xmm0, (%rax,%rdx,4)
incq %rdx
jmp 0x3751
incl %r14d
jmp 0x370c
cvtsi2ss %eax, %xmm0
movq 0x60(%rbx), %rax
xorl %ecx, %ecx
testq %rsi, %rsi
movl $0x0, %edx
cmovgq %rsi, %rdx
cmpq %rcx, %rdx
je 0x379d
movss (%rax,%rcx,4), %xmm1
divss %xmm0, %xmm1
movss %xmm1, (%rax,%rcx,4)
incq %rcx
jmp 0x3785
xorl %r14d, %r14d
xorps %xmm2, %xmm2
cmpq %r14, %rsi
jle 0x38f9
movq 0x60(%rbx), %rax
movq 0x78(%rbx), %rcx
movss (%rax,%r14,4), %xmm0
mulss %xmm0, %xmm0
addss (%rcx,%r14,4), %xmm0
ucomiss %xmm2, %xmm0
jb 0x37cf
sqrtss %xmm0, %xmm1
jmp 0x37da
callq 0x22f0
xorps %xmm2, %xmm2
movaps %xmm0, %xmm1
movq 0x78(%rbx), %rax
movss (%rax,%r14,4), %xmm0
ucomiss %xmm2, %xmm0
jb 0x37ef
sqrtss %xmm0, %xmm0
jmp 0x3801
movss %xmm1, -0x40(%rbp)
callq 0x22f0
movss -0x40(%rbp), %xmm1
xorps %xmm2, %xmm2
subss %xmm0, %xmm1
divss 0x14(%rbx), %xmm1
movq 0x70(%rbx), %rax
movss %xmm1, (%rax,%r14,4)
movq (%rbx), %rax
movq 0x60(%rbx), %rcx
movss (%rcx,%r14,4), %xmm0
mulss (%rax,%r14,4), %xmm1
subss %xmm1, %xmm0
movq 0x68(%rbx), %rdx
addss (%rdx,%r14,4), %xmm0
movss %xmm0, (%rdx,%r14,4)
movss (%rcx,%r14,4), %xmm0
movq 0x78(%rbx), %rcx
mulss %xmm0, %xmm0
addss (%rcx,%r14,4), %xmm0
movss %xmm0, (%rcx,%r14,4)
movss (%rdx,%r14,4), %xmm4
movaps %xmm4, %xmm1
andps 0x7ab(%rip), %xmm1      # 0x4010
movss 0x1c(%rbx), %xmm6
ucomiss %xmm1, %xmm6
jae 0x387f
movss 0x18(%rbx), %xmm5
ucomiss %xmm2, %xmm0
jb 0x3886
sqrtss %xmm0, %xmm0
jmp 0x38a6
andl $0x0, (%rax,%r14,4)
jmp 0x38e6
movaps %xmm4, -0x40(%rbp)
movaps %xmm5, -0x60(%rbp)
movaps %xmm6, -0x50(%rbp)
callq 0x22f0
movaps -0x50(%rbp), %xmm6
movaps -0x60(%rbp), %xmm5
movaps -0x40(%rbp), %xmm4
xorps %xmm2, %xmm2
addss %xmm0, %xmm5
xorps %xmm0, %xmm0
cmpnless %xmm4, %xmm0
movaps %xmm0, %xmm1
andps %xmm6, %xmm1
movaps 0x761(%rip), %xmm3      # 0x4020
xorps %xmm3, %xmm6
andnps %xmm6, %xmm0
orps %xmm1, %xmm0
addss %xmm4, %xmm0
divss 0x14(%rbx), %xmm5
addss 0x20(%rbx), %xmm5
xorps %xmm3, %xmm5
divss %xmm5, %xmm0
movq (%rbx), %rax
movss %xmm0, (%rax,%r14,4)
incq %r14
movq 0x40(%rbx), %rax
movq 0x2a0(%rax), %rsi
jmp 0x37a3
addq $0x48, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq