// File: /workspace/github_c_makefile_star2_O1/olcaytaner[P]Isell/hmm.c
// Function: init_state_model
void init_state_model(void *model, HMM_STATE_TYPE statetype)
{
 /*!Last Changed 15.03.2007*/
 Gaussianptr g;
 Gaussianmixtureptr gm;
 Multinomialptr m;
 Dirichletptr d;
 Dirichletmixtureptr dm;
 int i, j;
 int numrealfeatures = current_dataset->multifeaturecount - 1;
 switch (statetype)
  {
   case          STATE_DISCRETE:m = (Multinomialptr) model;
                                j = 0;
                                for (i = 0; i < current_dataset->featurecount; i++)
                                  if (current_dataset->features[i].type == STRING)
                                   {
                                    init_array(m->prob[j], current_dataset->features[i].valuecount);
                                    j++;
                                   }
                                break;
   case          STATE_GAUSSIAN:g = (Gaussianptr) model;
                                init_array(g->mean, numrealfeatures);
                                initialize_matrix(&(g->covariance), 0.0);
                                break;
   case  STATE_GAUSSIAN_MIXTURE:gm = (Gaussianmixtureptr) model;
                                init_array(gm->weights, gm->componentcount);
                                for (i = 0; i < gm->componentcount; i++)
                                 {
                                  init_array(gm->components[i].mean, numrealfeatures);
                                  initialize_matrix(&(gm->components[i].covariance), 0.0);
                                 }
                                break;
   case         STATE_DIRICHLET:d = (Dirichletptr) model;
                                init_array(d->alpha, numrealfeatures);
                                break;
   case STATE_DIRICHLET_MIXTURE:dm = (Dirichletmixtureptr) model;
                                init_array(dm->weights, dm->componentcount);
                                for (i = 0; i < dm->componentcount; i++)
                                  init_array(dm->components[i].alpha, numrealfeatures);
                                break;
  }
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
cmpl $0x4, %esi
ja 0x284b6
movq %rdi, %rbx
leaq 0xaa4a5(%rip), %r14     # 0xd2870
movq (%r14), %rax
movl 0x1c0(%rax), %ebp
decl %ebp
movl %esi, %eax
leaq 0x7ce85(%rip), %rcx     # 0xa5264
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
movq (%r14), %rax
cmpl $0x0, 0x1bc(%rax)
jle 0x284b6
xorl %r15d, %r15d
movl $0x30f20, %r12d         # imm = 0x30F20
xorl %r13d, %r13d
cmpl $0x1, -0x18(%rax,%r12)
jne 0x28422
movq (%rbx), %rcx
movslq %r13d, %r13
movq (%rcx,%r13,8), %rdi
movl (%rax,%r12), %esi
callq 0x37879
incl %r13d
incq %r15
movq (%r14), %rax
movslq 0x1bc(%rax), %rcx
addq $0x340, %r12            # imm = 0x340
cmpq %rcx, %r15
jl 0x28404
jmp 0x284b6
movq 0x10(%rbx), %rdi
movl 0x8(%rbx), %esi
callq 0x37879
cmpl $0x0, 0x8(%rbx)
jle 0x284b6
xorl %r14d, %r14d
movq (%rbx), %rax
movq (%rax,%r14,8), %rdi
movl %ebp, %esi
callq 0x37879
incq %r14
movslq 0x8(%rbx), %rax
cmpq %rax, %r14
jl 0x28452
jmp 0x284b6
movq 0x10(%rbx), %rdi
movl 0x8(%rbx), %esi
callq 0x37879
cmpl $0x0, 0x8(%rbx)
jle 0x284b6
movl $0x8, %r14d
xorl %r15d, %r15d
movq (%rbx), %rax
movq -0x8(%rax,%r14), %rdi
movl %ebp, %esi
callq 0x37879
movq (%rbx), %rdi
addq %r14, %rdi
xorps %xmm0, %xmm0
callq 0x3e1f9
incq %r15
movslq 0x8(%rbx), %rax
addq $0x18, %r14
cmpq %rax, %r15
jl 0x28489
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq (%rbx), %rdi
movl %ebp, %esi
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x37879
movq (%rbx), %rdi
movl %ebp, %esi
callq 0x37879
addq $0x8, %rbx
xorps %xmm0, %xmm0
movq %rbx, %rdi
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x3e1f9