// File: /workspace/github_c_makefile_star2_O3/olcaytaner[P]Isell/instancelist.c
// Function: instancelist_to_matrix
matrix instancelist_to_matrix(Instanceptr list, int problemtype, int positive, MULTIVARIATE_TYPE multivariate_type)
{
 /*!Last Changed 28.05.2004*/
 /*!Last Changed 22.03.2004*/
 matrix result;
 int i, dim, matrixdim, x, j;
 Instanceptr tmp;
 long int dataindex;
 dim = current_dataset->multifeaturecount - 1;
 if (multivariate_type == MULTIVARIATE_LINEAR)
   matrixdim = dim;
 else
   matrixdim = multifeaturecount_2d(current_dataset);
 result = matrix_alloc(data_size(list), matrixdim + 1);
 tmp = list;
 dataindex = 0;
 while (tmp)
  {
   if (multivariate_type == MULTIVARIATE_LINEAR)
     for (i = 0; i < current_dataset->multifeaturecount - 1; i++)
       result.values[dataindex][i] = real_feature(tmp, i);
   else
     if (multivariate_type == MULTIVARIATE_QUADRATIC)
      {
       x = 0;
       for (i = 0; i < dim; i++)
         for (j = i; j < dim; j++)
          {
           result.values[dataindex][x] = real_feature(tmp, i) * real_feature(tmp, j);
           x++;
          }
       for (i = 0; i < dim; i++)
        {
         result.values[dataindex][x] = real_feature(tmp, i);
         x++;
        }
      }
   switch (problemtype)
    {
     case CLASSIFICATION:result.values[dataindex][matrixdim] = give_classno(tmp);
                         break;
     case REGRESSION    :result.values[dataindex][matrixdim] = give_regressionvalue(tmp);
                         break;
     case 2             :if (give_classno(tmp) == positive)
                           result.values[dataindex][matrixdim] = 0;
                         else
                           result.values[dataindex][matrixdim] = 1;
                         break;
     case 3             :result.values[dataindex][matrixdim] = positive;
                         break;
     default            :printf(m1241, problemtype);
                         break;
    }
   tmp = tmp->next;
   dataindex++;
  }
 return result;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x58, %rsp
movl %ecx, %ebp
movl %edx, 0x1c(%rsp)
movl %esi, 0xc(%rsp)
movq %rdi, %r15
leaq 0xa57c3(%rip), %rax     # 0xd5870
movq (%rax), %rdi
movl 0x1c0(%rdi), %eax
movq %rax, 0x28(%rsp)
decl %eax
movl %eax, 0x20(%rsp)
movl %eax, %r12d
cmpl $-0x2, %ecx
je 0x300d1
callq 0x1372c
movl %eax, %r12d
testq %r15, %r15
je 0x302ee
xorl %edi, %edi
movq %r15, %rax
incl %edi
movq 0x10(%rax), %rax
testq %rax, %rax
jne 0x300df
leal 0x1(%r12), %esi
callq 0x3d79d
movq %rax, 0x30(%rsp)
movq %rdx, %r13
testq %r15, %r15
je 0x302d7
cmpl $-0x3, %ebp
setne %al
cmpl $0x2, 0x28(%rsp)
setl %cl
cvtsi2sdl 0x1c(%rsp), %xmm0
movsd %xmm0, 0x38(%rsp)
movslq %r12d, %rdx
movq %rdx, 0x10(%rsp)
orb %al, %cl
movb %cl, 0xb(%rsp)
movl 0x20(%rsp), %eax
movq %rax, 0x48(%rsp)
movl 0xc(%rsp), %eax
movq %rax, 0x40(%rsp)
xorl %ebx, %ebx
movl %ebp, 0x24(%rsp)
cmpl $-0x2, %ebp
jne 0x3019b
leaq 0xa571f(%rip), %rax     # 0xd5870
movq (%rax), %rax
cmpl $0x2, 0x1c0(%rax)
jl 0x3022b
xorl %r12d, %r12d
movq %r15, %rdi
movl %r12d, %esi
callq 0x2ed6a
movq (%r13,%rbx,8), %rax
movsd %xmm0, (%rax,%r12,8)
incq %r12
leaq 0xa56ec(%rip), %rax     # 0xd5870
movq (%rax), %rax
movslq 0x1c0(%rax), %rax
decq %rax
cmpq %rax, %r12
jl 0x30164
jmp 0x3022b
cmpb $0x0, 0xb(%rsp)
jne 0x3022b
xorl %r12d, %r12d
xorl %r14d, %r14d
movslq %r14d, %r14
movl %r12d, %ebp
movq %r15, %rdi
movl %r12d, %esi
callq 0x2ed6a
movsd %xmm0, 0x50(%rsp)
movq %r15, %rdi
movl %ebp, %esi
callq 0x2ed6a
mulsd 0x50(%rsp), %xmm0
movq (%r13,%rbx,8), %rax
movsd %xmm0, (%rax,%r14,8)
movl 0x20(%rsp), %eax
incq %r14
incl %ebp
cmpl %eax, %ebp
jl 0x301b2
incl %r12d
cmpl %eax, %r12d
jne 0x301ac
cmpl $0x2, 0x28(%rsp)
movl 0x24(%rsp), %ebp
jl 0x3022b
movslq %r14d, %r14
shlq $0x3, %r14
xorl %r12d, %r12d
movq %r15, %rdi
movl %r12d, %esi
callq 0x2ed6a
movq (%r13,%rbx,8), %rax
addq %r14, %rax
movsd %xmm0, (%rax,%r12,8)
incq %r12
cmpl %r12d, 0x48(%rsp)
jne 0x30208
cmpl $0x3, 0xc(%rsp)
ja 0x302a0
movq 0x40(%rsp), %rax
leaq 0x788ce(%rip), %rcx     # 0xa8b0c
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
movq %r15, %rdi
callq 0x2f33a
xorps %xmm0, %xmm0
cvtsi2sd %eax, %xmm0
jmp 0x3028f
movq %r15, %rdi
callq 0x2f33a
movq (%r13,%rbx,8), %rcx
cmpl 0x1c(%rsp), %eax
jne 0x302b4
movq 0x10(%rsp), %rax
movq $0x0, (%rcx,%rax,8)
jmp 0x302c7
movq (%r13,%rbx,8), %rax
movsd 0x38(%rsp), %xmm0
jmp 0x30294
movq %r15, %rdi
callq 0x2f35e
movq (%r13,%rbx,8), %rax
movq 0x10(%rsp), %rcx
movsd %xmm0, (%rax,%rcx,8)
jmp 0x302c7
leaq 0x78875(%rip), %rdi     # 0xa8b1c
movl 0xc(%rsp), %esi
xorl %eax, %eax
callq 0x4030
jmp 0x302c7
movq 0x10(%rsp), %rax
movabsq $0x3ff0000000000000, %rdx # imm = 0x3FF0000000000000
movq %rdx, (%rcx,%rax,8)
movq 0x10(%r15), %r15
incq %rbx
testq %r15, %r15
jne 0x30145
movq 0x30(%rsp), %rax
movq %r13, %rdx
addq $0x58, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
incl %r12d
xorl %edi, %edi
movl %r12d, %esi
addq $0x58, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x3d79d