// File: /workspace/github_c_makefile_star2_O0/DVaronos[P]AnLogProject1/logistic.c
// Function: Newpred
double Newpred(double* w,double b,HVector* F,HVector* S,int dif){//Vriskei to predict xwris na ginei to concat

	int fr,se,c;
	double wx,sum=b;

	fr=F->sum;
	se=S->sum;
	if(fr>se){//Eelgxo pio ap ta dio vectors tha mpei proto
		c=0;
		for(int i=0 ; i<F->size ; i++){	//Isago tis leksis tou protou vector
			if(F[i].key!=-1){
				c++;
				wx=w[F[i].key]*(F[i].value);
				sum+=wx;
			}
			if(c==F->count) break;
		}
		c=0;
		for(int i=0 ; i<S->size ; i++){	//Isago tis leksis tou defterou vectour me afksimeno to key kata dif
			if(S[i].key!=-1){
				c++;
				wx=w[(S[i].key)+dif]*(S[i].value);
				sum+=wx;
			}
			if(c==S->count) break;
		}
	}else{
		c=0;
		for(int i=0 ; i<S->size ; i++){
			if(S[i].key!=-1){
				c++;
				wx=w[(S[i].key)]*(S[i].value);
				sum+=wx;
			}
			if(c==S->count) break;
		}
		c=0;
		for(int i=0 ; i<F->size ; i++){
			if(F[i].key!=-1){
				c++;
				wx=w[(F[i].key)+dif]*(F[i].value);
				sum+=wx;
			}
			if(c==F->count) break;
		}
	}
	sum=1 / (1 + exp(-(sum)));	//ipologizoume to p(f(x))
	return sum;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x50, %rsp
movq %rdi, -0x8(%rbp)
movsd %xmm0, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
movq %rdx, -0x20(%rbp)
movl %ecx, -0x24(%rbp)
movsd -0x10(%rbp), %xmm0
movsd %xmm0, -0x40(%rbp)
movq -0x18(%rbp), %rax
cvttsd2si 0x10(%rax), %eax
movl %eax, -0x28(%rbp)
movq -0x20(%rbp), %rax
cvttsd2si 0x10(%rax), %eax
movl %eax, -0x2c(%rbp)
movl -0x28(%rbp), %eax
cmpl -0x2c(%rbp), %eax
jle 0x35e8
movl $0x0, -0x30(%rbp)
movl $0x0, -0x44(%rbp)
movl -0x44(%rbp), %eax
movq -0x18(%rbp), %rcx
cmpl 0x1c(%rcx), %eax
jge 0x3542
movq -0x18(%rbp), %rax
movslq -0x44(%rbp), %rcx
shlq $0x5, %rcx
addq %rcx, %rax
cmpl $-0x1, (%rax)
je 0x3524
movl -0x30(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x30(%rbp)
movq -0x8(%rbp), %rax
movq -0x18(%rbp), %rcx
movslq -0x44(%rbp), %rdx
shlq $0x5, %rdx
addq %rdx, %rcx
movslq (%rcx), %rcx
movsd (%rax,%rcx,8), %xmm0
movq -0x18(%rbp), %rax
movslq -0x44(%rbp), %rcx
shlq $0x5, %rcx
addq %rcx, %rax
mulsd 0x8(%rax), %xmm0
movsd %xmm0, -0x38(%rbp)
movsd -0x38(%rbp), %xmm0
addsd -0x40(%rbp), %xmm0
movsd %xmm0, -0x40(%rbp)
movl -0x30(%rbp), %eax
movq -0x18(%rbp), %rcx
cmpl 0x18(%rcx), %eax
jne 0x3532
jmp 0x3542
jmp 0x3534
movl -0x44(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x44(%rbp)
jmp 0x34b8
movl $0x0, -0x30(%rbp)
movl $0x0, -0x48(%rbp)
movl -0x48(%rbp), %eax
movq -0x20(%rbp), %rcx
cmpl 0x1c(%rcx), %eax
jge 0x35e3
movq -0x20(%rbp), %rax
movslq -0x48(%rbp), %rcx
shlq $0x5, %rcx
addq %rcx, %rax
cmpl $-0x1, (%rax)
je 0x35c5
movl -0x30(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x30(%rbp)
movq -0x8(%rbp), %rax
movq -0x20(%rbp), %rcx
movslq -0x48(%rbp), %rdx
shlq $0x5, %rdx
addq %rdx, %rcx
movl (%rcx), %ecx
addl -0x24(%rbp), %ecx
movslq %ecx, %rcx
movsd (%rax,%rcx,8), %xmm0
movq -0x20(%rbp), %rax
movslq -0x48(%rbp), %rcx
shlq $0x5, %rcx
addq %rcx, %rax
mulsd 0x8(%rax), %xmm0
movsd %xmm0, -0x38(%rbp)
movsd -0x38(%rbp), %xmm0
addsd -0x40(%rbp), %xmm0
movsd %xmm0, -0x40(%rbp)
movl -0x30(%rbp), %eax
movq -0x20(%rbp), %rcx
cmpl 0x18(%rcx), %eax
jne 0x35d3
jmp 0x35e3
jmp 0x35d5
movl -0x48(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x48(%rbp)
jmp 0x3550
jmp 0x3723
movl $0x0, -0x30(%rbp)
movl $0x0, -0x4c(%rbp)
movl -0x4c(%rbp), %eax
movq -0x20(%rbp), %rcx
cmpl 0x1c(%rcx), %eax
jge 0x3680
movq -0x20(%rbp), %rax
movslq -0x4c(%rbp), %rcx
shlq $0x5, %rcx
addq %rcx, %rax
cmpl $-0x1, (%rax)
je 0x3662
movl -0x30(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x30(%rbp)
movq -0x8(%rbp), %rax
movq -0x20(%rbp), %rcx
movslq -0x4c(%rbp), %rdx
shlq $0x5, %rdx
addq %rdx, %rcx
movslq (%rcx), %rcx
movsd (%rax,%rcx,8), %xmm0
movq -0x20(%rbp), %rax
movslq -0x4c(%rbp), %rcx
shlq $0x5, %rcx
addq %rcx, %rax
mulsd 0x8(%rax), %xmm0
movsd %xmm0, -0x38(%rbp)
movsd -0x38(%rbp), %xmm0
addsd -0x40(%rbp), %xmm0
movsd %xmm0, -0x40(%rbp)
movl -0x30(%rbp), %eax
movq -0x20(%rbp), %rcx
cmpl 0x18(%rcx), %eax
jne 0x3670
jmp 0x3680
jmp 0x3672
movl -0x4c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x4c(%rbp)
jmp 0x35f6
movl $0x0, -0x30(%rbp)
movl $0x0, -0x50(%rbp)
movl -0x50(%rbp), %eax
movq -0x18(%rbp), %rcx
cmpl 0x1c(%rcx), %eax
jge 0x3721
movq -0x18(%rbp), %rax
movslq -0x50(%rbp), %rcx
shlq $0x5, %rcx
addq %rcx, %rax
cmpl $-0x1, (%rax)
je 0x3703
movl -0x30(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x30(%rbp)
movq -0x8(%rbp), %rax
movq -0x18(%rbp), %rcx
movslq -0x50(%rbp), %rdx
shlq $0x5, %rdx
addq %rdx, %rcx
movl (%rcx), %ecx
addl -0x24(%rbp), %ecx
movslq %ecx, %rcx
movsd (%rax,%rcx,8), %xmm0
movq -0x18(%rbp), %rax
movslq -0x50(%rbp), %rcx
shlq $0x5, %rcx
addq %rcx, %rax
mulsd 0x8(%rax), %xmm0
movsd %xmm0, -0x38(%rbp)
movsd -0x38(%rbp), %xmm0
addsd -0x40(%rbp), %xmm0
movsd %xmm0, -0x40(%rbp)
movl -0x30(%rbp), %eax
movq -0x18(%rbp), %rcx
cmpl 0x18(%rcx), %eax
jne 0x3711
jmp 0x3721
jmp 0x3713
movl -0x50(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x50(%rbp)
jmp 0x368e
jmp 0x3723
movsd -0x40(%rbp), %xmm0
movq %xmm0, %rax
movabsq $-0x8000000000000000, %rcx # imm = 0x8000000000000000
xorq %rcx, %rax
movq %rax, %xmm0
callq 0x1280
movsd 0x4ae4(%rip), %xmm1     # 0x8230
addsd %xmm0, %xmm1
movsd 0x4ad8(%rip), %xmm0     # 0x8230
divsd %xmm1, %xmm0
movsd %xmm0, -0x40(%rbp)
movsd -0x40(%rbp), %xmm0
addq $0x50, %rsp
popq %rbp
retq
nopl (%rax)