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>
#define NUM 2000000
void insert(int);
int extract();
void maxHeapify(int);
void heapIncreaseKey(int,int);

int a[NUM],heapsize=0;

int main(){
  char c[10];
  int n,max;
  while(1){
    scanf("%s",c);
    if(c[0]=='i'){
      scanf("%d",&n);
      insert(n);
    }else{
      if(c[1]=='x'){
	max=extract();
	printf("%d\n",max);
      }else{
	break;
      }
    }
  }
  return 0;
}

void insert(int n){
  heapsize++;
  a[heapsize]=-1;
  heapIncreaseKey(heapsize,n);
}

int extract(){
  int max;
  if(heapsize<1){
    return -1;
  }
  max=a[1];
  a[1]=a[heapsize];
  heapsize--;
  maxHeapify(1);
  return max;
}

void maxHeapify(int i){
  int l,r,largest,a1;
  l=2*i;
  r=2*i+1;
  if(l<=heapsize&&a[l]>a[i]){
    largest=l;
  }else{
    largest=i;
  }
  if(r<=heapsize&&a[r]>a[largest]){
    largest=r;
  }
  if(largest!=i){
    a1=a[i];
    a[i]=a[largest];
    a[largest]=a1;
    maxHeapify(largest);
  }
}

void heapIncreaseKey(int i,int n){
  int a1;
  if(n<a[i]){
    return;
  }
  a[i]=n;
  while(i>1&&a[i/2]<a[i]){
    a1=a[i];
    a[i]=a[i/2];
    a[i/2]=a1;
    i=i/2;
  }
}

```

Unoptimized Assembly Code:

```assembly
	.file	"temp.c"
	.text
	.globl	a
	.bss
	.align 32
	.type	a, @object
	.size	a, 8000000
a:
	.zero	8000000
	.globl	heapsize
	.align 4
	.type	heapsize, @object
	.size	heapsize, 4
heapsize:
	.zero	4
	.section	.rodata
.LC0:
	.string	"%s"
.LC1:
	.string	"%d"
.LC2:
	.string	"%d\n"
	.text
	.globl	main
	.type	main, @function
main:
.LFB0:
	.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	%fs:40, %rax
	movq	%rax, -8(%rbp)
	xorl	%eax, %eax
.L6:
	leaq	-18(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movzbl	-18(%rbp), %eax
	cmpb	$105, %al
	jne	.L2
	leaq	-28(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	-28(%rbp), %eax
	movl	%eax, %edi
	call	insert
	jmp	.L6
.L2:
	movzbl	-17(%rbp), %eax
	cmpb	$120, %al
	jne	.L9
	movl	$0, %eax
	call	extract
	movl	%eax, -24(%rbp)
	movl	-24(%rbp), %eax
	movl	%eax, %esi
	leaq	.LC2(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	jmp	.L6
.L9:
	nop
	movl	$0, %eax
	movq	-8(%rbp), %rdx
	subq	%fs:40, %rdx
	je	.L8
	call	__stack_chk_fail@PLT
.L8:
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE0:
	.size	main, .-main
	.globl	insert
	.type	insert, @function
insert:
.LFB1:
	.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
	movl	%edi, -4(%rbp)
	movl	heapsize(%rip), %eax
	addl	$1, %eax
	movl	%eax, heapsize(%rip)
	movl	heapsize(%rip), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	a(%rip), %rax
	movl	$-1, (%rdx,%rax)
	movl	heapsize(%rip), %eax
	movl	-4(%rbp), %edx
	movl	%edx, %esi
	movl	%eax, %edi
	call	heapIncreaseKey
	nop
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE1:
	.size	insert, .-insert
	.globl	extract
	.type	extract, @function
extract:
.LFB2:
	.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
	movl	heapsize(%rip), %eax
	testl	%eax, %eax
	jg	.L12
	movl	$-1, %eax
	jmp	.L13
.L12:
	movl	4+a(%rip), %eax
	movl	%eax, -4(%rbp)
	movl	heapsize(%rip), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	a(%rip), %rax
	movl	(%rdx,%rax), %eax
	movl	%eax, 4+a(%rip)
	movl	heapsize(%rip), %eax
	subl	$1, %eax
	movl	%eax, heapsize(%rip)
	movl	$1, %edi
	call	maxHeapify
	movl	-4(%rbp), %eax
.L13:
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE2:
	.size	extract, .-extract
	.globl	maxHeapify
	.type	maxHeapify, @function
maxHeapify:
.LFB3:
	.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
	movl	%edi, -20(%rbp)
	movl	-20(%rbp), %eax
	addl	%eax, %eax
	movl	%eax, -12(%rbp)
	movl	-20(%rbp), %eax
	addl	%eax, %eax
	addl	$1, %eax
	movl	%eax, -8(%rbp)
	movl	heapsize(%rip), %eax
	cmpl	%eax, -12(%rbp)
	jg	.L15
	movl	-12(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	a(%rip), %rax
	movl	(%rdx,%rax), %edx
	movl	-20(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rcx
	leaq	a(%rip), %rax
	movl	(%rcx,%rax), %eax
	cmpl	%eax, %edx
	jle	.L15
	movl	-12(%rbp), %eax
	movl	%eax, -16(%rbp)
	jmp	.L16
.L15:
	movl	-20(%rbp), %eax
	movl	%eax, -16(%rbp)
.L16:
	movl	heapsize(%rip), %eax
	cmpl	%eax, -8(%rbp)
	jg	.L17
	movl	-8(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	a(%rip), %rax
	movl	(%rdx,%rax), %edx
	movl	-16(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rcx
	leaq	a(%rip), %rax
	movl	(%rcx,%rax), %eax
	cmpl	%eax, %edx
	jle	.L17
	movl	-8(%rbp), %eax
	movl	%eax, -16(%rbp)
.L17:
	movl	-16(%rbp), %eax
	cmpl	-20(%rbp), %eax
	je	.L19
	movl	-20(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	a(%rip), %rax
	movl	(%rdx,%rax), %eax
	movl	%eax, -4(%rbp)
	movl	-16(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	a(%rip), %rax
	movl	(%rdx,%rax), %eax
	movl	-20(%rbp), %edx
	movslq	%edx, %rdx
	leaq	0(,%rdx,4), %rcx
	leaq	a(%rip), %rdx
	movl	%eax, (%rcx,%rdx)
	movl	-16(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rcx
	leaq	a(%rip), %rdx
	movl	-4(%rbp), %eax
	movl	%eax, (%rcx,%rdx)
	movl	-16(%rbp), %eax
	movl	%eax, %edi
	call	maxHeapify
.L19:
	nop
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE3:
	.size	maxHeapify, .-maxHeapify
	.globl	heapIncreaseKey
	.type	heapIncreaseKey, @function
heapIncreaseKey:
.LFB4:
	.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)
	movl	%esi, -24(%rbp)
	movl	-20(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	a(%rip), %rax
	movl	(%rdx,%rax), %eax
	cmpl	%eax, -24(%rbp)
	jl	.L25
	movl	-20(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rcx
	leaq	a(%rip), %rdx
	movl	-24(%rbp), %eax
	movl	%eax, (%rcx,%rdx)
	jmp	.L23
.L24:
	movl	-20(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	a(%rip), %rax
	movl	(%rdx,%rax), %eax
	movl	%eax, -4(%rbp)
	movl	-20(%rbp), %eax
	movl	%eax, %edx
	shrl	$31, %edx
	addl	%edx, %eax
	sarl	%eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	a(%rip), %rax
	movl	(%rdx,%rax), %eax
	movl	-20(%rbp), %edx
	movslq	%edx, %rdx
	leaq	0(,%rdx,4), %rcx
	leaq	a(%rip), %rdx
	movl	%eax, (%rcx,%rdx)
	movl	-20(%rbp), %eax
	movl	%eax, %edx
	shrl	$31, %edx
	addl	%edx, %eax
	sarl	%eax
	cltq
	leaq	0(,%rax,4), %rcx
	leaq	a(%rip), %rdx
	movl	-4(%rbp), %eax
	movl	%eax, (%rcx,%rdx)
	movl	-20(%rbp), %eax
	movl	%eax, %edx
	shrl	$31, %edx
	addl	%edx, %eax
	sarl	%eax
	movl	%eax, -20(%rbp)
.L23:
	cmpl	$1, -20(%rbp)
	jle	.L20
	movl	-20(%rbp), %eax
	movl	%eax, %edx
	shrl	$31, %edx
	addl	%edx, %eax
	sarl	%eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	a(%rip), %rax
	movl	(%rdx,%rax), %edx
	movl	-20(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rcx
	leaq	a(%rip), %rax
	movl	(%rcx,%rax), %eax
	cmpl	%eax, %edx
	jl	.L24
	jmp	.L20
.L25:
	nop
.L20:
	popq	%rbp
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE4:
	.size	heapIncreaseKey, .-heapIncreaseKey
	.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
	.section	.rodata.str1.1,"aMS",@progbits,1
.LC0:
	.string	"%s"
.LC1:
	.string	"%d"
.LC2:
	.string	"%d\n"
	.section	.text.startup,"ax",@progbits
	.p2align 4
	.globl	main
	.type	main, @function
main:
.LFB23:
	.cfi_startproc
	endbr64
	pushq	%r14
	.cfi_def_cfa_offset 16
	.cfi_offset 14, -16
	leaq	a(%rip), %r14
	pushq	%r13
	.cfi_def_cfa_offset 24
	.cfi_offset 13, -24
	leaq	.LC1(%rip), %r13
	pushq	%r12
	.cfi_def_cfa_offset 32
	.cfi_offset 12, -32
	leaq	.LC2(%rip), %r12
	pushq	%rbp
	.cfi_def_cfa_offset 40
	.cfi_offset 6, -40
	pushq	%rbx
	.cfi_def_cfa_offset 48
	.cfi_offset 3, -48
	leaq	.LC0(%rip), %rbx
	subq	$32, %rsp
	.cfi_def_cfa_offset 80
	movq	%fs:40, %rax
	movq	%rax, 24(%rsp)
	xorl	%eax, %eax
	leaq	14(%rsp), %rbp
	.p2align 4,,10
	.p2align 3
.L2:
	xorl	%eax, %eax
	movq	%rbp, %rsi
	movq	%rbx, %rdi
	call	__isoc99_scanf@PLT
	cmpb	$105, 14(%rsp)
	je	.L25
	cmpb	$120, 15(%rsp)
	jne	.L8
	movl	heapsize(%rip), %edi
	testl	%edi, %edi
	jle	.L15
	movslq	%edi, %rax
	subl	$1, %edi
	movl	4+a(%rip), %r9d
	movl	(%r14,%rax,4), %r8d
	movl	$1, %eax
	movl	%edi, heapsize(%rip)
	leal	(%rax,%rax), %edx
	movl	%r8d, 4+a(%rip)
	leal	1(%rdx), %esi
	cmpl	%edx, %edi
	jl	.L10
	.p2align 4,,10
	.p2align 3
.L27:
	movslq	%edx, %rcx
	movl	(%r14,%rcx,4), %ecx
	cmpl	%ecx, %r8d
	jge	.L10
	cmpl	%esi, %edi
	jge	.L26
.L16:
	movl	%edx, %esi
.L11:
	cmpl	%esi, %eax
	je	.L9
	movl	%ecx, (%r14,%rax,4)
	movslq	%esi, %rax
	movl	%r8d, (%r14,%rax,4)
	movslq	%esi, %rax
	leal	(%rax,%rax), %edx
	leal	1(%rdx), %esi
	cmpl	%edx, %edi
	jge	.L27
.L10:
	cmpl	%esi, %edi
	jl	.L9
	movslq	%esi, %rdx
	movl	(%r14,%rdx,4), %ecx
	cmpl	%ecx, %r8d
	jl	.L11
	.p2align 4,,10
	.p2align 3
.L9:
	movl	%r9d, %edx
	movq	%r12, %rsi
	movl	$1, %edi
	xorl	%eax, %eax
	call	__printf_chk@PLT
	jmp	.L2
	.p2align 4,,10
	.p2align 3
.L25:
	movq	%r13, %rdi
	leaq	8(%rsp), %rsi
	xorl	%eax, %eax
	call	__isoc99_scanf@PLT
	movl	heapsize(%rip), %eax
	movl	8(%rsp), %edi
	addl	$1, %eax
	movl	%eax, heapsize(%rip)
	cmpl	$-1, %edi
	jl	.L4
	movslq	%eax, %rdx
	movl	%edi, (%r14,%rdx,4)
	cmpl	$1, %eax
	jg	.L5
	jmp	.L2
	.p2align 4,,10
	.p2align 3
.L7:
	movl	%ecx, (%r14,%rdx,4)
	movl	%edi, (%r14,%rsi,4)
	cmpl	$1, %eax
	je	.L2
.L5:
	movslq	%eax, %rdx
	sarl	%eax
	movslq	%eax, %rsi
	movl	(%r14,%rsi,4), %ecx
	cmpl	%ecx, %edi
	jg	.L7
	jmp	.L2
	.p2align 4,,10
	.p2align 3
.L8:
	movq	24(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L28
	addq	$32, %rsp
	.cfi_remember_state
	.cfi_def_cfa_offset 48
	xorl	%eax, %eax
	popq	%rbx
	.cfi_def_cfa_offset 40
	popq	%rbp
	.cfi_def_cfa_offset 32
	popq	%r12
	.cfi_def_cfa_offset 24
	popq	%r13
	.cfi_def_cfa_offset 16
	popq	%r14
	.cfi_def_cfa_offset 8
	ret
	.p2align 4,,10
	.p2align 3
.L4:
	.cfi_restore_state
	cltq
	movl	$-1, (%r14,%rax,4)
	jmp	.L2
.L15:
	orl	$-1, %r9d
	jmp	.L9
.L26:
	movslq	%esi, %r10
	movl	(%r14,%r10,4), %r10d
	cmpl	%r10d, %ecx
	jge	.L16
	movl	%r10d, %ecx
	jmp	.L11
.L28:
	call	__stack_chk_fail@PLT
	.cfi_endproc
.LFE23:
	.size	main, .-main
	.text
	.p2align 4
	.globl	insert
	.type	insert, @function
insert:
.LFB24:
	.cfi_startproc
	endbr64
	movl	heapsize(%rip), %eax
	addl	$1, %eax
	movl	%eax, heapsize(%rip)
	cmpl	$-1, %edi
	jl	.L38
	leaq	a(%rip), %rcx
	movslq	%eax, %rdx
	movl	%edi, (%rcx,%rdx,4)
	cmpl	$1, %eax
	jg	.L31
	jmp	.L39
	.p2align 4,,10
	.p2align 3
.L33:
	movl	%esi, (%rcx,%rdx,4)
	movl	%edi, (%rcx,%r8,4)
	cmpl	$1, %eax
	je	.L29
.L31:
	movslq	%eax, %rdx
	sarl	%eax
	movslq	%eax, %r8
	movl	(%rcx,%r8,4), %esi
	cmpl	%esi, %edi
	jg	.L33
.L29:
	ret
	.p2align 4,,10
	.p2align 3
.L38:
	cltq
	leaq	a(%rip), %rdx
	movl	$-1, (%rdx,%rax,4)
	ret
.L39:
	ret
	.cfi_endproc
.LFE24:
	.size	insert, .-insert
	.p2align 4
	.globl	extract
	.type	extract, @function
extract:
.LFB25:
	.cfi_startproc
	endbr64
	movl	heapsize(%rip), %r8d
	testl	%r8d, %r8d
	jle	.L45
	movslq	%r8d, %rax
	leaq	a(%rip), %rsi
	subl	$1, %r8d
	movl	4+a(%rip), %r10d
	movl	(%rsi,%rax,4), %r9d
	movl	$1, %eax
	movl	%r8d, heapsize(%rip)
	leal	(%rax,%rax), %ecx
	movl	%r9d, 4+a(%rip)
	leal	1(%rcx), %edx
	cmpl	%ecx, %r8d
	jl	.L42
	.p2align 4,,10
	.p2align 3
.L49:
	movslq	%ecx, %rdi
	movl	(%rsi,%rdi,4), %edi
	cmpl	%edi, %r9d
	jge	.L42
	cmpl	%edx, %r8d
	jge	.L48
.L46:
	movl	%ecx, %edx
.L43:
	cmpl	%edx, %eax
	je	.L40
	movl	%edi, (%rsi,%rax,4)
	movslq	%edx, %rax
	movl	%r9d, (%rsi,%rax,4)
	movslq	%edx, %rax
	leal	(%rax,%rax), %ecx
	leal	1(%rcx), %edx
	cmpl	%ecx, %r8d
	jge	.L49
.L42:
	cmpl	%edx, %r8d
	jl	.L40
	movslq	%edx, %rcx
	movl	(%rsi,%rcx,4), %edi
	cmpl	%edi, %r9d
	jl	.L43
.L40:
	movl	%r10d, %eax
	ret
.L45:
	movl	$-1, %r10d
	jmp	.L40
.L48:
	movslq	%edx, %r11
	movl	(%rsi,%r11,4), %r11d
	cmpl	%r11d, %edi
	jge	.L46
	movl	%r11d, %edi
	jmp	.L43
	.cfi_endproc
.LFE25:
	.size	extract, .-extract
	.p2align 4
	.globl	maxHeapify
	.type	maxHeapify, @function
maxHeapify:
.LFB26:
	.cfi_startproc
	endbr64
	movl	heapsize(%rip), %r9d
	leaq	a(%rip), %rdx
	jmp	.L54
	.p2align 4,,10
	.p2align 3
.L57:
	movslq	%esi, %rcx
	movl	(%rdx,%rcx,4), %r8d
	movslq	%edi, %rcx
	movl	%r8d, %r10d
	cmpl	(%rdx,%rcx,4), %r8d
	jle	.L51
	cmpl	%eax, %r9d
	jge	.L56
	movl	%esi, %eax
.L52:
	cmpl	%edi, %eax
	je	.L50
	movl	(%rdx,%rcx,4), %esi
	movl	%r8d, (%rdx,%rcx,4)
	movslq	%eax, %rcx
	movl	%eax, %edi
	movl	%esi, (%rdx,%rcx,4)
.L54:
	leal	(%rdi,%rdi), %esi
	leal	1(%rsi), %eax
	cmpl	%esi, %r9d
	jge	.L57
.L51:
	cmpl	%eax, %r9d
	jl	.L50
	movslq	%eax, %rcx
	movl	(%rdx,%rcx,4), %r8d
	movslq	%edi, %rcx
	cmpl	%r8d, (%rdx,%rcx,4)
	jl	.L52
.L50:
	ret
.L56:
	movslq	%eax, %r8
	movl	(%rdx,%r8,4), %r8d
	cmpl	%r10d, %r8d
	jg	.L52
	movl	%r10d, %r8d
	movl	%esi, %eax
	jmp	.L52
	.cfi_endproc
.LFE26:
	.size	maxHeapify, .-maxHeapify
	.p2align 4
	.globl	heapIncreaseKey
	.type	heapIncreaseKey, @function
heapIncreaseKey:
.LFB27:
	.cfi_startproc
	endbr64
	leaq	a(%rip), %rdx
	movslq	%edi, %rax
	cmpl	%esi, (%rdx,%rax,4)
	jg	.L58
	movl	%esi, (%rdx,%rax,4)
	cmpl	$1, %edi
	jg	.L60
	jmp	.L67
	.p2align 4,,10
	.p2align 3
.L62:
	movl	%ecx, (%rdx,%rax,4)
	movl	%esi, (%rdx,%r8,4)
	cmpl	$1, %edi
	je	.L58
.L60:
	movslq	%edi, %rax
	sarl	%edi
	movslq	%edi, %r8
	movl	(%rdx,%r8,4), %ecx
	cmpl	%ecx, %esi
	jg	.L62
.L58:
	ret
.L67:
	ret
	.cfi_endproc
.LFE27:
	.size	heapIncreaseKey, .-heapIncreaseKey
	.globl	heapsize
	.bss
	.align 4
	.type	heapsize, @object
	.size	heapsize, 4
heapsize:
	.zero	4
	.globl	a
	.align 32
	.type	a, @object
	.size	a, 8000000
a:
	.zero	8000000
	.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
	.section	.rodata.str1.1,"aMS",@progbits,1
.LC0:
	.string	"%s"
.LC1:
	.string	"%d"
.LC2:
	.string	"%d\n"
	.section	.text.startup,"ax",@progbits
	.p2align 4
	.globl	main
	.type	main, @function
main:
.LFB23:
	.cfi_startproc
	endbr64
	pushq	%r14
	.cfi_def_cfa_offset 16
	.cfi_offset 14, -16
	leaq	a(%rip), %r14
	pushq	%r13
	.cfi_def_cfa_offset 24
	.cfi_offset 13, -24
	leaq	.LC1(%rip), %r13
	pushq	%r12
	.cfi_def_cfa_offset 32
	.cfi_offset 12, -32
	leaq	.LC2(%rip), %r12
	pushq	%rbp
	.cfi_def_cfa_offset 40
	.cfi_offset 6, -40
	pushq	%rbx
	.cfi_def_cfa_offset 48
	.cfi_offset 3, -48
	leaq	.LC0(%rip), %rbx
	subq	$32, %rsp
	.cfi_def_cfa_offset 80
	movq	%fs:40, %rax
	movq	%rax, 24(%rsp)
	xorl	%eax, %eax
	leaq	14(%rsp), %rbp
	.p2align 4,,10
	.p2align 3
.L2:
	xorl	%eax, %eax
	movq	%rbp, %rsi
	movq	%rbx, %rdi
	call	__isoc99_scanf@PLT
	cmpb	$105, 14(%rsp)
	je	.L25
	cmpb	$120, 15(%rsp)
	jne	.L8
	movl	heapsize(%rip), %edi
	testl	%edi, %edi
	jle	.L15
	movslq	%edi, %rax
	subl	$1, %edi
	movl	4+a(%rip), %r9d
	movl	(%r14,%rax,4), %r8d
	movl	$1, %eax
	movl	%edi, heapsize(%rip)
	leal	(%rax,%rax), %edx
	movl	%r8d, 4+a(%rip)
	leal	1(%rdx), %esi
	cmpl	%edx, %edi
	jl	.L10
	.p2align 4,,10
	.p2align 3
.L27:
	movslq	%edx, %rcx
	movl	(%r14,%rcx,4), %ecx
	cmpl	%ecx, %r8d
	jge	.L10
	cmpl	%esi, %edi
	jge	.L26
.L16:
	movl	%edx, %esi
.L11:
	cmpl	%esi, %eax
	je	.L9
	movl	%ecx, (%r14,%rax,4)
	movslq	%esi, %rax
	movl	%r8d, (%r14,%rax,4)
	movslq	%esi, %rax
	leal	(%rax,%rax), %edx
	leal	1(%rdx), %esi
	cmpl	%edx, %edi
	jge	.L27
.L10:
	cmpl	%esi, %edi
	jl	.L9
	movslq	%esi, %rdx
	movl	(%r14,%rdx,4), %ecx
	cmpl	%ecx, %r8d
	jl	.L11
	.p2align 4,,10
	.p2align 3
.L9:
	movl	%r9d, %edx
	movq	%r12, %rsi
	movl	$1, %edi
	xorl	%eax, %eax
	call	__printf_chk@PLT
	jmp	.L2
	.p2align 4,,10
	.p2align 3
.L25:
	movq	%r13, %rdi
	leaq	8(%rsp), %rsi
	xorl	%eax, %eax
	call	__isoc99_scanf@PLT
	movl	heapsize(%rip), %eax
	movl	8(%rsp), %edi
	addl	$1, %eax
	movl	%eax, heapsize(%rip)
	cmpl	$-1, %edi
	jl	.L4
	movslq	%eax, %rdx
	movl	%edi, (%r14,%rdx,4)
	cmpl	$1, %eax
	jg	.L5
	jmp	.L2
	.p2align 4,,10
	.p2align 3
.L7:
	movl	%ecx, (%r14,%rdx,4)
	movl	%edi, (%r14,%rsi,4)
	cmpl	$1, %eax
	je	.L2
.L5:
	movslq	%eax, %rdx
	sarl	%eax
	movslq	%eax, %rsi
	movl	(%r14,%rsi,4), %ecx
	cmpl	%ecx, %edi
	jg	.L7
	jmp	.L2
	.p2align 4,,10
	.p2align 3
.L8:
	movq	24(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L28
	addq	$32, %rsp
	.cfi_remember_state
	.cfi_def_cfa_offset 48
	xorl	%eax, %eax
	popq	%rbx
	.cfi_def_cfa_offset 40
	popq	%rbp
	.cfi_def_cfa_offset 32
	popq	%r12
	.cfi_def_cfa_offset 24
	popq	%r13
	.cfi_def_cfa_offset 16
	popq	%r14
	.cfi_def_cfa_offset 8
	ret
	.p2align 4,,10
	.p2align 3
.L4:
	.cfi_restore_state
	cltq
	movl	$-1, (%r14,%rax,4)
	jmp	.L2
.L15:
	orl	$-1, %r9d
	jmp	.L9
.L26:
	movslq	%esi, %r10
	movl	(%r14,%r10,4), %r10d
	cmpl	%r10d, %ecx
	jge	.L16
	movl	%r10d, %ecx
	jmp	.L11
.L28:
	call	__stack_chk_fail@PLT
	.cfi_endproc
.LFE23:
	.size	main, .-main
	.text
	.p2align 4
	.globl	insert
	.type	insert, @function
insert:
.LFB24:
	.cfi_startproc
	endbr64
	movl	heapsize(%rip), %eax
	addl	$1, %eax
	movl	%eax, heapsize(%rip)
	cmpl	$-1, %edi
	jl	.L38
	leaq	a(%rip), %rcx
	movslq	%eax, %rdx
	movl	%edi, (%rcx,%rdx,4)
	cmpl	$1, %eax
	jg	.L31
	jmp	.L39
	.p2align 4,,10
	.p2align 3
.L33:
	movl	%esi, (%rcx,%rdx,4)
	movl	%edi, (%rcx,%r8,4)
	cmpl	$1, %eax
	je	.L29
.L31:
	movslq	%eax, %rdx
	sarl	%eax
	movslq	%eax, %r8
	movl	(%rcx,%r8,4), %esi
	cmpl	%esi, %edi
	jg	.L33
.L29:
	ret
	.p2align 4,,10
	.p2align 3
.L38:
	cltq
	leaq	a(%rip), %rdx
	movl	$-1, (%rdx,%rax,4)
	ret
.L39:
	ret
	.cfi_endproc
.LFE24:
	.size	insert, .-insert
	.p2align 4
	.globl	extract
	.type	extract, @function
extract:
.LFB25:
	.cfi_startproc
	endbr64
	movl	heapsize(%rip), %r8d
	testl	%r8d, %r8d
	jle	.L45
	movslq	%r8d, %rax
	leaq	a(%rip), %rsi
	subl	$1, %r8d
	movl	4+a(%rip), %r10d
	movl	(%rsi,%rax,4), %r9d
	movl	$1, %eax
	movl	%r8d, heapsize(%rip)
	leal	(%rax,%rax), %ecx
	movl	%r9d, 4+a(%rip)
	leal	1(%rcx), %edx
	cmpl	%ecx, %r8d
	jl	.L42
	.p2align 4,,10
	.p2align 3
.L49:
	movslq	%ecx, %rdi
	movl	(%rsi,%rdi,4), %edi
	cmpl	%edi, %r9d
	jge	.L42
	cmpl	%edx, %r8d
	jge	.L48
.L46:
	movl	%ecx, %edx
.L43:
	cmpl	%edx, %eax
	je	.L40
	movl	%edi, (%rsi,%rax,4)
	movslq	%edx, %rax
	movl	%r9d, (%rsi,%rax,4)
	movslq	%edx, %rax
	leal	(%rax,%rax), %ecx
	leal	1(%rcx), %edx
	cmpl	%ecx, %r8d
	jge	.L49
.L42:
	cmpl	%edx, %r8d
	jl	.L40
	movslq	%edx, %rcx
	movl	(%rsi,%rcx,4), %edi
	cmpl	%edi, %r9d
	jl	.L43
.L40:
	movl	%r10d, %eax
	ret
.L45:
	movl	$-1, %r10d
	jmp	.L40
.L48:
	movslq	%edx, %r11
	movl	(%rsi,%r11,4), %r11d
	cmpl	%r11d, %edi
	jge	.L46
	movl	%r11d, %edi
	jmp	.L43
	.cfi_endproc
.LFE25:
	.size	extract, .-extract
	.p2align 4
	.globl	maxHeapify
	.type	maxHeapify, @function
maxHeapify:
.LFB26:
	.cfi_startproc
	endbr64
	movl	heapsize(%rip), %r9d
	leaq	a(%rip), %rdx
	jmp	.L54
	.p2align 4,,10
	.p2align 3
.L57:
	movslq	%esi, %rcx
	movl	(%rdx,%rcx,4), %r8d
	movslq	%edi, %rcx
	movl	%r8d, %r10d
	cmpl	(%rdx,%rcx,4), %r8d
	jle	.L51
	cmpl	%eax, %r9d
	jge	.L56
	movl	%esi, %eax
.L52:
	cmpl	%edi, %eax
	je	.L50
	movl	(%rdx,%rcx,4), %esi
	movl	%r8d, (%rdx,%rcx,4)
	movslq	%eax, %rcx
	movl	%eax, %edi
	movl	%esi, (%rdx,%rcx,4)
.L54:
	leal	(%rdi,%rdi), %esi
	leal	1(%rsi), %eax
	cmpl	%esi, %r9d
	jge	.L57
.L51:
	cmpl	%eax, %r9d
	jl	.L50
	movslq	%eax, %rcx
	movl	(%rdx,%rcx,4), %r8d
	movslq	%edi, %rcx
	cmpl	%r8d, (%rdx,%rcx,4)
	jl	.L52
.L50:
	ret
.L56:
	movslq	%eax, %r8
	movl	(%rdx,%r8,4), %r8d
	cmpl	%r10d, %r8d
	jg	.L52
	movl	%r10d, %r8d
	movl	%esi, %eax
	jmp	.L52
	.cfi_endproc
.LFE26:
	.size	maxHeapify, .-maxHeapify
	.p2align 4
	.globl	heapIncreaseKey
	.type	heapIncreaseKey, @function
heapIncreaseKey:
.LFB27:
	.cfi_startproc
	endbr64
	leaq	a(%rip), %rdx
	movslq	%edi, %rax
	cmpl	%esi, (%rdx,%rax,4)
	jg	.L58
	movl	%esi, (%rdx,%rax,4)
	cmpl	$1, %edi
	jg	.L60
	jmp	.L67
	.p2align 4,,10
	.p2align 3
.L62:
	movl	%ecx, (%rdx,%rax,4)
	movl	%esi, (%rdx,%r8,4)
	cmpl	$1, %edi
	je	.L58
.L60:
	movslq	%edi, %rax
	sarl	%edi
	movslq	%edi, %r8
	movl	(%rdx,%r8,4), %ecx
	cmpl	%ecx, %esi
	jg	.L62
.L58:
	ret
.L67:
	ret
	.cfi_endproc
.LFE27:
	.size	heapIncreaseKey, .-heapIncreaseKey
	.globl	heapsize
	.bss
	.align 4
	.type	heapsize, @object
	.size	heapsize, 4
heapsize:
	.zero	4
	.globl	a
	.align 32
	.type	a, @object
	.size	a, 8000000
a:
	.zero	8000000
	.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>
#define NUM 2000000
void insert(int);
int extract();
void maxHeapify(int);
void heapIncreaseKey(int,int);

int a[NUM],heapsize=0;

int main(){
  char c[10];
  int n,max;
  while(1){
    scanf("%s",c);
    if(c[0]=='i'){
      scanf("%d",&n);
      insert(n);
    }else{
      if(c[1]=='x'){
	max=extract();
	printf("%d\n",max);
      }else{
	break;
      }
    }
  }
  return 0;
}

void insert(int n){
  heapsize++;
  a[heapsize]=-1;
  heapIncreaseKey(heapsize,n);
}

int extract(){
  int max;
  if(heapsize<1){
    return -1;
  }
  max=a[1];
  a[1]=a[heapsize];
  heapsize--;
  maxHeapify(1);
  return max;
}

void maxHeapify(int i){
  int l,r,largest,a1;
  l=2*i;
  r=2*i+1;
  if(l<=heapsize&&a[l]>a[i]){
    largest=l;
  }else{
    largest=i;
  }
  if(r<=heapsize&&a[r]>a[largest]){
    largest=r;
  }
  if(largest!=i){
    a1=a[i];
    a[i]=a[largest];
    a[largest]=a1;
    maxHeapify(largest);
  }
}

void heapIncreaseKey(int i,int n){
  int a1;
  if(n<a[i]){
    return;
  }
  a[i]=n;
  while(i>1&&a[i/2]<a[i]){
    a1=a[i];
    a[i]=a[i/2];
    a[i/2]=a1;
    i=i/2;
  }
}


insert 8
insert 1
extract
insert 10
extract
insert 11
extract
extract
end
 insert 9
insert 2
extract
insert 10
extract
insert 11
extract
extract
end
 insert 8
insert 2
extract
insert 16
extract
insert 11
extract
extract
end
 insert 8
insert 1
extract
insert 15
extract
insert 11
extract
extract
end
 insert 8
insert 0
extract
insert 10
extract
insert 11
extract
extract
end
 insert 8
insert 2
extract
insert 8
extract
insert 11
extract
extract
end
 insert 8
insert 2
extract
insert 4
extract
insert 11
extract
extract
end
 insert 8
insert 2
extract
insert 10
extract
insert 14
extract
extract
end
 insert 9
insert 2
extract
insert 4
extract
insert 11
extract
extract
end
 insert 8
insert 0
extract
insert 4
extract
insert 11
extract
extract
end

8
10
11
1
 9
10
11
2
 8
16
11
2
 8
15
11
1
 8
10
11
0
 8
8
11
2
 8
4
11
2
 8
10
14
2
 9
4
11
2
 8
4
11
0

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>
#define NUM 2000000
void insert(int);
int extract();
void maxHeapify(int);
void heapIncreaseKey(int,int);

int a[NUM],heapsize=0;

int main(){
  char c[10];
  int n,max;
  while(1){
    scanf("%s",c);
    if(c[0]=='i'){
      scanf("%d",&n);
      insert(n);
    }else{
      if(c[1]=='x'){
	max=extract();
	printf("%d\n",max);
      }else{
	break;
      }
    }
  }
  return 0;
}

void insert(int n){
  heapsize++;
  a[heapsize]=-1;
  heapIncreaseKey(heapsize,n);
}

int extract(){
  int max;
  if(heapsize<1){
    return -1;
  }
  max=a[1];
  a[1]=a[heapsize];
  heapsize--;
  maxHeapify(1);
  return max;
}

void maxHeapify(int i){
  int l,r,largest,a1;
  l=2*i;
  r=2*i+1;
  if(l<=heapsize&&a[l]>a[i]){
    largest=l;
  }else{
    largest=i;
  }
  if(r<=heapsize&&a[r]>a[largest]){
    largest=r;
  }
  if(largest!=i){
    a1=a[i];
    a[i]=a[largest];
    a[largest]=a1;
    maxHeapify(largest);
  }
}

void heapIncreaseKey(int i,int n){
  int a1;
  if(n<a[i]){
    return;
  }
  a[i]=n;
  while(i>1&&a[i/2]<a[i]){
    a1=a[i];
    a[i]=a[i/2];
    a[i/2]=a1;
    i=i/2;
  }
}

```

Unoptimized Assembly Code:

```assembly
	.file	"temp.c"
	.text
	.globl	a
	.bss
	.align 32
	.type	a, @object
	.size	a, 8000000
a:
	.zero	8000000
	.globl	heapsize
	.align 4
	.type	heapsize, @object
	.size	heapsize, 4
heapsize:
	.zero	4
	.section	.rodata
.LC0:
	.string	"%s"
.LC1:
	.string	"%d"
.LC2:
	.string	"%d\n"
	.text
	.globl	main
	.type	main, @function
main:
.LFB0:
	.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	%fs:40, %rax
	movq	%rax, -8(%rbp)
	xorl	%eax, %eax
.L6:
	leaq	-18(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movzbl	-18(%rbp), %eax
	cmpb	$105, %al
	jne	.L2
	leaq	-28(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	-28(%rbp), %eax
	movl	%eax, %edi
	call	insert
	jmp	.L6
.L2:
	movzbl	-17(%rbp), %eax
	cmpb	$120, %al
	jne	.L9
	movl	$0, %eax
	call	extract
	movl	%eax, -24(%rbp)
	movl	-24(%rbp), %eax
	movl	%eax, %esi
	leaq	.LC2(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	jmp	.L6
.L9:
	nop
	movl	$0, %eax
	movq	-8(%rbp), %rdx
	subq	%fs:40, %rdx
	je	.L8
	call	__stack_chk_fail@PLT
.L8:
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE0:
	.size	main, .-main
	.globl	insert
	.type	insert, @function
insert:
.LFB1:
	.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
	movl	%edi, -4(%rbp)
	movl	heapsize(%rip), %eax
	addl	$1, %eax
	movl	%eax, heapsize(%rip)
	movl	heapsize(%rip), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	a(%rip), %rax
	movl	$-1, (%rdx,%rax)
	movl	heapsize(%rip), %eax
	movl	-4(%rbp), %edx
	movl	%edx, %esi
	movl	%eax, %edi
	call	heapIncreaseKey
	nop
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE1:
	.size	insert, .-insert
	.globl	extract
	.type	extract, @function
extract:
.LFB2:
	.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
	movl	heapsize(%rip), %eax
	testl	%eax, %eax
	jg	.L12
	movl	$-1, %eax
	jmp	.L13
.L12:
	movl	4+a(%rip), %eax
	movl	%eax, -4(%rbp)
	movl	heapsize(%rip), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	a(%rip), %rax
	movl	(%rdx,%rax), %eax
	movl	%eax, 4+a(%rip)
	movl	heapsize(%rip), %eax
	subl	$1, %eax
	movl	%eax, heapsize(%rip)
	movl	$1, %edi
	call	maxHeapify
	movl	-4(%rbp), %eax
.L13:
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE2:
	.size	extract, .-extract
	.globl	maxHeapify
	.type	maxHeapify, @function
maxHeapify:
.LFB3:
	.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
	movl	%edi, -20(%rbp)
	movl	-20(%rbp), %eax
	addl	%eax, %eax
	movl	%eax, -12(%rbp)
	movl	-20(%rbp), %eax
	addl	%eax, %eax
	addl	$1, %eax
	movl	%eax, -8(%rbp)
	movl	heapsize(%rip), %eax
	cmpl	%eax, -12(%rbp)
	jg	.L15
	movl	-12(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	a(%rip), %rax
	movl	(%rdx,%rax), %edx
	movl	-20(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rcx
	leaq	a(%rip), %rax
	movl	(%rcx,%rax), %eax
	cmpl	%eax, %edx
	jle	.L15
	movl	-12(%rbp), %eax
	movl	%eax, -16(%rbp)
	jmp	.L16
.L15:
	movl	-20(%rbp), %eax
	movl	%eax, -16(%rbp)
.L16:
	movl	heapsize(%rip), %eax
	cmpl	%eax, -8(%rbp)
	jg	.L17
	movl	-8(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	a(%rip), %rax
	movl	(%rdx,%rax), %edx
	movl	-16(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rcx
	leaq	a(%rip), %rax
	movl	(%rcx,%rax), %eax
	cmpl	%eax, %edx
	jle	.L17
	movl	-8(%rbp), %eax
	movl	%eax, -16(%rbp)
.L17:
	movl	-16(%rbp), %eax
	cmpl	-20(%rbp), %eax
	je	.L19
	movl	-20(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	a(%rip), %rax
	movl	(%rdx,%rax), %eax
	movl	%eax, -4(%rbp)
	movl	-16(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	a(%rip), %rax
	movl	(%rdx,%rax), %eax
	movl	-20(%rbp), %edx
	movslq	%edx, %rdx
	leaq	0(,%rdx,4), %rcx
	leaq	a(%rip), %rdx
	movl	%eax, (%rcx,%rdx)
	movl	-16(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rcx
	leaq	a(%rip), %rdx
	movl	-4(%rbp), %eax
	movl	%eax, (%rcx,%rdx)
	movl	-16(%rbp), %eax
	movl	%eax, %edi
	call	maxHeapify
.L19:
	nop
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE3:
	.size	maxHeapify, .-maxHeapify
	.globl	heapIncreaseKey
	.type	heapIncreaseKey, @function
heapIncreaseKey:
.LFB4:
	.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)
	movl	%esi, -24(%rbp)
	movl	-20(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	a(%rip), %rax
	movl	(%rdx,%rax), %eax
	cmpl	%eax, -24(%rbp)
	jl	.L25
	movl	-20(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rcx
	leaq	a(%rip), %rdx
	movl	-24(%rbp), %eax
	movl	%eax, (%rcx,%rdx)
	jmp	.L23
.L24:
	movl	-20(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	a(%rip), %rax
	movl	(%rdx,%rax), %eax
	movl	%eax, -4(%rbp)
	movl	-20(%rbp), %eax
	movl	%eax, %edx
	shrl	$31, %edx
	addl	%edx, %eax
	sarl	%eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	a(%rip), %rax
	movl	(%rdx,%rax), %eax
	movl	-20(%rbp), %edx
	movslq	%edx, %rdx
	leaq	0(,%rdx,4), %rcx
	leaq	a(%rip), %rdx
	movl	%eax, (%rcx,%rdx)
	movl	-20(%rbp), %eax
	movl	%eax, %edx
	shrl	$31, %edx
	addl	%edx, %eax
	sarl	%eax
	cltq
	leaq	0(,%rax,4), %rcx
	leaq	a(%rip), %rdx
	movl	-4(%rbp), %eax
	movl	%eax, (%rcx,%rdx)
	movl	-20(%rbp), %eax
	movl	%eax, %edx
	shrl	$31, %edx
	addl	%edx, %eax
	sarl	%eax
	movl	%eax, -20(%rbp)
.L23:
	cmpl	$1, -20(%rbp)
	jle	.L20
	movl	-20(%rbp), %eax
	movl	%eax, %edx
	shrl	$31, %edx
	addl	%edx, %eax
	sarl	%eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	a(%rip), %rax
	movl	(%rdx,%rax), %edx
	movl	-20(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rcx
	leaq	a(%rip), %rax
	movl	(%rcx,%rax), %eax
	cmpl	%eax, %edx
	jl	.L24
	jmp	.L20
.L25:
	nop
.L20:
	popq	%rbp
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE4:
	.size	heapIncreaseKey, .-heapIncreaseKey
	.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	a
	.bss
	.align 32
	.type	a, @object
	.size	a, 8000000
a:
	.zero	8000000
	.globl	heapsize
	.align 4
	.type	heapsize, @object
	.size	heapsize, 4
heapsize:
	.zero	4
	.section	.rodata
.LC0:
	.string	"%s"
.LC1:
	.string	"%d"
.LC2:
	.string	"%d\n"
	.text
	.globl	main
	.type	main, @function
main:
.LFB0:
	.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	%fs:40, %rax
	movq	%rax, -8(%rbp)
	xorl	%eax, %eax
.L6:
	leaq	-18(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movzbl	-18(%rbp), %eax
	cmpb	$105, %al
	jne	.L2
	leaq	-28(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	-28(%rbp), %eax
	movl	%eax, %edi
	call	insert
	jmp	.L6
.L2:
	movzbl	-17(%rbp), %eax
	cmpb	$120, %al
	jne	.L9
	movl	$0, %eax
	call	extract
	movl	%eax, -24(%rbp)
	movl	-24(%rbp), %eax
	movl	%eax, %esi
	leaq	.LC2(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	jmp	.L6
.L9:
	nop
	movl	$0, %eax
	movq	-8(%rbp), %rdx
	subq	%fs:40, %rdx
	je	.L8
	call	__stack_chk_fail@PLT
.L8:
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE0:
	.size	main, .-main
	.globl	insert
	.type	insert, @function
insert:
.LFB1:
	.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
	movl	%edi, -4(%rbp)
	movl	heapsize(%rip), %eax
	addl	$1, %eax
	movl	%eax, heapsize(%rip)
	movl	heapsize(%rip), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	a(%rip), %rax
	movl	$-1, (%rdx,%rax)
	movl	heapsize(%rip), %eax
	movl	-4(%rbp), %edx
	movl	%edx, %esi
	movl	%eax, %edi
	call	heapIncreaseKey
	nop
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE1:
	.size	insert, .-insert
	.globl	extract
	.type	extract, @function
extract:
.LFB2:
	.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
	movl	heapsize(%rip), %eax
	testl	%eax, %eax
	jg	.L12
	movl	$-1, %eax
	jmp	.L13
.L12:
	movl	4+a(%rip), %eax
	movl	%eax, -4(%rbp)
	movl	heapsize(%rip), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	a(%rip), %rax
	movl	(%rdx,%rax), %eax
	movl	%eax, 4+a(%rip)
	movl	heapsize(%rip), %eax
	subl	$1, %eax
	movl	%eax, heapsize(%rip)
	movl	$1, %edi
	call	maxHeapify
	movl	-4(%rbp), %eax
.L13:
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE2:
	.size	extract, .-extract
	.globl	maxHeapify
	.type	maxHeapify, @function
maxHeapify:
.LFB3:
	.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
	movl	%edi, -20(%rbp)
	movl	-20(%rbp), %eax
	addl	%eax, %eax
	movl	%eax, -12(%rbp)
	movl	-20(%rbp), %eax
	addl	%eax, %eax
	addl	$1, %eax
	movl	%eax, -8(%rbp)
	movl	heapsize(%rip), %eax
	cmpl	%eax, -12(%rbp)
	jg	.L15
	movl	-12(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	a(%rip), %rax
	movl	(%rdx,%rax), %edx
	movl	-20(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rcx
	leaq	a(%rip), %rax
	movl	(%rcx,%rax), %eax
	cmpl	%eax, %edx
	jle	.L15
	movl	-12(%rbp), %eax
	movl	%eax, -16(%rbp)
	jmp	.L16
.L15:
	movl	-20(%rbp), %eax
	movl	%eax, -16(%rbp)
.L16:
	movl	heapsize(%rip), %eax
	cmpl	%eax, -8(%rbp)
	jg	.L17
	movl	-8(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	a(%rip), %rax
	movl	(%rdx,%rax), %edx
	movl	-16(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rcx
	leaq	a(%rip), %rax
	movl	(%rcx,%rax), %eax
	cmpl	%eax, %edx
	jle	.L17
	movl	-8(%rbp), %eax
	movl	%eax, -16(%rbp)
.L17:
	movl	-16(%rbp), %eax
	cmpl	-20(%rbp), %eax
	je	.L19
	movl	-20(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	a(%rip), %rax
	movl	(%rdx,%rax), %eax
	movl	%eax, -4(%rbp)
	movl	-16(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	a(%rip), %rax
	movl	(%rdx,%rax), %eax
	movl	-20(%rbp), %edx
	movslq	%edx, %rdx
	leaq	0(,%rdx,4), %rcx
	leaq	a(%rip), %rdx
	movl	%eax, (%rcx,%rdx)
	movl	-16(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rcx
	leaq	a(%rip), %rdx
	movl	-4(%rbp), %eax
	movl	%eax, (%rcx,%rdx)
	movl	-16(%rbp), %eax
	movl	%eax, %edi
	call	maxHeapify
.L19:
	nop
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE3:
	.size	maxHeapify, .-maxHeapify
	.globl	heapIncreaseKey
	.type	heapIncreaseKey, @function
heapIncreaseKey:
.LFB4:
	.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)
	movl	%esi, -24(%rbp)
	movl	-20(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	a(%rip), %rax
	movl	(%rdx,%rax), %eax
	cmpl	%eax, -24(%rbp)
	jl	.L25
	movl	-20(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rcx
	leaq	a(%rip), %rdx
	movl	-24(%rbp), %eax
	movl	%eax, (%rcx,%rdx)
	jmp	.L23
.L24:
	movl	-20(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	a(%rip), %rax
	movl	(%rdx,%rax), %eax
	movl	%eax, -4(%rbp)
	movl	-20(%rbp), %eax
	movl	%eax, %edx
	shrl	$31, %edx
	addl	%edx, %eax
	sarl	%eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	a(%rip), %rax
	movl	(%rdx,%rax), %eax
	movl	-20(%rbp), %edx
	movslq	%edx, %rdx
	leaq	0(,%rdx,4), %rcx
	leaq	a(%rip), %rdx
	movl	%eax, (%rcx,%rdx)
	movl	-20(%rbp), %eax
	movl	%eax, %edx
	shrl	$31, %edx
	addl	%edx, %eax
	sarl	%eax
	cltq
	leaq	0(,%rax,4), %rcx
	leaq	a(%rip), %rdx
	movl	-4(%rbp), %eax
	movl	%eax, (%rcx,%rdx)
	movl	-20(%rbp), %eax
	movl	%eax, %edx
	shrl	$31, %edx
	addl	%edx, %eax
	sarl	%eax
	movl	%eax, -20(%rbp)
.L23:
	cmpl	$1, -20(%rbp)
	jle	.L20
	movl	-20(%rbp), %eax
	movl	%eax, %edx
	shrl	$31, %edx
	addl	%edx, %eax
	sarl	%eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	a(%rip), %rax
	movl	(%rdx,%rax), %edx
	movl	-20(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rcx
	leaq	a(%rip), %rax
	movl	(%rcx,%rax), %eax
	cmpl	%eax, %edx
	jl	.L24
	jmp	.L20
.L25:
	nop
.L20:
	popq	%rbp
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE4:
	.size	heapIncreaseKey, .-heapIncreaseKey
	.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:
