// File: /workspace/github_c_makefile_star2_O2/olcaytaner[P]Isell/hmm.c
// Function: calloc_state_model
void* calloc_state_model(HMM_STATE_TYPE statetype, int componentcount)
{
 /*!Last Changed 15.03.2007*/
 Gaussianptr g;
 Gaussianmixtureptr gm;
 Multinomialptr m;
 Dirichletptr d;
 Dirichletmixtureptr dm;
 int i, j;
 switch (statetype)
  {
   case          STATE_DISCRETE:m = safemalloc(sizeof(Multinomial), "calloc_state_model", 10);
                                m->prob = safemalloc(sizeof(double*) * (current_dataset->featurecount - 1), "calloc_state_model", 11);
                                j = 0;
                                for (i = 0; i < current_dataset->featurecount; i++)
                                 if (current_dataset->features[i].type == STRING)
                                  {
                                   m->prob[j] = safecalloc(current_dataset->features[i].valuecount, sizeof(double), "calloc_state_model", 16);
                                   j++;
                                  }
                                return m;
                                break;
   case          STATE_GAUSSIAN:g = safemalloc(sizeof(Gaussian), "calloc_state_model", 21);
                                alloc_gaussian(g);
                                initialize_matrix(&(g->covariance), 0.0);
                                return g;
                                break;
   case  STATE_GAUSSIAN_MIXTURE:gm = safemalloc(sizeof(Gaussianmixture), "calloc_state_model", 27);
                                gm->componentcount = componentcount;
                                gm->weights = safecalloc(gm->componentcount, sizeof(double), "calloc_state_model", 29);
                                gm->components = safemalloc(componentcount * sizeof(Gaussian), "calloc_state_model", 30);
                                for (i = 0; i < gm->componentcount; i++)
                                 {
                                  alloc_gaussian(&(gm->components[i]));
                                  initialize_matrix(&(gm->components[i].covariance), 0.0);
                                 }
                                return gm;
                                break;
   case         STATE_DIRICHLET:d = safemalloc(sizeof(Dirichlet), "calloc_state_model", 38);
                                alloc_dirichlet(d);
                                return d;
                                break;
   case STATE_DIRICHLET_MIXTURE:dm = safemalloc(sizeof(Dirichletmixture), "calloc_state_model", 42);
                                dm->componentcount = componentcount;
                                dm->weights = safecalloc(dm->componentcount, sizeof(double), "calloc_state_model", 44);
                                dm->components = safemalloc(componentcount * sizeof(Dirichlet), "calloc_state_model", 45);
                                for (i = 0; i < dm->componentcount; i++)
                                  alloc_dirichlet(&(dm->components[i]));
                                return dm;
                                break;
      default                  :return NULL;
  }
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
cmpl $0x4, %edi
ja 0x250a1
movl %esi, %ebp
movl %edi, %eax
leaq 0x73350(%rip), %rcx     # 0x98214
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
leaq 0x73690(%rip), %r14     # 0x98564
pushq $0x8
popq %rdi
pushq $0xa
popq %rdx
movq %r14, %rsi
callq 0x34f59
movq %rax, %rbx
leaq 0xa8984(%rip), %r12     # 0xcd870
movq (%r12), %rax
movslq 0x1bc(%rax), %rax
leaq -0x8(,%rax,8), %rdi
pushq $0xb
popq %rdx
movq %r14, %rsi
callq 0x34f59
movq %rax, (%rbx)
movq (%r12), %rax
xorl %r13d, %r13d
movl $0x30f20, %r15d         # imm = 0x30F20
pushq $0x10
popq %rbp
xorl %r14d, %r14d
movslq 0x1bc(%rax), %rcx
cmpq %rcx, %r13
jge 0x250a3
cmpl $0x1, -0x18(%rax,%r15)
jne 0x24f5e
movslq (%rax,%r15), %rdi
pushq $0x8
popq %rsi
leaq 0x7361e(%rip), %rdx     # 0x98564
movl %ebp, %ecx
callq 0x35067
movq (%rbx), %rcx
movslq %r14d, %r14
movq %rax, (%rcx,%r14,8)
incl %r14d
movq (%r12), %rax
incq %r13
addq $0x340, %r15            # imm = 0x340
jmp 0x24f20
leaq 0x735f3(%rip), %r14     # 0x98564
pushq $0x18
popq %rdi
pushq $0x2a
popq %rdx
movq %r14, %rsi
callq 0x34f59
movq %rax, %rbx
movl %ebp, 0x8(%rax)
movslq %ebp, %r15
pushq $0x8
popq %rsi
pushq $0x2c
popq %rcx
movq %r15, %rdi
movq %r14, %rdx
callq 0x35067
movq %rax, 0x10(%rbx)
shlq $0x3, %r15
pushq $0x2d
popq %rdx
movq %r15, %rdi
movq %r14, %rsi
callq 0x34f59
movq %rax, (%rbx)
xorl %r14d, %r14d
xorl %r15d, %r15d
movslq 0x8(%rbx), %rax
cmpq %rax, %r15
jge 0x250a3
movq (%rbx), %rdi
addq %r14, %rdi
callq 0x2637f
incq %r15
addq $0x8, %r14
jmp 0x24fb8
leaq 0x73584(%rip), %r14     # 0x98564
pushq $0x18
popq %rdi
pushq $0x1b
popq %rdx
movq %r14, %rsi
callq 0x34f59
movq %rax, %rbx
movl %ebp, 0x8(%rax)
movslq %ebp, %r15
pushq $0x8
popq %rsi
pushq $0x1d
popq %rcx
movq %r15, %rdi
movq %r14, %rdx
callq 0x35067
movq %rax, 0x10(%rbx)
imulq $0x18, %r15, %rdi
pushq $0x1e
popq %rdx
movq %r14, %rsi
callq 0x34f59
movq %rax, (%rbx)
xorl %r14d, %r14d
xorl %r15d, %r15d
movslq 0x8(%rbx), %rax
cmpq %rax, %r15
jge 0x250a3
movq (%rbx), %rdi
addq %r14, %rdi
callq 0x26331
movq (%rbx), %rax
leaq (%rax,%r14), %rdi
addq $0x8, %rdi
xorps %xmm0, %xmm0
callq 0x397a4
incq %r15
addq $0x18, %r14
jmp 0x25024
leaq 0x73509(%rip), %rsi     # 0x98564
pushq $0x8
popq %rdi
pushq $0x26
popq %rdx
callq 0x34f59
movq %rax, %rbx
movq %rax, %rdi
callq 0x2637f
jmp 0x250a3
leaq 0x734ea(%rip), %rsi     # 0x98564
pushq $0x18
popq %rdi
pushq $0x15
popq %rdx
callq 0x34f59
movq %rax, %rbx
movq %rax, %rdi
callq 0x26331
movq %rbx, %rdi
addq $0x8, %rdi
xorps %xmm0, %xmm0
callq 0x397a4
jmp 0x250a3
xorl %ebx, %ebx
movq %rbx, %rax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq