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>

char map[20][21];											//高さ * 幅
int h, w;													//マップの高さ、幅
int px, py, dir = 0;										//自分の座標、方向
int dirx[4] = { 0,0,-1,1 };
int diry[4] = { -1,1,0,0 };
char my[4] = { '^', 'v', '<', '>' };

void act(char *n);
void move(int x);
void shot(int x);
void format(int x, int y);
void view(void);

int main(void) {
	format(20, 20);
	int i, j, k;
	int data;												//繰り返し回数
	int nmax;												//操作列の長さ
	char n[101];											//操作列の格納用
	scanf("%d\n", &data);									//繰り返し回数の取得
	for (k = 0; k < data; k++) {
		scanf("%d %d\n", &h, &w);							//高さと幅の取得
		for (i = 0; i < h; i++) {
			for (j = 0; j < w; j++) {
				map[i][j] = getchar();
				if (map[i][j] == '^') { px = j, py = i, dir = 0; }
				if (map[i][j] == 'v') { px = j, py = i, dir = 1; }
				if (map[i][j] == '<') { px = j, py = i, dir = 2; }
				if (map[i][j] == '>') { px = j, py = i, dir = 3; }
			}
			getchar();
		}
		scanf("%d\n", &nmax);								//操作列の長さの取得
		if (nmax < 0) { nmax = 0; }
		if (nmax > 100) { nmax = 100; }
		for (i = 0; i < nmax; i++) {						//操作列の取得
			n[i] = getchar();
		}
		n[i] = '\0';
		act(&n[0]);											//行動処理
		view();												//結果の表示
		if (k + 1 != data) { printf("\n"); }
	}
	return 0;
}
void act(char *str) {										//行動処理
	while (*str != '\0') {
		switch (*str) {
		case 'U':
			dir = 0;
			move(dir);
			break;
		case 'D':
			dir = 1;
			move(dir);
			break;
		case 'L':
			dir = 2;
			move(dir);
			break;
		case 'R':
			dir = 3;
			move(dir);
			break;
		case 'S':
			shot(dir);
			break;
		default:
			break;
		}
		str++;
	}
}
void move(int x) {											//移動処理
	int sx = px + dirx[x], sy = py + diry[x], flag = 0;
	if (sx < 0 || sx >= w) { flag = 1; }
	if (sy < 0 || sy >= h) { flag = 1; }
	if (map[sy][sx] == '.' && flag == 0) {
		map[py][px] = '.';									//自分のいた場所を平地へ変更する
		px = sx, py = sy;									//座標を移動する
	}
	map[py][px] = my[dir];
}
void shot(int x) {											//砲弾処理
	int sx = px + dirx[x], sy = py + diry[x] , flag;
	do {													//移動可能な限り繰り返す
		flag = 0;
		if (sx < 0 || sx >= w) { break; }					//幅の範囲外は見ない
		if (sy < 0 || sy >= h) { break; }					//高さの範囲外は見ない
		switch (map[sy][sx]) {
			case '*':										//レンガの壁の場合
				map[sy][sx] = '.';							//平地に変更する
				break;
			case '#':										//鉄の壁の場合
				break;
			default:										//障害物以外の場合
				flag = 1;									//繰り返す
				break;
		}
		sx += dirx[x];
		sy += diry[x];
	} while (flag != 0);
}
void format(int x, int y) {
	int i, j;
	for (i = 0; i < x; i++) {
		for (j = 0; j < y; j++) {
			map[i][j] = '0';
		}
	}
}
void view(void) {
	int i, j;
	for (i = 0; i < h; i++) {
		for (j = 0; j < w; j++) {
			printf("%c", map[i][j]);
		}
		printf("\n");
	}
}

```

Unoptimized Assembly Code:

```assembly
	.file	"temp.c"
	.text
	.globl	map
	.bss
	.align 32
	.type	map, @object
	.size	map, 420
map:
	.zero	420
	.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	px
	.align 4
	.type	px, @object
	.size	px, 4
px:
	.zero	4
	.globl	py
	.align 4
	.type	py, @object
	.size	py, 4
py:
	.zero	4
	.globl	dir
	.align 4
	.type	dir, @object
	.size	dir, 4
dir:
	.zero	4
	.globl	dirx
	.data
	.align 16
	.type	dirx, @object
	.size	dirx, 16
dirx:
	.long	0
	.long	0
	.long	-1
	.long	1
	.globl	diry
	.align 16
	.type	diry, @object
	.size	diry, 16
diry:
	.long	-1
	.long	1
	.long	0
	.long	0
	.globl	my
	.type	my, @object
	.size	my, 4
my:
	.ascii	"^v<>"
	.section	.rodata
.LC0:
	.string	"%d\n"
.LC1:
	.string	"%d %d\n"
	.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	$144, %rsp
	movq	%fs:40, %rax
	movq	%rax, -8(%rbp)
	xorl	%eax, %eax
	movl	$20, %esi
	movl	$20, %edi
	call	format
	leaq	-132(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	$0, -116(%rbp)
	jmp	.L2
.L16:
	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, -124(%rbp)
	jmp	.L3
.L10:
	movl	$0, -120(%rbp)
	jmp	.L4
.L9:
	call	getchar@PLT
	movl	%eax, %ecx
	movl	-120(%rbp), %eax
	movslq	%eax, %rsi
	movl	-124(%rbp), %eax
	movslq	%eax, %rdx
	movq	%rdx, %rax
	salq	$2, %rax
	addq	%rdx, %rax
	salq	$2, %rax
	addq	%rdx, %rax
	leaq	(%rax,%rsi), %rdx
	leaq	map(%rip), %rax
	addq	%rdx, %rax
	movb	%cl, (%rax)
	movl	-120(%rbp), %eax
	movslq	%eax, %rcx
	movl	-124(%rbp), %eax
	movslq	%eax, %rdx
	movq	%rdx, %rax
	salq	$2, %rax
	addq	%rdx, %rax
	salq	$2, %rax
	addq	%rdx, %rax
	leaq	(%rax,%rcx), %rdx
	leaq	map(%rip), %rax
	addq	%rdx, %rax
	movzbl	(%rax), %eax
	cmpb	$94, %al
	jne	.L5
	movl	-120(%rbp), %eax
	movl	%eax, px(%rip)
	movl	-124(%rbp), %eax
	movl	%eax, py(%rip)
	movl	$0, dir(%rip)
.L5:
	movl	-120(%rbp), %eax
	movslq	%eax, %rcx
	movl	-124(%rbp), %eax
	movslq	%eax, %rdx
	movq	%rdx, %rax
	salq	$2, %rax
	addq	%rdx, %rax
	salq	$2, %rax
	addq	%rdx, %rax
	leaq	(%rax,%rcx), %rdx
	leaq	map(%rip), %rax
	addq	%rdx, %rax
	movzbl	(%rax), %eax
	cmpb	$118, %al
	jne	.L6
	movl	-120(%rbp), %eax
	movl	%eax, px(%rip)
	movl	-124(%rbp), %eax
	movl	%eax, py(%rip)
	movl	$1, dir(%rip)
.L6:
	movl	-120(%rbp), %eax
	movslq	%eax, %rcx
	movl	-124(%rbp), %eax
	movslq	%eax, %rdx
	movq	%rdx, %rax
	salq	$2, %rax
	addq	%rdx, %rax
	salq	$2, %rax
	addq	%rdx, %rax
	leaq	(%rax,%rcx), %rdx
	leaq	map(%rip), %rax
	addq	%rdx, %rax
	movzbl	(%rax), %eax
	cmpb	$60, %al
	jne	.L7
	movl	-120(%rbp), %eax
	movl	%eax, px(%rip)
	movl	-124(%rbp), %eax
	movl	%eax, py(%rip)
	movl	$2, dir(%rip)
.L7:
	movl	-120(%rbp), %eax
	movslq	%eax, %rcx
	movl	-124(%rbp), %eax
	movslq	%eax, %rdx
	movq	%rdx, %rax
	salq	$2, %rax
	addq	%rdx, %rax
	salq	$2, %rax
	addq	%rdx, %rax
	leaq	(%rax,%rcx), %rdx
	leaq	map(%rip), %rax
	addq	%rdx, %rax
	movzbl	(%rax), %eax
	cmpb	$62, %al
	jne	.L8
	movl	-120(%rbp), %eax
	movl	%eax, px(%rip)
	movl	-124(%rbp), %eax
	movl	%eax, py(%rip)
	movl	$3, dir(%rip)
.L8:
	addl	$1, -120(%rbp)
.L4:
	movl	w(%rip), %eax
	cmpl	%eax, -120(%rbp)
	jl	.L9
	call	getchar@PLT
	addl	$1, -124(%rbp)
.L3:
	movl	h(%rip), %eax
	cmpl	%eax, -124(%rbp)
	jl	.L10
	leaq	-128(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	-128(%rbp), %eax
	testl	%eax, %eax
	jns	.L11
	movl	$0, -128(%rbp)
.L11:
	movl	-128(%rbp), %eax
	cmpl	$100, %eax
	jle	.L12
	movl	$100, -128(%rbp)
.L12:
	movl	$0, -124(%rbp)
	jmp	.L13
.L14:
	call	getchar@PLT
	movl	%eax, %edx
	movl	-124(%rbp), %eax
	cltq
	movb	%dl, -112(%rbp,%rax)
	addl	$1, -124(%rbp)
.L13:
	movl	-128(%rbp), %eax
	cmpl	%eax, -124(%rbp)
	jl	.L14
	movl	-124(%rbp), %eax
	cltq
	movb	$0, -112(%rbp,%rax)
	leaq	-112(%rbp), %rax
	movq	%rax, %rdi
	call	act
	call	view
	movl	-116(%rbp), %eax
	leal	1(%rax), %edx
	movl	-132(%rbp), %eax
	cmpl	%eax, %edx
	je	.L15
	movl	$10, %edi
	call	putchar@PLT
.L15:
	addl	$1, -116(%rbp)
.L2:
	movl	-132(%rbp), %eax
	cmpl	%eax, -116(%rbp)
	jl	.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
.LFE0:
	.size	main, .-main
	.globl	act
	.type	act, @function
act:
.LFB1:
	.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
	movq	%rdi, -8(%rbp)
	jmp	.L20
.L29:
	movq	-8(%rbp), %rax
	movzbl	(%rax), %eax
	movsbl	%al, %eax
	subl	$68, %eax
	cmpl	$17, %eax
	ja	.L30
	movl	%eax, %eax
	leaq	0(,%rax,4), %rdx
	leaq	.L23(%rip), %rax
	movl	(%rdx,%rax), %eax
	cltq
	leaq	.L23(%rip), %rdx
	addq	%rdx, %rax
	notrack jmp	*%rax
	.section	.rodata
	.align 4
	.align 4
.L23:
	.long	.L27-.L23
	.long	.L30-.L23
	.long	.L30-.L23
	.long	.L30-.L23
	.long	.L30-.L23
	.long	.L30-.L23
	.long	.L30-.L23
	.long	.L30-.L23
	.long	.L26-.L23
	.long	.L30-.L23
	.long	.L30-.L23
	.long	.L30-.L23
	.long	.L30-.L23
	.long	.L30-.L23
	.long	.L25-.L23
	.long	.L24-.L23
	.long	.L30-.L23
	.long	.L22-.L23
	.text
.L22:
	movl	$0, dir(%rip)
	movl	dir(%rip), %eax
	movl	%eax, %edi
	call	move
	jmp	.L28
.L27:
	movl	$1, dir(%rip)
	movl	dir(%rip), %eax
	movl	%eax, %edi
	call	move
	jmp	.L28
.L26:
	movl	$2, dir(%rip)
	movl	dir(%rip), %eax
	movl	%eax, %edi
	call	move
	jmp	.L28
.L25:
	movl	$3, dir(%rip)
	movl	dir(%rip), %eax
	movl	%eax, %edi
	call	move
	jmp	.L28
.L24:
	movl	dir(%rip), %eax
	movl	%eax, %edi
	call	shot
	jmp	.L28
.L30:
	nop
.L28:
	addq	$1, -8(%rbp)
.L20:
	movq	-8(%rbp), %rax
	movzbl	(%rax), %eax
	testb	%al, %al
	jne	.L29
	nop
	nop
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE1:
	.size	act, .-act
	.globl	move
	.type	move, @function
move:
.LFB2:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	movl	%edi, -20(%rbp)
	movl	-20(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	dirx(%rip), %rax
	movl	(%rdx,%rax), %edx
	movl	px(%rip), %eax
	addl	%edx, %eax
	movl	%eax, -8(%rbp)
	movl	-20(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	diry(%rip), %rax
	movl	(%rdx,%rax), %edx
	movl	py(%rip), %eax
	addl	%edx, %eax
	movl	%eax, -4(%rbp)
	movl	$0, -12(%rbp)
	cmpl	$0, -8(%rbp)
	js	.L32
	movl	w(%rip), %eax
	cmpl	%eax, -8(%rbp)
	jl	.L33
.L32:
	movl	$1, -12(%rbp)
.L33:
	cmpl	$0, -4(%rbp)
	js	.L34
	movl	h(%rip), %eax
	cmpl	%eax, -4(%rbp)
	jl	.L35
.L34:
	movl	$1, -12(%rbp)
.L35:
	movl	-8(%rbp), %eax
	movslq	%eax, %rcx
	movl	-4(%rbp), %eax
	movslq	%eax, %rdx
	movq	%rdx, %rax
	salq	$2, %rax
	addq	%rdx, %rax
	salq	$2, %rax
	addq	%rdx, %rax
	leaq	(%rax,%rcx), %rdx
	leaq	map(%rip), %rax
	addq	%rdx, %rax
	movzbl	(%rax), %eax
	cmpb	$46, %al
	jne	.L36
	cmpl	$0, -12(%rbp)
	jne	.L36
	movl	py(%rip), %eax
	movl	px(%rip), %edx
	movslq	%edx, %rcx
	movslq	%eax, %rdx
	movq	%rdx, %rax
	salq	$2, %rax
	addq	%rdx, %rax
	salq	$2, %rax
	addq	%rdx, %rax
	leaq	(%rax,%rcx), %rdx
	leaq	map(%rip), %rax
	addq	%rdx, %rax
	movb	$46, (%rax)
	movl	-8(%rbp), %eax
	movl	%eax, px(%rip)
	movl	-4(%rbp), %eax
	movl	%eax, py(%rip)
.L36:
	movl	dir(%rip), %eax
	movl	py(%rip), %edx
	movl	px(%rip), %esi
	cltq
	leaq	my(%rip), %rcx
	movzbl	(%rax,%rcx), %ecx
	movslq	%esi, %rsi
	movslq	%edx, %rdx
	movq	%rdx, %rax
	salq	$2, %rax
	addq	%rdx, %rax
	salq	$2, %rax
	addq	%rdx, %rax
	leaq	(%rax,%rsi), %rdx
	leaq	map(%rip), %rax
	addq	%rdx, %rax
	movb	%cl, (%rax)
	nop
	popq	%rbp
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE2:
	.size	move, .-move
	.globl	shot
	.type	shot, @function
shot:
.LFB3:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	movl	%edi, -20(%rbp)
	movl	-20(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	dirx(%rip), %rax
	movl	(%rdx,%rax), %edx
	movl	px(%rip), %eax
	addl	%edx, %eax
	movl	%eax, -12(%rbp)
	movl	-20(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	diry(%rip), %rax
	movl	(%rdx,%rax), %edx
	movl	py(%rip), %eax
	addl	%edx, %eax
	movl	%eax, -8(%rbp)
.L42:
	movl	$0, -4(%rbp)
	cmpl	$0, -12(%rbp)
	js	.L43
	movl	w(%rip), %eax
	cmpl	%eax, -12(%rbp)
	jge	.L43
	cmpl	$0, -8(%rbp)
	js	.L43
	movl	h(%rip), %eax
	cmpl	%eax, -8(%rbp)
	jge	.L43
	movl	-12(%rbp), %eax
	movslq	%eax, %rcx
	movl	-8(%rbp), %eax
	movslq	%eax, %rdx
	movq	%rdx, %rax
	salq	$2, %rax
	addq	%rdx, %rax
	salq	$2, %rax
	addq	%rdx, %rax
	leaq	(%rax,%rcx), %rdx
	leaq	map(%rip), %rax
	addq	%rdx, %rax
	movzbl	(%rax), %eax
	movsbl	%al, %eax
	cmpl	$35, %eax
	je	.L44
	cmpl	$42, %eax
	jne	.L40
	movl	-12(%rbp), %eax
	movslq	%eax, %rcx
	movl	-8(%rbp), %eax
	movslq	%eax, %rdx
	movq	%rdx, %rax
	salq	$2, %rax
	addq	%rdx, %rax
	salq	$2, %rax
	addq	%rdx, %rax
	leaq	(%rax,%rcx), %rdx
	leaq	map(%rip), %rax
	addq	%rdx, %rax
	movb	$46, (%rax)
	jmp	.L41
.L40:
	movl	$1, -4(%rbp)
	jmp	.L41
.L44:
	nop
.L41:
	movl	-20(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	dirx(%rip), %rax
	movl	(%rdx,%rax), %eax
	addl	%eax, -12(%rbp)
	movl	-20(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	diry(%rip), %rax
	movl	(%rdx,%rax), %eax
	addl	%eax, -8(%rbp)
	cmpl	$0, -4(%rbp)
	jne	.L42
.L43:
	nop
	popq	%rbp
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE3:
	.size	shot, .-shot
	.globl	format
	.type	format, @function
format:
.LFB4:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	movl	%edi, -20(%rbp)
	movl	%esi, -24(%rbp)
	movl	$0, -8(%rbp)
	jmp	.L46
.L49:
	movl	$0, -4(%rbp)
	jmp	.L47
.L48:
	movl	-4(%rbp), %eax
	movslq	%eax, %rcx
	movl	-8(%rbp), %eax
	movslq	%eax, %rdx
	movq	%rdx, %rax
	salq	$2, %rax
	addq	%rdx, %rax
	salq	$2, %rax
	addq	%rdx, %rax
	leaq	(%rax,%rcx), %rdx
	leaq	map(%rip), %rax
	addq	%rdx, %rax
	movb	$48, (%rax)
	addl	$1, -4(%rbp)
.L47:
	movl	-4(%rbp), %eax
	cmpl	-24(%rbp), %eax
	jl	.L48
	addl	$1, -8(%rbp)
.L46:
	movl	-8(%rbp), %eax
	cmpl	-20(%rbp), %eax
	jl	.L49
	nop
	nop
	popq	%rbp
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE4:
	.size	format, .-format
	.globl	view
	.type	view, @function
view:
.LFB5:
	.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
	movl	$0, -8(%rbp)
	jmp	.L51
.L54:
	movl	$0, -4(%rbp)
	jmp	.L52
.L53:
	movl	-4(%rbp), %eax
	movslq	%eax, %rcx
	movl	-8(%rbp), %eax
	movslq	%eax, %rdx
	movq	%rdx, %rax
	salq	$2, %rax
	addq	%rdx, %rax
	salq	$2, %rax
	addq	%rdx, %rax
	leaq	(%rax,%rcx), %rdx
	leaq	map(%rip), %rax
	addq	%rdx, %rax
	movzbl	(%rax), %eax
	movsbl	%al, %eax
	movl	%eax, %edi
	call	putchar@PLT
	addl	$1, -4(%rbp)
.L52:
	movl	w(%rip), %eax
	cmpl	%eax, -4(%rbp)
	jl	.L53
	movl	$10, %edi
	call	putchar@PLT
	addl	$1, -8(%rbp)
.L51:
	movl	h(%rip), %eax
	cmpl	%eax, -8(%rbp)
	jl	.L54
	nop
	nop
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE5:
	.size	view, .-view
	.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	move
	.type	move, @function
move:
.LFB25:
	.cfi_startproc
	endbr64
	leaq	diry(%rip), %rsi
	movslq	%edi, %rdi
	movslq	px(%rip), %rdx
	movslq	py(%rip), %rax
	movl	(%rsi,%rdi,4), %r10d
	leaq	dirx(%rip), %rcx
	movl	$1, %r8d
	movl	%edx, %esi
	addl	%eax, %r10d
	addl	(%rcx,%rdi,4), %esi
	js	.L2
	xorl	%r8d, %r8d
	cmpl	%esi, w(%rip)
	setle	%r8b
.L2:
	leaq	map(%rip), %rcx
	testl	%r10d, %r10d
	js	.L3
	cmpl	%r10d, h(%rip)
	jg	.L14
.L3:
	leaq	(%rax,%rax,4), %rsi
	leaq	(%rax,%rsi,4), %rax
	leaq	my(%rip), %rsi
	addq	%rax, %rcx
	movslq	dir(%rip), %rax
	movzbl	(%rsi,%rax), %eax
	movb	%al, (%rcx,%rdx)
	ret
	.p2align 4,,10
	.p2align 3
.L14:
	movslq	%r10d, %r9
	movslq	%esi, %rdi
	leaq	(%r9,%r9,4), %r11
	leaq	(%r9,%r11,4), %r9
	addq	%rcx, %r9
	cmpb	$46, (%r9,%rdi)
	jne	.L3
	testl	%r8d, %r8d
	jne	.L3
	leaq	(%rax,%rax,4), %rdi
	movl	%esi, px(%rip)
	leaq	(%rax,%rdi,4), %rax
	movl	%r10d, py(%rip)
	addq	%rcx, %rax
	movb	$46, (%rax,%rdx)
	movslq	%esi, %rdx
	movslq	%r10d, %rax
	jmp	.L3
	.cfi_endproc
.LFE25:
	.size	move, .-move
	.p2align 4
	.globl	shot
	.type	shot, @function
shot:
.LFB26:
	.cfi_startproc
	endbr64
	movslq	%edi, %rdi
	leaq	dirx(%rip), %rax
	movl	(%rax,%rdi,4), %ecx
	leaq	diry(%rip), %rax
	movl	(%rax,%rdi,4), %r11d
	movl	py(%rip), %eax
	movl	%ecx, %edx
	addl	%r11d, %eax
	addl	px(%rip), %edx
	js	.L35
	movl	w(%rip), %r8d
	cmpl	%r8d, %edx
	jge	.L35
	testl	%eax, %eax
	js	.L35
	pushq	%rbx
	.cfi_def_cfa_offset 16
	.cfi_offset 3, -16
	movl	h(%rip), %r9d
	cmpl	$1, %r11d
	jne	.L17
	cmpl	$1, %ecx
	jne	.L17
	movslq	%eax, %rcx
	leaq	map(%rip), %rdi
	leaq	(%rcx,%rcx,4), %rsi
	leaq	(%rcx,%rsi,4), %rcx
	movslq	%edx, %rsi
	addq	%rsi, %rcx
	addq	%rdi, %rcx
	.p2align 4,,10
	.p2align 3
.L21:
	cmpl	%eax, %r9d
	jle	.L15
	movzbl	(%rcx), %esi
	cmpb	$35, %sil
	je	.L15
	cmpb	$42, %sil
	jne	.L39
.L20:
	cltq
	movslq	%edx, %rdx
	leaq	(%rax,%rax,4), %rcx
	leaq	(%rax,%rcx,4), %rax
	addq	%rdi, %rax
	movb	$46, (%rax,%rdx)
.L15:
	popq	%rbx
	.cfi_remember_state
	.cfi_def_cfa_offset 8
	ret
	.p2align 4,,10
	.p2align 3
.L39:
	.cfi_restore_state
	addl	$1, %eax
	addl	$1, %edx
	js	.L15
	addq	$22, %rcx
	testl	%eax, %eax
	js	.L15
	cmpl	%r8d, %edx
	jl	.L21
	popq	%rbx
	.cfi_remember_state
	.cfi_def_cfa_offset 8
	ret
	.p2align 4,,10
	.p2align 3
.L17:
	.cfi_restore_state
	movslq	%r11d, %rsi
	leaq	(%rsi,%rsi,4), %rdi
	leaq	(%rsi,%rdi,4), %rbx
	movslq	%ecx, %rsi
	addq	%rsi, %rbx
	movslq	%eax, %rsi
	leaq	(%rsi,%rsi,4), %rdi
	leaq	(%rsi,%rdi,4), %rsi
	movslq	%edx, %rdi
	addq	%rdi, %rsi
	leaq	map(%rip), %rdi
	addq	%rdi, %rsi
	jmp	.L19
	.p2align 4,,10
	.p2align 3
.L40:
	cmpb	$42, %r10b
	je	.L20
	addl	%r11d, %eax
	addl	%ecx, %edx
	js	.L15
	addq	%rbx, %rsi
	cmpl	%r8d, %edx
	jge	.L15
	testl	%eax, %eax
	js	.L15
.L19:
	cmpl	%eax, %r9d
	jle	.L15
	movzbl	(%rsi), %r10d
	cmpb	$35, %r10b
	jne	.L40
	popq	%rbx
	.cfi_def_cfa_offset 8
	ret
.L35:
	.cfi_restore 3
	ret
	.cfi_endproc
.LFE26:
	.size	shot, .-shot
	.p2align 4
	.globl	act
	.type	act, @function
act:
.LFB24:
	.cfi_startproc
	endbr64
	movzbl	(%rdi), %eax
	testb	%al, %al
	je	.L56
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	leaq	.L45(%rip), %rbp
	pushq	%rbx
	.cfi_def_cfa_offset 24
	.cfi_offset 3, -24
	movq	%rdi, %rbx
	.p2align 4,,10
	.p2align 3
.L50:
	subl	$68, %eax
	cmpb	$17, %al
	ja	.L43
	movzbl	%al, %eax
	movslq	0(%rbp,%rax,4), %rax
	addq	%rbp, %rax
	notrack jmp	*%rax
	.section	.rodata
	.align 4
	.align 4
.L45:
	.long	.L49-.L45
	.long	.L43-.L45
	.long	.L43-.L45
	.long	.L43-.L45
	.long	.L43-.L45
	.long	.L43-.L45
	.long	.L43-.L45
	.long	.L43-.L45
	.long	.L48-.L45
	.long	.L43-.L45
	.long	.L43-.L45
	.long	.L43-.L45
	.long	.L43-.L45
	.long	.L43-.L45
	.long	.L47-.L45
	.long	.L46-.L45
	.long	.L43-.L45
	.long	.L44-.L45
	.text
	.p2align 4,,10
	.p2align 3
.L44:
	movl	$0, dir(%rip)
	xorl	%edi, %edi
	call	move
	.p2align 4,,10
	.p2align 3
.L43:
	movzbl	1(%rbx), %eax
	addq	$1, %rbx
	testb	%al, %al
	jne	.L50
.L59:
	popq	%rbx
	.cfi_remember_state
	.cfi_def_cfa_offset 16
	popq	%rbp
	.cfi_def_cfa_offset 8
	ret
	.p2align 4,,10
	.p2align 3
.L46:
	.cfi_restore_state
	movl	dir(%rip), %edi
	addq	$1, %rbx
	call	shot
	movzbl	(%rbx), %eax
	testb	%al, %al
	jne	.L50
	jmp	.L59
	.p2align 4,,10
	.p2align 3
.L47:
	movl	$3, %edi
	addq	$1, %rbx
	movl	$3, dir(%rip)
	call	move
	movzbl	(%rbx), %eax
	testb	%al, %al
	jne	.L50
	jmp	.L59
	.p2align 4,,10
	.p2align 3
.L48:
	movl	$2, %edi
	addq	$1, %rbx
	movl	$2, dir(%rip)
	call	move
	movzbl	(%rbx), %eax
	testb	%al, %al
	jne	.L50
	jmp	.L59
	.p2align 4,,10
	.p2align 3
.L49:
	movl	$1, %edi
	addq	$1, %rbx
	movl	$1, dir(%rip)
	call	move
	movzbl	(%rbx), %eax
	testb	%al, %al
	jne	.L50
	jmp	.L59
	.p2align 4,,10
	.p2align 3
.L56:
	.cfi_def_cfa_offset 8
	.cfi_restore 3
	.cfi_restore 6
	ret
	.cfi_endproc
.LFE24:
	.size	act, .-act
	.section	.rodata.str1.1,"aMS",@progbits,1
.LC0:
	.string	"%d\n"
.LC1:
	.string	"%d %d\n"
	.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	420+map(%rip), %rdx
	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	$152, %rsp
	.cfi_def_cfa_offset 208
	movq	%fs:40, %rax
	movq	%rax, 136(%rsp)
	xorl	%eax, %eax
	leaq	-420(%rdx), %rax
	.p2align 4,,10
	.p2align 3
.L61:
	movdqa	.LC2(%rip), %xmm0
	movl	$808464432, 16(%rax)
	addq	$21, %rax
	movups	%xmm0, -21(%rax)
	cmpq	%rax, %rdx
	jne	.L61
	leaq	.LC0(%rip), %r14
	leaq	24(%rsp), %rsi
	xorl	%eax, %eax
	xorl	%r12d, %r12d
	movq	%r14, %rdi
	leaq	.L83(%rip), %rbp
	call	__isoc99_scanf@PLT
	movl	24(%rsp), %edi
	leaq	28(%rsp), %rax
	movq	%rax, 8(%rsp)
	testl	%edi, %edi
	jle	.L91
	.p2align 4,,10
	.p2align 3
.L62:
	leaq	h(%rip), %rsi
	leaq	w(%rip), %rdx
	xorl	%eax, %eax
	xorl	%ebx, %ebx
	leaq	.LC1(%rip), %rdi
	leaq	map(%rip), %r15
	call	__isoc99_scanf@PLT
	movl	h(%rip), %esi
	testl	%esi, %esi
	jle	.L64
	.p2align 4,,10
	.p2align 3
.L63:
	movl	w(%rip), %ecx
	xorl	%r13d, %r13d
	testl	%ecx, %ecx
	jg	.L71
	jmp	.L72
	.p2align 4,,10
	.p2align 3
.L65:
	cmpb	$118, %al
	je	.L67
	cmpb	$60, %al
	jne	.L117
	movl	%r13d, px(%rip)
	movl	%ebx, py(%rip)
	movl	$2, dir(%rip)
.L66:
	addq	$1, %r13
	cmpl	%r13d, w(%rip)
	jle	.L72
.L71:
	movq	stdin(%rip), %rdi
	call	getc@PLT
	movb	%al, (%r15,%r13)
	cmpb	$94, %al
	jne	.L65
	movl	%r13d, px(%rip)
	addq	$1, %r13
	cmpl	%r13d, w(%rip)
	movl	%ebx, py(%rip)
	movl	$0, dir(%rip)
	jg	.L71
.L72:
	movq	stdin(%rip), %rdi
	addl	$1, %ebx
	addq	$21, %r15
	call	getc@PLT
	cmpl	%ebx, h(%rip)
	jg	.L63
.L64:
	movq	8(%rsp), %rsi
	movq	%r14, %rdi
	xorl	%eax, %eax
	call	__isoc99_scanf@PLT
	movl	28(%rsp), %ebx
	testl	%ebx, %ebx
	js	.L118
	cmpl	$100, %ebx
	jle	.L75
	movl	$100, 28(%rsp)
.L76:
	leaq	32(%rsp), %r15
	xorl	%ebx, %ebx
	.p2align 4,,10
	.p2align 3
.L77:
	movq	stdin(%rip), %rdi
	addl	$1, %ebx
	addq	$1, %r15
	call	getc@PLT
	movb	%al, -1(%r15)
	cmpl	%ebx, 28(%rsp)
	jg	.L77
.L74:
	movslq	%ebx, %rbx
	movb	$0, 32(%rsp,%rbx)
	movzbl	32(%rsp), %eax
	leaq	32(%rsp), %rbx
	testb	%al, %al
	je	.L88
	.p2align 4,,10
	.p2align 3
.L78:
	subl	$68, %eax
	cmpb	$17, %al
	ja	.L81
	movzbl	%al, %eax
	movslq	0(%rbp,%rax,4), %rax
	addq	%rbp, %rax
	notrack jmp	*%rax
	.section	.rodata
	.align 4
	.align 4
.L83:
	.long	.L87-.L83
	.long	.L81-.L83
	.long	.L81-.L83
	.long	.L81-.L83
	.long	.L81-.L83
	.long	.L81-.L83
	.long	.L81-.L83
	.long	.L81-.L83
	.long	.L86-.L83
	.long	.L81-.L83
	.long	.L81-.L83
	.long	.L81-.L83
	.long	.L81-.L83
	.long	.L81-.L83
	.long	.L85-.L83
	.long	.L84-.L83
	.long	.L81-.L83
	.long	.L82-.L83
	.section	.text.startup
.L117:
	cmpb	$62, %al
	jne	.L66
	movl	%r13d, px(%rip)
	movl	%ebx, py(%rip)
	movl	$3, dir(%rip)
	jmp	.L66
	.p2align 4,,10
	.p2align 3
.L67:
	movl	%r13d, px(%rip)
	movl	%ebx, py(%rip)
	movl	$1, dir(%rip)
	jmp	.L66
.L82:
	movl	$0, dir(%rip)
	xorl	%edi, %edi
	call	move
	.p2align 4,,10
	.p2align 3
.L81:
	movzbl	1(%rbx), %eax
	addq	$1, %rbx
	testb	%al, %al
	jne	.L78
.L88:
	movl	h(%rip), %edx
	leaq	map(%rip), %rbx
	xorl	%r15d, %r15d
	testl	%edx, %edx
	jle	.L80
	.p2align 4,,10
	.p2align 3
.L79:
	movl	w(%rip), %eax
	xorl	%r13d, %r13d
	testl	%eax, %eax
	jle	.L90
	.p2align 4,,10
	.p2align 3
.L89:
	movsbl	(%rbx,%r13), %edi
	addq	$1, %r13
	call	putchar@PLT
	cmpl	%r13d, w(%rip)
	jg	.L89
.L90:
	movl	$10, %edi
	addl	$1, %r15d
	addq	$21, %rbx
	call	putchar@PLT
	cmpl	h(%rip), %r15d
	jl	.L79
.L80:
	addl	$1, %r12d
	cmpl	24(%rsp), %r12d
	jne	.L119
.L91:
	movq	136(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L120
	addq	$152, %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
.L84:
	.cfi_restore_state
	movl	dir(%rip), %edi
	addq	$1, %rbx
	call	shot
	movzbl	(%rbx), %eax
	testb	%al, %al
	jne	.L78
	jmp	.L88
.L85:
	movl	$3, %edi
	addq	$1, %rbx
	movl	$3, dir(%rip)
	call	move
	movzbl	(%rbx), %eax
	testb	%al, %al
	jne	.L78
	jmp	.L88
.L86:
	movl	$2, %edi
	addq	$1, %rbx
	movl	$2, dir(%rip)
	call	move
	movzbl	(%rbx), %eax
	testb	%al, %al
	jne	.L78
	jmp	.L88
.L87:
	movl	$1, %edi
	addq	$1, %rbx
	movl	$1, dir(%rip)
	call	move
	movzbl	(%rbx), %eax
	testb	%al, %al
	jne	.L78
	jmp	.L88
.L119:
	movl	$10, %edi
	call	putchar@PLT
	cmpl	24(%rsp), %r12d
	jl	.L62
	jmp	.L91
	.p2align 4,,10
	.p2align 3
.L118:
	movl	$0, 28(%rsp)
	xorl	%ebx, %ebx
	jmp	.L74
.L75:
	testl	%ebx, %ebx
	jne	.L76
	jmp	.L74
.L120:
	call	__stack_chk_fail@PLT
	.cfi_endproc
.LFE23:
	.size	main, .-main
	.text
	.p2align 4
	.globl	format
	.type	format, @function
format:
.LFB27:
	.cfi_startproc
	endbr64
	testl	%edi, %edi
	jle	.L126
	testl	%esi, %esi
	jle	.L126
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	leal	-1(%rdi), %eax
	leaq	map(%rip), %rcx
	pushq	%rbx
	.cfi_def_cfa_offset 24
	.cfi_offset 3, -24
	leaq	(%rax,%rax,4), %rdx
	movslq	%esi, %rbx
	leaq	(%rax,%rdx,4), %rbp
	leaq	21(%rcx), %rax
	addq	%rax, %rbp
	subq	$8, %rsp
	.cfi_def_cfa_offset 32
	.p2align 4,,10
	.p2align 3
.L123:
	movq	%rcx, %rdi
	movq	%rbx, %rdx
	movl	$48, %esi
	call	memset@PLT
	movq	%rax, %rcx
	addq	$21, %rcx
	cmpq	%rbp, %rcx
	jne	.L123
	addq	$8, %rsp
	.cfi_def_cfa_offset 24
	popq	%rbx
	.cfi_def_cfa_offset 16
	popq	%rbp
	.cfi_def_cfa_offset 8
	ret
.L126:
	.cfi_restore 3
	.cfi_restore 6
	ret
	.cfi_endproc
.LFE27:
	.size	format, .-format
	.p2align 4
	.globl	view
	.type	view, @function
view:
.LFB28:
	.cfi_startproc
	endbr64
	movl	h(%rip), %edx
	testl	%edx, %edx
	jle	.L138
	pushq	%r12
	.cfi_def_cfa_offset 16
	.cfi_offset 12, -16
	xorl	%r12d, %r12d
	pushq	%rbp
	.cfi_def_cfa_offset 24
	.cfi_offset 6, -24
	leaq	map(%rip), %rbp
	pushq	%rbx
	.cfi_def_cfa_offset 32
	.cfi_offset 3, -32
	.p2align 4,,10
	.p2align 3
.L131:
	movl	w(%rip), %eax
	xorl	%ebx, %ebx
	testl	%eax, %eax
	jle	.L133
	.p2align 4,,10
	.p2align 3
.L132:
	movsbl	0(%rbp,%rbx), %edi
	addq	$1, %rbx
	call	putchar@PLT
	cmpl	%ebx, w(%rip)
	jg	.L132
.L133:
	movl	$10, %edi
	addl	$1, %r12d
	addq	$21, %rbp
	call	putchar@PLT
	cmpl	%r12d, h(%rip)
	jg	.L131
	popq	%rbx
	.cfi_def_cfa_offset 24
	popq	%rbp
	.cfi_def_cfa_offset 16
	popq	%r12
	.cfi_def_cfa_offset 8
	ret
.L138:
	.cfi_restore 3
	.cfi_restore 6
	.cfi_restore 12
	ret
	.cfi_endproc
.LFE28:
	.size	view, .-view
	.globl	my
	.data
	.type	my, @object
	.size	my, 4
my:
	.ascii	"^v<>"
	.globl	diry
	.align 16
	.type	diry, @object
	.size	diry, 16
diry:
	.long	-1
	.long	1
	.long	0
	.long	0
	.globl	dirx
	.align 16
	.type	dirx, @object
	.size	dirx, 16
dirx:
	.long	0
	.long	0
	.long	-1
	.long	1
	.globl	dir
	.bss
	.align 4
	.type	dir, @object
	.size	dir, 4
dir:
	.zero	4
	.globl	py
	.align 4
	.type	py, @object
	.size	py, 4
py:
	.zero	4
	.globl	px
	.align 4
	.type	px, @object
	.size	px, 4
px:
	.zero	4
	.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, 420
map:
	.zero	420
	.section	.rodata.cst16,"aM",@progbits,16
	.align 16
.LC2:
	.quad	3472328296227680304
	.quad	3472328296227680304
	.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	move
	.type	move, @function
move:
.LFB25:
	.cfi_startproc
	endbr64
	leaq	diry(%rip), %rsi
	movslq	%edi, %rdi
	movslq	px(%rip), %rdx
	movslq	py(%rip), %rax
	movl	(%rsi,%rdi,4), %r10d
	leaq	dirx(%rip), %rcx
	movl	$1, %r8d
	movl	%edx, %esi
	addl	%eax, %r10d
	addl	(%rcx,%rdi,4), %esi
	js	.L2
	xorl	%r8d, %r8d
	cmpl	%esi, w(%rip)
	setle	%r8b
.L2:
	leaq	map(%rip), %rcx
	testl	%r10d, %r10d
	js	.L3
	cmpl	%r10d, h(%rip)
	jg	.L14
.L3:
	leaq	(%rax,%rax,4), %rsi
	leaq	(%rax,%rsi,4), %rax
	leaq	my(%rip), %rsi
	addq	%rax, %rcx
	movslq	dir(%rip), %rax
	movzbl	(%rsi,%rax), %eax
	movb	%al, (%rcx,%rdx)
	ret
	.p2align 4,,10
	.p2align 3
.L14:
	movslq	%r10d, %r9
	movslq	%esi, %rdi
	leaq	(%r9,%r9,4), %r11
	leaq	(%r9,%r11,4), %r9
	addq	%rcx, %r9
	cmpb	$46, (%r9,%rdi)
	jne	.L3
	testl	%r8d, %r8d
	jne	.L3
	leaq	(%rax,%rax,4), %rdi
	movl	%esi, px(%rip)
	leaq	(%rax,%rdi,4), %rax
	movl	%r10d, py(%rip)
	addq	%rcx, %rax
	movb	$46, (%rax,%rdx)
	movslq	%esi, %rdx
	movslq	%r10d, %rax
	jmp	.L3
	.cfi_endproc
.LFE25:
	.size	move, .-move
	.p2align 4
	.globl	shot
	.type	shot, @function
shot:
.LFB26:
	.cfi_startproc
	endbr64
	movslq	%edi, %rdi
	leaq	dirx(%rip), %rax
	movl	(%rax,%rdi,4), %ecx
	leaq	diry(%rip), %rax
	movl	(%rax,%rdi,4), %r11d
	movl	py(%rip), %eax
	movl	%ecx, %edx
	addl	%r11d, %eax
	addl	px(%rip), %edx
	js	.L35
	movl	w(%rip), %r8d
	cmpl	%r8d, %edx
	jge	.L35
	testl	%eax, %eax
	js	.L35
	pushq	%rbx
	.cfi_def_cfa_offset 16
	.cfi_offset 3, -16
	movl	h(%rip), %r9d
	cmpl	$1, %r11d
	jne	.L17
	cmpl	$1, %ecx
	jne	.L17
	movslq	%eax, %rcx
	leaq	map(%rip), %rdi
	leaq	(%rcx,%rcx,4), %rsi
	leaq	(%rcx,%rsi,4), %rcx
	movslq	%edx, %rsi
	addq	%rsi, %rcx
	addq	%rdi, %rcx
	.p2align 4,,10
	.p2align 3
.L21:
	cmpl	%eax, %r9d
	jle	.L15
	movzbl	(%rcx), %esi
	cmpb	$35, %sil
	je	.L15
	cmpb	$42, %sil
	jne	.L39
.L20:
	cltq
	movslq	%edx, %rdx
	leaq	(%rax,%rax,4), %rcx
	leaq	(%rax,%rcx,4), %rax
	addq	%rdi, %rax
	movb	$46, (%rax,%rdx)
.L15:
	popq	%rbx
	.cfi_remember_state
	.cfi_def_cfa_offset 8
	ret
	.p2align 4,,10
	.p2align 3
.L39:
	.cfi_restore_state
	addl	$1, %eax
	addl	$1, %edx
	js	.L15
	addq	$22, %rcx
	testl	%eax, %eax
	js	.L15
	cmpl	%r8d, %edx
	jl	.L21
	popq	%rbx
	.cfi_remember_state
	.cfi_def_cfa_offset 8
	ret
	.p2align 4,,10
	.p2align 3
.L17:
	.cfi_restore_state
	movslq	%r11d, %rsi
	leaq	(%rsi,%rsi,4), %rdi
	leaq	(%rsi,%rdi,4), %rbx
	movslq	%ecx, %rsi
	addq	%rsi, %rbx
	movslq	%eax, %rsi
	leaq	(%rsi,%rsi,4), %rdi
	leaq	(%rsi,%rdi,4), %rsi
	movslq	%edx, %rdi
	addq	%rdi, %rsi
	leaq	map(%rip), %rdi
	addq	%rdi, %rsi
	jmp	.L19
	.p2align 4,,10
	.p2align 3
.L40:
	cmpb	$42, %r10b
	je	.L20
	addl	%r11d, %eax
	addl	%ecx, %edx
	js	.L15
	addq	%rbx, %rsi
	cmpl	%r8d, %edx
	jge	.L15
	testl	%eax, %eax
	js	.L15
.L19:
	cmpl	%eax, %r9d
	jle	.L15
	movzbl	(%rsi), %r10d
	cmpb	$35, %r10b
	jne	.L40
	popq	%rbx
	.cfi_def_cfa_offset 8
	ret
.L35:
	.cfi_restore 3
	ret
	.cfi_endproc
.LFE26:
	.size	shot, .-shot
	.p2align 4
	.globl	act
	.type	act, @function
act:
.LFB24:
	.cfi_startproc
	endbr64
	movzbl	(%rdi), %eax
	testb	%al, %al
	je	.L56
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	leaq	.L45(%rip), %rbp
	pushq	%rbx
	.cfi_def_cfa_offset 24
	.cfi_offset 3, -24
	movq	%rdi, %rbx
	.p2align 4,,10
	.p2align 3
.L50:
	subl	$68, %eax
	cmpb	$17, %al
	ja	.L43
	movzbl	%al, %eax
	movslq	0(%rbp,%rax,4), %rax
	addq	%rbp, %rax
	notrack jmp	*%rax
	.section	.rodata
	.align 4
	.align 4
.L45:
	.long	.L49-.L45
	.long	.L43-.L45
	.long	.L43-.L45
	.long	.L43-.L45
	.long	.L43-.L45
	.long	.L43-.L45
	.long	.L43-.L45
	.long	.L43-.L45
	.long	.L48-.L45
	.long	.L43-.L45
	.long	.L43-.L45
	.long	.L43-.L45
	.long	.L43-.L45
	.long	.L43-.L45
	.long	.L47-.L45
	.long	.L46-.L45
	.long	.L43-.L45
	.long	.L44-.L45
	.text
	.p2align 4,,10
	.p2align 3
.L44:
	movl	$0, dir(%rip)
	xorl	%edi, %edi
	call	move
	.p2align 4,,10
	.p2align 3
.L43:
	movzbl	1(%rbx), %eax
	addq	$1, %rbx
	testb	%al, %al
	jne	.L50
.L59:
	popq	%rbx
	.cfi_remember_state
	.cfi_def_cfa_offset 16
	popq	%rbp
	.cfi_def_cfa_offset 8
	ret
	.p2align 4,,10
	.p2align 3
.L46:
	.cfi_restore_state
	movl	dir(%rip), %edi
	addq	$1, %rbx
	call	shot
	movzbl	(%rbx), %eax
	testb	%al, %al
	jne	.L50
	jmp	.L59
	.p2align 4,,10
	.p2align 3
.L47:
	movl	$3, %edi
	addq	$1, %rbx
	movl	$3, dir(%rip)
	call	move
	movzbl	(%rbx), %eax
	testb	%al, %al
	jne	.L50
	jmp	.L59
	.p2align 4,,10
	.p2align 3
.L48:
	movl	$2, %edi
	addq	$1, %rbx
	movl	$2, dir(%rip)
	call	move
	movzbl	(%rbx), %eax
	testb	%al, %al
	jne	.L50
	jmp	.L59
	.p2align 4,,10
	.p2align 3
.L49:
	movl	$1, %edi
	addq	$1, %rbx
	movl	$1, dir(%rip)
	call	move
	movzbl	(%rbx), %eax
	testb	%al, %al
	jne	.L50
	jmp	.L59
	.p2align 4,,10
	.p2align 3
.L56:
	.cfi_def_cfa_offset 8
	.cfi_restore 3
	.cfi_restore 6
	ret
	.cfi_endproc
.LFE24:
	.size	act, .-act
	.section	.rodata.str1.1,"aMS",@progbits,1
.LC0:
	.string	"%d\n"
.LC1:
	.string	"%d %d\n"
	.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	420+map(%rip), %rdx
	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	$152, %rsp
	.cfi_def_cfa_offset 208
	movq	%fs:40, %rax
	movq	%rax, 136(%rsp)
	xorl	%eax, %eax
	leaq	-420(%rdx), %rax
	.p2align 4,,10
	.p2align 3
.L61:
	movdqa	.LC2(%rip), %xmm0
	movl	$808464432, 16(%rax)
	addq	$21, %rax
	movups	%xmm0, -21(%rax)
	cmpq	%rax, %rdx
	jne	.L61
	leaq	.LC0(%rip), %r14
	leaq	24(%rsp), %rsi
	xorl	%eax, %eax
	xorl	%r12d, %r12d
	movq	%r14, %rdi
	leaq	.L83(%rip), %rbp
	call	__isoc99_scanf@PLT
	movl	24(%rsp), %edi
	leaq	28(%rsp), %rax
	movq	%rax, 8(%rsp)
	testl	%edi, %edi
	jle	.L91
	.p2align 4,,10
	.p2align 3
.L62:
	leaq	h(%rip), %rsi
	leaq	w(%rip), %rdx
	xorl	%eax, %eax
	xorl	%ebx, %ebx
	leaq	.LC1(%rip), %rdi
	leaq	map(%rip), %r15
	call	__isoc99_scanf@PLT
	movl	h(%rip), %esi
	testl	%esi, %esi
	jle	.L64
	.p2align 4,,10
	.p2align 3
.L63:
	movl	w(%rip), %ecx
	xorl	%r13d, %r13d
	testl	%ecx, %ecx
	jg	.L71
	jmp	.L72
	.p2align 4,,10
	.p2align 3
.L65:
	cmpb	$118, %al
	je	.L67
	cmpb	$60, %al
	jne	.L117
	movl	%r13d, px(%rip)
	movl	%ebx, py(%rip)
	movl	$2, dir(%rip)
.L66:
	addq	$1, %r13
	cmpl	%r13d, w(%rip)
	jle	.L72
.L71:
	movq	stdin(%rip), %rdi
	call	getc@PLT
	movb	%al, (%r15,%r13)
	cmpb	$94, %al
	jne	.L65
	movl	%r13d, px(%rip)
	addq	$1, %r13
	cmpl	%r13d, w(%rip)
	movl	%ebx, py(%rip)
	movl	$0, dir(%rip)
	jg	.L71
.L72:
	movq	stdin(%rip), %rdi
	addl	$1, %ebx
	addq	$21, %r15
	call	getc@PLT
	cmpl	%ebx, h(%rip)
	jg	.L63
.L64:
	movq	8(%rsp), %rsi
	movq	%r14, %rdi
	xorl	%eax, %eax
	call	__isoc99_scanf@PLT
	movl	28(%rsp), %ebx
	testl	%ebx, %ebx
	js	.L118
	cmpl	$100, %ebx
	jle	.L75
	movl	$100, 28(%rsp)
.L76:
	leaq	32(%rsp), %r15
	xorl	%ebx, %ebx
	.p2align 4,,10
	.p2align 3
.L77:
	movq	stdin(%rip), %rdi
	addl	$1, %ebx
	addq	$1, %r15
	call	getc@PLT
	movb	%al, -1(%r15)
	cmpl	%ebx, 28(%rsp)
	jg	.L77
.L74:
	movslq	%ebx, %rbx
	movb	$0, 32(%rsp,%rbx)
	movzbl	32(%rsp), %eax
	leaq	32(%rsp), %rbx
	testb	%al, %al
	je	.L88
	.p2align 4,,10
	.p2align 3
.L78:
	subl	$68, %eax
	cmpb	$17, %al
	ja	.L81
	movzbl	%al, %eax
	movslq	0(%rbp,%rax,4), %rax
	addq	%rbp, %rax
	notrack jmp	*%rax
	.section	.rodata
	.align 4
	.align 4
.L83:
	.long	.L87-.L83
	.long	.L81-.L83
	.long	.L81-.L83
	.long	.L81-.L83
	.long	.L81-.L83
	.long	.L81-.L83
	.long	.L81-.L83
	.long	.L81-.L83
	.long	.L86-.L83
	.long	.L81-.L83
	.long	.L81-.L83
	.long	.L81-.L83
	.long	.L81-.L83
	.long	.L81-.L83
	.long	.L85-.L83
	.long	.L84-.L83
	.long	.L81-.L83
	.long	.L82-.L83
	.section	.text.startup
.L117:
	cmpb	$62, %al
	jne	.L66
	movl	%r13d, px(%rip)
	movl	%ebx, py(%rip)
	movl	$3, dir(%rip)
	jmp	.L66
	.p2align 4,,10
	.p2align 3
.L67:
	movl	%r13d, px(%rip)
	movl	%ebx, py(%rip)
	movl	$1, dir(%rip)
	jmp	.L66
.L82:
	movl	$0, dir(%rip)
	xorl	%edi, %edi
	call	move
	.p2align 4,,10
	.p2align 3
.L81:
	movzbl	1(%rbx), %eax
	addq	$1, %rbx
	testb	%al, %al
	jne	.L78
.L88:
	movl	h(%rip), %edx
	leaq	map(%rip), %rbx
	xorl	%r15d, %r15d
	testl	%edx, %edx
	jle	.L80
	.p2align 4,,10
	.p2align 3
.L79:
	movl	w(%rip), %eax
	xorl	%r13d, %r13d
	testl	%eax, %eax
	jle	.L90
	.p2align 4,,10
	.p2align 3
.L89:
	movsbl	(%rbx,%r13), %edi
	addq	$1, %r13
	call	putchar@PLT
	cmpl	%r13d, w(%rip)
	jg	.L89
.L90:
	movl	$10, %edi
	addl	$1, %r15d
	addq	$21, %rbx
	call	putchar@PLT
	cmpl	h(%rip), %r15d
	jl	.L79
.L80:
	addl	$1, %r12d
	cmpl	24(%rsp), %r12d
	jne	.L119
.L91:
	movq	136(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L120
	addq	$152, %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
.L84:
	.cfi_restore_state
	movl	dir(%rip), %edi
	addq	$1, %rbx
	call	shot
	movzbl	(%rbx), %eax
	testb	%al, %al
	jne	.L78
	jmp	.L88
.L85:
	movl	$3, %edi
	addq	$1, %rbx
	movl	$3, dir(%rip)
	call	move
	movzbl	(%rbx), %eax
	testb	%al, %al
	jne	.L78
	jmp	.L88
.L86:
	movl	$2, %edi
	addq	$1, %rbx
	movl	$2, dir(%rip)
	call	move
	movzbl	(%rbx), %eax
	testb	%al, %al
	jne	.L78
	jmp	.L88
.L87:
	movl	$1, %edi
	addq	$1, %rbx
	movl	$1, dir(%rip)
	call	move
	movzbl	(%rbx), %eax
	testb	%al, %al
	jne	.L78
	jmp	.L88
.L119:
	movl	$10, %edi
	call	putchar@PLT
	cmpl	24(%rsp), %r12d
	jl	.L62
	jmp	.L91
	.p2align 4,,10
	.p2align 3
.L118:
	movl	$0, 28(%rsp)
	xorl	%ebx, %ebx
	jmp	.L74
.L75:
	testl	%ebx, %ebx
	jne	.L76
	jmp	.L74
.L120:
	call	__stack_chk_fail@PLT
	.cfi_endproc
.LFE23:
	.size	main, .-main
	.text
	.p2align 4
	.globl	format
	.type	format, @function
format:
.LFB27:
	.cfi_startproc
	endbr64
	testl	%edi, %edi
	jle	.L126
	testl	%esi, %esi
	jle	.L126
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	leal	-1(%rdi), %eax
	leaq	map(%rip), %rcx
	pushq	%rbx
	.cfi_def_cfa_offset 24
	.cfi_offset 3, -24
	leaq	(%rax,%rax,4), %rdx
	movslq	%esi, %rbx
	leaq	(%rax,%rdx,4), %rbp
	leaq	21(%rcx), %rax
	addq	%rax, %rbp
	subq	$8, %rsp
	.cfi_def_cfa_offset 32
	.p2align 4,,10
	.p2align 3
.L123:
	movq	%rcx, %rdi
	movq	%rbx, %rdx
	movl	$48, %esi
	call	memset@PLT
	movq	%rax, %rcx
	addq	$21, %rcx
	cmpq	%rbp, %rcx
	jne	.L123
	addq	$8, %rsp
	.cfi_def_cfa_offset 24
	popq	%rbx
	.cfi_def_cfa_offset 16
	popq	%rbp
	.cfi_def_cfa_offset 8
	ret
.L126:
	.cfi_restore 3
	.cfi_restore 6
	ret
	.cfi_endproc
.LFE27:
	.size	format, .-format
	.p2align 4
	.globl	view
	.type	view, @function
view:
.LFB28:
	.cfi_startproc
	endbr64
	movl	h(%rip), %edx
	testl	%edx, %edx
	jle	.L138
	pushq	%r12
	.cfi_def_cfa_offset 16
	.cfi_offset 12, -16
	xorl	%r12d, %r12d
	pushq	%rbp
	.cfi_def_cfa_offset 24
	.cfi_offset 6, -24
	leaq	map(%rip), %rbp
	pushq	%rbx
	.cfi_def_cfa_offset 32
	.cfi_offset 3, -32
	.p2align 4,,10
	.p2align 3
.L131:
	movl	w(%rip), %eax
	xorl	%ebx, %ebx
	testl	%eax, %eax
	jle	.L133
	.p2align 4,,10
	.p2align 3
.L132:
	movsbl	0(%rbp,%rbx), %edi
	addq	$1, %rbx
	call	putchar@PLT
	cmpl	%ebx, w(%rip)
	jg	.L132
.L133:
	movl	$10, %edi
	addl	$1, %r12d
	addq	$21, %rbp
	call	putchar@PLT
	cmpl	%r12d, h(%rip)
	jg	.L131
	popq	%rbx
	.cfi_def_cfa_offset 24
	popq	%rbp
	.cfi_def_cfa_offset 16
	popq	%r12
	.cfi_def_cfa_offset 8
	ret
.L138:
	.cfi_restore 3
	.cfi_restore 6
	.cfi_restore 12
	ret
	.cfi_endproc
.LFE28:
	.size	view, .-view
	.globl	my
	.data
	.type	my, @object
	.size	my, 4
my:
	.ascii	"^v<>"
	.globl	diry
	.align 16
	.type	diry, @object
	.size	diry, 16
diry:
	.long	-1
	.long	1
	.long	0
	.long	0
	.globl	dirx
	.align 16
	.type	dirx, @object
	.size	dirx, 16
dirx:
	.long	0
	.long	0
	.long	-1
	.long	1
	.globl	dir
	.bss
	.align 4
	.type	dir, @object
	.size	dir, 4
dir:
	.zero	4
	.globl	py
	.align 4
	.type	py, @object
	.size	py, 4
py:
	.zero	4
	.globl	px
	.align 4
	.type	px, @object
	.size	px, 4
px:
	.zero	4
	.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, 420
map:
	.zero	420
	.section	.rodata.cst16,"aM",@progbits,16
	.align 16
.LC2:
	.quad	3472328296227680304
	.quad	3472328296227680304
	.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>

char map[20][21];											//高さ * 幅
int h, w;													//マップの高さ、幅
int px, py, dir = 0;										//自分の座標、方向
int dirx[4] = { 0,0,-1,1 };
int diry[4] = { -1,1,0,0 };
char my[4] = { '^', 'v', '<', '>' };

void act(char *n);
void move(int x);
void shot(int x);
void format(int x, int y);
void view(void);

int main(void) {
	format(20, 20);
	int i, j, k;
	int data;												//繰り返し回数
	int nmax;												//操作列の長さ
	char n[101];											//操作列の格納用
	scanf("%d\n", &data);									//繰り返し回数の取得
	for (k = 0; k < data; k++) {
		scanf("%d %d\n", &h, &w);							//高さと幅の取得
		for (i = 0; i < h; i++) {
			for (j = 0; j < w; j++) {
				map[i][j] = getchar();
				if (map[i][j] == '^') { px = j, py = i, dir = 0; }
				if (map[i][j] == 'v') { px = j, py = i, dir = 1; }
				if (map[i][j] == '<') { px = j, py = i, dir = 2; }
				if (map[i][j] == '>') { px = j, py = i, dir = 3; }
			}
			getchar();
		}
		scanf("%d\n", &nmax);								//操作列の長さの取得
		if (nmax < 0) { nmax = 0; }
		if (nmax > 100) { nmax = 100; }
		for (i = 0; i < nmax; i++) {						//操作列の取得
			n[i] = getchar();
		}
		n[i] = '\0';
		act(&n[0]);											//行動処理
		view();												//結果の表示
		if (k + 1 != data) { printf("\n"); }
	}
	return 0;
}
void act(char *str) {										//行動処理
	while (*str != '\0') {
		switch (*str) {
		case 'U':
			dir = 0;
			move(dir);
			break;
		case 'D':
			dir = 1;
			move(dir);
			break;
		case 'L':
			dir = 2;
			move(dir);
			break;
		case 'R':
			dir = 3;
			move(dir);
			break;
		case 'S':
			shot(dir);
			break;
		default:
			break;
		}
		str++;
	}
}
void move(int x) {											//移動処理
	int sx = px + dirx[x], sy = py + diry[x], flag = 0;
	if (sx < 0 || sx >= w) { flag = 1; }
	if (sy < 0 || sy >= h) { flag = 1; }
	if (map[sy][sx] == '.' && flag == 0) {
		map[py][px] = '.';									//自分のいた場所を平地へ変更する
		px = sx, py = sy;									//座標を移動する
	}
	map[py][px] = my[dir];
}
void shot(int x) {											//砲弾処理
	int sx = px + dirx[x], sy = py + diry[x] , flag;
	do {													//移動可能な限り繰り返す
		flag = 0;
		if (sx < 0 || sx >= w) { break; }					//幅の範囲外は見ない
		if (sy < 0 || sy >= h) { break; }					//高さの範囲外は見ない
		switch (map[sy][sx]) {
			case '*':										//レンガの壁の場合
				map[sy][sx] = '.';							//平地に変更する
				break;
			case '#':										//鉄の壁の場合
				break;
			default:										//障害物以外の場合
				flag = 1;									//繰り返す
				break;
		}
		sx += dirx[x];
		sy += diry[x];
	} while (flag != 0);
}
void format(int x, int y) {
	int i, j;
	for (i = 0; i < x; i++) {
		for (j = 0; j < y; j++) {
			map[i][j] = '0';
		}
	}
}
void view(void) {
	int i, j;
	for (i = 0; i < h; i++) {
		for (j = 0; j < w; j++) {
			printf("%c", map[i][j]);
		}
		printf("\n");
	}
}


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
 4
4 6
*.*..*
*.....
...-..
^.*#..
10
SRSSRRUSSR
2 2
<.
..
12
DESRRSUUSLLS
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
 4
4 6
*.*..*
*.....
...-..
^.*#..
10
SRSSRRUSSR
2 2
<.
..
12
DESRRSUUSLLS
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
 4
4 6
*.*..*
*.....
...-..
^..#*.
10
SRSSRRUSSR
2 2
<.
..
12
DDSRRSUUSLLS
3 5
>-#**
.-*#*
.-*#*
15
SSSDRSSSDRSSSUU
5 5
v****
)****
*****
*****
*****
44
SSSSDDRSDRSRDSULUURSSSSRRRRDSSSSDDLSDLSDLSSD

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

<.
..

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

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

<.
..

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

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

<.
..

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

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

<.
..

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

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

<.
..

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

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

<.
..

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

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

<.
..

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

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

<.
..

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

.....
)*.*.
.**..
.**..
.*..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
#include <stdio.h>

char map[20][21];											//高さ * 幅
int h, w;													//マップの高さ、幅
int px, py, dir = 0;										//自分の座標、方向
int dirx[4] = { 0,0,-1,1 };
int diry[4] = { -1,1,0,0 };
char my[4] = { '^', 'v', '<', '>' };

void act(char *n);
void move(int x);
void shot(int x);
void format(int x, int y);
void view(void);

int main(void) {
	format(20, 20);
	int i, j, k;
	int data;												//繰り返し回数
	int nmax;												//操作列の長さ
	char n[101];											//操作列の格納用
	scanf("%d\n", &data);									//繰り返し回数の取得
	for (k = 0; k < data; k++) {
		scanf("%d %d\n", &h, &w);							//高さと幅の取得
		for (i = 0; i < h; i++) {
			for (j = 0; j < w; j++) {
				map[i][j] = getchar();
				if (map[i][j] == '^') { px = j, py = i, dir = 0; }
				if (map[i][j] == 'v') { px = j, py = i, dir = 1; }
				if (map[i][j] == '<') { px = j, py = i, dir = 2; }
				if (map[i][j] == '>') { px = j, py = i, dir = 3; }
			}
			getchar();
		}
		scanf("%d\n", &nmax);								//操作列の長さの取得
		if (nmax < 0) { nmax = 0; }
		if (nmax > 100) { nmax = 100; }
		for (i = 0; i < nmax; i++) {						//操作列の取得
			n[i] = getchar();
		}
		n[i] = '\0';
		act(&n[0]);											//行動処理
		view();												//結果の表示
		if (k + 1 != data) { printf("\n"); }
	}
	return 0;
}
void act(char *str) {										//行動処理
	while (*str != '\0') {
		switch (*str) {
		case 'U':
			dir = 0;
			move(dir);
			break;
		case 'D':
			dir = 1;
			move(dir);
			break;
		case 'L':
			dir = 2;
			move(dir);
			break;
		case 'R':
			dir = 3;
			move(dir);
			break;
		case 'S':
			shot(dir);
			break;
		default:
			break;
		}
		str++;
	}
}
void move(int x) {											//移動処理
	int sx = px + dirx[x], sy = py + diry[x], flag = 0;
	if (sx < 0 || sx >= w) { flag = 1; }
	if (sy < 0 || sy >= h) { flag = 1; }
	if (map[sy][sx] == '.' && flag == 0) {
		map[py][px] = '.';									//自分のいた場所を平地へ変更する
		px = sx, py = sy;									//座標を移動する
	}
	map[py][px] = my[dir];
}
void shot(int x) {											//砲弾処理
	int sx = px + dirx[x], sy = py + diry[x] , flag;
	do {													//移動可能な限り繰り返す
		flag = 0;
		if (sx < 0 || sx >= w) { break; }					//幅の範囲外は見ない
		if (sy < 0 || sy >= h) { break; }					//高さの範囲外は見ない
		switch (map[sy][sx]) {
			case '*':										//レンガの壁の場合
				map[sy][sx] = '.';							//平地に変更する
				break;
			case '#':										//鉄の壁の場合
				break;
			default:										//障害物以外の場合
				flag = 1;									//繰り返す
				break;
		}
		sx += dirx[x];
		sy += diry[x];
	} while (flag != 0);
}
void format(int x, int y) {
	int i, j;
	for (i = 0; i < x; i++) {
		for (j = 0; j < y; j++) {
			map[i][j] = '0';
		}
	}
}
void view(void) {
	int i, j;
	for (i = 0; i < h; i++) {
		for (j = 0; j < w; j++) {
			printf("%c", map[i][j]);
		}
		printf("\n");
	}
}

```

Unoptimized Assembly Code:

```assembly
	.file	"temp.c"
	.text
	.globl	map
	.bss
	.align 32
	.type	map, @object
	.size	map, 420
map:
	.zero	420
	.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	px
	.align 4
	.type	px, @object
	.size	px, 4
px:
	.zero	4
	.globl	py
	.align 4
	.type	py, @object
	.size	py, 4
py:
	.zero	4
	.globl	dir
	.align 4
	.type	dir, @object
	.size	dir, 4
dir:
	.zero	4
	.globl	dirx
	.data
	.align 16
	.type	dirx, @object
	.size	dirx, 16
dirx:
	.long	0
	.long	0
	.long	-1
	.long	1
	.globl	diry
	.align 16
	.type	diry, @object
	.size	diry, 16
diry:
	.long	-1
	.long	1
	.long	0
	.long	0
	.globl	my
	.type	my, @object
	.size	my, 4
my:
	.ascii	"^v<>"
	.section	.rodata
.LC0:
	.string	"%d\n"
.LC1:
	.string	"%d %d\n"
	.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	$144, %rsp
	movq	%fs:40, %rax
	movq	%rax, -8(%rbp)
	xorl	%eax, %eax
	movl	$20, %esi
	movl	$20, %edi
	call	format
	leaq	-132(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	$0, -116(%rbp)
	jmp	.L2
.L16:
	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, -124(%rbp)
	jmp	.L3
.L10:
	movl	$0, -120(%rbp)
	jmp	.L4
.L9:
	call	getchar@PLT
	movl	%eax, %ecx
	movl	-120(%rbp), %eax
	movslq	%eax, %rsi
	movl	-124(%rbp), %eax
	movslq	%eax, %rdx
	movq	%rdx, %rax
	salq	$2, %rax
	addq	%rdx, %rax
	salq	$2, %rax
	addq	%rdx, %rax
	leaq	(%rax,%rsi), %rdx
	leaq	map(%rip), %rax
	addq	%rdx, %rax
	movb	%cl, (%rax)
	movl	-120(%rbp), %eax
	movslq	%eax, %rcx
	movl	-124(%rbp), %eax
	movslq	%eax, %rdx
	movq	%rdx, %rax
	salq	$2, %rax
	addq	%rdx, %rax
	salq	$2, %rax
	addq	%rdx, %rax
	leaq	(%rax,%rcx), %rdx
	leaq	map(%rip), %rax
	addq	%rdx, %rax
	movzbl	(%rax), %eax
	cmpb	$94, %al
	jne	.L5
	movl	-120(%rbp), %eax
	movl	%eax, px(%rip)
	movl	-124(%rbp), %eax
	movl	%eax, py(%rip)
	movl	$0, dir(%rip)
.L5:
	movl	-120(%rbp), %eax
	movslq	%eax, %rcx
	movl	-124(%rbp), %eax
	movslq	%eax, %rdx
	movq	%rdx, %rax
	salq	$2, %rax
	addq	%rdx, %rax
	salq	$2, %rax
	addq	%rdx, %rax
	leaq	(%rax,%rcx), %rdx
	leaq	map(%rip), %rax
	addq	%rdx, %rax
	movzbl	(%rax), %eax
	cmpb	$118, %al
	jne	.L6
	movl	-120(%rbp), %eax
	movl	%eax, px(%rip)
	movl	-124(%rbp), %eax
	movl	%eax, py(%rip)
	movl	$1, dir(%rip)
.L6:
	movl	-120(%rbp), %eax
	movslq	%eax, %rcx
	movl	-124(%rbp), %eax
	movslq	%eax, %rdx
	movq	%rdx, %rax
	salq	$2, %rax
	addq	%rdx, %rax
	salq	$2, %rax
	addq	%rdx, %rax
	leaq	(%rax,%rcx), %rdx
	leaq	map(%rip), %rax
	addq	%rdx, %rax
	movzbl	(%rax), %eax
	cmpb	$60, %al
	jne	.L7
	movl	-120(%rbp), %eax
	movl	%eax, px(%rip)
	movl	-124(%rbp), %eax
	movl	%eax, py(%rip)
	movl	$2, dir(%rip)
.L7:
	movl	-120(%rbp), %eax
	movslq	%eax, %rcx
	movl	-124(%rbp), %eax
	movslq	%eax, %rdx
	movq	%rdx, %rax
	salq	$2, %rax
	addq	%rdx, %rax
	salq	$2, %rax
	addq	%rdx, %rax
	leaq	(%rax,%rcx), %rdx
	leaq	map(%rip), %rax
	addq	%rdx, %rax
	movzbl	(%rax), %eax
	cmpb	$62, %al
	jne	.L8
	movl	-120(%rbp), %eax
	movl	%eax, px(%rip)
	movl	-124(%rbp), %eax
	movl	%eax, py(%rip)
	movl	$3, dir(%rip)
.L8:
	addl	$1, -120(%rbp)
.L4:
	movl	w(%rip), %eax
	cmpl	%eax, -120(%rbp)
	jl	.L9
	call	getchar@PLT
	addl	$1, -124(%rbp)
.L3:
	movl	h(%rip), %eax
	cmpl	%eax, -124(%rbp)
	jl	.L10
	leaq	-128(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	-128(%rbp), %eax
	testl	%eax, %eax
	jns	.L11
	movl	$0, -128(%rbp)
.L11:
	movl	-128(%rbp), %eax
	cmpl	$100, %eax
	jle	.L12
	movl	$100, -128(%rbp)
.L12:
	movl	$0, -124(%rbp)
	jmp	.L13
.L14:
	call	getchar@PLT
	movl	%eax, %edx
	movl	-124(%rbp), %eax
	cltq
	movb	%dl, -112(%rbp,%rax)
	addl	$1, -124(%rbp)
.L13:
	movl	-128(%rbp), %eax
	cmpl	%eax, -124(%rbp)
	jl	.L14
	movl	-124(%rbp), %eax
	cltq
	movb	$0, -112(%rbp,%rax)
	leaq	-112(%rbp), %rax
	movq	%rax, %rdi
	call	act
	call	view
	movl	-116(%rbp), %eax
	leal	1(%rax), %edx
	movl	-132(%rbp), %eax
	cmpl	%eax, %edx
	je	.L15
	movl	$10, %edi
	call	putchar@PLT
.L15:
	addl	$1, -116(%rbp)
.L2:
	movl	-132(%rbp), %eax
	cmpl	%eax, -116(%rbp)
	jl	.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
.LFE0:
	.size	main, .-main
	.globl	act
	.type	act, @function
act:
.LFB1:
	.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
	movq	%rdi, -8(%rbp)
	jmp	.L20
.L29:
	movq	-8(%rbp), %rax
	movzbl	(%rax), %eax
	movsbl	%al, %eax
	subl	$68, %eax
	cmpl	$17, %eax
	ja	.L30
	movl	%eax, %eax
	leaq	0(,%rax,4), %rdx
	leaq	.L23(%rip), %rax
	movl	(%rdx,%rax), %eax
	cltq
	leaq	.L23(%rip), %rdx
	addq	%rdx, %rax
	notrack jmp	*%rax
	.section	.rodata
	.align 4
	.align 4
.L23:
	.long	.L27-.L23
	.long	.L30-.L23
	.long	.L30-.L23
	.long	.L30-.L23
	.long	.L30-.L23
	.long	.L30-.L23
	.long	.L30-.L23
	.long	.L30-.L23
	.long	.L26-.L23
	.long	.L30-.L23
	.long	.L30-.L23
	.long	.L30-.L23
	.long	.L30-.L23
	.long	.L30-.L23
	.long	.L25-.L23
	.long	.L24-.L23
	.long	.L30-.L23
	.long	.L22-.L23
	.text
.L22:
	movl	$0, dir(%rip)
	movl	dir(%rip), %eax
	movl	%eax, %edi
	call	move
	jmp	.L28
.L27:
	movl	$1, dir(%rip)
	movl	dir(%rip), %eax
	movl	%eax, %edi
	call	move
	jmp	.L28
.L26:
	movl	$2, dir(%rip)
	movl	dir(%rip), %eax
	movl	%eax, %edi
	call	move
	jmp	.L28
.L25:
	movl	$3, dir(%rip)
	movl	dir(%rip), %eax
	movl	%eax, %edi
	call	move
	jmp	.L28
.L24:
	movl	dir(%rip), %eax
	movl	%eax, %edi
	call	shot
	jmp	.L28
.L30:
	nop
.L28:
	addq	$1, -8(%rbp)
.L20:
	movq	-8(%rbp), %rax
	movzbl	(%rax), %eax
	testb	%al, %al
	jne	.L29
	nop
	nop
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE1:
	.size	act, .-act
	.globl	move
	.type	move, @function
move:
.LFB2:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	movl	%edi, -20(%rbp)
	movl	-20(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	dirx(%rip), %rax
	movl	(%rdx,%rax), %edx
	movl	px(%rip), %eax
	addl	%edx, %eax
	movl	%eax, -8(%rbp)
	movl	-20(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	diry(%rip), %rax
	movl	(%rdx,%rax), %edx
	movl	py(%rip), %eax
	addl	%edx, %eax
	movl	%eax, -4(%rbp)
	movl	$0, -12(%rbp)
	cmpl	$0, -8(%rbp)
	js	.L32
	movl	w(%rip), %eax
	cmpl	%eax, -8(%rbp)
	jl	.L33
.L32:
	movl	$1, -12(%rbp)
.L33:
	cmpl	$0, -4(%rbp)
	js	.L34
	movl	h(%rip), %eax
	cmpl	%eax, -4(%rbp)
	jl	.L35
.L34:
	movl	$1, -12(%rbp)
.L35:
	movl	-8(%rbp), %eax
	movslq	%eax, %rcx
	movl	-4(%rbp), %eax
	movslq	%eax, %rdx
	movq	%rdx, %rax
	salq	$2, %rax
	addq	%rdx, %rax
	salq	$2, %rax
	addq	%rdx, %rax
	leaq	(%rax,%rcx), %rdx
	leaq	map(%rip), %rax
	addq	%rdx, %rax
	movzbl	(%rax), %eax
	cmpb	$46, %al
	jne	.L36
	cmpl	$0, -12(%rbp)
	jne	.L36
	movl	py(%rip), %eax
	movl	px(%rip), %edx
	movslq	%edx, %rcx
	movslq	%eax, %rdx
	movq	%rdx, %rax
	salq	$2, %rax
	addq	%rdx, %rax
	salq	$2, %rax
	addq	%rdx, %rax
	leaq	(%rax,%rcx), %rdx
	leaq	map(%rip), %rax
	addq	%rdx, %rax
	movb	$46, (%rax)
	movl	-8(%rbp), %eax
	movl	%eax, px(%rip)
	movl	-4(%rbp), %eax
	movl	%eax, py(%rip)
.L36:
	movl	dir(%rip), %eax
	movl	py(%rip), %edx
	movl	px(%rip), %esi
	cltq
	leaq	my(%rip), %rcx
	movzbl	(%rax,%rcx), %ecx
	movslq	%esi, %rsi
	movslq	%edx, %rdx
	movq	%rdx, %rax
	salq	$2, %rax
	addq	%rdx, %rax
	salq	$2, %rax
	addq	%rdx, %rax
	leaq	(%rax,%rsi), %rdx
	leaq	map(%rip), %rax
	addq	%rdx, %rax
	movb	%cl, (%rax)
	nop
	popq	%rbp
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE2:
	.size	move, .-move
	.globl	shot
	.type	shot, @function
shot:
.LFB3:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	movl	%edi, -20(%rbp)
	movl	-20(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	dirx(%rip), %rax
	movl	(%rdx,%rax), %edx
	movl	px(%rip), %eax
	addl	%edx, %eax
	movl	%eax, -12(%rbp)
	movl	-20(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	diry(%rip), %rax
	movl	(%rdx,%rax), %edx
	movl	py(%rip), %eax
	addl	%edx, %eax
	movl	%eax, -8(%rbp)
.L42:
	movl	$0, -4(%rbp)
	cmpl	$0, -12(%rbp)
	js	.L43
	movl	w(%rip), %eax
	cmpl	%eax, -12(%rbp)
	jge	.L43
	cmpl	$0, -8(%rbp)
	js	.L43
	movl	h(%rip), %eax
	cmpl	%eax, -8(%rbp)
	jge	.L43
	movl	-12(%rbp), %eax
	movslq	%eax, %rcx
	movl	-8(%rbp), %eax
	movslq	%eax, %rdx
	movq	%rdx, %rax
	salq	$2, %rax
	addq	%rdx, %rax
	salq	$2, %rax
	addq	%rdx, %rax
	leaq	(%rax,%rcx), %rdx
	leaq	map(%rip), %rax
	addq	%rdx, %rax
	movzbl	(%rax), %eax
	movsbl	%al, %eax
	cmpl	$35, %eax
	je	.L44
	cmpl	$42, %eax
	jne	.L40
	movl	-12(%rbp), %eax
	movslq	%eax, %rcx
	movl	-8(%rbp), %eax
	movslq	%eax, %rdx
	movq	%rdx, %rax
	salq	$2, %rax
	addq	%rdx, %rax
	salq	$2, %rax
	addq	%rdx, %rax
	leaq	(%rax,%rcx), %rdx
	leaq	map(%rip), %rax
	addq	%rdx, %rax
	movb	$46, (%rax)
	jmp	.L41
.L40:
	movl	$1, -4(%rbp)
	jmp	.L41
.L44:
	nop
.L41:
	movl	-20(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	dirx(%rip), %rax
	movl	(%rdx,%rax), %eax
	addl	%eax, -12(%rbp)
	movl	-20(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	diry(%rip), %rax
	movl	(%rdx,%rax), %eax
	addl	%eax, -8(%rbp)
	cmpl	$0, -4(%rbp)
	jne	.L42
.L43:
	nop
	popq	%rbp
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE3:
	.size	shot, .-shot
	.globl	format
	.type	format, @function
format:
.LFB4:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	movl	%edi, -20(%rbp)
	movl	%esi, -24(%rbp)
	movl	$0, -8(%rbp)
	jmp	.L46
.L49:
	movl	$0, -4(%rbp)
	jmp	.L47
.L48:
	movl	-4(%rbp), %eax
	movslq	%eax, %rcx
	movl	-8(%rbp), %eax
	movslq	%eax, %rdx
	movq	%rdx, %rax
	salq	$2, %rax
	addq	%rdx, %rax
	salq	$2, %rax
	addq	%rdx, %rax
	leaq	(%rax,%rcx), %rdx
	leaq	map(%rip), %rax
	addq	%rdx, %rax
	movb	$48, (%rax)
	addl	$1, -4(%rbp)
.L47:
	movl	-4(%rbp), %eax
	cmpl	-24(%rbp), %eax
	jl	.L48
	addl	$1, -8(%rbp)
.L46:
	movl	-8(%rbp), %eax
	cmpl	-20(%rbp), %eax
	jl	.L49
	nop
	nop
	popq	%rbp
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE4:
	.size	format, .-format
	.globl	view
	.type	view, @function
view:
.LFB5:
	.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
	movl	$0, -8(%rbp)
	jmp	.L51
.L54:
	movl	$0, -4(%rbp)
	jmp	.L52
.L53:
	movl	-4(%rbp), %eax
	movslq	%eax, %rcx
	movl	-8(%rbp), %eax
	movslq	%eax, %rdx
	movq	%rdx, %rax
	salq	$2, %rax
	addq	%rdx, %rax
	salq	$2, %rax
	addq	%rdx, %rax
	leaq	(%rax,%rcx), %rdx
	leaq	map(%rip), %rax
	addq	%rdx, %rax
	movzbl	(%rax), %eax
	movsbl	%al, %eax
	movl	%eax, %edi
	call	putchar@PLT
	addl	$1, -4(%rbp)
.L52:
	movl	w(%rip), %eax
	cmpl	%eax, -4(%rbp)
	jl	.L53
	movl	$10, %edi
	call	putchar@PLT
	addl	$1, -8(%rbp)
.L51:
	movl	h(%rip), %eax
	cmpl	%eax, -8(%rbp)
	jl	.L54
	nop
	nop
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE5:
	.size	view, .-view
	.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, 420
map:
	.zero	420
	.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	px
	.align 4
	.type	px, @object
	.size	px, 4
px:
	.zero	4
	.globl	py
	.align 4
	.type	py, @object
	.size	py, 4
py:
	.zero	4
	.globl	dir
	.align 4
	.type	dir, @object
	.size	dir, 4
dir:
	.zero	4
	.globl	dirx
	.data
	.align 16
	.type	dirx, @object
	.size	dirx, 16
dirx:
	.long	0
	.long	0
	.long	-1
	.long	1
	.globl	diry
	.align 16
	.type	diry, @object
	.size	diry, 16
diry:
	.long	-1
	.long	1
	.long	0
	.long	0
	.globl	my
	.type	my, @object
	.size	my, 4
my:
	.ascii	"^v<>"
	.section	.rodata
.LC0:
	.string	"%d\n"
.LC1:
	.string	"%d %d\n"
	.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	$144, %rsp
	movq	%fs:40, %rax
	movq	%rax, -8(%rbp)
	xorl	%eax, %eax
	movl	$20, %esi
	movl	$20, %edi
	call	format
	leaq	-132(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	$0, -116(%rbp)
	jmp	.L2
.L16:
	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, -124(%rbp)
	jmp	.L3
.L10:
	movl	$0, -120(%rbp)
	jmp	.L4
.L9:
	call	getchar@PLT
	movl	%eax, %ecx
	movl	-120(%rbp), %eax
	movslq	%eax, %rsi
	movl	-124(%rbp), %eax
	movslq	%eax, %rdx
	movq	%rdx, %rax
	salq	$2, %rax
	addq	%rdx, %rax
	salq	$2, %rax
	addq	%rdx, %rax
	leaq	(%rax,%rsi), %rdx
	leaq	map(%rip), %rax
	addq	%rdx, %rax
	movb	%cl, (%rax)
	movl	-120(%rbp), %eax
	movslq	%eax, %rcx
	movl	-124(%rbp), %eax
	movslq	%eax, %rdx
	movq	%rdx, %rax
	salq	$2, %rax
	addq	%rdx, %rax
	salq	$2, %rax
	addq	%rdx, %rax
	leaq	(%rax,%rcx), %rdx
	leaq	map(%rip), %rax
	addq	%rdx, %rax
	movzbl	(%rax), %eax
	cmpb	$94, %al
	jne	.L5
	movl	-120(%rbp), %eax
	movl	%eax, px(%rip)
	movl	-124(%rbp), %eax
	movl	%eax, py(%rip)
	movl	$0, dir(%rip)
.L5:
	movl	-120(%rbp), %eax
	movslq	%eax, %rcx
	movl	-124(%rbp), %eax
	movslq	%eax, %rdx
	movq	%rdx, %rax
	salq	$2, %rax
	addq	%rdx, %rax
	salq	$2, %rax
	addq	%rdx, %rax
	leaq	(%rax,%rcx), %rdx
	leaq	map(%rip), %rax
	addq	%rdx, %rax
	movzbl	(%rax), %eax
	cmpb	$118, %al
	jne	.L6
	movl	-120(%rbp), %eax
	movl	%eax, px(%rip)
	movl	-124(%rbp), %eax
	movl	%eax, py(%rip)
	movl	$1, dir(%rip)
.L6:
	movl	-120(%rbp), %eax
	movslq	%eax, %rcx
	movl	-124(%rbp), %eax
	movslq	%eax, %rdx
	movq	%rdx, %rax
	salq	$2, %rax
	addq	%rdx, %rax
	salq	$2, %rax
	addq	%rdx, %rax
	leaq	(%rax,%rcx), %rdx
	leaq	map(%rip), %rax
	addq	%rdx, %rax
	movzbl	(%rax), %eax
	cmpb	$60, %al
	jne	.L7
	movl	-120(%rbp), %eax
	movl	%eax, px(%rip)
	movl	-124(%rbp), %eax
	movl	%eax, py(%rip)
	movl	$2, dir(%rip)
.L7:
	movl	-120(%rbp), %eax
	movslq	%eax, %rcx
	movl	-124(%rbp), %eax
	movslq	%eax, %rdx
	movq	%rdx, %rax
	salq	$2, %rax
	addq	%rdx, %rax
	salq	$2, %rax
	addq	%rdx, %rax
	leaq	(%rax,%rcx), %rdx
	leaq	map(%rip), %rax
	addq	%rdx, %rax
	movzbl	(%rax), %eax
	cmpb	$62, %al
	jne	.L8
	movl	-120(%rbp), %eax
	movl	%eax, px(%rip)
	movl	-124(%rbp), %eax
	movl	%eax, py(%rip)
	movl	$3, dir(%rip)
.L8:
	addl	$1, -120(%rbp)
.L4:
	movl	w(%rip), %eax
	cmpl	%eax, -120(%rbp)
	jl	.L9
	call	getchar@PLT
	addl	$1, -124(%rbp)
.L3:
	movl	h(%rip), %eax
	cmpl	%eax, -124(%rbp)
	jl	.L10
	leaq	-128(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	-128(%rbp), %eax
	testl	%eax, %eax
	jns	.L11
	movl	$0, -128(%rbp)
.L11:
	movl	-128(%rbp), %eax
	cmpl	$100, %eax
	jle	.L12
	movl	$100, -128(%rbp)
.L12:
	movl	$0, -124(%rbp)
	jmp	.L13
.L14:
	call	getchar@PLT
	movl	%eax, %edx
	movl	-124(%rbp), %eax
	cltq
	movb	%dl, -112(%rbp,%rax)
	addl	$1, -124(%rbp)
.L13:
	movl	-128(%rbp), %eax
	cmpl	%eax, -124(%rbp)
	jl	.L14
	movl	-124(%rbp), %eax
	cltq
	movb	$0, -112(%rbp,%rax)
	leaq	-112(%rbp), %rax
	movq	%rax, %rdi
	call	act
	call	view
	movl	-116(%rbp), %eax
	leal	1(%rax), %edx
	movl	-132(%rbp), %eax
	cmpl	%eax, %edx
	je	.L15
	movl	$10, %edi
	call	putchar@PLT
.L15:
	addl	$1, -116(%rbp)
.L2:
	movl	-132(%rbp), %eax
	cmpl	%eax, -116(%rbp)
	jl	.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
.LFE0:
	.size	main, .-main
	.globl	act
	.type	act, @function
act:
.LFB1:
	.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
	movq	%rdi, -8(%rbp)
	jmp	.L20
.L29:
	movq	-8(%rbp), %rax
	movzbl	(%rax), %eax
	movsbl	%al, %eax
	subl	$68, %eax
	cmpl	$17, %eax
	ja	.L30
	movl	%eax, %eax
	leaq	0(,%rax,4), %rdx
	leaq	.L23(%rip), %rax
	movl	(%rdx,%rax), %eax
	cltq
	leaq	.L23(%rip), %rdx
	addq	%rdx, %rax
	notrack jmp	*%rax
	.section	.rodata
	.align 4
	.align 4
.L23:
	.long	.L27-.L23
	.long	.L30-.L23
	.long	.L30-.L23
	.long	.L30-.L23
	.long	.L30-.L23
	.long	.L30-.L23
	.long	.L30-.L23
	.long	.L30-.L23
	.long	.L26-.L23
	.long	.L30-.L23
	.long	.L30-.L23
	.long	.L30-.L23
	.long	.L30-.L23
	.long	.L30-.L23
	.long	.L25-.L23
	.long	.L24-.L23
	.long	.L30-.L23
	.long	.L22-.L23
	.text
.L22:
	movl	$0, dir(%rip)
	movl	dir(%rip), %eax
	movl	%eax, %edi
	call	move
	jmp	.L28
.L27:
	movl	$1, dir(%rip)
	movl	dir(%rip), %eax
	movl	%eax, %edi
	call	move
	jmp	.L28
.L26:
	movl	$2, dir(%rip)
	movl	dir(%rip), %eax
	movl	%eax, %edi
	call	move
	jmp	.L28
.L25:
	movl	$3, dir(%rip)
	movl	dir(%rip), %eax
	movl	%eax, %edi
	call	move
	jmp	.L28
.L24:
	movl	dir(%rip), %eax
	movl	%eax, %edi
	call	shot
	jmp	.L28
.L30:
	nop
.L28:
	addq	$1, -8(%rbp)
.L20:
	movq	-8(%rbp), %rax
	movzbl	(%rax), %eax
	testb	%al, %al
	jne	.L29
	nop
	nop
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE1:
	.size	act, .-act
	.globl	move
	.type	move, @function
move:
.LFB2:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	movl	%edi, -20(%rbp)
	movl	-20(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	dirx(%rip), %rax
	movl	(%rdx,%rax), %edx
	movl	px(%rip), %eax
	addl	%edx, %eax
	movl	%eax, -8(%rbp)
	movl	-20(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	diry(%rip), %rax
	movl	(%rdx,%rax), %edx
	movl	py(%rip), %eax
	addl	%edx, %eax
	movl	%eax, -4(%rbp)
	movl	$0, -12(%rbp)
	cmpl	$0, -8(%rbp)
	js	.L32
	movl	w(%rip), %eax
	cmpl	%eax, -8(%rbp)
	jl	.L33
.L32:
	movl	$1, -12(%rbp)
.L33:
	cmpl	$0, -4(%rbp)
	js	.L34
	movl	h(%rip), %eax
	cmpl	%eax, -4(%rbp)
	jl	.L35
.L34:
	movl	$1, -12(%rbp)
.L35:
	movl	-8(%rbp), %eax
	movslq	%eax, %rcx
	movl	-4(%rbp), %eax
	movslq	%eax, %rdx
	movq	%rdx, %rax
	salq	$2, %rax
	addq	%rdx, %rax
	salq	$2, %rax
	addq	%rdx, %rax
	leaq	(%rax,%rcx), %rdx
	leaq	map(%rip), %rax
	addq	%rdx, %rax
	movzbl	(%rax), %eax
	cmpb	$46, %al
	jne	.L36
	cmpl	$0, -12(%rbp)
	jne	.L36
	movl	py(%rip), %eax
	movl	px(%rip), %edx
	movslq	%edx, %rcx
	movslq	%eax, %rdx
	movq	%rdx, %rax
	salq	$2, %rax
	addq	%rdx, %rax
	salq	$2, %rax
	addq	%rdx, %rax
	leaq	(%rax,%rcx), %rdx
	leaq	map(%rip), %rax
	addq	%rdx, %rax
	movb	$46, (%rax)
	movl	-8(%rbp), %eax
	movl	%eax, px(%rip)
	movl	-4(%rbp), %eax
	movl	%eax, py(%rip)
.L36:
	movl	dir(%rip), %eax
	movl	py(%rip), %edx
	movl	px(%rip), %esi
	cltq
	leaq	my(%rip), %rcx
	movzbl	(%rax,%rcx), %ecx
	movslq	%esi, %rsi
	movslq	%edx, %rdx
	movq	%rdx, %rax
	salq	$2, %rax
	addq	%rdx, %rax
	salq	$2, %rax
	addq	%rdx, %rax
	leaq	(%rax,%rsi), %rdx
	leaq	map(%rip), %rax
	addq	%rdx, %rax
	movb	%cl, (%rax)
	nop
	popq	%rbp
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE2:
	.size	move, .-move
	.globl	shot
	.type	shot, @function
shot:
.LFB3:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	movl	%edi, -20(%rbp)
	movl	-20(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	dirx(%rip), %rax
	movl	(%rdx,%rax), %edx
	movl	px(%rip), %eax
	addl	%edx, %eax
	movl	%eax, -12(%rbp)
	movl	-20(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	diry(%rip), %rax
	movl	(%rdx,%rax), %edx
	movl	py(%rip), %eax
	addl	%edx, %eax
	movl	%eax, -8(%rbp)
.L42:
	movl	$0, -4(%rbp)
	cmpl	$0, -12(%rbp)
	js	.L43
	movl	w(%rip), %eax
	cmpl	%eax, -12(%rbp)
	jge	.L43
	cmpl	$0, -8(%rbp)
	js	.L43
	movl	h(%rip), %eax
	cmpl	%eax, -8(%rbp)
	jge	.L43
	movl	-12(%rbp), %eax
	movslq	%eax, %rcx
	movl	-8(%rbp), %eax
	movslq	%eax, %rdx
	movq	%rdx, %rax
	salq	$2, %rax
	addq	%rdx, %rax
	salq	$2, %rax
	addq	%rdx, %rax
	leaq	(%rax,%rcx), %rdx
	leaq	map(%rip), %rax
	addq	%rdx, %rax
	movzbl	(%rax), %eax
	movsbl	%al, %eax
	cmpl	$35, %eax
	je	.L44
	cmpl	$42, %eax
	jne	.L40
	movl	-12(%rbp), %eax
	movslq	%eax, %rcx
	movl	-8(%rbp), %eax
	movslq	%eax, %rdx
	movq	%rdx, %rax
	salq	$2, %rax
	addq	%rdx, %rax
	salq	$2, %rax
	addq	%rdx, %rax
	leaq	(%rax,%rcx), %rdx
	leaq	map(%rip), %rax
	addq	%rdx, %rax
	movb	$46, (%rax)
	jmp	.L41
.L40:
	movl	$1, -4(%rbp)
	jmp	.L41
.L44:
	nop
.L41:
	movl	-20(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	dirx(%rip), %rax
	movl	(%rdx,%rax), %eax
	addl	%eax, -12(%rbp)
	movl	-20(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	diry(%rip), %rax
	movl	(%rdx,%rax), %eax
	addl	%eax, -8(%rbp)
	cmpl	$0, -4(%rbp)
	jne	.L42
.L43:
	nop
	popq	%rbp
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE3:
	.size	shot, .-shot
	.globl	format
	.type	format, @function
format:
.LFB4:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	movl	%edi, -20(%rbp)
	movl	%esi, -24(%rbp)
	movl	$0, -8(%rbp)
	jmp	.L46
.L49:
	movl	$0, -4(%rbp)
	jmp	.L47
.L48:
	movl	-4(%rbp), %eax
	movslq	%eax, %rcx
	movl	-8(%rbp), %eax
	movslq	%eax, %rdx
	movq	%rdx, %rax
	salq	$2, %rax
	addq	%rdx, %rax
	salq	$2, %rax
	addq	%rdx, %rax
	leaq	(%rax,%rcx), %rdx
	leaq	map(%rip), %rax
	addq	%rdx, %rax
	movb	$48, (%rax)
	addl	$1, -4(%rbp)
.L47:
	movl	-4(%rbp), %eax
	cmpl	-24(%rbp), %eax
	jl	.L48
	addl	$1, -8(%rbp)
.L46:
	movl	-8(%rbp), %eax
	cmpl	-20(%rbp), %eax
	jl	.L49
	nop
	nop
	popq	%rbp
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE4:
	.size	format, .-format
	.globl	view
	.type	view, @function
view:
.LFB5:
	.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
	movl	$0, -8(%rbp)
	jmp	.L51
.L54:
	movl	$0, -4(%rbp)
	jmp	.L52
.L53:
	movl	-4(%rbp), %eax
	movslq	%eax, %rcx
	movl	-8(%rbp), %eax
	movslq	%eax, %rdx
	movq	%rdx, %rax
	salq	$2, %rax
	addq	%rdx, %rax
	salq	$2, %rax
	addq	%rdx, %rax
	leaq	(%rax,%rcx), %rdx
	leaq	map(%rip), %rax
	addq	%rdx, %rax
	movzbl	(%rax), %eax
	movsbl	%al, %eax
	movl	%eax, %edi
	call	putchar@PLT
	addl	$1, -4(%rbp)
.L52:
	movl	w(%rip), %eax
	cmpl	%eax, -4(%rbp)
	jl	.L53
	movl	$10, %edi
	call	putchar@PLT
	addl	$1, -8(%rbp)
.L51:
	movl	h(%rip), %eax
	cmpl	%eax, -8(%rbp)
	jl	.L54
	nop
	nop
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE5:
	.size	view, .-view
	.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:
