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

```c
// Aizu 2103: Battle Town
// 2017.9.20 bal4u@uu

#include <stdio.h>

char map[22][22]; int h, w;
char s[102];
char tbl[128];
int mv[4][2] = { {-1,0},{0,1},{1,0},{0,-1} };
char dir[4] = { '^', '>', 'v', '<' };

int main()
{
	int cno, t, n, r, c, tr, tc, d, k;
	char *p;

	tbl['^'] = 1, tbl['>'] = 2, tbl['v'] = 3, tbl['<'] = 4;
	tbl['U'] = 1, tbl['R'] = 2, tbl['D'] = 3, tbl['L'] = 4;
	scanf("%d", &t); cno = 0; while (t-- > 0) {
		scanf("%d%d", &h, &w);
		for (r = 0; r < h; r++) {
			scanf("%s", map[r]);
			for (c = 0; c < w; c++) if ((k = tbl[map[r][c]]) > 0) tr = r, tc = c, d = k-1;
		}
		scanf("%d", &n);
		scanf("%s", s); p = s;
		while (*p) {
			if (*p != 'S') {
				d = tbl[*p]-1; r = tr + mv[d][0], c = tc + mv[d][1]; map[tr][tc] = '.';
				if (r >= 0 && r < h && c >= 0 && c < w && map[r][c] == '.') tr = r, tc = c;
				map[tr][tc] = dir[d];
			} else {
				r = tr, c = tc; while (1) {
					r += mv[d][0], c += mv[d][1];
					if (r < 0 || r >= h || c < 0 || c >= w) break;
					if (map[r][c] == '*') { map[r][c] = '.'; break; }
					else if (map[r][c] == '#') break;
				}
			}
			p++;
		}
		if (cno++) putchar('\n');
		for (r = 0; r < h; r++) puts(map[r]);
	}
	return 0;
}```

Unoptimized Assembly Code:

```assembly
	.file	"temp.c"
	.text
	.globl	map
	.bss
	.align 32
	.type	map, @object
	.size	map, 484
map:
	.zero	484
	.globl	h
	.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	s
	.align 32
	.type	s, @object
	.size	s, 102
s:
	.zero	102
	.globl	tbl
	.align 32
	.type	tbl, @object
	.size	tbl, 128
tbl:
	.zero	128
	.globl	mv
	.data
	.align 32
	.type	mv, @object
	.size	mv, 32
mv:
	.long	-1
	.long	0
	.long	0
	.long	1
	.long	1
	.long	0
	.long	0
	.long	-1
	.globl	dir
	.type	dir, @object
	.size	dir, 4
dir:
	.ascii	"^>v<"
	.section	.rodata
.LC0:
	.string	"%d"
.LC1:
	.string	"%d%d"
.LC2:
	.string	"%s"
	.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	$64, %rsp
	movq	%fs:40, %rax
	movq	%rax, -8(%rbp)
	xorl	%eax, %eax
	movb	$1, 94+tbl(%rip)
	movb	$2, 62+tbl(%rip)
	movb	$3, 118+tbl(%rip)
	movb	$4, 60+tbl(%rip)
	movb	$1, 85+tbl(%rip)
	movb	$2, 82+tbl(%rip)
	movb	$3, 68+tbl(%rip)
	movb	$4, 76+tbl(%rip)
	leaq	-52(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	$0, -44(%rbp)
	jmp	.L2
.L19:
	leaq	w(%rip), %rax
	movq	%rax, %rdx
	leaq	h(%rip), %rax
	movq	%rax, %rsi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	$0, -40(%rbp)
	jmp	.L3
.L7:
	movl	-40(%rbp), %eax
	movslq	%eax, %rdx
	movq	%rdx, %rax
	salq	$2, %rax
	addq	%rdx, %rax
	addq	%rax, %rax
	addq	%rdx, %rax
	addq	%rax, %rax
	leaq	map(%rip), %rdx
	addq	%rdx, %rax
	movq	%rax, %rsi
	leaq	.LC2(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	$0, -36(%rbp)
	jmp	.L4
.L6:
	movl	-36(%rbp), %eax
	movslq	%eax, %rcx
	movl	-40(%rbp), %eax
	movslq	%eax, %rdx
	movq	%rdx, %rax
	salq	$2, %rax
	addq	%rdx, %rax
	addq	%rax, %rax
	addq	%rdx, %rax
	addq	%rax, %rax
	leaq	(%rax,%rcx), %rdx
	leaq	map(%rip), %rax
	addq	%rdx, %rax
	movzbl	(%rax), %eax
	movsbl	%al, %eax
	cltq
	leaq	tbl(%rip), %rdx
	movzbl	(%rax,%rdx), %eax
	movsbl	%al, %eax
	movl	%eax, -20(%rbp)
	cmpl	$0, -20(%rbp)
	jle	.L5
	movl	-40(%rbp), %eax
	movl	%eax, -32(%rbp)
	movl	-36(%rbp), %eax
	movl	%eax, -28(%rbp)
	movl	-20(%rbp), %eax
	subl	$1, %eax
	movl	%eax, -24(%rbp)
.L5:
	addl	$1, -36(%rbp)
.L4:
	movl	w(%rip), %eax
	cmpl	%eax, -36(%rbp)
	jl	.L6
	addl	$1, -40(%rbp)
.L3:
	movl	h(%rip), %eax
	cmpl	%eax, -40(%rbp)
	jl	.L7
	leaq	-48(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	leaq	s(%rip), %rax
	movq	%rax, %rsi
	leaq	.LC2(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	leaq	s(%rip), %rax
	movq	%rax, -16(%rbp)
	jmp	.L8
.L15:
	movq	-16(%rbp), %rax
	movzbl	(%rax), %eax
	cmpb	$83, %al
	je	.L9
	movq	-16(%rbp), %rax
	movzbl	(%rax), %eax
	movsbl	%al, %eax
	cltq
	leaq	tbl(%rip), %rdx
	movzbl	(%rax,%rdx), %eax
	movsbl	%al, %eax
	subl	$1, %eax
	movl	%eax, -24(%rbp)
	movl	-24(%rbp), %eax
	cltq
	leaq	0(,%rax,8), %rdx
	leaq	mv(%rip), %rax
	movl	(%rdx,%rax), %edx
	movl	-32(%rbp), %eax
	addl	%edx, %eax
	movl	%eax, -40(%rbp)
	movl	-24(%rbp), %eax
	cltq
	leaq	0(,%rax,8), %rdx
	leaq	4+mv(%rip), %rax
	movl	(%rdx,%rax), %edx
	movl	-28(%rbp), %eax
	addl	%edx, %eax
	movl	%eax, -36(%rbp)
	movl	-28(%rbp), %eax
	movslq	%eax, %rcx
	movl	-32(%rbp), %eax
	movslq	%eax, %rdx
	movq	%rdx, %rax
	salq	$2, %rax
	addq	%rdx, %rax
	addq	%rax, %rax
	addq	%rdx, %rax
	addq	%rax, %rax
	leaq	(%rax,%rcx), %rdx
	leaq	map(%rip), %rax
	addq	%rdx, %rax
	movb	$46, (%rax)
	cmpl	$0, -40(%rbp)
	js	.L10
	movl	h(%rip), %eax
	cmpl	%eax, -40(%rbp)
	jge	.L10
	cmpl	$0, -36(%rbp)
	js	.L10
	movl	w(%rip), %eax
	cmpl	%eax, -36(%rbp)
	jge	.L10
	movl	-36(%rbp), %eax
	movslq	%eax, %rcx
	movl	-40(%rbp), %eax
	movslq	%eax, %rdx
	movq	%rdx, %rax
	salq	$2, %rax
	addq	%rdx, %rax
	addq	%rax, %rax
	addq	%rdx, %rax
	addq	%rax, %rax
	leaq	(%rax,%rcx), %rdx
	leaq	map(%rip), %rax
	addq	%rdx, %rax
	movzbl	(%rax), %eax
	cmpb	$46, %al
	jne	.L10
	movl	-40(%rbp), %eax
	movl	%eax, -32(%rbp)
	movl	-36(%rbp), %eax
	movl	%eax, -28(%rbp)
.L10:
	movl	-24(%rbp), %eax
	cltq
	leaq	dir(%rip), %rdx
	movzbl	(%rax,%rdx), %ecx
	movl	-28(%rbp), %eax
	movslq	%eax, %rsi
	movl	-32(%rbp), %eax
	movslq	%eax, %rdx
	movq	%rdx, %rax
	salq	$2, %rax
	addq	%rdx, %rax
	addq	%rax, %rax
	addq	%rdx, %rax
	addq	%rax, %rax
	leaq	(%rax,%rsi), %rdx
	leaq	map(%rip), %rax
	addq	%rdx, %rax
	movb	%cl, (%rax)
	jmp	.L11
.L9:
	movl	-32(%rbp), %eax
	movl	%eax, -40(%rbp)
	movl	-28(%rbp), %eax
	movl	%eax, -36(%rbp)
.L14:
	movl	-24(%rbp), %eax
	cltq
	leaq	0(,%rax,8), %rdx
	leaq	mv(%rip), %rax
	movl	(%rdx,%rax), %eax
	addl	%eax, -40(%rbp)
	movl	-24(%rbp), %eax
	cltq
	leaq	0(,%rax,8), %rdx
	leaq	4+mv(%rip), %rax
	movl	(%rdx,%rax), %eax
	addl	%eax, -36(%rbp)
	cmpl	$0, -40(%rbp)
	js	.L11
	movl	h(%rip), %eax
	cmpl	%eax, -40(%rbp)
	jge	.L11
	cmpl	$0, -36(%rbp)
	js	.L11
	movl	w(%rip), %eax
	cmpl	%eax, -36(%rbp)
	jge	.L11
	movl	-36(%rbp), %eax
	movslq	%eax, %rcx
	movl	-40(%rbp), %eax
	movslq	%eax, %rdx
	movq	%rdx, %rax
	salq	$2, %rax
	addq	%rdx, %rax
	addq	%rax, %rax
	addq	%rdx, %rax
	addq	%rax, %rax
	leaq	(%rax,%rcx), %rdx
	leaq	map(%rip), %rax
	addq	%rdx, %rax
	movzbl	(%rax), %eax
	cmpb	$42, %al
	jne	.L12
	movl	-36(%rbp), %eax
	movslq	%eax, %rcx
	movl	-40(%rbp), %eax
	movslq	%eax, %rdx
	movq	%rdx, %rax
	salq	$2, %rax
	addq	%rdx, %rax
	addq	%rax, %rax
	addq	%rdx, %rax
	addq	%rax, %rax
	leaq	(%rax,%rcx), %rdx
	leaq	map(%rip), %rax
	addq	%rdx, %rax
	movb	$46, (%rax)
	jmp	.L11
.L12:
	movl	-36(%rbp), %eax
	movslq	%eax, %rcx
	movl	-40(%rbp), %eax
	movslq	%eax, %rdx
	movq	%rdx, %rax
	salq	$2, %rax
	addq	%rdx, %rax
	addq	%rax, %rax
	addq	%rdx, %rax
	addq	%rax, %rax
	leaq	(%rax,%rcx), %rdx
	leaq	map(%rip), %rax
	addq	%rdx, %rax
	movzbl	(%rax), %eax
	cmpb	$35, %al
	je	.L22
	jmp	.L14
.L22:
	nop
.L11:
	addq	$1, -16(%rbp)
.L8:
	movq	-16(%rbp), %rax
	movzbl	(%rax), %eax
	testb	%al, %al
	jne	.L15
	movl	-44(%rbp), %eax
	leal	1(%rax), %edx
	movl	%edx, -44(%rbp)
	testl	%eax, %eax
	je	.L16
	movl	$10, %edi
	call	putchar@PLT
.L16:
	movl	$0, -40(%rbp)
	jmp	.L17
.L18:
	movl	-40(%rbp), %eax
	movslq	%eax, %rdx
	movq	%rdx, %rax
	salq	$2, %rax
	addq	%rdx, %rax
	addq	%rax, %rax
	addq	%rdx, %rax
	addq	%rax, %rax
	leaq	map(%rip), %rdx
	addq	%rdx, %rax
	movq	%rax, %rdi
	call	puts@PLT
	addl	$1, -40(%rbp)
.L17:
	movl	h(%rip), %eax
	cmpl	%eax, -40(%rbp)
	jl	.L18
.L2:
	movl	-52(%rbp), %eax
	leal	-1(%rax), %edx
	movl	%edx, -52(%rbp)
	testl	%eax, %eax
	jg	.L19
	movl	$0, %eax
	movq	-8(%rbp), %rdx
	subq	%fs:40, %rdx
	je	.L21
	call	__stack_chk_fail@PLT
.L21:
	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"
.LC1:
	.string	"%d%d"
.LC2:
	.string	"%s"
	.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
	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	$56, %rsp
	.cfi_def_cfa_offset 112
	movq	%fs:40, %rax
	movq	%rax, 40(%rsp)
	xorl	%eax, %eax
	leaq	32(%rsp), %rsi
	movb	$1, 94+tbl(%rip)
	movb	$2, 62+tbl(%rip)
	movb	$3, 118+tbl(%rip)
	movb	$4, 60+tbl(%rip)
	movb	$1, 85+tbl(%rip)
	movb	$2, 82+tbl(%rip)
	movb	$3, 68+tbl(%rip)
	movb	$4, 76+tbl(%rip)
	call	__isoc99_scanf@PLT
	movl	32(%rsp), %eax
	leal	-1(%rax), %edx
	movl	%edx, 32(%rsp)
	testl	%eax, %eax
	jle	.L21
	leaq	36(%rsp), %rax
	movl	$0, 12(%rsp)
	leaq	tbl(%rip), %rbx
	movq	%rax, 24(%rsp)
	.p2align 4,,10
	.p2align 3
.L2:
	leaq	w(%rip), %rdx
	leaq	h(%rip), %rsi
	xorl	%eax, %eax
	leaq	.LC1(%rip), %rdi
	call	__isoc99_scanf@PLT
	movl	h(%rip), %ecx
	testl	%ecx, %ecx
	jle	.L3
	leaq	map(%rip), %r14
	xorl	%r13d, %r13d
	.p2align 4,,10
	.p2align 3
.L7:
	movq	%r14, %rsi
	leaq	.LC2(%rip), %rdi
	xorl	%eax, %eax
	call	__isoc99_scanf@PLT
	movslq	w(%rip), %rcx
	testl	%ecx, %ecx
	jle	.L4
	xorl	%eax, %eax
	.p2align 4,,10
	.p2align 3
.L6:
	movsbq	(%r14,%rax), %rdx
	movsbl	(%rbx,%rdx), %edx
	testl	%edx, %edx
	jle	.L5
	leal	-1(%rdx), %r15d
	movl	%eax, %r12d
	movl	%r13d, %ebp
.L5:
	addq	$1, %rax
	cmpq	%rcx, %rax
	jne	.L6
.L4:
	addl	$1, %r13d
	addq	$22, %r14
	cmpl	%r13d, h(%rip)
	jg	.L7
.L3:
	movq	24(%rsp), %rsi
	leaq	.LC0(%rip), %rdi
	xorl	%eax, %eax
	call	__isoc99_scanf@PLT
	leaq	s(%rip), %rsi
	leaq	.LC2(%rip), %rdi
	xorl	%eax, %eax
	call	__isoc99_scanf@PLT
	leaq	s(%rip), %rax
	movsbq	(%rax), %rax
	testb	%al, %al
	je	.L8
	movl	h(%rip), %r9d
	movl	w(%rip), %r14d
	leaq	s(%rip), %rcx
	leaq	mv(%rip), %rsi
	jmp	.L18
	.p2align 4,,10
	.p2align 3
.L62:
	movsbl	(%rbx,%rax), %r15d
	movslq	%ebp, %rax
	leaq	map(%rip), %r11
	movslq	%r12d, %rdi
	leaq	(%rax,%rax,4), %r10
	subl	$1, %r15d
	leaq	(%rax,%r10,2), %r10
	leaq	(%r11,%r10,2), %r10
	movslq	%r15d, %rdx
	movb	$46, (%r10,%rdi)
	movl	4(%rsi,%rdx,8), %r8d
	movl	%ebp, %r10d
	addl	(%rsi,%rdx,8), %r10d
	js	.L10
	addl	%r12d, %r8d
	js	.L10
	cmpl	%r10d, %r9d
	jg	.L61
.L10:
	leaq	(%rax,%rax,4), %r8
	leaq	map(%rip), %r11
	leaq	(%rax,%r8,2), %rax
	leaq	(%r11,%rax,2), %rax
	leaq	dir(%rip), %r11
	movzbl	(%r11,%rdx), %edx
	movb	%dl, (%rax,%rdi)
.L11:
	movsbq	1(%rcx), %rax
	addq	$1, %rcx
	testb	%al, %al
	je	.L8
.L18:
	cmpb	$83, %al
	jne	.L62
	movslq	%r15d, %rax
	movl	4(%rsi,%rax,8), %r10d
	movl	(%rsi,%rax,8), %r11d
	cmpl	$1, %r10d
	jne	.L26
	cmpl	$1, %r11d
	jne	.L26
	movslq	%ebp, %rax
	leaq	(%rax,%rax,4), %rdx
	leaq	(%rax,%rdx,2), %rdx
	movslq	%r12d, %rax
	leaq	(%rax,%rdx,2), %rdi
	leaq	map(%rip), %rax
	movl	%r12d, %edx
	addq	%rax, %rdi
	movl	%ebp, %eax
	jmp	.L17
	.p2align 4,,10
	.p2align 3
.L63:
	addq	$23, %rdi
	cmpb	$35, %r8b
	je	.L11
.L17:
	addl	$1, %edx
	addl	$1, %eax
	js	.L11
	cmpl	%eax, %r9d
	jle	.L11
	testl	%edx, %edx
	js	.L11
	cmpl	%edx, %r14d
	jle	.L11
	movzbl	23(%rdi), %r8d
	cmpb	$42, %r8b
	jne	.L63
.L16:
	cltq
	movslq	%edx, %rdx
	addq	$1, %rcx
	leaq	(%rax,%rax,4), %rdi
	leaq	(%rax,%rdi,2), %rax
	leaq	map(%rip), %rdi
	leaq	(%rdi,%rax,2), %rax
	movb	$46, (%rax,%rdx)
	movsbq	(%rcx), %rax
	testb	%al, %al
	jne	.L18
	.p2align 4,,10
	.p2align 3
.L8:
	movl	12(%rsp), %edx
	testl	%edx, %edx
	jne	.L64
.L19:
	movl	h(%rip), %eax
	leaq	map(%rip), %r14
	xorl	%r13d, %r13d
	testl	%eax, %eax
	jle	.L23
	.p2align 4,,10
	.p2align 3
.L22:
	movq	%r14, %rdi
	addl	$1, %r13d
	addq	$22, %r14
	call	puts@PLT
	cmpl	%r13d, h(%rip)
	jg	.L22
.L23:
	movl	32(%rsp), %eax
	addl	$1, 12(%rsp)
	leal	-1(%rax), %edx
	movl	%edx, 32(%rsp)
	testl	%eax, %eax
	jg	.L2
.L21:
	movq	40(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L65
	addq	$56, %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
.L61:
	.cfi_restore_state
	cmpl	%r8d, %r14d
	jle	.L10
	movslq	%r10d, %r13
	movq	%r13, %r11
	leaq	0(%r13,%r13,4), %r13
	movq	%r11, 16(%rsp)
	leaq	(%r11,%r13,2), %r13
	leaq	map(%rip), %r11
	leaq	(%r11,%r13,2), %r13
	movslq	%r8d, %r11
	cmpb	$46, 0(%r13,%r11)
	cmove	16(%rsp), %rax
	cmove	%r8d, %r12d
	cmove	%r10d, %ebp
	cmove	%r11, %rdi
	jmp	.L10
.L64:
	movq	stdout(%rip), %rsi
	movl	$10, %edi
	call	putc@PLT
	jmp	.L19
.L26:
	movslq	%r11d, %rax
	leaq	(%rax,%rax,4), %rdx
	leaq	(%rax,%rdx,2), %rdx
	movslq	%r10d, %rax
	leaq	(%rax,%rdx,2), %r13
	leal	(%r11,%rbp), %eax
	cltq
	leaq	(%rax,%rax,4), %rdx
	leaq	(%rax,%rdx,2), %rdx
	leal	(%r10,%r12), %eax
	cltq
	leaq	(%rax,%rdx,2), %rdi
	leaq	map(%rip), %rax
	movl	%r12d, %edx
	addq	%rax, %rdi
	movl	%ebp, %eax
	jmp	.L15
	.p2align 4,,10
	.p2align 3
.L14:
	addq	%r13, %rdi
	cmpb	$35, %r8b
	je	.L11
.L15:
	addl	%r11d, %eax
	addl	%r10d, %edx
	movl	%eax, %r8d
	orl	%edx, %r8d
	js	.L11
	cmpl	%eax, %r9d
	jle	.L11
	cmpl	%edx, %r14d
	jle	.L11
	movzbl	(%rdi), %r8d
	cmpb	$42, %r8b
	jne	.L14
	jmp	.L16
.L65:
	call	__stack_chk_fail@PLT
	.cfi_endproc
.LFE23:
	.size	main, .-main
	.globl	dir
	.data
	.type	dir, @object
	.size	dir, 4
dir:
	.ascii	"^>v<"
	.globl	mv
	.align 32
	.type	mv, @object
	.size	mv, 32
mv:
	.long	-1
	.long	0
	.long	0
	.long	1
	.long	1
	.long	0
	.long	0
	.long	-1
	.globl	tbl
	.bss
	.align 32
	.type	tbl, @object
	.size	tbl, 128
tbl:
	.zero	128
	.globl	s
	.align 32
	.type	s, @object
	.size	s, 102
s:
	.zero	102
	.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
	.globl	map
	.align 32
	.type	map, @object
	.size	map, 484
map:
	.zero	484
	.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"
.LC1:
	.string	"%d%d"
.LC2:
	.string	"%s"
	.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
	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	$56, %rsp
	.cfi_def_cfa_offset 112
	movq	%fs:40, %rax
	movq	%rax, 40(%rsp)
	xorl	%eax, %eax
	leaq	32(%rsp), %rsi
	movb	$1, 94+tbl(%rip)
	movb	$2, 62+tbl(%rip)
	movb	$3, 118+tbl(%rip)
	movb	$4, 60+tbl(%rip)
	movb	$1, 85+tbl(%rip)
	movb	$2, 82+tbl(%rip)
	movb	$3, 68+tbl(%rip)
	movb	$4, 76+tbl(%rip)
	call	__isoc99_scanf@PLT
	movl	32(%rsp), %eax
	leal	-1(%rax), %edx
	movl	%edx, 32(%rsp)
	testl	%eax, %eax
	jle	.L21
	leaq	36(%rsp), %rax
	movl	$0, 12(%rsp)
	leaq	tbl(%rip), %rbx
	movq	%rax, 24(%rsp)
	.p2align 4,,10
	.p2align 3
.L2:
	leaq	w(%rip), %rdx
	leaq	h(%rip), %rsi
	xorl	%eax, %eax
	leaq	.LC1(%rip), %rdi
	call	__isoc99_scanf@PLT
	movl	h(%rip), %ecx
	testl	%ecx, %ecx
	jle	.L3
	leaq	map(%rip), %r14
	xorl	%r13d, %r13d
	.p2align 4,,10
	.p2align 3
.L7:
	movq	%r14, %rsi
	leaq	.LC2(%rip), %rdi
	xorl	%eax, %eax
	call	__isoc99_scanf@PLT
	movslq	w(%rip), %rcx
	testl	%ecx, %ecx
	jle	.L4
	xorl	%eax, %eax
	.p2align 4,,10
	.p2align 3
.L6:
	movsbq	(%r14,%rax), %rdx
	movsbl	(%rbx,%rdx), %edx
	testl	%edx, %edx
	jle	.L5
	leal	-1(%rdx), %r15d
	movl	%eax, %r12d
	movl	%r13d, %ebp
.L5:
	addq	$1, %rax
	cmpq	%rcx, %rax
	jne	.L6
.L4:
	addl	$1, %r13d
	addq	$22, %r14
	cmpl	%r13d, h(%rip)
	jg	.L7
.L3:
	movq	24(%rsp), %rsi
	leaq	.LC0(%rip), %rdi
	xorl	%eax, %eax
	call	__isoc99_scanf@PLT
	leaq	s(%rip), %rsi
	leaq	.LC2(%rip), %rdi
	xorl	%eax, %eax
	call	__isoc99_scanf@PLT
	leaq	s(%rip), %rax
	movsbq	(%rax), %rax
	testb	%al, %al
	je	.L8
	movl	h(%rip), %r9d
	movl	w(%rip), %r14d
	leaq	s(%rip), %rcx
	leaq	mv(%rip), %rsi
	jmp	.L18
	.p2align 4,,10
	.p2align 3
.L62:
	movsbl	(%rbx,%rax), %r15d
	movslq	%ebp, %rax
	leaq	map(%rip), %r11
	movslq	%r12d, %rdi
	leaq	(%rax,%rax,4), %r10
	subl	$1, %r15d
	leaq	(%rax,%r10,2), %r10
	leaq	(%r11,%r10,2), %r10
	movslq	%r15d, %rdx
	movb	$46, (%r10,%rdi)
	movl	4(%rsi,%rdx,8), %r8d
	movl	%ebp, %r10d
	addl	(%rsi,%rdx,8), %r10d
	js	.L10
	addl	%r12d, %r8d
	js	.L10
	cmpl	%r10d, %r9d
	jg	.L61
.L10:
	leaq	(%rax,%rax,4), %r8
	leaq	map(%rip), %r11
	leaq	(%rax,%r8,2), %rax
	leaq	(%r11,%rax,2), %rax
	leaq	dir(%rip), %r11
	movzbl	(%r11,%rdx), %edx
	movb	%dl, (%rax,%rdi)
.L11:
	movsbq	1(%rcx), %rax
	addq	$1, %rcx
	testb	%al, %al
	je	.L8
.L18:
	cmpb	$83, %al
	jne	.L62
	movslq	%r15d, %rax
	movl	4(%rsi,%rax,8), %r10d
	movl	(%rsi,%rax,8), %r11d
	cmpl	$1, %r10d
	jne	.L26
	cmpl	$1, %r11d
	jne	.L26
	movslq	%ebp, %rax
	leaq	(%rax,%rax,4), %rdx
	leaq	(%rax,%rdx,2), %rdx
	movslq	%r12d, %rax
	leaq	(%rax,%rdx,2), %rdi
	leaq	map(%rip), %rax
	movl	%r12d, %edx
	addq	%rax, %rdi
	movl	%ebp, %eax
	jmp	.L17
	.p2align 4,,10
	.p2align 3
.L63:
	addq	$23, %rdi
	cmpb	$35, %r8b
	je	.L11
.L17:
	addl	$1, %edx
	addl	$1, %eax
	js	.L11
	cmpl	%eax, %r9d
	jle	.L11
	testl	%edx, %edx
	js	.L11
	cmpl	%edx, %r14d
	jle	.L11
	movzbl	23(%rdi), %r8d
	cmpb	$42, %r8b
	jne	.L63
.L16:
	cltq
	movslq	%edx, %rdx
	addq	$1, %rcx
	leaq	(%rax,%rax,4), %rdi
	leaq	(%rax,%rdi,2), %rax
	leaq	map(%rip), %rdi
	leaq	(%rdi,%rax,2), %rax
	movb	$46, (%rax,%rdx)
	movsbq	(%rcx), %rax
	testb	%al, %al
	jne	.L18
	.p2align 4,,10
	.p2align 3
.L8:
	movl	12(%rsp), %edx
	testl	%edx, %edx
	jne	.L64
.L19:
	movl	h(%rip), %eax
	leaq	map(%rip), %r14
	xorl	%r13d, %r13d
	testl	%eax, %eax
	jle	.L23
	.p2align 4,,10
	.p2align 3
.L22:
	movq	%r14, %rdi
	addl	$1, %r13d
	addq	$22, %r14
	call	puts@PLT
	cmpl	%r13d, h(%rip)
	jg	.L22
.L23:
	movl	32(%rsp), %eax
	addl	$1, 12(%rsp)
	leal	-1(%rax), %edx
	movl	%edx, 32(%rsp)
	testl	%eax, %eax
	jg	.L2
.L21:
	movq	40(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L65
	addq	$56, %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
.L61:
	.cfi_restore_state
	cmpl	%r8d, %r14d
	jle	.L10
	movslq	%r10d, %r13
	movq	%r13, %r11
	leaq	0(%r13,%r13,4), %r13
	movq	%r11, 16(%rsp)
	leaq	(%r11,%r13,2), %r13
	leaq	map(%rip), %r11
	leaq	(%r11,%r13,2), %r13
	movslq	%r8d, %r11
	cmpb	$46, 0(%r13,%r11)
	cmove	16(%rsp), %rax
	cmove	%r8d, %r12d
	cmove	%r10d, %ebp
	cmove	%r11, %rdi
	jmp	.L10
.L64:
	movq	stdout(%rip), %rsi
	movl	$10, %edi
	call	putc@PLT
	jmp	.L19
.L26:
	movslq	%r11d, %rax
	leaq	(%rax,%rax,4), %rdx
	leaq	(%rax,%rdx,2), %rdx
	movslq	%r10d, %rax
	leaq	(%rax,%rdx,2), %r13
	leal	(%r11,%rbp), %eax
	cltq
	leaq	(%rax,%rax,4), %rdx
	leaq	(%rax,%rdx,2), %rdx
	leal	(%r10,%r12), %eax
	cltq
	leaq	(%rax,%rdx,2), %rdi
	leaq	map(%rip), %rax
	movl	%r12d, %edx
	addq	%rax, %rdi
	movl	%ebp, %eax
	jmp	.L15
	.p2align 4,,10
	.p2align 3
.L14:
	addq	%r13, %rdi
	cmpb	$35, %r8b
	je	.L11
.L15:
	addl	%r11d, %eax
	addl	%r10d, %edx
	movl	%eax, %r8d
	orl	%edx, %r8d
	js	.L11
	cmpl	%eax, %r9d
	jle	.L11
	cmpl	%edx, %r14d
	jle	.L11
	movzbl	(%rdi), %r8d
	cmpb	$42, %r8b
	jne	.L14
	jmp	.L16
.L65:
	call	__stack_chk_fail@PLT
	.cfi_endproc
.LFE23:
	.size	main, .-main
	.globl	dir
	.data
	.type	dir, @object
	.size	dir, 4
dir:
	.ascii	"^>v<"
	.globl	mv
	.align 32
	.type	mv, @object
	.size	mv, 32
mv:
	.long	-1
	.long	0
	.long	0
	.long	1
	.long	1
	.long	0
	.long	0
	.long	-1
	.globl	tbl
	.bss
	.align 32
	.type	tbl, @object
	.size	tbl, 128
tbl:
	.zero	128
	.globl	s
	.align 32
	.type	s, @object
	.size	s, 102
s:
	.zero	102
	.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
	.globl	map
	.align 32
	.type	map, @object
	.size	map, 484
map:
	.zero	484
	.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:

// Aizu 2103: Battle Town
// 2017.9.20 bal4u@uu

#include <stdio.h>

char map[22][22]; int h, w;
char s[102];
char tbl[128];
int mv[4][2] = { {-1,0},{0,1},{1,0},{0,-1} };
char dir[4] = { '^', '>', 'v', '<' };

int main()
{
	int cno, t, n, r, c, tr, tc, d, k;
	char *p;

	tbl['^'] = 1, tbl['>'] = 2, tbl['v'] = 3, tbl['<'] = 4;
	tbl['U'] = 1, tbl['R'] = 2, tbl['D'] = 3, tbl['L'] = 4;
	scanf("%d", &t); cno = 0; while (t-- > 0) {
		scanf("%d%d", &h, &w);
		for (r = 0; r < h; r++) {
			scanf("%s", map[r]);
			for (c = 0; c < w; c++) if ((k = tbl[map[r][c]]) > 0) tr = r, tc = c, d = k-1;
		}
		scanf("%d", &n);
		scanf("%s", s); p = s;
		while (*p) {
			if (*p != 'S') {
				d = tbl[*p]-1; r = tr + mv[d][0], c = tc + mv[d][1]; map[tr][tc] = '.';
				if (r >= 0 && r < h && c >= 0 && c < w && map[r][c] == '.') tr = r, tc = c;
				map[tr][tc] = dir[d];
			} else {
				r = tr, c = tc; while (1) {
					r += mv[d][0], c += mv[d][1];
					if (r < 0 || r >= h || c < 0 || c >= w) break;
					if (map[r][c] == '*') { map[r][c] = '.'; break; }
					else if (map[r][c] == '#') break;
				}
			}
			p++;
		}
		if (cno++) putchar('\n');
		for (r = 0; r < h; r++) puts(map[r]);
	}
	return 0;
}
4
4 6
*.*..*
*.....
...-..
^.*#..
10
SRSSRRUSSR
2 2
<.
..
12
DDSRRSUUSLLS
3 5
>-#**
.-*#*
.-**#
15
SSSDRSSSDRSSSUU
5 5
v****
*****
*****
*****
*****
44
SSSSDDRSDRSRDSULUURSSSSRRRRDSSSSDDLSDLSDLSSD
 4
4 6
*.*..*
*.....
..-...
^.*#..
10
SRSSRRUSSR
2 2
<.
..
12
DDSRRSUUSLLS
3 5
>-#**
.-*#*
.-**#
15
SSSDRSSSDRSSSUU
5 5
v****
*****
*****
***)*
*****
44
SSSSDDRSDRSRDSULUURSSSSRRRRDSSSSDDLSDLSDLSSD
 4
4 6
*.*..*
*..../
..-...
^.*#..
10
SRSSRRUSSR
2 2
<.
..
12
DDSRRSUUSLLS
3 5
>-#**
.-*#*
.-**#
15
SSSDRSSSDRSSSUU
5 5
v****
*****
*****
***)*
*****
44
SSSSDDRSDRSRDSULUURSSSSRRRRDSSSSDDLSDLSDLSSD

*....*
......
..>-..
...#..

<.
..

^-#**
.-.#*
.-..#

.....
.***.
..*..
..*..
....v
 *....*
......
..-...
..>#..

<.
..

^-#**
.-.#*
.-..#

.....
.***.
..*..
...).
....v
 *....*
...../
..-...
..>#..

<.
..

^-#**
.-.#*
.-..#

.....
.***.
..*..
...).
....v

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

```c
// Aizu 2103: Battle Town
// 2017.9.20 bal4u@uu

#include <stdio.h>

char map[22][22]; int h, w;
char s[102];
char tbl[128];
int mv[4][2] = { {-1,0},{0,1},{1,0},{0,-1} };
char dir[4] = { '^', '>', 'v', '<' };

int main()
{
	int cno, t, n, r, c, tr, tc, d, k;
	char *p;

	tbl['^'] = 1, tbl['>'] = 2, tbl['v'] = 3, tbl['<'] = 4;
	tbl['U'] = 1, tbl['R'] = 2, tbl['D'] = 3, tbl['L'] = 4;
	scanf("%d", &t); cno = 0; while (t-- > 0) {
		scanf("%d%d", &h, &w);
		for (r = 0; r < h; r++) {
			scanf("%s", map[r]);
			for (c = 0; c < w; c++) if ((k = tbl[map[r][c]]) > 0) tr = r, tc = c, d = k-1;
		}
		scanf("%d", &n);
		scanf("%s", s); p = s;
		while (*p) {
			if (*p != 'S') {
				d = tbl[*p]-1; r = tr + mv[d][0], c = tc + mv[d][1]; map[tr][tc] = '.';
				if (r >= 0 && r < h && c >= 0 && c < w && map[r][c] == '.') tr = r, tc = c;
				map[tr][tc] = dir[d];
			} else {
				r = tr, c = tc; while (1) {
					r += mv[d][0], c += mv[d][1];
					if (r < 0 || r >= h || c < 0 || c >= w) break;
					if (map[r][c] == '*') { map[r][c] = '.'; break; }
					else if (map[r][c] == '#') break;
				}
			}
			p++;
		}
		if (cno++) putchar('\n');
		for (r = 0; r < h; r++) puts(map[r]);
	}
	return 0;
}```

Unoptimized Assembly Code:

```assembly
	.file	"temp.c"
	.text
	.globl	map
	.bss
	.align 32
	.type	map, @object
	.size	map, 484
map:
	.zero	484
	.globl	h
	.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	s
	.align 32
	.type	s, @object
	.size	s, 102
s:
	.zero	102
	.globl	tbl
	.align 32
	.type	tbl, @object
	.size	tbl, 128
tbl:
	.zero	128
	.globl	mv
	.data
	.align 32
	.type	mv, @object
	.size	mv, 32
mv:
	.long	-1
	.long	0
	.long	0
	.long	1
	.long	1
	.long	0
	.long	0
	.long	-1
	.globl	dir
	.type	dir, @object
	.size	dir, 4
dir:
	.ascii	"^>v<"
	.section	.rodata
.LC0:
	.string	"%d"
.LC1:
	.string	"%d%d"
.LC2:
	.string	"%s"
	.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	$64, %rsp
	movq	%fs:40, %rax
	movq	%rax, -8(%rbp)
	xorl	%eax, %eax
	movb	$1, 94+tbl(%rip)
	movb	$2, 62+tbl(%rip)
	movb	$3, 118+tbl(%rip)
	movb	$4, 60+tbl(%rip)
	movb	$1, 85+tbl(%rip)
	movb	$2, 82+tbl(%rip)
	movb	$3, 68+tbl(%rip)
	movb	$4, 76+tbl(%rip)
	leaq	-52(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	$0, -44(%rbp)
	jmp	.L2
.L19:
	leaq	w(%rip), %rax
	movq	%rax, %rdx
	leaq	h(%rip), %rax
	movq	%rax, %rsi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	$0, -40(%rbp)
	jmp	.L3
.L7:
	movl	-40(%rbp), %eax
	movslq	%eax, %rdx
	movq	%rdx, %rax
	salq	$2, %rax
	addq	%rdx, %rax
	addq	%rax, %rax
	addq	%rdx, %rax
	addq	%rax, %rax
	leaq	map(%rip), %rdx
	addq	%rdx, %rax
	movq	%rax, %rsi
	leaq	.LC2(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	$0, -36(%rbp)
	jmp	.L4
.L6:
	movl	-36(%rbp), %eax
	movslq	%eax, %rcx
	movl	-40(%rbp), %eax
	movslq	%eax, %rdx
	movq	%rdx, %rax
	salq	$2, %rax
	addq	%rdx, %rax
	addq	%rax, %rax
	addq	%rdx, %rax
	addq	%rax, %rax
	leaq	(%rax,%rcx), %rdx
	leaq	map(%rip), %rax
	addq	%rdx, %rax
	movzbl	(%rax), %eax
	movsbl	%al, %eax
	cltq
	leaq	tbl(%rip), %rdx
	movzbl	(%rax,%rdx), %eax
	movsbl	%al, %eax
	movl	%eax, -20(%rbp)
	cmpl	$0, -20(%rbp)
	jle	.L5
	movl	-40(%rbp), %eax
	movl	%eax, -32(%rbp)
	movl	-36(%rbp), %eax
	movl	%eax, -28(%rbp)
	movl	-20(%rbp), %eax
	subl	$1, %eax
	movl	%eax, -24(%rbp)
.L5:
	addl	$1, -36(%rbp)
.L4:
	movl	w(%rip), %eax
	cmpl	%eax, -36(%rbp)
	jl	.L6
	addl	$1, -40(%rbp)
.L3:
	movl	h(%rip), %eax
	cmpl	%eax, -40(%rbp)
	jl	.L7
	leaq	-48(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	leaq	s(%rip), %rax
	movq	%rax, %rsi
	leaq	.LC2(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	leaq	s(%rip), %rax
	movq	%rax, -16(%rbp)
	jmp	.L8
.L15:
	movq	-16(%rbp), %rax
	movzbl	(%rax), %eax
	cmpb	$83, %al
	je	.L9
	movq	-16(%rbp), %rax
	movzbl	(%rax), %eax
	movsbl	%al, %eax
	cltq
	leaq	tbl(%rip), %rdx
	movzbl	(%rax,%rdx), %eax
	movsbl	%al, %eax
	subl	$1, %eax
	movl	%eax, -24(%rbp)
	movl	-24(%rbp), %eax
	cltq
	leaq	0(,%rax,8), %rdx
	leaq	mv(%rip), %rax
	movl	(%rdx,%rax), %edx
	movl	-32(%rbp), %eax
	addl	%edx, %eax
	movl	%eax, -40(%rbp)
	movl	-24(%rbp), %eax
	cltq
	leaq	0(,%rax,8), %rdx
	leaq	4+mv(%rip), %rax
	movl	(%rdx,%rax), %edx
	movl	-28(%rbp), %eax
	addl	%edx, %eax
	movl	%eax, -36(%rbp)
	movl	-28(%rbp), %eax
	movslq	%eax, %rcx
	movl	-32(%rbp), %eax
	movslq	%eax, %rdx
	movq	%rdx, %rax
	salq	$2, %rax
	addq	%rdx, %rax
	addq	%rax, %rax
	addq	%rdx, %rax
	addq	%rax, %rax
	leaq	(%rax,%rcx), %rdx
	leaq	map(%rip), %rax
	addq	%rdx, %rax
	movb	$46, (%rax)
	cmpl	$0, -40(%rbp)
	js	.L10
	movl	h(%rip), %eax
	cmpl	%eax, -40(%rbp)
	jge	.L10
	cmpl	$0, -36(%rbp)
	js	.L10
	movl	w(%rip), %eax
	cmpl	%eax, -36(%rbp)
	jge	.L10
	movl	-36(%rbp), %eax
	movslq	%eax, %rcx
	movl	-40(%rbp), %eax
	movslq	%eax, %rdx
	movq	%rdx, %rax
	salq	$2, %rax
	addq	%rdx, %rax
	addq	%rax, %rax
	addq	%rdx, %rax
	addq	%rax, %rax
	leaq	(%rax,%rcx), %rdx
	leaq	map(%rip), %rax
	addq	%rdx, %rax
	movzbl	(%rax), %eax
	cmpb	$46, %al
	jne	.L10
	movl	-40(%rbp), %eax
	movl	%eax, -32(%rbp)
	movl	-36(%rbp), %eax
	movl	%eax, -28(%rbp)
.L10:
	movl	-24(%rbp), %eax
	cltq
	leaq	dir(%rip), %rdx
	movzbl	(%rax,%rdx), %ecx
	movl	-28(%rbp), %eax
	movslq	%eax, %rsi
	movl	-32(%rbp), %eax
	movslq	%eax, %rdx
	movq	%rdx, %rax
	salq	$2, %rax
	addq	%rdx, %rax
	addq	%rax, %rax
	addq	%rdx, %rax
	addq	%rax, %rax
	leaq	(%rax,%rsi), %rdx
	leaq	map(%rip), %rax
	addq	%rdx, %rax
	movb	%cl, (%rax)
	jmp	.L11
.L9:
	movl	-32(%rbp), %eax
	movl	%eax, -40(%rbp)
	movl	-28(%rbp), %eax
	movl	%eax, -36(%rbp)
.L14:
	movl	-24(%rbp), %eax
	cltq
	leaq	0(,%rax,8), %rdx
	leaq	mv(%rip), %rax
	movl	(%rdx,%rax), %eax
	addl	%eax, -40(%rbp)
	movl	-24(%rbp), %eax
	cltq
	leaq	0(,%rax,8), %rdx
	leaq	4+mv(%rip), %rax
	movl	(%rdx,%rax), %eax
	addl	%eax, -36(%rbp)
	cmpl	$0, -40(%rbp)
	js	.L11
	movl	h(%rip), %eax
	cmpl	%eax, -40(%rbp)
	jge	.L11
	cmpl	$0, -36(%rbp)
	js	.L11
	movl	w(%rip), %eax
	cmpl	%eax, -36(%rbp)
	jge	.L11
	movl	-36(%rbp), %eax
	movslq	%eax, %rcx
	movl	-40(%rbp), %eax
	movslq	%eax, %rdx
	movq	%rdx, %rax
	salq	$2, %rax
	addq	%rdx, %rax
	addq	%rax, %rax
	addq	%rdx, %rax
	addq	%rax, %rax
	leaq	(%rax,%rcx), %rdx
	leaq	map(%rip), %rax
	addq	%rdx, %rax
	movzbl	(%rax), %eax
	cmpb	$42, %al
	jne	.L12
	movl	-36(%rbp), %eax
	movslq	%eax, %rcx
	movl	-40(%rbp), %eax
	movslq	%eax, %rdx
	movq	%rdx, %rax
	salq	$2, %rax
	addq	%rdx, %rax
	addq	%rax, %rax
	addq	%rdx, %rax
	addq	%rax, %rax
	leaq	(%rax,%rcx), %rdx
	leaq	map(%rip), %rax
	addq	%rdx, %rax
	movb	$46, (%rax)
	jmp	.L11
.L12:
	movl	-36(%rbp), %eax
	movslq	%eax, %rcx
	movl	-40(%rbp), %eax
	movslq	%eax, %rdx
	movq	%rdx, %rax
	salq	$2, %rax
	addq	%rdx, %rax
	addq	%rax, %rax
	addq	%rdx, %rax
	addq	%rax, %rax
	leaq	(%rax,%rcx), %rdx
	leaq	map(%rip), %rax
	addq	%rdx, %rax
	movzbl	(%rax), %eax
	cmpb	$35, %al
	je	.L22
	jmp	.L14
.L22:
	nop
.L11:
	addq	$1, -16(%rbp)
.L8:
	movq	-16(%rbp), %rax
	movzbl	(%rax), %eax
	testb	%al, %al
	jne	.L15
	movl	-44(%rbp), %eax
	leal	1(%rax), %edx
	movl	%edx, -44(%rbp)
	testl	%eax, %eax
	je	.L16
	movl	$10, %edi
	call	putchar@PLT
.L16:
	movl	$0, -40(%rbp)
	jmp	.L17
.L18:
	movl	-40(%rbp), %eax
	movslq	%eax, %rdx
	movq	%rdx, %rax
	salq	$2, %rax
	addq	%rdx, %rax
	addq	%rax, %rax
	addq	%rdx, %rax
	addq	%rax, %rax
	leaq	map(%rip), %rdx
	addq	%rdx, %rax
	movq	%rax, %rdi
	call	puts@PLT
	addl	$1, -40(%rbp)
.L17:
	movl	h(%rip), %eax
	cmpl	%eax, -40(%rbp)
	jl	.L18
.L2:
	movl	-52(%rbp), %eax
	leal	-1(%rax), %edx
	movl	%edx, -52(%rbp)
	testl	%eax, %eax
	jg	.L19
	movl	$0, %eax
	movq	-8(%rbp), %rdx
	subq	%fs:40, %rdx
	je	.L21
	call	__stack_chk_fail@PLT
.L21:
	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
	.globl	map
	.bss
	.align 32
	.type	map, @object
	.size	map, 484
map:
	.zero	484
	.globl	h
	.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	s
	.align 32
	.type	s, @object
	.size	s, 102
s:
	.zero	102
	.globl	tbl
	.align 32
	.type	tbl, @object
	.size	tbl, 128
tbl:
	.zero	128
	.globl	mv
	.data
	.align 32
	.type	mv, @object
	.size	mv, 32
mv:
	.long	-1
	.long	0
	.long	0
	.long	1
	.long	1
	.long	0
	.long	0
	.long	-1
	.globl	dir
	.type	dir, @object
	.size	dir, 4
dir:
	.ascii	"^>v<"
	.section	.rodata
.LC0:
	.string	"%d"
.LC1:
	.string	"%d%d"
.LC2:
	.string	"%s"
	.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	$64, %rsp
	movq	%fs:40, %rax
	movq	%rax, -8(%rbp)
	xorl	%eax, %eax
	movb	$1, 94+tbl(%rip)
	movb	$2, 62+tbl(%rip)
	movb	$3, 118+tbl(%rip)
	movb	$4, 60+tbl(%rip)
	movb	$1, 85+tbl(%rip)
	movb	$2, 82+tbl(%rip)
	movb	$3, 68+tbl(%rip)
	movb	$4, 76+tbl(%rip)
	leaq	-52(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	$0, -44(%rbp)
	jmp	.L2
.L19:
	leaq	w(%rip), %rax
	movq	%rax, %rdx
	leaq	h(%rip), %rax
	movq	%rax, %rsi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	$0, -40(%rbp)
	jmp	.L3
.L7:
	movl	-40(%rbp), %eax
	movslq	%eax, %rdx
	movq	%rdx, %rax
	salq	$2, %rax
	addq	%rdx, %rax
	addq	%rax, %rax
	addq	%rdx, %rax
	addq	%rax, %rax
	leaq	map(%rip), %rdx
	addq	%rdx, %rax
	movq	%rax, %rsi
	leaq	.LC2(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	$0, -36(%rbp)
	jmp	.L4
.L6:
	movl	-36(%rbp), %eax
	movslq	%eax, %rcx
	movl	-40(%rbp), %eax
	movslq	%eax, %rdx
	movq	%rdx, %rax
	salq	$2, %rax
	addq	%rdx, %rax
	addq	%rax, %rax
	addq	%rdx, %rax
	addq	%rax, %rax
	leaq	(%rax,%rcx), %rdx
	leaq	map(%rip), %rax
	addq	%rdx, %rax
	movzbl	(%rax), %eax
	movsbl	%al, %eax
	cltq
	leaq	tbl(%rip), %rdx
	movzbl	(%rax,%rdx), %eax
	movsbl	%al, %eax
	movl	%eax, -20(%rbp)
	cmpl	$0, -20(%rbp)
	jle	.L5
	movl	-40(%rbp), %eax
	movl	%eax, -32(%rbp)
	movl	-36(%rbp), %eax
	movl	%eax, -28(%rbp)
	movl	-20(%rbp), %eax
	subl	$1, %eax
	movl	%eax, -24(%rbp)
.L5:
	addl	$1, -36(%rbp)
.L4:
	movl	w(%rip), %eax
	cmpl	%eax, -36(%rbp)
	jl	.L6
	addl	$1, -40(%rbp)
.L3:
	movl	h(%rip), %eax
	cmpl	%eax, -40(%rbp)
	jl	.L7
	leaq	-48(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	leaq	s(%rip), %rax
	movq	%rax, %rsi
	leaq	.LC2(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	leaq	s(%rip), %rax
	movq	%rax, -16(%rbp)
	jmp	.L8
.L15:
	movq	-16(%rbp), %rax
	movzbl	(%rax), %eax
	cmpb	$83, %al
	je	.L9
	movq	-16(%rbp), %rax
	movzbl	(%rax), %eax
	movsbl	%al, %eax
	cltq
	leaq	tbl(%rip), %rdx
	movzbl	(%rax,%rdx), %eax
	movsbl	%al, %eax
	subl	$1, %eax
	movl	%eax, -24(%rbp)
	movl	-24(%rbp), %eax
	cltq
	leaq	0(,%rax,8), %rdx
	leaq	mv(%rip), %rax
	movl	(%rdx,%rax), %edx
	movl	-32(%rbp), %eax
	addl	%edx, %eax
	movl	%eax, -40(%rbp)
	movl	-24(%rbp), %eax
	cltq
	leaq	0(,%rax,8), %rdx
	leaq	4+mv(%rip), %rax
	movl	(%rdx,%rax), %edx
	movl	-28(%rbp), %eax
	addl	%edx, %eax
	movl	%eax, -36(%rbp)
	movl	-28(%rbp), %eax
	movslq	%eax, %rcx
	movl	-32(%rbp), %eax
	movslq	%eax, %rdx
	movq	%rdx, %rax
	salq	$2, %rax
	addq	%rdx, %rax
	addq	%rax, %rax
	addq	%rdx, %rax
	addq	%rax, %rax
	leaq	(%rax,%rcx), %rdx
	leaq	map(%rip), %rax
	addq	%rdx, %rax
	movb	$46, (%rax)
	cmpl	$0, -40(%rbp)
	js	.L10
	movl	h(%rip), %eax
	cmpl	%eax, -40(%rbp)
	jge	.L10
	cmpl	$0, -36(%rbp)
	js	.L10
	movl	w(%rip), %eax
	cmpl	%eax, -36(%rbp)
	jge	.L10
	movl	-36(%rbp), %eax
	movslq	%eax, %rcx
	movl	-40(%rbp), %eax
	movslq	%eax, %rdx
	movq	%rdx, %rax
	salq	$2, %rax
	addq	%rdx, %rax
	addq	%rax, %rax
	addq	%rdx, %rax
	addq	%rax, %rax
	leaq	(%rax,%rcx), %rdx
	leaq	map(%rip), %rax
	addq	%rdx, %rax
	movzbl	(%rax), %eax
	cmpb	$46, %al
	jne	.L10
	movl	-40(%rbp), %eax
	movl	%eax, -32(%rbp)
	movl	-36(%rbp), %eax
	movl	%eax, -28(%rbp)
.L10:
	movl	-24(%rbp), %eax
	cltq
	leaq	dir(%rip), %rdx
	movzbl	(%rax,%rdx), %ecx
	movl	-28(%rbp), %eax
	movslq	%eax, %rsi
	movl	-32(%rbp), %eax
	movslq	%eax, %rdx
	movq	%rdx, %rax
	salq	$2, %rax
	addq	%rdx, %rax
	addq	%rax, %rax
	addq	%rdx, %rax
	addq	%rax, %rax
	leaq	(%rax,%rsi), %rdx
	leaq	map(%rip), %rax
	addq	%rdx, %rax
	movb	%cl, (%rax)
	jmp	.L11
.L9:
	movl	-32(%rbp), %eax
	movl	%eax, -40(%rbp)
	movl	-28(%rbp), %eax
	movl	%eax, -36(%rbp)
.L14:
	movl	-24(%rbp), %eax
	cltq
	leaq	0(,%rax,8), %rdx
	leaq	mv(%rip), %rax
	movl	(%rdx,%rax), %eax
	addl	%eax, -40(%rbp)
	movl	-24(%rbp), %eax
	cltq
	leaq	0(,%rax,8), %rdx
	leaq	4+mv(%rip), %rax
	movl	(%rdx,%rax), %eax
	addl	%eax, -36(%rbp)
	cmpl	$0, -40(%rbp)
	js	.L11
	movl	h(%rip), %eax
	cmpl	%eax, -40(%rbp)
	jge	.L11
	cmpl	$0, -36(%rbp)
	js	.L11
	movl	w(%rip), %eax
	cmpl	%eax, -36(%rbp)
	jge	.L11
	movl	-36(%rbp), %eax
	movslq	%eax, %rcx
	movl	-40(%rbp), %eax
	movslq	%eax, %rdx
	movq	%rdx, %rax
	salq	$2, %rax
	addq	%rdx, %rax
	addq	%rax, %rax
	addq	%rdx, %rax
	addq	%rax, %rax
	leaq	(%rax,%rcx), %rdx
	leaq	map(%rip), %rax
	addq	%rdx, %rax
	movzbl	(%rax), %eax
	cmpb	$42, %al
	jne	.L12
	movl	-36(%rbp), %eax
	movslq	%eax, %rcx
	movl	-40(%rbp), %eax
	movslq	%eax, %rdx
	movq	%rdx, %rax
	salq	$2, %rax
	addq	%rdx, %rax
	addq	%rax, %rax
	addq	%rdx, %rax
	addq	%rax, %rax
	leaq	(%rax,%rcx), %rdx
	leaq	map(%rip), %rax
	addq	%rdx, %rax
	movb	$46, (%rax)
	jmp	.L11
.L12:
	movl	-36(%rbp), %eax
	movslq	%eax, %rcx
	movl	-40(%rbp), %eax
	movslq	%eax, %rdx
	movq	%rdx, %rax
	salq	$2, %rax
	addq	%rdx, %rax
	addq	%rax, %rax
	addq	%rdx, %rax
	addq	%rax, %rax
	leaq	(%rax,%rcx), %rdx
	leaq	map(%rip), %rax
	addq	%rdx, %rax
	movzbl	(%rax), %eax
	cmpb	$35, %al
	je	.L22
	jmp	.L14
.L22:
	nop
.L11:
	addq	$1, -16(%rbp)
.L8:
	movq	-16(%rbp), %rax
	movzbl	(%rax), %eax
	testb	%al, %al
	jne	.L15
	movl	-44(%rbp), %eax
	leal	1(%rax), %edx
	movl	%edx, -44(%rbp)
	testl	%eax, %eax
	je	.L16
	movl	$10, %edi
	call	putchar@PLT
.L16:
	movl	$0, -40(%rbp)
	jmp	.L17
.L18:
	movl	-40(%rbp), %eax
	movslq	%eax, %rdx
	movq	%rdx, %rax
	salq	$2, %rax
	addq	%rdx, %rax
	addq	%rax, %rax
	addq	%rdx, %rax
	addq	%rax, %rax
	leaq	map(%rip), %rdx
	addq	%rdx, %rax
	movq	%rax, %rdi
	call	puts@PLT
	addl	$1, -40(%rbp)
.L17:
	movl	h(%rip), %eax
	cmpl	%eax, -40(%rbp)
	jl	.L18
.L2:
	movl	-52(%rbp), %eax
	leal	-1(%rax), %edx
	movl	%edx, -52(%rbp)
	testl	%eax, %eax
	jg	.L19
	movl	$0, %eax
	movq	-8(%rbp), %rdx
	subq	%fs:40, %rdx
	je	.L21
	call	__stack_chk_fail@PLT
.L21:
	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:
