// File: /workspace/github_c_makefile_star2_O2/olcaytaner[P]Isell/process.c
// Function: load_model
void** load_model(char* infile, int* modelcount, int* algorithm, Instanceptr* means, Instanceptr* variances)
{
 /*!Last Changed 05.08.2007 added QDACLASS algorithm*/
 /*!Last Changed 02.04.2007 added HMM algorithm*/
 /*!Last Changed 11.03.2006 added get_supervised_algorithm_index*/
 /*!Last Changed 19.12.2005*/
 FILE* modelfile;
 char datasetname[READLINELENGTH], algname[READLINELENGTH];
 void** result;
 int i, treecount;
 modelfile = fopen(infile, "r");
 if (!modelfile) 
   return NULL;
 fscanf(modelfile, "%s%s%d", datasetname, algname, modelcount);
 current_dataset = search_dataset(Datasets, datasetname);
 if (!current_dataset)
   return NULL;
 *algorithm = get_supervised_algorithm_index(algname);
 if (*algorithm == -1)
   return NULL;
 if (must_realize(*algorithm))
   exchange_classdefno(current_dataset);
 result = safemalloc((*modelcount) * sizeof(void *), "load_model", 15);
 if (must_normalize(*algorithm))
  {
   *means = safemalloc((*modelcount) * sizeof(Instance), "load_model", 18);
   *variances = safemalloc((*modelcount) * sizeof(Instance), "load_model", 19);
  }
 else
  {
   *means = NULL;
   *variances = NULL;
  }
 for (i = 0; i < (*modelcount); i++)
  {
   if (get_algorithm_type(*algorithm) == REGRESSION && get_parameter_o("normalizeoutput"))
     load_output_mean_and_variance(modelfile, &outputmean, &outputvariance);
   if (must_normalize(*algorithm))
    {
     if (must_realize(*algorithm))
      {
       (*means)[i] = load_instance(modelfile, current_dataset, BOOLEAN_FALSE);
       (*variances)[i] = load_instance(modelfile, current_dataset, BOOLEAN_FALSE);
      }
     else
      {
       (*means)[i] = load_instance_discrete(modelfile, current_dataset);
       (*variances)[i] = load_instance_discrete(modelfile, current_dataset);
      }
    }
   switch (*algorithm)
    {
     case SELECTMAX    :result[i] = load_model_selectmax(modelfile, current_dataset);
                        break;
     case ONEFEATURE   :result[i] = load_model_onefeature(modelfile, current_dataset);
                        break;
     case SELECTAVERAGE:result[i] = load_model_selectaverage(modelfile, current_dataset);
                        break;
     case GAUSSIAN     :result[i] = load_model_gaussian(modelfile, current_dataset); 
                        break;
     case NEARESTMEAN  :result[i] = load_model_nearestmean(modelfile, current_dataset); 
                        break;
     case LINEARREG    :result[i] = load_model_linearreg(modelfile, current_dataset); 
                        break;
     case QUANTIZEREG  :result[i] = load_model_quantizereg(modelfile, current_dataset); 
                        break;
     case KNN          :
     case KNNREG       :result[i] = load_model_knn(modelfile, current_dataset); 
                        break;
     case GPROCESSREG  :result[i] = load_model_knn(modelfile, current_dataset); 
                        break;
     case C45          :
     case LDT          :result[i] = safemalloc(sizeof(Decisionnode), "load_model", 30);
                        load_model_c45(modelfile, current_dataset, result[i]);
                        break;
     case SOFTTREE     :result[i] = safemalloc(sizeof(Decisionnode), "load_model", 32);
                        load_model_softtree(modelfile, current_dataset, result[i]);
                        break;
     case SVMTREE      :if (get_parameter_l("multiclasstype") == ONE_VS_ONE)
                          treecount = (current_dataset->classno * (current_dataset->classno - 1) / 2);
                        else
                          treecount = current_dataset->classno;
                        result[i] = safemalloc(treecount * sizeof(Decisionnodeptr), "load_model", 32);
                        load_model_svmtree(modelfile, current_dataset, result[i], treecount);
                        break;
     case RANDOMFOREST :treecount = get_parameter_i("forestsize");
                        load_model_randomforest(modelfile, current_dataset, result[i], treecount);
                        break;
     case SVMREGTREE   :
     case REGTREE      :
     case SOFTREGTREE  :result[i] = safemalloc(sizeof(Regressionnode), "load_model", 38);
                        load_model_regtree(modelfile, current_dataset, result[i]);
                        break;
     case REGRULE      :result[i] = load_model_regrule(modelfile, current_dataset);
                        break;
     case RISE         :result[i] = load_model_rise(modelfile, current_dataset);
                        break;
     case IREP         :
     case IREP2        :
     case C45RULES     :
     case RIPPER       :
     case MULTIRIPPER  :
     case REXRIPPER    :
     case CN2          :
     case LERILS       :
     case PART         :result[i] = load_model_ripper(modelfile, current_dataset);
                        break;
     case DIVS         :result[i] = load_model_divs(modelfile, current_dataset);
                        break;
     case NAIVEBAYES   :result[i] = load_model_naivebayes(modelfile, current_dataset);
                        break;
     case QDACLASS     :result[i] = load_model_qdaclass(modelfile, current_dataset);
                        break;
     case LDACLASS     :result[i] = load_model_ldaclass(modelfile, current_dataset);
                        break;
     case LOGISTIC     :result[i] = load_model_logistic(modelfile, current_dataset);
                        break;
     case RBF          :
     case RBFREG       :result[i] = load_model_rbf(modelfile, current_dataset);
                        break;
     case MLPGENERIC   :
     case MLPGENERICREG:
     case DNC          :
     case DNCREG       :result[i] = load_model_mlpgeneric(modelfile, current_dataset);
                        break;
     case MULTILDT     :
     case CART         :result[i] = load_model_multildt(modelfile, current_dataset);
                        break;
     case NBTREE       :result[i] = load_model_nodeboundedtree(modelfile, current_dataset);
                        break;
     case SVM          :
     case SVMREG       :result[i] = load_model_svm(modelfile, current_dataset);
                        break;
     case HMM          :result[i] = load_model_hmm(modelfile, current_dataset);                         
                        break;
     default           :safe_free(result);
                        return NULL;
    }
  }
 fclose(modelfile);
 return result;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0xf4298, %rsp          # imm = 0xF4298
movq %r8, 0x10(%rsp)
movq %rcx, 0x8(%rsp)
movq %rdx, %r15
movq %rsi, %r12
leaq 0x43dff(%rip), %rsi     # 0x9b87f
callq 0x40f0
testq %rax, %rax
je 0x57fe8
movq %rax, %r13
leaq 0x43ed1(%rip), %rsi     # 0x9b969
xorl %ebp, %ebp
leaq 0x7a170(%rsp), %rbx
leaq 0x50(%rsp), %rcx
movq %rax, %rdi
movq %rbx, %rdx
movq %r12, %r8
xorl %eax, %eax
callq 0x4070
movq 0x75dba(%rip), %rdi     # 0xcd878
movq %rbx, %rsi
callq 0x13da6
movq %rax, 0x75da3(%rip)     # 0xcd870
testq %rax, %rax
je 0x57fea
leaq 0x50(%rsp), %rdi
callq 0x4a3a
movl %eax, (%r15)
cmpl $-0x1, %eax
je 0x57fe8
movl %eax, %edi
callq 0x448a
testl %eax, %eax
je 0x57b03
movq 0x75d72(%rip), %rdi     # 0xcd870
callq 0x11d5c
movslq (%r12), %rdi
shlq $0x3, %rdi
leaq 0x43e5e(%rip), %rsi     # 0x9b970
pushq $0xf
popq %rdx
callq 0x34f59
movq %rax, %rbp
movl (%r15), %edi
callq 0x44cb
testl %eax, %eax
je 0x57b60
movslq (%r12), %rax
imulq $0x30, %rax, %rdi
leaq 0x43e38(%rip), %rbx     # 0x9b970
pushq $0x12
popq %rdx
movq %rbx, %rsi
callq 0x34f59
movq 0x8(%rsp), %rcx
movq %rax, (%rcx)
movslq (%r12), %rax
imulq $0x30, %rax, %rdi
pushq $0x13
popq %rdx
movq %rbx, %rsi
callq 0x34f59
jmp 0x57b6b
movq 0x8(%rsp), %rax
andq $0x0, (%rax)
xorl %eax, %eax
movq 0x10(%rsp), %rcx
movq %rax, (%rcx)
xorl %ebx, %ebx
xorl %r14d, %r14d
movq %r15, 0x18(%rsp)
movslq (%r12), %rax
cmpq %rax, %r14
jge 0x57fd6
movl (%r15), %edi
callq 0x445c
cmpl $0x1, %eax
jne 0x57bbd
leaq 0x43059(%rip), %rdi     # 0x9abf7
callq 0x4cff1
testl %eax, %eax
je 0x57bbd
movq %r13, %rdi
leaq 0x35245f(%rip), %rsi    # 0x3aa010
leaq 0x352460(%rip), %rdx    # 0x3aa018
callq 0x363c6
movl (%r15), %edi
callq 0x44cb
testl %eax, %eax
je 0x57ccd
movq %r14, (%rsp)
movq %r15, %rax
movq %rbp, %r15
movq %r12, %rbp
movl (%rax), %edi
callq 0x448a
movq 0x8(%rsp), %rcx
movq (%rcx), %r12
addq %rbx, %r12
testl %eax, %eax
movq %rbx, %r14
je 0x57c4a
movq 0x75c76(%rip), %rdx     # 0xcd870
leaq 0x20(%rsp), %rbx
movq %rbx, %rdi
movq %r13, %rsi
xorl %ecx, %ecx
callq 0x363da
movups 0x20(%rsp), %xmm0
movups 0x30(%rsp), %xmm1
movups 0x40(%rsp), %xmm2
movups %xmm2, 0x20(%r12)
movups %xmm1, 0x10(%r12)
movups %xmm0, (%r12)
movq 0x10(%rsp), %rax
movq (%rax), %r12
movq 0x75c35(%rip), %rdx     # 0xcd870
movq %rbx, %rdi
movq %r13, %rsi
xorl %ecx, %ecx
callq 0x363da
jmp 0x57c9b
movq 0x75c1f(%rip), %rdx     # 0xcd870
leaq 0x20(%rsp), %rbx
movq %rbx, %rdi
movq %r13, %rsi
callq 0x3647e
movups 0x20(%rsp), %xmm0
movups 0x30(%rsp), %xmm1
movups 0x40(%rsp), %xmm2
movups %xmm2, 0x20(%r12)
movups %xmm1, 0x10(%r12)
movups %xmm0, (%r12)
movq 0x10(%rsp), %rax
movq (%rax), %r12
movq 0x75be0(%rip), %rdx     # 0xcd870
movq %rbx, %rdi
movq %r13, %rsi
callq 0x3647e
movups 0x20(%rsp), %xmm0
movups 0x30(%rsp), %xmm1
movups 0x40(%rsp), %xmm2
movups %xmm2, 0x20(%r12,%r14)
movups %xmm1, 0x10(%r12,%r14)
movups %xmm0, (%r12,%r14)
movq %rbp, %r12
movq %r15, %rbp
movq 0x18(%rsp), %r15
movq %r14, %rbx
movq (%rsp), %r14
movl (%r15), %eax
leal -0x3e8(%rax), %ecx
cmpl $0x22, %ecx
ja 0x57cff
leaq 0x431b2(%rip), %rdx     # 0x9ae94
movslq (%rdx,%rcx,4), %rax
addq %rdx, %rax
jmpq *%rax
movq 0x75b7e(%rip), %rsi     # 0xcd870
movq %r13, %rdi
callq 0x374a8
jmp 0x57fc5
addl $0xfffff830, %eax       # imm = 0xFFFFF830
cmpl $0xe, %eax
ja 0x57fe0
leaq 0x4320c(%rip), %rcx     # 0x9af20
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
movl $0x98, %edi
leaq 0x43c47(%rip), %rsi     # 0x9b970
pushq $0x26
popq %rdx
callq 0x34f59
movq %rax, (%rbp,%r14,8)
movq 0x75b33(%rip), %rsi     # 0xcd870
movq %r13, %rdi
movq %rax, %rdx
callq 0x3797d
jmp 0x57fca
movq 0x75b1c(%rip), %rsi     # 0xcd870
movq %r13, %rdi
callq 0x36ad8
jmp 0x57fc5
movq 0x75b08(%rip), %rsi     # 0xcd870
movq %r13, %rdi
callq 0x36645
jmp 0x57fc5
movl $0x160, %edi            # imm = 0x160
leaq 0x43bef(%rip), %rsi     # 0x9b970
pushq $0x1e
popq %rdx
callq 0x34f59
movq %rax, (%rbp,%r14,8)
movq 0x75adb(%rip), %rsi     # 0xcd870
movq %r13, %rdi
movq %rax, %rdx
callq 0x36807
jmp 0x57fca
movq 0x75ac4(%rip), %rsi     # 0xcd870
movq %r13, %rdi
callq 0x36c0c
jmp 0x57fc5
movq 0x75ab0(%rip), %rsi     # 0xcd870
movq %r13, %rdi
callq 0x36a4c
jmp 0x57fc5
movq 0x75a9c(%rip), %rsi     # 0xcd870
movq %r13, %rdi
callq 0x371a7
jmp 0x57fc5
movq 0x75a88(%rip), %rsi     # 0xcd870
movq %r13, %rdi
callq 0x37670
jmp 0x57fc5
movl $0x160, %edi            # imm = 0x160
leaq 0x43b6f(%rip), %rsi     # 0x9b970
pushq $0x20
popq %rdx
callq 0x34f59
movq %rax, (%rbp,%r14,8)
movq 0x75a5b(%rip), %rsi     # 0xcd870
movq %r13, %rdi
movq %rax, %rdx
callq 0x366e9
jmp 0x57fca
movq 0x75a44(%rip), %rsi     # 0xcd870
movq %r13, %rdi
callq 0x36537
jmp 0x57fc5
movq 0x75a30(%rip), %rsi     # 0xcd870
movq %r13, %rdi
callq 0x3754f
jmp 0x57fc5
movq 0x75a1c(%rip), %rsi     # 0xcd870
movq %r13, %rdi
callq 0x36fdf
jmp 0x57fc5
movq 0x75a08(%rip), %rsi     # 0xcd870
movq %r13, %rdi
callq 0x37b7a
jmp 0x57fc5
movq 0x759f4(%rip), %rsi     # 0xcd870
movq %r13, %rdi
callq 0x370d7
jmp 0x57fc5
movq 0x759e0(%rip), %rsi     # 0xcd870
movq %r13, %rdi
callq 0x36e46
jmp 0x57fc5
movq 0x759cc(%rip), %rsi     # 0xcd870
movq %r13, %rdi
callq 0x36eda
jmp 0x57fc5
movq 0x759b8(%rip), %rsi     # 0xcd870
movq %r13, %rdi
callq 0x36a3c
jmp 0x57fc5
leaq 0x3d80a(%rip), %rdi     # 0x956d6
callq 0x4cd35
movq 0x75998(%rip), %rsi     # 0xcd870
movq (%rbp,%r14,8), %rdx
movq %r13, %rdi
movl %eax, %ecx
callq 0x36a37
jmp 0x57fca
leaq 0x3d7ee(%rip), %rdi     # 0x956e1
callq 0x4cf11
movl %eax, %ecx
movq 0x7596f(%rip), %rax     # 0xcd870
movl 0x10(%rax), %eax
testl %ecx, %ecx
jne 0x57f16
leal -0x1(%rax), %ecx
imull %eax, %ecx
movl %ecx, %eax
cltd
pushq $0x2
popq %rcx
idivl %ecx
cltq
movq %rax, (%rsp)
leaq (,%rax,8), %rdi
leaq 0x43a45(%rip), %rsi     # 0x9b970
pushq $0x20
popq %rdx
callq 0x34f59
movq %rax, (%rbp,%r14,8)
movq 0x75931(%rip), %rsi     # 0xcd870
movq %r13, %rdi
movq %rax, %rdx
movq (%rsp), %rcx
callq 0x369d7
jmp 0x57fca
movq 0x75919(%rip), %rsi     # 0xcd870
movq %r13, %rdi
callq 0x36cfe
jmp 0x57fc5
movq 0x75908(%rip), %rsi     # 0xcd870
movq %r13, %rdi
callq 0x36583
jmp 0x57fc5
movq 0x758f7(%rip), %rsi     # 0xcd870
movq %r13, %rdi
callq 0x378ba
jmp 0x57fc5
movq 0x758e6(%rip), %rsi     # 0xcd870
movq %r13, %rdi
callq 0x37fff
jmp 0x57fc5
movq 0x758d5(%rip), %rsi     # 0xcd870
movq %r13, %rdi
callq 0x37862
jmp 0x57fc5
movq 0x758c4(%rip), %rsi     # 0xcd870
movq %r13, %rdi
callq 0x37827
jmp 0x57fc5
movq 0x758b3(%rip), %rsi     # 0xcd870
movq %r13, %rdi
callq 0x377e0
movq %rax, (%rbp,%r14,8)
incq %r14
addq $0x30, %rbx
jmp 0x57b7d
movq %r13, %rdi
callq 0x42a0
jmp 0x57fea
movq %rbp, %rdi
callq 0x34ff7
xorl %ebp, %ebp
movq %rbp, %rax
addq $0xf4298, %rsp          # imm = 0xF4298
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq