// File: /workspace/github_c_makefile_star2_O3/olcaytaner[P]Isell/hmm.c
// Function: add_component
void add_component(Hmmptr hmm, int count, Instanceptr traindata)
{
 /*!Last Changed 06.04.2007*/
 int i, j;
 Gaussianmixtureptr gm;
 Dirichletmixtureptr dm;
 for (i = 0; i < hmm->statecount; i++)
   switch (hmm->statetype)
    {
     case  STATE_GAUSSIAN_MIXTURE:gm = (Gaussianmixtureptr) hmm->states[i].b;
                                  gm->weights = add_probability_conserving(gm->weights, gm->componentcount, count);
                                  gm->components = alloc(gm->components, (gm->componentcount + count) * sizeof(Gaussian), gm->componentcount + count);
                                  for (j = gm->componentcount; j < gm->componentcount + count; j++)
                                    random_gaussian(&(gm->components[j]), traindata);
                                  gm->componentcount += count;
                                  break;
     case STATE_DIRICHLET_MIXTURE:dm = (Dirichletmixtureptr) hmm->states[i].b;
                                  dm->weights = add_probability_conserving(dm->weights, dm->componentcount, count);
                                  dm->components = alloc(dm->components, (dm->componentcount + count) * sizeof(Dirichlet), dm->componentcount + count);
                                  for (j = dm->componentcount; j < dm->componentcount + count; j++)
                                    random_dirichlet(&(dm->components[j]), traindata);
                                  dm->componentcount += count;
                                  break;
     default                     :break;
    }
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
movl %esi, 0x4(%rsp)
cmpl $0x0, 0x8(%rdi)
jle 0x29660
movq %rdx, %rbx
movq %rdi, %r13
xorl %r12d, %r12d
movslq 0x4(%rsp), %r15
movq %rdi, 0x8(%rsp)
movq %rdx, 0x10(%rsp)
movl 0xc(%r13), %eax
cmpl $0x4, %eax
je 0x295b7
cmpl $0x2, %eax
jne 0x29650
movq (%r13), %rax
movq %r12, %rcx
shlq $0x5, %rcx
movq 0x18(%rax,%rcx), %rbp
movq 0x10(%rbp), %rdi
movl 0x8(%rbp), %esi
movl %r15d, %edx
callq 0x293c7
movq %rax, 0x10(%rbp)
movq (%rbp), %rdi
movslq 0x8(%rbp), %rdx
addq %r15, %rdx
movq %rdx, %rax
shlq $0x3, %rax
leaq (%rax,%rax,2), %rsi
callq 0x3a0b4
movslq 0x8(%rbp), %r14
movq %rax, (%rbp)
testl %r15d, %r15d
jle 0x29647
leaq (,%r14,8), %rax
leaq (%rax,%rax,2), %r13
movq (%rbp), %rdi
addq %r13, %rdi
movq %rbx, %rsi
callq 0x2966f
incq %r14
movslq 0x8(%rbp), %rax
addq %r15, %rax
addq $0x18, %r13
cmpq %rax, %r14
jl 0x29588
movl %eax, %r14d
movq 0x8(%rsp), %r13
jmp 0x2964c
movq (%r13), %rax
movq %r12, %rcx
shlq $0x5, %rcx
movq 0x18(%rax,%rcx), %rbp
movq 0x10(%rbp), %rdi
movl 0x8(%rbp), %esi
movl %r15d, %edx
callq 0x293c7
movq %rax, 0x10(%rbp)
movq (%rbp), %rdi
movslq 0x8(%rbp), %rdx
addq %r15, %rdx
movq %rdx, %rsi
shlq $0x3, %rsi
callq 0x3a0b4
movslq 0x8(%rbp), %r14
movq %rax, (%rbp)
testl %r15d, %r15d
jle 0x29647
leaq 0xac26b(%rip), %rbx     # 0xd5870
movq (%rbp), %r13
movq (%rbx), %rax
movl 0x1c0(%rax), %edi
decl %edi
xorps %xmm0, %xmm0
movsd 0x7bf01(%rip), %xmm1    # 0xa5520
callq 0x3b110
movq %rax, (%r13,%r14,8)
incq %r14
movslq 0x8(%rbp), %rax
addq %r15, %rax
cmpq %rax, %r14
jl 0x29605
movl %eax, %r14d
movq 0x8(%rsp), %r13
movq 0x10(%rsp), %rbx
jmp 0x2964c
addl 0x4(%rsp), %r14d
movl %r14d, 0x8(%rbp)
incq %r12
movslq 0x8(%r13), %rax
cmpq %rax, %r12
jl 0x29517
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq