// File: poseidon1214[P]logistic-regression-ftrl-mpi/src/predict.h
// Function: Predict::predict(float*)
void predict(float* glo_w){
        //std::cout<<"glo_w size "<<glo_w.size()<<std::endl;
        for(int i = 0; i < data->fea_matrix.size(); i++) {
	        float x = 0.0;
            for(int j = 0; j < data->fea_matrix[i].size(); j++) {
                long int idx = data->fea_matrix[i][j].idx;
                int val = data->fea_matrix[i][j].val;
                x += glo_w[idx] * val;
            }

            if(x < -30){
                pctr = 1e-6;
            }
            else if(x > 30){
                pctr = 1.0;
            }
            else{
                double ex = pow(2.718281828, x);
                pctr = ex / (1.0 + ex);
            }
            int id = int(pctr*MAX_ARRAY_SIZE);
            clkinfo clickinfo;
            clickinfo.clk = data->label[i];
            clickinfo.nclk = 1 - data->label[i];
            clickinfo.idx = id;
            result_list.push_back(clickinfo);
        }
    }

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x70, %rsp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq -0x8(%rbp), %rax
movq %rax, -0x58(%rbp)
movl $0x0, -0x14(%rbp)
movq -0x58(%rbp), %rax
movslq -0x14(%rbp), %rcx
movq %rcx, -0x60(%rbp)
movq (%rax), %rdi
addq $0x208, %rdi            # imm = 0x208
callq 0x10760
movq %rax, %rcx
movq -0x60(%rbp), %rax
cmpq %rcx, %rax
jae 0x11a03
xorps %xmm0, %xmm0
movss %xmm0, -0x18(%rbp)
movl $0x0, -0x1c(%rbp)
movq -0x58(%rbp), %rax
movslq -0x1c(%rbp), %rcx
movq %rcx, -0x68(%rbp)
movq (%rax), %rdi
addq $0x208, %rdi            # imm = 0x208
movslq -0x14(%rbp), %rsi
callq 0x11680
movq %rax, %rdi
callq 0xf9c0
movq %rax, %rcx
movq -0x68(%rbp), %rax
cmpq %rcx, %rax
jae 0x118f8
movq -0x58(%rbp), %rax
movq (%rax), %rdi
addq $0x208, %rdi            # imm = 0x208
movslq -0x14(%rbp), %rsi
callq 0x11680
movq %rax, %rdi
movslq -0x1c(%rbp), %rsi
callq 0x116a0
movq %rax, %rcx
movq -0x58(%rbp), %rax
movq (%rcx), %rcx
movq %rcx, -0x28(%rbp)
movq (%rax), %rdi
addq $0x208, %rdi            # imm = 0x208
movslq -0x14(%rbp), %rsi
callq 0x11680
movq %rax, %rdi
movslq -0x1c(%rbp), %rsi
callq 0x116a0
movl 0x8(%rax), %eax
movl %eax, -0x2c(%rbp)
movq -0x10(%rbp), %rax
movq -0x28(%rbp), %rcx
movss (%rax,%rcx,4), %xmm0
cvtsi2ssl -0x2c(%rbp), %xmm2
movss -0x18(%rbp), %xmm1
mulss %xmm2, %xmm0
addss %xmm1, %xmm0
movss %xmm0, -0x18(%rbp)
movl -0x1c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x1c(%rbp)
jmp 0x11839
movss 0x1708(%rip), %xmm0     # 0x13008
ucomiss -0x18(%rbp), %xmm0
jbe 0x11919
movq -0x58(%rbp), %rax
movss 0x1702(%rip), %xmm0     # 0x13014
movss %xmm0, 0x58(%rax)
jmp 0x1197a
movss -0x18(%rbp), %xmm0
movss 0x16e6(%rip), %xmm1     # 0x1300c
ucomiss %xmm1, %xmm0
jbe 0x1193e
movq -0x58(%rbp), %rax
movss 0x16d9(%rip), %xmm0     # 0x13010
movss %xmm0, 0x58(%rax)
jmp 0x11978
movss -0x18(%rbp), %xmm1
movsd 0x16d5(%rip), %xmm0     # 0x13020
callq 0x11770
movq -0x58(%rbp), %rax
movsd %xmm0, -0x38(%rbp)
movsd -0x38(%rbp), %xmm0
movsd 0x16b2(%rip), %xmm1     # 0x13018
addsd -0x38(%rbp), %xmm1
divsd %xmm1, %xmm0
cvtsd2ss %xmm0, %xmm0
movss %xmm0, 0x58(%rax)
jmp 0x1197a
movq -0x58(%rbp), %rax
movss 0x58(%rax), %xmm0
cvtsi2ssl 0x20(%rax), %xmm1
mulss %xmm1, %xmm0
cvttss2si %xmm0, %ecx
movl %ecx, -0x3c(%rbp)
movq (%rax), %rdi
addq $0x248, %rdi            # imm = 0x248
movslq -0x14(%rbp), %rsi
callq 0x11750
movq %rax, %rcx
movq -0x58(%rbp), %rax
cvtsi2ssl (%rcx), %xmm0
movss %xmm0, -0x50(%rbp)
movq (%rax), %rdi
addq $0x248, %rdi            # imm = 0x248
movslq -0x14(%rbp), %rsi
callq 0x11750
movq -0x58(%rbp), %rdi
movq %rax, %rcx
movl $0x1, %eax
subl (%rcx), %eax
cvtsi2ss %eax, %xmm0
movss %xmm0, -0x4c(%rbp)
movslq -0x3c(%rbp), %rax
movq %rax, -0x48(%rbp)
addq $0x8, %rdi
leaq -0x50(%rbp), %rsi
callq 0x11cc0
movl -0x14(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x14(%rbp)
jmp 0x117ff
addq $0x70, %rsp
popq %rbp
retq
nopl (%rax)