// File: /workspace/github_cpp_makefile_star2_O3/DRSY[P]MyRBTree/main.cpp
// Function: RBTree::ascend_fatherIsRed(Node*, Node*)
void ascend_fatherIsRed(NodePtr_t inserted_node, NodePtr_t father) {
      NodePtr_t gf = father->father; // grand father must be black
      NodePtr_t uncle = (father==gf->left)?gf->right:gf->left;
      // uncle node is red
      if(uncle && isred(uncle)) {
          father->color = Color::black;
          uncle->color = Color::black;
          gf->color = Color::red;
          if(gf==this->root) { gf->color = Color::black; return;}
          else if(isblack(gf->father)) return;
          else ascend_fatherIsRed(gf, gf->father);
      }
      // uncle node is black
      else{
          // same direction
          if(inserted_node == father->left && father == gf->left) {
              father->color = Color::black;
              gf->color = Color::red;
              rotate_right(father, gf);
          }
          else if(inserted_node==father->right && father==gf->right) {
              father->color = Color::black;
              gf->color = Color::red;
              rotate_left(gf, father);
          }
          // not same direction
          else if(inserted_node==father->right && father==gf->left) {
              auto p = rotate_left(father, inserted_node);
              p->color = Color::black;
              gf->color = Color::red;
              rotate_right(p, gf);
          }
          else {
              auto p = rotate_right(inserted_node, father);
              p->color = Color::black;
              gf->color = Color::red;
              rotate_left(gf, p);
          }
      }
    }

// Assembly:
pushq %rbp
movq %rsp, %rbp
movq (%rdi), %rcx
movl $0x1, %r8d
movq 0x8(%rdx), %rax
movq 0x10(%rax), %r9
movq %r9, %r10
cmpq %rdx, %r9
jne 0x1e91
movq 0x18(%rax), %r10
testq %r10, %r10
je 0x1ec7
cmpl $0x0, 0x4(%r10)
jne 0x1ec7
movl %r8d, 0x4(%rdx)
movl %r8d, 0x4(%r10)
movl $0x0, 0x4(%rax)
cmpq %rcx, %rax
je 0x1f88
movq 0x8(%rax), %rdx
cmpl $0x1, 0x4(%rdx)
movq %rax, %rsi
jne 0x1e7d
jmp 0x1f8f
movq %r9, %r8
xorq %rdx, %r8
movq 0x10(%rdx), %rcx
movq %rcx, %r10
xorq %rsi, %r10
orq %r8, %r10
je 0x1f48
cmpq %rsi, 0x18(%rdx)
je 0x1f91
movq 0x18(%rsi), %rcx
movq %rcx, 0x10(%rdx)
movq %rdx, 0x18(%rsi)
movq %rsi, 0x8(%rdx)
xorl %ecx, %ecx
cmpq %rdx, 0x10(%rax)
setne %cl
movq %rsi, 0x10(%rax,%rcx,8)
movq %rax, 0x8(%rsi)
movl $0x1, 0x4(%rsi)
movl $0x0, 0x4(%rax)
movq 0x8(%rax), %rcx
movq 0x10(%rsi), %rdx
movq %rdx, 0x18(%rax)
movq %rax, 0x10(%rsi)
movq %rsi, 0x8(%rax)
testq %rcx, %rcx
je 0x1f3f
leaq 0x10(%rcx), %rdx
leaq 0x18(%rcx), %rdi
cmpq %rax, 0x10(%rcx)
cmoveq %rdx, %rdi
movq %rsi, (%rdi)
movq %rcx, 0x8(%rsi)
jmp 0x1f8f
movl $0x1, 0x4(%rdx)
movl $0x0, 0x4(%rax)
movq 0x8(%rax), %rcx
movq 0x18(%rdx), %rsi
movq %rsi, 0x10(%rax)
movq %rax, 0x18(%rdx)
movq %rdx, 0x8(%rax)
testq %rcx, %rcx
je 0x1f7f
leaq 0x10(%rcx), %rsi
leaq 0x18(%rcx), %rdi
cmpq %rax, 0x10(%rcx)
cmoveq %rsi, %rdi
movq %rdx, (%rdi)
movq %rcx, 0x8(%rdx)
jmp 0x1f8f
movl $0x1, 0x4(%rax)
popq %rbp
retq
cmpq %rdx, 0x18(%rax)
je 0x1fe5
cmpq %rdx, %r9
jne 0x1ee6
movq 0x10(%rsi), %rcx
movq %rcx, 0x18(%rdx)
movq %rdx, 0x10(%rsi)
movq %rsi, 0x8(%rdx)
xorl %ecx, %ecx
cmpq %rdx, 0x10(%rax)
setne %cl
movq %rsi, 0x10(%rax,%rcx,8)
movq %rax, 0x8(%rsi)
movl $0x1, 0x4(%rsi)
movl $0x0, 0x4(%rax)
movq 0x8(%rax), %rcx
movq 0x18(%rsi), %rdx
movq %rdx, 0x10(%rax)
movq %rax, 0x18(%rsi)
jmp 0x1f26
movl $0x1, 0x4(%rdx)
movl $0x0, 0x4(%rax)
movq 0x8(%rax), %rsi
movq %rcx, 0x18(%rax)
movq %rax, 0x10(%rdx)
movq %rdx, 0x8(%rax)
testq %rsi, %rsi
je 0x2018
leaq 0x10(%rsi), %rcx
leaq 0x18(%rsi), %rdi
cmpq %rax, 0x10(%rsi)
cmoveq %rcx, %rdi
movq %rdx, (%rdi)
movq %rsi, 0x8(%rdx)
jmp 0x1f8f