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 f[1010][1010],y[1000010],x[1000010],l[1010][1010];
int main(){
  int Y[]={1,0,-1,0};
  int X[]={0,1,0,-1};
  int n,m,ny,nx,gy[11],gx[11],i,j,k,a=0,t,r;
  char s[1010][1010]={};
  scanf("%d %d %d",&n,&m,&k);
  for(i=1;i<=n;i++){
    for(j=1;j<=m;j++){
      scanf(" %c",&s[i][j]);
      if(s[i][j]=='S')s[i][j]='0';
      if('0'<=s[i][j]&&s[i][j]<='9')s[gy[s[i][j]-'0']=i][gx[s[i][j]-'0']=j]='.';
    }
  }
  //for(i=0;i<=k;i++)printf("%d %d\n",gy[i],gx[i]);
  for(i=0;i<k;i++){
    f[y[t=0]=gy[i]][x[  0]=gx[i]]=i+1;
    l[y[0]][x[0]]=0;
    for(r=1;r-t;t++){
      for(j=0;j<4;j++){
	ny=y[t]+Y[j];
	nx=x[t]+X[j];//printf("%d\n",f[ny][nx]);
	if(s[ny][nx]-'.'||f[ny][nx]==i+1)continue;
	f[y[r]=ny][x[r]=nx]=i+1;
	l[ny][nx]=l[y[t]][x[t]]+1;
	r++;
      }
    }//printf("%d\n",r);
    /*for(j=0;j<n;j++){
      for(t=0;t<m;t++)printf("%d ",l[j+1][t+1]);printf("\n");
      }//*/
    a+=l[gy[i+1]][gx[i+1]];
  }
  printf("%d\n",a);
  return 0;
}
	```

Unoptimized Assembly Code:

```assembly
	.file	"temp.c"
	.text
	.globl	f
	.bss
	.align 32
	.type	f, @object
	.size	f, 4080400
f:
	.zero	4080400
	.globl	y
	.align 32
	.type	y, @object
	.size	y, 4000040
y:
	.zero	4000040
	.globl	x
	.align 32
	.type	x, @object
	.size	x, 4000040
x:
	.zero	4000040
	.globl	l
	.align 32
	.type	l, @object
	.size	l, 4080400
l:
	.zero	4080400
	.section	.rodata
.LC0:
	.string	"%d %d %d"
.LC1:
	.string	" %c"
.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
	leaq	-1019904(%rsp), %r11
.LPSRL0:
	subq	$4096, %rsp
	orq	$0, (%rsp)
	cmpq	%r11, %rsp
	jne	.LPSRL0
	subq	$384, %rsp
	movq	%fs:40, %rax
	movq	%rax, -8(%rbp)
	xorl	%eax, %eax
	movl	$1, -1020240(%rbp)
	movl	$0, -1020236(%rbp)
	movl	$-1, -1020232(%rbp)
	movl	$0, -1020228(%rbp)
	movl	$0, -1020224(%rbp)
	movl	$1, -1020220(%rbp)
	movl	$0, -1020216(%rbp)
	movl	$-1, -1020212(%rbp)
	movl	$0, -1020260(%rbp)
	leaq	-1020112(%rbp), %rax
	movl	$1020100, %edx
	movl	$0, %esi
	movq	%rax, %rdi
	call	memset@PLT
	leaq	-1020272(%rbp), %rcx
	leaq	-1020276(%rbp), %rdx
	leaq	-1020280(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	$1, -1020268(%rbp)
	jmp	.L2
.L7:
	movl	$1, -1020264(%rbp)
	jmp	.L3
.L6:
	leaq	-1020112(%rbp), %rdx
	movl	-1020264(%rbp), %eax
	movslq	%eax, %rcx
	movl	-1020268(%rbp), %eax
	cltq
	imulq	$1010, %rax, %rax
	addq	%rcx, %rax
	addq	%rdx, %rax
	movq	%rax, %rsi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	-1020264(%rbp), %eax
	movslq	%eax, %rdx
	movl	-1020268(%rbp), %eax
	cltq
	imulq	$1010, %rax, %rax
	addq	%rbp, %rax
	addq	%rdx, %rax
	subq	$1020112, %rax
	movzbl	(%rax), %eax
	cmpb	$83, %al
	jne	.L4
	movl	-1020264(%rbp), %eax
	movslq	%eax, %rdx
	movl	-1020268(%rbp), %eax
	cltq
	imulq	$1010, %rax, %rax
	addq	%rbp, %rax
	addq	%rdx, %rax
	subq	$1020112, %rax
	movb	$48, (%rax)
.L4:
	movl	-1020264(%rbp), %eax
	movslq	%eax, %rdx
	movl	-1020268(%rbp), %eax
	cltq
	imulq	$1010, %rax, %rax
	addq	%rbp, %rax
	addq	%rdx, %rax
	subq	$1020112, %rax
	movzbl	(%rax), %eax
	cmpb	$47, %al
	jle	.L5
	movl	-1020264(%rbp), %eax
	movslq	%eax, %rdx
	movl	-1020268(%rbp), %eax
	cltq
	imulq	$1010, %rax, %rax
	addq	%rbp, %rax
	addq	%rdx, %rax
	subq	$1020112, %rax
	movzbl	(%rax), %eax
	cmpb	$57, %al
	jg	.L5
	movl	-1020264(%rbp), %eax
	movslq	%eax, %rdx
	movl	-1020268(%rbp), %eax
	cltq
	imulq	$1010, %rax, %rax
	addq	%rbp, %rax
	addq	%rdx, %rax
	subq	$1020112, %rax
	movzbl	(%rax), %eax
	movsbl	%al, %eax
	subl	$48, %eax
	movslq	%eax, %rdx
	movl	-1020268(%rbp), %ecx
	movl	%ecx, -1020208(%rbp,%rdx,4)
	cltq
	movl	-1020208(%rbp,%rax,4), %esi
	movl	-1020264(%rbp), %eax
	movslq	%eax, %rdx
	movl	-1020268(%rbp), %eax
	cltq
	imulq	$1010, %rax, %rax
	addq	%rbp, %rax
	addq	%rdx, %rax
	subq	$1020112, %rax
	movzbl	(%rax), %eax
	movsbl	%al, %eax
	subl	$48, %eax
	movslq	%eax, %rdx
	movl	-1020264(%rbp), %ecx
	movl	%ecx, -1020160(%rbp,%rdx,4)
	cltq
	movl	-1020160(%rbp,%rax,4), %eax
	movslq	%eax, %rdx
	movslq	%esi, %rax
	imulq	$1010, %rax, %rax
	addq	%rbp, %rax
	addq	%rdx, %rax
	subq	$1020112, %rax
	movb	$46, (%rax)
.L5:
	addl	$1, -1020264(%rbp)
.L3:
	movl	-1020276(%rbp), %eax
	cmpl	%eax, -1020264(%rbp)
	jle	.L6
	addl	$1, -1020268(%rbp)
.L2:
	movl	-1020280(%rbp), %eax
	cmpl	%eax, -1020268(%rbp)
	jle	.L7
	movl	$0, -1020268(%rbp)
	jmp	.L8
.L16:
	movl	$0, -1020256(%rbp)
	movl	-1020268(%rbp), %eax
	cltq
	movl	-1020208(%rbp,%rax,4), %eax
	movl	-1020256(%rbp), %edx
	movslq	%edx, %rdx
	leaq	0(,%rdx,4), %rcx
	leaq	y(%rip), %rdx
	movl	%eax, (%rcx,%rdx)
	movl	-1020256(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	y(%rip), %rax
	movl	(%rdx,%rax), %edx
	movl	-1020268(%rbp), %eax
	cltq
	movl	-1020160(%rbp,%rax,4), %eax
	movl	%eax, x(%rip)
	movl	x(%rip), %eax
	movl	-1020268(%rbp), %ecx
	addl	$1, %ecx
	movslq	%eax, %rsi
	movslq	%edx, %rax
	imulq	$1010, %rax, %rax
	addq	%rsi, %rax
	leaq	0(,%rax,4), %rdx
	leaq	f(%rip), %rax
	movl	%ecx, (%rdx,%rax)
	movl	y(%rip), %eax
	movl	x(%rip), %edx
	movslq	%edx, %rdx
	cltq
	imulq	$1010, %rax, %rax
	addq	%rdx, %rax
	leaq	0(,%rax,4), %rdx
	leaq	l(%rip), %rax
	movl	$0, (%rdx,%rax)
	movl	$1, -1020252(%rbp)
	jmp	.L9
.L15:
	movl	$0, -1020264(%rbp)
	jmp	.L10
.L14:
	movl	-1020256(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	y(%rip), %rax
	movl	(%rdx,%rax), %edx
	movl	-1020264(%rbp), %eax
	cltq
	movl	-1020240(%rbp,%rax,4), %eax
	addl	%edx, %eax
	movl	%eax, -1020248(%rbp)
	movl	-1020256(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	x(%rip), %rax
	movl	(%rdx,%rax), %edx
	movl	-1020264(%rbp), %eax
	cltq
	movl	-1020224(%rbp,%rax,4), %eax
	addl	%edx, %eax
	movl	%eax, -1020244(%rbp)
	movl	-1020244(%rbp), %eax
	movslq	%eax, %rdx
	movl	-1020248(%rbp), %eax
	cltq
	imulq	$1010, %rax, %rax
	addq	%rbp, %rax
	addq	%rdx, %rax
	subq	$1020112, %rax
	movzbl	(%rax), %eax
	cmpb	$46, %al
	jne	.L19
	movl	-1020244(%rbp), %eax
	movslq	%eax, %rdx
	movl	-1020248(%rbp), %eax
	cltq
	imulq	$1010, %rax, %rax
	addq	%rdx, %rax
	leaq	0(,%rax,4), %rdx
	leaq	f(%rip), %rax
	movl	(%rdx,%rax), %eax
	movl	-1020268(%rbp), %edx
	addl	$1, %edx
	cmpl	%edx, %eax
	je	.L19
	movl	-1020252(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rcx
	leaq	y(%rip), %rdx
	movl	-1020248(%rbp), %eax
	movl	%eax, (%rcx,%rdx)
	movl	-1020252(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	y(%rip), %rax
	movl	(%rdx,%rax), %edx
	movl	-1020252(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rsi
	leaq	x(%rip), %rcx
	movl	-1020244(%rbp), %eax
	movl	%eax, (%rsi,%rcx)
	movl	-1020252(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rcx
	leaq	x(%rip), %rax
	movl	(%rcx,%rax), %eax
	movl	-1020268(%rbp), %ecx
	addl	$1, %ecx
	movslq	%eax, %rsi
	movslq	%edx, %rax
	imulq	$1010, %rax, %rax
	addq	%rsi, %rax
	leaq	0(,%rax,4), %rdx
	leaq	f(%rip), %rax
	movl	%ecx, (%rdx,%rax)
	movl	-1020256(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	y(%rip), %rax
	movl	(%rdx,%rax), %eax
	movl	-1020256(%rbp), %edx
	movslq	%edx, %rdx
	leaq	0(,%rdx,4), %rcx
	leaq	x(%rip), %rdx
	movl	(%rcx,%rdx), %edx
	movslq	%edx, %rdx
	cltq
	imulq	$1010, %rax, %rax
	addq	%rdx, %rax
	leaq	0(,%rax,4), %rdx
	leaq	l(%rip), %rax
	movl	(%rdx,%rax), %eax
	leal	1(%rax), %ecx
	movl	-1020244(%rbp), %eax
	movslq	%eax, %rdx
	movl	-1020248(%rbp), %eax
	cltq
	imulq	$1010, %rax, %rax
	addq	%rdx, %rax
	leaq	0(,%rax,4), %rdx
	leaq	l(%rip), %rax
	movl	%ecx, (%rdx,%rax)
	addl	$1, -1020252(%rbp)
	jmp	.L13
.L19:
	nop
.L13:
	addl	$1, -1020264(%rbp)
.L10:
	cmpl	$3, -1020264(%rbp)
	jle	.L14
	addl	$1, -1020256(%rbp)
.L9:
	movl	-1020252(%rbp), %eax
	cmpl	-1020256(%rbp), %eax
	jne	.L15
	movl	-1020268(%rbp), %eax
	addl	$1, %eax
	cltq
	movl	-1020208(%rbp,%rax,4), %edx
	movl	-1020268(%rbp), %eax
	addl	$1, %eax
	cltq
	movl	-1020160(%rbp,%rax,4), %eax
	movslq	%eax, %rcx
	movslq	%edx, %rax
	imulq	$1010, %rax, %rax
	addq	%rcx, %rax
	leaq	0(,%rax,4), %rdx
	leaq	l(%rip), %rax
	movl	(%rdx,%rax), %eax
	addl	%eax, -1020260(%rbp)
	addl	$1, -1020268(%rbp)
.L8:
	movl	-1020272(%rbp), %eax
	cmpl	%eax, -1020268(%rbp)
	jl	.L16
	movl	-1020260(%rbp), %eax
	movl	%eax, %esi
	leaq	.LC2(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	movl	$0, %eax
	movq	-8(%rbp), %rdx
	subq	%fs:40, %rdx
	je	.L18
	call	__stack_chk_fail@PLT
.L18:
	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 %d %d"
.LC1:
	.string	" %c"
.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
	leaq	-1019904(%rsp), %r11
	.cfi_def_cfa 11, 1019960
.LPSRL0:
	subq	$4096, %rsp
	orq	$0, (%rsp)
	cmpq	%r11, %rsp
	jne	.LPSRL0
	.cfi_def_cfa_register 7
	subq	$376, %rsp
	.cfi_def_cfa_offset 1020336
	movl	$1020100, %edx
	xorl	%esi, %esi
	movq	%fs:40, %rax
	movq	%rax, 1020264(%rsp)
	xorl	%eax, %eax
	leaq	160(%rsp), %rdi
	call	memset@PLT
	leaq	60(%rsp), %rcx
	xorl	%eax, %eax
	leaq	56(%rsp), %rdx
	leaq	52(%rsp), %rsi
	leaq	.LC0(%rip), %rdi
	call	__isoc99_scanf@PLT
	movl	52(%rsp), %eax
	testl	%eax, %eax
	jle	.L2
	movl	56(%rsp), %eax
	leaq	1170(%rsp), %rbp
	movl	$1, %r13d
	leaq	.LC1(%rip), %r12
	testl	%eax, %eax
	jle	.L2
	.p2align 4,,10
	.p2align 3
.L8:
	leaq	1(%rbp), %r15
	movl	$1, %r14d
	jmp	.L6
	.p2align 4,,10
	.p2align 3
.L33:
	subl	$48, %eax
	cmpb	$9, %al
	jbe	.L31
.L5:
	movl	56(%rsp), %eax
	addq	$1, %r14
	addq	$1, %r15
	cmpl	%r14d, %eax
	jl	.L32
.L6:
	leaq	0(%rbp,%r14), %rsi
	movq	%r12, %rdi
	xorl	%eax, %eax
	movl	%r14d, %ebx
	call	__isoc99_scanf@PLT
	movzbl	(%r15), %eax
	cmpb	$83, %al
	jne	.L33
	xorl	%eax, %eax
.L4:
	movl	%r13d, 64(%rsp,%rax,4)
	movl	%ebx, 112(%rsp,%rax,4)
	movb	$46, (%r15)
	jmp	.L5
	.p2align 4,,10
	.p2align 3
.L31:
	movsbq	%al, %rax
	jmp	.L4
	.p2align 4,,10
	.p2align 3
.L32:
	addl	$1, %r13d
	cmpl	52(%rsp), %r13d
	jg	.L2
	addq	$1010, %rbp
	testl	%eax, %eax
	jg	.L8
.L2:
	movl	60(%rsp), %eax
	testl	%eax, %eax
	jle	.L19
	leaq	64(%rsp), %rcx
	addl	$1, %eax
	movslq	64(%rsp), %rdx
	movl	112(%rsp), %esi
	movq	%rcx, 40(%rsp)
	leaq	112(%rsp), %rcx
	movl	$1, %r12d
	leaq	f(%rip), %r11
	movq	%rax, 24(%rsp)
	leaq	y(%rip), %rax
	movq	%rdx, %rdi
	movq	%rdx, %r10
	movl	$0, 20(%rsp)
	leaq	l(%rip), %rbx
	movq	%rcx, 32(%rsp)
	movq	%rax, 8(%rsp)
	leaq	x(%rip), %rax
	movq	%rax, (%rsp)
	movslq	%esi, %rax
	.p2align 4,,10
	.p2align 3
.L16:
	movq	8(%rsp), %rdx
	movl	%r12d, %r13d
	movl	$1, %r8d
	xorl	%ebp, %ebp
	movl	%edi, (%rdx)
	movq	(%rsp), %rdx
	movl	%esi, (%rdx)
	imulq	$1010, %r10, %rdx
	addq	%rax, %rdx
	movl	%r12d, (%r11,%rdx,4)
	movl	$0, (%rbx,%rdx,4)
	leaq	y(%rip), %rdx
	movq	%rdx, 8(%rsp)
	movq	%rdx, %r10
	leaq	x(%rip), %rdx
	movq	%rdx, (%rsp)
	movq	%rdx, %r9
	jmp	.L15
	.p2align 4,,10
	.p2align 3
.L34:
	movslq	(%r9), %rax
	movl	(%r10), %edi
	movq	%rax, %rsi
.L15:
	leal	1(%rdi), %r14d
	movslq	%r14d, %rcx
	imulq	$1010, %rcx, %rcx
	leaq	1020272(%rcx), %rdx
	leaq	(%rsp,%rdx), %r15
	movslq	%edi, %rdx
	cmpb	$46, -1020112(%r15,%rax)
	jne	.L10
	addq	%rax, %rcx
	cmpl	%r12d, (%r11,%rcx,4)
	je	.L10
	movslq	%r8d, %rax
	leaq	y(%rip), %rdi
	movl	%r13d, (%r11,%rcx,4)
	addl	$1, %r8d
	movl	%r14d, (%rdi,%rax,4)
	movslq	(%r10), %rdx
	leaq	x(%rip), %rdi
	movl	%esi, (%rdi,%rax,4)
	movslq	(%r9), %r14
	imulq	$1010, %rdx, %rax
	movq	%rdx, %rdi
	movq	%r14, %rsi
	addq	%r14, %rax
	movl	(%rbx,%rax,4), %eax
	addl	$1, %eax
	movl	%eax, (%rbx,%rcx,4)
.L10:
	imulq	$1010, %rdx, %rdx
	leal	1(%rsi), %r14d
	movslq	%r14d, %rcx
	leaq	1020272(%rdx), %rax
	leaq	(%rsp,%rax), %r15
	movslq	%esi, %rax
	cmpb	$46, -1020112(%rcx,%r15)
	jne	.L11
	addq	%rcx, %rdx
	cmpl	%r12d, (%r11,%rdx,4)
	je	.L11
	movslq	%r8d, %rax
	leaq	y(%rip), %rsi
	movl	%r13d, (%r11,%rdx,4)
	addl	$1, %r8d
	movl	%edi, (%rsi,%rax,4)
	movslq	(%r10), %rcx
	leaq	x(%rip), %rdi
	movl	%r14d, (%rdi,%rax,4)
	movslq	(%r9), %rax
	movq	%rcx, %rdi
	imulq	$1010, %rcx, %rcx
	movq	%rax, %rsi
	addq	%rax, %rcx
	movl	(%rbx,%rcx,4), %ecx
	addl	$1, %ecx
	movl	%ecx, (%rbx,%rdx,4)
.L11:
	leal	-1(%rdi), %r14d
	movslq	%r14d, %rcx
	imulq	$1010, %rcx, %rcx
	leaq	1020272(%rcx), %rdx
	leaq	(%rsp,%rdx), %r15
	movslq	%edi, %rdx
	cmpb	$46, -1020112(%r15,%rax)
	jne	.L12
	addq	%rax, %rcx
	cmpl	%r12d, (%r11,%rcx,4)
	je	.L12
	movslq	%r8d, %rax
	leaq	y(%rip), %rdi
	movl	%r13d, (%r11,%rcx,4)
	addl	$1, %r8d
	movl	%r14d, (%rdi,%rax,4)
	movslq	(%r10), %rdx
	leaq	x(%rip), %rdi
	movl	%esi, (%rdi,%rax,4)
	movslq	(%r9), %r14
	imulq	$1010, %rdx, %rax
	movq	%rdx, %rdi
	movq	%r14, %rsi
	addq	%r14, %rax
	movl	(%rbx,%rax,4), %eax
	addl	$1, %eax
	movl	%eax, (%rbx,%rcx,4)
.L12:
	imulq	$1010, %rdx, %rdx
	subl	$1, %esi
	movslq	%esi, %rax
	leaq	1020272(%rdx), %rcx
	addq	%rsp, %rcx
	cmpb	$46, -1020112(%rax,%rcx)
	jne	.L13
	addq	%rdx, %rax
	cmpl	%r12d, (%r11,%rax,4)
	je	.L13
	movslq	%r8d, %rcx
	leaq	y(%rip), %r15
	movl	%r13d, (%r11,%rax,4)
	addl	$1, %r8d
	movl	%edi, (%r15,%rcx,4)
	leaq	x(%rip), %rdi
	movl	%esi, (%rdi,%rcx,4)
	movslq	(%r9), %rcx
	addq	%rcx, %rdx
	movl	(%rbx,%rdx,4), %edx
	addl	$1, %edx
	movl	%edx, (%rbx,%rax,4)
.L13:
	addl	$1, %ebp
	addq	$4, %r10
	addq	$4, %r9
	cmpl	%r8d, %ebp
	jne	.L34
	movq	40(%rsp), %rax
	movslq	(%rax,%r12,4), %rdx
	movq	32(%rsp), %rax
	imulq	$1010, %rdx, %rcx
	movslq	(%rax,%r12,4), %rax
	movq	%rdx, %rdi
	movq	%rdx, %r10
	addq	$1, %r12
	movq	%rax, %rsi
	addq	%rax, %rcx
	movl	(%rbx,%rcx,4), %ecx
	addl	%ecx, 20(%rsp)
	cmpq	24(%rsp), %r12
	jne	.L16
.L9:
	movl	20(%rsp), %edx
	xorl	%eax, %eax
	movl	$1, %edi
	leaq	.LC2(%rip), %rsi
	call	__printf_chk@PLT
	movq	1020264(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L35
	addq	$1020280, %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
.L19:
	.cfi_restore_state
	movl	$0, 20(%rsp)
	jmp	.L9
.L35:
	call	__stack_chk_fail@PLT
	.cfi_endproc
.LFE23:
	.size	main, .-main
	.globl	l
	.bss
	.align 32
	.type	l, @object
	.size	l, 4080400
l:
	.zero	4080400
	.globl	x
	.align 32
	.type	x, @object
	.size	x, 4000040
x:
	.zero	4000040
	.globl	y
	.align 32
	.type	y, @object
	.size	y, 4000040
y:
	.zero	4000040
	.globl	f
	.align 32
	.type	f, @object
	.size	f, 4080400
f:
	.zero	4080400
	.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 %d %d"
.LC1:
	.string	" %c"
.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
	leaq	-1019904(%rsp), %r11
	.cfi_def_cfa 11, 1019960
.LPSRL0:
	subq	$4096, %rsp
	orq	$0, (%rsp)
	cmpq	%r11, %rsp
	jne	.LPSRL0
	.cfi_def_cfa_register 7
	subq	$376, %rsp
	.cfi_def_cfa_offset 1020336
	movl	$1020100, %edx
	xorl	%esi, %esi
	movq	%fs:40, %rax
	movq	%rax, 1020264(%rsp)
	xorl	%eax, %eax
	leaq	160(%rsp), %rdi
	call	memset@PLT
	leaq	60(%rsp), %rcx
	xorl	%eax, %eax
	leaq	56(%rsp), %rdx
	leaq	52(%rsp), %rsi
	leaq	.LC0(%rip), %rdi
	call	__isoc99_scanf@PLT
	movl	52(%rsp), %eax
	testl	%eax, %eax
	jle	.L2
	movl	56(%rsp), %eax
	leaq	1170(%rsp), %rbp
	movl	$1, %r13d
	leaq	.LC1(%rip), %r12
	testl	%eax, %eax
	jle	.L2
	.p2align 4,,10
	.p2align 3
.L8:
	leaq	1(%rbp), %r15
	movl	$1, %r14d
	jmp	.L6
	.p2align 4,,10
	.p2align 3
.L33:
	subl	$48, %eax
	cmpb	$9, %al
	jbe	.L31
.L5:
	movl	56(%rsp), %eax
	addq	$1, %r14
	addq	$1, %r15
	cmpl	%r14d, %eax
	jl	.L32
.L6:
	leaq	0(%rbp,%r14), %rsi
	movq	%r12, %rdi
	xorl	%eax, %eax
	movl	%r14d, %ebx
	call	__isoc99_scanf@PLT
	movzbl	(%r15), %eax
	cmpb	$83, %al
	jne	.L33
	xorl	%eax, %eax
.L4:
	movl	%r13d, 64(%rsp,%rax,4)
	movl	%ebx, 112(%rsp,%rax,4)
	movb	$46, (%r15)
	jmp	.L5
	.p2align 4,,10
	.p2align 3
.L31:
	movsbq	%al, %rax
	jmp	.L4
	.p2align 4,,10
	.p2align 3
.L32:
	addl	$1, %r13d
	cmpl	52(%rsp), %r13d
	jg	.L2
	addq	$1010, %rbp
	testl	%eax, %eax
	jg	.L8
.L2:
	movl	60(%rsp), %eax
	testl	%eax, %eax
	jle	.L19
	leaq	64(%rsp), %rcx
	addl	$1, %eax
	movslq	64(%rsp), %rdx
	movl	112(%rsp), %esi
	movq	%rcx, 40(%rsp)
	leaq	112(%rsp), %rcx
	movl	$1, %r12d
	leaq	f(%rip), %r11
	movq	%rax, 24(%rsp)
	leaq	y(%rip), %rax
	movq	%rdx, %rdi
	movq	%rdx, %r10
	movl	$0, 20(%rsp)
	leaq	l(%rip), %rbx
	movq	%rcx, 32(%rsp)
	movq	%rax, 8(%rsp)
	leaq	x(%rip), %rax
	movq	%rax, (%rsp)
	movslq	%esi, %rax
	.p2align 4,,10
	.p2align 3
.L16:
	movq	8(%rsp), %rdx
	movl	%r12d, %r13d
	movl	$1, %r8d
	xorl	%ebp, %ebp
	movl	%edi, (%rdx)
	movq	(%rsp), %rdx
	movl	%esi, (%rdx)
	imulq	$1010, %r10, %rdx
	addq	%rax, %rdx
	movl	%r12d, (%r11,%rdx,4)
	movl	$0, (%rbx,%rdx,4)
	leaq	y(%rip), %rdx
	movq	%rdx, 8(%rsp)
	movq	%rdx, %r10
	leaq	x(%rip), %rdx
	movq	%rdx, (%rsp)
	movq	%rdx, %r9
	jmp	.L15
	.p2align 4,,10
	.p2align 3
.L34:
	movslq	(%r9), %rax
	movl	(%r10), %edi
	movq	%rax, %rsi
.L15:
	leal	1(%rdi), %r14d
	movslq	%r14d, %rcx
	imulq	$1010, %rcx, %rcx
	leaq	1020272(%rcx), %rdx
	leaq	(%rsp,%rdx), %r15
	movslq	%edi, %rdx
	cmpb	$46, -1020112(%r15,%rax)
	jne	.L10
	addq	%rax, %rcx
	cmpl	%r12d, (%r11,%rcx,4)
	je	.L10
	movslq	%r8d, %rax
	leaq	y(%rip), %rdi
	movl	%r13d, (%r11,%rcx,4)
	addl	$1, %r8d
	movl	%r14d, (%rdi,%rax,4)
	movslq	(%r10), %rdx
	leaq	x(%rip), %rdi
	movl	%esi, (%rdi,%rax,4)
	movslq	(%r9), %r14
	imulq	$1010, %rdx, %rax
	movq	%rdx, %rdi
	movq	%r14, %rsi
	addq	%r14, %rax
	movl	(%rbx,%rax,4), %eax
	addl	$1, %eax
	movl	%eax, (%rbx,%rcx,4)
.L10:
	imulq	$1010, %rdx, %rdx
	leal	1(%rsi), %r14d
	movslq	%r14d, %rcx
	leaq	1020272(%rdx), %rax
	leaq	(%rsp,%rax), %r15
	movslq	%esi, %rax
	cmpb	$46, -1020112(%rcx,%r15)
	jne	.L11
	addq	%rcx, %rdx
	cmpl	%r12d, (%r11,%rdx,4)
	je	.L11
	movslq	%r8d, %rax
	leaq	y(%rip), %rsi
	movl	%r13d, (%r11,%rdx,4)
	addl	$1, %r8d
	movl	%edi, (%rsi,%rax,4)
	movslq	(%r10), %rcx
	leaq	x(%rip), %rdi
	movl	%r14d, (%rdi,%rax,4)
	movslq	(%r9), %rax
	movq	%rcx, %rdi
	imulq	$1010, %rcx, %rcx
	movq	%rax, %rsi
	addq	%rax, %rcx
	movl	(%rbx,%rcx,4), %ecx
	addl	$1, %ecx
	movl	%ecx, (%rbx,%rdx,4)
.L11:
	leal	-1(%rdi), %r14d
	movslq	%r14d, %rcx
	imulq	$1010, %rcx, %rcx
	leaq	1020272(%rcx), %rdx
	leaq	(%rsp,%rdx), %r15
	movslq	%edi, %rdx
	cmpb	$46, -1020112(%r15,%rax)
	jne	.L12
	addq	%rax, %rcx
	cmpl	%r12d, (%r11,%rcx,4)
	je	.L12
	movslq	%r8d, %rax
	leaq	y(%rip), %rdi
	movl	%r13d, (%r11,%rcx,4)
	addl	$1, %r8d
	movl	%r14d, (%rdi,%rax,4)
	movslq	(%r10), %rdx
	leaq	x(%rip), %rdi
	movl	%esi, (%rdi,%rax,4)
	movslq	(%r9), %r14
	imulq	$1010, %rdx, %rax
	movq	%rdx, %rdi
	movq	%r14, %rsi
	addq	%r14, %rax
	movl	(%rbx,%rax,4), %eax
	addl	$1, %eax
	movl	%eax, (%rbx,%rcx,4)
.L12:
	imulq	$1010, %rdx, %rdx
	subl	$1, %esi
	movslq	%esi, %rax
	leaq	1020272(%rdx), %rcx
	addq	%rsp, %rcx
	cmpb	$46, -1020112(%rax,%rcx)
	jne	.L13
	addq	%rdx, %rax
	cmpl	%r12d, (%r11,%rax,4)
	je	.L13
	movslq	%r8d, %rcx
	leaq	y(%rip), %r15
	movl	%r13d, (%r11,%rax,4)
	addl	$1, %r8d
	movl	%edi, (%r15,%rcx,4)
	leaq	x(%rip), %rdi
	movl	%esi, (%rdi,%rcx,4)
	movslq	(%r9), %rcx
	addq	%rcx, %rdx
	movl	(%rbx,%rdx,4), %edx
	addl	$1, %edx
	movl	%edx, (%rbx,%rax,4)
.L13:
	addl	$1, %ebp
	addq	$4, %r10
	addq	$4, %r9
	cmpl	%r8d, %ebp
	jne	.L34
	movq	40(%rsp), %rax
	movslq	(%rax,%r12,4), %rdx
	movq	32(%rsp), %rax
	imulq	$1010, %rdx, %rcx
	movslq	(%rax,%r12,4), %rax
	movq	%rdx, %rdi
	movq	%rdx, %r10
	addq	$1, %r12
	movq	%rax, %rsi
	addq	%rax, %rcx
	movl	(%rbx,%rcx,4), %ecx
	addl	%ecx, 20(%rsp)
	cmpq	24(%rsp), %r12
	jne	.L16
.L9:
	movl	20(%rsp), %edx
	xorl	%eax, %eax
	movl	$1, %edi
	leaq	.LC2(%rip), %rsi
	call	__printf_chk@PLT
	movq	1020264(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L35
	addq	$1020280, %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
.L19:
	.cfi_restore_state
	movl	$0, 20(%rsp)
	jmp	.L9
.L35:
	call	__stack_chk_fail@PLT
	.cfi_endproc
.LFE23:
	.size	main, .-main
	.globl	l
	.bss
	.align 32
	.type	l, @object
	.size	l, 4080400
l:
	.zero	4080400
	.globl	x
	.align 32
	.type	x, @object
	.size	x, 4000040
x:
	.zero	4000040
	.globl	y
	.align 32
	.type	y, @object
	.size	y, 4000040
y:
	.zero	4000040
	.globl	f
	.align 32
	.type	f, @object
	.size	f, 4080400
f:
	.zero	4080400
	.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 f[1010][1010],y[1000010],x[1000010],l[1010][1010];
int main(){
  int Y[]={1,0,-1,0};
  int X[]={0,1,0,-1};
  int n,m,ny,nx,gy[11],gx[11],i,j,k,a=0,t,r;
  char s[1010][1010]={};
  scanf("%d %d %d",&n,&m,&k);
  for(i=1;i<=n;i++){
    for(j=1;j<=m;j++){
      scanf(" %c",&s[i][j]);
      if(s[i][j]=='S')s[i][j]='0';
      if('0'<=s[i][j]&&s[i][j]<='9')s[gy[s[i][j]-'0']=i][gx[s[i][j]-'0']=j]='.';
    }
  }
  //for(i=0;i<=k;i++)printf("%d %d\n",gy[i],gx[i]);
  for(i=0;i<k;i++){
    f[y[t=0]=gy[i]][x[  0]=gx[i]]=i+1;
    l[y[0]][x[0]]=0;
    for(r=1;r-t;t++){
      for(j=0;j<4;j++){
	ny=y[t]+Y[j];
	nx=x[t]+X[j];//printf("%d\n",f[ny][nx]);
	if(s[ny][nx]-'.'||f[ny][nx]==i+1)continue;
	f[y[r]=ny][x[r]=nx]=i+1;
	l[ny][nx]=l[y[t]][x[t]]+1;
	r++;
      }
    }//printf("%d\n",r);
    /*for(j=0;j<n;j++){
      for(t=0;t<m;t++)printf("%d ",l[j+1][t+1]);printf("\n");
      }//*/
    a+=l[gy[i+1]][gx[i+1]];
  }
  printf("%d\n",a);
  return 0;
}
	
3 3 1
S..
...
..1

4

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 f[1010][1010],y[1000010],x[1000010],l[1010][1010];
int main(){
  int Y[]={1,0,-1,0};
  int X[]={0,1,0,-1};
  int n,m,ny,nx,gy[11],gx[11],i,j,k,a=0,t,r;
  char s[1010][1010]={};
  scanf("%d %d %d",&n,&m,&k);
  for(i=1;i<=n;i++){
    for(j=1;j<=m;j++){
      scanf(" %c",&s[i][j]);
      if(s[i][j]=='S')s[i][j]='0';
      if('0'<=s[i][j]&&s[i][j]<='9')s[gy[s[i][j]-'0']=i][gx[s[i][j]-'0']=j]='.';
    }
  }
  //for(i=0;i<=k;i++)printf("%d %d\n",gy[i],gx[i]);
  for(i=0;i<k;i++){
    f[y[t=0]=gy[i]][x[  0]=gx[i]]=i+1;
    l[y[0]][x[0]]=0;
    for(r=1;r-t;t++){
      for(j=0;j<4;j++){
	ny=y[t]+Y[j];
	nx=x[t]+X[j];//printf("%d\n",f[ny][nx]);
	if(s[ny][nx]-'.'||f[ny][nx]==i+1)continue;
	f[y[r]=ny][x[r]=nx]=i+1;
	l[ny][nx]=l[y[t]][x[t]]+1;
	r++;
      }
    }//printf("%d\n",r);
    /*for(j=0;j<n;j++){
      for(t=0;t<m;t++)printf("%d ",l[j+1][t+1]);printf("\n");
      }//*/
    a+=l[gy[i+1]][gx[i+1]];
  }
  printf("%d\n",a);
  return 0;
}
	```

Unoptimized Assembly Code:

```assembly
	.file	"temp.c"
	.text
	.globl	f
	.bss
	.align 32
	.type	f, @object
	.size	f, 4080400
f:
	.zero	4080400
	.globl	y
	.align 32
	.type	y, @object
	.size	y, 4000040
y:
	.zero	4000040
	.globl	x
	.align 32
	.type	x, @object
	.size	x, 4000040
x:
	.zero	4000040
	.globl	l
	.align 32
	.type	l, @object
	.size	l, 4080400
l:
	.zero	4080400
	.section	.rodata
.LC0:
	.string	"%d %d %d"
.LC1:
	.string	" %c"
.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
	leaq	-1019904(%rsp), %r11
.LPSRL0:
	subq	$4096, %rsp
	orq	$0, (%rsp)
	cmpq	%r11, %rsp
	jne	.LPSRL0
	subq	$384, %rsp
	movq	%fs:40, %rax
	movq	%rax, -8(%rbp)
	xorl	%eax, %eax
	movl	$1, -1020240(%rbp)
	movl	$0, -1020236(%rbp)
	movl	$-1, -1020232(%rbp)
	movl	$0, -1020228(%rbp)
	movl	$0, -1020224(%rbp)
	movl	$1, -1020220(%rbp)
	movl	$0, -1020216(%rbp)
	movl	$-1, -1020212(%rbp)
	movl	$0, -1020260(%rbp)
	leaq	-1020112(%rbp), %rax
	movl	$1020100, %edx
	movl	$0, %esi
	movq	%rax, %rdi
	call	memset@PLT
	leaq	-1020272(%rbp), %rcx
	leaq	-1020276(%rbp), %rdx
	leaq	-1020280(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	$1, -1020268(%rbp)
	jmp	.L2
.L7:
	movl	$1, -1020264(%rbp)
	jmp	.L3
.L6:
	leaq	-1020112(%rbp), %rdx
	movl	-1020264(%rbp), %eax
	movslq	%eax, %rcx
	movl	-1020268(%rbp), %eax
	cltq
	imulq	$1010, %rax, %rax
	addq	%rcx, %rax
	addq	%rdx, %rax
	movq	%rax, %rsi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	-1020264(%rbp), %eax
	movslq	%eax, %rdx
	movl	-1020268(%rbp), %eax
	cltq
	imulq	$1010, %rax, %rax
	addq	%rbp, %rax
	addq	%rdx, %rax
	subq	$1020112, %rax
	movzbl	(%rax), %eax
	cmpb	$83, %al
	jne	.L4
	movl	-1020264(%rbp), %eax
	movslq	%eax, %rdx
	movl	-1020268(%rbp), %eax
	cltq
	imulq	$1010, %rax, %rax
	addq	%rbp, %rax
	addq	%rdx, %rax
	subq	$1020112, %rax
	movb	$48, (%rax)
.L4:
	movl	-1020264(%rbp), %eax
	movslq	%eax, %rdx
	movl	-1020268(%rbp), %eax
	cltq
	imulq	$1010, %rax, %rax
	addq	%rbp, %rax
	addq	%rdx, %rax
	subq	$1020112, %rax
	movzbl	(%rax), %eax
	cmpb	$47, %al
	jle	.L5
	movl	-1020264(%rbp), %eax
	movslq	%eax, %rdx
	movl	-1020268(%rbp), %eax
	cltq
	imulq	$1010, %rax, %rax
	addq	%rbp, %rax
	addq	%rdx, %rax
	subq	$1020112, %rax
	movzbl	(%rax), %eax
	cmpb	$57, %al
	jg	.L5
	movl	-1020264(%rbp), %eax
	movslq	%eax, %rdx
	movl	-1020268(%rbp), %eax
	cltq
	imulq	$1010, %rax, %rax
	addq	%rbp, %rax
	addq	%rdx, %rax
	subq	$1020112, %rax
	movzbl	(%rax), %eax
	movsbl	%al, %eax
	subl	$48, %eax
	movslq	%eax, %rdx
	movl	-1020268(%rbp), %ecx
	movl	%ecx, -1020208(%rbp,%rdx,4)
	cltq
	movl	-1020208(%rbp,%rax,4), %esi
	movl	-1020264(%rbp), %eax
	movslq	%eax, %rdx
	movl	-1020268(%rbp), %eax
	cltq
	imulq	$1010, %rax, %rax
	addq	%rbp, %rax
	addq	%rdx, %rax
	subq	$1020112, %rax
	movzbl	(%rax), %eax
	movsbl	%al, %eax
	subl	$48, %eax
	movslq	%eax, %rdx
	movl	-1020264(%rbp), %ecx
	movl	%ecx, -1020160(%rbp,%rdx,4)
	cltq
	movl	-1020160(%rbp,%rax,4), %eax
	movslq	%eax, %rdx
	movslq	%esi, %rax
	imulq	$1010, %rax, %rax
	addq	%rbp, %rax
	addq	%rdx, %rax
	subq	$1020112, %rax
	movb	$46, (%rax)
.L5:
	addl	$1, -1020264(%rbp)
.L3:
	movl	-1020276(%rbp), %eax
	cmpl	%eax, -1020264(%rbp)
	jle	.L6
	addl	$1, -1020268(%rbp)
.L2:
	movl	-1020280(%rbp), %eax
	cmpl	%eax, -1020268(%rbp)
	jle	.L7
	movl	$0, -1020268(%rbp)
	jmp	.L8
.L16:
	movl	$0, -1020256(%rbp)
	movl	-1020268(%rbp), %eax
	cltq
	movl	-1020208(%rbp,%rax,4), %eax
	movl	-1020256(%rbp), %edx
	movslq	%edx, %rdx
	leaq	0(,%rdx,4), %rcx
	leaq	y(%rip), %rdx
	movl	%eax, (%rcx,%rdx)
	movl	-1020256(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	y(%rip), %rax
	movl	(%rdx,%rax), %edx
	movl	-1020268(%rbp), %eax
	cltq
	movl	-1020160(%rbp,%rax,4), %eax
	movl	%eax, x(%rip)
	movl	x(%rip), %eax
	movl	-1020268(%rbp), %ecx
	addl	$1, %ecx
	movslq	%eax, %rsi
	movslq	%edx, %rax
	imulq	$1010, %rax, %rax
	addq	%rsi, %rax
	leaq	0(,%rax,4), %rdx
	leaq	f(%rip), %rax
	movl	%ecx, (%rdx,%rax)
	movl	y(%rip), %eax
	movl	x(%rip), %edx
	movslq	%edx, %rdx
	cltq
	imulq	$1010, %rax, %rax
	addq	%rdx, %rax
	leaq	0(,%rax,4), %rdx
	leaq	l(%rip), %rax
	movl	$0, (%rdx,%rax)
	movl	$1, -1020252(%rbp)
	jmp	.L9
.L15:
	movl	$0, -1020264(%rbp)
	jmp	.L10
.L14:
	movl	-1020256(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	y(%rip), %rax
	movl	(%rdx,%rax), %edx
	movl	-1020264(%rbp), %eax
	cltq
	movl	-1020240(%rbp,%rax,4), %eax
	addl	%edx, %eax
	movl	%eax, -1020248(%rbp)
	movl	-1020256(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	x(%rip), %rax
	movl	(%rdx,%rax), %edx
	movl	-1020264(%rbp), %eax
	cltq
	movl	-1020224(%rbp,%rax,4), %eax
	addl	%edx, %eax
	movl	%eax, -1020244(%rbp)
	movl	-1020244(%rbp), %eax
	movslq	%eax, %rdx
	movl	-1020248(%rbp), %eax
	cltq
	imulq	$1010, %rax, %rax
	addq	%rbp, %rax
	addq	%rdx, %rax
	subq	$1020112, %rax
	movzbl	(%rax), %eax
	cmpb	$46, %al
	jne	.L19
	movl	-1020244(%rbp), %eax
	movslq	%eax, %rdx
	movl	-1020248(%rbp), %eax
	cltq
	imulq	$1010, %rax, %rax
	addq	%rdx, %rax
	leaq	0(,%rax,4), %rdx
	leaq	f(%rip), %rax
	movl	(%rdx,%rax), %eax
	movl	-1020268(%rbp), %edx
	addl	$1, %edx
	cmpl	%edx, %eax
	je	.L19
	movl	-1020252(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rcx
	leaq	y(%rip), %rdx
	movl	-1020248(%rbp), %eax
	movl	%eax, (%rcx,%rdx)
	movl	-1020252(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	y(%rip), %rax
	movl	(%rdx,%rax), %edx
	movl	-1020252(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rsi
	leaq	x(%rip), %rcx
	movl	-1020244(%rbp), %eax
	movl	%eax, (%rsi,%rcx)
	movl	-1020252(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rcx
	leaq	x(%rip), %rax
	movl	(%rcx,%rax), %eax
	movl	-1020268(%rbp), %ecx
	addl	$1, %ecx
	movslq	%eax, %rsi
	movslq	%edx, %rax
	imulq	$1010, %rax, %rax
	addq	%rsi, %rax
	leaq	0(,%rax,4), %rdx
	leaq	f(%rip), %rax
	movl	%ecx, (%rdx,%rax)
	movl	-1020256(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	y(%rip), %rax
	movl	(%rdx,%rax), %eax
	movl	-1020256(%rbp), %edx
	movslq	%edx, %rdx
	leaq	0(,%rdx,4), %rcx
	leaq	x(%rip), %rdx
	movl	(%rcx,%rdx), %edx
	movslq	%edx, %rdx
	cltq
	imulq	$1010, %rax, %rax
	addq	%rdx, %rax
	leaq	0(,%rax,4), %rdx
	leaq	l(%rip), %rax
	movl	(%rdx,%rax), %eax
	leal	1(%rax), %ecx
	movl	-1020244(%rbp), %eax
	movslq	%eax, %rdx
	movl	-1020248(%rbp), %eax
	cltq
	imulq	$1010, %rax, %rax
	addq	%rdx, %rax
	leaq	0(,%rax,4), %rdx
	leaq	l(%rip), %rax
	movl	%ecx, (%rdx,%rax)
	addl	$1, -1020252(%rbp)
	jmp	.L13
.L19:
	nop
.L13:
	addl	$1, -1020264(%rbp)
.L10:
	cmpl	$3, -1020264(%rbp)
	jle	.L14
	addl	$1, -1020256(%rbp)
.L9:
	movl	-1020252(%rbp), %eax
	cmpl	-1020256(%rbp), %eax
	jne	.L15
	movl	-1020268(%rbp), %eax
	addl	$1, %eax
	cltq
	movl	-1020208(%rbp,%rax,4), %edx
	movl	-1020268(%rbp), %eax
	addl	$1, %eax
	cltq
	movl	-1020160(%rbp,%rax,4), %eax
	movslq	%eax, %rcx
	movslq	%edx, %rax
	imulq	$1010, %rax, %rax
	addq	%rcx, %rax
	leaq	0(,%rax,4), %rdx
	leaq	l(%rip), %rax
	movl	(%rdx,%rax), %eax
	addl	%eax, -1020260(%rbp)
	addl	$1, -1020268(%rbp)
.L8:
	movl	-1020272(%rbp), %eax
	cmpl	%eax, -1020268(%rbp)
	jl	.L16
	movl	-1020260(%rbp), %eax
	movl	%eax, %esi
	leaq	.LC2(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	movl	$0, %eax
	movq	-8(%rbp), %rdx
	subq	%fs:40, %rdx
	je	.L18
	call	__stack_chk_fail@PLT
.L18:
	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	f
	.bss
	.align 32
	.type	f, @object
	.size	f, 4080400
f:
	.zero	4080400
	.globl	y
	.align 32
	.type	y, @object
	.size	y, 4000040
y:
	.zero	4000040
	.globl	x
	.align 32
	.type	x, @object
	.size	x, 4000040
x:
	.zero	4000040
	.globl	l
	.align 32
	.type	l, @object
	.size	l, 4080400
l:
	.zero	4080400
	.section	.rodata
.LC0:
	.string	"%d %d %d"
.LC1:
	.string	" %c"
.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
	leaq	-1019904(%rsp), %r11
.LPSRL0:
	subq	$4096, %rsp
	orq	$0, (%rsp)
	cmpq	%r11, %rsp
	jne	.LPSRL0
	subq	$384, %rsp
	movq	%fs:40, %rax
	movq	%rax, -8(%rbp)
	xorl	%eax, %eax
	movl	$1, -1020240(%rbp)
	movl	$0, -1020236(%rbp)
	movl	$-1, -1020232(%rbp)
	movl	$0, -1020228(%rbp)
	movl	$0, -1020224(%rbp)
	movl	$1, -1020220(%rbp)
	movl	$0, -1020216(%rbp)
	movl	$-1, -1020212(%rbp)
	movl	$0, -1020260(%rbp)
	leaq	-1020112(%rbp), %rax
	movl	$1020100, %edx
	movl	$0, %esi
	movq	%rax, %rdi
	call	memset@PLT
	leaq	-1020272(%rbp), %rcx
	leaq	-1020276(%rbp), %rdx
	leaq	-1020280(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	$1, -1020268(%rbp)
	jmp	.L2
.L7:
	movl	$1, -1020264(%rbp)
	jmp	.L3
.L6:
	leaq	-1020112(%rbp), %rdx
	movl	-1020264(%rbp), %eax
	movslq	%eax, %rcx
	movl	-1020268(%rbp), %eax
	cltq
	imulq	$1010, %rax, %rax
	addq	%rcx, %rax
	addq	%rdx, %rax
	movq	%rax, %rsi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	-1020264(%rbp), %eax
	movslq	%eax, %rdx
	movl	-1020268(%rbp), %eax
	cltq
	imulq	$1010, %rax, %rax
	addq	%rbp, %rax
	addq	%rdx, %rax
	subq	$1020112, %rax
	movzbl	(%rax), %eax
	cmpb	$83, %al
	jne	.L4
	movl	-1020264(%rbp), %eax
	movslq	%eax, %rdx
	movl	-1020268(%rbp), %eax
	cltq
	imulq	$1010, %rax, %rax
	addq	%rbp, %rax
	addq	%rdx, %rax
	subq	$1020112, %rax
	movb	$48, (%rax)
.L4:
	movl	-1020264(%rbp), %eax
	movslq	%eax, %rdx
	movl	-1020268(%rbp), %eax
	cltq
	imulq	$1010, %rax, %rax
	addq	%rbp, %rax
	addq	%rdx, %rax
	subq	$1020112, %rax
	movzbl	(%rax), %eax
	cmpb	$47, %al
	jle	.L5
	movl	-1020264(%rbp), %eax
	movslq	%eax, %rdx
	movl	-1020268(%rbp), %eax
	cltq
	imulq	$1010, %rax, %rax
	addq	%rbp, %rax
	addq	%rdx, %rax
	subq	$1020112, %rax
	movzbl	(%rax), %eax
	cmpb	$57, %al
	jg	.L5
	movl	-1020264(%rbp), %eax
	movslq	%eax, %rdx
	movl	-1020268(%rbp), %eax
	cltq
	imulq	$1010, %rax, %rax
	addq	%rbp, %rax
	addq	%rdx, %rax
	subq	$1020112, %rax
	movzbl	(%rax), %eax
	movsbl	%al, %eax
	subl	$48, %eax
	movslq	%eax, %rdx
	movl	-1020268(%rbp), %ecx
	movl	%ecx, -1020208(%rbp,%rdx,4)
	cltq
	movl	-1020208(%rbp,%rax,4), %esi
	movl	-1020264(%rbp), %eax
	movslq	%eax, %rdx
	movl	-1020268(%rbp), %eax
	cltq
	imulq	$1010, %rax, %rax
	addq	%rbp, %rax
	addq	%rdx, %rax
	subq	$1020112, %rax
	movzbl	(%rax), %eax
	movsbl	%al, %eax
	subl	$48, %eax
	movslq	%eax, %rdx
	movl	-1020264(%rbp), %ecx
	movl	%ecx, -1020160(%rbp,%rdx,4)
	cltq
	movl	-1020160(%rbp,%rax,4), %eax
	movslq	%eax, %rdx
	movslq	%esi, %rax
	imulq	$1010, %rax, %rax
	addq	%rbp, %rax
	addq	%rdx, %rax
	subq	$1020112, %rax
	movb	$46, (%rax)
.L5:
	addl	$1, -1020264(%rbp)
.L3:
	movl	-1020276(%rbp), %eax
	cmpl	%eax, -1020264(%rbp)
	jle	.L6
	addl	$1, -1020268(%rbp)
.L2:
	movl	-1020280(%rbp), %eax
	cmpl	%eax, -1020268(%rbp)
	jle	.L7
	movl	$0, -1020268(%rbp)
	jmp	.L8
.L16:
	movl	$0, -1020256(%rbp)
	movl	-1020268(%rbp), %eax
	cltq
	movl	-1020208(%rbp,%rax,4), %eax
	movl	-1020256(%rbp), %edx
	movslq	%edx, %rdx
	leaq	0(,%rdx,4), %rcx
	leaq	y(%rip), %rdx
	movl	%eax, (%rcx,%rdx)
	movl	-1020256(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	y(%rip), %rax
	movl	(%rdx,%rax), %edx
	movl	-1020268(%rbp), %eax
	cltq
	movl	-1020160(%rbp,%rax,4), %eax
	movl	%eax, x(%rip)
	movl	x(%rip), %eax
	movl	-1020268(%rbp), %ecx
	addl	$1, %ecx
	movslq	%eax, %rsi
	movslq	%edx, %rax
	imulq	$1010, %rax, %rax
	addq	%rsi, %rax
	leaq	0(,%rax,4), %rdx
	leaq	f(%rip), %rax
	movl	%ecx, (%rdx,%rax)
	movl	y(%rip), %eax
	movl	x(%rip), %edx
	movslq	%edx, %rdx
	cltq
	imulq	$1010, %rax, %rax
	addq	%rdx, %rax
	leaq	0(,%rax,4), %rdx
	leaq	l(%rip), %rax
	movl	$0, (%rdx,%rax)
	movl	$1, -1020252(%rbp)
	jmp	.L9
.L15:
	movl	$0, -1020264(%rbp)
	jmp	.L10
.L14:
	movl	-1020256(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	y(%rip), %rax
	movl	(%rdx,%rax), %edx
	movl	-1020264(%rbp), %eax
	cltq
	movl	-1020240(%rbp,%rax,4), %eax
	addl	%edx, %eax
	movl	%eax, -1020248(%rbp)
	movl	-1020256(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	x(%rip), %rax
	movl	(%rdx,%rax), %edx
	movl	-1020264(%rbp), %eax
	cltq
	movl	-1020224(%rbp,%rax,4), %eax
	addl	%edx, %eax
	movl	%eax, -1020244(%rbp)
	movl	-1020244(%rbp), %eax
	movslq	%eax, %rdx
	movl	-1020248(%rbp), %eax
	cltq
	imulq	$1010, %rax, %rax
	addq	%rbp, %rax
	addq	%rdx, %rax
	subq	$1020112, %rax
	movzbl	(%rax), %eax
	cmpb	$46, %al
	jne	.L19
	movl	-1020244(%rbp), %eax
	movslq	%eax, %rdx
	movl	-1020248(%rbp), %eax
	cltq
	imulq	$1010, %rax, %rax
	addq	%rdx, %rax
	leaq	0(,%rax,4), %rdx
	leaq	f(%rip), %rax
	movl	(%rdx,%rax), %eax
	movl	-1020268(%rbp), %edx
	addl	$1, %edx
	cmpl	%edx, %eax
	je	.L19
	movl	-1020252(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rcx
	leaq	y(%rip), %rdx
	movl	-1020248(%rbp), %eax
	movl	%eax, (%rcx,%rdx)
	movl	-1020252(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	y(%rip), %rax
	movl	(%rdx,%rax), %edx
	movl	-1020252(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rsi
	leaq	x(%rip), %rcx
	movl	-1020244(%rbp), %eax
	movl	%eax, (%rsi,%rcx)
	movl	-1020252(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rcx
	leaq	x(%rip), %rax
	movl	(%rcx,%rax), %eax
	movl	-1020268(%rbp), %ecx
	addl	$1, %ecx
	movslq	%eax, %rsi
	movslq	%edx, %rax
	imulq	$1010, %rax, %rax
	addq	%rsi, %rax
	leaq	0(,%rax,4), %rdx
	leaq	f(%rip), %rax
	movl	%ecx, (%rdx,%rax)
	movl	-1020256(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	y(%rip), %rax
	movl	(%rdx,%rax), %eax
	movl	-1020256(%rbp), %edx
	movslq	%edx, %rdx
	leaq	0(,%rdx,4), %rcx
	leaq	x(%rip), %rdx
	movl	(%rcx,%rdx), %edx
	movslq	%edx, %rdx
	cltq
	imulq	$1010, %rax, %rax
	addq	%rdx, %rax
	leaq	0(,%rax,4), %rdx
	leaq	l(%rip), %rax
	movl	(%rdx,%rax), %eax
	leal	1(%rax), %ecx
	movl	-1020244(%rbp), %eax
	movslq	%eax, %rdx
	movl	-1020248(%rbp), %eax
	cltq
	imulq	$1010, %rax, %rax
	addq	%rdx, %rax
	leaq	0(,%rax,4), %rdx
	leaq	l(%rip), %rax
	movl	%ecx, (%rdx,%rax)
	addl	$1, -1020252(%rbp)
	jmp	.L13
.L19:
	nop
.L13:
	addl	$1, -1020264(%rbp)
.L10:
	cmpl	$3, -1020264(%rbp)
	jle	.L14
	addl	$1, -1020256(%rbp)
.L9:
	movl	-1020252(%rbp), %eax
	cmpl	-1020256(%rbp), %eax
	jne	.L15
	movl	-1020268(%rbp), %eax
	addl	$1, %eax
	cltq
	movl	-1020208(%rbp,%rax,4), %edx
	movl	-1020268(%rbp), %eax
	addl	$1, %eax
	cltq
	movl	-1020160(%rbp,%rax,4), %eax
	movslq	%eax, %rcx
	movslq	%edx, %rax
	imulq	$1010, %rax, %rax
	addq	%rcx, %rax
	leaq	0(,%rax,4), %rdx
	leaq	l(%rip), %rax
	movl	(%rdx,%rax), %eax
	addl	%eax, -1020260(%rbp)
	addl	$1, -1020268(%rbp)
.L8:
	movl	-1020272(%rbp), %eax
	cmpl	%eax, -1020268(%rbp)
	jl	.L16
	movl	-1020260(%rbp), %eax
	movl	%eax, %esi
	leaq	.LC2(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	movl	$0, %eax
	movq	-8(%rbp), %rdx
	subq	%fs:40, %rdx
	je	.L18
	call	__stack_chk_fail@PLT
.L18:
	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:
