// File: /workspace/github_c_makefile_star2_O0/olcaytaner[P]Isell/hmm.c
// Function: sum_state_model
void sum_state_model(void *destmodel, void* srcmodel, HMM_STATE_TYPE statetype)
{
 /*!Last Changed 15.03.2007*/
 Gaussianptr g, g1;
 Gaussianmixtureptr gm, gm1;
 Multinomialptr m, m1;
 Dirichletptr d, d1;
 Dirichletmixtureptr dm, dm1;
 int i, j;
 int numrealfeatures = current_dataset->multifeaturecount - 1;
 switch (statetype)
  {
   case          STATE_DISCRETE:m = (Multinomialptr) destmodel;
                                m1 = (Multinomialptr) srcmodel;
                        		      j = 0;
                                for (i = 0; i < current_dataset->featurecount; i++)
                                  if (current_dataset->features[i].type == STRING)
                                   {
                                    add_arrays(m->prob[j], m1->prob[j], current_dataset->features[i].valuecount);
                              		    j++;
                                   }
                                break;
   case          STATE_GAUSSIAN:g = (Gaussianptr) destmodel;
                                g1 = (Gaussianptr) srcmodel;
                                add_arrays(g->mean, g1->mean, numrealfeatures);
                                matrix_add(&(g->covariance), g1->covariance);
                                break;
   case  STATE_GAUSSIAN_MIXTURE:gm = (Gaussianmixtureptr) destmodel;
                                gm1 = (Gaussianmixtureptr) srcmodel;
                                add_arrays(gm->weights, gm1->weights, gm->componentcount);
                                for (i = 0; i < gm->componentcount; i++)
                                 {
                                  add_arrays(gm->components[i].mean, gm1->components[i].mean, numrealfeatures);
                                  matrix_add(&(gm->components[i].covariance), gm1->components[i].covariance);
                                 }
                                break;
   case         STATE_DIRICHLET:d = (Dirichletptr) destmodel;
                                d1 = (Dirichletptr) srcmodel;
                                add_arrays(d->alpha, d1->alpha, numrealfeatures);
                                break;
   case STATE_DIRICHLET_MIXTURE:dm = (Dirichletmixtureptr) destmodel;
                                dm1 = (Dirichletmixtureptr) srcmodel;
                                add_arrays(dm->weights, dm1->weights, dm->componentcount);
                                for (i = 0; i < dm->componentcount; i++)
                                  add_arrays(dm->components[i].alpha, dm1->components[i].alpha, numrealfeatures);
                                break;
  }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x80, %rsp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movl %edx, -0x14(%rbp)
leaq 0xcb923(%rip), %rax     # 0x105840
movq (%rax), %rax
movl 0x1c0(%rax), %eax
decl %eax
movl %eax, -0x74(%rbp)
movl -0x14(%rbp), %eax
movq %rax, -0x80(%rbp)
subq $0x4, %rax
ja 0x3a1a0
movq -0x80(%rbp), %rax
leaq 0xaaee5(%rip), %rcx     # 0xe4e2c
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
movq -0x8(%rbp), %rax
movq %rax, -0x40(%rbp)
movq -0x10(%rbp), %rax
movq %rax, -0x48(%rbp)
movl $0x0, -0x70(%rbp)
movl $0x0, -0x6c(%rbp)
movl -0x6c(%rbp), %eax
leaq 0xcb8c8(%rip), %rcx     # 0x105840
movq (%rcx), %rcx
cmpl 0x1bc(%rcx), %eax
jge 0x3a007
leaq 0xcb8b2(%rip), %rax     # 0x105840
movq (%rax), %rax
addq $0x30f08, %rax          # imm = 0x30F08
movslq -0x6c(%rbp), %rcx
imulq $0x340, %rcx, %rcx      # imm = 0x340
addq %rcx, %rax
cmpl $0x1, (%rax)
jne 0x39ff7
movq -0x40(%rbp), %rax
movq (%rax), %rax
movslq -0x70(%rbp), %rcx
movq (%rax,%rcx,8), %rdi
movq -0x48(%rbp), %rax
movq (%rax), %rax
movslq -0x70(%rbp), %rcx
movq (%rax,%rcx,8), %rsi
leaq 0xcb871(%rip), %rax     # 0x105840
movq (%rax), %rax
addq $0x30f08, %rax          # imm = 0x30F08
movslq -0x6c(%rbp), %rcx
imulq $0x340, %rcx, %rcx      # imm = 0x340
addq %rcx, %rax
movl 0x18(%rax), %edx
callq 0x4f970
movl -0x70(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x70(%rbp)
jmp 0x39ff9
movl -0x6c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x6c(%rbp)
jmp 0x39f6e
jmp 0x3a1a0
movq -0x8(%rbp), %rax
movq %rax, -0x20(%rbp)
movq -0x10(%rbp), %rax
movq %rax, -0x28(%rbp)
movq -0x20(%rbp), %rax
movq (%rax), %rdi
movq -0x28(%rbp), %rax
movq (%rax), %rsi
movl -0x74(%rbp), %edx
callq 0x4f970
movq -0x20(%rbp), %rdi
addq $0x8, %rdi
movq -0x28(%rbp), %rax
movq 0x8(%rax), %rsi
movq 0x10(%rax), %rdx
callq 0x5ac40
jmp 0x3a1a0
movq -0x8(%rbp), %rax
movq %rax, -0x30(%rbp)
movq -0x10(%rbp), %rax
movq %rax, -0x38(%rbp)
movq -0x30(%rbp), %rax
movq 0x10(%rax), %rdi
movq -0x38(%rbp), %rax
movq 0x10(%rax), %rsi
movq -0x30(%rbp), %rax
movl 0x8(%rax), %edx
callq 0x4f970
movl $0x0, -0x6c(%rbp)
movl -0x6c(%rbp), %eax
movq -0x30(%rbp), %rcx
cmpl 0x8(%rcx), %eax
jge 0x3a101
movq -0x30(%rbp), %rax
movq (%rax), %rax
movslq -0x6c(%rbp), %rcx
imulq $0x18, %rcx, %rcx
addq %rcx, %rax
movq (%rax), %rdi
movq -0x38(%rbp), %rax
movq (%rax), %rax
movslq -0x6c(%rbp), %rcx
imulq $0x18, %rcx, %rcx
addq %rcx, %rax
movq (%rax), %rsi
movl -0x74(%rbp), %edx
callq 0x4f970
movq -0x30(%rbp), %rax
movq (%rax), %rdi
movslq -0x6c(%rbp), %rax
imulq $0x18, %rax, %rax
addq %rax, %rdi
addq $0x8, %rdi
movq -0x38(%rbp), %rax
movq (%rax), %rax
movslq -0x6c(%rbp), %rcx
imulq $0x18, %rcx, %rcx
addq %rcx, %rax
movq 0x8(%rax), %rsi
movq 0x10(%rax), %rdx
callq 0x5ac40
movl -0x6c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x6c(%rbp)
jmp 0x3a083
jmp 0x3a1a0
movq -0x8(%rbp), %rax
movq %rax, -0x50(%rbp)
movq -0x10(%rbp), %rax
movq %rax, -0x58(%rbp)
movq -0x50(%rbp), %rax
movq (%rax), %rdi
movq -0x58(%rbp), %rax
movq (%rax), %rsi
movl -0x74(%rbp), %edx
callq 0x4f970
jmp 0x3a1a0
movq -0x8(%rbp), %rax
movq %rax, -0x60(%rbp)
movq -0x10(%rbp), %rax
movq %rax, -0x68(%rbp)
movq -0x60(%rbp), %rax
movq 0x10(%rax), %rdi
movq -0x68(%rbp), %rax
movq 0x10(%rax), %rsi
movq -0x60(%rbp), %rax
movl 0x8(%rax), %edx
callq 0x4f970
movl $0x0, -0x6c(%rbp)
movl -0x6c(%rbp), %eax
movq -0x60(%rbp), %rcx
cmpl 0x8(%rcx), %eax
jge 0x3a19e
movq -0x60(%rbp), %rax
movq (%rax), %rax
movslq -0x6c(%rbp), %rcx
movq (%rax,%rcx,8), %rdi
movq -0x68(%rbp), %rax
movq (%rax), %rax
movslq -0x6c(%rbp), %rcx
movq (%rax,%rcx,8), %rsi
movl -0x74(%rbp), %edx
callq 0x4f970
movl -0x6c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x6c(%rbp)
jmp 0x3a161
jmp 0x3a1a0
addq $0x80, %rsp
popq %rbp
retq
nopl (%rax)