// File: /workspace/github_c_makefile_star2_O0/olcaytaner[P]Isell/hmm.c
// Function: update_state_model
void update_state_model(void *model, double accum, double *accumMix, HMM_STATE_TYPE statetype)
{
 /*!Last Changed 27.03.2007*/
 Gaussianptr g;
 Gaussianmixtureptr gm;
 Multinomialptr m;
 Dirichletptr d;
 Dirichletmixtureptr dm;
 int i, j;
 double mul = (1.0 / accum);
 int numrealfeatures = current_dataset->multifeaturecount - 1;
 matrix covprior;
 switch (statetype)
  {
   case          STATE_DISCRETE:m = (Multinomialptr) model;
                                j = 0;
                                for (i = 0; i < current_dataset->featurecount; i++)
                                  if (current_dataset->features[i].type == STRING)
                                   {
                                    multiply_array(m->prob[j], mul, current_dataset->features[i].valuecount);
                                    j++;
                                   }
                                break;
   case          STATE_GAUSSIAN:g = (Gaussianptr) model;
                                multiply_array(g->mean, mul, numrealfeatures);
                                matrix_multiply_constant(&(g->covariance), mul);
                                covprior = identity(g->covariance.row);
                                matrix_multiply_constant(&(covprior), PRIOR);
                                matrix_add(&(g->covariance), covprior);
                                matrix_free(covprior);
                                break;
   case  STATE_GAUSSIAN_MIXTURE:gm = (Gaussianmixtureptr) model;
                                multiply_array(gm->weights, mul, gm->componentcount);
                                for (i = 0; i < gm->componentcount; i++)
                                 {
                                  multiply_array(gm->components[i].mean, (1.0 / accumMix[i]), numrealfeatures);
                                  matrix_multiply_constant(&(gm->components[i].covariance), (1.0 / accumMix[i]));
                                  covprior = identity(gm->components[i].covariance.row);
                                  matrix_multiply_constant(&(covprior), PRIOR);
                                  matrix_add(&(gm->components[i].covariance), covprior);
                                  matrix_free(covprior);
                                 }
                                break;
   case         STATE_DIRICHLET:d = (Dirichletptr) model;
                                multiply_array(d->alpha, mul, numrealfeatures);
                                break;
   case STATE_DIRICHLET_MIXTURE:dm = (Dirichletmixtureptr) model;
                                multiply_array(dm->weights, mul, dm->componentcount);
                                for (i = 0; i < dm->componentcount; i++)
                                  multiply_array(dm->components[i].alpha, (1.0 / accumMix[i]), numrealfeatures);
                                break;
  }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0xa0, %rsp
movq %rdi, -0x8(%rbp)
movsd %xmm0, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
movl %edx, -0x1c(%rbp)
movsd -0x10(%rbp), %xmm1
movsd 0xa6af0(%rip), %xmm0    # 0xe2018
divsd %xmm1, %xmm0
movsd %xmm0, -0x58(%rbp)
leaq 0xca308(%rip), %rax     # 0x105840
movq (%rax), %rax
movl 0x1c0(%rax), %eax
decl %eax
movl %eax, -0x5c(%rbp)
movl -0x1c(%rbp), %eax
movq %rax, -0x98(%rbp)
subq $0x4, %rax
ja 0x3b858
movq -0x98(%rbp), %rax
leaq 0xa98ec(%rip), %rcx     # 0xe4e54
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
movq -0x8(%rbp), %rax
movq %rax, -0x38(%rbp)
movl $0x0, -0x50(%rbp)
movl $0x0, -0x4c(%rbp)
movl -0x4c(%rbp), %eax
leaq 0xca2af(%rip), %rcx     # 0x105840
movq (%rcx), %rcx
cmpl 0x1bc(%rcx), %eax
jge 0x3b612
leaq 0xca29d(%rip), %rax     # 0x105840
movq (%rax), %rax
addq $0x30f08, %rax          # imm = 0x30F08
movslq -0x4c(%rbp), %rcx
imulq $0x340, %rcx, %rcx      # imm = 0x340
addq %rcx, %rax
cmpl $0x1, (%rax)
jne 0x3b602
movq -0x38(%rbp), %rax
movq (%rax), %rax
movslq -0x50(%rbp), %rcx
movq (%rax,%rcx,8), %rdi
movsd -0x58(%rbp), %xmm0
leaq 0xca266(%rip), %rax     # 0x105840
movq (%rax), %rax
addq $0x30f08, %rax          # imm = 0x30F08
movslq -0x4c(%rbp), %rcx
imulq $0x340, %rcx, %rcx      # imm = 0x340
addq %rcx, %rax
movl 0x18(%rax), %esi
callq 0x50700
movl -0x50(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x50(%rbp)
jmp 0x3b604
movl -0x4c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x4c(%rbp)
jmp 0x3b587
jmp 0x3b858
movq -0x8(%rbp), %rax
movq %rax, -0x28(%rbp)
movq -0x28(%rbp), %rax
movq (%rax), %rdi
movsd -0x58(%rbp), %xmm0
movl -0x5c(%rbp), %esi
callq 0x50700
movq -0x28(%rbp), %rdi
addq $0x8, %rdi
movsd -0x58(%rbp), %xmm0
callq 0x5a9d0
movq -0x28(%rbp), %rax
movl 0x8(%rax), %edi
callq 0x59f70
movq %rax, -0x80(%rbp)
movq %rdx, -0x78(%rbp)
movq -0x80(%rbp), %rax
movq %rax, -0x70(%rbp)
movq -0x78(%rbp), %rax
movq %rax, -0x68(%rbp)
leaq -0x70(%rbp), %rdi
movsd 0xa69ab(%rip), %xmm0    # 0xe2020
callq 0x5a9d0
movq -0x28(%rbp), %rdi
addq $0x8, %rdi
movq -0x70(%rbp), %rsi
movq -0x68(%rbp), %rdx
callq 0x5ac40
movq -0x70(%rbp), %rdi
movq -0x68(%rbp), %rsi
callq 0x59ea0
jmp 0x3b858
movq -0x8(%rbp), %rax
movq %rax, -0x30(%rbp)
movq -0x30(%rbp), %rax
movq 0x10(%rax), %rdi
movsd -0x58(%rbp), %xmm0
movq -0x30(%rbp), %rax
movl 0x8(%rax), %esi
callq 0x50700
movl $0x0, -0x4c(%rbp)
movl -0x4c(%rbp), %eax
movq -0x30(%rbp), %rcx
cmpl 0x8(%rcx), %eax
jge 0x3b7c8
movq -0x30(%rbp), %rax
movq (%rax), %rax
movslq -0x4c(%rbp), %rcx
imulq $0x18, %rcx, %rcx
addq %rcx, %rax
movq (%rax), %rdi
movq -0x18(%rbp), %rax
movslq -0x4c(%rbp), %rcx
movsd 0xa691a(%rip), %xmm0    # 0xe2018
divsd (%rax,%rcx,8), %xmm0
movl -0x5c(%rbp), %esi
callq 0x50700
movq -0x30(%rbp), %rax
movq (%rax), %rdi
movslq -0x4c(%rbp), %rax
imulq $0x18, %rax, %rax
addq %rax, %rdi
addq $0x8, %rdi
movq -0x18(%rbp), %rax
movslq -0x4c(%rbp), %rcx
movsd 0xa68e7(%rip), %xmm0    # 0xe2018
divsd (%rax,%rcx,8), %xmm0
callq 0x5a9d0
movq -0x30(%rbp), %rax
movq (%rax), %rax
movslq -0x4c(%rbp), %rcx
imulq $0x18, %rcx, %rcx
addq %rcx, %rax
movl 0x8(%rax), %edi
callq 0x59f70
movq %rax, -0x90(%rbp)
movq %rdx, -0x88(%rbp)
movq -0x90(%rbp), %rax
movq %rax, -0x70(%rbp)
movq -0x88(%rbp), %rax
movq %rax, -0x68(%rbp)
leaq -0x70(%rbp), %rdi
movsd 0xa689b(%rip), %xmm0    # 0xe2020
callq 0x5a9d0
movq -0x30(%rbp), %rax
movq (%rax), %rdi
movslq -0x4c(%rbp), %rax
imulq $0x18, %rax, %rax
addq %rax, %rdi
addq $0x8, %rdi
movq -0x70(%rbp), %rsi
movq -0x68(%rbp), %rdx
callq 0x5ac40
movq -0x70(%rbp), %rdi
movq -0x68(%rbp), %rsi
callq 0x59ea0
movl -0x4c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x4c(%rbp)
jmp 0x3b6c9
jmp 0x3b858
movq -0x8(%rbp), %rax
movq %rax, -0x40(%rbp)
movq -0x40(%rbp), %rax
movq (%rax), %rdi
movsd -0x58(%rbp), %xmm0
movl -0x5c(%rbp), %esi
callq 0x50700
jmp 0x3b858
movq -0x8(%rbp), %rax
movq %rax, -0x48(%rbp)
movq -0x48(%rbp), %rax
movq 0x10(%rax), %rdi
movsd -0x58(%rbp), %xmm0
movq -0x48(%rbp), %rax
movl 0x8(%rax), %esi
callq 0x50700
movl $0x0, -0x4c(%rbp)
movl -0x4c(%rbp), %eax
movq -0x48(%rbp), %rcx
cmpl 0x8(%rcx), %eax
jge 0x3b856
movq -0x48(%rbp), %rax
movq (%rax), %rax
movslq -0x4c(%rbp), %rcx
movq (%rax,%rcx,8), %rdi
movq -0x18(%rbp), %rax
movslq -0x4c(%rbp), %rcx
movsd 0xa67da(%rip), %xmm0    # 0xe2018
divsd (%rax,%rcx,8), %xmm0
movl -0x5c(%rbp), %esi
callq 0x50700
movl -0x4c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x4c(%rbp)
jmp 0x3b813
jmp 0x3b858
addq $0xa0, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)