// File: /workspace/github_c_makefile_star2_O3/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 0x799ad
movq %rdi, %rbx
cmpq $0x0, 0x50(%rdi)
je 0x799ad
movq 0x8(%rsi), %r15
movq 0x48(%rbx), %rax
cmpq %rax, %r15
je 0x7976f
movq 0x10(%rsi), %rcx
movq %rsi, %r14
cmpq %rax, %rcx
je 0x7978c
testq %rcx, %rcx
je 0x79774
movq %rcx, %r15
movq %r15, %r14
movq 0x8(%r15), %r15
cmpq %rax, %r15
jne 0x79761
jmp 0x7978c
movq %rsi, %r14
jmp 0x7978c
movq %rsi, %rcx
movq (%rcx), %r14
cmpq %rax, %r14
je 0x79788
cmpq 0x10(%r14), %rcx
movq %r14, %rcx
je 0x79777
movq 0x8(%r14), %r15
cmpq %rax, %r15
jne 0x79795
movq 0x10(%r14), %r15
movq (%r14), %rdx
movq %rdx, (%r15)
movq %rbx, %rcx
cmpq %rax, %rdx
je 0x797b3
leaq 0x8(%rdx), %rdi
leaq 0x10(%rdx), %rcx
cmpq 0x8(%rdx), %r14
cmoveq %rdi, %rcx
movq %r15, (%rcx)
cmpq %rsi, %r14
je 0x797d4
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 0x7982a
movq 0x8(%rdx), %rdi
movq 0x10(%rdx), %r8
cmpq %rax, %rdi
je 0x79810
movq 0x38(%rdi), %rdi
cmpq %rax, %r8
je 0x79819
movq 0x38(%r8), %r8
cmpq %r8, %rdi
cmovbeq %r8, %rdi
jmp 0x79819
cmpq %rax, %r8
je 0x7981d
movq 0x38(%r8), %rdi
movq %rdi, 0x38(%rdx)
movq (%rdx), %rdx
cmpq %rcx, %rdx
je 0x7982a
cmpq %rax, %rdx
jne 0x797ed
cmpl $0x0, 0x20(%r14)
jne 0x7998e
movl 0x20(%rsi), %ecx
movl %ecx, 0x20(%r14)
cmpl $0x0, 0x20(%r15)
jne 0x79986
xorl %ebp, %ebp
cmpq %r15, (%rbx)
je 0x79982
movq (%r15), %rdx
movq 0x8(%rdx), %rax
cmpq %rax, %r15
je 0x798cd
cmpl $0x1, 0x20(%rax)
jne 0x79884
movl $0x0, 0x20(%rax)
movl $0x1, 0x20(%rdx)
movq %rbx, %rdi
movq %rbx, %rsi
callq 0x7a1cb
movq (%r15), %rdx
movq 0x8(%rdx), %rax
movq 0x8(%rax), %rcx
movq 0x10(%rax), %rsi
cmpl $0x0, 0x20(%rsi)
movl 0x20(%rcx), %edi
je 0x7994b
testl %edi, %edi
jne 0x7994f
movl $0x0, 0x20(%rsi)
movl $0x1, 0x20(%rax)
movq %rbx, %rdi
movq %rbx, %rsi
movq %rax, %rdx
callq 0x7a11d
movq (%r15), %rdx
movq 0x8(%rdx), %rax
movq 0x8(%rax), %rcx
jmp 0x7994f
movq 0x10(%rdx), %rax
cmpl $0x1, 0x20(%rax)
jne 0x798f7
movl $0x0, 0x20(%rax)
movl $0x1, 0x20(%rdx)
movq %rbx, %rdi
movq %rbx, %rsi
callq 0x7a11d
movq (%r15), %rdx
movq 0x10(%rdx), %rax
movq 0x10(%rax), %rcx
cmpl $0x0, 0x20(%rcx)
jne 0x79932
movq 0x8(%rax), %rcx
cmpl $0x0, 0x20(%rcx)
je 0x79979
movl $0x0, 0x20(%rcx)
movl $0x1, 0x20(%rax)
movq %rbx, %rdi
movq %rbx, %rsi
movq %rax, %rdx
callq 0x7a1cb
movq (%r15), %rdx
movq 0x10(%rdx), %rax
movq 0x10(%rax), %rcx
movl 0x20(%rdx), %esi
movl %esi, 0x20(%rax)
movl %ebp, 0x20(%rdx)
movl %ebp, 0x20(%rcx)
movq %rbx, %rdi
movq %rbx, %rsi
callq 0x7a11d
jmp 0x79966
testl %edi, %edi
je 0x79979
movl 0x20(%rdx), %esi
movl %esi, 0x20(%rax)
movl %ebp, 0x20(%rdx)
movl %ebp, 0x20(%rcx)
movq %rbx, %rdi
movq %rbx, %rsi
callq 0x7a1cb
movq %rbx, %r15
movq (%r15), %r15
cmpl $0x0, 0x20(%r15)
je 0x79849
jmp 0x79982
movl $0x1, 0x20(%rax)
jmp 0x79969
movq 0x48(%rbx), %rax
movl $0x0, 0x20(%r15)
cmpq %rax, %r14
je 0x7999e
movq %rbx, %rdi
movq %r14, %rsi
callq 0x79313
decq 0x50(%rbx)
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
callq 0x1ca0a