// File: /workspace/github_cpp_makefile_star2_O1/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 $0x28, %rsp
leaq 0xee8f(%rip), %r14      # 0x12208
movslq 0xee88(%rip), %rdi      # 0x12208
shlq $0x3, %rdi
callq 0x21f0
movq %rax, %rbx
movl 0xeeb2(%rip), %edx      # 0x12244
leaq 0xee1f(%rip), %rsi      # 0x121b8
movq %r14, %rdi
movq %rax, %rcx
callq 0x97bc
movl 0xee0e(%rip), %ecx      # 0x121b8
addl $-0xb, %ecx
movl 0xee55(%rip), %eax      # 0x12208
cmpl $0x3, %ecx
jae 0x342b
testl %eax, %eax
jle 0x346c
xorpd %xmm0, %xmm0
movq 0xee45(%rip), %rcx      # 0x12210
xorl %edx, %edx
xorpd %xmm4, %xmm4
xorpd %xmm5, %xmm5
xorpd %xmm6, %xmm6
xorpd %xmm7, %xmm7
xorpd %xmm8, %xmm8
movsd (%rcx,%rdx,8), %xmm1
movsd (%rbx,%rdx,8), %xmm2
movapd %xmm2, %xmm3
subsd %xmm1, %xmm3
mulsd %xmm3, %xmm3
addsd %xmm3, %xmm0
addsd %xmm2, %xmm8
addsd %xmm1, %xmm7
movapd %xmm2, %xmm3
mulsd %xmm2, %xmm3
addsd %xmm3, %xmm6
mulsd %xmm1, %xmm2
mulsd %xmm1, %xmm1
addsd %xmm1, %xmm5
addsd %xmm2, %xmm4
incq %rdx
cmpq %rdx, %rax
jne 0x33e2
jmp 0x3485
testl %eax, %eax
jle 0x3525
xorl %ecx, %ecx
movq 0xedd4(%rip), %rdx      # 0x12210
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 0x343e
xorps %xmm0, %xmm0
cvtsi2sd %esi, %xmm0
mulsd 0x9bb9(%rip), %xmm0     # 0xd020
jmp 0x3529
xorpd %xmm8, %xmm8
xorpd %xmm7, %xmm7
xorpd %xmm6, %xmm6
xorpd %xmm5, %xmm5
xorpd %xmm4, %xmm4
xorpd %xmm0, %xmm0
movsd %xmm7, (%rsp)
movsd %xmm8, 0x8(%rsp)
movsd %xmm4, 0x10(%rsp)
movsd %xmm6, 0x18(%rsp)
movsd %xmm5, 0x20(%rsp)
xorps %xmm1, %xmm1
cvtsi2sd %eax, %xmm1
divsd %xmm1, %xmm0
leaq 0x9d10(%rip), %rdi      # 0xd1c5
movb $0x1, %al
callq 0x2050
xorps %xmm2, %xmm2
cvtsi2sdl 0xed41(%rip), %xmm2 # 0x12208
movsd (%rsp), %xmm4
movapd %xmm4, %xmm1
movsd 0x8(%rsp), %xmm3
mulsd %xmm3, %xmm1
movsd 0x10(%rsp), %xmm0
mulsd %xmm2, %xmm0
subsd %xmm1, %xmm0
mulsd %xmm0, %xmm0
mulsd %xmm3, %xmm3
movsd 0x18(%rsp), %xmm1
mulsd %xmm2, %xmm1
subsd %xmm3, %xmm1
movapd %xmm1, %xmm3
mulsd %xmm4, %xmm4
movsd 0x20(%rsp), %xmm1
mulsd %xmm2, %xmm1
subsd %xmm4, %xmm1
mulsd %xmm3, %xmm1
divsd %xmm1, %xmm0
leaq 0x9ccc(%rip), %rdi      # 0xd1ef
jmp 0x3538
xorpd %xmm0, %xmm0
cvtsi2sd %eax, %xmm1
divsd %xmm1, %xmm0
leaq 0x9cee(%rip), %rdi      # 0xd226
movb $0x1, %al
callq 0x2050
movq %rbx, %rdi
addq $0x28, %rsp
popq %rbx
popq %r14
jmp 0x21a0