// File: /workspace/github_c_makefile_star2_O0/olcaytaner[P]Isell/regression.c
// Function: train_gprocessreg
void* train_gprocessreg(Instanceptr* trdata, Instanceptr *cvdata, void* parameters)
{
 /*!Last Changed 15.01.2009*/
 int i, j;
 matrix kernel_matrix, t;
 Svm_nodeptr* nodelist;
 Svm_parameter param;
 Gprocess_parameterptr gp = (Gprocess_parameterptr) parameters;
 Model_gprocessregressionptr m = safemalloc(sizeof(Model_gprocessregression), "train_gprocessreg", 3);
 Instanceptr tmp = *trdata;
 m->size = data_size(*trdata);
 m->data = *trdata;
 kernel_matrix = matrix_alloc(m->size, m->size);
 t = matrix_alloc(m->size, 1);
 nodelist = safemalloc(m->size * sizeof(Svm_nodeptr), "train_gprocessreg", 10);
 i = 0;
 while (tmp)
  {
   nodelist[i] = instance_to_svmnode(tmp);
   t.values[i][0] = give_regressionvalue(tmp);
   tmp = tmp->next;
   i++;
  }
 param.kernel_type = gp->kernel_type;
 param.coef0 = gp->coef0;
 param.gamma = gp->gamma;
 param.degree = gp->degree;
 for (i = 0; i < m->size; i++)
   for (j = 0; j < m->size; j++)
     kernel_matrix.values[i][j] = k_function(nodelist[i], nodelist[j], param);
 for (i = 0; i < m->size; i++)
   kernel_matrix.values[i][i] += gp->sigma;
 matrix_inverse(&kernel_matrix);
 matrix_product(&kernel_matrix, t);
 m->weights = safemalloc(m->size * sizeof(double), "train_gprocessreg", 25);
 for (i = 0; i < m->size; i++)
   m->weights[i] = kernel_matrix.values[i][0];
 for (i = 0; i < m->size; i++)
   safe_free(nodelist[i]);
 safe_free(nodelist);
 matrix_free(kernel_matrix);
 matrix_free(t);
 return m;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x130, %rsp            # imm = 0x130
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq %rdx, -0x18(%rbp)
movq -0x18(%rbp), %rax
movq %rax, -0xa8(%rbp)
movl $0x18, %edi
leaq 0x4afdb(%rip), %rsi     # 0xec209
movl $0x3, %edx
callq 0x52d70
movq %rax, -0xb0(%rbp)
movq -0x8(%rbp), %rax
movq (%rax), %rax
movq %rax, -0xb8(%rbp)
movq -0x8(%rbp), %rax
movq (%rax), %rdi
callq 0x449f0
movl %eax, %ecx
movq -0xb0(%rbp), %rax
movl %ecx, (%rax)
movq -0x8(%rbp), %rax
movq (%rax), %rcx
movq -0xb0(%rbp), %rax
movq %rcx, 0x8(%rax)
movq -0xb0(%rbp), %rax
movl (%rax), %edi
movq -0xb0(%rbp), %rax
movl (%rax), %esi
callq 0x57fc0
movq %rax, -0xc8(%rbp)
movq %rdx, -0xc0(%rbp)
movq -0xc8(%rbp), %rax
movq %rax, -0x30(%rbp)
movq -0xc0(%rbp), %rax
movq %rax, -0x28(%rbp)
movq -0xb0(%rbp), %rax
movl (%rax), %edi
movl $0x1, %esi
callq 0x57fc0
movq %rax, -0xd8(%rbp)
movq %rdx, -0xd0(%rbp)
movq -0xd8(%rbp), %rax
movq %rax, -0x40(%rbp)
movq -0xd0(%rbp), %rax
movq %rax, -0x38(%rbp)
movq -0xb0(%rbp), %rax
movslq (%rax), %rdi
shlq $0x3, %rdi
leaq 0x4af0c(%rip), %rsi     # 0xec209
movl $0xa, %edx
callq 0x52d70
movq %rax, -0x48(%rbp)
movl $0x0, -0x1c(%rbp)
cmpq $0x0, -0xb8(%rbp)
je 0xa1370
movq -0xb8(%rbp), %rdi
callq 0x42b00
movq %rax, %rdx
movq -0x48(%rbp), %rax
movslq -0x1c(%rbp), %rcx
movq %rdx, (%rax,%rcx,8)
movq -0xb8(%rbp), %rdi
callq 0x43580
movq -0x38(%rbp), %rax
movslq -0x1c(%rbp), %rcx
movq (%rax,%rcx,8), %rax
movsd %xmm0, (%rax)
movq -0xb8(%rbp), %rax
movq 0x10(%rax), %rax
movq %rax, -0xb8(%rbp)
movl -0x1c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x1c(%rbp)
jmp 0xa1312
movq -0xa8(%rbp), %rax
movl 0x8(%rax), %eax
movl %eax, -0x9c(%rbp)
movq -0xa8(%rbp), %rax
movsd 0x10(%rax), %xmm0
movsd %xmm0, -0x88(%rbp)
movq -0xa8(%rbp), %rax
movsd 0x20(%rax), %xmm0
movsd %xmm0, -0x90(%rbp)
movq -0xa8(%rbp), %rax
movl 0x18(%rax), %eax
movl %eax, -0x98(%rbp)
movl $0x0, -0x1c(%rbp)
movl -0x1c(%rbp), %eax
movq -0xb0(%rbp), %rcx
cmpl (%rcx), %eax
jge 0xa146e
movl $0x0, -0x20(%rbp)
movl -0x20(%rbp), %eax
movq -0xb0(%rbp), %rcx
cmpl (%rcx), %eax
jge 0xa145e
movq -0x48(%rbp), %rax
movslq -0x1c(%rbp), %rcx
movq (%rax,%rcx,8), %rdi
movq -0x48(%rbp), %rax
movslq -0x20(%rbp), %rcx
movq (%rax,%rcx,8), %rsi
movq -0x50(%rbp), %rcx
movq %rsp, %rax
movq %rcx, 0x50(%rax)
movups -0x60(%rbp), %xmm0
movups %xmm0, 0x40(%rax)
movups -0xa0(%rbp), %xmm0
movups -0x90(%rbp), %xmm1
movups -0x80(%rbp), %xmm2
movups -0x70(%rbp), %xmm3
movups %xmm3, 0x30(%rax)
movups %xmm2, 0x20(%rax)
movups %xmm1, 0x10(%rax)
movups %xmm0, (%rax)
callq 0xcaa90
movq -0x28(%rbp), %rax
movslq -0x1c(%rbp), %rcx
movq (%rax,%rcx,8), %rax
movslq -0x20(%rbp), %rcx
movsd %xmm0, (%rax,%rcx,8)
movl -0x20(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x20(%rbp)
jmp 0xa13d8
jmp 0xa1460
movl -0x1c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x1c(%rbp)
jmp 0xa13bf
movl $0x0, -0x1c(%rbp)
movl -0x1c(%rbp), %eax
movq -0xb0(%rbp), %rcx
cmpl (%rcx), %eax
jge 0xa14b3
movq -0xa8(%rbp), %rax
movsd (%rax), %xmm0
movq -0x28(%rbp), %rax
movslq -0x1c(%rbp), %rcx
movq (%rax,%rcx,8), %rax
movslq -0x1c(%rbp), %rcx
addsd (%rax,%rcx,8), %xmm0
movsd %xmm0, (%rax,%rcx,8)
movl -0x1c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x1c(%rbp)
jmp 0xa1475
leaq -0x30(%rbp), %rdi
callq 0x5c470
movq -0x40(%rbp), %rsi
movq -0x38(%rbp), %rdx
leaq -0x30(%rbp), %rdi
callq 0x5afa0
movq -0xb0(%rbp), %rax
movslq (%rax), %rdi
shlq $0x3, %rdi
leaq 0x4ad27(%rip), %rsi     # 0xec209
movl $0x19, %edx
callq 0x52d70
movq %rax, %rcx
movq -0xb0(%rbp), %rax
movq %rcx, 0x10(%rax)
movl $0x0, -0x1c(%rbp)
movl -0x1c(%rbp), %eax
movq -0xb0(%rbp), %rcx
cmpl (%rcx), %eax
jge 0xa153e
movq -0x28(%rbp), %rax
movslq -0x1c(%rbp), %rcx
movq (%rax,%rcx,8), %rax
movsd (%rax), %xmm0
movq -0xb0(%rbp), %rax
movq 0x10(%rax), %rax
movslq -0x1c(%rbp), %rcx
movsd %xmm0, (%rax,%rcx,8)
movl -0x1c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x1c(%rbp)
jmp 0xa1501
movl $0x0, -0x1c(%rbp)
movl -0x1c(%rbp), %eax
movq -0xb0(%rbp), %rcx
cmpl (%rcx), %eax
jge 0xa156f
movq -0x48(%rbp), %rax
movslq -0x1c(%rbp), %rcx
movq (%rax,%rcx,8), %rdi
callq 0x52e80
movl -0x1c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x1c(%rbp)
jmp 0xa1545
movq -0x48(%rbp), %rdi
callq 0x52e80
movq -0x30(%rbp), %rdi
movq -0x28(%rbp), %rsi
callq 0x59ea0
movq -0x40(%rbp), %rdi
movq -0x38(%rbp), %rsi
callq 0x59ea0
movq -0xb0(%rbp), %rax
addq $0x130, %rsp            # imm = 0x130
popq %rbp
retq
nopw %cs:(%rax,%rax)