// File: /workspace/github_c_makefile_star2_O3/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 0x4b645(%rip), %rsi     # 0xab95b
callq 0x40f0
testq %rax, %rax
je 0x60893
movq %rax, %r13
leaq 0x4b717(%rip), %rsi     # 0xaba45
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 0x75524(%rip), %rdi     # 0xd5878
movq %rbx, %rsi
callq 0x14fb7
movq %rax, 0x7550d(%rip)     # 0xd5870
testq %rax, %rax
je 0x60895
leaq 0x60(%rsp), %rdi
callq 0x4a41
movl %eax, (%r15)
cmpl $-0x1, %eax
je 0x60893
movl %eax, %edi
callq 0x4488
testl %eax, %eax
je 0x60399
movq 0x754dc(%rip), %rdi     # 0xd5870
callq 0x12c28
movslq (%r12), %rdi
shlq $0x3, %rdi
leaq 0x4b6a4(%rip), %rsi     # 0xaba4c
movl $0xf, %edx
callq 0x3a0e1
movq %rax, %rbp
movl (%r15), %edi
callq 0x44c0
testl %eax, %eax
je 0x60404
movslq (%r12), %rax
shlq $0x4, %rax
leaq (%rax,%rax,2), %rdi
leaq 0x4b678(%rip), %rbx     # 0xaba4c
movq %rbx, %rsi
movl $0x12, %edx
callq 0x3a0e1
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 0x3a0e1
jmp 0x60412
movq 0x8(%rsp), %rax
movq $0x0, (%rax)
xorl %eax, %eax
movq 0x10(%rsp), %rcx
movq %rax, (%rcx)
cmpl $0x0, (%r12)
jle 0x60881
xorl %r14d, %r14d
xorl %ebx, %ebx
movq %r15, 0x20(%rsp)
movq %rbp, 0x18(%rsp)
movl (%r15), %edi
callq 0x445c
cmpl $0x1, %eax
jne 0x60467
leaq 0x4a87f(%rip), %rdi     # 0xaacc7
callq 0x54bec
testl %eax, %eax
je 0x60467
movq %r13, %rdi
leaq 0x351bb5(%rip), %rsi    # 0x3b2010
leaq 0x351bb6(%rip), %rdx    # 0x3b2018
callq 0x3b843
movl (%r15), %edi
callq 0x44c0
testl %eax, %eax
je 0x60566
movq %r12, %rbp
movl (%r15), %edi
callq 0x4488
movq 0x8(%rsp), %rcx
movq (%rcx), %r12
addq %r14, %r12
testl %eax, %eax
je 0x604e8
movq 0x753d8(%rip), %rdx     # 0xd5870
leaq 0x28(%rsp), %r15
movq %r15, %rdi
movq %r13, %rsi
xorl %ecx, %ecx
callq 0x3b857
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 0x75397(%rip), %rdx     # 0xd5870
movq %r15, %rdi
movq %r13, %rsi
xorl %ecx, %ecx
callq 0x3b857
jmp 0x60539
movq 0x75381(%rip), %rdx     # 0xd5870
leaq 0x28(%rsp), %r15
movq %r15, %rdi
movq %r13, %rsi
callq 0x3b8fb
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 0x75342(%rip), %rdx     # 0xd5870
movq %r15, %rdi
movq %r13, %rsi
callq 0x3b8fb
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 0x60598
leaq 0x4a9e1(%rip), %rdx     # 0xaaf5c
movslq (%rdx,%rcx,4), %rax
addq %rdx, %rax
jmpq *%rax
movq 0x752e5(%rip), %rsi     # 0xd5870
movq %r13, %rdi
callq 0x3ca24
jmp 0x60868
addl $0xfffff830, %eax       # imm = 0xFFFFF830
cmpl $0xe, %eax
ja 0x6088b
leaq 0x4aa3b(%rip), %rcx     # 0xaafe8
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
movl $0x98, %edi
leaq 0x4b48a(%rip), %rsi     # 0xaba4c
movl $0x26, %edx
callq 0x3a0e1
movq %rax, (%rbp,%rbx,8)
movq 0x75298(%rip), %rsi     # 0xd5870
movq %r13, %rdi
movq %rax, %rdx
callq 0x3cfa5
jmp 0x6086d
movq 0x75281(%rip), %rsi     # 0xd5870
movq %r13, %rdi
callq 0x3bf9c
jmp 0x60868
movq 0x7526d(%rip), %rsi     # 0xd5870
movq %r13, %rdi
callq 0x3badb
jmp 0x60868
movl $0x160, %edi            # imm = 0x160
leaq 0x4b430(%rip), %rsi     # 0xaba4c
movl $0x1e, %edx
callq 0x3a0e1
movq %rax, (%rbp,%rbx,8)
movq 0x7523e(%rip), %rsi     # 0xd5870
movq %r13, %rdi
movq %rax, %rdx
callq 0x3bca9
jmp 0x6086d
movq 0x75227(%rip), %rsi     # 0xd5870
movq %r13, %rdi
callq 0x3c0f5
jmp 0x60868
movq 0x75213(%rip), %rsi     # 0xd5870
movq %r13, %rdi
callq 0x3bf0e
jmp 0x60868
movq 0x751ff(%rip), %rsi     # 0xd5870
movq %r13, %rdi
callq 0x3c6e2
jmp 0x60868
movq 0x751eb(%rip), %rsi     # 0xd5870
movq %r13, %rdi
callq 0x3cc18
jmp 0x60868
movl $0x160, %edi            # imm = 0x160
leaq 0x4b3ae(%rip), %rsi     # 0xaba4c
movl $0x20, %edx
callq 0x3a0e1
movq %rax, (%rbp,%rbx,8)
movq 0x751bc(%rip), %rsi     # 0xd5870
movq %r13, %rdi
movq %rax, %rdx
callq 0x3bb84
jmp 0x6086d
movq 0x751a5(%rip), %rsi     # 0xd5870
movq %r13, %rdi
callq 0x3b9c2
jmp 0x60868
movq 0x75191(%rip), %rsi     # 0xd5870
movq %r13, %rdi
callq 0x3cad9
jmp 0x60868
movq 0x7517d(%rip), %rsi     # 0xd5870
movq %r13, %rdi
callq 0x3c4ef
jmp 0x60868
movq 0x75169(%rip), %rsi     # 0xd5870
movq %r13, %rdi
callq 0x3d1ab
jmp 0x60868
movq 0x75155(%rip), %rsi     # 0xd5870
movq %r13, %rdi
callq 0x3c600
jmp 0x60868
movq 0x75141(%rip), %rsi     # 0xd5870
movq %r13, %rdi
callq 0x3c33f
jmp 0x60868
movq 0x7512d(%rip), %rsi     # 0xd5870
movq %r13, %rdi
callq 0x3c3d4
jmp 0x60868
movq 0x75119(%rip), %rsi     # 0xd5870
movq %r13, %rdi
callq 0x3befe
jmp 0x60868
leaq 0x44f6b(%rip), %rdi     # 0xa56d6
callq 0x54920
movq 0x750f9(%rip), %rsi     # 0xd5870
movq (%rbp,%rbx,8), %rdx
movq %r13, %rdi
movl %eax, %ecx
callq 0x3bef9
jmp 0x6086d
leaq 0x44f4f(%rip), %rdi     # 0xa56e1
callq 0x54afc
movq 0x750d2(%rip), %rcx     # 0xd5870
movl 0x10(%rcx), %ecx
testl %eax, %eax
jne 0x607b4
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 0x4b281(%rip), %rsi     # 0xaba4c
movl $0x20, %edx
callq 0x3a0e1
movq %rax, (%rbp,%rbx,8)
movq 0x7508f(%rip), %rsi     # 0xd5870
movq %r13, %rdi
movq %rax, %rdx
movq 0x58(%rsp), %rcx
callq 0x3be9a
jmp 0x6086d
movq 0x75076(%rip), %rsi     # 0xd5870
movq %r13, %rdi
callq 0x3c1ee
jmp 0x60868
movq 0x75065(%rip), %rsi     # 0xd5870
movq %r13, %rdi
callq 0x3ba12
jmp 0x60868
movq 0x75054(%rip), %rsi     # 0xd5870
movq %r13, %rdi
callq 0x3ced9
jmp 0x60868
movq 0x75043(%rip), %rsi     # 0xd5870
movq %r13, %rdi
callq 0x3d69c
jmp 0x60868
movq 0x75032(%rip), %rsi     # 0xd5870
movq %r13, %rdi
callq 0x3ce7b
jmp 0x60868
movq 0x75021(%rip), %rsi     # 0xd5870
movq %r13, %rdi
callq 0x3ce3c
jmp 0x60868
movq 0x75010(%rip), %rsi     # 0xd5870
movq %r13, %rdi
callq 0x3cdf1
movq %rax, (%rbp,%rbx,8)
incq %rbx
movslq (%r12), %rax
addq $0x30, %r14
cmpq %rax, %rbx
jl 0x60434
movq %r13, %rdi
callq 0x42a0
jmp 0x60895
movq %rbp, %rdi
callq 0x3a180
xorl %ebp, %ebp
movq %rbp, %rax
addq $0xf42a8, %rsp          # imm = 0xF42A8
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq