// File: /workspace/github_c_makefile_star2_O2/olcaytaner[P]Isell/hmm.c
// Function: copy_state_model
void copy_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)
                                   {
                                    memcpy(m->prob[j], m1->prob[j], current_dataset->features[i].valuecount * sizeof(double));
                                    j++;
                                   }
                                break;
   case          STATE_GAUSSIAN:g = (Gaussianptr) destmodel;
                                g1 = (Gaussianptr) srcmodel;
                                memcpy(g->mean, g1->mean, numrealfeatures * sizeof(double));
                                matrix_identical(&(g->covariance), g1->covariance);
                                break;
   case  STATE_GAUSSIAN_MIXTURE:gm = (Gaussianmixtureptr) destmodel;
                                gm1 = (Gaussianmixtureptr) srcmodel;
                                memcpy(gm->weights, gm1->weights, gm->componentcount * sizeof(double));
                                for (i = 0; i < gm->componentcount; i++)
                                 {
                                  memcpy(gm->components[i].mean, gm1->components[i].mean, numrealfeatures * sizeof(double));
                                  matrix_identical(&(gm->components[i].covariance), gm1->components[i].covariance);
                                 }
                                break;
   case         STATE_DIRICHLET:d = (Dirichletptr) destmodel;
                                d1 = (Dirichletptr) srcmodel;
                                memcpy(d->alpha, d1->alpha, numrealfeatures * sizeof(double));
                                break;
   case STATE_DIRICHLET_MIXTURE:dm = (Dirichletmixtureptr) destmodel;
                                dm1 = (Dirichletmixtureptr) srcmodel;
                                memcpy(dm->weights, dm1->weights, dm->componentcount * sizeof(double));
                                for (i = 0; i < dm->componentcount; i++)
                                  memcpy(dm->components[i].alpha, dm1->components[i].alpha, numrealfeatures * sizeof(double));
                                break;
  }
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
cmpl $0x4, %edx
ja 0x256e8
movl %edx, %r15d
movq %rsi, %rbx
movq %rdi, %r14
leaq 0xa82a0(%rip), %r13     # 0xcd870
movq (%r13), %rax
movslq 0x1c0(%rax), %r12
decq %r12
movl %edx, %ecx
leaq 0x72c69(%rip), %rdx     # 0x98250
movslq (%rdx,%rcx,4), %rcx
addq %rdx, %rcx
jmpq *%rcx
movl $0x30f20, %r12d         # imm = 0x30F20
xorl %ebp, %ebp
movslq 0x1bc(%rax), %rcx
cmpq %rcx, %rbp
jge 0x256e8
cmpl $0x1, -0x18(%rax,%r12)
jne 0x25635
movq (%r14), %rcx
movslq %r15d, %r15
movq (%rcx,%r15,8), %rdi
movq (%rbx), %rcx
movq (%rcx,%r15,8), %rsi
movslq (%rax,%r12), %rdx
shlq $0x3, %rdx
callq 0x4310
incl %r15d
movq (%r13), %rax
incq %rbp
addq $0x340, %r12            # imm = 0x340
jmp 0x255f8
movq 0x10(%r14), %rdi
movq 0x10(%rbx), %rsi
movslq 0x8(%r14), %rdx
shlq $0x3, %rdx
callq 0x4310
movslq %r12d, %r15
shlq $0x3, %r15
xorl %r12d, %r12d
movslq 0x8(%r14), %rax
cmpq %rax, %r12
jge 0x256e8
movq (%r14), %rax
movq (%rax,%r12,8), %rdi
movq (%rbx), %rax
movq (%rax,%r12,8), %rsi
movq %r15, %rdx
callq 0x4310
incq %r12
jmp 0x25660
movq 0x10(%r14), %rdi
movq 0x10(%rbx), %rsi
movslq 0x8(%r14), %rdx
shlq $0x3, %rdx
callq 0x4310
movslq %r12d, %r15
shlq $0x3, %r15
pushq $0x8
popq %r12
xorl %r13d, %r13d
movslq 0x8(%r14), %rax
cmpq %rax, %r13
jge 0x256e8
movq (%r14), %rax
movq -0x8(%rax,%r12), %rdi
movq (%rbx), %rax
movq -0x8(%rax,%r12), %rsi
movq %r15, %rdx
callq 0x4310
movq (%r14), %rdi
addq %r12, %rdi
movq (%rbx), %rax
movq (%rax,%r12), %rsi
movq 0x8(%rax,%r12), %rdx
callq 0x3a763
incq %r13
addq $0x18, %r12
jmp 0x256a7
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq (%r14), %rdi
movq (%rbx), %rsi
movslq %r12d, %rdx
shlq $0x3, %rdx
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x4310
movq (%r14), %rdi
movq (%rbx), %rsi
shlq $0x3, %r12
movq %r12, %rdx
callq 0x4310
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 0x3a763