// File: /workspace/github_cpp_makefile_star2_O3/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 0xfebf(%rip), %r14      # 0x13208
movslq 0xfeb8(%rip), %rdi      # 0x13208
shlq $0x3, %rdi
callq 0x21f0
movq %rax, %rbx
movl 0xfee2(%rip), %edx      # 0x13244
leaq 0xfe4f(%rip), %rsi      # 0x131b8
movq %r14, %rdi
movq %rax, %rcx
callq 0xa090
movl 0xfe3e(%rip), %ecx      # 0x131b8
addl $-0xb, %ecx
movl 0xfe85(%rip), %eax      # 0x13208
cmpl $0x3, %ecx
jae 0x33e5
xorpd %xmm4, %xmm4
testl %eax, %eax
jle 0x3426
movq 0xfe75(%rip), %rcx      # 0x13210
xorl %edx, %edx
xorpd %xmm5, %xmm5
xorpd %xmm6, %xmm6
movsd (%rcx,%rdx,8), %xmm0
movsd (%rbx,%rdx,8), %xmm1
movapd %xmm1, %xmm2
subsd %xmm0, %xmm2
movapd %xmm1, %xmm3
unpcklpd %xmm0, %xmm3            # xmm3 = xmm3[0],xmm0[0]
addpd %xmm3, %xmm6
unpcklpd %xmm2, %xmm1            # xmm1 = xmm1[0],xmm2[0]
unpcklpd %xmm2, %xmm0            # xmm0 = xmm0[0],xmm2[0]
mulpd %xmm1, %xmm0
addpd %xmm0, %xmm5
mulpd %xmm3, %xmm3
addpd %xmm3, %xmm4
incq %rdx
cmpq %rdx, %rax
jne 0x33a5
jmp 0x342e
testl %eax, %eax
jle 0x34ce
xorl %ecx, %ecx
movq 0xfe1a(%rip), %rdx      # 0x13210
xorl %esi, %esi
movsd (%rdx,%rcx,8), %xmm0
cmpeqsd (%rbx,%rcx,8), %xmm0
movq %xmm0, %rdi
subl %edi, %esi
incq %rcx
cmpq %rcx, %rax
jne 0x33f8
xorps %xmm0, %xmm0
cvtsi2sd %esi, %xmm0
mulsd 0xac27(%rip), %xmm0     # 0xe048
jmp 0x34d2
xorpd %xmm5, %xmm5
xorpd %xmm6, %xmm6
movapd %xmm6, (%rsp)
movapd %xmm4, 0x10(%rsp)
movapd %xmm5, 0x20(%rsp)
xorps %xmm1, %xmm1
cvtsi2sd %eax, %xmm1
movapd %xmm5, %xmm0
unpckhpd %xmm5, %xmm0            # xmm0 = xmm0[1],xmm5[1]
divsd %xmm1, %xmm0
leaq 0xad94(%rip), %rdi      # 0xe1ed
movb $0x1, %al
callq 0x2050
xorps %xmm0, %xmm0
cvtsi2sdl 0xfd9d(%rip), %xmm0 # 0x13208
movapd (%rsp), %xmm4
movapd %xmm4, %xmm1
unpckhpd %xmm4, %xmm1            # xmm1 = xmm1[1],xmm4[1]
mulsd %xmm1, %xmm1
movapd 0x10(%rsp), %xmm3
movapd %xmm3, %xmm2
unpckhpd %xmm3, %xmm2            # xmm2 = xmm2[1],xmm3[1]
mulsd %xmm0, %xmm2
subsd %xmm1, %xmm2
movapd %xmm4, %xmm1
unpcklpd %xmm4, %xmm1            # xmm1 = xmm1[0],xmm4[0]
mulpd %xmm4, %xmm1
unpcklpd %xmm0, %xmm0            # xmm0 = xmm0[0,0]
unpcklpd 0x20(%rsp), %xmm3       # xmm3 = xmm3[0],mem[0]
mulpd %xmm0, %xmm3
subpd %xmm1, %xmm3
shufpd $0x2, %xmm3, %xmm2      # xmm2 = xmm2[0],xmm3[1]
mulpd %xmm3, %xmm2
movapd %xmm2, %xmm0
unpckhpd %xmm2, %xmm0            # xmm0 = xmm0[1],xmm2[1]
divsd %xmm2, %xmm0
leaq 0xad4b(%rip), %rdi      # 0xe217
jmp 0x34e1
xorpd %xmm0, %xmm0
cvtsi2sd %eax, %xmm1
divsd %xmm1, %xmm0
leaq 0xad6d(%rip), %rdi      # 0xe24e
movb $0x1, %al
callq 0x2050
movq %rbx, %rdi
addq $0x38, %rsp
popq %rbx
popq %r14
jmp 0x21a0