// File: /workspace/github_c_makefile_star2_O1/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 0x7c3cc
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 0x7c229
addq 0x18(%rdi), %rdx
testq %rdx, %rdx
je 0x7c3cc
cmpq %rcx, %rax
jle 0x7c2be
leaq 0x8(%rdi), %rdx
leaq (,%rax,8), %r8
movl $0x1, %r10d
leaq (%rax,%r10), %r11
decq %r11
cmpq %rcx, %r11
jle 0x7c3c2
movq (%rdi), %rbx
addq %r8, %rbx
leaq -0x1(%r10), %r9
cmpq %rsi, -0x10(%rbx,%r10,8)
movq %r9, %r10
jne 0x7c24d
cmpq %rcx, %r11
jle 0x7c3c2
leaq (%rax,%r9), %rsi
cmpq %rax, %rsi
jge 0x7c297
movq (%rdi), %rsi
addq %r8, %rsi
movq (%rsi,%r9,8), %r10
movq %r10, -0x8(%rsi,%r9,8)
incq %r9
jne 0x7c283
movq (%rdi), %rsi
movq $0x0, -0x8(%rsi,%rax,8)
decq %rax
movq %rax, 0x10(%rdi)
cmpq %rax, %rcx
jne 0x7c3c0
xorps %xmm0, %xmm0
movups %xmm0, (%rdx)
jmp 0x7c3c0
leaq (,%rax,8), %rdx
movl $0x1, %r9d
leaq (%rax,%r9), %r8
decq %r8
testq %r8, %r8
jle 0x7c32b
movq (%rdi), %r10
addq %rdx, %r10
leaq -0x1(%r9), %r8
cmpq %rsi, -0x10(%r10,%r9,8)
movq %r8, %r9
jne 0x7c2cc
leaq (%rax,%r8), %rcx
cmpq %rax, %rcx
jge 0x7c309
movq (%rdi), %rcx
addq %rdx, %rcx
movq (%rcx,%r8,8), %rsi
movq %rsi, -0x8(%rcx,%r8,8)
incq %r8
jne 0x7c2f5
movq (%rdi), %rcx
movq $0x0, -0x8(%rcx,%rax,8)
decq %rax
movq %rax, 0x10(%rdi)
jne 0x7c3c0
movq 0x18(%rdi), %rax
jmp 0x7c3bc
movq 0x18(%rdi), %rdx
leaq (,%rdx,8), %r8
movl $0x1, %r10d
leaq (%rdx,%r10), %r11
decq %r11
cmpq %rcx, %r11
jle 0x7c3c7
movq (%rdi), %rbx
addq %r8, %rbx
leaq -0x1(%r10), %r9
cmpq %rsi, -0x10(%rbx,%r10,8)
movq %r9, %r10
jne 0x7c33d
cmpq %rcx, %r11
jle 0x7c3c7
leaq (%rdx,%r9), %rcx
cmpq %rdx, %rcx
jge 0x7c37f
movq (%rdi), %rcx
addq %r8, %rcx
movq (%rcx,%r9,8), %rsi
movq %rsi, -0x8(%rcx,%r9,8)
incq %r9
jne 0x7c36b
movq (%rdi), %rcx
movq (%rcx), %rsi
movq %rsi, -0x8(%rcx,%rdx,8)
cmpq $0x2, %rax
jl 0x7c3a9
movl $0x1, %ecx
movq (%rdi), %rsi
movq (%rsi,%rcx,8), %r8
movq %r8, -0x8(%rsi,%rcx,8)
incq %rcx
cmpq %rcx, %rax
jne 0x7c395
movq (%rdi), %rcx
movq $0x0, -0x8(%rcx,%rax,8)
decq %rax
cmoveq %rdx, %rax
movq %rax, 0x10(%rdi)
popq %rbx
retq
callq 0x1d00f
callq 0x1cfd6
callq 0x1d048