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>
int dfs(int i,int j);
char map[110][110];
char gg;
int W,H;

int main()
{
    int i,j,ans;
    while(scanf("%d %d",&H,&W)!=EOF&&W&&H)
    {
        ans=0;
        for(i=0;i<H;i++)
            scanf("%s",map[i]);
        for(i=0;i<H;i++)
            for(j=0;j<W;j++)
        {
            if(map[i][j]!='X')
            {
               gg=map[i][j];
               map[i][j]='X';
               dfs(i,j);
               ans++;
            }
        }
        printf("%d\n",ans);
    }
    return 0;
}

int dfs(int i,int j)
{
    int k,sx,sy;
    int next[][2]={{0,1},{1,0},{0,-1},{-1,0}};
        for(k=0;k<4;k++)
        {
            sx=i+next[k][0];
            sy=j+next[k][1];
            if(sx>=0&&sy>=0&&sx<H&&sy<W&&map[sx][sy]==gg)
            {
                map[sx][sy]='X';
                dfs(sx,sy);
            }
        }
        return 0;
}```

Unoptimized Assembly Code:

```assembly
	.file	"temp.c"
	.text
	.globl	map
	.bss
	.align 32
	.type	map, @object
	.size	map, 12100
map:
	.zero	12100
	.globl	gg
	.type	gg, @object
	.size	gg, 1
gg:
	.zero	1
	.globl	W
	.align 4
	.type	W, @object
	.size	W, 4
W:
	.zero	4
	.globl	H
	.align 4
	.type	H, @object
	.size	H, 4
H:
	.zero	4
	.section	.rodata
.LC0:
	.string	"%s"
.LC1:
	.string	"%d\n"
.LC2:
	.string	"%d %d"
	.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	$16, %rsp
	jmp	.L2
.L11:
	movl	$0, -4(%rbp)
	movl	$0, -12(%rbp)
	jmp	.L3
.L4:
	movl	-12(%rbp), %eax
	cltq
	imulq	$110, %rax, %rax
	leaq	map(%rip), %rdx
	addq	%rdx, %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	addl	$1, -12(%rbp)
.L3:
	movl	H(%rip), %eax
	cmpl	%eax, -12(%rbp)
	jl	.L4
	movl	$0, -12(%rbp)
	jmp	.L5
.L9:
	movl	$0, -8(%rbp)
	jmp	.L6
.L8:
	movl	-8(%rbp), %eax
	movslq	%eax, %rdx
	movl	-12(%rbp), %eax
	cltq
	imulq	$110, %rax, %rax
	addq	%rax, %rdx
	leaq	map(%rip), %rax
	addq	%rdx, %rax
	movzbl	(%rax), %eax
	cmpb	$88, %al
	je	.L7
	movl	-8(%rbp), %eax
	movslq	%eax, %rdx
	movl	-12(%rbp), %eax
	cltq
	imulq	$110, %rax, %rax
	addq	%rax, %rdx
	leaq	map(%rip), %rax
	addq	%rdx, %rax
	movzbl	(%rax), %eax
	movb	%al, gg(%rip)
	movl	-8(%rbp), %eax
	movslq	%eax, %rdx
	movl	-12(%rbp), %eax
	cltq
	imulq	$110, %rax, %rax
	addq	%rax, %rdx
	leaq	map(%rip), %rax
	addq	%rdx, %rax
	movb	$88, (%rax)
	movl	-8(%rbp), %edx
	movl	-12(%rbp), %eax
	movl	%edx, %esi
	movl	%eax, %edi
	call	dfs
	addl	$1, -4(%rbp)
.L7:
	addl	$1, -8(%rbp)
.L6:
	movl	W(%rip), %eax
	cmpl	%eax, -8(%rbp)
	jl	.L8
	addl	$1, -12(%rbp)
.L5:
	movl	H(%rip), %eax
	cmpl	%eax, -12(%rbp)
	jl	.L9
	movl	-4(%rbp), %eax
	movl	%eax, %esi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
.L2:
	leaq	W(%rip), %rax
	movq	%rax, %rdx
	leaq	H(%rip), %rax
	movq	%rax, %rsi
	leaq	.LC2(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	cmpl	$-1, %eax
	je	.L10
	movl	W(%rip), %eax
	testl	%eax, %eax
	je	.L10
	movl	H(%rip), %eax
	testl	%eax, %eax
	jne	.L11
.L10:
	movl	$0, %eax
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE0:
	.size	main, .-main
	.globl	dfs
	.type	dfs, @function
dfs:
.LFB1:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	subq	$80, %rsp
	movl	%edi, -68(%rbp)
	movl	%esi, -72(%rbp)
	movq	%fs:40, %rax
	movq	%rax, -8(%rbp)
	xorl	%eax, %eax
	movl	$0, -48(%rbp)
	movl	$1, -44(%rbp)
	movl	$1, -40(%rbp)
	movl	$0, -36(%rbp)
	movl	$0, -32(%rbp)
	movl	$-1, -28(%rbp)
	movl	$-1, -24(%rbp)
	movl	$0, -20(%rbp)
	movl	$0, -60(%rbp)
	jmp	.L14
.L16:
	movl	-60(%rbp), %eax
	cltq
	movl	-48(%rbp,%rax,8), %edx
	movl	-68(%rbp), %eax
	addl	%edx, %eax
	movl	%eax, -56(%rbp)
	movl	-60(%rbp), %eax
	cltq
	movl	-44(%rbp,%rax,8), %edx
	movl	-72(%rbp), %eax
	addl	%edx, %eax
	movl	%eax, -52(%rbp)
	cmpl	$0, -56(%rbp)
	js	.L15
	cmpl	$0, -52(%rbp)
	js	.L15
	movl	H(%rip), %eax
	cmpl	%eax, -56(%rbp)
	jge	.L15
	movl	W(%rip), %eax
	cmpl	%eax, -52(%rbp)
	jge	.L15
	movl	-52(%rbp), %eax
	movslq	%eax, %rdx
	movl	-56(%rbp), %eax
	cltq
	imulq	$110, %rax, %rax
	addq	%rax, %rdx
	leaq	map(%rip), %rax
	addq	%rdx, %rax
	movzbl	(%rax), %edx
	movzbl	gg(%rip), %eax
	cmpb	%al, %dl
	jne	.L15
	movl	-52(%rbp), %eax
	movslq	%eax, %rdx
	movl	-56(%rbp), %eax
	cltq
	imulq	$110, %rax, %rax
	addq	%rax, %rdx
	leaq	map(%rip), %rax
	addq	%rdx, %rax
	movb	$88, (%rax)
	movl	-52(%rbp), %edx
	movl	-56(%rbp), %eax
	movl	%edx, %esi
	movl	%eax, %edi
	call	dfs
.L15:
	addl	$1, -60(%rbp)
.L14:
	cmpl	$3, -60(%rbp)
	jle	.L16
	movl	$0, %eax
	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
.LFE1:
	.size	dfs, .-dfs
	.ident	"GCC: (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0"
	.section	.note.GNU-stack,"",@progbits
	.section	.note.gnu.property,"a"
	.align 8
	.long	1f - 0f
	.long	4f - 1f
	.long	5
0:
	.string	"GNU"
1:
	.align 8
	.long	0xc0000002
	.long	3f - 2f
2:
	.long	0x3
3:
	.align 8
4:
```

Only output the optimized assembly code. Do not include any other text. Do not write any comments in the assembly code. Wrap the assembly code in ```assembly``` tags.
user
	.file	"temp.c"
	.text
	.p2align 4
	.globl	dfs
	.type	dfs, @function
dfs:
.LFB24:
	.cfi_startproc
	endbr64
	pushq	%r13
	.cfi_def_cfa_offset 16
	.cfi_offset 13, -16
	movl	%esi, %r13d
	pushq	%r12
	.cfi_def_cfa_offset 24
	.cfi_offset 12, -24
	movl	%edi, %r12d
	pushq	%rbp
	.cfi_def_cfa_offset 32
	.cfi_offset 6, -32
	notl	%r12d
	pushq	%rbx
	.cfi_def_cfa_offset 40
	.cfi_offset 3, -40
	shrl	$31, %r12d
	movl	%edi, %ebx
	subq	$8, %rsp
	.cfi_def_cfa_offset 48
	addl	$1, %esi
	js	.L2
	testb	%r12b, %r12b
	je	.L2
	cmpl	H(%rip), %edi
	jl	.L8
.L2:
	movl	%r13d, %ebp
	movl	%ebx, %edi
	notl	%ebp
	shrl	$31, %ebp
	addl	$1, %edi
	js	.L3
	testb	%bpl, %bpl
	je	.L3
	cmpl	H(%rip), %edi
	jl	.L9
.L3:
	movl	%r13d, %eax
	leal	-1(%r13), %esi
	negl	%eax
	jns	.L4
	testb	%r12b, %r12b
	je	.L4
	cmpl	H(%rip), %ebx
	jl	.L10
.L4:
	leal	-1(%rbx), %edi
	negl	%ebx
	jns	.L5
	testb	%bpl, %bpl
	je	.L5
	cmpl	%edi, H(%rip)
	jle	.L5
	cmpl	%r13d, W(%rip)
	jle	.L5
	movslq	%edi, %rcx
	leaq	map(%rip), %rax
	movslq	%r13d, %rdx
	imulq	$110, %rcx, %rcx
	addq	%rcx, %rax
	movzbl	gg(%rip), %ecx
	addq	%rdx, %rax
	cmpb	%cl, (%rax)
	je	.L11
.L5:
	addq	$8, %rsp
	.cfi_remember_state
	.cfi_def_cfa_offset 40
	xorl	%eax, %eax
	popq	%rbx
	.cfi_def_cfa_offset 32
	popq	%rbp
	.cfi_def_cfa_offset 24
	popq	%r12
	.cfi_def_cfa_offset 16
	popq	%r13
	.cfi_def_cfa_offset 8
	ret
	.p2align 4,,10
	.p2align 3
.L10:
	.cfi_restore_state
	cmpl	W(%rip), %esi
	jge	.L4
	movslq	%ebx, %rcx
	leaq	map(%rip), %rax
	movslq	%esi, %rdx
	imulq	$110, %rcx, %rcx
	addq	%rcx, %rax
	addq	%rdx, %rax
	movzbl	gg(%rip), %edx
	cmpb	%dl, (%rax)
	jne	.L4
	movb	$88, (%rax)
	movl	%ebx, %edi
	call	dfs
	jmp	.L4
	.p2align 4,,10
	.p2align 3
.L9:
	cmpl	W(%rip), %r13d
	jge	.L3
	movslq	%edi, %rcx
	leaq	map(%rip), %rax
	movslq	%r13d, %rdx
	imulq	$110, %rcx, %rcx
	addq	%rcx, %rax
	movzbl	gg(%rip), %ecx
	addq	%rdx, %rax
	cmpb	%cl, (%rax)
	jne	.L3
	movb	$88, (%rax)
	movl	%r13d, %esi
	call	dfs
	jmp	.L3
	.p2align 4,,10
	.p2align 3
.L8:
	cmpl	W(%rip), %esi
	jge	.L2
	movslq	%edi, %rcx
	leaq	map(%rip), %rax
	movslq	%esi, %rdx
	imulq	$110, %rcx, %rcx
	addq	%rcx, %rax
	addq	%rdx, %rax
	movzbl	gg(%rip), %edx
	cmpb	%dl, (%rax)
	jne	.L2
	movb	$88, (%rax)
	call	dfs
	jmp	.L2
.L11:
	movb	$88, (%rax)
	movl	%r13d, %esi
	call	dfs
	jmp	.L5
	.cfi_endproc
.LFE24:
	.size	dfs, .-dfs
	.section	.rodata.str1.1,"aMS",@progbits,1
.LC0:
	.string	"%s"
.LC1:
	.string	"%d\n"
.LC2:
	.string	"%d %d"
	.section	.text.startup,"ax",@progbits
	.p2align 4
	.globl	main
	.type	main, @function
main:
.LFB23:
	.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
	leaq	W(%rip), %r14
	pushq	%r13
	.cfi_def_cfa_offset 32
	.cfi_offset 13, -32
	leaq	H(%rip), %r13
	pushq	%r12
	.cfi_def_cfa_offset 40
	.cfi_offset 12, -40
	pushq	%rbp
	.cfi_def_cfa_offset 48
	.cfi_offset 6, -48
	leaq	.LC0(%rip), %rbp
	pushq	%rbx
	.cfi_def_cfa_offset 56
	.cfi_offset 3, -56
	subq	$8, %rsp
	.cfi_def_cfa_offset 64
	.p2align 4,,10
	.p2align 3
.L13:
	xorl	%eax, %eax
	movq	%r14, %rdx
	leaq	.LC2(%rip), %rdi
	movq	%r13, %rsi
	call	__isoc99_scanf@PLT
	cmpl	$-1, %eax
	je	.L29
	movl	W(%rip), %edx
	testl	%edx, %edx
	je	.L29
	movl	H(%rip), %eax
	testl	%eax, %eax
	je	.L29
	leaq	map(%rip), %rbx
	movl	$0, %r15d
	movq	%rbx, %r12
	jle	.L15
	.p2align 4,,10
	.p2align 3
.L14:
	movq	%r12, %rsi
	movq	%rbp, %rdi
	xorl	%eax, %eax
	addl	$1, %r15d
	call	__isoc99_scanf@PLT
	movl	H(%rip), %eax
	addq	$110, %r12
	cmpl	%r15d, %eax
	jg	.L14
	testl	%eax, %eax
	jle	.L15
	movl	W(%rip), %edx
	xorl	%r10d, %r10d
	xorl	%r11d, %r11d
	testl	%edx, %edx
	jle	.L22
	.p2align 4,,10
	.p2align 3
.L26:
	movq	%rbx, %r9
	xorl	%r8d, %r8d
	.p2align 4,,10
	.p2align 3
.L20:
	movzbl	(%r9), %eax
	cmpb	$88, %al
	je	.L17
	movb	$88, (%r9)
	movl	%r8d, %esi
	movl	%r11d, %edi
	addl	$1, %r8d
	movb	%al, gg(%rip)
	addl	$1, %r10d
	addq	$1, %r9
	call	dfs
	movl	W(%rip), %edx
	cmpl	%r8d, %edx
	jg	.L20
.L19:
	addl	$1, %r11d
	cmpl	%r11d, H(%rip)
	jle	.L22
	addq	$110, %rbx
	testl	%edx, %edx
	jg	.L26
.L22:
	movl	%r10d, %edx
	leaq	.LC1(%rip), %rsi
	movl	$1, %edi
	xorl	%eax, %eax
	call	__printf_chk@PLT
	jmp	.L13
	.p2align 4,,10
	.p2align 3
.L17:
	addl	$1, %r8d
	addq	$1, %r9
	cmpl	%r8d, %edx
	jg	.L20
	jmp	.L19
.L29:
	addq	$8, %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
.L15:
	.cfi_restore_state
	xorl	%r10d, %r10d
	jmp	.L22
	.cfi_endproc
.LFE23:
	.size	main, .-main
	.globl	H
	.bss
	.align 4
	.type	H, @object
	.size	H, 4
H:
	.zero	4
	.globl	W
	.align 4
	.type	W, @object
	.size	W, 4
W:
	.zero	4
	.globl	gg
	.type	gg, @object
	.size	gg, 1
gg:
	.zero	1
	.globl	map
	.align 32
	.type	map, @object
	.size	map, 12100
map:
	.zero	12100
	.ident	"GCC: (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0"
	.section	.note.GNU-stack,"",@progbits
	.section	.note.gnu.property,"a"
	.align 8
	.long	1f - 0f
	.long	4f - 1f
	.long	5
0:
	.string	"GNU"
1:
	.align 8
	.long	0xc0000002
	.long	3f - 2f
2:
	.long	0x3
3:
	.align 8
4:

rule
	.file	"temp.c"
	.text
	.p2align 4
	.globl	dfs
	.type	dfs, @function
dfs:
.LFB24:
	.cfi_startproc
	endbr64
	pushq	%r13
	.cfi_def_cfa_offset 16
	.cfi_offset 13, -16
	movl	%esi, %r13d
	pushq	%r12
	.cfi_def_cfa_offset 24
	.cfi_offset 12, -24
	movl	%edi, %r12d
	pushq	%rbp
	.cfi_def_cfa_offset 32
	.cfi_offset 6, -32
	notl	%r12d
	pushq	%rbx
	.cfi_def_cfa_offset 40
	.cfi_offset 3, -40
	shrl	$31, %r12d
	movl	%edi, %ebx
	subq	$8, %rsp
	.cfi_def_cfa_offset 48
	addl	$1, %esi
	js	.L2
	testb	%r12b, %r12b
	je	.L2
	cmpl	H(%rip), %edi
	jl	.L8
.L2:
	movl	%r13d, %ebp
	movl	%ebx, %edi
	notl	%ebp
	shrl	$31, %ebp
	addl	$1, %edi
	js	.L3
	testb	%bpl, %bpl
	je	.L3
	cmpl	H(%rip), %edi
	jl	.L9
.L3:
	movl	%r13d, %eax
	leal	-1(%r13), %esi
	negl	%eax
	jns	.L4
	testb	%r12b, %r12b
	je	.L4
	cmpl	H(%rip), %ebx
	jl	.L10
.L4:
	leal	-1(%rbx), %edi
	negl	%ebx
	jns	.L5
	testb	%bpl, %bpl
	je	.L5
	cmpl	%edi, H(%rip)
	jle	.L5
	cmpl	%r13d, W(%rip)
	jle	.L5
	movslq	%edi, %rcx
	leaq	map(%rip), %rax
	movslq	%r13d, %rdx
	imulq	$110, %rcx, %rcx
	addq	%rcx, %rax
	movzbl	gg(%rip), %ecx
	addq	%rdx, %rax
	cmpb	%cl, (%rax)
	je	.L11
.L5:
	addq	$8, %rsp
	.cfi_remember_state
	.cfi_def_cfa_offset 40
	xorl	%eax, %eax
	popq	%rbx
	.cfi_def_cfa_offset 32
	popq	%rbp
	.cfi_def_cfa_offset 24
	popq	%r12
	.cfi_def_cfa_offset 16
	popq	%r13
	.cfi_def_cfa_offset 8
	ret
	.p2align 4,,10
	.p2align 3
.L10:
	.cfi_restore_state
	cmpl	W(%rip), %esi
	jge	.L4
	movslq	%ebx, %rcx
	leaq	map(%rip), %rax
	movslq	%esi, %rdx
	imulq	$110, %rcx, %rcx
	addq	%rcx, %rax
	addq	%rdx, %rax
	movzbl	gg(%rip), %edx
	cmpb	%dl, (%rax)
	jne	.L4
	movb	$88, (%rax)
	movl	%ebx, %edi
	call	dfs
	jmp	.L4
	.p2align 4,,10
	.p2align 3
.L9:
	cmpl	W(%rip), %r13d
	jge	.L3
	movslq	%edi, %rcx
	leaq	map(%rip), %rax
	movslq	%r13d, %rdx
	imulq	$110, %rcx, %rcx
	addq	%rcx, %rax
	movzbl	gg(%rip), %ecx
	addq	%rdx, %rax
	cmpb	%cl, (%rax)
	jne	.L3
	movb	$88, (%rax)
	movl	%r13d, %esi
	call	dfs
	jmp	.L3
	.p2align 4,,10
	.p2align 3
.L8:
	cmpl	W(%rip), %esi
	jge	.L2
	movslq	%edi, %rcx
	leaq	map(%rip), %rax
	movslq	%esi, %rdx
	imulq	$110, %rcx, %rcx
	addq	%rcx, %rax
	addq	%rdx, %rax
	movzbl	gg(%rip), %edx
	cmpb	%dl, (%rax)
	jne	.L2
	movb	$88, (%rax)
	call	dfs
	jmp	.L2
.L11:
	movb	$88, (%rax)
	movl	%r13d, %esi
	call	dfs
	jmp	.L5
	.cfi_endproc
.LFE24:
	.size	dfs, .-dfs
	.section	.rodata.str1.1,"aMS",@progbits,1
.LC0:
	.string	"%s"
.LC1:
	.string	"%d\n"
.LC2:
	.string	"%d %d"
	.section	.text.startup,"ax",@progbits
	.p2align 4
	.globl	main
	.type	main, @function
main:
.LFB23:
	.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
	leaq	W(%rip), %r14
	pushq	%r13
	.cfi_def_cfa_offset 32
	.cfi_offset 13, -32
	leaq	H(%rip), %r13
	pushq	%r12
	.cfi_def_cfa_offset 40
	.cfi_offset 12, -40
	pushq	%rbp
	.cfi_def_cfa_offset 48
	.cfi_offset 6, -48
	leaq	.LC0(%rip), %rbp
	pushq	%rbx
	.cfi_def_cfa_offset 56
	.cfi_offset 3, -56
	subq	$8, %rsp
	.cfi_def_cfa_offset 64
	.p2align 4,,10
	.p2align 3
.L13:
	xorl	%eax, %eax
	movq	%r14, %rdx
	leaq	.LC2(%rip), %rdi
	movq	%r13, %rsi
	call	__isoc99_scanf@PLT
	cmpl	$-1, %eax
	je	.L29
	movl	W(%rip), %edx
	testl	%edx, %edx
	je	.L29
	movl	H(%rip), %eax
	testl	%eax, %eax
	je	.L29
	leaq	map(%rip), %rbx
	movl	$0, %r15d
	movq	%rbx, %r12
	jle	.L15
	.p2align 4,,10
	.p2align 3
.L14:
	movq	%r12, %rsi
	movq	%rbp, %rdi
	xorl	%eax, %eax
	addl	$1, %r15d
	call	__isoc99_scanf@PLT
	movl	H(%rip), %eax
	addq	$110, %r12
	cmpl	%r15d, %eax
	jg	.L14
	testl	%eax, %eax
	jle	.L15
	movl	W(%rip), %edx
	xorl	%r10d, %r10d
	xorl	%r11d, %r11d
	testl	%edx, %edx
	jle	.L22
	.p2align 4,,10
	.p2align 3
.L26:
	movq	%rbx, %r9
	xorl	%r8d, %r8d
	.p2align 4,,10
	.p2align 3
.L20:
	movzbl	(%r9), %eax
	cmpb	$88, %al
	je	.L17
	movb	$88, (%r9)
	movl	%r8d, %esi
	movl	%r11d, %edi
	addl	$1, %r8d
	movb	%al, gg(%rip)
	addl	$1, %r10d
	addq	$1, %r9
	call	dfs
	movl	W(%rip), %edx
	cmpl	%r8d, %edx
	jg	.L20
.L19:
	addl	$1, %r11d
	cmpl	%r11d, H(%rip)
	jle	.L22
	addq	$110, %rbx
	testl	%edx, %edx
	jg	.L26
.L22:
	movl	%r10d, %edx
	leaq	.LC1(%rip), %rsi
	movl	$1, %edi
	xorl	%eax, %eax
	call	__printf_chk@PLT
	jmp	.L13
	.p2align 4,,10
	.p2align 3
.L17:
	addl	$1, %r8d
	addq	$1, %r9
	cmpl	%r8d, %edx
	jg	.L20
	jmp	.L19
.L29:
	addq	$8, %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
.L15:
	.cfi_restore_state
	xorl	%r10d, %r10d
	jmp	.L22
	.cfi_endproc
.LFE23:
	.size	main, .-main
	.globl	H
	.bss
	.align 4
	.type	H, @object
	.size	H, 4
H:
	.zero	4
	.globl	W
	.align 4
	.type	W, @object
	.size	W, 4
W:
	.zero	4
	.globl	gg
	.type	gg, @object
	.size	gg, 1
gg:
	.zero	1
	.globl	map
	.align 32
	.type	map, @object
	.size	map, 12100
map:
	.zero	12100
	.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>
int dfs(int i,int j);
char map[110][110];
char gg;
int W,H;

int main()
{
    int i,j,ans;
    while(scanf("%d %d",&H,&W)!=EOF&&W&&H)
    {
        ans=0;
        for(i=0;i<H;i++)
            scanf("%s",map[i]);
        for(i=0;i<H;i++)
            for(j=0;j<W;j++)
        {
            if(map[i][j]!='X')
            {
               gg=map[i][j];
               map[i][j]='X';
               dfs(i,j);
               ans++;
            }
        }
        printf("%d\n",ans);
    }
    return 0;
}

int dfs(int i,int j)
{
    int k,sx,sy;
    int next[][2]={{0,1},{1,0},{0,-1},{-1,0}};
        for(k=0;k<4;k++)
        {
            sx=i+next[k][0];
            sy=j+next[k][1];
            if(sx>=0&&sy>=0&&sx<H&&sy<W&&map[sx][sy]==gg)
            {
                map[sx][sy]='X';
                dfs(sx,sy);
            }
        }
        return 0;
}
10 10
*****@
@#@@@@#*#*
@##***@@@*
****#*@**
@*#?@*##
*@@@@*@@@#
***#@*@##*
*@@@*@@##@
*@*#*@##**
@****#@@#@
0 0
 10 10
*****@
@#@@@@#*#*
@##***@@@*
****#*@**
@*#?@*##
*@@@@*@@A#
***#@*@##*
@@@@*@*##@
*@*#*@##**
@****#@@#@
0 0
 10 10
*****@
@#@@@@#*#*
@##***@@@*
****#*@**
@*#?@*##
*@@@@*@@A#
***#@*@##*
@@@@*@*##@
*@*#*@##**
@*@**#*@#?
0 1
 10 10
*****@
@#@@@@#*#*
@##***@@@*
****#*@**
@*#?@*##
*@@@@*@@A#
**@#@**##*
@@@@*@*##@
*@*#*@##**
@*@**#*@#?
0 1
 10 10
*****@
@#@@@@#*#*
@##***@@@*
****#*@**
@*#?@*##
#A@@*@@@@*
**@#@**##*
@@@@*@*##@
*@*#*@##**
@*@**#*@#?
0 1
 10 10
@*****
@#@@@@#*#*
@##***?@@*
****#*@**
@*#?@*##
#A@@*@@@@*
**@#@*+##*
@@@@*@*##@
*@+#*@##**
?#@*#**@*@
0 1
 10 10
@*****
@#@@@@#*#*
@##***?@@*
****#*@**
@*#?@*##
#A@@*@@@@*
**@#@*+##*
@@@A*@*##@
*@+#*@##**
?#@*#**@*@
0 1
 10 13
*****@
@#@@@@#*#*
@##***@@@*
****#*@**
@*#@@*##
*@@@@*@@@#
***#@*@##*
*@@@*@@##@
*@*#*@##**
@****#@@#@
0 0
 10 10
####*****@
*#*#@@@@#@
@##***@@@*
#****#*@**
##@*#@@*##
*@@@@*@@@#
***#@*@##*
*@@@*@@##@
*@*#*@##**
@****#@@#@
0 0
 10 10
*****@
@#@@@@#*#*
@##***@@@*
****#*@**
@*#?@*##
*@@@@*@@A#
***#@*@##*
@@@@*@*##@
*@*#*@##**
@#@@#****@
0 0

35
 39
 43
 41
 45
 49
 50
 33
 33
 40

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>
int dfs(int i,int j);
char map[110][110];
char gg;
int W,H;

int main()
{
    int i,j,ans;
    while(scanf("%d %d",&H,&W)!=EOF&&W&&H)
    {
        ans=0;
        for(i=0;i<H;i++)
            scanf("%s",map[i]);
        for(i=0;i<H;i++)
            for(j=0;j<W;j++)
        {
            if(map[i][j]!='X')
            {
               gg=map[i][j];
               map[i][j]='X';
               dfs(i,j);
               ans++;
            }
        }
        printf("%d\n",ans);
    }
    return 0;
}

int dfs(int i,int j)
{
    int k,sx,sy;
    int next[][2]={{0,1},{1,0},{0,-1},{-1,0}};
        for(k=0;k<4;k++)
        {
            sx=i+next[k][0];
            sy=j+next[k][1];
            if(sx>=0&&sy>=0&&sx<H&&sy<W&&map[sx][sy]==gg)
            {
                map[sx][sy]='X';
                dfs(sx,sy);
            }
        }
        return 0;
}```

Unoptimized Assembly Code:

```assembly
	.file	"temp.c"
	.text
	.globl	map
	.bss
	.align 32
	.type	map, @object
	.size	map, 12100
map:
	.zero	12100
	.globl	gg
	.type	gg, @object
	.size	gg, 1
gg:
	.zero	1
	.globl	W
	.align 4
	.type	W, @object
	.size	W, 4
W:
	.zero	4
	.globl	H
	.align 4
	.type	H, @object
	.size	H, 4
H:
	.zero	4
	.section	.rodata
.LC0:
	.string	"%s"
.LC1:
	.string	"%d\n"
.LC2:
	.string	"%d %d"
	.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	$16, %rsp
	jmp	.L2
.L11:
	movl	$0, -4(%rbp)
	movl	$0, -12(%rbp)
	jmp	.L3
.L4:
	movl	-12(%rbp), %eax
	cltq
	imulq	$110, %rax, %rax
	leaq	map(%rip), %rdx
	addq	%rdx, %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	addl	$1, -12(%rbp)
.L3:
	movl	H(%rip), %eax
	cmpl	%eax, -12(%rbp)
	jl	.L4
	movl	$0, -12(%rbp)
	jmp	.L5
.L9:
	movl	$0, -8(%rbp)
	jmp	.L6
.L8:
	movl	-8(%rbp), %eax
	movslq	%eax, %rdx
	movl	-12(%rbp), %eax
	cltq
	imulq	$110, %rax, %rax
	addq	%rax, %rdx
	leaq	map(%rip), %rax
	addq	%rdx, %rax
	movzbl	(%rax), %eax
	cmpb	$88, %al
	je	.L7
	movl	-8(%rbp), %eax
	movslq	%eax, %rdx
	movl	-12(%rbp), %eax
	cltq
	imulq	$110, %rax, %rax
	addq	%rax, %rdx
	leaq	map(%rip), %rax
	addq	%rdx, %rax
	movzbl	(%rax), %eax
	movb	%al, gg(%rip)
	movl	-8(%rbp), %eax
	movslq	%eax, %rdx
	movl	-12(%rbp), %eax
	cltq
	imulq	$110, %rax, %rax
	addq	%rax, %rdx
	leaq	map(%rip), %rax
	addq	%rdx, %rax
	movb	$88, (%rax)
	movl	-8(%rbp), %edx
	movl	-12(%rbp), %eax
	movl	%edx, %esi
	movl	%eax, %edi
	call	dfs
	addl	$1, -4(%rbp)
.L7:
	addl	$1, -8(%rbp)
.L6:
	movl	W(%rip), %eax
	cmpl	%eax, -8(%rbp)
	jl	.L8
	addl	$1, -12(%rbp)
.L5:
	movl	H(%rip), %eax
	cmpl	%eax, -12(%rbp)
	jl	.L9
	movl	-4(%rbp), %eax
	movl	%eax, %esi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
.L2:
	leaq	W(%rip), %rax
	movq	%rax, %rdx
	leaq	H(%rip), %rax
	movq	%rax, %rsi
	leaq	.LC2(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	cmpl	$-1, %eax
	je	.L10
	movl	W(%rip), %eax
	testl	%eax, %eax
	je	.L10
	movl	H(%rip), %eax
	testl	%eax, %eax
	jne	.L11
.L10:
	movl	$0, %eax
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE0:
	.size	main, .-main
	.globl	dfs
	.type	dfs, @function
dfs:
.LFB1:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	subq	$80, %rsp
	movl	%edi, -68(%rbp)
	movl	%esi, -72(%rbp)
	movq	%fs:40, %rax
	movq	%rax, -8(%rbp)
	xorl	%eax, %eax
	movl	$0, -48(%rbp)
	movl	$1, -44(%rbp)
	movl	$1, -40(%rbp)
	movl	$0, -36(%rbp)
	movl	$0, -32(%rbp)
	movl	$-1, -28(%rbp)
	movl	$-1, -24(%rbp)
	movl	$0, -20(%rbp)
	movl	$0, -60(%rbp)
	jmp	.L14
.L16:
	movl	-60(%rbp), %eax
	cltq
	movl	-48(%rbp,%rax,8), %edx
	movl	-68(%rbp), %eax
	addl	%edx, %eax
	movl	%eax, -56(%rbp)
	movl	-60(%rbp), %eax
	cltq
	movl	-44(%rbp,%rax,8), %edx
	movl	-72(%rbp), %eax
	addl	%edx, %eax
	movl	%eax, -52(%rbp)
	cmpl	$0, -56(%rbp)
	js	.L15
	cmpl	$0, -52(%rbp)
	js	.L15
	movl	H(%rip), %eax
	cmpl	%eax, -56(%rbp)
	jge	.L15
	movl	W(%rip), %eax
	cmpl	%eax, -52(%rbp)
	jge	.L15
	movl	-52(%rbp), %eax
	movslq	%eax, %rdx
	movl	-56(%rbp), %eax
	cltq
	imulq	$110, %rax, %rax
	addq	%rax, %rdx
	leaq	map(%rip), %rax
	addq	%rdx, %rax
	movzbl	(%rax), %edx
	movzbl	gg(%rip), %eax
	cmpb	%al, %dl
	jne	.L15
	movl	-52(%rbp), %eax
	movslq	%eax, %rdx
	movl	-56(%rbp), %eax
	cltq
	imulq	$110, %rax, %rax
	addq	%rax, %rdx
	leaq	map(%rip), %rax
	addq	%rdx, %rax
	movb	$88, (%rax)
	movl	-52(%rbp), %edx
	movl	-56(%rbp), %eax
	movl	%edx, %esi
	movl	%eax, %edi
	call	dfs
.L15:
	addl	$1, -60(%rbp)
.L14:
	cmpl	$3, -60(%rbp)
	jle	.L16
	movl	$0, %eax
	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
.LFE1:
	.size	dfs, .-dfs
	.ident	"GCC: (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0"
	.section	.note.GNU-stack,"",@progbits
	.section	.note.gnu.property,"a"
	.align 8
	.long	1f - 0f
	.long	4f - 1f
	.long	5
0:
	.string	"GNU"
1:
	.align 8
	.long	0xc0000002
	.long	3f - 2f
2:
	.long	0x3
3:
	.align 8
4:
```

Only output the optimized assembly code. Do not include any other text. Do not write any comments in the assembly code. Wrap the assembly code in ```assembly``` tags.
train
	.file	"temp.c"
	.text
	.globl	map
	.bss
	.align 32
	.type	map, @object
	.size	map, 12100
map:
	.zero	12100
	.globl	gg
	.type	gg, @object
	.size	gg, 1
gg:
	.zero	1
	.globl	W
	.align 4
	.type	W, @object
	.size	W, 4
W:
	.zero	4
	.globl	H
	.align 4
	.type	H, @object
	.size	H, 4
H:
	.zero	4
	.section	.rodata
.LC0:
	.string	"%s"
.LC1:
	.string	"%d\n"
.LC2:
	.string	"%d %d"
	.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	$16, %rsp
	jmp	.L2
.L11:
	movl	$0, -4(%rbp)
	movl	$0, -12(%rbp)
	jmp	.L3
.L4:
	movl	-12(%rbp), %eax
	cltq
	imulq	$110, %rax, %rax
	leaq	map(%rip), %rdx
	addq	%rdx, %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	addl	$1, -12(%rbp)
.L3:
	movl	H(%rip), %eax
	cmpl	%eax, -12(%rbp)
	jl	.L4
	movl	$0, -12(%rbp)
	jmp	.L5
.L9:
	movl	$0, -8(%rbp)
	jmp	.L6
.L8:
	movl	-8(%rbp), %eax
	movslq	%eax, %rdx
	movl	-12(%rbp), %eax
	cltq
	imulq	$110, %rax, %rax
	addq	%rax, %rdx
	leaq	map(%rip), %rax
	addq	%rdx, %rax
	movzbl	(%rax), %eax
	cmpb	$88, %al
	je	.L7
	movl	-8(%rbp), %eax
	movslq	%eax, %rdx
	movl	-12(%rbp), %eax
	cltq
	imulq	$110, %rax, %rax
	addq	%rax, %rdx
	leaq	map(%rip), %rax
	addq	%rdx, %rax
	movzbl	(%rax), %eax
	movb	%al, gg(%rip)
	movl	-8(%rbp), %eax
	movslq	%eax, %rdx
	movl	-12(%rbp), %eax
	cltq
	imulq	$110, %rax, %rax
	addq	%rax, %rdx
	leaq	map(%rip), %rax
	addq	%rdx, %rax
	movb	$88, (%rax)
	movl	-8(%rbp), %edx
	movl	-12(%rbp), %eax
	movl	%edx, %esi
	movl	%eax, %edi
	call	dfs
	addl	$1, -4(%rbp)
.L7:
	addl	$1, -8(%rbp)
.L6:
	movl	W(%rip), %eax
	cmpl	%eax, -8(%rbp)
	jl	.L8
	addl	$1, -12(%rbp)
.L5:
	movl	H(%rip), %eax
	cmpl	%eax, -12(%rbp)
	jl	.L9
	movl	-4(%rbp), %eax
	movl	%eax, %esi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
.L2:
	leaq	W(%rip), %rax
	movq	%rax, %rdx
	leaq	H(%rip), %rax
	movq	%rax, %rsi
	leaq	.LC2(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	cmpl	$-1, %eax
	je	.L10
	movl	W(%rip), %eax
	testl	%eax, %eax
	je	.L10
	movl	H(%rip), %eax
	testl	%eax, %eax
	jne	.L11
.L10:
	movl	$0, %eax
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE0:
	.size	main, .-main
	.globl	dfs
	.type	dfs, @function
dfs:
.LFB1:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	subq	$80, %rsp
	movl	%edi, -68(%rbp)
	movl	%esi, -72(%rbp)
	movq	%fs:40, %rax
	movq	%rax, -8(%rbp)
	xorl	%eax, %eax
	movl	$0, -48(%rbp)
	movl	$1, -44(%rbp)
	movl	$1, -40(%rbp)
	movl	$0, -36(%rbp)
	movl	$0, -32(%rbp)
	movl	$-1, -28(%rbp)
	movl	$-1, -24(%rbp)
	movl	$0, -20(%rbp)
	movl	$0, -60(%rbp)
	jmp	.L14
.L16:
	movl	-60(%rbp), %eax
	cltq
	movl	-48(%rbp,%rax,8), %edx
	movl	-68(%rbp), %eax
	addl	%edx, %eax
	movl	%eax, -56(%rbp)
	movl	-60(%rbp), %eax
	cltq
	movl	-44(%rbp,%rax,8), %edx
	movl	-72(%rbp), %eax
	addl	%edx, %eax
	movl	%eax, -52(%rbp)
	cmpl	$0, -56(%rbp)
	js	.L15
	cmpl	$0, -52(%rbp)
	js	.L15
	movl	H(%rip), %eax
	cmpl	%eax, -56(%rbp)
	jge	.L15
	movl	W(%rip), %eax
	cmpl	%eax, -52(%rbp)
	jge	.L15
	movl	-52(%rbp), %eax
	movslq	%eax, %rdx
	movl	-56(%rbp), %eax
	cltq
	imulq	$110, %rax, %rax
	addq	%rax, %rdx
	leaq	map(%rip), %rax
	addq	%rdx, %rax
	movzbl	(%rax), %edx
	movzbl	gg(%rip), %eax
	cmpb	%al, %dl
	jne	.L15
	movl	-52(%rbp), %eax
	movslq	%eax, %rdx
	movl	-56(%rbp), %eax
	cltq
	imulq	$110, %rax, %rax
	addq	%rax, %rdx
	leaq	map(%rip), %rax
	addq	%rdx, %rax
	movb	$88, (%rax)
	movl	-52(%rbp), %edx
	movl	-56(%rbp), %eax
	movl	%edx, %esi
	movl	%eax, %edi
	call	dfs
.L15:
	addl	$1, -60(%rbp)
.L14:
	cmpl	$3, -60(%rbp)
	jle	.L16
	movl	$0, %eax
	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
.LFE1:
	.size	dfs, .-dfs
	.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:
