// File: /workspace/github_c_makefile_star2_O2/olcaytaner[P]Isell/savemodel.c
// Function: save_model_regtree
void save_model_regtree(FILE* modelfile, Datasetptr d, Regressionnodeptr m, int level)
{
 /*Last Changed 29.05.2006*/
 char pst[READLINELENGTH];
 int i, size;
 for (i = 0; i < level; i++)
   fprintf(modelfile, "  ");
 set_precision(pst, NULL, "\n"); 
 fprintf(modelfile, "%d ", m->featureno);
 if (m->featureno == LEAF_NODE)
  {
   size = data_size(m->instances);
   fprintf(modelfile, "%d ", m->leaftype);
   if (m->leaftype == CONSTANTLEAF)
     fprintf(modelfile, pst, m->regressionvalue);   
   else
     save_matrix(modelfile, m->w);   
  }
 else
  {
   if (m->featureno >= 0)
     fprintf(modelfile, pst, m->split);   
   else
     if (m->featureno == LINEAR)
      {
       save_instance(modelfile, d, m->leftcenter, BOOLEAN_FALSE);
       save_instance(modelfile, d, m->rightcenter, BOOLEAN_FALSE);
      }
     else
       if (m->featureno == QUADRATIC)
        {
         save_instance_2d(modelfile, d, m->leftcenter, BOOLEAN_FALSE);
         save_instance_2d(modelfile, d, m->rightcenter, BOOLEAN_FALSE);
        }
       else
         if (m->featureno == SOFTLIN)
           save_matrix(modelfile, m->w);
   save_model_regtree(modelfile, d, m->left, level + 1);
   save_model_regtree(modelfile, d, m->right, level + 1);
  } 
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x7a138, %rsp          # imm = 0x7A138
movq %rdx, %r14
movq %rsi, 0x8(%rsp)
xorl %ebp, %ebp
testl %ecx, %ecx
movl %ecx, 0x4(%rsp)
cmovgl %ecx, %ebp
movq %rdi, %rbx
leaq 0x253c8(%rip), %r12     # 0xa0d70
pushq $0x2
popq %r13
pushq $0x1
popq %r15
subl $0x1, %ebp
jb 0x7b9c8
movq %r12, %rdi
movq %r13, %rsi
movq %r15, %rdx
movq %rbx, %rcx
callq 0x42c0
jmp 0x7b9b0
leaq 0x1d73c(%rip), %rdx     # 0x9910b
leaq 0x10(%rsp), %rdi
xorl %esi, %esi
callq 0x35305
movl 0x68(%r14), %edx
leaq 0x242d2(%rip), %rsi     # 0x9fcb8
movq %rbx, %rdi
xorl %eax, %eax
callq 0x42e0
movl 0x68(%r14), %eax
cmpl $-0x1, %eax
je 0x7ba43
testl %eax, %eax
js 0x7ba7a
movsd 0x50(%r14), %xmm0
leaq 0x10(%rsp), %rsi
movq %rbx, %rdi
movb $0x1, %al
callq 0x42e0
movq 0x8(%rsp), %r15
movq (%r14), %rdx
movl 0x4(%rsp), %ebp
incl %ebp
movq %rbx, %rdi
movq %r15, %rsi
movl %ebp, %ecx
callq 0x7b97a
movq 0x8(%r14), %rdx
movq %rbx, %rdi
movq %r15, %rsi
movl %ebp, %ecx
callq 0x7b97a
jmp 0x7bad0
movq 0x20(%r14), %rdi
callq 0x2c3cc
movl 0x6c(%r14), %edx
leaq 0x24261(%rip), %rsi     # 0x9fcb8
movq %rbx, %rdi
xorl %eax, %eax
callq 0x42e0
cmpl $0x0, 0x6c(%r14)
je 0x7babb
movq 0x30(%r14), %rsi
movq 0x38(%r14), %rdx
movq %rbx, %rdi
callq 0x7a484
jmp 0x7bad0
cmpl $-0x6, %eax
movq 0x8(%rsp), %r15
je 0x7bb0b
cmpl $-0x3, %eax
je 0x7bae2
cmpl $-0x2, %eax
jne 0x7ba17
movq 0x80(%r14), %rdx
movq %rbx, %rdi
movq %r15, %rsi
callq 0x7a756
movq 0x88(%r14), %rdx
movq %rbx, %rdi
movq %r15, %rsi
callq 0x7a756
jmp 0x7ba17
movsd 0x70(%r14), %xmm0
leaq 0x10(%rsp), %rsi
movq %rbx, %rdi
movb $0x1, %al
callq 0x42e0
addq $0x7a138, %rsp          # imm = 0x7A138
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq 0x80(%r14), %rdx
movq %rbx, %rdi
movq %r15, %rsi
callq 0x7a7f8
movq 0x88(%r14), %rdx
movq %rbx, %rdi
movq %r15, %rsi
callq 0x7a7f8
jmp 0x7ba17
movq 0x30(%r14), %rsi
movq 0x38(%r14), %rdx
movq %rbx, %rdi
callq 0x7a484
jmp 0x7ba17