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

```c
#include<stdio.h>
int main(){
  int X[]={2,2,3,3,0,0,1,1,0,1,0,1};
  int Y[]={0,1,0,1,0,1,0,1,2,2,3,3};
  int XX[]={0,1,0,-1};
  int YY[]={1,0,-1,0};
  int h,w,sx,sy,gx,gy,n,a,b,c,d,t,r,i,j,k,nx,ny,x[10000],y[10000];
  while(scanf("%d %d",&w,&h),w||h){
    char m[101][101]={0};
    scanf("%d %d %d %d",&sx,&sy,&gx,&gy);
    scanf("%d",&n);
    while(n--){
      scanf("%d %d %d %d",&a,&b,&c,&d);
      for(i=b*4;i<8+b*4;i++)m[d+Y[i]][c+X[i]]=a;
    }
    /*for(i=0;i<h;i++){
      for(j=0;j<w;j++)printf("%d ",m[i][j]);
      printf("\n");
      }*/
    if(m[sy][sx]!=m[gy][gx])printf("NG\n");
    else {
      x[t=0]=sx;
      y[t]=sy;
      m[sy][sx]=0;
      for(r=1;r-t;t++){
	for(k=0;k<4;k++){
	  nx=x[t]+XX[k];
	  ny=y[t]+YY[k];
	  if(nx<1||w<nx||ny<1||h<ny)continue;
	  if(m[gy][gx]==m[ny][nx]){
	    x[r]=nx;
	    y[r]=ny;
	    m[y[r]][x[r++]]=0;
	    if(nx==gx&&ny==gy)break;
	  }
	}
	if(nx==gx&&ny==gy)break;
      }
      /*for(i=0;i<=h;i++){
	for(j=0;j<=w;j++)printf("%d ",m[i][j]);
	printf("\n");
	}*/
      if(r-t)printf("OK\n");
      else   printf("NG\n");
    }
  }
  return 0;
}
 ```

Unoptimized Assembly Code:

```assembly
	.file	"temp.c"
	.text
	.section	.rodata
.LC0:
	.string	"%d %d %d %d"
.LC1:
	.string	"%d"
.LC2:
	.string	"NG"
.LC3:
	.string	"OK"
.LC4:
	.string	"%d %d"
	.text
	.globl	main
	.type	main, @function
main:
.LFB0:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	leaq	-90112(%rsp), %r11
.LPSRL0:
	subq	$4096, %rsp
	orq	$0, (%rsp)
	cmpq	%r11, %rsp
	jne	.LPSRL0
	subq	$320, %rsp
	movq	%fs:40, %rax
	movq	%rax, -8(%rbp)
	xorl	%eax, %eax
	movl	$2, -90320(%rbp)
	movl	$2, -90316(%rbp)
	movl	$3, -90312(%rbp)
	movl	$3, -90308(%rbp)
	movl	$0, -90304(%rbp)
	movl	$0, -90300(%rbp)
	movl	$1, -90296(%rbp)
	movl	$1, -90292(%rbp)
	movl	$0, -90288(%rbp)
	movl	$1, -90284(%rbp)
	movl	$0, -90280(%rbp)
	movl	$1, -90276(%rbp)
	movl	$0, -90272(%rbp)
	movl	$1, -90268(%rbp)
	movl	$0, -90264(%rbp)
	movl	$1, -90260(%rbp)
	movl	$0, -90256(%rbp)
	movl	$1, -90252(%rbp)
	movl	$0, -90248(%rbp)
	movl	$1, -90244(%rbp)
	movl	$2, -90240(%rbp)
	movl	$2, -90236(%rbp)
	movl	$3, -90232(%rbp)
	movl	$3, -90228(%rbp)
	movl	$0, -90352(%rbp)
	movl	$1, -90348(%rbp)
	movl	$0, -90344(%rbp)
	movl	$-1, -90340(%rbp)
	movl	$1, -90336(%rbp)
	movl	$0, -90332(%rbp)
	movl	$-1, -90328(%rbp)
	movl	$0, -90324(%rbp)
	jmp	.L2
.L23:
	leaq	-90224(%rbp), %rax
	movl	$10201, %edx
	movl	$0, %esi
	movq	%rax, %rdi
	call	memset@PLT
	leaq	-90400(%rbp), %rsi
	leaq	-90404(%rbp), %rcx
	leaq	-90408(%rbp), %rdx
	leaq	-90412(%rbp), %rax
	movq	%rsi, %r8
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	leaq	-90396(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	jmp	.L3
.L6:
	leaq	-90380(%rbp), %rsi
	leaq	-90384(%rbp), %rcx
	leaq	-90388(%rbp), %rdx
	leaq	-90392(%rbp), %rax
	movq	%rsi, %r8
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	-90388(%rbp), %eax
	sall	$2, %eax
	movl	%eax, -90368(%rbp)
	jmp	.L4
.L5:
	movl	-90392(%rbp), %ecx
	movl	-90368(%rbp), %eax
	cltq
	movl	-90272(%rbp,%rax,4), %edx
	movl	-90380(%rbp), %eax
	addl	%eax, %edx
	movl	-90368(%rbp), %eax
	cltq
	movl	-90320(%rbp,%rax,4), %esi
	movl	-90384(%rbp), %eax
	addl	%esi, %eax
	movslq	%eax, %rsi
	movslq	%edx, %rdx
	movq	%rdx, %rax
	salq	$2, %rax
	addq	%rdx, %rax
	leaq	0(,%rax,4), %rdi
	addq	%rdi, %rax
	salq	$2, %rax
	addq	%rdx, %rax
	addq	%rbp, %rax
	addq	%rsi, %rax
	subq	$90224, %rax
	movb	%cl, (%rax)
	addl	$1, -90368(%rbp)
.L4:
	movl	-90388(%rbp), %eax
	addl	$2, %eax
	sall	$2, %eax
	cmpl	%eax, -90368(%rbp)
	jl	.L5
.L3:
	movl	-90396(%rbp), %eax
	leal	-1(%rax), %edx
	movl	%edx, -90396(%rbp)
	testl	%eax, %eax
	jne	.L6
	movl	-90408(%rbp), %eax
	movl	-90412(%rbp), %edx
	movslq	%edx, %rcx
	movslq	%eax, %rdx
	movq	%rdx, %rax
	salq	$2, %rax
	addq	%rdx, %rax
	leaq	0(,%rax,4), %rsi
	addq	%rsi, %rax
	salq	$2, %rax
	addq	%rdx, %rax
	addq	%rbp, %rax
	addq	%rcx, %rax
	subq	$90224, %rax
	movzbl	(%rax), %ecx
	movl	-90400(%rbp), %eax
	movl	-90404(%rbp), %edx
	movslq	%edx, %rsi
	movslq	%eax, %rdx
	movq	%rdx, %rax
	salq	$2, %rax
	addq	%rdx, %rax
	leaq	0(,%rax,4), %rdi
	addq	%rdi, %rax
	salq	$2, %rax
	addq	%rdx, %rax
	addq	%rbp, %rax
	addq	%rsi, %rax
	subq	$90224, %rax
	movzbl	(%rax), %eax
	cmpb	%al, %cl
	je	.L7
	leaq	.LC2(%rip), %rax
	movq	%rax, %rdi
	call	puts@PLT
	jmp	.L2
.L7:
	movl	$0, -90376(%rbp)
	movl	-90412(%rbp), %edx
	movl	-90376(%rbp), %eax
	cltq
	movl	%edx, -80016(%rbp,%rax,4)
	movl	-90408(%rbp), %edx
	movl	-90376(%rbp), %eax
	cltq
	movl	%edx, -40016(%rbp,%rax,4)
	movl	-90408(%rbp), %eax
	movl	-90412(%rbp), %edx
	movslq	%edx, %rcx
	movslq	%eax, %rdx
	movq	%rdx, %rax
	salq	$2, %rax
	addq	%rdx, %rax
	leaq	0(,%rax,4), %rsi
	addq	%rsi, %rax
	salq	$2, %rax
	addq	%rdx, %rax
	addq	%rbp, %rax
	addq	%rcx, %rax
	subq	$90224, %rax
	movb	$0, (%rax)
	movl	$1, -90372(%rbp)
	jmp	.L9
.L18:
	movl	$0, -90364(%rbp)
	jmp	.L10
.L15:
	movl	-90376(%rbp), %eax
	cltq
	movl	-80016(%rbp,%rax,4), %edx
	movl	-90364(%rbp), %eax
	cltq
	movl	-90352(%rbp,%rax,4), %eax
	addl	%edx, %eax
	movl	%eax, -90360(%rbp)
	movl	-90376(%rbp), %eax
	cltq
	movl	-40016(%rbp,%rax,4), %edx
	movl	-90364(%rbp), %eax
	cltq
	movl	-90336(%rbp,%rax,4), %eax
	addl	%edx, %eax
	movl	%eax, -90356(%rbp)
	cmpl	$0, -90360(%rbp)
	jle	.L26
	movl	-90416(%rbp), %eax
	cmpl	%eax, -90360(%rbp)
	jg	.L26
	cmpl	$0, -90356(%rbp)
	jle	.L26
	movl	-90420(%rbp), %eax
	cmpl	%eax, -90356(%rbp)
	jg	.L26
	movl	-90400(%rbp), %eax
	movl	-90404(%rbp), %edx
	movslq	%edx, %rcx
	movslq	%eax, %rdx
	movq	%rdx, %rax
	salq	$2, %rax
	addq	%rdx, %rax
	leaq	0(,%rax,4), %rsi
	addq	%rsi, %rax
	salq	$2, %rax
	addq	%rdx, %rax
	addq	%rbp, %rax
	addq	%rcx, %rax
	subq	$90224, %rax
	movzbl	(%rax), %ecx
	movl	-90360(%rbp), %eax
	movslq	%eax, %rsi
	movl	-90356(%rbp), %eax
	movslq	%eax, %rdx
	movq	%rdx, %rax
	salq	$2, %rax
	addq	%rdx, %rax
	leaq	0(,%rax,4), %rdi
	addq	%rdi, %rax
	salq	$2, %rax
	addq	%rdx, %rax
	addq	%rbp, %rax
	addq	%rsi, %rax
	subq	$90224, %rax
	movzbl	(%rax), %eax
	cmpb	%al, %cl
	jne	.L13
	movl	-90372(%rbp), %eax
	cltq
	movl	-90360(%rbp), %edx
	movl	%edx, -80016(%rbp,%rax,4)
	movl	-90372(%rbp), %eax
	cltq
	movl	-90356(%rbp), %edx
	movl	%edx, -40016(%rbp,%rax,4)
	movl	-90372(%rbp), %eax
	cltq
	movl	-40016(%rbp,%rax,4), %ecx
	movl	-90372(%rbp), %eax
	leal	1(%rax), %edx
	movl	%edx, -90372(%rbp)
	cltq
	movl	-80016(%rbp,%rax,4), %eax
	movslq	%eax, %rsi
	movslq	%ecx, %rdx
	movq	%rdx, %rax
	salq	$2, %rax
	addq	%rdx, %rax
	leaq	0(,%rax,4), %rcx
	addq	%rcx, %rax
	salq	$2, %rax
	addq	%rdx, %rax
	addq	%rbp, %rax
	addq	%rsi, %rax
	subq	$90224, %rax
	movb	$0, (%rax)
	movl	-90404(%rbp), %eax
	cmpl	%eax, -90360(%rbp)
	jne	.L13
	movl	-90400(%rbp), %eax
	cmpl	%eax, -90356(%rbp)
	je	.L27
	jmp	.L13
.L26:
	nop
.L13:
	addl	$1, -90364(%rbp)
.L10:
	cmpl	$3, -90364(%rbp)
	jle	.L15
	jmp	.L14
.L27:
	nop
.L14:
	movl	-90404(%rbp), %eax
	cmpl	%eax, -90360(%rbp)
	jne	.L16
	movl	-90400(%rbp), %eax
	cmpl	%eax, -90356(%rbp)
	je	.L28
.L16:
	addl	$1, -90376(%rbp)
.L9:
	movl	-90372(%rbp), %eax
	cmpl	-90376(%rbp), %eax
	jne	.L18
	jmp	.L17
.L28:
	nop
.L17:
	movl	-90372(%rbp), %eax
	cmpl	-90376(%rbp), %eax
	je	.L19
	leaq	.LC3(%rip), %rax
	movq	%rax, %rdi
	call	puts@PLT
	jmp	.L2
.L19:
	leaq	.LC2(%rip), %rax
	movq	%rax, %rdi
	call	puts@PLT
.L2:
	leaq	-90420(%rbp), %rdx
	leaq	-90416(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC4(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	-90416(%rbp), %eax
	testl	%eax, %eax
	jne	.L20
	movl	-90420(%rbp), %eax
	testl	%eax, %eax
	je	.L21
.L20:
	movl	$1, %eax
	jmp	.L22
.L21:
	movl	$0, %eax
.L22:
	testl	%eax, %eax
	jne	.L23
	movl	$0, %eax
	movq	-8(%rbp), %rdx
	subq	%fs:40, %rdx
	je	.L25
	call	__stack_chk_fail@PLT
.L25:
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE0:
	.size	main, .-main
	.ident	"GCC: (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0"
	.section	.note.GNU-stack,"",@progbits
	.section	.note.gnu.property,"a"
	.align 8
	.long	1f - 0f
	.long	4f - 1f
	.long	5
0:
	.string	"GNU"
1:
	.align 8
	.long	0xc0000002
	.long	3f - 2f
2:
	.long	0x3
3:
	.align 8
4:
```

Only output the optimized assembly code. Do not include any other text. Do not write any comments in the assembly code. Wrap the assembly code in ```assembly``` tags.
user
	.file	"temp.c"
	.text
	.section	.rodata.str1.1,"aMS",@progbits,1
.LC3:
	.string	"%d %d %d %d"
.LC4:
	.string	"%d"
.LC5:
	.string	"NG"
.LC6:
	.string	"OK"
.LC7:
	.string	"%d %d"
	.section	.text.startup,"ax",@progbits
	.p2align 4
	.globl	main
	.type	main, @function
main:
.LFB23:
	.cfi_startproc
	endbr64
	pushq	%r15
	.cfi_def_cfa_offset 16
	.cfi_offset 15, -16
	pushq	%r14
	.cfi_def_cfa_offset 24
	.cfi_offset 14, -24
	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
	leaq	-90112(%rsp), %r11
	.cfi_def_cfa 11, 90168
.LPSRL0:
	subq	$4096, %rsp
	orq	$0, (%rsp)
	cmpq	%r11, %rsp
	jne	.LPSRL0
	.cfi_def_cfa_register 7
	subq	$296, %rsp
	.cfi_def_cfa_offset 90464
	movdqa	.LC1(%rip), %xmm0
	movdqa	.LC0(%rip), %xmm1
	leaq	.LC3(%rip), %r15
	movq	%fs:40, %rax
	movq	%rax, 90392(%rsp)
	xorl	%eax, %eax
	leaq	36(%rsp), %rax
	movaps	%xmm0, 96(%rsp)
	movdqa	.LC2(%rip), %xmm0
	movq	%rax, 16(%rsp)
	leaq	40(%rsp), %rax
	movq	%rax, 24(%rsp)
	movaps	%xmm1, 80(%rsp)
	movaps	%xmm0, 112(%rsp)
	movaps	%xmm0, 128(%rsp)
	movaps	%xmm0, 144(%rsp)
	movaps	%xmm1, 160(%rsp)
	.p2align 4,,10
	.p2align 3
.L2:
	movq	16(%rsp), %rdx
	movq	24(%rsp), %rsi
	xorl	%eax, %eax
	leaq	.LC7(%rip), %rdi
	call	__isoc99_scanf@PLT
	movl	40(%rsp), %eax
	orl	36(%rsp), %eax
	je	.L44
	leaq	176(%rsp), %rdi
	movl	$10201, %edx
	xorl	%esi, %esi
	call	memset@PLT
	leaq	48(%rsp), %rdx
	movq	%r15, %rdi
	xorl	%eax, %eax
	leaq	52(%rsp), %rcx
	leaq	44(%rsp), %rsi
	leaq	56(%rsp), %r8
	call	__isoc99_scanf@PLT
	leaq	60(%rsp), %rsi
	leaq	.LC4(%rip), %rdi
	xorl	%eax, %eax
	call	__isoc99_scanf@PLT
	movl	60(%rsp), %eax
	leal	-1(%rax), %edx
	movl	%edx, 60(%rsp)
	testl	%eax, %eax
	je	.L6
	leaq	76(%rsp), %r13
	leaq	72(%rsp), %r12
	leaq	68(%rsp), %rbp
	leaq	64(%rsp), %rbx
	.p2align 4,,10
	.p2align 3
.L3:
	movq	%r13, %r8
	movq	%r12, %rcx
	movq	%rbp, %rdx
	movq	%rbx, %rsi
	movq	%r15, %rdi
	xorl	%eax, %eax
	call	__isoc99_scanf@PLT
	movl	68(%rsp), %eax
	movl	76(%rsp), %ecx
	movl	72(%rsp), %esi
	movl	64(%rsp), %edi
	sall	$2, %eax
	movslq	%eax, %rdx
	movl	128(%rsp,%rdx,4), %r14d
	movl	80(%rsp,%rdx,4), %r8d
	addl	%ecx, %r14d
	addl	%esi, %r8d
	movslq	%r14d, %rdx
	movslq	%r8d, %r8
	leaq	(%rdx,%rdx,4), %r9
	leaq	(%r9,%r9,4), %r9
	leaq	(%rdx,%r9,4), %rdx
	addq	$90400, %rdx
	addq	%rsp, %rdx
	movb	%dil, -90224(%r8,%rdx)
	leal	1(%rax), %edx
	movslq	%edx, %rdx
	movl	128(%rsp,%rdx,4), %r11d
	movl	80(%rsp,%rdx,4), %r8d
	addl	%ecx, %r11d
	addl	%esi, %r8d
	movslq	%r11d, %rdx
	movslq	%r8d, %r8
	leaq	(%rdx,%rdx,4), %r9
	leaq	(%r9,%r9,4), %r9
	leaq	(%rdx,%r9,4), %rdx
	addq	$90400, %rdx
	addq	%rsp, %rdx
	movb	%dil, -90224(%r8,%rdx)
	leal	2(%rax), %edx
	movslq	%edx, %rdx
	movl	128(%rsp,%rdx,4), %r14d
	movl	80(%rsp,%rdx,4), %r8d
	addl	%ecx, %r14d
	addl	%esi, %r8d
	movslq	%r14d, %rdx
	movslq	%r8d, %r8
	leaq	(%rdx,%rdx,4), %r9
	leaq	(%r9,%r9,4), %r9
	leaq	(%rdx,%r9,4), %rdx
	addq	$90400, %rdx
	addq	%rsp, %rdx
	movb	%dil, -90224(%r8,%rdx)
	leal	3(%rax), %edx
	movslq	%edx, %rdx
	movl	128(%rsp,%rdx,4), %r11d
	movl	80(%rsp,%rdx,4), %r8d
	addl	%ecx, %r11d
	addl	%esi, %r8d
	movslq	%r11d, %rdx
	movslq	%r8d, %r8
	leaq	(%rdx,%rdx,4), %r9
	leaq	(%r9,%r9,4), %r9
	leaq	(%rdx,%r9,4), %rdx
	addq	$90400, %rdx
	addq	%rsp, %rdx
	movb	%dil, -90224(%r8,%rdx)
	leal	4(%rax), %edx
	movslq	%edx, %rdx
	movl	128(%rsp,%rdx,4), %r10d
	movl	80(%rsp,%rdx,4), %r8d
	addl	%ecx, %r10d
	addl	%esi, %r8d
	movslq	%r10d, %rdx
	movslq	%r8d, %r8
	leaq	(%rdx,%rdx,4), %r9
	leaq	(%r9,%r9,4), %r9
	leaq	(%rdx,%r9,4), %rdx
	addq	$90400, %rdx
	addq	%rsp, %rdx
	movb	%dil, -90224(%r8,%rdx)
	leal	5(%rax), %edx
	movslq	%edx, %rdx
	movl	128(%rsp,%rdx,4), %r14d
	movl	80(%rsp,%rdx,4), %r8d
	addl	%ecx, %r14d
	addl	%esi, %r8d
	movslq	%r14d, %rdx
	movslq	%r8d, %r8
	leaq	(%rdx,%rdx,4), %r9
	leaq	(%r9,%r9,4), %r9
	leaq	(%rdx,%r9,4), %rdx
	addq	$90400, %rdx
	addq	%rsp, %rdx
	movb	%dil, -90224(%r8,%rdx)
	leal	6(%rax), %edx
	movslq	%edx, %rdx
	movl	128(%rsp,%rdx,4), %r11d
	movl	80(%rsp,%rdx,4), %r8d
	addl	%ecx, %r11d
	addl	%esi, %r8d
	movslq	%r11d, %rdx
	movslq	%r8d, %r8
	leaq	(%rdx,%rdx,4), %r9
	leaq	(%r9,%r9,4), %r9
	leaq	(%rdx,%r9,4), %rdx
	addq	$90400, %rdx
	addq	%rsp, %rdx
	movb	%dil, -90224(%r8,%rdx)
	leal	7(%rax), %edx
	movslq	%edx, %rdx
	movl	128(%rsp,%rdx,4), %eax
	addl	80(%rsp,%rdx,4), %esi
	movslq	%esi, %rsi
	addl	%ecx, %eax
	cltq
	leaq	(%rax,%rax,4), %rdx
	leaq	(%rdx,%rdx,4), %rdx
	leaq	(%rax,%rdx,4), %rax
	addq	$90400, %rax
	addq	%rsp, %rax
	movb	%dil, -90224(%rsi,%rax)
	movl	60(%rsp), %eax
	leal	-1(%rax), %edx
	movl	%edx, 60(%rsp)
	testl	%eax, %eax
	jne	.L3
.L6:
	movslq	48(%rsp), %rcx
	movl	56(%rsp), %ebx
	movslq	44(%rsp), %rdi
	movslq	52(%rsp), %r9
	leaq	(%rcx,%rcx,4), %rsi
	movq	%rcx, %rdx
	movl	%ebx, 12(%rsp)
	leaq	(%rsi,%rsi,4), %rsi
	movq	%rdi, %rax
	movq	%r9, %r11
	leaq	(%rcx,%rsi,4), %rcx
	movslq	%ebx, %rsi
	addq	$90400, %rcx
	addq	%rsp, %rcx
	addq	%rdi, %rcx
	leaq	(%rsi,%rsi,4), %rdi
	leaq	(%rdi,%rdi,4), %rdi
	leaq	(%rsi,%rdi,4), %r8
	leaq	90400(%r8), %rbx
	leaq	(%rsp,%rbx), %r8
	addq	%r9, %r8
	movzbl	-90224(%r8), %ebx
	cmpb	%bl, -90224(%rcx)
	je	.L45
.L4:
	leaq	.LC5(%rip), %rdi
	call	puts@PLT
	jmp	.L2
.L45:
	movl	40(%rsp), %edi
	movl	36(%rsp), %r12d
	movb	$0, -90224(%rcx)
	leaq	50384(%rsp), %rsi
	movl	%eax, 10384(%rsp)
	xorl	%ecx, %ecx
	movl	$1, %r9d
	movl	%edx, 50384(%rsp)
	jmp	.L8
	.p2align 4,,10
	.p2align 3
.L9:
	addq	$1, %rcx
	addq	$4, %rsi
	cmpl	%ecx, %r9d
	je	.L4
	movl	10384(%rsp,%rcx,4), %eax
	movl	(%rsi), %edx
.L8:
	movl	%ecx, 8(%rsp)
	testl	%eax, %eax
	jle	.L12
	leal	1(%rdx), %r10d
	testl	%r10d, %r10d
	jle	.L13
	cmpl	%eax, %edi
	jl	.L13
	cmpl	%r12d, %r10d
	jg	.L13
	movslq	%r10d, %rbp
	movslq	%eax, %rbx
	leaq	0(%rbp,%rbp,4), %r13
	leaq	0(%r13,%r13,4), %r13
	leaq	0(%rbp,%r13,4), %rbp
	leaq	90400(%rbp), %r14
	leaq	(%rsp,%r14), %rbp
	addq	%rbp, %rbx
	movzbl	-90224(%rbx), %r14d
	cmpb	%r14b, -90224(%r8)
	je	.L46
.L13:
	addl	$1, %eax
.L24:
	cmpl	%eax, %edi
	jl	.L16
	testl	%edx, %edx
	jle	.L16
	cmpl	%edx, %r12d
	jl	.L16
	movslq	%edx, %r10
	movslq	%eax, %rbx
	leaq	(%r10,%r10,4), %rbp
	leaq	0(%rbp,%rbp,4), %rbp
	leaq	(%r10,%rbp,4), %r10
	addq	$90400, %r10
	addq	%rsp, %r10
	addq	%rbx, %r10
	movzbl	-90224(%r10), %ebx
	cmpb	%bl, -90224(%r8)
	je	.L47
.L16:
	leaq	10384(%rsp), %rbx
	leal	-1(%rdx), %r10d
	movl	(%rbx,%rcx,4), %eax
	testl	%eax, %eax
	jle	.L18
	cmpl	%eax, %edi
	jl	.L18
	testl	%r10d, %r10d
	jle	.L18
	cmpl	%r10d, %r12d
	jl	.L18
	movslq	%r10d, %r13
	movslq	%eax, %rbp
	leaq	0(%r13,%r13,4), %r14
	leaq	(%r14,%r14,4), %r14
	leaq	0(%r13,%r14,4), %r13
	leaq	90400(%r13), %r14
	leaq	(%rsp,%r14), %r13
	addq	%r13, %rbp
	movzbl	-90224(%rbp), %r14d
	cmpb	%r14b, -90224(%r8)
	je	.L48
	.p2align 4,,10
	.p2align 3
.L18:
	subl	$1, %eax
	testl	%eax, %eax
	jle	.L20
	testl	%edx, %edx
	jle	.L20
	cmpl	%eax, %edi
	jl	.L20
	cmpl	%edx, %r12d
	jl	.L20
	movslq	%edx, %r10
	movslq	%eax, %rbx
	leaq	(%r10,%r10,4), %rbp
	leaq	0(%rbp,%rbp,4), %rbp
	leaq	(%r10,%rbp,4), %r10
	addq	$90400, %r10
	addq	%rsp, %r10
	addq	%rbx, %r10
	movzbl	-90224(%r10), %ebx
	cmpb	%bl, -90224(%r8)
	je	.L49
	.p2align 4,,10
	.p2align 3
.L20:
	cmpl	%eax, %r11d
	jne	.L9
	cmpl	%edx, 12(%rsp)
	jne	.L9
.L10:
	cmpl	8(%rsp), %r9d
	je	.L4
	leaq	.LC6(%rip), %rdi
	call	puts@PLT
	jmp	.L2
	.p2align 4,,10
	.p2align 3
.L12:
	jne	.L23
	movl	$1, %eax
	jmp	.L24
.L47:
	movslq	%r9d, %rbx
	movb	$0, -90224(%r10)
	addl	$1, %r9d
	movl	%eax, 10384(%rsp,%rbx,4)
	movl	%edx, 50384(%rsp,%rbx,4)
	cmpl	%edx, 12(%rsp)
	jne	.L27
	cmpl	%eax, %r11d
	je	.L10
.L27:
	movl	(%rsi), %edx
	jmp	.L16
.L48:
	movslq	%r9d, %rdx
	movb	$0, -90224(%rbp)
	addl	$1, %r9d
	movl	%eax, 10384(%rsp,%rdx,4)
	movl	%r10d, 50384(%rsp,%rdx,4)
	cmpl	%eax, %r11d
	jne	.L28
	cmpl	%r10d, 12(%rsp)
	je	.L10
.L28:
	movl	(%rbx,%rcx,4), %eax
	movl	(%rsi), %edx
	jmp	.L18
.L49:
	movslq	%r9d, %rbx
	movb	$0, -90224(%r10)
	addl	$1, %r9d
	movl	%eax, 10384(%rsp,%rbx,4)
	movl	%edx, 50384(%rsp,%rbx,4)
	cmpl	%eax, %r11d
	jne	.L9
	cmpl	%edx, 12(%rsp)
	jne	.L9
	jmp	.L10
	.p2align 4,,10
	.p2align 3
.L46:
	movslq	%r9d, %rdx
	movb	$0, -90224(%rbx)
	addl	$1, %r9d
	movl	%eax, 10384(%rsp,%rdx,4)
	movl	%r10d, 50384(%rsp,%rdx,4)
	cmpl	%eax, %r11d
	jne	.L26
	cmpl	%r10d, 12(%rsp)
	je	.L10
.L26:
	movl	(%rsi), %edx
	addl	$1, %eax
	jmp	.L24
.L23:
	subl	$1, %eax
	jmp	.L20
.L44:
	movq	90392(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L50
	addq	$90408, %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
.L50:
	.cfi_restore_state
	call	__stack_chk_fail@PLT
	.cfi_endproc
.LFE23:
	.size	main, .-main
	.section	.rodata.cst16,"aM",@progbits,16
	.align 16
.LC0:
	.long	2
	.long	2
	.long	3
	.long	3
	.align 16
.LC1:
	.long	0
	.long	0
	.long	1
	.long	1
	.align 16
.LC2:
	.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
.LC3:
	.string	"%d %d %d %d"
.LC4:
	.string	"%d"
.LC5:
	.string	"NG"
.LC6:
	.string	"OK"
.LC7:
	.string	"%d %d"
	.section	.text.startup,"ax",@progbits
	.p2align 4
	.globl	main
	.type	main, @function
main:
.LFB23:
	.cfi_startproc
	endbr64
	pushq	%r15
	.cfi_def_cfa_offset 16
	.cfi_offset 15, -16
	pushq	%r14
	.cfi_def_cfa_offset 24
	.cfi_offset 14, -24
	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
	leaq	-90112(%rsp), %r11
	.cfi_def_cfa 11, 90168
.LPSRL0:
	subq	$4096, %rsp
	orq	$0, (%rsp)
	cmpq	%r11, %rsp
	jne	.LPSRL0
	.cfi_def_cfa_register 7
	subq	$296, %rsp
	.cfi_def_cfa_offset 90464
	movdqa	.LC1(%rip), %xmm0
	movdqa	.LC0(%rip), %xmm1
	leaq	.LC3(%rip), %r15
	movq	%fs:40, %rax
	movq	%rax, 90392(%rsp)
	xorl	%eax, %eax
	leaq	36(%rsp), %rax
	movaps	%xmm0, 96(%rsp)
	movdqa	.LC2(%rip), %xmm0
	movq	%rax, 16(%rsp)
	leaq	40(%rsp), %rax
	movq	%rax, 24(%rsp)
	movaps	%xmm1, 80(%rsp)
	movaps	%xmm0, 112(%rsp)
	movaps	%xmm0, 128(%rsp)
	movaps	%xmm0, 144(%rsp)
	movaps	%xmm1, 160(%rsp)
	.p2align 4,,10
	.p2align 3
.L2:
	movq	16(%rsp), %rdx
	movq	24(%rsp), %rsi
	xorl	%eax, %eax
	leaq	.LC7(%rip), %rdi
	call	__isoc99_scanf@PLT
	movl	40(%rsp), %eax
	orl	36(%rsp), %eax
	je	.L44
	leaq	176(%rsp), %rdi
	movl	$10201, %edx
	xorl	%esi, %esi
	call	memset@PLT
	leaq	48(%rsp), %rdx
	movq	%r15, %rdi
	xorl	%eax, %eax
	leaq	52(%rsp), %rcx
	leaq	44(%rsp), %rsi
	leaq	56(%rsp), %r8
	call	__isoc99_scanf@PLT
	leaq	60(%rsp), %rsi
	leaq	.LC4(%rip), %rdi
	xorl	%eax, %eax
	call	__isoc99_scanf@PLT
	movl	60(%rsp), %eax
	leal	-1(%rax), %edx
	movl	%edx, 60(%rsp)
	testl	%eax, %eax
	je	.L6
	leaq	76(%rsp), %r13
	leaq	72(%rsp), %r12
	leaq	68(%rsp), %rbp
	leaq	64(%rsp), %rbx
	.p2align 4,,10
	.p2align 3
.L3:
	movq	%r13, %r8
	movq	%r12, %rcx
	movq	%rbp, %rdx
	movq	%rbx, %rsi
	movq	%r15, %rdi
	xorl	%eax, %eax
	call	__isoc99_scanf@PLT
	movl	68(%rsp), %eax
	movl	76(%rsp), %ecx
	movl	72(%rsp), %esi
	movl	64(%rsp), %edi
	sall	$2, %eax
	movslq	%eax, %rdx
	movl	128(%rsp,%rdx,4), %r14d
	movl	80(%rsp,%rdx,4), %r8d
	addl	%ecx, %r14d
	addl	%esi, %r8d
	movslq	%r14d, %rdx
	movslq	%r8d, %r8
	leaq	(%rdx,%rdx,4), %r9
	leaq	(%r9,%r9,4), %r9
	leaq	(%rdx,%r9,4), %rdx
	addq	$90400, %rdx
	addq	%rsp, %rdx
	movb	%dil, -90224(%r8,%rdx)
	leal	1(%rax), %edx
	movslq	%edx, %rdx
	movl	128(%rsp,%rdx,4), %r11d
	movl	80(%rsp,%rdx,4), %r8d
	addl	%ecx, %r11d
	addl	%esi, %r8d
	movslq	%r11d, %rdx
	movslq	%r8d, %r8
	leaq	(%rdx,%rdx,4), %r9
	leaq	(%r9,%r9,4), %r9
	leaq	(%rdx,%r9,4), %rdx
	addq	$90400, %rdx
	addq	%rsp, %rdx
	movb	%dil, -90224(%r8,%rdx)
	leal	2(%rax), %edx
	movslq	%edx, %rdx
	movl	128(%rsp,%rdx,4), %r14d
	movl	80(%rsp,%rdx,4), %r8d
	addl	%ecx, %r14d
	addl	%esi, %r8d
	movslq	%r14d, %rdx
	movslq	%r8d, %r8
	leaq	(%rdx,%rdx,4), %r9
	leaq	(%r9,%r9,4), %r9
	leaq	(%rdx,%r9,4), %rdx
	addq	$90400, %rdx
	addq	%rsp, %rdx
	movb	%dil, -90224(%r8,%rdx)
	leal	3(%rax), %edx
	movslq	%edx, %rdx
	movl	128(%rsp,%rdx,4), %r11d
	movl	80(%rsp,%rdx,4), %r8d
	addl	%ecx, %r11d
	addl	%esi, %r8d
	movslq	%r11d, %rdx
	movslq	%r8d, %r8
	leaq	(%rdx,%rdx,4), %r9
	leaq	(%r9,%r9,4), %r9
	leaq	(%rdx,%r9,4), %rdx
	addq	$90400, %rdx
	addq	%rsp, %rdx
	movb	%dil, -90224(%r8,%rdx)
	leal	4(%rax), %edx
	movslq	%edx, %rdx
	movl	128(%rsp,%rdx,4), %r10d
	movl	80(%rsp,%rdx,4), %r8d
	addl	%ecx, %r10d
	addl	%esi, %r8d
	movslq	%r10d, %rdx
	movslq	%r8d, %r8
	leaq	(%rdx,%rdx,4), %r9
	leaq	(%r9,%r9,4), %r9
	leaq	(%rdx,%r9,4), %rdx
	addq	$90400, %rdx
	addq	%rsp, %rdx
	movb	%dil, -90224(%r8,%rdx)
	leal	5(%rax), %edx
	movslq	%edx, %rdx
	movl	128(%rsp,%rdx,4), %r14d
	movl	80(%rsp,%rdx,4), %r8d
	addl	%ecx, %r14d
	addl	%esi, %r8d
	movslq	%r14d, %rdx
	movslq	%r8d, %r8
	leaq	(%rdx,%rdx,4), %r9
	leaq	(%r9,%r9,4), %r9
	leaq	(%rdx,%r9,4), %rdx
	addq	$90400, %rdx
	addq	%rsp, %rdx
	movb	%dil, -90224(%r8,%rdx)
	leal	6(%rax), %edx
	movslq	%edx, %rdx
	movl	128(%rsp,%rdx,4), %r11d
	movl	80(%rsp,%rdx,4), %r8d
	addl	%ecx, %r11d
	addl	%esi, %r8d
	movslq	%r11d, %rdx
	movslq	%r8d, %r8
	leaq	(%rdx,%rdx,4), %r9
	leaq	(%r9,%r9,4), %r9
	leaq	(%rdx,%r9,4), %rdx
	addq	$90400, %rdx
	addq	%rsp, %rdx
	movb	%dil, -90224(%r8,%rdx)
	leal	7(%rax), %edx
	movslq	%edx, %rdx
	movl	128(%rsp,%rdx,4), %eax
	addl	80(%rsp,%rdx,4), %esi
	movslq	%esi, %rsi
	addl	%ecx, %eax
	cltq
	leaq	(%rax,%rax,4), %rdx
	leaq	(%rdx,%rdx,4), %rdx
	leaq	(%rax,%rdx,4), %rax
	addq	$90400, %rax
	addq	%rsp, %rax
	movb	%dil, -90224(%rsi,%rax)
	movl	60(%rsp), %eax
	leal	-1(%rax), %edx
	movl	%edx, 60(%rsp)
	testl	%eax, %eax
	jne	.L3
.L6:
	movslq	48(%rsp), %rcx
	movl	56(%rsp), %ebx
	movslq	44(%rsp), %rdi
	movslq	52(%rsp), %r9
	leaq	(%rcx,%rcx,4), %rsi
	movq	%rcx, %rdx
	movl	%ebx, 12(%rsp)
	leaq	(%rsi,%rsi,4), %rsi
	movq	%rdi, %rax
	movq	%r9, %r11
	leaq	(%rcx,%rsi,4), %rcx
	movslq	%ebx, %rsi
	addq	$90400, %rcx
	addq	%rsp, %rcx
	addq	%rdi, %rcx
	leaq	(%rsi,%rsi,4), %rdi
	leaq	(%rdi,%rdi,4), %rdi
	leaq	(%rsi,%rdi,4), %r8
	leaq	90400(%r8), %rbx
	leaq	(%rsp,%rbx), %r8
	addq	%r9, %r8
	movzbl	-90224(%r8), %ebx
	cmpb	%bl, -90224(%rcx)
	je	.L45
.L4:
	leaq	.LC5(%rip), %rdi
	call	puts@PLT
	jmp	.L2
.L45:
	movl	40(%rsp), %edi
	movl	36(%rsp), %r12d
	movb	$0, -90224(%rcx)
	leaq	50384(%rsp), %rsi
	movl	%eax, 10384(%rsp)
	xorl	%ecx, %ecx
	movl	$1, %r9d
	movl	%edx, 50384(%rsp)
	jmp	.L8
	.p2align 4,,10
	.p2align 3
.L9:
	addq	$1, %rcx
	addq	$4, %rsi
	cmpl	%ecx, %r9d
	je	.L4
	movl	10384(%rsp,%rcx,4), %eax
	movl	(%rsi), %edx
.L8:
	movl	%ecx, 8(%rsp)
	testl	%eax, %eax
	jle	.L12
	leal	1(%rdx), %r10d
	testl	%r10d, %r10d
	jle	.L13
	cmpl	%eax, %edi
	jl	.L13
	cmpl	%r12d, %r10d
	jg	.L13
	movslq	%r10d, %rbp
	movslq	%eax, %rbx
	leaq	0(%rbp,%rbp,4), %r13
	leaq	0(%r13,%r13,4), %r13
	leaq	0(%rbp,%r13,4), %rbp
	leaq	90400(%rbp), %r14
	leaq	(%rsp,%r14), %rbp
	addq	%rbp, %rbx
	movzbl	-90224(%rbx), %r14d
	cmpb	%r14b, -90224(%r8)
	je	.L46
.L13:
	addl	$1, %eax
.L24:
	cmpl	%eax, %edi
	jl	.L16
	testl	%edx, %edx
	jle	.L16
	cmpl	%edx, %r12d
	jl	.L16
	movslq	%edx, %r10
	movslq	%eax, %rbx
	leaq	(%r10,%r10,4), %rbp
	leaq	0(%rbp,%rbp,4), %rbp
	leaq	(%r10,%rbp,4), %r10
	addq	$90400, %r10
	addq	%rsp, %r10
	addq	%rbx, %r10
	movzbl	-90224(%r10), %ebx
	cmpb	%bl, -90224(%r8)
	je	.L47
.L16:
	leaq	10384(%rsp), %rbx
	leal	-1(%rdx), %r10d
	movl	(%rbx,%rcx,4), %eax
	testl	%eax, %eax
	jle	.L18
	cmpl	%eax, %edi
	jl	.L18
	testl	%r10d, %r10d
	jle	.L18
	cmpl	%r10d, %r12d
	jl	.L18
	movslq	%r10d, %r13
	movslq	%eax, %rbp
	leaq	0(%r13,%r13,4), %r14
	leaq	(%r14,%r14,4), %r14
	leaq	0(%r13,%r14,4), %r13
	leaq	90400(%r13), %r14
	leaq	(%rsp,%r14), %r13
	addq	%r13, %rbp
	movzbl	-90224(%rbp), %r14d
	cmpb	%r14b, -90224(%r8)
	je	.L48
	.p2align 4,,10
	.p2align 3
.L18:
	subl	$1, %eax
	testl	%eax, %eax
	jle	.L20
	testl	%edx, %edx
	jle	.L20
	cmpl	%eax, %edi
	jl	.L20
	cmpl	%edx, %r12d
	jl	.L20
	movslq	%edx, %r10
	movslq	%eax, %rbx
	leaq	(%r10,%r10,4), %rbp
	leaq	0(%rbp,%rbp,4), %rbp
	leaq	(%r10,%rbp,4), %r10
	addq	$90400, %r10
	addq	%rsp, %r10
	addq	%rbx, %r10
	movzbl	-90224(%r10), %ebx
	cmpb	%bl, -90224(%r8)
	je	.L49
	.p2align 4,,10
	.p2align 3
.L20:
	cmpl	%eax, %r11d
	jne	.L9
	cmpl	%edx, 12(%rsp)
	jne	.L9
.L10:
	cmpl	8(%rsp), %r9d
	je	.L4
	leaq	.LC6(%rip), %rdi
	call	puts@PLT
	jmp	.L2
	.p2align 4,,10
	.p2align 3
.L12:
	jne	.L23
	movl	$1, %eax
	jmp	.L24
.L47:
	movslq	%r9d, %rbx
	movb	$0, -90224(%r10)
	addl	$1, %r9d
	movl	%eax, 10384(%rsp,%rbx,4)
	movl	%edx, 50384(%rsp,%rbx,4)
	cmpl	%edx, 12(%rsp)
	jne	.L27
	cmpl	%eax, %r11d
	je	.L10
.L27:
	movl	(%rsi), %edx
	jmp	.L16
.L48:
	movslq	%r9d, %rdx
	movb	$0, -90224(%rbp)
	addl	$1, %r9d
	movl	%eax, 10384(%rsp,%rdx,4)
	movl	%r10d, 50384(%rsp,%rdx,4)
	cmpl	%eax, %r11d
	jne	.L28
	cmpl	%r10d, 12(%rsp)
	je	.L10
.L28:
	movl	(%rbx,%rcx,4), %eax
	movl	(%rsi), %edx
	jmp	.L18
.L49:
	movslq	%r9d, %rbx
	movb	$0, -90224(%r10)
	addl	$1, %r9d
	movl	%eax, 10384(%rsp,%rbx,4)
	movl	%edx, 50384(%rsp,%rbx,4)
	cmpl	%eax, %r11d
	jne	.L9
	cmpl	%edx, 12(%rsp)
	jne	.L9
	jmp	.L10
	.p2align 4,,10
	.p2align 3
.L46:
	movslq	%r9d, %rdx
	movb	$0, -90224(%rbx)
	addl	$1, %r9d
	movl	%eax, 10384(%rsp,%rdx,4)
	movl	%r10d, 50384(%rsp,%rdx,4)
	cmpl	%eax, %r11d
	jne	.L26
	cmpl	%r10d, 12(%rsp)
	je	.L10
.L26:
	movl	(%rsi), %edx
	addl	$1, %eax
	jmp	.L24
.L23:
	subl	$1, %eax
	jmp	.L20
.L44:
	movq	90392(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L50
	addq	$90408, %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
.L50:
	.cfi_restore_state
	call	__stack_chk_fail@PLT
	.cfi_endproc
.LFE23:
	.size	main, .-main
	.section	.rodata.cst16,"aM",@progbits,16
	.align 16
.LC0:
	.long	2
	.long	2
	.long	3
	.long	3
	.align 16
.LC1:
	.long	0
	.long	0
	.long	1
	.long	1
	.align 16
.LC2:
	.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:

#include<stdio.h>
int main(){
  int X[]={2,2,3,3,0,0,1,1,0,1,0,1};
  int Y[]={0,1,0,1,0,1,0,1,2,2,3,3};
  int XX[]={0,1,0,-1};
  int YY[]={1,0,-1,0};
  int h,w,sx,sy,gx,gy,n,a,b,c,d,t,r,i,j,k,nx,ny,x[10000],y[10000];
  while(scanf("%d %d",&w,&h),w||h){
    char m[101][101]={0};
    scanf("%d %d %d %d",&sx,&sy,&gx,&gy);
    scanf("%d",&n);
    while(n--){
      scanf("%d %d %d %d",&a,&b,&c,&d);
      for(i=b*4;i<8+b*4;i++)m[d+Y[i]][c+X[i]]=a;
    }
    /*for(i=0;i<h;i++){
      for(j=0;j<w;j++)printf("%d ",m[i][j]);
      printf("\n");
      }*/
    if(m[sy][sx]!=m[gy][gx])printf("NG\n");
    else {
      x[t=0]=sx;
      y[t]=sy;
      m[sy][sx]=0;
      for(r=1;r-t;t++){
	for(k=0;k<4;k++){
	  nx=x[t]+XX[k];
	  ny=y[t]+YY[k];
	  if(nx<1||w<nx||ny<1||h<ny)continue;
	  if(m[gy][gx]==m[ny][nx]){
	    x[r]=nx;
	    y[r]=ny;
	    m[y[r]][x[r++]]=0;
	    if(nx==gx&&ny==gy)break;
	  }
	}
	if(nx==gx&&ny==gy)break;
      }
      /*for(i=0;i<=h;i++){
	for(j=0;j<=w;j++)printf("%d ",m[i][j]);
	printf("\n");
	}*/
      if(r-t)printf("OK\n");
      else   printf("NG\n");
    }
  }
  return 0;
}
 
20 20
1 1
9 9
7
2 0 1 1
5 1 1 3
2 1 3 3
1 1 5 2
5 1 7 3
2 0 2 7
2 0 6 8
20 20
9 9
1 1
6
2 0 1 1
1 0 5 1
2 1 1 3
5 0 1 7
3 1 6 5
4 1 8 5
0 0
 20 20
1 1
9 9
7
2 0 1 1
5 1 1 3
2 1 3 3
1 1 5 2
5 1 7 3
2 0 4 7
2 -1 6 8
20 20
9 9
1 1
6
2 0 1 1
1 0 5 1
2 1 1 3
5 0 1 7
3 1 6 5
4 1 8 5
0 0
 20 20
1 1
9 9
7
2 0 1 1
5 1 1 3
2 1 3 3
1 1 5 2
5 1 7 3
2 0 4 7
2 0 6 8
20 20
9 9
1 1
6
2 0 1 1
1 0 5 1
2 1 1 3
5 0 1 7
3 1 6 5
4 1 8 5
0 0
 20 20
1 1
9 9
7
2 0 1 1
5 1 1 3
2 1 3 3
1 1 5 2
5 1 7 3
2 0 4 7
2 -1 6 8
20 20
9 9
1 1
6
2 0 1 1
2 0 5 1
2 1 1 3
5 0 1 7
3 1 6 5
4 1 8 5
0 0
 20 20
1 2
9 9
7
2 0 1 1
5 1 1 3
2 1 3 3
1 1 5 2
5 1 7 3
2 0 2 7
2 0 6 8
20 20
9 9
1 1
6
2 0 1 1
1 0 5 1
2 1 1 3
5 0 1 7
3 1 5 5
4 1 8 5
0 0
 20 20
1 1
9 9
7
2 0 1 1
5 0 1 3
2 1 3 3
1 1 5 2
5 1 7 3
2 0 2 7
2 0 6 8
20 20
9 9
1 1
6
2 0 1 1
1 0 5 1
2 1 1 3
5 0 1 7
3 1 6 5
4 1 8 5
0 0
 20 20
1 1
9 9
7
2 0 1 1
5 1 1 3
2 1 3 3
1 1 5 2
5 1 7 3
2 0 4 7
2 0 6 8
20 20
9 9
1 1
6
2 0 1 1
1 0 5 1
2 1 1 3
8 0 1 7
3 1 6 5
4 1 8 5
0 0
 20 20
1 1
9 9
7
2 0 1 1
5 1 1 3
2 1 3 3
1 1 5 2
5 1 7 3
2 0 4 7
2 -1 6 8
20 20
9 12
1 1
6
2 0 1 1
1 0 5 1
2 1 1 3
5 0 1 7
3 1 6 5
4 1 8 5
0 0
 20 20
1 1
9 9
7
2 0 1 1
5 1 1 3
2 1 3 3
1 1 5 2
5 1 7 3
2 0 4 7
2 -1 6 8
20 20
9 16
1 1
6
2 0 1 1
2 0 5 1
2 1 1 3
5 0 1 7
3 1 6 5
4 1 8 5
0 0
 20 20
1 2
9 9
7
2 0 1 1
5 1 1 3
2 1 3 3
1 1 5 2
5 1 7 3
2 0 2 7
2 0 6 8
20 20
9 9
1 1
6
2 0 1 1
2 0 5 1
2 1 1 3
5 0 1 7
3 1 5 5
4 1 8 5
0 0

OK
NG
 OK
NG
 OK
NG
 OK
NG
 OK
NG
 OK
NG
 OK
NG
 OK
NG
 OK
NG
 OK
NG

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

```c
#include<stdio.h>
int main(){
  int X[]={2,2,3,3,0,0,1,1,0,1,0,1};
  int Y[]={0,1,0,1,0,1,0,1,2,2,3,3};
  int XX[]={0,1,0,-1};
  int YY[]={1,0,-1,0};
  int h,w,sx,sy,gx,gy,n,a,b,c,d,t,r,i,j,k,nx,ny,x[10000],y[10000];
  while(scanf("%d %d",&w,&h),w||h){
    char m[101][101]={0};
    scanf("%d %d %d %d",&sx,&sy,&gx,&gy);
    scanf("%d",&n);
    while(n--){
      scanf("%d %d %d %d",&a,&b,&c,&d);
      for(i=b*4;i<8+b*4;i++)m[d+Y[i]][c+X[i]]=a;
    }
    /*for(i=0;i<h;i++){
      for(j=0;j<w;j++)printf("%d ",m[i][j]);
      printf("\n");
      }*/
    if(m[sy][sx]!=m[gy][gx])printf("NG\n");
    else {
      x[t=0]=sx;
      y[t]=sy;
      m[sy][sx]=0;
      for(r=1;r-t;t++){
	for(k=0;k<4;k++){
	  nx=x[t]+XX[k];
	  ny=y[t]+YY[k];
	  if(nx<1||w<nx||ny<1||h<ny)continue;
	  if(m[gy][gx]==m[ny][nx]){
	    x[r]=nx;
	    y[r]=ny;
	    m[y[r]][x[r++]]=0;
	    if(nx==gx&&ny==gy)break;
	  }
	}
	if(nx==gx&&ny==gy)break;
      }
      /*for(i=0;i<=h;i++){
	for(j=0;j<=w;j++)printf("%d ",m[i][j]);
	printf("\n");
	}*/
      if(r-t)printf("OK\n");
      else   printf("NG\n");
    }
  }
  return 0;
}
 ```

Unoptimized Assembly Code:

```assembly
	.file	"temp.c"
	.text
	.section	.rodata
.LC0:
	.string	"%d %d %d %d"
.LC1:
	.string	"%d"
.LC2:
	.string	"NG"
.LC3:
	.string	"OK"
.LC4:
	.string	"%d %d"
	.text
	.globl	main
	.type	main, @function
main:
.LFB0:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	leaq	-90112(%rsp), %r11
.LPSRL0:
	subq	$4096, %rsp
	orq	$0, (%rsp)
	cmpq	%r11, %rsp
	jne	.LPSRL0
	subq	$320, %rsp
	movq	%fs:40, %rax
	movq	%rax, -8(%rbp)
	xorl	%eax, %eax
	movl	$2, -90320(%rbp)
	movl	$2, -90316(%rbp)
	movl	$3, -90312(%rbp)
	movl	$3, -90308(%rbp)
	movl	$0, -90304(%rbp)
	movl	$0, -90300(%rbp)
	movl	$1, -90296(%rbp)
	movl	$1, -90292(%rbp)
	movl	$0, -90288(%rbp)
	movl	$1, -90284(%rbp)
	movl	$0, -90280(%rbp)
	movl	$1, -90276(%rbp)
	movl	$0, -90272(%rbp)
	movl	$1, -90268(%rbp)
	movl	$0, -90264(%rbp)
	movl	$1, -90260(%rbp)
	movl	$0, -90256(%rbp)
	movl	$1, -90252(%rbp)
	movl	$0, -90248(%rbp)
	movl	$1, -90244(%rbp)
	movl	$2, -90240(%rbp)
	movl	$2, -90236(%rbp)
	movl	$3, -90232(%rbp)
	movl	$3, -90228(%rbp)
	movl	$0, -90352(%rbp)
	movl	$1, -90348(%rbp)
	movl	$0, -90344(%rbp)
	movl	$-1, -90340(%rbp)
	movl	$1, -90336(%rbp)
	movl	$0, -90332(%rbp)
	movl	$-1, -90328(%rbp)
	movl	$0, -90324(%rbp)
	jmp	.L2
.L23:
	leaq	-90224(%rbp), %rax
	movl	$10201, %edx
	movl	$0, %esi
	movq	%rax, %rdi
	call	memset@PLT
	leaq	-90400(%rbp), %rsi
	leaq	-90404(%rbp), %rcx
	leaq	-90408(%rbp), %rdx
	leaq	-90412(%rbp), %rax
	movq	%rsi, %r8
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	leaq	-90396(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	jmp	.L3
.L6:
	leaq	-90380(%rbp), %rsi
	leaq	-90384(%rbp), %rcx
	leaq	-90388(%rbp), %rdx
	leaq	-90392(%rbp), %rax
	movq	%rsi, %r8
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	-90388(%rbp), %eax
	sall	$2, %eax
	movl	%eax, -90368(%rbp)
	jmp	.L4
.L5:
	movl	-90392(%rbp), %ecx
	movl	-90368(%rbp), %eax
	cltq
	movl	-90272(%rbp,%rax,4), %edx
	movl	-90380(%rbp), %eax
	addl	%eax, %edx
	movl	-90368(%rbp), %eax
	cltq
	movl	-90320(%rbp,%rax,4), %esi
	movl	-90384(%rbp), %eax
	addl	%esi, %eax
	movslq	%eax, %rsi
	movslq	%edx, %rdx
	movq	%rdx, %rax
	salq	$2, %rax
	addq	%rdx, %rax
	leaq	0(,%rax,4), %rdi
	addq	%rdi, %rax
	salq	$2, %rax
	addq	%rdx, %rax
	addq	%rbp, %rax
	addq	%rsi, %rax
	subq	$90224, %rax
	movb	%cl, (%rax)
	addl	$1, -90368(%rbp)
.L4:
	movl	-90388(%rbp), %eax
	addl	$2, %eax
	sall	$2, %eax
	cmpl	%eax, -90368(%rbp)
	jl	.L5
.L3:
	movl	-90396(%rbp), %eax
	leal	-1(%rax), %edx
	movl	%edx, -90396(%rbp)
	testl	%eax, %eax
	jne	.L6
	movl	-90408(%rbp), %eax
	movl	-90412(%rbp), %edx
	movslq	%edx, %rcx
	movslq	%eax, %rdx
	movq	%rdx, %rax
	salq	$2, %rax
	addq	%rdx, %rax
	leaq	0(,%rax,4), %rsi
	addq	%rsi, %rax
	salq	$2, %rax
	addq	%rdx, %rax
	addq	%rbp, %rax
	addq	%rcx, %rax
	subq	$90224, %rax
	movzbl	(%rax), %ecx
	movl	-90400(%rbp), %eax
	movl	-90404(%rbp), %edx
	movslq	%edx, %rsi
	movslq	%eax, %rdx
	movq	%rdx, %rax
	salq	$2, %rax
	addq	%rdx, %rax
	leaq	0(,%rax,4), %rdi
	addq	%rdi, %rax
	salq	$2, %rax
	addq	%rdx, %rax
	addq	%rbp, %rax
	addq	%rsi, %rax
	subq	$90224, %rax
	movzbl	(%rax), %eax
	cmpb	%al, %cl
	je	.L7
	leaq	.LC2(%rip), %rax
	movq	%rax, %rdi
	call	puts@PLT
	jmp	.L2
.L7:
	movl	$0, -90376(%rbp)
	movl	-90412(%rbp), %edx
	movl	-90376(%rbp), %eax
	cltq
	movl	%edx, -80016(%rbp,%rax,4)
	movl	-90408(%rbp), %edx
	movl	-90376(%rbp), %eax
	cltq
	movl	%edx, -40016(%rbp,%rax,4)
	movl	-90408(%rbp), %eax
	movl	-90412(%rbp), %edx
	movslq	%edx, %rcx
	movslq	%eax, %rdx
	movq	%rdx, %rax
	salq	$2, %rax
	addq	%rdx, %rax
	leaq	0(,%rax,4), %rsi
	addq	%rsi, %rax
	salq	$2, %rax
	addq	%rdx, %rax
	addq	%rbp, %rax
	addq	%rcx, %rax
	subq	$90224, %rax
	movb	$0, (%rax)
	movl	$1, -90372(%rbp)
	jmp	.L9
.L18:
	movl	$0, -90364(%rbp)
	jmp	.L10
.L15:
	movl	-90376(%rbp), %eax
	cltq
	movl	-80016(%rbp,%rax,4), %edx
	movl	-90364(%rbp), %eax
	cltq
	movl	-90352(%rbp,%rax,4), %eax
	addl	%edx, %eax
	movl	%eax, -90360(%rbp)
	movl	-90376(%rbp), %eax
	cltq
	movl	-40016(%rbp,%rax,4), %edx
	movl	-90364(%rbp), %eax
	cltq
	movl	-90336(%rbp,%rax,4), %eax
	addl	%edx, %eax
	movl	%eax, -90356(%rbp)
	cmpl	$0, -90360(%rbp)
	jle	.L26
	movl	-90416(%rbp), %eax
	cmpl	%eax, -90360(%rbp)
	jg	.L26
	cmpl	$0, -90356(%rbp)
	jle	.L26
	movl	-90420(%rbp), %eax
	cmpl	%eax, -90356(%rbp)
	jg	.L26
	movl	-90400(%rbp), %eax
	movl	-90404(%rbp), %edx
	movslq	%edx, %rcx
	movslq	%eax, %rdx
	movq	%rdx, %rax
	salq	$2, %rax
	addq	%rdx, %rax
	leaq	0(,%rax,4), %rsi
	addq	%rsi, %rax
	salq	$2, %rax
	addq	%rdx, %rax
	addq	%rbp, %rax
	addq	%rcx, %rax
	subq	$90224, %rax
	movzbl	(%rax), %ecx
	movl	-90360(%rbp), %eax
	movslq	%eax, %rsi
	movl	-90356(%rbp), %eax
	movslq	%eax, %rdx
	movq	%rdx, %rax
	salq	$2, %rax
	addq	%rdx, %rax
	leaq	0(,%rax,4), %rdi
	addq	%rdi, %rax
	salq	$2, %rax
	addq	%rdx, %rax
	addq	%rbp, %rax
	addq	%rsi, %rax
	subq	$90224, %rax
	movzbl	(%rax), %eax
	cmpb	%al, %cl
	jne	.L13
	movl	-90372(%rbp), %eax
	cltq
	movl	-90360(%rbp), %edx
	movl	%edx, -80016(%rbp,%rax,4)
	movl	-90372(%rbp), %eax
	cltq
	movl	-90356(%rbp), %edx
	movl	%edx, -40016(%rbp,%rax,4)
	movl	-90372(%rbp), %eax
	cltq
	movl	-40016(%rbp,%rax,4), %ecx
	movl	-90372(%rbp), %eax
	leal	1(%rax), %edx
	movl	%edx, -90372(%rbp)
	cltq
	movl	-80016(%rbp,%rax,4), %eax
	movslq	%eax, %rsi
	movslq	%ecx, %rdx
	movq	%rdx, %rax
	salq	$2, %rax
	addq	%rdx, %rax
	leaq	0(,%rax,4), %rcx
	addq	%rcx, %rax
	salq	$2, %rax
	addq	%rdx, %rax
	addq	%rbp, %rax
	addq	%rsi, %rax
	subq	$90224, %rax
	movb	$0, (%rax)
	movl	-90404(%rbp), %eax
	cmpl	%eax, -90360(%rbp)
	jne	.L13
	movl	-90400(%rbp), %eax
	cmpl	%eax, -90356(%rbp)
	je	.L27
	jmp	.L13
.L26:
	nop
.L13:
	addl	$1, -90364(%rbp)
.L10:
	cmpl	$3, -90364(%rbp)
	jle	.L15
	jmp	.L14
.L27:
	nop
.L14:
	movl	-90404(%rbp), %eax
	cmpl	%eax, -90360(%rbp)
	jne	.L16
	movl	-90400(%rbp), %eax
	cmpl	%eax, -90356(%rbp)
	je	.L28
.L16:
	addl	$1, -90376(%rbp)
.L9:
	movl	-90372(%rbp), %eax
	cmpl	-90376(%rbp), %eax
	jne	.L18
	jmp	.L17
.L28:
	nop
.L17:
	movl	-90372(%rbp), %eax
	cmpl	-90376(%rbp), %eax
	je	.L19
	leaq	.LC3(%rip), %rax
	movq	%rax, %rdi
	call	puts@PLT
	jmp	.L2
.L19:
	leaq	.LC2(%rip), %rax
	movq	%rax, %rdi
	call	puts@PLT
.L2:
	leaq	-90420(%rbp), %rdx
	leaq	-90416(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC4(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	-90416(%rbp), %eax
	testl	%eax, %eax
	jne	.L20
	movl	-90420(%rbp), %eax
	testl	%eax, %eax
	je	.L21
.L20:
	movl	$1, %eax
	jmp	.L22
.L21:
	movl	$0, %eax
.L22:
	testl	%eax, %eax
	jne	.L23
	movl	$0, %eax
	movq	-8(%rbp), %rdx
	subq	%fs:40, %rdx
	je	.L25
	call	__stack_chk_fail@PLT
.L25:
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE0:
	.size	main, .-main
	.ident	"GCC: (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0"
	.section	.note.GNU-stack,"",@progbits
	.section	.note.gnu.property,"a"
	.align 8
	.long	1f - 0f
	.long	4f - 1f
	.long	5
0:
	.string	"GNU"
1:
	.align 8
	.long	0xc0000002
	.long	3f - 2f
2:
	.long	0x3
3:
	.align 8
4:
```

Only output the optimized assembly code. Do not include any other text. Do not write any comments in the assembly code. Wrap the assembly code in ```assembly``` tags.
train
	.file	"temp.c"
	.text
	.section	.rodata
.LC0:
	.string	"%d %d %d %d"
.LC1:
	.string	"%d"
.LC2:
	.string	"NG"
.LC3:
	.string	"OK"
.LC4:
	.string	"%d %d"
	.text
	.globl	main
	.type	main, @function
main:
.LFB0:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	leaq	-90112(%rsp), %r11
.LPSRL0:
	subq	$4096, %rsp
	orq	$0, (%rsp)
	cmpq	%r11, %rsp
	jne	.LPSRL0
	subq	$320, %rsp
	movq	%fs:40, %rax
	movq	%rax, -8(%rbp)
	xorl	%eax, %eax
	movl	$2, -90320(%rbp)
	movl	$2, -90316(%rbp)
	movl	$3, -90312(%rbp)
	movl	$3, -90308(%rbp)
	movl	$0, -90304(%rbp)
	movl	$0, -90300(%rbp)
	movl	$1, -90296(%rbp)
	movl	$1, -90292(%rbp)
	movl	$0, -90288(%rbp)
	movl	$1, -90284(%rbp)
	movl	$0, -90280(%rbp)
	movl	$1, -90276(%rbp)
	movl	$0, -90272(%rbp)
	movl	$1, -90268(%rbp)
	movl	$0, -90264(%rbp)
	movl	$1, -90260(%rbp)
	movl	$0, -90256(%rbp)
	movl	$1, -90252(%rbp)
	movl	$0, -90248(%rbp)
	movl	$1, -90244(%rbp)
	movl	$2, -90240(%rbp)
	movl	$2, -90236(%rbp)
	movl	$3, -90232(%rbp)
	movl	$3, -90228(%rbp)
	movl	$0, -90352(%rbp)
	movl	$1, -90348(%rbp)
	movl	$0, -90344(%rbp)
	movl	$-1, -90340(%rbp)
	movl	$1, -90336(%rbp)
	movl	$0, -90332(%rbp)
	movl	$-1, -90328(%rbp)
	movl	$0, -90324(%rbp)
	jmp	.L2
.L23:
	leaq	-90224(%rbp), %rax
	movl	$10201, %edx
	movl	$0, %esi
	movq	%rax, %rdi
	call	memset@PLT
	leaq	-90400(%rbp), %rsi
	leaq	-90404(%rbp), %rcx
	leaq	-90408(%rbp), %rdx
	leaq	-90412(%rbp), %rax
	movq	%rsi, %r8
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	leaq	-90396(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	jmp	.L3
.L6:
	leaq	-90380(%rbp), %rsi
	leaq	-90384(%rbp), %rcx
	leaq	-90388(%rbp), %rdx
	leaq	-90392(%rbp), %rax
	movq	%rsi, %r8
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	-90388(%rbp), %eax
	sall	$2, %eax
	movl	%eax, -90368(%rbp)
	jmp	.L4
.L5:
	movl	-90392(%rbp), %ecx
	movl	-90368(%rbp), %eax
	cltq
	movl	-90272(%rbp,%rax,4), %edx
	movl	-90380(%rbp), %eax
	addl	%eax, %edx
	movl	-90368(%rbp), %eax
	cltq
	movl	-90320(%rbp,%rax,4), %esi
	movl	-90384(%rbp), %eax
	addl	%esi, %eax
	movslq	%eax, %rsi
	movslq	%edx, %rdx
	movq	%rdx, %rax
	salq	$2, %rax
	addq	%rdx, %rax
	leaq	0(,%rax,4), %rdi
	addq	%rdi, %rax
	salq	$2, %rax
	addq	%rdx, %rax
	addq	%rbp, %rax
	addq	%rsi, %rax
	subq	$90224, %rax
	movb	%cl, (%rax)
	addl	$1, -90368(%rbp)
.L4:
	movl	-90388(%rbp), %eax
	addl	$2, %eax
	sall	$2, %eax
	cmpl	%eax, -90368(%rbp)
	jl	.L5
.L3:
	movl	-90396(%rbp), %eax
	leal	-1(%rax), %edx
	movl	%edx, -90396(%rbp)
	testl	%eax, %eax
	jne	.L6
	movl	-90408(%rbp), %eax
	movl	-90412(%rbp), %edx
	movslq	%edx, %rcx
	movslq	%eax, %rdx
	movq	%rdx, %rax
	salq	$2, %rax
	addq	%rdx, %rax
	leaq	0(,%rax,4), %rsi
	addq	%rsi, %rax
	salq	$2, %rax
	addq	%rdx, %rax
	addq	%rbp, %rax
	addq	%rcx, %rax
	subq	$90224, %rax
	movzbl	(%rax), %ecx
	movl	-90400(%rbp), %eax
	movl	-90404(%rbp), %edx
	movslq	%edx, %rsi
	movslq	%eax, %rdx
	movq	%rdx, %rax
	salq	$2, %rax
	addq	%rdx, %rax
	leaq	0(,%rax,4), %rdi
	addq	%rdi, %rax
	salq	$2, %rax
	addq	%rdx, %rax
	addq	%rbp, %rax
	addq	%rsi, %rax
	subq	$90224, %rax
	movzbl	(%rax), %eax
	cmpb	%al, %cl
	je	.L7
	leaq	.LC2(%rip), %rax
	movq	%rax, %rdi
	call	puts@PLT
	jmp	.L2
.L7:
	movl	$0, -90376(%rbp)
	movl	-90412(%rbp), %edx
	movl	-90376(%rbp), %eax
	cltq
	movl	%edx, -80016(%rbp,%rax,4)
	movl	-90408(%rbp), %edx
	movl	-90376(%rbp), %eax
	cltq
	movl	%edx, -40016(%rbp,%rax,4)
	movl	-90408(%rbp), %eax
	movl	-90412(%rbp), %edx
	movslq	%edx, %rcx
	movslq	%eax, %rdx
	movq	%rdx, %rax
	salq	$2, %rax
	addq	%rdx, %rax
	leaq	0(,%rax,4), %rsi
	addq	%rsi, %rax
	salq	$2, %rax
	addq	%rdx, %rax
	addq	%rbp, %rax
	addq	%rcx, %rax
	subq	$90224, %rax
	movb	$0, (%rax)
	movl	$1, -90372(%rbp)
	jmp	.L9
.L18:
	movl	$0, -90364(%rbp)
	jmp	.L10
.L15:
	movl	-90376(%rbp), %eax
	cltq
	movl	-80016(%rbp,%rax,4), %edx
	movl	-90364(%rbp), %eax
	cltq
	movl	-90352(%rbp,%rax,4), %eax
	addl	%edx, %eax
	movl	%eax, -90360(%rbp)
	movl	-90376(%rbp), %eax
	cltq
	movl	-40016(%rbp,%rax,4), %edx
	movl	-90364(%rbp), %eax
	cltq
	movl	-90336(%rbp,%rax,4), %eax
	addl	%edx, %eax
	movl	%eax, -90356(%rbp)
	cmpl	$0, -90360(%rbp)
	jle	.L26
	movl	-90416(%rbp), %eax
	cmpl	%eax, -90360(%rbp)
	jg	.L26
	cmpl	$0, -90356(%rbp)
	jle	.L26
	movl	-90420(%rbp), %eax
	cmpl	%eax, -90356(%rbp)
	jg	.L26
	movl	-90400(%rbp), %eax
	movl	-90404(%rbp), %edx
	movslq	%edx, %rcx
	movslq	%eax, %rdx
	movq	%rdx, %rax
	salq	$2, %rax
	addq	%rdx, %rax
	leaq	0(,%rax,4), %rsi
	addq	%rsi, %rax
	salq	$2, %rax
	addq	%rdx, %rax
	addq	%rbp, %rax
	addq	%rcx, %rax
	subq	$90224, %rax
	movzbl	(%rax), %ecx
	movl	-90360(%rbp), %eax
	movslq	%eax, %rsi
	movl	-90356(%rbp), %eax
	movslq	%eax, %rdx
	movq	%rdx, %rax
	salq	$2, %rax
	addq	%rdx, %rax
	leaq	0(,%rax,4), %rdi
	addq	%rdi, %rax
	salq	$2, %rax
	addq	%rdx, %rax
	addq	%rbp, %rax
	addq	%rsi, %rax
	subq	$90224, %rax
	movzbl	(%rax), %eax
	cmpb	%al, %cl
	jne	.L13
	movl	-90372(%rbp), %eax
	cltq
	movl	-90360(%rbp), %edx
	movl	%edx, -80016(%rbp,%rax,4)
	movl	-90372(%rbp), %eax
	cltq
	movl	-90356(%rbp), %edx
	movl	%edx, -40016(%rbp,%rax,4)
	movl	-90372(%rbp), %eax
	cltq
	movl	-40016(%rbp,%rax,4), %ecx
	movl	-90372(%rbp), %eax
	leal	1(%rax), %edx
	movl	%edx, -90372(%rbp)
	cltq
	movl	-80016(%rbp,%rax,4), %eax
	movslq	%eax, %rsi
	movslq	%ecx, %rdx
	movq	%rdx, %rax
	salq	$2, %rax
	addq	%rdx, %rax
	leaq	0(,%rax,4), %rcx
	addq	%rcx, %rax
	salq	$2, %rax
	addq	%rdx, %rax
	addq	%rbp, %rax
	addq	%rsi, %rax
	subq	$90224, %rax
	movb	$0, (%rax)
	movl	-90404(%rbp), %eax
	cmpl	%eax, -90360(%rbp)
	jne	.L13
	movl	-90400(%rbp), %eax
	cmpl	%eax, -90356(%rbp)
	je	.L27
	jmp	.L13
.L26:
	nop
.L13:
	addl	$1, -90364(%rbp)
.L10:
	cmpl	$3, -90364(%rbp)
	jle	.L15
	jmp	.L14
.L27:
	nop
.L14:
	movl	-90404(%rbp), %eax
	cmpl	%eax, -90360(%rbp)
	jne	.L16
	movl	-90400(%rbp), %eax
	cmpl	%eax, -90356(%rbp)
	je	.L28
.L16:
	addl	$1, -90376(%rbp)
.L9:
	movl	-90372(%rbp), %eax
	cmpl	-90376(%rbp), %eax
	jne	.L18
	jmp	.L17
.L28:
	nop
.L17:
	movl	-90372(%rbp), %eax
	cmpl	-90376(%rbp), %eax
	je	.L19
	leaq	.LC3(%rip), %rax
	movq	%rax, %rdi
	call	puts@PLT
	jmp	.L2
.L19:
	leaq	.LC2(%rip), %rax
	movq	%rax, %rdi
	call	puts@PLT
.L2:
	leaq	-90420(%rbp), %rdx
	leaq	-90416(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC4(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	-90416(%rbp), %eax
	testl	%eax, %eax
	jne	.L20
	movl	-90420(%rbp), %eax
	testl	%eax, %eax
	je	.L21
.L20:
	movl	$1, %eax
	jmp	.L22
.L21:
	movl	$0, %eax
.L22:
	testl	%eax, %eax
	jne	.L23
	movl	$0, %eax
	movq	-8(%rbp), %rdx
	subq	%fs:40, %rdx
	je	.L25
	call	__stack_chk_fail@PLT
.L25:
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE0:
	.size	main, .-main
	.ident	"GCC: (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0"
	.section	.note.GNU-stack,"",@progbits
	.section	.note.gnu.property,"a"
	.align 8
	.long	1f - 0f
	.long	4f - 1f
	.long	5
0:
	.string	"GNU"
1:
	.align 8
	.long	0xc0000002
	.long	3f - 2f
2:
	.long	0x3
3:
	.align 8
4:
