// File: /workspace/github_c_makefile_star2_O1/olcaytaner[P]Isell/process.c
// Function: create_cvdata
void create_cvdata()
{
 /*!Last Changed 26.11.2005 removed bug safe_free(myarray) called for regression*/
 /*!Last Changed 28.10.2005 added find_classes and find_class_counts*/
 /*!Last Changed 23.11.2004 added traincount*/
 /*!Last Changed 02.02.2004 added safemalloc*/
 /*!Last Changed 14.01.2004*/
 int j, dat = data_size(traindata), *myarray = NULL, *partition, *classcounts = NULL;
 Instanceptr cvbefore = NULL, trainbefore = NULL, train = traindata; 
 if (cvdata)
  {
   deallocate(cvdata);
   cvdata = NULL;
  } 
 if (current_dataset->classno > 0)
  { 
   myarray = find_classes(traindata);
   classcounts = find_class_counts(traindata);
  }  
 partition = stratified_partition(myarray, dat, current_dataset->classno, classcounts);
 j = 0; 
 while (train)
  {
   if (partition[j] % 5 == 0)
    {
     if (cvbefore)
      {
       cvbefore->next = train;
       cvbefore = cvbefore->next;
      }
     else
      {
       cvdata = train;
       cvbefore = cvdata;
      }
    }
   else
     if (trainbefore)
      {
       trainbefore->next = train;
       trainbefore = trainbefore->next;
      }
     else
      {
       traindata = train;
       trainbefore = traindata;
      }
   train = train->next;
   j++;
  }
	if (trainbefore)
   trainbefore->next = NULL;
	if (cvbefore)
   cvbefore->next = NULL;
 current_dataset->traincount = data_size(traindata);
 if (current_dataset->classno > 0)
  {
   safe_free(classcounts);
   safe_free(myarray);
  }
 safe_free(partition);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
movq 0x2d6ef5(%rip), %rdi    # 0x334e30
callq 0x2fa14
movl %eax, %ebp
movq 0x2d6ee7(%rip), %r12    # 0x334e30
movq 0x2d6ef0(%rip), %rdi    # 0x334e40
testq %rdi, %rdi
je 0x5df65
callq 0x2f616
movq $0x0, 0x2d6edb(%rip) # 0x334e40
movq 0x74904(%rip), %rax     # 0xd2870
cmpl $0x0, 0x10(%rax)
jle 0x5df92
movq 0x2d6eb7(%rip), %rdi    # 0x334e30
callq 0x116b3
movq %rax, %rbx
movq 0x2d6ea8(%rip), %rdi    # 0x334e30
callq 0x115e1
movq %rax, %r14
jmp 0x5df97
xorl %ebx, %ebx
xorl %r14d, %r14d
movq 0x748d2(%rip), %rax     # 0xd2870
movl 0x10(%rax), %edx
movq %rbx, %rdi
movl %ebp, %esi
movq %r14, %rcx
callq 0x2f14d
movq %rax, %r15
testq %r12, %r12
je 0x5e014
xorl %ecx, %ecx
leaq 0x2d6e81(%rip), %rdx    # 0x334e40
leaq 0x2d6e6a(%rip), %rsi    # 0x334e30
movq %r15, %rdi
xorl %eax, %eax
imull $0xcccccccd, (%rdi), %r8d # imm = 0xCCCCCCCD
addl $0x19999999, %r8d       # imm = 0x19999999
cmpl $0x33333333, %r8d       # imm = 0x33333333
movq %rcx, %r8
cmovbq %rax, %r8
movq %rsi, %r9
cmovbq %rdx, %r9
cmovbq %r12, %rax
cmovaeq %r12, %rcx
leaq 0x10(%r8), %r10
testq %r8, %r8
cmoveq %r9, %r10
movq %r12, (%r10)
movq 0x10(%r12), %r12
addq $0x4, %rdi
testq %r12, %r12
jne 0x5dfcb
jmp 0x5e018
xorl %eax, %eax
xorl %ecx, %ecx
testq %rcx, %rcx
je 0x5e025
movq $0x0, 0x10(%rcx)
testq %rax, %rax
je 0x5e032
movq $0x0, 0x10(%rax)
movq 0x2d6df7(%rip), %rdi    # 0x334e30
callq 0x2fa14
movq 0x7482b(%rip), %rcx     # 0xd2870
movl %eax, 0x1407124(%rcx)
cmpl $0x0, 0x10(%rcx)
jle 0x5e061
movq %r14, %rdi
callq 0x39194
movq %rbx, %rdi
callq 0x39194
movq %r15, %rdi
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
jmp 0x39194