// File: /workspace/github_c_makefile_star2_O1/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 $0xf42a8, %rsp          # imm = 0xF42A8
movq %r8, 0x10(%rsp)
movq %rcx, 0x8(%rsp)
movq %rdx, %r15
movq %rsi, %r12
leaq 0x49c73(%rip), %rsi     # 0xa888f
callq 0x40f0
testq %rax, %rax
je 0x5f199
movq %rax, %r13
leaq 0x49d45(%rip), %rsi     # 0xa8979
xorl %ebp, %ebp
leaq 0x7a180(%rsp), %rbx
leaq 0x60(%rsp), %rcx
movq %rax, %rdi
movq %rbx, %rdx
movq %r12, %r8
xorl %eax, %eax
callq 0x4070
movq 0x73c1e(%rip), %rdi     # 0xd2878
movq %rbx, %rsi
callq 0x14f16
movq %rax, 0x73c07(%rip)     # 0xd2870
testq %rax, %rax
je 0x5f19b
leaq 0x60(%rsp), %rdi
callq 0x4a5b
movl %eax, (%r15)
cmpl $-0x1, %eax
je 0x5f199
movl %eax, %edi
callq 0x4488
testl %eax, %eax
je 0x5ec9f
movq 0x73bd6(%rip), %rdi     # 0xd2870
callq 0x12cfc
movslq (%r12), %rdi
shlq $0x3, %rdi
leaq 0x49cd2(%rip), %rsi     # 0xa8980
movl $0xf, %edx
callq 0x390f5
movq %rax, %rbp
movl (%r15), %edi
callq 0x44c0
testl %eax, %eax
je 0x5ed0a
movslq (%r12), %rax
shlq $0x4, %rax
leaq (%rax,%rax,2), %rdi
leaq 0x49ca6(%rip), %rbx     # 0xa8980
movq %rbx, %rsi
movl $0x12, %edx
callq 0x390f5
movq 0x8(%rsp), %rcx
movq %rax, (%rcx)
movslq (%r12), %rax
shlq $0x4, %rax
leaq (%rax,%rax,2), %rdi
movq %rbx, %rsi
movl $0x13, %edx
callq 0x390f5
jmp 0x5ed18
movq 0x8(%rsp), %rax
movq $0x0, (%rax)
xorl %eax, %eax
movq 0x10(%rsp), %rcx
movq %rax, (%rcx)
cmpl $0x0, (%r12)
jle 0x5f187
xorl %r14d, %r14d
xorl %ebx, %ebx
movq %r15, 0x20(%rsp)
movq %rbp, 0x18(%rsp)
movl (%r15), %edi
callq 0x445c
cmpl $0x1, %eax
jne 0x5ed6d
leaq 0x48ec9(%rip), %rdi     # 0xa7c17
callq 0x536e7
testl %eax, %eax
je 0x5ed6d
movq %r13, %rdi
leaq 0x3502af(%rip), %rsi    # 0x3af010
leaq 0x3502b0(%rip), %rdx    # 0x3af018
callq 0x3a7b3
movl (%r15), %edi
callq 0x44c0
testl %eax, %eax
je 0x5ee6c
movq %r12, %rbp
movl (%r15), %edi
callq 0x4488
movq 0x8(%rsp), %rcx
movq (%rcx), %r12
addq %r14, %r12
testl %eax, %eax
je 0x5edee
movq 0x73ad2(%rip), %rdx     # 0xd2870
leaq 0x28(%rsp), %r15
movq %r15, %rdi
movq %r13, %rsi
xorl %ecx, %ecx
callq 0x3a7c7
movups 0x28(%rsp), %xmm0
movups 0x38(%rsp), %xmm1
movups 0x48(%rsp), %xmm2
movups %xmm2, 0x20(%r12)
movups %xmm1, 0x10(%r12)
movups %xmm0, (%r12)
movq 0x10(%rsp), %rax
movq (%rax), %r12
movq 0x73a91(%rip), %rdx     # 0xd2870
movq %r15, %rdi
movq %r13, %rsi
xorl %ecx, %ecx
callq 0x3a7c7
jmp 0x5ee3f
movq 0x73a7b(%rip), %rdx     # 0xd2870
leaq 0x28(%rsp), %r15
movq %r15, %rdi
movq %r13, %rsi
callq 0x3a86b
movups 0x28(%rsp), %xmm0
movups 0x38(%rsp), %xmm1
movups 0x48(%rsp), %xmm2
movups %xmm2, 0x20(%r12)
movups %xmm1, 0x10(%r12)
movups %xmm0, (%r12)
movq 0x10(%rsp), %rax
movq (%rax), %r12
movq 0x73a3c(%rip), %rdx     # 0xd2870
movq %r15, %rdi
movq %r13, %rsi
callq 0x3a86b
movups 0x28(%rsp), %xmm0
movups 0x38(%rsp), %xmm1
movups 0x48(%rsp), %xmm2
movups %xmm2, 0x20(%r12,%r14)
movups %xmm1, 0x10(%r12,%r14)
movups %xmm0, (%r12,%r14)
movq %rbp, %r12
movq 0x18(%rsp), %rbp
movq 0x20(%rsp), %r15
movl (%r15), %eax
leal -0x3e8(%rax), %ecx
cmpl $0x22, %ecx
ja 0x5ee9e
leaq 0x49023(%rip), %rdx     # 0xa7ea4
movslq (%rdx,%rcx,4), %rax
addq %rdx, %rax
jmpq *%rax
movq 0x739df(%rip), %rsi     # 0xd2870
movq %r13, %rdi
callq 0x3b996
jmp 0x5f16e
addl $0xfffff830, %eax       # imm = 0xFFFFF830
cmpl $0xe, %eax
ja 0x5f191
leaq 0x4907d(%rip), %rcx     # 0xa7f30
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
movl $0x98, %edi
leaq 0x49ab8(%rip), %rsi     # 0xa8980
movl $0x26, %edx
callq 0x390f5
movq %rax, (%rbp,%rbx,8)
movq 0x73992(%rip), %rsi     # 0xd2870
movq %r13, %rdi
movq %rax, %rdx
callq 0x3bf05
jmp 0x5f173
movq 0x7397b(%rip), %rsi     # 0xd2870
movq %r13, %rdi
callq 0x3af0c
jmp 0x5f16e
movq 0x73967(%rip), %rsi     # 0xd2870
movq %r13, %rdi
callq 0x3aa4b
jmp 0x5f16e
movl $0x160, %edi            # imm = 0x160
leaq 0x49a5e(%rip), %rsi     # 0xa8980
movl $0x1e, %edx
callq 0x390f5
movq %rax, (%rbp,%rbx,8)
movq 0x73938(%rip), %rsi     # 0xd2870
movq %r13, %rdi
movq %rax, %rdx
callq 0x3ac19
jmp 0x5f173
movq 0x73921(%rip), %rsi     # 0xd2870
movq %r13, %rdi
callq 0x3b06d
jmp 0x5f16e
movq 0x7390d(%rip), %rsi     # 0xd2870
movq %r13, %rdi
callq 0x3ae7e
jmp 0x5f16e
movq 0x738f9(%rip), %rsi     # 0xd2870
movq %r13, %rdi
callq 0x3b656
jmp 0x5f16e
movq 0x738e5(%rip), %rsi     # 0xd2870
movq %r13, %rdi
callq 0x3bb87
jmp 0x5f16e
movl $0x160, %edi            # imm = 0x160
leaq 0x499dc(%rip), %rsi     # 0xa8980
movl $0x20, %edx
callq 0x390f5
movq %rax, (%rbp,%rbx,8)
movq 0x738b6(%rip), %rsi     # 0xd2870
movq %r13, %rdi
movq %rax, %rdx
callq 0x3aaf4
jmp 0x5f173
movq 0x7389f(%rip), %rsi     # 0xd2870
movq %r13, %rdi
callq 0x3a932
jmp 0x5f16e
movq 0x7388b(%rip), %rsi     # 0xd2870
movq %r13, %rdi
callq 0x3ba4b
jmp 0x5f16e
movq 0x73877(%rip), %rsi     # 0xd2870
movq %r13, %rdi
callq 0x3b462
jmp 0x5f16e
movq 0x73863(%rip), %rsi     # 0xd2870
movq %r13, %rdi
callq 0x3c10b
jmp 0x5f16e
movq 0x7384f(%rip), %rsi     # 0xd2870
movq %r13, %rdi
callq 0x3b574
jmp 0x5f16e
movq 0x7383b(%rip), %rsi     # 0xd2870
movq %r13, %rdi
callq 0x3b2b7
jmp 0x5f16e
movq 0x73827(%rip), %rsi     # 0xd2870
movq %r13, %rdi
callq 0x3b34c
jmp 0x5f16e
movq 0x73813(%rip), %rsi     # 0xd2870
movq %r13, %rdi
callq 0x3ae6e
jmp 0x5f16e
leaq 0x43665(%rip), %rdi     # 0xa26d6
callq 0x5341c
movq 0x737f3(%rip), %rsi     # 0xd2870
movq (%rbp,%rbx,8), %rdx
movq %r13, %rdi
movl %eax, %ecx
callq 0x3ae69
jmp 0x5f173
leaq 0x43649(%rip), %rdi     # 0xa26e1
callq 0x535f7
movq 0x737cc(%rip), %rcx     # 0xd2870
movl 0x10(%rcx), %ecx
testl %eax, %eax
jne 0x5f0ba
leal -0x1(%rcx), %eax
imull %ecx, %eax
movl %eax, %ecx
shrl $0x1f, %ecx
addl %eax, %ecx
sarl %ecx
movslq %ecx, %rax
movq %rax, 0x58(%rsp)
leaq (,%rax,8), %rdi
leaq 0x498af(%rip), %rsi     # 0xa8980
movl $0x20, %edx
callq 0x390f5
movq %rax, (%rbp,%rbx,8)
movq 0x73789(%rip), %rsi     # 0xd2870
movq %r13, %rdi
movq %rax, %rdx
movq 0x58(%rsp), %rcx
callq 0x3ae0a
jmp 0x5f173
movq 0x73770(%rip), %rsi     # 0xd2870
movq %r13, %rdi
callq 0x3b166
jmp 0x5f16e
movq 0x7375f(%rip), %rsi     # 0xd2870
movq %r13, %rdi
callq 0x3a982
jmp 0x5f16e
movq 0x7374e(%rip), %rsi     # 0xd2870
movq %r13, %rdi
callq 0x3be39
jmp 0x5f16e
movq 0x7373d(%rip), %rsi     # 0xd2870
movq %r13, %rdi
callq 0x3c5e6
jmp 0x5f16e
movq 0x7372c(%rip), %rsi     # 0xd2870
movq %r13, %rdi
callq 0x3bddb
jmp 0x5f16e
movq 0x7371b(%rip), %rsi     # 0xd2870
movq %r13, %rdi
callq 0x3bd9c
jmp 0x5f16e
movq 0x7370a(%rip), %rsi     # 0xd2870
movq %r13, %rdi
callq 0x3bd51
movq %rax, (%rbp,%rbx,8)
incq %rbx
movslq (%r12), %rax
addq $0x30, %r14
cmpq %rax, %rbx
jl 0x5ed3a
movq %r13, %rdi
callq 0x42a0
jmp 0x5f19b
movq %rbp, %rdi
callq 0x39194
xorl %ebp, %ebp
movq %rbp, %rax
addq $0xf42a8, %rsp          # imm = 0xF42A8
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq