Given the following C code and unoptimized assembly code, your task is to generate highly optimized x86-64 assembly code.
C Code:

```c
/* ex 7_3
   アカウント名 */

#include <stdio.h>

#define ROW 100
#define COLUMN 100

int main(void){
    int i, j, k, row, column;
    scanf("%d %d\n", &row, &column);
    int row_flag[ROW] = {0}, column_flag[COLUMN] = {0};
    for(i = 0; i < row; i++){
        row_flag[i] = 0;
    }
    for(i = 0; i < column; i++){
        column_flag[i] = 0;
    }
    char matrix[row][column];
    for(i = 0; i < row; i++){
        for(j = 0; j < column; j++){
            scanf(" %c", &matrix[i][j]);
            if(matrix[i][j] == '#'){
                row_flag[i] = 1;
                column_flag[j] = 1;
            }
        }
    }

    for(i = 0; i < row; i++){
        k = 0;
        for(j = 0; j < column; j++){
            if(row_flag[i] == 1 && column_flag[j] == 1){
                printf("%c", matrix[i][j]);
                k = 1;
            }
        }
        if(k == 1){
            printf("\n");
        }
    }

    return 0;
}```

Unoptimized Assembly Code:

```assembly
	.file	"temp.c"
	.text
	.section	.rodata
.LC0:
	.string	"%d %d\n"
.LC1:
	.string	" %c"
	.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
	pushq	%r15
	pushq	%r14
	pushq	%r13
	pushq	%r12
	pushq	%rbx
	subq	$936, %rsp
	.cfi_offset 15, -24
	.cfi_offset 14, -32
	.cfi_offset 13, -40
	.cfi_offset 12, -48
	.cfi_offset 3, -56
	movq	%fs:40, %rax
	movq	%rax, -56(%rbp)
	xorl	%eax, %eax
	movq	%rsp, %rax
	movq	%rax, -968(%rbp)
	leaq	-904(%rbp), %rdx
	leaq	-908(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	leaq	-864(%rbp), %rdx
	movl	$0, %eax
	movl	$50, %ecx
	movq	%rdx, %rdi
	rep stosq
	leaq	-464(%rbp), %rdx
	movl	$0, %eax
	movl	$50, %ecx
	movq	%rdx, %rdi
	rep stosq
	movl	$0, -900(%rbp)
	jmp	.L2
.L3:
	movl	-900(%rbp), %eax
	cltq
	movl	$0, -864(%rbp,%rax,4)
	addl	$1, -900(%rbp)
.L2:
	movl	-908(%rbp), %eax
	cmpl	%eax, -900(%rbp)
	jl	.L3
	movl	$0, -900(%rbp)
	jmp	.L4
.L5:
	movl	-900(%rbp), %eax
	cltq
	movl	$0, -464(%rbp,%rax,4)
	addl	$1, -900(%rbp)
.L4:
	movl	-904(%rbp), %eax
	cmpl	%eax, -900(%rbp)
	jl	.L5
	movl	-904(%rbp), %ecx
	movl	-908(%rbp), %esi
	movslq	%ecx, %rax
	subq	$1, %rax
	movq	%rax, -888(%rbp)
	movslq	%ecx, %rax
	movq	%rax, -960(%rbp)
	movq	$0, -952(%rbp)
	movslq	%ecx, %rbx
	movslq	%esi, %rax
	subq	$1, %rax
	movq	%rax, -880(%rbp)
	movslq	%ecx, %rax
	movq	%rax, -928(%rbp)
	movq	$0, -920(%rbp)
	movslq	%esi, %rax
	movq	%rax, -944(%rbp)
	movq	$0, -936(%rbp)
	movq	-928(%rbp), %r8
	movq	-920(%rbp), %r9
	movq	%r9, %rdx
	movq	-944(%rbp), %r10
	movq	-936(%rbp), %r11
	imulq	%r10, %rdx
	movq	%r11, %rax
	imulq	%r8, %rax
	leaq	(%rdx,%rax), %rdi
	movq	%r8, %rax
	mulq	%r10
	addq	%rdx, %rdi
	movq	%rdi, %rdx
	movslq	%ecx, %rax
	movq	%rax, %r14
	movl	$0, %r15d
	movslq	%esi, %rax
	movq	%rax, %r12
	movl	$0, %r13d
	movq	%r15, %rdx
	imulq	%r12, %rdx
	movq	%r13, %rax
	imulq	%r14, %rax
	leaq	(%rdx,%rax), %rdi
	movq	%r14, %rax
	mulq	%r12
	addq	%rdx, %rdi
	movq	%rdi, %rdx
	movslq	%ecx, %rdx
	movslq	%esi, %rax
	imulq	%rdx, %rax
	movl	$16, %edx
	subq	$1, %rdx
	addq	%rdx, %rax
	movl	$16, %esi
	movl	$0, %edx
	divq	%rsi
	imulq	$16, %rax, %rax
	movq	%rax, %rcx
	andq	$-4096, %rcx
	movq	%rsp, %rdx
	subq	%rcx, %rdx
.L6:
	cmpq	%rdx, %rsp
	je	.L7
	subq	$4096, %rsp
	orq	$0, 4088(%rsp)
	jmp	.L6
.L7:
	movq	%rax, %rdx
	andl	$4095, %edx
	subq	%rdx, %rsp
	movq	%rax, %rdx
	andl	$4095, %edx
	testq	%rdx, %rdx
	je	.L8
	andl	$4095, %eax
	subq	$8, %rax
	addq	%rsp, %rax
	orq	$0, (%rax)
.L8:
	movq	%rsp, %rax
	addq	$0, %rax
	movq	%rax, -872(%rbp)
	movl	$0, -900(%rbp)
	jmp	.L9
.L13:
	movl	$0, -896(%rbp)
	jmp	.L10
.L12:
	movl	-896(%rbp), %eax
	movslq	%eax, %rdx
	movl	-900(%rbp), %eax
	cltq
	imulq	%rbx, %rax
	addq	%rax, %rdx
	movq	-872(%rbp), %rax
	addq	%rdx, %rax
	movq	%rax, %rsi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movq	-872(%rbp), %rcx
	movl	-896(%rbp), %eax
	movslq	%eax, %rdx
	movl	-900(%rbp), %eax
	cltq
	imulq	%rbx, %rax
	addq	%rcx, %rdx
	addq	%rdx, %rax
	movzbl	(%rax), %eax
	cmpb	$35, %al
	jne	.L11
	movl	-900(%rbp), %eax
	cltq
	movl	$1, -864(%rbp,%rax,4)
	movl	-896(%rbp), %eax
	cltq
	movl	$1, -464(%rbp,%rax,4)
.L11:
	addl	$1, -896(%rbp)
.L10:
	movl	-904(%rbp), %eax
	cmpl	%eax, -896(%rbp)
	jl	.L12
	addl	$1, -900(%rbp)
.L9:
	movl	-908(%rbp), %eax
	cmpl	%eax, -900(%rbp)
	jl	.L13
	movl	$0, -900(%rbp)
	jmp	.L14
.L19:
	movl	$0, -892(%rbp)
	movl	$0, -896(%rbp)
	jmp	.L15
.L17:
	movl	-900(%rbp), %eax
	cltq
	movl	-864(%rbp,%rax,4), %eax
	cmpl	$1, %eax
	jne	.L16
	movl	-896(%rbp), %eax
	cltq
	movl	-464(%rbp,%rax,4), %eax
	cmpl	$1, %eax
	jne	.L16
	movq	-872(%rbp), %rcx
	movl	-896(%rbp), %eax
	movslq	%eax, %rdx
	movl	-900(%rbp), %eax
	cltq
	imulq	%rbx, %rax
	addq	%rcx, %rdx
	addq	%rdx, %rax
	movzbl	(%rax), %eax
	movsbl	%al, %eax
	movl	%eax, %edi
	call	putchar@PLT
	movl	$1, -892(%rbp)
.L16:
	addl	$1, -896(%rbp)
.L15:
	movl	-904(%rbp), %eax
	cmpl	%eax, -896(%rbp)
	jl	.L17
	cmpl	$1, -892(%rbp)
	jne	.L18
	movl	$10, %edi
	call	putchar@PLT
.L18:
	addl	$1, -900(%rbp)
.L14:
	movl	-908(%rbp), %eax
	cmpl	%eax, -900(%rbp)
	jl	.L19
	movl	$0, %eax
	movq	-968(%rbp), %rsp
	movq	-56(%rbp), %rdx
	subq	%fs:40, %rdx
	je	.L21
	call	__stack_chk_fail@PLT
.L21:
	leaq	-40(%rbp), %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	.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\n"
.LC1:
	.string	" %c"
	.section	.text.startup,"ax",@progbits
	.p2align 4
	.globl	main
	.type	main, @function
main:
.LFB23:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	leaq	.LC0(%rip), %rdi
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	pushq	%r15
	pushq	%r14
	leaq	-868(%rbp), %rdx
	leaq	-872(%rbp), %rsi
	pushq	%r13
	pushq	%r12
	.cfi_offset 15, -24
	.cfi_offset 14, -32
	.cfi_offset 13, -40
	.cfi_offset 12, -48
	leaq	-464(%rbp), %r12
	pushq	%rbx
	subq	$872, %rsp
	.cfi_offset 3, -56
	movq	%fs:40, %rax
	movq	%rax, -56(%rbp)
	xorl	%eax, %eax
	call	__isoc99_scanf@PLT
	leaq	-864(%rbp), %rdi
	xorl	%eax, %eax
	movl	$50, %ecx
	movl	-872(%rbp), %r9d
	movq	%rdi, -888(%rbp)
	movq	%rdi, %r8
	rep stosq
	movl	$50, %ecx
	movq	%r12, %rdi
	rep stosq
	testl	%r9d, %r9d
	jle	.L2
	movslq	%r9d, %rbx
	xorl	%esi, %esi
	movq	%r8, %rdi
	movl	%r9d, -896(%rbp)
	leaq	0(,%rbx,4), %rdx
	call	memset@PLT
	movl	-868(%rbp), %ecx
	movl	-896(%rbp), %r9d
	testl	%ecx, %ecx
	jg	.L47
	movslq	%ecx, %rdx
	movq	%rbx, %rax
	movq	%rsp, %rsi
	imulq	%rdx, %rax
	movq	%rdx, -896(%rbp)
	addq	$15, %rax
	movq	%rax, %rdx
	andq	$-4096, %rax
	andq	$-16, %rdx
	subq	%rax, %rsi
.L21:
	cmpq	%rsi, %rsp
	je	.L26
	subq	$4096, %rsp
	orq	$0, 4088(%rsp)
	jmp	.L21
	.p2align 4,,10
	.p2align 3
.L2:
	movq	-56(%rbp), %rax
	subq	%fs:40, %rax
	jne	.L48
	leaq	-40(%rbp), %rsp
	xorl	%eax, %eax
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	.cfi_remember_state
	.cfi_def_cfa 7, 8
	ret
.L26:
	.cfi_restore_state
	movq	%rdx, %rax
	andl	$4095, %eax
	subq	%rax, %rsp
	testq	%rax, %rax
	je	.L27
	orq	$0, -8(%rsp,%rax)
.L27:
	movq	%rsp, %r15
	movl	$1, %r13d
	leaq	.LC1(%rip), %rbx
	movq	%r15, -904(%rbp)
	testl	%ecx, %ecx
	jle	.L10
	.p2align 4,,10
	.p2align 3
.L29:
	xorl	%r14d, %r14d
	.p2align 4,,10
	.p2align 3
.L8:
	xorl	%eax, %eax
	leaq	(%r15,%r14), %rsi
	movq	%rbx, %rdi
	call	__isoc99_scanf@PLT
	cmpb	$35, (%r15,%r14)
	je	.L49
	movl	-868(%rbp), %ecx
	addq	$1, %r14
	cmpl	%r14d, %ecx
	jg	.L8
.L7:
	movl	-872(%rbp), %r9d
	cmpl	%r13d, %r9d
	jle	.L10
	addq	$1, %r13
	addq	-896(%rbp), %r15
	testl	%ecx, %ecx
	jg	.L29
.L10:
	testl	%r9d, %r9d
	jle	.L2
	xorl	%r13d, %r13d
	jmp	.L11
	.p2align 4,,10
	.p2align 3
.L44:
	movl	-872(%rbp), %r9d
.L18:
	addq	$1, %r13
	movq	-896(%rbp), %rdx
	addq	%rdx, -904(%rbp)
	cmpl	%r13d, %r9d
	jle	.L2
	movl	-868(%rbp), %ecx
.L11:
	testl	%ecx, %ecx
	jle	.L18
	movq	-888(%rbp), %rax
	cmpl	$1, (%rax,%r13,4)
	jne	.L44
	xorl	%ebx, %ebx
	xorl	%eax, %eax
	jmp	.L17
	.p2align 4,,10
	.p2align 3
.L13:
	addq	$1, %rbx
	cmpl	%ebx, %ecx
	jle	.L50
.L17:
	cmpl	$1, (%r12,%rbx,4)
	jne	.L13
	movq	-904(%rbp), %rax
	movsbl	(%rax,%rbx), %edi
	addq	$1, %rbx
	call	putchar@PLT
	movl	-868(%rbp), %ecx
	cmpl	%ebx, %ecx
	jle	.L15
	movl	$1, %eax
	jmp	.L17
	.p2align 4,,10
	.p2align 3
.L49:
	movq	-888(%rbp), %rax
	movl	-868(%rbp), %ecx
	movl	$1, (%r12,%r14,4)
	addq	$1, %r14
	movl	$1, -4(%rax,%r13,4)
	cmpl	%r14d, %ecx
	jg	.L8
	jmp	.L7
	.p2align 4,,10
	.p2align 3
.L50:
	cmpl	$1, %eax
	jne	.L44
.L15:
	movl	$10, %edi
	call	putchar@PLT
	jmp	.L44
.L47:
	movslq	%ecx, %r13
	xorl	%esi, %esi
	movq	%r12, %rdi
	movl	%r9d, -908(%rbp)
	leaq	0(,%r13,4), %rdx
	movl	%ecx, -904(%rbp)
	call	memset@PLT
	movq	%rbx, %rax
	movq	%rsp, %rsi
	movq	%r13, -896(%rbp)
	imulq	%r13, %rax
	movl	-908(%rbp), %r9d
	movl	-904(%rbp), %ecx
	addq	$15, %rax
	movq	%rax, %rdx
	andq	$-4096, %rax
	andq	$-16, %rdx
	subq	%rax, %rsi
.L25:
	cmpq	%rsi, %rsp
	je	.L26
	subq	$4096, %rsp
	orq	$0, 4088(%rsp)
	jmp	.L25
.L48:
	call	__stack_chk_fail@PLT
	.cfi_endproc
.LFE23:
	.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\n"
.LC1:
	.string	" %c"
	.section	.text.startup,"ax",@progbits
	.p2align 4
	.globl	main
	.type	main, @function
main:
.LFB23:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	leaq	.LC0(%rip), %rdi
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	pushq	%r15
	pushq	%r14
	leaq	-868(%rbp), %rdx
	leaq	-872(%rbp), %rsi
	pushq	%r13
	pushq	%r12
	.cfi_offset 15, -24
	.cfi_offset 14, -32
	.cfi_offset 13, -40
	.cfi_offset 12, -48
	leaq	-464(%rbp), %r12
	pushq	%rbx
	subq	$872, %rsp
	.cfi_offset 3, -56
	movq	%fs:40, %rax
	movq	%rax, -56(%rbp)
	xorl	%eax, %eax
	call	__isoc99_scanf@PLT
	leaq	-864(%rbp), %rdi
	xorl	%eax, %eax
	movl	$50, %ecx
	movl	-872(%rbp), %r9d
	movq	%rdi, -888(%rbp)
	movq	%rdi, %r8
	rep stosq
	movl	$50, %ecx
	movq	%r12, %rdi
	rep stosq
	testl	%r9d, %r9d
	jle	.L2
	movslq	%r9d, %rbx
	xorl	%esi, %esi
	movq	%r8, %rdi
	movl	%r9d, -896(%rbp)
	leaq	0(,%rbx,4), %rdx
	call	memset@PLT
	movl	-868(%rbp), %ecx
	movl	-896(%rbp), %r9d
	testl	%ecx, %ecx
	jg	.L47
	movslq	%ecx, %rdx
	movq	%rbx, %rax
	movq	%rsp, %rsi
	imulq	%rdx, %rax
	movq	%rdx, -896(%rbp)
	addq	$15, %rax
	movq	%rax, %rdx
	andq	$-4096, %rax
	andq	$-16, %rdx
	subq	%rax, %rsi
.L21:
	cmpq	%rsi, %rsp
	je	.L26
	subq	$4096, %rsp
	orq	$0, 4088(%rsp)
	jmp	.L21
	.p2align 4,,10
	.p2align 3
.L2:
	movq	-56(%rbp), %rax
	subq	%fs:40, %rax
	jne	.L48
	leaq	-40(%rbp), %rsp
	xorl	%eax, %eax
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	.cfi_remember_state
	.cfi_def_cfa 7, 8
	ret
.L26:
	.cfi_restore_state
	movq	%rdx, %rax
	andl	$4095, %eax
	subq	%rax, %rsp
	testq	%rax, %rax
	je	.L27
	orq	$0, -8(%rsp,%rax)
.L27:
	movq	%rsp, %r15
	movl	$1, %r13d
	leaq	.LC1(%rip), %rbx
	movq	%r15, -904(%rbp)
	testl	%ecx, %ecx
	jle	.L10
	.p2align 4,,10
	.p2align 3
.L29:
	xorl	%r14d, %r14d
	.p2align 4,,10
	.p2align 3
.L8:
	xorl	%eax, %eax
	leaq	(%r15,%r14), %rsi
	movq	%rbx, %rdi
	call	__isoc99_scanf@PLT
	cmpb	$35, (%r15,%r14)
	je	.L49
	movl	-868(%rbp), %ecx
	addq	$1, %r14
	cmpl	%r14d, %ecx
	jg	.L8
.L7:
	movl	-872(%rbp), %r9d
	cmpl	%r13d, %r9d
	jle	.L10
	addq	$1, %r13
	addq	-896(%rbp), %r15
	testl	%ecx, %ecx
	jg	.L29
.L10:
	testl	%r9d, %r9d
	jle	.L2
	xorl	%r13d, %r13d
	jmp	.L11
	.p2align 4,,10
	.p2align 3
.L44:
	movl	-872(%rbp), %r9d
.L18:
	addq	$1, %r13
	movq	-896(%rbp), %rdx
	addq	%rdx, -904(%rbp)
	cmpl	%r13d, %r9d
	jle	.L2
	movl	-868(%rbp), %ecx
.L11:
	testl	%ecx, %ecx
	jle	.L18
	movq	-888(%rbp), %rax
	cmpl	$1, (%rax,%r13,4)
	jne	.L44
	xorl	%ebx, %ebx
	xorl	%eax, %eax
	jmp	.L17
	.p2align 4,,10
	.p2align 3
.L13:
	addq	$1, %rbx
	cmpl	%ebx, %ecx
	jle	.L50
.L17:
	cmpl	$1, (%r12,%rbx,4)
	jne	.L13
	movq	-904(%rbp), %rax
	movsbl	(%rax,%rbx), %edi
	addq	$1, %rbx
	call	putchar@PLT
	movl	-868(%rbp), %ecx
	cmpl	%ebx, %ecx
	jle	.L15
	movl	$1, %eax
	jmp	.L17
	.p2align 4,,10
	.p2align 3
.L49:
	movq	-888(%rbp), %rax
	movl	-868(%rbp), %ecx
	movl	$1, (%r12,%r14,4)
	addq	$1, %r14
	movl	$1, -4(%rax,%r13,4)
	cmpl	%r14d, %ecx
	jg	.L8
	jmp	.L7
	.p2align 4,,10
	.p2align 3
.L50:
	cmpl	$1, %eax
	jne	.L44
.L15:
	movl	$10, %edi
	call	putchar@PLT
	jmp	.L44
.L47:
	movslq	%ecx, %r13
	xorl	%esi, %esi
	movq	%r12, %rdi
	movl	%r9d, -908(%rbp)
	leaq	0(,%r13,4), %rdx
	movl	%ecx, -904(%rbp)
	call	memset@PLT
	movq	%rbx, %rax
	movq	%rsp, %rsi
	movq	%r13, -896(%rbp)
	imulq	%r13, %rax
	movl	-908(%rbp), %r9d
	movl	-904(%rbp), %ecx
	addq	$15, %rax
	movq	%rax, %rdx
	andq	$-4096, %rax
	andq	$-16, %rdx
	subq	%rax, %rsi
.L25:
	cmpq	%rsi, %rsp
	je	.L26
	subq	$4096, %rsp
	orq	$0, 4088(%rsp)
	jmp	.L25
.L48:
	call	__stack_chk_fail@PLT
	.cfi_endproc
.LFE23:
	.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:

/* ex 7_3
   アカウント名 */

#include <stdio.h>

#define ROW 100
#define COLUMN 100

int main(void){
    int i, j, k, row, column;
    scanf("%d %d\n", &row, &column);
    int row_flag[ROW] = {0}, column_flag[COLUMN] = {0};
    for(i = 0; i < row; i++){
        row_flag[i] = 0;
    }
    for(i = 0; i < column; i++){
        column_flag[i] = 0;
    }
    char matrix[row][column];
    for(i = 0; i < row; i++){
        for(j = 0; j < column; j++){
            scanf(" %c", &matrix[i][j]);
            if(matrix[i][j] == '#'){
                row_flag[i] = 1;
                column_flag[j] = 1;
            }
        }
    }

    for(i = 0; i < row; i++){
        k = 0;
        for(j = 0; j < column; j++){
            if(row_flag[i] == 1 && column_flag[j] == 1){
                printf("%c", matrix[i][j]);
                k = 1;
            }
        }
        if(k == 1){
            printf("\n");
        }
    }

    return 0;
}
4 4
##.#
....
##.$
.#.#
 4 5
-....
.....
..#..
.....
 7 6
..../.
....#.
.#....
..#...
..#...
......
.#..#.
 4 4
.#
....
.#
#.#.
 4 4
##.#
....
##.$
#.#.
 3 4
.#
....
.#
#-#.
 7 6
.././.
....#.
.#....
/..#..
..#...
......
.#..#.
 3 4
.#
....
.#
$-#.
 8 4
#.##
.-..
##.$
#.#.
 7 6
.././.
....#.
.#....
/..#..
..#...
......
.#..".

###
##$
.##
 #
 ..#
#..
.#.
.#.
#.#
 .#..
...#
#.#.
 ##.#
##.$
#.#.
 .#..
...#
#-#.
 ...#
#...
..#.
.#..
#..#
 #..
..#
-#.
 #.##
##.$
#.#.
 ...#
#...
..#.
.#..
#.."

Given the following C code and unoptimized assembly code, your task is to generate highly optimized x86-64 assembly code.
C Code:

```c
/* ex 7_3
   アカウント名 */

#include <stdio.h>

#define ROW 100
#define COLUMN 100

int main(void){
    int i, j, k, row, column;
    scanf("%d %d\n", &row, &column);
    int row_flag[ROW] = {0}, column_flag[COLUMN] = {0};
    for(i = 0; i < row; i++){
        row_flag[i] = 0;
    }
    for(i = 0; i < column; i++){
        column_flag[i] = 0;
    }
    char matrix[row][column];
    for(i = 0; i < row; i++){
        for(j = 0; j < column; j++){
            scanf(" %c", &matrix[i][j]);
            if(matrix[i][j] == '#'){
                row_flag[i] = 1;
                column_flag[j] = 1;
            }
        }
    }

    for(i = 0; i < row; i++){
        k = 0;
        for(j = 0; j < column; j++){
            if(row_flag[i] == 1 && column_flag[j] == 1){
                printf("%c", matrix[i][j]);
                k = 1;
            }
        }
        if(k == 1){
            printf("\n");
        }
    }

    return 0;
}```

Unoptimized Assembly Code:

```assembly
	.file	"temp.c"
	.text
	.section	.rodata
.LC0:
	.string	"%d %d\n"
.LC1:
	.string	" %c"
	.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
	pushq	%r15
	pushq	%r14
	pushq	%r13
	pushq	%r12
	pushq	%rbx
	subq	$936, %rsp
	.cfi_offset 15, -24
	.cfi_offset 14, -32
	.cfi_offset 13, -40
	.cfi_offset 12, -48
	.cfi_offset 3, -56
	movq	%fs:40, %rax
	movq	%rax, -56(%rbp)
	xorl	%eax, %eax
	movq	%rsp, %rax
	movq	%rax, -968(%rbp)
	leaq	-904(%rbp), %rdx
	leaq	-908(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	leaq	-864(%rbp), %rdx
	movl	$0, %eax
	movl	$50, %ecx
	movq	%rdx, %rdi
	rep stosq
	leaq	-464(%rbp), %rdx
	movl	$0, %eax
	movl	$50, %ecx
	movq	%rdx, %rdi
	rep stosq
	movl	$0, -900(%rbp)
	jmp	.L2
.L3:
	movl	-900(%rbp), %eax
	cltq
	movl	$0, -864(%rbp,%rax,4)
	addl	$1, -900(%rbp)
.L2:
	movl	-908(%rbp), %eax
	cmpl	%eax, -900(%rbp)
	jl	.L3
	movl	$0, -900(%rbp)
	jmp	.L4
.L5:
	movl	-900(%rbp), %eax
	cltq
	movl	$0, -464(%rbp,%rax,4)
	addl	$1, -900(%rbp)
.L4:
	movl	-904(%rbp), %eax
	cmpl	%eax, -900(%rbp)
	jl	.L5
	movl	-904(%rbp), %ecx
	movl	-908(%rbp), %esi
	movslq	%ecx, %rax
	subq	$1, %rax
	movq	%rax, -888(%rbp)
	movslq	%ecx, %rax
	movq	%rax, -960(%rbp)
	movq	$0, -952(%rbp)
	movslq	%ecx, %rbx
	movslq	%esi, %rax
	subq	$1, %rax
	movq	%rax, -880(%rbp)
	movslq	%ecx, %rax
	movq	%rax, -928(%rbp)
	movq	$0, -920(%rbp)
	movslq	%esi, %rax
	movq	%rax, -944(%rbp)
	movq	$0, -936(%rbp)
	movq	-928(%rbp), %r8
	movq	-920(%rbp), %r9
	movq	%r9, %rdx
	movq	-944(%rbp), %r10
	movq	-936(%rbp), %r11
	imulq	%r10, %rdx
	movq	%r11, %rax
	imulq	%r8, %rax
	leaq	(%rdx,%rax), %rdi
	movq	%r8, %rax
	mulq	%r10
	addq	%rdx, %rdi
	movq	%rdi, %rdx
	movslq	%ecx, %rax
	movq	%rax, %r14
	movl	$0, %r15d
	movslq	%esi, %rax
	movq	%rax, %r12
	movl	$0, %r13d
	movq	%r15, %rdx
	imulq	%r12, %rdx
	movq	%r13, %rax
	imulq	%r14, %rax
	leaq	(%rdx,%rax), %rdi
	movq	%r14, %rax
	mulq	%r12
	addq	%rdx, %rdi
	movq	%rdi, %rdx
	movslq	%ecx, %rdx
	movslq	%esi, %rax
	imulq	%rdx, %rax
	movl	$16, %edx
	subq	$1, %rdx
	addq	%rdx, %rax
	movl	$16, %esi
	movl	$0, %edx
	divq	%rsi
	imulq	$16, %rax, %rax
	movq	%rax, %rcx
	andq	$-4096, %rcx
	movq	%rsp, %rdx
	subq	%rcx, %rdx
.L6:
	cmpq	%rdx, %rsp
	je	.L7
	subq	$4096, %rsp
	orq	$0, 4088(%rsp)
	jmp	.L6
.L7:
	movq	%rax, %rdx
	andl	$4095, %edx
	subq	%rdx, %rsp
	movq	%rax, %rdx
	andl	$4095, %edx
	testq	%rdx, %rdx
	je	.L8
	andl	$4095, %eax
	subq	$8, %rax
	addq	%rsp, %rax
	orq	$0, (%rax)
.L8:
	movq	%rsp, %rax
	addq	$0, %rax
	movq	%rax, -872(%rbp)
	movl	$0, -900(%rbp)
	jmp	.L9
.L13:
	movl	$0, -896(%rbp)
	jmp	.L10
.L12:
	movl	-896(%rbp), %eax
	movslq	%eax, %rdx
	movl	-900(%rbp), %eax
	cltq
	imulq	%rbx, %rax
	addq	%rax, %rdx
	movq	-872(%rbp), %rax
	addq	%rdx, %rax
	movq	%rax, %rsi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movq	-872(%rbp), %rcx
	movl	-896(%rbp), %eax
	movslq	%eax, %rdx
	movl	-900(%rbp), %eax
	cltq
	imulq	%rbx, %rax
	addq	%rcx, %rdx
	addq	%rdx, %rax
	movzbl	(%rax), %eax
	cmpb	$35, %al
	jne	.L11
	movl	-900(%rbp), %eax
	cltq
	movl	$1, -864(%rbp,%rax,4)
	movl	-896(%rbp), %eax
	cltq
	movl	$1, -464(%rbp,%rax,4)
.L11:
	addl	$1, -896(%rbp)
.L10:
	movl	-904(%rbp), %eax
	cmpl	%eax, -896(%rbp)
	jl	.L12
	addl	$1, -900(%rbp)
.L9:
	movl	-908(%rbp), %eax
	cmpl	%eax, -900(%rbp)
	jl	.L13
	movl	$0, -900(%rbp)
	jmp	.L14
.L19:
	movl	$0, -892(%rbp)
	movl	$0, -896(%rbp)
	jmp	.L15
.L17:
	movl	-900(%rbp), %eax
	cltq
	movl	-864(%rbp,%rax,4), %eax
	cmpl	$1, %eax
	jne	.L16
	movl	-896(%rbp), %eax
	cltq
	movl	-464(%rbp,%rax,4), %eax
	cmpl	$1, %eax
	jne	.L16
	movq	-872(%rbp), %rcx
	movl	-896(%rbp), %eax
	movslq	%eax, %rdx
	movl	-900(%rbp), %eax
	cltq
	imulq	%rbx, %rax
	addq	%rcx, %rdx
	addq	%rdx, %rax
	movzbl	(%rax), %eax
	movsbl	%al, %eax
	movl	%eax, %edi
	call	putchar@PLT
	movl	$1, -892(%rbp)
.L16:
	addl	$1, -896(%rbp)
.L15:
	movl	-904(%rbp), %eax
	cmpl	%eax, -896(%rbp)
	jl	.L17
	cmpl	$1, -892(%rbp)
	jne	.L18
	movl	$10, %edi
	call	putchar@PLT
.L18:
	addl	$1, -900(%rbp)
.L14:
	movl	-908(%rbp), %eax
	cmpl	%eax, -900(%rbp)
	jl	.L19
	movl	$0, %eax
	movq	-968(%rbp), %rsp
	movq	-56(%rbp), %rdx
	subq	%fs:40, %rdx
	je	.L21
	call	__stack_chk_fail@PLT
.L21:
	leaq	-40(%rbp), %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	.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
	.section	.rodata
.LC0:
	.string	"%d %d\n"
.LC1:
	.string	" %c"
	.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
	pushq	%r15
	pushq	%r14
	pushq	%r13
	pushq	%r12
	pushq	%rbx
	subq	$936, %rsp
	.cfi_offset 15, -24
	.cfi_offset 14, -32
	.cfi_offset 13, -40
	.cfi_offset 12, -48
	.cfi_offset 3, -56
	movq	%fs:40, %rax
	movq	%rax, -56(%rbp)
	xorl	%eax, %eax
	movq	%rsp, %rax
	movq	%rax, -968(%rbp)
	leaq	-904(%rbp), %rdx
	leaq	-908(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	leaq	-864(%rbp), %rdx
	movl	$0, %eax
	movl	$50, %ecx
	movq	%rdx, %rdi
	rep stosq
	leaq	-464(%rbp), %rdx
	movl	$0, %eax
	movl	$50, %ecx
	movq	%rdx, %rdi
	rep stosq
	movl	$0, -900(%rbp)
	jmp	.L2
.L3:
	movl	-900(%rbp), %eax
	cltq
	movl	$0, -864(%rbp,%rax,4)
	addl	$1, -900(%rbp)
.L2:
	movl	-908(%rbp), %eax
	cmpl	%eax, -900(%rbp)
	jl	.L3
	movl	$0, -900(%rbp)
	jmp	.L4
.L5:
	movl	-900(%rbp), %eax
	cltq
	movl	$0, -464(%rbp,%rax,4)
	addl	$1, -900(%rbp)
.L4:
	movl	-904(%rbp), %eax
	cmpl	%eax, -900(%rbp)
	jl	.L5
	movl	-904(%rbp), %ecx
	movl	-908(%rbp), %esi
	movslq	%ecx, %rax
	subq	$1, %rax
	movq	%rax, -888(%rbp)
	movslq	%ecx, %rax
	movq	%rax, -960(%rbp)
	movq	$0, -952(%rbp)
	movslq	%ecx, %rbx
	movslq	%esi, %rax
	subq	$1, %rax
	movq	%rax, -880(%rbp)
	movslq	%ecx, %rax
	movq	%rax, -928(%rbp)
	movq	$0, -920(%rbp)
	movslq	%esi, %rax
	movq	%rax, -944(%rbp)
	movq	$0, -936(%rbp)
	movq	-928(%rbp), %r8
	movq	-920(%rbp), %r9
	movq	%r9, %rdx
	movq	-944(%rbp), %r10
	movq	-936(%rbp), %r11
	imulq	%r10, %rdx
	movq	%r11, %rax
	imulq	%r8, %rax
	leaq	(%rdx,%rax), %rdi
	movq	%r8, %rax
	mulq	%r10
	addq	%rdx, %rdi
	movq	%rdi, %rdx
	movslq	%ecx, %rax
	movq	%rax, %r14
	movl	$0, %r15d
	movslq	%esi, %rax
	movq	%rax, %r12
	movl	$0, %r13d
	movq	%r15, %rdx
	imulq	%r12, %rdx
	movq	%r13, %rax
	imulq	%r14, %rax
	leaq	(%rdx,%rax), %rdi
	movq	%r14, %rax
	mulq	%r12
	addq	%rdx, %rdi
	movq	%rdi, %rdx
	movslq	%ecx, %rdx
	movslq	%esi, %rax
	imulq	%rdx, %rax
	movl	$16, %edx
	subq	$1, %rdx
	addq	%rdx, %rax
	movl	$16, %esi
	movl	$0, %edx
	divq	%rsi
	imulq	$16, %rax, %rax
	movq	%rax, %rcx
	andq	$-4096, %rcx
	movq	%rsp, %rdx
	subq	%rcx, %rdx
.L6:
	cmpq	%rdx, %rsp
	je	.L7
	subq	$4096, %rsp
	orq	$0, 4088(%rsp)
	jmp	.L6
.L7:
	movq	%rax, %rdx
	andl	$4095, %edx
	subq	%rdx, %rsp
	movq	%rax, %rdx
	andl	$4095, %edx
	testq	%rdx, %rdx
	je	.L8
	andl	$4095, %eax
	subq	$8, %rax
	addq	%rsp, %rax
	orq	$0, (%rax)
.L8:
	movq	%rsp, %rax
	addq	$0, %rax
	movq	%rax, -872(%rbp)
	movl	$0, -900(%rbp)
	jmp	.L9
.L13:
	movl	$0, -896(%rbp)
	jmp	.L10
.L12:
	movl	-896(%rbp), %eax
	movslq	%eax, %rdx
	movl	-900(%rbp), %eax
	cltq
	imulq	%rbx, %rax
	addq	%rax, %rdx
	movq	-872(%rbp), %rax
	addq	%rdx, %rax
	movq	%rax, %rsi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movq	-872(%rbp), %rcx
	movl	-896(%rbp), %eax
	movslq	%eax, %rdx
	movl	-900(%rbp), %eax
	cltq
	imulq	%rbx, %rax
	addq	%rcx, %rdx
	addq	%rdx, %rax
	movzbl	(%rax), %eax
	cmpb	$35, %al
	jne	.L11
	movl	-900(%rbp), %eax
	cltq
	movl	$1, -864(%rbp,%rax,4)
	movl	-896(%rbp), %eax
	cltq
	movl	$1, -464(%rbp,%rax,4)
.L11:
	addl	$1, -896(%rbp)
.L10:
	movl	-904(%rbp), %eax
	cmpl	%eax, -896(%rbp)
	jl	.L12
	addl	$1, -900(%rbp)
.L9:
	movl	-908(%rbp), %eax
	cmpl	%eax, -900(%rbp)
	jl	.L13
	movl	$0, -900(%rbp)
	jmp	.L14
.L19:
	movl	$0, -892(%rbp)
	movl	$0, -896(%rbp)
	jmp	.L15
.L17:
	movl	-900(%rbp), %eax
	cltq
	movl	-864(%rbp,%rax,4), %eax
	cmpl	$1, %eax
	jne	.L16
	movl	-896(%rbp), %eax
	cltq
	movl	-464(%rbp,%rax,4), %eax
	cmpl	$1, %eax
	jne	.L16
	movq	-872(%rbp), %rcx
	movl	-896(%rbp), %eax
	movslq	%eax, %rdx
	movl	-900(%rbp), %eax
	cltq
	imulq	%rbx, %rax
	addq	%rcx, %rdx
	addq	%rdx, %rax
	movzbl	(%rax), %eax
	movsbl	%al, %eax
	movl	%eax, %edi
	call	putchar@PLT
	movl	$1, -892(%rbp)
.L16:
	addl	$1, -896(%rbp)
.L15:
	movl	-904(%rbp), %eax
	cmpl	%eax, -896(%rbp)
	jl	.L17
	cmpl	$1, -892(%rbp)
	jne	.L18
	movl	$10, %edi
	call	putchar@PLT
.L18:
	addl	$1, -900(%rbp)
.L14:
	movl	-908(%rbp), %eax
	cmpl	%eax, -900(%rbp)
	jl	.L19
	movl	$0, %eax
	movq	-968(%rbp), %rsp
	movq	-56(%rbp), %rdx
	subq	%fs:40, %rdx
	je	.L21
	call	__stack_chk_fail@PLT
.L21:
	leaq	-40(%rbp), %rsp
	popq	%rbx
	popq	%r12
	popq	%r13
	popq	%r14
	popq	%r15
	popq	%rbp
	.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:
