// File: /workspace/github_c_makefile_star2_O0/olcaytaner[P]Isell/hmm.c
// Function: alloc_state_model
void* alloc_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), "alloc_state_model", 10);
                                m->prob = safemalloc(sizeof(double*) * (current_dataset->featurecount - 1), "alloc_state_model", 10);
                                j = 0;
                                for (i = 0; i < current_dataset->featurecount; i++)
                                  if (current_dataset->features[i].type == STRING)
                                   {
                                    m->prob[j] = safemalloc(sizeof(double) * current_dataset->features[i].valuecount, "alloc_state_model", 16);
                                    j++;
                                   }
                                return m;
                                break;
   case          STATE_GAUSSIAN:g = safemalloc(sizeof(Gaussian), "alloc_state_model", 21);
                                alloc_gaussian(g);
                                return g;
                                break;
   case  STATE_GAUSSIAN_MIXTURE:gm = safemalloc(sizeof(Gaussianmixture), "alloc_state_model", 26);
                                gm->componentcount = componentcount;
                                gm->weights = safemalloc(sizeof(double) * gm->componentcount, "alloc_state_model", 28);
                                gm->components = safemalloc(gm->componentcount * sizeof(Gaussian), "alloc_state_model", 29);
                                for (i = 0; i < gm->componentcount; i++)
                                  alloc_gaussian(&(gm->components[i]));
                                return gm;
                                break;
   case         STATE_DIRICHLET:d = safemalloc(sizeof(Dirichlet), "alloc_state_model", 37);
                                alloc_dirichlet(d);
                                return d;
                                break;
   case STATE_DIRICHLET_MIXTURE:dm = safemalloc(sizeof(Dirichletmixture), "alloc_state_model", 41);
                                dm->componentcount = componentcount;
                                dm->weights = safemalloc(sizeof(double) * dm->componentcount, "alloc_state_model", 43);
                                dm->components = safemalloc(componentcount * sizeof(Dirichlet), "alloc_state_model", 44);
                                for (i = 0; i < dm->componentcount; i++)
                                  alloc_dirichlet(&(dm->components[i]));
                                return dm;
                                break;
      default                  :return NULL;
  }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x50, %rsp
movl %edi, -0xc(%rbp)
movl %esi, -0x10(%rbp)
movl -0xc(%rbp), %eax
movq %rax, -0x48(%rbp)
subq $0x4, %rax
ja 0x38d1e
movq -0x48(%rbp), %rax
leaq 0xac37e(%rip), %rcx     # 0xe4dc8
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
movl $0x8, %edi
leaq 0xac726(%rip), %rsi     # 0xe5185
movl $0xa, %edx
callq 0x52d70
movq %rax, -0x28(%rbp)
leaq 0xccdcc(%rip), %rax     # 0x105840
movq (%rax), %rax
movl 0x1bc(%rax), %eax
subl $0x1, %eax
movslq %eax, %rdi
shlq $0x3, %rdi
leaq 0xac6f7(%rip), %rsi     # 0xe5185
movl $0xa, %edx
callq 0x52d70
movq %rax, %rcx
movq -0x28(%rbp), %rax
movq %rcx, (%rax)
movl $0x0, -0x40(%rbp)
movl $0x0, -0x3c(%rbp)
movl -0x3c(%rbp), %eax
leaq 0xccd86(%rip), %rcx     # 0x105840
movq (%rcx), %rcx
cmpl 0x1bc(%rcx), %eax
jge 0x38b4e
leaq 0xccd70(%rip), %rax     # 0x105840
movq (%rax), %rax
addq $0x30f08, %rax          # imm = 0x30F08
movslq -0x3c(%rbp), %rcx
imulq $0x340, %rcx, %rcx      # imm = 0x340
addq %rcx, %rax
cmpl $0x1, (%rax)
jne 0x38b3e
leaq 0xccd4d(%rip), %rax     # 0x105840
movq (%rax), %rax
addq $0x30f08, %rax          # imm = 0x30F08
movslq -0x3c(%rbp), %rcx
imulq $0x340, %rcx, %rcx      # imm = 0x340
addq %rcx, %rax
movslq 0x18(%rax), %rdi
shlq $0x3, %rdi
leaq 0xac66c(%rip), %rsi     # 0xe5185
movl $0x10, %edx
callq 0x52d70
movq %rax, %rdx
movq -0x28(%rbp), %rax
movq (%rax), %rax
movslq -0x40(%rbp), %rcx
movq %rdx, (%rax,%rcx,8)
movl -0x40(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x40(%rbp)
jmp 0x38b40
movl -0x3c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x3c(%rbp)
jmp 0x38ab0
movq -0x28(%rbp), %rax
movq %rax, -0x8(%rbp)
jmp 0x38d26
movl $0x18, %edi
leaq 0xac61e(%rip), %rsi     # 0xe5185
movl $0x15, %edx
callq 0x52d70
movq %rax, -0x18(%rbp)
movq -0x18(%rbp), %rdi
callq 0x3b200
movq -0x18(%rbp), %rax
movq %rax, -0x8(%rbp)
jmp 0x38d26
movl $0x18, %edi
leaq 0xac5ee(%rip), %rsi     # 0xe5185
movl $0x1a, %edx
callq 0x52d70
movq %rax, -0x20(%rbp)
movl -0x10(%rbp), %ecx
movq -0x20(%rbp), %rax
movl %ecx, 0x8(%rax)
movq -0x20(%rbp), %rax
movslq 0x8(%rax), %rdi
shlq $0x3, %rdi
leaq 0xac5c3(%rip), %rsi     # 0xe5185
movl $0x1c, %edx
callq 0x52d70
movq %rax, %rcx
movq -0x20(%rbp), %rax
movq %rcx, 0x10(%rax)
movq -0x20(%rbp), %rax
movslq 0x8(%rax), %rax
imulq $0x18, %rax, %rdi
leaq 0xac59b(%rip), %rsi     # 0xe5185
movl $0x1d, %edx
callq 0x52d70
movq %rax, %rcx
movq -0x20(%rbp), %rax
movq %rcx, (%rax)
movl $0x0, -0x3c(%rbp)
movl -0x3c(%rbp), %eax
movq -0x20(%rbp), %rcx
cmpl 0x8(%rcx), %eax
jge 0x38c33
movq -0x20(%rbp), %rax
movq (%rax), %rdi
movslq -0x3c(%rbp), %rax
imulq $0x18, %rax, %rax
addq %rax, %rdi
callq 0x3b200
movl -0x3c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x3c(%rbp)
jmp 0x38c05
movq -0x20(%rbp), %rax
movq %rax, -0x8(%rbp)
jmp 0x38d26
movl $0x8, %edi
leaq 0xac539(%rip), %rsi     # 0xe5185
movl $0x25, %edx
callq 0x52d70
movq %rax, -0x30(%rbp)
movq -0x30(%rbp), %rdi
callq 0x3b280
movq -0x30(%rbp), %rax
movq %rax, -0x8(%rbp)
jmp 0x38d26
movl $0x18, %edi
leaq 0xac509(%rip), %rsi     # 0xe5185
movl $0x29, %edx
callq 0x52d70
movq %rax, -0x38(%rbp)
movl -0x10(%rbp), %ecx
movq -0x38(%rbp), %rax
movl %ecx, 0x8(%rax)
movq -0x38(%rbp), %rax
movslq 0x8(%rax), %rdi
shlq $0x3, %rdi
leaq 0xac4de(%rip), %rsi     # 0xe5185
movl $0x2b, %edx
callq 0x52d70
movq %rax, %rcx
movq -0x38(%rbp), %rax
movq %rcx, 0x10(%rax)
movslq -0x10(%rbp), %rdi
shlq $0x3, %rdi
leaq 0xac4ba(%rip), %rsi     # 0xe5185
movl $0x2c, %edx
callq 0x52d70
movq %rax, %rcx
movq -0x38(%rbp), %rax
movq %rcx, (%rax)
movl $0x0, -0x3c(%rbp)
movl -0x3c(%rbp), %eax
movq -0x38(%rbp), %rcx
cmpl 0x8(%rcx), %eax
jge 0x38d14
movq -0x38(%rbp), %rax
movq (%rax), %rdi
movslq -0x3c(%rbp), %rax
shlq $0x3, %rax
addq %rax, %rdi
callq 0x3b280
movl -0x3c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x3c(%rbp)
jmp 0x38ce6
movq -0x38(%rbp), %rax
movq %rax, -0x8(%rbp)
jmp 0x38d26
movq $0x0, -0x8(%rbp)
movq -0x8(%rbp), %rax
addq $0x50, %rsp
popq %rbp
retq