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,w,l,d,a,p[20],r[20],s=0;
  char t[10][22];
  int i,j;
  while(1){
    scanf("%d",&n);
    if(n==0)break;
    for(i=0;i<n;i++){
      r[i]=i;
      scanf("%s %d %d %d",&t[i],&w,&l,&d);
      p[i]=3*w+d;
    }
    for(i=0;i<n;i++){
      for(j=1;i+j<n;j++){
	if(p[r[j-1]]<p[r[j]]){
	  a=r[j-1];
	  r[j-1]=r[j];
	  r[j]=a;
	}
      }
    }
    if(s!=0)printf("\n");
    s=1;
    for(i=0;i<n;i++){
      printf("%s,%d\n",t[r[i]],p[r[i]]);
    }
  }
  return 0;
}```

Unoptimized Assembly Code:

```assembly
	.file	"temp.c"
	.text
	.section	.rodata
.LC0:
	.string	"%d"
.LC1:
	.string	"%s %d %d %d"
.LC2:
	.string	"%s,%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	$432, %rsp
	movq	%fs:40, %rax
	movq	%rax, -8(%rbp)
	xorl	%eax, %eax
	movl	$0, -416(%rbp)
.L14:
	leaq	-432(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	-432(%rbp), %eax
	testl	%eax, %eax
	je	.L18
	movl	$0, -412(%rbp)
	jmp	.L4
.L5:
	movl	-412(%rbp), %eax
	cltq
	movl	-412(%rbp), %edx
	movl	%edx, -320(%rbp,%rax,4)
	leaq	-240(%rbp), %rcx
	movl	-412(%rbp), %eax
	movslq	%eax, %rdx
	movq	%rdx, %rax
	salq	$2, %rax
	addq	%rdx, %rax
	addq	%rax, %rax
	addq	%rdx, %rax
	addq	%rax, %rax
	leaq	(%rcx,%rax), %rsi
	leaq	-420(%rbp), %rcx
	leaq	-424(%rbp), %rdx
	leaq	-428(%rbp), %rax
	movq	%rcx, %r8
	movq	%rdx, %rcx
	movq	%rax, %rdx
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	-428(%rbp), %edx
	movl	%edx, %eax
	addl	%eax, %eax
	addl	%eax, %edx
	movl	-420(%rbp), %eax
	addl	%eax, %edx
	movl	-412(%rbp), %eax
	cltq
	movl	%edx, -400(%rbp,%rax,4)
	addl	$1, -412(%rbp)
.L4:
	movl	-432(%rbp), %eax
	cmpl	%eax, -412(%rbp)
	jl	.L5
	movl	$0, -412(%rbp)
	jmp	.L6
.L10:
	movl	$1, -408(%rbp)
	jmp	.L7
.L9:
	movl	-408(%rbp), %eax
	subl	$1, %eax
	cltq
	movl	-320(%rbp,%rax,4), %eax
	cltq
	movl	-400(%rbp,%rax,4), %edx
	movl	-408(%rbp), %eax
	cltq
	movl	-320(%rbp,%rax,4), %eax
	cltq
	movl	-400(%rbp,%rax,4), %eax
	cmpl	%eax, %edx
	jge	.L8
	movl	-408(%rbp), %eax
	subl	$1, %eax
	cltq
	movl	-320(%rbp,%rax,4), %eax
	movl	%eax, -404(%rbp)
	movl	-408(%rbp), %eax
	leal	-1(%rax), %ecx
	movl	-408(%rbp), %eax
	cltq
	movl	-320(%rbp,%rax,4), %edx
	movslq	%ecx, %rax
	movl	%edx, -320(%rbp,%rax,4)
	movl	-408(%rbp), %eax
	cltq
	movl	-404(%rbp), %edx
	movl	%edx, -320(%rbp,%rax,4)
.L8:
	addl	$1, -408(%rbp)
.L7:
	movl	-412(%rbp), %edx
	movl	-408(%rbp), %eax
	addl	%eax, %edx
	movl	-432(%rbp), %eax
	cmpl	%eax, %edx
	jl	.L9
	addl	$1, -412(%rbp)
.L6:
	movl	-432(%rbp), %eax
	cmpl	%eax, -412(%rbp)
	jl	.L10
	cmpl	$0, -416(%rbp)
	je	.L11
	movl	$10, %edi
	call	putchar@PLT
.L11:
	movl	$1, -416(%rbp)
	movl	$0, -412(%rbp)
	jmp	.L12
.L13:
	movl	-412(%rbp), %eax
	cltq
	movl	-320(%rbp,%rax,4), %eax
	cltq
	movl	-400(%rbp,%rax,4), %ecx
	movl	-412(%rbp), %eax
	cltq
	movl	-320(%rbp,%rax,4), %eax
	leaq	-240(%rbp), %rsi
	movslq	%eax, %rdx
	movq	%rdx, %rax
	salq	$2, %rax
	addq	%rdx, %rax
	addq	%rax, %rax
	addq	%rdx, %rax
	addq	%rax, %rax
	addq	%rsi, %rax
	movl	%ecx, %edx
	movq	%rax, %rsi
	leaq	.LC2(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	addl	$1, -412(%rbp)
.L12:
	movl	-432(%rbp), %eax
	cmpl	%eax, -412(%rbp)
	jl	.L13
	jmp	.L14
.L18:
	nop
	movl	$0, %eax
	movq	-8(%rbp), %rdx
	subq	%fs:40, %rdx
	je	.L16
	call	__stack_chk_fail@PLT
.L16:
	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	"%s %d %d %d"
.LC2:
	.string	"%s,%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
	subq	$472, %rsp
	.cfi_def_cfa_offset 528
	movq	%fs:40, %rax
	movq	%rax, 456(%rsp)
	xorl	%eax, %eax
	leaq	48(%rsp), %rax
	movl	$0, 36(%rsp)
	movq	%rax, 40(%rsp)
	leaq	148(%rsp), %rax
	movq	%rax, 16(%rsp)
	.p2align 4,,10
	.p2align 3
.L13:
	movq	40(%rsp), %rsi
	leaq	.LC0(%rip), %rdi
	xorl	%eax, %eax
	call	__isoc99_scanf@PLT
	movl	48(%rsp), %esi
	testl	%esi, %esi
	je	.L2
	jle	.L3
	leaq	224(%rsp), %rax
	xorl	%r12d, %r12d
	leaq	60(%rsp), %r15
	movq	%rax, 24(%rsp)
	movq	%rax, %rbp
	leaq	64(%rsp), %rax
	leaq	144(%rsp), %rbx
	movq	%rax, 8(%rsp)
	leaq	56(%rsp), %r14
	leaq	52(%rsp), %r13
	.p2align 4,,10
	.p2align 3
.L4:
	movq	%rbp, %rsi
	leaq	.LC1(%rip), %rdi
	movq	%r15, %r8
	movq	%r14, %rcx
	movq	%r13, %rdx
	xorl	%eax, %eax
	movl	%r12d, (%rbx,%r12,4)
	addq	$22, %rbp
	call	__isoc99_scanf@PLT
	movl	52(%rsp), %eax
	movq	8(%rsp), %rdi
	leal	(%rax,%rax,2), %eax
	addl	60(%rsp), %eax
	movl	%eax, (%rdi,%r12,4)
	movl	48(%rsp), %edi
	addq	$1, %r12
	cmpl	%r12d, %edi
	jg	.L4
	testl	%edi, %edi
	jle	.L3
	xorl	%r8d, %r8d
	leal	-1(%rdi), %r9d
.L5:
	addl	$1, %r8d
	cmpl	%r8d, %edi
	jle	.L27
	.p2align 4,,10
	.p2align 3
.L10:
	movq	16(%rsp), %rsi
	movl	%r9d, %eax
	movq	%rbx, %rdx
	subl	%r8d, %eax
	leaq	(%rsi,%rax,4), %rsi
	.p2align 4,,10
	.p2align 3
.L7:
	movq	(%rdx), %xmm0
	movslq	(%rdx), %rcx
	pshufd	$0xe5, %xmm0, %xmm2
	movd	%xmm2, %eax
	pshufd	$225, %xmm0, %xmm1
	cltq
	movl	64(%rsp,%rax,4), %eax
	cmpl	%eax, 64(%rsp,%rcx,4)
	jge	.L6
	movq	%xmm1, (%rdx)
.L6:
	addq	$4, %rdx
	cmpq	%rsi, %rdx
	jne	.L7
	addl	$1, %r8d
	cmpl	%r8d, %edi
	jg	.L10
.L27:
	jne	.L5
	movl	36(%rsp), %eax
	testl	%eax, %eax
	jne	.L16
.L12:
	movq	24(%rsp), %rbp
	xorl	%r12d, %r12d
	.p2align 4,,10
	.p2align 3
.L14:
	movslq	(%rbx,%r12,4), %rax
	leaq	.LC2(%rip), %rsi
	movl	$1, %edi
	addq	$1, %r12
	leaq	(%rax,%rax,4), %rdx
	movl	64(%rsp,%rax,4), %ecx
	leaq	(%rax,%rdx,2), %rax
	leaq	0(%rbp,%rax,2), %rdx
	xorl	%eax, %eax
	call	__printf_chk@PLT
	cmpl	%r12d, 48(%rsp)
	jg	.L14
.L15:
	movl	$1, 36(%rsp)
	jmp	.L13
.L3:
	movl	36(%rsp), %edx
	testl	%edx, %edx
	je	.L15
.L16:
	movl	$10, %edi
	leaq	144(%rsp), %rbx
	call	putchar@PLT
	movl	48(%rsp), %ecx
	leaq	224(%rsp), %rax
	movq	%rax, 24(%rsp)
	testl	%ecx, %ecx
	jg	.L12
	jmp	.L15
.L2:
	movq	456(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L28
	addq	$472, %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
.L28:
	.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	"%s %d %d %d"
.LC2:
	.string	"%s,%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
	subq	$472, %rsp
	.cfi_def_cfa_offset 528
	movq	%fs:40, %rax
	movq	%rax, 456(%rsp)
	xorl	%eax, %eax
	leaq	48(%rsp), %rax
	movl	$0, 36(%rsp)
	movq	%rax, 40(%rsp)
	leaq	148(%rsp), %rax
	movq	%rax, 16(%rsp)
	.p2align 4,,10
	.p2align 3
.L13:
	movq	40(%rsp), %rsi
	leaq	.LC0(%rip), %rdi
	xorl	%eax, %eax
	call	__isoc99_scanf@PLT
	movl	48(%rsp), %esi
	testl	%esi, %esi
	je	.L2
	jle	.L3
	leaq	224(%rsp), %rax
	xorl	%r12d, %r12d
	leaq	60(%rsp), %r15
	movq	%rax, 24(%rsp)
	movq	%rax, %rbp
	leaq	64(%rsp), %rax
	leaq	144(%rsp), %rbx
	movq	%rax, 8(%rsp)
	leaq	56(%rsp), %r14
	leaq	52(%rsp), %r13
	.p2align 4,,10
	.p2align 3
.L4:
	movq	%rbp, %rsi
	leaq	.LC1(%rip), %rdi
	movq	%r15, %r8
	movq	%r14, %rcx
	movq	%r13, %rdx
	xorl	%eax, %eax
	movl	%r12d, (%rbx,%r12,4)
	addq	$22, %rbp
	call	__isoc99_scanf@PLT
	movl	52(%rsp), %eax
	movq	8(%rsp), %rdi
	leal	(%rax,%rax,2), %eax
	addl	60(%rsp), %eax
	movl	%eax, (%rdi,%r12,4)
	movl	48(%rsp), %edi
	addq	$1, %r12
	cmpl	%r12d, %edi
	jg	.L4
	testl	%edi, %edi
	jle	.L3
	xorl	%r8d, %r8d
	leal	-1(%rdi), %r9d
.L5:
	addl	$1, %r8d
	cmpl	%r8d, %edi
	jle	.L27
	.p2align 4,,10
	.p2align 3
.L10:
	movq	16(%rsp), %rsi
	movl	%r9d, %eax
	movq	%rbx, %rdx
	subl	%r8d, %eax
	leaq	(%rsi,%rax,4), %rsi
	.p2align 4,,10
	.p2align 3
.L7:
	movq	(%rdx), %xmm0
	movslq	(%rdx), %rcx
	pshufd	$0xe5, %xmm0, %xmm2
	movd	%xmm2, %eax
	pshufd	$225, %xmm0, %xmm1
	cltq
	movl	64(%rsp,%rax,4), %eax
	cmpl	%eax, 64(%rsp,%rcx,4)
	jge	.L6
	movq	%xmm1, (%rdx)
.L6:
	addq	$4, %rdx
	cmpq	%rsi, %rdx
	jne	.L7
	addl	$1, %r8d
	cmpl	%r8d, %edi
	jg	.L10
.L27:
	jne	.L5
	movl	36(%rsp), %eax
	testl	%eax, %eax
	jne	.L16
.L12:
	movq	24(%rsp), %rbp
	xorl	%r12d, %r12d
	.p2align 4,,10
	.p2align 3
.L14:
	movslq	(%rbx,%r12,4), %rax
	leaq	.LC2(%rip), %rsi
	movl	$1, %edi
	addq	$1, %r12
	leaq	(%rax,%rax,4), %rdx
	movl	64(%rsp,%rax,4), %ecx
	leaq	(%rax,%rdx,2), %rax
	leaq	0(%rbp,%rax,2), %rdx
	xorl	%eax, %eax
	call	__printf_chk@PLT
	cmpl	%r12d, 48(%rsp)
	jg	.L14
.L15:
	movl	$1, 36(%rsp)
	jmp	.L13
.L3:
	movl	36(%rsp), %edx
	testl	%edx, %edx
	je	.L15
.L16:
	movl	$10, %edi
	leaq	144(%rsp), %rbx
	call	putchar@PLT
	movl	48(%rsp), %ecx
	leaq	224(%rsp), %rax
	movq	%rax, 24(%rsp)
	testl	%ecx, %ecx
	jg	.L12
	jmp	.L15
.L2:
	movq	456(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L28
	addq	$472, %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
.L28:
	.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,w,l,d,a,p[20],r[20],s=0;
  char t[10][22];
  int i,j;
  while(1){
    scanf("%d",&n);
    if(n==0)break;
    for(i=0;i<n;i++){
      r[i]=i;
      scanf("%s %d %d %d",&t[i],&w,&l,&d);
      p[i]=3*w+d;
    }
    for(i=0;i<n;i++){
      for(j=1;i+j<n;j++){
	if(p[r[j-1]]<p[r[j]]){
	  a=r[j-1];
	  r[j-1]=r[j];
	  r[j]=a;
	}
      }
    }
    if(s!=0)printf("\n");
    s=1;
    for(i=0;i<n;i++){
      printf("%s,%d\n",t[r[i]],p[r[i]]);
    }
  }
  return 0;
}
4
Japan 1 0 2
Egypt 1 2 0
Canada 0 2 1
Spain 2 0 1
3
India 0 2 0
Poland 1 0 1
Italy 1 -1 1
0
 4
Japan 1 0 2
Egypt 1 2 0
Canada 0 2 1
Spain 2 0 1
3
India 0 2 0
Poland 1 0 1
Italx 1 -1 1
0
 4
Japan 1 0 2
Egypt 1 2 0
Canada 0 2 1
niapS 2 0 1
3
India 0 2 0
Poland 1 0 1
Italy 1 1 1
0
 4
Japan 1 0 2
Egypt 1 2 0
Canada 0 2 1
Spain 2 0 1
3
India -1 2 0
Poland 1 0 1
Italx 1 -1 1
0
 4
Japan 1 0 2
Egypt 1 2 0
Caaadn 0 2 1
niapS 2 0 1
3
India 0 2 0
Poland 1 0 1
Italy 1 1 1
0
 4
Japan 1 0 2
Egypt 1 2 0
Canada 0 2 1
Spain 2 0 1
3
Jndia -1 2 0
Poland 1 0 1
Italx 1 -1 1
0
 4
Japan 1 0 2
Egypt 1 2 0
Caaadn 0 2 1
niapS 2 0 1
3
Iodia 0 2 0
Poland 1 0 1
Italy 1 1 1
0
 4
Japan 1 0 2
Egypt 1 2 0
Canada 0 2 1
Spain 1 0 1
3
Jndia -1 2 0
Poland 1 0 1
Italx 1 -1 1
0
 4
Japan 1 0 2
Egypt 1 2 0
Caaadn 0 2 1
niapS 2 0 1
3
Ioida 0 2 0
Poland 1 0 1
Italy 1 1 1
0
 4
Japan 1 0 2
Egypt 1 2 0
Caaadn 0 2 1
nibpS 2 0 1
3
Ioida 0 2 0
Poland 1 0 1
Italy 1 1 1
0

Spain,7
Japan,5
Egypt,3
Canada,1

Poland,4
Italy,4
India,0
 Spain,7
Japan,5
Egypt,3
Canada,1

Poland,4
Italx,4
India,0
 niapS,7
Japan,5
Egypt,3
Canada,1

Poland,4
Italy,4
India,0
 Spain,7
Japan,5
Egypt,3
Canada,1

Poland,4
Italx,4
India,-3
 niapS,7
Japan,5
Egypt,3
Caaadn,1

Poland,4
Italy,4
India,0
 Spain,7
Japan,5
Egypt,3
Canada,1

Poland,4
Italx,4
Jndia,-3
 niapS,7
Japan,5
Egypt,3
Caaadn,1

Poland,4
Italy,4
Iodia,0
 Japan,5
Spain,4
Egypt,3
Canada,1

Poland,4
Italx,4
Jndia,-3
 niapS,7
Japan,5
Egypt,3
Caaadn,1

Poland,4
Italy,4
Ioida,0
 nibpS,7
Japan,5
Egypt,3
Caaadn,1

Poland,4
Italy,4
Ioida,0

Given the following C code and unoptimized assembly code, your task is to generate highly optimized x86-64 assembly code.
C Code:

```c
#include<stdio.h>
int main(){
  int n,w,l,d,a,p[20],r[20],s=0;
  char t[10][22];
  int i,j;
  while(1){
    scanf("%d",&n);
    if(n==0)break;
    for(i=0;i<n;i++){
      r[i]=i;
      scanf("%s %d %d %d",&t[i],&w,&l,&d);
      p[i]=3*w+d;
    }
    for(i=0;i<n;i++){
      for(j=1;i+j<n;j++){
	if(p[r[j-1]]<p[r[j]]){
	  a=r[j-1];
	  r[j-1]=r[j];
	  r[j]=a;
	}
      }
    }
    if(s!=0)printf("\n");
    s=1;
    for(i=0;i<n;i++){
      printf("%s,%d\n",t[r[i]],p[r[i]]);
    }
  }
  return 0;
}```

Unoptimized Assembly Code:

```assembly
	.file	"temp.c"
	.text
	.section	.rodata
.LC0:
	.string	"%d"
.LC1:
	.string	"%s %d %d %d"
.LC2:
	.string	"%s,%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	$432, %rsp
	movq	%fs:40, %rax
	movq	%rax, -8(%rbp)
	xorl	%eax, %eax
	movl	$0, -416(%rbp)
.L14:
	leaq	-432(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	-432(%rbp), %eax
	testl	%eax, %eax
	je	.L18
	movl	$0, -412(%rbp)
	jmp	.L4
.L5:
	movl	-412(%rbp), %eax
	cltq
	movl	-412(%rbp), %edx
	movl	%edx, -320(%rbp,%rax,4)
	leaq	-240(%rbp), %rcx
	movl	-412(%rbp), %eax
	movslq	%eax, %rdx
	movq	%rdx, %rax
	salq	$2, %rax
	addq	%rdx, %rax
	addq	%rax, %rax
	addq	%rdx, %rax
	addq	%rax, %rax
	leaq	(%rcx,%rax), %rsi
	leaq	-420(%rbp), %rcx
	leaq	-424(%rbp), %rdx
	leaq	-428(%rbp), %rax
	movq	%rcx, %r8
	movq	%rdx, %rcx
	movq	%rax, %rdx
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	-428(%rbp), %edx
	movl	%edx, %eax
	addl	%eax, %eax
	addl	%eax, %edx
	movl	-420(%rbp), %eax
	addl	%eax, %edx
	movl	-412(%rbp), %eax
	cltq
	movl	%edx, -400(%rbp,%rax,4)
	addl	$1, -412(%rbp)
.L4:
	movl	-432(%rbp), %eax
	cmpl	%eax, -412(%rbp)
	jl	.L5
	movl	$0, -412(%rbp)
	jmp	.L6
.L10:
	movl	$1, -408(%rbp)
	jmp	.L7
.L9:
	movl	-408(%rbp), %eax
	subl	$1, %eax
	cltq
	movl	-320(%rbp,%rax,4), %eax
	cltq
	movl	-400(%rbp,%rax,4), %edx
	movl	-408(%rbp), %eax
	cltq
	movl	-320(%rbp,%rax,4), %eax
	cltq
	movl	-400(%rbp,%rax,4), %eax
	cmpl	%eax, %edx
	jge	.L8
	movl	-408(%rbp), %eax
	subl	$1, %eax
	cltq
	movl	-320(%rbp,%rax,4), %eax
	movl	%eax, -404(%rbp)
	movl	-408(%rbp), %eax
	leal	-1(%rax), %ecx
	movl	-408(%rbp), %eax
	cltq
	movl	-320(%rbp,%rax,4), %edx
	movslq	%ecx, %rax
	movl	%edx, -320(%rbp,%rax,4)
	movl	-408(%rbp), %eax
	cltq
	movl	-404(%rbp), %edx
	movl	%edx, -320(%rbp,%rax,4)
.L8:
	addl	$1, -408(%rbp)
.L7:
	movl	-412(%rbp), %edx
	movl	-408(%rbp), %eax
	addl	%eax, %edx
	movl	-432(%rbp), %eax
	cmpl	%eax, %edx
	jl	.L9
	addl	$1, -412(%rbp)
.L6:
	movl	-432(%rbp), %eax
	cmpl	%eax, -412(%rbp)
	jl	.L10
	cmpl	$0, -416(%rbp)
	je	.L11
	movl	$10, %edi
	call	putchar@PLT
.L11:
	movl	$1, -416(%rbp)
	movl	$0, -412(%rbp)
	jmp	.L12
.L13:
	movl	-412(%rbp), %eax
	cltq
	movl	-320(%rbp,%rax,4), %eax
	cltq
	movl	-400(%rbp,%rax,4), %ecx
	movl	-412(%rbp), %eax
	cltq
	movl	-320(%rbp,%rax,4), %eax
	leaq	-240(%rbp), %rsi
	movslq	%eax, %rdx
	movq	%rdx, %rax
	salq	$2, %rax
	addq	%rdx, %rax
	addq	%rax, %rax
	addq	%rdx, %rax
	addq	%rax, %rax
	addq	%rsi, %rax
	movl	%ecx, %edx
	movq	%rax, %rsi
	leaq	.LC2(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	addl	$1, -412(%rbp)
.L12:
	movl	-432(%rbp), %eax
	cmpl	%eax, -412(%rbp)
	jl	.L13
	jmp	.L14
.L18:
	nop
	movl	$0, %eax
	movq	-8(%rbp), %rdx
	subq	%fs:40, %rdx
	je	.L16
	call	__stack_chk_fail@PLT
.L16:
	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	"%s %d %d %d"
.LC2:
	.string	"%s,%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	$432, %rsp
	movq	%fs:40, %rax
	movq	%rax, -8(%rbp)
	xorl	%eax, %eax
	movl	$0, -416(%rbp)
.L14:
	leaq	-432(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	-432(%rbp), %eax
	testl	%eax, %eax
	je	.L18
	movl	$0, -412(%rbp)
	jmp	.L4
.L5:
	movl	-412(%rbp), %eax
	cltq
	movl	-412(%rbp), %edx
	movl	%edx, -320(%rbp,%rax,4)
	leaq	-240(%rbp), %rcx
	movl	-412(%rbp), %eax
	movslq	%eax, %rdx
	movq	%rdx, %rax
	salq	$2, %rax
	addq	%rdx, %rax
	addq	%rax, %rax
	addq	%rdx, %rax
	addq	%rax, %rax
	leaq	(%rcx,%rax), %rsi
	leaq	-420(%rbp), %rcx
	leaq	-424(%rbp), %rdx
	leaq	-428(%rbp), %rax
	movq	%rcx, %r8
	movq	%rdx, %rcx
	movq	%rax, %rdx
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	-428(%rbp), %edx
	movl	%edx, %eax
	addl	%eax, %eax
	addl	%eax, %edx
	movl	-420(%rbp), %eax
	addl	%eax, %edx
	movl	-412(%rbp), %eax
	cltq
	movl	%edx, -400(%rbp,%rax,4)
	addl	$1, -412(%rbp)
.L4:
	movl	-432(%rbp), %eax
	cmpl	%eax, -412(%rbp)
	jl	.L5
	movl	$0, -412(%rbp)
	jmp	.L6
.L10:
	movl	$1, -408(%rbp)
	jmp	.L7
.L9:
	movl	-408(%rbp), %eax
	subl	$1, %eax
	cltq
	movl	-320(%rbp,%rax,4), %eax
	cltq
	movl	-400(%rbp,%rax,4), %edx
	movl	-408(%rbp), %eax
	cltq
	movl	-320(%rbp,%rax,4), %eax
	cltq
	movl	-400(%rbp,%rax,4), %eax
	cmpl	%eax, %edx
	jge	.L8
	movl	-408(%rbp), %eax
	subl	$1, %eax
	cltq
	movl	-320(%rbp,%rax,4), %eax
	movl	%eax, -404(%rbp)
	movl	-408(%rbp), %eax
	leal	-1(%rax), %ecx
	movl	-408(%rbp), %eax
	cltq
	movl	-320(%rbp,%rax,4), %edx
	movslq	%ecx, %rax
	movl	%edx, -320(%rbp,%rax,4)
	movl	-408(%rbp), %eax
	cltq
	movl	-404(%rbp), %edx
	movl	%edx, -320(%rbp,%rax,4)
.L8:
	addl	$1, -408(%rbp)
.L7:
	movl	-412(%rbp), %edx
	movl	-408(%rbp), %eax
	addl	%eax, %edx
	movl	-432(%rbp), %eax
	cmpl	%eax, %edx
	jl	.L9
	addl	$1, -412(%rbp)
.L6:
	movl	-432(%rbp), %eax
	cmpl	%eax, -412(%rbp)
	jl	.L10
	cmpl	$0, -416(%rbp)
	je	.L11
	movl	$10, %edi
	call	putchar@PLT
.L11:
	movl	$1, -416(%rbp)
	movl	$0, -412(%rbp)
	jmp	.L12
.L13:
	movl	-412(%rbp), %eax
	cltq
	movl	-320(%rbp,%rax,4), %eax
	cltq
	movl	-400(%rbp,%rax,4), %ecx
	movl	-412(%rbp), %eax
	cltq
	movl	-320(%rbp,%rax,4), %eax
	leaq	-240(%rbp), %rsi
	movslq	%eax, %rdx
	movq	%rdx, %rax
	salq	$2, %rax
	addq	%rdx, %rax
	addq	%rax, %rax
	addq	%rdx, %rax
	addq	%rax, %rax
	addq	%rsi, %rax
	movl	%ecx, %edx
	movq	%rax, %rsi
	leaq	.LC2(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	addl	$1, -412(%rbp)
.L12:
	movl	-432(%rbp), %eax
	cmpl	%eax, -412(%rbp)
	jl	.L13
	jmp	.L14
.L18:
	nop
	movl	$0, %eax
	movq	-8(%rbp), %rdx
	subq	%fs:40, %rdx
	je	.L16
	call	__stack_chk_fail@PLT
.L16:
	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:
