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

```c
X[]={0,1,0,-1},Y[]={-1,0,1,0},f[109][109],g[109][109][4];char s[109],*D="NESW";
main(h,w,z,x,y,c,i,j,k){long long l;for(;scanf("%d%d%lld",&h,&w,&l),h;printf("%d %d %c\n",y,x,D[z])){
	memset(f,1,sizeof(f)),memset(g,0,sizeof(g));
	for(i=0;i<h;i++)for(scanf("%s",s),j=0;j<w;j++){
		for(k=0;k<4;k++)if(s[j]==D[k])x=j+1,y=i+1,z=k;
		if(s[j]!='#')f[i+1][j+1]=0;
	}
	for(c=0;l;l--,c++){
		if(g[y][x][z]&&(l%=c-g[y][x][z])==0)break;
		for(g[y][x][z]=c;;z=(z+1)%4)if(!f[y+Y[z]][x+X[z]]){x+=X[z];y+=Y[z];break;}
	}
}exit(0);}```

Unoptimized Assembly Code:

```assembly
	.file	"temp.c"
	.text
	.globl	X
	.data
	.align 16
	.type	X, @object
	.size	X, 16
X:
	.long	0
	.long	1
	.long	0
	.long	-1
	.globl	Y
	.align 16
	.type	Y, @object
	.size	Y, 16
Y:
	.long	-1
	.long	0
	.long	1
	.long	0
	.globl	f
	.bss
	.align 32
	.type	f, @object
	.size	f, 47524
f:
	.zero	47524
	.globl	g
	.align 32
	.type	g, @object
	.size	g, 190096
g:
	.zero	190096
	.globl	s
	.align 32
	.type	s, @object
	.size	s, 109
s:
	.zero	109
	.globl	D
	.section	.rodata
.LC0:
	.string	"NESW"
	.section	.data.rel.local,"aw"
	.align 8
	.type	D, @object
	.size	D, 8
D:
	.quad	.LC0
	.section	.rodata
.LC1:
	.string	"%s"
.LC2:
	.string	"%d %d %c\n"
.LC3:
	.string	"%d%d%lld"
	.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	$48, %rsp
	movl	%edi, -20(%rbp)
	movl	%esi, -24(%rbp)
	movl	%edx, -28(%rbp)
	movl	%ecx, -32(%rbp)
	movl	%r8d, -36(%rbp)
	movl	%r9d, -40(%rbp)
	movq	%fs:40, %rax
	movq	%rax, -8(%rbp)
	xorl	%eax, %eax
	jmp	.L2
.L18:
	movl	$47524, %edx
	movl	$1, %esi
	leaq	f(%rip), %rax
	movq	%rax, %rdi
	call	memset@PLT
	movl	$190096, %edx
	movl	$0, %esi
	leaq	g(%rip), %rax
	movq	%rax, %rdi
	call	memset@PLT
	movl	$0, 16(%rbp)
	jmp	.L3
.L10:
	leaq	s(%rip), %rax
	movq	%rax, %rsi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	scanf@PLT
	movl	$0, 24(%rbp)
	jmp	.L4
.L9:
	movl	$0, 32(%rbp)
	jmp	.L5
.L7:
	movl	24(%rbp), %eax
	cltq
	leaq	s(%rip), %rdx
	movzbl	(%rax,%rdx), %edx
	movq	D(%rip), %rcx
	movl	32(%rbp), %eax
	cltq
	addq	%rcx, %rax
	movzbl	(%rax), %eax
	cmpb	%al, %dl
	jne	.L6
	movl	24(%rbp), %eax
	addl	$1, %eax
	movl	%eax, -32(%rbp)
	movl	16(%rbp), %eax
	addl	$1, %eax
	movl	%eax, -36(%rbp)
	movl	32(%rbp), %eax
	movl	%eax, -28(%rbp)
.L6:
	addl	$1, 32(%rbp)
.L5:
	cmpl	$3, 32(%rbp)
	jle	.L7
	movl	24(%rbp), %eax
	cltq
	leaq	s(%rip), %rdx
	movzbl	(%rax,%rdx), %eax
	cmpb	$35, %al
	je	.L8
	movl	16(%rbp), %eax
	leal	1(%rax), %edx
	movl	24(%rbp), %eax
	addl	$1, %eax
	movslq	%eax, %rcx
	movslq	%edx, %rdx
	movq	%rdx, %rax
	addq	%rax, %rax
	addq	%rdx, %rax
	leaq	0(,%rax,8), %rsi
	addq	%rsi, %rax
	salq	$2, %rax
	addq	%rdx, %rax
	addq	%rcx, %rax
	leaq	0(,%rax,4), %rdx
	leaq	f(%rip), %rax
	movl	$0, (%rdx,%rax)
.L8:
	addl	$1, 24(%rbp)
.L4:
	movl	-24(%rbp), %eax
	cmpl	%eax, 24(%rbp)
	jl	.L9
	addl	$1, 16(%rbp)
.L3:
	movl	-20(%rbp), %eax
	cmpl	%eax, 16(%rbp)
	jl	.L10
	movl	$0, -40(%rbp)
	jmp	.L11
.L17:
	movl	-28(%rbp), %eax
	movslq	%eax, %rcx
	movl	-36(%rbp), %eax
	movslq	%eax, %rdx
	movl	-32(%rbp), %eax
	movslq	%eax, %rsi
	movq	%rdx, %rax
	addq	%rax, %rax
	addq	%rdx, %rax
	leaq	0(,%rax,8), %rdi
	addq	%rdi, %rax
	salq	$2, %rax
	addq	%rdx, %rax
	addq	%rsi, %rax
	salq	$2, %rax
	addq	%rcx, %rax
	leaq	0(,%rax,4), %rdx
	leaq	g(%rip), %rax
	movl	(%rdx,%rax), %eax
	testl	%eax, %eax
	je	.L12
	movq	-16(%rbp), %rcx
	movl	-28(%rbp), %eax
	movslq	%eax, %rsi
	movl	-36(%rbp), %eax
	movslq	%eax, %rdx
	movl	-32(%rbp), %eax
	movslq	%eax, %rdi
	movq	%rdx, %rax
	addq	%rax, %rax
	addq	%rdx, %rax
	leaq	0(,%rax,8), %r8
	addq	%r8, %rax
	salq	$2, %rax
	addq	%rdx, %rax
	addq	%rdi, %rax
	salq	$2, %rax
	addq	%rsi, %rax
	leaq	0(,%rax,4), %rdx
	leaq	g(%rip), %rax
	movl	(%rdx,%rax), %edx
	movl	-40(%rbp), %eax
	subl	%edx, %eax
	movslq	%eax, %rsi
	movq	%rcx, %rax
	cqto
	idivq	%rsi
	movq	%rdx, %rax
	movq	%rax, -16(%rbp)
	movq	-16(%rbp), %rax
	testq	%rax, %rax
	je	.L21
.L12:
	movl	-28(%rbp), %eax
	movslq	%eax, %rcx
	movl	-36(%rbp), %eax
	movslq	%eax, %rdx
	movl	-32(%rbp), %eax
	movslq	%eax, %rsi
	movq	%rdx, %rax
	addq	%rax, %rax
	addq	%rdx, %rax
	leaq	0(,%rax,8), %rdi
	addq	%rdi, %rax
	salq	$2, %rax
	addq	%rdx, %rax
	addq	%rsi, %rax
	salq	$2, %rax
	addq	%rcx, %rax
	leaq	0(,%rax,4), %rcx
	leaq	g(%rip), %rdx
	movl	-40(%rbp), %eax
	movl	%eax, (%rcx,%rdx)
.L16:
	movl	-28(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	Y(%rip), %rax
	movl	(%rdx,%rax), %edx
	movl	-36(%rbp), %eax
	leal	(%rdx,%rax), %ecx
	movl	-28(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	X(%rip), %rax
	movl	(%rdx,%rax), %edx
	movl	-32(%rbp), %eax
	addl	%edx, %eax
	movslq	%eax, %rsi
	movslq	%ecx, %rdx
	movq	%rdx, %rax
	addq	%rax, %rax
	addq	%rdx, %rax
	leaq	0(,%rax,8), %rcx
	addq	%rcx, %rax
	salq	$2, %rax
	addq	%rdx, %rax
	addq	%rsi, %rax
	leaq	0(,%rax,4), %rdx
	leaq	f(%rip), %rax
	movl	(%rdx,%rax), %eax
	testl	%eax, %eax
	jne	.L14
	movl	-28(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	X(%rip), %rax
	movl	(%rdx,%rax), %eax
	addl	%eax, -32(%rbp)
	movl	-28(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	Y(%rip), %rax
	movl	(%rdx,%rax), %eax
	addl	%eax, -36(%rbp)
	jmp	.L20
.L14:
	movl	-28(%rbp), %eax
	addl	$1, %eax
	cltd
	shrl	$30, %edx
	addl	%edx, %eax
	andl	$3, %eax
	subl	%edx, %eax
	movl	%eax, -28(%rbp)
	jmp	.L16
.L20:
	movq	-16(%rbp), %rax
	subq	$1, %rax
	movq	%rax, -16(%rbp)
	addl	$1, -40(%rbp)
.L11:
	movq	-16(%rbp), %rax
	testq	%rax, %rax
	jne	.L17
	jmp	.L13
.L21:
	nop
.L13:
	movq	D(%rip), %rdx
	movl	-28(%rbp), %eax
	cltq
	addq	%rdx, %rax
	movzbl	(%rax), %eax
	movsbl	%al, %ecx
	movl	-32(%rbp), %edx
	movl	-36(%rbp), %eax
	movl	%eax, %esi
	leaq	.LC2(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
.L2:
	leaq	-16(%rbp), %rcx
	leaq	-24(%rbp), %rdx
	leaq	-20(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC3(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	scanf@PLT
	movl	-20(%rbp), %eax
	testl	%eax, %eax
	jne	.L18
	movl	$0, %edi
	call	exit@PLT
	.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	"%s"
.LC1:
	.string	"%d %d %c\n"
.LC2:
	.string	"%d%d%lld"
	.section	.text.startup,"ax",@progbits
	.p2align 4
	.globl	main
	.type	main, @function
main:
.LFB0:
	.cfi_startproc
	endbr64
	pushq	%r15
	.cfi_def_cfa_offset 16
	.cfi_offset 15, -16
	movl	%r8d, %r15d
	pushq	%r14
	.cfi_def_cfa_offset 24
	.cfi_offset 14, -24
	pushq	%r13
	.cfi_def_cfa_offset 32
	.cfi_offset 13, -32
	leaq	-1+s(%rip), %r13
	pushq	%r12
	.cfi_def_cfa_offset 40
	.cfi_offset 12, -40
	pushq	%rbp
	.cfi_def_cfa_offset 48
	.cfi_offset 6, -48
	movl	%ecx, %ebp
	pushq	%rbx
	.cfi_def_cfa_offset 56
	.cfi_offset 3, -56
	movl	%edx, %ebx
	subq	$56, %rsp
	.cfi_def_cfa_offset 112
	movl	%edi, 28(%rsp)
	movl	%esi, 24(%rsp)
	movq	%fs:40, %rax
	movq	%rax, 40(%rsp)
	xorl	%eax, %eax
	leaq	32(%rsp), %rax
	movq	%rax, 16(%rsp)
	leaq	24(%rsp), %rax
	movq	%rax, (%rsp)
	leaq	28(%rsp), %rax
	movq	%rax, 8(%rsp)
.L2:
	movq	16(%rsp), %rcx
	movq	(%rsp), %rdx
	leaq	.LC2(%rip), %rdi
	xorl	%eax, %eax
	movq	8(%rsp), %rsi
	call	scanf@PLT
	movl	28(%rsp), %r12d
	testl	%r12d, %r12d
	je	.L42
	movl	$47524, %edx
	movl	$1, %esi
	leaq	f(%rip), %rdi
	call	memset@PLT
	xorl	%esi, %esi
	movl	$190096, %edx
	leaq	g(%rip), %rdi
	call	memset@PLT
	testl	%r12d, %r12d
	jle	.L3
	leaq	436+f(%rip), %r14
	xorl	%r12d, %r12d
	.p2align 4,,10
	.p2align 3
.L12:
	leaq	s(%rip), %rsi
	leaq	.LC0(%rip), %rdi
	xorl	%eax, %eax
	addl	$1, %r12d
	call	scanf@PLT
	movl	24(%rsp), %eax
	testl	%eax, %eax
	jle	.L4
	movq	D(%rip), %rsi
	leal	1(%rax), %r11d
	xorl	%r10d, %r10d
	movl	$1, %eax
	movl	$1, %r9d
	movl	$2, %r8d
	movl	$3, %edi
	.p2align 4,,10
	.p2align 3
.L5:
	movzbl	0(%r13,%rax), %edx
	cmpb	(%rsi), %dl
	cmove	%r12d, %r15d
	cmove	%eax, %ebp
	cmove	%r10d, %ebx
	cmpb	1(%rsi), %dl
	cmove	%r12d, %r15d
	cmove	%eax, %ebp
	cmove	%r9d, %ebx
	cmpb	2(%rsi), %dl
	cmove	%r12d, %r15d
	cmove	%eax, %ebp
	cmove	%r8d, %ebx
	cmpb	3(%rsi), %dl
	cmove	%r12d, %r15d
	cmove	%eax, %ebp
	cmove	%edi, %ebx
	cmpb	$35, %dl
	je	.L11
	movl	$0, (%r14,%rax,4)
.L11:
	addq	$1, %rax
	cmpq	%rax, %r11
	jne	.L5
.L4:
	addq	$436, %r14
	cmpl	%r12d, 28(%rsp)
	jg	.L12
.L3:
	movq	32(%rsp), %rdx
	movslq	%ebx, %rcx
	testq	%rdx, %rdx
	je	.L13
	xorl	%r11d, %r11d
	movslq	%ebx, %rcx
	leaq	Y(%rip), %r10
	leaq	X(%rip), %r9
	.p2align 4,,10
	.p2align 3
.L16:
	movslq	%r15d, %rsi
	movslq	%ebp, %rdi
	leaq	g(%rip), %r14
	leaq	(%rsi,%rsi,2), %rax
	leaq	(%rax,%rax,8), %rax
	leaq	(%rsi,%rax,4), %rax
	addq	%rdi, %rax
	leaq	(%rcx,%rax,4), %rax
	movl	(%r14,%rax,4), %eax
	testl	%eax, %eax
	je	.L14
	movl	%r11d, %r8d
	subl	%eax, %r8d
	movq	%rdx, %rax
	movslq	%r8d, %r8
	cqto
	idivq	%r8
	testq	%rdx, %rdx
	je	.L35
.L14:
	leaq	(%rsi,%rsi,2), %rax
	leaq	(%rax,%rax,8), %rax
	leaq	(%rsi,%rax,4), %rax
	addq	%rdi, %rax
	leaq	g(%rip), %rdi
	leaq	(%rcx,%rax,4), %rax
	movl	%r11d, (%rdi,%rax,4)
	jmp	.L40
	.p2align 4,,10
	.p2align 3
.L15:
	addl	$1, %ebx
	movl	%ebx, %eax
	sarl	$31, %eax
	shrl	$30, %eax
	addl	%eax, %ebx
	andl	$3, %ebx
	subl	%eax, %ebx
	movslq	%ebx, %rcx
.L40:
	movl	(%r10,%rcx,4), %edi
	movl	(%r9,%rcx,4), %r8d
	addl	%r15d, %edi
	addl	%ebp, %r8d
	movslq	%edi, %rax
	movslq	%r8d, %r12
	leaq	(%rax,%rax,2), %rsi
	leaq	(%rsi,%rsi,8), %rsi
	leaq	(%rax,%rsi,4), %rax
	leaq	f(%rip), %rsi
	addq	%r12, %rax
	movl	(%rsi,%rax,4), %eax
	testl	%eax, %eax
	jne	.L15
	movl	%r8d, %ebp
	movl	%edi, %r15d
	addl	$1, %r11d
	subq	$1, %rdx
	jne	.L16
.L35:
	movq	$0, 32(%rsp)
.L13:
	movq	D(%rip), %rax
	movl	%ebp, %edx
	movl	%r15d, %esi
	leaq	.LC1(%rip), %rdi
	movsbl	(%rax,%rcx), %ecx
	xorl	%eax, %eax
	call	printf@PLT
	jmp	.L2
.L42:
	xorl	%edi, %edi
	call	exit@PLT
	.cfi_endproc
.LFE0:
	.size	main, .-main
	.globl	D
	.section	.rodata.str1.1
.LC3:
	.string	"NESW"
	.section	.data.rel.local,"aw"
	.align 8
	.type	D, @object
	.size	D, 8
D:
	.quad	.LC3
	.globl	s
	.bss
	.align 32
	.type	s, @object
	.size	s, 109
s:
	.zero	109
	.globl	g
	.align 32
	.type	g, @object
	.size	g, 190096
g:
	.zero	190096
	.globl	f
	.align 32
	.type	f, @object
	.size	f, 47524
f:
	.zero	47524
	.globl	Y
	.data
	.align 16
	.type	Y, @object
	.size	Y, 16
Y:
	.long	-1
	.long	0
	.long	1
	.long	0
	.globl	X
	.align 16
	.type	X, @object
	.size	X, 16
X:
	.long	0
	.long	1
	.long	0
	.long	-1
	.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	"%s"
.LC1:
	.string	"%d %d %c\n"
.LC2:
	.string	"%d%d%lld"
	.section	.text.startup,"ax",@progbits
	.p2align 4
	.globl	main
	.type	main, @function
main:
.LFB0:
	.cfi_startproc
	endbr64
	pushq	%r15
	.cfi_def_cfa_offset 16
	.cfi_offset 15, -16
	movl	%r8d, %r15d
	pushq	%r14
	.cfi_def_cfa_offset 24
	.cfi_offset 14, -24
	pushq	%r13
	.cfi_def_cfa_offset 32
	.cfi_offset 13, -32
	leaq	-1+s(%rip), %r13
	pushq	%r12
	.cfi_def_cfa_offset 40
	.cfi_offset 12, -40
	pushq	%rbp
	.cfi_def_cfa_offset 48
	.cfi_offset 6, -48
	movl	%ecx, %ebp
	pushq	%rbx
	.cfi_def_cfa_offset 56
	.cfi_offset 3, -56
	movl	%edx, %ebx
	subq	$56, %rsp
	.cfi_def_cfa_offset 112
	movl	%edi, 28(%rsp)
	movl	%esi, 24(%rsp)
	movq	%fs:40, %rax
	movq	%rax, 40(%rsp)
	xorl	%eax, %eax
	leaq	32(%rsp), %rax
	movq	%rax, 16(%rsp)
	leaq	24(%rsp), %rax
	movq	%rax, (%rsp)
	leaq	28(%rsp), %rax
	movq	%rax, 8(%rsp)
.L2:
	movq	16(%rsp), %rcx
	movq	(%rsp), %rdx
	leaq	.LC2(%rip), %rdi
	xorl	%eax, %eax
	movq	8(%rsp), %rsi
	call	scanf@PLT
	movl	28(%rsp), %r12d
	testl	%r12d, %r12d
	je	.L42
	movl	$47524, %edx
	movl	$1, %esi
	leaq	f(%rip), %rdi
	call	memset@PLT
	xorl	%esi, %esi
	movl	$190096, %edx
	leaq	g(%rip), %rdi
	call	memset@PLT
	testl	%r12d, %r12d
	jle	.L3
	leaq	436+f(%rip), %r14
	xorl	%r12d, %r12d
	.p2align 4,,10
	.p2align 3
.L12:
	leaq	s(%rip), %rsi
	leaq	.LC0(%rip), %rdi
	xorl	%eax, %eax
	addl	$1, %r12d
	call	scanf@PLT
	movl	24(%rsp), %eax
	testl	%eax, %eax
	jle	.L4
	movq	D(%rip), %rsi
	leal	1(%rax), %r11d
	xorl	%r10d, %r10d
	movl	$1, %eax
	movl	$1, %r9d
	movl	$2, %r8d
	movl	$3, %edi
	.p2align 4,,10
	.p2align 3
.L5:
	movzbl	0(%r13,%rax), %edx
	cmpb	(%rsi), %dl
	cmove	%r12d, %r15d
	cmove	%eax, %ebp
	cmove	%r10d, %ebx
	cmpb	1(%rsi), %dl
	cmove	%r12d, %r15d
	cmove	%eax, %ebp
	cmove	%r9d, %ebx
	cmpb	2(%rsi), %dl
	cmove	%r12d, %r15d
	cmove	%eax, %ebp
	cmove	%r8d, %ebx
	cmpb	3(%rsi), %dl
	cmove	%r12d, %r15d
	cmove	%eax, %ebp
	cmove	%edi, %ebx
	cmpb	$35, %dl
	je	.L11
	movl	$0, (%r14,%rax,4)
.L11:
	addq	$1, %rax
	cmpq	%rax, %r11
	jne	.L5
.L4:
	addq	$436, %r14
	cmpl	%r12d, 28(%rsp)
	jg	.L12
.L3:
	movq	32(%rsp), %rdx
	movslq	%ebx, %rcx
	testq	%rdx, %rdx
	je	.L13
	xorl	%r11d, %r11d
	movslq	%ebx, %rcx
	leaq	Y(%rip), %r10
	leaq	X(%rip), %r9
	.p2align 4,,10
	.p2align 3
.L16:
	movslq	%r15d, %rsi
	movslq	%ebp, %rdi
	leaq	g(%rip), %r14
	leaq	(%rsi,%rsi,2), %rax
	leaq	(%rax,%rax,8), %rax
	leaq	(%rsi,%rax,4), %rax
	addq	%rdi, %rax
	leaq	(%rcx,%rax,4), %rax
	movl	(%r14,%rax,4), %eax
	testl	%eax, %eax
	je	.L14
	movl	%r11d, %r8d
	subl	%eax, %r8d
	movq	%rdx, %rax
	movslq	%r8d, %r8
	cqto
	idivq	%r8
	testq	%rdx, %rdx
	je	.L35
.L14:
	leaq	(%rsi,%rsi,2), %rax
	leaq	(%rax,%rax,8), %rax
	leaq	(%rsi,%rax,4), %rax
	addq	%rdi, %rax
	leaq	g(%rip), %rdi
	leaq	(%rcx,%rax,4), %rax
	movl	%r11d, (%rdi,%rax,4)
	jmp	.L40
	.p2align 4,,10
	.p2align 3
.L15:
	addl	$1, %ebx
	movl	%ebx, %eax
	sarl	$31, %eax
	shrl	$30, %eax
	addl	%eax, %ebx
	andl	$3, %ebx
	subl	%eax, %ebx
	movslq	%ebx, %rcx
.L40:
	movl	(%r10,%rcx,4), %edi
	movl	(%r9,%rcx,4), %r8d
	addl	%r15d, %edi
	addl	%ebp, %r8d
	movslq	%edi, %rax
	movslq	%r8d, %r12
	leaq	(%rax,%rax,2), %rsi
	leaq	(%rsi,%rsi,8), %rsi
	leaq	(%rax,%rsi,4), %rax
	leaq	f(%rip), %rsi
	addq	%r12, %rax
	movl	(%rsi,%rax,4), %eax
	testl	%eax, %eax
	jne	.L15
	movl	%r8d, %ebp
	movl	%edi, %r15d
	addl	$1, %r11d
	subq	$1, %rdx
	jne	.L16
.L35:
	movq	$0, 32(%rsp)
.L13:
	movq	D(%rip), %rax
	movl	%ebp, %edx
	movl	%r15d, %esi
	leaq	.LC1(%rip), %rdi
	movsbl	(%rax,%rcx), %ecx
	xorl	%eax, %eax
	call	printf@PLT
	jmp	.L2
.L42:
	xorl	%edi, %edi
	call	exit@PLT
	.cfi_endproc
.LFE0:
	.size	main, .-main
	.globl	D
	.section	.rodata.str1.1
.LC3:
	.string	"NESW"
	.section	.data.rel.local,"aw"
	.align 8
	.type	D, @object
	.size	D, 8
D:
	.quad	.LC3
	.globl	s
	.bss
	.align 32
	.type	s, @object
	.size	s, 109
s:
	.zero	109
	.globl	g
	.align 32
	.type	g, @object
	.size	g, 190096
g:
	.zero	190096
	.globl	f
	.align 32
	.type	f, @object
	.size	f, 47524
f:
	.zero	47524
	.globl	Y
	.data
	.align 16
	.type	Y, @object
	.size	Y, 16
Y:
	.long	-1
	.long	0
	.long	1
	.long	0
	.globl	X
	.align 16
	.type	X, @object
	.size	X, 16
X:
	.long	0
	.long	1
	.long	0
	.long	-1
	.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:

X[]={0,1,0,-1},Y[]={-1,0,1,0},f[109][109],g[109][109][4];char s[109],*D="NESW";
main(h,w,z,x,y,c,i,j,k){long long l;for(;scanf("%d%d%lld",&h,&w,&l),h;printf("%d %d %c\n",y,x,D[z])){
	memset(f,1,sizeof(f)),memset(g,0,sizeof(g));
	for(i=0;i<h;i++)for(scanf("%s",s),j=0;j<w;j++){
		for(k=0;k<4;k++)if(s[j]==D[k])x=j+1,y=i+1,z=k;
		if(s[j]!='#')f[i+1][j+1]=0;
	}
	for(c=0;l;l--,c++){
		if(g[y][x][z]&&(l%=c-g[y][x][z])==0)break;
		for(g[y][x][z]=c;;z=(z+1)%4)if(!f[y+Y[z]][x+X[z]]){x+=X[z];y+=Y[z];break;}
	}
}exit(0);}
3 3 10
E..
.#.
...
5 5 19
####.
.....
.#S#.
...#.
#.##.
5 5 6
#.#..
#....
##.#.
#..S.
#....
5 4 35
.#.#
....
.##.
.#S.
...#
0 0 0
 3 3 19
E..
.#.
...
5 5 19
.
.....
.#S#.
...#.
.##.
5 5 6
.#..
....
.#.
..S.
....
5 4 35
..##
....
.##.
.#S.
...#
0 0 0
 3 3 10
E..
.#.
...
5 5 37
####.
.....
.#S#.
...#.
#.##.
5 5 6
#.#..
#....
##.#.
#..S.
#....
5 4 35
.#.#
....
.##.
.#S.
...#
0 0 0
 3 3 6
E..
.#.
...
5 5 19
.
.....
.#S#.
...#.
.##.
5 5 6
.#..
....
.#.
..S.
....
5 4 35
..##
....
.##.
.#S.
...#
0 0 0
 3 3 10
E..
.#.
...
5 5 37
####.
.....
.#S#.
...#.
#.##.
5 5 6
#.#..
#....
#..##
#..S.
#....
5 4 35
.#.#
....
.##.
.#S.
...#
0 0 0
 3 3 10
E..
.#.
...
5 5 19
####.
.....
.#S#.
...#.
#.##.
5 5 6
..#.#
#....
##.#.
#..S.
#....
5 4 35
..##
....
.##.
.#S.
...#
0 0 0
 3 3 10
E..
.#.
...
5 5 19
.
.....
.#S#.
...#.
.##.
5 5 6
.#..
....
.#.
..S.
....
5 4 5
..##
....
.##.
.#S.
...#
0 0 0
 3 3 10
E..
.#.
...
5 5 19
####.
.....
.#S#.
...#.
#.##.
5 5 6
#.#..
#....
##.#.
.S..#
#....
5 4 35
..##
....
.##.
.#S.
...#
0 0 0
 3 3 23
E..
.#.
...
5 5 19
.
.....
.#S#.
...#.
.##.
5 5 6
.#..
....
.#.
..S.
....
5 4 35
..##
....
.##.
.#S.
...#
0 0 0
 3 3 17
E..
.#.
...
5 5 19
.
.....
.#S#.
...#.
.##.
5 5 6
.#..
....
.#.
..S.
....
5 4 5
..##
....
.##.
.#S.
...#
0 0 0

1 3 E
4 5 S
4 4 E
5 1 S
 2 3 S
5 4 W
2 1 N
1 1 N
 1 3 E
4 5 N
4 4 E
5 1 S
 3 1 W
5 4 W
2 1 N
1 1 N
 1 3 E
4 5 N
2 2 N
5 1 S
 1 3 E
4 5 S
4 4 E
1 1 N
 1 3 E
5 4 W
2 1 N
3 1 N
 1 3 E
4 5 S
5 3 W
1 1 N
 2 1 N
5 4 W
2 1 N
1 1 N
 1 2 E
5 4 W
2 1 N
3 1 N

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

```c
X[]={0,1,0,-1},Y[]={-1,0,1,0},f[109][109],g[109][109][4];char s[109],*D="NESW";
main(h,w,z,x,y,c,i,j,k){long long l;for(;scanf("%d%d%lld",&h,&w,&l),h;printf("%d %d %c\n",y,x,D[z])){
	memset(f,1,sizeof(f)),memset(g,0,sizeof(g));
	for(i=0;i<h;i++)for(scanf("%s",s),j=0;j<w;j++){
		for(k=0;k<4;k++)if(s[j]==D[k])x=j+1,y=i+1,z=k;
		if(s[j]!='#')f[i+1][j+1]=0;
	}
	for(c=0;l;l--,c++){
		if(g[y][x][z]&&(l%=c-g[y][x][z])==0)break;
		for(g[y][x][z]=c;;z=(z+1)%4)if(!f[y+Y[z]][x+X[z]]){x+=X[z];y+=Y[z];break;}
	}
}exit(0);}```

Unoptimized Assembly Code:

```assembly
	.file	"temp.c"
	.text
	.globl	X
	.data
	.align 16
	.type	X, @object
	.size	X, 16
X:
	.long	0
	.long	1
	.long	0
	.long	-1
	.globl	Y
	.align 16
	.type	Y, @object
	.size	Y, 16
Y:
	.long	-1
	.long	0
	.long	1
	.long	0
	.globl	f
	.bss
	.align 32
	.type	f, @object
	.size	f, 47524
f:
	.zero	47524
	.globl	g
	.align 32
	.type	g, @object
	.size	g, 190096
g:
	.zero	190096
	.globl	s
	.align 32
	.type	s, @object
	.size	s, 109
s:
	.zero	109
	.globl	D
	.section	.rodata
.LC0:
	.string	"NESW"
	.section	.data.rel.local,"aw"
	.align 8
	.type	D, @object
	.size	D, 8
D:
	.quad	.LC0
	.section	.rodata
.LC1:
	.string	"%s"
.LC2:
	.string	"%d %d %c\n"
.LC3:
	.string	"%d%d%lld"
	.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	$48, %rsp
	movl	%edi, -20(%rbp)
	movl	%esi, -24(%rbp)
	movl	%edx, -28(%rbp)
	movl	%ecx, -32(%rbp)
	movl	%r8d, -36(%rbp)
	movl	%r9d, -40(%rbp)
	movq	%fs:40, %rax
	movq	%rax, -8(%rbp)
	xorl	%eax, %eax
	jmp	.L2
.L18:
	movl	$47524, %edx
	movl	$1, %esi
	leaq	f(%rip), %rax
	movq	%rax, %rdi
	call	memset@PLT
	movl	$190096, %edx
	movl	$0, %esi
	leaq	g(%rip), %rax
	movq	%rax, %rdi
	call	memset@PLT
	movl	$0, 16(%rbp)
	jmp	.L3
.L10:
	leaq	s(%rip), %rax
	movq	%rax, %rsi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	scanf@PLT
	movl	$0, 24(%rbp)
	jmp	.L4
.L9:
	movl	$0, 32(%rbp)
	jmp	.L5
.L7:
	movl	24(%rbp), %eax
	cltq
	leaq	s(%rip), %rdx
	movzbl	(%rax,%rdx), %edx
	movq	D(%rip), %rcx
	movl	32(%rbp), %eax
	cltq
	addq	%rcx, %rax
	movzbl	(%rax), %eax
	cmpb	%al, %dl
	jne	.L6
	movl	24(%rbp), %eax
	addl	$1, %eax
	movl	%eax, -32(%rbp)
	movl	16(%rbp), %eax
	addl	$1, %eax
	movl	%eax, -36(%rbp)
	movl	32(%rbp), %eax
	movl	%eax, -28(%rbp)
.L6:
	addl	$1, 32(%rbp)
.L5:
	cmpl	$3, 32(%rbp)
	jle	.L7
	movl	24(%rbp), %eax
	cltq
	leaq	s(%rip), %rdx
	movzbl	(%rax,%rdx), %eax
	cmpb	$35, %al
	je	.L8
	movl	16(%rbp), %eax
	leal	1(%rax), %edx
	movl	24(%rbp), %eax
	addl	$1, %eax
	movslq	%eax, %rcx
	movslq	%edx, %rdx
	movq	%rdx, %rax
	addq	%rax, %rax
	addq	%rdx, %rax
	leaq	0(,%rax,8), %rsi
	addq	%rsi, %rax
	salq	$2, %rax
	addq	%rdx, %rax
	addq	%rcx, %rax
	leaq	0(,%rax,4), %rdx
	leaq	f(%rip), %rax
	movl	$0, (%rdx,%rax)
.L8:
	addl	$1, 24(%rbp)
.L4:
	movl	-24(%rbp), %eax
	cmpl	%eax, 24(%rbp)
	jl	.L9
	addl	$1, 16(%rbp)
.L3:
	movl	-20(%rbp), %eax
	cmpl	%eax, 16(%rbp)
	jl	.L10
	movl	$0, -40(%rbp)
	jmp	.L11
.L17:
	movl	-28(%rbp), %eax
	movslq	%eax, %rcx
	movl	-36(%rbp), %eax
	movslq	%eax, %rdx
	movl	-32(%rbp), %eax
	movslq	%eax, %rsi
	movq	%rdx, %rax
	addq	%rax, %rax
	addq	%rdx, %rax
	leaq	0(,%rax,8), %rdi
	addq	%rdi, %rax
	salq	$2, %rax
	addq	%rdx, %rax
	addq	%rsi, %rax
	salq	$2, %rax
	addq	%rcx, %rax
	leaq	0(,%rax,4), %rdx
	leaq	g(%rip), %rax
	movl	(%rdx,%rax), %eax
	testl	%eax, %eax
	je	.L12
	movq	-16(%rbp), %rcx
	movl	-28(%rbp), %eax
	movslq	%eax, %rsi
	movl	-36(%rbp), %eax
	movslq	%eax, %rdx
	movl	-32(%rbp), %eax
	movslq	%eax, %rdi
	movq	%rdx, %rax
	addq	%rax, %rax
	addq	%rdx, %rax
	leaq	0(,%rax,8), %r8
	addq	%r8, %rax
	salq	$2, %rax
	addq	%rdx, %rax
	addq	%rdi, %rax
	salq	$2, %rax
	addq	%rsi, %rax
	leaq	0(,%rax,4), %rdx
	leaq	g(%rip), %rax
	movl	(%rdx,%rax), %edx
	movl	-40(%rbp), %eax
	subl	%edx, %eax
	movslq	%eax, %rsi
	movq	%rcx, %rax
	cqto
	idivq	%rsi
	movq	%rdx, %rax
	movq	%rax, -16(%rbp)
	movq	-16(%rbp), %rax
	testq	%rax, %rax
	je	.L21
.L12:
	movl	-28(%rbp), %eax
	movslq	%eax, %rcx
	movl	-36(%rbp), %eax
	movslq	%eax, %rdx
	movl	-32(%rbp), %eax
	movslq	%eax, %rsi
	movq	%rdx, %rax
	addq	%rax, %rax
	addq	%rdx, %rax
	leaq	0(,%rax,8), %rdi
	addq	%rdi, %rax
	salq	$2, %rax
	addq	%rdx, %rax
	addq	%rsi, %rax
	salq	$2, %rax
	addq	%rcx, %rax
	leaq	0(,%rax,4), %rcx
	leaq	g(%rip), %rdx
	movl	-40(%rbp), %eax
	movl	%eax, (%rcx,%rdx)
.L16:
	movl	-28(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	Y(%rip), %rax
	movl	(%rdx,%rax), %edx
	movl	-36(%rbp), %eax
	leal	(%rdx,%rax), %ecx
	movl	-28(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	X(%rip), %rax
	movl	(%rdx,%rax), %edx
	movl	-32(%rbp), %eax
	addl	%edx, %eax
	movslq	%eax, %rsi
	movslq	%ecx, %rdx
	movq	%rdx, %rax
	addq	%rax, %rax
	addq	%rdx, %rax
	leaq	0(,%rax,8), %rcx
	addq	%rcx, %rax
	salq	$2, %rax
	addq	%rdx, %rax
	addq	%rsi, %rax
	leaq	0(,%rax,4), %rdx
	leaq	f(%rip), %rax
	movl	(%rdx,%rax), %eax
	testl	%eax, %eax
	jne	.L14
	movl	-28(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	X(%rip), %rax
	movl	(%rdx,%rax), %eax
	addl	%eax, -32(%rbp)
	movl	-28(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	Y(%rip), %rax
	movl	(%rdx,%rax), %eax
	addl	%eax, -36(%rbp)
	jmp	.L20
.L14:
	movl	-28(%rbp), %eax
	addl	$1, %eax
	cltd
	shrl	$30, %edx
	addl	%edx, %eax
	andl	$3, %eax
	subl	%edx, %eax
	movl	%eax, -28(%rbp)
	jmp	.L16
.L20:
	movq	-16(%rbp), %rax
	subq	$1, %rax
	movq	%rax, -16(%rbp)
	addl	$1, -40(%rbp)
.L11:
	movq	-16(%rbp), %rax
	testq	%rax, %rax
	jne	.L17
	jmp	.L13
.L21:
	nop
.L13:
	movq	D(%rip), %rdx
	movl	-28(%rbp), %eax
	cltq
	addq	%rdx, %rax
	movzbl	(%rax), %eax
	movsbl	%al, %ecx
	movl	-32(%rbp), %edx
	movl	-36(%rbp), %eax
	movl	%eax, %esi
	leaq	.LC2(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
.L2:
	leaq	-16(%rbp), %rcx
	leaq	-24(%rbp), %rdx
	leaq	-20(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC3(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	scanf@PLT
	movl	-20(%rbp), %eax
	testl	%eax, %eax
	jne	.L18
	movl	$0, %edi
	call	exit@PLT
	.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	X
	.data
	.align 16
	.type	X, @object
	.size	X, 16
X:
	.long	0
	.long	1
	.long	0
	.long	-1
	.globl	Y
	.align 16
	.type	Y, @object
	.size	Y, 16
Y:
	.long	-1
	.long	0
	.long	1
	.long	0
	.globl	f
	.bss
	.align 32
	.type	f, @object
	.size	f, 47524
f:
	.zero	47524
	.globl	g
	.align 32
	.type	g, @object
	.size	g, 190096
g:
	.zero	190096
	.globl	s
	.align 32
	.type	s, @object
	.size	s, 109
s:
	.zero	109
	.globl	D
	.section	.rodata
.LC0:
	.string	"NESW"
	.section	.data.rel.local,"aw"
	.align 8
	.type	D, @object
	.size	D, 8
D:
	.quad	.LC0
	.section	.rodata
.LC1:
	.string	"%s"
.LC2:
	.string	"%d %d %c\n"
.LC3:
	.string	"%d%d%lld"
	.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	$48, %rsp
	movl	%edi, -20(%rbp)
	movl	%esi, -24(%rbp)
	movl	%edx, -28(%rbp)
	movl	%ecx, -32(%rbp)
	movl	%r8d, -36(%rbp)
	movl	%r9d, -40(%rbp)
	movq	%fs:40, %rax
	movq	%rax, -8(%rbp)
	xorl	%eax, %eax
	jmp	.L2
.L18:
	movl	$47524, %edx
	movl	$1, %esi
	leaq	f(%rip), %rax
	movq	%rax, %rdi
	call	memset@PLT
	movl	$190096, %edx
	movl	$0, %esi
	leaq	g(%rip), %rax
	movq	%rax, %rdi
	call	memset@PLT
	movl	$0, 16(%rbp)
	jmp	.L3
.L10:
	leaq	s(%rip), %rax
	movq	%rax, %rsi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	scanf@PLT
	movl	$0, 24(%rbp)
	jmp	.L4
.L9:
	movl	$0, 32(%rbp)
	jmp	.L5
.L7:
	movl	24(%rbp), %eax
	cltq
	leaq	s(%rip), %rdx
	movzbl	(%rax,%rdx), %edx
	movq	D(%rip), %rcx
	movl	32(%rbp), %eax
	cltq
	addq	%rcx, %rax
	movzbl	(%rax), %eax
	cmpb	%al, %dl
	jne	.L6
	movl	24(%rbp), %eax
	addl	$1, %eax
	movl	%eax, -32(%rbp)
	movl	16(%rbp), %eax
	addl	$1, %eax
	movl	%eax, -36(%rbp)
	movl	32(%rbp), %eax
	movl	%eax, -28(%rbp)
.L6:
	addl	$1, 32(%rbp)
.L5:
	cmpl	$3, 32(%rbp)
	jle	.L7
	movl	24(%rbp), %eax
	cltq
	leaq	s(%rip), %rdx
	movzbl	(%rax,%rdx), %eax
	cmpb	$35, %al
	je	.L8
	movl	16(%rbp), %eax
	leal	1(%rax), %edx
	movl	24(%rbp), %eax
	addl	$1, %eax
	movslq	%eax, %rcx
	movslq	%edx, %rdx
	movq	%rdx, %rax
	addq	%rax, %rax
	addq	%rdx, %rax
	leaq	0(,%rax,8), %rsi
	addq	%rsi, %rax
	salq	$2, %rax
	addq	%rdx, %rax
	addq	%rcx, %rax
	leaq	0(,%rax,4), %rdx
	leaq	f(%rip), %rax
	movl	$0, (%rdx,%rax)
.L8:
	addl	$1, 24(%rbp)
.L4:
	movl	-24(%rbp), %eax
	cmpl	%eax, 24(%rbp)
	jl	.L9
	addl	$1, 16(%rbp)
.L3:
	movl	-20(%rbp), %eax
	cmpl	%eax, 16(%rbp)
	jl	.L10
	movl	$0, -40(%rbp)
	jmp	.L11
.L17:
	movl	-28(%rbp), %eax
	movslq	%eax, %rcx
	movl	-36(%rbp), %eax
	movslq	%eax, %rdx
	movl	-32(%rbp), %eax
	movslq	%eax, %rsi
	movq	%rdx, %rax
	addq	%rax, %rax
	addq	%rdx, %rax
	leaq	0(,%rax,8), %rdi
	addq	%rdi, %rax
	salq	$2, %rax
	addq	%rdx, %rax
	addq	%rsi, %rax
	salq	$2, %rax
	addq	%rcx, %rax
	leaq	0(,%rax,4), %rdx
	leaq	g(%rip), %rax
	movl	(%rdx,%rax), %eax
	testl	%eax, %eax
	je	.L12
	movq	-16(%rbp), %rcx
	movl	-28(%rbp), %eax
	movslq	%eax, %rsi
	movl	-36(%rbp), %eax
	movslq	%eax, %rdx
	movl	-32(%rbp), %eax
	movslq	%eax, %rdi
	movq	%rdx, %rax
	addq	%rax, %rax
	addq	%rdx, %rax
	leaq	0(,%rax,8), %r8
	addq	%r8, %rax
	salq	$2, %rax
	addq	%rdx, %rax
	addq	%rdi, %rax
	salq	$2, %rax
	addq	%rsi, %rax
	leaq	0(,%rax,4), %rdx
	leaq	g(%rip), %rax
	movl	(%rdx,%rax), %edx
	movl	-40(%rbp), %eax
	subl	%edx, %eax
	movslq	%eax, %rsi
	movq	%rcx, %rax
	cqto
	idivq	%rsi
	movq	%rdx, %rax
	movq	%rax, -16(%rbp)
	movq	-16(%rbp), %rax
	testq	%rax, %rax
	je	.L21
.L12:
	movl	-28(%rbp), %eax
	movslq	%eax, %rcx
	movl	-36(%rbp), %eax
	movslq	%eax, %rdx
	movl	-32(%rbp), %eax
	movslq	%eax, %rsi
	movq	%rdx, %rax
	addq	%rax, %rax
	addq	%rdx, %rax
	leaq	0(,%rax,8), %rdi
	addq	%rdi, %rax
	salq	$2, %rax
	addq	%rdx, %rax
	addq	%rsi, %rax
	salq	$2, %rax
	addq	%rcx, %rax
	leaq	0(,%rax,4), %rcx
	leaq	g(%rip), %rdx
	movl	-40(%rbp), %eax
	movl	%eax, (%rcx,%rdx)
.L16:
	movl	-28(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	Y(%rip), %rax
	movl	(%rdx,%rax), %edx
	movl	-36(%rbp), %eax
	leal	(%rdx,%rax), %ecx
	movl	-28(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	X(%rip), %rax
	movl	(%rdx,%rax), %edx
	movl	-32(%rbp), %eax
	addl	%edx, %eax
	movslq	%eax, %rsi
	movslq	%ecx, %rdx
	movq	%rdx, %rax
	addq	%rax, %rax
	addq	%rdx, %rax
	leaq	0(,%rax,8), %rcx
	addq	%rcx, %rax
	salq	$2, %rax
	addq	%rdx, %rax
	addq	%rsi, %rax
	leaq	0(,%rax,4), %rdx
	leaq	f(%rip), %rax
	movl	(%rdx,%rax), %eax
	testl	%eax, %eax
	jne	.L14
	movl	-28(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	X(%rip), %rax
	movl	(%rdx,%rax), %eax
	addl	%eax, -32(%rbp)
	movl	-28(%rbp), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	Y(%rip), %rax
	movl	(%rdx,%rax), %eax
	addl	%eax, -36(%rbp)
	jmp	.L20
.L14:
	movl	-28(%rbp), %eax
	addl	$1, %eax
	cltd
	shrl	$30, %edx
	addl	%edx, %eax
	andl	$3, %eax
	subl	%edx, %eax
	movl	%eax, -28(%rbp)
	jmp	.L16
.L20:
	movq	-16(%rbp), %rax
	subq	$1, %rax
	movq	%rax, -16(%rbp)
	addl	$1, -40(%rbp)
.L11:
	movq	-16(%rbp), %rax
	testq	%rax, %rax
	jne	.L17
	jmp	.L13
.L21:
	nop
.L13:
	movq	D(%rip), %rdx
	movl	-28(%rbp), %eax
	cltq
	addq	%rdx, %rax
	movzbl	(%rax), %eax
	movsbl	%al, %ecx
	movl	-32(%rbp), %edx
	movl	-36(%rbp), %eax
	movl	%eax, %esi
	leaq	.LC2(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
.L2:
	leaq	-16(%rbp), %rcx
	leaq	-24(%rbp), %rdx
	leaq	-20(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC3(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	scanf@PLT
	movl	-20(%rbp), %eax
	testl	%eax, %eax
	jne	.L18
	movl	$0, %edi
	call	exit@PLT
	.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:
