Given the following C code and unoptimized assembly code, your task is to generate highly optimized x86-64 assembly code.
C Code:

```c
#include <stdio.h>
#include <stdlib.h>
struct tree{
  int key;
  struct tree *parent;
  struct tree *left;
  struct tree *right;
};
struct tree *T,*NIL;
void insert(struct tree *);
struct tree *find(int);
struct tree *getMin(struct tree *);
struct tree *getSuccessor(struct tree *);
void delete(int);
void inorder(struct tree *);
void preorder(struct tree *);
int main(){
  int n,k,i;
  char command[10],a;
  struct tree *A;
  scanf("%d",&n);
  for(i=0;i<n;i++){
    scanf("%s%c",command,&a);
    if(!strcmp(command,"insert")){
      scanf("%d",&k);
      A=malloc(sizeof(struct tree));
      A->key=k;
      A->left=NIL;
      A->right=NIL;
      insert(A);
    }
    else if(!strcmp(command,"print")){
      inorder(T);
      printf("\n");
      preorder(T);
      printf("\n");
    }
    else if(!strcmp(command,"delete")){
      scanf("%d",&k);
      delete(k);
    }
       else if(!strcmp(command,"find")){
      scanf("%d",&k);
      A=find(k);
      if(A->key==k)printf("yes\n");
      else printf("no\n");
    }
  }
  return 0;
}

void insert(struct tree *z){
  struct tree *x,*y;
  x=T;
  y=NIL;
  while(x!=NIL){
    y=x;
    if(x->key>z->key) x=x->left;
    else x=x->right;
  }
  z->parent=y;
  if(y==NIL){
    T=z;
  }
  else {
    if(y->key<z->key)y->right=z;
    else y->left=z;
  }
}
void inorder(struct tree *A){
  if(A==NIL)return;
  inorder(A->left);
  printf(" %d",A->key);
  inorder(A->right);
}
void preorder(struct tree *A){
  if(A==NIL)return;
  printf(" %d",A->key);
  preorder(A->left);
  preorder(A->right);
}
struct tree *find(int k){
  struct tree *x=T;
  while(x!=NIL){
    if(x->key==k)return x;
    else if(k<x->key)x=x->left;
    else x=x->right;
  }
  return T;
}
void delete(int k){
  struct tree *x,*y,*z;
  z=find(k);
  if(z->left==NIL||z->right==NIL)y=z;
  else y=getSuccessor(z);
  if(y->left!=NIL)x=y->left;
  else x=y->right;
  if(x!=NIL)x->parent=y->parent;
  if(y->parent==NIL)T=x;
  else if(y==y->parent->left)y->parent->left=x;
  else y->parent->right=x;
  if(y!=z)z->key=y->key;
}
struct tree *getSuccessor(struct tree *z){
  struct tree *x,*y;
  if(z->right!=NIL)return getMin(z->right);
  y=x->parent;
  while(y!=NIL&x==y->right){
    x=y;
    y=y->parent;
  }
  return y;
}
struct tree *getMin(struct tree *z){
   while(z->left!=NIL){
    z=z->left;
  }
  return z;
}


```

Unoptimized Assembly Code:

```assembly
	.file	"temp.c"
	.text
	.globl	T
	.bss
	.align 8
	.type	T, @object
	.size	T, 8
T:
	.zero	8
	.globl	NIL
	.align 8
	.type	NIL, @object
	.size	NIL, 8
NIL:
	.zero	8
	.section	.rodata
.LC0:
	.string	"%d"
.LC1:
	.string	"%s%c"
.LC2:
	.string	"insert"
.LC3:
	.string	"print"
.LC4:
	.string	"delete"
.LC5:
	.string	"find"
.LC6:
	.string	"yes"
.LC7:
	.string	"no"
	.text
	.globl	main
	.type	main, @function
main:
.LFB6:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	subq	$48, %rsp
	movq	%fs:40, %rax
	movq	%rax, -8(%rbp)
	xorl	%eax, %eax
	leaq	-44(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	$0, -36(%rbp)
	jmp	.L2
.L8:
	leaq	-45(%rbp), %rdx
	leaq	-18(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	leaq	-18(%rbp), %rax
	leaq	.LC2(%rip), %rdx
	movq	%rdx, %rsi
	movq	%rax, %rdi
	call	strcmp@PLT
	testl	%eax, %eax
	jne	.L3
	leaq	-40(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	$32, %edi
	call	malloc@PLT
	movq	%rax, -32(%rbp)
	movl	-40(%rbp), %edx
	movq	-32(%rbp), %rax
	movl	%edx, (%rax)
	movq	NIL(%rip), %rdx
	movq	-32(%rbp), %rax
	movq	%rdx, 16(%rax)
	movq	NIL(%rip), %rdx
	movq	-32(%rbp), %rax
	movq	%rdx, 24(%rax)
	movq	-32(%rbp), %rax
	movq	%rax, %rdi
	call	insert
	jmp	.L4
.L3:
	leaq	-18(%rbp), %rax
	leaq	.LC3(%rip), %rdx
	movq	%rdx, %rsi
	movq	%rax, %rdi
	call	strcmp@PLT
	testl	%eax, %eax
	jne	.L5
	movq	T(%rip), %rax
	movq	%rax, %rdi
	call	inorder
	movl	$10, %edi
	call	putchar@PLT
	movq	T(%rip), %rax
	movq	%rax, %rdi
	call	preorder
	movl	$10, %edi
	call	putchar@PLT
	jmp	.L4
.L5:
	leaq	-18(%rbp), %rax
	leaq	.LC4(%rip), %rdx
	movq	%rdx, %rsi
	movq	%rax, %rdi
	call	strcmp@PLT
	testl	%eax, %eax
	jne	.L6
	leaq	-40(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	-40(%rbp), %eax
	movl	%eax, %edi
	call	delete
	jmp	.L4
.L6:
	leaq	-18(%rbp), %rax
	leaq	.LC5(%rip), %rdx
	movq	%rdx, %rsi
	movq	%rax, %rdi
	call	strcmp@PLT
	testl	%eax, %eax
	jne	.L4
	leaq	-40(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	-40(%rbp), %eax
	movl	%eax, %edi
	call	find
	movq	%rax, -32(%rbp)
	movq	-32(%rbp), %rax
	movl	(%rax), %edx
	movl	-40(%rbp), %eax
	cmpl	%eax, %edx
	jne	.L7
	leaq	.LC6(%rip), %rax
	movq	%rax, %rdi
	call	puts@PLT
	jmp	.L4
.L7:
	leaq	.LC7(%rip), %rax
	movq	%rax, %rdi
	call	puts@PLT
.L4:
	addl	$1, -36(%rbp)
.L2:
	movl	-44(%rbp), %eax
	cmpl	%eax, -36(%rbp)
	jl	.L8
	movl	$0, %eax
	movq	-8(%rbp), %rdx
	subq	%fs:40, %rdx
	je	.L10
	call	__stack_chk_fail@PLT
.L10:
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE6:
	.size	main, .-main
	.globl	insert
	.type	insert, @function
insert:
.LFB7:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	movq	%rdi, -24(%rbp)
	movq	T(%rip), %rax
	movq	%rax, -16(%rbp)
	movq	NIL(%rip), %rax
	movq	%rax, -8(%rbp)
	jmp	.L12
.L14:
	movq	-16(%rbp), %rax
	movq	%rax, -8(%rbp)
	movq	-16(%rbp), %rax
	movl	(%rax), %edx
	movq	-24(%rbp), %rax
	movl	(%rax), %eax
	cmpl	%eax, %edx
	jle	.L13
	movq	-16(%rbp), %rax
	movq	16(%rax), %rax
	movq	%rax, -16(%rbp)
	jmp	.L12
.L13:
	movq	-16(%rbp), %rax
	movq	24(%rax), %rax
	movq	%rax, -16(%rbp)
.L12:
	movq	NIL(%rip), %rax
	cmpq	%rax, -16(%rbp)
	jne	.L14
	movq	-24(%rbp), %rax
	movq	-8(%rbp), %rdx
	movq	%rdx, 8(%rax)
	movq	NIL(%rip), %rax
	cmpq	%rax, -8(%rbp)
	jne	.L15
	movq	-24(%rbp), %rax
	movq	%rax, T(%rip)
	jmp	.L18
.L15:
	movq	-8(%rbp), %rax
	movl	(%rax), %edx
	movq	-24(%rbp), %rax
	movl	(%rax), %eax
	cmpl	%eax, %edx
	jge	.L17
	movq	-8(%rbp), %rax
	movq	-24(%rbp), %rdx
	movq	%rdx, 24(%rax)
	jmp	.L18
.L17:
	movq	-8(%rbp), %rax
	movq	-24(%rbp), %rdx
	movq	%rdx, 16(%rax)
.L18:
	nop
	popq	%rbp
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE7:
	.size	insert, .-insert
	.section	.rodata
.LC8:
	.string	" %d"
	.text
	.globl	inorder
	.type	inorder, @function
inorder:
.LFB8:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	subq	$16, %rsp
	movq	%rdi, -8(%rbp)
	movq	NIL(%rip), %rax
	cmpq	%rax, -8(%rbp)
	je	.L22
	movq	-8(%rbp), %rax
	movq	16(%rax), %rax
	movq	%rax, %rdi
	call	inorder
	movq	-8(%rbp), %rax
	movl	(%rax), %eax
	movl	%eax, %esi
	leaq	.LC8(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	movq	-8(%rbp), %rax
	movq	24(%rax), %rax
	movq	%rax, %rdi
	call	inorder
	jmp	.L19
.L22:
	nop
.L19:
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE8:
	.size	inorder, .-inorder
	.globl	preorder
	.type	preorder, @function
preorder:
.LFB9:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	subq	$16, %rsp
	movq	%rdi, -8(%rbp)
	movq	NIL(%rip), %rax
	cmpq	%rax, -8(%rbp)
	je	.L26
	movq	-8(%rbp), %rax
	movl	(%rax), %eax
	movl	%eax, %esi
	leaq	.LC8(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	movq	-8(%rbp), %rax
	movq	16(%rax), %rax
	movq	%rax, %rdi
	call	preorder
	movq	-8(%rbp), %rax
	movq	24(%rax), %rax
	movq	%rax, %rdi
	call	preorder
	jmp	.L23
.L26:
	nop
.L23:
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE9:
	.size	preorder, .-preorder
	.globl	find
	.type	find, @function
find:
.LFB10:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	movl	%edi, -20(%rbp)
	movq	T(%rip), %rax
	movq	%rax, -8(%rbp)
	jmp	.L28
.L32:
	movq	-8(%rbp), %rax
	movl	(%rax), %eax
	cmpl	%eax, -20(%rbp)
	jne	.L29
	movq	-8(%rbp), %rax
	jmp	.L30
.L29:
	movq	-8(%rbp), %rax
	movl	(%rax), %eax
	cmpl	%eax, -20(%rbp)
	jge	.L31
	movq	-8(%rbp), %rax
	movq	16(%rax), %rax
	movq	%rax, -8(%rbp)
	jmp	.L28
.L31:
	movq	-8(%rbp), %rax
	movq	24(%rax), %rax
	movq	%rax, -8(%rbp)
.L28:
	movq	NIL(%rip), %rax
	cmpq	%rax, -8(%rbp)
	jne	.L32
	movq	T(%rip), %rax
.L30:
	popq	%rbp
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE10:
	.size	find, .-find
	.globl	delete
	.type	delete, @function
delete:
.LFB11:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	subq	$48, %rsp
	movl	%edi, -36(%rbp)
	movl	-36(%rbp), %eax
	movl	%eax, %edi
	call	find
	movq	%rax, -8(%rbp)
	movq	-8(%rbp), %rax
	movq	16(%rax), %rdx
	movq	NIL(%rip), %rax
	cmpq	%rax, %rdx
	je	.L34
	movq	-8(%rbp), %rax
	movq	24(%rax), %rdx
	movq	NIL(%rip), %rax
	cmpq	%rax, %rdx
	jne	.L35
.L34:
	movq	-8(%rbp), %rax
	movq	%rax, -16(%rbp)
	jmp	.L36
.L35:
	movq	-8(%rbp), %rax
	movq	%rax, %rdi
	call	getSuccessor
	movq	%rax, -16(%rbp)
.L36:
	movq	-16(%rbp), %rax
	movq	16(%rax), %rdx
	movq	NIL(%rip), %rax
	cmpq	%rax, %rdx
	je	.L37
	movq	-16(%rbp), %rax
	movq	16(%rax), %rax
	movq	%rax, -24(%rbp)
	jmp	.L38
.L37:
	movq	-16(%rbp), %rax
	movq	24(%rax), %rax
	movq	%rax, -24(%rbp)
.L38:
	movq	NIL(%rip), %rax
	cmpq	%rax, -24(%rbp)
	je	.L39
	movq	-16(%rbp), %rax
	movq	8(%rax), %rdx
	movq	-24(%rbp), %rax
	movq	%rdx, 8(%rax)
.L39:
	movq	-16(%rbp), %rax
	movq	8(%rax), %rdx
	movq	NIL(%rip), %rax
	cmpq	%rax, %rdx
	jne	.L40
	movq	-24(%rbp), %rax
	movq	%rax, T(%rip)
	jmp	.L41
.L40:
	movq	-16(%rbp), %rax
	movq	8(%rax), %rax
	movq	16(%rax), %rax
	cmpq	%rax, -16(%rbp)
	jne	.L42
	movq	-16(%rbp), %rax
	movq	8(%rax), %rax
	movq	-24(%rbp), %rdx
	movq	%rdx, 16(%rax)
	jmp	.L41
.L42:
	movq	-16(%rbp), %rax
	movq	8(%rax), %rax
	movq	-24(%rbp), %rdx
	movq	%rdx, 24(%rax)
.L41:
	movq	-16(%rbp), %rax
	cmpq	-8(%rbp), %rax
	je	.L44
	movq	-16(%rbp), %rax
	movl	(%rax), %edx
	movq	-8(%rbp), %rax
	movl	%edx, (%rax)
.L44:
	nop
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE11:
	.size	delete, .-delete
	.globl	getSuccessor
	.type	getSuccessor, @function
getSuccessor:
.LFB12:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	subq	$32, %rsp
	movq	%rdi, -24(%rbp)
	movq	-24(%rbp), %rax
	movq	24(%rax), %rdx
	movq	NIL(%rip), %rax
	cmpq	%rax, %rdx
	je	.L46
	movq	-24(%rbp), %rax
	movq	24(%rax), %rax
	movq	%rax, %rdi
	call	getMin
	jmp	.L47
.L46:
	movq	-16(%rbp), %rax
	movq	8(%rax), %rax
	movq	%rax, -8(%rbp)
	jmp	.L48
.L49:
	movq	-8(%rbp), %rax
	movq	%rax, -16(%rbp)
	movq	-8(%rbp), %rax
	movq	8(%rax), %rax
	movq	%rax, -8(%rbp)
.L48:
	movq	NIL(%rip), %rax
	cmpq	%rax, -8(%rbp)
	setne	%dl
	movq	-8(%rbp), %rax
	movq	24(%rax), %rax
	cmpq	%rax, -16(%rbp)
	sete	%al
	andl	%edx, %eax
	testb	%al, %al
	jne	.L49
	movq	-8(%rbp), %rax
.L47:
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE12:
	.size	getSuccessor, .-getSuccessor
	.globl	getMin
	.type	getMin, @function
getMin:
.LFB13:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	movq	%rdi, -8(%rbp)
	jmp	.L51
.L52:
	movq	-8(%rbp), %rax
	movq	16(%rax), %rax
	movq	%rax, -8(%rbp)
.L51:
	movq	-8(%rbp), %rax
	movq	16(%rax), %rdx
	movq	NIL(%rip), %rax
	cmpq	%rax, %rdx
	jne	.L52
	movq	-8(%rbp), %rax
	popq	%rbp
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE13:
	.size	getMin, .-getMin
	.ident	"GCC: (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0"
	.section	.note.GNU-stack,"",@progbits
	.section	.note.gnu.property,"a"
	.align 8
	.long	1f - 0f
	.long	4f - 1f
	.long	5
0:
	.string	"GNU"
1:
	.align 8
	.long	0xc0000002
	.long	3f - 2f
2:
	.long	0x3
3:
	.align 8
4:
```

Only output the optimized assembly code. Do not include any other text. Do not write any comments in the assembly code. Wrap the assembly code in ```assembly``` tags.
user
	.file	"temp.c"
	.text
	.p2align 4
	.globl	insert
	.type	insert, @function
insert:
.LFB40:
	.cfi_startproc
	endbr64
	movq	T(%rip), %rax
	movq	NIL(%rip), %r8
	cmpq	%r8, %rax
	je	.L2
	movl	(%rdi), %r9d
	.p2align 4,,10
	.p2align 3
.L7:
	movl	(%rax), %edx
	movq	16(%rax), %rcx
	movq	24(%rax), %rsi
	cmpl	%edx, %r9d
	jge	.L3
.L16:
	cmpq	%rcx, %r8
	je	.L15
	movq	%rcx, %rax
	movl	(%rax), %edx
	movq	16(%rax), %rcx
	movq	24(%rax), %rsi
	cmpl	%edx, %r9d
	jl	.L16
.L3:
	cmpq	%rsi, %r8
	je	.L6
	movq	%rsi, %rax
	jmp	.L7
	.p2align 4,,10
	.p2align 3
.L15:
	movq	%rax, 8(%rdi)
	cmpq	%r8, %rax
	je	.L11
.L10:
	movq	%rdi, 16(%rax)
	ret
	.p2align 4,,10
	.p2align 3
.L6:
	movq	%rax, 8(%rdi)
	cmpq	%r8, %rax
	je	.L11
	cmpl	%edx, %r9d
	jle	.L10
	movq	%rdi, 24(%rax)
	ret
	.p2align 4,,10
	.p2align 3
.L2:
	movq	%rax, 8(%rdi)
.L11:
	movq	%rdi, T(%rip)
	ret
	.cfi_endproc
.LFE40:
	.size	insert, .-insert
	.section	.rodata.str1.1,"aMS",@progbits,1
.LC0:
	.string	" %d"
	.text
	.p2align 4
	.globl	inorder
	.type	inorder, @function
inorder:
.LFB41:
	.cfi_startproc
	endbr64
	pushq	%r15
	.cfi_def_cfa_offset 16
	.cfi_offset 15, -16
	pushq	%r14
	.cfi_def_cfa_offset 24
	.cfi_offset 14, -24
	pushq	%r13
	.cfi_def_cfa_offset 32
	.cfi_offset 13, -32
	pushq	%r12
	.cfi_def_cfa_offset 40
	.cfi_offset 12, -40
	pushq	%rbp
	.cfi_def_cfa_offset 48
	.cfi_offset 6, -48
	pushq	%rbx
	.cfi_def_cfa_offset 56
	.cfi_offset 3, -56
	subq	$40, %rsp
	.cfi_def_cfa_offset 96
	movq	NIL(%rip), %rax
	movq	%rdi, 16(%rsp)
	cmpq	%rax, %rdi
	je	.L17
	leaq	.LC0(%rip), %rbp
.L18:
	movq	16(%rsp), %rsi
	movq	16(%rsi), %rcx
	movq	%rcx, (%rsp)
	cmpq	%rax, %rcx
	je	.L22
.L19:
	movq	(%rsp), %rcx
	movq	16(%rcx), %rdx
	movq	%rdx, 8(%rsp)
	cmpq	%rax, %rdx
	je	.L24
.L21:
	movq	8(%rsp), %rdi
	movq	16(%rdi), %r15
	cmpq	%rax, %r15
	je	.L26
.L23:
	movq	16(%r15), %rbx
	cmpq	%rax, %rbx
	je	.L28
.L25:
	movq	16(%rbx), %r13
	cmpq	%rax, %r13
	je	.L30
.L27:
	movq	16(%r13), %r12
	cmpq	%rax, %r12
	je	.L32
.L29:
	movq	16(%r12), %r14
	cmpq	%rax, %r14
	je	.L34
.L31:
	movq	16(%r14), %r9
	cmpq	%rax, %r9
	je	.L35
.L33:
	movq	16(%r9), %rdi
	movq	%r9, 24(%rsp)
	call	inorder
	movq	24(%rsp), %r9
	xorl	%eax, %eax
	movq	%rbp, %rsi
	movl	$1, %edi
	movl	(%r9), %edx
	call	__printf_chk@PLT
	movq	24(%rsp), %r9
	movq	24(%r9), %r9
	cmpq	%r9, NIL(%rip)
	jne	.L33
.L35:
	movl	(%r14), %edx
	movq	%rbp, %rsi
	movl	$1, %edi
	xorl	%eax, %eax
	call	__printf_chk@PLT
	movq	24(%r14), %r14
	movq	NIL(%rip), %rax
	cmpq	%r14, %rax
	jne	.L31
.L34:
	movl	(%r12), %edx
	movq	%rbp, %rsi
	movl	$1, %edi
	xorl	%eax, %eax
	call	__printf_chk@PLT
	movq	24(%r12), %r12
	movq	NIL(%rip), %rax
	cmpq	%r12, %rax
	jne	.L29
.L32:
	movl	0(%r13), %edx
	movq	%rbp, %rsi
	movl	$1, %edi
	xorl	%eax, %eax
	call	__printf_chk@PLT
	movq	24(%r13), %r13
	movq	NIL(%rip), %rax
	cmpq	%r13, %rax
	jne	.L27
.L30:
	movl	(%rbx), %edx
	movq	%rbp, %rsi
	movl	$1, %edi
	xorl	%eax, %eax
	call	__printf_chk@PLT
	movq	24(%rbx), %rbx
	movq	NIL(%rip), %rax
	cmpq	%rbx, %rax
	jne	.L25
.L28:
	movl	(%r15), %edx
	movq	%rbp, %rsi
	movl	$1, %edi
	xorl	%eax, %eax
	call	__printf_chk@PLT
	movq	24(%r15), %r15
	movq	NIL(%rip), %rax
	cmpq	%r15, %rax
	jne	.L23
.L26:
	movq	8(%rsp), %rbx
	movq	%rbp, %rsi
	movl	$1, %edi
	xorl	%eax, %eax
	movl	(%rbx), %edx
	call	__printf_chk@PLT
	movq	24(%rbx), %rcx
	movq	NIL(%rip), %rax
	movq	%rcx, 8(%rsp)
	cmpq	%rcx, %rax
	jne	.L21
.L24:
	movq	(%rsp), %rbx
	movq	%rbp, %rsi
	movl	$1, %edi
	xorl	%eax, %eax
	movl	(%rbx), %edx
	call	__printf_chk@PLT
	movq	24(%rbx), %rsi
	movq	NIL(%rip), %rax
	movq	%rsi, (%rsp)
	cmpq	%rsi, %rax
	jne	.L19
.L22:
	movq	16(%rsp), %rbx
	movq	%rbp, %rsi
	movl	$1, %edi
	xorl	%eax, %eax
	movl	(%rbx), %edx
	call	__printf_chk@PLT
	movq	24(%rbx), %rcx
	movq	NIL(%rip), %rax
	movq	%rcx, 16(%rsp)
	cmpq	%rcx, %rax
	jne	.L18
.L17:
	addq	$40, %rsp
	.cfi_def_cfa_offset 56
	popq	%rbx
	.cfi_def_cfa_offset 48
	popq	%rbp
	.cfi_def_cfa_offset 40
	popq	%r12
	.cfi_def_cfa_offset 32
	popq	%r13
	.cfi_def_cfa_offset 24
	popq	%r14
	.cfi_def_cfa_offset 16
	popq	%r15
	.cfi_def_cfa_offset 8
	ret
	.cfi_endproc
.LFE41:
	.size	inorder, .-inorder
	.p2align 4
	.globl	preorder
	.type	preorder, @function
preorder:
.LFB42:
	.cfi_startproc
	endbr64
	cmpq	NIL(%rip), %rdi
	je	.L79
	pushq	%r15
	.cfi_def_cfa_offset 16
	.cfi_offset 15, -16
	pushq	%r14
	.cfi_def_cfa_offset 24
	.cfi_offset 14, -24
	pushq	%r13
	.cfi_def_cfa_offset 32
	.cfi_offset 13, -32
	pushq	%r12
	.cfi_def_cfa_offset 40
	.cfi_offset 12, -40
	movq	%rdi, %r12
	pushq	%rbp
	.cfi_def_cfa_offset 48
	.cfi_offset 6, -48
	leaq	.LC0(%rip), %rbp
	pushq	%rbx
	.cfi_def_cfa_offset 56
	.cfi_offset 3, -56
	subq	$40, %rsp
	.cfi_def_cfa_offset 96
.L48:
	movl	(%r12), %edx
	movq	%rbp, %rsi
	movl	$1, %edi
	xorl	%eax, %eax
	call	__printf_chk@PLT
	movq	16(%r12), %rax
	movq	NIL(%rip), %r14
	movq	%rax, (%rsp)
	cmpq	%r14, %rax
	je	.L49
.L64:
	movq	(%rsp), %rbx
	movq	%rbp, %rsi
	movl	$1, %edi
	xorl	%eax, %eax
	movl	(%rbx), %edx
	call	__printf_chk@PLT
	movq	16(%rbx), %rax
	movq	NIL(%rip), %r14
	movq	%rax, 8(%rsp)
	cmpq	%r14, %rax
	je	.L50
.L63:
	movq	8(%rsp), %rbx
	movq	%rbp, %rsi
	movl	$1, %edi
	xorl	%eax, %eax
	movl	(%rbx), %edx
	call	__printf_chk@PLT
	movq	16(%rbx), %rax
	movq	NIL(%rip), %r14
	movq	%rax, 16(%rsp)
	cmpq	%r14, %rax
	je	.L51
.L62:
	movq	16(%rsp), %rbx
	movq	%rbp, %rsi
	movl	$1, %edi
	xorl	%eax, %eax
	movl	(%rbx), %edx
	call	__printf_chk@PLT
	movq	16(%rbx), %rbx
	movq	NIL(%rip), %r14
	cmpq	%r14, %rbx
	je	.L52
.L61:
	movl	(%rbx), %edx
	xorl	%eax, %eax
	movq	%rbp, %rsi
	movl	$1, %edi
	call	__printf_chk@PLT
	movq	16(%rbx), %r15
	cmpq	%r15, NIL(%rip)
	movq	%r15, %r14
	je	.L53
.L60:
	movl	(%r15), %edx
	movq	%rbp, %rsi
	movl	$1, %edi
	xorl	%eax, %eax
	call	__printf_chk@PLT
	movq	16(%r15), %r13
	movq	NIL(%rip), %r14
	cmpq	%r14, %r13
	je	.L54
.L59:
	movl	0(%r13), %edx
	movq	%rbp, %rsi
	movl	$1, %edi
	xorl	%eax, %eax
	call	__printf_chk@PLT
	movq	16(%r13), %rax
	movq	NIL(%rip), %r14
	cmpq	%r14, %rax
	je	.L55
	movq	%rax, %r14
.L58:
	movl	(%r14), %edx
	xorl	%eax, %eax
	movq	%rbp, %rsi
	movl	$1, %edi
	call	__printf_chk@PLT
	movq	16(%r14), %r9
	cmpq	NIL(%rip), %r9
	je	.L56
.L57:
	movl	(%r9), %edx
	movq	%rbp, %rsi
	movl	$1, %edi
	xorl	%eax, %eax
	movq	%r9, 24(%rsp)
	call	__printf_chk@PLT
	movq	24(%rsp), %r9
	movq	16(%r9), %rdi
	call	preorder
	movq	24(%rsp), %r9
	movq	24(%r9), %r9
	cmpq	%r9, NIL(%rip)
	jne	.L57
.L56:
	movq	24(%r14), %r14
	cmpq	%r14, %r9
	jne	.L58
.L55:
	movq	24(%r13), %r13
	cmpq	%r14, %r13
	jne	.L59
.L54:
	movq	24(%r15), %r15
	cmpq	%r14, %r15
	jne	.L60
.L53:
	movq	24(%rbx), %rbx
	cmpq	%r14, %rbx
	jne	.L61
.L52:
	movq	16(%rsp), %rax
	movq	24(%rax), %rax
	movq	%rax, 16(%rsp)
	cmpq	%r14, %rax
	jne	.L62
.L51:
	movq	8(%rsp), %rax
	movq	24(%rax), %rax
	movq	%rax, 8(%rsp)
	cmpq	%r14, %rax
	jne	.L63
.L50:
	movq	(%rsp), %rax
	movq	24(%rax), %rax
	movq	%rax, (%rsp)
	cmpq	%r14, %rax
	jne	.L64
.L49:
	movq	24(%r12), %r12
	cmpq	%r14, %r12
	jne	.L48
	addq	$40, %rsp
	.cfi_def_cfa_offset 56
	popq	%rbx
	.cfi_def_cfa_offset 48
	popq	%rbp
	.cfi_def_cfa_offset 40
	popq	%r12
	.cfi_def_cfa_offset 32
	popq	%r13
	.cfi_def_cfa_offset 24
	popq	%r14
	.cfi_def_cfa_offset 16
	popq	%r15
	.cfi_def_cfa_offset 8
	ret
.L79:
	.cfi_restore 3
	.cfi_restore 6
	.cfi_restore 12
	.cfi_restore 13
	.cfi_restore 14
	.cfi_restore 15
	ret
	.cfi_endproc
.LFE42:
	.size	preorder, .-preorder
	.p2align 4
	.globl	find
	.type	find, @function
find:
.LFB43:
	.cfi_startproc
	endbr64
	movq	T(%rip), %rsi
	movq	NIL(%rip), %rcx
	movq	%rsi, %rax
	cmpq	%rcx, %rsi
	jne	.L85
	jmp	.L82
	.p2align 4,,10
	.p2align 3
.L90:
	movq	16(%rax), %rdx
	cmovle	24(%rax), %rdx
	movq	%rdx, %rax
	cmpq	%rcx, %rdx
	je	.L89
.L85:
	cmpl	%edi, (%rax)
	jne	.L90
.L82:
	ret
	.p2align 4,,10
	.p2align 3
.L89:
	movq	%rsi, %rax
	ret
	.cfi_endproc
.LFE43:
	.size	find, .-find
	.p2align 4
	.globl	delete
	.type	delete, @function
delete:
.LFB44:
	.cfi_startproc
	endbr64
	movq	T(%rip), %rsi
	movq	NIL(%rip), %rcx
	cmpq	%rcx, %rsi
	je	.L103
	movq	%rsi, %rax
	jmp	.L94
	.p2align 4,,10
	.p2align 3
.L109:
	movq	16(%rax), %rdx
	cmovge	24(%rax), %rdx
	movq	%rdx, %rax
	cmpq	%rcx, %rdx
	je	.L108
.L94:
	cmpl	(%rax), %edi
	jne	.L109
.L92:
	movq	16(%rax), %rdi
	movq	24(%rax), %rdx
	cmpq	%rcx, %rdi
	je	.L104
.L113:
	cmpq	%rcx, %rdx
	je	.L105
	.p2align 4,,10
	.p2align 3
.L97:
	movq	%rdx, %rsi
	movq	16(%rdx), %rdx
	cmpq	%rcx, %rdx
	jne	.L97
.L95:
	movq	24(%rsi), %rdi
	cmpq	%rcx, %rdi
	jne	.L96
	movq	8(%rsi), %rdx
	cmpq	%rcx, %rdx
	je	.L110
.L98:
	cmpq	%rsi, 16(%rdx)
	je	.L111
	movq	%rdi, 24(%rdx)
.L99:
	cmpq	%rsi, %rax
	je	.L91
.L112:
	movl	(%rsi), %edx
	movl	%edx, (%rax)
	ret
	.p2align 4,,10
	.p2align 3
.L105:
	movq	%rax, %rsi
.L96:
	movq	8(%rsi), %rdx
	movq	%rdx, 8(%rdi)
	movq	8(%rsi), %rdx
	cmpq	%rcx, %rdx
	jne	.L98
.L110:
	movq	%rdi, T(%rip)
	cmpq	%rsi, %rax
	jne	.L112
.L91:
	ret
	.p2align 4,,10
	.p2align 3
.L108:
	movq	%rsi, %rax
	movq	16(%rax), %rdi
	movq	24(%rax), %rdx
	cmpq	%rcx, %rdi
	jne	.L113
.L104:
	movq	%rax, %rsi
	jmp	.L95
	.p2align 4,,10
	.p2align 3
.L111:
	movq	%rdi, 16(%rdx)
	jmp	.L99
.L103:
	movq	%rcx, %rax
	jmp	.L92
	.cfi_endproc
.LFE44:
	.size	delete, .-delete
	.section	.rodata.str1.1
.LC1:
	.string	"%d"
.LC2:
	.string	"%s%c"
.LC3:
	.string	"insert"
.LC4:
	.string	"print"
.LC5:
	.string	"delete"
.LC6:
	.string	"find"
.LC7:
	.string	"yes"
.LC8:
	.string	"no"
	.section	.text.startup,"ax",@progbits
	.p2align 4
	.globl	main
	.type	main, @function
main:
.LFB39:
	.cfi_startproc
	endbr64
	pushq	%r15
	.cfi_def_cfa_offset 16
	.cfi_offset 15, -16
	leaq	.LC1(%rip), %rdi
	pushq	%r14
	.cfi_def_cfa_offset 24
	.cfi_offset 14, -24
	pushq	%r13
	.cfi_def_cfa_offset 32
	.cfi_offset 13, -32
	pushq	%r12
	.cfi_def_cfa_offset 40
	.cfi_offset 12, -40
	pushq	%rbp
	.cfi_def_cfa_offset 48
	.cfi_offset 6, -48
	pushq	%rbx
	.cfi_def_cfa_offset 56
	.cfi_offset 3, -56
	subq	$56, %rsp
	.cfi_def_cfa_offset 112
	movq	%fs:40, %rax
	movq	%rax, 40(%rsp)
	xorl	%eax, %eax
	leaq	20(%rsp), %rsi
	call	__isoc99_scanf@PLT
	movl	20(%rsp), %eax
	testl	%eax, %eax
	jle	.L145
	leaq	24(%rsp), %rax
	xorl	%ebp, %ebp
	leaq	19(%rsp), %r14
	movq	%rax, 8(%rsp)
	leaq	30(%rsp), %rbx
	leaq	.LC2(%rip), %r13
	leaq	.LC0(%rip), %r12
	jmp	.L115
	.p2align 4,,10
	.p2align 3
.L116:
	cmpl	$1852404336, (%rbx)
	je	.L163
.L128:
	cmpl	$1701602660, (%rbx)
	je	.L164
.L135:
	cmpl	$1684957542, (%rbx)
	je	.L165
.L126:
	addl	$1, %ebp
	cmpl	%ebp, 20(%rsp)
	jle	.L145
.L115:
	xorl	%eax, %eax
	movq	%r14, %rdx
	movq	%rbx, %rsi
	movq	%r13, %rdi
	call	__isoc99_scanf@PLT
	cmpl	$1702063721, (%rbx)
	jne	.L116
	cmpw	$29810, 4(%rbx)
	jne	.L116
	cmpb	$0, 6(%rbx)
	jne	.L116
	movq	8(%rsp), %rsi
	leaq	.LC1(%rip), %rdi
	xorl	%eax, %eax
	call	__isoc99_scanf@PLT
	movl	$32, %edi
	call	malloc@PLT
	movq	NIL(%rip), %r8
	movl	24(%rsp), %r9d
	movq	T(%rip), %rdx
	movq	%r8, %xmm0
	movl	%r9d, (%rax)
	punpcklqdq	%xmm0, %xmm0
	movups	%xmm0, 16(%rax)
	cmpq	%rdx, %r8
	je	.L166
	.p2align 4,,10
	.p2align 3
.L124:
	movl	(%rdx), %ecx
	movq	16(%rdx), %rsi
	movq	24(%rdx), %rdi
	cmpl	%ecx, %r9d
	jge	.L120
.L168:
	cmpq	%rsi, %r8
	je	.L167
	movq	%rsi, %rdx
	movl	(%rdx), %ecx
	movq	16(%rdx), %rsi
	movq	24(%rdx), %rdi
	cmpl	%ecx, %r9d
	jl	.L168
.L120:
	cmpq	%rdi, %r8
	je	.L123
	movq	%rdi, %rdx
	jmp	.L124
	.p2align 4,,10
	.p2align 3
.L163:
	cmpw	$116, 4(%rbx)
	jne	.L128
	movq	T(%rip), %r15
	cmpq	NIL(%rip), %r15
	je	.L134
	.p2align 4,,10
	.p2align 3
.L131:
	movq	16(%r15), %rdi
	call	inorder
	movl	(%r15), %edx
	xorl	%eax, %eax
	movq	%r12, %rsi
	movl	$1, %edi
	call	__printf_chk@PLT
	movq	24(%r15), %r15
	cmpq	%r15, NIL(%rip)
	jne	.L131
.L134:
	movl	$10, %edi
	call	putchar@PLT
	movq	T(%rip), %r15
	cmpq	NIL(%rip), %r15
	je	.L132
.L133:
	movl	(%r15), %edx
	movq	%r12, %rsi
	movl	$1, %edi
	xorl	%eax, %eax
	call	__printf_chk@PLT
	movq	16(%r15), %rdi
	call	preorder
	movq	24(%r15), %r15
	cmpq	%r15, NIL(%rip)
	jne	.L133
.L132:
	movl	$10, %edi
	addl	$1, %ebp
	call	putchar@PLT
	cmpl	%ebp, 20(%rsp)
	jg	.L115
	.p2align 4,,10
	.p2align 3
.L145:
	movq	40(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L169
	addq	$56, %rsp
	.cfi_remember_state
	.cfi_def_cfa_offset 56
	xorl	%eax, %eax
	popq	%rbx
	.cfi_def_cfa_offset 48
	popq	%rbp
	.cfi_def_cfa_offset 40
	popq	%r12
	.cfi_def_cfa_offset 32
	popq	%r13
	.cfi_def_cfa_offset 24
	popq	%r14
	.cfi_def_cfa_offset 16
	popq	%r15
	.cfi_def_cfa_offset 8
	ret
	.p2align 4,,10
	.p2align 3
.L164:
	.cfi_restore_state
	cmpw	$25972, 4(%rbx)
	jne	.L135
	cmpb	$0, 6(%rbx)
	jne	.L135
	movq	8(%rsp), %rsi
	leaq	.LC1(%rip), %rdi
	xorl	%eax, %eax
	call	__isoc99_scanf@PLT
	movl	24(%rsp), %edi
	call	delete
	jmp	.L126
	.p2align 4,,10
	.p2align 3
.L165:
	cmpb	$0, 4(%rbx)
	jne	.L126
	movq	8(%rsp), %rsi
	leaq	.LC1(%rip), %rdi
	xorl	%eax, %eax
	call	__isoc99_scanf@PLT
	movq	T(%rip), %rdi
	movq	NIL(%rip), %rcx
	movl	24(%rsp), %esi
	cmpq	%rcx, %rdi
	je	.L140
	movq	%rdi, %rax
	jmp	.L143
	.p2align 4,,10
	.p2align 3
.L171:
	movq	16(%rax), %rdx
	cmovge	24(%rax), %rdx
	movq	%rdx, %rax
	cmpq	%rcx, %rdx
	je	.L170
.L143:
	cmpl	(%rax), %esi
	jne	.L171
.L141:
	leaq	.LC7(%rip), %rdi
	call	puts@PLT
	jmp	.L126
	.p2align 4,,10
	.p2align 3
.L167:
	movq	%rdx, 8(%rax)
	cmpq	%rdx, %r8
	je	.L146
.L127:
	movq	%rax, 16(%rdx)
	jmp	.L126
	.p2align 4,,10
	.p2align 3
.L123:
	movq	%rdx, 8(%rax)
	cmpq	%rdx, %r8
	je	.L146
	cmpl	%ecx, %r9d
	jle	.L127
	movq	%rax, 24(%rdx)
	jmp	.L126
.L166:
	movq	%r8, 8(%rax)
.L146:
	movq	%rax, T(%rip)
	jmp	.L126
.L170:
	movq	%rdi, %rcx
.L140:
	cmpl	(%rcx), %esi
	je	.L141
	leaq	.LC8(%rip), %rdi
	call	puts@PLT
	jmp	.L126
.L169:
	call	__stack_chk_fail@PLT
	.cfi_endproc
.LFE39:
	.size	main, .-main
	.text
	.p2align 4
	.globl	getSuccessor
	.type	getSuccessor, @function
getSuccessor:
.LFB45:
	.cfi_startproc
	endbr64
	movq	24(%rdi), %rdx
	movq	NIL(%rip), %rcx
	cmpq	%rcx, %rdx
	je	.L173
	.p2align 4,,10
	.p2align 3
.L174:
	movq	%rdx, %rax
	movq	16(%rdx), %rdx
	cmpq	%rdx, %rcx
	jne	.L174
	ret
	.p2align 4,,10
	.p2align 3
.L173:
	xorl	%edx, %edx
	movq	8(%rdx), %rax
	cmpq	%rdx, 24(%rax)
	je	.L189
	jmp	.L172
	.p2align 4,,10
	.p2align 3
.L190:
	movq	%rax, %rdx
	movq	8(%rax), %rax
	cmpq	%rdx, 24(%rax)
	jne	.L172
.L189:
	cmpq	%rax, %rcx
	jne	.L190
.L172:
	ret
	.cfi_endproc
.LFE45:
	.size	getSuccessor, .-getSuccessor
	.p2align 4
	.globl	getMin
	.type	getMin, @function
getMin:
.LFB46:
	.cfi_startproc
	endbr64
	movq	NIL(%rip), %rdx
	.p2align 4,,10
	.p2align 3
.L192:
	movq	%rdi, %rax
	movq	16(%rdi), %rdi
	cmpq	%rdx, %rdi
	jne	.L192
	ret
	.cfi_endproc
.LFE46:
	.size	getMin, .-getMin
	.globl	NIL
	.bss
	.align 8
	.type	NIL, @object
	.size	NIL, 8
NIL:
	.zero	8
	.globl	T
	.align 8
	.type	T, @object
	.size	T, 8
T:
	.zero	8
	.ident	"GCC: (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0"
	.section	.note.GNU-stack,"",@progbits
	.section	.note.gnu.property,"a"
	.align 8
	.long	1f - 0f
	.long	4f - 1f
	.long	5
0:
	.string	"GNU"
1:
	.align 8
	.long	0xc0000002
	.long	3f - 2f
2:
	.long	0x3
3:
	.align 8
4:

rule
	.file	"temp.c"
	.text
	.p2align 4
	.globl	insert
	.type	insert, @function
insert:
.LFB40:
	.cfi_startproc
	endbr64
	movq	T(%rip), %rax
	movq	NIL(%rip), %r8
	cmpq	%r8, %rax
	je	.L2
	movl	(%rdi), %r9d
	.p2align 4,,10
	.p2align 3
.L7:
	movl	(%rax), %edx
	movq	16(%rax), %rcx
	movq	24(%rax), %rsi
	cmpl	%edx, %r9d
	jge	.L3
.L16:
	cmpq	%rcx, %r8
	je	.L15
	movq	%rcx, %rax
	movl	(%rax), %edx
	movq	16(%rax), %rcx
	movq	24(%rax), %rsi
	cmpl	%edx, %r9d
	jl	.L16
.L3:
	cmpq	%rsi, %r8
	je	.L6
	movq	%rsi, %rax
	jmp	.L7
	.p2align 4,,10
	.p2align 3
.L15:
	movq	%rax, 8(%rdi)
	cmpq	%r8, %rax
	je	.L11
.L10:
	movq	%rdi, 16(%rax)
	ret
	.p2align 4,,10
	.p2align 3
.L6:
	movq	%rax, 8(%rdi)
	cmpq	%r8, %rax
	je	.L11
	cmpl	%edx, %r9d
	jle	.L10
	movq	%rdi, 24(%rax)
	ret
	.p2align 4,,10
	.p2align 3
.L2:
	movq	%rax, 8(%rdi)
.L11:
	movq	%rdi, T(%rip)
	ret
	.cfi_endproc
.LFE40:
	.size	insert, .-insert
	.section	.rodata.str1.1,"aMS",@progbits,1
.LC0:
	.string	" %d"
	.text
	.p2align 4
	.globl	inorder
	.type	inorder, @function
inorder:
.LFB41:
	.cfi_startproc
	endbr64
	pushq	%r15
	.cfi_def_cfa_offset 16
	.cfi_offset 15, -16
	pushq	%r14
	.cfi_def_cfa_offset 24
	.cfi_offset 14, -24
	pushq	%r13
	.cfi_def_cfa_offset 32
	.cfi_offset 13, -32
	pushq	%r12
	.cfi_def_cfa_offset 40
	.cfi_offset 12, -40
	pushq	%rbp
	.cfi_def_cfa_offset 48
	.cfi_offset 6, -48
	pushq	%rbx
	.cfi_def_cfa_offset 56
	.cfi_offset 3, -56
	subq	$40, %rsp
	.cfi_def_cfa_offset 96
	movq	NIL(%rip), %rax
	movq	%rdi, 16(%rsp)
	cmpq	%rax, %rdi
	je	.L17
	leaq	.LC0(%rip), %rbp
.L18:
	movq	16(%rsp), %rsi
	movq	16(%rsi), %rcx
	movq	%rcx, (%rsp)
	cmpq	%rax, %rcx
	je	.L22
.L19:
	movq	(%rsp), %rcx
	movq	16(%rcx), %rdx
	movq	%rdx, 8(%rsp)
	cmpq	%rax, %rdx
	je	.L24
.L21:
	movq	8(%rsp), %rdi
	movq	16(%rdi), %r15
	cmpq	%rax, %r15
	je	.L26
.L23:
	movq	16(%r15), %rbx
	cmpq	%rax, %rbx
	je	.L28
.L25:
	movq	16(%rbx), %r13
	cmpq	%rax, %r13
	je	.L30
.L27:
	movq	16(%r13), %r12
	cmpq	%rax, %r12
	je	.L32
.L29:
	movq	16(%r12), %r14
	cmpq	%rax, %r14
	je	.L34
.L31:
	movq	16(%r14), %r9
	cmpq	%rax, %r9
	je	.L35
.L33:
	movq	16(%r9), %rdi
	movq	%r9, 24(%rsp)
	call	inorder
	movq	24(%rsp), %r9
	xorl	%eax, %eax
	movq	%rbp, %rsi
	movl	$1, %edi
	movl	(%r9), %edx
	call	__printf_chk@PLT
	movq	24(%rsp), %r9
	movq	24(%r9), %r9
	cmpq	%r9, NIL(%rip)
	jne	.L33
.L35:
	movl	(%r14), %edx
	movq	%rbp, %rsi
	movl	$1, %edi
	xorl	%eax, %eax
	call	__printf_chk@PLT
	movq	24(%r14), %r14
	movq	NIL(%rip), %rax
	cmpq	%r14, %rax
	jne	.L31
.L34:
	movl	(%r12), %edx
	movq	%rbp, %rsi
	movl	$1, %edi
	xorl	%eax, %eax
	call	__printf_chk@PLT
	movq	24(%r12), %r12
	movq	NIL(%rip), %rax
	cmpq	%r12, %rax
	jne	.L29
.L32:
	movl	0(%r13), %edx
	movq	%rbp, %rsi
	movl	$1, %edi
	xorl	%eax, %eax
	call	__printf_chk@PLT
	movq	24(%r13), %r13
	movq	NIL(%rip), %rax
	cmpq	%r13, %rax
	jne	.L27
.L30:
	movl	(%rbx), %edx
	movq	%rbp, %rsi
	movl	$1, %edi
	xorl	%eax, %eax
	call	__printf_chk@PLT
	movq	24(%rbx), %rbx
	movq	NIL(%rip), %rax
	cmpq	%rbx, %rax
	jne	.L25
.L28:
	movl	(%r15), %edx
	movq	%rbp, %rsi
	movl	$1, %edi
	xorl	%eax, %eax
	call	__printf_chk@PLT
	movq	24(%r15), %r15
	movq	NIL(%rip), %rax
	cmpq	%r15, %rax
	jne	.L23
.L26:
	movq	8(%rsp), %rbx
	movq	%rbp, %rsi
	movl	$1, %edi
	xorl	%eax, %eax
	movl	(%rbx), %edx
	call	__printf_chk@PLT
	movq	24(%rbx), %rcx
	movq	NIL(%rip), %rax
	movq	%rcx, 8(%rsp)
	cmpq	%rcx, %rax
	jne	.L21
.L24:
	movq	(%rsp), %rbx
	movq	%rbp, %rsi
	movl	$1, %edi
	xorl	%eax, %eax
	movl	(%rbx), %edx
	call	__printf_chk@PLT
	movq	24(%rbx), %rsi
	movq	NIL(%rip), %rax
	movq	%rsi, (%rsp)
	cmpq	%rsi, %rax
	jne	.L19
.L22:
	movq	16(%rsp), %rbx
	movq	%rbp, %rsi
	movl	$1, %edi
	xorl	%eax, %eax
	movl	(%rbx), %edx
	call	__printf_chk@PLT
	movq	24(%rbx), %rcx
	movq	NIL(%rip), %rax
	movq	%rcx, 16(%rsp)
	cmpq	%rcx, %rax
	jne	.L18
.L17:
	addq	$40, %rsp
	.cfi_def_cfa_offset 56
	popq	%rbx
	.cfi_def_cfa_offset 48
	popq	%rbp
	.cfi_def_cfa_offset 40
	popq	%r12
	.cfi_def_cfa_offset 32
	popq	%r13
	.cfi_def_cfa_offset 24
	popq	%r14
	.cfi_def_cfa_offset 16
	popq	%r15
	.cfi_def_cfa_offset 8
	ret
	.cfi_endproc
.LFE41:
	.size	inorder, .-inorder
	.p2align 4
	.globl	preorder
	.type	preorder, @function
preorder:
.LFB42:
	.cfi_startproc
	endbr64
	cmpq	NIL(%rip), %rdi
	je	.L79
	pushq	%r15
	.cfi_def_cfa_offset 16
	.cfi_offset 15, -16
	pushq	%r14
	.cfi_def_cfa_offset 24
	.cfi_offset 14, -24
	pushq	%r13
	.cfi_def_cfa_offset 32
	.cfi_offset 13, -32
	pushq	%r12
	.cfi_def_cfa_offset 40
	.cfi_offset 12, -40
	movq	%rdi, %r12
	pushq	%rbp
	.cfi_def_cfa_offset 48
	.cfi_offset 6, -48
	leaq	.LC0(%rip), %rbp
	pushq	%rbx
	.cfi_def_cfa_offset 56
	.cfi_offset 3, -56
	subq	$40, %rsp
	.cfi_def_cfa_offset 96
.L48:
	movl	(%r12), %edx
	movq	%rbp, %rsi
	movl	$1, %edi
	xorl	%eax, %eax
	call	__printf_chk@PLT
	movq	16(%r12), %rax
	movq	NIL(%rip), %r14
	movq	%rax, (%rsp)
	cmpq	%r14, %rax
	je	.L49
.L64:
	movq	(%rsp), %rbx
	movq	%rbp, %rsi
	movl	$1, %edi
	xorl	%eax, %eax
	movl	(%rbx), %edx
	call	__printf_chk@PLT
	movq	16(%rbx), %rax
	movq	NIL(%rip), %r14
	movq	%rax, 8(%rsp)
	cmpq	%r14, %rax
	je	.L50
.L63:
	movq	8(%rsp), %rbx
	movq	%rbp, %rsi
	movl	$1, %edi
	xorl	%eax, %eax
	movl	(%rbx), %edx
	call	__printf_chk@PLT
	movq	16(%rbx), %rax
	movq	NIL(%rip), %r14
	movq	%rax, 16(%rsp)
	cmpq	%r14, %rax
	je	.L51
.L62:
	movq	16(%rsp), %rbx
	movq	%rbp, %rsi
	movl	$1, %edi
	xorl	%eax, %eax
	movl	(%rbx), %edx
	call	__printf_chk@PLT
	movq	16(%rbx), %rbx
	movq	NIL(%rip), %r14
	cmpq	%r14, %rbx
	je	.L52
.L61:
	movl	(%rbx), %edx
	xorl	%eax, %eax
	movq	%rbp, %rsi
	movl	$1, %edi
	call	__printf_chk@PLT
	movq	16(%rbx), %r15
	cmpq	%r15, NIL(%rip)
	movq	%r15, %r14
	je	.L53
.L60:
	movl	(%r15), %edx
	movq	%rbp, %rsi
	movl	$1, %edi
	xorl	%eax, %eax
	call	__printf_chk@PLT
	movq	16(%r15), %r13
	movq	NIL(%rip), %r14
	cmpq	%r14, %r13
	je	.L54
.L59:
	movl	0(%r13), %edx
	movq	%rbp, %rsi
	movl	$1, %edi
	xorl	%eax, %eax
	call	__printf_chk@PLT
	movq	16(%r13), %rax
	movq	NIL(%rip), %r14
	cmpq	%r14, %rax
	je	.L55
	movq	%rax, %r14
.L58:
	movl	(%r14), %edx
	xorl	%eax, %eax
	movq	%rbp, %rsi
	movl	$1, %edi
	call	__printf_chk@PLT
	movq	16(%r14), %r9
	cmpq	NIL(%rip), %r9
	je	.L56
.L57:
	movl	(%r9), %edx
	movq	%rbp, %rsi
	movl	$1, %edi
	xorl	%eax, %eax
	movq	%r9, 24(%rsp)
	call	__printf_chk@PLT
	movq	24(%rsp), %r9
	movq	16(%r9), %rdi
	call	preorder
	movq	24(%rsp), %r9
	movq	24(%r9), %r9
	cmpq	%r9, NIL(%rip)
	jne	.L57
.L56:
	movq	24(%r14), %r14
	cmpq	%r14, %r9
	jne	.L58
.L55:
	movq	24(%r13), %r13
	cmpq	%r14, %r13
	jne	.L59
.L54:
	movq	24(%r15), %r15
	cmpq	%r14, %r15
	jne	.L60
.L53:
	movq	24(%rbx), %rbx
	cmpq	%r14, %rbx
	jne	.L61
.L52:
	movq	16(%rsp), %rax
	movq	24(%rax), %rax
	movq	%rax, 16(%rsp)
	cmpq	%r14, %rax
	jne	.L62
.L51:
	movq	8(%rsp), %rax
	movq	24(%rax), %rax
	movq	%rax, 8(%rsp)
	cmpq	%r14, %rax
	jne	.L63
.L50:
	movq	(%rsp), %rax
	movq	24(%rax), %rax
	movq	%rax, (%rsp)
	cmpq	%r14, %rax
	jne	.L64
.L49:
	movq	24(%r12), %r12
	cmpq	%r14, %r12
	jne	.L48
	addq	$40, %rsp
	.cfi_def_cfa_offset 56
	popq	%rbx
	.cfi_def_cfa_offset 48
	popq	%rbp
	.cfi_def_cfa_offset 40
	popq	%r12
	.cfi_def_cfa_offset 32
	popq	%r13
	.cfi_def_cfa_offset 24
	popq	%r14
	.cfi_def_cfa_offset 16
	popq	%r15
	.cfi_def_cfa_offset 8
	ret
.L79:
	.cfi_restore 3
	.cfi_restore 6
	.cfi_restore 12
	.cfi_restore 13
	.cfi_restore 14
	.cfi_restore 15
	ret
	.cfi_endproc
.LFE42:
	.size	preorder, .-preorder
	.p2align 4
	.globl	find
	.type	find, @function
find:
.LFB43:
	.cfi_startproc
	endbr64
	movq	T(%rip), %rsi
	movq	NIL(%rip), %rcx
	movq	%rsi, %rax
	cmpq	%rcx, %rsi
	jne	.L85
	jmp	.L82
	.p2align 4,,10
	.p2align 3
.L90:
	movq	16(%rax), %rdx
	cmovle	24(%rax), %rdx
	movq	%rdx, %rax
	cmpq	%rcx, %rdx
	je	.L89
.L85:
	cmpl	%edi, (%rax)
	jne	.L90
.L82:
	ret
	.p2align 4,,10
	.p2align 3
.L89:
	movq	%rsi, %rax
	ret
	.cfi_endproc
.LFE43:
	.size	find, .-find
	.p2align 4
	.globl	delete
	.type	delete, @function
delete:
.LFB44:
	.cfi_startproc
	endbr64
	movq	T(%rip), %rsi
	movq	NIL(%rip), %rcx
	cmpq	%rcx, %rsi
	je	.L103
	movq	%rsi, %rax
	jmp	.L94
	.p2align 4,,10
	.p2align 3
.L109:
	movq	16(%rax), %rdx
	cmovge	24(%rax), %rdx
	movq	%rdx, %rax
	cmpq	%rcx, %rdx
	je	.L108
.L94:
	cmpl	(%rax), %edi
	jne	.L109
.L92:
	movq	16(%rax), %rdi
	movq	24(%rax), %rdx
	cmpq	%rcx, %rdi
	je	.L104
.L113:
	cmpq	%rcx, %rdx
	je	.L105
	.p2align 4,,10
	.p2align 3
.L97:
	movq	%rdx, %rsi
	movq	16(%rdx), %rdx
	cmpq	%rcx, %rdx
	jne	.L97
.L95:
	movq	24(%rsi), %rdi
	cmpq	%rcx, %rdi
	jne	.L96
	movq	8(%rsi), %rdx
	cmpq	%rcx, %rdx
	je	.L110
.L98:
	cmpq	%rsi, 16(%rdx)
	je	.L111
	movq	%rdi, 24(%rdx)
.L99:
	cmpq	%rsi, %rax
	je	.L91
.L112:
	movl	(%rsi), %edx
	movl	%edx, (%rax)
	ret
	.p2align 4,,10
	.p2align 3
.L105:
	movq	%rax, %rsi
.L96:
	movq	8(%rsi), %rdx
	movq	%rdx, 8(%rdi)
	movq	8(%rsi), %rdx
	cmpq	%rcx, %rdx
	jne	.L98
.L110:
	movq	%rdi, T(%rip)
	cmpq	%rsi, %rax
	jne	.L112
.L91:
	ret
	.p2align 4,,10
	.p2align 3
.L108:
	movq	%rsi, %rax
	movq	16(%rax), %rdi
	movq	24(%rax), %rdx
	cmpq	%rcx, %rdi
	jne	.L113
.L104:
	movq	%rax, %rsi
	jmp	.L95
	.p2align 4,,10
	.p2align 3
.L111:
	movq	%rdi, 16(%rdx)
	jmp	.L99
.L103:
	movq	%rcx, %rax
	jmp	.L92
	.cfi_endproc
.LFE44:
	.size	delete, .-delete
	.section	.rodata.str1.1
.LC1:
	.string	"%d"
.LC2:
	.string	"%s%c"
.LC3:
	.string	"insert"
.LC4:
	.string	"print"
.LC5:
	.string	"delete"
.LC6:
	.string	"find"
.LC7:
	.string	"yes"
.LC8:
	.string	"no"
	.section	.text.startup,"ax",@progbits
	.p2align 4
	.globl	main
	.type	main, @function
main:
.LFB39:
	.cfi_startproc
	endbr64
	pushq	%r15
	.cfi_def_cfa_offset 16
	.cfi_offset 15, -16
	leaq	.LC1(%rip), %rdi
	pushq	%r14
	.cfi_def_cfa_offset 24
	.cfi_offset 14, -24
	pushq	%r13
	.cfi_def_cfa_offset 32
	.cfi_offset 13, -32
	pushq	%r12
	.cfi_def_cfa_offset 40
	.cfi_offset 12, -40
	pushq	%rbp
	.cfi_def_cfa_offset 48
	.cfi_offset 6, -48
	pushq	%rbx
	.cfi_def_cfa_offset 56
	.cfi_offset 3, -56
	subq	$56, %rsp
	.cfi_def_cfa_offset 112
	movq	%fs:40, %rax
	movq	%rax, 40(%rsp)
	xorl	%eax, %eax
	leaq	20(%rsp), %rsi
	call	__isoc99_scanf@PLT
	movl	20(%rsp), %eax
	testl	%eax, %eax
	jle	.L145
	leaq	24(%rsp), %rax
	xorl	%ebp, %ebp
	leaq	19(%rsp), %r14
	movq	%rax, 8(%rsp)
	leaq	30(%rsp), %rbx
	leaq	.LC2(%rip), %r13
	leaq	.LC0(%rip), %r12
	jmp	.L115
	.p2align 4,,10
	.p2align 3
.L116:
	cmpl	$1852404336, (%rbx)
	je	.L163
.L128:
	cmpl	$1701602660, (%rbx)
	je	.L164
.L135:
	cmpl	$1684957542, (%rbx)
	je	.L165
.L126:
	addl	$1, %ebp
	cmpl	%ebp, 20(%rsp)
	jle	.L145
.L115:
	xorl	%eax, %eax
	movq	%r14, %rdx
	movq	%rbx, %rsi
	movq	%r13, %rdi
	call	__isoc99_scanf@PLT
	cmpl	$1702063721, (%rbx)
	jne	.L116
	cmpw	$29810, 4(%rbx)
	jne	.L116
	cmpb	$0, 6(%rbx)
	jne	.L116
	movq	8(%rsp), %rsi
	leaq	.LC1(%rip), %rdi
	xorl	%eax, %eax
	call	__isoc99_scanf@PLT
	movl	$32, %edi
	call	malloc@PLT
	movq	NIL(%rip), %r8
	movl	24(%rsp), %r9d
	movq	T(%rip), %rdx
	movq	%r8, %xmm0
	movl	%r9d, (%rax)
	punpcklqdq	%xmm0, %xmm0
	movups	%xmm0, 16(%rax)
	cmpq	%rdx, %r8
	je	.L166
	.p2align 4,,10
	.p2align 3
.L124:
	movl	(%rdx), %ecx
	movq	16(%rdx), %rsi
	movq	24(%rdx), %rdi
	cmpl	%ecx, %r9d
	jge	.L120
.L168:
	cmpq	%rsi, %r8
	je	.L167
	movq	%rsi, %rdx
	movl	(%rdx), %ecx
	movq	16(%rdx), %rsi
	movq	24(%rdx), %rdi
	cmpl	%ecx, %r9d
	jl	.L168
.L120:
	cmpq	%rdi, %r8
	je	.L123
	movq	%rdi, %rdx
	jmp	.L124
	.p2align 4,,10
	.p2align 3
.L163:
	cmpw	$116, 4(%rbx)
	jne	.L128
	movq	T(%rip), %r15
	cmpq	NIL(%rip), %r15
	je	.L134
	.p2align 4,,10
	.p2align 3
.L131:
	movq	16(%r15), %rdi
	call	inorder
	movl	(%r15), %edx
	xorl	%eax, %eax
	movq	%r12, %rsi
	movl	$1, %edi
	call	__printf_chk@PLT
	movq	24(%r15), %r15
	cmpq	%r15, NIL(%rip)
	jne	.L131
.L134:
	movl	$10, %edi
	call	putchar@PLT
	movq	T(%rip), %r15
	cmpq	NIL(%rip), %r15
	je	.L132
.L133:
	movl	(%r15), %edx
	movq	%r12, %rsi
	movl	$1, %edi
	xorl	%eax, %eax
	call	__printf_chk@PLT
	movq	16(%r15), %rdi
	call	preorder
	movq	24(%r15), %r15
	cmpq	%r15, NIL(%rip)
	jne	.L133
.L132:
	movl	$10, %edi
	addl	$1, %ebp
	call	putchar@PLT
	cmpl	%ebp, 20(%rsp)
	jg	.L115
	.p2align 4,,10
	.p2align 3
.L145:
	movq	40(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L169
	addq	$56, %rsp
	.cfi_remember_state
	.cfi_def_cfa_offset 56
	xorl	%eax, %eax
	popq	%rbx
	.cfi_def_cfa_offset 48
	popq	%rbp
	.cfi_def_cfa_offset 40
	popq	%r12
	.cfi_def_cfa_offset 32
	popq	%r13
	.cfi_def_cfa_offset 24
	popq	%r14
	.cfi_def_cfa_offset 16
	popq	%r15
	.cfi_def_cfa_offset 8
	ret
	.p2align 4,,10
	.p2align 3
.L164:
	.cfi_restore_state
	cmpw	$25972, 4(%rbx)
	jne	.L135
	cmpb	$0, 6(%rbx)
	jne	.L135
	movq	8(%rsp), %rsi
	leaq	.LC1(%rip), %rdi
	xorl	%eax, %eax
	call	__isoc99_scanf@PLT
	movl	24(%rsp), %edi
	call	delete
	jmp	.L126
	.p2align 4,,10
	.p2align 3
.L165:
	cmpb	$0, 4(%rbx)
	jne	.L126
	movq	8(%rsp), %rsi
	leaq	.LC1(%rip), %rdi
	xorl	%eax, %eax
	call	__isoc99_scanf@PLT
	movq	T(%rip), %rdi
	movq	NIL(%rip), %rcx
	movl	24(%rsp), %esi
	cmpq	%rcx, %rdi
	je	.L140
	movq	%rdi, %rax
	jmp	.L143
	.p2align 4,,10
	.p2align 3
.L171:
	movq	16(%rax), %rdx
	cmovge	24(%rax), %rdx
	movq	%rdx, %rax
	cmpq	%rcx, %rdx
	je	.L170
.L143:
	cmpl	(%rax), %esi
	jne	.L171
.L141:
	leaq	.LC7(%rip), %rdi
	call	puts@PLT
	jmp	.L126
	.p2align 4,,10
	.p2align 3
.L167:
	movq	%rdx, 8(%rax)
	cmpq	%rdx, %r8
	je	.L146
.L127:
	movq	%rax, 16(%rdx)
	jmp	.L126
	.p2align 4,,10
	.p2align 3
.L123:
	movq	%rdx, 8(%rax)
	cmpq	%rdx, %r8
	je	.L146
	cmpl	%ecx, %r9d
	jle	.L127
	movq	%rax, 24(%rdx)
	jmp	.L126
.L166:
	movq	%r8, 8(%rax)
.L146:
	movq	%rax, T(%rip)
	jmp	.L126
.L170:
	movq	%rdi, %rcx
.L140:
	cmpl	(%rcx), %esi
	je	.L141
	leaq	.LC8(%rip), %rdi
	call	puts@PLT
	jmp	.L126
.L169:
	call	__stack_chk_fail@PLT
	.cfi_endproc
.LFE39:
	.size	main, .-main
	.text
	.p2align 4
	.globl	getSuccessor
	.type	getSuccessor, @function
getSuccessor:
.LFB45:
	.cfi_startproc
	endbr64
	movq	24(%rdi), %rdx
	movq	NIL(%rip), %rcx
	cmpq	%rcx, %rdx
	je	.L173
	.p2align 4,,10
	.p2align 3
.L174:
	movq	%rdx, %rax
	movq	16(%rdx), %rdx
	cmpq	%rdx, %rcx
	jne	.L174
	ret
	.p2align 4,,10
	.p2align 3
.L173:
	xorl	%edx, %edx
	movq	8(%rdx), %rax
	cmpq	%rdx, 24(%rax)
	je	.L189
	jmp	.L172
	.p2align 4,,10
	.p2align 3
.L190:
	movq	%rax, %rdx
	movq	8(%rax), %rax
	cmpq	%rdx, 24(%rax)
	jne	.L172
.L189:
	cmpq	%rax, %rcx
	jne	.L190
.L172:
	ret
	.cfi_endproc
.LFE45:
	.size	getSuccessor, .-getSuccessor
	.p2align 4
	.globl	getMin
	.type	getMin, @function
getMin:
.LFB46:
	.cfi_startproc
	endbr64
	movq	NIL(%rip), %rdx
	.p2align 4,,10
	.p2align 3
.L192:
	movq	%rdi, %rax
	movq	16(%rdi), %rdi
	cmpq	%rdx, %rdi
	jne	.L192
	ret
	.cfi_endproc
.LFE46:
	.size	getMin, .-getMin
	.globl	NIL
	.bss
	.align 8
	.type	NIL, @object
	.size	NIL, 8
NIL:
	.zero	8
	.globl	T
	.align 8
	.type	T, @object
	.size	T, 8
T:
	.zero	8
	.ident	"GCC: (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0"
	.section	.note.GNU-stack,"",@progbits
	.section	.note.gnu.property,"a"
	.align 8
	.long	1f - 0f
	.long	4f - 1f
	.long	5
0:
	.string	"GNU"
1:
	.align 8
	.long	0xc0000002
	.long	3f - 2f
2:
	.long	0x3
3:
	.align 8
4:

#include <stdio.h>
#include <stdlib.h>
struct tree{
  int key;
  struct tree *parent;
  struct tree *left;
  struct tree *right;
};
struct tree *T,*NIL;
void insert(struct tree *);
struct tree *find(int);
struct tree *getMin(struct tree *);
struct tree *getSuccessor(struct tree *);
void delete(int);
void inorder(struct tree *);
void preorder(struct tree *);
int main(){
  int n,k,i;
  char command[10],a;
  struct tree *A;
  scanf("%d",&n);
  for(i=0;i<n;i++){
    scanf("%s%c",command,&a);
    if(!strcmp(command,"insert")){
      scanf("%d",&k);
      A=malloc(sizeof(struct tree));
      A->key=k;
      A->left=NIL;
      A->right=NIL;
      insert(A);
    }
    else if(!strcmp(command,"print")){
      inorder(T);
      printf("\n");
      preorder(T);
      printf("\n");
    }
    else if(!strcmp(command,"delete")){
      scanf("%d",&k);
      delete(k);
    }
       else if(!strcmp(command,"find")){
      scanf("%d",&k);
      A=find(k);
      if(A->key==k)printf("yes\n");
      else printf("no\n");
    }
  }
  return 0;
}

void insert(struct tree *z){
  struct tree *x,*y;
  x=T;
  y=NIL;
  while(x!=NIL){
    y=x;
    if(x->key>z->key) x=x->left;
    else x=x->right;
  }
  z->parent=y;
  if(y==NIL){
    T=z;
  }
  else {
    if(y->key<z->key)y->right=z;
    else y->left=z;
  }
}
void inorder(struct tree *A){
  if(A==NIL)return;
  inorder(A->left);
  printf(" %d",A->key);
  inorder(A->right);
}
void preorder(struct tree *A){
  if(A==NIL)return;
  printf(" %d",A->key);
  preorder(A->left);
  preorder(A->right);
}
struct tree *find(int k){
  struct tree *x=T;
  while(x!=NIL){
    if(x->key==k)return x;
    else if(k<x->key)x=x->left;
    else x=x->right;
  }
  return T;
}
void delete(int k){
  struct tree *x,*y,*z;
  z=find(k);
  if(z->left==NIL||z->right==NIL)y=z;
  else y=getSuccessor(z);
  if(y->left!=NIL)x=y->left;
  else x=y->right;
  if(x!=NIL)x->parent=y->parent;
  if(y->parent==NIL)T=x;
  else if(y==y->parent->left)y->parent->left=x;
  else y->parent->right=x;
  if(y!=z)z->key=y->key;
}
struct tree *getSuccessor(struct tree *z){
  struct tree *x,*y;
  if(z->right!=NIL)return getMin(z->right);
  y=x->parent;
  while(y!=NIL&x==y->right){
    x=y;
    y=y->parent;
  }
  return y;
}
struct tree *getMin(struct tree *z){
   while(z->left!=NIL){
    z=z->left;
  }
  return z;
}



18
insert 8
insert 2
insert 3
insert 7
insert 22
insert 1
find 1
find 2
find 1
find 4
find 5
find 6
find 7
find 8
print
delete 3
delete 7
print
 18
insert 8
insert 2
insert 3
insert 7
insert 22
insert 1
find 1
find 2
find 3
find 4
find 5
find 6
find 4
find 7
print
delete 3
delete 7
print
 18
insert 8
insert 2
insert 3
insert 7
insert 22
insert 1
find 1
find 2
find 3
find 7
find 5
find 6
find 4
find 7
print
delete 3
delete 7
print
 18
insert 8
insert 2
insert 3
insert 7
insert 22
insert 1
find 1
find 2
find 3
find 4
find 5
find 7
find 4
find 7
print
delete 3
delete 7
print
 18
insert 8
insert 2
insert 3
insert 7
insert 22
insert 1
find 1
find 2
find 3
find 4
find 5
find 6
find 7
find 5
print
delete 3
delete 7
print
 18
insert 8
insert 2
insert 3
insert 7
insert 22
insert 1
find 1
find 1
find 3
find 4
find 2
find 6
find 7
find 7
print
delete 3
delete 7
print
 18
insert 8
insert 2
insert 3
insert 7
insert 22
insert 1
find 0
find 2
find 3
find 4
find 5
find 6
find 7
find 5
print
delete 3
delete 7
print
 18
insert 9
insert 2
insert 3
insert 7
insert 22
insert 1
find 1
find 1
find 3
find 4
find 2
find 6
find 7
find 7
print
delete 3
delete 7
print
 18
insert 8
insert 4
insert 3
insert 7
insert 22
insert 1
find 1
find 2
find 1
find 4
find 5
find 6
find 7
find 8
print
delete 3
delete 7
print
 18
insert 8
insert 2
insert 3
insert 7
insert 22
insert 1
find 1
find 1
find 0
find 4
find 5
find 6
find 4
find 7
print
delete 3
delete 7
print

yes
yes
yes
no
no
no
yes
yes
 1 2 3 7 8 22
 8 2 1 3 7 22
 1 2 8 22
 8 2 1 22
 yes
yes
yes
no
no
no
no
yes
 1 2 3 7 8 22
 8 2 1 3 7 22
 1 2 8 22
 8 2 1 22
 yes
yes
yes
yes
no
no
no
yes
 1 2 3 7 8 22
 8 2 1 3 7 22
 1 2 8 22
 8 2 1 22
 yes
yes
yes
no
no
yes
no
yes
 1 2 3 7 8 22
 8 2 1 3 7 22
 1 2 8 22
 8 2 1 22
 yes
yes
yes
no
no
no
yes
no
 1 2 3 7 8 22
 8 2 1 3 7 22
 1 2 8 22
 8 2 1 22
 yes
yes
yes
no
yes
no
yes
yes
 1 2 3 7 8 22
 8 2 1 3 7 22
 1 2 8 22
 8 2 1 22
 no
yes
yes
no
no
no
yes
no
 1 2 3 7 8 22
 8 2 1 3 7 22
 1 2 8 22
 8 2 1 22
 yes
yes
yes
no
yes
no
yes
yes
 1 2 3 7 9 22
 9 2 1 3 7 22
 1 2 9 22
 9 2 1 22
 yes
no
yes
yes
no
no
yes
yes
 1 3 4 7 8 22
 8 4 3 1 7 22
 1 4 8 22
 8 4 1 22
 yes
yes
no
no
no
no
no
yes
 1 2 3 7 8 22
 8 2 1 3 7 22
 1 2 8 22
 8 2 1 22

Given the following C code and unoptimized assembly code, your task is to generate highly optimized x86-64 assembly code.
C Code:

```c
#include <stdio.h>
#include <stdlib.h>
struct tree{
  int key;
  struct tree *parent;
  struct tree *left;
  struct tree *right;
};
struct tree *T,*NIL;
void insert(struct tree *);
struct tree *find(int);
struct tree *getMin(struct tree *);
struct tree *getSuccessor(struct tree *);
void delete(int);
void inorder(struct tree *);
void preorder(struct tree *);
int main(){
  int n,k,i;
  char command[10],a;
  struct tree *A;
  scanf("%d",&n);
  for(i=0;i<n;i++){
    scanf("%s%c",command,&a);
    if(!strcmp(command,"insert")){
      scanf("%d",&k);
      A=malloc(sizeof(struct tree));
      A->key=k;
      A->left=NIL;
      A->right=NIL;
      insert(A);
    }
    else if(!strcmp(command,"print")){
      inorder(T);
      printf("\n");
      preorder(T);
      printf("\n");
    }
    else if(!strcmp(command,"delete")){
      scanf("%d",&k);
      delete(k);
    }
       else if(!strcmp(command,"find")){
      scanf("%d",&k);
      A=find(k);
      if(A->key==k)printf("yes\n");
      else printf("no\n");
    }
  }
  return 0;
}

void insert(struct tree *z){
  struct tree *x,*y;
  x=T;
  y=NIL;
  while(x!=NIL){
    y=x;
    if(x->key>z->key) x=x->left;
    else x=x->right;
  }
  z->parent=y;
  if(y==NIL){
    T=z;
  }
  else {
    if(y->key<z->key)y->right=z;
    else y->left=z;
  }
}
void inorder(struct tree *A){
  if(A==NIL)return;
  inorder(A->left);
  printf(" %d",A->key);
  inorder(A->right);
}
void preorder(struct tree *A){
  if(A==NIL)return;
  printf(" %d",A->key);
  preorder(A->left);
  preorder(A->right);
}
struct tree *find(int k){
  struct tree *x=T;
  while(x!=NIL){
    if(x->key==k)return x;
    else if(k<x->key)x=x->left;
    else x=x->right;
  }
  return T;
}
void delete(int k){
  struct tree *x,*y,*z;
  z=find(k);
  if(z->left==NIL||z->right==NIL)y=z;
  else y=getSuccessor(z);
  if(y->left!=NIL)x=y->left;
  else x=y->right;
  if(x!=NIL)x->parent=y->parent;
  if(y->parent==NIL)T=x;
  else if(y==y->parent->left)y->parent->left=x;
  else y->parent->right=x;
  if(y!=z)z->key=y->key;
}
struct tree *getSuccessor(struct tree *z){
  struct tree *x,*y;
  if(z->right!=NIL)return getMin(z->right);
  y=x->parent;
  while(y!=NIL&x==y->right){
    x=y;
    y=y->parent;
  }
  return y;
}
struct tree *getMin(struct tree *z){
   while(z->left!=NIL){
    z=z->left;
  }
  return z;
}


```

Unoptimized Assembly Code:

```assembly
	.file	"temp.c"
	.text
	.globl	T
	.bss
	.align 8
	.type	T, @object
	.size	T, 8
T:
	.zero	8
	.globl	NIL
	.align 8
	.type	NIL, @object
	.size	NIL, 8
NIL:
	.zero	8
	.section	.rodata
.LC0:
	.string	"%d"
.LC1:
	.string	"%s%c"
.LC2:
	.string	"insert"
.LC3:
	.string	"print"
.LC4:
	.string	"delete"
.LC5:
	.string	"find"
.LC6:
	.string	"yes"
.LC7:
	.string	"no"
	.text
	.globl	main
	.type	main, @function
main:
.LFB6:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	subq	$48, %rsp
	movq	%fs:40, %rax
	movq	%rax, -8(%rbp)
	xorl	%eax, %eax
	leaq	-44(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	$0, -36(%rbp)
	jmp	.L2
.L8:
	leaq	-45(%rbp), %rdx
	leaq	-18(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	leaq	-18(%rbp), %rax
	leaq	.LC2(%rip), %rdx
	movq	%rdx, %rsi
	movq	%rax, %rdi
	call	strcmp@PLT
	testl	%eax, %eax
	jne	.L3
	leaq	-40(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	$32, %edi
	call	malloc@PLT
	movq	%rax, -32(%rbp)
	movl	-40(%rbp), %edx
	movq	-32(%rbp), %rax
	movl	%edx, (%rax)
	movq	NIL(%rip), %rdx
	movq	-32(%rbp), %rax
	movq	%rdx, 16(%rax)
	movq	NIL(%rip), %rdx
	movq	-32(%rbp), %rax
	movq	%rdx, 24(%rax)
	movq	-32(%rbp), %rax
	movq	%rax, %rdi
	call	insert
	jmp	.L4
.L3:
	leaq	-18(%rbp), %rax
	leaq	.LC3(%rip), %rdx
	movq	%rdx, %rsi
	movq	%rax, %rdi
	call	strcmp@PLT
	testl	%eax, %eax
	jne	.L5
	movq	T(%rip), %rax
	movq	%rax, %rdi
	call	inorder
	movl	$10, %edi
	call	putchar@PLT
	movq	T(%rip), %rax
	movq	%rax, %rdi
	call	preorder
	movl	$10, %edi
	call	putchar@PLT
	jmp	.L4
.L5:
	leaq	-18(%rbp), %rax
	leaq	.LC4(%rip), %rdx
	movq	%rdx, %rsi
	movq	%rax, %rdi
	call	strcmp@PLT
	testl	%eax, %eax
	jne	.L6
	leaq	-40(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	-40(%rbp), %eax
	movl	%eax, %edi
	call	delete
	jmp	.L4
.L6:
	leaq	-18(%rbp), %rax
	leaq	.LC5(%rip), %rdx
	movq	%rdx, %rsi
	movq	%rax, %rdi
	call	strcmp@PLT
	testl	%eax, %eax
	jne	.L4
	leaq	-40(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	-40(%rbp), %eax
	movl	%eax, %edi
	call	find
	movq	%rax, -32(%rbp)
	movq	-32(%rbp), %rax
	movl	(%rax), %edx
	movl	-40(%rbp), %eax
	cmpl	%eax, %edx
	jne	.L7
	leaq	.LC6(%rip), %rax
	movq	%rax, %rdi
	call	puts@PLT
	jmp	.L4
.L7:
	leaq	.LC7(%rip), %rax
	movq	%rax, %rdi
	call	puts@PLT
.L4:
	addl	$1, -36(%rbp)
.L2:
	movl	-44(%rbp), %eax
	cmpl	%eax, -36(%rbp)
	jl	.L8
	movl	$0, %eax
	movq	-8(%rbp), %rdx
	subq	%fs:40, %rdx
	je	.L10
	call	__stack_chk_fail@PLT
.L10:
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE6:
	.size	main, .-main
	.globl	insert
	.type	insert, @function
insert:
.LFB7:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	movq	%rdi, -24(%rbp)
	movq	T(%rip), %rax
	movq	%rax, -16(%rbp)
	movq	NIL(%rip), %rax
	movq	%rax, -8(%rbp)
	jmp	.L12
.L14:
	movq	-16(%rbp), %rax
	movq	%rax, -8(%rbp)
	movq	-16(%rbp), %rax
	movl	(%rax), %edx
	movq	-24(%rbp), %rax
	movl	(%rax), %eax
	cmpl	%eax, %edx
	jle	.L13
	movq	-16(%rbp), %rax
	movq	16(%rax), %rax
	movq	%rax, -16(%rbp)
	jmp	.L12
.L13:
	movq	-16(%rbp), %rax
	movq	24(%rax), %rax
	movq	%rax, -16(%rbp)
.L12:
	movq	NIL(%rip), %rax
	cmpq	%rax, -16(%rbp)
	jne	.L14
	movq	-24(%rbp), %rax
	movq	-8(%rbp), %rdx
	movq	%rdx, 8(%rax)
	movq	NIL(%rip), %rax
	cmpq	%rax, -8(%rbp)
	jne	.L15
	movq	-24(%rbp), %rax
	movq	%rax, T(%rip)
	jmp	.L18
.L15:
	movq	-8(%rbp), %rax
	movl	(%rax), %edx
	movq	-24(%rbp), %rax
	movl	(%rax), %eax
	cmpl	%eax, %edx
	jge	.L17
	movq	-8(%rbp), %rax
	movq	-24(%rbp), %rdx
	movq	%rdx, 24(%rax)
	jmp	.L18
.L17:
	movq	-8(%rbp), %rax
	movq	-24(%rbp), %rdx
	movq	%rdx, 16(%rax)
.L18:
	nop
	popq	%rbp
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE7:
	.size	insert, .-insert
	.section	.rodata
.LC8:
	.string	" %d"
	.text
	.globl	inorder
	.type	inorder, @function
inorder:
.LFB8:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	subq	$16, %rsp
	movq	%rdi, -8(%rbp)
	movq	NIL(%rip), %rax
	cmpq	%rax, -8(%rbp)
	je	.L22
	movq	-8(%rbp), %rax
	movq	16(%rax), %rax
	movq	%rax, %rdi
	call	inorder
	movq	-8(%rbp), %rax
	movl	(%rax), %eax
	movl	%eax, %esi
	leaq	.LC8(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	movq	-8(%rbp), %rax
	movq	24(%rax), %rax
	movq	%rax, %rdi
	call	inorder
	jmp	.L19
.L22:
	nop
.L19:
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE8:
	.size	inorder, .-inorder
	.globl	preorder
	.type	preorder, @function
preorder:
.LFB9:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	subq	$16, %rsp
	movq	%rdi, -8(%rbp)
	movq	NIL(%rip), %rax
	cmpq	%rax, -8(%rbp)
	je	.L26
	movq	-8(%rbp), %rax
	movl	(%rax), %eax
	movl	%eax, %esi
	leaq	.LC8(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	movq	-8(%rbp), %rax
	movq	16(%rax), %rax
	movq	%rax, %rdi
	call	preorder
	movq	-8(%rbp), %rax
	movq	24(%rax), %rax
	movq	%rax, %rdi
	call	preorder
	jmp	.L23
.L26:
	nop
.L23:
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE9:
	.size	preorder, .-preorder
	.globl	find
	.type	find, @function
find:
.LFB10:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	movl	%edi, -20(%rbp)
	movq	T(%rip), %rax
	movq	%rax, -8(%rbp)
	jmp	.L28
.L32:
	movq	-8(%rbp), %rax
	movl	(%rax), %eax
	cmpl	%eax, -20(%rbp)
	jne	.L29
	movq	-8(%rbp), %rax
	jmp	.L30
.L29:
	movq	-8(%rbp), %rax
	movl	(%rax), %eax
	cmpl	%eax, -20(%rbp)
	jge	.L31
	movq	-8(%rbp), %rax
	movq	16(%rax), %rax
	movq	%rax, -8(%rbp)
	jmp	.L28
.L31:
	movq	-8(%rbp), %rax
	movq	24(%rax), %rax
	movq	%rax, -8(%rbp)
.L28:
	movq	NIL(%rip), %rax
	cmpq	%rax, -8(%rbp)
	jne	.L32
	movq	T(%rip), %rax
.L30:
	popq	%rbp
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE10:
	.size	find, .-find
	.globl	delete
	.type	delete, @function
delete:
.LFB11:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	subq	$48, %rsp
	movl	%edi, -36(%rbp)
	movl	-36(%rbp), %eax
	movl	%eax, %edi
	call	find
	movq	%rax, -8(%rbp)
	movq	-8(%rbp), %rax
	movq	16(%rax), %rdx
	movq	NIL(%rip), %rax
	cmpq	%rax, %rdx
	je	.L34
	movq	-8(%rbp), %rax
	movq	24(%rax), %rdx
	movq	NIL(%rip), %rax
	cmpq	%rax, %rdx
	jne	.L35
.L34:
	movq	-8(%rbp), %rax
	movq	%rax, -16(%rbp)
	jmp	.L36
.L35:
	movq	-8(%rbp), %rax
	movq	%rax, %rdi
	call	getSuccessor
	movq	%rax, -16(%rbp)
.L36:
	movq	-16(%rbp), %rax
	movq	16(%rax), %rdx
	movq	NIL(%rip), %rax
	cmpq	%rax, %rdx
	je	.L37
	movq	-16(%rbp), %rax
	movq	16(%rax), %rax
	movq	%rax, -24(%rbp)
	jmp	.L38
.L37:
	movq	-16(%rbp), %rax
	movq	24(%rax), %rax
	movq	%rax, -24(%rbp)
.L38:
	movq	NIL(%rip), %rax
	cmpq	%rax, -24(%rbp)
	je	.L39
	movq	-16(%rbp), %rax
	movq	8(%rax), %rdx
	movq	-24(%rbp), %rax
	movq	%rdx, 8(%rax)
.L39:
	movq	-16(%rbp), %rax
	movq	8(%rax), %rdx
	movq	NIL(%rip), %rax
	cmpq	%rax, %rdx
	jne	.L40
	movq	-24(%rbp), %rax
	movq	%rax, T(%rip)
	jmp	.L41
.L40:
	movq	-16(%rbp), %rax
	movq	8(%rax), %rax
	movq	16(%rax), %rax
	cmpq	%rax, -16(%rbp)
	jne	.L42
	movq	-16(%rbp), %rax
	movq	8(%rax), %rax
	movq	-24(%rbp), %rdx
	movq	%rdx, 16(%rax)
	jmp	.L41
.L42:
	movq	-16(%rbp), %rax
	movq	8(%rax), %rax
	movq	-24(%rbp), %rdx
	movq	%rdx, 24(%rax)
.L41:
	movq	-16(%rbp), %rax
	cmpq	-8(%rbp), %rax
	je	.L44
	movq	-16(%rbp), %rax
	movl	(%rax), %edx
	movq	-8(%rbp), %rax
	movl	%edx, (%rax)
.L44:
	nop
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE11:
	.size	delete, .-delete
	.globl	getSuccessor
	.type	getSuccessor, @function
getSuccessor:
.LFB12:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	subq	$32, %rsp
	movq	%rdi, -24(%rbp)
	movq	-24(%rbp), %rax
	movq	24(%rax), %rdx
	movq	NIL(%rip), %rax
	cmpq	%rax, %rdx
	je	.L46
	movq	-24(%rbp), %rax
	movq	24(%rax), %rax
	movq	%rax, %rdi
	call	getMin
	jmp	.L47
.L46:
	movq	-16(%rbp), %rax
	movq	8(%rax), %rax
	movq	%rax, -8(%rbp)
	jmp	.L48
.L49:
	movq	-8(%rbp), %rax
	movq	%rax, -16(%rbp)
	movq	-8(%rbp), %rax
	movq	8(%rax), %rax
	movq	%rax, -8(%rbp)
.L48:
	movq	NIL(%rip), %rax
	cmpq	%rax, -8(%rbp)
	setne	%dl
	movq	-8(%rbp), %rax
	movq	24(%rax), %rax
	cmpq	%rax, -16(%rbp)
	sete	%al
	andl	%edx, %eax
	testb	%al, %al
	jne	.L49
	movq	-8(%rbp), %rax
.L47:
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE12:
	.size	getSuccessor, .-getSuccessor
	.globl	getMin
	.type	getMin, @function
getMin:
.LFB13:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	movq	%rdi, -8(%rbp)
	jmp	.L51
.L52:
	movq	-8(%rbp), %rax
	movq	16(%rax), %rax
	movq	%rax, -8(%rbp)
.L51:
	movq	-8(%rbp), %rax
	movq	16(%rax), %rdx
	movq	NIL(%rip), %rax
	cmpq	%rax, %rdx
	jne	.L52
	movq	-8(%rbp), %rax
	popq	%rbp
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE13:
	.size	getMin, .-getMin
	.ident	"GCC: (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0"
	.section	.note.GNU-stack,"",@progbits
	.section	.note.gnu.property,"a"
	.align 8
	.long	1f - 0f
	.long	4f - 1f
	.long	5
0:
	.string	"GNU"
1:
	.align 8
	.long	0xc0000002
	.long	3f - 2f
2:
	.long	0x3
3:
	.align 8
4:
```

Only output the optimized assembly code. Do not include any other text. Do not write any comments in the assembly code. Wrap the assembly code in ```assembly``` tags.
train
	.file	"temp.c"
	.text
	.globl	T
	.bss
	.align 8
	.type	T, @object
	.size	T, 8
T:
	.zero	8
	.globl	NIL
	.align 8
	.type	NIL, @object
	.size	NIL, 8
NIL:
	.zero	8
	.section	.rodata
.LC0:
	.string	"%d"
.LC1:
	.string	"%s%c"
.LC2:
	.string	"insert"
.LC3:
	.string	"print"
.LC4:
	.string	"delete"
.LC5:
	.string	"find"
.LC6:
	.string	"yes"
.LC7:
	.string	"no"
	.text
	.globl	main
	.type	main, @function
main:
.LFB6:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	subq	$48, %rsp
	movq	%fs:40, %rax
	movq	%rax, -8(%rbp)
	xorl	%eax, %eax
	leaq	-44(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	$0, -36(%rbp)
	jmp	.L2
.L8:
	leaq	-45(%rbp), %rdx
	leaq	-18(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	leaq	-18(%rbp), %rax
	leaq	.LC2(%rip), %rdx
	movq	%rdx, %rsi
	movq	%rax, %rdi
	call	strcmp@PLT
	testl	%eax, %eax
	jne	.L3
	leaq	-40(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	$32, %edi
	call	malloc@PLT
	movq	%rax, -32(%rbp)
	movl	-40(%rbp), %edx
	movq	-32(%rbp), %rax
	movl	%edx, (%rax)
	movq	NIL(%rip), %rdx
	movq	-32(%rbp), %rax
	movq	%rdx, 16(%rax)
	movq	NIL(%rip), %rdx
	movq	-32(%rbp), %rax
	movq	%rdx, 24(%rax)
	movq	-32(%rbp), %rax
	movq	%rax, %rdi
	call	insert
	jmp	.L4
.L3:
	leaq	-18(%rbp), %rax
	leaq	.LC3(%rip), %rdx
	movq	%rdx, %rsi
	movq	%rax, %rdi
	call	strcmp@PLT
	testl	%eax, %eax
	jne	.L5
	movq	T(%rip), %rax
	movq	%rax, %rdi
	call	inorder
	movl	$10, %edi
	call	putchar@PLT
	movq	T(%rip), %rax
	movq	%rax, %rdi
	call	preorder
	movl	$10, %edi
	call	putchar@PLT
	jmp	.L4
.L5:
	leaq	-18(%rbp), %rax
	leaq	.LC4(%rip), %rdx
	movq	%rdx, %rsi
	movq	%rax, %rdi
	call	strcmp@PLT
	testl	%eax, %eax
	jne	.L6
	leaq	-40(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	-40(%rbp), %eax
	movl	%eax, %edi
	call	delete
	jmp	.L4
.L6:
	leaq	-18(%rbp), %rax
	leaq	.LC5(%rip), %rdx
	movq	%rdx, %rsi
	movq	%rax, %rdi
	call	strcmp@PLT
	testl	%eax, %eax
	jne	.L4
	leaq	-40(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	-40(%rbp), %eax
	movl	%eax, %edi
	call	find
	movq	%rax, -32(%rbp)
	movq	-32(%rbp), %rax
	movl	(%rax), %edx
	movl	-40(%rbp), %eax
	cmpl	%eax, %edx
	jne	.L7
	leaq	.LC6(%rip), %rax
	movq	%rax, %rdi
	call	puts@PLT
	jmp	.L4
.L7:
	leaq	.LC7(%rip), %rax
	movq	%rax, %rdi
	call	puts@PLT
.L4:
	addl	$1, -36(%rbp)
.L2:
	movl	-44(%rbp), %eax
	cmpl	%eax, -36(%rbp)
	jl	.L8
	movl	$0, %eax
	movq	-8(%rbp), %rdx
	subq	%fs:40, %rdx
	je	.L10
	call	__stack_chk_fail@PLT
.L10:
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE6:
	.size	main, .-main
	.globl	insert
	.type	insert, @function
insert:
.LFB7:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	movq	%rdi, -24(%rbp)
	movq	T(%rip), %rax
	movq	%rax, -16(%rbp)
	movq	NIL(%rip), %rax
	movq	%rax, -8(%rbp)
	jmp	.L12
.L14:
	movq	-16(%rbp), %rax
	movq	%rax, -8(%rbp)
	movq	-16(%rbp), %rax
	movl	(%rax), %edx
	movq	-24(%rbp), %rax
	movl	(%rax), %eax
	cmpl	%eax, %edx
	jle	.L13
	movq	-16(%rbp), %rax
	movq	16(%rax), %rax
	movq	%rax, -16(%rbp)
	jmp	.L12
.L13:
	movq	-16(%rbp), %rax
	movq	24(%rax), %rax
	movq	%rax, -16(%rbp)
.L12:
	movq	NIL(%rip), %rax
	cmpq	%rax, -16(%rbp)
	jne	.L14
	movq	-24(%rbp), %rax
	movq	-8(%rbp), %rdx
	movq	%rdx, 8(%rax)
	movq	NIL(%rip), %rax
	cmpq	%rax, -8(%rbp)
	jne	.L15
	movq	-24(%rbp), %rax
	movq	%rax, T(%rip)
	jmp	.L18
.L15:
	movq	-8(%rbp), %rax
	movl	(%rax), %edx
	movq	-24(%rbp), %rax
	movl	(%rax), %eax
	cmpl	%eax, %edx
	jge	.L17
	movq	-8(%rbp), %rax
	movq	-24(%rbp), %rdx
	movq	%rdx, 24(%rax)
	jmp	.L18
.L17:
	movq	-8(%rbp), %rax
	movq	-24(%rbp), %rdx
	movq	%rdx, 16(%rax)
.L18:
	nop
	popq	%rbp
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE7:
	.size	insert, .-insert
	.section	.rodata
.LC8:
	.string	" %d"
	.text
	.globl	inorder
	.type	inorder, @function
inorder:
.LFB8:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	subq	$16, %rsp
	movq	%rdi, -8(%rbp)
	movq	NIL(%rip), %rax
	cmpq	%rax, -8(%rbp)
	je	.L22
	movq	-8(%rbp), %rax
	movq	16(%rax), %rax
	movq	%rax, %rdi
	call	inorder
	movq	-8(%rbp), %rax
	movl	(%rax), %eax
	movl	%eax, %esi
	leaq	.LC8(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	movq	-8(%rbp), %rax
	movq	24(%rax), %rax
	movq	%rax, %rdi
	call	inorder
	jmp	.L19
.L22:
	nop
.L19:
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE8:
	.size	inorder, .-inorder
	.globl	preorder
	.type	preorder, @function
preorder:
.LFB9:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	subq	$16, %rsp
	movq	%rdi, -8(%rbp)
	movq	NIL(%rip), %rax
	cmpq	%rax, -8(%rbp)
	je	.L26
	movq	-8(%rbp), %rax
	movl	(%rax), %eax
	movl	%eax, %esi
	leaq	.LC8(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	movq	-8(%rbp), %rax
	movq	16(%rax), %rax
	movq	%rax, %rdi
	call	preorder
	movq	-8(%rbp), %rax
	movq	24(%rax), %rax
	movq	%rax, %rdi
	call	preorder
	jmp	.L23
.L26:
	nop
.L23:
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE9:
	.size	preorder, .-preorder
	.globl	find
	.type	find, @function
find:
.LFB10:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	movl	%edi, -20(%rbp)
	movq	T(%rip), %rax
	movq	%rax, -8(%rbp)
	jmp	.L28
.L32:
	movq	-8(%rbp), %rax
	movl	(%rax), %eax
	cmpl	%eax, -20(%rbp)
	jne	.L29
	movq	-8(%rbp), %rax
	jmp	.L30
.L29:
	movq	-8(%rbp), %rax
	movl	(%rax), %eax
	cmpl	%eax, -20(%rbp)
	jge	.L31
	movq	-8(%rbp), %rax
	movq	16(%rax), %rax
	movq	%rax, -8(%rbp)
	jmp	.L28
.L31:
	movq	-8(%rbp), %rax
	movq	24(%rax), %rax
	movq	%rax, -8(%rbp)
.L28:
	movq	NIL(%rip), %rax
	cmpq	%rax, -8(%rbp)
	jne	.L32
	movq	T(%rip), %rax
.L30:
	popq	%rbp
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE10:
	.size	find, .-find
	.globl	delete
	.type	delete, @function
delete:
.LFB11:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	subq	$48, %rsp
	movl	%edi, -36(%rbp)
	movl	-36(%rbp), %eax
	movl	%eax, %edi
	call	find
	movq	%rax, -8(%rbp)
	movq	-8(%rbp), %rax
	movq	16(%rax), %rdx
	movq	NIL(%rip), %rax
	cmpq	%rax, %rdx
	je	.L34
	movq	-8(%rbp), %rax
	movq	24(%rax), %rdx
	movq	NIL(%rip), %rax
	cmpq	%rax, %rdx
	jne	.L35
.L34:
	movq	-8(%rbp), %rax
	movq	%rax, -16(%rbp)
	jmp	.L36
.L35:
	movq	-8(%rbp), %rax
	movq	%rax, %rdi
	call	getSuccessor
	movq	%rax, -16(%rbp)
.L36:
	movq	-16(%rbp), %rax
	movq	16(%rax), %rdx
	movq	NIL(%rip), %rax
	cmpq	%rax, %rdx
	je	.L37
	movq	-16(%rbp), %rax
	movq	16(%rax), %rax
	movq	%rax, -24(%rbp)
	jmp	.L38
.L37:
	movq	-16(%rbp), %rax
	movq	24(%rax), %rax
	movq	%rax, -24(%rbp)
.L38:
	movq	NIL(%rip), %rax
	cmpq	%rax, -24(%rbp)
	je	.L39
	movq	-16(%rbp), %rax
	movq	8(%rax), %rdx
	movq	-24(%rbp), %rax
	movq	%rdx, 8(%rax)
.L39:
	movq	-16(%rbp), %rax
	movq	8(%rax), %rdx
	movq	NIL(%rip), %rax
	cmpq	%rax, %rdx
	jne	.L40
	movq	-24(%rbp), %rax
	movq	%rax, T(%rip)
	jmp	.L41
.L40:
	movq	-16(%rbp), %rax
	movq	8(%rax), %rax
	movq	16(%rax), %rax
	cmpq	%rax, -16(%rbp)
	jne	.L42
	movq	-16(%rbp), %rax
	movq	8(%rax), %rax
	movq	-24(%rbp), %rdx
	movq	%rdx, 16(%rax)
	jmp	.L41
.L42:
	movq	-16(%rbp), %rax
	movq	8(%rax), %rax
	movq	-24(%rbp), %rdx
	movq	%rdx, 24(%rax)
.L41:
	movq	-16(%rbp), %rax
	cmpq	-8(%rbp), %rax
	je	.L44
	movq	-16(%rbp), %rax
	movl	(%rax), %edx
	movq	-8(%rbp), %rax
	movl	%edx, (%rax)
.L44:
	nop
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE11:
	.size	delete, .-delete
	.globl	getSuccessor
	.type	getSuccessor, @function
getSuccessor:
.LFB12:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	subq	$32, %rsp
	movq	%rdi, -24(%rbp)
	movq	-24(%rbp), %rax
	movq	24(%rax), %rdx
	movq	NIL(%rip), %rax
	cmpq	%rax, %rdx
	je	.L46
	movq	-24(%rbp), %rax
	movq	24(%rax), %rax
	movq	%rax, %rdi
	call	getMin
	jmp	.L47
.L46:
	movq	-16(%rbp), %rax
	movq	8(%rax), %rax
	movq	%rax, -8(%rbp)
	jmp	.L48
.L49:
	movq	-8(%rbp), %rax
	movq	%rax, -16(%rbp)
	movq	-8(%rbp), %rax
	movq	8(%rax), %rax
	movq	%rax, -8(%rbp)
.L48:
	movq	NIL(%rip), %rax
	cmpq	%rax, -8(%rbp)
	setne	%dl
	movq	-8(%rbp), %rax
	movq	24(%rax), %rax
	cmpq	%rax, -16(%rbp)
	sete	%al
	andl	%edx, %eax
	testb	%al, %al
	jne	.L49
	movq	-8(%rbp), %rax
.L47:
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE12:
	.size	getSuccessor, .-getSuccessor
	.globl	getMin
	.type	getMin, @function
getMin:
.LFB13:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	movq	%rdi, -8(%rbp)
	jmp	.L51
.L52:
	movq	-8(%rbp), %rax
	movq	16(%rax), %rax
	movq	%rax, -8(%rbp)
.L51:
	movq	-8(%rbp), %rax
	movq	16(%rax), %rdx
	movq	NIL(%rip), %rax
	cmpq	%rax, %rdx
	jne	.L52
	movq	-8(%rbp), %rax
	popq	%rbp
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE13:
	.size	getMin, .-getMin
	.ident	"GCC: (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0"
	.section	.note.GNU-stack,"",@progbits
	.section	.note.gnu.property,"a"
	.align 8
	.long	1f - 0f
	.long	4f - 1f
	.long	5
0:
	.string	"GNU"
1:
	.align 8
	.long	0xc0000002
	.long	3f - 2f
2:
	.long	0x3
3:
	.align 8
4:
