// File: /workspace/github_c_makefile_star2_O2/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 0x258f3
movl %edx, %r15d
movq %rsi, %rbx
movq %rdi, %r14
leaq 0xa8077(%rip), %r12     # 0xcd870
movq (%r12), %rax
movl 0x1c0(%rax), %ebp
decl %ebp
movl %edx, %ecx
leaq 0x72a56(%rip), %rdx     # 0x98264
movslq (%rdx,%rcx,4), %rcx
addq %rdx, %rcx
jmpq *%rcx
movl $0x30f20, %r13d         # imm = 0x30F20
xorl %ebp, %ebp
movslq 0x1bc(%rax), %rcx
cmpq %rcx, %rbp
jge 0x258f3
cmpl $0x1, -0x18(%rax,%r13)
jne 0x25858
movq (%r14), %rcx
movslq %r15d, %r15
movq (%rcx,%r15,8), %rdi
movq (%rbx), %rcx
movq (%rcx,%r15,8), %rsi
movl (%rax,%r13), %edx
callq 0x3323c
incl %r15d
movq (%r12), %rax
incq %rbp
addq $0x340, %r13            # imm = 0x340
jmp 0x2581f
movq 0x10(%r14), %rdi
movq 0x10(%rbx), %rsi
movl 0x8(%r14), %edx
callq 0x3323c
xorl %r15d, %r15d
movslq 0x8(%r14), %rax
cmpq %rax, %r15
jge 0x258f3
movq (%r14), %rax
movq (%rax,%r15,8), %rdi
movq (%rbx), %rax
movq (%rax,%r15,8), %rsi
movl %ebp, %edx
callq 0x3323c
incq %r15
jmp 0x25878
movq 0x10(%r14), %rdi
movq 0x10(%rbx), %rsi
movl 0x8(%r14), %edx
callq 0x3323c
pushq $0x8
popq %r15
xorl %r12d, %r12d
movslq 0x8(%r14), %rax
cmpq %rax, %r12
jge 0x258f3
movq (%r14), %rax
movq -0x8(%rax,%r15), %rdi
movq (%rbx), %rax
movq -0x8(%rax,%r15), %rsi
movl %ebp, %edx
callq 0x3323c
movq (%r14), %rdi
addq %r15, %rdi
movq (%rbx), %rax
movq (%rax,%r15), %rsi
movq 0x8(%rax,%r15), %rdx
callq 0x39b81
incq %r12
addq $0x18, %r15
jmp 0x258b3
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 0x3323c
movq (%r14), %rdi
movq (%rbx), %rsi
movl %ebp, %edx
callq 0x3323c
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 0x39b81