// File: /workspace/github_cpp_makefile_star2_O1/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
movl $0x1, %r8d
movq 0x8(%rdx), %rax
movq 0x10(%rax), %rcx
movq %rcx, %r9
cmpq %rdx, %rcx
jne 0x1eac
movq 0x18(%rax), %r9
testq %r9, %r9
je 0x1ee2
cmpl $0x0, 0x4(%r9)
jne 0x1ee2
movl %r8d, 0x4(%rdx)
movl %r8d, 0x4(%r9)
movl $0x0, 0x4(%rax)
cmpq (%rdi), %rax
je 0x1f71
movq 0x8(%rax), %rdx
cmpl $0x1, 0x4(%rdx)
movq %rax, %rsi
jne 0x1e98
jmp 0x201f
xorq %rdx, %rcx
movq 0x10(%rdx), %r9
movq %r9, %r8
xorq %rsi, %r8
orq %rcx, %r8
je 0x1f32
leaq 0x10(%rax), %r8
movq 0x18(%rdx), %r10
cmpq %rsi, %r10
je 0x1f8d
movq 0x18(%rsi), %rcx
movq %rcx, 0x10(%rdx)
movq %rdx, 0x18(%rsi)
movq %rsi, 0x8(%rdx)
testq %rax, %rax
je 0x1fcd
cmpq %rdx, 0x10(%rax)
leaq 0x18(%rax), %rcx
cmoveq %r8, %rcx
movq %rax, %rdx
jmp 0x1fd2
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 0x1f7d
xorl %esi, %esi
cmpq %rax, 0x10(%rcx)
setne %sil
movq %rdx, 0x10(%rcx,%rsi,8)
movq %rcx, 0x8(%rdx)
jmp 0x201f
movl $0x1, 0x4(%rax)
jmp 0x201f
movq %rdx, (%rdi)
movq $0x0, 0x8(%rdx)
jmp 0x201f
cmpq %rdx, 0x18(%rax)
je 0x2021
xorq %rsi, %r10
orq %r10, %rcx
jne 0x1f05
movq 0x10(%rsi), %rcx
movq %rcx, 0x18(%rdx)
movq %rdx, 0x10(%rsi)
movq %rsi, 0x8(%rdx)
testq %rax, %rax
je 0x2040
cmpq %rdx, 0x10(%rax)
leaq 0x18(%rax), %rcx
cmoveq %r8, %rcx
movq %rax, %rdx
jmp 0x2045
xorl %edx, %edx
movq %rdi, %rcx
movq %rsi, (%rcx)
movq %rdx, 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 0x2014
xorl %edx, %edx
cmpq %rax, 0x10(%rcx)
setne %dl
movq %rsi, 0x10(%rcx,%rdx,8)
movq %rcx, 0x8(%rsi)
jmp 0x201f
movq %rsi, (%rdi)
movq $0x0, 0x8(%rsi)
popq %rbp
retq
movl $0x1, 0x4(%rdx)
movl $0x0, 0x4(%rax)
movq 0x8(%rax), %rcx
movq %r9, 0x18(%rax)
movq %rax, 0x10(%rdx)
jmp 0x1f50
xorl %edx, %edx
movq %rdi, %rcx
movq %rsi, (%rcx)
movq %rdx, 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 0x1ff7