// File: /workspace/github_c_makefile_star2_O3/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
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
cmpl $0x4, %edx
ja 0x29030
movq %rsi, %rbx
movq %rdi, %r14
leaq 0xac958(%rip), %r15     # 0xd5870
movq (%r15), %rax
movl 0x1c0(%rax), %ebp
decl %ebp
movl %edx, %ecx
leaq 0x7f3b8(%rip), %rdx     # 0xa82e4
movslq (%rdx,%rcx,4), %rcx
addq %rdx, %rcx
jmpq *%rcx
cmpl $0x0, 0x1bc(%rax)
jle 0x29030
xorl %r12d, %r12d
movl $0x30f20, %r13d         # imm = 0x30F20
xorl %ebp, %ebp
cmpl $0x1, -0x18(%rax,%r13)
jne 0x28f74
movq (%r14), %rcx
movslq %ebp, %rbp
movq (%rcx,%rbp,8), %rdi
movq (%rbx), %rcx
movq (%rcx,%rbp,8), %rsi
movl (%rax,%r13), %edx
callq 0x37a08
incl %ebp
movq (%r15), %rax
incq %r12
movslq 0x1bc(%rax), %rcx
addq $0x340, %r13            # imm = 0x340
cmpq %rcx, %r12
jl 0x28f4d
jmp 0x29030
movq 0x10(%r14), %rdi
movq 0x10(%rbx), %rsi
movl 0x8(%r14), %edx
callq 0x37a08
cmpl $0x0, 0x8(%r14)
jle 0x29030
xorl %r15d, %r15d
movq (%r14), %rax
movq (%rax,%r15,8), %rdi
movq (%rbx), %rax
movq (%rax,%r15,8), %rsi
movl %ebp, %edx
callq 0x37a08
incq %r15
movslq 0x8(%r14), %rax
cmpq %rax, %r15
jl 0x28fae
jmp 0x29030
movq 0x10(%r14), %rdi
movq 0x10(%rbx), %rsi
movl 0x8(%r14), %edx
callq 0x37a08
cmpl $0x0, 0x8(%r14)
jle 0x29030
movl $0x8, %r15d
xorl %r12d, %r12d
movq (%r14), %rax
movq -0x8(%rax,%r15), %rdi
movq (%rbx), %rax
movq -0x8(%rax,%r15), %rsi
movl %ebp, %edx
callq 0x37a08
movq (%r14), %rdi
addq %r15, %rdi
movq (%rbx), %rax
movq (%rax,%r15), %rsi
movq 0x8(%rax,%r15), %rdx
callq 0x3f993
incq %r12
movslq 0x8(%r14), %rax
addq $0x18, %r15
cmpq %rax, %r12
jl 0x28ff2
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq (%r14), %rdi
movq (%rbx), %rsi
movl %ebp, %edx
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x37a08
movq (%r14), %rdi
movq (%rbx), %rsi
movl %ebp, %edx
callq 0x37a08
addq $0x8, %r14
movq 0x8(%rbx), %rsi
movq 0x10(%rbx), %rdx
movq %r14, %rdi
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x3f993