// File: /workspace/github_c_makefile_star2_O0/genometools[P]genometools/src/core/interval_tree.c
// Function: interval_tree_insert_internal
static void interval_tree_insert_internal(GtIntervalTree *it,
                                          GtIntervalTreeNode **root,
                                          GtIntervalTreeNode *z)
{
  GtIntervalTreeNode* y;
  interval_tree_insert(it, root, z);
  z->color = RED;
  while (z != *root && z->parent->color == RED)
  {
    if (z->parent == z->parent->parent->left)
    {
      y = z->parent->parent->right;
      if (y != it->nil && y->color == RED)
      {
        z->parent->color = BLACK;
        y->color = BLACK;
        z->parent->parent->color = RED;
        z = z->parent->parent;
      }
      else
      {
        if (z == z->parent->right)
        {
          z = z->parent;
          interval_tree_left_rotate(it, root, z);
        }
        z->parent->color = BLACK;
        z->parent->parent->color = RED;
        interval_tree_right_rotate(it, root, z->parent->parent);
      }
    }
    else
    {
      y = z->parent->parent->left;
      if (y != it->nil && y->color == RED)
      {
        z->parent->color = BLACK;
        y->color = BLACK;
        z->parent->parent->color = RED;
        z = z->parent->parent;
      }
      else
      {
        if (z == z->parent->left)
        {
          z = z->parent;
          interval_tree_right_rotate(it, root, z);
        }
        z->parent->color = BLACK;
        z->parent->parent->color = RED;
        interval_tree_left_rotate(it, root, z->parent->parent);
      }
    }
  }
  (*root)->color = BLACK;
}

// Assembly:
subq $0x28, %rsp
movq %rdi, 0x20(%rsp)
movq %rsi, 0x18(%rsp)
movq %rdx, 0x10(%rsp)
movq 0x20(%rsp), %rdi
movq 0x18(%rsp), %rsi
movq 0x10(%rsp), %rdx
callq 0x8bb80
movq 0x10(%rsp), %rax
movl $0x1, 0x20(%rax)
movq 0x10(%rsp), %rcx
movq 0x18(%rsp), %rdx
xorl %eax, %eax
cmpq (%rdx), %rcx
movb %al, 0x7(%rsp)
je 0x8a2cb
movq 0x10(%rsp), %rax
movq (%rax), %rax
cmpl $0x1, 0x20(%rax)
sete %al
movb %al, 0x7(%rsp)
movb 0x7(%rsp), %al
testb $0x1, %al
jne 0x8a2d8
jmp 0x8a4bb
movq 0x10(%rsp), %rax
movq (%rax), %rax
movq 0x10(%rsp), %rcx
movq (%rcx), %rcx
movq (%rcx), %rcx
cmpq 0x8(%rcx), %rax
jne 0x8a3d7
movq 0x10(%rsp), %rax
movq (%rax), %rax
movq (%rax), %rax
movq 0x10(%rax), %rax
movq %rax, 0x8(%rsp)
movq 0x8(%rsp), %rax
movq 0x20(%rsp), %rcx
cmpq 0x48(%rcx), %rax
je 0x8a363
movq 0x8(%rsp), %rax
cmpl $0x1, 0x20(%rax)
jne 0x8a363
movq 0x10(%rsp), %rax
movq (%rax), %rax
movl $0x0, 0x20(%rax)
movq 0x8(%rsp), %rax
movl $0x0, 0x20(%rax)
movq 0x10(%rsp), %rax
movq (%rax), %rax
movq (%rax), %rax
movl $0x1, 0x20(%rax)
movq 0x10(%rsp), %rax
movq (%rax), %rax
movq (%rax), %rax
movq %rax, 0x10(%rsp)
jmp 0x8a3d2
movq 0x10(%rsp), %rax
movq 0x10(%rsp), %rcx
movq (%rcx), %rcx
cmpq 0x10(%rcx), %rax
jne 0x8a397
movq 0x10(%rsp), %rax
movq (%rax), %rax
movq %rax, 0x10(%rsp)
movq 0x20(%rsp), %rdi
movq 0x18(%rsp), %rsi
movq 0x10(%rsp), %rdx
callq 0x8bca0
movq 0x10(%rsp), %rax
movq (%rax), %rax
movl $0x0, 0x20(%rax)
movq 0x10(%rsp), %rax
movq (%rax), %rax
movq (%rax), %rax
movl $0x1, 0x20(%rax)
movq 0x20(%rsp), %rdi
movq 0x18(%rsp), %rsi
movq 0x10(%rsp), %rax
movq (%rax), %rax
movq (%rax), %rdx
callq 0x8beb0
jmp 0x8a4b6
movq 0x10(%rsp), %rax
movq (%rax), %rax
movq (%rax), %rax
movq 0x8(%rax), %rax
movq %rax, 0x8(%rsp)
movq 0x8(%rsp), %rax
movq 0x20(%rsp), %rcx
cmpq 0x48(%rcx), %rax
je 0x8a445
movq 0x8(%rsp), %rax
cmpl $0x1, 0x20(%rax)
jne 0x8a445
movq 0x10(%rsp), %rax
movq (%rax), %rax
movl $0x0, 0x20(%rax)
movq 0x8(%rsp), %rax
movl $0x0, 0x20(%rax)
movq 0x10(%rsp), %rax
movq (%rax), %rax
movq (%rax), %rax
movl $0x1, 0x20(%rax)
movq 0x10(%rsp), %rax
movq (%rax), %rax
movq (%rax), %rax
movq %rax, 0x10(%rsp)
jmp 0x8a4b4
movq 0x10(%rsp), %rax
movq 0x10(%rsp), %rcx
movq (%rcx), %rcx
cmpq 0x8(%rcx), %rax
jne 0x8a479
movq 0x10(%rsp), %rax
movq (%rax), %rax
movq %rax, 0x10(%rsp)
movq 0x20(%rsp), %rdi
movq 0x18(%rsp), %rsi
movq 0x10(%rsp), %rdx
callq 0x8beb0
movq 0x10(%rsp), %rax
movq (%rax), %rax
movl $0x0, 0x20(%rax)
movq 0x10(%rsp), %rax
movq (%rax), %rax
movq (%rax), %rax
movl $0x1, 0x20(%rax)
movq 0x20(%rsp), %rdi
movq 0x18(%rsp), %rsi
movq 0x10(%rsp), %rax
movq (%rax), %rax
movq (%rax), %rdx
callq 0x8bca0
jmp 0x8a4b6
jmp 0x8a2a3
movq 0x18(%rsp), %rax
movq (%rax), %rax
movl $0x0, 0x20(%rax)
addq $0x28, %rsp
retq
nop