// File: /workspace/github_c_makefile_star2_O2/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
movq %rdx, %rbx
movl %esi, %ebp
xorl %r12d, %r12d
movslq %esi, %rax
movq %rax, 0x8(%rsp)
movq %rdi, 0x10(%rsp)
movslq 0x8(%rdi), %rax
cmpq %rax, %r12
jge 0x25e0a
movl 0xc(%rdi), %eax
cmpl $0x4, %eax
je 0x25d84
cmpl $0x2, %eax
jne 0x25e02
movq (%rdi), %rax
movq %r12, %rcx
shlq $0x5, %rcx
movq 0x18(%rax,%rcx), %r13
movq 0x10(%r13), %rdi
movl 0x8(%r13), %esi
movq 0x8(%rsp), %r14
movl %r14d, %edx
callq 0x25c60
movq %rax, 0x10(%r13)
movq (%r13), %rdi
movslq 0x8(%r13), %rdx
addq %r14, %rdx
imulq $0x18, %rdx, %rsi
callq 0x34f30
movq %rax, (%r13)
movl 0x8(%r13), %eax
movslq %eax, %r15
imulq $0x18, %r15, %r14
addl %ebp, %eax
movslq %eax, %rcx
cmpq %rcx, %r15
jge 0x25df9
movq (%r13), %rdi
addq %r14, %rdi
movq %rbx, %rsi
callq 0x25e19
incq %r15
movl 0x8(%r13), %eax
addq $0x18, %r14
jmp 0x25d5a
movq (%rdi), %rax
movq %r12, %rcx
shlq $0x5, %rcx
movq 0x18(%rax,%rcx), %r13
movq 0x10(%r13), %rdi
movl 0x8(%r13), %esi
movq 0x8(%rsp), %r14
movl %r14d, %edx
callq 0x25c60
movq %rax, 0x10(%r13)
movq (%r13), %rdi
movslq 0x8(%r13), %rdx
addq %r14, %rdx
movq %rdx, %rsi
shlq $0x3, %rsi
callq 0x34f30
movq %rax, (%r13)
movl 0x8(%r13), %eax
movslq %eax, %r14
leaq (,%r14,8), %r15
addl %ebp, %eax
movslq %eax, %rcx
cmpq %rcx, %r14
jge 0x25df9
movq (%r13), %rdi
addq %r15, %rdi
callq 0x25f0b
incq %r14
movl 0x8(%r13), %eax
addq $0x8, %r15
jmp 0x25dd6
movl %eax, 0x8(%r13)
movq 0x10(%rsp), %rdi
incq %r12
jmp 0x25cf1
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq