// File: /workspace/github_c_makefile_star2_O0/genometools[P]genometools/src/extended/priority_queue.c
// Function: gt_priority_queue_add
void gt_priority_queue_add(GtPriorityQueue *pq, void *value)
{
  gt_assert(pq != NULL && !gt_priority_queue_is_full(pq));
  if (pq->capacity < (GtUword) GT_MINPQSIZE)
  {
    void **ptr;

    /* store elements in reverse order, i.e.\ with the minimum element
       at the last index */
    /* move elements to the right until an element larger or equal than
       the key is found. */
    for (ptr = pq->elements + pq->numofelements; ptr > pq->elements; ptr--)
    {
      if (*(ptr-1) == NULL || pq->cmpfun(*(ptr-1),value) < 0)
      {
        *ptr = *(ptr-1);
      } else
      {
        break;
      }
    }
    *ptr = value;
    pq->numofelements++;
  } else
  {
    GtUword idx = ++pq->numofelements;

    while (true)
    {
      const GtUword newidx = GT_HEAP_PARENT(idx);

      if (newidx == 0 || pq->cmpfun(pq->elements[newidx],value) <= 0)
      {
        break;
      }
      gt_assert(idx > 0);
      pq->elements[idx] = pq->elements[newidx];
      idx = newidx;
    }
    gt_assert(idx > 0);
    pq->elements[idx] = value;
  }
}

// Assembly:
subq $0x28, %rsp
movq %rdi, 0x20(%rsp)
movq %rsi, 0x18(%rsp)
cmpq $0x0, 0x20(%rsp)
je 0x1b6146
movq 0x20(%rsp), %rdi
callq 0x1b60b0
testb $0x1, %al
jne 0x1b6146
jmp 0x1b617e
movq 0x485e53(%rip), %rax    # 0x63bfa0
movq (%rax), %rdi
leaq 0x35febc(%rip), %rsi    # 0x516013
leaq 0x3aa874(%rip), %rdx    # 0x5609d2
leaq 0x3aa89a(%rip), %rcx    # 0x5609ff
leaq 0x3aa808(%rip), %r8     # 0x560974
movl $0x42, %r9d
movb $0x0, %al
callq 0x199f0
callq 0x19370
jmp 0x1b6180
movq 0x20(%rsp), %rax
cmpq $0x10, 0x8(%rax)
jae 0x1b6231
movq 0x20(%rsp), %rax
movq 0x20(%rax), %rax
movq 0x20(%rsp), %rcx
movq 0x10(%rcx), %rcx
shlq $0x3, %rcx
addq %rcx, %rax
movq %rax, 0x10(%rsp)
movq 0x10(%rsp), %rax
movq 0x20(%rsp), %rcx
cmpq 0x20(%rcx), %rax
jbe 0x1b620e
movq 0x10(%rsp), %rax
cmpq $0x0, -0x8(%rax)
je 0x1b61e7
movq 0x20(%rsp), %rax
movq (%rax), %rax
movq 0x10(%rsp), %rcx
movq -0x8(%rcx), %rdi
movq 0x18(%rsp), %rsi
callq *%rax
cmpl $0x0, %eax
jge 0x1b61fa
movq 0x10(%rsp), %rax
movq -0x8(%rax), %rcx
movq 0x10(%rsp), %rax
movq %rcx, (%rax)
jmp 0x1b61fc
jmp 0x1b620e
jmp 0x1b61fe
movq 0x10(%rsp), %rax
addq $-0x8, %rax
movq %rax, 0x10(%rsp)
jmp 0x1b61ae
movq 0x18(%rsp), %rcx
movq 0x10(%rsp), %rax
movq %rcx, (%rax)
movq 0x20(%rsp), %rax
movq 0x10(%rax), %rcx
addq $0x1, %rcx
movq %rcx, 0x10(%rax)
jmp 0x1b6351
movq 0x20(%rsp), %rcx
movq 0x10(%rcx), %rax
addq $0x1, %rax
movq %rax, 0x10(%rcx)
movq %rax, 0x8(%rsp)
movq 0x8(%rsp), %rax
shrq %rax
movq %rax, (%rsp)
cmpq $0x0, (%rsp)
je 0x1b627f
movq 0x20(%rsp), %rax
movq (%rax), %rax
movq 0x20(%rsp), %rcx
movq 0x20(%rcx), %rcx
movq (%rsp), %rdx
movq (%rcx,%rdx,8), %rdi
movq 0x18(%rsp), %rsi
callq *%rax
cmpl $0x0, %eax
jg 0x1b6281
jmp 0x1b62f6
jmp 0x1b6283
cmpq $0x0, 0x8(%rsp)
ja 0x1b62c3
movq 0x485d0e(%rip), %rax    # 0x63bfa0
movq (%rax), %rdi
leaq 0x35fd77(%rip), %rsi    # 0x516013
leaq 0x383c70(%rip), %rdx    # 0x539f13
leaq 0x3aa755(%rip), %rcx    # 0x5609ff
leaq 0x3aa6c3(%rip), %r8     # 0x560974
movl $0x63, %r9d
movb $0x0, %al
callq 0x199f0
callq 0x19370
jmp 0x1b62c5
movq 0x20(%rsp), %rax
movq 0x20(%rax), %rax
movq (%rsp), %rcx
movq (%rax,%rcx,8), %rdx
movq 0x20(%rsp), %rax
movq 0x20(%rax), %rax
movq 0x8(%rsp), %rcx
movq %rdx, (%rax,%rcx,8)
movq (%rsp), %rax
movq %rax, 0x8(%rsp)
jmp 0x1b6247
jmp 0x1b62f8
cmpq $0x0, 0x8(%rsp)
ja 0x1b6338
movq 0x485c99(%rip), %rax    # 0x63bfa0
movq (%rax), %rdi
leaq 0x35fd02(%rip), %rsi    # 0x516013
leaq 0x383bfb(%rip), %rdx    # 0x539f13
leaq 0x3aa6e0(%rip), %rcx    # 0x5609ff
leaq 0x3aa64e(%rip), %r8     # 0x560974
movl $0x67, %r9d
movb $0x0, %al
callq 0x199f0
callq 0x19370
jmp 0x1b633a
movq 0x18(%rsp), %rdx
movq 0x20(%rsp), %rax
movq 0x20(%rax), %rax
movq 0x8(%rsp), %rcx
movq %rdx, (%rax,%rcx,8)
addq $0x28, %rsp
retq
nopw %cs:(%rax,%rax)