// File: /workspace/github_c_makefile_star2_O0/olcaytaner[P]Isell/hmm.c
// Function: clone_state_model
void* clone_state_model(void* model, 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) model;
                                m1 = safemalloc(sizeof(Multinomial), "clone_state_model", 11);
                                m1->prob = safemalloc(sizeof(double*) * (current_dataset->featurecount - 1), "clone_state_model", 11);
                                j = 0;
                                for (i = 0; i < current_dataset->featurecount; i++)
                                  if (current_dataset->features[i].type == STRING)
                                   {
                                    m1->prob[j] = clone_array(m->prob[j],  current_dataset->features[i].valuecount);
                                    j++;
                                   }
                                return m1;
                                break;
   case          STATE_GAUSSIAN:g = (Gaussianptr) model;
                                g1 = safemalloc(sizeof(Gaussian), "clone_state_model", 23);
                                g1->mean = clone_array(g->mean, numrealfeatures);
                                g1->covariance = matrix_copy(g->covariance);
                                return g1;
                                break;
   case  STATE_GAUSSIAN_MIXTURE:gm = (Gaussianmixtureptr) model;
                                gm1 = safemalloc(sizeof(Gaussianmixture), "clone_state_model", 29);
                                gm1->componentcount = gm->componentcount;
                                gm1->weights = clone_array(gm->weights, gm->componentcount);
                                gm1->components = safemalloc(gm->componentcount * sizeof(Gaussian), "clone_state_model", 32);
                                for (i = 0; i < gm->componentcount; i++)
                                 {
                                  gm1->components[i].mean = clone_array(gm->components[i].mean, numrealfeatures);
                                  gm1->components[i].covariance = matrix_copy(gm->components[i].covariance);
                                 }
                                return gm1;
                                break;
   case         STATE_DIRICHLET:d = (Dirichletptr) model;
                                d1 = safemalloc(sizeof(Dirichlet), "clone_state_model", 40);
                                d1->alpha = clone_array(d->alpha, numrealfeatures);
                                return d1;
                                break;
   case STATE_DIRICHLET_MIXTURE:dm = (Dirichletmixtureptr) model;
                                dm1 = safemalloc(sizeof(Dirichletmixture), "clone_state_model", 45);
                                dm1->componentcount = dm->componentcount;
                                dm1->weights = clone_array(dm->weights, dm->componentcount);
                                dm1->components = safemalloc(dm->componentcount * sizeof(Dirichlet), "clone_state_model", 48);
                                for (i = 0; i < dm->componentcount; i++)
                                  dm1->components[i].alpha = clone_array(dm->components[i].alpha, numrealfeatures);
                                return dm1;
                                break;
      default                  :return NULL;
  }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0xb0, %rsp
movq %rdi, -0x10(%rbp)
movl %esi, -0x14(%rbp)
leaq 0xcc577(%rip), %rax     # 0x105840
movq (%rax), %rax
movl 0x1c0(%rax), %eax
decl %eax
movl %eax, -0x74(%rbp)
movl -0x14(%rbp), %eax
movq %rax, -0xa0(%rbp)
subq $0x4, %rax
ja 0x396ee
movq -0xa0(%rbp), %rax
leaq 0xabaf7(%rip), %rcx     # 0xe4df0
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
movq -0x10(%rbp), %rax
movq %rax, -0x40(%rbp)
movl $0x8, %edi
leaq 0xabe81(%rip), %rsi     # 0xe5197
movl $0xb, %edx
callq 0x52d70
movq %rax, -0x48(%rbp)
leaq 0xcc515(%rip), %rax     # 0x105840
movq (%rax), %rax
movl 0x1bc(%rax), %eax
subl $0x1, %eax
movslq %eax, %rdi
shlq $0x3, %rdi
leaq 0xabe52(%rip), %rsi     # 0xe5197
movl $0xb, %edx
callq 0x52d70
movq %rax, %rcx
movq -0x48(%rbp), %rax
movq %rcx, (%rax)
movl $0x0, -0x70(%rbp)
movl $0x0, -0x6c(%rbp)
movl -0x6c(%rbp), %eax
leaq 0xcc4cf(%rip), %rcx     # 0x105840
movq (%rcx), %rcx
cmpl 0x1bc(%rcx), %eax
jge 0x39403
leaq 0xcc4b9(%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 0x393f3
movq -0x40(%rbp), %rax
movq (%rax), %rax
movslq -0x70(%rbp), %rcx
movq (%rax,%rcx,8), %rdi
leaq 0xcc487(%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), %esi
callq 0x4f9d0
movq %rax, %rdx
movq -0x48(%rbp), %rax
movq (%rax), %rax
movslq -0x70(%rbp), %rcx
movq %rdx, (%rax,%rcx,8)
movl -0x70(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x70(%rbp)
jmp 0x393f5
movl -0x6c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x6c(%rbp)
jmp 0x39367
movq -0x48(%rbp), %rax
movq %rax, -0x8(%rbp)
jmp 0x396f6
movq -0x10(%rbp), %rax
movq %rax, -0x20(%rbp)
movl $0x18, %edi
leaq 0xabd73(%rip), %rsi     # 0xe5197
movl $0x17, %edx
callq 0x52d70
movq %rax, -0x28(%rbp)
movq -0x20(%rbp), %rax
movq (%rax), %rdi
movl -0x74(%rbp), %esi
callq 0x4f9d0
movq %rax, %rcx
movq -0x28(%rbp), %rax
movq %rcx, (%rax)
movq -0x28(%rbp), %rax
movq %rax, -0xa8(%rbp)
movq -0x20(%rbp), %rax
movq 0x8(%rax), %rdi
movq 0x10(%rax), %rsi
callq 0x58550
movq %rax, %rcx
movq -0xa8(%rbp), %rax
movq %rcx, -0x88(%rbp)
movq %rdx, -0x80(%rbp)
movq -0x88(%rbp), %rcx
movq %rcx, 0x8(%rax)
movq -0x80(%rbp), %rcx
movq %rcx, 0x10(%rax)
movq -0x28(%rbp), %rax
movq %rax, -0x8(%rbp)
jmp 0x396f6
movq -0x10(%rbp), %rax
movq %rax, -0x30(%rbp)
movl $0x18, %edi
leaq 0xabce7(%rip), %rsi     # 0xe5197
movl $0x1d, %edx
callq 0x52d70
movq %rax, -0x38(%rbp)
movq -0x30(%rbp), %rax
movl 0x8(%rax), %ecx
movq -0x38(%rbp), %rax
movl %ecx, 0x8(%rax)
movq -0x30(%rbp), %rax
movq 0x10(%rax), %rdi
movq -0x30(%rbp), %rax
movl 0x8(%rax), %esi
callq 0x4f9d0
movq %rax, %rcx
movq -0x38(%rbp), %rax
movq %rcx, 0x10(%rax)
movq -0x30(%rbp), %rax
movslq 0x8(%rax), %rax
imulq $0x18, %rax, %rdi
leaq 0xabc99(%rip), %rsi     # 0xe5197
movl $0x20, %edx
callq 0x52d70
movq %rax, %rcx
movq -0x38(%rbp), %rax
movq %rcx, (%rax)
movl $0x0, -0x6c(%rbp)
movl -0x6c(%rbp), %eax
movq -0x30(%rbp), %rcx
cmpl 0x8(%rcx), %eax
jge 0x395d2
movq -0x30(%rbp), %rax
movq (%rax), %rax
movslq -0x6c(%rbp), %rcx
imulq $0x18, %rcx, %rcx
addq %rcx, %rax
movq (%rax), %rdi
movl -0x74(%rbp), %esi
callq 0x4f9d0
movq %rax, %rcx
movq -0x38(%rbp), %rax
movq (%rax), %rax
movslq -0x6c(%rbp), %rdx
imulq $0x18, %rdx, %rdx
addq %rdx, %rax
movq %rcx, (%rax)
movq -0x38(%rbp), %rax
movq (%rax), %rax
movslq -0x6c(%rbp), %rcx
imulq $0x18, %rcx, %rcx
addq %rcx, %rax
movq %rax, -0xb0(%rbp)
movq -0x30(%rbp), %rax
movq (%rax), %rax
movslq -0x6c(%rbp), %rcx
imulq $0x18, %rcx, %rcx
addq %rcx, %rax
movq 0x8(%rax), %rdi
movq 0x10(%rax), %rsi
callq 0x58550
movq %rax, %rcx
movq -0xb0(%rbp), %rax
movq %rcx, -0x98(%rbp)
movq %rdx, -0x90(%rbp)
movq -0x98(%rbp), %rcx
movq %rcx, 0x8(%rax)
movq -0x90(%rbp), %rcx
movq %rcx, 0x10(%rax)
movl -0x6c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x6c(%rbp)
jmp 0x39519
movq -0x38(%rbp), %rax
movq %rax, -0x8(%rbp)
jmp 0x396f6
movq -0x10(%rbp), %rax
movq %rax, -0x50(%rbp)
movl $0x8, %edi
leaq 0xabba4(%rip), %rsi     # 0xe5197
movl $0x28, %edx
callq 0x52d70
movq %rax, -0x58(%rbp)
movq -0x50(%rbp), %rax
movq (%rax), %rdi
movl -0x74(%rbp), %esi
callq 0x4f9d0
movq %rax, %rcx
movq -0x58(%rbp), %rax
movq %rcx, (%rax)
movq -0x58(%rbp), %rax
movq %rax, -0x8(%rbp)
jmp 0x396f6
movq -0x10(%rbp), %rax
movq %rax, -0x60(%rbp)
movl $0x18, %edi
leaq 0xabb5c(%rip), %rsi     # 0xe5197
movl $0x2d, %edx
callq 0x52d70
movq %rax, -0x68(%rbp)
movq -0x60(%rbp), %rax
movl 0x8(%rax), %ecx
movq -0x68(%rbp), %rax
movl %ecx, 0x8(%rax)
movq -0x60(%rbp), %rax
movq 0x10(%rax), %rdi
movq -0x60(%rbp), %rax
movl 0x8(%rax), %esi
callq 0x4f9d0
movq %rax, %rcx
movq -0x68(%rbp), %rax
movq %rcx, 0x10(%rax)
movq -0x60(%rbp), %rax
movslq 0x8(%rax), %rdi
shlq $0x3, %rdi
leaq 0xabb0e(%rip), %rsi     # 0xe5197
movl $0x30, %edx
callq 0x52d70
movq %rax, %rcx
movq -0x68(%rbp), %rax
movq %rcx, (%rax)
movl $0x0, -0x6c(%rbp)
movl -0x6c(%rbp), %eax
movq -0x60(%rbp), %rcx
cmpl 0x8(%rcx), %eax
jge 0x396e4
movq -0x60(%rbp), %rax
movq (%rax), %rax
movslq -0x6c(%rbp), %rcx
movq (%rax,%rcx,8), %rdi
movl -0x74(%rbp), %esi
callq 0x4f9d0
movq %rax, %rdx
movq -0x68(%rbp), %rax
movq (%rax), %rax
movslq -0x6c(%rbp), %rcx
movq %rdx, (%rax,%rcx,8)
movl -0x6c(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x6c(%rbp)
jmp 0x396a4
movq -0x68(%rbp), %rax
movq %rax, -0x8(%rbp)
jmp 0x396f6
movq $0x0, -0x8(%rbp)
movq -0x8(%rbp), %rax
addq $0xb0, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)