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>          // printf(), scanf()
#include <stdbool.h>

#define MAX_N 1000
#define max(a, b) ((a) > (b) ? (a) : (b))
#define min(a, b) ((a) < (b) ? (a) : (b))

char G[MAX_N][MAX_N + 1];
int dp[MAX_N][MAX_N];
int n;

int
square()
{
	int i, j;

	int max_n = 0;
	for (i = 0; i < n; ++i)
	{
		for (j = 0; j < n; ++j)
		{
			dp[i][j] = (G[i][j] == '.') ? 1 : 0;
			max_n |= dp[i][j];
		}
	}

	for (i = 1; i < n; ++i)
	{
		for (j = 1; j < n; ++j)
		{
			if (G[i][j] == '*')
				dp[i][j] = 0;
			else
			{
				dp[i][j] = min(dp[i - 1][j - 1], min(dp[i - 1][j], dp[i][j - 1])) + 1;
				max_n = max(max_n, dp[i][j]);
			}
		}
	}

	return max_n;
}

int
main(int argc, char **argv)
{
	int i;

	while (true)
	{
		scanf("%d\n", &n);
		if (n == 0)
			break;

		for (i = 0; i < n; ++i)
			fgets(&G[i][0], n + 2, stdin);

		printf("%d\n", square());
	}

	return 0;
}```

Unoptimized Assembly Code:

```assembly
	.file	"temp.c"
	.text
	.globl	G
	.bss
	.align 32
	.type	G, @object
	.size	G, 1001000
G:
	.zero	1001000
	.globl	dp
	.align 32
	.type	dp, @object
	.size	dp, 4000000
dp:
	.zero	4000000
	.globl	n
	.align 4
	.type	n, @object
	.size	n, 4
n:
	.zero	4
	.text
	.globl	square
	.type	square, @function
square:
.LFB0:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	movl	$0, -4(%rbp)
	movl	$0, -12(%rbp)
	jmp	.L2
.L5:
	movl	$0, -8(%rbp)
	jmp	.L3
.L4:
	movl	-8(%rbp), %eax
	movslq	%eax, %rdx
	movl	-12(%rbp), %eax
	cltq
	imulq	$1001, %rax, %rax
	addq	%rax, %rdx
	leaq	G(%rip), %rax
	addq	%rdx, %rax
	movzbl	(%rax), %eax
	cmpb	$46, %al
	sete	%al
	movzbl	%al, %eax
	movl	-8(%rbp), %edx
	movslq	%edx, %rcx
	movl	-12(%rbp), %edx
	movslq	%edx, %rdx
	imulq	$1000, %rdx, %rdx
	addq	%rcx, %rdx
	leaq	0(,%rdx,4), %rcx
	leaq	dp(%rip), %rdx
	movl	%eax, (%rcx,%rdx)
	movl	-8(%rbp), %eax
	movslq	%eax, %rdx
	movl	-12(%rbp), %eax
	cltq
	imulq	$1000, %rax, %rax
	addq	%rdx, %rax
	leaq	0(,%rax,4), %rdx
	leaq	dp(%rip), %rax
	movl	(%rdx,%rax), %eax
	orl	%eax, -4(%rbp)
	addl	$1, -8(%rbp)
.L3:
	movl	n(%rip), %eax
	cmpl	%eax, -8(%rbp)
	jl	.L4
	addl	$1, -12(%rbp)
.L2:
	movl	n(%rip), %eax
	cmpl	%eax, -12(%rbp)
	jl	.L5
	movl	$1, -12(%rbp)
	jmp	.L6
.L11:
	movl	$1, -8(%rbp)
	jmp	.L7
.L10:
	movl	-8(%rbp), %eax
	movslq	%eax, %rdx
	movl	-12(%rbp), %eax
	cltq
	imulq	$1001, %rax, %rax
	addq	%rax, %rdx
	leaq	G(%rip), %rax
	addq	%rdx, %rax
	movzbl	(%rax), %eax
	cmpb	$42, %al
	jne	.L8
	movl	-8(%rbp), %eax
	movslq	%eax, %rdx
	movl	-12(%rbp), %eax
	cltq
	imulq	$1000, %rax, %rax
	addq	%rdx, %rax
	leaq	0(,%rax,4), %rdx
	leaq	dp(%rip), %rax
	movl	$0, (%rdx,%rax)
	jmp	.L9
.L8:
	movl	-8(%rbp), %eax
	subl	$1, %eax
	movslq	%eax, %rdx
	movl	-12(%rbp), %eax
	cltq
	imulq	$1000, %rax, %rax
	addq	%rdx, %rax
	leaq	0(,%rax,4), %rdx
	leaq	dp(%rip), %rax
	movl	(%rdx,%rax), %edx
	movl	-12(%rbp), %eax
	leal	-1(%rax), %ecx
	movl	-8(%rbp), %eax
	movslq	%eax, %rsi
	movslq	%ecx, %rax
	imulq	$1000, %rax, %rax
	addq	%rsi, %rax
	leaq	0(,%rax,4), %rcx
	leaq	dp(%rip), %rax
	movl	(%rcx,%rax), %eax
	cmpl	%eax, %edx
	cmovg	%eax, %edx
	movl	-12(%rbp), %eax
	leal	-1(%rax), %ecx
	movl	-8(%rbp), %eax
	subl	$1, %eax
	movslq	%eax, %rsi
	movslq	%ecx, %rax
	imulq	$1000, %rax, %rax
	addq	%rsi, %rax
	leaq	0(,%rax,4), %rcx
	leaq	dp(%rip), %rax
	movl	(%rcx,%rax), %eax
	cmpl	%eax, %edx
	cmovle	%edx, %eax
	leal	1(%rax), %ecx
	movl	-8(%rbp), %eax
	movslq	%eax, %rdx
	movl	-12(%rbp), %eax
	cltq
	imulq	$1000, %rax, %rax
	addq	%rdx, %rax
	leaq	0(,%rax,4), %rdx
	leaq	dp(%rip), %rax
	movl	%ecx, (%rdx,%rax)
	movl	-8(%rbp), %eax
	movslq	%eax, %rdx
	movl	-12(%rbp), %eax
	cltq
	imulq	$1000, %rax, %rax
	addq	%rdx, %rax
	leaq	0(,%rax,4), %rdx
	leaq	dp(%rip), %rax
	movl	(%rdx,%rax), %eax
	movl	-4(%rbp), %edx
	cmpl	%eax, %edx
	cmovge	%edx, %eax
	movl	%eax, -4(%rbp)
.L9:
	addl	$1, -8(%rbp)
.L7:
	movl	n(%rip), %eax
	cmpl	%eax, -8(%rbp)
	jl	.L10
	addl	$1, -12(%rbp)
.L6:
	movl	n(%rip), %eax
	cmpl	%eax, -12(%rbp)
	jl	.L11
	movl	-4(%rbp), %eax
	popq	%rbp
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE0:
	.size	square, .-square
	.section	.rodata
.LC0:
	.string	"%d\n"
	.text
	.globl	main
	.type	main, @function
main:
.LFB1:
	.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
	movl	%edi, -20(%rbp)
	movq	%rsi, -32(%rbp)
.L18:
	leaq	n(%rip), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	n(%rip), %eax
	testl	%eax, %eax
	je	.L21
	movl	$0, -4(%rbp)
	jmp	.L16
.L17:
	movq	stdin(%rip), %rax
	movl	n(%rip), %edx
	leal	2(%rdx), %esi
	movl	-4(%rbp), %edx
	movslq	%edx, %rdx
	imulq	$1001, %rdx, %rdx
	leaq	G(%rip), %rcx
	addq	%rdx, %rcx
	movq	%rax, %rdx
	movq	%rcx, %rdi
	call	fgets@PLT
	addl	$1, -4(%rbp)
.L16:
	movl	n(%rip), %eax
	cmpl	%eax, -4(%rbp)
	jl	.L17
	movl	$0, %eax
	call	square
	movl	%eax, %esi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	jmp	.L18
.L21:
	nop
	movl	$0, %eax
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE1:
	.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
	.p2align 4
	.globl	square
	.type	square, @function
square:
.LFB23:
	.cfi_startproc
	endbr64
	movl	n(%rip), %ecx
	testl	%ecx, %ecx
	jle	.L12
	pushq	%r15
	.cfi_def_cfa_offset 16
	.cfi_offset 15, -16
	leal	-1(%rcx), %eax
	leaq	G(%rip), %r15
	xorl	%r11d, %r11d
	pushq	%r14
	.cfi_def_cfa_offset 24
	.cfi_offset 14, -24
	pxor	%xmm4, %xmm4
	pxor	%xmm2, %xmm2
	leaq	dp(%rip), %r9
	pushq	%r13
	.cfi_def_cfa_offset 32
	.cfi_offset 13, -32
	movdqa	.LC0(%rip), %xmm6
	movl	%ecx, %r13d
	pushq	%r12
	.cfi_def_cfa_offset 40
	.cfi_offset 12, -40
	movdqa	.LC1(%rip), %xmm5
	andl	$-16, %r13d
	pushq	%rbp
	.cfi_def_cfa_offset 48
	.cfi_offset 6, -48
	movq	%r9, %rbp
	pushq	%rbx
	.cfi_def_cfa_offset 56
	.cfi_offset 3, -56
	movq	%r15, %rbx
	movl	%eax, -12(%rsp)
	movl	%ecx, %eax
	shrl	$4, %eax
	leal	-1(%rax), %r14d
	xorl	%eax, %eax
	addq	$1, %r14
	salq	$4, %r14
	.p2align 4,,10
	.p2align 3
.L6:
	cmpl	$14, -12(%rsp)
	jbe	.L13
	leaq	(%r14,%rbx), %rdi
	movq	%rbp, %rdx
	pxor	%xmm3, %xmm3
	movq	%rbx, %rsi
	.p2align 4,,10
	.p2align 3
.L4:
	movdqu	(%rsi), %xmm0
	addq	$16, %rsi
	addq	$64, %rdx
	pcmpeqb	%xmm6, %xmm0
	pand	%xmm5, %xmm0
	movdqa	%xmm0, %xmm1
	punpckhbw	%xmm4, %xmm0
	punpcklbw	%xmm4, %xmm1
	movdqa	%xmm0, %xmm7
	punpckhwd	%xmm2, %xmm0
	movdqa	%xmm1, %xmm8
	punpcklwd	%xmm2, %xmm7
	punpckhwd	%xmm2, %xmm1
	movaps	%xmm0, -16(%rdx)
	punpcklwd	%xmm2, %xmm8
	movaps	%xmm1, -48(%rdx)
	por	%xmm7, %xmm0
	por	%xmm8, %xmm1
	movaps	%xmm8, -64(%rdx)
	por	%xmm0, %xmm1
	movaps	%xmm7, -32(%rdx)
	por	%xmm1, %xmm3
	cmpq	%rdi, %rsi
	jne	.L4
	movdqa	%xmm3, %xmm0
	psrldq	$8, %xmm0
	por	%xmm0, %xmm3
	movdqa	%xmm3, %xmm0
	psrldq	$4, %xmm0
	por	%xmm0, %xmm3
	movd	%xmm3, %edx
	orl	%edx, %eax
	cmpl	%r13d, %ecx
	je	.L5
	movl	%r13d, %edx
.L3:
	movslq	%r11d, %r10
	movslq	%edx, %r8
	xorl	%r12d, %r12d
	imulq	$1001, %r10, %rsi
	addq	%r15, %rsi
	cmpb	$46, (%rsi,%r8)
	sete	%r12b
	imulq	$1000, %r10, %rdi
	orl	%r12d, %eax
	addq	%rdi, %r8
	movl	%r12d, (%r9,%r8,4)
	leal	1(%rdx), %r8d
	cmpl	%ecx, %r8d
	jge	.L5
	movslq	%r8d, %r8
	xorl	%r12d, %r12d
	cmpb	$46, (%rsi,%r8)
	sete	%r12b
	addq	%rdi, %r8
	movl	%r12d, (%r9,%r8,4)
	leal	2(%rdx), %r8d
	orl	%r12d, %eax
	cmpl	%ecx, %r8d
	jge	.L5
	movslq	%r8d, %r8
	xorl	%r12d, %r12d
	cmpb	$46, (%rsi,%r8)
	sete	%r12b
	addq	%rdi, %r8
	movl	%r12d, (%r9,%r8,4)
	leal	3(%rdx), %r8d
	orl	%r12d, %eax
	cmpl	%r8d, %ecx
	jle	.L5
	movslq	%r8d, %r8
	xorl	%r12d, %r12d
	cmpb	$46, (%rsi,%r8)
	sete	%r12b
	addq	%rdi, %r8
	movl	%r12d, (%r9,%r8,4)
	leal	4(%rdx), %r8d
	orl	%r12d, %eax
	cmpl	%r8d, %ecx
	jle	.L5
	movslq	%r8d, %r8
	xorl	%r12d, %r12d
	cmpb	$46, (%rsi,%r8)
	sete	%r12b
	addq	%rdi, %r8
	movl	%r12d, (%r9,%r8,4)
	leal	5(%rdx), %r8d
	orl	%r12d, %eax
	cmpl	%r8d, %ecx
	jle	.L5
	movslq	%r8d, %r8
	xorl	%r12d, %r12d
	cmpb	$46, (%rsi,%r8)
	sete	%r12b
	addq	%rdi, %r8
	movl	%r12d, (%r9,%r8,4)
	leal	6(%rdx), %r8d
	orl	%r12d, %eax
	cmpl	%r8d, %ecx
	jle	.L5
	movslq	%r8d, %r8
	xorl	%r12d, %r12d
	cmpb	$46, (%rsi,%r8)
	sete	%r12b
	addq	%rdi, %r8
	movl	%r12d, (%r9,%r8,4)
	leal	7(%rdx), %r8d
	orl	%r12d, %eax
	cmpl	%r8d, %ecx
	jle	.L5
	movslq	%r8d, %r8
	xorl	%r12d, %r12d
	cmpb	$46, (%rsi,%r8)
	sete	%r12b
	addq	%rdi, %r8
	movl	%r12d, (%r9,%r8,4)
	leal	8(%rdx), %r8d
	orl	%r12d, %eax
	cmpl	%r8d, %ecx
	jle	.L5
	movslq	%r8d, %r8
	xorl	%r12d, %r12d
	cmpb	$46, (%rsi,%r8)
	sete	%r12b
	addq	%rdi, %r8
	movl	%r12d, (%r9,%r8,4)
	leal	9(%rdx), %r8d
	orl	%r12d, %eax
	cmpl	%r8d, %ecx
	jle	.L5
	movslq	%r8d, %r8
	cmpb	$46, (%rsi,%r8)
	sete	%sil
	addq	%r8, %rdi
	movzbl	%sil, %esi
	movl	%esi, (%r9,%rdi,4)
	orl	%esi, %eax
	leal	10(%rdx), %esi
	cmpl	%esi, %ecx
	jle	.L5
	imulq	$1001, %r10, %rdi
	movslq	%esi, %rsi
	xorl	%r8d, %r8d
	addq	%r15, %rdi
	cmpb	$46, (%rdi,%rsi)
	sete	%r8b
	imulq	$1000, %r10, %r10
	orl	%r8d, %eax
	addq	%r10, %rsi
	movl	%r8d, (%r9,%rsi,4)
	leal	11(%rdx), %esi
	cmpl	%esi, %ecx
	jle	.L5
	movslq	%esi, %rsi
	xorl	%r8d, %r8d
	cmpb	$46, (%rdi,%rsi)
	sete	%r8b
	addq	%r10, %rsi
	movl	%r8d, (%r9,%rsi,4)
	leal	12(%rdx), %esi
	orl	%r8d, %eax
	cmpl	%esi, %ecx
	jle	.L5
	movslq	%esi, %rsi
	xorl	%r8d, %r8d
	cmpb	$46, (%rdi,%rsi)
	sete	%r8b
	addq	%r10, %rsi
	movl	%r8d, (%r9,%rsi,4)
	leal	13(%rdx), %esi
	orl	%r8d, %eax
	cmpl	%esi, %ecx
	jle	.L5
	movslq	%esi, %rsi
	xorl	%r8d, %r8d
	cmpb	$46, (%rdi,%rsi)
	sete	%r8b
	addq	%r10, %rsi
	addl	$14, %edx
	movl	%r8d, (%r9,%rsi,4)
	orl	%r8d, %eax
	cmpl	%edx, %ecx
	jle	.L5
	movslq	%edx, %rdx
	xorl	%esi, %esi
	cmpb	$46, (%rdi,%rdx)
	sete	%sil
	addq	%rdx, %r10
	movl	%esi, (%r9,%r10,4)
	orl	%esi, %eax
	.p2align 4,,10
	.p2align 3
.L5:
	addl	$1, %r11d
	addq	$1001, %rbx
	addq	$4000, %rbp
	cmpl	%ecx, %r11d
	jne	.L6
	cmpl	$1, %r11d
	jle	.L1
	leal	-2(%r11), %edx
	leaq	4+dp(%rip), %rcx
	leaq	4000(%rcx,%rdx,4), %r9
	leaq	1002+G(%rip), %r11
	imulq	$1001, %rdx, %rdx
	leaq	3996(%rcx), %r10
	leaq	1001(%r11), %rcx
	leaq	(%rdx,%rcx), %rbx
	.p2align 4,,10
	.p2align 3
.L11:
	leaq	-4000(%r10), %rsi
	movq	%r10, %rcx
	movq	%r11, %rdi
	jmp	.L10
	.p2align 4,,10
	.p2align 3
.L24:
	movl	4(%rsi), %r8d
	movl	(%rcx), %edx
	cmpl	%r8d, %edx
	cmovg	%r8d, %edx
	movl	(%rsi), %r8d
	cmpl	%r8d, %edx
	cmovg	%r8d, %edx
	addl	$1, %edx
	cmpl	%edx, %eax
	movl	%edx, 4(%rcx)
	cmovl	%edx, %eax
.L21:
	addq	$4, %rcx
	addq	$1, %rdi
	addq	$4, %rsi
	cmpq	%r9, %rcx
	je	.L23
.L10:
	cmpb	$42, (%rdi)
	jne	.L24
	movl	$0, 4(%rcx)
	jmp	.L21
	.p2align 4,,10
	.p2align 3
.L23:
	addq	$1001, %r11
	addq	$4000, %r9
	addq	$4000, %r10
	cmpq	%rbx, %r11
	jne	.L11
.L1:
	popq	%rbx
	.cfi_remember_state
	.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
	.p2align 4,,10
	.p2align 3
.L13:
	.cfi_restore_state
	xorl	%edx, %edx
	jmp	.L3
.L12:
	.cfi_def_cfa_offset 8
	.cfi_restore 3
	.cfi_restore 6
	.cfi_restore 12
	.cfi_restore 13
	.cfi_restore 14
	.cfi_restore 15
	xorl	%eax, %eax
	ret
	.cfi_endproc
.LFE23:
	.size	square, .-square
	.section	.rodata.str1.1,"aMS",@progbits,1
.LC2:
	.string	"%d\n"
	.section	.text.startup,"ax",@progbits
	.p2align 4
	.globl	main
	.type	main, @function
main:
.LFB24:
	.cfi_startproc
	endbr64
	pushq	%r13
	.cfi_def_cfa_offset 16
	.cfi_offset 13, -16
	leaq	n(%rip), %r13
	pushq	%r12
	.cfi_def_cfa_offset 24
	.cfi_offset 12, -24
	leaq	.LC2(%rip), %r12
	pushq	%rbp
	.cfi_def_cfa_offset 32
	.cfi_offset 6, -32
	pushq	%rbx
	.cfi_def_cfa_offset 40
	.cfi_offset 3, -40
	subq	$8, %rsp
	.cfi_def_cfa_offset 48
	.p2align 4,,10
	.p2align 3
.L29:
	movq	%r13, %rsi
	movq	%r12, %rdi
	xorl	%eax, %eax
	call	__isoc99_scanf@PLT
	movl	n(%rip), %edx
	testl	%edx, %edx
	je	.L26
	jle	.L27
	leaq	G(%rip), %rbp
	xorl	%ebx, %ebx
	.p2align 4,,10
	.p2align 3
.L28:
	movq	stdin(%rip), %rcx
	addl	$2, %edx
	movq	%rbp, %rdi
	addl	$1, %ebx
	movl	$1001, %esi
	addq	$1001, %rbp
	call	__fgets_chk@PLT
	movl	n(%rip), %edx
	cmpl	%ebx, %edx
	jg	.L28
.L27:
	xorl	%eax, %eax
	call	square
	movq	%r12, %rsi
	movl	$1, %edi
	movl	%eax, %edx
	xorl	%eax, %eax
	call	__printf_chk@PLT
	jmp	.L29
	.p2align 4,,10
	.p2align 3
.L26:
	addq	$8, %rsp
	.cfi_def_cfa_offset 40
	xorl	%eax, %eax
	popq	%rbx
	.cfi_def_cfa_offset 32
	popq	%rbp
	.cfi_def_cfa_offset 24
	popq	%r12
	.cfi_def_cfa_offset 16
	popq	%r13
	.cfi_def_cfa_offset 8
	ret
	.cfi_endproc
.LFE24:
	.size	main, .-main
	.globl	n
	.bss
	.align 4
	.type	n, @object
	.size	n, 4
n:
	.zero	4
	.globl	dp
	.align 32
	.type	dp, @object
	.size	dp, 4000000
dp:
	.zero	4000000
	.globl	G
	.align 32
	.type	G, @object
	.size	G, 1001000
G:
	.zero	1001000
	.section	.rodata.cst16,"aM",@progbits,16
	.align 16
.LC0:
	.byte	46
	.byte	46
	.byte	46
	.byte	46
	.byte	46
	.byte	46
	.byte	46
	.byte	46
	.byte	46
	.byte	46
	.byte	46
	.byte	46
	.byte	46
	.byte	46
	.byte	46
	.byte	46
	.align 16
.LC1:
	.byte	1
	.byte	1
	.byte	1
	.byte	1
	.byte	1
	.byte	1
	.byte	1
	.byte	1
	.byte	1
	.byte	1
	.byte	1
	.byte	1
	.byte	1
	.byte	1
	.byte	1
	.byte	1
	.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
	.p2align 4
	.globl	square
	.type	square, @function
square:
.LFB23:
	.cfi_startproc
	endbr64
	movl	n(%rip), %ecx
	testl	%ecx, %ecx
	jle	.L12
	pushq	%r15
	.cfi_def_cfa_offset 16
	.cfi_offset 15, -16
	leal	-1(%rcx), %eax
	leaq	G(%rip), %r15
	xorl	%r11d, %r11d
	pushq	%r14
	.cfi_def_cfa_offset 24
	.cfi_offset 14, -24
	pxor	%xmm4, %xmm4
	pxor	%xmm2, %xmm2
	leaq	dp(%rip), %r9
	pushq	%r13
	.cfi_def_cfa_offset 32
	.cfi_offset 13, -32
	movdqa	.LC0(%rip), %xmm6
	movl	%ecx, %r13d
	pushq	%r12
	.cfi_def_cfa_offset 40
	.cfi_offset 12, -40
	movdqa	.LC1(%rip), %xmm5
	andl	$-16, %r13d
	pushq	%rbp
	.cfi_def_cfa_offset 48
	.cfi_offset 6, -48
	movq	%r9, %rbp
	pushq	%rbx
	.cfi_def_cfa_offset 56
	.cfi_offset 3, -56
	movq	%r15, %rbx
	movl	%eax, -12(%rsp)
	movl	%ecx, %eax
	shrl	$4, %eax
	leal	-1(%rax), %r14d
	xorl	%eax, %eax
	addq	$1, %r14
	salq	$4, %r14
	.p2align 4,,10
	.p2align 3
.L6:
	cmpl	$14, -12(%rsp)
	jbe	.L13
	leaq	(%r14,%rbx), %rdi
	movq	%rbp, %rdx
	pxor	%xmm3, %xmm3
	movq	%rbx, %rsi
	.p2align 4,,10
	.p2align 3
.L4:
	movdqu	(%rsi), %xmm0
	addq	$16, %rsi
	addq	$64, %rdx
	pcmpeqb	%xmm6, %xmm0
	pand	%xmm5, %xmm0
	movdqa	%xmm0, %xmm1
	punpckhbw	%xmm4, %xmm0
	punpcklbw	%xmm4, %xmm1
	movdqa	%xmm0, %xmm7
	punpckhwd	%xmm2, %xmm0
	movdqa	%xmm1, %xmm8
	punpcklwd	%xmm2, %xmm7
	punpckhwd	%xmm2, %xmm1
	movaps	%xmm0, -16(%rdx)
	punpcklwd	%xmm2, %xmm8
	movaps	%xmm1, -48(%rdx)
	por	%xmm7, %xmm0
	por	%xmm8, %xmm1
	movaps	%xmm8, -64(%rdx)
	por	%xmm0, %xmm1
	movaps	%xmm7, -32(%rdx)
	por	%xmm1, %xmm3
	cmpq	%rdi, %rsi
	jne	.L4
	movdqa	%xmm3, %xmm0
	psrldq	$8, %xmm0
	por	%xmm0, %xmm3
	movdqa	%xmm3, %xmm0
	psrldq	$4, %xmm0
	por	%xmm0, %xmm3
	movd	%xmm3, %edx
	orl	%edx, %eax
	cmpl	%r13d, %ecx
	je	.L5
	movl	%r13d, %edx
.L3:
	movslq	%r11d, %r10
	movslq	%edx, %r8
	xorl	%r12d, %r12d
	imulq	$1001, %r10, %rsi
	addq	%r15, %rsi
	cmpb	$46, (%rsi,%r8)
	sete	%r12b
	imulq	$1000, %r10, %rdi
	orl	%r12d, %eax
	addq	%rdi, %r8
	movl	%r12d, (%r9,%r8,4)
	leal	1(%rdx), %r8d
	cmpl	%ecx, %r8d
	jge	.L5
	movslq	%r8d, %r8
	xorl	%r12d, %r12d
	cmpb	$46, (%rsi,%r8)
	sete	%r12b
	addq	%rdi, %r8
	movl	%r12d, (%r9,%r8,4)
	leal	2(%rdx), %r8d
	orl	%r12d, %eax
	cmpl	%ecx, %r8d
	jge	.L5
	movslq	%r8d, %r8
	xorl	%r12d, %r12d
	cmpb	$46, (%rsi,%r8)
	sete	%r12b
	addq	%rdi, %r8
	movl	%r12d, (%r9,%r8,4)
	leal	3(%rdx), %r8d
	orl	%r12d, %eax
	cmpl	%r8d, %ecx
	jle	.L5
	movslq	%r8d, %r8
	xorl	%r12d, %r12d
	cmpb	$46, (%rsi,%r8)
	sete	%r12b
	addq	%rdi, %r8
	movl	%r12d, (%r9,%r8,4)
	leal	4(%rdx), %r8d
	orl	%r12d, %eax
	cmpl	%r8d, %ecx
	jle	.L5
	movslq	%r8d, %r8
	xorl	%r12d, %r12d
	cmpb	$46, (%rsi,%r8)
	sete	%r12b
	addq	%rdi, %r8
	movl	%r12d, (%r9,%r8,4)
	leal	5(%rdx), %r8d
	orl	%r12d, %eax
	cmpl	%r8d, %ecx
	jle	.L5
	movslq	%r8d, %r8
	xorl	%r12d, %r12d
	cmpb	$46, (%rsi,%r8)
	sete	%r12b
	addq	%rdi, %r8
	movl	%r12d, (%r9,%r8,4)
	leal	6(%rdx), %r8d
	orl	%r12d, %eax
	cmpl	%r8d, %ecx
	jle	.L5
	movslq	%r8d, %r8
	xorl	%r12d, %r12d
	cmpb	$46, (%rsi,%r8)
	sete	%r12b
	addq	%rdi, %r8
	movl	%r12d, (%r9,%r8,4)
	leal	7(%rdx), %r8d
	orl	%r12d, %eax
	cmpl	%r8d, %ecx
	jle	.L5
	movslq	%r8d, %r8
	xorl	%r12d, %r12d
	cmpb	$46, (%rsi,%r8)
	sete	%r12b
	addq	%rdi, %r8
	movl	%r12d, (%r9,%r8,4)
	leal	8(%rdx), %r8d
	orl	%r12d, %eax
	cmpl	%r8d, %ecx
	jle	.L5
	movslq	%r8d, %r8
	xorl	%r12d, %r12d
	cmpb	$46, (%rsi,%r8)
	sete	%r12b
	addq	%rdi, %r8
	movl	%r12d, (%r9,%r8,4)
	leal	9(%rdx), %r8d
	orl	%r12d, %eax
	cmpl	%r8d, %ecx
	jle	.L5
	movslq	%r8d, %r8
	cmpb	$46, (%rsi,%r8)
	sete	%sil
	addq	%r8, %rdi
	movzbl	%sil, %esi
	movl	%esi, (%r9,%rdi,4)
	orl	%esi, %eax
	leal	10(%rdx), %esi
	cmpl	%esi, %ecx
	jle	.L5
	imulq	$1001, %r10, %rdi
	movslq	%esi, %rsi
	xorl	%r8d, %r8d
	addq	%r15, %rdi
	cmpb	$46, (%rdi,%rsi)
	sete	%r8b
	imulq	$1000, %r10, %r10
	orl	%r8d, %eax
	addq	%r10, %rsi
	movl	%r8d, (%r9,%rsi,4)
	leal	11(%rdx), %esi
	cmpl	%esi, %ecx
	jle	.L5
	movslq	%esi, %rsi
	xorl	%r8d, %r8d
	cmpb	$46, (%rdi,%rsi)
	sete	%r8b
	addq	%r10, %rsi
	movl	%r8d, (%r9,%rsi,4)
	leal	12(%rdx), %esi
	orl	%r8d, %eax
	cmpl	%esi, %ecx
	jle	.L5
	movslq	%esi, %rsi
	xorl	%r8d, %r8d
	cmpb	$46, (%rdi,%rsi)
	sete	%r8b
	addq	%r10, %rsi
	movl	%r8d, (%r9,%rsi,4)
	leal	13(%rdx), %esi
	orl	%r8d, %eax
	cmpl	%esi, %ecx
	jle	.L5
	movslq	%esi, %rsi
	xorl	%r8d, %r8d
	cmpb	$46, (%rdi,%rsi)
	sete	%r8b
	addq	%r10, %rsi
	addl	$14, %edx
	movl	%r8d, (%r9,%rsi,4)
	orl	%r8d, %eax
	cmpl	%edx, %ecx
	jle	.L5
	movslq	%edx, %rdx
	xorl	%esi, %esi
	cmpb	$46, (%rdi,%rdx)
	sete	%sil
	addq	%rdx, %r10
	movl	%esi, (%r9,%r10,4)
	orl	%esi, %eax
	.p2align 4,,10
	.p2align 3
.L5:
	addl	$1, %r11d
	addq	$1001, %rbx
	addq	$4000, %rbp
	cmpl	%ecx, %r11d
	jne	.L6
	cmpl	$1, %r11d
	jle	.L1
	leal	-2(%r11), %edx
	leaq	4+dp(%rip), %rcx
	leaq	4000(%rcx,%rdx,4), %r9
	leaq	1002+G(%rip), %r11
	imulq	$1001, %rdx, %rdx
	leaq	3996(%rcx), %r10
	leaq	1001(%r11), %rcx
	leaq	(%rdx,%rcx), %rbx
	.p2align 4,,10
	.p2align 3
.L11:
	leaq	-4000(%r10), %rsi
	movq	%r10, %rcx
	movq	%r11, %rdi
	jmp	.L10
	.p2align 4,,10
	.p2align 3
.L24:
	movl	4(%rsi), %r8d
	movl	(%rcx), %edx
	cmpl	%r8d, %edx
	cmovg	%r8d, %edx
	movl	(%rsi), %r8d
	cmpl	%r8d, %edx
	cmovg	%r8d, %edx
	addl	$1, %edx
	cmpl	%edx, %eax
	movl	%edx, 4(%rcx)
	cmovl	%edx, %eax
.L21:
	addq	$4, %rcx
	addq	$1, %rdi
	addq	$4, %rsi
	cmpq	%r9, %rcx
	je	.L23
.L10:
	cmpb	$42, (%rdi)
	jne	.L24
	movl	$0, 4(%rcx)
	jmp	.L21
	.p2align 4,,10
	.p2align 3
.L23:
	addq	$1001, %r11
	addq	$4000, %r9
	addq	$4000, %r10
	cmpq	%rbx, %r11
	jne	.L11
.L1:
	popq	%rbx
	.cfi_remember_state
	.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
	.p2align 4,,10
	.p2align 3
.L13:
	.cfi_restore_state
	xorl	%edx, %edx
	jmp	.L3
.L12:
	.cfi_def_cfa_offset 8
	.cfi_restore 3
	.cfi_restore 6
	.cfi_restore 12
	.cfi_restore 13
	.cfi_restore 14
	.cfi_restore 15
	xorl	%eax, %eax
	ret
	.cfi_endproc
.LFE23:
	.size	square, .-square
	.section	.rodata.str1.1,"aMS",@progbits,1
.LC2:
	.string	"%d\n"
	.section	.text.startup,"ax",@progbits
	.p2align 4
	.globl	main
	.type	main, @function
main:
.LFB24:
	.cfi_startproc
	endbr64
	pushq	%r13
	.cfi_def_cfa_offset 16
	.cfi_offset 13, -16
	leaq	n(%rip), %r13
	pushq	%r12
	.cfi_def_cfa_offset 24
	.cfi_offset 12, -24
	leaq	.LC2(%rip), %r12
	pushq	%rbp
	.cfi_def_cfa_offset 32
	.cfi_offset 6, -32
	pushq	%rbx
	.cfi_def_cfa_offset 40
	.cfi_offset 3, -40
	subq	$8, %rsp
	.cfi_def_cfa_offset 48
	.p2align 4,,10
	.p2align 3
.L29:
	movq	%r13, %rsi
	movq	%r12, %rdi
	xorl	%eax, %eax
	call	__isoc99_scanf@PLT
	movl	n(%rip), %edx
	testl	%edx, %edx
	je	.L26
	jle	.L27
	leaq	G(%rip), %rbp
	xorl	%ebx, %ebx
	.p2align 4,,10
	.p2align 3
.L28:
	movq	stdin(%rip), %rcx
	addl	$2, %edx
	movq	%rbp, %rdi
	addl	$1, %ebx
	movl	$1001, %esi
	addq	$1001, %rbp
	call	__fgets_chk@PLT
	movl	n(%rip), %edx
	cmpl	%ebx, %edx
	jg	.L28
.L27:
	xorl	%eax, %eax
	call	square
	movq	%r12, %rsi
	movl	$1, %edi
	movl	%eax, %edx
	xorl	%eax, %eax
	call	__printf_chk@PLT
	jmp	.L29
	.p2align 4,,10
	.p2align 3
.L26:
	addq	$8, %rsp
	.cfi_def_cfa_offset 40
	xorl	%eax, %eax
	popq	%rbx
	.cfi_def_cfa_offset 32
	popq	%rbp
	.cfi_def_cfa_offset 24
	popq	%r12
	.cfi_def_cfa_offset 16
	popq	%r13
	.cfi_def_cfa_offset 8
	ret
	.cfi_endproc
.LFE24:
	.size	main, .-main
	.globl	n
	.bss
	.align 4
	.type	n, @object
	.size	n, 4
n:
	.zero	4
	.globl	dp
	.align 32
	.type	dp, @object
	.size	dp, 4000000
dp:
	.zero	4000000
	.globl	G
	.align 32
	.type	G, @object
	.size	G, 1001000
G:
	.zero	1001000
	.section	.rodata.cst16,"aM",@progbits,16
	.align 16
.LC0:
	.byte	46
	.byte	46
	.byte	46
	.byte	46
	.byte	46
	.byte	46
	.byte	46
	.byte	46
	.byte	46
	.byte	46
	.byte	46
	.byte	46
	.byte	46
	.byte	46
	.byte	46
	.byte	46
	.align 16
.LC1:
	.byte	1
	.byte	1
	.byte	1
	.byte	1
	.byte	1
	.byte	1
	.byte	1
	.byte	1
	.byte	1
	.byte	1
	.byte	1
	.byte	1
	.byte	1
	.byte	1
	.byte	1
	.byte	1
	.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>          // printf(), scanf()
#include <stdbool.h>

#define MAX_N 1000
#define max(a, b) ((a) > (b) ? (a) : (b))
#define min(a, b) ((a) < (b) ? (a) : (b))

char G[MAX_N][MAX_N + 1];
int dp[MAX_N][MAX_N];
int n;

int
square()
{
	int i, j;

	int max_n = 0;
	for (i = 0; i < n; ++i)
	{
		for (j = 0; j < n; ++j)
		{
			dp[i][j] = (G[i][j] == '.') ? 1 : 0;
			max_n |= dp[i][j];
		}
	}

	for (i = 1; i < n; ++i)
	{
		for (j = 1; j < n; ++j)
		{
			if (G[i][j] == '*')
				dp[i][j] = 0;
			else
			{
				dp[i][j] = min(dp[i - 1][j - 1], min(dp[i - 1][j], dp[i][j - 1])) + 1;
				max_n = max(max_n, dp[i][j]);
			}
		}
	}

	return max_n;
}

int
main(int argc, char **argv)
{
	int i;

	while (true)
	{
		scanf("%d\n", &n);
		if (n == 0)
			break;

		for (i = 0; i < n; ++i)
			fgets(&G[i][0], n + 2, stdin);

		printf("%d\n", square());
	}

	return 0;
}
10
...*....**
..........
**....**..
........*.
..*.......
..........
.*........
..........
....*..***
.*....*...
10
*****.****
*..*.*....
****.*....
*....*....
*....*****
..........
****.*****
*..*...*..
****...*..
*..*...*..
0
 10
...*....**
..........
**....**..
*.........
.......*..
..........
../.....*.
..........
....*..***
...*....*/
10
*****.****
*..*.*....
****.*....
.....*..*.
*....*****
..........
*****.*+**
*..*./.*..
****...*..
*..*../*..
0
 10
...*....**
..........
**....**..
*.........
.......*..
..........
../.....*.
..........
....*..***
...*....*/
10
*****.****
....*.*..*
****.*/...
.....*..*.
*../.*****
..........
*****.*+**
*..*./.*..
****...*..
*..*../*..
0
 10
...*....**
..........
**....**..
*.........
.......*..
..........
.*...../..
..........
....*..***
.*....*...
10
*****.****
*..*.*....
....*.****
*....*.-..
*****....*
..........
**+*.*****
*..*...*..
****...*..
*..*../*..
0
 10
...*....**
.....-....
**....**..
*.........
.......*..
.....-....
../.....*.
..........
....*..***
...*....*/
10
*+***.****
-...*.*..*
****.*....
.....*..*.
*....*****
..........
*****.*+**
*./*.0.*..
****...*..
*..*../*..
0
 10
...*....**
.....-....
**....**..
*.........
.......*..
.......-..
../.....*.
..........
....*..***
/*....*...
0
*****.****
....*-*..+
****.*....
.....*..*.
*....*****
..........
*****.*+**
*..*./.*..
****...*..
*.-*../*..
0
 10
../+...-**
........-.
**...,**..
)....-....
..*......-
......../.
../....-*.
..../.....
....*..***
...*....*/
10
*****.***)
*./*.*-...
)***.*....
...//*-.*.
*....**)**
.........-
)****-*+**
*..*...*..
****...*-.
*..*..0*..
0
 10
...*....**
.....-....
**....**..
*.........
-......*..
.......-..
.*...../..
..........
....*..***
/*....*...
0
*****.****
....*-*..+
****.*....
.....*..*.
*....*****
..........
*****.*+**
*..*./.*..
****...*..
*.-*../*..
1
 10
/..*....**
...-......
**....)*..
*.........
-......*..
..--......
../.....*.
...../.../
....*..***
/)....*...
0
**+**.****
../.*-*..+
****.*....
.....*..*.
*....*****
..........
***+*.*+**
*..*./.*..
..*...***)
*.-*.//*..
0
 10
...*....**
..........
**....**..
........*.
.......*..
..........
.*........
..........
....*..***
.*....*...
10
*****.****
*..*.*....
****.*....
*....*....
*....*****
..........
****.*****
*..*...*..
****...*..
*..*...*..
0

5
3
 5
3
 5
3
 5
3
 5
3
 5
 5
3
 5
 5
 5
3

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>          // printf(), scanf()
#include <stdbool.h>

#define MAX_N 1000
#define max(a, b) ((a) > (b) ? (a) : (b))
#define min(a, b) ((a) < (b) ? (a) : (b))

char G[MAX_N][MAX_N + 1];
int dp[MAX_N][MAX_N];
int n;

int
square()
{
	int i, j;

	int max_n = 0;
	for (i = 0; i < n; ++i)
	{
		for (j = 0; j < n; ++j)
		{
			dp[i][j] = (G[i][j] == '.') ? 1 : 0;
			max_n |= dp[i][j];
		}
	}

	for (i = 1; i < n; ++i)
	{
		for (j = 1; j < n; ++j)
		{
			if (G[i][j] == '*')
				dp[i][j] = 0;
			else
			{
				dp[i][j] = min(dp[i - 1][j - 1], min(dp[i - 1][j], dp[i][j - 1])) + 1;
				max_n = max(max_n, dp[i][j]);
			}
		}
	}

	return max_n;
}

int
main(int argc, char **argv)
{
	int i;

	while (true)
	{
		scanf("%d\n", &n);
		if (n == 0)
			break;

		for (i = 0; i < n; ++i)
			fgets(&G[i][0], n + 2, stdin);

		printf("%d\n", square());
	}

	return 0;
}```

Unoptimized Assembly Code:

```assembly
	.file	"temp.c"
	.text
	.globl	G
	.bss
	.align 32
	.type	G, @object
	.size	G, 1001000
G:
	.zero	1001000
	.globl	dp
	.align 32
	.type	dp, @object
	.size	dp, 4000000
dp:
	.zero	4000000
	.globl	n
	.align 4
	.type	n, @object
	.size	n, 4
n:
	.zero	4
	.text
	.globl	square
	.type	square, @function
square:
.LFB0:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	movl	$0, -4(%rbp)
	movl	$0, -12(%rbp)
	jmp	.L2
.L5:
	movl	$0, -8(%rbp)
	jmp	.L3
.L4:
	movl	-8(%rbp), %eax
	movslq	%eax, %rdx
	movl	-12(%rbp), %eax
	cltq
	imulq	$1001, %rax, %rax
	addq	%rax, %rdx
	leaq	G(%rip), %rax
	addq	%rdx, %rax
	movzbl	(%rax), %eax
	cmpb	$46, %al
	sete	%al
	movzbl	%al, %eax
	movl	-8(%rbp), %edx
	movslq	%edx, %rcx
	movl	-12(%rbp), %edx
	movslq	%edx, %rdx
	imulq	$1000, %rdx, %rdx
	addq	%rcx, %rdx
	leaq	0(,%rdx,4), %rcx
	leaq	dp(%rip), %rdx
	movl	%eax, (%rcx,%rdx)
	movl	-8(%rbp), %eax
	movslq	%eax, %rdx
	movl	-12(%rbp), %eax
	cltq
	imulq	$1000, %rax, %rax
	addq	%rdx, %rax
	leaq	0(,%rax,4), %rdx
	leaq	dp(%rip), %rax
	movl	(%rdx,%rax), %eax
	orl	%eax, -4(%rbp)
	addl	$1, -8(%rbp)
.L3:
	movl	n(%rip), %eax
	cmpl	%eax, -8(%rbp)
	jl	.L4
	addl	$1, -12(%rbp)
.L2:
	movl	n(%rip), %eax
	cmpl	%eax, -12(%rbp)
	jl	.L5
	movl	$1, -12(%rbp)
	jmp	.L6
.L11:
	movl	$1, -8(%rbp)
	jmp	.L7
.L10:
	movl	-8(%rbp), %eax
	movslq	%eax, %rdx
	movl	-12(%rbp), %eax
	cltq
	imulq	$1001, %rax, %rax
	addq	%rax, %rdx
	leaq	G(%rip), %rax
	addq	%rdx, %rax
	movzbl	(%rax), %eax
	cmpb	$42, %al
	jne	.L8
	movl	-8(%rbp), %eax
	movslq	%eax, %rdx
	movl	-12(%rbp), %eax
	cltq
	imulq	$1000, %rax, %rax
	addq	%rdx, %rax
	leaq	0(,%rax,4), %rdx
	leaq	dp(%rip), %rax
	movl	$0, (%rdx,%rax)
	jmp	.L9
.L8:
	movl	-8(%rbp), %eax
	subl	$1, %eax
	movslq	%eax, %rdx
	movl	-12(%rbp), %eax
	cltq
	imulq	$1000, %rax, %rax
	addq	%rdx, %rax
	leaq	0(,%rax,4), %rdx
	leaq	dp(%rip), %rax
	movl	(%rdx,%rax), %edx
	movl	-12(%rbp), %eax
	leal	-1(%rax), %ecx
	movl	-8(%rbp), %eax
	movslq	%eax, %rsi
	movslq	%ecx, %rax
	imulq	$1000, %rax, %rax
	addq	%rsi, %rax
	leaq	0(,%rax,4), %rcx
	leaq	dp(%rip), %rax
	movl	(%rcx,%rax), %eax
	cmpl	%eax, %edx
	cmovg	%eax, %edx
	movl	-12(%rbp), %eax
	leal	-1(%rax), %ecx
	movl	-8(%rbp), %eax
	subl	$1, %eax
	movslq	%eax, %rsi
	movslq	%ecx, %rax
	imulq	$1000, %rax, %rax
	addq	%rsi, %rax
	leaq	0(,%rax,4), %rcx
	leaq	dp(%rip), %rax
	movl	(%rcx,%rax), %eax
	cmpl	%eax, %edx
	cmovle	%edx, %eax
	leal	1(%rax), %ecx
	movl	-8(%rbp), %eax
	movslq	%eax, %rdx
	movl	-12(%rbp), %eax
	cltq
	imulq	$1000, %rax, %rax
	addq	%rdx, %rax
	leaq	0(,%rax,4), %rdx
	leaq	dp(%rip), %rax
	movl	%ecx, (%rdx,%rax)
	movl	-8(%rbp), %eax
	movslq	%eax, %rdx
	movl	-12(%rbp), %eax
	cltq
	imulq	$1000, %rax, %rax
	addq	%rdx, %rax
	leaq	0(,%rax,4), %rdx
	leaq	dp(%rip), %rax
	movl	(%rdx,%rax), %eax
	movl	-4(%rbp), %edx
	cmpl	%eax, %edx
	cmovge	%edx, %eax
	movl	%eax, -4(%rbp)
.L9:
	addl	$1, -8(%rbp)
.L7:
	movl	n(%rip), %eax
	cmpl	%eax, -8(%rbp)
	jl	.L10
	addl	$1, -12(%rbp)
.L6:
	movl	n(%rip), %eax
	cmpl	%eax, -12(%rbp)
	jl	.L11
	movl	-4(%rbp), %eax
	popq	%rbp
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE0:
	.size	square, .-square
	.section	.rodata
.LC0:
	.string	"%d\n"
	.text
	.globl	main
	.type	main, @function
main:
.LFB1:
	.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
	movl	%edi, -20(%rbp)
	movq	%rsi, -32(%rbp)
.L18:
	leaq	n(%rip), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	n(%rip), %eax
	testl	%eax, %eax
	je	.L21
	movl	$0, -4(%rbp)
	jmp	.L16
.L17:
	movq	stdin(%rip), %rax
	movl	n(%rip), %edx
	leal	2(%rdx), %esi
	movl	-4(%rbp), %edx
	movslq	%edx, %rdx
	imulq	$1001, %rdx, %rdx
	leaq	G(%rip), %rcx
	addq	%rdx, %rcx
	movq	%rax, %rdx
	movq	%rcx, %rdi
	call	fgets@PLT
	addl	$1, -4(%rbp)
.L16:
	movl	n(%rip), %eax
	cmpl	%eax, -4(%rbp)
	jl	.L17
	movl	$0, %eax
	call	square
	movl	%eax, %esi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	jmp	.L18
.L21:
	nop
	movl	$0, %eax
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE1:
	.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	G
	.bss
	.align 32
	.type	G, @object
	.size	G, 1001000
G:
	.zero	1001000
	.globl	dp
	.align 32
	.type	dp, @object
	.size	dp, 4000000
dp:
	.zero	4000000
	.globl	n
	.align 4
	.type	n, @object
	.size	n, 4
n:
	.zero	4
	.text
	.globl	square
	.type	square, @function
square:
.LFB0:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	movl	$0, -4(%rbp)
	movl	$0, -12(%rbp)
	jmp	.L2
.L5:
	movl	$0, -8(%rbp)
	jmp	.L3
.L4:
	movl	-8(%rbp), %eax
	movslq	%eax, %rdx
	movl	-12(%rbp), %eax
	cltq
	imulq	$1001, %rax, %rax
	addq	%rax, %rdx
	leaq	G(%rip), %rax
	addq	%rdx, %rax
	movzbl	(%rax), %eax
	cmpb	$46, %al
	sete	%al
	movzbl	%al, %eax
	movl	-8(%rbp), %edx
	movslq	%edx, %rcx
	movl	-12(%rbp), %edx
	movslq	%edx, %rdx
	imulq	$1000, %rdx, %rdx
	addq	%rcx, %rdx
	leaq	0(,%rdx,4), %rcx
	leaq	dp(%rip), %rdx
	movl	%eax, (%rcx,%rdx)
	movl	-8(%rbp), %eax
	movslq	%eax, %rdx
	movl	-12(%rbp), %eax
	cltq
	imulq	$1000, %rax, %rax
	addq	%rdx, %rax
	leaq	0(,%rax,4), %rdx
	leaq	dp(%rip), %rax
	movl	(%rdx,%rax), %eax
	orl	%eax, -4(%rbp)
	addl	$1, -8(%rbp)
.L3:
	movl	n(%rip), %eax
	cmpl	%eax, -8(%rbp)
	jl	.L4
	addl	$1, -12(%rbp)
.L2:
	movl	n(%rip), %eax
	cmpl	%eax, -12(%rbp)
	jl	.L5
	movl	$1, -12(%rbp)
	jmp	.L6
.L11:
	movl	$1, -8(%rbp)
	jmp	.L7
.L10:
	movl	-8(%rbp), %eax
	movslq	%eax, %rdx
	movl	-12(%rbp), %eax
	cltq
	imulq	$1001, %rax, %rax
	addq	%rax, %rdx
	leaq	G(%rip), %rax
	addq	%rdx, %rax
	movzbl	(%rax), %eax
	cmpb	$42, %al
	jne	.L8
	movl	-8(%rbp), %eax
	movslq	%eax, %rdx
	movl	-12(%rbp), %eax
	cltq
	imulq	$1000, %rax, %rax
	addq	%rdx, %rax
	leaq	0(,%rax,4), %rdx
	leaq	dp(%rip), %rax
	movl	$0, (%rdx,%rax)
	jmp	.L9
.L8:
	movl	-8(%rbp), %eax
	subl	$1, %eax
	movslq	%eax, %rdx
	movl	-12(%rbp), %eax
	cltq
	imulq	$1000, %rax, %rax
	addq	%rdx, %rax
	leaq	0(,%rax,4), %rdx
	leaq	dp(%rip), %rax
	movl	(%rdx,%rax), %edx
	movl	-12(%rbp), %eax
	leal	-1(%rax), %ecx
	movl	-8(%rbp), %eax
	movslq	%eax, %rsi
	movslq	%ecx, %rax
	imulq	$1000, %rax, %rax
	addq	%rsi, %rax
	leaq	0(,%rax,4), %rcx
	leaq	dp(%rip), %rax
	movl	(%rcx,%rax), %eax
	cmpl	%eax, %edx
	cmovg	%eax, %edx
	movl	-12(%rbp), %eax
	leal	-1(%rax), %ecx
	movl	-8(%rbp), %eax
	subl	$1, %eax
	movslq	%eax, %rsi
	movslq	%ecx, %rax
	imulq	$1000, %rax, %rax
	addq	%rsi, %rax
	leaq	0(,%rax,4), %rcx
	leaq	dp(%rip), %rax
	movl	(%rcx,%rax), %eax
	cmpl	%eax, %edx
	cmovle	%edx, %eax
	leal	1(%rax), %ecx
	movl	-8(%rbp), %eax
	movslq	%eax, %rdx
	movl	-12(%rbp), %eax
	cltq
	imulq	$1000, %rax, %rax
	addq	%rdx, %rax
	leaq	0(,%rax,4), %rdx
	leaq	dp(%rip), %rax
	movl	%ecx, (%rdx,%rax)
	movl	-8(%rbp), %eax
	movslq	%eax, %rdx
	movl	-12(%rbp), %eax
	cltq
	imulq	$1000, %rax, %rax
	addq	%rdx, %rax
	leaq	0(,%rax,4), %rdx
	leaq	dp(%rip), %rax
	movl	(%rdx,%rax), %eax
	movl	-4(%rbp), %edx
	cmpl	%eax, %edx
	cmovge	%edx, %eax
	movl	%eax, -4(%rbp)
.L9:
	addl	$1, -8(%rbp)
.L7:
	movl	n(%rip), %eax
	cmpl	%eax, -8(%rbp)
	jl	.L10
	addl	$1, -12(%rbp)
.L6:
	movl	n(%rip), %eax
	cmpl	%eax, -12(%rbp)
	jl	.L11
	movl	-4(%rbp), %eax
	popq	%rbp
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE0:
	.size	square, .-square
	.section	.rodata
.LC0:
	.string	"%d\n"
	.text
	.globl	main
	.type	main, @function
main:
.LFB1:
	.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
	movl	%edi, -20(%rbp)
	movq	%rsi, -32(%rbp)
.L18:
	leaq	n(%rip), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	n(%rip), %eax
	testl	%eax, %eax
	je	.L21
	movl	$0, -4(%rbp)
	jmp	.L16
.L17:
	movq	stdin(%rip), %rax
	movl	n(%rip), %edx
	leal	2(%rdx), %esi
	movl	-4(%rbp), %edx
	movslq	%edx, %rdx
	imulq	$1001, %rdx, %rdx
	leaq	G(%rip), %rcx
	addq	%rdx, %rcx
	movq	%rax, %rdx
	movq	%rcx, %rdi
	call	fgets@PLT
	addl	$1, -4(%rbp)
.L16:
	movl	n(%rip), %eax
	cmpl	%eax, -4(%rbp)
	jl	.L17
	movl	$0, %eax
	call	square
	movl	%eax, %esi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	jmp	.L18
.L21:
	nop
	movl	$0, %eax
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE1:
	.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:
