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>

typedef struct{
  int I;
  int U;
  int A;
  int P;
}T;

T TT[300],tmp;

int main()
{
  int i,j,n,UU[1001],SS[1001],head;

  while(1){
    scanf("%d",&n);   
    if(n==0)break;
    for(i=0;i<1001;i++)UU[i]=0;
    for(i=0;i<n;i++){
      scanf("%d%d%d%d",&TT[i].I,&TT[i].U,&TT[i].A,&TT[i].P);
    }  
    for(i=0;i<n;i++){
      for(j=n-1;j>i;j--){
	if(TT[j].A>TT[j-1].A){
          tmp=TT[j];
	  TT[j]=TT[j-1];
	  TT[j-1]=tmp;
	}
        else if(TT[j].A==TT[j-1].A && TT[j].P<TT[j-1].P){
	  tmp=TT[j];
	  TT[j]=TT[j-1];
	  TT[j-1]=tmp;
	}
        else if(TT[j].A==TT[j-1].A && TT[j].P==TT[j-1].P && TT[j].I<TT[j-1].I){
	  tmp=TT[j];
	  TT[j]=TT[j-1];
	  TT[j-1]=tmp;
	}
      }
    }
    for(i=0,head=0;i<n;i++){
      UU[TT[i].U]++;
      if(head<10 && UU[TT[i].U]<=3){
        SS[head]=TT[i].I;
	head++;
      }
      else if(head<20 && UU[TT[i].U]<=2){ 
	SS[head]=TT[i].I;
	head++;
      }
      else if(head<26 && UU[TT[i].U]<=1){
 	SS[head]=TT[i].I;
	head++;
      }
    }
    for(i=0;i<head;i++)printf("%d\n",SS[i]);
  }
  return 0;
}```

Unoptimized Assembly Code:

```assembly
	.file	"temp.c"
	.text
	.globl	TT
	.bss
	.align 32
	.type	TT, @object
	.size	TT, 4800
TT:
	.zero	4800
	.globl	tmp
	.align 16
	.type	tmp, @object
	.size	tmp, 16
tmp:
	.zero	16
	.section	.rodata
.LC0:
	.string	"%d"
.LC1:
	.string	"%d%d%d%d"
.LC2:
	.string	"%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	$4096, %rsp
	orq	$0, (%rsp)
	subq	$3952, %rsp
	movq	%fs:40, %rax
	movq	%rax, -8(%rbp)
	xorl	%eax, %eax
.L22:
	leaq	-8048(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	-8048(%rbp), %eax
	testl	%eax, %eax
	je	.L26
	movl	$0, -8044(%rbp)
	jmp	.L4
.L5:
	movl	-8044(%rbp), %eax
	cltq
	movl	$0, -8032(%rbp,%rax,4)
	addl	$1, -8044(%rbp)
.L4:
	cmpl	$1000, -8044(%rbp)
	jle	.L5
	movl	$0, -8044(%rbp)
	jmp	.L6
.L7:
	movl	-8044(%rbp), %eax
	cltq
	salq	$4, %rax
	movq	%rax, %rdx
	leaq	TT(%rip), %rax
	addq	%rdx, %rax
	leaq	12(%rax), %rsi
	movl	-8044(%rbp), %eax
	cltq
	salq	$4, %rax
	movq	%rax, %rdx
	leaq	TT(%rip), %rax
	addq	%rdx, %rax
	leaq	8(%rax), %rcx
	movl	-8044(%rbp), %eax
	cltq
	salq	$4, %rax
	movq	%rax, %rdx
	leaq	TT(%rip), %rax
	addq	%rdx, %rax
	leaq	4(%rax), %rdx
	movl	-8044(%rbp), %eax
	cltq
	salq	$4, %rax
	movq	%rax, %rdi
	leaq	TT(%rip), %rax
	addq	%rdi, %rax
	movq	%rsi, %r8
	movq	%rax, %rsi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	addl	$1, -8044(%rbp)
.L6:
	movl	-8048(%rbp), %eax
	cmpl	%eax, -8044(%rbp)
	jl	.L7
	movl	$0, -8044(%rbp)
	jmp	.L8
.L14:
	movl	-8048(%rbp), %eax
	subl	$1, %eax
	movl	%eax, -8040(%rbp)
	jmp	.L9
.L13:
	movl	-8040(%rbp), %eax
	cltq
	salq	$4, %rax
	movq	%rax, %rdx
	leaq	8+TT(%rip), %rax
	movl	(%rdx,%rax), %edx
	movl	-8040(%rbp), %eax
	subl	$1, %eax
	cltq
	salq	$4, %rax
	movq	%rax, %rcx
	leaq	8+TT(%rip), %rax
	movl	(%rcx,%rax), %eax
	cmpl	%eax, %edx
	jle	.L10
	movl	-8040(%rbp), %eax
	cltq
	salq	$4, %rax
	movq	%rax, %rdx
	leaq	TT(%rip), %rax
	leaq	(%rdx,%rax), %rdx
	movq	(%rdx), %rax
	movq	8(%rdx), %rdx
	movq	%rax, tmp(%rip)
	movq	%rdx, 8+tmp(%rip)
	movl	-8040(%rbp), %eax
	leal	-1(%rax), %edx
	movl	-8040(%rbp), %eax
	cltq
	salq	$4, %rax
	movq	%rax, %rsi
	leaq	TT(%rip), %rcx
	movslq	%edx, %rax
	salq	$4, %rax
	movq	%rax, %rdx
	leaq	TT(%rip), %rax
	leaq	(%rdx,%rax), %rdx
	movq	(%rdx), %rax
	movq	8(%rdx), %rdx
	movq	%rax, (%rsi,%rcx)
	movq	%rdx, 8(%rsi,%rcx)
	movl	-8040(%rbp), %eax
	subl	$1, %eax
	cltq
	salq	$4, %rax
	movq	%rax, %rsi
	leaq	TT(%rip), %rcx
	movq	tmp(%rip), %rax
	movq	8+tmp(%rip), %rdx
	movq	%rax, (%rsi,%rcx)
	movq	%rdx, 8(%rsi,%rcx)
	jmp	.L11
.L10:
	movl	-8040(%rbp), %eax
	cltq
	salq	$4, %rax
	movq	%rax, %rdx
	leaq	8+TT(%rip), %rax
	movl	(%rdx,%rax), %edx
	movl	-8040(%rbp), %eax
	subl	$1, %eax
	cltq
	salq	$4, %rax
	movq	%rax, %rcx
	leaq	8+TT(%rip), %rax
	movl	(%rcx,%rax), %eax
	cmpl	%eax, %edx
	jne	.L12
	movl	-8040(%rbp), %eax
	cltq
	salq	$4, %rax
	movq	%rax, %rdx
	leaq	12+TT(%rip), %rax
	movl	(%rdx,%rax), %edx
	movl	-8040(%rbp), %eax
	subl	$1, %eax
	cltq
	salq	$4, %rax
	movq	%rax, %rcx
	leaq	12+TT(%rip), %rax
	movl	(%rcx,%rax), %eax
	cmpl	%eax, %edx
	jge	.L12
	movl	-8040(%rbp), %eax
	cltq
	salq	$4, %rax
	movq	%rax, %rdx
	leaq	TT(%rip), %rax
	leaq	(%rdx,%rax), %rdx
	movq	(%rdx), %rax
	movq	8(%rdx), %rdx
	movq	%rax, tmp(%rip)
	movq	%rdx, 8+tmp(%rip)
	movl	-8040(%rbp), %eax
	leal	-1(%rax), %edx
	movl	-8040(%rbp), %eax
	cltq
	salq	$4, %rax
	movq	%rax, %rsi
	leaq	TT(%rip), %rcx
	movslq	%edx, %rax
	salq	$4, %rax
	movq	%rax, %rdx
	leaq	TT(%rip), %rax
	leaq	(%rdx,%rax), %rdx
	movq	(%rdx), %rax
	movq	8(%rdx), %rdx
	movq	%rax, (%rsi,%rcx)
	movq	%rdx, 8(%rsi,%rcx)
	movl	-8040(%rbp), %eax
	subl	$1, %eax
	cltq
	salq	$4, %rax
	movq	%rax, %rsi
	leaq	TT(%rip), %rcx
	movq	tmp(%rip), %rax
	movq	8+tmp(%rip), %rdx
	movq	%rax, (%rsi,%rcx)
	movq	%rdx, 8(%rsi,%rcx)
	jmp	.L11
.L12:
	movl	-8040(%rbp), %eax
	cltq
	salq	$4, %rax
	movq	%rax, %rdx
	leaq	8+TT(%rip), %rax
	movl	(%rdx,%rax), %edx
	movl	-8040(%rbp), %eax
	subl	$1, %eax
	cltq
	salq	$4, %rax
	movq	%rax, %rcx
	leaq	8+TT(%rip), %rax
	movl	(%rcx,%rax), %eax
	cmpl	%eax, %edx
	jne	.L11
	movl	-8040(%rbp), %eax
	cltq
	salq	$4, %rax
	movq	%rax, %rdx
	leaq	12+TT(%rip), %rax
	movl	(%rdx,%rax), %edx
	movl	-8040(%rbp), %eax
	subl	$1, %eax
	cltq
	salq	$4, %rax
	movq	%rax, %rcx
	leaq	12+TT(%rip), %rax
	movl	(%rcx,%rax), %eax
	cmpl	%eax, %edx
	jne	.L11
	movl	-8040(%rbp), %eax
	cltq
	salq	$4, %rax
	movq	%rax, %rdx
	leaq	TT(%rip), %rax
	movl	(%rdx,%rax), %edx
	movl	-8040(%rbp), %eax
	subl	$1, %eax
	cltq
	salq	$4, %rax
	movq	%rax, %rcx
	leaq	TT(%rip), %rax
	movl	(%rcx,%rax), %eax
	cmpl	%eax, %edx
	jge	.L11
	movl	-8040(%rbp), %eax
	cltq
	salq	$4, %rax
	movq	%rax, %rdx
	leaq	TT(%rip), %rax
	leaq	(%rdx,%rax), %rdx
	movq	(%rdx), %rax
	movq	8(%rdx), %rdx
	movq	%rax, tmp(%rip)
	movq	%rdx, 8+tmp(%rip)
	movl	-8040(%rbp), %eax
	leal	-1(%rax), %edx
	movl	-8040(%rbp), %eax
	cltq
	salq	$4, %rax
	movq	%rax, %rsi
	leaq	TT(%rip), %rcx
	movslq	%edx, %rax
	salq	$4, %rax
	movq	%rax, %rdx
	leaq	TT(%rip), %rax
	leaq	(%rdx,%rax), %rdx
	movq	(%rdx), %rax
	movq	8(%rdx), %rdx
	movq	%rax, (%rsi,%rcx)
	movq	%rdx, 8(%rsi,%rcx)
	movl	-8040(%rbp), %eax
	subl	$1, %eax
	cltq
	salq	$4, %rax
	movq	%rax, %rsi
	leaq	TT(%rip), %rcx
	movq	tmp(%rip), %rax
	movq	8+tmp(%rip), %rdx
	movq	%rax, (%rsi,%rcx)
	movq	%rdx, 8(%rsi,%rcx)
.L11:
	subl	$1, -8040(%rbp)
.L9:
	movl	-8040(%rbp), %eax
	cmpl	-8044(%rbp), %eax
	jg	.L13
	addl	$1, -8044(%rbp)
.L8:
	movl	-8048(%rbp), %eax
	cmpl	%eax, -8044(%rbp)
	jl	.L14
	movl	$0, -8044(%rbp)
	movl	$0, -8036(%rbp)
	jmp	.L15
.L19:
	movl	-8044(%rbp), %eax
	cltq
	salq	$4, %rax
	movq	%rax, %rdx
	leaq	4+TT(%rip), %rax
	movl	(%rdx,%rax), %eax
	movslq	%eax, %rdx
	movl	-8032(%rbp,%rdx,4), %edx
	addl	$1, %edx
	cltq
	movl	%edx, -8032(%rbp,%rax,4)
	cmpl	$9, -8036(%rbp)
	jg	.L16
	movl	-8044(%rbp), %eax
	cltq
	salq	$4, %rax
	movq	%rax, %rdx
	leaq	4+TT(%rip), %rax
	movl	(%rdx,%rax), %eax
	cltq
	movl	-8032(%rbp,%rax,4), %eax
	cmpl	$3, %eax
	jg	.L16
	movl	-8044(%rbp), %eax
	cltq
	salq	$4, %rax
	movq	%rax, %rdx
	leaq	TT(%rip), %rax
	movl	(%rdx,%rax), %edx
	movl	-8036(%rbp), %eax
	cltq
	movl	%edx, -4016(%rbp,%rax,4)
	addl	$1, -8036(%rbp)
	jmp	.L17
.L16:
	cmpl	$19, -8036(%rbp)
	jg	.L18
	movl	-8044(%rbp), %eax
	cltq
	salq	$4, %rax
	movq	%rax, %rdx
	leaq	4+TT(%rip), %rax
	movl	(%rdx,%rax), %eax
	cltq
	movl	-8032(%rbp,%rax,4), %eax
	cmpl	$2, %eax
	jg	.L18
	movl	-8044(%rbp), %eax
	cltq
	salq	$4, %rax
	movq	%rax, %rdx
	leaq	TT(%rip), %rax
	movl	(%rdx,%rax), %edx
	movl	-8036(%rbp), %eax
	cltq
	movl	%edx, -4016(%rbp,%rax,4)
	addl	$1, -8036(%rbp)
	jmp	.L17
.L18:
	cmpl	$25, -8036(%rbp)
	jg	.L17
	movl	-8044(%rbp), %eax
	cltq
	salq	$4, %rax
	movq	%rax, %rdx
	leaq	4+TT(%rip), %rax
	movl	(%rdx,%rax), %eax
	cltq
	movl	-8032(%rbp,%rax,4), %eax
	cmpl	$1, %eax
	jg	.L17
	movl	-8044(%rbp), %eax
	cltq
	salq	$4, %rax
	movq	%rax, %rdx
	leaq	TT(%rip), %rax
	movl	(%rdx,%rax), %edx
	movl	-8036(%rbp), %eax
	cltq
	movl	%edx, -4016(%rbp,%rax,4)
	addl	$1, -8036(%rbp)
.L17:
	addl	$1, -8044(%rbp)
.L15:
	movl	-8048(%rbp), %eax
	cmpl	%eax, -8044(%rbp)
	jl	.L19
	movl	$0, -8044(%rbp)
	jmp	.L20
.L21:
	movl	-8044(%rbp), %eax
	cltq
	movl	-4016(%rbp,%rax,4), %eax
	movl	%eax, %esi
	leaq	.LC2(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	addl	$1, -8044(%rbp)
.L20:
	movl	-8044(%rbp), %eax
	cmpl	-8036(%rbp), %eax
	jl	.L21
	jmp	.L22
.L26:
	nop
	movl	$0, %eax
	movq	-8(%rbp), %rdx
	subq	%fs:40, %rdx
	je	.L24
	call	__stack_chk_fail@PLT
.L24:
	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%d%d"
.LC2:
	.string	"%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	$4096, %rsp
	.cfi_def_cfa_offset 4152
	orq	$0, (%rsp)
	subq	$3976, %rsp
	.cfi_def_cfa_offset 8128
	leaq	.LC1(%rip), %r12
	leaq	.LC2(%rip), %rbp
	movq	%fs:40, %rax
	movq	%rax, 8056(%rsp)
	xorl	%eax, %eax
	leaq	32(%rsp), %rax
	leaq	28(%rsp), %r14
	movq	%rax, 8(%rsp)
	.p2align 4,,10
	.p2align 3
.L18:
	movq	%r14, %rsi
	leaq	.LC0(%rip), %rdi
	xorl	%eax, %eax
	call	__isoc99_scanf@PLT
	movl	28(%rsp), %eax
	testl	%eax, %eax
	je	.L2
	movq	8(%rsp), %rdi
	movl	$500, %ecx
	movl	$0, %eax
	rep stosq
	movl	$0, (%rdi)
	jle	.L18
	leaq	TT(%rip), %r13
	xorl	%r15d, %r15d
	movq	%r13, %rbx
	.p2align 4,,10
	.p2align 3
.L4:
	leaq	8(%rbx), %rcx
	leaq	4(%rbx), %rdx
	movq	%rbx, %rsi
	movq	%r12, %rdi
	leaq	12(%rbx), %r8
	xorl	%eax, %eax
	addl	$1, %r15d
	addq	$16, %rbx
	call	__isoc99_scanf@PLT
	movslq	28(%rsp), %rax
	cmpl	%r15d, %eax
	jg	.L4
	testl	%eax, %eax
	jle	.L18
	movl	%eax, %esi
	subl	$1, %esi
	je	.L5
	salq	$4, %rax
	leaq	TT(%rip), %rdi
	xorl	%ecx, %ecx
	leaq	-32(%rdi,%rax), %rdi
	.p2align 4,,10
	.p2align 3
.L7:
	movq	%rdi, %rax
	movl	%esi, %edx
	jmp	.L6
	.p2align 4,,10
	.p2align 3
.L36:
	movdqa	16(%rax), %xmm0
	movdqa	(%rax), %xmm1
	movaps	%xmm0, tmp(%rip)
	movaps	%xmm1, 16(%rax)
	movaps	%xmm0, (%rax)
.L9:
	subq	$16, %rax
	cmpl	%ecx, %edx
	jle	.L35
.L6:
	movl	8(%rax), %ebx
	subl	$1, %edx
	cmpl	%ebx, 24(%rax)
	jg	.L36
	jne	.L9
	movl	12(%rax), %ebx
	cmpl	%ebx, 28(%rax)
	jge	.L10
	movdqa	16(%rax), %xmm0
	movdqa	(%rax), %xmm2
	subq	$16, %rax
	movaps	%xmm2, 32(%rax)
	movaps	%xmm0, 16(%rax)
	movaps	%xmm0, tmp(%rip)
	cmpl	%ecx, %edx
	jg	.L6
	.p2align 4,,10
	.p2align 3
.L35:
	addl	$1, %ecx
	cmpl	%esi, %ecx
	jl	.L7
.L5:
	movl	%esi, %esi
	leaq	16+TT(%rip), %rax
	xorl	%edx, %edx
	salq	$4, %rsi
	leaq	(%rsi,%rax), %rcx
	jmp	.L15
	.p2align 4,,10
	.p2align 3
.L38:
	cmpl	$3, %eax
	jg	.L13
.L33:
	movl	0(%r13), %esi
	movslq	%edx, %rax
	addl	$1, %edx
	movl	%esi, 4048(%rsp,%rax,4)
.L13:
	addq	$16, %r13
	cmpq	%rcx, %r13
	je	.L37
.L15:
	movslq	4(%r13), %rsi
	movl	32(%rsp,%rsi,4), %eax
	addl	$1, %eax
	movl	%eax, 32(%rsp,%rsi,4)
	cmpl	$9, %edx
	jle	.L38
	cmpl	$19, %edx
	jle	.L39
	cmpl	$25, %edx
	jg	.L13
	cmpl	$1, %eax
	jle	.L33
	jmp	.L13
	.p2align 4,,10
	.p2align 3
.L10:
	jne	.L9
	movl	(%rax), %ebx
	cmpl	%ebx, 16(%rax)
	jge	.L9
	movdqa	16(%rax), %xmm0
	movdqa	(%rax), %xmm3
	movaps	%xmm0, tmp(%rip)
	movaps	%xmm3, 16(%rax)
	movaps	%xmm0, (%rax)
	jmp	.L9
	.p2align 4,,10
	.p2align 3
.L39:
	cmpl	$2, %eax
	jle	.L33
	jmp	.L13
	.p2align 4,,10
	.p2align 3
.L37:
	testl	%edx, %edx
	je	.L18
	leal	-1(%rdx), %eax
	leaq	4048(%rsp), %rbx
	leaq	4052(%rsp,%rax,4), %r13
	.p2align 4,,10
	.p2align 3
.L17:
	movl	(%rbx), %edx
	movq	%rbp, %rsi
	movl	$1, %edi
	xorl	%eax, %eax
	addq	$4, %rbx
	call	__printf_chk@PLT
	cmpq	%rbx, %r13
	jne	.L17
	jmp	.L18
.L2:
	movq	8056(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L40
	addq	$8072, %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
.L40:
	.cfi_restore_state
	call	__stack_chk_fail@PLT
	.cfi_endproc
.LFE23:
	.size	main, .-main
	.globl	tmp
	.bss
	.align 16
	.type	tmp, @object
	.size	tmp, 16
tmp:
	.zero	16
	.globl	TT
	.align 32
	.type	TT, @object
	.size	TT, 4800
TT:
	.zero	4800
	.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%d%d"
.LC2:
	.string	"%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	$4096, %rsp
	.cfi_def_cfa_offset 4152
	orq	$0, (%rsp)
	subq	$3976, %rsp
	.cfi_def_cfa_offset 8128
	leaq	.LC1(%rip), %r12
	leaq	.LC2(%rip), %rbp
	movq	%fs:40, %rax
	movq	%rax, 8056(%rsp)
	xorl	%eax, %eax
	leaq	32(%rsp), %rax
	leaq	28(%rsp), %r14
	movq	%rax, 8(%rsp)
	.p2align 4,,10
	.p2align 3
.L18:
	movq	%r14, %rsi
	leaq	.LC0(%rip), %rdi
	xorl	%eax, %eax
	call	__isoc99_scanf@PLT
	movl	28(%rsp), %eax
	testl	%eax, %eax
	je	.L2
	movq	8(%rsp), %rdi
	movl	$500, %ecx
	movl	$0, %eax
	rep stosq
	movl	$0, (%rdi)
	jle	.L18
	leaq	TT(%rip), %r13
	xorl	%r15d, %r15d
	movq	%r13, %rbx
	.p2align 4,,10
	.p2align 3
.L4:
	leaq	8(%rbx), %rcx
	leaq	4(%rbx), %rdx
	movq	%rbx, %rsi
	movq	%r12, %rdi
	leaq	12(%rbx), %r8
	xorl	%eax, %eax
	addl	$1, %r15d
	addq	$16, %rbx
	call	__isoc99_scanf@PLT
	movslq	28(%rsp), %rax
	cmpl	%r15d, %eax
	jg	.L4
	testl	%eax, %eax
	jle	.L18
	movl	%eax, %esi
	subl	$1, %esi
	je	.L5
	salq	$4, %rax
	leaq	TT(%rip), %rdi
	xorl	%ecx, %ecx
	leaq	-32(%rdi,%rax), %rdi
	.p2align 4,,10
	.p2align 3
.L7:
	movq	%rdi, %rax
	movl	%esi, %edx
	jmp	.L6
	.p2align 4,,10
	.p2align 3
.L36:
	movdqa	16(%rax), %xmm0
	movdqa	(%rax), %xmm1
	movaps	%xmm0, tmp(%rip)
	movaps	%xmm1, 16(%rax)
	movaps	%xmm0, (%rax)
.L9:
	subq	$16, %rax
	cmpl	%ecx, %edx
	jle	.L35
.L6:
	movl	8(%rax), %ebx
	subl	$1, %edx
	cmpl	%ebx, 24(%rax)
	jg	.L36
	jne	.L9
	movl	12(%rax), %ebx
	cmpl	%ebx, 28(%rax)
	jge	.L10
	movdqa	16(%rax), %xmm0
	movdqa	(%rax), %xmm2
	subq	$16, %rax
	movaps	%xmm2, 32(%rax)
	movaps	%xmm0, 16(%rax)
	movaps	%xmm0, tmp(%rip)
	cmpl	%ecx, %edx
	jg	.L6
	.p2align 4,,10
	.p2align 3
.L35:
	addl	$1, %ecx
	cmpl	%esi, %ecx
	jl	.L7
.L5:
	movl	%esi, %esi
	leaq	16+TT(%rip), %rax
	xorl	%edx, %edx
	salq	$4, %rsi
	leaq	(%rsi,%rax), %rcx
	jmp	.L15
	.p2align 4,,10
	.p2align 3
.L38:
	cmpl	$3, %eax
	jg	.L13
.L33:
	movl	0(%r13), %esi
	movslq	%edx, %rax
	addl	$1, %edx
	movl	%esi, 4048(%rsp,%rax,4)
.L13:
	addq	$16, %r13
	cmpq	%rcx, %r13
	je	.L37
.L15:
	movslq	4(%r13), %rsi
	movl	32(%rsp,%rsi,4), %eax
	addl	$1, %eax
	movl	%eax, 32(%rsp,%rsi,4)
	cmpl	$9, %edx
	jle	.L38
	cmpl	$19, %edx
	jle	.L39
	cmpl	$25, %edx
	jg	.L13
	cmpl	$1, %eax
	jle	.L33
	jmp	.L13
	.p2align 4,,10
	.p2align 3
.L10:
	jne	.L9
	movl	(%rax), %ebx
	cmpl	%ebx, 16(%rax)
	jge	.L9
	movdqa	16(%rax), %xmm0
	movdqa	(%rax), %xmm3
	movaps	%xmm0, tmp(%rip)
	movaps	%xmm3, 16(%rax)
	movaps	%xmm0, (%rax)
	jmp	.L9
	.p2align 4,,10
	.p2align 3
.L39:
	cmpl	$2, %eax
	jle	.L33
	jmp	.L13
	.p2align 4,,10
	.p2align 3
.L37:
	testl	%edx, %edx
	je	.L18
	leal	-1(%rdx), %eax
	leaq	4048(%rsp), %rbx
	leaq	4052(%rsp,%rax,4), %r13
	.p2align 4,,10
	.p2align 3
.L17:
	movl	(%rbx), %edx
	movq	%rbp, %rsi
	movl	$1, %edi
	xorl	%eax, %eax
	addq	$4, %rbx
	call	__printf_chk@PLT
	cmpq	%rbx, %r13
	jne	.L17
	jmp	.L18
.L2:
	movq	8056(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L40
	addq	$8072, %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
.L40:
	.cfi_restore_state
	call	__stack_chk_fail@PLT
	.cfi_endproc
.LFE23:
	.size	main, .-main
	.globl	tmp
	.bss
	.align 16
	.type	tmp, @object
	.size	tmp, 16
tmp:
	.zero	16
	.globl	TT
	.align 32
	.type	TT, @object
	.size	TT, 4800
TT:
	.zero	4800
	.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>

typedef struct{
  int I;
  int U;
  int A;
  int P;
}T;

T TT[300],tmp;

int main()
{
  int i,j,n,UU[1001],SS[1001],head;

  while(1){
    scanf("%d",&n);   
    if(n==0)break;
    for(i=0;i<1001;i++)UU[i]=0;
    for(i=0;i<n;i++){
      scanf("%d%d%d%d",&TT[i].I,&TT[i].U,&TT[i].A,&TT[i].P);
    }  
    for(i=0;i<n;i++){
      for(j=n-1;j>i;j--){
	if(TT[j].A>TT[j-1].A){
          tmp=TT[j];
	  TT[j]=TT[j-1];
	  TT[j-1]=tmp;
	}
        else if(TT[j].A==TT[j-1].A && TT[j].P<TT[j-1].P){
	  tmp=TT[j];
	  TT[j]=TT[j-1];
	  TT[j-1]=tmp;
	}
        else if(TT[j].A==TT[j-1].A && TT[j].P==TT[j-1].P && TT[j].I<TT[j-1].I){
	  tmp=TT[j];
	  TT[j]=TT[j-1];
	  TT[j-1]=tmp;
	}
      }
    }
    for(i=0,head=0;i<n;i++){
      UU[TT[i].U]++;
      if(head<10 && UU[TT[i].U]<=3){
        SS[head]=TT[i].I;
	head++;
      }
      else if(head<20 && UU[TT[i].U]<=2){ 
	SS[head]=TT[i].I;
	head++;
      }
      else if(head<26 && UU[TT[i].U]<=1){
 	SS[head]=TT[i].I;
	head++;
      }
    }
    for(i=0;i<head;i++)printf("%d\n",SS[i]);
  }
  return 0;
}
6
1 1 6 200
2 1 11 300
3 1 6 400
4 2 5 1200
5 1 5 1400
6 3 4 800
3
777 1 5 300
808 2 4 20
123 3 6 500
2
2 1 3 100
1 1 3 100
0
 6
1 1 6 200
2 1 11 300
3 0 6 400
4 2 5 1200
5 1 5 1400
6 3 4 800
3
777 1 5 300
808 2 4 20
123 3 6 500
2
2 1 3 100
1 1 3 100
0
 6
1 1 6 200
2 1 11 300
3 0 6 400
4 2 5 1200
5 1 5 1674
6 4 4 800
3
777 1 5 300
808 2 4 20
123 3 6 500
2
2 1 3 100
1 1 2 100
0
 6
1 1 6 200
2 1 11 300
3 0 1 400
4 0 5 1200
5 0 5 1674
6 4 4 9
3
777 1 5 300
808 2 4 20
123 3 6 500
2
2 1 3 100
1 1 2 100
0
 6
1 1 6 200
2 1 11 300
3 0 1 400
4 0 5 1200
5 0 5 1674
6 4 4 9
3
1015 1 5 300
808 2 4 20
123 3 6 500
2
2 1 3 100
1 1 2 100
0
 6
1 1 6 200
2 1 6 300
3 1 6 400
4 2 5 1200
5 1 5 1400
6 3 4 800
3
777 1 5 300
808 2 4 38
123 3 6 500
2
2 1 3 100
1 1 3 100
0
 6
1 1 6 200
2 1 11 300
3 0 6 400
4 2 5 1200
5 1 5 1400
6 3 4 800
3
187 1 5 300
808 2 4 20
123 3 6 500
2
2 1 3 100
1 1 3 100
0
 6
1 1 6 200
2 1 11 300
3 0 6 400
4 2 5 1200
5 1 5 1674
6 4 4 800
3
777 1 5 300
34 2 4 20
123 3 6 500
2
2 1 3 100
1 1 2 100
0
 6
1 1 6 200
2 1 11 300
3 0 6 400
4 2 5 1200
5 0 5 1674
6 4 4 800
3
777 1 5 300
808 2 4 20
123 3 6 500
2
4 1 3 100
1 1 2 100
0
 6
1 0 6 200
2 1 11 300
3 0 1 400
4 0 5 1200
5 0 5 1674
6 4 4 9
3
777 1 5 300
808 2 4 20
123 3 6 500
2
2 1 3 100
1 1 2 100
0

2
1
3
4
6
123
777
808
1
2
 2
1
3
4
5
6
123
777
808
1
2
 2
1
3
4
5
6
123
777
808
2
1
 2
1
4
5
6
3
123
777
808
2
1
 2
1
4
5
6
3
123
1015
808
2
1
 1
2
3
4
6
123
777
808
1
2
 2
1
3
4
5
6
123
187
808
1
2
 2
1
3
4
5
6
123
777
34
2
1
 2
1
3
4
5
6
123
777
808
4
1
 2
1
4
5
6
123
777
808
2
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>

typedef struct{
  int I;
  int U;
  int A;
  int P;
}T;

T TT[300],tmp;

int main()
{
  int i,j,n,UU[1001],SS[1001],head;

  while(1){
    scanf("%d",&n);   
    if(n==0)break;
    for(i=0;i<1001;i++)UU[i]=0;
    for(i=0;i<n;i++){
      scanf("%d%d%d%d",&TT[i].I,&TT[i].U,&TT[i].A,&TT[i].P);
    }  
    for(i=0;i<n;i++){
      for(j=n-1;j>i;j--){
	if(TT[j].A>TT[j-1].A){
          tmp=TT[j];
	  TT[j]=TT[j-1];
	  TT[j-1]=tmp;
	}
        else if(TT[j].A==TT[j-1].A && TT[j].P<TT[j-1].P){
	  tmp=TT[j];
	  TT[j]=TT[j-1];
	  TT[j-1]=tmp;
	}
        else if(TT[j].A==TT[j-1].A && TT[j].P==TT[j-1].P && TT[j].I<TT[j-1].I){
	  tmp=TT[j];
	  TT[j]=TT[j-1];
	  TT[j-1]=tmp;
	}
      }
    }
    for(i=0,head=0;i<n;i++){
      UU[TT[i].U]++;
      if(head<10 && UU[TT[i].U]<=3){
        SS[head]=TT[i].I;
	head++;
      }
      else if(head<20 && UU[TT[i].U]<=2){ 
	SS[head]=TT[i].I;
	head++;
      }
      else if(head<26 && UU[TT[i].U]<=1){
 	SS[head]=TT[i].I;
	head++;
      }
    }
    for(i=0;i<head;i++)printf("%d\n",SS[i]);
  }
  return 0;
}```

Unoptimized Assembly Code:

```assembly
	.file	"temp.c"
	.text
	.globl	TT
	.bss
	.align 32
	.type	TT, @object
	.size	TT, 4800
TT:
	.zero	4800
	.globl	tmp
	.align 16
	.type	tmp, @object
	.size	tmp, 16
tmp:
	.zero	16
	.section	.rodata
.LC0:
	.string	"%d"
.LC1:
	.string	"%d%d%d%d"
.LC2:
	.string	"%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	$4096, %rsp
	orq	$0, (%rsp)
	subq	$3952, %rsp
	movq	%fs:40, %rax
	movq	%rax, -8(%rbp)
	xorl	%eax, %eax
.L22:
	leaq	-8048(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	-8048(%rbp), %eax
	testl	%eax, %eax
	je	.L26
	movl	$0, -8044(%rbp)
	jmp	.L4
.L5:
	movl	-8044(%rbp), %eax
	cltq
	movl	$0, -8032(%rbp,%rax,4)
	addl	$1, -8044(%rbp)
.L4:
	cmpl	$1000, -8044(%rbp)
	jle	.L5
	movl	$0, -8044(%rbp)
	jmp	.L6
.L7:
	movl	-8044(%rbp), %eax
	cltq
	salq	$4, %rax
	movq	%rax, %rdx
	leaq	TT(%rip), %rax
	addq	%rdx, %rax
	leaq	12(%rax), %rsi
	movl	-8044(%rbp), %eax
	cltq
	salq	$4, %rax
	movq	%rax, %rdx
	leaq	TT(%rip), %rax
	addq	%rdx, %rax
	leaq	8(%rax), %rcx
	movl	-8044(%rbp), %eax
	cltq
	salq	$4, %rax
	movq	%rax, %rdx
	leaq	TT(%rip), %rax
	addq	%rdx, %rax
	leaq	4(%rax), %rdx
	movl	-8044(%rbp), %eax
	cltq
	salq	$4, %rax
	movq	%rax, %rdi
	leaq	TT(%rip), %rax
	addq	%rdi, %rax
	movq	%rsi, %r8
	movq	%rax, %rsi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	addl	$1, -8044(%rbp)
.L6:
	movl	-8048(%rbp), %eax
	cmpl	%eax, -8044(%rbp)
	jl	.L7
	movl	$0, -8044(%rbp)
	jmp	.L8
.L14:
	movl	-8048(%rbp), %eax
	subl	$1, %eax
	movl	%eax, -8040(%rbp)
	jmp	.L9
.L13:
	movl	-8040(%rbp), %eax
	cltq
	salq	$4, %rax
	movq	%rax, %rdx
	leaq	8+TT(%rip), %rax
	movl	(%rdx,%rax), %edx
	movl	-8040(%rbp), %eax
	subl	$1, %eax
	cltq
	salq	$4, %rax
	movq	%rax, %rcx
	leaq	8+TT(%rip), %rax
	movl	(%rcx,%rax), %eax
	cmpl	%eax, %edx
	jle	.L10
	movl	-8040(%rbp), %eax
	cltq
	salq	$4, %rax
	movq	%rax, %rdx
	leaq	TT(%rip), %rax
	leaq	(%rdx,%rax), %rdx
	movq	(%rdx), %rax
	movq	8(%rdx), %rdx
	movq	%rax, tmp(%rip)
	movq	%rdx, 8+tmp(%rip)
	movl	-8040(%rbp), %eax
	leal	-1(%rax), %edx
	movl	-8040(%rbp), %eax
	cltq
	salq	$4, %rax
	movq	%rax, %rsi
	leaq	TT(%rip), %rcx
	movslq	%edx, %rax
	salq	$4, %rax
	movq	%rax, %rdx
	leaq	TT(%rip), %rax
	leaq	(%rdx,%rax), %rdx
	movq	(%rdx), %rax
	movq	8(%rdx), %rdx
	movq	%rax, (%rsi,%rcx)
	movq	%rdx, 8(%rsi,%rcx)
	movl	-8040(%rbp), %eax
	subl	$1, %eax
	cltq
	salq	$4, %rax
	movq	%rax, %rsi
	leaq	TT(%rip), %rcx
	movq	tmp(%rip), %rax
	movq	8+tmp(%rip), %rdx
	movq	%rax, (%rsi,%rcx)
	movq	%rdx, 8(%rsi,%rcx)
	jmp	.L11
.L10:
	movl	-8040(%rbp), %eax
	cltq
	salq	$4, %rax
	movq	%rax, %rdx
	leaq	8+TT(%rip), %rax
	movl	(%rdx,%rax), %edx
	movl	-8040(%rbp), %eax
	subl	$1, %eax
	cltq
	salq	$4, %rax
	movq	%rax, %rcx
	leaq	8+TT(%rip), %rax
	movl	(%rcx,%rax), %eax
	cmpl	%eax, %edx
	jne	.L12
	movl	-8040(%rbp), %eax
	cltq
	salq	$4, %rax
	movq	%rax, %rdx
	leaq	12+TT(%rip), %rax
	movl	(%rdx,%rax), %edx
	movl	-8040(%rbp), %eax
	subl	$1, %eax
	cltq
	salq	$4, %rax
	movq	%rax, %rcx
	leaq	12+TT(%rip), %rax
	movl	(%rcx,%rax), %eax
	cmpl	%eax, %edx
	jge	.L12
	movl	-8040(%rbp), %eax
	cltq
	salq	$4, %rax
	movq	%rax, %rdx
	leaq	TT(%rip), %rax
	leaq	(%rdx,%rax), %rdx
	movq	(%rdx), %rax
	movq	8(%rdx), %rdx
	movq	%rax, tmp(%rip)
	movq	%rdx, 8+tmp(%rip)
	movl	-8040(%rbp), %eax
	leal	-1(%rax), %edx
	movl	-8040(%rbp), %eax
	cltq
	salq	$4, %rax
	movq	%rax, %rsi
	leaq	TT(%rip), %rcx
	movslq	%edx, %rax
	salq	$4, %rax
	movq	%rax, %rdx
	leaq	TT(%rip), %rax
	leaq	(%rdx,%rax), %rdx
	movq	(%rdx), %rax
	movq	8(%rdx), %rdx
	movq	%rax, (%rsi,%rcx)
	movq	%rdx, 8(%rsi,%rcx)
	movl	-8040(%rbp), %eax
	subl	$1, %eax
	cltq
	salq	$4, %rax
	movq	%rax, %rsi
	leaq	TT(%rip), %rcx
	movq	tmp(%rip), %rax
	movq	8+tmp(%rip), %rdx
	movq	%rax, (%rsi,%rcx)
	movq	%rdx, 8(%rsi,%rcx)
	jmp	.L11
.L12:
	movl	-8040(%rbp), %eax
	cltq
	salq	$4, %rax
	movq	%rax, %rdx
	leaq	8+TT(%rip), %rax
	movl	(%rdx,%rax), %edx
	movl	-8040(%rbp), %eax
	subl	$1, %eax
	cltq
	salq	$4, %rax
	movq	%rax, %rcx
	leaq	8+TT(%rip), %rax
	movl	(%rcx,%rax), %eax
	cmpl	%eax, %edx
	jne	.L11
	movl	-8040(%rbp), %eax
	cltq
	salq	$4, %rax
	movq	%rax, %rdx
	leaq	12+TT(%rip), %rax
	movl	(%rdx,%rax), %edx
	movl	-8040(%rbp), %eax
	subl	$1, %eax
	cltq
	salq	$4, %rax
	movq	%rax, %rcx
	leaq	12+TT(%rip), %rax
	movl	(%rcx,%rax), %eax
	cmpl	%eax, %edx
	jne	.L11
	movl	-8040(%rbp), %eax
	cltq
	salq	$4, %rax
	movq	%rax, %rdx
	leaq	TT(%rip), %rax
	movl	(%rdx,%rax), %edx
	movl	-8040(%rbp), %eax
	subl	$1, %eax
	cltq
	salq	$4, %rax
	movq	%rax, %rcx
	leaq	TT(%rip), %rax
	movl	(%rcx,%rax), %eax
	cmpl	%eax, %edx
	jge	.L11
	movl	-8040(%rbp), %eax
	cltq
	salq	$4, %rax
	movq	%rax, %rdx
	leaq	TT(%rip), %rax
	leaq	(%rdx,%rax), %rdx
	movq	(%rdx), %rax
	movq	8(%rdx), %rdx
	movq	%rax, tmp(%rip)
	movq	%rdx, 8+tmp(%rip)
	movl	-8040(%rbp), %eax
	leal	-1(%rax), %edx
	movl	-8040(%rbp), %eax
	cltq
	salq	$4, %rax
	movq	%rax, %rsi
	leaq	TT(%rip), %rcx
	movslq	%edx, %rax
	salq	$4, %rax
	movq	%rax, %rdx
	leaq	TT(%rip), %rax
	leaq	(%rdx,%rax), %rdx
	movq	(%rdx), %rax
	movq	8(%rdx), %rdx
	movq	%rax, (%rsi,%rcx)
	movq	%rdx, 8(%rsi,%rcx)
	movl	-8040(%rbp), %eax
	subl	$1, %eax
	cltq
	salq	$4, %rax
	movq	%rax, %rsi
	leaq	TT(%rip), %rcx
	movq	tmp(%rip), %rax
	movq	8+tmp(%rip), %rdx
	movq	%rax, (%rsi,%rcx)
	movq	%rdx, 8(%rsi,%rcx)
.L11:
	subl	$1, -8040(%rbp)
.L9:
	movl	-8040(%rbp), %eax
	cmpl	-8044(%rbp), %eax
	jg	.L13
	addl	$1, -8044(%rbp)
.L8:
	movl	-8048(%rbp), %eax
	cmpl	%eax, -8044(%rbp)
	jl	.L14
	movl	$0, -8044(%rbp)
	movl	$0, -8036(%rbp)
	jmp	.L15
.L19:
	movl	-8044(%rbp), %eax
	cltq
	salq	$4, %rax
	movq	%rax, %rdx
	leaq	4+TT(%rip), %rax
	movl	(%rdx,%rax), %eax
	movslq	%eax, %rdx
	movl	-8032(%rbp,%rdx,4), %edx
	addl	$1, %edx
	cltq
	movl	%edx, -8032(%rbp,%rax,4)
	cmpl	$9, -8036(%rbp)
	jg	.L16
	movl	-8044(%rbp), %eax
	cltq
	salq	$4, %rax
	movq	%rax, %rdx
	leaq	4+TT(%rip), %rax
	movl	(%rdx,%rax), %eax
	cltq
	movl	-8032(%rbp,%rax,4), %eax
	cmpl	$3, %eax
	jg	.L16
	movl	-8044(%rbp), %eax
	cltq
	salq	$4, %rax
	movq	%rax, %rdx
	leaq	TT(%rip), %rax
	movl	(%rdx,%rax), %edx
	movl	-8036(%rbp), %eax
	cltq
	movl	%edx, -4016(%rbp,%rax,4)
	addl	$1, -8036(%rbp)
	jmp	.L17
.L16:
	cmpl	$19, -8036(%rbp)
	jg	.L18
	movl	-8044(%rbp), %eax
	cltq
	salq	$4, %rax
	movq	%rax, %rdx
	leaq	4+TT(%rip), %rax
	movl	(%rdx,%rax), %eax
	cltq
	movl	-8032(%rbp,%rax,4), %eax
	cmpl	$2, %eax
	jg	.L18
	movl	-8044(%rbp), %eax
	cltq
	salq	$4, %rax
	movq	%rax, %rdx
	leaq	TT(%rip), %rax
	movl	(%rdx,%rax), %edx
	movl	-8036(%rbp), %eax
	cltq
	movl	%edx, -4016(%rbp,%rax,4)
	addl	$1, -8036(%rbp)
	jmp	.L17
.L18:
	cmpl	$25, -8036(%rbp)
	jg	.L17
	movl	-8044(%rbp), %eax
	cltq
	salq	$4, %rax
	movq	%rax, %rdx
	leaq	4+TT(%rip), %rax
	movl	(%rdx,%rax), %eax
	cltq
	movl	-8032(%rbp,%rax,4), %eax
	cmpl	$1, %eax
	jg	.L17
	movl	-8044(%rbp), %eax
	cltq
	salq	$4, %rax
	movq	%rax, %rdx
	leaq	TT(%rip), %rax
	movl	(%rdx,%rax), %edx
	movl	-8036(%rbp), %eax
	cltq
	movl	%edx, -4016(%rbp,%rax,4)
	addl	$1, -8036(%rbp)
.L17:
	addl	$1, -8044(%rbp)
.L15:
	movl	-8048(%rbp), %eax
	cmpl	%eax, -8044(%rbp)
	jl	.L19
	movl	$0, -8044(%rbp)
	jmp	.L20
.L21:
	movl	-8044(%rbp), %eax
	cltq
	movl	-4016(%rbp,%rax,4), %eax
	movl	%eax, %esi
	leaq	.LC2(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	addl	$1, -8044(%rbp)
.L20:
	movl	-8044(%rbp), %eax
	cmpl	-8036(%rbp), %eax
	jl	.L21
	jmp	.L22
.L26:
	nop
	movl	$0, %eax
	movq	-8(%rbp), %rdx
	subq	%fs:40, %rdx
	je	.L24
	call	__stack_chk_fail@PLT
.L24:
	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
	.globl	TT
	.bss
	.align 32
	.type	TT, @object
	.size	TT, 4800
TT:
	.zero	4800
	.globl	tmp
	.align 16
	.type	tmp, @object
	.size	tmp, 16
tmp:
	.zero	16
	.section	.rodata
.LC0:
	.string	"%d"
.LC1:
	.string	"%d%d%d%d"
.LC2:
	.string	"%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	$4096, %rsp
	orq	$0, (%rsp)
	subq	$3952, %rsp
	movq	%fs:40, %rax
	movq	%rax, -8(%rbp)
	xorl	%eax, %eax
.L22:
	leaq	-8048(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	-8048(%rbp), %eax
	testl	%eax, %eax
	je	.L26
	movl	$0, -8044(%rbp)
	jmp	.L4
.L5:
	movl	-8044(%rbp), %eax
	cltq
	movl	$0, -8032(%rbp,%rax,4)
	addl	$1, -8044(%rbp)
.L4:
	cmpl	$1000, -8044(%rbp)
	jle	.L5
	movl	$0, -8044(%rbp)
	jmp	.L6
.L7:
	movl	-8044(%rbp), %eax
	cltq
	salq	$4, %rax
	movq	%rax, %rdx
	leaq	TT(%rip), %rax
	addq	%rdx, %rax
	leaq	12(%rax), %rsi
	movl	-8044(%rbp), %eax
	cltq
	salq	$4, %rax
	movq	%rax, %rdx
	leaq	TT(%rip), %rax
	addq	%rdx, %rax
	leaq	8(%rax), %rcx
	movl	-8044(%rbp), %eax
	cltq
	salq	$4, %rax
	movq	%rax, %rdx
	leaq	TT(%rip), %rax
	addq	%rdx, %rax
	leaq	4(%rax), %rdx
	movl	-8044(%rbp), %eax
	cltq
	salq	$4, %rax
	movq	%rax, %rdi
	leaq	TT(%rip), %rax
	addq	%rdi, %rax
	movq	%rsi, %r8
	movq	%rax, %rsi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	addl	$1, -8044(%rbp)
.L6:
	movl	-8048(%rbp), %eax
	cmpl	%eax, -8044(%rbp)
	jl	.L7
	movl	$0, -8044(%rbp)
	jmp	.L8
.L14:
	movl	-8048(%rbp), %eax
	subl	$1, %eax
	movl	%eax, -8040(%rbp)
	jmp	.L9
.L13:
	movl	-8040(%rbp), %eax
	cltq
	salq	$4, %rax
	movq	%rax, %rdx
	leaq	8+TT(%rip), %rax
	movl	(%rdx,%rax), %edx
	movl	-8040(%rbp), %eax
	subl	$1, %eax
	cltq
	salq	$4, %rax
	movq	%rax, %rcx
	leaq	8+TT(%rip), %rax
	movl	(%rcx,%rax), %eax
	cmpl	%eax, %edx
	jle	.L10
	movl	-8040(%rbp), %eax
	cltq
	salq	$4, %rax
	movq	%rax, %rdx
	leaq	TT(%rip), %rax
	leaq	(%rdx,%rax), %rdx
	movq	(%rdx), %rax
	movq	8(%rdx), %rdx
	movq	%rax, tmp(%rip)
	movq	%rdx, 8+tmp(%rip)
	movl	-8040(%rbp), %eax
	leal	-1(%rax), %edx
	movl	-8040(%rbp), %eax
	cltq
	salq	$4, %rax
	movq	%rax, %rsi
	leaq	TT(%rip), %rcx
	movslq	%edx, %rax
	salq	$4, %rax
	movq	%rax, %rdx
	leaq	TT(%rip), %rax
	leaq	(%rdx,%rax), %rdx
	movq	(%rdx), %rax
	movq	8(%rdx), %rdx
	movq	%rax, (%rsi,%rcx)
	movq	%rdx, 8(%rsi,%rcx)
	movl	-8040(%rbp), %eax
	subl	$1, %eax
	cltq
	salq	$4, %rax
	movq	%rax, %rsi
	leaq	TT(%rip), %rcx
	movq	tmp(%rip), %rax
	movq	8+tmp(%rip), %rdx
	movq	%rax, (%rsi,%rcx)
	movq	%rdx, 8(%rsi,%rcx)
	jmp	.L11
.L10:
	movl	-8040(%rbp), %eax
	cltq
	salq	$4, %rax
	movq	%rax, %rdx
	leaq	8+TT(%rip), %rax
	movl	(%rdx,%rax), %edx
	movl	-8040(%rbp), %eax
	subl	$1, %eax
	cltq
	salq	$4, %rax
	movq	%rax, %rcx
	leaq	8+TT(%rip), %rax
	movl	(%rcx,%rax), %eax
	cmpl	%eax, %edx
	jne	.L12
	movl	-8040(%rbp), %eax
	cltq
	salq	$4, %rax
	movq	%rax, %rdx
	leaq	12+TT(%rip), %rax
	movl	(%rdx,%rax), %edx
	movl	-8040(%rbp), %eax
	subl	$1, %eax
	cltq
	salq	$4, %rax
	movq	%rax, %rcx
	leaq	12+TT(%rip), %rax
	movl	(%rcx,%rax), %eax
	cmpl	%eax, %edx
	jge	.L12
	movl	-8040(%rbp), %eax
	cltq
	salq	$4, %rax
	movq	%rax, %rdx
	leaq	TT(%rip), %rax
	leaq	(%rdx,%rax), %rdx
	movq	(%rdx), %rax
	movq	8(%rdx), %rdx
	movq	%rax, tmp(%rip)
	movq	%rdx, 8+tmp(%rip)
	movl	-8040(%rbp), %eax
	leal	-1(%rax), %edx
	movl	-8040(%rbp), %eax
	cltq
	salq	$4, %rax
	movq	%rax, %rsi
	leaq	TT(%rip), %rcx
	movslq	%edx, %rax
	salq	$4, %rax
	movq	%rax, %rdx
	leaq	TT(%rip), %rax
	leaq	(%rdx,%rax), %rdx
	movq	(%rdx), %rax
	movq	8(%rdx), %rdx
	movq	%rax, (%rsi,%rcx)
	movq	%rdx, 8(%rsi,%rcx)
	movl	-8040(%rbp), %eax
	subl	$1, %eax
	cltq
	salq	$4, %rax
	movq	%rax, %rsi
	leaq	TT(%rip), %rcx
	movq	tmp(%rip), %rax
	movq	8+tmp(%rip), %rdx
	movq	%rax, (%rsi,%rcx)
	movq	%rdx, 8(%rsi,%rcx)
	jmp	.L11
.L12:
	movl	-8040(%rbp), %eax
	cltq
	salq	$4, %rax
	movq	%rax, %rdx
	leaq	8+TT(%rip), %rax
	movl	(%rdx,%rax), %edx
	movl	-8040(%rbp), %eax
	subl	$1, %eax
	cltq
	salq	$4, %rax
	movq	%rax, %rcx
	leaq	8+TT(%rip), %rax
	movl	(%rcx,%rax), %eax
	cmpl	%eax, %edx
	jne	.L11
	movl	-8040(%rbp), %eax
	cltq
	salq	$4, %rax
	movq	%rax, %rdx
	leaq	12+TT(%rip), %rax
	movl	(%rdx,%rax), %edx
	movl	-8040(%rbp), %eax
	subl	$1, %eax
	cltq
	salq	$4, %rax
	movq	%rax, %rcx
	leaq	12+TT(%rip), %rax
	movl	(%rcx,%rax), %eax
	cmpl	%eax, %edx
	jne	.L11
	movl	-8040(%rbp), %eax
	cltq
	salq	$4, %rax
	movq	%rax, %rdx
	leaq	TT(%rip), %rax
	movl	(%rdx,%rax), %edx
	movl	-8040(%rbp), %eax
	subl	$1, %eax
	cltq
	salq	$4, %rax
	movq	%rax, %rcx
	leaq	TT(%rip), %rax
	movl	(%rcx,%rax), %eax
	cmpl	%eax, %edx
	jge	.L11
	movl	-8040(%rbp), %eax
	cltq
	salq	$4, %rax
	movq	%rax, %rdx
	leaq	TT(%rip), %rax
	leaq	(%rdx,%rax), %rdx
	movq	(%rdx), %rax
	movq	8(%rdx), %rdx
	movq	%rax, tmp(%rip)
	movq	%rdx, 8+tmp(%rip)
	movl	-8040(%rbp), %eax
	leal	-1(%rax), %edx
	movl	-8040(%rbp), %eax
	cltq
	salq	$4, %rax
	movq	%rax, %rsi
	leaq	TT(%rip), %rcx
	movslq	%edx, %rax
	salq	$4, %rax
	movq	%rax, %rdx
	leaq	TT(%rip), %rax
	leaq	(%rdx,%rax), %rdx
	movq	(%rdx), %rax
	movq	8(%rdx), %rdx
	movq	%rax, (%rsi,%rcx)
	movq	%rdx, 8(%rsi,%rcx)
	movl	-8040(%rbp), %eax
	subl	$1, %eax
	cltq
	salq	$4, %rax
	movq	%rax, %rsi
	leaq	TT(%rip), %rcx
	movq	tmp(%rip), %rax
	movq	8+tmp(%rip), %rdx
	movq	%rax, (%rsi,%rcx)
	movq	%rdx, 8(%rsi,%rcx)
.L11:
	subl	$1, -8040(%rbp)
.L9:
	movl	-8040(%rbp), %eax
	cmpl	-8044(%rbp), %eax
	jg	.L13
	addl	$1, -8044(%rbp)
.L8:
	movl	-8048(%rbp), %eax
	cmpl	%eax, -8044(%rbp)
	jl	.L14
	movl	$0, -8044(%rbp)
	movl	$0, -8036(%rbp)
	jmp	.L15
.L19:
	movl	-8044(%rbp), %eax
	cltq
	salq	$4, %rax
	movq	%rax, %rdx
	leaq	4+TT(%rip), %rax
	movl	(%rdx,%rax), %eax
	movslq	%eax, %rdx
	movl	-8032(%rbp,%rdx,4), %edx
	addl	$1, %edx
	cltq
	movl	%edx, -8032(%rbp,%rax,4)
	cmpl	$9, -8036(%rbp)
	jg	.L16
	movl	-8044(%rbp), %eax
	cltq
	salq	$4, %rax
	movq	%rax, %rdx
	leaq	4+TT(%rip), %rax
	movl	(%rdx,%rax), %eax
	cltq
	movl	-8032(%rbp,%rax,4), %eax
	cmpl	$3, %eax
	jg	.L16
	movl	-8044(%rbp), %eax
	cltq
	salq	$4, %rax
	movq	%rax, %rdx
	leaq	TT(%rip), %rax
	movl	(%rdx,%rax), %edx
	movl	-8036(%rbp), %eax
	cltq
	movl	%edx, -4016(%rbp,%rax,4)
	addl	$1, -8036(%rbp)
	jmp	.L17
.L16:
	cmpl	$19, -8036(%rbp)
	jg	.L18
	movl	-8044(%rbp), %eax
	cltq
	salq	$4, %rax
	movq	%rax, %rdx
	leaq	4+TT(%rip), %rax
	movl	(%rdx,%rax), %eax
	cltq
	movl	-8032(%rbp,%rax,4), %eax
	cmpl	$2, %eax
	jg	.L18
	movl	-8044(%rbp), %eax
	cltq
	salq	$4, %rax
	movq	%rax, %rdx
	leaq	TT(%rip), %rax
	movl	(%rdx,%rax), %edx
	movl	-8036(%rbp), %eax
	cltq
	movl	%edx, -4016(%rbp,%rax,4)
	addl	$1, -8036(%rbp)
	jmp	.L17
.L18:
	cmpl	$25, -8036(%rbp)
	jg	.L17
	movl	-8044(%rbp), %eax
	cltq
	salq	$4, %rax
	movq	%rax, %rdx
	leaq	4+TT(%rip), %rax
	movl	(%rdx,%rax), %eax
	cltq
	movl	-8032(%rbp,%rax,4), %eax
	cmpl	$1, %eax
	jg	.L17
	movl	-8044(%rbp), %eax
	cltq
	salq	$4, %rax
	movq	%rax, %rdx
	leaq	TT(%rip), %rax
	movl	(%rdx,%rax), %edx
	movl	-8036(%rbp), %eax
	cltq
	movl	%edx, -4016(%rbp,%rax,4)
	addl	$1, -8036(%rbp)
.L17:
	addl	$1, -8044(%rbp)
.L15:
	movl	-8048(%rbp), %eax
	cmpl	%eax, -8044(%rbp)
	jl	.L19
	movl	$0, -8044(%rbp)
	jmp	.L20
.L21:
	movl	-8044(%rbp), %eax
	cltq
	movl	-4016(%rbp,%rax,4), %eax
	movl	%eax, %esi
	leaq	.LC2(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	addl	$1, -8044(%rbp)
.L20:
	movl	-8044(%rbp), %eax
	cmpl	-8036(%rbp), %eax
	jl	.L21
	jmp	.L22
.L26:
	nop
	movl	$0, %eax
	movq	-8(%rbp), %rdx
	subq	%fs:40, %rdx
	je	.L24
	call	__stack_chk_fail@PLT
.L24:
	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:
