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 main(void){
	int n,a,b,an,bn,t;
	while(1){
		an=0;bn=0;
		scanf("%d",&n);
		if(n==0){
			return 0;
		}
		for(t=0;t<n;t++){
			scanf("%d %d",&a,&b);
			if(a>b){
				an = an+a+b;
			}
			if(a<b){
				bn = bn+a+b;
			}
			if(a==b){
				an = an+a;
				bn = bn+b;
			}
		}
		printf("%d %d\n",an,bn);
	}
}
			```

Unoptimized Assembly Code:

```assembly
	.file	"temp.c"
	.text
	.section	.rodata
.LC0:
	.string	"%d"
.LC1:
	.string	"%d %d"
.LC2:
	.string	"%d %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
.L9:
	movl	$0, -20(%rbp)
	movl	$0, -16(%rbp)
	leaq	-32(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	-32(%rbp), %eax
	testl	%eax, %eax
	jne	.L2
	movl	$0, %eax
	movq	-8(%rbp), %rdx
	subq	%fs:40, %rdx
	je	.L10
	jmp	.L11
.L2:
	movl	$0, -12(%rbp)
	jmp	.L4
.L8:
	leaq	-24(%rbp), %rdx
	leaq	-28(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	-28(%rbp), %edx
	movl	-24(%rbp), %eax
	cmpl	%eax, %edx
	jle	.L5
	movl	-28(%rbp), %edx
	movl	-20(%rbp), %eax
	addl	%eax, %edx
	movl	-24(%rbp), %eax
	addl	%edx, %eax
	movl	%eax, -20(%rbp)
.L5:
	movl	-28(%rbp), %edx
	movl	-24(%rbp), %eax
	cmpl	%eax, %edx
	jge	.L6
	movl	-28(%rbp), %edx
	movl	-16(%rbp), %eax
	addl	%eax, %edx
	movl	-24(%rbp), %eax
	addl	%edx, %eax
	movl	%eax, -16(%rbp)
.L6:
	movl	-28(%rbp), %edx
	movl	-24(%rbp), %eax
	cmpl	%eax, %edx
	jne	.L7
	movl	-28(%rbp), %eax
	addl	%eax, -20(%rbp)
	movl	-24(%rbp), %eax
	addl	%eax, -16(%rbp)
.L7:
	addl	$1, -12(%rbp)
.L4:
	movl	-32(%rbp), %eax
	cmpl	%eax, -12(%rbp)
	jl	.L8
	movl	-16(%rbp), %edx
	movl	-20(%rbp), %eax
	movl	%eax, %esi
	leaq	.LC2(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	jmp	.L9
.L11:
	call	__stack_chk_fail@PLT
.L10:
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE0:
	.size	main, .-main
	.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	"%d"
.LC1:
	.string	"%d %d"
.LC2:
	.string	"%d %d\n"
	.section	.text.startup,"ax",@progbits
	.p2align 4
	.globl	main
	.type	main, @function
main:
.LFB23:
	.cfi_startproc
	endbr64
	pushq	%r15
	.cfi_def_cfa_offset 16
	.cfi_offset 15, -16
	pushq	%r14
	.cfi_def_cfa_offset 24
	.cfi_offset 14, -24
	pushq	%r13
	.cfi_def_cfa_offset 32
	.cfi_offset 13, -32
	pushq	%r12
	.cfi_def_cfa_offset 40
	.cfi_offset 12, -40
	pushq	%rbp
	.cfi_def_cfa_offset 48
	.cfi_offset 6, -48
	pushq	%rbx
	.cfi_def_cfa_offset 56
	.cfi_offset 3, -56
	leaq	.LC1(%rip), %rbx
	subq	$56, %rsp
	.cfi_def_cfa_offset 112
	movq	%fs:40, %rax
	movq	%rax, 40(%rsp)
	xorl	%eax, %eax
	leaq	28(%rsp), %rax
	leaq	36(%rsp), %r14
	movq	%rax, 8(%rsp)
	leaq	32(%rsp), %rbp
	.p2align 4,,10
	.p2align 3
.L9:
	movq	8(%rsp), %rsi
	leaq	.LC0(%rip), %rdi
	xorl	%eax, %eax
	call	__isoc99_scanf@PLT
	movl	28(%rsp), %eax
	testl	%eax, %eax
	je	.L2
	movl	$0, %r15d
	movl	$0, %r13d
	movl	$0, %r12d
	jg	.L3
	jmp	.L4
	.p2align 4,,10
	.p2align 3
.L16:
	addl	%r12d, %eax
	leal	(%rdx,%rax), %r12d
.L6:
	addl	$1, %r15d
	cmpl	%r15d, 28(%rsp)
	jle	.L4
.L3:
	movq	%r14, %rdx
	movq	%rbp, %rsi
	movq	%rbx, %rdi
	xorl	%eax, %eax
	call	__isoc99_scanf@PLT
	movl	32(%rsp), %eax
	movl	36(%rsp), %edx
	cmpl	%edx, %eax
	jg	.L16
	jge	.L17
	addl	%r13d, %eax
	addl	$1, %r15d
	leal	(%rdx,%rax), %r13d
	cmpl	%r15d, 28(%rsp)
	jg	.L3
.L4:
	movl	%r13d, %ecx
	movl	%r12d, %edx
	leaq	.LC2(%rip), %rsi
	xorl	%eax, %eax
	movl	$1, %edi
	call	__printf_chk@PLT
	jmp	.L9
.L17:
	jne	.L6
	addl	%eax, %r12d
	addl	%eax, %r13d
	jmp	.L6
	.p2align 4,,10
	.p2align 3
.L2:
	movq	40(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L18
	addq	$56, %rsp
	.cfi_remember_state
	.cfi_def_cfa_offset 56
	xorl	%eax, %eax
	popq	%rbx
	.cfi_def_cfa_offset 48
	popq	%rbp
	.cfi_def_cfa_offset 40
	popq	%r12
	.cfi_def_cfa_offset 32
	popq	%r13
	.cfi_def_cfa_offset 24
	popq	%r14
	.cfi_def_cfa_offset 16
	popq	%r15
	.cfi_def_cfa_offset 8
	ret
.L18:
	.cfi_restore_state
	call	__stack_chk_fail@PLT
	.cfi_endproc
.LFE23:
	.size	main, .-main
	.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	"%d"
.LC1:
	.string	"%d %d"
.LC2:
	.string	"%d %d\n"
	.section	.text.startup,"ax",@progbits
	.p2align 4
	.globl	main
	.type	main, @function
main:
.LFB23:
	.cfi_startproc
	endbr64
	pushq	%r15
	.cfi_def_cfa_offset 16
	.cfi_offset 15, -16
	pushq	%r14
	.cfi_def_cfa_offset 24
	.cfi_offset 14, -24
	pushq	%r13
	.cfi_def_cfa_offset 32
	.cfi_offset 13, -32
	pushq	%r12
	.cfi_def_cfa_offset 40
	.cfi_offset 12, -40
	pushq	%rbp
	.cfi_def_cfa_offset 48
	.cfi_offset 6, -48
	pushq	%rbx
	.cfi_def_cfa_offset 56
	.cfi_offset 3, -56
	leaq	.LC1(%rip), %rbx
	subq	$56, %rsp
	.cfi_def_cfa_offset 112
	movq	%fs:40, %rax
	movq	%rax, 40(%rsp)
	xorl	%eax, %eax
	leaq	28(%rsp), %rax
	leaq	36(%rsp), %r14
	movq	%rax, 8(%rsp)
	leaq	32(%rsp), %rbp
	.p2align 4,,10
	.p2align 3
.L9:
	movq	8(%rsp), %rsi
	leaq	.LC0(%rip), %rdi
	xorl	%eax, %eax
	call	__isoc99_scanf@PLT
	movl	28(%rsp), %eax
	testl	%eax, %eax
	je	.L2
	movl	$0, %r15d
	movl	$0, %r13d
	movl	$0, %r12d
	jg	.L3
	jmp	.L4
	.p2align 4,,10
	.p2align 3
.L16:
	addl	%r12d, %eax
	leal	(%rdx,%rax), %r12d
.L6:
	addl	$1, %r15d
	cmpl	%r15d, 28(%rsp)
	jle	.L4
.L3:
	movq	%r14, %rdx
	movq	%rbp, %rsi
	movq	%rbx, %rdi
	xorl	%eax, %eax
	call	__isoc99_scanf@PLT
	movl	32(%rsp), %eax
	movl	36(%rsp), %edx
	cmpl	%edx, %eax
	jg	.L16
	jge	.L17
	addl	%r13d, %eax
	addl	$1, %r15d
	leal	(%rdx,%rax), %r13d
	cmpl	%r15d, 28(%rsp)
	jg	.L3
.L4:
	movl	%r13d, %ecx
	movl	%r12d, %edx
	leaq	.LC2(%rip), %rsi
	xorl	%eax, %eax
	movl	$1, %edi
	call	__printf_chk@PLT
	jmp	.L9
.L17:
	jne	.L6
	addl	%eax, %r12d
	addl	%eax, %r13d
	jmp	.L6
	.p2align 4,,10
	.p2align 3
.L2:
	movq	40(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L18
	addq	$56, %rsp
	.cfi_remember_state
	.cfi_def_cfa_offset 56
	xorl	%eax, %eax
	popq	%rbx
	.cfi_def_cfa_offset 48
	popq	%rbp
	.cfi_def_cfa_offset 40
	popq	%r12
	.cfi_def_cfa_offset 32
	popq	%r13
	.cfi_def_cfa_offset 24
	popq	%r14
	.cfi_def_cfa_offset 16
	popq	%r15
	.cfi_def_cfa_offset 8
	ret
.L18:
	.cfi_restore_state
	call	__stack_chk_fail@PLT
	.cfi_endproc
.LFE23:
	.size	main, .-main
	.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 main(void){
	int n,a,b,an,bn,t;
	while(1){
		an=0;bn=0;
		scanf("%d",&n);
		if(n==0){
			return 0;
		}
		for(t=0;t<n;t++){
			scanf("%d %d",&a,&b);
			if(a>b){
				an = an+a+b;
			}
			if(a<b){
				bn = bn+a+b;
			}
			if(a==b){
				an = an+a;
				bn = bn+b;
			}
		}
		printf("%d %d\n",an,bn);
	}
}
			
3
9 1
5 4
0 4
3
9 1
5 4
1 0
3
9 1
5 5
1 8
0
 3
9 1
5 4
0 8
3
9 1
5 4
1 0
3
9 1
5 0
1 8
0
 3
9 1
5 4
1 4
3
9 1
5 4
1 0
3
9 1
5 5
1 8
0
 3
9 1
5 4
0 8
3
9 1
5 4
1 0
3
9 1
5 0
1 1
0
 3
9 1
5 4
1 4
3
9 1
6 4
1 0
3
9 1
5 5
1 8
0
 3
9 1
5 4
0 8
3
9 1
9 4
1 0
3
9 1
5 0
1 1
0
 3
9 1
5 4
1 4
3
10 1
6 4
1 0
3
9 1
5 5
1 8
0
 3
9 1
5 4
0 8
3
9 1
18 4
1 0
3
9 1
5 0
1 1
0
 3
9 1
5 4
1 4
3
10 1
6 7
1 0
3
9 1
5 5
1 8
0
 3
9 1
5 4
0 14
3
9 1
18 4
1 0
3
9 1
5 0
1 1
0

19 4
20 0
15 14
 19 8
20 0
15 9
 19 5
20 0
15 14
 19 8
20 0
16 1
 19 5
21 0
15 14
 19 8
24 0
16 1
 19 5
22 0
15 14
 19 8
33 0
16 1
 19 5
12 13
15 14
 19 14
33 0
16 1

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 main(void){
	int n,a,b,an,bn,t;
	while(1){
		an=0;bn=0;
		scanf("%d",&n);
		if(n==0){
			return 0;
		}
		for(t=0;t<n;t++){
			scanf("%d %d",&a,&b);
			if(a>b){
				an = an+a+b;
			}
			if(a<b){
				bn = bn+a+b;
			}
			if(a==b){
				an = an+a;
				bn = bn+b;
			}
		}
		printf("%d %d\n",an,bn);
	}
}
			```

Unoptimized Assembly Code:

```assembly
	.file	"temp.c"
	.text
	.section	.rodata
.LC0:
	.string	"%d"
.LC1:
	.string	"%d %d"
.LC2:
	.string	"%d %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
.L9:
	movl	$0, -20(%rbp)
	movl	$0, -16(%rbp)
	leaq	-32(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	-32(%rbp), %eax
	testl	%eax, %eax
	jne	.L2
	movl	$0, %eax
	movq	-8(%rbp), %rdx
	subq	%fs:40, %rdx
	je	.L10
	jmp	.L11
.L2:
	movl	$0, -12(%rbp)
	jmp	.L4
.L8:
	leaq	-24(%rbp), %rdx
	leaq	-28(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	-28(%rbp), %edx
	movl	-24(%rbp), %eax
	cmpl	%eax, %edx
	jle	.L5
	movl	-28(%rbp), %edx
	movl	-20(%rbp), %eax
	addl	%eax, %edx
	movl	-24(%rbp), %eax
	addl	%edx, %eax
	movl	%eax, -20(%rbp)
.L5:
	movl	-28(%rbp), %edx
	movl	-24(%rbp), %eax
	cmpl	%eax, %edx
	jge	.L6
	movl	-28(%rbp), %edx
	movl	-16(%rbp), %eax
	addl	%eax, %edx
	movl	-24(%rbp), %eax
	addl	%edx, %eax
	movl	%eax, -16(%rbp)
.L6:
	movl	-28(%rbp), %edx
	movl	-24(%rbp), %eax
	cmpl	%eax, %edx
	jne	.L7
	movl	-28(%rbp), %eax
	addl	%eax, -20(%rbp)
	movl	-24(%rbp), %eax
	addl	%eax, -16(%rbp)
.L7:
	addl	$1, -12(%rbp)
.L4:
	movl	-32(%rbp), %eax
	cmpl	%eax, -12(%rbp)
	jl	.L8
	movl	-16(%rbp), %edx
	movl	-20(%rbp), %eax
	movl	%eax, %esi
	leaq	.LC2(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	jmp	.L9
.L11:
	call	__stack_chk_fail@PLT
.L10:
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE0:
	.size	main, .-main
	.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"
.LC1:
	.string	"%d %d"
.LC2:
	.string	"%d %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
.L9:
	movl	$0, -20(%rbp)
	movl	$0, -16(%rbp)
	leaq	-32(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	-32(%rbp), %eax
	testl	%eax, %eax
	jne	.L2
	movl	$0, %eax
	movq	-8(%rbp), %rdx
	subq	%fs:40, %rdx
	je	.L10
	jmp	.L11
.L2:
	movl	$0, -12(%rbp)
	jmp	.L4
.L8:
	leaq	-24(%rbp), %rdx
	leaq	-28(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	-28(%rbp), %edx
	movl	-24(%rbp), %eax
	cmpl	%eax, %edx
	jle	.L5
	movl	-28(%rbp), %edx
	movl	-20(%rbp), %eax
	addl	%eax, %edx
	movl	-24(%rbp), %eax
	addl	%edx, %eax
	movl	%eax, -20(%rbp)
.L5:
	movl	-28(%rbp), %edx
	movl	-24(%rbp), %eax
	cmpl	%eax, %edx
	jge	.L6
	movl	-28(%rbp), %edx
	movl	-16(%rbp), %eax
	addl	%eax, %edx
	movl	-24(%rbp), %eax
	addl	%edx, %eax
	movl	%eax, -16(%rbp)
.L6:
	movl	-28(%rbp), %edx
	movl	-24(%rbp), %eax
	cmpl	%eax, %edx
	jne	.L7
	movl	-28(%rbp), %eax
	addl	%eax, -20(%rbp)
	movl	-24(%rbp), %eax
	addl	%eax, -16(%rbp)
.L7:
	addl	$1, -12(%rbp)
.L4:
	movl	-32(%rbp), %eax
	cmpl	%eax, -12(%rbp)
	jl	.L8
	movl	-16(%rbp), %edx
	movl	-20(%rbp), %eax
	movl	%eax, %esi
	leaq	.LC2(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	jmp	.L9
.L11:
	call	__stack_chk_fail@PLT
.L10:
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE0:
	.size	main, .-main
	.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:
