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(){
  int n,m,d[100],p,pp,s,a,b,c,i,j;
  while(scanf("%d",&n),n){
    for(j=0;j<n;j++){
      s=0;
      a=b=c=1;
      scanf("%d",&m);
      for(i=0;i<10;i++){
	scanf("%d",&p);
	s+=p*a;//printf("!%d %d %d %d %d",s,i,a,b,c);
	if(p==10){
	  if(i<9){
	    b++;
	    c++;
	  }
	}
	a=b;
	b=c;
	c=1;
	if(p-10||i==9){
	  scanf("%d",&pp);
	  s+=pp*a;//printf("!!%d %d %d %d %d",s,i,a,b,c);
	  if(p+pp==10){
	    b++;
	  }
	  a=b;
	  b=c;
	  c=1;
	}//printf("\n");
      }
      if(p+pp>=10){
 	scanf("%d",&p);
	s+=p;
      }
      s=(300-s)*10000+m;
      //printf("%d\n",s);
      for(i=j;j&&d[i-1]>s;i--)d[i]=d[i-1];
      d[i]=s;
      //for(i=0;i<=j;i++)printf("!%d %d",300-d[i]/10000,d[i]%10000);printf("\n");
    }
    for(i=0;i<n;i++)printf("%d %d\n",d[i]%10000,300-d[i]/10000);
  }
  return 0;
}

```

Unoptimized Assembly Code:

```assembly
	.file	"temp.c"
	.text
	.section	.rodata
.LC0:
	.string	"%d"
.LC1:
	.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	$464, %rsp
	movq	%fs:40, %rax
	movq	%rax, -8(%rbp)
	xorl	%eax, %eax
	jmp	.L2
.L17:
	movl	$0, -420(%rbp)
	jmp	.L3
.L14:
	movl	$0, -440(%rbp)
	movl	$1, -428(%rbp)
	movl	-428(%rbp), %eax
	movl	%eax, -432(%rbp)
	movl	-432(%rbp), %eax
	movl	%eax, -436(%rbp)
	leaq	-452(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	$0, -424(%rbp)
	jmp	.L4
.L9:
	leaq	-448(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	-448(%rbp), %eax
	imull	-436(%rbp), %eax
	addl	%eax, -440(%rbp)
	movl	-448(%rbp), %eax
	cmpl	$10, %eax
	jne	.L5
	cmpl	$8, -424(%rbp)
	jg	.L5
	addl	$1, -432(%rbp)
	addl	$1, -428(%rbp)
.L5:
	movl	-432(%rbp), %eax
	movl	%eax, -436(%rbp)
	movl	-428(%rbp), %eax
	movl	%eax, -432(%rbp)
	movl	$1, -428(%rbp)
	movl	-448(%rbp), %eax
	cmpl	$10, %eax
	jne	.L6
	cmpl	$9, -424(%rbp)
	jne	.L7
.L6:
	leaq	-444(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	-444(%rbp), %eax
	imull	-436(%rbp), %eax
	addl	%eax, -440(%rbp)
	movl	-448(%rbp), %edx
	movl	-444(%rbp), %eax
	addl	%edx, %eax
	cmpl	$10, %eax
	jne	.L8
	addl	$1, -432(%rbp)
.L8:
	movl	-432(%rbp), %eax
	movl	%eax, -436(%rbp)
	movl	-428(%rbp), %eax
	movl	%eax, -432(%rbp)
	movl	$1, -428(%rbp)
.L7:
	addl	$1, -424(%rbp)
.L4:
	cmpl	$9, -424(%rbp)
	jle	.L9
	movl	-448(%rbp), %edx
	movl	-444(%rbp), %eax
	addl	%edx, %eax
	cmpl	$9, %eax
	jle	.L10
	leaq	-448(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	-448(%rbp), %eax
	addl	%eax, -440(%rbp)
.L10:
	movl	$300, %eax
	subl	-440(%rbp), %eax
	imull	$10000, %eax, %edx
	movl	-452(%rbp), %eax
	addl	%edx, %eax
	movl	%eax, -440(%rbp)
	movl	-420(%rbp), %eax
	movl	%eax, -424(%rbp)
	jmp	.L11
.L13:
	movl	-424(%rbp), %eax
	subl	$1, %eax
	cltq
	movl	-416(%rbp,%rax,4), %edx
	movl	-424(%rbp), %eax
	cltq
	movl	%edx, -416(%rbp,%rax,4)
	subl	$1, -424(%rbp)
.L11:
	cmpl	$0, -420(%rbp)
	je	.L12
	movl	-424(%rbp), %eax
	subl	$1, %eax
	cltq
	movl	-416(%rbp,%rax,4), %eax
	cmpl	%eax, -440(%rbp)
	jl	.L13
.L12:
	movl	-424(%rbp), %eax
	cltq
	movl	-440(%rbp), %edx
	movl	%edx, -416(%rbp,%rax,4)
	addl	$1, -420(%rbp)
.L3:
	movl	-456(%rbp), %eax
	cmpl	%eax, -420(%rbp)
	jl	.L14
	movl	$0, -424(%rbp)
	jmp	.L15
.L16:
	movl	-424(%rbp), %eax
	cltq
	movl	-416(%rbp,%rax,4), %eax
	movslq	%eax, %rdx
	imulq	$1759218605, %rdx, %rdx
	shrq	$32, %rdx
	sarl	$12, %edx
	sarl	$31, %eax
	subl	%edx, %eax
	leal	300(%rax), %ecx
	movl	-424(%rbp), %eax
	cltq
	movl	-416(%rbp,%rax,4), %edx
	movslq	%edx, %rax
	imulq	$1759218605, %rax, %rax
	shrq	$32, %rax
	sarl	$12, %eax
	movl	%edx, %esi
	sarl	$31, %esi
	subl	%esi, %eax
	imull	$10000, %eax, %esi
	movl	%edx, %eax
	subl	%esi, %eax
	movl	%ecx, %edx
	movl	%eax, %esi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	addl	$1, -424(%rbp)
.L15:
	movl	-456(%rbp), %eax
	cmpl	%eax, -424(%rbp)
	jl	.L16
.L2:
	leaq	-456(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	-456(%rbp), %eax
	testl	%eax, %eax
	jne	.L17
	movl	$0, %eax
	movq	-8(%rbp), %rdx
	subq	%fs:40, %rdx
	je	.L19
	call	__stack_chk_fail@PLT
.L19:
	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\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
	leaq	.LC0(%rip), %r13
	pushq	%r12
	.cfi_def_cfa_offset 40
	.cfi_offset 12, -40
	pushq	%rbp
	.cfi_def_cfa_offset 48
	.cfi_offset 6, -48
	pushq	%rbx
	.cfi_def_cfa_offset 56
	.cfi_offset 3, -56
	subq	$488, %rsp
	.cfi_def_cfa_offset 544
	movq	%fs:40, %rax
	movq	%rax, 472(%rsp)
	xorl	%eax, %eax
	leaq	48(%rsp), %rax
	movq	%rax, 40(%rsp)
	leaq	60(%rsp), %rax
	movq	%rax, 16(%rsp)
	.p2align 4,,10
	.p2align 3
.L2:
	movq	40(%rsp), %rsi
	movq	%r13, %rdi
	xorl	%eax, %eax
	call	__isoc99_scanf@PLT
	movl	48(%rsp), %eax
	testl	%eax, %eax
	je	.L14
	leaq	52(%rsp), %rax
	leaq	56(%rsp), %r15
	movq	$0, 24(%rsp)
	movq	%rax, 32(%rsp)
	jle	.L2
	.p2align 4,,10
	.p2align 3
.L11:
	movl	24(%rsp), %eax
	movq	32(%rsp), %rsi
	movq	%r13, %rdi
	xorl	%ebp, %ebp
	movl	$1, %r12d
	movl	$1, %r14d
	xorl	%ebx, %ebx
	movl	%eax, 12(%rsp)
	xorl	%eax, %eax
	call	__isoc99_scanf@PLT
	jmp	.L6
	.p2align 4,,10
	.p2align 3
.L3:
	movq	16(%rsp), %rsi
	xorl	%eax, %eax
	movq	%r13, %rdi
	xorl	%r14d, %r14d
	call	__isoc99_scanf@PLT
	movl	60(%rsp), %edx
	movl	56(%rsp), %eax
	imull	%edx, %r12d
	addl	%eax, %edx
	addl	%r12d, %ebx
	cmpl	$10, %edx
	movl	$1, %r12d
	sete	%r14b
	addl	$1, %r14d
.L5:
	addl	$1, %ebp
	cmpl	$10, %ebp
	je	.L33
.L6:
	movq	%r15, %rsi
	movq	%r13, %rdi
	xorl	%eax, %eax
	call	__isoc99_scanf@PLT
	movl	56(%rsp), %eax
	movl	%r14d, %edx
	imull	%eax, %edx
	addl	%edx, %ebx
	cmpl	$10, %eax
	jne	.L3
	cmpl	$9, %ebp
	je	.L4
	leal	1(%r12), %r14d
	movl	$2, %r12d
	jmp	.L5
	.p2align 4,,10
	.p2align 3
.L4:
	movq	16(%rsp), %rsi
	movq	%r13, %rdi
	xorl	%eax, %eax
	call	__isoc99_scanf@PLT
	movl	60(%rsp), %edx
	movl	56(%rsp), %eax
	imull	%edx, %r12d
	leal	(%rdx,%rax), %ecx
	addl	%r12d, %ebx
	cmpl	$10, %ecx
	je	.L15
.L16:
	cmpl	$9, %ecx
	jg	.L34
.L7:
	movl	$300, %ecx
	movq	24(%rsp), %rax
	subl	%ebx, %ecx
	imull	$10000, %ecx, %ecx
	addl	52(%rsp), %ecx
	testq	%rax, %rax
	je	.L19
	movl	60(%rsp,%rax,4), %edx
	leaq	64(%rsp), %rbx
	cmpl	%edx, %ecx
	jge	.L8
	subq	$1, %rax
	.p2align 4,,10
	.p2align 3
.L10:
	movl	%edx, 4(%rbx,%rax,4)
	movl	%eax, 12(%rsp)
	subq	$1, %rax
	movl	(%rbx,%rax,4), %edx
	cmpl	%ecx, %edx
	jg	.L10
.L8:
	addq	$1, 24(%rsp)
	movslq	12(%rsp), %r14
	movl	48(%rsp), %eax
	movq	24(%rsp), %rdi
	movl	%ecx, 64(%rsp,%r14,4)
	cmpl	%edi, %eax
	jg	.L11
	testl	%eax, %eax
	jle	.L2
	xorl	%ebp, %ebp
	leaq	64(%rsp), %rbx
	.p2align 4,,10
	.p2align 3
.L12:
	movslq	(%rbx,%rbp,4), %rax
	movl	$1, %edi
	addq	$1, %rbp
	movq	%rax, %rdx
	imulq	$1759218605, %rax, %rax
	movl	%edx, %esi
	sarl	$31, %esi
	sarq	$44, %rax
	movl	%esi, %ecx
	subl	%eax, %ecx
	subl	%esi, %eax
	leaq	.LC1(%rip), %rsi
	imull	$10000, %eax, %eax
	addl	$300, %ecx
	subl	%eax, %edx
	xorl	%eax, %eax
	call	__printf_chk@PLT
	cmpl	%ebp, 48(%rsp)
	jg	.L12
	jmp	.L2
	.p2align 4,,10
	.p2align 3
.L34:
	movq	%r15, %rsi
	movq	%r13, %rdi
	xorl	%eax, %eax
	call	__isoc99_scanf@PLT
	addl	56(%rsp), %ebx
	jmp	.L7
.L33:
	movl	60(%rsp), %edx
	.p2align 4,,10
	.p2align 3
.L15:
	leal	(%rdx,%rax), %ecx
	jmp	.L16
.L19:
	movl	$0, 12(%rsp)
	jmp	.L8
.L14:
	movq	472(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L35
	addq	$488, %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
.L35:
	.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\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
	leaq	.LC0(%rip), %r13
	pushq	%r12
	.cfi_def_cfa_offset 40
	.cfi_offset 12, -40
	pushq	%rbp
	.cfi_def_cfa_offset 48
	.cfi_offset 6, -48
	pushq	%rbx
	.cfi_def_cfa_offset 56
	.cfi_offset 3, -56
	subq	$488, %rsp
	.cfi_def_cfa_offset 544
	movq	%fs:40, %rax
	movq	%rax, 472(%rsp)
	xorl	%eax, %eax
	leaq	48(%rsp), %rax
	movq	%rax, 40(%rsp)
	leaq	60(%rsp), %rax
	movq	%rax, 16(%rsp)
	.p2align 4,,10
	.p2align 3
.L2:
	movq	40(%rsp), %rsi
	movq	%r13, %rdi
	xorl	%eax, %eax
	call	__isoc99_scanf@PLT
	movl	48(%rsp), %eax
	testl	%eax, %eax
	je	.L14
	leaq	52(%rsp), %rax
	leaq	56(%rsp), %r15
	movq	$0, 24(%rsp)
	movq	%rax, 32(%rsp)
	jle	.L2
	.p2align 4,,10
	.p2align 3
.L11:
	movl	24(%rsp), %eax
	movq	32(%rsp), %rsi
	movq	%r13, %rdi
	xorl	%ebp, %ebp
	movl	$1, %r12d
	movl	$1, %r14d
	xorl	%ebx, %ebx
	movl	%eax, 12(%rsp)
	xorl	%eax, %eax
	call	__isoc99_scanf@PLT
	jmp	.L6
	.p2align 4,,10
	.p2align 3
.L3:
	movq	16(%rsp), %rsi
	xorl	%eax, %eax
	movq	%r13, %rdi
	xorl	%r14d, %r14d
	call	__isoc99_scanf@PLT
	movl	60(%rsp), %edx
	movl	56(%rsp), %eax
	imull	%edx, %r12d
	addl	%eax, %edx
	addl	%r12d, %ebx
	cmpl	$10, %edx
	movl	$1, %r12d
	sete	%r14b
	addl	$1, %r14d
.L5:
	addl	$1, %ebp
	cmpl	$10, %ebp
	je	.L33
.L6:
	movq	%r15, %rsi
	movq	%r13, %rdi
	xorl	%eax, %eax
	call	__isoc99_scanf@PLT
	movl	56(%rsp), %eax
	movl	%r14d, %edx
	imull	%eax, %edx
	addl	%edx, %ebx
	cmpl	$10, %eax
	jne	.L3
	cmpl	$9, %ebp
	je	.L4
	leal	1(%r12), %r14d
	movl	$2, %r12d
	jmp	.L5
	.p2align 4,,10
	.p2align 3
.L4:
	movq	16(%rsp), %rsi
	movq	%r13, %rdi
	xorl	%eax, %eax
	call	__isoc99_scanf@PLT
	movl	60(%rsp), %edx
	movl	56(%rsp), %eax
	imull	%edx, %r12d
	leal	(%rdx,%rax), %ecx
	addl	%r12d, %ebx
	cmpl	$10, %ecx
	je	.L15
.L16:
	cmpl	$9, %ecx
	jg	.L34
.L7:
	movl	$300, %ecx
	movq	24(%rsp), %rax
	subl	%ebx, %ecx
	imull	$10000, %ecx, %ecx
	addl	52(%rsp), %ecx
	testq	%rax, %rax
	je	.L19
	movl	60(%rsp,%rax,4), %edx
	leaq	64(%rsp), %rbx
	cmpl	%edx, %ecx
	jge	.L8
	subq	$1, %rax
	.p2align 4,,10
	.p2align 3
.L10:
	movl	%edx, 4(%rbx,%rax,4)
	movl	%eax, 12(%rsp)
	subq	$1, %rax
	movl	(%rbx,%rax,4), %edx
	cmpl	%ecx, %edx
	jg	.L10
.L8:
	addq	$1, 24(%rsp)
	movslq	12(%rsp), %r14
	movl	48(%rsp), %eax
	movq	24(%rsp), %rdi
	movl	%ecx, 64(%rsp,%r14,4)
	cmpl	%edi, %eax
	jg	.L11
	testl	%eax, %eax
	jle	.L2
	xorl	%ebp, %ebp
	leaq	64(%rsp), %rbx
	.p2align 4,,10
	.p2align 3
.L12:
	movslq	(%rbx,%rbp,4), %rax
	movl	$1, %edi
	addq	$1, %rbp
	movq	%rax, %rdx
	imulq	$1759218605, %rax, %rax
	movl	%edx, %esi
	sarl	$31, %esi
	sarq	$44, %rax
	movl	%esi, %ecx
	subl	%eax, %ecx
	subl	%esi, %eax
	leaq	.LC1(%rip), %rsi
	imull	$10000, %eax, %eax
	addl	$300, %ecx
	subl	%eax, %edx
	xorl	%eax, %eax
	call	__printf_chk@PLT
	cmpl	%ebp, 48(%rsp)
	jg	.L12
	jmp	.L2
	.p2align 4,,10
	.p2align 3
.L34:
	movq	%r15, %rsi
	movq	%r13, %rdi
	xorl	%eax, %eax
	call	__isoc99_scanf@PLT
	addl	56(%rsp), %ebx
	jmp	.L7
.L33:
	movl	60(%rsp), %edx
	.p2align 4,,10
	.p2align 3
.L15:
	leal	(%rdx,%rax), %ecx
	jmp	.L16
.L19:
	movl	$0, 12(%rsp)
	jmp	.L8
.L14:
	movq	472(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L35
	addq	$488, %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
.L35:
	.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(){
  int n,m,d[100],p,pp,s,a,b,c,i,j;
  while(scanf("%d",&n),n){
    for(j=0;j<n;j++){
      s=0;
      a=b=c=1;
      scanf("%d",&m);
      for(i=0;i<10;i++){
	scanf("%d",&p);
	s+=p*a;//printf("!%d %d %d %d %d",s,i,a,b,c);
	if(p==10){
	  if(i<9){
	    b++;
	    c++;
	  }
	}
	a=b;
	b=c;
	c=1;
	if(p-10||i==9){
	  scanf("%d",&pp);
	  s+=pp*a;//printf("!!%d %d %d %d %d",s,i,a,b,c);
	  if(p+pp==10){
	    b++;
	  }
	  a=b;
	  b=c;
	  c=1;
	}//printf("\n");
      }
      if(p+pp>=10){
 	scanf("%d",&p);
	s+=p;
      }
      s=(300-s)*10000+m;
      //printf("%d\n",s);
      for(i=j;j&&d[i-1]>s;i--)d[i]=d[i-1];
      d[i]=s;
      //for(i=0;i<=j;i++)printf("!%d %d",300-d[i]/10000,d[i]%10000);printf("\n");
    }
    for(i=0;i<n;i++)printf("%d %d\n",d[i]%10000,300-d[i]/10000);
  }
  return 0;
}


3
1010 6 3 10 7 1 0 7 9 1 10 6 2 4 3 9 1 9 0
1200 5 3 9 1 7 1 0 0 8 1 10 10 4 3 9 1 8 2 9
1101 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3
4
3321 8 2 10 9 1 7 0 10 10 10 0 8 10 10 10 10
3332 5 0 10 9 1 4 1 9 0 10 10 7 1 5 2 8 1
3335 10 10 10 10 10 10 10 10 10 10 10 10
3340 8 2 7 3 0 4 8 2 8 2 9 1 7 3 6 4 8 2 9 1 7
0
 3
1010 6 3 10 7 1 0 7 9 1 10 6 2 4 3 9 1 9 0
1200 5 3 9 1 7 1 0 0 8 1 10 10 4 3 9 1 8 2 9
1101 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3
4
3321 8 2 10 9 1 7 0 10 10 10 0 8 10 10 10 10
3332 5 0 10 9 1 4 1 9 0 10 10 7 1 5 2 8 1
3335 10 10 10 10 10 10 10 10 10 10 10 10
3340 8 2 7 3 6 4 8 2 8 2 9 0 7 3 6 4 8 2 9 1 7
0
 3
1010 6 3 10 7 1 0 7 9 1 10 6 2 4 3 9 1 9 0
1200 5 3 9 1 12 1 0 0 8 1 10 10 4 3 9 1 8 2 9
1101 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3
4
3321 8 2 10 9 1 7 0 10 10 10 0 8 10 10 10 10
3332 5 0 10 9 1 4 1 9 0 10 10 7 1 5 2 8 1
3335 10 10 10 10 10 10 10 10 10 10 10 10
3340 8 2 7 3 0 4 8 2 8 2 9 1 7 3 6 4 8 2 9 1 7
0
 3
1010 6 3 10 7 1 0 7 9 1 10 6 2 4 3 9 1 9 0
1200 5 3 9 1 7 1 0 0 8 1 10 10 4 3 9 1 8 2 9
1101 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3
4
3321 8 2 10 9 1 7 0 10 10 10 0 8 10 10 10 10
3332 5 0 10 9 1 4 1 9 0 10 10 7 1 5 2 8 1
3335 10 10 10 10 10 10 10 10 10 10 10 10
3340 8 2 7 3 6 4 8 2 8 2 9 0 7 3 6 4 11 2 9 1 7
0
 3
1010 6 3 10 7 1 0 7 9 1 10 6 2 4 3 9 1 9 0
1200 5 3 9 1 12 1 0 0 8 1 10 10 4 3 9 1 8 2 9
1101 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3
4
3321 8 2 10 9 1 7 0 10 10 10 0 8 10 10 10 10
3332 5 0 10 9 1 4 1 9 0 10 10 7 1 5 2 8 1
3335 10 10 10 10 10 10 10 10 10 10 10 10
3340 8 2 7 3 0 4 8 2 8 2 9 1 7 3 5 4 8 2 9 1 7
0
 3
1010 5 3 10 7 1 0 7 9 1 10 6 2 4 3 9 1 9 0
1200 5 3 9 1 7 1 0 0 8 1 10 10 4 3 9 1 8 2 9
1101 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3
4
3321 8 2 10 9 1 7 0 10 10 10 0 8 10 10 10 10
3332 5 0 10 9 1 4 1 9 0 10 10 7 1 5 2 8 1
3335 10 10 10 10 10 10 10 10 10 10 10 10
3340 8 2 7 3 6 4 8 2 8 2 9 0 7 3 6 4 11 2 9 1 7
0
 3
1010 6 3 10 7 1 0 7 9 1 10 6 2 4 3 9 1 9 0
1200 5 3 9 1 9 1 0 0 8 1 10 10 4 3 9 1 8 2 9
1101 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3
4
3321 8 2 10 9 1 7 0 10 10 10 0 8 10 10 10 10
3332 5 0 10 9 1 4 1 9 0 10 10 7 1 5 2 8 1
3335 10 10 10 10 10 10 10 10 10 10 10 10
3340 8 2 7 3 6 4 8 2 8 2 9 1 7 3 6 4 8 2 9 1 7
0
 3
1010 6 3 10 7 1 0 7 9 1 10 6 2 4 3 16 1 9 0
1200 5 3 9 1 7 1 0 0 8 1 10 10 4 3 9 1 8 2 9
1101 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3
4
3321 8 2 10 9 1 7 0 10 10 10 0 8 10 10 10 10
3332 5 0 10 9 1 4 1 9 0 10 10 7 1 5 2 8 1
3335 10 10 10 10 10 10 10 10 10 10 10 10
3340 8 2 7 3 0 4 8 2 8 2 9 1 7 3 6 4 8 2 9 1 7
0
 3
1010 6 3 10 7 1 0 7 9 1 10 6 2 4 3 9 1 9 0
1200 5 3 9 1 7 1 0 0 8 1 10 10 4 3 9 1 8 2 9
1101 3 3 3 3 3 3 3 3 2 3 3 3 3 3 3 3 3 3 3 3
4
3321 8 2 10 9 1 7 0 10 10 10 0 8 10 10 10 10
3332 5 0 10 9 1 4 1 9 0 10 10 7 1 5 2 8 1
3335 10 10 10 10 10 10 10 10 10 10 10 10
3340 8 2 7 3 6 4 8 2 8 2 9 0 7 3 6 4 8 2 9 1 7
0
 3
1010 6 3 10 7 1 0 7 9 1 10 6 2 4 3 9 2 9 0
1200 5 3 9 1 9 1 0 0 8 1 10 10 4 3 9 1 8 2 9
1101 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3
4
3321 8 2 10 9 1 7 0 10 10 10 0 8 10 10 10 10
3332 5 0 10 9 1 4 1 9 0 10 10 7 1 5 2 8 1
3335 10 10 10 10 10 10 10 10 10 10 10 10
3340 8 2 7 3 6 4 8 2 8 2 9 1 7 3 6 4 8 2 9 1 7
0

1200 127
1010 123
1101 60
3335 300
3321 200
3340 155
3332 122
 1200 127
1010 123
1101 60
3335 300
3321 200
3340 167
3332 122
 1200 137
1010 123
1101 60
3335 300
3321 200
3340 155
3332 122
 1200 127
1010 123
1101 60
3335 300
3321 200
3340 164
3332 122
 1200 137
1010 123
1101 60
3335 300
3321 200
3340 145
3332 122
 1200 127
1010 122
1101 60
3335 300
3321 200
3340 164
3332 122
 1200 131
1010 123
1101 60
3335 300
3321 200
3340 175
3332 122
 1200 127
1010 121
1101 60
3335 300
3321 200
3340 155
3332 122
 1200 127
1010 123
1101 59
3335 300
3321 200
3340 167
3332 122
 1200 131
1010 115
1101 60
3335 300
3321 200
3340 175
3332 122

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(){
  int n,m,d[100],p,pp,s,a,b,c,i,j;
  while(scanf("%d",&n),n){
    for(j=0;j<n;j++){
      s=0;
      a=b=c=1;
      scanf("%d",&m);
      for(i=0;i<10;i++){
	scanf("%d",&p);
	s+=p*a;//printf("!%d %d %d %d %d",s,i,a,b,c);
	if(p==10){
	  if(i<9){
	    b++;
	    c++;
	  }
	}
	a=b;
	b=c;
	c=1;
	if(p-10||i==9){
	  scanf("%d",&pp);
	  s+=pp*a;//printf("!!%d %d %d %d %d",s,i,a,b,c);
	  if(p+pp==10){
	    b++;
	  }
	  a=b;
	  b=c;
	  c=1;
	}//printf("\n");
      }
      if(p+pp>=10){
 	scanf("%d",&p);
	s+=p;
      }
      s=(300-s)*10000+m;
      //printf("%d\n",s);
      for(i=j;j&&d[i-1]>s;i--)d[i]=d[i-1];
      d[i]=s;
      //for(i=0;i<=j;i++)printf("!%d %d",300-d[i]/10000,d[i]%10000);printf("\n");
    }
    for(i=0;i<n;i++)printf("%d %d\n",d[i]%10000,300-d[i]/10000);
  }
  return 0;
}

```

Unoptimized Assembly Code:

```assembly
	.file	"temp.c"
	.text
	.section	.rodata
.LC0:
	.string	"%d"
.LC1:
	.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	$464, %rsp
	movq	%fs:40, %rax
	movq	%rax, -8(%rbp)
	xorl	%eax, %eax
	jmp	.L2
.L17:
	movl	$0, -420(%rbp)
	jmp	.L3
.L14:
	movl	$0, -440(%rbp)
	movl	$1, -428(%rbp)
	movl	-428(%rbp), %eax
	movl	%eax, -432(%rbp)
	movl	-432(%rbp), %eax
	movl	%eax, -436(%rbp)
	leaq	-452(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	$0, -424(%rbp)
	jmp	.L4
.L9:
	leaq	-448(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	-448(%rbp), %eax
	imull	-436(%rbp), %eax
	addl	%eax, -440(%rbp)
	movl	-448(%rbp), %eax
	cmpl	$10, %eax
	jne	.L5
	cmpl	$8, -424(%rbp)
	jg	.L5
	addl	$1, -432(%rbp)
	addl	$1, -428(%rbp)
.L5:
	movl	-432(%rbp), %eax
	movl	%eax, -436(%rbp)
	movl	-428(%rbp), %eax
	movl	%eax, -432(%rbp)
	movl	$1, -428(%rbp)
	movl	-448(%rbp), %eax
	cmpl	$10, %eax
	jne	.L6
	cmpl	$9, -424(%rbp)
	jne	.L7
.L6:
	leaq	-444(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	-444(%rbp), %eax
	imull	-436(%rbp), %eax
	addl	%eax, -440(%rbp)
	movl	-448(%rbp), %edx
	movl	-444(%rbp), %eax
	addl	%edx, %eax
	cmpl	$10, %eax
	jne	.L8
	addl	$1, -432(%rbp)
.L8:
	movl	-432(%rbp), %eax
	movl	%eax, -436(%rbp)
	movl	-428(%rbp), %eax
	movl	%eax, -432(%rbp)
	movl	$1, -428(%rbp)
.L7:
	addl	$1, -424(%rbp)
.L4:
	cmpl	$9, -424(%rbp)
	jle	.L9
	movl	-448(%rbp), %edx
	movl	-444(%rbp), %eax
	addl	%edx, %eax
	cmpl	$9, %eax
	jle	.L10
	leaq	-448(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	-448(%rbp), %eax
	addl	%eax, -440(%rbp)
.L10:
	movl	$300, %eax
	subl	-440(%rbp), %eax
	imull	$10000, %eax, %edx
	movl	-452(%rbp), %eax
	addl	%edx, %eax
	movl	%eax, -440(%rbp)
	movl	-420(%rbp), %eax
	movl	%eax, -424(%rbp)
	jmp	.L11
.L13:
	movl	-424(%rbp), %eax
	subl	$1, %eax
	cltq
	movl	-416(%rbp,%rax,4), %edx
	movl	-424(%rbp), %eax
	cltq
	movl	%edx, -416(%rbp,%rax,4)
	subl	$1, -424(%rbp)
.L11:
	cmpl	$0, -420(%rbp)
	je	.L12
	movl	-424(%rbp), %eax
	subl	$1, %eax
	cltq
	movl	-416(%rbp,%rax,4), %eax
	cmpl	%eax, -440(%rbp)
	jl	.L13
.L12:
	movl	-424(%rbp), %eax
	cltq
	movl	-440(%rbp), %edx
	movl	%edx, -416(%rbp,%rax,4)
	addl	$1, -420(%rbp)
.L3:
	movl	-456(%rbp), %eax
	cmpl	%eax, -420(%rbp)
	jl	.L14
	movl	$0, -424(%rbp)
	jmp	.L15
.L16:
	movl	-424(%rbp), %eax
	cltq
	movl	-416(%rbp,%rax,4), %eax
	movslq	%eax, %rdx
	imulq	$1759218605, %rdx, %rdx
	shrq	$32, %rdx
	sarl	$12, %edx
	sarl	$31, %eax
	subl	%edx, %eax
	leal	300(%rax), %ecx
	movl	-424(%rbp), %eax
	cltq
	movl	-416(%rbp,%rax,4), %edx
	movslq	%edx, %rax
	imulq	$1759218605, %rax, %rax
	shrq	$32, %rax
	sarl	$12, %eax
	movl	%edx, %esi
	sarl	$31, %esi
	subl	%esi, %eax
	imull	$10000, %eax, %esi
	movl	%edx, %eax
	subl	%esi, %eax
	movl	%ecx, %edx
	movl	%eax, %esi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	addl	$1, -424(%rbp)
.L15:
	movl	-456(%rbp), %eax
	cmpl	%eax, -424(%rbp)
	jl	.L16
.L2:
	leaq	-456(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	-456(%rbp), %eax
	testl	%eax, %eax
	jne	.L17
	movl	$0, %eax
	movq	-8(%rbp), %rdx
	subq	%fs:40, %rdx
	je	.L19
	call	__stack_chk_fail@PLT
.L19:
	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.
val
	.file	"temp.c"
	.text
	.section	.rodata
.LC0:
	.string	"%d"
.LC1:
	.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	$464, %rsp
	movq	%fs:40, %rax
	movq	%rax, -8(%rbp)
	xorl	%eax, %eax
	jmp	.L2
.L17:
	movl	$0, -420(%rbp)
	jmp	.L3
.L14:
	movl	$0, -440(%rbp)
	movl	$1, -428(%rbp)
	movl	-428(%rbp), %eax
	movl	%eax, -432(%rbp)
	movl	-432(%rbp), %eax
	movl	%eax, -436(%rbp)
	leaq	-452(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	$0, -424(%rbp)
	jmp	.L4
.L9:
	leaq	-448(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	-448(%rbp), %eax
	imull	-436(%rbp), %eax
	addl	%eax, -440(%rbp)
	movl	-448(%rbp), %eax
	cmpl	$10, %eax
	jne	.L5
	cmpl	$8, -424(%rbp)
	jg	.L5
	addl	$1, -432(%rbp)
	addl	$1, -428(%rbp)
.L5:
	movl	-432(%rbp), %eax
	movl	%eax, -436(%rbp)
	movl	-428(%rbp), %eax
	movl	%eax, -432(%rbp)
	movl	$1, -428(%rbp)
	movl	-448(%rbp), %eax
	cmpl	$10, %eax
	jne	.L6
	cmpl	$9, -424(%rbp)
	jne	.L7
.L6:
	leaq	-444(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	-444(%rbp), %eax
	imull	-436(%rbp), %eax
	addl	%eax, -440(%rbp)
	movl	-448(%rbp), %edx
	movl	-444(%rbp), %eax
	addl	%edx, %eax
	cmpl	$10, %eax
	jne	.L8
	addl	$1, -432(%rbp)
.L8:
	movl	-432(%rbp), %eax
	movl	%eax, -436(%rbp)
	movl	-428(%rbp), %eax
	movl	%eax, -432(%rbp)
	movl	$1, -428(%rbp)
.L7:
	addl	$1, -424(%rbp)
.L4:
	cmpl	$9, -424(%rbp)
	jle	.L9
	movl	-448(%rbp), %edx
	movl	-444(%rbp), %eax
	addl	%edx, %eax
	cmpl	$9, %eax
	jle	.L10
	leaq	-448(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	-448(%rbp), %eax
	addl	%eax, -440(%rbp)
.L10:
	movl	$300, %eax
	subl	-440(%rbp), %eax
	imull	$10000, %eax, %edx
	movl	-452(%rbp), %eax
	addl	%edx, %eax
	movl	%eax, -440(%rbp)
	movl	-420(%rbp), %eax
	movl	%eax, -424(%rbp)
	jmp	.L11
.L13:
	movl	-424(%rbp), %eax
	subl	$1, %eax
	cltq
	movl	-416(%rbp,%rax,4), %edx
	movl	-424(%rbp), %eax
	cltq
	movl	%edx, -416(%rbp,%rax,4)
	subl	$1, -424(%rbp)
.L11:
	cmpl	$0, -420(%rbp)
	je	.L12
	movl	-424(%rbp), %eax
	subl	$1, %eax
	cltq
	movl	-416(%rbp,%rax,4), %eax
	cmpl	%eax, -440(%rbp)
	jl	.L13
.L12:
	movl	-424(%rbp), %eax
	cltq
	movl	-440(%rbp), %edx
	movl	%edx, -416(%rbp,%rax,4)
	addl	$1, -420(%rbp)
.L3:
	movl	-456(%rbp), %eax
	cmpl	%eax, -420(%rbp)
	jl	.L14
	movl	$0, -424(%rbp)
	jmp	.L15
.L16:
	movl	-424(%rbp), %eax
	cltq
	movl	-416(%rbp,%rax,4), %eax
	movslq	%eax, %rdx
	imulq	$1759218605, %rdx, %rdx
	shrq	$32, %rdx
	sarl	$12, %edx
	sarl	$31, %eax
	subl	%edx, %eax
	leal	300(%rax), %ecx
	movl	-424(%rbp), %eax
	cltq
	movl	-416(%rbp,%rax,4), %edx
	movslq	%edx, %rax
	imulq	$1759218605, %rax, %rax
	shrq	$32, %rax
	sarl	$12, %eax
	movl	%edx, %esi
	sarl	$31, %esi
	subl	%esi, %eax
	imull	$10000, %eax, %esi
	movl	%edx, %eax
	subl	%esi, %eax
	movl	%ecx, %edx
	movl	%eax, %esi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	addl	$1, -424(%rbp)
.L15:
	movl	-456(%rbp), %eax
	cmpl	%eax, -424(%rbp)
	jl	.L16
.L2:
	leaq	-456(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	-456(%rbp), %eax
	testl	%eax, %eax
	jne	.L17
	movl	$0, %eax
	movq	-8(%rbp), %rdx
	subq	%fs:40, %rdx
	je	.L19
	call	__stack_chk_fail@PLT
.L19:
	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:
