// File: /workspace/github_c_makefile_star2_O2/genometools[P]genometools/src/core/queue.c
// Function: gt_queue_remove
void gt_queue_remove(GtQueue *q, void *elem)
{
  long i, elemidx;
  gt_assert(q &&  gt_queue_size(q));
  if (q->front < q->back) { /* no wraparound */
    for (i = q->back-1; i >= q->front; i--) {
      if (q->contents[i] == elem)
        break;
    }
    elemidx = i;
    gt_assert(elemidx >= q->front); /* valid element found */
    for (i = elemidx+1; i < q->back; i++)
      q->contents[i-1] = q->contents[i];
    q->contents[q->back-1] = NULL;
    q->back--;
    if (q->front == q->back)
      q->front = q->back = 0; /* reset */
  }
  else { /* wraparound */
    for (i = q->back-1; i >= 0; i--) {
      if (q->contents[i] == elem)
        break;
    }
    elemidx = i;
    if (elemidx >= 0) { /* element found */
      for (i = elemidx+1; i < q->back; i++)
        q->contents[i-1] = q->contents[i];
      q->contents[q->back-1] = NULL;
      q->back--;
      if (q->back == 0) q->back = q->size;
      return;
    }
    for (i = q->size-1; i >= q->front; i--) {
      if (q->contents[i] == elem)
        break;
    }
    elemidx = i;
    gt_assert(elemidx >= q->front); /* valid element found */
    for (i = elemidx+1; i < q->size; i++)
      q->contents[i-1] = q->contents[i];
    q->contents[q->size-1] = q->contents[0];
    for (i = 1; i < q->back; i++)
      q->contents[i-1] = q->contents[i];
    q->contents[q->back-1] = NULL;
    q->back--;
    if (q->back == 0)
      q->back = q->size;
  }
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
testq %rdi, %rdi
je 0x5b466
movq %rsi, %r14
movq %rdi, %rbx
callq 0x5b20f
testq %rax, %rax
je 0x5b466
movq 0x8(%rbx), %rcx
movq 0x10(%rbx), %rax
cmpq %rax, %rcx
jge 0x5b34b
leaq 0x8(%rbx), %rdx
movq %rax, %rdi
cmpq %rcx, %rdi
jle 0x5b400
leaq -0x1(%rdi), %rsi
movq (%rbx), %r8
cmpq %r14, -0x8(%r8,%rdi,8)
movq %rsi, %rdi
jne 0x5b2fa
jmp 0x5b31f
movq (%rdi,%rsi,8), %r8
movq %r8, -0x8(%rdi,%rsi,8)
incq %rsi
movq (%rbx), %rdi
cmpq %rax, %rsi
jl 0x5b316
andq $0x0, -0x8(%rdi,%rax,8)
decq %rax
movq %rax, 0x10(%rbx)
cmpq %rax, %rcx
jne 0x5b3f8
xorps %xmm0, %xmm0
movups %xmm0, (%rdx)
jmp 0x5b3f8
movq %rax, %rsi
testq %rsi, %rsi
jle 0x5b38f
leaq -0x1(%rsi), %rdx
movq (%rbx), %rdi
cmpq %r14, -0x8(%rdi,%rsi,8)
movq %rdx, %rsi
jne 0x5b34e
jmp 0x5b36f
movq (%rcx,%rdx,8), %rsi
movq %rsi, -0x8(%rcx,%rdx,8)
incq %rdx
movq (%rbx), %rcx
cmpq %rax, %rdx
jl 0x5b366
andq $0x0, -0x8(%rcx,%rax,8)
decq %rax
movq %rax, 0x10(%rbx)
jne 0x5b3f8
movq 0x18(%rbx), %rax
jmp 0x5b3f4
movq 0x18(%rbx), %rdx
movq %rdx, %rdi
cmpq %rcx, %rdi
jle 0x5b42e
leaq -0x1(%rdi), %rsi
movq (%rbx), %r8
cmpq %r14, -0x8(%r8,%rdi,8)
movq %rsi, %rdi
jne 0x5b396
jmp 0x5b3bb
movq (%rcx,%rsi,8), %rdi
movq %rdi, -0x8(%rcx,%rsi,8)
incq %rsi
movq (%rbx), %rcx
cmpq %rdx, %rsi
jl 0x5b3b2
movq (%rcx), %rsi
movq %rsi, -0x8(%rcx,%rdx,8)
pushq $0x1
popq %rcx
movq (%rbx), %rsi
cmpq %rax, %rcx
jge 0x5b3e7
movq (%rsi,%rcx,8), %rdi
movq %rdi, -0x8(%rsi,%rcx,8)
incq %rcx
jmp 0x5b3d1
andq $0x0, -0x8(%rsi,%rax,8)
decq %rax
cmoveq %rdx, %rax
movq %rax, 0x10(%rbx)
addq $0x8, %rsp
popq %rbx
popq %r14
retq
movq 0xd2bb1(%rip), %rax     # 0x12dfb8
movq (%rax), %rdi
leaq 0x6ec55(%rip), %rsi     # 0xca066
leaq 0x7ffa1(%rip), %rdx     # 0xdb3b9
leaq 0x7ff8a(%rip), %rcx     # 0xdb3a9
leaq 0x7ff34(%rip), %r8      # 0xdb35a
movl $0x87, %r9d
jmp 0x5b45a
movq 0xd2b83(%rip), %rax     # 0x12dfb8
movq (%rax), %rdi
leaq 0x6ec27(%rip), %rsi     # 0xca066
leaq 0x7ff73(%rip), %rdx     # 0xdb3b9
leaq 0x7ff5c(%rip), %rcx     # 0xdb3a9
leaq 0x7ff06(%rip), %r8      # 0xdb35a
movl $0xa2, %r9d
xorl %eax, %eax
callq 0xb8c0
callq 0xb300
movq 0xd2b4b(%rip), %rax     # 0x12dfb8
movq (%rax), %rdi
leaq 0x6ebef(%rip), %rsi     # 0xca066
leaq 0x7fefa(%rip), %rdx     # 0xdb378
leaq 0x7ff24(%rip), %rcx     # 0xdb3a9
leaq 0x7fece(%rip), %r8      # 0xdb35a
movl $0x80, %r9d
jmp 0x5b45a