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>
#define SQ(x) ((x)*(x))
#define IN(x,y) ((0<=x&&x<=5000)&&(0<=y&&y<=5000))


typedef struct{
  int x;
  int y;
}point;

char map[5001][5001];
point ps[3000];
int pi;
int st;

int main(){
  int i,j,d,dx,dy,nx,ny;
  int max;
  do{
    scanf("%d",&pi);
    if(pi==0) break;
    st++;
    max=0;
    for(i=0;i<pi;i++){
      scanf("%d %d",&(ps[i].x),&(ps[i].y));
      map[ps[i].y][ps[i].x]=st;
    }
    for(i=0;i<pi-1;i++){
      for(j=i+1;j<pi;j++){
	d=SQ(ps[i].x>ps[j].x?ps[i].x-ps[j].x:ps[j].x-ps[i].x);
	d+=SQ(ps[i].y>ps[j].y?ps[i].y-ps[j].y:ps[j].y-ps[i].y);
	if(d>max){
	  dx=ps[j].x-ps[i].x;
	  dy=ps[j].y-ps[i].y;
	  nx=ps[i].x+dy;
	  ny=ps[i].y-dx;
	  if(IN(nx,ny)&&(map[ny][nx]==st)){
	    nx+=dx;
	    ny+=dy;
	    if(IN(nx,ny)&&(map[ny][nx]==st)){
	      max=d;
	    }
	  }
	  nx=ps[i].x-dy;
	  ny=ps[i].y+dx;
	  if(IN(nx,ny)&&(map[ny][nx]==st)){
	    nx+=dx;
	    ny+=dy;
	    if(IN(nx,ny)&&(map[ny][nx]==st)){
	      max=d;
	    }
	  }
	}
      }
    }
    printf("%d\n",max);
  }while(1);
  return 0;
}```

Unoptimized Assembly Code:

```assembly
	.file	"temp.c"
	.text
	.globl	map
	.bss
	.align 32
	.type	map, @object
	.size	map, 25010001
map:
	.zero	25010001
	.globl	ps
	.align 32
	.type	ps, @object
	.size	ps, 24000
ps:
	.zero	24000
	.globl	pi
	.align 4
	.type	pi, @object
	.size	pi, 4
pi:
	.zero	4
	.globl	st
	.align 4
	.type	st, @object
	.size	st, 4
st:
	.zero	4
	.section	.rodata
.LC0:
	.string	"%d"
.LC1:
	.string	"%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	$32, %rsp
.L20:
	leaq	pi(%rip), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	pi(%rip), %eax
	testl	%eax, %eax
	je	.L23
	movl	st(%rip), %eax
	addl	$1, %eax
	movl	%eax, st(%rip)
	movl	$0, -24(%rbp)
	movl	$0, -32(%rbp)
	jmp	.L4
.L5:
	movl	-32(%rbp), %eax
	cltq
	leaq	0(,%rax,8), %rdx
	leaq	ps(%rip), %rax
	addq	%rdx, %rax
	leaq	4(%rax), %rdx
	movl	-32(%rbp), %eax
	cltq
	leaq	0(,%rax,8), %rcx
	leaq	ps(%rip), %rax
	addq	%rcx, %rax
	movq	%rax, %rsi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	st(%rip), %esi
	movl	-32(%rbp), %eax
	cltq
	leaq	0(,%rax,8), %rdx
	leaq	4+ps(%rip), %rax
	movl	(%rdx,%rax), %eax
	movl	-32(%rbp), %edx
	movslq	%edx, %rdx
	leaq	0(,%rdx,8), %rcx
	leaq	ps(%rip), %rdx
	movl	(%rcx,%rdx), %edx
	movl	%esi, %ecx
	movslq	%edx, %rdx
	cltq
	imulq	$5001, %rax, %rax
	addq	%rax, %rdx
	leaq	map(%rip), %rax
	addq	%rdx, %rax
	movb	%cl, (%rax)
	addl	$1, -32(%rbp)
.L4:
	movl	pi(%rip), %eax
	cmpl	%eax, -32(%rbp)
	jl	.L5
	movl	$0, -32(%rbp)
	jmp	.L6
.L19:
	movl	-32(%rbp), %eax
	addl	$1, %eax
	movl	%eax, -28(%rbp)
	jmp	.L7
.L18:
	movl	-32(%rbp), %eax
	cltq
	leaq	0(,%rax,8), %rdx
	leaq	ps(%rip), %rax
	movl	(%rdx,%rax), %edx
	movl	-28(%rbp), %eax
	cltq
	leaq	0(,%rax,8), %rcx
	leaq	ps(%rip), %rax
	movl	(%rcx,%rax), %eax
	cmpl	%eax, %edx
	jle	.L8
	movl	-32(%rbp), %eax
	cltq
	leaq	0(,%rax,8), %rdx
	leaq	ps(%rip), %rax
	movl	(%rdx,%rax), %eax
	movl	-28(%rbp), %edx
	movslq	%edx, %rdx
	leaq	0(,%rdx,8), %rcx
	leaq	ps(%rip), %rdx
	movl	(%rcx,%rdx), %ecx
	subl	%ecx, %eax
	movl	%eax, %edx
	jmp	.L9
.L8:
	movl	-28(%rbp), %eax
	cltq
	leaq	0(,%rax,8), %rdx
	leaq	ps(%rip), %rax
	movl	(%rdx,%rax), %eax
	movl	-32(%rbp), %edx
	movslq	%edx, %rdx
	leaq	0(,%rdx,8), %rcx
	leaq	ps(%rip), %rdx
	movl	(%rcx,%rdx), %ecx
	subl	%ecx, %eax
	movl	%eax, %edx
.L9:
	movl	-32(%rbp), %eax
	cltq
	leaq	0(,%rax,8), %rcx
	leaq	ps(%rip), %rax
	movl	(%rcx,%rax), %ecx
	movl	-28(%rbp), %eax
	cltq
	leaq	0(,%rax,8), %rsi
	leaq	ps(%rip), %rax
	movl	(%rsi,%rax), %eax
	cmpl	%eax, %ecx
	jle	.L10
	movl	-32(%rbp), %eax
	cltq
	leaq	0(,%rax,8), %rcx
	leaq	ps(%rip), %rax
	movl	(%rcx,%rax), %eax
	movl	-28(%rbp), %ecx
	movslq	%ecx, %rcx
	leaq	0(,%rcx,8), %rsi
	leaq	ps(%rip), %rcx
	movl	(%rsi,%rcx), %ecx
	subl	%ecx, %eax
	jmp	.L11
.L10:
	movl	-28(%rbp), %eax
	cltq
	leaq	0(,%rax,8), %rcx
	leaq	ps(%rip), %rax
	movl	(%rcx,%rax), %eax
	movl	-32(%rbp), %ecx
	movslq	%ecx, %rcx
	leaq	0(,%rcx,8), %rsi
	leaq	ps(%rip), %rcx
	movl	(%rsi,%rcx), %ecx
	subl	%ecx, %eax
.L11:
	imull	%edx, %eax
	movl	%eax, -20(%rbp)
	movl	-32(%rbp), %eax
	cltq
	leaq	0(,%rax,8), %rdx
	leaq	4+ps(%rip), %rax
	movl	(%rdx,%rax), %edx
	movl	-28(%rbp), %eax
	cltq
	leaq	0(,%rax,8), %rcx
	leaq	4+ps(%rip), %rax
	movl	(%rcx,%rax), %eax
	cmpl	%eax, %edx
	jle	.L12
	movl	-32(%rbp), %eax
	cltq
	leaq	0(,%rax,8), %rdx
	leaq	4+ps(%rip), %rax
	movl	(%rdx,%rax), %eax
	movl	-28(%rbp), %edx
	movslq	%edx, %rdx
	leaq	0(,%rdx,8), %rcx
	leaq	4+ps(%rip), %rdx
	movl	(%rcx,%rdx), %ecx
	subl	%ecx, %eax
	movl	%eax, %edx
	jmp	.L13
.L12:
	movl	-28(%rbp), %eax
	cltq
	leaq	0(,%rax,8), %rdx
	leaq	4+ps(%rip), %rax
	movl	(%rdx,%rax), %eax
	movl	-32(%rbp), %edx
	movslq	%edx, %rdx
	leaq	0(,%rdx,8), %rcx
	leaq	4+ps(%rip), %rdx
	movl	(%rcx,%rdx), %ecx
	subl	%ecx, %eax
	movl	%eax, %edx
.L13:
	movl	-32(%rbp), %eax
	cltq
	leaq	0(,%rax,8), %rcx
	leaq	4+ps(%rip), %rax
	movl	(%rcx,%rax), %ecx
	movl	-28(%rbp), %eax
	cltq
	leaq	0(,%rax,8), %rsi
	leaq	4+ps(%rip), %rax
	movl	(%rsi,%rax), %eax
	cmpl	%eax, %ecx
	jle	.L14
	movl	-32(%rbp), %eax
	cltq
	leaq	0(,%rax,8), %rcx
	leaq	4+ps(%rip), %rax
	movl	(%rcx,%rax), %eax
	movl	-28(%rbp), %ecx
	movslq	%ecx, %rcx
	leaq	0(,%rcx,8), %rsi
	leaq	4+ps(%rip), %rcx
	movl	(%rsi,%rcx), %ecx
	subl	%ecx, %eax
	jmp	.L15
.L14:
	movl	-28(%rbp), %eax
	cltq
	leaq	0(,%rax,8), %rcx
	leaq	4+ps(%rip), %rax
	movl	(%rcx,%rax), %eax
	movl	-32(%rbp), %ecx
	movslq	%ecx, %rcx
	leaq	0(,%rcx,8), %rsi
	leaq	4+ps(%rip), %rcx
	movl	(%rsi,%rcx), %ecx
	subl	%ecx, %eax
.L15:
	imull	%edx, %eax
	addl	%eax, -20(%rbp)
	movl	-20(%rbp), %eax
	cmpl	-24(%rbp), %eax
	jle	.L16
	movl	-28(%rbp), %eax
	cltq
	leaq	0(,%rax,8), %rdx
	leaq	ps(%rip), %rax
	movl	(%rdx,%rax), %eax
	movl	-32(%rbp), %edx
	movslq	%edx, %rdx
	leaq	0(,%rdx,8), %rcx
	leaq	ps(%rip), %rdx
	movl	(%rcx,%rdx), %edx
	subl	%edx, %eax
	movl	%eax, -16(%rbp)
	movl	-28(%rbp), %eax
	cltq
	leaq	0(,%rax,8), %rdx
	leaq	4+ps(%rip), %rax
	movl	(%rdx,%rax), %eax
	movl	-32(%rbp), %edx
	movslq	%edx, %rdx
	leaq	0(,%rdx,8), %rcx
	leaq	4+ps(%rip), %rdx
	movl	(%rcx,%rdx), %edx
	subl	%edx, %eax
	movl	%eax, -12(%rbp)
	movl	-32(%rbp), %eax
	cltq
	leaq	0(,%rax,8), %rdx
	leaq	ps(%rip), %rax
	movl	(%rdx,%rax), %edx
	movl	-12(%rbp), %eax
	addl	%edx, %eax
	movl	%eax, -8(%rbp)
	movl	-32(%rbp), %eax
	cltq
	leaq	0(,%rax,8), %rdx
	leaq	4+ps(%rip), %rax
	movl	(%rdx,%rax), %eax
	subl	-16(%rbp), %eax
	movl	%eax, -4(%rbp)
	cmpl	$0, -8(%rbp)
	js	.L17
	cmpl	$5000, -8(%rbp)
	jg	.L17
	cmpl	$0, -4(%rbp)
	js	.L17
	cmpl	$5000, -4(%rbp)
	jg	.L17
	movl	-8(%rbp), %eax
	movslq	%eax, %rdx
	movl	-4(%rbp), %eax
	cltq
	imulq	$5001, %rax, %rax
	addq	%rax, %rdx
	leaq	map(%rip), %rax
	addq	%rdx, %rax
	movzbl	(%rax), %eax
	movsbl	%al, %edx
	movl	st(%rip), %eax
	cmpl	%eax, %edx
	jne	.L17
	movl	-16(%rbp), %eax
	addl	%eax, -8(%rbp)
	movl	-12(%rbp), %eax
	addl	%eax, -4(%rbp)
	cmpl	$0, -8(%rbp)
	js	.L17
	cmpl	$5000, -8(%rbp)
	jg	.L17
	cmpl	$0, -4(%rbp)
	js	.L17
	cmpl	$5000, -4(%rbp)
	jg	.L17
	movl	-8(%rbp), %eax
	movslq	%eax, %rdx
	movl	-4(%rbp), %eax
	cltq
	imulq	$5001, %rax, %rax
	addq	%rax, %rdx
	leaq	map(%rip), %rax
	addq	%rdx, %rax
	movzbl	(%rax), %eax
	movsbl	%al, %edx
	movl	st(%rip), %eax
	cmpl	%eax, %edx
	jne	.L17
	movl	-20(%rbp), %eax
	movl	%eax, -24(%rbp)
.L17:
	movl	-32(%rbp), %eax
	cltq
	leaq	0(,%rax,8), %rdx
	leaq	ps(%rip), %rax
	movl	(%rdx,%rax), %eax
	subl	-12(%rbp), %eax
	movl	%eax, -8(%rbp)
	movl	-32(%rbp), %eax
	cltq
	leaq	0(,%rax,8), %rdx
	leaq	4+ps(%rip), %rax
	movl	(%rdx,%rax), %edx
	movl	-16(%rbp), %eax
	addl	%edx, %eax
	movl	%eax, -4(%rbp)
	cmpl	$0, -8(%rbp)
	js	.L16
	cmpl	$5000, -8(%rbp)
	jg	.L16
	cmpl	$0, -4(%rbp)
	js	.L16
	cmpl	$5000, -4(%rbp)
	jg	.L16
	movl	-8(%rbp), %eax
	movslq	%eax, %rdx
	movl	-4(%rbp), %eax
	cltq
	imulq	$5001, %rax, %rax
	addq	%rax, %rdx
	leaq	map(%rip), %rax
	addq	%rdx, %rax
	movzbl	(%rax), %eax
	movsbl	%al, %edx
	movl	st(%rip), %eax
	cmpl	%eax, %edx
	jne	.L16
	movl	-16(%rbp), %eax
	addl	%eax, -8(%rbp)
	movl	-12(%rbp), %eax
	addl	%eax, -4(%rbp)
	cmpl	$0, -8(%rbp)
	js	.L16
	cmpl	$5000, -8(%rbp)
	jg	.L16
	cmpl	$0, -4(%rbp)
	js	.L16
	cmpl	$5000, -4(%rbp)
	jg	.L16
	movl	-8(%rbp), %eax
	movslq	%eax, %rdx
	movl	-4(%rbp), %eax
	cltq
	imulq	$5001, %rax, %rax
	addq	%rax, %rdx
	leaq	map(%rip), %rax
	addq	%rdx, %rax
	movzbl	(%rax), %eax
	movsbl	%al, %edx
	movl	st(%rip), %eax
	cmpl	%eax, %edx
	jne	.L16
	movl	-20(%rbp), %eax
	movl	%eax, -24(%rbp)
.L16:
	addl	$1, -28(%rbp)
.L7:
	movl	pi(%rip), %eax
	cmpl	%eax, -28(%rbp)
	jl	.L18
	addl	$1, -32(%rbp)
.L6:
	movl	pi(%rip), %eax
	subl	$1, %eax
	cmpl	%eax, -32(%rbp)
	jl	.L19
	movl	-24(%rbp), %eax
	movl	%eax, %esi
	leaq	.LC2(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	jmp	.L20
.L23:
	nop
	movl	$0, %eax
	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\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	$40, %rsp
	.cfi_def_cfa_offset 96
	.p2align 4,,10
	.p2align 3
.L15:
	leaq	pi(%rip), %rsi
	leaq	.LC0(%rip), %rdi
	xorl	%eax, %eax
	call	__isoc99_scanf@PLT
	movl	pi(%rip), %eax
	movl	%eax, 24(%rsp)
	testl	%eax, %eax
	je	.L2
	movl	st(%rip), %edi
	leal	1(%rdi), %r13d
	movl	%r13d, st(%rip)
	jle	.L3
	leaq	ps(%rip), %rbx
	xorl	%r12d, %r12d
	leaq	map(%rip), %rbp
	.p2align 4,,10
	.p2align 3
.L4:
	leaq	4(%rbx), %rdx
	movq	%rbx, %rsi
	leaq	.LC1(%rip), %rdi
	xorl	%eax, %eax
	call	__isoc99_scanf@PLT
	movslq	4(%rbx), %rax
	movslq	(%rbx), %rdx
	addl	$1, %r12d
	movl	st(%rip), %r13d
	addq	$8, %rbx
	imulq	$5001, %rax, %rax
	addq	%rbp, %rax
	movb	%r13b, (%rax,%rdx)
	movl	pi(%rip), %eax
	cmpl	%r12d, %eax
	jg	.L4
	movl	%eax, 24(%rsp)
.L3:
	movl	24(%rsp), %edi
	cmpl	$1, %edi
	jle	.L16
	leal	-2(%rdi), %eax
	movl	$1, %r14d
	xorl	%r12d, %r12d
	addq	$2, %rax
	leaq	map(%rip), %r15
	movq	%rax, 16(%rsp)
	leaq	ps(%rip), %rax
	movq	%rax, 8(%rsp)
	leal	-1(%rdi), %eax
	movl	%eax, 28(%rsp)
	.p2align 4,,10
	.p2align 3
.L14:
	cmpl	%r14d, 24(%rsp)
	jle	.L6
	movl	28(%rsp), %eax
	movq	8(%rsp), %rdx
	leaq	8+ps(%rip), %rsi
	subl	%r14d, %eax
	movl	(%rdx), %r8d
	movl	4(%rdx), %edi
	leaq	-1(%r14,%rax), %rax
	leaq	(%rsi,%rax,8), %rbp
	.p2align 4,,10
	.p2align 3
.L13:
	movl	8(%rdx), %esi
	movl	%r8d, %r11d
	movl	12(%rdx), %ecx
	movl	%edi, %eax
	movl	%esi, %r9d
	subl	%esi, %r11d
	movl	%ecx, %r10d
	subl	%r8d, %r9d
	cmpl	%esi, %r8d
	cmovle	%r9d, %r11d
	subl	%ecx, %eax
	subl	%edi, %r10d
	imull	%r11d, %r11d
	cmpl	%ecx, %edi
	cmovle	%r10d, %eax
	imull	%eax, %eax
	addl	%r11d, %eax
	cmpl	%r12d, %eax
	jle	.L11
	movl	%edi, %r11d
	leal	(%r8,%r10), %ebx
	subl	%r9d, %r11d
	cmpl	$5000, %ebx
	ja	.L12
	cmpl	$5000, %r11d
	ja	.L12
	movslq	%r11d, %r11
	movslq	%ebx, %rbx
	imulq	$5001, %r11, %r11
	addq	%r15, %r11
	movsbl	(%r11,%rbx), %r11d
	cmpl	%r13d, %r11d
	je	.L47
.L12:
	movl	%r8d, %ebx
	leal	(%rdi,%r9), %r11d
	subl	%r10d, %ebx
	cmpl	$5000, %ebx
	ja	.L11
	cmpl	$5000, %r11d
	ja	.L11
	movslq	%r11d, %r11
	movslq	%ebx, %rbx
	imulq	$5001, %r11, %r11
	addq	%r15, %r11
	movsbl	(%r11,%rbx), %r11d
	cmpl	%r13d, %r11d
	je	.L48
	.p2align 4,,10
	.p2align 3
.L11:
	addq	$8, %rdx
	cmpq	%rdx, %rbp
	jne	.L13
.L6:
	addq	$8, 8(%rsp)
	addq	$1, %r14
	cmpq	16(%rsp), %r14
	jne	.L14
.L5:
	movl	%r12d, %edx
	leaq	.LC2(%rip), %rsi
	movl	$1, %edi
	xorl	%eax, %eax
	call	__printf_chk@PLT
	jmp	.L15
	.p2align 4,,10
	.p2align 3
.L48:
	subl	%r10d, %esi
	addl	%r9d, %ecx
	cmpl	$5000, %esi
	ja	.L11
	cmpl	$5000, %ecx
	ja	.L11
	movslq	%ecx, %rcx
	movslq	%esi, %rsi
	imulq	$5001, %rcx, %rcx
	addq	%r15, %rcx
	movsbl	(%rcx,%rsi), %ecx
	cmpl	%r13d, %ecx
	cmove	%eax, %r12d
	jmp	.L11
	.p2align 4,,10
	.p2align 3
.L47:
	movl	%ecx, %r11d
	leal	(%rsi,%r10), %ebx
	subl	%r9d, %r11d
	cmpl	$5000, %ebx
	ja	.L12
	cmpl	$5000, %r11d
	ja	.L12
	movslq	%r11d, %r11
	movslq	%ebx, %rbx
	imulq	$5001, %r11, %r11
	addq	%r15, %r11
	movsbl	(%r11,%rbx), %r11d
	cmpl	%r13d, %r11d
	cmove	%eax, %r12d
	jmp	.L12
.L2:
	addq	$40, %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
.L16:
	.cfi_restore_state
	xorl	%r12d, %r12d
	jmp	.L5
	.cfi_endproc
.LFE23:
	.size	main, .-main
	.globl	st
	.bss
	.align 4
	.type	st, @object
	.size	st, 4
st:
	.zero	4
	.globl	pi
	.align 4
	.type	pi, @object
	.size	pi, 4
pi:
	.zero	4
	.globl	ps
	.align 32
	.type	ps, @object
	.size	ps, 24000
ps:
	.zero	24000
	.globl	map
	.align 32
	.type	map, @object
	.size	map, 25010001
map:
	.zero	25010001
	.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\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	$40, %rsp
	.cfi_def_cfa_offset 96
	.p2align 4,,10
	.p2align 3
.L15:
	leaq	pi(%rip), %rsi
	leaq	.LC0(%rip), %rdi
	xorl	%eax, %eax
	call	__isoc99_scanf@PLT
	movl	pi(%rip), %eax
	movl	%eax, 24(%rsp)
	testl	%eax, %eax
	je	.L2
	movl	st(%rip), %edi
	leal	1(%rdi), %r13d
	movl	%r13d, st(%rip)
	jle	.L3
	leaq	ps(%rip), %rbx
	xorl	%r12d, %r12d
	leaq	map(%rip), %rbp
	.p2align 4,,10
	.p2align 3
.L4:
	leaq	4(%rbx), %rdx
	movq	%rbx, %rsi
	leaq	.LC1(%rip), %rdi
	xorl	%eax, %eax
	call	__isoc99_scanf@PLT
	movslq	4(%rbx), %rax
	movslq	(%rbx), %rdx
	addl	$1, %r12d
	movl	st(%rip), %r13d
	addq	$8, %rbx
	imulq	$5001, %rax, %rax
	addq	%rbp, %rax
	movb	%r13b, (%rax,%rdx)
	movl	pi(%rip), %eax
	cmpl	%r12d, %eax
	jg	.L4
	movl	%eax, 24(%rsp)
.L3:
	movl	24(%rsp), %edi
	cmpl	$1, %edi
	jle	.L16
	leal	-2(%rdi), %eax
	movl	$1, %r14d
	xorl	%r12d, %r12d
	addq	$2, %rax
	leaq	map(%rip), %r15
	movq	%rax, 16(%rsp)
	leaq	ps(%rip), %rax
	movq	%rax, 8(%rsp)
	leal	-1(%rdi), %eax
	movl	%eax, 28(%rsp)
	.p2align 4,,10
	.p2align 3
.L14:
	cmpl	%r14d, 24(%rsp)
	jle	.L6
	movl	28(%rsp), %eax
	movq	8(%rsp), %rdx
	leaq	8+ps(%rip), %rsi
	subl	%r14d, %eax
	movl	(%rdx), %r8d
	movl	4(%rdx), %edi
	leaq	-1(%r14,%rax), %rax
	leaq	(%rsi,%rax,8), %rbp
	.p2align 4,,10
	.p2align 3
.L13:
	movl	8(%rdx), %esi
	movl	%r8d, %r11d
	movl	12(%rdx), %ecx
	movl	%edi, %eax
	movl	%esi, %r9d
	subl	%esi, %r11d
	movl	%ecx, %r10d
	subl	%r8d, %r9d
	cmpl	%esi, %r8d
	cmovle	%r9d, %r11d
	subl	%ecx, %eax
	subl	%edi, %r10d
	imull	%r11d, %r11d
	cmpl	%ecx, %edi
	cmovle	%r10d, %eax
	imull	%eax, %eax
	addl	%r11d, %eax
	cmpl	%r12d, %eax
	jle	.L11
	movl	%edi, %r11d
	leal	(%r8,%r10), %ebx
	subl	%r9d, %r11d
	cmpl	$5000, %ebx
	ja	.L12
	cmpl	$5000, %r11d
	ja	.L12
	movslq	%r11d, %r11
	movslq	%ebx, %rbx
	imulq	$5001, %r11, %r11
	addq	%r15, %r11
	movsbl	(%r11,%rbx), %r11d
	cmpl	%r13d, %r11d
	je	.L47
.L12:
	movl	%r8d, %ebx
	leal	(%rdi,%r9), %r11d
	subl	%r10d, %ebx
	cmpl	$5000, %ebx
	ja	.L11
	cmpl	$5000, %r11d
	ja	.L11
	movslq	%r11d, %r11
	movslq	%ebx, %rbx
	imulq	$5001, %r11, %r11
	addq	%r15, %r11
	movsbl	(%r11,%rbx), %r11d
	cmpl	%r13d, %r11d
	je	.L48
	.p2align 4,,10
	.p2align 3
.L11:
	addq	$8, %rdx
	cmpq	%rdx, %rbp
	jne	.L13
.L6:
	addq	$8, 8(%rsp)
	addq	$1, %r14
	cmpq	16(%rsp), %r14
	jne	.L14
.L5:
	movl	%r12d, %edx
	leaq	.LC2(%rip), %rsi
	movl	$1, %edi
	xorl	%eax, %eax
	call	__printf_chk@PLT
	jmp	.L15
	.p2align 4,,10
	.p2align 3
.L48:
	subl	%r10d, %esi
	addl	%r9d, %ecx
	cmpl	$5000, %esi
	ja	.L11
	cmpl	$5000, %ecx
	ja	.L11
	movslq	%ecx, %rcx
	movslq	%esi, %rsi
	imulq	$5001, %rcx, %rcx
	addq	%r15, %rcx
	movsbl	(%rcx,%rsi), %ecx
	cmpl	%r13d, %ecx
	cmove	%eax, %r12d
	jmp	.L11
	.p2align 4,,10
	.p2align 3
.L47:
	movl	%ecx, %r11d
	leal	(%rsi,%r10), %ebx
	subl	%r9d, %r11d
	cmpl	$5000, %ebx
	ja	.L12
	cmpl	$5000, %r11d
	ja	.L12
	movslq	%r11d, %r11
	movslq	%ebx, %rbx
	imulq	$5001, %r11, %r11
	addq	%r15, %r11
	movsbl	(%r11,%rbx), %r11d
	cmpl	%r13d, %r11d
	cmove	%eax, %r12d
	jmp	.L12
.L2:
	addq	$40, %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
.L16:
	.cfi_restore_state
	xorl	%r12d, %r12d
	jmp	.L5
	.cfi_endproc
.LFE23:
	.size	main, .-main
	.globl	st
	.bss
	.align 4
	.type	st, @object
	.size	st, 4
st:
	.zero	4
	.globl	pi
	.align 4
	.type	pi, @object
	.size	pi, 4
pi:
	.zero	4
	.globl	ps
	.align 32
	.type	ps, @object
	.size	ps, 24000
ps:
	.zero	24000
	.globl	map
	.align 32
	.type	map, @object
	.size	map, 25010001
map:
	.zero	25010001
	.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>
#define SQ(x) ((x)*(x))
#define IN(x,y) ((0<=x&&x<=5000)&&(0<=y&&y<=5000))


typedef struct{
  int x;
  int y;
}point;

char map[5001][5001];
point ps[3000];
int pi;
int st;

int main(){
  int i,j,d,dx,dy,nx,ny;
  int max;
  do{
    scanf("%d",&pi);
    if(pi==0) break;
    st++;
    max=0;
    for(i=0;i<pi;i++){
      scanf("%d %d",&(ps[i].x),&(ps[i].y));
      map[ps[i].y][ps[i].x]=st;
    }
    for(i=0;i<pi-1;i++){
      for(j=i+1;j<pi;j++){
	d=SQ(ps[i].x>ps[j].x?ps[i].x-ps[j].x:ps[j].x-ps[i].x);
	d+=SQ(ps[i].y>ps[j].y?ps[i].y-ps[j].y:ps[j].y-ps[i].y);
	if(d>max){
	  dx=ps[j].x-ps[i].x;
	  dy=ps[j].y-ps[i].y;
	  nx=ps[i].x+dy;
	  ny=ps[i].y-dx;
	  if(IN(nx,ny)&&(map[ny][nx]==st)){
	    nx+=dx;
	    ny+=dy;
	    if(IN(nx,ny)&&(map[ny][nx]==st)){
	      max=d;
	    }
	  }
	  nx=ps[i].x-dy;
	  ny=ps[i].y+dx;
	  if(IN(nx,ny)&&(map[ny][nx]==st)){
	    nx+=dx;
	    ny+=dy;
	    if(IN(nx,ny)&&(map[ny][nx]==st)){
	      max=d;
	    }
	  }
	}
      }
    }
    printf("%d\n",max);
  }while(1);
  return 0;
}
10
9 4
4 3
1 1
4 2
2 4
5 8
4 0
5 3
0 5
5 2
10
2 4
4 3
1 1
4 2
2 4
5 8
4 0
5 3
0 5
5 2
0
 10
9 4
4 3
1 1
4 2
2 4
5 8
4 1
5 3
0 5
5 2
10
2 4
4 3
1 1
4 2
2 4
5 8
4 0
5 3
0 5
5 2
0
 10
9 4
4 4
1 1
4 2
2 5
5 8
4 1
5 3
0 5
5 2
10
2 4
4 3
1 1
4 2
2 4
5 8
4 0
5 3
0 5
3 2
0
 10
16 4
4 3
1 1
2 2
2 4
5 8
4 0
5 5
0 5
5 2
10
9 4
4 3
1 1
4 2
2 8
5 8
4 0
5 3
0 5
5 2
0
 10
16 4
4 3
1 1
2 2
2 4
5 8
4 0
5 5
0 5
5 2
10
9 4
4 3
1 1
4 2
2 8
9 8
4 0
5 5
0 5
5 2
0

10
10
 1
10
 0
10
 0
1
 0
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>
#define SQ(x) ((x)*(x))
#define IN(x,y) ((0<=x&&x<=5000)&&(0<=y&&y<=5000))


typedef struct{
  int x;
  int y;
}point;

char map[5001][5001];
point ps[3000];
int pi;
int st;

int main(){
  int i,j,d,dx,dy,nx,ny;
  int max;
  do{
    scanf("%d",&pi);
    if(pi==0) break;
    st++;
    max=0;
    for(i=0;i<pi;i++){
      scanf("%d %d",&(ps[i].x),&(ps[i].y));
      map[ps[i].y][ps[i].x]=st;
    }
    for(i=0;i<pi-1;i++){
      for(j=i+1;j<pi;j++){
	d=SQ(ps[i].x>ps[j].x?ps[i].x-ps[j].x:ps[j].x-ps[i].x);
	d+=SQ(ps[i].y>ps[j].y?ps[i].y-ps[j].y:ps[j].y-ps[i].y);
	if(d>max){
	  dx=ps[j].x-ps[i].x;
	  dy=ps[j].y-ps[i].y;
	  nx=ps[i].x+dy;
	  ny=ps[i].y-dx;
	  if(IN(nx,ny)&&(map[ny][nx]==st)){
	    nx+=dx;
	    ny+=dy;
	    if(IN(nx,ny)&&(map[ny][nx]==st)){
	      max=d;
	    }
	  }
	  nx=ps[i].x-dy;
	  ny=ps[i].y+dx;
	  if(IN(nx,ny)&&(map[ny][nx]==st)){
	    nx+=dx;
	    ny+=dy;
	    if(IN(nx,ny)&&(map[ny][nx]==st)){
	      max=d;
	    }
	  }
	}
      }
    }
    printf("%d\n",max);
  }while(1);
  return 0;
}```

Unoptimized Assembly Code:

```assembly
	.file	"temp.c"
	.text
	.globl	map
	.bss
	.align 32
	.type	map, @object
	.size	map, 25010001
map:
	.zero	25010001
	.globl	ps
	.align 32
	.type	ps, @object
	.size	ps, 24000
ps:
	.zero	24000
	.globl	pi
	.align 4
	.type	pi, @object
	.size	pi, 4
pi:
	.zero	4
	.globl	st
	.align 4
	.type	st, @object
	.size	st, 4
st:
	.zero	4
	.section	.rodata
.LC0:
	.string	"%d"
.LC1:
	.string	"%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	$32, %rsp
.L20:
	leaq	pi(%rip), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	pi(%rip), %eax
	testl	%eax, %eax
	je	.L23
	movl	st(%rip), %eax
	addl	$1, %eax
	movl	%eax, st(%rip)
	movl	$0, -24(%rbp)
	movl	$0, -32(%rbp)
	jmp	.L4
.L5:
	movl	-32(%rbp), %eax
	cltq
	leaq	0(,%rax,8), %rdx
	leaq	ps(%rip), %rax
	addq	%rdx, %rax
	leaq	4(%rax), %rdx
	movl	-32(%rbp), %eax
	cltq
	leaq	0(,%rax,8), %rcx
	leaq	ps(%rip), %rax
	addq	%rcx, %rax
	movq	%rax, %rsi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	st(%rip), %esi
	movl	-32(%rbp), %eax
	cltq
	leaq	0(,%rax,8), %rdx
	leaq	4+ps(%rip), %rax
	movl	(%rdx,%rax), %eax
	movl	-32(%rbp), %edx
	movslq	%edx, %rdx
	leaq	0(,%rdx,8), %rcx
	leaq	ps(%rip), %rdx
	movl	(%rcx,%rdx), %edx
	movl	%esi, %ecx
	movslq	%edx, %rdx
	cltq
	imulq	$5001, %rax, %rax
	addq	%rax, %rdx
	leaq	map(%rip), %rax
	addq	%rdx, %rax
	movb	%cl, (%rax)
	addl	$1, -32(%rbp)
.L4:
	movl	pi(%rip), %eax
	cmpl	%eax, -32(%rbp)
	jl	.L5
	movl	$0, -32(%rbp)
	jmp	.L6
.L19:
	movl	-32(%rbp), %eax
	addl	$1, %eax
	movl	%eax, -28(%rbp)
	jmp	.L7
.L18:
	movl	-32(%rbp), %eax
	cltq
	leaq	0(,%rax,8), %rdx
	leaq	ps(%rip), %rax
	movl	(%rdx,%rax), %edx
	movl	-28(%rbp), %eax
	cltq
	leaq	0(,%rax,8), %rcx
	leaq	ps(%rip), %rax
	movl	(%rcx,%rax), %eax
	cmpl	%eax, %edx
	jle	.L8
	movl	-32(%rbp), %eax
	cltq
	leaq	0(,%rax,8), %rdx
	leaq	ps(%rip), %rax
	movl	(%rdx,%rax), %eax
	movl	-28(%rbp), %edx
	movslq	%edx, %rdx
	leaq	0(,%rdx,8), %rcx
	leaq	ps(%rip), %rdx
	movl	(%rcx,%rdx), %ecx
	subl	%ecx, %eax
	movl	%eax, %edx
	jmp	.L9
.L8:
	movl	-28(%rbp), %eax
	cltq
	leaq	0(,%rax,8), %rdx
	leaq	ps(%rip), %rax
	movl	(%rdx,%rax), %eax
	movl	-32(%rbp), %edx
	movslq	%edx, %rdx
	leaq	0(,%rdx,8), %rcx
	leaq	ps(%rip), %rdx
	movl	(%rcx,%rdx), %ecx
	subl	%ecx, %eax
	movl	%eax, %edx
.L9:
	movl	-32(%rbp), %eax
	cltq
	leaq	0(,%rax,8), %rcx
	leaq	ps(%rip), %rax
	movl	(%rcx,%rax), %ecx
	movl	-28(%rbp), %eax
	cltq
	leaq	0(,%rax,8), %rsi
	leaq	ps(%rip), %rax
	movl	(%rsi,%rax), %eax
	cmpl	%eax, %ecx
	jle	.L10
	movl	-32(%rbp), %eax
	cltq
	leaq	0(,%rax,8), %rcx
	leaq	ps(%rip), %rax
	movl	(%rcx,%rax), %eax
	movl	-28(%rbp), %ecx
	movslq	%ecx, %rcx
	leaq	0(,%rcx,8), %rsi
	leaq	ps(%rip), %rcx
	movl	(%rsi,%rcx), %ecx
	subl	%ecx, %eax
	jmp	.L11
.L10:
	movl	-28(%rbp), %eax
	cltq
	leaq	0(,%rax,8), %rcx
	leaq	ps(%rip), %rax
	movl	(%rcx,%rax), %eax
	movl	-32(%rbp), %ecx
	movslq	%ecx, %rcx
	leaq	0(,%rcx,8), %rsi
	leaq	ps(%rip), %rcx
	movl	(%rsi,%rcx), %ecx
	subl	%ecx, %eax
.L11:
	imull	%edx, %eax
	movl	%eax, -20(%rbp)
	movl	-32(%rbp), %eax
	cltq
	leaq	0(,%rax,8), %rdx
	leaq	4+ps(%rip), %rax
	movl	(%rdx,%rax), %edx
	movl	-28(%rbp), %eax
	cltq
	leaq	0(,%rax,8), %rcx
	leaq	4+ps(%rip), %rax
	movl	(%rcx,%rax), %eax
	cmpl	%eax, %edx
	jle	.L12
	movl	-32(%rbp), %eax
	cltq
	leaq	0(,%rax,8), %rdx
	leaq	4+ps(%rip), %rax
	movl	(%rdx,%rax), %eax
	movl	-28(%rbp), %edx
	movslq	%edx, %rdx
	leaq	0(,%rdx,8), %rcx
	leaq	4+ps(%rip), %rdx
	movl	(%rcx,%rdx), %ecx
	subl	%ecx, %eax
	movl	%eax, %edx
	jmp	.L13
.L12:
	movl	-28(%rbp), %eax
	cltq
	leaq	0(,%rax,8), %rdx
	leaq	4+ps(%rip), %rax
	movl	(%rdx,%rax), %eax
	movl	-32(%rbp), %edx
	movslq	%edx, %rdx
	leaq	0(,%rdx,8), %rcx
	leaq	4+ps(%rip), %rdx
	movl	(%rcx,%rdx), %ecx
	subl	%ecx, %eax
	movl	%eax, %edx
.L13:
	movl	-32(%rbp), %eax
	cltq
	leaq	0(,%rax,8), %rcx
	leaq	4+ps(%rip), %rax
	movl	(%rcx,%rax), %ecx
	movl	-28(%rbp), %eax
	cltq
	leaq	0(,%rax,8), %rsi
	leaq	4+ps(%rip), %rax
	movl	(%rsi,%rax), %eax
	cmpl	%eax, %ecx
	jle	.L14
	movl	-32(%rbp), %eax
	cltq
	leaq	0(,%rax,8), %rcx
	leaq	4+ps(%rip), %rax
	movl	(%rcx,%rax), %eax
	movl	-28(%rbp), %ecx
	movslq	%ecx, %rcx
	leaq	0(,%rcx,8), %rsi
	leaq	4+ps(%rip), %rcx
	movl	(%rsi,%rcx), %ecx
	subl	%ecx, %eax
	jmp	.L15
.L14:
	movl	-28(%rbp), %eax
	cltq
	leaq	0(,%rax,8), %rcx
	leaq	4+ps(%rip), %rax
	movl	(%rcx,%rax), %eax
	movl	-32(%rbp), %ecx
	movslq	%ecx, %rcx
	leaq	0(,%rcx,8), %rsi
	leaq	4+ps(%rip), %rcx
	movl	(%rsi,%rcx), %ecx
	subl	%ecx, %eax
.L15:
	imull	%edx, %eax
	addl	%eax, -20(%rbp)
	movl	-20(%rbp), %eax
	cmpl	-24(%rbp), %eax
	jle	.L16
	movl	-28(%rbp), %eax
	cltq
	leaq	0(,%rax,8), %rdx
	leaq	ps(%rip), %rax
	movl	(%rdx,%rax), %eax
	movl	-32(%rbp), %edx
	movslq	%edx, %rdx
	leaq	0(,%rdx,8), %rcx
	leaq	ps(%rip), %rdx
	movl	(%rcx,%rdx), %edx
	subl	%edx, %eax
	movl	%eax, -16(%rbp)
	movl	-28(%rbp), %eax
	cltq
	leaq	0(,%rax,8), %rdx
	leaq	4+ps(%rip), %rax
	movl	(%rdx,%rax), %eax
	movl	-32(%rbp), %edx
	movslq	%edx, %rdx
	leaq	0(,%rdx,8), %rcx
	leaq	4+ps(%rip), %rdx
	movl	(%rcx,%rdx), %edx
	subl	%edx, %eax
	movl	%eax, -12(%rbp)
	movl	-32(%rbp), %eax
	cltq
	leaq	0(,%rax,8), %rdx
	leaq	ps(%rip), %rax
	movl	(%rdx,%rax), %edx
	movl	-12(%rbp), %eax
	addl	%edx, %eax
	movl	%eax, -8(%rbp)
	movl	-32(%rbp), %eax
	cltq
	leaq	0(,%rax,8), %rdx
	leaq	4+ps(%rip), %rax
	movl	(%rdx,%rax), %eax
	subl	-16(%rbp), %eax
	movl	%eax, -4(%rbp)
	cmpl	$0, -8(%rbp)
	js	.L17
	cmpl	$5000, -8(%rbp)
	jg	.L17
	cmpl	$0, -4(%rbp)
	js	.L17
	cmpl	$5000, -4(%rbp)
	jg	.L17
	movl	-8(%rbp), %eax
	movslq	%eax, %rdx
	movl	-4(%rbp), %eax
	cltq
	imulq	$5001, %rax, %rax
	addq	%rax, %rdx
	leaq	map(%rip), %rax
	addq	%rdx, %rax
	movzbl	(%rax), %eax
	movsbl	%al, %edx
	movl	st(%rip), %eax
	cmpl	%eax, %edx
	jne	.L17
	movl	-16(%rbp), %eax
	addl	%eax, -8(%rbp)
	movl	-12(%rbp), %eax
	addl	%eax, -4(%rbp)
	cmpl	$0, -8(%rbp)
	js	.L17
	cmpl	$5000, -8(%rbp)
	jg	.L17
	cmpl	$0, -4(%rbp)
	js	.L17
	cmpl	$5000, -4(%rbp)
	jg	.L17
	movl	-8(%rbp), %eax
	movslq	%eax, %rdx
	movl	-4(%rbp), %eax
	cltq
	imulq	$5001, %rax, %rax
	addq	%rax, %rdx
	leaq	map(%rip), %rax
	addq	%rdx, %rax
	movzbl	(%rax), %eax
	movsbl	%al, %edx
	movl	st(%rip), %eax
	cmpl	%eax, %edx
	jne	.L17
	movl	-20(%rbp), %eax
	movl	%eax, -24(%rbp)
.L17:
	movl	-32(%rbp), %eax
	cltq
	leaq	0(,%rax,8), %rdx
	leaq	ps(%rip), %rax
	movl	(%rdx,%rax), %eax
	subl	-12(%rbp), %eax
	movl	%eax, -8(%rbp)
	movl	-32(%rbp), %eax
	cltq
	leaq	0(,%rax,8), %rdx
	leaq	4+ps(%rip), %rax
	movl	(%rdx,%rax), %edx
	movl	-16(%rbp), %eax
	addl	%edx, %eax
	movl	%eax, -4(%rbp)
	cmpl	$0, -8(%rbp)
	js	.L16
	cmpl	$5000, -8(%rbp)
	jg	.L16
	cmpl	$0, -4(%rbp)
	js	.L16
	cmpl	$5000, -4(%rbp)
	jg	.L16
	movl	-8(%rbp), %eax
	movslq	%eax, %rdx
	movl	-4(%rbp), %eax
	cltq
	imulq	$5001, %rax, %rax
	addq	%rax, %rdx
	leaq	map(%rip), %rax
	addq	%rdx, %rax
	movzbl	(%rax), %eax
	movsbl	%al, %edx
	movl	st(%rip), %eax
	cmpl	%eax, %edx
	jne	.L16
	movl	-16(%rbp), %eax
	addl	%eax, -8(%rbp)
	movl	-12(%rbp), %eax
	addl	%eax, -4(%rbp)
	cmpl	$0, -8(%rbp)
	js	.L16
	cmpl	$5000, -8(%rbp)
	jg	.L16
	cmpl	$0, -4(%rbp)
	js	.L16
	cmpl	$5000, -4(%rbp)
	jg	.L16
	movl	-8(%rbp), %eax
	movslq	%eax, %rdx
	movl	-4(%rbp), %eax
	cltq
	imulq	$5001, %rax, %rax
	addq	%rax, %rdx
	leaq	map(%rip), %rax
	addq	%rdx, %rax
	movzbl	(%rax), %eax
	movsbl	%al, %edx
	movl	st(%rip), %eax
	cmpl	%eax, %edx
	jne	.L16
	movl	-20(%rbp), %eax
	movl	%eax, -24(%rbp)
.L16:
	addl	$1, -28(%rbp)
.L7:
	movl	pi(%rip), %eax
	cmpl	%eax, -28(%rbp)
	jl	.L18
	addl	$1, -32(%rbp)
.L6:
	movl	pi(%rip), %eax
	subl	$1, %eax
	cmpl	%eax, -32(%rbp)
	jl	.L19
	movl	-24(%rbp), %eax
	movl	%eax, %esi
	leaq	.LC2(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	jmp	.L20
.L23:
	nop
	movl	$0, %eax
	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	map
	.bss
	.align 32
	.type	map, @object
	.size	map, 25010001
map:
	.zero	25010001
	.globl	ps
	.align 32
	.type	ps, @object
	.size	ps, 24000
ps:
	.zero	24000
	.globl	pi
	.align 4
	.type	pi, @object
	.size	pi, 4
pi:
	.zero	4
	.globl	st
	.align 4
	.type	st, @object
	.size	st, 4
st:
	.zero	4
	.section	.rodata
.LC0:
	.string	"%d"
.LC1:
	.string	"%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	$32, %rsp
.L20:
	leaq	pi(%rip), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	pi(%rip), %eax
	testl	%eax, %eax
	je	.L23
	movl	st(%rip), %eax
	addl	$1, %eax
	movl	%eax, st(%rip)
	movl	$0, -24(%rbp)
	movl	$0, -32(%rbp)
	jmp	.L4
.L5:
	movl	-32(%rbp), %eax
	cltq
	leaq	0(,%rax,8), %rdx
	leaq	ps(%rip), %rax
	addq	%rdx, %rax
	leaq	4(%rax), %rdx
	movl	-32(%rbp), %eax
	cltq
	leaq	0(,%rax,8), %rcx
	leaq	ps(%rip), %rax
	addq	%rcx, %rax
	movq	%rax, %rsi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	st(%rip), %esi
	movl	-32(%rbp), %eax
	cltq
	leaq	0(,%rax,8), %rdx
	leaq	4+ps(%rip), %rax
	movl	(%rdx,%rax), %eax
	movl	-32(%rbp), %edx
	movslq	%edx, %rdx
	leaq	0(,%rdx,8), %rcx
	leaq	ps(%rip), %rdx
	movl	(%rcx,%rdx), %edx
	movl	%esi, %ecx
	movslq	%edx, %rdx
	cltq
	imulq	$5001, %rax, %rax
	addq	%rax, %rdx
	leaq	map(%rip), %rax
	addq	%rdx, %rax
	movb	%cl, (%rax)
	addl	$1, -32(%rbp)
.L4:
	movl	pi(%rip), %eax
	cmpl	%eax, -32(%rbp)
	jl	.L5
	movl	$0, -32(%rbp)
	jmp	.L6
.L19:
	movl	-32(%rbp), %eax
	addl	$1, %eax
	movl	%eax, -28(%rbp)
	jmp	.L7
.L18:
	movl	-32(%rbp), %eax
	cltq
	leaq	0(,%rax,8), %rdx
	leaq	ps(%rip), %rax
	movl	(%rdx,%rax), %edx
	movl	-28(%rbp), %eax
	cltq
	leaq	0(,%rax,8), %rcx
	leaq	ps(%rip), %rax
	movl	(%rcx,%rax), %eax
	cmpl	%eax, %edx
	jle	.L8
	movl	-32(%rbp), %eax
	cltq
	leaq	0(,%rax,8), %rdx
	leaq	ps(%rip), %rax
	movl	(%rdx,%rax), %eax
	movl	-28(%rbp), %edx
	movslq	%edx, %rdx
	leaq	0(,%rdx,8), %rcx
	leaq	ps(%rip), %rdx
	movl	(%rcx,%rdx), %ecx
	subl	%ecx, %eax
	movl	%eax, %edx
	jmp	.L9
.L8:
	movl	-28(%rbp), %eax
	cltq
	leaq	0(,%rax,8), %rdx
	leaq	ps(%rip), %rax
	movl	(%rdx,%rax), %eax
	movl	-32(%rbp), %edx
	movslq	%edx, %rdx
	leaq	0(,%rdx,8), %rcx
	leaq	ps(%rip), %rdx
	movl	(%rcx,%rdx), %ecx
	subl	%ecx, %eax
	movl	%eax, %edx
.L9:
	movl	-32(%rbp), %eax
	cltq
	leaq	0(,%rax,8), %rcx
	leaq	ps(%rip), %rax
	movl	(%rcx,%rax), %ecx
	movl	-28(%rbp), %eax
	cltq
	leaq	0(,%rax,8), %rsi
	leaq	ps(%rip), %rax
	movl	(%rsi,%rax), %eax
	cmpl	%eax, %ecx
	jle	.L10
	movl	-32(%rbp), %eax
	cltq
	leaq	0(,%rax,8), %rcx
	leaq	ps(%rip), %rax
	movl	(%rcx,%rax), %eax
	movl	-28(%rbp), %ecx
	movslq	%ecx, %rcx
	leaq	0(,%rcx,8), %rsi
	leaq	ps(%rip), %rcx
	movl	(%rsi,%rcx), %ecx
	subl	%ecx, %eax
	jmp	.L11
.L10:
	movl	-28(%rbp), %eax
	cltq
	leaq	0(,%rax,8), %rcx
	leaq	ps(%rip), %rax
	movl	(%rcx,%rax), %eax
	movl	-32(%rbp), %ecx
	movslq	%ecx, %rcx
	leaq	0(,%rcx,8), %rsi
	leaq	ps(%rip), %rcx
	movl	(%rsi,%rcx), %ecx
	subl	%ecx, %eax
.L11:
	imull	%edx, %eax
	movl	%eax, -20(%rbp)
	movl	-32(%rbp), %eax
	cltq
	leaq	0(,%rax,8), %rdx
	leaq	4+ps(%rip), %rax
	movl	(%rdx,%rax), %edx
	movl	-28(%rbp), %eax
	cltq
	leaq	0(,%rax,8), %rcx
	leaq	4+ps(%rip), %rax
	movl	(%rcx,%rax), %eax
	cmpl	%eax, %edx
	jle	.L12
	movl	-32(%rbp), %eax
	cltq
	leaq	0(,%rax,8), %rdx
	leaq	4+ps(%rip), %rax
	movl	(%rdx,%rax), %eax
	movl	-28(%rbp), %edx
	movslq	%edx, %rdx
	leaq	0(,%rdx,8), %rcx
	leaq	4+ps(%rip), %rdx
	movl	(%rcx,%rdx), %ecx
	subl	%ecx, %eax
	movl	%eax, %edx
	jmp	.L13
.L12:
	movl	-28(%rbp), %eax
	cltq
	leaq	0(,%rax,8), %rdx
	leaq	4+ps(%rip), %rax
	movl	(%rdx,%rax), %eax
	movl	-32(%rbp), %edx
	movslq	%edx, %rdx
	leaq	0(,%rdx,8), %rcx
	leaq	4+ps(%rip), %rdx
	movl	(%rcx,%rdx), %ecx
	subl	%ecx, %eax
	movl	%eax, %edx
.L13:
	movl	-32(%rbp), %eax
	cltq
	leaq	0(,%rax,8), %rcx
	leaq	4+ps(%rip), %rax
	movl	(%rcx,%rax), %ecx
	movl	-28(%rbp), %eax
	cltq
	leaq	0(,%rax,8), %rsi
	leaq	4+ps(%rip), %rax
	movl	(%rsi,%rax), %eax
	cmpl	%eax, %ecx
	jle	.L14
	movl	-32(%rbp), %eax
	cltq
	leaq	0(,%rax,8), %rcx
	leaq	4+ps(%rip), %rax
	movl	(%rcx,%rax), %eax
	movl	-28(%rbp), %ecx
	movslq	%ecx, %rcx
	leaq	0(,%rcx,8), %rsi
	leaq	4+ps(%rip), %rcx
	movl	(%rsi,%rcx), %ecx
	subl	%ecx, %eax
	jmp	.L15
.L14:
	movl	-28(%rbp), %eax
	cltq
	leaq	0(,%rax,8), %rcx
	leaq	4+ps(%rip), %rax
	movl	(%rcx,%rax), %eax
	movl	-32(%rbp), %ecx
	movslq	%ecx, %rcx
	leaq	0(,%rcx,8), %rsi
	leaq	4+ps(%rip), %rcx
	movl	(%rsi,%rcx), %ecx
	subl	%ecx, %eax
.L15:
	imull	%edx, %eax
	addl	%eax, -20(%rbp)
	movl	-20(%rbp), %eax
	cmpl	-24(%rbp), %eax
	jle	.L16
	movl	-28(%rbp), %eax
	cltq
	leaq	0(,%rax,8), %rdx
	leaq	ps(%rip), %rax
	movl	(%rdx,%rax), %eax
	movl	-32(%rbp), %edx
	movslq	%edx, %rdx
	leaq	0(,%rdx,8), %rcx
	leaq	ps(%rip), %rdx
	movl	(%rcx,%rdx), %edx
	subl	%edx, %eax
	movl	%eax, -16(%rbp)
	movl	-28(%rbp), %eax
	cltq
	leaq	0(,%rax,8), %rdx
	leaq	4+ps(%rip), %rax
	movl	(%rdx,%rax), %eax
	movl	-32(%rbp), %edx
	movslq	%edx, %rdx
	leaq	0(,%rdx,8), %rcx
	leaq	4+ps(%rip), %rdx
	movl	(%rcx,%rdx), %edx
	subl	%edx, %eax
	movl	%eax, -12(%rbp)
	movl	-32(%rbp), %eax
	cltq
	leaq	0(,%rax,8), %rdx
	leaq	ps(%rip), %rax
	movl	(%rdx,%rax), %edx
	movl	-12(%rbp), %eax
	addl	%edx, %eax
	movl	%eax, -8(%rbp)
	movl	-32(%rbp), %eax
	cltq
	leaq	0(,%rax,8), %rdx
	leaq	4+ps(%rip), %rax
	movl	(%rdx,%rax), %eax
	subl	-16(%rbp), %eax
	movl	%eax, -4(%rbp)
	cmpl	$0, -8(%rbp)
	js	.L17
	cmpl	$5000, -8(%rbp)
	jg	.L17
	cmpl	$0, -4(%rbp)
	js	.L17
	cmpl	$5000, -4(%rbp)
	jg	.L17
	movl	-8(%rbp), %eax
	movslq	%eax, %rdx
	movl	-4(%rbp), %eax
	cltq
	imulq	$5001, %rax, %rax
	addq	%rax, %rdx
	leaq	map(%rip), %rax
	addq	%rdx, %rax
	movzbl	(%rax), %eax
	movsbl	%al, %edx
	movl	st(%rip), %eax
	cmpl	%eax, %edx
	jne	.L17
	movl	-16(%rbp), %eax
	addl	%eax, -8(%rbp)
	movl	-12(%rbp), %eax
	addl	%eax, -4(%rbp)
	cmpl	$0, -8(%rbp)
	js	.L17
	cmpl	$5000, -8(%rbp)
	jg	.L17
	cmpl	$0, -4(%rbp)
	js	.L17
	cmpl	$5000, -4(%rbp)
	jg	.L17
	movl	-8(%rbp), %eax
	movslq	%eax, %rdx
	movl	-4(%rbp), %eax
	cltq
	imulq	$5001, %rax, %rax
	addq	%rax, %rdx
	leaq	map(%rip), %rax
	addq	%rdx, %rax
	movzbl	(%rax), %eax
	movsbl	%al, %edx
	movl	st(%rip), %eax
	cmpl	%eax, %edx
	jne	.L17
	movl	-20(%rbp), %eax
	movl	%eax, -24(%rbp)
.L17:
	movl	-32(%rbp), %eax
	cltq
	leaq	0(,%rax,8), %rdx
	leaq	ps(%rip), %rax
	movl	(%rdx,%rax), %eax
	subl	-12(%rbp), %eax
	movl	%eax, -8(%rbp)
	movl	-32(%rbp), %eax
	cltq
	leaq	0(,%rax,8), %rdx
	leaq	4+ps(%rip), %rax
	movl	(%rdx,%rax), %edx
	movl	-16(%rbp), %eax
	addl	%edx, %eax
	movl	%eax, -4(%rbp)
	cmpl	$0, -8(%rbp)
	js	.L16
	cmpl	$5000, -8(%rbp)
	jg	.L16
	cmpl	$0, -4(%rbp)
	js	.L16
	cmpl	$5000, -4(%rbp)
	jg	.L16
	movl	-8(%rbp), %eax
	movslq	%eax, %rdx
	movl	-4(%rbp), %eax
	cltq
	imulq	$5001, %rax, %rax
	addq	%rax, %rdx
	leaq	map(%rip), %rax
	addq	%rdx, %rax
	movzbl	(%rax), %eax
	movsbl	%al, %edx
	movl	st(%rip), %eax
	cmpl	%eax, %edx
	jne	.L16
	movl	-16(%rbp), %eax
	addl	%eax, -8(%rbp)
	movl	-12(%rbp), %eax
	addl	%eax, -4(%rbp)
	cmpl	$0, -8(%rbp)
	js	.L16
	cmpl	$5000, -8(%rbp)
	jg	.L16
	cmpl	$0, -4(%rbp)
	js	.L16
	cmpl	$5000, -4(%rbp)
	jg	.L16
	movl	-8(%rbp), %eax
	movslq	%eax, %rdx
	movl	-4(%rbp), %eax
	cltq
	imulq	$5001, %rax, %rax
	addq	%rax, %rdx
	leaq	map(%rip), %rax
	addq	%rdx, %rax
	movzbl	(%rax), %eax
	movsbl	%al, %edx
	movl	st(%rip), %eax
	cmpl	%eax, %edx
	jne	.L16
	movl	-20(%rbp), %eax
	movl	%eax, -24(%rbp)
.L16:
	addl	$1, -28(%rbp)
.L7:
	movl	pi(%rip), %eax
	cmpl	%eax, -28(%rbp)
	jl	.L18
	addl	$1, -32(%rbp)
.L6:
	movl	pi(%rip), %eax
	subl	$1, %eax
	cmpl	%eax, -32(%rbp)
	jl	.L19
	movl	-24(%rbp), %eax
	movl	%eax, %esi
	leaq	.LC2(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	jmp	.L20
.L23:
	nop
	movl	$0, %eax
	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:
