// File: /workspace/github_c_makefile_star2_O1/genometools[P]genometools/src/core/interval_tree.c
// Function: gt_interval_tree_remove
void gt_interval_tree_remove(GtIntervalTree *it, GtIntervalTreeNode *z)
{
  GtIntervalTreeNode *y, *x;
  gt_assert(it && it->size > 0);
  y = (z->left == it->nil || z->right == it->nil)
    ? z
    : gt_interval_tree_get_successor(it, z);
  x = (y->left != it->nil) ? y->left : y->right;
  gt_assert(y);

  x->parent = y->parent;

  if (y->parent == it->nil) {
    it->root = x;
  } else {
    if (y == y->parent->left) {
      y->parent->left = x;
    } else {
      y->parent->right = x;
    }
  }

  if (y != z) {
    z->max = y->max;
    z->low = y->low;
    z->high = y->high;
    z->data = y->data;
  }
  interval_tree_max_fixup(it, it->root, z->parent);
  if (y->color == BLACK) {
    y->color = z->color;
    interval_tree_delete_fixup(it, x);
  }
  if (y != it->nil)
    gt_interval_tree_node_delete(it, y);
  it->size--;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %rbx
pushq %rax
testq %rdi, %rdi
je 0x7952e
movq %rdi, %rbx
cmpq $0x0, 0x50(%rdi)
je 0x7952e
movq 0x48(%rbx), %rax
movq %rsi, %r14
cmpq %rax, 0x8(%rsi)
je 0x792cf
movq 0x10(%rsi), %rcx
movq %rsi, %r14
cmpq %rax, %rcx
je 0x792cf
testq %rcx, %rcx
je 0x792bb
movq %rcx, %r14
movq 0x8(%rcx), %rcx
cmpq %rax, %rcx
jne 0x792ad
jmp 0x792cf
movq %rsi, %rcx
movq (%rcx), %r14
cmpq %rax, %r14
je 0x792cf
cmpq 0x10(%r14), %rcx
movq %r14, %rcx
je 0x792be
movq 0x8(%r14), %r15
cmpq %rax, %r15
jne 0x792dc
movq 0x10(%r14), %r15
testq %r14, %r14
je 0x79533
movq (%r14), %rcx
movq %rcx, (%r15)
movq (%r14), %rdx
movq %rbx, %rcx
cmpq %rax, %rdx
je 0x79306
leaq 0x8(%rdx), %rdi
leaq 0x10(%rdx), %rcx
cmpq 0x8(%rdx), %r14
cmoveq %rdi, %rcx
movq %r15, (%rcx)
cmpq %rsi, %r14
je 0x79327
movq 0x38(%r14), %rcx
movq %rcx, 0x38(%rsi)
movups 0x28(%r14), %xmm0
movups %xmm0, 0x28(%rsi)
movq 0x18(%r14), %rcx
movq %rcx, 0x18(%rsi)
movq (%rbx), %rcx
movq (%rsi), %rdx
cmpq %rdx, %rax
sete %dil
cmpq %rcx, %rdx
sete %r8b
orb %dil, %r8b
jne 0x793a8
movq 0x8(%rdx), %rdi
cmpq %rax, %rdi
je 0x7938a
cmpq %rax, %rdi
sete %r9b
movq 0x10(%rdx), %r8
cmpq %rax, %r8
setne %r10b
orb %r9b, %r10b
je 0x79384
cmpq %rax, %r8
sete %r9b
cmpq %rax, %rdi
sete %r10b
orb %r9b, %r10b
jne 0x7939b
movq 0x38(%rdi), %r9
movq 0x38(%r8), %rdi
cmpq %rdi, %r9
cmovaq %r9, %rdi
jmp 0x79397
movq 0x38(%rdi), %rdi
jmp 0x79397
movq 0x10(%rdx), %r8
cmpq %rax, %r8
je 0x79349
movq 0x38(%r8), %rdi
movq %rdi, 0x38(%rdx)
movq (%rdx), %rdx
cmpq %rcx, %rdx
je 0x793a8
cmpq %rax, %rdx
jne 0x79340
cmpl $0x0, 0x20(%r14)
jne 0x793c5
movl 0x20(%rsi), %eax
movl %eax, 0x20(%r14)
cmpl $0x0, 0x20(%r15)
je 0x793e5
movl $0x0, 0x20(%r15)
cmpq 0x48(%rbx), %r14
je 0x793d6
movq %rbx, %rdi
movq %r14, %rsi
callq 0x78e73
decq 0x50(%rbx)
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
xorl %ebp, %ebp
cmpq %r15, (%rbx)
je 0x793bd
movq (%r15), %rax
movq 0x8(%rax), %rdx
cmpq %rdx, %r15
je 0x7948d
cmpl $0x1, 0x20(%rdx)
jne 0x79425
movl $0x0, 0x20(%rdx)
movl $0x1, 0x20(%rax)
movq %rbx, %rdi
movq %rbx, %rsi
movq %rax, %rdx
callq 0x79e40
movq (%r15), %rax
movq 0x8(%rax), %rdx
movq 0x10(%rdx), %rax
cmpl $0x0, 0x20(%rax)
jne 0x7943d
movq 0x8(%rdx), %rcx
cmpl $0x0, 0x20(%rcx)
je 0x79525
movq 0x8(%rdx), %rcx
cmpl $0x0, 0x20(%rcx)
jne 0x79467
movl $0x0, 0x20(%rax)
movl $0x1, 0x20(%rdx)
movq %rbx, %rdi
movq %rbx, %rsi
callq 0x79d95
movq (%r15), %rax
movq 0x8(%rax), %rdx
movq (%r15), %rax
movl 0x20(%rax), %ecx
movl %ecx, 0x20(%rdx)
movl %ebp, 0x20(%rax)
movq 0x8(%rdx), %rcx
movl %ebp, 0x20(%rcx)
movq %rbx, %rdi
movq %rbx, %rsi
movq %rax, %rdx
callq 0x79e40
jmp 0x7950f
movq 0x10(%rax), %rdx
cmpl $0x1, 0x20(%rdx)
jne 0x794ba
movl $0x0, 0x20(%rdx)
movl $0x1, 0x20(%rax)
movq %rbx, %rdi
movq %rbx, %rsi
movq %rax, %rdx
callq 0x79d95
movq (%r15), %rax
movq 0x10(%rax), %rdx
movq 0x10(%rdx), %rax
cmpl $0x0, 0x20(%rax)
jne 0x794ee
movq 0x8(%rdx), %rax
cmpl $0x0, 0x20(%rax)
je 0x79525
movl $0x0, 0x20(%rax)
movl $0x1, 0x20(%rdx)
movq %rbx, %rdi
movq %rbx, %rsi
callq 0x79e40
movq (%r15), %rax
movq 0x10(%rax), %rdx
movq (%r15), %rax
movl 0x20(%rax), %ecx
movl %ecx, 0x20(%rdx)
movl %ebp, 0x20(%rax)
movq 0x10(%rdx), %rcx
movl %ebp, 0x20(%rcx)
movq %rbx, %rdi
movq %rbx, %rsi
movq %rax, %rdx
callq 0x79d95
movq %rbx, %r15
movq (%r15), %r15
cmpl $0x0, 0x20(%r15)
je 0x793e7
jmp 0x793bd
movl $0x1, 0x20(%rdx)
jmp 0x79512
callq 0x1ca98
callq 0x1ca5f