// File: /workspace/github_c_makefile_star2_O3/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 0x4dbc4
cmpq $0x0, 0x20(%rbx)
je 0x4dbc4
movq %rbx, %rdi
movl $0x1, %esi
callq 0x1d107
movq %rax, %r14
movq %rbx, %rdi
movl $0x1, %esi
callq 0x1d107
movq %rax, %r15
movq $0x0, 0x10(%rbx)
movq %r14, 0x80(%rsp)
movq %r14, (%rbx)
movq %rax, 0x8(%rbx)
cmpl $0x2, 0x98(%rbx)
jne 0x4dbfa
movl 0x30(%rbx), %edi
jmp 0x4dc06
xorl %ebp, %ebp
movl $0x2, %esi
movl $0xfffffffe, %edx       # imm = 0xFFFFFFFE
movl $0xfffffffd, %ecx       # imm = 0xFFFFFFFD
xorl %eax, %eax
callq 0x3aa8c
testl %eax, %eax
je 0x4dbed
movq 0x38(%rbx), %rdi
movq 0x40(%rbx), %rsi
callq 0x3ed51
movq %rbx, %rdi
callq 0x1cab0
jmp 0x4ddf8
movl $0xfffffffe, 0x30(%rbx) # imm = 0xFFFFFFFE
movl $0xfffffffe, %edi       # imm = 0xFFFFFFFE
movq 0x20(%rbx), %r12
movl $0x2, %esi
movl $0xfffffffe, %edx       # imm = 0xFFFFFFFE
movl $0xfffffffd, %ecx       # imm = 0xFFFFFFFD
xorl %eax, %eax
callq 0x3aa8c
testl %eax, %eax
je 0x4dcbc
movsd 0x48(%rbx), %xmm0
movsd %xmm0, 0x78(%rsp)
movl 0x30(%rbx), %ebp
movq 0x38(%rbx), %rdi
movq 0x40(%rbx), %rsi
callq 0x3dae3
movl %ebp, 0xf8(%rsp)
movb $0x3c, 0xfc(%rsp)
movq %rax, 0x118(%rsp)
movq %rdx, 0x120(%rsp)
movsd 0x78(%rsp), %xmm0
movsd %xmm0, 0x128(%rsp)
movsd 0x48(%rbx), %xmm0
movsd %xmm0, 0x78(%rsp)
movl 0x30(%rbx), %ebp
movq 0x38(%rbx), %rdi
movq 0x40(%rbx), %rsi
callq 0x3dae3
movl %ebp, 0x88(%rsp)
movb $0x3e, 0x8c(%rsp)
movq %rax, 0xa8(%rsp)
movq %rdx, 0xb0(%rsp)
movsd 0x78(%rsp), %xmm0
movsd %xmm0, 0xb8(%rsp)
jmp 0x4dcf0
movl 0x30(%rbx), %esi
movsd 0x28(%rbx), %xmm0
leaq 0xf8(%rsp), %rdi
movl $0x3c, %edx
callq 0x9fc56
movl 0x30(%rbx), %esi
movsd 0x28(%rbx), %xmm0
leaq 0x88(%rsp), %rdi
movl $0x3e, %edx
callq 0x9fc56
movq (%rbx), %rax
leaq 0xf8(%rsp), %rsi
movl $0xe, %ecx
movq %rsp, %rdi
rep  movsq (%rsi), %es:(%rdi)
movq %rax, %rdi
callq 0x1d0c5
movq 0x8(%rbx), %rax
leaq 0x88(%rsp), %rsi
movl $0xe, %ecx
movq %rsp, %rdi
rep  movsq (%rsi), %es:(%rdi)
movq %rax, %rdi
callq 0x1d0c5
testq %r12, %r12
je 0x4ddeb
leaq 0x48(%rbx), %rbp
leaq 0x28(%rbx), %rax
movq %rax, 0x78(%rsp)
xorl %r13d, %r13d
xorl %r14d, %r14d
movl 0x30(%rbx), %edi
movl $0x2, %esi
movl $0xfffffffe, %edx       # imm = 0xFFFFFFFE
movl $0xfffffffd, %ecx       # imm = 0xFFFFFFFD
xorl %eax, %eax
callq 0x3aa8c
testl %eax, %eax
je 0x4dd7b
movq 0x38(%rbx), %rsi
movq 0x40(%rbx), %rdx
movq %r12, %rdi
callq 0x2efa4
movq %rbp, %rax
jmp 0x4dd8b
movl 0x30(%rbx), %esi
movq %r12, %rdi
callq 0x2ed6a
movq 0x78(%rsp), %rax
movsd (%rax), %xmm1
ucomisd %xmm0, %xmm1
movq 0x80(%rsp), %rcx
cmovbq %r15, %rcx
movq %r12, %rax
cmovbq %r14, %rax
cmovbq %r13, %r14
cmovbq %r12, %r13
addq $0x20, %rcx
leaq 0x10(%r14), %rdx
testq %r14, %r14
cmoveq %rcx, %rdx
movq %r12, (%rdx)
movq 0x10(%r12), %r12
movq %rax, %r14
testq %r12, %r12
jne 0x4dd49
testq %rax, %rax
je 0x4ddde
movq $0x0, 0x10(%rax)
testq %r13, %r13
je 0x4ddeb
movq $0x0, 0x10(%r13)
movq $0x0, 0x20(%rbx)
movl $0x1, %ebp
movl %ebp, %eax
addq $0x168, %rsp            # imm = 0x168
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq