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

```c
// ABC054 B - Template Matching
#include <stdio.h>
#include <string.h>

int main(void) {
    int N, M;
    scanf("%d %d", &N, &M);
    char A[50][51];
    char B[50][51];
    char joinA[2501] = {'\0'};
    char joinB[2501] = {'\0'};
    int i;
    for (i = 0; i < N; i++) {
        scanf("%s", A[i]);
    }
    for (i = 0; i < M; i++) {
        scanf("%s", B[i]);
    }

    for (i = 0; i < M; i++) {
        strcat(joinB, B[i]);
    }
    int x, y;
    for (y = 0; y < (N - M + 1); y++) {
        for (x = 0; x < (N - M + 1); x++) {
            if (A[y][x] == joinB[0]) {
                // joinAを作る
                for (i = 0; i < M; i++) {
                    strncat(joinA, &A[y + i][x], M);
                }
                // printf("joinA:%s\n",joinA);
                // joinA=joinBならYes
                if (strcmp(joinA, joinB) == 0) {
                    printf("Yes\n");
                    return 0;
                }
                joinA[0] = '\0';
            }
        }
    }

    printf("No\n");
    return 0;

}```

Unoptimized Assembly Code:

```assembly
	.file	"temp.c"
	.text
	.section	.rodata
.LC0:
	.string	"%d %d"
.LC1:
	.string	"%s"
.LC2:
	.string	"Yes"
.LC3:
	.string	"No"
	.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
	subq	$4096, %rsp
	orq	$0, (%rsp)
	subq	$4096, %rsp
	orq	$0, (%rsp)
	subq	$1984, %rsp
	movq	%fs:40, %rax
	movq	%rax, -8(%rbp)
	xorl	%eax, %eax
	leaq	-10160(%rbp), %rdx
	leaq	-10164(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movq	$0, -5024(%rbp)
	movq	$0, -5016(%rbp)
	leaq	-5008(%rbp), %rdx
	movl	$0, %eax
	movl	$310, %ecx
	movq	%rdx, %rdi
	rep stosq
	movq	%rdi, %rdx
	movl	%eax, (%rdx)
	addq	$4, %rdx
	movb	%al, (%rdx)
	addq	$1, %rdx
	movq	$0, -2512(%rbp)
	movq	$0, -2504(%rbp)
	leaq	-2496(%rbp), %rdx
	movl	$0, %eax
	movl	$310, %ecx
	movq	%rdx, %rdi
	rep stosq
	movq	%rdi, %rdx
	movl	%eax, (%rdx)
	addq	$4, %rdx
	movb	%al, (%rdx)
	addq	$1, %rdx
	movl	$0, -10156(%rbp)
	jmp	.L2
.L3:
	leaq	-10144(%rbp), %rcx
	movl	-10156(%rbp), %eax
	movslq	%eax, %rdx
	movq	%rdx, %rax
	addq	%rax, %rax
	addq	%rdx, %rax
	movq	%rax, %rdx
	salq	$4, %rdx
	addq	%rdx, %rax
	addq	%rcx, %rax
	movq	%rax, %rsi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	addl	$1, -10156(%rbp)
.L2:
	movl	-10164(%rbp), %eax
	cmpl	%eax, -10156(%rbp)
	jl	.L3
	movl	$0, -10156(%rbp)
	jmp	.L4
.L5:
	leaq	-7584(%rbp), %rcx
	movl	-10156(%rbp), %eax
	movslq	%eax, %rdx
	movq	%rdx, %rax
	addq	%rax, %rax
	addq	%rdx, %rax
	movq	%rax, %rdx
	salq	$4, %rdx
	addq	%rdx, %rax
	addq	%rcx, %rax
	movq	%rax, %rsi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	addl	$1, -10156(%rbp)
.L4:
	movl	-10160(%rbp), %eax
	cmpl	%eax, -10156(%rbp)
	jl	.L5
	movl	$0, -10156(%rbp)
	jmp	.L6
.L7:
	leaq	-7584(%rbp), %rcx
	movl	-10156(%rbp), %eax
	movslq	%eax, %rdx
	movq	%rdx, %rax
	addq	%rax, %rax
	addq	%rdx, %rax
	movq	%rax, %rdx
	salq	$4, %rdx
	addq	%rdx, %rax
	leaq	(%rcx,%rax), %rdx
	leaq	-2512(%rbp), %rax
	movq	%rdx, %rsi
	movq	%rax, %rdi
	call	strcat@PLT
	addl	$1, -10156(%rbp)
.L6:
	movl	-10160(%rbp), %eax
	cmpl	%eax, -10156(%rbp)
	jl	.L7
	movl	$0, -10148(%rbp)
	jmp	.L8
.L16:
	movl	$0, -10152(%rbp)
	jmp	.L9
.L15:
	movl	-10152(%rbp), %eax
	movslq	%eax, %rcx
	movl	-10148(%rbp), %eax
	movslq	%eax, %rdx
	movq	%rdx, %rax
	addq	%rax, %rax
	addq	%rdx, %rax
	movq	%rax, %rdx
	salq	$4, %rdx
	addq	%rdx, %rax
	addq	%rbp, %rax
	addq	%rcx, %rax
	subq	$10144, %rax
	movzbl	(%rax), %edx
	movzbl	-2512(%rbp), %eax
	cmpb	%al, %dl
	jne	.L10
	movl	$0, -10156(%rbp)
	jmp	.L11
.L12:
	movl	-10160(%rbp), %eax
	movslq	%eax, %rdx
	movl	-10148(%rbp), %ecx
	movl	-10156(%rbp), %eax
	addl	%eax, %ecx
	leaq	-10144(%rbp), %rsi
	movl	-10152(%rbp), %eax
	movslq	%eax, %rdi
	movslq	%ecx, %rcx
	movq	%rcx, %rax
	addq	%rax, %rax
	addq	%rcx, %rax
	movq	%rax, %rcx
	salq	$4, %rcx
	addq	%rcx, %rax
	addq	%rdi, %rax
	leaq	(%rsi,%rax), %rcx
	leaq	-5024(%rbp), %rax
	movq	%rcx, %rsi
	movq	%rax, %rdi
	call	strncat@PLT
	addl	$1, -10156(%rbp)
.L11:
	movl	-10160(%rbp), %eax
	cmpl	%eax, -10156(%rbp)
	jl	.L12
	leaq	-2512(%rbp), %rdx
	leaq	-5024(%rbp), %rax
	movq	%rdx, %rsi
	movq	%rax, %rdi
	call	strcmp@PLT
	testl	%eax, %eax
	jne	.L13
	leaq	.LC2(%rip), %rax
	movq	%rax, %rdi
	call	puts@PLT
	movl	$0, %eax
	jmp	.L17
.L13:
	movb	$0, -5024(%rbp)
.L10:
	addl	$1, -10152(%rbp)
.L9:
	movl	-10164(%rbp), %eax
	movl	-10160(%rbp), %edx
	subl	%edx, %eax
	cmpl	%eax, -10152(%rbp)
	jle	.L15
	addl	$1, -10148(%rbp)
.L8:
	movl	-10164(%rbp), %eax
	movl	-10160(%rbp), %edx
	subl	%edx, %eax
	cmpl	%eax, -10148(%rbp)
	jle	.L16
	leaq	.LC3(%rip), %rax
	movq	%rax, %rdi
	call	puts@PLT
	movl	$0, %eax
.L17:
	movq	-8(%rbp), %rdx
	subq	%fs:40, %rdx
	je	.L18
	call	__stack_chk_fail@PLT
.L18:
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE0:
	.size	main, .-main
	.ident	"GCC: (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0"
	.section	.note.GNU-stack,"",@progbits
	.section	.note.gnu.property,"a"
	.align 8
	.long	1f - 0f
	.long	4f - 1f
	.long	5
0:
	.string	"GNU"
1:
	.align 8
	.long	0xc0000002
	.long	3f - 2f
2:
	.long	0x3
3:
	.align 8
4:
```

Only output the optimized assembly code. Do not include any other text. Do not write any comments in the assembly code. Wrap the assembly code in ```assembly``` tags.
user
	.file	"temp.c"
	.text
	.section	.rodata.str1.1,"aMS",@progbits,1
.LC0:
	.string	"%d %d"
.LC1:
	.string	"%s"
.LC2:
	.string	"No"
.LC3:
	.string	"Yes"
	.section	.text.startup,"ax",@progbits
	.p2align 4
	.globl	main
	.type	main, @function
main:
.LFB35:
	.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
	subq	$4096, %rsp
	.cfi_def_cfa_offset 4152
	orq	$0, (%rsp)
	subq	$4096, %rsp
	.cfi_def_cfa_offset 8248
	orq	$0, (%rsp)
	subq	$2024, %rsp
	.cfi_def_cfa_offset 10272
	leaq	.LC0(%rip), %rdi
	xorl	%ebx, %ebx
	leaq	.LC1(%rip), %r12
	movq	%fs:40, %rax
	movq	%rax, 10200(%rsp)
	xorl	%eax, %eax
	leaq	60(%rsp), %rdx
	leaq	56(%rsp), %rsi
	leaq	64(%rsp), %rbp
	call	__isoc99_scanf@PLT
	xorl	%eax, %eax
	movl	$310, %ecx
	movl	56(%rsp), %edx
	leaq	5200(%rsp), %rdi
	pxor	%xmm0, %xmm0
	rep stosq
	movl	$310, %ecx
	movaps	%xmm0, 5184(%rsp)
	movaps	%xmm0, 7696(%rsp)
	movl	$0, (%rdi)
	movb	$0, 4(%rdi)
	leaq	7712(%rsp), %rdi
	rep stosq
	movl	$0, (%rdi)
	movb	$0, 4(%rdi)
	testl	%edx, %edx
	jle	.L6
	.p2align 4,,10
	.p2align 3
.L5:
	movq	%rbp, %rsi
	movq	%r12, %rdi
	xorl	%eax, %eax
	addl	$1, %ebx
	call	__isoc99_scanf@PLT
	addq	$51, %rbp
	cmpl	%ebx, 56(%rsp)
	jg	.L5
.L6:
	movl	60(%rsp), %eax
	movl	%eax, 16(%rsp)
	testl	%eax, %eax
	jle	.L4
	leaq	2624(%rsp), %r13
	xorl	%ebx, %ebx
	leaq	.LC1(%rip), %r12
	movq	%r13, %rbp
	.p2align 4,,10
	.p2align 3
.L7:
	movq	%rbp, %rsi
	movq	%r12, %rdi
	xorl	%eax, %eax
	addl	$1, %ebx
	call	__isoc99_scanf@PLT
	movl	60(%rsp), %eax
	addq	$51, %rbp
	cmpl	%ebx, %eax
	jg	.L7
	movl	%eax, 16(%rsp)
	testl	%eax, %eax
	jle	.L4
	subl	$1, %eax
	leaq	51(%r13), %rbx
	leaq	7696(%rsp), %rcx
	movq	%r13, %rsi
	leaq	(%rax,%rax,2), %rax
	movq	%rax, %rdx
	salq	$4, %rdx
	addq	%rdx, %rax
	leaq	(%rax,%rbx), %rbp
	jmp	.L8
	.p2align 4,,10
	.p2align 3
.L33:
	addq	$51, %rbx
.L8:
	movq	%rcx, %rdi
	movl	$2501, %edx
	call	__strcat_chk@PLT
	movq	%rbx, %rsi
	movq	%rax, %rcx
	cmpq	%rbp, %rbx
	jne	.L33
.L4:
	movl	56(%rsp), %eax
	subl	16(%rsp), %eax
	movl	%eax, 12(%rsp)
	js	.L19
	leaq	64(%rsp), %rax
	movl	$0, 20(%rsp)
	movzbl	7696(%rsp), %r14d
	movq	%rax, 40(%rsp)
	movl	16(%rsp), %eax
	subl	$1, %eax
	leaq	3(%rax,%rax,2), %rax
	movq	%rax, 24(%rsp)
	salq	$4, %rax
	movq	%rax, 32(%rsp)
	.p2align 4,,10
	.p2align 3
.L18:
	movq	40(%rsp), %r15
	xorl	%ebx, %ebx
	jmp	.L17
	.p2align 4,,10
	.p2align 3
.L11:
	addq	$1, %rbx
	addq	$1, %r15
	cmpl	%ebx, 12(%rsp)
	jl	.L34
.L17:
	cmpb	%r14b, (%r15)
	jne	.L11
	movl	16(%rsp), %eax
	testl	%eax, %eax
	jle	.L35
	movq	24(%rsp), %rbp
	movslq	16(%rsp), %r12
	movq	%r15, %r13
	leaq	5184(%rsp), %rdi
	addq	32(%rsp), %rbp
	addq	%r15, %rbp
	.p2align 4,,10
	.p2align 3
.L15:
	movq	%r13, %rsi
	movl	$2501, %ecx
	movq	%r12, %rdx
	addq	$51, %r13
	call	__strncat_chk@PLT
	movq	%rax, %rdi
	cmpq	%r13, %rbp
	jne	.L15
.L16:
	leaq	7696(%rsp), %rsi
	call	strcmp@PLT
	testl	%eax, %eax
	je	.L36
	movb	$0, 5184(%rsp)
	addq	$1, %rbx
	addq	$1, %r15
	cmpl	%ebx, 12(%rsp)
	jge	.L17
	.p2align 4,,10
	.p2align 3
.L34:
	addl	$1, 20(%rsp)
	movl	20(%rsp), %eax
	addq	$51, 40(%rsp)
	cmpl	%eax, 12(%rsp)
	jge	.L18
.L19:
	leaq	.LC2(%rip), %rdi
	call	puts@PLT
	jmp	.L10
	.p2align 4,,10
	.p2align 3
.L35:
	leaq	5184(%rsp), %rdi
	jmp	.L16
.L36:
	leaq	.LC3(%rip), %rdi
	call	puts@PLT
.L10:
	movq	10200(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L37
	addq	$10216, %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
.L37:
	.cfi_restore_state
	call	__stack_chk_fail@PLT
	.cfi_endproc
.LFE35:
	.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	"No"
.LC3:
	.string	"Yes"
	.section	.text.startup,"ax",@progbits
	.p2align 4
	.globl	main
	.type	main, @function
main:
.LFB35:
	.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
	subq	$4096, %rsp
	.cfi_def_cfa_offset 4152
	orq	$0, (%rsp)
	subq	$4096, %rsp
	.cfi_def_cfa_offset 8248
	orq	$0, (%rsp)
	subq	$2024, %rsp
	.cfi_def_cfa_offset 10272
	leaq	.LC0(%rip), %rdi
	xorl	%ebx, %ebx
	leaq	.LC1(%rip), %r12
	movq	%fs:40, %rax
	movq	%rax, 10200(%rsp)
	xorl	%eax, %eax
	leaq	60(%rsp), %rdx
	leaq	56(%rsp), %rsi
	leaq	64(%rsp), %rbp
	call	__isoc99_scanf@PLT
	xorl	%eax, %eax
	movl	$310, %ecx
	movl	56(%rsp), %edx
	leaq	5200(%rsp), %rdi
	pxor	%xmm0, %xmm0
	rep stosq
	movl	$310, %ecx
	movaps	%xmm0, 5184(%rsp)
	movaps	%xmm0, 7696(%rsp)
	movl	$0, (%rdi)
	movb	$0, 4(%rdi)
	leaq	7712(%rsp), %rdi
	rep stosq
	movl	$0, (%rdi)
	movb	$0, 4(%rdi)
	testl	%edx, %edx
	jle	.L6
	.p2align 4,,10
	.p2align 3
.L5:
	movq	%rbp, %rsi
	movq	%r12, %rdi
	xorl	%eax, %eax
	addl	$1, %ebx
	call	__isoc99_scanf@PLT
	addq	$51, %rbp
	cmpl	%ebx, 56(%rsp)
	jg	.L5
.L6:
	movl	60(%rsp), %eax
	movl	%eax, 16(%rsp)
	testl	%eax, %eax
	jle	.L4
	leaq	2624(%rsp), %r13
	xorl	%ebx, %ebx
	leaq	.LC1(%rip), %r12
	movq	%r13, %rbp
	.p2align 4,,10
	.p2align 3
.L7:
	movq	%rbp, %rsi
	movq	%r12, %rdi
	xorl	%eax, %eax
	addl	$1, %ebx
	call	__isoc99_scanf@PLT
	movl	60(%rsp), %eax
	addq	$51, %rbp
	cmpl	%ebx, %eax
	jg	.L7
	movl	%eax, 16(%rsp)
	testl	%eax, %eax
	jle	.L4
	subl	$1, %eax
	leaq	51(%r13), %rbx
	leaq	7696(%rsp), %rcx
	movq	%r13, %rsi
	leaq	(%rax,%rax,2), %rax
	movq	%rax, %rdx
	salq	$4, %rdx
	addq	%rdx, %rax
	leaq	(%rax,%rbx), %rbp
	jmp	.L8
	.p2align 4,,10
	.p2align 3
.L33:
	addq	$51, %rbx
.L8:
	movq	%rcx, %rdi
	movl	$2501, %edx
	call	__strcat_chk@PLT
	movq	%rbx, %rsi
	movq	%rax, %rcx
	cmpq	%rbp, %rbx
	jne	.L33
.L4:
	movl	56(%rsp), %eax
	subl	16(%rsp), %eax
	movl	%eax, 12(%rsp)
	js	.L19
	leaq	64(%rsp), %rax
	movl	$0, 20(%rsp)
	movzbl	7696(%rsp), %r14d
	movq	%rax, 40(%rsp)
	movl	16(%rsp), %eax
	subl	$1, %eax
	leaq	3(%rax,%rax,2), %rax
	movq	%rax, 24(%rsp)
	salq	$4, %rax
	movq	%rax, 32(%rsp)
	.p2align 4,,10
	.p2align 3
.L18:
	movq	40(%rsp), %r15
	xorl	%ebx, %ebx
	jmp	.L17
	.p2align 4,,10
	.p2align 3
.L11:
	addq	$1, %rbx
	addq	$1, %r15
	cmpl	%ebx, 12(%rsp)
	jl	.L34
.L17:
	cmpb	%r14b, (%r15)
	jne	.L11
	movl	16(%rsp), %eax
	testl	%eax, %eax
	jle	.L35
	movq	24(%rsp), %rbp
	movslq	16(%rsp), %r12
	movq	%r15, %r13
	leaq	5184(%rsp), %rdi
	addq	32(%rsp), %rbp
	addq	%r15, %rbp
	.p2align 4,,10
	.p2align 3
.L15:
	movq	%r13, %rsi
	movl	$2501, %ecx
	movq	%r12, %rdx
	addq	$51, %r13
	call	__strncat_chk@PLT
	movq	%rax, %rdi
	cmpq	%r13, %rbp
	jne	.L15
.L16:
	leaq	7696(%rsp), %rsi
	call	strcmp@PLT
	testl	%eax, %eax
	je	.L36
	movb	$0, 5184(%rsp)
	addq	$1, %rbx
	addq	$1, %r15
	cmpl	%ebx, 12(%rsp)
	jge	.L17
	.p2align 4,,10
	.p2align 3
.L34:
	addl	$1, 20(%rsp)
	movl	20(%rsp), %eax
	addq	$51, 40(%rsp)
	cmpl	%eax, 12(%rsp)
	jge	.L18
.L19:
	leaq	.LC2(%rip), %rdi
	call	puts@PLT
	jmp	.L10
	.p2align 4,,10
	.p2align 3
.L35:
	leaq	5184(%rsp), %rdi
	jmp	.L16
.L36:
	leaq	.LC3(%rip), %rdi
	call	puts@PLT
.L10:
	movq	10200(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L37
	addq	$10216, %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
.L37:
	.cfi_restore_state
	call	__stack_chk_fail@PLT
	.cfi_endproc
.LFE35:
	.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:

// ABC054 B - Template Matching
#include <stdio.h>
#include <string.h>

int main(void) {
    int N, M;
    scanf("%d %d", &N, &M);
    char A[50][51];
    char B[50][51];
    char joinA[2501] = {'\0'};
    char joinB[2501] = {'\0'};
    int i;
    for (i = 0; i < N; i++) {
        scanf("%s", A[i]);
    }
    for (i = 0; i < M; i++) {
        scanf("%s", B[i]);
    }

    for (i = 0; i < M; i++) {
        strcat(joinB, B[i]);
    }
    int x, y;
    for (y = 0; y < (N - M + 1); y++) {
        for (x = 0; x < (N - M + 1); x++) {
            if (A[y][x] == joinB[0]) {
                // joinAを作る
                for (i = 0; i < M; i++) {
                    strncat(joinA, &A[y + i][x], M);
                }
                // printf("joinA:%s\n",joinA);
                // joinA=joinBならYes
                if (strcmp(joinA, joinB) == 0) {
                    printf("Yes\n");
                    return 0;
                }
                joinA[0] = '\0';
            }
        }
    }

    printf("No\n");
    return 0;

}
3 2
#.#
.#.
#-#
#.
.#
 3 2
-#
.#.
.#
.
.#
 4 0
....
....
....
....
 3 2
#.#
.".
#-#
#.
.#
 4 1
..-.
....
....
....
 3 2
-#
.#.
#.
.
.#
 3 2
#.#
.".
#-#
$.
.#
 0 1
..-.
....
....
....
 0 2
#.#
.".
#-#
$.
.#
 0 1
..-.
....
....
-...

Yes
 No
 Yes
 No
 No
 No
 No
 No
 No
 No

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

```c
// ABC054 B - Template Matching
#include <stdio.h>
#include <string.h>

int main(void) {
    int N, M;
    scanf("%d %d", &N, &M);
    char A[50][51];
    char B[50][51];
    char joinA[2501] = {'\0'};
    char joinB[2501] = {'\0'};
    int i;
    for (i = 0; i < N; i++) {
        scanf("%s", A[i]);
    }
    for (i = 0; i < M; i++) {
        scanf("%s", B[i]);
    }

    for (i = 0; i < M; i++) {
        strcat(joinB, B[i]);
    }
    int x, y;
    for (y = 0; y < (N - M + 1); y++) {
        for (x = 0; x < (N - M + 1); x++) {
            if (A[y][x] == joinB[0]) {
                // joinAを作る
                for (i = 0; i < M; i++) {
                    strncat(joinA, &A[y + i][x], M);
                }
                // printf("joinA:%s\n",joinA);
                // joinA=joinBならYes
                if (strcmp(joinA, joinB) == 0) {
                    printf("Yes\n");
                    return 0;
                }
                joinA[0] = '\0';
            }
        }
    }

    printf("No\n");
    return 0;

}```

Unoptimized Assembly Code:

```assembly
	.file	"temp.c"
	.text
	.section	.rodata
.LC0:
	.string	"%d %d"
.LC1:
	.string	"%s"
.LC2:
	.string	"Yes"
.LC3:
	.string	"No"
	.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
	subq	$4096, %rsp
	orq	$0, (%rsp)
	subq	$4096, %rsp
	orq	$0, (%rsp)
	subq	$1984, %rsp
	movq	%fs:40, %rax
	movq	%rax, -8(%rbp)
	xorl	%eax, %eax
	leaq	-10160(%rbp), %rdx
	leaq	-10164(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movq	$0, -5024(%rbp)
	movq	$0, -5016(%rbp)
	leaq	-5008(%rbp), %rdx
	movl	$0, %eax
	movl	$310, %ecx
	movq	%rdx, %rdi
	rep stosq
	movq	%rdi, %rdx
	movl	%eax, (%rdx)
	addq	$4, %rdx
	movb	%al, (%rdx)
	addq	$1, %rdx
	movq	$0, -2512(%rbp)
	movq	$0, -2504(%rbp)
	leaq	-2496(%rbp), %rdx
	movl	$0, %eax
	movl	$310, %ecx
	movq	%rdx, %rdi
	rep stosq
	movq	%rdi, %rdx
	movl	%eax, (%rdx)
	addq	$4, %rdx
	movb	%al, (%rdx)
	addq	$1, %rdx
	movl	$0, -10156(%rbp)
	jmp	.L2
.L3:
	leaq	-10144(%rbp), %rcx
	movl	-10156(%rbp), %eax
	movslq	%eax, %rdx
	movq	%rdx, %rax
	addq	%rax, %rax
	addq	%rdx, %rax
	movq	%rax, %rdx
	salq	$4, %rdx
	addq	%rdx, %rax
	addq	%rcx, %rax
	movq	%rax, %rsi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	addl	$1, -10156(%rbp)
.L2:
	movl	-10164(%rbp), %eax
	cmpl	%eax, -10156(%rbp)
	jl	.L3
	movl	$0, -10156(%rbp)
	jmp	.L4
.L5:
	leaq	-7584(%rbp), %rcx
	movl	-10156(%rbp), %eax
	movslq	%eax, %rdx
	movq	%rdx, %rax
	addq	%rax, %rax
	addq	%rdx, %rax
	movq	%rax, %rdx
	salq	$4, %rdx
	addq	%rdx, %rax
	addq	%rcx, %rax
	movq	%rax, %rsi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	addl	$1, -10156(%rbp)
.L4:
	movl	-10160(%rbp), %eax
	cmpl	%eax, -10156(%rbp)
	jl	.L5
	movl	$0, -10156(%rbp)
	jmp	.L6
.L7:
	leaq	-7584(%rbp), %rcx
	movl	-10156(%rbp), %eax
	movslq	%eax, %rdx
	movq	%rdx, %rax
	addq	%rax, %rax
	addq	%rdx, %rax
	movq	%rax, %rdx
	salq	$4, %rdx
	addq	%rdx, %rax
	leaq	(%rcx,%rax), %rdx
	leaq	-2512(%rbp), %rax
	movq	%rdx, %rsi
	movq	%rax, %rdi
	call	strcat@PLT
	addl	$1, -10156(%rbp)
.L6:
	movl	-10160(%rbp), %eax
	cmpl	%eax, -10156(%rbp)
	jl	.L7
	movl	$0, -10148(%rbp)
	jmp	.L8
.L16:
	movl	$0, -10152(%rbp)
	jmp	.L9
.L15:
	movl	-10152(%rbp), %eax
	movslq	%eax, %rcx
	movl	-10148(%rbp), %eax
	movslq	%eax, %rdx
	movq	%rdx, %rax
	addq	%rax, %rax
	addq	%rdx, %rax
	movq	%rax, %rdx
	salq	$4, %rdx
	addq	%rdx, %rax
	addq	%rbp, %rax
	addq	%rcx, %rax
	subq	$10144, %rax
	movzbl	(%rax), %edx
	movzbl	-2512(%rbp), %eax
	cmpb	%al, %dl
	jne	.L10
	movl	$0, -10156(%rbp)
	jmp	.L11
.L12:
	movl	-10160(%rbp), %eax
	movslq	%eax, %rdx
	movl	-10148(%rbp), %ecx
	movl	-10156(%rbp), %eax
	addl	%eax, %ecx
	leaq	-10144(%rbp), %rsi
	movl	-10152(%rbp), %eax
	movslq	%eax, %rdi
	movslq	%ecx, %rcx
	movq	%rcx, %rax
	addq	%rax, %rax
	addq	%rcx, %rax
	movq	%rax, %rcx
	salq	$4, %rcx
	addq	%rcx, %rax
	addq	%rdi, %rax
	leaq	(%rsi,%rax), %rcx
	leaq	-5024(%rbp), %rax
	movq	%rcx, %rsi
	movq	%rax, %rdi
	call	strncat@PLT
	addl	$1, -10156(%rbp)
.L11:
	movl	-10160(%rbp), %eax
	cmpl	%eax, -10156(%rbp)
	jl	.L12
	leaq	-2512(%rbp), %rdx
	leaq	-5024(%rbp), %rax
	movq	%rdx, %rsi
	movq	%rax, %rdi
	call	strcmp@PLT
	testl	%eax, %eax
	jne	.L13
	leaq	.LC2(%rip), %rax
	movq	%rax, %rdi
	call	puts@PLT
	movl	$0, %eax
	jmp	.L17
.L13:
	movb	$0, -5024(%rbp)
.L10:
	addl	$1, -10152(%rbp)
.L9:
	movl	-10164(%rbp), %eax
	movl	-10160(%rbp), %edx
	subl	%edx, %eax
	cmpl	%eax, -10152(%rbp)
	jle	.L15
	addl	$1, -10148(%rbp)
.L8:
	movl	-10164(%rbp), %eax
	movl	-10160(%rbp), %edx
	subl	%edx, %eax
	cmpl	%eax, -10148(%rbp)
	jle	.L16
	leaq	.LC3(%rip), %rax
	movq	%rax, %rdi
	call	puts@PLT
	movl	$0, %eax
.L17:
	movq	-8(%rbp), %rdx
	subq	%fs:40, %rdx
	je	.L18
	call	__stack_chk_fail@PLT
.L18:
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE0:
	.size	main, .-main
	.ident	"GCC: (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0"
	.section	.note.GNU-stack,"",@progbits
	.section	.note.gnu.property,"a"
	.align 8
	.long	1f - 0f
	.long	4f - 1f
	.long	5
0:
	.string	"GNU"
1:
	.align 8
	.long	0xc0000002
	.long	3f - 2f
2:
	.long	0x3
3:
	.align 8
4:
```

Only output the optimized assembly code. Do not include any other text. Do not write any comments in the assembly code. Wrap the assembly code in ```assembly``` tags.
train
	.file	"temp.c"
	.text
	.section	.rodata
.LC0:
	.string	"%d %d"
.LC1:
	.string	"%s"
.LC2:
	.string	"Yes"
.LC3:
	.string	"No"
	.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
	subq	$4096, %rsp
	orq	$0, (%rsp)
	subq	$4096, %rsp
	orq	$0, (%rsp)
	subq	$1984, %rsp
	movq	%fs:40, %rax
	movq	%rax, -8(%rbp)
	xorl	%eax, %eax
	leaq	-10160(%rbp), %rdx
	leaq	-10164(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movq	$0, -5024(%rbp)
	movq	$0, -5016(%rbp)
	leaq	-5008(%rbp), %rdx
	movl	$0, %eax
	movl	$310, %ecx
	movq	%rdx, %rdi
	rep stosq
	movq	%rdi, %rdx
	movl	%eax, (%rdx)
	addq	$4, %rdx
	movb	%al, (%rdx)
	addq	$1, %rdx
	movq	$0, -2512(%rbp)
	movq	$0, -2504(%rbp)
	leaq	-2496(%rbp), %rdx
	movl	$0, %eax
	movl	$310, %ecx
	movq	%rdx, %rdi
	rep stosq
	movq	%rdi, %rdx
	movl	%eax, (%rdx)
	addq	$4, %rdx
	movb	%al, (%rdx)
	addq	$1, %rdx
	movl	$0, -10156(%rbp)
	jmp	.L2
.L3:
	leaq	-10144(%rbp), %rcx
	movl	-10156(%rbp), %eax
	movslq	%eax, %rdx
	movq	%rdx, %rax
	addq	%rax, %rax
	addq	%rdx, %rax
	movq	%rax, %rdx
	salq	$4, %rdx
	addq	%rdx, %rax
	addq	%rcx, %rax
	movq	%rax, %rsi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	addl	$1, -10156(%rbp)
.L2:
	movl	-10164(%rbp), %eax
	cmpl	%eax, -10156(%rbp)
	jl	.L3
	movl	$0, -10156(%rbp)
	jmp	.L4
.L5:
	leaq	-7584(%rbp), %rcx
	movl	-10156(%rbp), %eax
	movslq	%eax, %rdx
	movq	%rdx, %rax
	addq	%rax, %rax
	addq	%rdx, %rax
	movq	%rax, %rdx
	salq	$4, %rdx
	addq	%rdx, %rax
	addq	%rcx, %rax
	movq	%rax, %rsi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	addl	$1, -10156(%rbp)
.L4:
	movl	-10160(%rbp), %eax
	cmpl	%eax, -10156(%rbp)
	jl	.L5
	movl	$0, -10156(%rbp)
	jmp	.L6
.L7:
	leaq	-7584(%rbp), %rcx
	movl	-10156(%rbp), %eax
	movslq	%eax, %rdx
	movq	%rdx, %rax
	addq	%rax, %rax
	addq	%rdx, %rax
	movq	%rax, %rdx
	salq	$4, %rdx
	addq	%rdx, %rax
	leaq	(%rcx,%rax), %rdx
	leaq	-2512(%rbp), %rax
	movq	%rdx, %rsi
	movq	%rax, %rdi
	call	strcat@PLT
	addl	$1, -10156(%rbp)
.L6:
	movl	-10160(%rbp), %eax
	cmpl	%eax, -10156(%rbp)
	jl	.L7
	movl	$0, -10148(%rbp)
	jmp	.L8
.L16:
	movl	$0, -10152(%rbp)
	jmp	.L9
.L15:
	movl	-10152(%rbp), %eax
	movslq	%eax, %rcx
	movl	-10148(%rbp), %eax
	movslq	%eax, %rdx
	movq	%rdx, %rax
	addq	%rax, %rax
	addq	%rdx, %rax
	movq	%rax, %rdx
	salq	$4, %rdx
	addq	%rdx, %rax
	addq	%rbp, %rax
	addq	%rcx, %rax
	subq	$10144, %rax
	movzbl	(%rax), %edx
	movzbl	-2512(%rbp), %eax
	cmpb	%al, %dl
	jne	.L10
	movl	$0, -10156(%rbp)
	jmp	.L11
.L12:
	movl	-10160(%rbp), %eax
	movslq	%eax, %rdx
	movl	-10148(%rbp), %ecx
	movl	-10156(%rbp), %eax
	addl	%eax, %ecx
	leaq	-10144(%rbp), %rsi
	movl	-10152(%rbp), %eax
	movslq	%eax, %rdi
	movslq	%ecx, %rcx
	movq	%rcx, %rax
	addq	%rax, %rax
	addq	%rcx, %rax
	movq	%rax, %rcx
	salq	$4, %rcx
	addq	%rcx, %rax
	addq	%rdi, %rax
	leaq	(%rsi,%rax), %rcx
	leaq	-5024(%rbp), %rax
	movq	%rcx, %rsi
	movq	%rax, %rdi
	call	strncat@PLT
	addl	$1, -10156(%rbp)
.L11:
	movl	-10160(%rbp), %eax
	cmpl	%eax, -10156(%rbp)
	jl	.L12
	leaq	-2512(%rbp), %rdx
	leaq	-5024(%rbp), %rax
	movq	%rdx, %rsi
	movq	%rax, %rdi
	call	strcmp@PLT
	testl	%eax, %eax
	jne	.L13
	leaq	.LC2(%rip), %rax
	movq	%rax, %rdi
	call	puts@PLT
	movl	$0, %eax
	jmp	.L17
.L13:
	movb	$0, -5024(%rbp)
.L10:
	addl	$1, -10152(%rbp)
.L9:
	movl	-10164(%rbp), %eax
	movl	-10160(%rbp), %edx
	subl	%edx, %eax
	cmpl	%eax, -10152(%rbp)
	jle	.L15
	addl	$1, -10148(%rbp)
.L8:
	movl	-10164(%rbp), %eax
	movl	-10160(%rbp), %edx
	subl	%edx, %eax
	cmpl	%eax, -10148(%rbp)
	jle	.L16
	leaq	.LC3(%rip), %rax
	movq	%rax, %rdi
	call	puts@PLT
	movl	$0, %eax
.L17:
	movq	-8(%rbp), %rdx
	subq	%fs:40, %rdx
	je	.L18
	call	__stack_chk_fail@PLT
.L18:
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE0:
	.size	main, .-main
	.ident	"GCC: (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0"
	.section	.note.GNU-stack,"",@progbits
	.section	.note.gnu.property,"a"
	.align 8
	.long	1f - 0f
	.long	4f - 1f
	.long	5
0:
	.string	"GNU"
1:
	.align 8
	.long	0xc0000002
	.long	3f - 2f
2:
	.long	0x3
3:
	.align 8
4:
