// File: /workspace/github_c_makefile_star2_O0/mrkite[P]regs/docmaker/avl.cc
// Function: AVL::insertOnce(std::shared_ptr<AVLNode_>, unsigned int)
AVLNode AVL::insertOnce(AVLNode node, uint32_t key) {
  if (node == nullptr) {
    node = std::make_shared<AVLNode_>();
    node->key = key;
    node->left = nullptr;
    node->right = nullptr;
    node->down = nullptr;
    node->height = 1;
    node->matched = false;
    return node;
  }
  if (key < node->key) {
    node->left = insertOnce(node->left, key);
  } else if (key > node->key) {
    node->right = insertOnce(node->right, key);
  } else {  // key already exists
    return node;
  }
  node->height = 1 + max(Height(node->left), Height(node->right));
  int balance = getBalance(node);
  if (balance > 1 && key < node->left->key) {
    return rotateRight(node);
  }
  if (balance < -1 && key > node->right->key) {
    return rotateLeft(node);
  }
  if (balance > 1 && key > node->left->key) {
    node->left = rotateLeft(node->left);
    return rotateRight(node);
  }
  if (balance < -1 && key < node->right->key) {
    node->right = rotateRight(node->right);
    return rotateLeft(node);
  }
  return node;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x240, %rsp            # imm = 0x240
movq %rdx, -0x188(%rbp)
movq %rdi, %rax
movq -0x188(%rbp), %rdi
movq %rax, -0x180(%rbp)
movq %rax, %rdx
movq %rdx, -0x178(%rbp)
movq %rax, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq %rdi, -0x18(%rbp)
movl %ecx, -0x1c(%rbp)
movq -0x10(%rbp), %rax
movq %rax, -0x170(%rbp)
xorl %eax, %eax
movl %eax, %esi
callq 0xdbe0
testb $0x1, %al
jne 0xcc69
jmp 0xcd79
leaq -0x30(%rbp), %rdi
callq 0xdc10
movq -0x188(%rbp), %rdi
leaq -0x30(%rbp), %rsi
callq 0xdc80
leaq -0x30(%rbp), %rdi
callq 0xc2c0
movq -0x188(%rbp), %rdi
movl -0x1c(%rbp), %eax
movl %eax, -0x18c(%rbp)
callq 0xdcb0
movl -0x18c(%rbp), %ecx
movl %ecx, (%rax)
leaq -0x40(%rbp), %rdi
xorl %eax, %eax
movl %eax, %esi
callq 0xdcd0
movq -0x188(%rbp), %rdi
callq 0xdcb0
movq %rax, %rdi
addq $0x8, %rdi
leaq -0x40(%rbp), %rsi
callq 0xdc80
leaq -0x40(%rbp), %rdi
callq 0xc2c0
leaq -0x50(%rbp), %rdi
xorl %eax, %eax
movl %eax, %esi
callq 0xdcd0
movq -0x188(%rbp), %rdi
callq 0xdcb0
movq %rax, %rdi
addq $0x18, %rdi
leaq -0x50(%rbp), %rsi
callq 0xdc80
leaq -0x50(%rbp), %rdi
callq 0xc2c0
leaq -0x60(%rbp), %rdi
xorl %eax, %eax
movl %eax, %esi
callq 0xdcd0
movq -0x188(%rbp), %rdi
callq 0xdcb0
movq %rax, %rdi
addq $0x28, %rdi
leaq -0x60(%rbp), %rsi
callq 0xdc80
leaq -0x60(%rbp), %rdi
callq 0xc2c0
movq -0x188(%rbp), %rdi
callq 0xdcb0
movq -0x188(%rbp), %rdi
movl $0x1, 0x38(%rax)
callq 0xdcb0
movq -0x180(%rbp), %rdi
movq -0x188(%rbp), %rsi
movb $0x0, 0x3c(%rax)
callq 0xdcf0
jmp 0xd44c
movq -0x188(%rbp), %rdi
movl -0x1c(%rbp), %eax
movl %eax, -0x190(%rbp)
callq 0xdcb0
movq %rax, %rcx
movl -0x190(%rbp), %eax
cmpl (%rcx), %eax
jae 0xce31
movq -0x188(%rbp), %rdi
callq 0xdcb0
movq %rax, %rsi
addq $0x8, %rsi
leaq -0x80(%rbp), %rdi
movq %rdi, -0x198(%rbp)
callq 0xdd20
movq -0x170(%rbp), %rsi
movq -0x198(%rbp), %rdx
movl -0x1c(%rbp), %ecx
leaq -0x70(%rbp), %rdi
callq 0xcc10
jmp 0xcdde
movq -0x188(%rbp), %rdi
callq 0xdcb0
movq %rax, %rdi
addq $0x8, %rdi
leaq -0x70(%rbp), %rsi
callq 0xdc80
leaq -0x70(%rbp), %rdi
callq 0xc2c0
leaq -0x80(%rbp), %rdi
callq 0xc2c0
jmp 0xcf12
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x88(%rbp)
movl %eax, -0x8c(%rbp)
leaq -0x80(%rbp), %rdi
callq 0xc2c0
jmp 0xd45c
movq -0x188(%rbp), %rdi
movl -0x1c(%rbp), %eax
movl %eax, -0x19c(%rbp)
callq 0xdcb0
movq %rax, %rcx
movl -0x19c(%rbp), %eax
cmpl (%rcx), %eax
jbe 0xcef8
movq -0x188(%rbp), %rdi
callq 0xdcb0
movq %rax, %rsi
addq $0x18, %rsi
leaq -0xb0(%rbp), %rdi
movq %rdi, -0x1a8(%rbp)
callq 0xdd20
movq -0x170(%rbp), %rsi
movq -0x1a8(%rbp), %rdx
movl -0x1c(%rbp), %ecx
leaq -0xa0(%rbp), %rdi
callq 0xcc10
jmp 0xce9c
movq -0x188(%rbp), %rdi
callq 0xdcb0
movq %rax, %rdi
addq $0x18, %rdi
leaq -0xa0(%rbp), %rsi
callq 0xdc80
leaq -0xa0(%rbp), %rdi
callq 0xc2c0
leaq -0xb0(%rbp), %rdi
callq 0xc2c0
jmp 0xcf10
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x88(%rbp)
movl %eax, -0x8c(%rbp)
leaq -0xb0(%rbp), %rdi
callq 0xc2c0
jmp 0xd45c
movq -0x188(%rbp), %rsi
movq -0x180(%rbp), %rdi
callq 0xdcf0
jmp 0xd44c
jmp 0xcf12
movq -0x188(%rbp), %rdi
callq 0xdcb0
movq %rax, %rsi
addq $0x8, %rsi
leaq -0xc0(%rbp), %rdi
movq %rdi, -0x1b8(%rbp)
callq 0xdd20
movq -0x1b8(%rbp), %rdi
callq 0xd4a0
movl %eax, -0x1ac(%rbp)
jmp 0xcf4c
movq -0x188(%rbp), %rdi
callq 0xdcb0
movq %rax, %rsi
addq $0x18, %rsi
leaq -0xd0(%rbp), %rdi
movq %rdi, -0x1c8(%rbp)
callq 0xdd20
movq -0x1c8(%rbp), %rdi
callq 0xd4a0
movl %eax, -0x1bc(%rbp)
jmp 0xcf86
movl -0x1bc(%rbp), %esi
movl -0x1ac(%rbp), %edi
callq 0xd470
movl %eax, -0x1cc(%rbp)
jmp 0xcf9f
movq -0x188(%rbp), %rdi
movl -0x1cc(%rbp), %eax
incl %eax
movl %eax, -0x1dc(%rbp)
callq 0xdcb0
movl -0x1dc(%rbp), %ecx
movl %ecx, 0x38(%rax)
leaq -0xd0(%rbp), %rdi
callq 0xc2c0
leaq -0xc0(%rbp), %rdi
callq 0xc2c0
movq -0x188(%rbp), %rsi
leaq -0xe8(%rbp), %rdi
movq %rdi, -0x1d8(%rbp)
callq 0xdd20
movq -0x1d8(%rbp), %rdi
callq 0xd4e0
movl %eax, -0x1d0(%rbp)
jmp 0xd008
leaq -0xe8(%rbp), %rdi
callq 0xc2c0
movl -0x1d0(%rbp), %eax
movl %eax, -0xd4(%rbp)
cmpl $0x1, -0xd4(%rbp)
jle 0xd128
movq -0x188(%rbp), %rdi
movl -0x1c(%rbp), %eax
movl %eax, -0x1e0(%rbp)
callq 0xdcb0
movq %rax, %rdi
addq $0x8, %rdi
callq 0xdcb0
movq %rax, %rcx
movl -0x1e0(%rbp), %eax
cmpl (%rcx), %eax
jae 0xd128
movq -0x188(%rbp), %rsi
leaq -0xf8(%rbp), %rdi
movq %rdi, -0x1e8(%rbp)
callq 0xdd20
movq -0x180(%rbp), %rdi
movq -0x1e8(%rbp), %rsi
callq 0xd580
jmp 0xd08e
leaq -0xf8(%rbp), %rdi
callq 0xc2c0
jmp 0xd44c
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x88(%rbp)
movl %eax, -0x8c(%rbp)
jmp 0xd0d1
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x88(%rbp)
movl %eax, -0x8c(%rbp)
leaq -0xd0(%rbp), %rdi
callq 0xc2c0
leaq -0xc0(%rbp), %rdi
callq 0xc2c0
jmp 0xd45c
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x88(%rbp)
movl %eax, -0x8c(%rbp)
leaq -0xe8(%rbp), %rdi
callq 0xc2c0
jmp 0xd45c
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x88(%rbp)
movl %eax, -0x8c(%rbp)
leaq -0xf8(%rbp), %rdi
callq 0xc2c0
jmp 0xd45c
cmpl $-0x1, -0xd4(%rbp)
jge 0xd1c6
movq -0x188(%rbp), %rdi
movl -0x1c(%rbp), %eax
movl %eax, -0x1ec(%rbp)
callq 0xdcb0
movq %rax, %rdi
addq $0x18, %rdi
callq 0xdcb0
movq %rax, %rcx
movl -0x1ec(%rbp), %eax
cmpl (%rcx), %eax
jbe 0xd1c6
movq -0x188(%rbp), %rsi
leaq -0x108(%rbp), %rdi
movq %rdi, -0x1f8(%rbp)
callq 0xdd20
movq -0x180(%rbp), %rdi
movq -0x1f8(%rbp), %rsi
callq 0xd750
jmp 0xd192
leaq -0x108(%rbp), %rdi
callq 0xc2c0
jmp 0xd44c
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x88(%rbp)
movl %eax, -0x8c(%rbp)
leaq -0x108(%rbp), %rdi
callq 0xc2c0
jmp 0xd45c
cmpl $0x1, -0xd4(%rbp)
jle 0xd304
movq -0x188(%rbp), %rdi
movl -0x1c(%rbp), %eax
movl %eax, -0x1fc(%rbp)
callq 0xdcb0
movq %rax, %rdi
addq $0x8, %rdi
callq 0xdcb0
movq %rax, %rcx
movl -0x1fc(%rbp), %eax
cmpl (%rcx), %eax
jbe 0xd304
movq -0x188(%rbp), %rdi
callq 0xdcb0
movq %rax, %rsi
addq $0x8, %rsi
leaq -0x128(%rbp), %rdi
movq %rdi, -0x208(%rbp)
callq 0xdd20
movq -0x208(%rbp), %rsi
leaq -0x118(%rbp), %rdi
callq 0xd750
jmp 0xd240
movq -0x188(%rbp), %rdi
callq 0xdcb0
movq %rax, %rdi
addq $0x8, %rdi
leaq -0x118(%rbp), %rsi
movq %rsi, -0x218(%rbp)
callq 0xdc80
movq -0x218(%rbp), %rdi
callq 0xc2c0
leaq -0x128(%rbp), %rdi
callq 0xc2c0
movq -0x188(%rbp), %rsi
leaq -0x138(%rbp), %rdi
movq %rdi, -0x210(%rbp)
callq 0xdd20
movq -0x180(%rbp), %rdi
movq -0x210(%rbp), %rsi
callq 0xd580
jmp 0xd2ad
leaq -0x138(%rbp), %rdi
callq 0xc2c0
jmp 0xd44c
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x88(%rbp)
movl %eax, -0x8c(%rbp)
leaq -0x128(%rbp), %rdi
callq 0xc2c0
jmp 0xd45c
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x88(%rbp)
movl %eax, -0x8c(%rbp)
leaq -0x138(%rbp), %rdi
callq 0xc2c0
jmp 0xd45c
cmpl $-0x1, -0xd4(%rbp)
jge 0xd439
movq -0x188(%rbp), %rdi
movl -0x1c(%rbp), %eax
movl %eax, -0x21c(%rbp)
callq 0xdcb0
movq %rax, %rdi
addq $0x18, %rdi
callq 0xdcb0
movq %rax, %rcx
movl -0x21c(%rbp), %eax
cmpl (%rcx), %eax
jae 0xd439
movq -0x188(%rbp), %rdi
callq 0xdcb0
movq %rax, %rsi
addq $0x18, %rsi
leaq -0x158(%rbp), %rdi
movq %rdi, -0x228(%rbp)
callq 0xdd20
movq -0x228(%rbp), %rsi
leaq -0x148(%rbp), %rdi
callq 0xd580
jmp 0xd37e
movq -0x188(%rbp), %rdi
callq 0xdcb0
movq %rax, %rdi
addq $0x18, %rdi
leaq -0x148(%rbp), %rsi
movq %rsi, -0x238(%rbp)
callq 0xdc80
movq -0x238(%rbp), %rdi
callq 0xc2c0
leaq -0x158(%rbp), %rdi
callq 0xc2c0
movq -0x188(%rbp), %rsi
leaq -0x168(%rbp), %rdi
movq %rdi, -0x230(%rbp)
callq 0xdd20
movq -0x180(%rbp), %rdi
movq -0x230(%rbp), %rsi
callq 0xd750
jmp 0xd3eb
leaq -0x168(%rbp), %rdi
callq 0xc2c0
jmp 0xd44c
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x88(%rbp)
movl %eax, -0x8c(%rbp)
leaq -0x158(%rbp), %rdi
callq 0xc2c0
jmp 0xd45c
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x88(%rbp)
movl %eax, -0x8c(%rbp)
leaq -0x168(%rbp), %rdi
callq 0xc2c0
jmp 0xd45c
movq -0x188(%rbp), %rsi
movq -0x180(%rbp), %rdi
callq 0xdcf0
movq -0x178(%rbp), %rax
addq $0x240, %rsp            # imm = 0x240
popq %rbp
retq
movq -0x88(%rbp), %rdi
callq 0x3490
nopl (%rax,%rax)