// File: /workspace/github_c_makefile_star2_O3/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 0x151128
movq %rdi, %rbx
cmpl $0x1, (%rdi)
jne 0x150f75
xorpd %xmm1, %xmm1
xorl %ebp, %ebp
jmp 0x150fc8
xorpd %xmm1, %xmm1
xorl %ebp, %ebp
movsd %xmm1, 0x8(%rsp)
movsd 0x1f529f(%rip), %xmm0   # 0x346228
subsd %xmm1, %xmm0
callq 0x105dfd
movsd %xmm0, (%rsp)
movq %rbx, %rdi
movl %ebp, %esi
callq 0x150b0e
movsd 0x8(%rsp), %xmm1
addsd (%rsp), %xmm1
incl %ebp
movl (%rbx), %eax
decl %eax
cmpl %eax, %ebp
jb 0x150f7b
movsd 0x1f526a(%rip), %xmm0   # 0x346228
ucomisd %xmm1, %xmm0
jb 0x151132
movsd 0x1f5258(%rip), %xmm0   # 0x346228
subsd %xmm1, %xmm0
movq %rbx, %rdi
movl %ebp, %esi
callq 0x150b0e
movl (%rbx), %eax
testl %eax, %eax
je 0x151109
cmpl $0x1, %eax
sete %al
xorl %ebp, %ebp
xorpd %xmm1, %xmm1
movl $0x0, %r14d
testb $0x1, %al
movsd 0x1f5224(%rip), %xmm0   # 0x346228
jne 0x15105b
xorl %r14d, %r14d
movsd %xmm1, 0x8(%rsp)
movsd 0x1f5211(%rip), %xmm0   # 0x346228
subsd %xmm1, %xmm0
callq 0x105dfd
movsd %xmm0, (%rsp)
movq %rbx, %rdi
movl %ebp, %esi
movl %r14d, %edx
callq 0x150b75
movsd 0x8(%rsp), %xmm1
movsd 0x1f51e8(%rip), %xmm0   # 0x346228
addsd (%rsp), %xmm1
incl %r14d
movl (%rbx), %eax
decl %eax
cmpl %eax, %r14d
jb 0x151009
ucomisd %xmm1, %xmm0
jb 0x15111e
subsd %xmm1, %xmm0
movq %rbx, %rdi
movl %ebp, %esi
movl %r14d, %edx
callq 0x150b75
incl %ebp
movl (%rbx), %ecx
xorl %eax, %eax
cmpl %ecx, %ebp
jb 0x150ff0
testl %ecx, %ecx
je 0x151109
xorl %ebp, %ebp
xorpd %xmm1, %xmm1
cmpl $0x1, 0x4(%rbx)
movl $0x0, %r14d
movsd 0x1f518e(%rip), %xmm0   # 0x346228
je 0x1510ee
xorl %r14d, %r14d
movsd %xmm1, 0x8(%rsp)
movsd 0x1f517b(%rip), %xmm0   # 0x346228
subsd %xmm1, %xmm0
callq 0x105dfd
movsd %xmm0, (%rsp)
movq %rbx, %rdi
movl %ebp, %esi
movl %r14d, %edx
callq 0x150bec
movsd 0x8(%rsp), %xmm1
movsd 0x1f5152(%rip), %xmm0   # 0x346228
addsd (%rsp), %xmm1
incl %r14d
movl 0x4(%rbx), %eax
decl %eax
cmpl %eax, %r14d
jb 0x15109f
ucomisd %xmm1, %xmm0
jb 0x151123
subsd %xmm1, %xmm0
movq %rbx, %rdi
movl %ebp, %esi
movl %r14d, %edx
callq 0x150bec
incl %ebp
cmpl (%rbx), %ebp
jb 0x151084
movq %rbx, %rdi
callq 0x150e36
testb %al, %al
je 0x15112d
addq $0x10, %rsp
popq %rbx
popq %r14
popq %rbp
retq
callq 0x47faf
callq 0x47fe8
callq 0x4805a
callq 0x48021
callq 0x47f76