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

```c
#include <stdio.h>
#include <stdlib.h>
#define MAX 100000

int gcd(long int a, long int b) {
  if (b == 0) {
    return a;
  }
  return gcd(b, a % b);
}

int main() {
  long int N, M;

  char S[MAX], T[MAX];

  long int i;

  long int g, m, n, L;

  scanf("%ld %ld", &N, &M);
  scanf("%s", S);
  scanf("%s", T);

  g = gcd(N, M);
  n = M / g;
  m = N / g;
  L = M * N / g;

  for (i = 0; i < g; i++) {
    if (S[i * m] != T[i * n]) {
      printf("-1\n");
      return 0;
    }
  }

  printf("%ld\n", L);

  return 0;
}
```

Assembly Code:

```assembly
	.file	"temp.c"
	.text
	.p2align 4
	.globl	gcd
	.type	gcd, @function
gcd:
.LFB39:
	.cfi_startproc
	endbr64
	movq	%rdi, %rax
	testq	%rsi, %rsi
	jne	.L2
	jmp	.L10
	.p2align 4,,10
	.p2align 3
.L11:
	movq	%rdx, %rsi
.L2:
	cqto
	idivq	%rsi
	movq	%rsi, %rax
	testq	%rdx, %rdx
	jne	.L11
	movl	%esi, %eax
	ret
	.p2align 4,,10
	.p2align 3
.L10:
	movq	%rdi, %rsi
	movl	%esi, %eax
	ret
	.cfi_endproc
.LFE39:
	.size	gcd, .-gcd
	.section	.rodata.str1.1,"aMS",@progbits,1
.LC0:
	.string	"%ld %ld"
.LC1:
	.string	"%s"
.LC2:
	.string	"-1"
.LC3:
	.string	"%ld\n"
	.section	.text.startup,"ax",@progbits
	.p2align 4
	.globl	main
	.type	main, @function
main:
.LFB40:
	.cfi_startproc
	endbr64
	pushq	%r12
	.cfi_def_cfa_offset 16
	.cfi_offset 12, -16
	pushq	%rbp
	.cfi_def_cfa_offset 24
	.cfi_offset 6, -24
	pushq	%rbx
	.cfi_def_cfa_offset 32
	.cfi_offset 3, -32
	leaq	-196608(%rsp), %r11
	.cfi_def_cfa 11, 196640
.LPSRL0:
	subq	$4096, %rsp
	orq	$0, (%rsp)
	cmpq	%r11, %rsp
	jne	.LPSRL0
	.cfi_def_cfa_register 7
	subq	$3424, %rsp
	.cfi_def_cfa_offset 200064
	leaq	.LC0(%rip), %rdi
	leaq	.LC1(%rip), %r12
	movq	%fs:40, %rax
	movq	%rax, 200024(%rsp)
	xorl	%eax, %eax
	leaq	8(%rsp), %rdx
	movq	%rsp, %rsi
	leaq	16(%rsp), %rbp
	leaq	100016(%rsp), %rbx
	call	__isoc99_scanf@PLT
	movq	%rbp, %rsi
	movq	%r12, %rdi
	xorl	%eax, %eax
	call	__isoc99_scanf@PLT
	movq	%rbx, %rsi
	movq	%r12, %rdi
	xorl	%eax, %eax
	call	__isoc99_scanf@PLT
	movq	8(%rsp), %r9
	movq	(%rsp), %r10
	movq	%r9, %rcx
	movq	%r10, %rax
	testq	%r9, %r9
	jne	.L13
	jmp	.L30
	.p2align 4,,10
	.p2align 3
.L31:
	movq	%rdx, %rcx
.L13:
	cqto
	idivq	%rcx
	movq	%rcx, %rax
	testq	%rdx, %rdx
	jne	.L31
.L16:
	movq	%r9, %rax
	movslq	%ecx, %rcx
	movq	%rbp, %rdi
	movq	%rbx, %rsi
	cqto
	xorl	%r8d, %r8d
	idivq	%rcx
	movq	%rax, %r11
	movq	%r10, %rax
	cqto
	idivq	%rcx
	testq	%rcx, %rcx
	jg	.L19
	jmp	.L15
	.p2align 4,,10
	.p2align 3
.L17:
	addq	$1, %r8
	addq	%rax, %rdi
	addq	%r11, %rsi
	cmpq	%r8, %rcx
	je	.L15
.L19:
	movzbl	(%rsi), %ebx
	cmpb	%bl, (%rdi)
	je	.L17
	leaq	.LC2(%rip), %rdi
	call	puts@PLT
	jmp	.L18
.L15:
	movq	%r9, %rax
	leaq	.LC3(%rip), %rsi
	movl	$1, %edi
	imulq	%r10, %rax
	cqto
	idivq	%rcx
	movq	%rax, %rdx
	xorl	%eax, %eax
	call	__printf_chk@PLT
.L18:
	movq	200024(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L32
	addq	$200032, %rsp
	.cfi_remember_state
	.cfi_def_cfa_offset 32
	xorl	%eax, %eax
	popq	%rbx
	.cfi_def_cfa_offset 24
	popq	%rbp
	.cfi_def_cfa_offset 16
	popq	%r12
	.cfi_def_cfa_offset 8
	ret
.L30:
	.cfi_restore_state
	movq	%r10, %rcx
	jmp	.L16
.L32:
	call	__stack_chk_fail@PLT
	.cfi_endproc
.LFE40:
	.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.
Optimized Assembly Code:

user
```assembly
	.file	"temp.c"
	.text
	.p2align 4
	.globl	gcd
	.type	gcd, @function
gcd:
.LFB39:
	.cfi_startproc
	endbr64
	movq	%rdi, %rax
	testq	%rsi, %rsi
	jne	.L2
	jmp	.L10
	.p2align 4,,10
	.p2align 3
.L11:
	movq	%rdx, %rsi
.L2:
	cqto
	idivq	%rsi
	movq	%rsi, %rax
	testq	%rdx, %rdx
	jne	.L11
	movl	%esi, %eax
	ret
	.p2align 4,,10
	.p2align 3
.L10:
	movq	%rdi, %rsi
	movl	%esi, %eax
	ret
	.cfi_endproc
.LFE39:
	.size	gcd, .-gcd
	.section	.rodata.str1.1,"aMS",@progbits,1
.LC0:
	.string	"%ld %ld"
.LC1:
	.string	"%s"
.LC2:
	.string	"-1"
.LC3:
	.string	"%ld\n"
	.section	.text.startup,"ax",@progbits
	.p2align 4
	.globl	main
	.type	main, @function
main:
.LFB40:
	.cfi_startproc
	endbr64
	pushq	%r12
	.cfi_def_cfa_offset 16
	.cfi_offset 12, -16
	pushq	%rbp
	.cfi_def_cfa_offset 24
	.cfi_offset 6, -24
	pushq	%rbx
	.cfi_def_cfa_offset 32
	.cfi_offset 3, -32
	leaq	-196608(%rsp), %r11
	.cfi_def_cfa 11, 196640
.LPSRL0:
	subq	$4096, %rsp
	orq	$0, (%rsp)
	cmpq	%r11, %rsp
	jne	.LPSRL0
	.cfi_def_cfa_register 7
	subq	$3424, %rsp
	.cfi_def_cfa_offset 200064
	leaq	.LC0(%rip), %rdi
	leaq	.LC1(%rip), %r12
	movq	%fs:40, %rax
	movq	%rax, 200024(%rsp)
	xorl	%eax, %eax
	leaq	8(%rsp), %rdx
	movq	%rsp, %rsi
	leaq	16(%rsp), %rbp
	leaq	100016(%rsp), %rbx
	call	__isoc99_scanf@PLT
	movq	%rbp, %rsi
	movq	%r12, %rdi
	xorl	%eax, %eax
	call	__isoc99_scanf@PLT
	movq	%rbx, %rsi
	movq	%r12, %rdi
	xorl	%eax, %eax
	call	__isoc99_scanf@PLT
	movq	8(%rsp), %r9
	movq	(%rsp), %r10
	movq	%r9, %rcx
	movq	%r10, %rax
	testq	%r9, %r9
	jne	.L13
	jmp	.L30
	.p2align 4,,10
	.p2align 3
.L31:
	movq	%rdx, %rcx
.L13:
	cqto
	idivq	%rcx
	movq	%rcx, %rax
	testq	%rdx, %rdx
	jne	.L31
.L16:
	movq	%r9, %rax
	movslq	%ecx, %rcx
	movq	%rbp, %rdi
	movq	%rbx, %rsi
	cqto
	xorl	%r8d, %r8d
	idivq	%rcx
	movq	%rax, %r11
	movq	%r10, %rax
	cqto
	idivq	%rcx
	testq	%rcx, %rcx
	jg	.L19
	jmp	.L15
	.p2align 4,,10
	.p2align 3
.L17:
	addq	$1, %r8
	addq	%rax, %rdi
	addq	%r11, %rsi
	cmpq	%r8, %rcx
	je	.L15
.L19:
	movzbl	(%rsi), %ebx
	cmpb	%bl, (%rdi)
	je	.L17
	leaq	.LC2(%rip), %rdi
	call	puts@PLT
	jmp	.L18
.L15:
	movq	%r9, %rax
	leaq	.LC3(%rip), %rsi
	movl	$1, %edi
	imulq	%r10, %rax
	cqto
	idivq	%rcx
	movq	%rax, %rdx
	xorl	%eax, %eax
	call	__printf_chk@PLT
.L18:
	movq	200024(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L32
	addq	$200032, %rsp
	.cfi_remember_state
	.cfi_def_cfa_offset 32
	xorl	%eax, %eax
	popq	%rbx
	.cfi_def_cfa_offset 24
	popq	%rbp
	.cfi_def_cfa_offset 16
	popq	%r12
	.cfi_def_cfa_offset 8
	ret
.L30:
	.cfi_restore_state
	movq	%r10, %rcx
	jmp	.L16
.L32:
	call	__stack_chk_fail@PLT
	.cfi_endproc
.LFE40:
	.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
```assembly
	.file	"temp.c"
	.text
	.p2align 4
	.globl	gcd
	.type	gcd, @function
gcd:
.LFB39:
	.cfi_startproc
	endbr64
	movq	%rdi, %rax
	testq	%rsi, %rsi
	jne	.L2
	jmp	.L10
	.p2align 4,,10
	.p2align 3
.L11:
	movq	%rdx, %rsi
.L2:
	cqto
	idivq	%rsi
	movq	%rsi, %rax
	testq	%rdx, %rdx
	jne	.L11
	movl	%esi, %eax
	ret
	.p2align 4,,10
	.p2align 3
.L10:
	movq	%rdi, %rsi
	movl	%esi, %eax
	ret
	.cfi_endproc
.LFE39:
	.size	gcd, .-gcd
	.section	.rodata.str1.1,"aMS",@progbits,1
.LC0:
	.string	"%ld %ld"
.LC1:
	.string	"%s"
.LC2:
	.string	"-1"
.LC3:
	.string	"%ld\n"
	.section	.text.startup,"ax",@progbits
	.p2align 4
	.globl	main
	.type	main, @function
main:
.LFB40:
	.cfi_startproc
	endbr64
	pushq	%r12
	.cfi_def_cfa_offset 16
	.cfi_offset 12, -16
	pushq	%rbp
	.cfi_def_cfa_offset 24
	.cfi_offset 6, -24
	pushq	%rbx
	.cfi_def_cfa_offset 32
	.cfi_offset 3, -32
	leaq	-196608(%rsp), %r11
	.cfi_def_cfa 11, 196640
.LPSRL0:
	subq	$4096, %rsp
	orq	$0, (%rsp)
	cmpq	%r11, %rsp
	jne	.LPSRL0
	.cfi_def_cfa_register 7
	subq	$3424, %rsp
	.cfi_def_cfa_offset 200064
	leaq	.LC0(%rip), %rdi
	leaq	.LC1(%rip), %r12
	movq	%fs:40, %rax
	movq	%rax, 200024(%rsp)
	xorl	%eax, %eax
	leaq	8(%rsp), %rdx
	movq	%rsp, %rsi
	leaq	16(%rsp), %rbp
	leaq	100016(%rsp), %rbx
	call	__isoc99_scanf@PLT
	movq	%rbp, %rsi
	movq	%r12, %rdi
	xorl	%eax, %eax
	call	__isoc99_scanf@PLT
	movq	%rbx, %rsi
	movq	%r12, %rdi
	xorl	%eax, %eax
	call	__isoc99_scanf@PLT
	movq	8(%rsp), %r9
	movq	(%rsp), %r10
	movq	%r9, %rcx
	movq	%r10, %rax
	testq	%r9, %r9
	jne	.L13
	jmp	.L30
	.p2align 4,,10
	.p2align 3
.L31:
	movq	%rdx, %rcx
.L13:
	cqto
	idivq	%rcx
	movq	%rcx, %rax
	testq	%rdx, %rdx
	jne	.L31
.L16:
	movq	%r9, %rax
	movslq	%ecx, %rcx
	movq	%rbp, %rdi
	movq	%rbx, %rsi
	cqto
	xorl	%r8d, %r8d
	idivq	%rcx
	movq	%rax, %r11
	movq	%r10, %rax
	cqto
	idivq	%rcx
	testq	%rcx, %rcx
	jg	.L19
	jmp	.L15
	.p2align 4,,10
	.p2align 3
.L17:
	addq	$1, %r8
	addq	%rax, %rdi
	addq	%r11, %rsi
	cmpq	%r8, %rcx
	je	.L15
.L19:
	movzbl	(%rsi), %ebx
	cmpb	%bl, (%rdi)
	je	.L17
	leaq	.LC2(%rip), %rdi
	call	puts@PLT
	jmp	.L18
.L15:
	movq	%r9, %rax
	leaq	.LC3(%rip), %rsi
	movl	$1, %edi
	imulq	%r10, %rax
	cqto
	idivq	%rcx
	movq	%rax, %rdx
	xorl	%eax, %eax
	call	__printf_chk@PLT
.L18:
	movq	200024(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L32
	addq	$200032, %rsp
	.cfi_remember_state
	.cfi_def_cfa_offset 32
	xorl	%eax, %eax
	popq	%rbx
	.cfi_def_cfa_offset 24
	popq	%rbp
	.cfi_def_cfa_offset 16
	popq	%r12
	.cfi_def_cfa_offset 8
	ret
.L30:
	.cfi_restore_state
	movq	%r10, %rcx
	jmp	.L16
.L32:
	call	__stack_chk_fail@PLT
	.cfi_endproc
.LFE40:
	.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:
```
```c
#include <stdio.h>
#include <stdlib.h>
#define MAX 100000

int gcd(long int a, long int b) {
  if (b == 0) {
    return a;
  }
  return gcd(b, a % b);
}

int main() {
  long int N, M;

  char S[MAX], T[MAX];

  long int i;

  long int g, m, n, L;

  scanf("%ld %ld", &N, &M);
  scanf("%s", S);
  scanf("%s", T);

  g = gcd(N, M);
  n = M / g;
  m = N / g;
  L = M * N / g;

  for (i = 0; i < g; i++) {
    if (S[i * m] != T[i * n]) {
      printf("-1\n");
      return 0;
    }
  }

  printf("%ld\n", L);

  return 0;
}
```
Given the following C code, your task is to generate highly optimized x86-64 assembly code.
C Code:

```c
#include <stdio.h>
#include <stdlib.h>
#define MAX 100000

int gcd(long int a, long int b) {
  if (b == 0) {
    return a;
  }
  return gcd(b, a % b);
}

int main() {
  long int N, M;

  char S[MAX], T[MAX];

  long int i;

  long int g, m, n, L;

  scanf("%ld %ld", &N, &M);
  scanf("%s", S);
  scanf("%s", T);

  g = gcd(N, M);
  n = M / g;
  m = N / g;
  L = M * N / g;

  for (i = 0; i < g; i++) {
    if (S[i * m] != T[i * n]) {
      printf("-1\n");
      return 0;
    }
  }

  printf("%ld\n", L);

  return 0;
}
```

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.
Optimized Assembly Code:

3 2
acq
ae
 3 3
abcdef
abc
 15 9
dnsusrayukuaiia
rujdunuma
 3 4
asiaukvyartuind
aumnudjus
 15 9
dnausrayukusiia
dujrunuma
 1 2
acq
ae
 4 1
abq
ae
 15 16
dnausrayukusiia
dujrunuma
 1 1
`br
`e
 5 4
aiiaukuyarsusod
amtntdjur

6
 3
 -1
 12
 45
 2
 4
 240
 1
 20

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

```c
#include <stdio.h>
#include <stdlib.h>
#define MAX 100000

int gcd(long int a, long int b) {
  if (b == 0) {
    return a;
  }
  return gcd(b, a % b);
}

int main() {
  long int N, M;

  char S[MAX], T[MAX];

  long int i;

  long int g, m, n, L;

  scanf("%ld %ld", &N, &M);
  scanf("%s", S);
  scanf("%s", T);

  g = gcd(N, M);
  n = M / g;
  m = N / g;
  L = M * N / g;

  for (i = 0; i < g; i++) {
    if (S[i * m] != T[i * n]) {
      printf("-1\n");
      return 0;
    }
  }

  printf("%ld\n", L);

  return 0;
}
```

Assembly Code:

```assembly
	.file	"temp.c"
	.text
	.p2align 4
	.globl	gcd
	.type	gcd, @function
gcd:
.LFB39:
	.cfi_startproc
	endbr64
	movq	%rdi, %rax
	testq	%rsi, %rsi
	jne	.L2
	jmp	.L10
	.p2align 4,,10
	.p2align 3
.L11:
	movq	%rdx, %rsi
.L2:
	cqto
	idivq	%rsi
	movq	%rsi, %rax
	testq	%rdx, %rdx
	jne	.L11
	movl	%esi, %eax
	ret
	.p2align 4,,10
	.p2align 3
.L10:
	movq	%rdi, %rsi
	movl	%esi, %eax
	ret
	.cfi_endproc
.LFE39:
	.size	gcd, .-gcd
	.section	.rodata.str1.1,"aMS",@progbits,1
.LC0:
	.string	"%ld %ld"
.LC1:
	.string	"%s"
.LC2:
	.string	"-1"
.LC3:
	.string	"%ld\n"
	.section	.text.startup,"ax",@progbits
	.p2align 4
	.globl	main
	.type	main, @function
main:
.LFB40:
	.cfi_startproc
	endbr64
	pushq	%r12
	.cfi_def_cfa_offset 16
	.cfi_offset 12, -16
	pushq	%rbp
	.cfi_def_cfa_offset 24
	.cfi_offset 6, -24
	pushq	%rbx
	.cfi_def_cfa_offset 32
	.cfi_offset 3, -32
	leaq	-196608(%rsp), %r11
	.cfi_def_cfa 11, 196640
.LPSRL0:
	subq	$4096, %rsp
	orq	$0, (%rsp)
	cmpq	%r11, %rsp
	jne	.LPSRL0
	.cfi_def_cfa_register 7
	subq	$3424, %rsp
	.cfi_def_cfa_offset 200064
	leaq	.LC0(%rip), %rdi
	leaq	.LC1(%rip), %r12
	movq	%fs:40, %rax
	movq	%rax, 200024(%rsp)
	xorl	%eax, %eax
	leaq	8(%rsp), %rdx
	movq	%rsp, %rsi
	leaq	16(%rsp), %rbp
	leaq	100016(%rsp), %rbx
	call	__isoc99_scanf@PLT
	movq	%rbp, %rsi
	movq	%r12, %rdi
	xorl	%eax, %eax
	call	__isoc99_scanf@PLT
	movq	%rbx, %rsi
	movq	%r12, %rdi
	xorl	%eax, %eax
	call	__isoc99_scanf@PLT
	movq	8(%rsp), %r9
	movq	(%rsp), %r10
	movq	%r9, %rcx
	movq	%r10, %rax
	testq	%r9, %r9
	jne	.L13
	jmp	.L30
	.p2align 4,,10
	.p2align 3
.L31:
	movq	%rdx, %rcx
.L13:
	cqto
	idivq	%rcx
	movq	%rcx, %rax
	testq	%rdx, %rdx
	jne	.L31
.L16:
	movq	%r9, %rax
	movslq	%ecx, %rcx
	movq	%rbp, %rdi
	movq	%rbx, %rsi
	cqto
	xorl	%r8d, %r8d
	idivq	%rcx
	movq	%rax, %r11
	movq	%r10, %rax
	cqto
	idivq	%rcx
	testq	%rcx, %rcx
	jg	.L19
	jmp	.L15
	.p2align 4,,10
	.p2align 3
.L17:
	addq	$1, %r8
	addq	%rax, %rdi
	addq	%r11, %rsi
	cmpq	%r8, %rcx
	je	.L15
.L19:
	movzbl	(%rsi), %ebx
	cmpb	%bl, (%rdi)
	je	.L17
	leaq	.LC2(%rip), %rdi
	call	puts@PLT
	jmp	.L18
.L15:
	movq	%r9, %rax
	leaq	.LC3(%rip), %rsi
	movl	$1, %edi
	imulq	%r10, %rax
	cqto
	idivq	%rcx
	movq	%rax, %rdx
	xorl	%eax, %eax
	call	__printf_chk@PLT
.L18:
	movq	200024(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L32
	addq	$200032, %rsp
	.cfi_remember_state
	.cfi_def_cfa_offset 32
	xorl	%eax, %eax
	popq	%rbx
	.cfi_def_cfa_offset 24
	popq	%rbp
	.cfi_def_cfa_offset 16
	popq	%r12
	.cfi_def_cfa_offset 8
	ret
.L30:
	.cfi_restore_state
	movq	%r10, %rcx
	jmp	.L16
.L32:
	call	__stack_chk_fail@PLT
	.cfi_endproc
.LFE40:
	.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.
Optimized Assembly Code:

train
```assembly
	.file	"temp.c"
	.text
	.p2align 4
	.globl	gcd
	.type	gcd, @function
gcd:
.LFB39:
	.cfi_startproc
	endbr64
	movq	%rdi, %rax
	testq	%rsi, %rsi
	jne	.L2
	jmp	.L10
	.p2align 4,,10
	.p2align 3
.L11:
	movq	%rdx, %rsi
.L2:
	cqto
	idivq	%rsi
	movq	%rsi, %rax
	testq	%rdx, %rdx
	jne	.L11
	movl	%esi, %eax
	ret
	.p2align 4,,10
	.p2align 3
.L10:
	movq	%rdi, %rsi
	movl	%esi, %eax
	ret
	.cfi_endproc
.LFE39:
	.size	gcd, .-gcd
	.section	.rodata.str1.1,"aMS",@progbits,1
.LC0:
	.string	"%ld %ld"
.LC1:
	.string	"%s"
.LC2:
	.string	"-1"
.LC3:
	.string	"%ld\n"
	.section	.text.startup,"ax",@progbits
	.p2align 4
	.globl	main
	.type	main, @function
main:
.LFB40:
	.cfi_startproc
	endbr64
	pushq	%r12
	.cfi_def_cfa_offset 16
	.cfi_offset 12, -16
	pushq	%rbp
	.cfi_def_cfa_offset 24
	.cfi_offset 6, -24
	pushq	%rbx
	.cfi_def_cfa_offset 32
	.cfi_offset 3, -32
	leaq	-196608(%rsp), %r11
	.cfi_def_cfa 11, 196640
.LPSRL0:
	subq	$4096, %rsp
	orq	$0, (%rsp)
	cmpq	%r11, %rsp
	jne	.LPSRL0
	.cfi_def_cfa_register 7
	subq	$3424, %rsp
	.cfi_def_cfa_offset 200064
	leaq	.LC0(%rip), %rdi
	leaq	.LC1(%rip), %r12
	movq	%fs:40, %rax
	movq	%rax, 200024(%rsp)
	xorl	%eax, %eax
	leaq	8(%rsp), %rdx
	movq	%rsp, %rsi
	leaq	16(%rsp), %rbp
	leaq	100016(%rsp), %rbx
	call	__isoc99_scanf@PLT
	movq	%rbp, %rsi
	movq	%r12, %rdi
	xorl	%eax, %eax
	call	__isoc99_scanf@PLT
	movq	%rbx, %rsi
	movq	%r12, %rdi
	xorl	%eax, %eax
	call	__isoc99_scanf@PLT
	movq	8(%rsp), %r9
	movq	(%rsp), %r10
	movq	%r9, %rcx
	movq	%r10, %rax
	testq	%r9, %r9
	jne	.L13
	jmp	.L30
	.p2align 4,,10
	.p2align 3
.L31:
	movq	%rdx, %rcx
.L13:
	cqto
	idivq	%rcx
	movq	%rcx, %rax
	testq	%rdx, %rdx
	jne	.L31
.L16:
	movq	%r9, %rax
	movslq	%ecx, %rcx
	movq	%rbp, %rdi
	movq	%rbx, %rsi
	cqto
	xorl	%r8d, %r8d
	idivq	%rcx
	movq	%rax, %r11
	movq	%r10, %rax
	cqto
	idivq	%rcx
	testq	%rcx, %rcx
	jg	.L19
	jmp	.L15
	.p2align 4,,10
	.p2align 3
.L17:
	addq	$1, %r8
	addq	%rax, %rdi
	addq	%r11, %rsi
	cmpq	%r8, %rcx
	je	.L15
.L19:
	movzbl	(%rsi), %ebx
	cmpb	%bl, (%rdi)
	je	.L17
	leaq	.LC2(%rip), %rdi
	call	puts@PLT
	jmp	.L18
.L15:
	movq	%r9, %rax
	leaq	.LC3(%rip), %rsi
	movl	$1, %edi
	imulq	%r10, %rax
	cqto
	idivq	%rcx
	movq	%rax, %rdx
	xorl	%eax, %eax
	call	__printf_chk@PLT
.L18:
	movq	200024(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L32
	addq	$200032, %rsp
	.cfi_remember_state
	.cfi_def_cfa_offset 32
	xorl	%eax, %eax
	popq	%rbx
	.cfi_def_cfa_offset 24
	popq	%rbp
	.cfi_def_cfa_offset 16
	popq	%r12
	.cfi_def_cfa_offset 8
	ret
.L30:
	.cfi_restore_state
	movq	%r10, %rcx
	jmp	.L16
.L32:
	call	__stack_chk_fail@PLT
	.cfi_endproc
.LFE40:
	.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:
```