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>

void quicksort(int i,int j,int *A);
int partition(int i,int j,int a,int *A);
int pivot(int i,int j,int *A);
void swap(int i,int j,int *A);

int main(void){
  int N,K,i;
  long total = 0;
  int h[200009];
  scanf("%d %d\n",&N,&K );
  for(i=0; i<N; i++){
    scanf("%d",&h[i] );
  }
  quicksort(0,N-1,h);
  for(i=0;i<N-K;i++ ){
    total += h[i];
  }
  printf("%ld\n",total );
  return 0;
}
void quicksort(int i,int j,int *A){
  int a,pv,k;
  pv = pivot(i,j,A);
  if(pv != -1){
    a = A[pv];
    k = partition(i,j,a,A);
    quicksort(i,k-1,A);
    quicksort(k,j,A);
  }
}
int partition(int i,int j,int a,int *A){
  int l,r,k;
  l = i;
  r = j;
  while(1){
    while(A[l] < a) l++;
    while(A[r] >= a) r--;
    if(l <= r){
      swap(l, r, A);
      l++;
      r--;
    }else break;
  }
  k = l;
  return k;
}
int pivot(int i,int j,int *A){
  int pv,k;
  k = i+1;
  while(k<=j && A[i] == A[k]) k++;
  if(k > j) pv = -1;
  else if(A[i] >= A[k]) pv = i;
  else pv = k;
  return pv;
}
void swap(int i,int j,int *A){
  int tmp;
  tmp = A[i];
  A[i] = A[j];
  A[j] = tmp;
}```

Unoptimized Assembly Code:

```assembly
	.file	"temp.c"
	.text
	.section	.rodata
.LC0:
	.string	"%d %d\n"
.LC1:
	.string	"%d"
.LC2:
	.string	"%ld\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
	leaq	-798720(%rsp), %r11
.LPSRL0:
	subq	$4096, %rsp
	orq	$0, (%rsp)
	cmpq	%r11, %rsp
	jne	.LPSRL0
	subq	$1360, %rsp
	movq	%fs:40, %rax
	movq	%rax, -8(%rbp)
	xorl	%eax, %eax
	movq	$0, -800056(%rbp)
	leaq	-800064(%rbp), %rdx
	leaq	-800068(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	$0, -800060(%rbp)
	jmp	.L2
.L3:
	leaq	-800048(%rbp), %rdx
	movl	-800060(%rbp), %eax
	cltq
	salq	$2, %rax
	addq	%rdx, %rax
	movq	%rax, %rsi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	addl	$1, -800060(%rbp)
.L2:
	movl	-800068(%rbp), %eax
	cmpl	%eax, -800060(%rbp)
	jl	.L3
	movl	-800068(%rbp), %eax
	leal	-1(%rax), %ecx
	leaq	-800048(%rbp), %rax
	movq	%rax, %rdx
	movl	%ecx, %esi
	movl	$0, %edi
	call	quicksort
	movl	$0, -800060(%rbp)
	jmp	.L4
.L5:
	movl	-800060(%rbp), %eax
	cltq
	movl	-800048(%rbp,%rax,4), %eax
	cltq
	addq	%rax, -800056(%rbp)
	addl	$1, -800060(%rbp)
.L4:
	movl	-800068(%rbp), %eax
	movl	-800064(%rbp), %edx
	subl	%edx, %eax
	cmpl	%eax, -800060(%rbp)
	jl	.L5
	movq	-800056(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC2(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	movl	$0, %eax
	movq	-8(%rbp), %rdx
	subq	%fs:40, %rdx
	je	.L7
	call	__stack_chk_fail@PLT
.L7:
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE0:
	.size	main, .-main
	.globl	quicksort
	.type	quicksort, @function
quicksort:
.LFB1:
	.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	%esi, -24(%rbp)
	movq	%rdx, -32(%rbp)
	movq	-32(%rbp), %rdx
	movl	-24(%rbp), %ecx
	movl	-20(%rbp), %eax
	movl	%ecx, %esi
	movl	%eax, %edi
	call	pivot
	movl	%eax, -12(%rbp)
	cmpl	$-1, -12(%rbp)
	je	.L10
	movl	-12(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	movq	-32(%rbp), %rax
	addq	%rdx, %rax
	movl	(%rax), %eax
	movl	%eax, -8(%rbp)
	movq	-32(%rbp), %rcx
	movl	-8(%rbp), %edx
	movl	-24(%rbp), %esi
	movl	-20(%rbp), %eax
	movl	%eax, %edi
	call	partition
	movl	%eax, -4(%rbp)
	movl	-4(%rbp), %eax
	leal	-1(%rax), %ecx
	movq	-32(%rbp), %rdx
	movl	-20(%rbp), %eax
	movl	%ecx, %esi
	movl	%eax, %edi
	call	quicksort
	movq	-32(%rbp), %rdx
	movl	-24(%rbp), %ecx
	movl	-4(%rbp), %eax
	movl	%ecx, %esi
	movl	%eax, %edi
	call	quicksort
.L10:
	nop
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE1:
	.size	quicksort, .-quicksort
	.globl	partition
	.type	partition, @function
partition:
.LFB2:
	.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, -20(%rbp)
	movl	%esi, -24(%rbp)
	movl	%edx, -28(%rbp)
	movq	%rcx, -40(%rbp)
	movl	-20(%rbp), %eax
	movl	%eax, -12(%rbp)
	movl	-24(%rbp), %eax
	movl	%eax, -8(%rbp)
	jmp	.L12
.L13:
	addl	$1, -12(%rbp)
.L12:
	movl	-12(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	movq	-40(%rbp), %rax
	addq	%rdx, %rax
	movl	(%rax), %eax
	cmpl	%eax, -28(%rbp)
	jg	.L13
	jmp	.L14
.L15:
	subl	$1, -8(%rbp)
.L14:
	movl	-8(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	movq	-40(%rbp), %rax
	addq	%rdx, %rax
	movl	(%rax), %eax
	cmpl	%eax, -28(%rbp)
	jle	.L15
	movl	-12(%rbp), %eax
	cmpl	-8(%rbp), %eax
	jg	.L21
	movq	-40(%rbp), %rdx
	movl	-8(%rbp), %ecx
	movl	-12(%rbp), %eax
	movl	%ecx, %esi
	movl	%eax, %edi
	call	swap
	addl	$1, -12(%rbp)
	subl	$1, -8(%rbp)
	jmp	.L12
.L21:
	nop
	movl	-12(%rbp), %eax
	movl	%eax, -4(%rbp)
	movl	-4(%rbp), %eax
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE2:
	.size	partition, .-partition
	.globl	pivot
	.type	pivot, @function
pivot:
.LFB3:
	.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)
	movq	%rdx, -32(%rbp)
	movl	-20(%rbp), %eax
	addl	$1, %eax
	movl	%eax, -4(%rbp)
	jmp	.L23
.L25:
	addl	$1, -4(%rbp)
.L23:
	movl	-4(%rbp), %eax
	cmpl	-24(%rbp), %eax
	jg	.L24
	movl	-20(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	movq	-32(%rbp), %rax
	addq	%rdx, %rax
	movl	(%rax), %edx
	movl	-4(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rcx
	movq	-32(%rbp), %rax
	addq	%rcx, %rax
	movl	(%rax), %eax
	cmpl	%eax, %edx
	je	.L25
.L24:
	movl	-4(%rbp), %eax
	cmpl	-24(%rbp), %eax
	jle	.L26
	movl	$-1, -8(%rbp)
	jmp	.L27
.L26:
	movl	-20(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	movq	-32(%rbp), %rax
	addq	%rdx, %rax
	movl	(%rax), %edx
	movl	-4(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rcx
	movq	-32(%rbp), %rax
	addq	%rcx, %rax
	movl	(%rax), %eax
	cmpl	%eax, %edx
	jl	.L28
	movl	-20(%rbp), %eax
	movl	%eax, -8(%rbp)
	jmp	.L27
.L28:
	movl	-4(%rbp), %eax
	movl	%eax, -8(%rbp)
.L27:
	movl	-8(%rbp), %eax
	popq	%rbp
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE3:
	.size	pivot, .-pivot
	.globl	swap
	.type	swap, @function
swap:
.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)
	movq	%rdx, -32(%rbp)
	movl	-20(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	movq	-32(%rbp), %rax
	addq	%rdx, %rax
	movl	(%rax), %eax
	movl	%eax, -4(%rbp)
	movl	-24(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	movq	-32(%rbp), %rax
	addq	%rdx, %rax
	movl	-20(%rbp), %edx
	movslq	%edx, %rdx
	leaq	0(,%rdx,4), %rcx
	movq	-32(%rbp), %rdx
	addq	%rcx, %rdx
	movl	(%rax), %eax
	movl	%eax, (%rdx)
	movl	-24(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	movq	-32(%rbp), %rax
	addq	%rax, %rdx
	movl	-4(%rbp), %eax
	movl	%eax, (%rdx)
	nop
	popq	%rbp
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE4:
	.size	swap, .-swap
	.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	quicksort
	.type	quicksort, @function
quicksort:
.LFB24:
	.cfi_startproc
	endbr64
	pushq	%r13
	.cfi_def_cfa_offset 16
	.cfi_offset 13, -16
	movl	%edi, %r10d
	pushq	%r12
	.cfi_def_cfa_offset 24
	.cfi_offset 12, -24
	movslq	%esi, %r12
	pushq	%rbp
	.cfi_def_cfa_offset 32
	.cfi_offset 6, -32
	movq	%r12, %rbp
	pushq	%rbx
	.cfi_def_cfa_offset 40
	.cfi_offset 3, -40
	movq	%rdx, %rbx
	subq	$8, %rsp
	.cfi_def_cfa_offset 48
.L11:
	leal	1(%r10), %eax
	cmpl	%eax, %ebp
	jl	.L1
	movslq	%r10d, %r8
	cltq
	movl	(%rbx,%r8,4), %ecx
	jmp	.L3
	.p2align 4,,10
	.p2align 3
.L4:
	addq	$1, %rax
	cmpl	%eax, %ebp
	jl	.L1
.L3:
	movl	(%rbx,%rax,4), %esi
	movl	%eax, %edx
	cmpl	%esi, %ecx
	je	.L4
	cmovge	%r10d, %edx
	cmovge	%ecx, %esi
	cmpl	$-1, %edx
	je	.L1
	movl	%ebp, %ecx
	movq	%r12, %rax
	.p2align 4,,10
	.p2align 3
.L6:
	movl	(%rbx,%r8,4), %r9d
	leaq	(%rbx,%rax,4), %rdi
	movl	%r8d, %r13d
	movl	(%rdi), %edx
	cmpl	%esi, %r9d
	jl	.L7
	cmpl	%edx, %esi
	jg	.L8
	leaq	-4(%rbx,%rax,4), %rax
	.p2align 4,,10
	.p2align 3
.L9:
	movq	%rax, %rdi
	movl	(%rax), %edx
	subq	$4, %rax
	subl	$1, %ecx
	cmpl	%esi, %edx
	jge	.L9
.L8:
	cmpl	%r8d, %ecx
	jl	.L10
	movl	%edx, (%rbx,%r8,4)
	subl	$1, %ecx
	movl	%r9d, (%rdi)
	movslq	%ecx, %rax
.L7:
	addq	$1, %r8
	jmp	.L6
	.p2align 4,,10
	.p2align 3
.L1:
	addq	$8, %rsp
	.cfi_remember_state
	.cfi_def_cfa_offset 40
	popq	%rbx
	.cfi_def_cfa_offset 32
	popq	%rbp
	.cfi_def_cfa_offset 24
	popq	%r12
	.cfi_def_cfa_offset 16
	popq	%r13
	.cfi_def_cfa_offset 8
	ret
	.p2align 4,,10
	.p2align 3
.L10:
	.cfi_restore_state
	movl	%r10d, %edi
	leal	-1(%r13), %esi
	movq	%rbx, %rdx
	call	quicksort
	movl	%r13d, %r10d
	jmp	.L11
	.cfi_endproc
.LFE24:
	.size	quicksort, .-quicksort
	.section	.rodata.str1.1,"aMS",@progbits,1
.LC0:
	.string	"%d %d\n"
.LC1:
	.string	"%d"
.LC2:
	.string	"%ld\n"
	.section	.text.startup,"ax",@progbits
	.p2align 4
	.globl	main
	.type	main, @function
main:
.LFB23:
	.cfi_startproc
	endbr64
	pushq	%r13
	.cfi_def_cfa_offset 16
	.cfi_offset 13, -16
	pushq	%r12
	.cfi_def_cfa_offset 24
	.cfi_offset 12, -24
	pushq	%rbp
	.cfi_def_cfa_offset 32
	.cfi_offset 6, -32
	pushq	%rbx
	.cfi_def_cfa_offset 40
	.cfi_offset 3, -40
	leaq	-798720(%rsp), %r11
	.cfi_def_cfa 11, 798760
.LPSRL0:
	subq	$4096, %rsp
	orq	$0, (%rsp)
	cmpq	%r11, %rsp
	jne	.LPSRL0
	.cfi_def_cfa_register 7
	subq	$1352, %rsp
	.cfi_def_cfa_offset 800112
	leaq	.LC0(%rip), %rdi
	xorl	%ebx, %ebx
	leaq	.LC1(%rip), %r13
	movq	%fs:40, %rax
	movq	%rax, 800056(%rsp)
	xorl	%eax, %eax
	leaq	8(%rsp), %rsi
	leaq	12(%rsp), %rdx
	leaq	16(%rsp), %r12
	movq	%r12, %rbp
	call	__isoc99_scanf@PLT
	movl	8(%rsp), %esi
	testl	%esi, %esi
	jle	.L17
	.p2align 4,,10
	.p2align 3
.L18:
	movq	%rbp, %rsi
	movq	%r13, %rdi
	xorl	%eax, %eax
	addl	$1, %ebx
	call	__isoc99_scanf@PLT
	movl	8(%rsp), %esi
	addq	$4, %rbp
	cmpl	%ebx, %esi
	jg	.L18
.L17:
	subl	$1, %esi
	movq	%r12, %rdx
	xorl	%edi, %edi
	call	quicksort
	movl	8(%rsp), %ecx
	subl	12(%rsp), %ecx
	testl	%ecx, %ecx
	jle	.L25
	leal	-1(%rcx), %eax
	cmpl	$2, %eax
	jbe	.L26
	movl	%ecx, %edx
	pxor	%xmm0, %xmm0
	pxor	%xmm4, %xmm4
	movq	%r12, %rax
	shrl	$2, %edx
	subl	$1, %edx
	salq	$4, %rdx
	leaq	32(%rsp,%rdx), %rdx
	.p2align 4,,10
	.p2align 3
.L21:
	movdqa	(%rax), %xmm1
	movdqa	%xmm4, %xmm2
	addq	$16, %rax
	pcmpgtd	%xmm1, %xmm2
	movdqa	%xmm1, %xmm3
	punpckldq	%xmm2, %xmm3
	punpckhdq	%xmm2, %xmm1
	paddq	%xmm3, %xmm0
	paddq	%xmm1, %xmm0
	cmpq	%rdx, %rax
	jne	.L21
	movdqa	%xmm0, %xmm1
	movl	%ecx, %eax
	psrldq	$8, %xmm1
	andl	$-4, %eax
	paddq	%xmm1, %xmm0
	movq	%xmm0, %rdx
	testb	$3, %cl
	je	.L19
.L20:
	movslq	%eax, %rsi
	movslq	16(%rsp,%rsi,4), %rsi
	addq	%rsi, %rdx
	leal	1(%rax), %esi
	cmpl	%ecx, %esi
	jge	.L19
	movslq	%esi, %rsi
	addl	$2, %eax
	movslq	16(%rsp,%rsi,4), %rsi
	addq	%rsi, %rdx
	cmpl	%eax, %ecx
	jle	.L19
	cltq
	movslq	16(%rsp,%rax,4), %rax
	addq	%rax, %rdx
.L19:
	xorl	%eax, %eax
	leaq	.LC2(%rip), %rsi
	movl	$1, %edi
	call	__printf_chk@PLT
	movq	800056(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L32
	addq	$800072, %rsp
	.cfi_remember_state
	.cfi_def_cfa_offset 40
	xorl	%eax, %eax
	popq	%rbx
	.cfi_def_cfa_offset 32
	popq	%rbp
	.cfi_def_cfa_offset 24
	popq	%r12
	.cfi_def_cfa_offset 16
	popq	%r13
	.cfi_def_cfa_offset 8
	ret
.L25:
	.cfi_restore_state
	xorl	%edx, %edx
	jmp	.L19
.L26:
	xorl	%edx, %edx
	xorl	%eax, %eax
	jmp	.L20
.L32:
	call	__stack_chk_fail@PLT
	.cfi_endproc
.LFE23:
	.size	main, .-main
	.text
	.p2align 4
	.globl	partition
	.type	partition, @function
partition:
.LFB25:
	.cfi_startproc
	endbr64
	movslq	%edi, %rax
	movq	%rax, %r11
	leaq	(%rcx,%rax,4), %r10
	movslq	%esi, %rax
	.p2align 4,,10
	.p2align 3
.L34:
	movl	(%r10), %edi
	leaq	(%rcx,%rax,4), %r9
	movl	(%r9), %r8d
	cmpl	%edx, %edi
	jl	.L35
	cmpl	%r8d, %edx
	jg	.L36
	leaq	-4(%rcx,%rax,4), %rax
	.p2align 4,,10
	.p2align 3
.L37:
	movq	%rax, %r9
	movl	(%rax), %r8d
	subq	$4, %rax
	subl	$1, %esi
	cmpl	%edx, %r8d
	jge	.L37
.L36:
	cmpl	%esi, %r11d
	jg	.L33
	movl	%r8d, (%r10)
	subl	$1, %esi
	movl	%edi, (%r9)
	movslq	%esi, %rax
.L35:
	addq	$4, %r10
	addl	$1, %r11d
	jmp	.L34
	.p2align 4,,10
	.p2align 3
.L33:
	movl	%r11d, %eax
	ret
	.cfi_endproc
.LFE25:
	.size	partition, .-partition
	.p2align 4
	.globl	pivot
	.type	pivot, @function
pivot:
.LFB26:
	.cfi_startproc
	endbr64
	leal	1(%rdi), %eax
	cmpl	%esi, %eax
	jg	.L46
	movslq	%edi, %rcx
	cltq
	movl	(%rdx,%rcx,4), %ecx
	jmp	.L42
	.p2align 4,,10
	.p2align 3
.L43:
	addq	$1, %rax
	cmpl	%eax, %esi
	jl	.L46
.L42:
	movl	%eax, %r8d
	cmpl	(%rdx,%rax,4), %ecx
	je	.L43
	cmovge	%edi, %r8d
	movl	%r8d, %eax
	ret
	.p2align 4,,10
	.p2align 3
.L46:
	movl	$-1, %r8d
	movl	%r8d, %eax
	ret
	.cfi_endproc
.LFE26:
	.size	pivot, .-pivot
	.p2align 4
	.globl	swap
	.type	swap, @function
swap:
.LFB27:
	.cfi_startproc
	endbr64
	movslq	%edi, %rdi
	movslq	%esi, %rsi
	leaq	(%rdx,%rdi,4), %rcx
	leaq	(%rdx,%rsi,4), %rax
	movl	(%rcx), %edi
	movl	(%rax), %edx
	movl	%edx, (%rcx)
	movl	%edi, (%rax)
	ret
	.cfi_endproc
.LFE27:
	.size	swap, .-swap
	.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	quicksort
	.type	quicksort, @function
quicksort:
.LFB24:
	.cfi_startproc
	endbr64
	pushq	%r13
	.cfi_def_cfa_offset 16
	.cfi_offset 13, -16
	movl	%edi, %r10d
	pushq	%r12
	.cfi_def_cfa_offset 24
	.cfi_offset 12, -24
	movslq	%esi, %r12
	pushq	%rbp
	.cfi_def_cfa_offset 32
	.cfi_offset 6, -32
	movq	%r12, %rbp
	pushq	%rbx
	.cfi_def_cfa_offset 40
	.cfi_offset 3, -40
	movq	%rdx, %rbx
	subq	$8, %rsp
	.cfi_def_cfa_offset 48
.L11:
	leal	1(%r10), %eax
	cmpl	%eax, %ebp
	jl	.L1
	movslq	%r10d, %r8
	cltq
	movl	(%rbx,%r8,4), %ecx
	jmp	.L3
	.p2align 4,,10
	.p2align 3
.L4:
	addq	$1, %rax
	cmpl	%eax, %ebp
	jl	.L1
.L3:
	movl	(%rbx,%rax,4), %esi
	movl	%eax, %edx
	cmpl	%esi, %ecx
	je	.L4
	cmovge	%r10d, %edx
	cmovge	%ecx, %esi
	cmpl	$-1, %edx
	je	.L1
	movl	%ebp, %ecx
	movq	%r12, %rax
	.p2align 4,,10
	.p2align 3
.L6:
	movl	(%rbx,%r8,4), %r9d
	leaq	(%rbx,%rax,4), %rdi
	movl	%r8d, %r13d
	movl	(%rdi), %edx
	cmpl	%esi, %r9d
	jl	.L7
	cmpl	%edx, %esi
	jg	.L8
	leaq	-4(%rbx,%rax,4), %rax
	.p2align 4,,10
	.p2align 3
.L9:
	movq	%rax, %rdi
	movl	(%rax), %edx
	subq	$4, %rax
	subl	$1, %ecx
	cmpl	%esi, %edx
	jge	.L9
.L8:
	cmpl	%r8d, %ecx
	jl	.L10
	movl	%edx, (%rbx,%r8,4)
	subl	$1, %ecx
	movl	%r9d, (%rdi)
	movslq	%ecx, %rax
.L7:
	addq	$1, %r8
	jmp	.L6
	.p2align 4,,10
	.p2align 3
.L1:
	addq	$8, %rsp
	.cfi_remember_state
	.cfi_def_cfa_offset 40
	popq	%rbx
	.cfi_def_cfa_offset 32
	popq	%rbp
	.cfi_def_cfa_offset 24
	popq	%r12
	.cfi_def_cfa_offset 16
	popq	%r13
	.cfi_def_cfa_offset 8
	ret
	.p2align 4,,10
	.p2align 3
.L10:
	.cfi_restore_state
	movl	%r10d, %edi
	leal	-1(%r13), %esi
	movq	%rbx, %rdx
	call	quicksort
	movl	%r13d, %r10d
	jmp	.L11
	.cfi_endproc
.LFE24:
	.size	quicksort, .-quicksort
	.section	.rodata.str1.1,"aMS",@progbits,1
.LC0:
	.string	"%d %d\n"
.LC1:
	.string	"%d"
.LC2:
	.string	"%ld\n"
	.section	.text.startup,"ax",@progbits
	.p2align 4
	.globl	main
	.type	main, @function
main:
.LFB23:
	.cfi_startproc
	endbr64
	pushq	%r13
	.cfi_def_cfa_offset 16
	.cfi_offset 13, -16
	pushq	%r12
	.cfi_def_cfa_offset 24
	.cfi_offset 12, -24
	pushq	%rbp
	.cfi_def_cfa_offset 32
	.cfi_offset 6, -32
	pushq	%rbx
	.cfi_def_cfa_offset 40
	.cfi_offset 3, -40
	leaq	-798720(%rsp), %r11
	.cfi_def_cfa 11, 798760
.LPSRL0:
	subq	$4096, %rsp
	orq	$0, (%rsp)
	cmpq	%r11, %rsp
	jne	.LPSRL0
	.cfi_def_cfa_register 7
	subq	$1352, %rsp
	.cfi_def_cfa_offset 800112
	leaq	.LC0(%rip), %rdi
	xorl	%ebx, %ebx
	leaq	.LC1(%rip), %r13
	movq	%fs:40, %rax
	movq	%rax, 800056(%rsp)
	xorl	%eax, %eax
	leaq	8(%rsp), %rsi
	leaq	12(%rsp), %rdx
	leaq	16(%rsp), %r12
	movq	%r12, %rbp
	call	__isoc99_scanf@PLT
	movl	8(%rsp), %esi
	testl	%esi, %esi
	jle	.L17
	.p2align 4,,10
	.p2align 3
.L18:
	movq	%rbp, %rsi
	movq	%r13, %rdi
	xorl	%eax, %eax
	addl	$1, %ebx
	call	__isoc99_scanf@PLT
	movl	8(%rsp), %esi
	addq	$4, %rbp
	cmpl	%ebx, %esi
	jg	.L18
.L17:
	subl	$1, %esi
	movq	%r12, %rdx
	xorl	%edi, %edi
	call	quicksort
	movl	8(%rsp), %ecx
	subl	12(%rsp), %ecx
	testl	%ecx, %ecx
	jle	.L25
	leal	-1(%rcx), %eax
	cmpl	$2, %eax
	jbe	.L26
	movl	%ecx, %edx
	pxor	%xmm0, %xmm0
	pxor	%xmm4, %xmm4
	movq	%r12, %rax
	shrl	$2, %edx
	subl	$1, %edx
	salq	$4, %rdx
	leaq	32(%rsp,%rdx), %rdx
	.p2align 4,,10
	.p2align 3
.L21:
	movdqa	(%rax), %xmm1
	movdqa	%xmm4, %xmm2
	addq	$16, %rax
	pcmpgtd	%xmm1, %xmm2
	movdqa	%xmm1, %xmm3
	punpckldq	%xmm2, %xmm3
	punpckhdq	%xmm2, %xmm1
	paddq	%xmm3, %xmm0
	paddq	%xmm1, %xmm0
	cmpq	%rdx, %rax
	jne	.L21
	movdqa	%xmm0, %xmm1
	movl	%ecx, %eax
	psrldq	$8, %xmm1
	andl	$-4, %eax
	paddq	%xmm1, %xmm0
	movq	%xmm0, %rdx
	testb	$3, %cl
	je	.L19
.L20:
	movslq	%eax, %rsi
	movslq	16(%rsp,%rsi,4), %rsi
	addq	%rsi, %rdx
	leal	1(%rax), %esi
	cmpl	%ecx, %esi
	jge	.L19
	movslq	%esi, %rsi
	addl	$2, %eax
	movslq	16(%rsp,%rsi,4), %rsi
	addq	%rsi, %rdx
	cmpl	%eax, %ecx
	jle	.L19
	cltq
	movslq	16(%rsp,%rax,4), %rax
	addq	%rax, %rdx
.L19:
	xorl	%eax, %eax
	leaq	.LC2(%rip), %rsi
	movl	$1, %edi
	call	__printf_chk@PLT
	movq	800056(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L32
	addq	$800072, %rsp
	.cfi_remember_state
	.cfi_def_cfa_offset 40
	xorl	%eax, %eax
	popq	%rbx
	.cfi_def_cfa_offset 32
	popq	%rbp
	.cfi_def_cfa_offset 24
	popq	%r12
	.cfi_def_cfa_offset 16
	popq	%r13
	.cfi_def_cfa_offset 8
	ret
.L25:
	.cfi_restore_state
	xorl	%edx, %edx
	jmp	.L19
.L26:
	xorl	%edx, %edx
	xorl	%eax, %eax
	jmp	.L20
.L32:
	call	__stack_chk_fail@PLT
	.cfi_endproc
.LFE23:
	.size	main, .-main
	.text
	.p2align 4
	.globl	partition
	.type	partition, @function
partition:
.LFB25:
	.cfi_startproc
	endbr64
	movslq	%edi, %rax
	movq	%rax, %r11
	leaq	(%rcx,%rax,4), %r10
	movslq	%esi, %rax
	.p2align 4,,10
	.p2align 3
.L34:
	movl	(%r10), %edi
	leaq	(%rcx,%rax,4), %r9
	movl	(%r9), %r8d
	cmpl	%edx, %edi
	jl	.L35
	cmpl	%r8d, %edx
	jg	.L36
	leaq	-4(%rcx,%rax,4), %rax
	.p2align 4,,10
	.p2align 3
.L37:
	movq	%rax, %r9
	movl	(%rax), %r8d
	subq	$4, %rax
	subl	$1, %esi
	cmpl	%edx, %r8d
	jge	.L37
.L36:
	cmpl	%esi, %r11d
	jg	.L33
	movl	%r8d, (%r10)
	subl	$1, %esi
	movl	%edi, (%r9)
	movslq	%esi, %rax
.L35:
	addq	$4, %r10
	addl	$1, %r11d
	jmp	.L34
	.p2align 4,,10
	.p2align 3
.L33:
	movl	%r11d, %eax
	ret
	.cfi_endproc
.LFE25:
	.size	partition, .-partition
	.p2align 4
	.globl	pivot
	.type	pivot, @function
pivot:
.LFB26:
	.cfi_startproc
	endbr64
	leal	1(%rdi), %eax
	cmpl	%esi, %eax
	jg	.L46
	movslq	%edi, %rcx
	cltq
	movl	(%rdx,%rcx,4), %ecx
	jmp	.L42
	.p2align 4,,10
	.p2align 3
.L43:
	addq	$1, %rax
	cmpl	%eax, %esi
	jl	.L46
.L42:
	movl	%eax, %r8d
	cmpl	(%rdx,%rax,4), %ecx
	je	.L43
	cmovge	%edi, %r8d
	movl	%r8d, %eax
	ret
	.p2align 4,,10
	.p2align 3
.L46:
	movl	$-1, %r8d
	movl	%r8d, %eax
	ret
	.cfi_endproc
.LFE26:
	.size	pivot, .-pivot
	.p2align 4
	.globl	swap
	.type	swap, @function
swap:
.LFB27:
	.cfi_startproc
	endbr64
	movslq	%edi, %rdi
	movslq	%esi, %rsi
	leaq	(%rdx,%rdi,4), %rcx
	leaq	(%rdx,%rsi,4), %rax
	movl	(%rcx), %edi
	movl	(%rax), %edx
	movl	%edx, (%rcx)
	movl	%edi, (%rax)
	ret
	.cfi_endproc
.LFE27:
	.size	swap, .-swap
	.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>

void quicksort(int i,int j,int *A);
int partition(int i,int j,int a,int *A);
int pivot(int i,int j,int *A);
void swap(int i,int j,int *A);

int main(void){
  int N,K,i;
  long total = 0;
  int h[200009];
  scanf("%d %d\n",&N,&K );
  for(i=0; i<N; i++){
    scanf("%d",&h[i] );
  }
  quicksort(0,N-1,h);
  for(i=0;i<N-K;i++ ){
    total += h[i];
  }
  printf("%ld\n",total );
  return 0;
}
void quicksort(int i,int j,int *A){
  int a,pv,k;
  pv = pivot(i,j,A);
  if(pv != -1){
    a = A[pv];
    k = partition(i,j,a,A);
    quicksort(i,k-1,A);
    quicksort(k,j,A);
  }
}
int partition(int i,int j,int a,int *A){
  int l,r,k;
  l = i;
  r = j;
  while(1){
    while(A[l] < a) l++;
    while(A[r] >= a) r--;
    if(l <= r){
      swap(l, r, A);
      l++;
      r--;
    }else break;
  }
  k = l;
  return k;
}
int pivot(int i,int j,int *A){
  int pv,k;
  k = i+1;
  while(k<=j && A[i] == A[k]) k++;
  if(k > j) pv = -1;
  else if(A[i] >= A[k]) pv = i;
  else pv = k;
  return pv;
}
void swap(int i,int j,int *A){
  int tmp;
  tmp = A[i];
  A[i] = A[j];
  A[j] = tmp;
}
3 0
1000000000 1000000000 1010000000
 8 8
7 9 3 2 3 8 4 6
 3 1
0 1 5
 3 0
1000000000 1000000000 1110000000
 3 0
1100000000 1000000000 1110000000
 3 0
1100000000 1000000001 1110000000
 3 0
1100000000 1000000001 1110001000
 3 0
1100000001 1000000001 1110001000
 8 0
4 9 5 2 3 6 5 6
 8 1
4 9 5 2 3 6 5 6

3010000000
 0
 1
 3110000000
 3210000000
 3210000001
 3210001001
 3210001002
 40
 31

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>

void quicksort(int i,int j,int *A);
int partition(int i,int j,int a,int *A);
int pivot(int i,int j,int *A);
void swap(int i,int j,int *A);

int main(void){
  int N,K,i;
  long total = 0;
  int h[200009];
  scanf("%d %d\n",&N,&K );
  for(i=0; i<N; i++){
    scanf("%d",&h[i] );
  }
  quicksort(0,N-1,h);
  for(i=0;i<N-K;i++ ){
    total += h[i];
  }
  printf("%ld\n",total );
  return 0;
}
void quicksort(int i,int j,int *A){
  int a,pv,k;
  pv = pivot(i,j,A);
  if(pv != -1){
    a = A[pv];
    k = partition(i,j,a,A);
    quicksort(i,k-1,A);
    quicksort(k,j,A);
  }
}
int partition(int i,int j,int a,int *A){
  int l,r,k;
  l = i;
  r = j;
  while(1){
    while(A[l] < a) l++;
    while(A[r] >= a) r--;
    if(l <= r){
      swap(l, r, A);
      l++;
      r--;
    }else break;
  }
  k = l;
  return k;
}
int pivot(int i,int j,int *A){
  int pv,k;
  k = i+1;
  while(k<=j && A[i] == A[k]) k++;
  if(k > j) pv = -1;
  else if(A[i] >= A[k]) pv = i;
  else pv = k;
  return pv;
}
void swap(int i,int j,int *A){
  int tmp;
  tmp = A[i];
  A[i] = A[j];
  A[j] = tmp;
}```

Unoptimized Assembly Code:

```assembly
	.file	"temp.c"
	.text
	.section	.rodata
.LC0:
	.string	"%d %d\n"
.LC1:
	.string	"%d"
.LC2:
	.string	"%ld\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
	leaq	-798720(%rsp), %r11
.LPSRL0:
	subq	$4096, %rsp
	orq	$0, (%rsp)
	cmpq	%r11, %rsp
	jne	.LPSRL0
	subq	$1360, %rsp
	movq	%fs:40, %rax
	movq	%rax, -8(%rbp)
	xorl	%eax, %eax
	movq	$0, -800056(%rbp)
	leaq	-800064(%rbp), %rdx
	leaq	-800068(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	$0, -800060(%rbp)
	jmp	.L2
.L3:
	leaq	-800048(%rbp), %rdx
	movl	-800060(%rbp), %eax
	cltq
	salq	$2, %rax
	addq	%rdx, %rax
	movq	%rax, %rsi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	addl	$1, -800060(%rbp)
.L2:
	movl	-800068(%rbp), %eax
	cmpl	%eax, -800060(%rbp)
	jl	.L3
	movl	-800068(%rbp), %eax
	leal	-1(%rax), %ecx
	leaq	-800048(%rbp), %rax
	movq	%rax, %rdx
	movl	%ecx, %esi
	movl	$0, %edi
	call	quicksort
	movl	$0, -800060(%rbp)
	jmp	.L4
.L5:
	movl	-800060(%rbp), %eax
	cltq
	movl	-800048(%rbp,%rax,4), %eax
	cltq
	addq	%rax, -800056(%rbp)
	addl	$1, -800060(%rbp)
.L4:
	movl	-800068(%rbp), %eax
	movl	-800064(%rbp), %edx
	subl	%edx, %eax
	cmpl	%eax, -800060(%rbp)
	jl	.L5
	movq	-800056(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC2(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	movl	$0, %eax
	movq	-8(%rbp), %rdx
	subq	%fs:40, %rdx
	je	.L7
	call	__stack_chk_fail@PLT
.L7:
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE0:
	.size	main, .-main
	.globl	quicksort
	.type	quicksort, @function
quicksort:
.LFB1:
	.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	%esi, -24(%rbp)
	movq	%rdx, -32(%rbp)
	movq	-32(%rbp), %rdx
	movl	-24(%rbp), %ecx
	movl	-20(%rbp), %eax
	movl	%ecx, %esi
	movl	%eax, %edi
	call	pivot
	movl	%eax, -12(%rbp)
	cmpl	$-1, -12(%rbp)
	je	.L10
	movl	-12(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	movq	-32(%rbp), %rax
	addq	%rdx, %rax
	movl	(%rax), %eax
	movl	%eax, -8(%rbp)
	movq	-32(%rbp), %rcx
	movl	-8(%rbp), %edx
	movl	-24(%rbp), %esi
	movl	-20(%rbp), %eax
	movl	%eax, %edi
	call	partition
	movl	%eax, -4(%rbp)
	movl	-4(%rbp), %eax
	leal	-1(%rax), %ecx
	movq	-32(%rbp), %rdx
	movl	-20(%rbp), %eax
	movl	%ecx, %esi
	movl	%eax, %edi
	call	quicksort
	movq	-32(%rbp), %rdx
	movl	-24(%rbp), %ecx
	movl	-4(%rbp), %eax
	movl	%ecx, %esi
	movl	%eax, %edi
	call	quicksort
.L10:
	nop
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE1:
	.size	quicksort, .-quicksort
	.globl	partition
	.type	partition, @function
partition:
.LFB2:
	.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, -20(%rbp)
	movl	%esi, -24(%rbp)
	movl	%edx, -28(%rbp)
	movq	%rcx, -40(%rbp)
	movl	-20(%rbp), %eax
	movl	%eax, -12(%rbp)
	movl	-24(%rbp), %eax
	movl	%eax, -8(%rbp)
	jmp	.L12
.L13:
	addl	$1, -12(%rbp)
.L12:
	movl	-12(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	movq	-40(%rbp), %rax
	addq	%rdx, %rax
	movl	(%rax), %eax
	cmpl	%eax, -28(%rbp)
	jg	.L13
	jmp	.L14
.L15:
	subl	$1, -8(%rbp)
.L14:
	movl	-8(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	movq	-40(%rbp), %rax
	addq	%rdx, %rax
	movl	(%rax), %eax
	cmpl	%eax, -28(%rbp)
	jle	.L15
	movl	-12(%rbp), %eax
	cmpl	-8(%rbp), %eax
	jg	.L21
	movq	-40(%rbp), %rdx
	movl	-8(%rbp), %ecx
	movl	-12(%rbp), %eax
	movl	%ecx, %esi
	movl	%eax, %edi
	call	swap
	addl	$1, -12(%rbp)
	subl	$1, -8(%rbp)
	jmp	.L12
.L21:
	nop
	movl	-12(%rbp), %eax
	movl	%eax, -4(%rbp)
	movl	-4(%rbp), %eax
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE2:
	.size	partition, .-partition
	.globl	pivot
	.type	pivot, @function
pivot:
.LFB3:
	.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)
	movq	%rdx, -32(%rbp)
	movl	-20(%rbp), %eax
	addl	$1, %eax
	movl	%eax, -4(%rbp)
	jmp	.L23
.L25:
	addl	$1, -4(%rbp)
.L23:
	movl	-4(%rbp), %eax
	cmpl	-24(%rbp), %eax
	jg	.L24
	movl	-20(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	movq	-32(%rbp), %rax
	addq	%rdx, %rax
	movl	(%rax), %edx
	movl	-4(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rcx
	movq	-32(%rbp), %rax
	addq	%rcx, %rax
	movl	(%rax), %eax
	cmpl	%eax, %edx
	je	.L25
.L24:
	movl	-4(%rbp), %eax
	cmpl	-24(%rbp), %eax
	jle	.L26
	movl	$-1, -8(%rbp)
	jmp	.L27
.L26:
	movl	-20(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	movq	-32(%rbp), %rax
	addq	%rdx, %rax
	movl	(%rax), %edx
	movl	-4(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rcx
	movq	-32(%rbp), %rax
	addq	%rcx, %rax
	movl	(%rax), %eax
	cmpl	%eax, %edx
	jl	.L28
	movl	-20(%rbp), %eax
	movl	%eax, -8(%rbp)
	jmp	.L27
.L28:
	movl	-4(%rbp), %eax
	movl	%eax, -8(%rbp)
.L27:
	movl	-8(%rbp), %eax
	popq	%rbp
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE3:
	.size	pivot, .-pivot
	.globl	swap
	.type	swap, @function
swap:
.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)
	movq	%rdx, -32(%rbp)
	movl	-20(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	movq	-32(%rbp), %rax
	addq	%rdx, %rax
	movl	(%rax), %eax
	movl	%eax, -4(%rbp)
	movl	-24(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	movq	-32(%rbp), %rax
	addq	%rdx, %rax
	movl	-20(%rbp), %edx
	movslq	%edx, %rdx
	leaq	0(,%rdx,4), %rcx
	movq	-32(%rbp), %rdx
	addq	%rcx, %rdx
	movl	(%rax), %eax
	movl	%eax, (%rdx)
	movl	-24(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	movq	-32(%rbp), %rax
	addq	%rax, %rdx
	movl	-4(%rbp), %eax
	movl	%eax, (%rdx)
	nop
	popq	%rbp
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE4:
	.size	swap, .-swap
	.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
	.section	.rodata
.LC0:
	.string	"%d %d\n"
.LC1:
	.string	"%d"
.LC2:
	.string	"%ld\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
	leaq	-798720(%rsp), %r11
.LPSRL0:
	subq	$4096, %rsp
	orq	$0, (%rsp)
	cmpq	%r11, %rsp
	jne	.LPSRL0
	subq	$1360, %rsp
	movq	%fs:40, %rax
	movq	%rax, -8(%rbp)
	xorl	%eax, %eax
	movq	$0, -800056(%rbp)
	leaq	-800064(%rbp), %rdx
	leaq	-800068(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	$0, -800060(%rbp)
	jmp	.L2
.L3:
	leaq	-800048(%rbp), %rdx
	movl	-800060(%rbp), %eax
	cltq
	salq	$2, %rax
	addq	%rdx, %rax
	movq	%rax, %rsi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	addl	$1, -800060(%rbp)
.L2:
	movl	-800068(%rbp), %eax
	cmpl	%eax, -800060(%rbp)
	jl	.L3
	movl	-800068(%rbp), %eax
	leal	-1(%rax), %ecx
	leaq	-800048(%rbp), %rax
	movq	%rax, %rdx
	movl	%ecx, %esi
	movl	$0, %edi
	call	quicksort
	movl	$0, -800060(%rbp)
	jmp	.L4
.L5:
	movl	-800060(%rbp), %eax
	cltq
	movl	-800048(%rbp,%rax,4), %eax
	cltq
	addq	%rax, -800056(%rbp)
	addl	$1, -800060(%rbp)
.L4:
	movl	-800068(%rbp), %eax
	movl	-800064(%rbp), %edx
	subl	%edx, %eax
	cmpl	%eax, -800060(%rbp)
	jl	.L5
	movq	-800056(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC2(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	movl	$0, %eax
	movq	-8(%rbp), %rdx
	subq	%fs:40, %rdx
	je	.L7
	call	__stack_chk_fail@PLT
.L7:
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE0:
	.size	main, .-main
	.globl	quicksort
	.type	quicksort, @function
quicksort:
.LFB1:
	.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	%esi, -24(%rbp)
	movq	%rdx, -32(%rbp)
	movq	-32(%rbp), %rdx
	movl	-24(%rbp), %ecx
	movl	-20(%rbp), %eax
	movl	%ecx, %esi
	movl	%eax, %edi
	call	pivot
	movl	%eax, -12(%rbp)
	cmpl	$-1, -12(%rbp)
	je	.L10
	movl	-12(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	movq	-32(%rbp), %rax
	addq	%rdx, %rax
	movl	(%rax), %eax
	movl	%eax, -8(%rbp)
	movq	-32(%rbp), %rcx
	movl	-8(%rbp), %edx
	movl	-24(%rbp), %esi
	movl	-20(%rbp), %eax
	movl	%eax, %edi
	call	partition
	movl	%eax, -4(%rbp)
	movl	-4(%rbp), %eax
	leal	-1(%rax), %ecx
	movq	-32(%rbp), %rdx
	movl	-20(%rbp), %eax
	movl	%ecx, %esi
	movl	%eax, %edi
	call	quicksort
	movq	-32(%rbp), %rdx
	movl	-24(%rbp), %ecx
	movl	-4(%rbp), %eax
	movl	%ecx, %esi
	movl	%eax, %edi
	call	quicksort
.L10:
	nop
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE1:
	.size	quicksort, .-quicksort
	.globl	partition
	.type	partition, @function
partition:
.LFB2:
	.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, -20(%rbp)
	movl	%esi, -24(%rbp)
	movl	%edx, -28(%rbp)
	movq	%rcx, -40(%rbp)
	movl	-20(%rbp), %eax
	movl	%eax, -12(%rbp)
	movl	-24(%rbp), %eax
	movl	%eax, -8(%rbp)
	jmp	.L12
.L13:
	addl	$1, -12(%rbp)
.L12:
	movl	-12(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	movq	-40(%rbp), %rax
	addq	%rdx, %rax
	movl	(%rax), %eax
	cmpl	%eax, -28(%rbp)
	jg	.L13
	jmp	.L14
.L15:
	subl	$1, -8(%rbp)
.L14:
	movl	-8(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	movq	-40(%rbp), %rax
	addq	%rdx, %rax
	movl	(%rax), %eax
	cmpl	%eax, -28(%rbp)
	jle	.L15
	movl	-12(%rbp), %eax
	cmpl	-8(%rbp), %eax
	jg	.L21
	movq	-40(%rbp), %rdx
	movl	-8(%rbp), %ecx
	movl	-12(%rbp), %eax
	movl	%ecx, %esi
	movl	%eax, %edi
	call	swap
	addl	$1, -12(%rbp)
	subl	$1, -8(%rbp)
	jmp	.L12
.L21:
	nop
	movl	-12(%rbp), %eax
	movl	%eax, -4(%rbp)
	movl	-4(%rbp), %eax
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE2:
	.size	partition, .-partition
	.globl	pivot
	.type	pivot, @function
pivot:
.LFB3:
	.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)
	movq	%rdx, -32(%rbp)
	movl	-20(%rbp), %eax
	addl	$1, %eax
	movl	%eax, -4(%rbp)
	jmp	.L23
.L25:
	addl	$1, -4(%rbp)
.L23:
	movl	-4(%rbp), %eax
	cmpl	-24(%rbp), %eax
	jg	.L24
	movl	-20(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	movq	-32(%rbp), %rax
	addq	%rdx, %rax
	movl	(%rax), %edx
	movl	-4(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rcx
	movq	-32(%rbp), %rax
	addq	%rcx, %rax
	movl	(%rax), %eax
	cmpl	%eax, %edx
	je	.L25
.L24:
	movl	-4(%rbp), %eax
	cmpl	-24(%rbp), %eax
	jle	.L26
	movl	$-1, -8(%rbp)
	jmp	.L27
.L26:
	movl	-20(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	movq	-32(%rbp), %rax
	addq	%rdx, %rax
	movl	(%rax), %edx
	movl	-4(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rcx
	movq	-32(%rbp), %rax
	addq	%rcx, %rax
	movl	(%rax), %eax
	cmpl	%eax, %edx
	jl	.L28
	movl	-20(%rbp), %eax
	movl	%eax, -8(%rbp)
	jmp	.L27
.L28:
	movl	-4(%rbp), %eax
	movl	%eax, -8(%rbp)
.L27:
	movl	-8(%rbp), %eax
	popq	%rbp
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE3:
	.size	pivot, .-pivot
	.globl	swap
	.type	swap, @function
swap:
.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)
	movq	%rdx, -32(%rbp)
	movl	-20(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	movq	-32(%rbp), %rax
	addq	%rdx, %rax
	movl	(%rax), %eax
	movl	%eax, -4(%rbp)
	movl	-24(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	movq	-32(%rbp), %rax
	addq	%rdx, %rax
	movl	-20(%rbp), %edx
	movslq	%edx, %rdx
	leaq	0(,%rdx,4), %rcx
	movq	-32(%rbp), %rdx
	addq	%rcx, %rdx
	movl	(%rax), %eax
	movl	%eax, (%rdx)
	movl	-24(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	movq	-32(%rbp), %rax
	addq	%rax, %rdx
	movl	-4(%rbp), %eax
	movl	%eax, (%rdx)
	nop
	popq	%rbp
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE4:
	.size	swap, .-swap
	.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:
