// File: /workspace/github_c_makefile_star2_O0/olcaytaner[P]Isell/instancelist.c
// Function: divide_instancelist
void divide_instancelist(Instanceptr* parentlist, Instanceptr* list1, Instanceptr* list2, int mod)
{
 /*!Last Changed 28.10.2005 called find_classes and find_class_counts*/
 /*!Last Changed 24.03.2005*/
 /*!Last Changed 02.02.2004 added safemalloc*/
 /*!Last Changed 23.11.2003*/
 /*!Last Changed 10.05.2003*/
 int i = 0, *classes = NULL, *classcounts = NULL, *partition;
 Instanceptr ptmp, pnext, next1 = NULL, next2 = NULL;
 if (current_dataset->classno > 0)
  {
   classes = find_classes(*parentlist);
   classcounts = find_class_counts(*parentlist);
  }
 partition = stratified_partition(classes, data_size(*parentlist), current_dataset->classno, classcounts);
 i = 0;
 ptmp = (*parentlist);
 while (ptmp)
  {
   pnext = ptmp->next;
   if (partition[i] % mod == (mod - 1))
    {
     if (!next1)
       *list1 = ptmp;
     else
       next1->next = ptmp;
     next1 = ptmp;
    }
   else
    {
     if (!next2)
       *list2 = ptmp;
     else
       next2->next = ptmp;
     next2 = ptmp;
    }
   ptmp = pnext;
   i++;
  }
 if (next1)
   next1->next = NULL;
 if (next2)
   next2->next = NULL;
 (*parentlist) = NULL;
 if (current_dataset->classno > 0)
  {
   safe_free(classcounts);
   safe_free(classes);
  }
 safe_free(partition);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x60, %rsp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq %rdx, -0x18(%rbp)
movl %ecx, -0x1c(%rbp)
movl $0x0, -0x20(%rbp)
movq $0x0, -0x28(%rbp)
movq $0x0, -0x30(%rbp)
movq $0x0, -0x50(%rbp)
movq $0x0, -0x58(%rbp)
leaq 0xbf89b(%rip), %rax     # 0x105840
movq (%rax), %rax
cmpl $0x0, 0x10(%rax)
jle 0x45fce
movq -0x8(%rbp), %rax
movq (%rax), %rdi
callq 0x18500
movq %rax, -0x28(%rbp)
movq -0x8(%rbp), %rax
movq (%rax), %rdi
callq 0x183a0
movq %rax, -0x30(%rbp)
movq -0x28(%rbp), %rax
movq %rax, -0x60(%rbp)
movq -0x8(%rbp), %rax
movq (%rax), %rdi
callq 0x449f0
movq -0x60(%rbp), %rdi
movl %eax, %esi
leaq 0xbf851(%rip), %rax     # 0x105840
movq (%rax), %rax
movl 0x10(%rax), %edx
movq -0x30(%rbp), %rcx
callq 0x43d20
movq %rax, -0x38(%rbp)
movl $0x0, -0x20(%rbp)
movq -0x8(%rbp), %rax
movq (%rax), %rax
movq %rax, -0x40(%rbp)
cmpq $0x0, -0x40(%rbp)
je 0x460ac
movq -0x40(%rbp), %rax
movq 0x10(%rax), %rax
movq %rax, -0x48(%rbp)
movq -0x38(%rbp), %rax
movslq -0x20(%rbp), %rcx
movl (%rax,%rcx,4), %eax
cltd
idivl -0x1c(%rbp)
movl -0x1c(%rbp), %eax
subl $0x1, %eax
cmpl %eax, %edx
jne 0x4606e
cmpq $0x0, -0x50(%rbp)
jne 0x46058
movq -0x40(%rbp), %rcx
movq -0x10(%rbp), %rax
movq %rcx, (%rax)
jmp 0x46064
movq -0x40(%rbp), %rcx
movq -0x50(%rbp), %rax
movq %rcx, 0x10(%rax)
movq -0x40(%rbp), %rax
movq %rax, -0x50(%rbp)
jmp 0x46096
cmpq $0x0, -0x58(%rbp)
jne 0x46082
movq -0x40(%rbp), %rcx
movq -0x18(%rbp), %rax
movq %rcx, (%rax)
jmp 0x4608e
movq -0x40(%rbp), %rcx
movq -0x58(%rbp), %rax
movq %rcx, 0x10(%rax)
movq -0x40(%rbp), %rax
movq %rax, -0x58(%rbp)
movq -0x48(%rbp), %rax
movq %rax, -0x40(%rbp)
movl -0x20(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x20(%rbp)
jmp 0x46014
cmpq $0x0, -0x50(%rbp)
je 0x460bf
movq -0x50(%rbp), %rax
movq $0x0, 0x10(%rax)
cmpq $0x0, -0x58(%rbp)
je 0x460d2
movq -0x58(%rbp), %rax
movq $0x0, 0x10(%rax)
movq -0x8(%rbp), %rax
movq $0x0, (%rax)
leaq 0xbf75c(%rip), %rax     # 0x105840
movq (%rax), %rax
cmpl $0x0, 0x10(%rax)
jle 0x460ff
movq -0x30(%rbp), %rdi
callq 0x52e80
movq -0x28(%rbp), %rdi
callq 0x52e80
movq -0x38(%rbp), %rdi
callq 0x52e80
addq $0x60, %rsp
popq %rbp
retq
nop