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>
#include<stdlib.h>

int main() {

	char **c;     //?????????
	int W ,H;     //?????????????¨??????¨??????
	int i,j;      //???????????¨?????°
	int a=0;      //??????????´???¨??????????????°
	int count;    //??????
	int flag;     //??¢?´¢????¶?????????????????????????????????°
	int A[10000]; //??????????´???¨??????

	for(;;) {

	scanf("%d %d",&W,&H); //?¨??????¨???????????\???

	if(W==0&&H==0) break;

	c = malloc(sizeof(char *) * H);

	for(i=0;i<H;i++) {
		c[i] = malloc(sizeof(char)*W);
	}

	for(i=0;i<H;i++)
		scanf("%s",c[i]); //??????????????\???

	count=1;
	flag=1;

	while(flag) { //??¢?´¢????§?
		flag = 0;
		for(i=0;i<H;i++) {
			for(j=0;j<W;j++) {
				if(c[i][j]=='@') {
					if(i!=0&&c[i-1][j]=='.') { //???????§????
						count++;
						c[i-1][j]='@';
						flag=1;
					}
					if(j!=W-1&&c[i][j+1]=='.') { //???????§????
						count++;
						c[i][j+1]='@';
						flag=1;
					}
					if(i!=H-1&&c[i+1][j]=='.') { //???????§????
						count++;
						c[i+1][j]='@';
						flag=1;
					}
					if(j!=0&&c[i][j-1]=='.') { //???????§????
						count++;
						c[i][j-1]='@';
						flag=1;
					}
				}
			}
		}
	} //??¢?´¢????¶???????flag??????????¶???????

	A[a]=count;
	a++;

	free(c);
	}

	for(i=0;i<a;i++)
		printf("%d\n",A[i]);

	return 0;
}```

Unoptimized Assembly Code:

```assembly
	.file	"temp.c"
	.text
	.section	.rodata
.LC0:
	.string	"%d %d"
.LC1:
	.string	"%s"
.LC2:
	.string	"%d\n"
	.text
	.globl	main
	.type	main, @function
main:
.LFB6:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	pushq	%rbx
	leaq	-36864(%rsp), %r11
.LPSRL0:
	subq	$4096, %rsp
	orq	$0, (%rsp)
	cmpq	%r11, %rsp
	jne	.LPSRL0
	subq	$3208, %rsp
	.cfi_offset 3, -24
	movq	%fs:40, %rax
	movq	%rax, -24(%rbp)
	xorl	%eax, %eax
	movl	$0, -40052(%rbp)
.L18:
	leaq	-40064(%rbp), %rdx
	leaq	-40068(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	-40068(%rbp), %eax
	testl	%eax, %eax
	jne	.L2
	movl	-40064(%rbp), %eax
	testl	%eax, %eax
	je	.L24
.L2:
	movl	-40064(%rbp), %eax
	cltq
	salq	$3, %rax
	movq	%rax, %rdi
	call	malloc@PLT
	movq	%rax, -40040(%rbp)
	movl	$0, -40060(%rbp)
	jmp	.L4
.L5:
	movl	-40068(%rbp), %eax
	cltq
	movl	-40060(%rbp), %edx
	movslq	%edx, %rdx
	leaq	0(,%rdx,8), %rcx
	movq	-40040(%rbp), %rdx
	leaq	(%rcx,%rdx), %rbx
	movq	%rax, %rdi
	call	malloc@PLT
	movq	%rax, (%rbx)
	addl	$1, -40060(%rbp)
.L4:
	movl	-40064(%rbp), %eax
	cmpl	%eax, -40060(%rbp)
	jl	.L5
	movl	$0, -40060(%rbp)
	jmp	.L6
.L7:
	movl	-40060(%rbp), %eax
	cltq
	leaq	0(,%rax,8), %rdx
	movq	-40040(%rbp), %rax
	addq	%rdx, %rax
	movq	(%rax), %rax
	movq	%rax, %rsi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	addl	$1, -40060(%rbp)
.L6:
	movl	-40064(%rbp), %eax
	cmpl	%eax, -40060(%rbp)
	jl	.L7
	movl	$1, -40048(%rbp)
	movl	$1, -40044(%rbp)
	jmp	.L8
.L17:
	movl	$0, -40044(%rbp)
	movl	$0, -40060(%rbp)
	jmp	.L9
.L16:
	movl	$0, -40056(%rbp)
	jmp	.L10
.L15:
	movl	-40060(%rbp), %eax
	cltq
	leaq	0(,%rax,8), %rdx
	movq	-40040(%rbp), %rax
	addq	%rdx, %rax
	movq	(%rax), %rdx
	movl	-40056(%rbp), %eax
	cltq
	addq	%rdx, %rax
	movzbl	(%rax), %eax
	cmpb	$64, %al
	jne	.L11
	cmpl	$0, -40060(%rbp)
	je	.L12
	movl	-40060(%rbp), %eax
	cltq
	salq	$3, %rax
	leaq	-8(%rax), %rdx
	movq	-40040(%rbp), %rax
	addq	%rdx, %rax
	movq	(%rax), %rdx
	movl	-40056(%rbp), %eax
	cltq
	addq	%rdx, %rax
	movzbl	(%rax), %eax
	cmpb	$46, %al
	jne	.L12
	addl	$1, -40048(%rbp)
	movl	-40060(%rbp), %eax
	cltq
	salq	$3, %rax
	leaq	-8(%rax), %rdx
	movq	-40040(%rbp), %rax
	addq	%rdx, %rax
	movq	(%rax), %rdx
	movl	-40056(%rbp), %eax
	cltq
	addq	%rdx, %rax
	movb	$64, (%rax)
	movl	$1, -40044(%rbp)
.L12:
	movl	-40068(%rbp), %eax
	subl	$1, %eax
	cmpl	%eax, -40056(%rbp)
	je	.L13
	movl	-40060(%rbp), %eax
	cltq
	leaq	0(,%rax,8), %rdx
	movq	-40040(%rbp), %rax
	addq	%rdx, %rax
	movq	(%rax), %rdx
	movl	-40056(%rbp), %eax
	cltq
	addq	$1, %rax
	addq	%rdx, %rax
	movzbl	(%rax), %eax
	cmpb	$46, %al
	jne	.L13
	addl	$1, -40048(%rbp)
	movl	-40060(%rbp), %eax
	cltq
	leaq	0(,%rax,8), %rdx
	movq	-40040(%rbp), %rax
	addq	%rdx, %rax
	movq	(%rax), %rdx
	movl	-40056(%rbp), %eax
	cltq
	addq	$1, %rax
	addq	%rdx, %rax
	movb	$64, (%rax)
	movl	$1, -40044(%rbp)
.L13:
	movl	-40064(%rbp), %eax
	subl	$1, %eax
	cmpl	%eax, -40060(%rbp)
	je	.L14
	movl	-40060(%rbp), %eax
	cltq
	addq	$1, %rax
	leaq	0(,%rax,8), %rdx
	movq	-40040(%rbp), %rax
	addq	%rdx, %rax
	movq	(%rax), %rdx
	movl	-40056(%rbp), %eax
	cltq
	addq	%rdx, %rax
	movzbl	(%rax), %eax
	cmpb	$46, %al
	jne	.L14
	addl	$1, -40048(%rbp)
	movl	-40060(%rbp), %eax
	cltq
	addq	$1, %rax
	leaq	0(,%rax,8), %rdx
	movq	-40040(%rbp), %rax
	addq	%rdx, %rax
	movq	(%rax), %rdx
	movl	-40056(%rbp), %eax
	cltq
	addq	%rdx, %rax
	movb	$64, (%rax)
	movl	$1, -40044(%rbp)
.L14:
	cmpl	$0, -40056(%rbp)
	je	.L11
	movl	-40060(%rbp), %eax
	cltq
	leaq	0(,%rax,8), %rdx
	movq	-40040(%rbp), %rax
	addq	%rdx, %rax
	movq	(%rax), %rdx
	movl	-40056(%rbp), %eax
	cltq
	subq	$1, %rax
	addq	%rdx, %rax
	movzbl	(%rax), %eax
	cmpb	$46, %al
	jne	.L11
	addl	$1, -40048(%rbp)
	movl	-40060(%rbp), %eax
	cltq
	leaq	0(,%rax,8), %rdx
	movq	-40040(%rbp), %rax
	addq	%rdx, %rax
	movq	(%rax), %rdx
	movl	-40056(%rbp), %eax
	cltq
	subq	$1, %rax
	addq	%rdx, %rax
	movb	$64, (%rax)
	movl	$1, -40044(%rbp)
.L11:
	addl	$1, -40056(%rbp)
.L10:
	movl	-40068(%rbp), %eax
	cmpl	%eax, -40056(%rbp)
	jl	.L15
	addl	$1, -40060(%rbp)
.L9:
	movl	-40064(%rbp), %eax
	cmpl	%eax, -40060(%rbp)
	jl	.L16
.L8:
	cmpl	$0, -40044(%rbp)
	jne	.L17
	movl	-40052(%rbp), %eax
	cltq
	movl	-40048(%rbp), %edx
	movl	%edx, -40032(%rbp,%rax,4)
	addl	$1, -40052(%rbp)
	movq	-40040(%rbp), %rax
	movq	%rax, %rdi
	call	free@PLT
	jmp	.L18
.L24:
	nop
	movl	$0, -40060(%rbp)
	jmp	.L19
.L20:
	movl	-40060(%rbp), %eax
	cltq
	movl	-40032(%rbp,%rax,4), %eax
	movl	%eax, %esi
	leaq	.LC2(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	addl	$1, -40060(%rbp)
.L19:
	movl	-40060(%rbp), %eax
	cmpl	-40052(%rbp), %eax
	jl	.L20
	movl	$0, %eax
	movq	-24(%rbp), %rdx
	subq	%fs:40, %rdx
	je	.L22
	call	__stack_chk_fail@PLT
.L22:
	movq	-8(%rbp), %rbx
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE6:
	.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"
.LC1:
	.string	"%s"
.LC2:
	.string	"%d\n"
	.section	.text.startup,"ax",@progbits
	.p2align 4
	.globl	main
	.type	main, @function
main:
.LFB39:
	.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	-36864(%rsp), %r11
	.cfi_def_cfa 11, 36920
.LPSRL0:
	subq	$4096, %rsp
	orq	$0, (%rsp)
	cmpq	%r11, %rsp
	jne	.LPSRL0
	.cfi_def_cfa_register 7
	subq	$3208, %rsp
	.cfi_def_cfa_offset 40128
	leaq	.LC1(%rip), %rbx
	movq	%fs:40, %rax
	movq	%rax, 40056(%rsp)
	xorl	%eax, %eax
	leaq	44(%rsp), %rax
	movq	$0, 8(%rsp)
	movq	%rax, 24(%rsp)
	leaq	40(%rsp), %rax
	movq	%rax, 16(%rsp)
.L37:
	movq	24(%rsp), %rdx
	movq	16(%rsp), %rsi
	xorl	%eax, %eax
	leaq	.LC0(%rip), %rdi
	movl	8(%rsp), %ebp
	call	__isoc99_scanf@PLT
	movslq	40(%rsp), %r12
	movl	44(%rsp), %r13d
	movl	%r12d, %eax
	orl	%r13d, %eax
	je	.L71
	movslq	%r13d, %rdi
	salq	$3, %rdi
	call	malloc@PLT
	movq	%rax, %rbp
	testl	%r13d, %r13d
	jle	.L4
	movl	%r13d, %r13d
	movq	%rax, %r14
	leaq	(%rax,%r13,8), %r13
	.p2align 4,,10
	.p2align 3
.L5:
	movq	%r12, %rdi
	addq	$8, %r14
	call	malloc@PLT
	movq	%rax, -8(%r14)
	cmpq	%r14, %r13
	jne	.L5
	xorl	%r12d, %r12d
	.p2align 4,,10
	.p2align 3
.L6:
	movq	0(%rbp,%r12,8), %rsi
	movq	%rbx, %rdi
	xorl	%eax, %eax
	addq	$1, %r12
	call	__isoc99_scanf@PLT
	movl	44(%rsp), %r13d
	cmpl	%r12d, %r13d
	jg	.L6
	movl	40(%rsp), %r12d
.L4:
	xorl	%r11d, %r11d
	movl	$1, %r8d
	xorl	%edi, %edi
	movslq	%r12d, %rcx
	leal	-1(%r13), %r15d
	leal	-1(%r12), %r9d
	.p2align 4,,10
	.p2align 3
.L7:
	cmpl	%r13d, %edi
	jge	.L32
	movl	%edi, %esi
	addl	$1, %edi
.L36:
	testl	%r12d, %r12d
	jle	.L7
	movslq	%esi, %rdx
	leaq	0(,%rdx,8), %rax
	movq	0(%rbp,%rdx,8), %rdx
	leaq	-8(%rbp,%rax), %r14
	leaq	8(%rbp,%rax), %r10
	xorl	%eax, %eax
	cmpl	%esi, %r15d
	je	.L72
	testl	%esi, %esi
	jne	.L31
	jmp	.L26
	.p2align 4,,10
	.p2align 3
.L27:
	addq	$1, %rax
	cmpq	%rax, %rcx
	je	.L7
.L31:
	cmpb	$64, (%rdx,%rax)
	jne	.L27
	movq	(%r14), %rsi
	addq	%rax, %rsi
	cmpb	$46, (%rsi)
	jne	.L28
	movb	$64, (%rsi)
	addl	$1, %r8d
	movl	$1, %r11d
.L28:
	cmpl	%eax, %r9d
	je	.L29
	cmpb	$46, 1(%rdx,%rax)
	jne	.L29
	movb	$64, 1(%rdx,%rax)
	addl	$1, %r8d
	movl	$1, %r11d
.L29:
	movq	(%r10), %rsi
	addq	%rax, %rsi
	cmpb	$46, (%rsi)
	je	.L73
.L30:
	testq	%rax, %rax
	je	.L27
	cmpb	$46, -1(%rdx,%rax)
	jne	.L27
	movb	$64, -1(%rdx,%rax)
	addl	$1, %r8d
	movl	$1, %r11d
	jmp	.L27
	.p2align 4,,10
	.p2align 3
.L75:
	cmpl	%eax, %r9d
	je	.L25
	cmpb	$46, 1(%rdx,%rax)
	jne	.L25
	movb	$64, 1(%rdx,%rax)
	addl	$1, %r8d
	movl	$1, %r11d
.L25:
	movq	(%r10), %rsi
	addq	%rax, %rsi
	cmpb	$46, (%rsi)
	je	.L23
.L24:
	testq	%rax, %rax
	je	.L21
	cmpb	$46, -1(%rdx,%rax)
	je	.L74
	.p2align 4,,10
	.p2align 3
.L21:
	addq	$1, %rax
	cmpq	%rax, %rcx
	je	.L7
.L26:
	cmpb	$64, (%rdx,%rax)
	jne	.L21
	jmp	.L75
	.p2align 4,,10
	.p2align 3
.L74:
	movb	$64, -1(%rdx,%rax)
	addl	$1, %r8d
	movl	$1, %r11d
	jmp	.L21
	.p2align 4,,10
	.p2align 3
.L72:
	testl	%r15d, %r15d
	jne	.L19
	jmp	.L12
	.p2align 4,,10
	.p2align 3
.L15:
	addq	$1, %rax
	cmpq	%rax, %rcx
	je	.L7
.L19:
	cmpb	$64, (%rdx,%rax)
	jne	.L15
	movq	(%r14), %rsi
	addq	%rax, %rsi
	cmpb	$46, (%rsi)
	jne	.L18
	movb	$64, (%rsi)
	addl	$1, %r8d
	movl	$1, %r11d
.L18:
	cmpl	%eax, %r9d
	je	.L17
	cmpb	$46, 1(%rdx,%rax)
	jne	.L17
	movb	$64, 1(%rdx,%rax)
	addl	$1, %r8d
	movl	$1, %r11d
.L17:
	testq	%rax, %rax
	je	.L15
	cmpb	$46, -1(%rdx,%rax)
	jne	.L15
	movb	$64, -1(%rdx,%rax)
	addl	$1, %r8d
	movl	$1, %r11d
	jmp	.L15
	.p2align 4,,10
	.p2align 3
.L77:
	cmpl	%r9d, %esi
	je	.L11
	cmpb	$46, 1(%rdx)
	jne	.L11
	movb	$64, 1(%rdx)
	addl	$1, %r8d
	movl	$1, %r11d
.L11:
	testl	%esi, %esi
	je	.L10
	cmpb	$46, -1(%rdx)
	je	.L76
	.p2align 4,,10
	.p2align 3
.L10:
	addl	$1, %esi
	addq	$1, %rdx
	cmpl	%esi, %r12d
	je	.L7
.L12:
	cmpb	$64, (%rdx)
	jne	.L10
	jmp	.L77
.L76:
	movb	$64, -1(%rdx)
	addl	$1, %r8d
	movl	$1, %r11d
	jmp	.L10
	.p2align 4,,10
	.p2align 3
.L73:
	movb	$64, (%rsi)
	addl	$1, %r8d
	movl	$1, %r11d
	jmp	.L30
	.p2align 4,,10
	.p2align 3
.L23:
	movb	$64, (%rsi)
	addl	$1, %r8d
	movl	$1, %r11d
	jmp	.L24
	.p2align 4,,10
	.p2align 3
.L32:
	testl	%r11d, %r11d
	je	.L35
	testl	%r13d, %r13d
	jle	.L35
	movl	%r11d, %edi
	xorl	%esi, %esi
	xorl	%r11d, %r11d
	jmp	.L36
.L35:
	movq	8(%rsp), %r14
	movq	%rbp, %rdi
	movl	%r8d, 48(%rsp,%r14,4)
	call	free@PLT
	movq	%r14, %rax
	addq	$1, %rax
	movq	%rax, 8(%rsp)
	jmp	.L37
.L71:
	testl	%ebp, %ebp
	je	.L39
	leal	-1(%rbp), %eax
	leaq	48(%rsp), %rbx
	leaq	52(%rsp,%rax,4), %r12
	leaq	.LC2(%rip), %rbp
.L38:
	movl	(%rbx), %edx
	movq	%rbp, %rsi
	movl	$1, %edi
	xorl	%eax, %eax
	addq	$4, %rbx
	call	__printf_chk@PLT
	cmpq	%rbx, %r12
	jne	.L38
.L39:
	movq	40056(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L78
	addq	$40072, %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
.L78:
	.cfi_restore_state
	call	__stack_chk_fail@PLT
	.cfi_endproc
.LFE39:
	.size	main, .-main
	.ident	"GCC: (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0"
	.section	.note.GNU-stack,"",@progbits
	.section	.note.gnu.property,"a"
	.align 8
	.long	1f - 0f
	.long	4f - 1f
	.long	5
0:
	.string	"GNU"
1:
	.align 8
	.long	0xc0000002
	.long	3f - 2f
2:
	.long	0x3
3:
	.align 8
4:

rule
	.file	"temp.c"
	.text
	.section	.rodata.str1.1,"aMS",@progbits,1
.LC0:
	.string	"%d %d"
.LC1:
	.string	"%s"
.LC2:
	.string	"%d\n"
	.section	.text.startup,"ax",@progbits
	.p2align 4
	.globl	main
	.type	main, @function
main:
.LFB39:
	.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	-36864(%rsp), %r11
	.cfi_def_cfa 11, 36920
.LPSRL0:
	subq	$4096, %rsp
	orq	$0, (%rsp)
	cmpq	%r11, %rsp
	jne	.LPSRL0
	.cfi_def_cfa_register 7
	subq	$3208, %rsp
	.cfi_def_cfa_offset 40128
	leaq	.LC1(%rip), %rbx
	movq	%fs:40, %rax
	movq	%rax, 40056(%rsp)
	xorl	%eax, %eax
	leaq	44(%rsp), %rax
	movq	$0, 8(%rsp)
	movq	%rax, 24(%rsp)
	leaq	40(%rsp), %rax
	movq	%rax, 16(%rsp)
.L37:
	movq	24(%rsp), %rdx
	movq	16(%rsp), %rsi
	xorl	%eax, %eax
	leaq	.LC0(%rip), %rdi
	movl	8(%rsp), %ebp
	call	__isoc99_scanf@PLT
	movslq	40(%rsp), %r12
	movl	44(%rsp), %r13d
	movl	%r12d, %eax
	orl	%r13d, %eax
	je	.L71
	movslq	%r13d, %rdi
	salq	$3, %rdi
	call	malloc@PLT
	movq	%rax, %rbp
	testl	%r13d, %r13d
	jle	.L4
	movl	%r13d, %r13d
	movq	%rax, %r14
	leaq	(%rax,%r13,8), %r13
	.p2align 4,,10
	.p2align 3
.L5:
	movq	%r12, %rdi
	addq	$8, %r14
	call	malloc@PLT
	movq	%rax, -8(%r14)
	cmpq	%r14, %r13
	jne	.L5
	xorl	%r12d, %r12d
	.p2align 4,,10
	.p2align 3
.L6:
	movq	0(%rbp,%r12,8), %rsi
	movq	%rbx, %rdi
	xorl	%eax, %eax
	addq	$1, %r12
	call	__isoc99_scanf@PLT
	movl	44(%rsp), %r13d
	cmpl	%r12d, %r13d
	jg	.L6
	movl	40(%rsp), %r12d
.L4:
	xorl	%r11d, %r11d
	movl	$1, %r8d
	xorl	%edi, %edi
	movslq	%r12d, %rcx
	leal	-1(%r13), %r15d
	leal	-1(%r12), %r9d
	.p2align 4,,10
	.p2align 3
.L7:
	cmpl	%r13d, %edi
	jge	.L32
	movl	%edi, %esi
	addl	$1, %edi
.L36:
	testl	%r12d, %r12d
	jle	.L7
	movslq	%esi, %rdx
	leaq	0(,%rdx,8), %rax
	movq	0(%rbp,%rdx,8), %rdx
	leaq	-8(%rbp,%rax), %r14
	leaq	8(%rbp,%rax), %r10
	xorl	%eax, %eax
	cmpl	%esi, %r15d
	je	.L72
	testl	%esi, %esi
	jne	.L31
	jmp	.L26
	.p2align 4,,10
	.p2align 3
.L27:
	addq	$1, %rax
	cmpq	%rax, %rcx
	je	.L7
.L31:
	cmpb	$64, (%rdx,%rax)
	jne	.L27
	movq	(%r14), %rsi
	addq	%rax, %rsi
	cmpb	$46, (%rsi)
	jne	.L28
	movb	$64, (%rsi)
	addl	$1, %r8d
	movl	$1, %r11d
.L28:
	cmpl	%eax, %r9d
	je	.L29
	cmpb	$46, 1(%rdx,%rax)
	jne	.L29
	movb	$64, 1(%rdx,%rax)
	addl	$1, %r8d
	movl	$1, %r11d
.L29:
	movq	(%r10), %rsi
	addq	%rax, %rsi
	cmpb	$46, (%rsi)
	je	.L73
.L30:
	testq	%rax, %rax
	je	.L27
	cmpb	$46, -1(%rdx,%rax)
	jne	.L27
	movb	$64, -1(%rdx,%rax)
	addl	$1, %r8d
	movl	$1, %r11d
	jmp	.L27
	.p2align 4,,10
	.p2align 3
.L75:
	cmpl	%eax, %r9d
	je	.L25
	cmpb	$46, 1(%rdx,%rax)
	jne	.L25
	movb	$64, 1(%rdx,%rax)
	addl	$1, %r8d
	movl	$1, %r11d
.L25:
	movq	(%r10), %rsi
	addq	%rax, %rsi
	cmpb	$46, (%rsi)
	je	.L23
.L24:
	testq	%rax, %rax
	je	.L21
	cmpb	$46, -1(%rdx,%rax)
	je	.L74
	.p2align 4,,10
	.p2align 3
.L21:
	addq	$1, %rax
	cmpq	%rax, %rcx
	je	.L7
.L26:
	cmpb	$64, (%rdx,%rax)
	jne	.L21
	jmp	.L75
	.p2align 4,,10
	.p2align 3
.L74:
	movb	$64, -1(%rdx,%rax)
	addl	$1, %r8d
	movl	$1, %r11d
	jmp	.L21
	.p2align 4,,10
	.p2align 3
.L72:
	testl	%r15d, %r15d
	jne	.L19
	jmp	.L12
	.p2align 4,,10
	.p2align 3
.L15:
	addq	$1, %rax
	cmpq	%rax, %rcx
	je	.L7
.L19:
	cmpb	$64, (%rdx,%rax)
	jne	.L15
	movq	(%r14), %rsi
	addq	%rax, %rsi
	cmpb	$46, (%rsi)
	jne	.L18
	movb	$64, (%rsi)
	addl	$1, %r8d
	movl	$1, %r11d
.L18:
	cmpl	%eax, %r9d
	je	.L17
	cmpb	$46, 1(%rdx,%rax)
	jne	.L17
	movb	$64, 1(%rdx,%rax)
	addl	$1, %r8d
	movl	$1, %r11d
.L17:
	testq	%rax, %rax
	je	.L15
	cmpb	$46, -1(%rdx,%rax)
	jne	.L15
	movb	$64, -1(%rdx,%rax)
	addl	$1, %r8d
	movl	$1, %r11d
	jmp	.L15
	.p2align 4,,10
	.p2align 3
.L77:
	cmpl	%r9d, %esi
	je	.L11
	cmpb	$46, 1(%rdx)
	jne	.L11
	movb	$64, 1(%rdx)
	addl	$1, %r8d
	movl	$1, %r11d
.L11:
	testl	%esi, %esi
	je	.L10
	cmpb	$46, -1(%rdx)
	je	.L76
	.p2align 4,,10
	.p2align 3
.L10:
	addl	$1, %esi
	addq	$1, %rdx
	cmpl	%esi, %r12d
	je	.L7
.L12:
	cmpb	$64, (%rdx)
	jne	.L10
	jmp	.L77
.L76:
	movb	$64, -1(%rdx)
	addl	$1, %r8d
	movl	$1, %r11d
	jmp	.L10
	.p2align 4,,10
	.p2align 3
.L73:
	movb	$64, (%rsi)
	addl	$1, %r8d
	movl	$1, %r11d
	jmp	.L30
	.p2align 4,,10
	.p2align 3
.L23:
	movb	$64, (%rsi)
	addl	$1, %r8d
	movl	$1, %r11d
	jmp	.L24
	.p2align 4,,10
	.p2align 3
.L32:
	testl	%r11d, %r11d
	je	.L35
	testl	%r13d, %r13d
	jle	.L35
	movl	%r11d, %edi
	xorl	%esi, %esi
	xorl	%r11d, %r11d
	jmp	.L36
.L35:
	movq	8(%rsp), %r14
	movq	%rbp, %rdi
	movl	%r8d, 48(%rsp,%r14,4)
	call	free@PLT
	movq	%r14, %rax
	addq	$1, %rax
	movq	%rax, 8(%rsp)
	jmp	.L37
.L71:
	testl	%ebp, %ebp
	je	.L39
	leal	-1(%rbp), %eax
	leaq	48(%rsp), %rbx
	leaq	52(%rsp,%rax,4), %r12
	leaq	.LC2(%rip), %rbp
.L38:
	movl	(%rbx), %edx
	movq	%rbp, %rsi
	movl	$1, %edi
	xorl	%eax, %eax
	addq	$4, %rbx
	call	__printf_chk@PLT
	cmpq	%rbx, %r12
	jne	.L38
.L39:
	movq	40056(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L78
	addq	$40072, %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
.L78:
	.cfi_restore_state
	call	__stack_chk_fail@PLT
	.cfi_endproc
.LFE39:
	.size	main, .-main
	.ident	"GCC: (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0"
	.section	.note.GNU-stack,"",@progbits
	.section	.note.gnu.property,"a"
	.align 8
	.long	1f - 0f
	.long	4f - 1f
	.long	5
0:
	.string	"GNU"
1:
	.align 8
	.long	0xc0000002
	.long	3f - 2f
2:
	.long	0x3
3:
	.align 8
4:

#include<stdio.h>
#include<stdlib.h>

int main() {

	char **c;     //?????????
	int W ,H;     //?????????????¨??????¨??????
	int i,j;      //???????????¨?????°
	int a=0;      //??????????´???¨??????????????°
	int count;    //??????
	int flag;     //??¢?´¢????¶?????????????????????????????????°
	int A[10000]; //??????????´???¨??????

	for(;;) {

	scanf("%d %d",&W,&H); //?¨??????¨???????????\???

	if(W==0&&H==0) break;

	c = malloc(sizeof(char *) * H);

	for(i=0;i<H;i++) {
		c[i] = malloc(sizeof(char)*W);
	}

	for(i=0;i<H;i++)
		scanf("%s",c[i]); //??????????????\???

	count=1;
	flag=1;

	while(flag) { //??¢?´¢????§?
		flag = 0;
		for(i=0;i<H;i++) {
			for(j=0;j<W;j++) {
				if(c[i][j]=='@') {
					if(i!=0&&c[i-1][j]=='.') { //???????§????
						count++;
						c[i-1][j]='@';
						flag=1;
					}
					if(j!=W-1&&c[i][j+1]=='.') { //???????§????
						count++;
						c[i][j+1]='@';
						flag=1;
					}
					if(i!=H-1&&c[i+1][j]=='.') { //???????§????
						count++;
						c[i+1][j]='@';
						flag=1;
					}
					if(j!=0&&c[i][j-1]=='.') { //???????§????
						count++;
						c[i][j-1]='@';
						flag=1;
					}
				}
			}
		}
	} //??¢?´¢????¶???????flag??????????¶???????

	A[a]=count;
	a++;

	free(c);
	}

	for(i=0;i<a;i++)
		printf("%d\n",A[i]);

	return 0;
}
6 9
....#.
.....#
......
......
......
......
......
@...#
.#..#.
11 9
.#.........
.#.#######.
.#.#.....#.
.#.#.###.#.
.#.#..@#.#.
.#.#####.#.
.#.......#.
.#########.
...........
11 6
..#..#..#..
..#..#..#..
..#..#..###
..#..#..#@.
..#..#..#..
..#..#..#..
7 7
#.#....
..#.#..
.###
...@...
.###
..#.#..
..#.#..
0 0
 6 9
....#.
.....#
......
......
......
......
......
#@...#
.#..#.
11 9
.#.........
.#.#######.
.#.#.....#.
.#.#.###.#.
.#.#..@#.#.
.#.#####.#.
.#.......#.
.#########.
...........
11 6
..#..#..#..
..#..#..#..
..#..#..###
..#..#..#@.
..#..#..#..
..#..#..#..
7 7
..#.#..
..#.#..
###.###
...@...
###."##
..#.#..
..#.#..
0 0
 6 9
....#.
.....#
......
......
......
......
......
@...#
."..#.
11 9
.#.........
.#.#######.
.#.....#.#.
.#.#.###.#.
.#.#..@#.#.
.#.#####.#.
.#.......#.
.#########.
...........
11 6
..#..#..#..
..#..#..#..
..#..#..###
..#..#..#@.
..#..#..#..
..#..#..#..
7 7
#.#....
..#.#..
.###
...@...
.###
..#.#..
..#.#..
0 0
 6 9
....#.
.....#
......
......
......
......
......
@...#
."..#.
11 9
.#.........
.#.#######.
.#.....#.#.
.#.#.###.#.
.#.#..@#.#.
.#.#####.#.
.#.......#.
.#########.
...........
11 6
..#..#..#..
..#..#..#..
..#.."..###
..#..#..#@.
..#..#..#..
..#..#..#..
7 7
#.#....
..#.#..
.###
...@...
.###
..#.#..
..#.#..
0 0
 6 9
....#.
.....#
......
......
......
......
......
@...#
.#..#.
11 9
.#.........
.#.#######.
.#.#.....#.
.#.#.###.#.
.#.#..@#.#.
.#.#####.#.
.#.......#.
.#########.
...........
11 6
..#..#..#..
..#..#..#..
###..#..#..
..#..#..#@.
..#..#..#..
..#..#..#..
7 7
..#.#..
..#.#..
.###
...@...
.###
..#.#..
..#.#..
0 0
 6 9
....#.
.....#
......
......
......
......
......
#@...#
.#..#.
11 9
.#.........
.#.#######.
.#.#.....#.
.#.#.###.#.
.#.#..@#.#.
.#.#####.#.
.#.......#.
.#########.
...........
11 6
..#..#..#..
..#..#..#..
..#..#..###
..#..#..#@.
..#..#..#..
..#..#..#..
13 7
..#.#..
..#.#..
###.###
...@...
###.###
..#.#..
..#.#..
0 0
 6 9
....#.
.....#
......
......
......
......
......
#@...#
.#..#.
12 9
.#.........
.#.#######.
.#.#.....#.
.#.#.###.#.
.#.#..@#.#.
.#.#####.#.
.#.......#.
.#########.
...........
11 6
..#..#..#..
..#..#..#..
..#..#..###
..#..#..#@.
..#..#..#..
..#..#..#..
7 7
..#.#..
..#.#..
###.###
...@...
###."##
..#.#..
..#.#..
0 0
 6 9
....#.
.....#
......
......
......
......
......
@...#
."..#.
11 9
.#.........
.#.#######.
.".....#.#.
.#.#.###.#.
.#.#..@#.#.
.#.#####.#.
.#.......#.
.#########.
...........
11 6
..#..#..#..
..#..#..#..
..#.."..###
..#..#..#@.
..#..#..#..
..#..#..#..
7 7
#.#....
..#.#..
.###
...@...
.###
..#.#..
..#.#..
0 0
 6 9
....#.
.....#
......
......
......
......
......
@...#
."..#.
11 9
.#.........
.#.#######.
##.....#...
.#.#.###.#.
.#.#..@#.#.
.#.#####.#.
.#.......#.
.#########.
...........
11 6
..#..#..#..
..#..#..#..
..#..#..###
..#..#..#@.
..#..#..#..
..#..#..#..
7 7
#.#....
..#.#..
.###
./.@...
.###
..#.#..
..#.#..
0 0
 6 9
./..#.
.....#
......
......
......
......
......
@...#
."..#.
11 9
.#.........
.#######.#.
.#.....#.#.
.#.#.###.#.
.#.#..@#.#.
.#.#####.#.
.#.......#.
.#########.
...........
11 6
..#..#..#..
..#..#..#..
..#.."..#"#
..#..#..#@.
..#..#..#..
..#..#..#..
7 7
#.#....
..#.#..
.###
...@...
.###
..#.#..
..#.#..
0 0

46
59
6
16
 45
59
6
13
 46
59
6
16
 46
59
6
16
 46
59
12
17
 45
59
6
13
 45
59
6
13
 46
59
6
16
 46
57
6
5
 45
59
6
16

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>
#include<stdlib.h>

int main() {

	char **c;     //?????????
	int W ,H;     //?????????????¨??????¨??????
	int i,j;      //???????????¨?????°
	int a=0;      //??????????´???¨??????????????°
	int count;    //??????
	int flag;     //??¢?´¢????¶?????????????????????????????????°
	int A[10000]; //??????????´???¨??????

	for(;;) {

	scanf("%d %d",&W,&H); //?¨??????¨???????????\???

	if(W==0&&H==0) break;

	c = malloc(sizeof(char *) * H);

	for(i=0;i<H;i++) {
		c[i] = malloc(sizeof(char)*W);
	}

	for(i=0;i<H;i++)
		scanf("%s",c[i]); //??????????????\???

	count=1;
	flag=1;

	while(flag) { //??¢?´¢????§?
		flag = 0;
		for(i=0;i<H;i++) {
			for(j=0;j<W;j++) {
				if(c[i][j]=='@') {
					if(i!=0&&c[i-1][j]=='.') { //???????§????
						count++;
						c[i-1][j]='@';
						flag=1;
					}
					if(j!=W-1&&c[i][j+1]=='.') { //???????§????
						count++;
						c[i][j+1]='@';
						flag=1;
					}
					if(i!=H-1&&c[i+1][j]=='.') { //???????§????
						count++;
						c[i+1][j]='@';
						flag=1;
					}
					if(j!=0&&c[i][j-1]=='.') { //???????§????
						count++;
						c[i][j-1]='@';
						flag=1;
					}
				}
			}
		}
	} //??¢?´¢????¶???????flag??????????¶???????

	A[a]=count;
	a++;

	free(c);
	}

	for(i=0;i<a;i++)
		printf("%d\n",A[i]);

	return 0;
}```

Unoptimized Assembly Code:

```assembly
	.file	"temp.c"
	.text
	.section	.rodata
.LC0:
	.string	"%d %d"
.LC1:
	.string	"%s"
.LC2:
	.string	"%d\n"
	.text
	.globl	main
	.type	main, @function
main:
.LFB6:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	pushq	%rbx
	leaq	-36864(%rsp), %r11
.LPSRL0:
	subq	$4096, %rsp
	orq	$0, (%rsp)
	cmpq	%r11, %rsp
	jne	.LPSRL0
	subq	$3208, %rsp
	.cfi_offset 3, -24
	movq	%fs:40, %rax
	movq	%rax, -24(%rbp)
	xorl	%eax, %eax
	movl	$0, -40052(%rbp)
.L18:
	leaq	-40064(%rbp), %rdx
	leaq	-40068(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	-40068(%rbp), %eax
	testl	%eax, %eax
	jne	.L2
	movl	-40064(%rbp), %eax
	testl	%eax, %eax
	je	.L24
.L2:
	movl	-40064(%rbp), %eax
	cltq
	salq	$3, %rax
	movq	%rax, %rdi
	call	malloc@PLT
	movq	%rax, -40040(%rbp)
	movl	$0, -40060(%rbp)
	jmp	.L4
.L5:
	movl	-40068(%rbp), %eax
	cltq
	movl	-40060(%rbp), %edx
	movslq	%edx, %rdx
	leaq	0(,%rdx,8), %rcx
	movq	-40040(%rbp), %rdx
	leaq	(%rcx,%rdx), %rbx
	movq	%rax, %rdi
	call	malloc@PLT
	movq	%rax, (%rbx)
	addl	$1, -40060(%rbp)
.L4:
	movl	-40064(%rbp), %eax
	cmpl	%eax, -40060(%rbp)
	jl	.L5
	movl	$0, -40060(%rbp)
	jmp	.L6
.L7:
	movl	-40060(%rbp), %eax
	cltq
	leaq	0(,%rax,8), %rdx
	movq	-40040(%rbp), %rax
	addq	%rdx, %rax
	movq	(%rax), %rax
	movq	%rax, %rsi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	addl	$1, -40060(%rbp)
.L6:
	movl	-40064(%rbp), %eax
	cmpl	%eax, -40060(%rbp)
	jl	.L7
	movl	$1, -40048(%rbp)
	movl	$1, -40044(%rbp)
	jmp	.L8
.L17:
	movl	$0, -40044(%rbp)
	movl	$0, -40060(%rbp)
	jmp	.L9
.L16:
	movl	$0, -40056(%rbp)
	jmp	.L10
.L15:
	movl	-40060(%rbp), %eax
	cltq
	leaq	0(,%rax,8), %rdx
	movq	-40040(%rbp), %rax
	addq	%rdx, %rax
	movq	(%rax), %rdx
	movl	-40056(%rbp), %eax
	cltq
	addq	%rdx, %rax
	movzbl	(%rax), %eax
	cmpb	$64, %al
	jne	.L11
	cmpl	$0, -40060(%rbp)
	je	.L12
	movl	-40060(%rbp), %eax
	cltq
	salq	$3, %rax
	leaq	-8(%rax), %rdx
	movq	-40040(%rbp), %rax
	addq	%rdx, %rax
	movq	(%rax), %rdx
	movl	-40056(%rbp), %eax
	cltq
	addq	%rdx, %rax
	movzbl	(%rax), %eax
	cmpb	$46, %al
	jne	.L12
	addl	$1, -40048(%rbp)
	movl	-40060(%rbp), %eax
	cltq
	salq	$3, %rax
	leaq	-8(%rax), %rdx
	movq	-40040(%rbp), %rax
	addq	%rdx, %rax
	movq	(%rax), %rdx
	movl	-40056(%rbp), %eax
	cltq
	addq	%rdx, %rax
	movb	$64, (%rax)
	movl	$1, -40044(%rbp)
.L12:
	movl	-40068(%rbp), %eax
	subl	$1, %eax
	cmpl	%eax, -40056(%rbp)
	je	.L13
	movl	-40060(%rbp), %eax
	cltq
	leaq	0(,%rax,8), %rdx
	movq	-40040(%rbp), %rax
	addq	%rdx, %rax
	movq	(%rax), %rdx
	movl	-40056(%rbp), %eax
	cltq
	addq	$1, %rax
	addq	%rdx, %rax
	movzbl	(%rax), %eax
	cmpb	$46, %al
	jne	.L13
	addl	$1, -40048(%rbp)
	movl	-40060(%rbp), %eax
	cltq
	leaq	0(,%rax,8), %rdx
	movq	-40040(%rbp), %rax
	addq	%rdx, %rax
	movq	(%rax), %rdx
	movl	-40056(%rbp), %eax
	cltq
	addq	$1, %rax
	addq	%rdx, %rax
	movb	$64, (%rax)
	movl	$1, -40044(%rbp)
.L13:
	movl	-40064(%rbp), %eax
	subl	$1, %eax
	cmpl	%eax, -40060(%rbp)
	je	.L14
	movl	-40060(%rbp), %eax
	cltq
	addq	$1, %rax
	leaq	0(,%rax,8), %rdx
	movq	-40040(%rbp), %rax
	addq	%rdx, %rax
	movq	(%rax), %rdx
	movl	-40056(%rbp), %eax
	cltq
	addq	%rdx, %rax
	movzbl	(%rax), %eax
	cmpb	$46, %al
	jne	.L14
	addl	$1, -40048(%rbp)
	movl	-40060(%rbp), %eax
	cltq
	addq	$1, %rax
	leaq	0(,%rax,8), %rdx
	movq	-40040(%rbp), %rax
	addq	%rdx, %rax
	movq	(%rax), %rdx
	movl	-40056(%rbp), %eax
	cltq
	addq	%rdx, %rax
	movb	$64, (%rax)
	movl	$1, -40044(%rbp)
.L14:
	cmpl	$0, -40056(%rbp)
	je	.L11
	movl	-40060(%rbp), %eax
	cltq
	leaq	0(,%rax,8), %rdx
	movq	-40040(%rbp), %rax
	addq	%rdx, %rax
	movq	(%rax), %rdx
	movl	-40056(%rbp), %eax
	cltq
	subq	$1, %rax
	addq	%rdx, %rax
	movzbl	(%rax), %eax
	cmpb	$46, %al
	jne	.L11
	addl	$1, -40048(%rbp)
	movl	-40060(%rbp), %eax
	cltq
	leaq	0(,%rax,8), %rdx
	movq	-40040(%rbp), %rax
	addq	%rdx, %rax
	movq	(%rax), %rdx
	movl	-40056(%rbp), %eax
	cltq
	subq	$1, %rax
	addq	%rdx, %rax
	movb	$64, (%rax)
	movl	$1, -40044(%rbp)
.L11:
	addl	$1, -40056(%rbp)
.L10:
	movl	-40068(%rbp), %eax
	cmpl	%eax, -40056(%rbp)
	jl	.L15
	addl	$1, -40060(%rbp)
.L9:
	movl	-40064(%rbp), %eax
	cmpl	%eax, -40060(%rbp)
	jl	.L16
.L8:
	cmpl	$0, -40044(%rbp)
	jne	.L17
	movl	-40052(%rbp), %eax
	cltq
	movl	-40048(%rbp), %edx
	movl	%edx, -40032(%rbp,%rax,4)
	addl	$1, -40052(%rbp)
	movq	-40040(%rbp), %rax
	movq	%rax, %rdi
	call	free@PLT
	jmp	.L18
.L24:
	nop
	movl	$0, -40060(%rbp)
	jmp	.L19
.L20:
	movl	-40060(%rbp), %eax
	cltq
	movl	-40032(%rbp,%rax,4), %eax
	movl	%eax, %esi
	leaq	.LC2(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	addl	$1, -40060(%rbp)
.L19:
	movl	-40060(%rbp), %eax
	cmpl	-40052(%rbp), %eax
	jl	.L20
	movl	$0, %eax
	movq	-24(%rbp), %rdx
	subq	%fs:40, %rdx
	je	.L22
	call	__stack_chk_fail@PLT
.L22:
	movq	-8(%rbp), %rbx
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE6:
	.size	main, .-main
	.ident	"GCC: (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0"
	.section	.note.GNU-stack,"",@progbits
	.section	.note.gnu.property,"a"
	.align 8
	.long	1f - 0f
	.long	4f - 1f
	.long	5
0:
	.string	"GNU"
1:
	.align 8
	.long	0xc0000002
	.long	3f - 2f
2:
	.long	0x3
3:
	.align 8
4:
```

Only output the optimized assembly code. Do not include any other text. Do not write any comments in the assembly code. Wrap the assembly code in ```assembly``` tags.
train
	.file	"temp.c"
	.text
	.section	.rodata
.LC0:
	.string	"%d %d"
.LC1:
	.string	"%s"
.LC2:
	.string	"%d\n"
	.text
	.globl	main
	.type	main, @function
main:
.LFB6:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	pushq	%rbx
	leaq	-36864(%rsp), %r11
.LPSRL0:
	subq	$4096, %rsp
	orq	$0, (%rsp)
	cmpq	%r11, %rsp
	jne	.LPSRL0
	subq	$3208, %rsp
	.cfi_offset 3, -24
	movq	%fs:40, %rax
	movq	%rax, -24(%rbp)
	xorl	%eax, %eax
	movl	$0, -40052(%rbp)
.L18:
	leaq	-40064(%rbp), %rdx
	leaq	-40068(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	-40068(%rbp), %eax
	testl	%eax, %eax
	jne	.L2
	movl	-40064(%rbp), %eax
	testl	%eax, %eax
	je	.L24
.L2:
	movl	-40064(%rbp), %eax
	cltq
	salq	$3, %rax
	movq	%rax, %rdi
	call	malloc@PLT
	movq	%rax, -40040(%rbp)
	movl	$0, -40060(%rbp)
	jmp	.L4
.L5:
	movl	-40068(%rbp), %eax
	cltq
	movl	-40060(%rbp), %edx
	movslq	%edx, %rdx
	leaq	0(,%rdx,8), %rcx
	movq	-40040(%rbp), %rdx
	leaq	(%rcx,%rdx), %rbx
	movq	%rax, %rdi
	call	malloc@PLT
	movq	%rax, (%rbx)
	addl	$1, -40060(%rbp)
.L4:
	movl	-40064(%rbp), %eax
	cmpl	%eax, -40060(%rbp)
	jl	.L5
	movl	$0, -40060(%rbp)
	jmp	.L6
.L7:
	movl	-40060(%rbp), %eax
	cltq
	leaq	0(,%rax,8), %rdx
	movq	-40040(%rbp), %rax
	addq	%rdx, %rax
	movq	(%rax), %rax
	movq	%rax, %rsi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	addl	$1, -40060(%rbp)
.L6:
	movl	-40064(%rbp), %eax
	cmpl	%eax, -40060(%rbp)
	jl	.L7
	movl	$1, -40048(%rbp)
	movl	$1, -40044(%rbp)
	jmp	.L8
.L17:
	movl	$0, -40044(%rbp)
	movl	$0, -40060(%rbp)
	jmp	.L9
.L16:
	movl	$0, -40056(%rbp)
	jmp	.L10
.L15:
	movl	-40060(%rbp), %eax
	cltq
	leaq	0(,%rax,8), %rdx
	movq	-40040(%rbp), %rax
	addq	%rdx, %rax
	movq	(%rax), %rdx
	movl	-40056(%rbp), %eax
	cltq
	addq	%rdx, %rax
	movzbl	(%rax), %eax
	cmpb	$64, %al
	jne	.L11
	cmpl	$0, -40060(%rbp)
	je	.L12
	movl	-40060(%rbp), %eax
	cltq
	salq	$3, %rax
	leaq	-8(%rax), %rdx
	movq	-40040(%rbp), %rax
	addq	%rdx, %rax
	movq	(%rax), %rdx
	movl	-40056(%rbp), %eax
	cltq
	addq	%rdx, %rax
	movzbl	(%rax), %eax
	cmpb	$46, %al
	jne	.L12
	addl	$1, -40048(%rbp)
	movl	-40060(%rbp), %eax
	cltq
	salq	$3, %rax
	leaq	-8(%rax), %rdx
	movq	-40040(%rbp), %rax
	addq	%rdx, %rax
	movq	(%rax), %rdx
	movl	-40056(%rbp), %eax
	cltq
	addq	%rdx, %rax
	movb	$64, (%rax)
	movl	$1, -40044(%rbp)
.L12:
	movl	-40068(%rbp), %eax
	subl	$1, %eax
	cmpl	%eax, -40056(%rbp)
	je	.L13
	movl	-40060(%rbp), %eax
	cltq
	leaq	0(,%rax,8), %rdx
	movq	-40040(%rbp), %rax
	addq	%rdx, %rax
	movq	(%rax), %rdx
	movl	-40056(%rbp), %eax
	cltq
	addq	$1, %rax
	addq	%rdx, %rax
	movzbl	(%rax), %eax
	cmpb	$46, %al
	jne	.L13
	addl	$1, -40048(%rbp)
	movl	-40060(%rbp), %eax
	cltq
	leaq	0(,%rax,8), %rdx
	movq	-40040(%rbp), %rax
	addq	%rdx, %rax
	movq	(%rax), %rdx
	movl	-40056(%rbp), %eax
	cltq
	addq	$1, %rax
	addq	%rdx, %rax
	movb	$64, (%rax)
	movl	$1, -40044(%rbp)
.L13:
	movl	-40064(%rbp), %eax
	subl	$1, %eax
	cmpl	%eax, -40060(%rbp)
	je	.L14
	movl	-40060(%rbp), %eax
	cltq
	addq	$1, %rax
	leaq	0(,%rax,8), %rdx
	movq	-40040(%rbp), %rax
	addq	%rdx, %rax
	movq	(%rax), %rdx
	movl	-40056(%rbp), %eax
	cltq
	addq	%rdx, %rax
	movzbl	(%rax), %eax
	cmpb	$46, %al
	jne	.L14
	addl	$1, -40048(%rbp)
	movl	-40060(%rbp), %eax
	cltq
	addq	$1, %rax
	leaq	0(,%rax,8), %rdx
	movq	-40040(%rbp), %rax
	addq	%rdx, %rax
	movq	(%rax), %rdx
	movl	-40056(%rbp), %eax
	cltq
	addq	%rdx, %rax
	movb	$64, (%rax)
	movl	$1, -40044(%rbp)
.L14:
	cmpl	$0, -40056(%rbp)
	je	.L11
	movl	-40060(%rbp), %eax
	cltq
	leaq	0(,%rax,8), %rdx
	movq	-40040(%rbp), %rax
	addq	%rdx, %rax
	movq	(%rax), %rdx
	movl	-40056(%rbp), %eax
	cltq
	subq	$1, %rax
	addq	%rdx, %rax
	movzbl	(%rax), %eax
	cmpb	$46, %al
	jne	.L11
	addl	$1, -40048(%rbp)
	movl	-40060(%rbp), %eax
	cltq
	leaq	0(,%rax,8), %rdx
	movq	-40040(%rbp), %rax
	addq	%rdx, %rax
	movq	(%rax), %rdx
	movl	-40056(%rbp), %eax
	cltq
	subq	$1, %rax
	addq	%rdx, %rax
	movb	$64, (%rax)
	movl	$1, -40044(%rbp)
.L11:
	addl	$1, -40056(%rbp)
.L10:
	movl	-40068(%rbp), %eax
	cmpl	%eax, -40056(%rbp)
	jl	.L15
	addl	$1, -40060(%rbp)
.L9:
	movl	-40064(%rbp), %eax
	cmpl	%eax, -40060(%rbp)
	jl	.L16
.L8:
	cmpl	$0, -40044(%rbp)
	jne	.L17
	movl	-40052(%rbp), %eax
	cltq
	movl	-40048(%rbp), %edx
	movl	%edx, -40032(%rbp,%rax,4)
	addl	$1, -40052(%rbp)
	movq	-40040(%rbp), %rax
	movq	%rax, %rdi
	call	free@PLT
	jmp	.L18
.L24:
	nop
	movl	$0, -40060(%rbp)
	jmp	.L19
.L20:
	movl	-40060(%rbp), %eax
	cltq
	movl	-40032(%rbp,%rax,4), %eax
	movl	%eax, %esi
	leaq	.LC2(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	addl	$1, -40060(%rbp)
.L19:
	movl	-40060(%rbp), %eax
	cmpl	-40052(%rbp), %eax
	jl	.L20
	movl	$0, %eax
	movq	-24(%rbp), %rdx
	subq	%fs:40, %rdx
	je	.L22
	call	__stack_chk_fail@PLT
.L22:
	movq	-8(%rbp), %rbx
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE6:
	.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:
