// File: /workspace/github_c_makefile_star2_O2/olcaytaner[P]Isell/multivariatetree.c
// Function: make_multivariate_children
int make_multivariate_children(Decisionnodeptr node)
{
 /*!Last Changed 04.10.2004 added rules*/
 /*!Last Changed 26.09.2004 added parent*/
 /*!Last Changed 21.09.2004*/
 Instanceptr inst, leftbefore=NULL, rightbefore=NULL;
 Decisionnodeptr left, right;
 double value, threshold;
 Decisioncondition ruleleft, ruleright;
 if (node->featureno == LEAF_NODE || node->instances == NULL)
  {
   if (in_list(node->featureno, 2, LINEAR, QUADRATIC))
     matrix_free(node->w);
   make_leaf_node(node);
   return 0;
  }
 left = createnewnode(node, 1);
 right = createnewnode(node, 1);
 node->string = NULL;
 node->left = left;
 node->right = right;
 inst = node->instances;
 if (node->conditiontype != HYBRID_CONDITION)
   node->featureno = LINEAR;
 if (in_list(node->featureno, 2, LINEAR, QUADRATIC))
  {
   ruleleft = createmultivariatecondition(node->w, node->w0, '<', node->featureno);
   ruleright = createmultivariatecondition(node->w, node->w0, '>', node->featureno);
  }
 else
  {
   ruleleft = createcondition(node->featureno, '<', node->split);
   ruleright = createcondition(node->featureno, '>', node->split);
  }
 addcondition(node->left, ruleleft);
 addcondition(node->right, ruleright);
 while (inst)
  {
   if (in_list(node->featureno, 2, LINEAR, QUADRATIC))
    {
     value = multiply_with_matrix(inst, node->w);
     threshold = node->w0;
    }
   else
    {
     value = real_feature(inst, node->featureno);
     threshold = node->split;
    }
   if (value <= threshold)
    {
     if (leftbefore)
       leftbefore->next = inst;
     else
       left->instances = inst;
     leftbefore = inst;
    }
   else
    {
     if (rightbefore)
       rightbefore->next = inst;
     else
       right->instances = inst;
     rightbefore = inst;
    }
   inst = inst->next;
  }
 if (leftbefore)
   leftbefore->next = NULL;
 if (rightbefore)
   rightbefore->next = NULL;
 node->instances = NULL;
 return 1;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x168, %rsp            # imm = 0x168
movq %rdi, %rbx
movl 0x30(%rdi), %edi
cmpl $-0x1, %edi
je 0x46992
cmpq $0x0, 0x20(%rbx)
je 0x46992
pushq $0x1
popq %rbp
movq %rbx, %rdi
movl %ebp, %esi
callq 0x1ac98
movq %rax, %r14
movq %rbx, %rdi
movl %ebp, %esi
callq 0x1ac98
andq $0x0, 0x10(%rbx)
movq %r14, 0x80(%rsp)
movq %r14, (%rbx)
movq %rax, 0x78(%rsp)
movq %rax, 0x8(%rbx)
cmpl $0x2, 0x98(%rbx)
jne 0x469c2
movl 0x30(%rbx), %edi
jmp 0x469cc
xorl %ebp, %ebp
pushq $0x2
popq %rsi
pushq $-0x2
popq %rdx
pushq $-0x3
popq %rcx
xorl %eax, %eax
callq 0x35812
testl %eax, %eax
je 0x469b5
movq 0x38(%rbx), %rdi
movq 0x40(%rbx), %rsi
callq 0x3929f
movq %rbx, %rdi
callq 0x1a6ac
jmp 0x46ba4
movl $0xfffffffe, 0x30(%rbx) # imm = 0xFFFFFFFE
pushq $-0x2
popq %rdi
movq 0x20(%rbx), %r12
pushq $0x2
popq %rsi
pushq $-0x2
popq %rdx
pushq $-0x3
popq %rcx
xorl %eax, %eax
callq 0x35812
testl %eax, %eax
je 0x46a7c
movsd 0x48(%rbx), %xmm0
movsd %xmm0, 0x70(%rsp)
movl 0x30(%rbx), %ebp
movq 0x38(%rbx), %rdi
movq 0x40(%rbx), %rsi
callq 0x383f4
movl %ebp, 0xf8(%rsp)
movb $0x3c, 0xfc(%rsp)
movq %rax, 0x118(%rsp)
movq %rdx, 0x120(%rsp)
movsd 0x70(%rsp), %xmm0
movsd %xmm0, 0x128(%rsp)
movsd 0x48(%rbx), %xmm0
movsd %xmm0, 0x70(%rsp)
movl 0x30(%rbx), %ebp
movq 0x38(%rbx), %rdi
movq 0x40(%rbx), %rsi
callq 0x383f4
movl %ebp, 0x88(%rsp)
movb $0x3e, 0x8c(%rsp)
movq %rax, 0xa8(%rsp)
movq %rdx, 0xb0(%rsp)
movsd 0x70(%rsp), %xmm0
movsd %xmm0, 0xb8(%rsp)
jmp 0x46aac
movl 0x30(%rbx), %esi
movsd 0x28(%rbx), %xmm0
leaq 0xf8(%rsp), %rdi
pushq $0x3c
popq %rdx
callq 0x9087a
movl 0x30(%rbx), %esi
movsd 0x28(%rbx), %xmm0
leaq 0x88(%rsp), %rdi
pushq $0x3e
popq %rdx
callq 0x9087a
movq (%rbx), %rax
pushq $0xe
popq %r14
leaq 0xf8(%rsp), %rsi
movq %r14, %rcx
movq %rsp, %rdi
rep  movsq (%rsi), %es:(%rdi)
movq %rax, %rdi
callq 0x1ac58
movq 0x8(%rbx), %rax
leaq 0x88(%rsp), %rsi
movq %r14, %rcx
movq %rsp, %rdi
rep  movsq (%rsi), %es:(%rdi)
movq %rax, %rdi
callq 0x1ac58
leaq 0x48(%rbx), %r13
leaq 0x28(%rbx), %rax
movq %rax, 0x70(%rsp)
pushq $-0x3
popq %r14
xorl %ebp, %ebp
xorl %r15d, %r15d
testq %r12, %r12
je 0x46b88
movl 0x30(%rbx), %edi
pushq $0x2
popq %rsi
pushq $-0x2
popq %rdx
movl %r14d, %ecx
xorl %eax, %eax
callq 0x35812
testl %eax, %eax
je 0x46b34
movq 0x38(%rbx), %rsi
movq 0x40(%rbx), %rdx
movq %r12, %rdi
callq 0x2b0c0
movq %r13, %rax
jmp 0x46b44
movl 0x30(%rbx), %esi
movq %r12, %rdi
callq 0x2aea2
movq 0x70(%rsp), %rax
movsd (%rax), %xmm1
ucomisd %xmm0, %xmm1
movq 0x80(%rsp), %rax
cmovbq 0x78(%rsp), %rax
movq %r12, %rcx
cmovbq %rbp, %rcx
cmovbq %r15, %rbp
cmovbq %r12, %r15
addq $0x20, %rax
leaq 0x10(%rbp), %rdx
testq %rbp, %rbp
cmoveq %rax, %rdx
movq %r12, (%rdx)
movq 0x10(%r12), %r12
movq %rcx, %rbp
jmp 0x46aff
testq %rbp, %rbp
je 0x46b92
andq $0x0, 0x10(%rbp)
testq %r15, %r15
je 0x46b9c
andq $0x0, 0x10(%r15)
andq $0x0, 0x20(%rbx)
pushq $0x1
popq %rbp
movl %ebp, %eax
addq $0x168, %rsp            # imm = 0x168
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq