// File: poseidon1214[P]logistic-regression-ftrl-mpi/src/ftrl.h
// Function: FTRL::batch_gradient_calculate(int&)
void batch_gradient_calculate(int &row){
            int index = 0; float value = 0.0; float pctr = 0;
            for(int line = 0; line < batch_size; line++){
                float wx = bias;
                for(int col = 0; col < data->fea_matrix[row].size(); col++){//for one instance
                    index = data->fea_matrix[row][col].idx;
                    value = data->fea_matrix[row][col].val;
                    wx += loc_w[index] * value;
                }
                pctr = sigmoid(wx);
                for(int col = 0; col < data->fea_matrix[row].size(); col++){
                    index = data->fea_matrix[row][col].idx;
                    value = data->fea_matrix[row][col].val;
                    loc_g[index] += (pctr - data->label[row]) * value;
                }
                row++;
            }//end for
        }

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x50, %rsp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq -0x8(%rbp), %rax
movq %rax, -0x38(%rbp)
movl $0x0, -0x14(%rbp)
xorps %xmm0, %xmm0
movss %xmm0, -0x18(%rbp)
xorps %xmm0, %xmm0
movss %xmm0, -0x1c(%rbp)
movl $0x0, -0x20(%rbp)
movq -0x38(%rbp), %rcx
movl -0x20(%rbp), %eax
cmpl 0xc(%rcx), %eax
jge 0x11307
movq -0x38(%rbp), %rax
movss 0x10(%rax), %xmm0
movss %xmm0, -0x24(%rbp)
movl $0x0, -0x28(%rbp)
movq -0x38(%rbp), %rax
movslq -0x28(%rbp), %rcx
movq %rcx, -0x40(%rbp)
movq 0x40(%rax), %rdi
addq $0x208, %rdi            # imm = 0x208
movq -0x10(%rbp), %rax
movslq (%rax), %rsi
callq 0x11680
movq %rax, %rdi
callq 0xf9c0
movq %rax, %rcx
movq -0x40(%rbp), %rax
cmpq %rcx, %rax
jae 0x111cf
movq -0x38(%rbp), %rax
movq 0x40(%rax), %rdi
addq $0x208, %rdi            # imm = 0x208
movq -0x10(%rbp), %rax
movslq (%rax), %rsi
callq 0x11680
movq %rax, %rdi
movslq -0x28(%rbp), %rsi
callq 0x116a0
movq %rax, %rcx
movq -0x38(%rbp), %rax
movq (%rcx), %rcx
movl %ecx, -0x14(%rbp)
movq 0x40(%rax), %rdi
addq $0x208, %rdi            # imm = 0x208
movq -0x10(%rbp), %rax
movslq (%rax), %rsi
callq 0x11680
movq %rax, %rdi
movslq -0x28(%rbp), %rsi
callq 0x116a0
movq %rax, %rcx
movq -0x38(%rbp), %rax
cvtsi2ssl 0x8(%rcx), %xmm0
movss %xmm0, -0x18(%rbp)
movq (%rax), %rax
movslq -0x14(%rbp), %rcx
movss (%rax,%rcx,4), %xmm0
movss -0x18(%rbp), %xmm2
movss -0x24(%rbp), %xmm1
mulss %xmm2, %xmm0
addss %xmm1, %xmm0
movss %xmm0, -0x24(%rbp)
movl -0x28(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x28(%rbp)
jmp 0x110fb
movq -0x38(%rbp), %rdi
movss -0x24(%rbp), %xmm0
callq 0x116c0
movss %xmm0, -0x1c(%rbp)
movl $0x0, -0x2c(%rbp)
movq -0x38(%rbp), %rax
movslq -0x2c(%rbp), %rcx
movq %rcx, -0x48(%rbp)
movq 0x40(%rax), %rdi
addq $0x208, %rdi            # imm = 0x208
movq -0x10(%rbp), %rax
movslq (%rax), %rsi
callq 0x11680
movq %rax, %rdi
callq 0xf9c0
movq %rax, %rcx
movq -0x48(%rbp), %rax
cmpq %rcx, %rax
jae 0x112ee
movq -0x38(%rbp), %rax
movq 0x40(%rax), %rdi
addq $0x208, %rdi            # imm = 0x208
movq -0x10(%rbp), %rax
movslq (%rax), %rsi
callq 0x11680
movq %rax, %rdi
movslq -0x2c(%rbp), %rsi
callq 0x116a0
movq %rax, %rcx
movq -0x38(%rbp), %rax
movq (%rcx), %rcx
movl %ecx, -0x14(%rbp)
movq 0x40(%rax), %rdi
addq $0x208, %rdi            # imm = 0x208
movq -0x10(%rbp), %rax
movslq (%rax), %rsi
callq 0x11680
movq %rax, %rdi
movslq -0x2c(%rbp), %rsi
callq 0x116a0
movq %rax, %rcx
movq -0x38(%rbp), %rax
cvtsi2ssl 0x8(%rcx), %xmm0
movss %xmm0, -0x18(%rbp)
movss -0x1c(%rbp), %xmm0
movss %xmm0, -0x4c(%rbp)
movq 0x40(%rax), %rdi
addq $0x248, %rdi            # imm = 0x248
movq -0x10(%rbp), %rax
movslq (%rax), %rsi
callq 0x11750
movss -0x4c(%rbp), %xmm0
movq %rax, %rcx
movq -0x38(%rbp), %rax
cvtsi2ssl (%rcx), %xmm1
subss %xmm1, %xmm0
movss -0x18(%rbp), %xmm2
movq 0x58(%rax), %rax
movslq -0x14(%rbp), %rcx
movss (%rax,%rcx,4), %xmm1
mulss %xmm2, %xmm0
addss %xmm1, %xmm0
movss %xmm0, (%rax,%rcx,4)
movl -0x2c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x2c(%rbp)
jmp 0x111e9
movq -0x10(%rbp), %rax
movl (%rax), %ecx
addl $0x1, %ecx
movl %ecx, (%rax)
movl -0x20(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x20(%rbp)
jmp 0x110d6
addq $0x50, %rsp
popq %rbp
retq
nopl (%rax)