// File: /workspace/github_c_makefile_star2_O3/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:
movl 0x8(%rdi), %ecx
movl 0x10(%rdi), %edx
cmpl $0x2, %edx
je 0x279d1
cmpl $0x1, %edx
je 0x279ca
movl %ecx, %eax
testl %edx, %edx
jne 0x279d4
leal 0x1(%rcx), %eax
imull %ecx, %eax
jmp 0x279d4
leal (%rcx,%rcx,2), %eax
decl %eax
jmp 0x279d4
leal (%rcx,%rcx,2), %eax
movl 0xc(%rdi), %r9d
cmpq $0x4, %r9
ja 0x27a6b
leaq 0xade87(%rip), %rdx     # 0xd5870
movq (%rdx), %rsi
movl 0x1c0(%rsi), %r8d
leal -0x1(%r8), %edx
leaq 0x80846(%rip), %r10     # 0xa8244
movslq (%r10,%r9,4), %r9
addq %r10, %r9
jmpq *%r9
movslq 0x1bc(%rsi), %rdx
testq %rdx, %rdx
jle 0x27aa1
imulq $0x340, %rdx, %rdi      # imm = 0x340
xorl %r8d, %r8d
xorl %edx, %edx
cmpl $0x1, 0x30f08(%rsi,%r8)
jne 0x27a37
addl 0x30f20(%rsi,%r8), %edx
addq $0x340, %r8             # imm = 0x340
cmpq %r8, %rdi
jne 0x27a24
jmp 0x27aa3
testl %ecx, %ecx
jle 0x27a6b
movq (%rdi), %rsi
shlq $0x5, %rcx
xorl %edi, %edi
movq 0x18(%rsi,%rdi), %r8
movl 0x8(%r8), %r8d
imull %edx, %r8d
addl %r8d, %eax
addq $0x20, %rdi
cmpq %rdi, %rcx
jne 0x27a52
retq
imull %ecx, %edx
imull %r8d, %edx
jmp 0x27aa6
testl %ecx, %ecx
jle 0x27a6b
movq (%rdi), %rsi
imull %r8d, %edx
shlq $0x5, %rcx
xorl %edi, %edi
movq 0x18(%rsi,%rdi), %r8
movl 0x8(%r8), %r8d
imull %edx, %r8d
addl %r8d, %eax
addq $0x20, %rdi
cmpq %rdi, %rcx
jne 0x27a86
jmp 0x27a6b
xorl %edx, %edx
imull %ecx, %edx
addl %edx, %eax
retq