// File: /workspace/github_c_makefile_star2_O3/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 0x2d88f1(%rip), %rdi    # 0x337e30
callq 0x30309
movl %eax, %ebp
movq 0x2d88e3(%rip), %r12    # 0x337e30
movq 0x2d88ec(%rip), %rdi    # 0x337e40
testq %rdi, %rdi
je 0x5f569
callq 0x2ff55
movq $0x0, 0x2d88d7(%rip) # 0x337e40
movq 0x76300(%rip), %rax     # 0xd5870
movl 0x10(%rax), %edx
testl %edx, %edx
jle 0x5f5a1
movq 0x2d88b2(%rip), %rdi    # 0x337e30
callq 0x11678
movq %rax, %rbx
movq 0x2d88a3(%rip), %rdi    # 0x337e30
callq 0x115a6
movq %rax, %r14
movq 0x762d4(%rip), %rax     # 0xd5870
movl 0x10(%rax), %edx
jmp 0x5f5a6
xorl %ebx, %ebx
xorl %r14d, %r14d
movq %rbx, %rdi
movl %ebp, %esi
movq %r14, %rcx
callq 0x2f9b1
movq %rax, %r15
testq %r12, %r12
je 0x5f631
xorl %eax, %eax
leaq 0x2d887c(%rip), %rdx    # 0x337e40
leaq 0x2d8865(%rip), %rsi    # 0x337e30
movq %r15, %rdi
xorl %ecx, %ecx
imull $0xcccccccd, (%rdi), %r8d # imm = 0xCCCCCCCD
addl $0x19999999, %r8d       # imm = 0x19999999
cmpl $0x33333333, %r8d       # imm = 0x33333333
movq %rax, %r8
cmovbq %rcx, %r8
movq %rsi, %r9
cmovbq %rdx, %r9
cmovbq %r12, %rcx
cmovaeq %r12, %rax
leaq 0x10(%r8), %r10
testq %r8, %r8
cmoveq %r9, %r10
movq %r12, (%r10)
movq 0x10(%r12), %r12
addq $0x4, %rdi
testq %r12, %r12
jne 0x5f5d0
testq %rax, %rax
je 0x5f624
movq $0x0, 0x10(%rax)
testq %rcx, %rcx
je 0x5f631
movq $0x0, 0x10(%rcx)
movq 0x2d87f8(%rip), %rdi    # 0x337e30
callq 0x30309
movq 0x7622c(%rip), %rcx     # 0xd5870
movl %eax, 0x1407124(%rcx)
cmpl $0x0, 0x10(%rcx)
jle 0x5f660
movq %r14, %rdi
callq 0x3a180
movq %rbx, %rdi
callq 0x3a180
movq %r15, %rdi
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
jmp 0x3a180