// File: /workspace/github_c_makefile_star2_O0/olcaytaner[P]Isell/hmm.c
// Function: complexity_of_hmm
int complexity_of_hmm(Hmmptr hmm)
{
 /*!Last Changed 02.04.2007*/
 int complexity = 0, statecomplexity, numrealfeatures, componentcount, i;
 complexity += hmm->statecount; /*pi*/
 switch (hmm->hmmtype) /*a_dot_j and a_i_dot*/
  {
   case    FULL_MODEL:complexity += hmm->statecount * hmm->statecount;
                      break;
   case      LR_MODEL:complexity += 2 * hmm->statecount - 1;
                      break;
   case LR_LOOP_MODEL:complexity += 2 * hmm->statecount;
                      break;
  }
 numrealfeatures = current_dataset->multifeaturecount - 1;
 switch (hmm->statetype)
  {
   case          STATE_DISCRETE:statecomplexity = 0;
                                for (i = 0; i < current_dataset->featurecount; i++) /*prob*/
                                  if (current_dataset->features[i].type == STRING)
                                    statecomplexity += current_dataset->features[i].valuecount;
                                complexity += statecomplexity * hmm->statecount;
                                break;
   case          STATE_GAUSSIAN:complexity += (numrealfeatures + numrealfeatures * numrealfeatures) * hmm->statecount; /*mean and covariance*/
                                break;
   case  STATE_GAUSSIAN_MIXTURE:for (i = 0; i < hmm->statecount; i++)
                                 {
                                  componentcount = ((Gaussianmixtureptr) hmm->states[i].b)->componentcount;
                                  complexity += componentcount * (numrealfeatures + numrealfeatures * numrealfeatures); /*mean and covariance*/
                                 }
                                break;
   case         STATE_DIRICHLET:complexity += numrealfeatures * hmm->statecount; /*alpha*/
                                break;
   case STATE_DIRICHLET_MIXTURE:for (i = 0; i < hmm->statecount; i++)
                                 {
                                  componentcount = ((Dirichletmixtureptr) hmm->states[i].b)->componentcount;
                                  complexity += componentcount * numrealfeatures; /*alpha*/
                                 }
                                break;
  }
 return complexity;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
movq %rdi, -0x8(%rbp)
movl $0x0, -0xc(%rbp)
movq -0x8(%rbp), %rax
movl 0x8(%rax), %ecx
movl -0xc(%rbp), %eax
addl %ecx, %eax
movl %eax, -0xc(%rbp)
movq -0x8(%rbp), %rax
movl 0x10(%rax), %eax
movl %eax, -0x20(%rbp)
testl %eax, %eax
je 0x37e02
jmp 0x37dee
movl -0x20(%rbp), %eax
subl $0x1, %eax
je 0x37e19
jmp 0x37df8
movl -0x20(%rbp), %eax
subl $0x2, %eax
je 0x37e2d
jmp 0x37e3c
movq -0x8(%rbp), %rax
movl 0x8(%rax), %eax
movq -0x8(%rbp), %rcx
imull 0x8(%rcx), %eax
addl -0xc(%rbp), %eax
movl %eax, -0xc(%rbp)
jmp 0x37e3c
movq -0x8(%rbp), %rax
movl 0x8(%rax), %eax
shll %eax
subl $0x1, %eax
addl -0xc(%rbp), %eax
movl %eax, -0xc(%rbp)
jmp 0x37e3c
movq -0x8(%rbp), %rax
movl 0x8(%rax), %eax
shll %eax
addl -0xc(%rbp), %eax
movl %eax, -0xc(%rbp)
leaq 0xcd9fd(%rip), %rax     # 0x105840
movq (%rax), %rax
movl 0x1c0(%rax), %eax
decl %eax
movl %eax, -0x14(%rbp)
movq -0x8(%rbp), %rax
movl 0xc(%rax), %eax
movq %rax, -0x28(%rbp)
subq $0x4, %rax
ja 0x37fd9
movq -0x28(%rbp), %rax
leaq 0xacf1b(%rip), %rcx     # 0xe4d8c
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
movl $0x0, -0x10(%rbp)
movl $0x0, -0x1c(%rbp)
movl -0x1c(%rbp), %eax
leaq 0xcd9ae(%rip), %rcx     # 0x105840
movq (%rcx), %rcx
cmpl 0x1bc(%rcx), %eax
jge 0x37ef4
leaq 0xcd99c(%rip), %rax     # 0x105840
movq (%rax), %rax
addq $0x30f08, %rax          # imm = 0x30F08
movslq -0x1c(%rbp), %rcx
imulq $0x340, %rcx, %rcx      # imm = 0x340
addq %rcx, %rax
cmpl $0x1, (%rax)
jne 0x37ee7
leaq 0xcd979(%rip), %rax     # 0x105840
movq (%rax), %rax
addq $0x30f08, %rax          # imm = 0x30F08
movslq -0x1c(%rbp), %rcx
imulq $0x340, %rcx, %rcx      # imm = 0x340
addq %rcx, %rax
movl 0x18(%rax), %eax
addl -0x10(%rbp), %eax
movl %eax, -0x10(%rbp)
jmp 0x37ee9
movl -0x1c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x1c(%rbp)
jmp 0x37e88
movl -0x10(%rbp), %eax
movq -0x8(%rbp), %rcx
imull 0x8(%rcx), %eax
addl -0xc(%rbp), %eax
movl %eax, -0xc(%rbp)
jmp 0x37fd9
movl -0x14(%rbp), %eax
movl -0x14(%rbp), %ecx
imull -0x14(%rbp), %ecx
addl %ecx, %eax
movq -0x8(%rbp), %rcx
imull 0x8(%rcx), %eax
addl -0xc(%rbp), %eax
movl %eax, -0xc(%rbp)
jmp 0x37fd9
movl $0x0, -0x1c(%rbp)
movl -0x1c(%rbp), %eax
movq -0x8(%rbp), %rcx
cmpl 0x8(%rcx), %eax
jge 0x37f7b
movq -0x8(%rbp), %rax
movq (%rax), %rax
movslq -0x1c(%rbp), %rcx
shlq $0x5, %rcx
addq %rcx, %rax
movq 0x18(%rax), %rax
movl 0x8(%rax), %eax
movl %eax, -0x18(%rbp)
movl -0x18(%rbp), %eax
movl -0x14(%rbp), %ecx
movl -0x14(%rbp), %edx
imull -0x14(%rbp), %edx
addl %edx, %ecx
imull %ecx, %eax
addl -0xc(%rbp), %eax
movl %eax, -0xc(%rbp)
movl -0x1c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x1c(%rbp)
jmp 0x37f30
jmp 0x37fd9
movl -0x14(%rbp), %eax
movq -0x8(%rbp), %rcx
imull 0x8(%rcx), %eax
addl -0xc(%rbp), %eax
movl %eax, -0xc(%rbp)
jmp 0x37fd9
movl $0x0, -0x1c(%rbp)
movl -0x1c(%rbp), %eax
movq -0x8(%rbp), %rcx
cmpl 0x8(%rcx), %eax
jge 0x37fd7
movq -0x8(%rbp), %rax
movq (%rax), %rax
movslq -0x1c(%rbp), %rcx
shlq $0x5, %rcx
addq %rcx, %rax
movq 0x18(%rax), %rax
movl 0x8(%rax), %eax
movl %eax, -0x18(%rbp)
movl -0x18(%rbp), %eax
imull -0x14(%rbp), %eax
addl -0xc(%rbp), %eax
movl %eax, -0xc(%rbp)
movl -0x1c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x1c(%rbp)
jmp 0x37f97
jmp 0x37fd9
movl -0xc(%rbp), %eax
popq %rbp
retq
nop