// File: /workspace/github_c_makefile_star2_O0/olcaytaner[P]Isell/loadmodel.c
// Function: load_model_hmm
void* load_model_hmm(FILE* infile, Datasetptr d)
{
 /*!Last Changed 26.02.2007*/
 int i, j, k, statetype;
 Hmmptr h;
 Hmmptr* hmmarray;
 Multinomialptr m;
 Gaussianptr g;
 Gaussianmixtureptr gm;
 Dirichletptr di;
 Dirichletmixtureptr dm;
 hmmarray = safemalloc(d->classno * sizeof(Hmmptr), "load_model_hmm", 10);
 for (k = 0; k < d->classno; k++)
  {
   h = safemalloc(sizeof(Hmm), "load_model_hmm", 11);
   hmmarray[k] = h;
   fscanf(infile, "%d%d", &(h->statecount), &statetype);
   h->statetype = statetype;
   h->states = safemalloc(h->statecount * sizeof(State), "load_model_hmm", 4);
   for (i = 0; i < h->statecount; i++)
    {
     h->states[i].a_dot_j = load_array(infile, h->statecount);
     h->states[i].a_i_dot = load_array(infile, h->statecount);
     fscanf(infile, "%lf", &(h->states[i].pi));
     switch (h->statetype)
      {
       case          STATE_DISCRETE:m = safemalloc(sizeof(Multinomial), "load_model_hmm", 11);
                                    m->prob = safemalloc((d->featurecount - 1) * sizeof(double*), "load_model_hmm", 12);
                                    for (j = 0; j < d->featurecount; j++)
                                      if (d->features[j].type == STRING)
                                        m->prob[j] = load_array(infile, d->features[j].valuecount);
                                    h->states[i].b = m;
                                    break;
       case          STATE_GAUSSIAN:g = safemalloc(sizeof(Gaussian), "load_model_hmm", 18);
                                    g->mean = load_array(infile, d->multifeaturecount - 1);
                                    g->covariance = load_matrix(infile, d->multifeaturecount - 1, d->multifeaturecount - 1);
                                    h->states[i].b = g;
                                    break;
       case  STATE_GAUSSIAN_MIXTURE:gm = safemalloc(sizeof(Gaussianmixture), "load_model_hmm", 23);
                                    fscanf(infile, "%d", &(gm->componentcount));
                                    gm->weights = load_array(infile, gm->componentcount);
                                    gm->components = safemalloc(gm->componentcount * sizeof(Gaussian), "load_model_hmm", 26);
                                    for (j = 0; j < gm->componentcount; j++)
                                     {
                                      gm->components[j].mean = load_array(infile, d->multifeaturecount - 1);
                                      gm->components[j].covariance = load_matrix(infile, d->multifeaturecount - 1, d->multifeaturecount - 1);
                                     }
                                    h->states[i].b = gm;
                                    break;
       case         STATE_DIRICHLET:di = safemalloc(sizeof(Dirichlet), "load_model_hmm", 34);
                                    di->alpha = load_array(infile, d->multifeaturecount - 1);
                                    h->states[i].b = di;
                                    break;
       case STATE_DIRICHLET_MIXTURE:dm = safemalloc(sizeof(Dirichletmixture), "load_model_hmm", 38);
                                    fscanf(infile, "%d", &(dm->componentcount));
                                    dm->weights = load_array(infile, dm->componentcount);
                                    dm->components = safemalloc(dm->componentcount * sizeof(Dirichlet), "load_model_hmm", 41);
                                    for (j = 0; j < dm->componentcount; j++)
                                      dm->components[j].alpha = load_array(infile, d->multifeaturecount - 1);
                                    h->states[i].b = dm;
                                    break;
      }
    }
  }
 return hmmarray;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x90, %rsp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq -0x10(%rbp), %rax
movslq 0x10(%rax), %rdi
shlq $0x3, %rdi
leaq 0x8f239(%rip), %rsi     # 0xe69ef
movl $0xa, %edx
callq 0x52d70
movq %rax, -0x30(%rbp)
movl $0x0, -0x1c(%rbp)
movl -0x1c(%rbp), %eax
movq -0x10(%rbp), %rcx
cmpl 0x10(%rcx), %eax
jge 0x57d23
movl $0x18, %edi
leaq 0x8f208(%rip), %rsi     # 0xe69ef
movl $0xb, %edx
callq 0x52d70
movq %rax, -0x28(%rbp)
movq -0x28(%rbp), %rdx
movq -0x30(%rbp), %rax
movslq -0x1c(%rbp), %rcx
movq %rdx, (%rax,%rcx,8)
movq -0x8(%rbp), %rdi
movq -0x28(%rbp), %rdx
addq $0x8, %rdx
leaq 0x8f111(%rip), %rsi     # 0xe6929
leaq -0x20(%rbp), %rcx
movb $0x0, %al
callq 0x4070
movl -0x20(%rbp), %ecx
movq -0x28(%rbp), %rax
movl %ecx, 0xc(%rax)
movq -0x28(%rbp), %rax
movslq 0x8(%rax), %rdi
shlq $0x5, %rdi
leaq 0x8f1af(%rip), %rsi     # 0xe69ef
movl $0x4, %edx
callq 0x52d70
movq %rax, %rcx
movq -0x28(%rbp), %rax
movq %rcx, (%rax)
movl $0x0, -0x14(%rbp)
movl -0x14(%rbp), %eax
movq -0x28(%rbp), %rcx
cmpl 0x8(%rcx), %eax
jge 0x57d13
movq -0x8(%rbp), %rdi
movq -0x28(%rbp), %rax
movl 0x8(%rax), %esi
callq 0x54d70
movq %rax, %rdx
movq -0x28(%rbp), %rax
movq (%rax), %rax
movslq -0x14(%rbp), %rcx
shlq $0x5, %rcx
movq %rdx, (%rax,%rcx)
movq -0x8(%rbp), %rdi
movq -0x28(%rbp), %rax
movl 0x8(%rax), %esi
callq 0x54d70
movq %rax, %rdx
movq -0x28(%rbp), %rax
movq (%rax), %rax
movslq -0x14(%rbp), %rcx
shlq $0x5, %rcx
movq %rdx, 0x8(%rax,%rcx)
movq -0x8(%rbp), %rdi
movq -0x28(%rbp), %rax
movq (%rax), %rax
movslq -0x14(%rbp), %rcx
shlq $0x5, %rcx
leaq 0x10(%rax,%rcx), %rdx
leaq 0x8eef1(%rip), %rsi     # 0xe67c8
xorl %eax, %eax
callq 0x4070
movq -0x28(%rbp), %rax
movl 0xc(%rax), %eax
movq %rax, -0x80(%rbp)
subq $0x4, %rax
ja 0x57d03
movq -0x80(%rbp), %rax
leaq 0x8ee76(%rip), %rcx     # 0xe6774
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
movl $0x8, %edi
leaq 0x8f0dc(%rip), %rsi     # 0xe69ef
movl $0xb, %edx
callq 0x52d70
movq %rax, -0x38(%rbp)
movq -0x10(%rbp), %rax
movl 0x1bc(%rax), %eax
subl $0x1, %eax
movslq %eax, %rdi
shlq $0x3, %rdi
leaq 0x8f0b3(%rip), %rsi     # 0xe69ef
movl $0xc, %edx
callq 0x52d70
movq %rax, %rcx
movq -0x38(%rbp), %rax
movq %rcx, (%rax)
movl $0x0, -0x18(%rbp)
movl -0x18(%rbp), %eax
movq -0x10(%rbp), %rcx
cmpl 0x1bc(%rcx), %eax
jge 0x579c6
movq -0x10(%rbp), %rax
addq $0x30f08, %rax          # imm = 0x30F08
movslq -0x18(%rbp), %rcx
imulq $0x340, %rcx, %rcx      # imm = 0x340
addq %rcx, %rax
cmpl $0x1, (%rax)
jne 0x579b9
movq -0x8(%rbp), %rdi
movq -0x10(%rbp), %rax
addq $0x30f08, %rax          # imm = 0x30F08
movslq -0x18(%rbp), %rcx
imulq $0x340, %rcx, %rcx      # imm = 0x340
addq %rcx, %rax
movl 0x18(%rax), %esi
callq 0x54d70
movq %rax, %rdx
movq -0x38(%rbp), %rax
movq (%rax), %rax
movslq -0x18(%rbp), %rcx
movq %rdx, (%rax,%rcx,8)
jmp 0x579bb
movl -0x18(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x18(%rbp)
jmp 0x57957
movq -0x38(%rbp), %rcx
movq -0x28(%rbp), %rax
movq (%rax), %rax
movslq -0x14(%rbp), %rdx
shlq $0x5, %rdx
addq %rdx, %rax
movq %rcx, 0x18(%rax)
jmp 0x57d03
movl $0x18, %edi
leaq 0x8effe(%rip), %rsi     # 0xe69ef
movl $0x12, %edx
callq 0x52d70
movq %rax, -0x40(%rbp)
movq -0x8(%rbp), %rdi
movq -0x10(%rbp), %rax
movl 0x1c0(%rax), %esi
subl $0x1, %esi
callq 0x54d70
movq %rax, %rcx
movq -0x40(%rbp), %rax
movq %rcx, (%rax)
movq -0x40(%rbp), %rax
movq %rax, -0x88(%rbp)
movq -0x8(%rbp), %rdi
movq -0x10(%rbp), %rax
movl 0x1c0(%rax), %esi
subl $0x1, %esi
movq -0x10(%rbp), %rax
movl 0x1c0(%rax), %edx
subl $0x1, %edx
callq 0x54cc0
movq %rax, %rcx
movq -0x88(%rbp), %rax
movq %rcx, -0x68(%rbp)
movq %rdx, -0x60(%rbp)
movq -0x68(%rbp), %rcx
movq %rcx, 0x8(%rax)
movq -0x60(%rbp), %rcx
movq %rcx, 0x10(%rax)
movq -0x40(%rbp), %rcx
movq -0x28(%rbp), %rax
movq (%rax), %rax
movslq -0x14(%rbp), %rdx
shlq $0x5, %rdx
addq %rdx, %rax
movq %rcx, 0x18(%rax)
jmp 0x57d03
movl $0x18, %edi
leaq 0x8ef55(%rip), %rsi     # 0xe69ef
movl $0x17, %edx
callq 0x52d70
movq %rax, -0x48(%rbp)
movq -0x8(%rbp), %rdi
movq -0x48(%rbp), %rdx
addq $0x8, %rdx
leaq 0x957aa(%rip), %rsi     # 0xed265
movb $0x0, %al
callq 0x4070
movq -0x8(%rbp), %rdi
movq -0x48(%rbp), %rax
movl 0x8(%rax), %esi
callq 0x54d70
movq %rax, %rcx
movq -0x48(%rbp), %rax
movq %rcx, 0x10(%rax)
movq -0x48(%rbp), %rax
movslq 0x8(%rax), %rax
imulq $0x18, %rax, %rdi
leaq 0x8eeff(%rip), %rsi     # 0xe69ef
movl $0x1a, %edx
callq 0x52d70
movq %rax, %rcx
movq -0x48(%rbp), %rax
movq %rcx, (%rax)
movl $0x0, -0x18(%rbp)
movl -0x18(%rbp), %eax
movq -0x48(%rbp), %rcx
cmpl 0x8(%rcx), %eax
jge 0x57bb5
movq -0x8(%rbp), %rdi
movq -0x10(%rbp), %rax
movl 0x1c0(%rax), %esi
subl $0x1, %esi
callq 0x54d70
movq %rax, %rcx
movq -0x48(%rbp), %rax
movq (%rax), %rax
movslq -0x18(%rbp), %rdx
imulq $0x18, %rdx, %rdx
addq %rdx, %rax
movq %rcx, (%rax)
movq -0x48(%rbp), %rax
movq (%rax), %rax
movslq -0x18(%rbp), %rcx
imulq $0x18, %rcx, %rcx
addq %rcx, %rax
movq %rax, -0x90(%rbp)
movq -0x8(%rbp), %rdi
movq -0x10(%rbp), %rax
movl 0x1c0(%rax), %esi
subl $0x1, %esi
movq -0x10(%rbp), %rax
movl 0x1c0(%rax), %edx
subl $0x1, %edx
callq 0x54cc0
movq %rax, %rcx
movq -0x90(%rbp), %rax
movq %rcx, -0x78(%rbp)
movq %rdx, -0x70(%rbp)
movq -0x78(%rbp), %rcx
movq %rcx, 0x8(%rax)
movq -0x70(%rbp), %rcx
movq %rcx, 0x10(%rax)
movl -0x18(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x18(%rbp)
jmp 0x57b0b
movq -0x48(%rbp), %rcx
movq -0x28(%rbp), %rax
movq (%rax), %rax
movslq -0x14(%rbp), %rdx
shlq $0x5, %rdx
addq %rdx, %rax
movq %rcx, 0x18(%rax)
jmp 0x57d03
movl $0x8, %edi
leaq 0x8ee0f(%rip), %rsi     # 0xe69ef
movl $0x22, %edx
callq 0x52d70
movq %rax, -0x50(%rbp)
movq -0x8(%rbp), %rdi
movq -0x10(%rbp), %rax
movl 0x1c0(%rax), %esi
subl $0x1, %esi
callq 0x54d70
movq %rax, %rcx
movq -0x50(%rbp), %rax
movq %rcx, (%rax)
movq -0x50(%rbp), %rcx
movq -0x28(%rbp), %rax
movq (%rax), %rax
movslq -0x14(%rbp), %rdx
shlq $0x5, %rdx
addq %rdx, %rax
movq %rcx, 0x18(%rax)
jmp 0x57d03
movl $0x18, %edi
leaq 0x8edb6(%rip), %rsi     # 0xe69ef
movl $0x26, %edx
callq 0x52d70
movq %rax, -0x58(%rbp)
movq -0x8(%rbp), %rdi
movq -0x58(%rbp), %rdx
addq $0x8, %rdx
leaq 0x9560b(%rip), %rsi     # 0xed265
movb $0x0, %al
callq 0x4070
movq -0x8(%rbp), %rdi
movq -0x58(%rbp), %rax
movl 0x8(%rax), %esi
callq 0x54d70
movq %rax, %rcx
movq -0x58(%rbp), %rax
movq %rcx, 0x10(%rax)
movq -0x58(%rbp), %rax
movslq 0x8(%rax), %rdi
shlq $0x3, %rdi
leaq 0x8ed60(%rip), %rsi     # 0xe69ef
movl $0x29, %edx
callq 0x52d70
movq %rax, %rcx
movq -0x58(%rbp), %rax
movq %rcx, (%rax)
movl $0x0, -0x18(%rbp)
movl -0x18(%rbp), %eax
movq -0x58(%rbp), %rcx
cmpl 0x8(%rcx), %eax
jge 0x57ce9
movq -0x8(%rbp), %rdi
movq -0x10(%rbp), %rax
movl 0x1c0(%rax), %esi
subl $0x1, %esi
callq 0x54d70
movq %rax, %rdx
movq -0x58(%rbp), %rax
movq (%rax), %rax
movslq -0x18(%rbp), %rcx
movq %rdx, (%rax,%rcx,8)
movl -0x18(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x18(%rbp)
jmp 0x57caa
movq -0x58(%rbp), %rcx
movq -0x28(%rbp), %rax
movq (%rax), %rax
movslq -0x14(%rbp), %rdx
shlq $0x5, %rdx
addq %rdx, %rax
movq %rcx, 0x18(%rax)
jmp 0x57d05
movl -0x14(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x14(%rbp)
jmp 0x5785b
jmp 0x57d15
movl -0x1c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x1c(%rbp)
jmp 0x577cb
movq -0x30(%rbp), %rax
addq $0x90, %rsp
popq %rbp
retq