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 chk(int);

int main(void){
   int x,y,xg,yg;
   scanf("%d%d",&x,&y);

   xg = chk(x); yg = chk(y);
   if(xg==yg){
      printf("Yes\n");
   } else {
      printf("No\n");
   }

   return 0;
}

int chk(int n){
   int g;
   if(n==2) return 2;
   if (n<8){
      if(n%2==1){ g=0;
      } else { g=1;}
   } else {
      if(n%2==0){g=0;
      } else { g=1;}
   }

   return g; 
}   ```

Unoptimized Assembly Code:

```assembly
	.file	"temp.c"
	.text
	.section	.rodata
.LC0:
	.string	"%d%d"
.LC1:
	.string	"Yes"
.LC2:
	.string	"No"
	.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	$32, %rsp
	movq	%fs:40, %rax
	movq	%rax, -8(%rbp)
	xorl	%eax, %eax
	leaq	-20(%rbp), %rdx
	leaq	-24(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	-24(%rbp), %eax
	movl	%eax, %edi
	call	chk
	movl	%eax, -16(%rbp)
	movl	-20(%rbp), %eax
	movl	%eax, %edi
	call	chk
	movl	%eax, -12(%rbp)
	movl	-16(%rbp), %eax
	cmpl	-12(%rbp), %eax
	jne	.L2
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	call	puts@PLT
	jmp	.L3
.L2:
	leaq	.LC2(%rip), %rax
	movq	%rax, %rdi
	call	puts@PLT
.L3:
	movl	$0, %eax
	movq	-8(%rbp), %rdx
	subq	%fs:40, %rdx
	je	.L5
	call	__stack_chk_fail@PLT
.L5:
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE0:
	.size	main, .-main
	.globl	chk
	.type	chk, @function
chk:
.LFB1:
	.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)
	cmpl	$2, -20(%rbp)
	jne	.L7
	movl	$2, %eax
	jmp	.L8
.L7:
	cmpl	$7, -20(%rbp)
	jg	.L9
	movl	-20(%rbp), %eax
	cltd
	shrl	$31, %edx
	addl	%edx, %eax
	andl	$1, %eax
	subl	%edx, %eax
	cmpl	$1, %eax
	jne	.L10
	movl	$0, -4(%rbp)
	jmp	.L11
.L10:
	movl	$1, -4(%rbp)
	jmp	.L11
.L9:
	movl	-20(%rbp), %eax
	andl	$1, %eax
	testl	%eax, %eax
	jne	.L12
	movl	$0, -4(%rbp)
	jmp	.L11
.L12:
	movl	$1, -4(%rbp)
.L11:
	movl	-4(%rbp), %eax
.L8:
	popq	%rbp
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE1:
	.size	chk, .-chk
	.ident	"GCC: (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0"
	.section	.note.GNU-stack,"",@progbits
	.section	.note.gnu.property,"a"
	.align 8
	.long	1f - 0f
	.long	4f - 1f
	.long	5
0:
	.string	"GNU"
1:
	.align 8
	.long	0xc0000002
	.long	3f - 2f
2:
	.long	0x3
3:
	.align 8
4:
```

Only output the optimized assembly code. Do not include any other text. Do not write any comments in the assembly code. Wrap the assembly code in ```assembly``` tags.
user
	.file	"temp.c"
	.text
	.section	.rodata.str1.1,"aMS",@progbits,1
.LC0:
	.string	"%d%d"
.LC1:
	.string	"Yes"
.LC2:
	.string	"No"
	.section	.text.startup,"ax",@progbits
	.p2align 4
	.globl	main
	.type	main, @function
main:
.LFB23:
	.cfi_startproc
	endbr64
	subq	$24, %rsp
	.cfi_def_cfa_offset 32
	leaq	.LC0(%rip), %rdi
	movq	%fs:40, %rax
	movq	%rax, 8(%rsp)
	xorl	%eax, %eax
	leaq	4(%rsp), %rdx
	movq	%rsp, %rsi
	call	__isoc99_scanf@PLT
	movl	(%rsp), %ecx
	cmpl	$2, %ecx
	je	.L2
	cmpl	$7, %ecx
	jle	.L21
	andl	$1, %ecx
.L4:
	movl	4(%rsp), %eax
	cmpl	$2, %eax
	je	.L7
.L10:
	movl	%eax, %edx
	andl	$1, %edx
	cmpl	$7, %eax
	jg	.L6
	cltd
	movl	$2, %esi
	idivl	%esi
	subl	$1, %edx
	setne	%dl
	movzbl	%dl, %edx
.L6:
	cmpl	%ecx, %edx
	je	.L9
.L7:
	leaq	.LC2(%rip), %rdi
	call	puts@PLT
.L8:
	movq	8(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L22
	xorl	%eax, %eax
	addq	$24, %rsp
	.cfi_remember_state
	.cfi_def_cfa_offset 8
	ret
.L21:
	.cfi_restore_state
	movl	%ecx, %eax
	movl	$2, %esi
	xorl	%ecx, %ecx
	cltd
	idivl	%esi
	subl	$1, %edx
	setne	%cl
	jmp	.L4
.L2:
	movl	4(%rsp), %eax
	cmpl	$2, %eax
	jne	.L10
.L9:
	leaq	.LC1(%rip), %rdi
	call	puts@PLT
	jmp	.L8
.L22:
	call	__stack_chk_fail@PLT
	.cfi_endproc
.LFE23:
	.size	main, .-main
	.text
	.p2align 4
	.globl	chk
	.type	chk, @function
chk:
.LFB24:
	.cfi_startproc
	endbr64
	cmpl	$2, %edi
	je	.L26
	movl	%edi, %eax
	andl	$1, %eax
	cmpl	$7, %edi
	jg	.L23
	movl	%edi, %eax
	shrl	$31, %eax
	addl	%eax, %edi
	andl	$1, %edi
	subl	%eax, %edi
	xorl	%eax, %eax
	cmpl	$1, %edi
	setne	%al
	ret
	.p2align 4,,10
	.p2align 3
.L26:
	movl	$2, %eax
.L23:
	ret
	.cfi_endproc
.LFE24:
	.size	chk, .-chk
	.ident	"GCC: (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0"
	.section	.note.GNU-stack,"",@progbits
	.section	.note.gnu.property,"a"
	.align 8
	.long	1f - 0f
	.long	4f - 1f
	.long	5
0:
	.string	"GNU"
1:
	.align 8
	.long	0xc0000002
	.long	3f - 2f
2:
	.long	0x3
3:
	.align 8
4:

rule
	.file	"temp.c"
	.text
	.section	.rodata.str1.1,"aMS",@progbits,1
.LC0:
	.string	"%d%d"
.LC1:
	.string	"Yes"
.LC2:
	.string	"No"
	.section	.text.startup,"ax",@progbits
	.p2align 4
	.globl	main
	.type	main, @function
main:
.LFB23:
	.cfi_startproc
	endbr64
	subq	$24, %rsp
	.cfi_def_cfa_offset 32
	leaq	.LC0(%rip), %rdi
	movq	%fs:40, %rax
	movq	%rax, 8(%rsp)
	xorl	%eax, %eax
	leaq	4(%rsp), %rdx
	movq	%rsp, %rsi
	call	__isoc99_scanf@PLT
	movl	(%rsp), %ecx
	cmpl	$2, %ecx
	je	.L2
	cmpl	$7, %ecx
	jle	.L21
	andl	$1, %ecx
.L4:
	movl	4(%rsp), %eax
	cmpl	$2, %eax
	je	.L7
.L10:
	movl	%eax, %edx
	andl	$1, %edx
	cmpl	$7, %eax
	jg	.L6
	cltd
	movl	$2, %esi
	idivl	%esi
	subl	$1, %edx
	setne	%dl
	movzbl	%dl, %edx
.L6:
	cmpl	%ecx, %edx
	je	.L9
.L7:
	leaq	.LC2(%rip), %rdi
	call	puts@PLT
.L8:
	movq	8(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L22
	xorl	%eax, %eax
	addq	$24, %rsp
	.cfi_remember_state
	.cfi_def_cfa_offset 8
	ret
.L21:
	.cfi_restore_state
	movl	%ecx, %eax
	movl	$2, %esi
	xorl	%ecx, %ecx
	cltd
	idivl	%esi
	subl	$1, %edx
	setne	%cl
	jmp	.L4
.L2:
	movl	4(%rsp), %eax
	cmpl	$2, %eax
	jne	.L10
.L9:
	leaq	.LC1(%rip), %rdi
	call	puts@PLT
	jmp	.L8
.L22:
	call	__stack_chk_fail@PLT
	.cfi_endproc
.LFE23:
	.size	main, .-main
	.text
	.p2align 4
	.globl	chk
	.type	chk, @function
chk:
.LFB24:
	.cfi_startproc
	endbr64
	cmpl	$2, %edi
	je	.L26
	movl	%edi, %eax
	andl	$1, %eax
	cmpl	$7, %edi
	jg	.L23
	movl	%edi, %eax
	shrl	$31, %eax
	addl	%eax, %edi
	andl	$1, %edi
	subl	%eax, %edi
	xorl	%eax, %eax
	cmpl	$1, %edi
	setne	%al
	ret
	.p2align 4,,10
	.p2align 3
.L26:
	movl	$2, %eax
.L23:
	ret
	.cfi_endproc
.LFE24:
	.size	chk, .-chk
	.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 chk(int);

int main(void){
   int x,y,xg,yg;
   scanf("%d%d",&x,&y);

   xg = chk(x); yg = chk(y);
   if(xg==yg){
      printf("Yes\n");
   } else {
      printf("No\n");
   }

   return 0;
}

int chk(int n){
   int g;
   if(n==2) return 2;
   if (n<8){
      if(n%2==1){ g=0;
      } else { g=1;}
   } else {
      if(n%2==0){g=0;
      } else { g=1;}
   }

   return g; 
}   
2 8
 1 10
 1 4
 2 3
 2 10
 4 3
 7 3
 7 6
 7 4
 7 5

No
 Yes
 No
 No
 No
 No
 Yes
 No
 No
 Yes

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 chk(int);

int main(void){
   int x,y,xg,yg;
   scanf("%d%d",&x,&y);

   xg = chk(x); yg = chk(y);
   if(xg==yg){
      printf("Yes\n");
   } else {
      printf("No\n");
   }

   return 0;
}

int chk(int n){
   int g;
   if(n==2) return 2;
   if (n<8){
      if(n%2==1){ g=0;
      } else { g=1;}
   } else {
      if(n%2==0){g=0;
      } else { g=1;}
   }

   return g; 
}   ```

Unoptimized Assembly Code:

```assembly
	.file	"temp.c"
	.text
	.section	.rodata
.LC0:
	.string	"%d%d"
.LC1:
	.string	"Yes"
.LC2:
	.string	"No"
	.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	$32, %rsp
	movq	%fs:40, %rax
	movq	%rax, -8(%rbp)
	xorl	%eax, %eax
	leaq	-20(%rbp), %rdx
	leaq	-24(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	-24(%rbp), %eax
	movl	%eax, %edi
	call	chk
	movl	%eax, -16(%rbp)
	movl	-20(%rbp), %eax
	movl	%eax, %edi
	call	chk
	movl	%eax, -12(%rbp)
	movl	-16(%rbp), %eax
	cmpl	-12(%rbp), %eax
	jne	.L2
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	call	puts@PLT
	jmp	.L3
.L2:
	leaq	.LC2(%rip), %rax
	movq	%rax, %rdi
	call	puts@PLT
.L3:
	movl	$0, %eax
	movq	-8(%rbp), %rdx
	subq	%fs:40, %rdx
	je	.L5
	call	__stack_chk_fail@PLT
.L5:
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE0:
	.size	main, .-main
	.globl	chk
	.type	chk, @function
chk:
.LFB1:
	.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)
	cmpl	$2, -20(%rbp)
	jne	.L7
	movl	$2, %eax
	jmp	.L8
.L7:
	cmpl	$7, -20(%rbp)
	jg	.L9
	movl	-20(%rbp), %eax
	cltd
	shrl	$31, %edx
	addl	%edx, %eax
	andl	$1, %eax
	subl	%edx, %eax
	cmpl	$1, %eax
	jne	.L10
	movl	$0, -4(%rbp)
	jmp	.L11
.L10:
	movl	$1, -4(%rbp)
	jmp	.L11
.L9:
	movl	-20(%rbp), %eax
	andl	$1, %eax
	testl	%eax, %eax
	jne	.L12
	movl	$0, -4(%rbp)
	jmp	.L11
.L12:
	movl	$1, -4(%rbp)
.L11:
	movl	-4(%rbp), %eax
.L8:
	popq	%rbp
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE1:
	.size	chk, .-chk
	.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"
.LC1:
	.string	"Yes"
.LC2:
	.string	"No"
	.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	$32, %rsp
	movq	%fs:40, %rax
	movq	%rax, -8(%rbp)
	xorl	%eax, %eax
	leaq	-20(%rbp), %rdx
	leaq	-24(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	-24(%rbp), %eax
	movl	%eax, %edi
	call	chk
	movl	%eax, -16(%rbp)
	movl	-20(%rbp), %eax
	movl	%eax, %edi
	call	chk
	movl	%eax, -12(%rbp)
	movl	-16(%rbp), %eax
	cmpl	-12(%rbp), %eax
	jne	.L2
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	call	puts@PLT
	jmp	.L3
.L2:
	leaq	.LC2(%rip), %rax
	movq	%rax, %rdi
	call	puts@PLT
.L3:
	movl	$0, %eax
	movq	-8(%rbp), %rdx
	subq	%fs:40, %rdx
	je	.L5
	call	__stack_chk_fail@PLT
.L5:
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE0:
	.size	main, .-main
	.globl	chk
	.type	chk, @function
chk:
.LFB1:
	.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)
	cmpl	$2, -20(%rbp)
	jne	.L7
	movl	$2, %eax
	jmp	.L8
.L7:
	cmpl	$7, -20(%rbp)
	jg	.L9
	movl	-20(%rbp), %eax
	cltd
	shrl	$31, %edx
	addl	%edx, %eax
	andl	$1, %eax
	subl	%edx, %eax
	cmpl	$1, %eax
	jne	.L10
	movl	$0, -4(%rbp)
	jmp	.L11
.L10:
	movl	$1, -4(%rbp)
	jmp	.L11
.L9:
	movl	-20(%rbp), %eax
	andl	$1, %eax
	testl	%eax, %eax
	jne	.L12
	movl	$0, -4(%rbp)
	jmp	.L11
.L12:
	movl	$1, -4(%rbp)
.L11:
	movl	-4(%rbp), %eax
.L8:
	popq	%rbp
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE1:
	.size	chk, .-chk
	.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:
