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
   Stuartyg */

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

int main(void){
    int height,width,i,j;
    char **array;
    int *col;
    int *row;

    scanf("%d %d",&height,&width);

    //メモリ確保
    //各行の配列へのポインタ分のメモリ領域を確保
    array = (char**)calloc(height,sizeof(char*));

    if (array == NULL){ //確保失敗
        exit(1);
    }

    for (i= 0;i<height;i++ ){
        //各行の要素分のメモリ領域を確保
        array[i] = (char*)calloc(width,sizeof(char));
        if (array[i] == NULL){ //確保失敗
            exit(1);
        }
    }
    //配列col,rowの分のメモリ領域を確保
    col = (int*)calloc(width, sizeof(int));
    if (col == NULL){ //確保失敗
        exit(1);
    }
    row = (int*)calloc(height,sizeof(int));
    if (row == NULL){ //確保失敗
        exit(1);
    }

    for (i=0;i<height;i++){
        for(j=0;j<width;j++){
            scanf(" %c",&array[i][j]); //array[i][j]の値の受取り

            //白しかない行、列があるかのチェック       
            if (array[i][j] == '#'){ //黒を含む
                row[i] = 1;
                col[j] = 1;
            }
        }
    }

    //出力
    for (i=0;i<height;i++){
        if(row[i] == 1){ //行には黒を含む
            for (j=0;j<width;j++){
                    if (col[j] == 1){ //列にも黒を含む
                        printf("%c", array[i][j]);
                    }
            }
            printf("\n"); //1行出力するごとに改行
        }
    }

    //メモリ領域の開放
    for (i= 0;i<height;i++ ){
        //各行の要素分のメモリ領域を開放
        free(array[i]);
    }

    //各行の配列へのポインタ分のメモリ領域を開放
    free(array);

    free(col);
    free(row);

    return 0;
}

```

Unoptimized Assembly Code:

```assembly
	.file	"temp.c"
	.text
	.section	.rodata
.LC0:
	.string	"%d %d"
.LC1:
	.string	" %c"
	.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
	subq	$56, %rsp
	.cfi_offset 3, -24
	movq	%fs:40, %rax
	movq	%rax, -24(%rbp)
	xorl	%eax, %eax
	leaq	-60(%rbp), %rdx
	leaq	-64(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	-64(%rbp), %eax
	cltq
	movl	$8, %esi
	movq	%rax, %rdi
	call	calloc@PLT
	movq	%rax, -48(%rbp)
	cmpq	$0, -48(%rbp)
	jne	.L2
	movl	$1, %edi
	call	exit@PLT
.L2:
	movl	$0, -56(%rbp)
	jmp	.L3
.L5:
	movl	-60(%rbp), %eax
	cltq
	movl	-56(%rbp), %edx
	movslq	%edx, %rdx
	leaq	0(,%rdx,8), %rcx
	movq	-48(%rbp), %rdx
	leaq	(%rcx,%rdx), %rbx
	movl	$1, %esi
	movq	%rax, %rdi
	call	calloc@PLT
	movq	%rax, (%rbx)
	movl	-56(%rbp), %eax
	cltq
	leaq	0(,%rax,8), %rdx
	movq	-48(%rbp), %rax
	addq	%rdx, %rax
	movq	(%rax), %rax
	testq	%rax, %rax
	jne	.L4
	movl	$1, %edi
	call	exit@PLT
.L4:
	addl	$1, -56(%rbp)
.L3:
	movl	-64(%rbp), %eax
	cmpl	%eax, -56(%rbp)
	jl	.L5
	movl	-60(%rbp), %eax
	cltq
	movl	$4, %esi
	movq	%rax, %rdi
	call	calloc@PLT
	movq	%rax, -40(%rbp)
	cmpq	$0, -40(%rbp)
	jne	.L6
	movl	$1, %edi
	call	exit@PLT
.L6:
	movl	-64(%rbp), %eax
	cltq
	movl	$4, %esi
	movq	%rax, %rdi
	call	calloc@PLT
	movq	%rax, -32(%rbp)
	cmpq	$0, -32(%rbp)
	jne	.L7
	movl	$1, %edi
	call	exit@PLT
.L7:
	movl	$0, -56(%rbp)
	jmp	.L8
.L12:
	movl	$0, -52(%rbp)
	jmp	.L9
.L11:
	movl	-56(%rbp), %eax
	cltq
	leaq	0(,%rax,8), %rdx
	movq	-48(%rbp), %rax
	addq	%rdx, %rax
	movq	(%rax), %rdx
	movl	-52(%rbp), %eax
	cltq
	addq	%rdx, %rax
	movq	%rax, %rsi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	-56(%rbp), %eax
	cltq
	leaq	0(,%rax,8), %rdx
	movq	-48(%rbp), %rax
	addq	%rdx, %rax
	movq	(%rax), %rdx
	movl	-52(%rbp), %eax
	cltq
	addq	%rdx, %rax
	movzbl	(%rax), %eax
	cmpb	$35, %al
	jne	.L10
	movl	-56(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	movq	-32(%rbp), %rax
	addq	%rdx, %rax
	movl	$1, (%rax)
	movl	-52(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	movq	-40(%rbp), %rax
	addq	%rdx, %rax
	movl	$1, (%rax)
.L10:
	addl	$1, -52(%rbp)
.L9:
	movl	-60(%rbp), %eax
	cmpl	%eax, -52(%rbp)
	jl	.L11
	addl	$1, -56(%rbp)
.L8:
	movl	-64(%rbp), %eax
	cmpl	%eax, -56(%rbp)
	jl	.L12
	movl	$0, -56(%rbp)
	jmp	.L13
.L18:
	movl	-56(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	movq	-32(%rbp), %rax
	addq	%rdx, %rax
	movl	(%rax), %eax
	cmpl	$1, %eax
	jne	.L14
	movl	$0, -52(%rbp)
	jmp	.L15
.L17:
	movl	-52(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	movq	-40(%rbp), %rax
	addq	%rdx, %rax
	movl	(%rax), %eax
	cmpl	$1, %eax
	jne	.L16
	movl	-56(%rbp), %eax
	cltq
	leaq	0(,%rax,8), %rdx
	movq	-48(%rbp), %rax
	addq	%rdx, %rax
	movq	(%rax), %rdx
	movl	-52(%rbp), %eax
	cltq
	addq	%rdx, %rax
	movzbl	(%rax), %eax
	movsbl	%al, %eax
	movl	%eax, %edi
	call	putchar@PLT
.L16:
	addl	$1, -52(%rbp)
.L15:
	movl	-60(%rbp), %eax
	cmpl	%eax, -52(%rbp)
	jl	.L17
	movl	$10, %edi
	call	putchar@PLT
.L14:
	addl	$1, -56(%rbp)
.L13:
	movl	-64(%rbp), %eax
	cmpl	%eax, -56(%rbp)
	jl	.L18
	movl	$0, -56(%rbp)
	jmp	.L19
.L20:
	movl	-56(%rbp), %eax
	cltq
	leaq	0(,%rax,8), %rdx
	movq	-48(%rbp), %rax
	addq	%rdx, %rax
	movq	(%rax), %rax
	movq	%rax, %rdi
	call	free@PLT
	addl	$1, -56(%rbp)
.L19:
	movl	-64(%rbp), %eax
	cmpl	%eax, -56(%rbp)
	jl	.L20
	movq	-48(%rbp), %rax
	movq	%rax, %rdi
	call	free@PLT
	movq	-40(%rbp), %rax
	movq	%rax, %rdi
	call	free@PLT
	movq	-32(%rbp), %rax
	movq	%rax, %rdi
	call	free@PLT
	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	" %c"
	.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
	leaq	.LC0(%rip), %rdi
	pushq	%r14
	.cfi_def_cfa_offset 24
	.cfi_offset 14, -24
	pushq	%r13
	.cfi_def_cfa_offset 32
	.cfi_offset 13, -32
	pushq	%r12
	.cfi_def_cfa_offset 40
	.cfi_offset 12, -40
	pushq	%rbp
	.cfi_def_cfa_offset 48
	.cfi_offset 6, -48
	pushq	%rbx
	.cfi_def_cfa_offset 56
	.cfi_offset 3, -56
	subq	$40, %rsp
	.cfi_def_cfa_offset 96
	movq	%fs:40, %rax
	movq	%rax, 24(%rsp)
	xorl	%eax, %eax
	leaq	20(%rsp), %rdx
	leaq	16(%rsp), %rsi
	call	__isoc99_scanf@PLT
	movslq	16(%rsp), %rbp
	movl	$8, %esi
	movq	%rbp, %rdi
	call	calloc@PLT
	movq	%rax, 8(%rsp)
	testq	%rax, %rax
	je	.L2
	movslq	20(%rsp), %r14
	movq	%rbp, %rbx
	movq	%r14, %r15
	testl	%ebp, %ebp
	jle	.L6
	movq	%rax, %rcx
	movq	%rax, %r13
	movl	%ebp, %eax
	leaq	(%rcx,%rax,8), %r12
	.p2align 4,,10
	.p2align 3
.L5:
	movl	$1, %esi
	movq	%r14, %rdi
	call	calloc@PLT
	movq	%rax, 0(%r13)
	testq	%rax, %rax
	je	.L2
	addq	$8, %r13
	cmpq	%r13, %r12
	jne	.L5
.L6:
	movl	$4, %esi
	movq	%r14, %rdi
	call	calloc@PLT
	movq	%rax, %r13
	testq	%rax, %rax
	je	.L2
	movl	$4, %esi
	movq	%rbp, %rdi
	call	calloc@PLT
	movq	%rax, (%rsp)
	testq	%rax, %rax
	je	.L2
	movl	$1, %r12d
	leaq	.LC1(%rip), %rbp
	testl	%ebx, %ebx
	jle	.L22
	testl	%r15d, %r15d
	jle	.L14
	.p2align 4,,10
	.p2align 3
.L15:
	movq	8(%rsp), %rax
	xorl	%ebx, %ebx
	movq	-8(%rax,%r12,8), %r14
	.p2align 4,,10
	.p2align 3
.L12:
	xorl	%eax, %eax
	leaq	(%r14,%rbx), %rsi
	movq	%rbp, %rdi
	call	__isoc99_scanf@PLT
	cmpb	$35, (%r14,%rbx)
	je	.L44
	movl	20(%rsp), %r15d
	addq	$1, %rbx
	cmpl	%ebx, %r15d
	jg	.L12
.L11:
	movl	16(%rsp), %ebx
	cmpl	%r12d, %ebx
	jle	.L14
	addq	$1, %r12
	testl	%r15d, %r15d
	jg	.L15
.L14:
	testl	%ebx, %ebx
	jle	.L22
	xorl	%ebp, %ebp
	jmp	.L21
	.p2align 4,,10
	.p2align 3
.L16:
	addq	$1, %rbp
	cmpl	%ebp, %ebx
	jle	.L45
.L21:
	movq	(%rsp), %rax
	cmpl	$1, (%rax,%rbp,4)
	jne	.L16
	movl	20(%rsp), %eax
	xorl	%ebx, %ebx
	testl	%eax, %eax
	jle	.L20
	.p2align 4,,10
	.p2align 3
.L17:
	cmpl	$1, 0(%r13,%rbx,4)
	je	.L46
	addq	$1, %rbx
	cmpl	%ebx, %eax
	jg	.L17
.L20:
	movl	$10, %edi
	addq	$1, %rbp
	call	putchar@PLT
	movl	16(%rsp), %ebx
	cmpl	%ebp, %ebx
	jg	.L21
	.p2align 4,,10
	.p2align 3
.L45:
	testl	%ebx, %ebx
	jle	.L22
	movq	8(%rsp), %rdx
	leal	-1(%rbx), %eax
	movq	%rdx, %rbp
	leaq	8(%rdx,%rax,8), %rbx
	.p2align 4,,10
	.p2align 3
.L23:
	movq	0(%rbp), %rdi
	addq	$8, %rbp
	call	free@PLT
	cmpq	%rbx, %rbp
	jne	.L23
.L22:
	movq	8(%rsp), %rdi
	call	free@PLT
	movq	%r13, %rdi
	call	free@PLT
	movq	(%rsp), %rdi
	call	free@PLT
	movq	24(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L47
	addq	$40, %rsp
	.cfi_remember_state
	.cfi_def_cfa_offset 56
	xorl	%eax, %eax
	popq	%rbx
	.cfi_def_cfa_offset 48
	popq	%rbp
	.cfi_def_cfa_offset 40
	popq	%r12
	.cfi_def_cfa_offset 32
	popq	%r13
	.cfi_def_cfa_offset 24
	popq	%r14
	.cfi_def_cfa_offset 16
	popq	%r15
	.cfi_def_cfa_offset 8
	ret
	.p2align 4,,10
	.p2align 3
.L44:
	.cfi_restore_state
	movq	(%rsp), %rax
	movl	20(%rsp), %r15d
	movl	$1, 0(%r13,%rbx,4)
	addq	$1, %rbx
	movl	$1, -4(%rax,%r12,4)
	cmpl	%ebx, %r15d
	jg	.L12
	jmp	.L11
	.p2align 4,,10
	.p2align 3
.L46:
	movq	8(%rsp), %rax
	movq	(%rax,%rbp,8), %rax
	movsbl	(%rax,%rbx), %edi
	addq	$1, %rbx
	call	putchar@PLT
	movl	20(%rsp), %eax
	cmpl	%ebx, %eax
	jg	.L17
	jmp	.L20
.L2:
	movl	$1, %edi
	call	exit@PLT
.L47:
	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	" %c"
	.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
	leaq	.LC0(%rip), %rdi
	pushq	%r14
	.cfi_def_cfa_offset 24
	.cfi_offset 14, -24
	pushq	%r13
	.cfi_def_cfa_offset 32
	.cfi_offset 13, -32
	pushq	%r12
	.cfi_def_cfa_offset 40
	.cfi_offset 12, -40
	pushq	%rbp
	.cfi_def_cfa_offset 48
	.cfi_offset 6, -48
	pushq	%rbx
	.cfi_def_cfa_offset 56
	.cfi_offset 3, -56
	subq	$40, %rsp
	.cfi_def_cfa_offset 96
	movq	%fs:40, %rax
	movq	%rax, 24(%rsp)
	xorl	%eax, %eax
	leaq	20(%rsp), %rdx
	leaq	16(%rsp), %rsi
	call	__isoc99_scanf@PLT
	movslq	16(%rsp), %rbp
	movl	$8, %esi
	movq	%rbp, %rdi
	call	calloc@PLT
	movq	%rax, 8(%rsp)
	testq	%rax, %rax
	je	.L2
	movslq	20(%rsp), %r14
	movq	%rbp, %rbx
	movq	%r14, %r15
	testl	%ebp, %ebp
	jle	.L6
	movq	%rax, %rcx
	movq	%rax, %r13
	movl	%ebp, %eax
	leaq	(%rcx,%rax,8), %r12
	.p2align 4,,10
	.p2align 3
.L5:
	movl	$1, %esi
	movq	%r14, %rdi
	call	calloc@PLT
	movq	%rax, 0(%r13)
	testq	%rax, %rax
	je	.L2
	addq	$8, %r13
	cmpq	%r13, %r12
	jne	.L5
.L6:
	movl	$4, %esi
	movq	%r14, %rdi
	call	calloc@PLT
	movq	%rax, %r13
	testq	%rax, %rax
	je	.L2
	movl	$4, %esi
	movq	%rbp, %rdi
	call	calloc@PLT
	movq	%rax, (%rsp)
	testq	%rax, %rax
	je	.L2
	movl	$1, %r12d
	leaq	.LC1(%rip), %rbp
	testl	%ebx, %ebx
	jle	.L22
	testl	%r15d, %r15d
	jle	.L14
	.p2align 4,,10
	.p2align 3
.L15:
	movq	8(%rsp), %rax
	xorl	%ebx, %ebx
	movq	-8(%rax,%r12,8), %r14
	.p2align 4,,10
	.p2align 3
.L12:
	xorl	%eax, %eax
	leaq	(%r14,%rbx), %rsi
	movq	%rbp, %rdi
	call	__isoc99_scanf@PLT
	cmpb	$35, (%r14,%rbx)
	je	.L44
	movl	20(%rsp), %r15d
	addq	$1, %rbx
	cmpl	%ebx, %r15d
	jg	.L12
.L11:
	movl	16(%rsp), %ebx
	cmpl	%r12d, %ebx
	jle	.L14
	addq	$1, %r12
	testl	%r15d, %r15d
	jg	.L15
.L14:
	testl	%ebx, %ebx
	jle	.L22
	xorl	%ebp, %ebp
	jmp	.L21
	.p2align 4,,10
	.p2align 3
.L16:
	addq	$1, %rbp
	cmpl	%ebp, %ebx
	jle	.L45
.L21:
	movq	(%rsp), %rax
	cmpl	$1, (%rax,%rbp,4)
	jne	.L16
	movl	20(%rsp), %eax
	xorl	%ebx, %ebx
	testl	%eax, %eax
	jle	.L20
	.p2align 4,,10
	.p2align 3
.L17:
	cmpl	$1, 0(%r13,%rbx,4)
	je	.L46
	addq	$1, %rbx
	cmpl	%ebx, %eax
	jg	.L17
.L20:
	movl	$10, %edi
	addq	$1, %rbp
	call	putchar@PLT
	movl	16(%rsp), %ebx
	cmpl	%ebp, %ebx
	jg	.L21
	.p2align 4,,10
	.p2align 3
.L45:
	testl	%ebx, %ebx
	jle	.L22
	movq	8(%rsp), %rdx
	leal	-1(%rbx), %eax
	movq	%rdx, %rbp
	leaq	8(%rdx,%rax,8), %rbx
	.p2align 4,,10
	.p2align 3
.L23:
	movq	0(%rbp), %rdi
	addq	$8, %rbp
	call	free@PLT
	cmpq	%rbx, %rbp
	jne	.L23
.L22:
	movq	8(%rsp), %rdi
	call	free@PLT
	movq	%r13, %rdi
	call	free@PLT
	movq	(%rsp), %rdi
	call	free@PLT
	movq	24(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L47
	addq	$40, %rsp
	.cfi_remember_state
	.cfi_def_cfa_offset 56
	xorl	%eax, %eax
	popq	%rbx
	.cfi_def_cfa_offset 48
	popq	%rbp
	.cfi_def_cfa_offset 40
	popq	%r12
	.cfi_def_cfa_offset 32
	popq	%r13
	.cfi_def_cfa_offset 24
	popq	%r14
	.cfi_def_cfa_offset 16
	popq	%r15
	.cfi_def_cfa_offset 8
	ret
	.p2align 4,,10
	.p2align 3
.L44:
	.cfi_restore_state
	movq	(%rsp), %rax
	movl	20(%rsp), %r15d
	movl	$1, 0(%r13,%rbx,4)
	addq	$1, %rbx
	movl	$1, -4(%rax,%r12,4)
	cmpl	%ebx, %r15d
	jg	.L12
	jmp	.L11
	.p2align 4,,10
	.p2align 3
.L46:
	movq	8(%rsp), %rax
	movq	(%rax,%rbp,8), %rax
	movsbl	(%rax,%rbx), %edi
	addq	$1, %rbx
	call	putchar@PLT
	movl	20(%rsp), %eax
	cmpl	%ebx, %eax
	jg	.L17
	jmp	.L20
.L2:
	movl	$1, %edi
	call	exit@PLT
.L47:
	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:

/* ex 7_3
   Stuartyg */

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

int main(void){
    int height,width,i,j;
    char **array;
    int *col;
    int *row;

    scanf("%d %d",&height,&width);

    //メモリ確保
    //各行の配列へのポインタ分のメモリ領域を確保
    array = (char**)calloc(height,sizeof(char*));

    if (array == NULL){ //確保失敗
        exit(1);
    }

    for (i= 0;i<height;i++ ){
        //各行の要素分のメモリ領域を確保
        array[i] = (char*)calloc(width,sizeof(char));
        if (array[i] == NULL){ //確保失敗
            exit(1);
        }
    }
    //配列col,rowの分のメモリ領域を確保
    col = (int*)calloc(width, sizeof(int));
    if (col == NULL){ //確保失敗
        exit(1);
    }
    row = (int*)calloc(height,sizeof(int));
    if (row == NULL){ //確保失敗
        exit(1);
    }

    for (i=0;i<height;i++){
        for(j=0;j<width;j++){
            scanf(" %c",&array[i][j]); //array[i][j]の値の受取り

            //白しかない行、列があるかのチェック       
            if (array[i][j] == '#'){ //黒を含む
                row[i] = 1;
                col[j] = 1;
            }
        }
    }

    //出力
    for (i=0;i<height;i++){
        if(row[i] == 1){ //行には黒を含む
            for (j=0;j<width;j++){
                    if (col[j] == 1){ //列にも黒を含む
                        printf("%c", array[i][j]);
                    }
            }
            printf("\n"); //1行出力するごとに改行
        }
    }

    //メモリ領域の開放
    for (i= 0;i<height;i++ ){
        //各行の要素分のメモリ領域を開放
        free(array[i]);
    }

    //各行の配列へのポインタ分のメモリ領域を開放
    free(array);

    free(col);
    free(row);

    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
   Stuartyg */

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

int main(void){
    int height,width,i,j;
    char **array;
    int *col;
    int *row;

    scanf("%d %d",&height,&width);

    //メモリ確保
    //各行の配列へのポインタ分のメモリ領域を確保
    array = (char**)calloc(height,sizeof(char*));

    if (array == NULL){ //確保失敗
        exit(1);
    }

    for (i= 0;i<height;i++ ){
        //各行の要素分のメモリ領域を確保
        array[i] = (char*)calloc(width,sizeof(char));
        if (array[i] == NULL){ //確保失敗
            exit(1);
        }
    }
    //配列col,rowの分のメモリ領域を確保
    col = (int*)calloc(width, sizeof(int));
    if (col == NULL){ //確保失敗
        exit(1);
    }
    row = (int*)calloc(height,sizeof(int));
    if (row == NULL){ //確保失敗
        exit(1);
    }

    for (i=0;i<height;i++){
        for(j=0;j<width;j++){
            scanf(" %c",&array[i][j]); //array[i][j]の値の受取り

            //白しかない行、列があるかのチェック       
            if (array[i][j] == '#'){ //黒を含む
                row[i] = 1;
                col[j] = 1;
            }
        }
    }

    //出力
    for (i=0;i<height;i++){
        if(row[i] == 1){ //行には黒を含む
            for (j=0;j<width;j++){
                    if (col[j] == 1){ //列にも黒を含む
                        printf("%c", array[i][j]);
                    }
            }
            printf("\n"); //1行出力するごとに改行
        }
    }

    //メモリ領域の開放
    for (i= 0;i<height;i++ ){
        //各行の要素分のメモリ領域を開放
        free(array[i]);
    }

    //各行の配列へのポインタ分のメモリ領域を開放
    free(array);

    free(col);
    free(row);

    return 0;
}

```

Unoptimized Assembly Code:

```assembly
	.file	"temp.c"
	.text
	.section	.rodata
.LC0:
	.string	"%d %d"
.LC1:
	.string	" %c"
	.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
	subq	$56, %rsp
	.cfi_offset 3, -24
	movq	%fs:40, %rax
	movq	%rax, -24(%rbp)
	xorl	%eax, %eax
	leaq	-60(%rbp), %rdx
	leaq	-64(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	-64(%rbp), %eax
	cltq
	movl	$8, %esi
	movq	%rax, %rdi
	call	calloc@PLT
	movq	%rax, -48(%rbp)
	cmpq	$0, -48(%rbp)
	jne	.L2
	movl	$1, %edi
	call	exit@PLT
.L2:
	movl	$0, -56(%rbp)
	jmp	.L3
.L5:
	movl	-60(%rbp), %eax
	cltq
	movl	-56(%rbp), %edx
	movslq	%edx, %rdx
	leaq	0(,%rdx,8), %rcx
	movq	-48(%rbp), %rdx
	leaq	(%rcx,%rdx), %rbx
	movl	$1, %esi
	movq	%rax, %rdi
	call	calloc@PLT
	movq	%rax, (%rbx)
	movl	-56(%rbp), %eax
	cltq
	leaq	0(,%rax,8), %rdx
	movq	-48(%rbp), %rax
	addq	%rdx, %rax
	movq	(%rax), %rax
	testq	%rax, %rax
	jne	.L4
	movl	$1, %edi
	call	exit@PLT
.L4:
	addl	$1, -56(%rbp)
.L3:
	movl	-64(%rbp), %eax
	cmpl	%eax, -56(%rbp)
	jl	.L5
	movl	-60(%rbp), %eax
	cltq
	movl	$4, %esi
	movq	%rax, %rdi
	call	calloc@PLT
	movq	%rax, -40(%rbp)
	cmpq	$0, -40(%rbp)
	jne	.L6
	movl	$1, %edi
	call	exit@PLT
.L6:
	movl	-64(%rbp), %eax
	cltq
	movl	$4, %esi
	movq	%rax, %rdi
	call	calloc@PLT
	movq	%rax, -32(%rbp)
	cmpq	$0, -32(%rbp)
	jne	.L7
	movl	$1, %edi
	call	exit@PLT
.L7:
	movl	$0, -56(%rbp)
	jmp	.L8
.L12:
	movl	$0, -52(%rbp)
	jmp	.L9
.L11:
	movl	-56(%rbp), %eax
	cltq
	leaq	0(,%rax,8), %rdx
	movq	-48(%rbp), %rax
	addq	%rdx, %rax
	movq	(%rax), %rdx
	movl	-52(%rbp), %eax
	cltq
	addq	%rdx, %rax
	movq	%rax, %rsi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	-56(%rbp), %eax
	cltq
	leaq	0(,%rax,8), %rdx
	movq	-48(%rbp), %rax
	addq	%rdx, %rax
	movq	(%rax), %rdx
	movl	-52(%rbp), %eax
	cltq
	addq	%rdx, %rax
	movzbl	(%rax), %eax
	cmpb	$35, %al
	jne	.L10
	movl	-56(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	movq	-32(%rbp), %rax
	addq	%rdx, %rax
	movl	$1, (%rax)
	movl	-52(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	movq	-40(%rbp), %rax
	addq	%rdx, %rax
	movl	$1, (%rax)
.L10:
	addl	$1, -52(%rbp)
.L9:
	movl	-60(%rbp), %eax
	cmpl	%eax, -52(%rbp)
	jl	.L11
	addl	$1, -56(%rbp)
.L8:
	movl	-64(%rbp), %eax
	cmpl	%eax, -56(%rbp)
	jl	.L12
	movl	$0, -56(%rbp)
	jmp	.L13
.L18:
	movl	-56(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	movq	-32(%rbp), %rax
	addq	%rdx, %rax
	movl	(%rax), %eax
	cmpl	$1, %eax
	jne	.L14
	movl	$0, -52(%rbp)
	jmp	.L15
.L17:
	movl	-52(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	movq	-40(%rbp), %rax
	addq	%rdx, %rax
	movl	(%rax), %eax
	cmpl	$1, %eax
	jne	.L16
	movl	-56(%rbp), %eax
	cltq
	leaq	0(,%rax,8), %rdx
	movq	-48(%rbp), %rax
	addq	%rdx, %rax
	movq	(%rax), %rdx
	movl	-52(%rbp), %eax
	cltq
	addq	%rdx, %rax
	movzbl	(%rax), %eax
	movsbl	%al, %eax
	movl	%eax, %edi
	call	putchar@PLT
.L16:
	addl	$1, -52(%rbp)
.L15:
	movl	-60(%rbp), %eax
	cmpl	%eax, -52(%rbp)
	jl	.L17
	movl	$10, %edi
	call	putchar@PLT
.L14:
	addl	$1, -56(%rbp)
.L13:
	movl	-64(%rbp), %eax
	cmpl	%eax, -56(%rbp)
	jl	.L18
	movl	$0, -56(%rbp)
	jmp	.L19
.L20:
	movl	-56(%rbp), %eax
	cltq
	leaq	0(,%rax,8), %rdx
	movq	-48(%rbp), %rax
	addq	%rdx, %rax
	movq	(%rax), %rax
	movq	%rax, %rdi
	call	free@PLT
	addl	$1, -56(%rbp)
.L19:
	movl	-64(%rbp), %eax
	cmpl	%eax, -56(%rbp)
	jl	.L20
	movq	-48(%rbp), %rax
	movq	%rax, %rdi
	call	free@PLT
	movq	-40(%rbp), %rax
	movq	%rax, %rdi
	call	free@PLT
	movq	-32(%rbp), %rax
	movq	%rax, %rdi
	call	free@PLT
	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	" %c"
	.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
	subq	$56, %rsp
	.cfi_offset 3, -24
	movq	%fs:40, %rax
	movq	%rax, -24(%rbp)
	xorl	%eax, %eax
	leaq	-60(%rbp), %rdx
	leaq	-64(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	-64(%rbp), %eax
	cltq
	movl	$8, %esi
	movq	%rax, %rdi
	call	calloc@PLT
	movq	%rax, -48(%rbp)
	cmpq	$0, -48(%rbp)
	jne	.L2
	movl	$1, %edi
	call	exit@PLT
.L2:
	movl	$0, -56(%rbp)
	jmp	.L3
.L5:
	movl	-60(%rbp), %eax
	cltq
	movl	-56(%rbp), %edx
	movslq	%edx, %rdx
	leaq	0(,%rdx,8), %rcx
	movq	-48(%rbp), %rdx
	leaq	(%rcx,%rdx), %rbx
	movl	$1, %esi
	movq	%rax, %rdi
	call	calloc@PLT
	movq	%rax, (%rbx)
	movl	-56(%rbp), %eax
	cltq
	leaq	0(,%rax,8), %rdx
	movq	-48(%rbp), %rax
	addq	%rdx, %rax
	movq	(%rax), %rax
	testq	%rax, %rax
	jne	.L4
	movl	$1, %edi
	call	exit@PLT
.L4:
	addl	$1, -56(%rbp)
.L3:
	movl	-64(%rbp), %eax
	cmpl	%eax, -56(%rbp)
	jl	.L5
	movl	-60(%rbp), %eax
	cltq
	movl	$4, %esi
	movq	%rax, %rdi
	call	calloc@PLT
	movq	%rax, -40(%rbp)
	cmpq	$0, -40(%rbp)
	jne	.L6
	movl	$1, %edi
	call	exit@PLT
.L6:
	movl	-64(%rbp), %eax
	cltq
	movl	$4, %esi
	movq	%rax, %rdi
	call	calloc@PLT
	movq	%rax, -32(%rbp)
	cmpq	$0, -32(%rbp)
	jne	.L7
	movl	$1, %edi
	call	exit@PLT
.L7:
	movl	$0, -56(%rbp)
	jmp	.L8
.L12:
	movl	$0, -52(%rbp)
	jmp	.L9
.L11:
	movl	-56(%rbp), %eax
	cltq
	leaq	0(,%rax,8), %rdx
	movq	-48(%rbp), %rax
	addq	%rdx, %rax
	movq	(%rax), %rdx
	movl	-52(%rbp), %eax
	cltq
	addq	%rdx, %rax
	movq	%rax, %rsi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	-56(%rbp), %eax
	cltq
	leaq	0(,%rax,8), %rdx
	movq	-48(%rbp), %rax
	addq	%rdx, %rax
	movq	(%rax), %rdx
	movl	-52(%rbp), %eax
	cltq
	addq	%rdx, %rax
	movzbl	(%rax), %eax
	cmpb	$35, %al
	jne	.L10
	movl	-56(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	movq	-32(%rbp), %rax
	addq	%rdx, %rax
	movl	$1, (%rax)
	movl	-52(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	movq	-40(%rbp), %rax
	addq	%rdx, %rax
	movl	$1, (%rax)
.L10:
	addl	$1, -52(%rbp)
.L9:
	movl	-60(%rbp), %eax
	cmpl	%eax, -52(%rbp)
	jl	.L11
	addl	$1, -56(%rbp)
.L8:
	movl	-64(%rbp), %eax
	cmpl	%eax, -56(%rbp)
	jl	.L12
	movl	$0, -56(%rbp)
	jmp	.L13
.L18:
	movl	-56(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	movq	-32(%rbp), %rax
	addq	%rdx, %rax
	movl	(%rax), %eax
	cmpl	$1, %eax
	jne	.L14
	movl	$0, -52(%rbp)
	jmp	.L15
.L17:
	movl	-52(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	movq	-40(%rbp), %rax
	addq	%rdx, %rax
	movl	(%rax), %eax
	cmpl	$1, %eax
	jne	.L16
	movl	-56(%rbp), %eax
	cltq
	leaq	0(,%rax,8), %rdx
	movq	-48(%rbp), %rax
	addq	%rdx, %rax
	movq	(%rax), %rdx
	movl	-52(%rbp), %eax
	cltq
	addq	%rdx, %rax
	movzbl	(%rax), %eax
	movsbl	%al, %eax
	movl	%eax, %edi
	call	putchar@PLT
.L16:
	addl	$1, -52(%rbp)
.L15:
	movl	-60(%rbp), %eax
	cmpl	%eax, -52(%rbp)
	jl	.L17
	movl	$10, %edi
	call	putchar@PLT
.L14:
	addl	$1, -56(%rbp)
.L13:
	movl	-64(%rbp), %eax
	cmpl	%eax, -56(%rbp)
	jl	.L18
	movl	$0, -56(%rbp)
	jmp	.L19
.L20:
	movl	-56(%rbp), %eax
	cltq
	leaq	0(,%rax,8), %rdx
	movq	-48(%rbp), %rax
	addq	%rdx, %rax
	movq	(%rax), %rax
	movq	%rax, %rdi
	call	free@PLT
	addl	$1, -56(%rbp)
.L19:
	movl	-64(%rbp), %eax
	cmpl	%eax, -56(%rbp)
	jl	.L20
	movq	-48(%rbp), %rax
	movq	%rax, %rdi
	call	free@PLT
	movq	-40(%rbp), %rax
	movq	%rax, %rdi
	call	free@PLT
	movq	-32(%rbp), %rax
	movq	%rax, %rdi
	call	free@PLT
	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:
