// File: /workspace/github_c_makefile_star2_O3/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 0x28737
movl %esi, %ebp
movl %edi, %eax
leaq 0x7fdc8(%rip), %rcx     # 0xa8294
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
leaq 0x80108(%rip), %r14     # 0xa85e4
movl $0x8, %edi
movq %r14, %rsi
movl $0xa, %edx
callq 0x3a0e1
movq %rax, %rbx
leaq 0xad378(%rip), %r15     # 0xd5870
movq (%r15), %rax
movslq 0x1bc(%rax), %rax
leaq -0x8(,%rax,8), %rdi
movq %r14, %rsi
movl $0xb, %edx
callq 0x3a0e1
movq %rax, (%rbx)
movq (%r15), %rax
cmpl $0x0, 0x1bc(%rax)
jle 0x28739
xorl %r12d, %r12d
movl $0x30f20, %r13d         # imm = 0x30F20
leaq 0x800aa(%rip), %r14     # 0xa85e4
xorl %ebp, %ebp
cmpl $0x1, -0x18(%rax,%r13)
jne 0x28569
movslq (%rax,%r13), %rdi
movl $0x8, %esi
movq %r14, %rdx
movl $0x10, %ecx
callq 0x3a1fc
movq (%rbx), %rcx
movslq %ebp, %rbp
movq %rax, (%rcx,%rbp,8)
incl %ebp
movq (%r15), %rax
incq %r12
movslq 0x1bc(%rax), %rcx
addq $0x340, %r13            # imm = 0x340
cmpq %rcx, %r12
jl 0x2853c
jmp 0x28739
leaq 0x80059(%rip), %r14     # 0xa85e4
movl $0x18, %edi
movq %r14, %rsi
movl $0x2a, %edx
callq 0x3a0e1
movq %rax, %rbx
movl %ebp, 0x8(%rax)
movslq %ebp, %r15
movl $0x8, %esi
movq %r15, %rdi
movq %r14, %rdx
movl $0x2c, %ecx
callq 0x3a1fc
movq %rax, 0x10(%rbx)
shlq $0x3, %r15
movq %r15, %rdi
movq %r14, %rsi
movl $0x2d, %edx
callq 0x3a0e1
movq %rax, (%rbx)
cmpl $0x0, 0x8(%rbx)
jle 0x28739
xorl %r15d, %r15d
leaq 0xad286(%rip), %r12     # 0xd5870
leaq 0x80027(%rip), %r14     # 0xa8618
movq (%rbx), %r13
movq (%r12), %rax
movslq 0x1c0(%rax), %rdi
decq %rdi
movl $0x8, %esi
movq %r14, %rdx
movl $0x2, %ecx
callq 0x3a1fc
movq %rax, (%r13,%r15,8)
incq %r15
movslq 0x8(%rbx), %rax
cmpq %rax, %r15
jl 0x285f1
jmp 0x28739
leaq 0x7ffb3(%rip), %r14     # 0xa85e4
movl $0x18, %edi
movq %r14, %rsi
movl $0x1b, %edx
callq 0x3a0e1
movq %rax, %rbx
movl %ebp, 0x8(%rax)
movslq %ebp, %r15
movl $0x8, %esi
movq %r15, %rdi
movq %r14, %rdx
movl $0x1d, %ecx
callq 0x3a1fc
movq %rax, 0x10(%rbx)
shlq $0x3, %r15
leaq (%r15,%r15,2), %rdi
movq %r14, %rsi
movl $0x1e, %edx
callq 0x3a0e1
movq %rax, (%rbx)
cmpl $0x0, 0x8(%rbx)
jle 0x28739
xorl %r14d, %r14d
xorl %r15d, %r15d
movq (%rbx), %rdi
addq %r14, %rdi
callq 0x29c30
movq (%rbx), %rax
leaq (%rax,%r14), %rdi
addq $0x8, %rdi
xorps %xmm0, %xmm0
callq 0x3f41d
incq %r15
movslq 0x8(%rbx), %rax
addq $0x18, %r14
cmpq %rax, %r15
jl 0x2868d
jmp 0x28739
leaq 0x7ff20(%rip), %rsi     # 0xa85e4
movl $0x8, %edi
movl $0x26, %edx
callq 0x3a0e1
movq %rax, %rbx
leaq 0xad193(%rip), %rax     # 0xd5870
movq (%rax), %rax
movslq 0x1c0(%rax), %rdi
decq %rdi
leaq 0x7ff27(%rip), %rdx     # 0xa8618
movl $0x8, %esi
movl $0x2, %ecx
callq 0x3a1fc
movq %rax, (%rbx)
jmp 0x28739
leaq 0x7fed8(%rip), %rsi     # 0xa85e4
movl $0x18, %edi
movl $0x15, %edx
callq 0x3a0e1
movq %rax, %rbx
movq %rax, %rdi
callq 0x29c30
movq %rbx, %rdi
addq $0x8, %rdi
xorps %xmm0, %xmm0
callq 0x3f41d
jmp 0x28739
xorl %ebx, %ebx
movq %rbx, %rax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq