// File: /workspace/github_cpp_makefile_star2_O2/cjlin1[P]liblinear/train.c
// Function: do_cross_validation()
void do_cross_validation()
{
	int i;
	int total_correct = 0;
	double total_error = 0;
	double sumv = 0, sumy = 0, sumvv = 0, sumyy = 0, sumvy = 0;
	double *target = Malloc(double, prob.l);

	cross_validation(&prob,&param,nr_fold,target);
	if(param.solver_type == L2R_L2LOSS_SVR ||
	   param.solver_type == L2R_L1LOSS_SVR_DUAL ||
	   param.solver_type == L2R_L2LOSS_SVR_DUAL)
	{
		for(i=0;i<prob.l;i++)
		{
			double y = prob.y[i];
			double v = target[i];
			total_error += (v-y)*(v-y);
			sumv += v;
			sumy += y;
			sumvv += v*v;
			sumyy += y*y;
			sumvy += v*y;
		}
		printf("Cross Validation Mean squared error = %g\n",total_error/prob.l);
		printf("Cross Validation Squared correlation coefficient = %g\n",
				((prob.l*sumvy-sumv*sumy)*(prob.l*sumvy-sumv*sumy))/
				((prob.l*sumvv-sumv*sumv)*(prob.l*sumyy-sumy*sumy))
			  );
	}
	else
	{
		for(i=0;i<prob.l;i++)
			if(target[i] == prob.y[i])
				++total_correct;
		printf("Cross Validation Accuracy = %g%%\n",100.0*total_correct/prob.l);
	}

	free(target);
}

// Assembly:
pushq %r14
pushq %rbx
subq $0x38, %rsp
leaq 0xe43e(%rip), %r14      # 0x11208
movslq 0xe437(%rip), %rdi      # 0x11208
shlq $0x3, %rdi
callq 0x21f0
movq %rax, %rbx
movl 0xe461(%rip), %edx      # 0x11244
leaq 0xe3ce(%rip), %rsi      # 0x111b8
movq %r14, %rdi
movq %rax, %rcx
callq 0x8add
movl 0xe3bd(%rip), %edi      # 0x111b8
addl $-0xb, %edi
movl 0xe404(%rip), %eax      # 0x11208
xorl %esi, %esi
testl %eax, %eax
movl $0x0, %ecx
cmovgl %eax, %ecx
movq 0xe3f9(%rip), %rdx      # 0x11210
cmpl $0x3, %edi
jae 0x2e6a
xorpd %xmm5, %xmm5
xorl %esi, %esi
xorpd %xmm6, %xmm6
xorpd %xmm4, %xmm4
cmpq %rsi, %rcx
je 0x2e8d
movsd (%rdx,%rsi,8), %xmm0
movsd (%rbx,%rsi,8), %xmm1
movapd %xmm1, %xmm2
subsd %xmm0, %xmm2
movapd %xmm1, %xmm3
unpcklpd %xmm0, %xmm3            # xmm3 = xmm3[0],xmm0[0]
addpd %xmm3, %xmm6
unpcklpd %xmm2, %xmm0            # xmm0 = xmm0[0],xmm2[0]
mulpd %xmm0, %xmm0
addpd %xmm0, %xmm4
unpcklpd %xmm1, %xmm1            # xmm1 = xmm1[0,0]
mulpd %xmm3, %xmm1
addpd %xmm1, %xmm5
incq %rsi
jmp 0x2e2a
xorl %edi, %edi
cmpq %rdi, %rcx
je 0x2f1f
movsd (%rdx,%rdi,8), %xmm0
cmpeqsd (%rbx,%rdi,8), %xmm0
movq %xmm0, %r8
subl %r8d, %esi
incq %rdi
jmp 0x2e6c
cvtsi2sd %eax, %xmm1
movapd %xmm4, %xmm0
unpckhpd %xmm4, %xmm0            # xmm0 = xmm0[1],xmm4[1]
divsd %xmm1, %xmm0
leaq 0x9349(%rip), %rdi      # 0xc1ed
movb $0x1, %al
movapd %xmm4, 0x10(%rsp)
movapd %xmm5, 0x20(%rsp)
movapd %xmm6, (%rsp)
callq 0x2050
cvtsi2sdl 0xe344(%rip), %xmm0 # 0x11208
movapd (%rsp), %xmm3
movapd %xmm3, %xmm1
unpckhpd %xmm3, %xmm1            # xmm1 = xmm1[1],xmm3[1]
mulsd %xmm1, %xmm1
movapd 0x10(%rsp), %xmm2
mulsd %xmm0, %xmm2
subsd %xmm1, %xmm2
movapd %xmm3, %xmm1
unpcklpd %xmm3, %xmm1            # xmm1 = xmm1[0],xmm3[0]
mulpd %xmm3, %xmm1
unpcklpd %xmm0, %xmm0            # xmm0 = xmm0[0,0]
mulpd 0x20(%rsp), %xmm0
subpd %xmm1, %xmm0
movapd %xmm2, %xmm1
shufpd $0x2, %xmm0, %xmm1      # xmm1 = xmm1[0],xmm0[1]
mulpd %xmm0, %xmm1
movapd %xmm1, %xmm0
unpckhpd %xmm1, %xmm0            # xmm0 = xmm0[1],xmm1[1]
divsd %xmm1, %xmm0
leaq 0x92fa(%rip), %rdi      # 0xc217
jmp 0x2f3a
cvtsi2sd %esi, %xmm0
mulsd 0x911d(%rip), %xmm0     # 0xc048
cvtsi2sd %eax, %xmm1
divsd %xmm1, %xmm0
leaq 0x9314(%rip), %rdi      # 0xc24e
movb $0x1, %al
callq 0x2050
movq %rbx, %rdi
addq $0x38, %rsp
popq %rbx
popq %r14
jmp 0x21a0