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(void){
  int x,y;
  int a,i;
  int max,min;
  int result,flag;
  
  while(scanf("%d%d",&x,&y)!=EOF){
    flag=0;
    if(x>y){
      max=x;
      min=y;
    }
    else{
      max=y;
      min=x;
    }
    for(i=1;i<=max;i++){
      if(max%i==0){
	a=max/i;
	if(min%a==0){
	  result=a;
	  flag++;
	  break;
	}
	else{
	  if(a*min==max && i!=1){
	    if(a<min)
	      result=a;
	    else
	      result=min;
	    flag++;
	  }
	}
      }
    }
    if(flag==0)
      result=1;
    printf("%d\n",result);
  }
  return(0);
}```

Unoptimized Assembly Code:

```assembly
	.file	"temp.c"
	.text
	.section	.rodata
.LC0:
	.string	"%d\n"
.LC1:
	.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
	subq	$48, %rsp
	movq	%fs:40, %rax
	movq	%rax, -8(%rbp)
	xorl	%eax, %eax
	jmp	.L2
.L13:
	movl	$0, -16(%rbp)
	movl	-40(%rbp), %edx
	movl	-36(%rbp), %eax
	cmpl	%eax, %edx
	jle	.L3
	movl	-40(%rbp), %eax
	movl	%eax, -28(%rbp)
	movl	-36(%rbp), %eax
	movl	%eax, -24(%rbp)
	jmp	.L4
.L3:
	movl	-36(%rbp), %eax
	movl	%eax, -28(%rbp)
	movl	-40(%rbp), %eax
	movl	%eax, -24(%rbp)
.L4:
	movl	$1, -32(%rbp)
	jmp	.L5
.L11:
	movl	-28(%rbp), %eax
	cltd
	idivl	-32(%rbp)
	movl	%edx, %eax
	testl	%eax, %eax
	jne	.L6
	movl	-28(%rbp), %eax
	cltd
	idivl	-32(%rbp)
	movl	%eax, -12(%rbp)
	movl	-24(%rbp), %eax
	cltd
	idivl	-12(%rbp)
	movl	%edx, %eax
	testl	%eax, %eax
	jne	.L7
	movl	-12(%rbp), %eax
	movl	%eax, -20(%rbp)
	addl	$1, -16(%rbp)
	jmp	.L8
.L7:
	movl	-12(%rbp), %eax
	imull	-24(%rbp), %eax
	cmpl	%eax, -28(%rbp)
	jne	.L6
	cmpl	$1, -32(%rbp)
	je	.L6
	movl	-12(%rbp), %eax
	cmpl	-24(%rbp), %eax
	jge	.L9
	movl	-12(%rbp), %eax
	movl	%eax, -20(%rbp)
	jmp	.L10
.L9:
	movl	-24(%rbp), %eax
	movl	%eax, -20(%rbp)
.L10:
	addl	$1, -16(%rbp)
.L6:
	addl	$1, -32(%rbp)
.L5:
	movl	-32(%rbp), %eax
	cmpl	-28(%rbp), %eax
	jle	.L11
.L8:
	cmpl	$0, -16(%rbp)
	jne	.L12
	movl	$1, -20(%rbp)
.L12:
	movl	-20(%rbp), %eax
	movl	%eax, %esi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
.L2:
	leaq	-36(%rbp), %rdx
	leaq	-40(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	cmpl	$-1, %eax
	jne	.L13
	movl	$0, %eax
	movq	-8(%rbp), %rdx
	subq	%fs:40, %rdx
	je	.L15
	call	__stack_chk_fail@PLT
.L15:
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE0:
	.size	main, .-main
	.ident	"GCC: (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0"
	.section	.note.GNU-stack,"",@progbits
	.section	.note.gnu.property,"a"
	.align 8
	.long	1f - 0f
	.long	4f - 1f
	.long	5
0:
	.string	"GNU"
1:
	.align 8
	.long	0xc0000002
	.long	3f - 2f
2:
	.long	0x3
3:
	.align 8
4:
```

Only output the optimized assembly code. Do not include any other text. Do not write any comments in the assembly code. Wrap the assembly code in ```assembly``` tags.
user
	.file	"temp.c"
	.text
	.section	.rodata.str1.1,"aMS",@progbits,1
.LC0:
	.string	"%d\n"
.LC1:
	.string	"%d%d"
	.section	.text.startup,"ax",@progbits
	.p2align 4
	.globl	main
	.type	main, @function
main:
.LFB23:
	.cfi_startproc
	endbr64
	pushq	%r14
	.cfi_def_cfa_offset 16
	.cfi_offset 14, -16
	pushq	%r13
	.cfi_def_cfa_offset 24
	.cfi_offset 13, -24
	leaq	.LC0(%rip), %r13
	pushq	%r12
	.cfi_def_cfa_offset 32
	.cfi_offset 12, -32
	pushq	%rbp
	.cfi_def_cfa_offset 40
	.cfi_offset 6, -40
	pushq	%rbx
	.cfi_def_cfa_offset 48
	.cfi_offset 3, -48
	leaq	.LC1(%rip), %rbx
	subq	$16, %rsp
	.cfi_def_cfa_offset 64
	movq	%fs:40, %rax
	movq	%rax, 8(%rsp)
	xorl	%eax, %eax
	leaq	4(%rsp), %r12
	movq	%rsp, %rbp
	.p2align 4,,10
	.p2align 3
.L2:
	xorl	%eax, %eax
	movq	%r12, %rdx
	movq	%rbp, %rsi
	movq	%rbx, %rdi
	call	__isoc99_scanf@PLT
	cmpl	$-1, %eax
	je	.L21
	movl	(%rsp), %esi
	movl	4(%rsp), %r8d
	cmpl	%r8d, %esi
	jg	.L3
	movl	%esi, %eax
	movl	%r8d, %esi
	movl	%eax, %r8d
.L3:
	testl	%esi, %esi
	jle	.L9
	xorl	%r9d, %r9d
	movl	$1, %ecx
	.p2align 4,,10
	.p2align 3
.L6:
	movl	%esi, %eax
	cltd
	idivl	%ecx
	movl	%eax, %edi
	testl	%edx, %edx
	jne	.L5
	movl	%r8d, %eax
	cltd
	idivl	%edi
	testl	%edx, %edx
	je	.L10
	movl	%r8d, %eax
	imull	%edi, %eax
	cmpl	%esi, %eax
	jne	.L5
	cmpl	$1, %ecx
	je	.L5
	cmpl	%edi, %r8d
	cmovle	%r8d, %edi
	addl	$1, %r9d
	movl	%edi, %r14d
	.p2align 4,,10
	.p2align 3
.L5:
	addl	$1, %ecx
	cmpl	%ecx, %esi
	jge	.L6
	testl	%r9d, %r9d
	movl	$1, %eax
	cmove	%eax, %r14d
.L4:
	movl	%r14d, %edx
	movq	%r13, %rsi
	movl	$1, %edi
	xorl	%eax, %eax
	call	__printf_chk@PLT
	jmp	.L2
	.p2align 4,,10
	.p2align 3
.L10:
	movl	%edi, %r14d
	jmp	.L4
	.p2align 4,,10
	.p2align 3
.L21:
	movq	8(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L22
	addq	$16, %rsp
	.cfi_remember_state
	.cfi_def_cfa_offset 48
	xorl	%eax, %eax
	popq	%rbx
	.cfi_def_cfa_offset 40
	popq	%rbp
	.cfi_def_cfa_offset 32
	popq	%r12
	.cfi_def_cfa_offset 24
	popq	%r13
	.cfi_def_cfa_offset 16
	popq	%r14
	.cfi_def_cfa_offset 8
	ret
.L9:
	.cfi_restore_state
	movl	$1, %r14d
	jmp	.L4
.L22:
	call	__stack_chk_fail@PLT
	.cfi_endproc
.LFE23:
	.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:

rule
	.file	"temp.c"
	.text
	.section	.rodata.str1.1,"aMS",@progbits,1
.LC0:
	.string	"%d\n"
.LC1:
	.string	"%d%d"
	.section	.text.startup,"ax",@progbits
	.p2align 4
	.globl	main
	.type	main, @function
main:
.LFB23:
	.cfi_startproc
	endbr64
	pushq	%r14
	.cfi_def_cfa_offset 16
	.cfi_offset 14, -16
	pushq	%r13
	.cfi_def_cfa_offset 24
	.cfi_offset 13, -24
	leaq	.LC0(%rip), %r13
	pushq	%r12
	.cfi_def_cfa_offset 32
	.cfi_offset 12, -32
	pushq	%rbp
	.cfi_def_cfa_offset 40
	.cfi_offset 6, -40
	pushq	%rbx
	.cfi_def_cfa_offset 48
	.cfi_offset 3, -48
	leaq	.LC1(%rip), %rbx
	subq	$16, %rsp
	.cfi_def_cfa_offset 64
	movq	%fs:40, %rax
	movq	%rax, 8(%rsp)
	xorl	%eax, %eax
	leaq	4(%rsp), %r12
	movq	%rsp, %rbp
	.p2align 4,,10
	.p2align 3
.L2:
	xorl	%eax, %eax
	movq	%r12, %rdx
	movq	%rbp, %rsi
	movq	%rbx, %rdi
	call	__isoc99_scanf@PLT
	cmpl	$-1, %eax
	je	.L21
	movl	(%rsp), %esi
	movl	4(%rsp), %r8d
	cmpl	%r8d, %esi
	jg	.L3
	movl	%esi, %eax
	movl	%r8d, %esi
	movl	%eax, %r8d
.L3:
	testl	%esi, %esi
	jle	.L9
	xorl	%r9d, %r9d
	movl	$1, %ecx
	.p2align 4,,10
	.p2align 3
.L6:
	movl	%esi, %eax
	cltd
	idivl	%ecx
	movl	%eax, %edi
	testl	%edx, %edx
	jne	.L5
	movl	%r8d, %eax
	cltd
	idivl	%edi
	testl	%edx, %edx
	je	.L10
	movl	%r8d, %eax
	imull	%edi, %eax
	cmpl	%esi, %eax
	jne	.L5
	cmpl	$1, %ecx
	je	.L5
	cmpl	%edi, %r8d
	cmovle	%r8d, %edi
	addl	$1, %r9d
	movl	%edi, %r14d
	.p2align 4,,10
	.p2align 3
.L5:
	addl	$1, %ecx
	cmpl	%ecx, %esi
	jge	.L6
	testl	%r9d, %r9d
	movl	$1, %eax
	cmove	%eax, %r14d
.L4:
	movl	%r14d, %edx
	movq	%r13, %rsi
	movl	$1, %edi
	xorl	%eax, %eax
	call	__printf_chk@PLT
	jmp	.L2
	.p2align 4,,10
	.p2align 3
.L10:
	movl	%edi, %r14d
	jmp	.L4
	.p2align 4,,10
	.p2align 3
.L21:
	movq	8(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L22
	addq	$16, %rsp
	.cfi_remember_state
	.cfi_def_cfa_offset 48
	xorl	%eax, %eax
	popq	%rbx
	.cfi_def_cfa_offset 40
	popq	%rbp
	.cfi_def_cfa_offset 32
	popq	%r12
	.cfi_def_cfa_offset 24
	popq	%r13
	.cfi_def_cfa_offset 16
	popq	%r14
	.cfi_def_cfa_offset 8
	ret
.L9:
	.cfi_restore_state
	movl	$1, %r14d
	jmp	.L4
.L22:
	call	__stack_chk_fail@PLT
	.cfi_endproc
.LFE23:
	.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:

#include<stdio.h>

int main(void){
  int x,y;
  int a,i;
  int max,min;
  int result,flag;
  
  while(scanf("%d%d",&x,&y)!=EOF){
    flag=0;
    if(x>y){
      max=x;
      min=y;
    }
    else{
      max=y;
      min=x;
    }
    for(i=1;i<=max;i++){
      if(max%i==0){
	a=max/i;
	if(min%a==0){
	  result=a;
	  flag++;
	  break;
	}
	else{
	  if(a*min==max && i!=1){
	    if(a<min)
	      result=a;
	    else
	      result=min;
	    flag++;
	  }
	}
      }
    }
    if(flag==0)
      result=1;
    printf("%d\n",result);
  }
  return(0);
}
57 38
19 84
 57 38
6 84
 101 38
6 84
 101 47
6 88
 100 47
11 88
 57 18
19 84
 101 47
6 37
 101 47
6 21
 100 38
10 84
 100 88
6 169

19
1
 19
6
 1
6
 1
2
 1
11
 3
1
 1
1
 1
3
 2
2
 4
1

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(void){
  int x,y;
  int a,i;
  int max,min;
  int result,flag;
  
  while(scanf("%d%d",&x,&y)!=EOF){
    flag=0;
    if(x>y){
      max=x;
      min=y;
    }
    else{
      max=y;
      min=x;
    }
    for(i=1;i<=max;i++){
      if(max%i==0){
	a=max/i;
	if(min%a==0){
	  result=a;
	  flag++;
	  break;
	}
	else{
	  if(a*min==max && i!=1){
	    if(a<min)
	      result=a;
	    else
	      result=min;
	    flag++;
	  }
	}
      }
    }
    if(flag==0)
      result=1;
    printf("%d\n",result);
  }
  return(0);
}```

Unoptimized Assembly Code:

```assembly
	.file	"temp.c"
	.text
	.section	.rodata
.LC0:
	.string	"%d\n"
.LC1:
	.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
	subq	$48, %rsp
	movq	%fs:40, %rax
	movq	%rax, -8(%rbp)
	xorl	%eax, %eax
	jmp	.L2
.L13:
	movl	$0, -16(%rbp)
	movl	-40(%rbp), %edx
	movl	-36(%rbp), %eax
	cmpl	%eax, %edx
	jle	.L3
	movl	-40(%rbp), %eax
	movl	%eax, -28(%rbp)
	movl	-36(%rbp), %eax
	movl	%eax, -24(%rbp)
	jmp	.L4
.L3:
	movl	-36(%rbp), %eax
	movl	%eax, -28(%rbp)
	movl	-40(%rbp), %eax
	movl	%eax, -24(%rbp)
.L4:
	movl	$1, -32(%rbp)
	jmp	.L5
.L11:
	movl	-28(%rbp), %eax
	cltd
	idivl	-32(%rbp)
	movl	%edx, %eax
	testl	%eax, %eax
	jne	.L6
	movl	-28(%rbp), %eax
	cltd
	idivl	-32(%rbp)
	movl	%eax, -12(%rbp)
	movl	-24(%rbp), %eax
	cltd
	idivl	-12(%rbp)
	movl	%edx, %eax
	testl	%eax, %eax
	jne	.L7
	movl	-12(%rbp), %eax
	movl	%eax, -20(%rbp)
	addl	$1, -16(%rbp)
	jmp	.L8
.L7:
	movl	-12(%rbp), %eax
	imull	-24(%rbp), %eax
	cmpl	%eax, -28(%rbp)
	jne	.L6
	cmpl	$1, -32(%rbp)
	je	.L6
	movl	-12(%rbp), %eax
	cmpl	-24(%rbp), %eax
	jge	.L9
	movl	-12(%rbp), %eax
	movl	%eax, -20(%rbp)
	jmp	.L10
.L9:
	movl	-24(%rbp), %eax
	movl	%eax, -20(%rbp)
.L10:
	addl	$1, -16(%rbp)
.L6:
	addl	$1, -32(%rbp)
.L5:
	movl	-32(%rbp), %eax
	cmpl	-28(%rbp), %eax
	jle	.L11
.L8:
	cmpl	$0, -16(%rbp)
	jne	.L12
	movl	$1, -20(%rbp)
.L12:
	movl	-20(%rbp), %eax
	movl	%eax, %esi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
.L2:
	leaq	-36(%rbp), %rdx
	leaq	-40(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	cmpl	$-1, %eax
	jne	.L13
	movl	$0, %eax
	movq	-8(%rbp), %rdx
	subq	%fs:40, %rdx
	je	.L15
	call	__stack_chk_fail@PLT
.L15:
	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\n"
.LC1:
	.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
	subq	$48, %rsp
	movq	%fs:40, %rax
	movq	%rax, -8(%rbp)
	xorl	%eax, %eax
	jmp	.L2
.L13:
	movl	$0, -16(%rbp)
	movl	-40(%rbp), %edx
	movl	-36(%rbp), %eax
	cmpl	%eax, %edx
	jle	.L3
	movl	-40(%rbp), %eax
	movl	%eax, -28(%rbp)
	movl	-36(%rbp), %eax
	movl	%eax, -24(%rbp)
	jmp	.L4
.L3:
	movl	-36(%rbp), %eax
	movl	%eax, -28(%rbp)
	movl	-40(%rbp), %eax
	movl	%eax, -24(%rbp)
.L4:
	movl	$1, -32(%rbp)
	jmp	.L5
.L11:
	movl	-28(%rbp), %eax
	cltd
	idivl	-32(%rbp)
	movl	%edx, %eax
	testl	%eax, %eax
	jne	.L6
	movl	-28(%rbp), %eax
	cltd
	idivl	-32(%rbp)
	movl	%eax, -12(%rbp)
	movl	-24(%rbp), %eax
	cltd
	idivl	-12(%rbp)
	movl	%edx, %eax
	testl	%eax, %eax
	jne	.L7
	movl	-12(%rbp), %eax
	movl	%eax, -20(%rbp)
	addl	$1, -16(%rbp)
	jmp	.L8
.L7:
	movl	-12(%rbp), %eax
	imull	-24(%rbp), %eax
	cmpl	%eax, -28(%rbp)
	jne	.L6
	cmpl	$1, -32(%rbp)
	je	.L6
	movl	-12(%rbp), %eax
	cmpl	-24(%rbp), %eax
	jge	.L9
	movl	-12(%rbp), %eax
	movl	%eax, -20(%rbp)
	jmp	.L10
.L9:
	movl	-24(%rbp), %eax
	movl	%eax, -20(%rbp)
.L10:
	addl	$1, -16(%rbp)
.L6:
	addl	$1, -32(%rbp)
.L5:
	movl	-32(%rbp), %eax
	cmpl	-28(%rbp), %eax
	jle	.L11
.L8:
	cmpl	$0, -16(%rbp)
	jne	.L12
	movl	$1, -20(%rbp)
.L12:
	movl	-20(%rbp), %eax
	movl	%eax, %esi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
.L2:
	leaq	-36(%rbp), %rdx
	leaq	-40(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	cmpl	$-1, %eax
	jne	.L13
	movl	$0, %eax
	movq	-8(%rbp), %rdx
	subq	%fs:40, %rdx
	je	.L15
	call	__stack_chk_fail@PLT
.L15:
	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:
