// File: /workspace/github_c_makefile_star2_O0/genometools[P]genometools/src/extended/ranked_list.c
// Function: gt_ranked_list_insert
void gt_ranked_list_insert(GtRankedList *ranked_list, void *elem)
{
  /* bool nodecreated = false; */
  if (ranked_list->currentsize < ranked_list->maxsize)
  {
    if (ranked_list->currentsize == 0 ||
        ranked_list->comparefunction(elem,ranked_list->worstelement,
                                     ranked_list->compareinfo) < 0)
    {
      ranked_list->worstelement = elem;
    }
    /* (void) gt_rbtree_search(ranked_list->root, elem, &nodecreated); */
    gt_dlist_add(ranked_list->list, elem);
    /* if (nodecreated)
    { */
    ranked_list->currentsize++;
    /* } */
  } else
  {
/* new element is not as bad as worst element, so insert it and
  and delete the worst element */
    if (ranked_list->comparefunction(ranked_list->worstelement, elem,
                                     ranked_list->compareinfo) <= 0)
    {
      GtDlistelem *oldelem = gt_dlist_first(ranked_list->list);
      if (ranked_list->free_func != NULL)
        ranked_list->free_func(gt_dlistelem_get_data(oldelem));
      gt_dlist_remove(ranked_list->list, oldelem);
      gt_dlist_add(ranked_list->list, elem);
      ranked_list->worstelement =
                       gt_dlistelem_get_data(gt_dlist_first(ranked_list->list));
      /* (void) gt_rbtree_search(ranked_list->root, elem, &nodecreated);
      if (nodecreated)
      {
        if (gt_rbtree_erase(ranked_list->root, ranked_list->worstelement) != 0)
        {
          fprintf(stderr,"%s: deletion failed\n",__func__);
          exit(GT_EXIT_PROGRAMMING_ERROR);
        }
        ranked_list->worstelement = gt_rbtree_minimum_key(ranked_list->root);
      } */
    } else if (ranked_list->free_func != NULL)
    {
      ranked_list->free_func(elem);
    }
  }
}

// Assembly:
subq $0x28, %rsp
movq %rdi, 0x20(%rsp)
movq %rsi, 0x18(%rsp)
movq 0x20(%rsp), %rax
movq (%rax), %rax
movq 0x20(%rsp), %rcx
cmpq 0x8(%rcx), %rax
jae 0x1b70b8
movq 0x20(%rsp), %rax
cmpq $0x0, (%rax)
je 0x1b7083
movq 0x20(%rsp), %rax
movq 0x10(%rax), %rax
movq 0x18(%rsp), %rdi
movq 0x20(%rsp), %rcx
movq 0x20(%rcx), %rsi
movq 0x20(%rsp), %rcx
movq 0x28(%rcx), %rdx
callq *%rax
cmpl $0x0, %eax
jge 0x1b7091
movq 0x18(%rsp), %rcx
movq 0x20(%rsp), %rax
movq %rcx, 0x20(%rax)
movq 0x20(%rsp), %rax
movq 0x30(%rax), %rdi
movq 0x18(%rsp), %rsi
callq 0xa61a0
movq 0x20(%rsp), %rax
movq (%rax), %rcx
addq $0x1, %rcx
movq %rcx, (%rax)
jmp 0x1b718e
movq 0x20(%rsp), %rax
movq 0x10(%rax), %rax
movq 0x20(%rsp), %rcx
movq 0x20(%rcx), %rdi
movq 0x18(%rsp), %rsi
movq 0x20(%rsp), %rcx
movq 0x28(%rcx), %rdx
callq *%rax
cmpl $0x0, %eax
jg 0x1b716e
movq 0x20(%rsp), %rax
movq 0x30(%rax), %rdi
callq 0xa5f40
movq %rax, 0x10(%rsp)
movq 0x20(%rsp), %rax
cmpq $0x0, 0x18(%rax)
je 0x1b7124
movq 0x20(%rsp), %rax
movq 0x18(%rax), %rax
movq %rax, 0x8(%rsp)
movq 0x10(%rsp), %rdi
callq 0xa60d0
movq %rax, %rdi
movq 0x8(%rsp), %rax
callq *%rax
movq 0x20(%rsp), %rax
movq 0x30(%rax), %rdi
movq 0x10(%rsp), %rsi
callq 0xa6660
movq 0x20(%rsp), %rax
movq 0x30(%rax), %rdi
movq 0x18(%rsp), %rsi
callq 0xa61a0
movq 0x20(%rsp), %rax
movq 0x30(%rax), %rdi
callq 0xa5f40
movq %rax, %rdi
callq 0xa60d0
movq %rax, %rcx
movq 0x20(%rsp), %rax
movq %rcx, 0x20(%rax)
jmp 0x1b718c
movq 0x20(%rsp), %rax
cmpq $0x0, 0x18(%rax)
je 0x1b718a
movq 0x20(%rsp), %rax
movq 0x18(%rax), %rax
movq 0x18(%rsp), %rdi
callq *%rax
jmp 0x1b718c
jmp 0x1b718e
addq $0x28, %rsp
retq
nopw %cs:(%rax,%rax)