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>

int nextInt();
char compare(int x, int y);
int med3(int x, int y, int z);
void quickSort(int *a, int left, int right);
void sort(int *a, int size);

int N, i;
int A[100000], B[100000], C[100000];
long long int a, b;

int main(){
	N=nextInt();
	for(i=0; i<N; i++){
		A[i]=nextInt();
		B[i]=nextInt();
		C[i] = A[i] + B[i];
		b += B[i];
	}
	sort(C, N);
	for(i=0; i<N; i++){
		if(i%2 == 0){
			a += C[N-i-1];
		}
	}
	printf("%lld\n", a-b);
	return 0;
}

int nextInt(){
	int f=0; char c=getchar();
	while((c<'0')||('9'<c)){c=getchar();}
	while((c>='0')&&(c<='9')){f=f*10+(c-'0'); c=getchar();}
	return f;
}

char compare(int x, int y){
	return x < y;
}

int med3(int x, int y, int z){
	if(compare(x, y)){
		if (compare(y, z)){return y;}else if(compare(z, x)){return x;}else{return z;}
	} else {
		if (compare(z, y)){return y;}else if(compare(x, z)){return x;}else{return z;}
	}
}

void quickSort(int *a, int left, int right){
	if(left >= right){return;}
	int pivot = med3(a[left], a[left+(right-left)/2], a[right]);
	int l=left, r=right;
	int t;
	while(1){
		while (compare(a[l], pivot)){l++;}
		while (compare(pivot, a[r])){r--;}
		if(l>=r){break;}
		t=a[l]; a[l]=a[r]; a[r]=t;
		l++; r--;
	}
	quickSort(a, left, l-1);
	quickSort(a, r+1, right);
}

void sort(int *a, int size){
	quickSort(a, 0, size-1);
}
```

Unoptimized Assembly Code:

```assembly
	.file	"temp.c"
	.text
	.globl	N
	.bss
	.align 4
	.type	N, @object
	.size	N, 4
N:
	.zero	4
	.globl	i
	.align 4
	.type	i, @object
	.size	i, 4
i:
	.zero	4
	.globl	A
	.align 32
	.type	A, @object
	.size	A, 400000
A:
	.zero	400000
	.globl	B
	.align 32
	.type	B, @object
	.size	B, 400000
B:
	.zero	400000
	.globl	C
	.align 32
	.type	C, @object
	.size	C, 400000
C:
	.zero	400000
	.globl	a
	.align 8
	.type	a, @object
	.size	a, 8
a:
	.zero	8
	.globl	b
	.align 8
	.type	b, @object
	.size	b, 8
b:
	.zero	8
	.section	.rodata
.LC0:
	.string	"%lld\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
	pushq	%rbx
	subq	$8, %rsp
	.cfi_offset 3, -24
	movl	$0, %eax
	call	nextInt
	movl	%eax, N(%rip)
	movl	$0, i(%rip)
	jmp	.L2
.L3:
	movl	i(%rip), %ebx
	movl	$0, %eax
	call	nextInt
	movslq	%ebx, %rdx
	leaq	0(,%rdx,4), %rcx
	leaq	A(%rip), %rdx
	movl	%eax, (%rcx,%rdx)
	movl	i(%rip), %ebx
	movl	$0, %eax
	call	nextInt
	movslq	%ebx, %rdx
	leaq	0(,%rdx,4), %rcx
	leaq	B(%rip), %rdx
	movl	%eax, (%rcx,%rdx)
	movl	i(%rip), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	A(%rip), %rax
	movl	(%rdx,%rax), %ecx
	movl	i(%rip), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	B(%rip), %rax
	movl	(%rdx,%rax), %edx
	movl	i(%rip), %eax
	addl	%edx, %ecx
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	C(%rip), %rax
	movl	%ecx, (%rdx,%rax)
	movl	i(%rip), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	B(%rip), %rax
	movl	(%rdx,%rax), %eax
	movslq	%eax, %rdx
	movq	b(%rip), %rax
	addq	%rdx, %rax
	movq	%rax, b(%rip)
	movl	i(%rip), %eax
	addl	$1, %eax
	movl	%eax, i(%rip)
.L2:
	movl	i(%rip), %edx
	movl	N(%rip), %eax
	cmpl	%eax, %edx
	jl	.L3
	movl	N(%rip), %eax
	movl	%eax, %esi
	leaq	C(%rip), %rax
	movq	%rax, %rdi
	call	sort
	movl	$0, i(%rip)
	jmp	.L4
.L6:
	movl	i(%rip), %eax
	andl	$1, %eax
	testl	%eax, %eax
	jne	.L5
	movl	N(%rip), %eax
	movl	i(%rip), %edx
	subl	%edx, %eax
	subl	$1, %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	C(%rip), %rax
	movl	(%rdx,%rax), %eax
	movslq	%eax, %rdx
	movq	a(%rip), %rax
	addq	%rdx, %rax
	movq	%rax, a(%rip)
.L5:
	movl	i(%rip), %eax
	addl	$1, %eax
	movl	%eax, i(%rip)
.L4:
	movl	i(%rip), %edx
	movl	N(%rip), %eax
	cmpl	%eax, %edx
	jl	.L6
	movq	a(%rip), %rax
	movq	b(%rip), %rdx
	subq	%rdx, %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	movl	$0, %eax
	movq	-8(%rbp), %rbx
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE0:
	.size	main, .-main
	.globl	nextInt
	.type	nextInt, @function
nextInt:
.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	$0, -4(%rbp)
	call	getchar@PLT
	movb	%al, -5(%rbp)
	jmp	.L9
.L10:
	call	getchar@PLT
	movb	%al, -5(%rbp)
.L9:
	cmpb	$47, -5(%rbp)
	jle	.L10
	cmpb	$57, -5(%rbp)
	jg	.L10
	jmp	.L11
.L13:
	movl	-4(%rbp), %edx
	movl	%edx, %eax
	sall	$2, %eax
	addl	%edx, %eax
	addl	%eax, %eax
	movl	%eax, %edx
	movsbl	-5(%rbp), %eax
	subl	$48, %eax
	addl	%edx, %eax
	movl	%eax, -4(%rbp)
	call	getchar@PLT
	movb	%al, -5(%rbp)
.L11:
	cmpb	$47, -5(%rbp)
	jle	.L12
	cmpb	$57, -5(%rbp)
	jle	.L13
.L12:
	movl	-4(%rbp), %eax
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE1:
	.size	nextInt, .-nextInt
	.globl	compare
	.type	compare, @function
compare:
.LFB2:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	movl	%edi, -4(%rbp)
	movl	%esi, -8(%rbp)
	movl	-4(%rbp), %eax
	cmpl	-8(%rbp), %eax
	setl	%al
	popq	%rbp
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE2:
	.size	compare, .-compare
	.globl	med3
	.type	med3, @function
med3:
.LFB3:
	.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	%esi, -8(%rbp)
	movl	%edx, -12(%rbp)
	movl	-8(%rbp), %edx
	movl	-4(%rbp), %eax
	movl	%edx, %esi
	movl	%eax, %edi
	call	compare
	testb	%al, %al
	je	.L18
	movl	-12(%rbp), %edx
	movl	-8(%rbp), %eax
	movl	%edx, %esi
	movl	%eax, %edi
	call	compare
	testb	%al, %al
	je	.L19
	movl	-8(%rbp), %eax
	jmp	.L20
.L19:
	movl	-4(%rbp), %edx
	movl	-12(%rbp), %eax
	movl	%edx, %esi
	movl	%eax, %edi
	call	compare
	testb	%al, %al
	je	.L21
	movl	-4(%rbp), %eax
	jmp	.L20
.L21:
	movl	-12(%rbp), %eax
	jmp	.L20
.L18:
	movl	-8(%rbp), %edx
	movl	-12(%rbp), %eax
	movl	%edx, %esi
	movl	%eax, %edi
	call	compare
	testb	%al, %al
	je	.L22
	movl	-8(%rbp), %eax
	jmp	.L20
.L22:
	movl	-12(%rbp), %edx
	movl	-4(%rbp), %eax
	movl	%edx, %esi
	movl	%eax, %edi
	call	compare
	testb	%al, %al
	je	.L23
	movl	-4(%rbp), %eax
	jmp	.L20
.L23:
	movl	-12(%rbp), %eax
.L20:
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE3:
	.size	med3, .-med3
	.globl	quickSort
	.type	quickSort, @function
quickSort:
.LFB4:
	.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)
	movl	%esi, -28(%rbp)
	movl	%edx, -32(%rbp)
	movl	-28(%rbp), %eax
	cmpl	-32(%rbp), %eax
	jge	.L35
	movl	-32(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	movq	-24(%rbp), %rax
	addq	%rdx, %rax
	movl	(%rax), %edx
	movl	-32(%rbp), %eax
	subl	-28(%rbp), %eax
	movl	%eax, %ecx
	shrl	$31, %ecx
	addl	%ecx, %eax
	sarl	%eax
	movl	%eax, %ecx
	movl	-28(%rbp), %eax
	addl	%ecx, %eax
	cltq
	leaq	0(,%rax,4), %rcx
	movq	-24(%rbp), %rax
	addq	%rcx, %rax
	movl	(%rax), %ecx
	movl	-28(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rsi
	movq	-24(%rbp), %rax
	addq	%rsi, %rax
	movl	(%rax), %eax
	movl	%ecx, %esi
	movl	%eax, %edi
	call	med3
	movl	%eax, -8(%rbp)
	movl	-28(%rbp), %eax
	movl	%eax, -16(%rbp)
	movl	-32(%rbp), %eax
	movl	%eax, -12(%rbp)
	jmp	.L27
.L28:
	addl	$1, -16(%rbp)
.L27:
	movl	-16(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	movq	-24(%rbp), %rax
	addq	%rdx, %rax
	movl	(%rax), %eax
	movl	-8(%rbp), %edx
	movl	%edx, %esi
	movl	%eax, %edi
	call	compare
	testb	%al, %al
	jne	.L28
	jmp	.L29
.L30:
	subl	$1, -12(%rbp)
.L29:
	movl	-12(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	movq	-24(%rbp), %rax
	addq	%rdx, %rax
	movl	(%rax), %edx
	movl	-8(%rbp), %eax
	movl	%edx, %esi
	movl	%eax, %edi
	call	compare
	testb	%al, %al
	jne	.L30
	movl	-16(%rbp), %eax
	cmpl	-12(%rbp), %eax
	jge	.L36
	movl	-16(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	movq	-24(%rbp), %rax
	addq	%rdx, %rax
	movl	(%rax), %eax
	movl	%eax, -4(%rbp)
	movl	-12(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	movq	-24(%rbp), %rax
	addq	%rdx, %rax
	movl	-16(%rbp), %edx
	movslq	%edx, %rdx
	leaq	0(,%rdx,4), %rcx
	movq	-24(%rbp), %rdx
	addq	%rcx, %rdx
	movl	(%rax), %eax
	movl	%eax, (%rdx)
	movl	-12(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	movq	-24(%rbp), %rax
	addq	%rax, %rdx
	movl	-4(%rbp), %eax
	movl	%eax, (%rdx)
	addl	$1, -16(%rbp)
	subl	$1, -12(%rbp)
	jmp	.L27
.L36:
	nop
	movl	-16(%rbp), %eax
	leal	-1(%rax), %edx
	movl	-28(%rbp), %ecx
	movq	-24(%rbp), %rax
	movl	%ecx, %esi
	movq	%rax, %rdi
	call	quickSort
	movl	-12(%rbp), %eax
	leal	1(%rax), %ecx
	movl	-32(%rbp), %edx
	movq	-24(%rbp), %rax
	movl	%ecx, %esi
	movq	%rax, %rdi
	call	quickSort
	jmp	.L24
.L35:
	nop
.L24:
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE4:
	.size	quickSort, .-quickSort
	.globl	sort
	.type	sort, @function
sort:
.LFB5:
	.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)
	movl	%esi, -12(%rbp)
	movl	-12(%rbp), %eax
	leal	-1(%rax), %edx
	movq	-8(%rbp), %rax
	movl	$0, %esi
	movq	%rax, %rdi
	call	quickSort
	nop
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE5:
	.size	sort, .-sort
	.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	nextInt
	.type	nextInt, @function
nextInt:
.LFB24:
	.cfi_startproc
	endbr64
	pushq	%r12
	.cfi_def_cfa_offset 16
	.cfi_offset 12, -16
	.p2align 4,,10
	.p2align 3
.L10:
	movq	stdin(%rip), %rdi
	call	getc@PLT
	leal	-48(%rax), %edx
	cmpb	$9, %dl
	ja	.L10
	movl	%eax, %edx
	xorl	%r12d, %r12d
	.p2align 4,,10
	.p2align 3
.L5:
	movq	stdin(%rip), %rdi
	subl	$48, %edx
	leal	(%r12,%r12,4), %eax
	movsbl	%dl, %edx
	leal	(%rdx,%rax,2), %r12d
	call	getc@PLT
	movl	%eax, %edx
	subl	$48, %eax
	cmpb	$9, %al
	jbe	.L5
	movl	%r12d, %eax
	popq	%r12
	.cfi_def_cfa_offset 8
	ret
	.cfi_endproc
.LFE24:
	.size	nextInt, .-nextInt
	.p2align 4
	.globl	compare
	.type	compare, @function
compare:
.LFB25:
	.cfi_startproc
	endbr64
	cmpl	%esi, %edi
	setl	%al
	ret
	.cfi_endproc
.LFE25:
	.size	compare, .-compare
	.p2align 4
	.globl	med3
	.type	med3, @function
med3:
.LFB26:
	.cfi_startproc
	endbr64
	cmpl	%esi, %edi
	jge	.L14
	cmpl	%edx, %edi
	movl	%esi, %eax
	cmovl	%edx, %edi
	cmpl	%edx, %esi
	cmovge	%edi, %eax
	ret
	.p2align 4,,10
	.p2align 3
.L14:
	cmpl	%edx, %edi
	movl	%esi, %eax
	cmovg	%edx, %edi
	cmpl	%edx, %esi
	cmovle	%edi, %eax
	ret
	.cfi_endproc
.LFE26:
	.size	med3, .-med3
	.p2align 4
	.globl	quickSort
	.type	quickSort, @function
quickSort:
.LFB27:
	.cfi_startproc
	endbr64
	cmpl	%esi, %edx
	jle	.L32
	pushq	%r14
	.cfi_def_cfa_offset 16
	.cfi_offset 14, -16
	movl	%esi, %r9d
	movq	%rdi, %r14
	pushq	%r13
	.cfi_def_cfa_offset 24
	.cfi_offset 13, -24
	movl	%edx, %r13d
	pushq	%r12
	.cfi_def_cfa_offset 32
	.cfi_offset 12, -32
	pushq	%rbp
	.cfi_def_cfa_offset 40
	.cfi_offset 6, -40
	movslq	%edx, %rbp
	pushq	%rbx
	.cfi_def_cfa_offset 48
	.cfi_offset 3, -48
	leaq	(%rdi,%rbp,4), %r12
.L29:
	movl	%r13d, %eax
	movl	(%r12), %edx
	subl	%r9d, %eax
	sarl	%eax
	addl	%r9d, %eax
	cltq
	movl	(%r14,%rax,4), %ecx
	movslq	%r9d, %rax
	leaq	(%r14,%rax,4), %rdi
	movl	(%rdi), %eax
	cmpl	%eax, %ecx
	jle	.L20
	cmpl	%eax, %edx
	cmovge	%edx, %eax
	cmpl	%ecx, %edx
	cmovle	%eax, %ecx
.L21:
	movl	%r9d, %r8d
	movl	%r13d, %ebx
	movq	%rbp, %rax
	.p2align 4,,10
	.p2align 3
.L22:
	movl	(%rdi), %r10d
	cmpl	%ecx, %r10d
	jl	.L23
	cmpl	%edx, %ecx
	jge	.L24
	leaq	-4(%r14,%rax,4), %rax
	.p2align 4,,10
	.p2align 3
.L25:
	movq	%rax, %rsi
	movl	(%rax), %edx
	subq	$4, %rax
	subl	$1, %ebx
	cmpl	%ecx, %edx
	jg	.L25
	cmpl	%ebx, %r8d
	jge	.L27
.L35:
	subl	$1, %ebx
	movl	%edx, (%rdi)
	movslq	%ebx, %rax
	movl	%r10d, (%rsi)
	movl	(%r14,%rax,4), %edx
.L23:
	addq	$4, %rdi
	addl	$1, %r8d
	jmp	.L22
	.p2align 4,,10
	.p2align 3
.L24:
	leaq	(%r14,%rax,4), %rsi
	cmpl	%ebx, %r8d
	jl	.L35
	.p2align 4,,10
	.p2align 3
.L27:
	movl	%r9d, %esi
	leal	-1(%r8), %edx
	movq	%r14, %rdi
	call	quickSort
	leal	1(%rbx), %r9d
	cmpl	%r13d, %r9d
	jl	.L29
	popq	%rbx
	.cfi_remember_state
	.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
.L20:
	.cfi_restore_state
	cmpl	%eax, %edx
	cmovle	%edx, %eax
	cmpl	%ecx, %edx
	cmovge	%eax, %ecx
	jmp	.L21
.L32:
	.cfi_def_cfa_offset 8
	.cfi_restore 3
	.cfi_restore 6
	.cfi_restore 12
	.cfi_restore 13
	.cfi_restore 14
	ret
	.cfi_endproc
.LFE27:
	.size	quickSort, .-quickSort
	.section	.rodata.str1.1,"aMS",@progbits,1
.LC0:
	.string	"%lld\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
	xorl	%eax, %eax
	pushq	%r13
	.cfi_def_cfa_offset 24
	.cfi_offset 13, -24
	pushq	%r12
	.cfi_def_cfa_offset 32
	.cfi_offset 12, -32
	pushq	%rbp
	.cfi_def_cfa_offset 40
	.cfi_offset 6, -40
	pushq	%rbx
	.cfi_def_cfa_offset 48
	.cfi_offset 3, -48
	call	nextInt
	movl	$0, i(%rip)
	movl	%eax, N(%rip)
	testl	%eax, %eax
	jle	.L37
	xorl	%ebx, %ebx
	leaq	A(%rip), %r12
	leaq	B(%rip), %rbp
	leaq	C(%rip), %r13
	.p2align 4,,10
	.p2align 3
.L46:
	movq	stdin(%rip), %rdi
	call	getc@PLT
	leal	-48(%rax), %edx
	cmpb	$9, %dl
	ja	.L46
	movl	%eax, %edx
	xorl	%r14d, %r14d
	.p2align 4,,10
	.p2align 3
.L41:
	movq	stdin(%rip), %rdi
	subl	$48, %edx
	leal	(%r14,%r14,4), %eax
	movsbl	%dl, %edx
	leal	(%rdx,%rax,2), %r14d
	call	getc@PLT
	movl	%eax, %edx
	subl	$48, %eax
	cmpb	$9, %al
	jbe	.L41
	movslq	%ebx, %rbx
	movl	%r14d, (%r12,%rbx,4)
	movslq	i(%rip), %rbx
	.p2align 4,,10
	.p2align 3
.L65:
	movq	stdin(%rip), %rdi
	call	getc@PLT
	leal	-48(%rax), %edx
	cmpb	$9, %dl
	ja	.L65
	movl	%eax, %edx
	xorl	%r14d, %r14d
	.p2align 4,,10
	.p2align 3
.L45:
	movq	stdin(%rip), %rdi
	subl	$48, %edx
	leal	(%r14,%r14,4), %eax
	movsbl	%dl, %edx
	leal	(%rdx,%rax,2), %r14d
	call	getc@PLT
	movl	%eax, %edx
	subl	$48, %eax
	cmpb	$9, %al
	jbe	.L45
	movslq	i(%rip), %rdx
	movl	%r14d, 0(%rbp,%rbx,4)
	movl	N(%rip), %eax
	movslq	0(%rbp,%rdx,4), %r11
	movl	(%r12,%rdx,4), %ecx
	movq	%rdx, %rbx
	addl	$1, %ebx
	addl	%r11d, %ecx
	addq	b(%rip), %r11
	movl	%ebx, i(%rip)
	movl	%ecx, 0(%r13,%rdx,4)
	movq	%r11, b(%rip)
	cmpl	%eax, %ebx
	jl	.L46
.L47:
	leal	-1(%rax), %edx
	xorl	%esi, %esi
	movq	%r13, %rdi
	call	quickSort
	movl	N(%rip), %r9d
	movq	a(%rip), %rdx
	xorl	%r8d, %r8d
	movl	$0, i(%rip)
	leal	-1(%r9), %edi
	movq	%rdx, %rsi
	movl	%edi, %eax
	testl	%r9d, %r9d
	jle	.L49
	.p2align 4,,10
	.p2align 3
.L51:
	movl	%edi, %ecx
	subl	%eax, %ecx
	andl	$1, %ecx
	jne	.L50
	movslq	%eax, %rcx
	movl	$1, %r8d
	movslq	0(%r13,%rcx,4), %rcx
	addq	%rcx, %rsi
.L50:
	subl	$1, %eax
	jnb	.L51
	movl	%r9d, i(%rip)
	testb	%r8b, %r8b
	je	.L49
	movq	%rsi, a(%rip)
	movq	%rsi, %rdx
.L49:
	subq	%r11, %rdx
	leaq	.LC0(%rip), %rsi
	movl	$1, %edi
	xorl	%eax, %eax
	call	__printf_chk@PLT
	popq	%rbx
	.cfi_remember_state
	.cfi_def_cfa_offset 40
	xorl	%eax, %eax
	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
.L37:
	.cfi_restore_state
	movq	b(%rip), %r11
	leaq	C(%rip), %r13
	jmp	.L47
	.cfi_endproc
.LFE23:
	.size	main, .-main
	.text
	.p2align 4
	.globl	sort
	.type	sort, @function
sort:
.LFB28:
	.cfi_startproc
	endbr64
	leal	-1(%rsi), %edx
	xorl	%esi, %esi
	jmp	quickSort
	.cfi_endproc
.LFE28:
	.size	sort, .-sort
	.globl	b
	.bss
	.align 8
	.type	b, @object
	.size	b, 8
b:
	.zero	8
	.globl	a
	.align 8
	.type	a, @object
	.size	a, 8
a:
	.zero	8
	.globl	C
	.align 32
	.type	C, @object
	.size	C, 400000
C:
	.zero	400000
	.globl	B
	.align 32
	.type	B, @object
	.size	B, 400000
B:
	.zero	400000
	.globl	A
	.align 32
	.type	A, @object
	.size	A, 400000
A:
	.zero	400000
	.globl	i
	.align 4
	.type	i, @object
	.size	i, 4
i:
	.zero	4
	.globl	N
	.align 4
	.type	N, @object
	.size	N, 4
N:
	.zero	4
	.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	nextInt
	.type	nextInt, @function
nextInt:
.LFB24:
	.cfi_startproc
	endbr64
	pushq	%r12
	.cfi_def_cfa_offset 16
	.cfi_offset 12, -16
	.p2align 4,,10
	.p2align 3
.L10:
	movq	stdin(%rip), %rdi
	call	getc@PLT
	leal	-48(%rax), %edx
	cmpb	$9, %dl
	ja	.L10
	movl	%eax, %edx
	xorl	%r12d, %r12d
	.p2align 4,,10
	.p2align 3
.L5:
	movq	stdin(%rip), %rdi
	subl	$48, %edx
	leal	(%r12,%r12,4), %eax
	movsbl	%dl, %edx
	leal	(%rdx,%rax,2), %r12d
	call	getc@PLT
	movl	%eax, %edx
	subl	$48, %eax
	cmpb	$9, %al
	jbe	.L5
	movl	%r12d, %eax
	popq	%r12
	.cfi_def_cfa_offset 8
	ret
	.cfi_endproc
.LFE24:
	.size	nextInt, .-nextInt
	.p2align 4
	.globl	compare
	.type	compare, @function
compare:
.LFB25:
	.cfi_startproc
	endbr64
	cmpl	%esi, %edi
	setl	%al
	ret
	.cfi_endproc
.LFE25:
	.size	compare, .-compare
	.p2align 4
	.globl	med3
	.type	med3, @function
med3:
.LFB26:
	.cfi_startproc
	endbr64
	cmpl	%esi, %edi
	jge	.L14
	cmpl	%edx, %edi
	movl	%esi, %eax
	cmovl	%edx, %edi
	cmpl	%edx, %esi
	cmovge	%edi, %eax
	ret
	.p2align 4,,10
	.p2align 3
.L14:
	cmpl	%edx, %edi
	movl	%esi, %eax
	cmovg	%edx, %edi
	cmpl	%edx, %esi
	cmovle	%edi, %eax
	ret
	.cfi_endproc
.LFE26:
	.size	med3, .-med3
	.p2align 4
	.globl	quickSort
	.type	quickSort, @function
quickSort:
.LFB27:
	.cfi_startproc
	endbr64
	cmpl	%esi, %edx
	jle	.L32
	pushq	%r14
	.cfi_def_cfa_offset 16
	.cfi_offset 14, -16
	movl	%esi, %r9d
	movq	%rdi, %r14
	pushq	%r13
	.cfi_def_cfa_offset 24
	.cfi_offset 13, -24
	movl	%edx, %r13d
	pushq	%r12
	.cfi_def_cfa_offset 32
	.cfi_offset 12, -32
	pushq	%rbp
	.cfi_def_cfa_offset 40
	.cfi_offset 6, -40
	movslq	%edx, %rbp
	pushq	%rbx
	.cfi_def_cfa_offset 48
	.cfi_offset 3, -48
	leaq	(%rdi,%rbp,4), %r12
.L29:
	movl	%r13d, %eax
	movl	(%r12), %edx
	subl	%r9d, %eax
	sarl	%eax
	addl	%r9d, %eax
	cltq
	movl	(%r14,%rax,4), %ecx
	movslq	%r9d, %rax
	leaq	(%r14,%rax,4), %rdi
	movl	(%rdi), %eax
	cmpl	%eax, %ecx
	jle	.L20
	cmpl	%eax, %edx
	cmovge	%edx, %eax
	cmpl	%ecx, %edx
	cmovle	%eax, %ecx
.L21:
	movl	%r9d, %r8d
	movl	%r13d, %ebx
	movq	%rbp, %rax
	.p2align 4,,10
	.p2align 3
.L22:
	movl	(%rdi), %r10d
	cmpl	%ecx, %r10d
	jl	.L23
	cmpl	%edx, %ecx
	jge	.L24
	leaq	-4(%r14,%rax,4), %rax
	.p2align 4,,10
	.p2align 3
.L25:
	movq	%rax, %rsi
	movl	(%rax), %edx
	subq	$4, %rax
	subl	$1, %ebx
	cmpl	%ecx, %edx
	jg	.L25
	cmpl	%ebx, %r8d
	jge	.L27
.L35:
	subl	$1, %ebx
	movl	%edx, (%rdi)
	movslq	%ebx, %rax
	movl	%r10d, (%rsi)
	movl	(%r14,%rax,4), %edx
.L23:
	addq	$4, %rdi
	addl	$1, %r8d
	jmp	.L22
	.p2align 4,,10
	.p2align 3
.L24:
	leaq	(%r14,%rax,4), %rsi
	cmpl	%ebx, %r8d
	jl	.L35
	.p2align 4,,10
	.p2align 3
.L27:
	movl	%r9d, %esi
	leal	-1(%r8), %edx
	movq	%r14, %rdi
	call	quickSort
	leal	1(%rbx), %r9d
	cmpl	%r13d, %r9d
	jl	.L29
	popq	%rbx
	.cfi_remember_state
	.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
.L20:
	.cfi_restore_state
	cmpl	%eax, %edx
	cmovle	%edx, %eax
	cmpl	%ecx, %edx
	cmovge	%eax, %ecx
	jmp	.L21
.L32:
	.cfi_def_cfa_offset 8
	.cfi_restore 3
	.cfi_restore 6
	.cfi_restore 12
	.cfi_restore 13
	.cfi_restore 14
	ret
	.cfi_endproc
.LFE27:
	.size	quickSort, .-quickSort
	.section	.rodata.str1.1,"aMS",@progbits,1
.LC0:
	.string	"%lld\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
	xorl	%eax, %eax
	pushq	%r13
	.cfi_def_cfa_offset 24
	.cfi_offset 13, -24
	pushq	%r12
	.cfi_def_cfa_offset 32
	.cfi_offset 12, -32
	pushq	%rbp
	.cfi_def_cfa_offset 40
	.cfi_offset 6, -40
	pushq	%rbx
	.cfi_def_cfa_offset 48
	.cfi_offset 3, -48
	call	nextInt
	movl	$0, i(%rip)
	movl	%eax, N(%rip)
	testl	%eax, %eax
	jle	.L37
	xorl	%ebx, %ebx
	leaq	A(%rip), %r12
	leaq	B(%rip), %rbp
	leaq	C(%rip), %r13
	.p2align 4,,10
	.p2align 3
.L46:
	movq	stdin(%rip), %rdi
	call	getc@PLT
	leal	-48(%rax), %edx
	cmpb	$9, %dl
	ja	.L46
	movl	%eax, %edx
	xorl	%r14d, %r14d
	.p2align 4,,10
	.p2align 3
.L41:
	movq	stdin(%rip), %rdi
	subl	$48, %edx
	leal	(%r14,%r14,4), %eax
	movsbl	%dl, %edx
	leal	(%rdx,%rax,2), %r14d
	call	getc@PLT
	movl	%eax, %edx
	subl	$48, %eax
	cmpb	$9, %al
	jbe	.L41
	movslq	%ebx, %rbx
	movl	%r14d, (%r12,%rbx,4)
	movslq	i(%rip), %rbx
	.p2align 4,,10
	.p2align 3
.L65:
	movq	stdin(%rip), %rdi
	call	getc@PLT
	leal	-48(%rax), %edx
	cmpb	$9, %dl
	ja	.L65
	movl	%eax, %edx
	xorl	%r14d, %r14d
	.p2align 4,,10
	.p2align 3
.L45:
	movq	stdin(%rip), %rdi
	subl	$48, %edx
	leal	(%r14,%r14,4), %eax
	movsbl	%dl, %edx
	leal	(%rdx,%rax,2), %r14d
	call	getc@PLT
	movl	%eax, %edx
	subl	$48, %eax
	cmpb	$9, %al
	jbe	.L45
	movslq	i(%rip), %rdx
	movl	%r14d, 0(%rbp,%rbx,4)
	movl	N(%rip), %eax
	movslq	0(%rbp,%rdx,4), %r11
	movl	(%r12,%rdx,4), %ecx
	movq	%rdx, %rbx
	addl	$1, %ebx
	addl	%r11d, %ecx
	addq	b(%rip), %r11
	movl	%ebx, i(%rip)
	movl	%ecx, 0(%r13,%rdx,4)
	movq	%r11, b(%rip)
	cmpl	%eax, %ebx
	jl	.L46
.L47:
	leal	-1(%rax), %edx
	xorl	%esi, %esi
	movq	%r13, %rdi
	call	quickSort
	movl	N(%rip), %r9d
	movq	a(%rip), %rdx
	xorl	%r8d, %r8d
	movl	$0, i(%rip)
	leal	-1(%r9), %edi
	movq	%rdx, %rsi
	movl	%edi, %eax
	testl	%r9d, %r9d
	jle	.L49
	.p2align 4,,10
	.p2align 3
.L51:
	movl	%edi, %ecx
	subl	%eax, %ecx
	andl	$1, %ecx
	jne	.L50
	movslq	%eax, %rcx
	movl	$1, %r8d
	movslq	0(%r13,%rcx,4), %rcx
	addq	%rcx, %rsi
.L50:
	subl	$1, %eax
	jnb	.L51
	movl	%r9d, i(%rip)
	testb	%r8b, %r8b
	je	.L49
	movq	%rsi, a(%rip)
	movq	%rsi, %rdx
.L49:
	subq	%r11, %rdx
	leaq	.LC0(%rip), %rsi
	movl	$1, %edi
	xorl	%eax, %eax
	call	__printf_chk@PLT
	popq	%rbx
	.cfi_remember_state
	.cfi_def_cfa_offset 40
	xorl	%eax, %eax
	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
.L37:
	.cfi_restore_state
	movq	b(%rip), %r11
	leaq	C(%rip), %r13
	jmp	.L47
	.cfi_endproc
.LFE23:
	.size	main, .-main
	.text
	.p2align 4
	.globl	sort
	.type	sort, @function
sort:
.LFB28:
	.cfi_startproc
	endbr64
	leal	-1(%rsi), %edx
	xorl	%esi, %esi
	jmp	quickSort
	.cfi_endproc
.LFE28:
	.size	sort, .-sort
	.globl	b
	.bss
	.align 8
	.type	b, @object
	.size	b, 8
b:
	.zero	8
	.globl	a
	.align 8
	.type	a, @object
	.size	a, 8
a:
	.zero	8
	.globl	C
	.align 32
	.type	C, @object
	.size	C, 400000
C:
	.zero	400000
	.globl	B
	.align 32
	.type	B, @object
	.size	B, 400000
B:
	.zero	400000
	.globl	A
	.align 32
	.type	A, @object
	.size	A, 400000
A:
	.zero	400000
	.globl	i
	.align 4
	.type	i, @object
	.size	i, 4
i:
	.zero	4
	.globl	N
	.align 4
	.type	N, @object
	.size	N, 4
N:
	.zero	4
	.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>

int nextInt();
char compare(int x, int y);
int med3(int x, int y, int z);
void quickSort(int *a, int left, int right);
void sort(int *a, int size);

int N, i;
int A[100000], B[100000], C[100000];
long long int a, b;

int main(){
	N=nextInt();
	for(i=0; i<N; i++){
		A[i]=nextInt();
		B[i]=nextInt();
		C[i] = A[i] + B[i];
		b += B[i];
	}
	sort(C, N);
	for(i=0; i<N; i++){
		if(i%2 == 0){
			a += C[N-i-1];
		}
	}
	printf("%lld\n", a-b);
	return 0;
}

int nextInt(){
	int f=0; char c=getchar();
	while((c<'0')||('9'<c)){c=getchar();}
	while((c>='0')&&(c<='9')){f=f*10+(c-'0'); c=getchar();}
	return f;
}

char compare(int x, int y){
	return x < y;
}

int med3(int x, int y, int z){
	if(compare(x, y)){
		if (compare(y, z)){return y;}else if(compare(z, x)){return x;}else{return z;}
	} else {
		if (compare(z, y)){return y;}else if(compare(x, z)){return x;}else{return z;}
	}
}

void quickSort(int *a, int left, int right){
	if(left >= right){return;}
	int pivot = med3(a[left], a[left+(right-left)/2], a[right]);
	int l=left, r=right;
	int t;
	while(1){
		while (compare(a[l], pivot)){l++;}
		while (compare(pivot, a[r])){r--;}
		if(l>=r){break;}
		t=a[l]; a[l]=a[r]; a[r]=t;
		l++; r--;
	}
	quickSort(a, left, l-1);
	quickSort(a, r+1, right);
}

void sort(int *a, int size){
	quickSort(a, 0, size-1);
}

3
20 10
16 20
20 30
 3
10 10
20 34
30 30
 6
1 1000000000
1 1000000000
1 1000000000
1 1000000000
1 1000000000
1 1000000001
 3
20 10
16 20
20 7
 3
10 10
20 4
30 30
 6
1 1000000000
1 1000000000
1 1000000000
1 1000000000
1 1000000000
2 1000000001
 3
20 2
16 20
20 7
 3
15 10
20 4
30 30
 6
1 1000000000
1 1000000000
1 1000000000
1 1010000000
1 1000000000
2 1000000001
 3
20 2
1 20
20 7

20
 6
 -2999999997
 26
 36
 -2999999996
 29
 40
 -2999999998
 19

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>

int nextInt();
char compare(int x, int y);
int med3(int x, int y, int z);
void quickSort(int *a, int left, int right);
void sort(int *a, int size);

int N, i;
int A[100000], B[100000], C[100000];
long long int a, b;

int main(){
	N=nextInt();
	for(i=0; i<N; i++){
		A[i]=nextInt();
		B[i]=nextInt();
		C[i] = A[i] + B[i];
		b += B[i];
	}
	sort(C, N);
	for(i=0; i<N; i++){
		if(i%2 == 0){
			a += C[N-i-1];
		}
	}
	printf("%lld\n", a-b);
	return 0;
}

int nextInt(){
	int f=0; char c=getchar();
	while((c<'0')||('9'<c)){c=getchar();}
	while((c>='0')&&(c<='9')){f=f*10+(c-'0'); c=getchar();}
	return f;
}

char compare(int x, int y){
	return x < y;
}

int med3(int x, int y, int z){
	if(compare(x, y)){
		if (compare(y, z)){return y;}else if(compare(z, x)){return x;}else{return z;}
	} else {
		if (compare(z, y)){return y;}else if(compare(x, z)){return x;}else{return z;}
	}
}

void quickSort(int *a, int left, int right){
	if(left >= right){return;}
	int pivot = med3(a[left], a[left+(right-left)/2], a[right]);
	int l=left, r=right;
	int t;
	while(1){
		while (compare(a[l], pivot)){l++;}
		while (compare(pivot, a[r])){r--;}
		if(l>=r){break;}
		t=a[l]; a[l]=a[r]; a[r]=t;
		l++; r--;
	}
	quickSort(a, left, l-1);
	quickSort(a, r+1, right);
}

void sort(int *a, int size){
	quickSort(a, 0, size-1);
}
```

Unoptimized Assembly Code:

```assembly
	.file	"temp.c"
	.text
	.globl	N
	.bss
	.align 4
	.type	N, @object
	.size	N, 4
N:
	.zero	4
	.globl	i
	.align 4
	.type	i, @object
	.size	i, 4
i:
	.zero	4
	.globl	A
	.align 32
	.type	A, @object
	.size	A, 400000
A:
	.zero	400000
	.globl	B
	.align 32
	.type	B, @object
	.size	B, 400000
B:
	.zero	400000
	.globl	C
	.align 32
	.type	C, @object
	.size	C, 400000
C:
	.zero	400000
	.globl	a
	.align 8
	.type	a, @object
	.size	a, 8
a:
	.zero	8
	.globl	b
	.align 8
	.type	b, @object
	.size	b, 8
b:
	.zero	8
	.section	.rodata
.LC0:
	.string	"%lld\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
	pushq	%rbx
	subq	$8, %rsp
	.cfi_offset 3, -24
	movl	$0, %eax
	call	nextInt
	movl	%eax, N(%rip)
	movl	$0, i(%rip)
	jmp	.L2
.L3:
	movl	i(%rip), %ebx
	movl	$0, %eax
	call	nextInt
	movslq	%ebx, %rdx
	leaq	0(,%rdx,4), %rcx
	leaq	A(%rip), %rdx
	movl	%eax, (%rcx,%rdx)
	movl	i(%rip), %ebx
	movl	$0, %eax
	call	nextInt
	movslq	%ebx, %rdx
	leaq	0(,%rdx,4), %rcx
	leaq	B(%rip), %rdx
	movl	%eax, (%rcx,%rdx)
	movl	i(%rip), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	A(%rip), %rax
	movl	(%rdx,%rax), %ecx
	movl	i(%rip), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	B(%rip), %rax
	movl	(%rdx,%rax), %edx
	movl	i(%rip), %eax
	addl	%edx, %ecx
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	C(%rip), %rax
	movl	%ecx, (%rdx,%rax)
	movl	i(%rip), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	B(%rip), %rax
	movl	(%rdx,%rax), %eax
	movslq	%eax, %rdx
	movq	b(%rip), %rax
	addq	%rdx, %rax
	movq	%rax, b(%rip)
	movl	i(%rip), %eax
	addl	$1, %eax
	movl	%eax, i(%rip)
.L2:
	movl	i(%rip), %edx
	movl	N(%rip), %eax
	cmpl	%eax, %edx
	jl	.L3
	movl	N(%rip), %eax
	movl	%eax, %esi
	leaq	C(%rip), %rax
	movq	%rax, %rdi
	call	sort
	movl	$0, i(%rip)
	jmp	.L4
.L6:
	movl	i(%rip), %eax
	andl	$1, %eax
	testl	%eax, %eax
	jne	.L5
	movl	N(%rip), %eax
	movl	i(%rip), %edx
	subl	%edx, %eax
	subl	$1, %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	C(%rip), %rax
	movl	(%rdx,%rax), %eax
	movslq	%eax, %rdx
	movq	a(%rip), %rax
	addq	%rdx, %rax
	movq	%rax, a(%rip)
.L5:
	movl	i(%rip), %eax
	addl	$1, %eax
	movl	%eax, i(%rip)
.L4:
	movl	i(%rip), %edx
	movl	N(%rip), %eax
	cmpl	%eax, %edx
	jl	.L6
	movq	a(%rip), %rax
	movq	b(%rip), %rdx
	subq	%rdx, %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	movl	$0, %eax
	movq	-8(%rbp), %rbx
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE0:
	.size	main, .-main
	.globl	nextInt
	.type	nextInt, @function
nextInt:
.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	$0, -4(%rbp)
	call	getchar@PLT
	movb	%al, -5(%rbp)
	jmp	.L9
.L10:
	call	getchar@PLT
	movb	%al, -5(%rbp)
.L9:
	cmpb	$47, -5(%rbp)
	jle	.L10
	cmpb	$57, -5(%rbp)
	jg	.L10
	jmp	.L11
.L13:
	movl	-4(%rbp), %edx
	movl	%edx, %eax
	sall	$2, %eax
	addl	%edx, %eax
	addl	%eax, %eax
	movl	%eax, %edx
	movsbl	-5(%rbp), %eax
	subl	$48, %eax
	addl	%edx, %eax
	movl	%eax, -4(%rbp)
	call	getchar@PLT
	movb	%al, -5(%rbp)
.L11:
	cmpb	$47, -5(%rbp)
	jle	.L12
	cmpb	$57, -5(%rbp)
	jle	.L13
.L12:
	movl	-4(%rbp), %eax
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE1:
	.size	nextInt, .-nextInt
	.globl	compare
	.type	compare, @function
compare:
.LFB2:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	movl	%edi, -4(%rbp)
	movl	%esi, -8(%rbp)
	movl	-4(%rbp), %eax
	cmpl	-8(%rbp), %eax
	setl	%al
	popq	%rbp
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE2:
	.size	compare, .-compare
	.globl	med3
	.type	med3, @function
med3:
.LFB3:
	.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	%esi, -8(%rbp)
	movl	%edx, -12(%rbp)
	movl	-8(%rbp), %edx
	movl	-4(%rbp), %eax
	movl	%edx, %esi
	movl	%eax, %edi
	call	compare
	testb	%al, %al
	je	.L18
	movl	-12(%rbp), %edx
	movl	-8(%rbp), %eax
	movl	%edx, %esi
	movl	%eax, %edi
	call	compare
	testb	%al, %al
	je	.L19
	movl	-8(%rbp), %eax
	jmp	.L20
.L19:
	movl	-4(%rbp), %edx
	movl	-12(%rbp), %eax
	movl	%edx, %esi
	movl	%eax, %edi
	call	compare
	testb	%al, %al
	je	.L21
	movl	-4(%rbp), %eax
	jmp	.L20
.L21:
	movl	-12(%rbp), %eax
	jmp	.L20
.L18:
	movl	-8(%rbp), %edx
	movl	-12(%rbp), %eax
	movl	%edx, %esi
	movl	%eax, %edi
	call	compare
	testb	%al, %al
	je	.L22
	movl	-8(%rbp), %eax
	jmp	.L20
.L22:
	movl	-12(%rbp), %edx
	movl	-4(%rbp), %eax
	movl	%edx, %esi
	movl	%eax, %edi
	call	compare
	testb	%al, %al
	je	.L23
	movl	-4(%rbp), %eax
	jmp	.L20
.L23:
	movl	-12(%rbp), %eax
.L20:
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE3:
	.size	med3, .-med3
	.globl	quickSort
	.type	quickSort, @function
quickSort:
.LFB4:
	.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)
	movl	%esi, -28(%rbp)
	movl	%edx, -32(%rbp)
	movl	-28(%rbp), %eax
	cmpl	-32(%rbp), %eax
	jge	.L35
	movl	-32(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	movq	-24(%rbp), %rax
	addq	%rdx, %rax
	movl	(%rax), %edx
	movl	-32(%rbp), %eax
	subl	-28(%rbp), %eax
	movl	%eax, %ecx
	shrl	$31, %ecx
	addl	%ecx, %eax
	sarl	%eax
	movl	%eax, %ecx
	movl	-28(%rbp), %eax
	addl	%ecx, %eax
	cltq
	leaq	0(,%rax,4), %rcx
	movq	-24(%rbp), %rax
	addq	%rcx, %rax
	movl	(%rax), %ecx
	movl	-28(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rsi
	movq	-24(%rbp), %rax
	addq	%rsi, %rax
	movl	(%rax), %eax
	movl	%ecx, %esi
	movl	%eax, %edi
	call	med3
	movl	%eax, -8(%rbp)
	movl	-28(%rbp), %eax
	movl	%eax, -16(%rbp)
	movl	-32(%rbp), %eax
	movl	%eax, -12(%rbp)
	jmp	.L27
.L28:
	addl	$1, -16(%rbp)
.L27:
	movl	-16(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	movq	-24(%rbp), %rax
	addq	%rdx, %rax
	movl	(%rax), %eax
	movl	-8(%rbp), %edx
	movl	%edx, %esi
	movl	%eax, %edi
	call	compare
	testb	%al, %al
	jne	.L28
	jmp	.L29
.L30:
	subl	$1, -12(%rbp)
.L29:
	movl	-12(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	movq	-24(%rbp), %rax
	addq	%rdx, %rax
	movl	(%rax), %edx
	movl	-8(%rbp), %eax
	movl	%edx, %esi
	movl	%eax, %edi
	call	compare
	testb	%al, %al
	jne	.L30
	movl	-16(%rbp), %eax
	cmpl	-12(%rbp), %eax
	jge	.L36
	movl	-16(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	movq	-24(%rbp), %rax
	addq	%rdx, %rax
	movl	(%rax), %eax
	movl	%eax, -4(%rbp)
	movl	-12(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	movq	-24(%rbp), %rax
	addq	%rdx, %rax
	movl	-16(%rbp), %edx
	movslq	%edx, %rdx
	leaq	0(,%rdx,4), %rcx
	movq	-24(%rbp), %rdx
	addq	%rcx, %rdx
	movl	(%rax), %eax
	movl	%eax, (%rdx)
	movl	-12(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	movq	-24(%rbp), %rax
	addq	%rax, %rdx
	movl	-4(%rbp), %eax
	movl	%eax, (%rdx)
	addl	$1, -16(%rbp)
	subl	$1, -12(%rbp)
	jmp	.L27
.L36:
	nop
	movl	-16(%rbp), %eax
	leal	-1(%rax), %edx
	movl	-28(%rbp), %ecx
	movq	-24(%rbp), %rax
	movl	%ecx, %esi
	movq	%rax, %rdi
	call	quickSort
	movl	-12(%rbp), %eax
	leal	1(%rax), %ecx
	movl	-32(%rbp), %edx
	movq	-24(%rbp), %rax
	movl	%ecx, %esi
	movq	%rax, %rdi
	call	quickSort
	jmp	.L24
.L35:
	nop
.L24:
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE4:
	.size	quickSort, .-quickSort
	.globl	sort
	.type	sort, @function
sort:
.LFB5:
	.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)
	movl	%esi, -12(%rbp)
	movl	-12(%rbp), %eax
	leal	-1(%rax), %edx
	movq	-8(%rbp), %rax
	movl	$0, %esi
	movq	%rax, %rdi
	call	quickSort
	nop
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE5:
	.size	sort, .-sort
	.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	N
	.bss
	.align 4
	.type	N, @object
	.size	N, 4
N:
	.zero	4
	.globl	i
	.align 4
	.type	i, @object
	.size	i, 4
i:
	.zero	4
	.globl	A
	.align 32
	.type	A, @object
	.size	A, 400000
A:
	.zero	400000
	.globl	B
	.align 32
	.type	B, @object
	.size	B, 400000
B:
	.zero	400000
	.globl	C
	.align 32
	.type	C, @object
	.size	C, 400000
C:
	.zero	400000
	.globl	a
	.align 8
	.type	a, @object
	.size	a, 8
a:
	.zero	8
	.globl	b
	.align 8
	.type	b, @object
	.size	b, 8
b:
	.zero	8
	.section	.rodata
.LC0:
	.string	"%lld\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
	pushq	%rbx
	subq	$8, %rsp
	.cfi_offset 3, -24
	movl	$0, %eax
	call	nextInt
	movl	%eax, N(%rip)
	movl	$0, i(%rip)
	jmp	.L2
.L3:
	movl	i(%rip), %ebx
	movl	$0, %eax
	call	nextInt
	movslq	%ebx, %rdx
	leaq	0(,%rdx,4), %rcx
	leaq	A(%rip), %rdx
	movl	%eax, (%rcx,%rdx)
	movl	i(%rip), %ebx
	movl	$0, %eax
	call	nextInt
	movslq	%ebx, %rdx
	leaq	0(,%rdx,4), %rcx
	leaq	B(%rip), %rdx
	movl	%eax, (%rcx,%rdx)
	movl	i(%rip), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	A(%rip), %rax
	movl	(%rdx,%rax), %ecx
	movl	i(%rip), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	B(%rip), %rax
	movl	(%rdx,%rax), %edx
	movl	i(%rip), %eax
	addl	%edx, %ecx
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	C(%rip), %rax
	movl	%ecx, (%rdx,%rax)
	movl	i(%rip), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	B(%rip), %rax
	movl	(%rdx,%rax), %eax
	movslq	%eax, %rdx
	movq	b(%rip), %rax
	addq	%rdx, %rax
	movq	%rax, b(%rip)
	movl	i(%rip), %eax
	addl	$1, %eax
	movl	%eax, i(%rip)
.L2:
	movl	i(%rip), %edx
	movl	N(%rip), %eax
	cmpl	%eax, %edx
	jl	.L3
	movl	N(%rip), %eax
	movl	%eax, %esi
	leaq	C(%rip), %rax
	movq	%rax, %rdi
	call	sort
	movl	$0, i(%rip)
	jmp	.L4
.L6:
	movl	i(%rip), %eax
	andl	$1, %eax
	testl	%eax, %eax
	jne	.L5
	movl	N(%rip), %eax
	movl	i(%rip), %edx
	subl	%edx, %eax
	subl	$1, %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	C(%rip), %rax
	movl	(%rdx,%rax), %eax
	movslq	%eax, %rdx
	movq	a(%rip), %rax
	addq	%rdx, %rax
	movq	%rax, a(%rip)
.L5:
	movl	i(%rip), %eax
	addl	$1, %eax
	movl	%eax, i(%rip)
.L4:
	movl	i(%rip), %edx
	movl	N(%rip), %eax
	cmpl	%eax, %edx
	jl	.L6
	movq	a(%rip), %rax
	movq	b(%rip), %rdx
	subq	%rdx, %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	movl	$0, %eax
	movq	-8(%rbp), %rbx
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE0:
	.size	main, .-main
	.globl	nextInt
	.type	nextInt, @function
nextInt:
.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	$0, -4(%rbp)
	call	getchar@PLT
	movb	%al, -5(%rbp)
	jmp	.L9
.L10:
	call	getchar@PLT
	movb	%al, -5(%rbp)
.L9:
	cmpb	$47, -5(%rbp)
	jle	.L10
	cmpb	$57, -5(%rbp)
	jg	.L10
	jmp	.L11
.L13:
	movl	-4(%rbp), %edx
	movl	%edx, %eax
	sall	$2, %eax
	addl	%edx, %eax
	addl	%eax, %eax
	movl	%eax, %edx
	movsbl	-5(%rbp), %eax
	subl	$48, %eax
	addl	%edx, %eax
	movl	%eax, -4(%rbp)
	call	getchar@PLT
	movb	%al, -5(%rbp)
.L11:
	cmpb	$47, -5(%rbp)
	jle	.L12
	cmpb	$57, -5(%rbp)
	jle	.L13
.L12:
	movl	-4(%rbp), %eax
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE1:
	.size	nextInt, .-nextInt
	.globl	compare
	.type	compare, @function
compare:
.LFB2:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	movl	%edi, -4(%rbp)
	movl	%esi, -8(%rbp)
	movl	-4(%rbp), %eax
	cmpl	-8(%rbp), %eax
	setl	%al
	popq	%rbp
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE2:
	.size	compare, .-compare
	.globl	med3
	.type	med3, @function
med3:
.LFB3:
	.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	%esi, -8(%rbp)
	movl	%edx, -12(%rbp)
	movl	-8(%rbp), %edx
	movl	-4(%rbp), %eax
	movl	%edx, %esi
	movl	%eax, %edi
	call	compare
	testb	%al, %al
	je	.L18
	movl	-12(%rbp), %edx
	movl	-8(%rbp), %eax
	movl	%edx, %esi
	movl	%eax, %edi
	call	compare
	testb	%al, %al
	je	.L19
	movl	-8(%rbp), %eax
	jmp	.L20
.L19:
	movl	-4(%rbp), %edx
	movl	-12(%rbp), %eax
	movl	%edx, %esi
	movl	%eax, %edi
	call	compare
	testb	%al, %al
	je	.L21
	movl	-4(%rbp), %eax
	jmp	.L20
.L21:
	movl	-12(%rbp), %eax
	jmp	.L20
.L18:
	movl	-8(%rbp), %edx
	movl	-12(%rbp), %eax
	movl	%edx, %esi
	movl	%eax, %edi
	call	compare
	testb	%al, %al
	je	.L22
	movl	-8(%rbp), %eax
	jmp	.L20
.L22:
	movl	-12(%rbp), %edx
	movl	-4(%rbp), %eax
	movl	%edx, %esi
	movl	%eax, %edi
	call	compare
	testb	%al, %al
	je	.L23
	movl	-4(%rbp), %eax
	jmp	.L20
.L23:
	movl	-12(%rbp), %eax
.L20:
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE3:
	.size	med3, .-med3
	.globl	quickSort
	.type	quickSort, @function
quickSort:
.LFB4:
	.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)
	movl	%esi, -28(%rbp)
	movl	%edx, -32(%rbp)
	movl	-28(%rbp), %eax
	cmpl	-32(%rbp), %eax
	jge	.L35
	movl	-32(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	movq	-24(%rbp), %rax
	addq	%rdx, %rax
	movl	(%rax), %edx
	movl	-32(%rbp), %eax
	subl	-28(%rbp), %eax
	movl	%eax, %ecx
	shrl	$31, %ecx
	addl	%ecx, %eax
	sarl	%eax
	movl	%eax, %ecx
	movl	-28(%rbp), %eax
	addl	%ecx, %eax
	cltq
	leaq	0(,%rax,4), %rcx
	movq	-24(%rbp), %rax
	addq	%rcx, %rax
	movl	(%rax), %ecx
	movl	-28(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rsi
	movq	-24(%rbp), %rax
	addq	%rsi, %rax
	movl	(%rax), %eax
	movl	%ecx, %esi
	movl	%eax, %edi
	call	med3
	movl	%eax, -8(%rbp)
	movl	-28(%rbp), %eax
	movl	%eax, -16(%rbp)
	movl	-32(%rbp), %eax
	movl	%eax, -12(%rbp)
	jmp	.L27
.L28:
	addl	$1, -16(%rbp)
.L27:
	movl	-16(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	movq	-24(%rbp), %rax
	addq	%rdx, %rax
	movl	(%rax), %eax
	movl	-8(%rbp), %edx
	movl	%edx, %esi
	movl	%eax, %edi
	call	compare
	testb	%al, %al
	jne	.L28
	jmp	.L29
.L30:
	subl	$1, -12(%rbp)
.L29:
	movl	-12(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	movq	-24(%rbp), %rax
	addq	%rdx, %rax
	movl	(%rax), %edx
	movl	-8(%rbp), %eax
	movl	%edx, %esi
	movl	%eax, %edi
	call	compare
	testb	%al, %al
	jne	.L30
	movl	-16(%rbp), %eax
	cmpl	-12(%rbp), %eax
	jge	.L36
	movl	-16(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	movq	-24(%rbp), %rax
	addq	%rdx, %rax
	movl	(%rax), %eax
	movl	%eax, -4(%rbp)
	movl	-12(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	movq	-24(%rbp), %rax
	addq	%rdx, %rax
	movl	-16(%rbp), %edx
	movslq	%edx, %rdx
	leaq	0(,%rdx,4), %rcx
	movq	-24(%rbp), %rdx
	addq	%rcx, %rdx
	movl	(%rax), %eax
	movl	%eax, (%rdx)
	movl	-12(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	movq	-24(%rbp), %rax
	addq	%rax, %rdx
	movl	-4(%rbp), %eax
	movl	%eax, (%rdx)
	addl	$1, -16(%rbp)
	subl	$1, -12(%rbp)
	jmp	.L27
.L36:
	nop
	movl	-16(%rbp), %eax
	leal	-1(%rax), %edx
	movl	-28(%rbp), %ecx
	movq	-24(%rbp), %rax
	movl	%ecx, %esi
	movq	%rax, %rdi
	call	quickSort
	movl	-12(%rbp), %eax
	leal	1(%rax), %ecx
	movl	-32(%rbp), %edx
	movq	-24(%rbp), %rax
	movl	%ecx, %esi
	movq	%rax, %rdi
	call	quickSort
	jmp	.L24
.L35:
	nop
.L24:
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE4:
	.size	quickSort, .-quickSort
	.globl	sort
	.type	sort, @function
sort:
.LFB5:
	.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)
	movl	%esi, -12(%rbp)
	movl	-12(%rbp), %eax
	leal	-1(%rax), %edx
	movq	-8(%rbp), %rax
	movl	$0, %esi
	movq	%rax, %rdi
	call	quickSort
	nop
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE5:
	.size	sort, .-sort
	.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:
