// File: 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 %rbp
movq %rsp, %rbp
subq $0x50, %rsp
movl $0x0, -0x8(%rbp)
xorps %xmm0, %xmm0
movsd %xmm0, -0x10(%rbp)
xorps %xmm0, %xmm0
movsd %xmm0, -0x18(%rbp)
xorps %xmm0, %xmm0
movsd %xmm0, -0x20(%rbp)
xorps %xmm0, %xmm0
movsd %xmm0, -0x28(%rbp)
xorps %xmm0, %xmm0
movsd %xmm0, -0x30(%rbp)
xorps %xmm0, %xmm0
movsd %xmm0, -0x38(%rbp)
movslq 0x131e2(%rip), %rdi     # 0x162a8
shlq $0x3, %rdi
callq 0x21c0
movq %rax, -0x40(%rbp)
movl 0x1320b(%rip), %edx     # 0x162e4
movq -0x40(%rbp), %rcx
leaq 0x131c4(%rip), %rdi     # 0x162a8
leaq 0x1316d(%rip), %rsi     # 0x16258
callq 0x9820
cmpl $0xb, 0x13161(%rip)     # 0x16258
je 0x310f
cmpl $0xd, 0x13158(%rip)     # 0x16258
je 0x310f
cmpl $0xc, 0x1314f(%rip)     # 0x16258
jne 0x3305
movl $0x0, -0x4(%rbp)
movl -0x4(%rbp), %eax
cmpl 0x13189(%rip), %eax     # 0x162a8
jge 0x31f2
movq 0x13184(%rip), %rax     # 0x162b0
movslq -0x4(%rbp), %rcx
movsd (%rax,%rcx,8), %xmm0
movsd %xmm0, -0x48(%rbp)
movq -0x40(%rbp), %rax
movslq -0x4(%rbp), %rcx
movsd (%rax,%rcx,8), %xmm0
movsd %xmm0, -0x50(%rbp)
movsd -0x50(%rbp), %xmm0
subsd -0x48(%rbp), %xmm0
movsd -0x50(%rbp), %xmm2
subsd -0x48(%rbp), %xmm2
movsd -0x10(%rbp), %xmm1
mulsd %xmm2, %xmm0
addsd %xmm1, %xmm0
movsd %xmm0, -0x10(%rbp)
movsd -0x50(%rbp), %xmm0
addsd -0x18(%rbp), %xmm0
movsd %xmm0, -0x18(%rbp)
movsd -0x48(%rbp), %xmm0
addsd -0x20(%rbp), %xmm0
movsd %xmm0, -0x20(%rbp)
movsd -0x50(%rbp), %xmm0
movsd -0x50(%rbp), %xmm2
movsd -0x28(%rbp), %xmm1
mulsd %xmm2, %xmm0
addsd %xmm1, %xmm0
movsd %xmm0, -0x28(%rbp)
movsd -0x48(%rbp), %xmm0
movsd -0x48(%rbp), %xmm2
movsd -0x30(%rbp), %xmm1
mulsd %xmm2, %xmm0
addsd %xmm1, %xmm0
movsd %xmm0, -0x30(%rbp)
movsd -0x50(%rbp), %xmm0
movsd -0x48(%rbp), %xmm2
movsd -0x38(%rbp), %xmm1
mulsd %xmm2, %xmm0
addsd %xmm1, %xmm0
movsd %xmm0, -0x38(%rbp)
movl -0x4(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x4(%rbp)
jmp 0x3116
movsd -0x10(%rbp), %xmm0
cvtsi2sdl 0x130a9(%rip), %xmm1 # 0x162a8
divsd %xmm1, %xmm0
leaq 0xf918(%rip), %rdi      # 0x12b22
movb $0x1, %al
callq 0x2050
cvtsi2sdl 0x1308f(%rip), %xmm0 # 0x162a8
movsd -0x38(%rbp), %xmm2
movsd -0x18(%rbp), %xmm1
mulsd -0x20(%rbp), %xmm1
movq %xmm1, %rax
movabsq $-0x8000000000000000, %rcx # imm = 0x8000000000000000
xorq %rcx, %rax
movq %rax, %xmm1
mulsd %xmm2, %xmm0
addsd %xmm1, %xmm0
cvtsi2sdl 0x13059(%rip), %xmm1 # 0x162a8
movsd -0x38(%rbp), %xmm3
movsd -0x18(%rbp), %xmm2
mulsd -0x20(%rbp), %xmm2
movq %xmm2, %rax
movabsq $-0x8000000000000000, %rcx # imm = 0x8000000000000000
xorq %rcx, %rax
movq %rax, %xmm2
mulsd %xmm3, %xmm1
addsd %xmm2, %xmm1
mulsd %xmm1, %xmm0
cvtsi2sdl 0x1301f(%rip), %xmm1 # 0x162a8
movsd -0x28(%rbp), %xmm3
movsd -0x18(%rbp), %xmm2
mulsd -0x18(%rbp), %xmm2
movq %xmm2, %rax
movabsq $-0x8000000000000000, %rcx # imm = 0x8000000000000000
xorq %rcx, %rax
movq %rax, %xmm2
mulsd %xmm3, %xmm1
addsd %xmm2, %xmm1
cvtsi2sdl 0x12fe9(%rip), %xmm2 # 0x162a8
movsd -0x30(%rbp), %xmm4
movsd -0x20(%rbp), %xmm3
mulsd -0x20(%rbp), %xmm3
movq %xmm3, %rax
movabsq $-0x8000000000000000, %rcx # imm = 0x8000000000000000
xorq %rcx, %rax
movq %rax, %xmm3
mulsd %xmm4, %xmm2
addsd %xmm3, %xmm2
mulsd %xmm2, %xmm1
divsd %xmm1, %xmm0
leaq 0xf850(%rip), %rdi      # 0x12b4c
movb $0x1, %al
callq 0x2050
jmp 0x3379
movl $0x0, -0x4(%rbp)
movl -0x4(%rbp), %eax
cmpl 0x12f93(%rip), %eax     # 0x162a8
jge 0x334e
movq -0x40(%rbp), %rax
movslq -0x4(%rbp), %rcx
movsd (%rax,%rcx,8), %xmm0
movq 0x12f85(%rip), %rax     # 0x162b0
movslq -0x4(%rbp), %rcx
ucomisd (%rax,%rcx,8), %xmm0
jne 0x3341
jp 0x3341
movl -0x8(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x8(%rbp)
jmp 0x3343
movl -0x4(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x4(%rbp)
jmp 0x330c
cvtsi2sdl -0x8(%rbp), %xmm1
movsd 0xece5(%rip), %xmm0     # 0x12040
mulsd %xmm1, %xmm0
cvtsi2sdl 0x12f41(%rip), %xmm1 # 0x162a8
divsd %xmm1, %xmm0
leaq 0xf811(%rip), %rdi      # 0x12b83
movb $0x1, %al
callq 0x2050
movq -0x40(%rbp), %rdi
callq 0x2180
addq $0x50, %rsp
popq %rbp
retq
nopl (%rax,%rax)