// File: /workspace/github_c_makefile_star2_O3/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 %rbx
testq %rdi, %rdi
je 0x7c7f9
movq 0x8(%rdi), %rcx
movq 0x10(%rdi), %rax
movq %rax, %rdx
subq %rcx, %rdx
setle %r8b
movq %rax, %r9
orq %rcx, %r9
setne %r9b
testb %r9b, %r8b
je 0x7c665
addq 0x18(%rdi), %rdx
testq %rdx, %rdx
je 0x7c7f9
cmpq %rcx, %rax
jle 0x7c6ee
leaq 0x8(%rdi), %rdx
leaq (,%rax,8), %r8
movl $0x1, %r11d
leaq (%rax,%r11), %r9
decq %r9
cmpq %rcx, %r9
jle 0x7c7ef
movq (%rdi), %r10
leaq (%r10,%r8), %rbx
leaq -0x1(%r11), %r9
cmpq %rsi, -0x10(%rbx,%r11,8)
movq %r9, %r11
jne 0x7c685
leaq (%rax,%r9), %rsi
cmpq %rax, %rsi
jge 0x7c6ca
movq (%rdi), %rsi
addq %r8, %rsi
movq (%rsi,%r9,8), %r10
movq %r10, -0x8(%rsi,%r9,8)
incq %r9
jne 0x7c6b3
movq (%rdi), %r10
movq $0x0, -0x8(%r10,%rax,8)
decq %rax
movq %rax, 0x10(%rdi)
cmpq %rax, %rcx
jne 0x7c7ed
xorps %xmm0, %xmm0
movups %xmm0, (%rdx)
jmp 0x7c7ed
leaq (,%rax,8), %rdx
movl $0x1, %r10d
leaq (%rax,%r10), %r8
decq %r8
testq %r8, %r8
jle 0x7c75c
movq (%rdi), %r9
leaq (%r9,%rdx), %r11
leaq -0x1(%r10), %r8
cmpq %rsi, -0x10(%r11,%r10,8)
movq %r8, %r10
jne 0x7c6fc
leaq (%rax,%r8), %rcx
cmpq %rax, %rcx
jge 0x7c73d
movq (%rdi), %rcx
addq %rdx, %rcx
movq (%rcx,%r8,8), %rsi
movq %rsi, -0x8(%rcx,%r8,8)
incq %r8
jne 0x7c726
movq (%rdi), %r9
movq $0x0, -0x8(%r9,%rax,8)
decq %rax
movq %rax, 0x10(%rdi)
jne 0x7c7ed
movq 0x18(%rdi), %rax
jmp 0x7c7e9
movq 0x18(%rdi), %rdx
leaq (,%rdx,8), %r8
movl $0x1, %r11d
leaq (%rdx,%r11), %r9
decq %r9
cmpq %rcx, %r9
jle 0x7c7f4
movq (%rdi), %r10
leaq (%r10,%r8), %rbx
leaq -0x1(%r11), %r9
cmpq %rsi, -0x10(%rbx,%r11,8)
movq %r9, %r11
jne 0x7c76e
leaq (%rdx,%r9), %rcx
cmpq %rdx, %rcx
jge 0x7c7af
movq (%rdi), %rcx
addq %r8, %rcx
movq (%rcx,%r9,8), %rsi
movq %rsi, -0x8(%rcx,%r9,8)
incq %r9
jne 0x7c798
movq (%rdi), %r10
movq (%r10), %rcx
movq %rcx, -0x8(%r10,%rdx,8)
cmpq $0x2, %rax
jl 0x7c7d6
movl $0x1, %ecx
movq (%rdi), %rsi
movq (%rsi,%rcx,8), %r8
movq %r8, -0x8(%rsi,%rcx,8)
incq %rcx
cmpq %rcx, %rax
jne 0x7c7c2
movq (%rdi), %rcx
movq $0x0, -0x8(%rcx,%rax,8)
decq %rax
cmoveq %rdx, %rax
movq %rax, 0x10(%rdi)
popq %rbx
retq
callq 0x1cfe0
callq 0x1cfa7
callq 0x1d019