// File: /workspace/github_c_makefile_star2_O1/genometools[P]genometools/src/extended/hmm.c
// Function: gt_hmm_init_random
void gt_hmm_init_random(GtHMM *hmm)
{
  double random_value, cumulative_prob;
  unsigned int i, j;
  gt_assert(hmm);

  /* initialize initial state probabilities in random fashion */
  cumulative_prob = 0.0;
  for (i = 0; i < hmm->num_of_states - 1; i++) {
    random_value = gt_rand_max_double(1.0 - cumulative_prob);
    gt_hmm_set_initial_state_probability(hmm, i, random_value);
    cumulative_prob += random_value;
  }
  gt_assert(cumulative_prob <= 1.0);
  gt_hmm_set_initial_state_probability(hmm, i,  1.0 - cumulative_prob);

  /* initialize transition probabilities in random fashion */
  for (i = 0; i < hmm->num_of_states; i++) {
    cumulative_prob = 0.0;
    for (j = 0; j < hmm->num_of_states - 1; j++) {
      random_value = gt_rand_max_double(1.0 - cumulative_prob);
      gt_hmm_set_transition_probability(hmm, i, j, random_value);
      cumulative_prob += random_value;
    }
    gt_assert(cumulative_prob <= 1.0);
    gt_hmm_set_transition_probability(hmm, i, j, 1.0 - cumulative_prob);
  }

  /* initialize emission probabilities in random fashion */
  for (i = 0; i < hmm->num_of_states; i++) {
    cumulative_prob = 0.0;
    for (j = 0; j < hmm->num_of_symbols - 1; j++) {
      random_value = gt_rand_max_double(1.0 - cumulative_prob);
      gt_hmm_set_emission_probability(hmm, i, j, random_value);
      cumulative_prob += random_value;
    }
    gt_assert(cumulative_prob <= 1.0);
    gt_hmm_set_emission_probability(hmm, i, j, 1.0 - cumulative_prob);
  }

  gt_assert(gt_hmm_is_valid(hmm));
}

// Assembly:
pushq %rbp
pushq %r14
pushq %rbx
subq $0x10, %rsp
testq %rdi, %rdi
je 0x158aaf
movq %rdi, %rbx
cmpl $0x1, (%rdi)
jne 0x15890d
xorl %ebp, %ebp
xorpd %xmm1, %xmm1
jmp 0x15894e
xorpd %xmm1, %xmm1
xorl %ebp, %ebp
movsd %xmm1, 0x8(%rsp)
movsd 0x1f6907(%rip), %xmm0   # 0x34f228
subsd %xmm1, %xmm0
callq 0x10aeb4
movsd %xmm0, (%rsp)
movq %rbx, %rdi
movl %ebp, %esi
callq 0x15846e
movsd 0x8(%rsp), %xmm1
addsd (%rsp), %xmm1
incl %ebp
movl (%rbx), %eax
decl %eax
cmpl %eax, %ebp
jb 0x158913
movsd 0x1f68d2(%rip), %xmm0   # 0x34f228
ucomisd %xmm1, %xmm0
jb 0x158ab4
subsd %xmm1, %xmm0
movq %rbx, %rdi
movl %ebp, %esi
callq 0x15846e
cmpl $0x0, (%rbx)
je 0x158a00
xorl %ebp, %ebp
xorpd %xmm1, %xmm1
cmpl $0x1, (%rbx)
movl $0x0, %r14d
movsd 0x1f689a(%rip), %xmm0   # 0x34f228
je 0x1589db
xorl %r14d, %r14d
movsd %xmm1, 0x8(%rsp)
movsd 0x1f6887(%rip), %xmm0   # 0x34f228
subsd %xmm1, %xmm0
callq 0x10aeb4
movsd %xmm0, (%rsp)
movq %rbx, %rdi
movl %ebp, %esi
movl %r14d, %edx
callq 0x1584d5
movsd 0x1f6864(%rip), %xmm0   # 0x34f228
movsd 0x8(%rsp), %xmm1
addsd (%rsp), %xmm1
incl %r14d
movl (%rbx), %eax
decl %eax
cmpl %eax, %r14d
jb 0x158993
ucomisd %xmm1, %xmm0
jb 0x158aa5
subsd %xmm1, %xmm0
movq %rbx, %rdi
movl %ebp, %esi
movl %r14d, %edx
callq 0x1584d5
incl %ebp
cmpl (%rbx), %ebp
jb 0x158979
cmpl $0x0, (%rbx)
je 0x158a90
xorl %ebp, %ebp
xorpd %xmm1, %xmm1
cmpl $0x1, 0x4(%rbx)
movl $0x0, %r14d
movsd 0x1f6807(%rip), %xmm0   # 0x34f228
je 0x158a6f
xorl %r14d, %r14d
movsd %xmm1, 0x8(%rsp)
movsd 0x1f67f4(%rip), %xmm0   # 0x34f228
subsd %xmm1, %xmm0
callq 0x10aeb4
movsd %xmm0, (%rsp)
movq %rbx, %rdi
movl %ebp, %esi
movl %r14d, %edx
callq 0x15854c
movsd 0x8(%rsp), %xmm1
movsd 0x1f67cb(%rip), %xmm0   # 0x34f228
addsd (%rsp), %xmm1
incl %r14d
movl 0x4(%rbx), %eax
decl %eax
cmpl %eax, %r14d
jb 0x158a26
ucomisd %xmm1, %xmm0
jb 0x158aaa
subsd %xmm1, %xmm0
movq %rbx, %rdi
movl %ebp, %esi
movl %r14d, %edx
callq 0x15854c
incl %ebp
cmpl (%rbx), %ebp
jb 0x158a0b
movq %rbx, %rdi
callq 0x1587b0
testb %al, %al
je 0x158ab9
addq $0x10, %rsp
popq %rbx
popq %r14
popq %rbp
retq
callq 0x48dea
callq 0x48e23
callq 0x48ece
callq 0x48e95
callq 0x48e5c