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

```c
/*************************************************************
190914-001-AGC028A


＜入力＞


＜出力＞


*************************************************************/

#include <stdio.h>
#include <stdlib.h>

// //////////////////////////////////////////////////////////////////////////////////
// 機能：ユークリッドの互除法によりa,bの最大公約数を求める
// 戻り値： 最大公約数、(自然数以外が指定されたときは-1)
// //////////////////////////////////////////////////////////////////////////////////
int gcd(
    int a,
    int b
)
{
    int temp;

    if (a < b)
    {
        temp = a;
        a = b;
        b = temp;
    }
    if (b < 1)
        return -1;

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

int main(int argc, char const *argv[])
{
    long long N,M;
    scanf("%lld%lld", &N, &M);
    char *S = (char *)malloc(sizeof(char) * N + 1);
    char *T = (char *)malloc(sizeof(char) * M + 1);
    scanf("%s", S);
    scanf("%s", T);

    int g, a, b;
    g = gcd(N, M);
    a = N / g;
    b = M / g;

    int i, j;
    for (i = 0, j = 0; i * a < N && j * b < M; i++, j++)
    {
        if(S[i*a] != T[j*b])
        {
            printf("-1\n");
            return 0;
        }
    }

    printf("%lld\n", (N * M / g));

    return 0;
}

```

Assembly Code:

```assembly
	.file	"temp.c"
	.text
	.p2align 4
	.globl	gcd
	.type	gcd, @function
gcd:
.LFB39:
	.cfi_startproc
	endbr64
	.p2align 4,,10
	.p2align 3
.L4:
	cmpl	%esi, %edi
	jl	.L2
	movl	%esi, %eax
	movl	%edi, %esi
	movl	%eax, %edi
.L2:
	testl	%edi, %edi
	jle	.L6
	movl	%esi, %eax
	cltd
	idivl	%edi
	movl	%edx, %esi
	testl	%edx, %edx
	jne	.L4
	movl	%edi, %eax
	ret
	.p2align 4,,10
	.p2align 3
.L6:
	movl	$-1, %eax
	ret
	.cfi_endproc
.LFE39:
	.size	gcd, .-gcd
	.section	.rodata.str1.1,"aMS",@progbits,1
.LC0:
	.string	"%lld%lld"
.LC1:
	.string	"%s"
.LC2:
	.string	"-1"
.LC3:
	.string	"%lld\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
	leaq	.LC0(%rip), %rdi
	leaq	.LC1(%rip), %r12
	pushq	%rbp
	.cfi_def_cfa_offset 24
	.cfi_offset 6, -24
	pushq	%rbx
	.cfi_def_cfa_offset 32
	.cfi_offset 3, -32
	subq	$32, %rsp
	.cfi_def_cfa_offset 64
	movq	%fs:40, %rax
	movq	%rax, 24(%rsp)
	xorl	%eax, %eax
	leaq	16(%rsp), %rdx
	leaq	8(%rsp), %rsi
	call	__isoc99_scanf@PLT
	movq	8(%rsp), %rax
	leaq	1(%rax), %rdi
	call	malloc@PLT
	movq	%rax, %rbx
	movq	16(%rsp), %rax
	leaq	1(%rax), %rdi
	call	malloc@PLT
	movq	%rbx, %rsi
	movq	%r12, %rdi
	movq	%rax, %rbp
	xorl	%eax, %eax
	call	__isoc99_scanf@PLT
	movq	%rbp, %rsi
	movq	%r12, %rdi
	xorl	%eax, %eax
	call	__isoc99_scanf@PLT
	movq	16(%rsp), %r9
	movq	8(%rsp), %r10
	movl	%r9d, %ecx
	movslq	%r10d, %rsi
	jmp	.L12
	.p2align 4,,10
	.p2align 3
.L23:
	movl	%ecx, %eax
	cltd
	idivl	%esi
	movl	%edx, %ecx
	testl	%edx, %edx
	je	.L11
.L12:
	cmpl	%ecx, %esi
	jl	.L10
	movl	%ecx, %eax
	movl	%esi, %ecx
	movslq	%eax, %rsi
.L10:
	testl	%esi, %esi
	jg	.L23
	orq	$-1, %rsi
.L11:
	movq	%r10, %rax
	cqto
	idivq	%rsi
	movq	%rax, %r11
	movq	%r9, %rax
	cqto
	idivq	%rsi
	testq	%r10, %r10
	jle	.L13
	testq	%r9, %r9
	jle	.L13
	xorl	%r8d, %r8d
	xorl	%ecx, %ecx
	xorl	%edi, %edi
	jmp	.L16
	.p2align 4,,10
	.p2align 3
.L14:
	addl	$1, %r8d
	movl	%r11d, %ecx
	imull	%r8d, %ecx
	movslq	%ecx, %rcx
	cmpq	%rcx, %r10
	jle	.L13
	movl	%eax, %edi
	imull	%r8d, %edi
	movslq	%edi, %rdi
	cmpq	%rdi, %r9
	jle	.L13
.L16:
	movzbl	0(%rbp,%rdi), %edx
	cmpb	%dl, (%rbx,%rcx)
	je	.L14
	leaq	.LC2(%rip), %rdi
	call	puts@PLT
	jmp	.L15
	.p2align 4,,10
	.p2align 3
.L13:
	movq	%r9, %rax
	movl	$1, %edi
	imulq	%r10, %rax
	cqto
	idivq	%rsi
	leaq	.LC3(%rip), %rsi
	movq	%rax, %rdx
	xorl	%eax, %eax
	call	__printf_chk@PLT
.L15:
	movq	24(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L24
	addq	$32, %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
.L24:
	.cfi_restore_state
	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
	.p2align 4,,10
	.p2align 3
.L4:
	cmpl	%esi, %edi
	jl	.L2
	movl	%esi, %eax
	movl	%edi, %esi
	movl	%eax, %edi
.L2:
	testl	%edi, %edi
	jle	.L6
	movl	%esi, %eax
	cltd
	idivl	%edi
	movl	%edx, %esi
	testl	%edx, %edx
	jne	.L4
	movl	%edi, %eax
	ret
	.p2align 4,,10
	.p2align 3
.L6:
	movl	$-1, %eax
	ret
	.cfi_endproc
.LFE39:
	.size	gcd, .-gcd
	.section	.rodata.str1.1,"aMS",@progbits,1
.LC0:
	.string	"%lld%lld"
.LC1:
	.string	"%s"
.LC2:
	.string	"-1"
.LC3:
	.string	"%lld\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
	leaq	.LC0(%rip), %rdi
	leaq	.LC1(%rip), %r12
	pushq	%rbp
	.cfi_def_cfa_offset 24
	.cfi_offset 6, -24
	pushq	%rbx
	.cfi_def_cfa_offset 32
	.cfi_offset 3, -32
	subq	$32, %rsp
	.cfi_def_cfa_offset 64
	movq	%fs:40, %rax
	movq	%rax, 24(%rsp)
	xorl	%eax, %eax
	leaq	16(%rsp), %rdx
	leaq	8(%rsp), %rsi
	call	__isoc99_scanf@PLT
	movq	8(%rsp), %rax
	leaq	1(%rax), %rdi
	call	malloc@PLT
	movq	%rax, %rbx
	movq	16(%rsp), %rax
	leaq	1(%rax), %rdi
	call	malloc@PLT
	movq	%rbx, %rsi
	movq	%r12, %rdi
	movq	%rax, %rbp
	xorl	%eax, %eax
	call	__isoc99_scanf@PLT
	movq	%rbp, %rsi
	movq	%r12, %rdi
	xorl	%eax, %eax
	call	__isoc99_scanf@PLT
	movq	16(%rsp), %r9
	movq	8(%rsp), %r10
	movl	%r9d, %ecx
	movslq	%r10d, %rsi
	jmp	.L12
	.p2align 4,,10
	.p2align 3
.L23:
	movl	%ecx, %eax
	cltd
	idivl	%esi
	movl	%edx, %ecx
	testl	%edx, %edx
	je	.L11
.L12:
	cmpl	%ecx, %esi
	jl	.L10
	movl	%ecx, %eax
	movl	%esi, %ecx
	movslq	%eax, %rsi
.L10:
	testl	%esi, %esi
	jg	.L23
	orq	$-1, %rsi
.L11:
	movq	%r10, %rax
	cqto
	idivq	%rsi
	movq	%rax, %r11
	movq	%r9, %rax
	cqto
	idivq	%rsi
	testq	%r10, %r10
	jle	.L13
	testq	%r9, %r9
	jle	.L13
	xorl	%r8d, %r8d
	xorl	%ecx, %ecx
	xorl	%edi, %edi
	jmp	.L16
	.p2align 4,,10
	.p2align 3
.L14:
	addl	$1, %r8d
	movl	%r11d, %ecx
	imull	%r8d, %ecx
	movslq	%ecx, %rcx
	cmpq	%rcx, %r10
	jle	.L13
	movl	%eax, %edi
	imull	%r8d, %edi
	movslq	%edi, %rdi
	cmpq	%rdi, %r9
	jle	.L13
.L16:
	movzbl	0(%rbp,%rdi), %edx
	cmpb	%dl, (%rbx,%rcx)
	je	.L14
	leaq	.LC2(%rip), %rdi
	call	puts@PLT
	jmp	.L15
	.p2align 4,,10
	.p2align 3
.L13:
	movq	%r9, %rax
	movl	$1, %edi
	imulq	%r10, %rax
	cqto
	idivq	%rsi
	leaq	.LC3(%rip), %rsi
	movq	%rax, %rdx
	xorl	%eax, %eax
	call	__printf_chk@PLT
.L15:
	movq	24(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L24
	addq	$32, %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
.L24:
	.cfi_restore_state
	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
	.p2align 4,,10
	.p2align 3
.L4:
	cmpl	%esi, %edi
	jl	.L2
	movl	%esi, %eax
	movl	%edi, %esi
	movl	%eax, %edi
.L2:
	testl	%edi, %edi
	jle	.L6
	movl	%esi, %eax
	cltd
	idivl	%edi
	movl	%edx, %esi
	testl	%edx, %edx
	jne	.L4
	movl	%edi, %eax
	ret
	.p2align 4,,10
	.p2align 3
.L6:
	movl	$-1, %eax
	ret
	.cfi_endproc
.LFE39:
	.size	gcd, .-gcd
	.section	.rodata.str1.1,"aMS",@progbits,1
.LC0:
	.string	"%lld%lld"
.LC1:
	.string	"%s"
.LC2:
	.string	"-1"
.LC3:
	.string	"%lld\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
	leaq	.LC0(%rip), %rdi
	leaq	.LC1(%rip), %r12
	pushq	%rbp
	.cfi_def_cfa_offset 24
	.cfi_offset 6, -24
	pushq	%rbx
	.cfi_def_cfa_offset 32
	.cfi_offset 3, -32
	subq	$32, %rsp
	.cfi_def_cfa_offset 64
	movq	%fs:40, %rax
	movq	%rax, 24(%rsp)
	xorl	%eax, %eax
	leaq	16(%rsp), %rdx
	leaq	8(%rsp), %rsi
	call	__isoc99_scanf@PLT
	movq	8(%rsp), %rax
	leaq	1(%rax), %rdi
	call	malloc@PLT
	movq	%rax, %rbx
	movq	16(%rsp), %rax
	leaq	1(%rax), %rdi
	call	malloc@PLT
	movq	%rbx, %rsi
	movq	%r12, %rdi
	movq	%rax, %rbp
	xorl	%eax, %eax
	call	__isoc99_scanf@PLT
	movq	%rbp, %rsi
	movq	%r12, %rdi
	xorl	%eax, %eax
	call	__isoc99_scanf@PLT
	movq	16(%rsp), %r9
	movq	8(%rsp), %r10
	movl	%r9d, %ecx
	movslq	%r10d, %rsi
	jmp	.L12
	.p2align 4,,10
	.p2align 3
.L23:
	movl	%ecx, %eax
	cltd
	idivl	%esi
	movl	%edx, %ecx
	testl	%edx, %edx
	je	.L11
.L12:
	cmpl	%ecx, %esi
	jl	.L10
	movl	%ecx, %eax
	movl	%esi, %ecx
	movslq	%eax, %rsi
.L10:
	testl	%esi, %esi
	jg	.L23
	orq	$-1, %rsi
.L11:
	movq	%r10, %rax
	cqto
	idivq	%rsi
	movq	%rax, %r11
	movq	%r9, %rax
	cqto
	idivq	%rsi
	testq	%r10, %r10
	jle	.L13
	testq	%r9, %r9
	jle	.L13
	xorl	%r8d, %r8d
	xorl	%ecx, %ecx
	xorl	%edi, %edi
	jmp	.L16
	.p2align 4,,10
	.p2align 3
.L14:
	addl	$1, %r8d
	movl	%r11d, %ecx
	imull	%r8d, %ecx
	movslq	%ecx, %rcx
	cmpq	%rcx, %r10
	jle	.L13
	movl	%eax, %edi
	imull	%r8d, %edi
	movslq	%edi, %rdi
	cmpq	%rdi, %r9
	jle	.L13
.L16:
	movzbl	0(%rbp,%rdi), %edx
	cmpb	%dl, (%rbx,%rcx)
	je	.L14
	leaq	.LC2(%rip), %rdi
	call	puts@PLT
	jmp	.L15
	.p2align 4,,10
	.p2align 3
.L13:
	movq	%r9, %rax
	movl	$1, %edi
	imulq	%r10, %rax
	cqto
	idivq	%rsi
	leaq	.LC3(%rip), %rsi
	movq	%rax, %rdx
	xorl	%eax, %eax
	call	__printf_chk@PLT
.L15:
	movq	24(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L24
	addq	$32, %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
.L24:
	.cfi_restore_state
	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
/*************************************************************
190914-001-AGC028A


＜入力＞


＜出力＞


*************************************************************/

#include <stdio.h>
#include <stdlib.h>

// //////////////////////////////////////////////////////////////////////////////////
// 機能：ユークリッドの互除法によりa,bの最大公約数を求める
// 戻り値： 最大公約数、(自然数以外が指定されたときは-1)
// //////////////////////////////////////////////////////////////////////////////////
int gcd(
    int a,
    int b
)
{
    int temp;

    if (a < b)
    {
        temp = a;
        a = b;
        b = temp;
    }
    if (b < 1)
        return -1;

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

int main(int argc, char const *argv[])
{
    long long N,M;
    scanf("%lld%lld", &N, &M);
    char *S = (char *)malloc(sizeof(char) * N + 1);
    char *T = (char *)malloc(sizeof(char) * M + 1);
    scanf("%s", S);
    scanf("%s", T);

    int g, a, b;
    g = gcd(N, M);
    a = N / g;
    b = M / g;

    int i, j;
    for (i = 0, j = 0; i * a < N && j * b < M; i++, j++)
    {
        if(S[i*a] != T[j*b])
        {
            printf("-1\n");
            return 0;
        }
    }

    printf("%lld\n", (N * M / g));

    return 0;
}

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

```c
/*************************************************************
190914-001-AGC028A


＜入力＞


＜出力＞


*************************************************************/

#include <stdio.h>
#include <stdlib.h>

// //////////////////////////////////////////////////////////////////////////////////
// 機能：ユークリッドの互除法によりa,bの最大公約数を求める
// 戻り値： 最大公約数、(自然数以外が指定されたときは-1)
// //////////////////////////////////////////////////////////////////////////////////
int gcd(
    int a,
    int b
)
{
    int temp;

    if (a < b)
    {
        temp = a;
        a = b;
        b = temp;
    }
    if (b < 1)
        return -1;

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

int main(int argc, char const *argv[])
{
    long long N,M;
    scanf("%lld%lld", &N, &M);
    char *S = (char *)malloc(sizeof(char) * N + 1);
    char *T = (char *)malloc(sizeof(char) * M + 1);
    scanf("%s", S);
    scanf("%s", T);

    int g, a, b;
    g = gcd(N, M);
    a = N / g;
    b = M / g;

    int i, j;
    for (i = 0, j = 0; i * a < N && j * b < M; i++, j++)
    {
        if(S[i*a] != T[j*b])
        {
            printf("-1\n");
            return 0;
        }
    }

    printf("%lld\n", (N * M / g));

    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
/*************************************************************
190914-001-AGC028A


＜入力＞


＜出力＞


*************************************************************/

#include <stdio.h>
#include <stdlib.h>

// //////////////////////////////////////////////////////////////////////////////////
// 機能：ユークリッドの互除法によりa,bの最大公約数を求める
// 戻り値： 最大公約数、(自然数以外が指定されたときは-1)
// //////////////////////////////////////////////////////////////////////////////////
int gcd(
    int a,
    int b
)
{
    int temp;

    if (a < b)
    {
        temp = a;
        a = b;
        b = temp;
    }
    if (b < 1)
        return -1;

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

int main(int argc, char const *argv[])
{
    long long N,M;
    scanf("%lld%lld", &N, &M);
    char *S = (char *)malloc(sizeof(char) * N + 1);
    char *T = (char *)malloc(sizeof(char) * M + 1);
    scanf("%s", S);
    scanf("%s", T);

    int g, a, b;
    g = gcd(N, M);
    a = N / g;
    b = M / g;

    int i, j;
    for (i = 0, j = 0; i * a < N && j * b < M; i++, j++)
    {
        if(S[i*a] != T[j*b])
        {
            printf("-1\n");
            return 0;
        }
    }

    printf("%lld\n", (N * M / g));

    return 0;
}

```

Assembly Code:

```assembly
	.file	"temp.c"
	.text
	.p2align 4
	.globl	gcd
	.type	gcd, @function
gcd:
.LFB39:
	.cfi_startproc
	endbr64
	.p2align 4,,10
	.p2align 3
.L4:
	cmpl	%esi, %edi
	jl	.L2
	movl	%esi, %eax
	movl	%edi, %esi
	movl	%eax, %edi
.L2:
	testl	%edi, %edi
	jle	.L6
	movl	%esi, %eax
	cltd
	idivl	%edi
	movl	%edx, %esi
	testl	%edx, %edx
	jne	.L4
	movl	%edi, %eax
	ret
	.p2align 4,,10
	.p2align 3
.L6:
	movl	$-1, %eax
	ret
	.cfi_endproc
.LFE39:
	.size	gcd, .-gcd
	.section	.rodata.str1.1,"aMS",@progbits,1
.LC0:
	.string	"%lld%lld"
.LC1:
	.string	"%s"
.LC2:
	.string	"-1"
.LC3:
	.string	"%lld\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
	leaq	.LC0(%rip), %rdi
	leaq	.LC1(%rip), %r12
	pushq	%rbp
	.cfi_def_cfa_offset 24
	.cfi_offset 6, -24
	pushq	%rbx
	.cfi_def_cfa_offset 32
	.cfi_offset 3, -32
	subq	$32, %rsp
	.cfi_def_cfa_offset 64
	movq	%fs:40, %rax
	movq	%rax, 24(%rsp)
	xorl	%eax, %eax
	leaq	16(%rsp), %rdx
	leaq	8(%rsp), %rsi
	call	__isoc99_scanf@PLT
	movq	8(%rsp), %rax
	leaq	1(%rax), %rdi
	call	malloc@PLT
	movq	%rax, %rbx
	movq	16(%rsp), %rax
	leaq	1(%rax), %rdi
	call	malloc@PLT
	movq	%rbx, %rsi
	movq	%r12, %rdi
	movq	%rax, %rbp
	xorl	%eax, %eax
	call	__isoc99_scanf@PLT
	movq	%rbp, %rsi
	movq	%r12, %rdi
	xorl	%eax, %eax
	call	__isoc99_scanf@PLT
	movq	16(%rsp), %r9
	movq	8(%rsp), %r10
	movl	%r9d, %ecx
	movslq	%r10d, %rsi
	jmp	.L12
	.p2align 4,,10
	.p2align 3
.L23:
	movl	%ecx, %eax
	cltd
	idivl	%esi
	movl	%edx, %ecx
	testl	%edx, %edx
	je	.L11
.L12:
	cmpl	%ecx, %esi
	jl	.L10
	movl	%ecx, %eax
	movl	%esi, %ecx
	movslq	%eax, %rsi
.L10:
	testl	%esi, %esi
	jg	.L23
	orq	$-1, %rsi
.L11:
	movq	%r10, %rax
	cqto
	idivq	%rsi
	movq	%rax, %r11
	movq	%r9, %rax
	cqto
	idivq	%rsi
	testq	%r10, %r10
	jle	.L13
	testq	%r9, %r9
	jle	.L13
	xorl	%r8d, %r8d
	xorl	%ecx, %ecx
	xorl	%edi, %edi
	jmp	.L16
	.p2align 4,,10
	.p2align 3
.L14:
	addl	$1, %r8d
	movl	%r11d, %ecx
	imull	%r8d, %ecx
	movslq	%ecx, %rcx
	cmpq	%rcx, %r10
	jle	.L13
	movl	%eax, %edi
	imull	%r8d, %edi
	movslq	%edi, %rdi
	cmpq	%rdi, %r9
	jle	.L13
.L16:
	movzbl	0(%rbp,%rdi), %edx
	cmpb	%dl, (%rbx,%rcx)
	je	.L14
	leaq	.LC2(%rip), %rdi
	call	puts@PLT
	jmp	.L15
	.p2align 4,,10
	.p2align 3
.L13:
	movq	%r9, %rax
	movl	$1, %edi
	imulq	%r10, %rax
	cqto
	idivq	%rsi
	leaq	.LC3(%rip), %rsi
	movq	%rax, %rdx
	xorl	%eax, %eax
	call	__printf_chk@PLT
.L15:
	movq	24(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L24
	addq	$32, %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
.L24:
	.cfi_restore_state
	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
	.p2align 4,,10
	.p2align 3
.L4:
	cmpl	%esi, %edi
	jl	.L2
	movl	%esi, %eax
	movl	%edi, %esi
	movl	%eax, %edi
.L2:
	testl	%edi, %edi
	jle	.L6
	movl	%esi, %eax
	cltd
	idivl	%edi
	movl	%edx, %esi
	testl	%edx, %edx
	jne	.L4
	movl	%edi, %eax
	ret
	.p2align 4,,10
	.p2align 3
.L6:
	movl	$-1, %eax
	ret
	.cfi_endproc
.LFE39:
	.size	gcd, .-gcd
	.section	.rodata.str1.1,"aMS",@progbits,1
.LC0:
	.string	"%lld%lld"
.LC1:
	.string	"%s"
.LC2:
	.string	"-1"
.LC3:
	.string	"%lld\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
	leaq	.LC0(%rip), %rdi
	leaq	.LC1(%rip), %r12
	pushq	%rbp
	.cfi_def_cfa_offset 24
	.cfi_offset 6, -24
	pushq	%rbx
	.cfi_def_cfa_offset 32
	.cfi_offset 3, -32
	subq	$32, %rsp
	.cfi_def_cfa_offset 64
	movq	%fs:40, %rax
	movq	%rax, 24(%rsp)
	xorl	%eax, %eax
	leaq	16(%rsp), %rdx
	leaq	8(%rsp), %rsi
	call	__isoc99_scanf@PLT
	movq	8(%rsp), %rax
	leaq	1(%rax), %rdi
	call	malloc@PLT
	movq	%rax, %rbx
	movq	16(%rsp), %rax
	leaq	1(%rax), %rdi
	call	malloc@PLT
	movq	%rbx, %rsi
	movq	%r12, %rdi
	movq	%rax, %rbp
	xorl	%eax, %eax
	call	__isoc99_scanf@PLT
	movq	%rbp, %rsi
	movq	%r12, %rdi
	xorl	%eax, %eax
	call	__isoc99_scanf@PLT
	movq	16(%rsp), %r9
	movq	8(%rsp), %r10
	movl	%r9d, %ecx
	movslq	%r10d, %rsi
	jmp	.L12
	.p2align 4,,10
	.p2align 3
.L23:
	movl	%ecx, %eax
	cltd
	idivl	%esi
	movl	%edx, %ecx
	testl	%edx, %edx
	je	.L11
.L12:
	cmpl	%ecx, %esi
	jl	.L10
	movl	%ecx, %eax
	movl	%esi, %ecx
	movslq	%eax, %rsi
.L10:
	testl	%esi, %esi
	jg	.L23
	orq	$-1, %rsi
.L11:
	movq	%r10, %rax
	cqto
	idivq	%rsi
	movq	%rax, %r11
	movq	%r9, %rax
	cqto
	idivq	%rsi
	testq	%r10, %r10
	jle	.L13
	testq	%r9, %r9
	jle	.L13
	xorl	%r8d, %r8d
	xorl	%ecx, %ecx
	xorl	%edi, %edi
	jmp	.L16
	.p2align 4,,10
	.p2align 3
.L14:
	addl	$1, %r8d
	movl	%r11d, %ecx
	imull	%r8d, %ecx
	movslq	%ecx, %rcx
	cmpq	%rcx, %r10
	jle	.L13
	movl	%eax, %edi
	imull	%r8d, %edi
	movslq	%edi, %rdi
	cmpq	%rdi, %r9
	jle	.L13
.L16:
	movzbl	0(%rbp,%rdi), %edx
	cmpb	%dl, (%rbx,%rcx)
	je	.L14
	leaq	.LC2(%rip), %rdi
	call	puts@PLT
	jmp	.L15
	.p2align 4,,10
	.p2align 3
.L13:
	movq	%r9, %rax
	movl	$1, %edi
	imulq	%r10, %rax
	cqto
	idivq	%rsi
	leaq	.LC3(%rip), %rsi
	movq	%rax, %rdx
	xorl	%eax, %eax
	call	__printf_chk@PLT
.L15:
	movq	24(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L24
	addq	$32, %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
.L24:
	.cfi_restore_state
	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:
```