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

```c
// AOJ 0114: Electro-Fly
// 2017.8.23 bal4u@uu
// 1017.11.14

#include <stdio.h>

long long gcd(long long a, long long b)
{
	long long r;
	if (a < b) r = a, a = b, b = r;
	while (b != 0) r = a % b, a = b, b = r; return a;
}

int carmichael(int a, int m)
{
    int n, b;
	for (n = 1, b = a; b != 1; n++) b = (b * a) % m;
	return n;
}

char buf[40], *p;
int getint()
{
	int n = 0;
	while (*p >= '0') n = (n<<3) + (n<<1) + (*p++ & 0xf);
	return n;
}

int main()
{
	int a1, a2, a3, m1, m2, m3, b1, b2, b3;
	long long ans;
	
	while (fgets(p=buf, 40, stdin) && *p != '0') {
		a1 = getint(), p++, m1 = getint(), p++;
		a2 = getint(), p++, m2 = getint(), p++;
		a3 = getint(), p++, m3 = getint(), p++;		

		b1 = carmichael(a1, m1);
		b2 = carmichael(a2, m2);
		b3 = carmichael(a3, m3);
		
		ans = (long long)b1 / gcd(b1,  b2) * b2;
		ans =           ans / gcd(ans, b3) * b3;
		printf("%lld\n", ans);
	}
	return 0;
}```

Unoptimized Assembly Code:

```assembly
	.file	"temp.c"
	.text
	.globl	gcd
	.type	gcd, @function
gcd:
.LFB0:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	movq	%rdi, -24(%rbp)
	movq	%rsi, -32(%rbp)
	movq	-24(%rbp), %rax
	cmpq	-32(%rbp), %rax
	jge	.L3
	movq	-24(%rbp), %rax
	movq	%rax, -8(%rbp)
	movq	-32(%rbp), %rax
	movq	%rax, -24(%rbp)
	movq	-8(%rbp), %rax
	movq	%rax, -32(%rbp)
	jmp	.L3
.L4:
	movq	-24(%rbp), %rax
	cqto
	idivq	-32(%rbp)
	movq	%rdx, -8(%rbp)
	movq	-32(%rbp), %rax
	movq	%rax, -24(%rbp)
	movq	-8(%rbp), %rax
	movq	%rax, -32(%rbp)
.L3:
	cmpq	$0, -32(%rbp)
	jne	.L4
	movq	-24(%rbp), %rax
	popq	%rbp
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE0:
	.size	gcd, .-gcd
	.globl	carmichael
	.type	carmichael, @function
carmichael:
.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)
	movl	%esi, -24(%rbp)
	movl	$1, -8(%rbp)
	movl	-20(%rbp), %eax
	movl	%eax, -4(%rbp)
	jmp	.L7
.L8:
	movl	-4(%rbp), %eax
	imull	-20(%rbp), %eax
	cltd
	idivl	-24(%rbp)
	movl	%edx, -4(%rbp)
	addl	$1, -8(%rbp)
.L7:
	cmpl	$1, -4(%rbp)
	jne	.L8
	movl	-8(%rbp), %eax
	popq	%rbp
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE1:
	.size	carmichael, .-carmichael
	.globl	buf
	.bss
	.align 32
	.type	buf, @object
	.size	buf, 40
buf:
	.zero	40
	.globl	p
	.align 8
	.type	p, @object
	.size	p, 8
p:
	.zero	8
	.text
	.globl	getint
	.type	getint, @function
getint:
.LFB2:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	movl	$0, -4(%rbp)
	jmp	.L11
.L12:
	movl	-4(%rbp), %eax
	leal	0(,%rax,8), %edx
	movl	-4(%rbp), %eax
	addl	%eax, %eax
	leal	(%rdx,%rax), %ecx
	movq	p(%rip), %rax
	leaq	1(%rax), %rdx
	movq	%rdx, p(%rip)
	movzbl	(%rax), %eax
	movsbl	%al, %eax
	andl	$15, %eax
	addl	%ecx, %eax
	movl	%eax, -4(%rbp)
.L11:
	movq	p(%rip), %rax
	movzbl	(%rax), %eax
	cmpb	$47, %al
	jg	.L12
	movl	-4(%rbp), %eax
	popq	%rbp
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE2:
	.size	getint, .-getint
	.section	.rodata
.LC0:
	.string	"%lld\n"
	.text
	.globl	main
	.type	main, @function
main:
.LFB3:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	pushq	%rbx
	subq	$56, %rsp
	.cfi_offset 3, -24
	jmp	.L15
.L17:
	movl	$0, %eax
	call	getint
	movl	%eax, -60(%rbp)
	movq	p(%rip), %rax
	addq	$1, %rax
	movq	%rax, p(%rip)
	movl	$0, %eax
	call	getint
	movl	%eax, -56(%rbp)
	movq	p(%rip), %rax
	addq	$1, %rax
	movq	%rax, p(%rip)
	movl	$0, %eax
	call	getint
	movl	%eax, -52(%rbp)
	movq	p(%rip), %rax
	addq	$1, %rax
	movq	%rax, p(%rip)
	movl	$0, %eax
	call	getint
	movl	%eax, -48(%rbp)
	movq	p(%rip), %rax
	addq	$1, %rax
	movq	%rax, p(%rip)
	movl	$0, %eax
	call	getint
	movl	%eax, -44(%rbp)
	movq	p(%rip), %rax
	addq	$1, %rax
	movq	%rax, p(%rip)
	movl	$0, %eax
	call	getint
	movl	%eax, -40(%rbp)
	movq	p(%rip), %rax
	addq	$1, %rax
	movq	%rax, p(%rip)
	movl	-56(%rbp), %edx
	movl	-60(%rbp), %eax
	movl	%edx, %esi
	movl	%eax, %edi
	call	carmichael
	movl	%eax, -36(%rbp)
	movl	-48(%rbp), %edx
	movl	-52(%rbp), %eax
	movl	%edx, %esi
	movl	%eax, %edi
	call	carmichael
	movl	%eax, -32(%rbp)
	movl	-40(%rbp), %edx
	movl	-44(%rbp), %eax
	movl	%edx, %esi
	movl	%eax, %edi
	call	carmichael
	movl	%eax, -28(%rbp)
	movl	-36(%rbp), %eax
	movslq	%eax, %rbx
	movl	-32(%rbp), %eax
	movslq	%eax, %rdx
	movl	-36(%rbp), %eax
	cltq
	movq	%rdx, %rsi
	movq	%rax, %rdi
	call	gcd
	movq	%rax, %rcx
	movq	%rbx, %rax
	cqto
	idivq	%rcx
	movq	%rax, %rdx
	movl	-32(%rbp), %eax
	cltq
	imulq	%rdx, %rax
	movq	%rax, -24(%rbp)
	movl	-28(%rbp), %eax
	movslq	%eax, %rdx
	movq	-24(%rbp), %rax
	movq	%rdx, %rsi
	movq	%rax, %rdi
	call	gcd
	movq	%rax, %rcx
	movq	-24(%rbp), %rax
	cqto
	idivq	%rcx
	movq	%rax, %rdx
	movl	-28(%rbp), %eax
	cltq
	imulq	%rdx, %rax
	movq	%rax, -24(%rbp)
	movq	-24(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
.L15:
	movq	stdin(%rip), %rdx
	leaq	buf(%rip), %rax
	movq	%rax, p(%rip)
	movq	p(%rip), %rax
	movl	$40, %esi
	movq	%rax, %rdi
	call	fgets@PLT
	testq	%rax, %rax
	je	.L16
	movq	p(%rip), %rax
	movzbl	(%rax), %eax
	cmpb	$48, %al
	jne	.L17
.L16:
	movl	$0, %eax
	movq	-8(%rbp), %rbx
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE3:
	.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
	.p2align 4
	.globl	gcd
	.type	gcd, @function
gcd:
.LFB23:
	.cfi_startproc
	endbr64
	movq	%rdi, %rax
	movq	%rsi, %rdx
	cmpq	%rsi, %rdi
	jge	.L2
	movq	%rsi, %rax
	movq	%rdi, %rdx
.L2:
	testq	%rdx, %rdx
	je	.L5
	.p2align 4,,10
	.p2align 3
.L4:
	movq	%rdx, %r8
	cqto
	idivq	%r8
	movq	%r8, %rax
	testq	%rdx, %rdx
	jne	.L4
	movq	%r8, %rax
	ret
	.p2align 4,,10
	.p2align 3
.L5:
	movq	%rax, %r8
	movq	%r8, %rax
	ret
	.cfi_endproc
.LFE23:
	.size	gcd, .-gcd
	.p2align 4
	.globl	carmichael
	.type	carmichael, @function
carmichael:
.LFB24:
	.cfi_startproc
	endbr64
	cmpl	$1, %edi
	je	.L11
	movl	%edi, %edx
	movl	$1, %r8d
	.p2align 4,,10
	.p2align 3
.L10:
	movl	%edx, %eax
	addl	$1, %r8d
	imull	%edi, %eax
	cltd
	idivl	%esi
	cmpl	$1, %edx
	jne	.L10
	movl	%r8d, %eax
	ret
	.p2align 4,,10
	.p2align 3
.L11:
	movl	$1, %r8d
	movl	%r8d, %eax
	ret
	.cfi_endproc
.LFE24:
	.size	carmichael, .-carmichael
	.p2align 4
	.globl	getint
	.type	getint, @function
getint:
.LFB25:
	.cfi_startproc
	endbr64
	movq	p(%rip), %rax
	cmpb	$47, (%rax)
	jle	.L16
	addq	$1, %rax
	xorl	%r8d, %r8d
	.p2align 4,,10
	.p2align 3
.L15:
	movq	%rax, p(%rip)
	movzbl	-1(%rax), %edx
	addq	$1, %rax
	leal	(%r8,%r8,4), %ecx
	andl	$15, %edx
	cmpb	$47, -1(%rax)
	leal	(%rdx,%rcx,2), %r8d
	jg	.L15
	movl	%r8d, %eax
	ret
	.p2align 4,,10
	.p2align 3
.L16:
	xorl	%r8d, %r8d
	movl	%r8d, %eax
	ret
	.cfi_endproc
.LFE25:
	.size	getint, .-getint
	.section	.rodata.str1.1,"aMS",@progbits,1
.LC0:
	.string	"%lld\n"
	.section	.text.startup,"ax",@progbits
	.p2align 4
	.globl	main
	.type	main, @function
main:
.LFB26:
	.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
	leaq	.LC0(%rip), %rbp
	pushq	%rbx
	.cfi_def_cfa_offset 32
	.cfi_offset 3, -32
	leaq	buf(%rip), %rbx
	.p2align 4,,10
	.p2align 3
.L19:
	movq	stdin(%rip), %rdx
	movl	$40, %esi
	movq	%rbx, %rdi
	movq	%rbx, p(%rip)
	call	fgets@PLT
	testq	%rax, %rax
	je	.L60
	movq	p(%rip), %rax
	movzbl	(%rax), %ecx
	cmpb	$48, %cl
	je	.L60
	leaq	1(%rax), %rdx
	xorl	%esi, %esi
	cmpb	$47, %cl
	jle	.L45
	.p2align 4,,10
	.p2align 3
.L20:
	movq	%rdx, p(%rip)
	movzbl	-1(%rdx), %ecx
	movq	%rdx, %rax
	leal	(%rsi,%rsi,4), %esi
	addq	$1, %rdx
	andl	$15, %ecx
	cmpb	$47, -1(%rdx)
	leal	(%rcx,%rsi,2), %esi
	jg	.L20
.L45:
	leaq	1(%rax), %rdx
	movq	%rdx, p(%rip)
	cmpb	$47, 1(%rax)
	jle	.L48
	addq	$2, %rax
	xorl	%edi, %edi
	.p2align 4,,10
	.p2align 3
.L22:
	movq	%rax, p(%rip)
	movzbl	-1(%rax), %ecx
	movq	%rax, %rdx
	leal	(%rdi,%rdi,4), %edi
	addq	$1, %rax
	andl	$15, %ecx
	cmpb	$47, -1(%rax)
	leal	(%rcx,%rdi,2), %edi
	jg	.L22
.L21:
	leaq	1(%rdx), %rax
	movq	%rax, p(%rip)
	cmpb	$47, 1(%rdx)
	jle	.L49
	addq	$2, %rdx
	xorl	%r8d, %r8d
	.p2align 4,,10
	.p2align 3
.L24:
	movq	%rdx, p(%rip)
	movzbl	-1(%rdx), %ecx
	movq	%rdx, %rax
	addq	$1, %rdx
	leal	(%r8,%r8,4), %r8d
	andl	$15, %ecx
	cmpb	$47, -1(%rdx)
	leal	(%rcx,%r8,2), %r8d
	jg	.L24
.L23:
	leaq	1(%rax), %rdx
	movq	%rdx, p(%rip)
	cmpb	$47, 1(%rax)
	jle	.L50
	addq	$2, %rax
	xorl	%r9d, %r9d
	.p2align 4,,10
	.p2align 3
.L26:
	movq	%rax, p(%rip)
	movzbl	-1(%rax), %ecx
	movq	%rax, %rdx
	addq	$1, %rax
	leal	(%r9,%r9,4), %r9d
	andl	$15, %ecx
	cmpb	$47, -1(%rax)
	leal	(%rcx,%r9,2), %r9d
	jg	.L26
.L25:
	leaq	1(%rdx), %rax
	movq	%rax, p(%rip)
	cmpb	$47, 1(%rdx)
	jle	.L51
	addq	$2, %rdx
	xorl	%r10d, %r10d
	.p2align 4,,10
	.p2align 3
.L28:
	movq	%rdx, p(%rip)
	movzbl	-1(%rdx), %ecx
	movq	%rdx, %rax
	addq	$1, %rdx
	leal	(%r10,%r10,4), %r10d
	andl	$15, %ecx
	cmpb	$47, -1(%rdx)
	leal	(%rcx,%r10,2), %r10d
	jg	.L28
.L27:
	leaq	1(%rax), %r12
	movq	%r12, p(%rip)
	cmpb	$47, 1(%rax)
	jle	.L52
	addq	$2, %rax
	xorl	%r11d, %r11d
	.p2align 4,,10
	.p2align 3
.L30:
	movq	%rax, p(%rip)
	movzbl	-1(%rax), %edx
	movq	%rax, %r12
	addq	$1, %rax
	leal	(%r11,%r11,4), %ecx
	andl	$15, %edx
	cmpb	$47, -1(%rax)
	leal	(%rdx,%rcx,2), %r11d
	jg	.L30
.L29:
	addq	$1, %r12
	movq	%r12, p(%rip)
	cmpl	$1, %esi
	je	.L53
	movl	%esi, %edx
	movl	$1, %ecx
	.p2align 4,,10
	.p2align 3
.L32:
	movl	%edx, %eax
	addl	$1, %ecx
	imull	%esi, %eax
	cltd
	idivl	%edi
	cmpl	$1, %edx
	jne	.L32
	movslq	%ecx, %rcx
.L31:
	cmpl	$1, %r8d
	je	.L33
	movl	%r8d, %edx
	movl	$1, %esi
	.p2align 4,,10
	.p2align 3
.L34:
	movl	%edx, %eax
	addl	$1, %esi
	imull	%r8d, %eax
	cltd
	idivl	%r9d
	cmpl	$1, %edx
	jne	.L34
	movslq	%esi, %r8
	cmpl	$1, %r10d
	je	.L54
.L46:
	movl	%r10d, %edx
	movl	$1, %esi
	.p2align 4,,10
	.p2align 3
.L36:
	movl	%edx, %eax
	addl	$1, %esi
	imull	%r10d, %eax
	cltd
	idivl	%r11d
	cmpl	$1, %edx
	jne	.L36
	movslq	%esi, %rsi
.L35:
	cmpq	%r8, %rcx
	jge	.L55
	movq	%rcx, %rdx
	movq	%r8, %rdi
	.p2align 4,,10
	.p2align 3
.L38:
	movq	%rdi, %rax
	movq	%rdx, %rdi
	cqto
	idivq	%rdi
	testq	%rdx, %rdx
	jne	.L38
	movq	%rcx, %rax
	cqto
	idivq	%rdi
	movq	%rax, %rcx
	imulq	%r8, %rcx
	cmpq	%rsi, %rcx
	jl	.L39
.L47:
	movq	%rsi, %r9
	movq	%rcx, %r8
	movq	%rcx, %rsi
	movq	%r9, %rcx
	.p2align 4,,10
	.p2align 3
.L42:
	movq	%rsi, %rax
	movq	%rcx, %rdi
	cqto
	movq	%rdi, %rsi
	idivq	%rcx
	movq	%rdx, %rcx
	testq	%rdx, %rdx
	jne	.L42
.L41:
	movq	%r8, %rax
	movq	%rbp, %rsi
	cqto
	idivq	%rdi
	movl	$1, %edi
	imulq	%r9, %rax
	movq	%rax, %rdx
	xorl	%eax, %eax
	call	__printf_chk@PLT
	jmp	.L19
	.p2align 4,,10
	.p2align 3
.L39:
	movq	%rsi, %r9
	testq	%rcx, %rcx
	je	.L56
	movq	%rcx, %r8
	jmp	.L42
	.p2align 4,,10
	.p2align 3
.L55:
	movq	%r8, %rdx
	movq	%rcx, %rdi
	jmp	.L38
	.p2align 4,,10
	.p2align 3
.L60:
	popq	%rbx
	.cfi_remember_state
	.cfi_def_cfa_offset 24
	xorl	%eax, %eax
	popq	%rbp
	.cfi_def_cfa_offset 16
	popq	%r12
	.cfi_def_cfa_offset 8
	ret
	.p2align 4,,10
	.p2align 3
.L48:
	.cfi_restore_state
	xorl	%edi, %edi
	jmp	.L21
	.p2align 4,,10
	.p2align 3
.L56:
	xorl	%r8d, %r8d
	movq	%rsi, %rdi
	jmp	.L41
	.p2align 4,,10
	.p2align 3
.L50:
	xorl	%r9d, %r9d
	jmp	.L25
	.p2align 4,,10
	.p2align 3
.L49:
	xorl	%r8d, %r8d
	jmp	.L23
	.p2align 4,,10
	.p2align 3
.L33:
	movl	$1, %r8d
	movl	$1, %esi
	cmpl	$1, %r10d
	jne	.L46
	jmp	.L47
	.p2align 4,,10
	.p2align 3
.L53:
	movl	$1, %ecx
	jmp	.L31
	.p2align 4,,10
	.p2align 3
.L52:
	xorl	%r11d, %r11d
	jmp	.L29
	.p2align 4,,10
	.p2align 3
.L51:
	xorl	%r10d, %r10d
	jmp	.L27
	.p2align 4,,10
	.p2align 3
.L54:
	movl	$1, %esi
	jmp	.L35
	.cfi_endproc
.LFE26:
	.size	main, .-main
	.globl	p
	.bss
	.align 8
	.type	p, @object
	.size	p, 8
p:
	.zero	8
	.globl	buf
	.align 32
	.type	buf, @object
	.size	buf, 40
buf:
	.zero	40
	.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
	.p2align 4
	.globl	gcd
	.type	gcd, @function
gcd:
.LFB23:
	.cfi_startproc
	endbr64
	movq	%rdi, %rax
	movq	%rsi, %rdx
	cmpq	%rsi, %rdi
	jge	.L2
	movq	%rsi, %rax
	movq	%rdi, %rdx
.L2:
	testq	%rdx, %rdx
	je	.L5
	.p2align 4,,10
	.p2align 3
.L4:
	movq	%rdx, %r8
	cqto
	idivq	%r8
	movq	%r8, %rax
	testq	%rdx, %rdx
	jne	.L4
	movq	%r8, %rax
	ret
	.p2align 4,,10
	.p2align 3
.L5:
	movq	%rax, %r8
	movq	%r8, %rax
	ret
	.cfi_endproc
.LFE23:
	.size	gcd, .-gcd
	.p2align 4
	.globl	carmichael
	.type	carmichael, @function
carmichael:
.LFB24:
	.cfi_startproc
	endbr64
	cmpl	$1, %edi
	je	.L11
	movl	%edi, %edx
	movl	$1, %r8d
	.p2align 4,,10
	.p2align 3
.L10:
	movl	%edx, %eax
	addl	$1, %r8d
	imull	%edi, %eax
	cltd
	idivl	%esi
	cmpl	$1, %edx
	jne	.L10
	movl	%r8d, %eax
	ret
	.p2align 4,,10
	.p2align 3
.L11:
	movl	$1, %r8d
	movl	%r8d, %eax
	ret
	.cfi_endproc
.LFE24:
	.size	carmichael, .-carmichael
	.p2align 4
	.globl	getint
	.type	getint, @function
getint:
.LFB25:
	.cfi_startproc
	endbr64
	movq	p(%rip), %rax
	cmpb	$47, (%rax)
	jle	.L16
	addq	$1, %rax
	xorl	%r8d, %r8d
	.p2align 4,,10
	.p2align 3
.L15:
	movq	%rax, p(%rip)
	movzbl	-1(%rax), %edx
	addq	$1, %rax
	leal	(%r8,%r8,4), %ecx
	andl	$15, %edx
	cmpb	$47, -1(%rax)
	leal	(%rdx,%rcx,2), %r8d
	jg	.L15
	movl	%r8d, %eax
	ret
	.p2align 4,,10
	.p2align 3
.L16:
	xorl	%r8d, %r8d
	movl	%r8d, %eax
	ret
	.cfi_endproc
.LFE25:
	.size	getint, .-getint
	.section	.rodata.str1.1,"aMS",@progbits,1
.LC0:
	.string	"%lld\n"
	.section	.text.startup,"ax",@progbits
	.p2align 4
	.globl	main
	.type	main, @function
main:
.LFB26:
	.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
	leaq	.LC0(%rip), %rbp
	pushq	%rbx
	.cfi_def_cfa_offset 32
	.cfi_offset 3, -32
	leaq	buf(%rip), %rbx
	.p2align 4,,10
	.p2align 3
.L19:
	movq	stdin(%rip), %rdx
	movl	$40, %esi
	movq	%rbx, %rdi
	movq	%rbx, p(%rip)
	call	fgets@PLT
	testq	%rax, %rax
	je	.L60
	movq	p(%rip), %rax
	movzbl	(%rax), %ecx
	cmpb	$48, %cl
	je	.L60
	leaq	1(%rax), %rdx
	xorl	%esi, %esi
	cmpb	$47, %cl
	jle	.L45
	.p2align 4,,10
	.p2align 3
.L20:
	movq	%rdx, p(%rip)
	movzbl	-1(%rdx), %ecx
	movq	%rdx, %rax
	leal	(%rsi,%rsi,4), %esi
	addq	$1, %rdx
	andl	$15, %ecx
	cmpb	$47, -1(%rdx)
	leal	(%rcx,%rsi,2), %esi
	jg	.L20
.L45:
	leaq	1(%rax), %rdx
	movq	%rdx, p(%rip)
	cmpb	$47, 1(%rax)
	jle	.L48
	addq	$2, %rax
	xorl	%edi, %edi
	.p2align 4,,10
	.p2align 3
.L22:
	movq	%rax, p(%rip)
	movzbl	-1(%rax), %ecx
	movq	%rax, %rdx
	leal	(%rdi,%rdi,4), %edi
	addq	$1, %rax
	andl	$15, %ecx
	cmpb	$47, -1(%rax)
	leal	(%rcx,%rdi,2), %edi
	jg	.L22
.L21:
	leaq	1(%rdx), %rax
	movq	%rax, p(%rip)
	cmpb	$47, 1(%rdx)
	jle	.L49
	addq	$2, %rdx
	xorl	%r8d, %r8d
	.p2align 4,,10
	.p2align 3
.L24:
	movq	%rdx, p(%rip)
	movzbl	-1(%rdx), %ecx
	movq	%rdx, %rax
	addq	$1, %rdx
	leal	(%r8,%r8,4), %r8d
	andl	$15, %ecx
	cmpb	$47, -1(%rdx)
	leal	(%rcx,%r8,2), %r8d
	jg	.L24
.L23:
	leaq	1(%rax), %rdx
	movq	%rdx, p(%rip)
	cmpb	$47, 1(%rax)
	jle	.L50
	addq	$2, %rax
	xorl	%r9d, %r9d
	.p2align 4,,10
	.p2align 3
.L26:
	movq	%rax, p(%rip)
	movzbl	-1(%rax), %ecx
	movq	%rax, %rdx
	addq	$1, %rax
	leal	(%r9,%r9,4), %r9d
	andl	$15, %ecx
	cmpb	$47, -1(%rax)
	leal	(%rcx,%r9,2), %r9d
	jg	.L26
.L25:
	leaq	1(%rdx), %rax
	movq	%rax, p(%rip)
	cmpb	$47, 1(%rdx)
	jle	.L51
	addq	$2, %rdx
	xorl	%r10d, %r10d
	.p2align 4,,10
	.p2align 3
.L28:
	movq	%rdx, p(%rip)
	movzbl	-1(%rdx), %ecx
	movq	%rdx, %rax
	addq	$1, %rdx
	leal	(%r10,%r10,4), %r10d
	andl	$15, %ecx
	cmpb	$47, -1(%rdx)
	leal	(%rcx,%r10,2), %r10d
	jg	.L28
.L27:
	leaq	1(%rax), %r12
	movq	%r12, p(%rip)
	cmpb	$47, 1(%rax)
	jle	.L52
	addq	$2, %rax
	xorl	%r11d, %r11d
	.p2align 4,,10
	.p2align 3
.L30:
	movq	%rax, p(%rip)
	movzbl	-1(%rax), %edx
	movq	%rax, %r12
	addq	$1, %rax
	leal	(%r11,%r11,4), %ecx
	andl	$15, %edx
	cmpb	$47, -1(%rax)
	leal	(%rdx,%rcx,2), %r11d
	jg	.L30
.L29:
	addq	$1, %r12
	movq	%r12, p(%rip)
	cmpl	$1, %esi
	je	.L53
	movl	%esi, %edx
	movl	$1, %ecx
	.p2align 4,,10
	.p2align 3
.L32:
	movl	%edx, %eax
	addl	$1, %ecx
	imull	%esi, %eax
	cltd
	idivl	%edi
	cmpl	$1, %edx
	jne	.L32
	movslq	%ecx, %rcx
.L31:
	cmpl	$1, %r8d
	je	.L33
	movl	%r8d, %edx
	movl	$1, %esi
	.p2align 4,,10
	.p2align 3
.L34:
	movl	%edx, %eax
	addl	$1, %esi
	imull	%r8d, %eax
	cltd
	idivl	%r9d
	cmpl	$1, %edx
	jne	.L34
	movslq	%esi, %r8
	cmpl	$1, %r10d
	je	.L54
.L46:
	movl	%r10d, %edx
	movl	$1, %esi
	.p2align 4,,10
	.p2align 3
.L36:
	movl	%edx, %eax
	addl	$1, %esi
	imull	%r10d, %eax
	cltd
	idivl	%r11d
	cmpl	$1, %edx
	jne	.L36
	movslq	%esi, %rsi
.L35:
	cmpq	%r8, %rcx
	jge	.L55
	movq	%rcx, %rdx
	movq	%r8, %rdi
	.p2align 4,,10
	.p2align 3
.L38:
	movq	%rdi, %rax
	movq	%rdx, %rdi
	cqto
	idivq	%rdi
	testq	%rdx, %rdx
	jne	.L38
	movq	%rcx, %rax
	cqto
	idivq	%rdi
	movq	%rax, %rcx
	imulq	%r8, %rcx
	cmpq	%rsi, %rcx
	jl	.L39
.L47:
	movq	%rsi, %r9
	movq	%rcx, %r8
	movq	%rcx, %rsi
	movq	%r9, %rcx
	.p2align 4,,10
	.p2align 3
.L42:
	movq	%rsi, %rax
	movq	%rcx, %rdi
	cqto
	movq	%rdi, %rsi
	idivq	%rcx
	movq	%rdx, %rcx
	testq	%rdx, %rdx
	jne	.L42
.L41:
	movq	%r8, %rax
	movq	%rbp, %rsi
	cqto
	idivq	%rdi
	movl	$1, %edi
	imulq	%r9, %rax
	movq	%rax, %rdx
	xorl	%eax, %eax
	call	__printf_chk@PLT
	jmp	.L19
	.p2align 4,,10
	.p2align 3
.L39:
	movq	%rsi, %r9
	testq	%rcx, %rcx
	je	.L56
	movq	%rcx, %r8
	jmp	.L42
	.p2align 4,,10
	.p2align 3
.L55:
	movq	%r8, %rdx
	movq	%rcx, %rdi
	jmp	.L38
	.p2align 4,,10
	.p2align 3
.L60:
	popq	%rbx
	.cfi_remember_state
	.cfi_def_cfa_offset 24
	xorl	%eax, %eax
	popq	%rbp
	.cfi_def_cfa_offset 16
	popq	%r12
	.cfi_def_cfa_offset 8
	ret
	.p2align 4,,10
	.p2align 3
.L48:
	.cfi_restore_state
	xorl	%edi, %edi
	jmp	.L21
	.p2align 4,,10
	.p2align 3
.L56:
	xorl	%r8d, %r8d
	movq	%rsi, %rdi
	jmp	.L41
	.p2align 4,,10
	.p2align 3
.L50:
	xorl	%r9d, %r9d
	jmp	.L25
	.p2align 4,,10
	.p2align 3
.L49:
	xorl	%r8d, %r8d
	jmp	.L23
	.p2align 4,,10
	.p2align 3
.L33:
	movl	$1, %r8d
	movl	$1, %esi
	cmpl	$1, %r10d
	jne	.L46
	jmp	.L47
	.p2align 4,,10
	.p2align 3
.L53:
	movl	$1, %ecx
	jmp	.L31
	.p2align 4,,10
	.p2align 3
.L52:
	xorl	%r11d, %r11d
	jmp	.L29
	.p2align 4,,10
	.p2align 3
.L51:
	xorl	%r10d, %r10d
	jmp	.L27
	.p2align 4,,10
	.p2align 3
.L54:
	movl	$1, %esi
	jmp	.L35
	.cfi_endproc
.LFE26:
	.size	main, .-main
	.globl	p
	.bss
	.align 8
	.type	p, @object
	.size	p, 8
p:
	.zero	8
	.globl	buf
	.align 32
	.type	buf, @object
	.size	buf, 40
buf:
	.zero	40
	.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:

// AOJ 0114: Electro-Fly
// 2017.8.23 bal4u@uu
// 1017.11.14

#include <stdio.h>

long long gcd(long long a, long long b)
{
	long long r;
	if (a < b) r = a, a = b, b = r;
	while (b != 0) r = a % b, a = b, b = r; return a;
}

int carmichael(int a, int m)
{
    int n, b;
	for (n = 1, b = a; b != 1; n++) b = (b * a) % m;
	return n;
}

char buf[40], *p;
int getint()
{
	int n = 0;
	while (*p >= '0') n = (n<<3) + (n<<1) + (*p++ & 0xf);
	return n;
}

int main()
{
	int a1, a2, a3, m1, m2, m3, b1, b2, b3;
	long long ans;
	
	while (fgets(p=buf, 40, stdin) && *p != '0') {
		a1 = getint(), p++, m1 = getint(), p++;
		a2 = getint(), p++, m2 = getint(), p++;
		a3 = getint(), p++, m3 = getint(), p++;		

		b1 = carmichael(a1, m1);
		b2 = carmichael(a2, m2);
		b3 = carmichael(a3, m3);
		
		ans = (long long)b1 / gcd(b1,  b2) * b2;
		ans =           ans / gcd(ans, b3) * b3;
		printf("%lld\n", ans);
	}
	return 0;
}
2 5 5 7 6 13
517 1024 746 6561 4303 3125
0 0 0 0 0 0
 2 5 5 7 6 13
517 1334 746 6561 4303 3125
0 0 0 0 0 0
 2 5 5 7 6 13
517 1024 746 11315 4303 3125
0 0 0 0 0 0
 2 5 5 7 6 13
913 1334 1228 6561 4303 3125
0 0 0 0 0 0
 2 5 5 7 6 13
517 1024 746 14921 4303 3125
0 0 0 0 0 0
 2 5 5 7 6 13
517 821 746 11315 4303 3125
0 0 0 0 0 0
 2 5 5 7 6 13
913 1334 764 6561 6799 3125
0 0 0 0 0 0
 2 5 6 7 6 13
517 1024 746 11867 4303 3125
0 0 0 0 0 0
 2 5 5 7 6 13
844 821 1163 11315 4303 3125
0 0 0 0 0 0
 2 5 5 7 6 13
913 1334 764 6561 10568 3125
0 0 0 0 0 0

12
116640000
 12
140332500
 12
1440000
 12
420997500
 12
581280000
 12
922500
 12
28066500
 12
949280000
 12
1845000
 12
5613300

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

```c
// AOJ 0114: Electro-Fly
// 2017.8.23 bal4u@uu
// 1017.11.14

#include <stdio.h>

long long gcd(long long a, long long b)
{
	long long r;
	if (a < b) r = a, a = b, b = r;
	while (b != 0) r = a % b, a = b, b = r; return a;
}

int carmichael(int a, int m)
{
    int n, b;
	for (n = 1, b = a; b != 1; n++) b = (b * a) % m;
	return n;
}

char buf[40], *p;
int getint()
{
	int n = 0;
	while (*p >= '0') n = (n<<3) + (n<<1) + (*p++ & 0xf);
	return n;
}

int main()
{
	int a1, a2, a3, m1, m2, m3, b1, b2, b3;
	long long ans;
	
	while (fgets(p=buf, 40, stdin) && *p != '0') {
		a1 = getint(), p++, m1 = getint(), p++;
		a2 = getint(), p++, m2 = getint(), p++;
		a3 = getint(), p++, m3 = getint(), p++;		

		b1 = carmichael(a1, m1);
		b2 = carmichael(a2, m2);
		b3 = carmichael(a3, m3);
		
		ans = (long long)b1 / gcd(b1,  b2) * b2;
		ans =           ans / gcd(ans, b3) * b3;
		printf("%lld\n", ans);
	}
	return 0;
}```

Unoptimized Assembly Code:

```assembly
	.file	"temp.c"
	.text
	.globl	gcd
	.type	gcd, @function
gcd:
.LFB0:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	movq	%rdi, -24(%rbp)
	movq	%rsi, -32(%rbp)
	movq	-24(%rbp), %rax
	cmpq	-32(%rbp), %rax
	jge	.L3
	movq	-24(%rbp), %rax
	movq	%rax, -8(%rbp)
	movq	-32(%rbp), %rax
	movq	%rax, -24(%rbp)
	movq	-8(%rbp), %rax
	movq	%rax, -32(%rbp)
	jmp	.L3
.L4:
	movq	-24(%rbp), %rax
	cqto
	idivq	-32(%rbp)
	movq	%rdx, -8(%rbp)
	movq	-32(%rbp), %rax
	movq	%rax, -24(%rbp)
	movq	-8(%rbp), %rax
	movq	%rax, -32(%rbp)
.L3:
	cmpq	$0, -32(%rbp)
	jne	.L4
	movq	-24(%rbp), %rax
	popq	%rbp
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE0:
	.size	gcd, .-gcd
	.globl	carmichael
	.type	carmichael, @function
carmichael:
.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)
	movl	%esi, -24(%rbp)
	movl	$1, -8(%rbp)
	movl	-20(%rbp), %eax
	movl	%eax, -4(%rbp)
	jmp	.L7
.L8:
	movl	-4(%rbp), %eax
	imull	-20(%rbp), %eax
	cltd
	idivl	-24(%rbp)
	movl	%edx, -4(%rbp)
	addl	$1, -8(%rbp)
.L7:
	cmpl	$1, -4(%rbp)
	jne	.L8
	movl	-8(%rbp), %eax
	popq	%rbp
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE1:
	.size	carmichael, .-carmichael
	.globl	buf
	.bss
	.align 32
	.type	buf, @object
	.size	buf, 40
buf:
	.zero	40
	.globl	p
	.align 8
	.type	p, @object
	.size	p, 8
p:
	.zero	8
	.text
	.globl	getint
	.type	getint, @function
getint:
.LFB2:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	movl	$0, -4(%rbp)
	jmp	.L11
.L12:
	movl	-4(%rbp), %eax
	leal	0(,%rax,8), %edx
	movl	-4(%rbp), %eax
	addl	%eax, %eax
	leal	(%rdx,%rax), %ecx
	movq	p(%rip), %rax
	leaq	1(%rax), %rdx
	movq	%rdx, p(%rip)
	movzbl	(%rax), %eax
	movsbl	%al, %eax
	andl	$15, %eax
	addl	%ecx, %eax
	movl	%eax, -4(%rbp)
.L11:
	movq	p(%rip), %rax
	movzbl	(%rax), %eax
	cmpb	$47, %al
	jg	.L12
	movl	-4(%rbp), %eax
	popq	%rbp
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE2:
	.size	getint, .-getint
	.section	.rodata
.LC0:
	.string	"%lld\n"
	.text
	.globl	main
	.type	main, @function
main:
.LFB3:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	pushq	%rbx
	subq	$56, %rsp
	.cfi_offset 3, -24
	jmp	.L15
.L17:
	movl	$0, %eax
	call	getint
	movl	%eax, -60(%rbp)
	movq	p(%rip), %rax
	addq	$1, %rax
	movq	%rax, p(%rip)
	movl	$0, %eax
	call	getint
	movl	%eax, -56(%rbp)
	movq	p(%rip), %rax
	addq	$1, %rax
	movq	%rax, p(%rip)
	movl	$0, %eax
	call	getint
	movl	%eax, -52(%rbp)
	movq	p(%rip), %rax
	addq	$1, %rax
	movq	%rax, p(%rip)
	movl	$0, %eax
	call	getint
	movl	%eax, -48(%rbp)
	movq	p(%rip), %rax
	addq	$1, %rax
	movq	%rax, p(%rip)
	movl	$0, %eax
	call	getint
	movl	%eax, -44(%rbp)
	movq	p(%rip), %rax
	addq	$1, %rax
	movq	%rax, p(%rip)
	movl	$0, %eax
	call	getint
	movl	%eax, -40(%rbp)
	movq	p(%rip), %rax
	addq	$1, %rax
	movq	%rax, p(%rip)
	movl	-56(%rbp), %edx
	movl	-60(%rbp), %eax
	movl	%edx, %esi
	movl	%eax, %edi
	call	carmichael
	movl	%eax, -36(%rbp)
	movl	-48(%rbp), %edx
	movl	-52(%rbp), %eax
	movl	%edx, %esi
	movl	%eax, %edi
	call	carmichael
	movl	%eax, -32(%rbp)
	movl	-40(%rbp), %edx
	movl	-44(%rbp), %eax
	movl	%edx, %esi
	movl	%eax, %edi
	call	carmichael
	movl	%eax, -28(%rbp)
	movl	-36(%rbp), %eax
	movslq	%eax, %rbx
	movl	-32(%rbp), %eax
	movslq	%eax, %rdx
	movl	-36(%rbp), %eax
	cltq
	movq	%rdx, %rsi
	movq	%rax, %rdi
	call	gcd
	movq	%rax, %rcx
	movq	%rbx, %rax
	cqto
	idivq	%rcx
	movq	%rax, %rdx
	movl	-32(%rbp), %eax
	cltq
	imulq	%rdx, %rax
	movq	%rax, -24(%rbp)
	movl	-28(%rbp), %eax
	movslq	%eax, %rdx
	movq	-24(%rbp), %rax
	movq	%rdx, %rsi
	movq	%rax, %rdi
	call	gcd
	movq	%rax, %rcx
	movq	-24(%rbp), %rax
	cqto
	idivq	%rcx
	movq	%rax, %rdx
	movl	-28(%rbp), %eax
	cltq
	imulq	%rdx, %rax
	movq	%rax, -24(%rbp)
	movq	-24(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
.L15:
	movq	stdin(%rip), %rdx
	leaq	buf(%rip), %rax
	movq	%rax, p(%rip)
	movq	p(%rip), %rax
	movl	$40, %esi
	movq	%rax, %rdi
	call	fgets@PLT
	testq	%rax, %rax
	je	.L16
	movq	p(%rip), %rax
	movzbl	(%rax), %eax
	cmpb	$48, %al
	jne	.L17
.L16:
	movl	$0, %eax
	movq	-8(%rbp), %rbx
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE3:
	.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
	.globl	gcd
	.type	gcd, @function
gcd:
.LFB0:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	movq	%rdi, -24(%rbp)
	movq	%rsi, -32(%rbp)
	movq	-24(%rbp), %rax
	cmpq	-32(%rbp), %rax
	jge	.L3
	movq	-24(%rbp), %rax
	movq	%rax, -8(%rbp)
	movq	-32(%rbp), %rax
	movq	%rax, -24(%rbp)
	movq	-8(%rbp), %rax
	movq	%rax, -32(%rbp)
	jmp	.L3
.L4:
	movq	-24(%rbp), %rax
	cqto
	idivq	-32(%rbp)
	movq	%rdx, -8(%rbp)
	movq	-32(%rbp), %rax
	movq	%rax, -24(%rbp)
	movq	-8(%rbp), %rax
	movq	%rax, -32(%rbp)
.L3:
	cmpq	$0, -32(%rbp)
	jne	.L4
	movq	-24(%rbp), %rax
	popq	%rbp
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE0:
	.size	gcd, .-gcd
	.globl	carmichael
	.type	carmichael, @function
carmichael:
.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)
	movl	%esi, -24(%rbp)
	movl	$1, -8(%rbp)
	movl	-20(%rbp), %eax
	movl	%eax, -4(%rbp)
	jmp	.L7
.L8:
	movl	-4(%rbp), %eax
	imull	-20(%rbp), %eax
	cltd
	idivl	-24(%rbp)
	movl	%edx, -4(%rbp)
	addl	$1, -8(%rbp)
.L7:
	cmpl	$1, -4(%rbp)
	jne	.L8
	movl	-8(%rbp), %eax
	popq	%rbp
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE1:
	.size	carmichael, .-carmichael
	.globl	buf
	.bss
	.align 32
	.type	buf, @object
	.size	buf, 40
buf:
	.zero	40
	.globl	p
	.align 8
	.type	p, @object
	.size	p, 8
p:
	.zero	8
	.text
	.globl	getint
	.type	getint, @function
getint:
.LFB2:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	movl	$0, -4(%rbp)
	jmp	.L11
.L12:
	movl	-4(%rbp), %eax
	leal	0(,%rax,8), %edx
	movl	-4(%rbp), %eax
	addl	%eax, %eax
	leal	(%rdx,%rax), %ecx
	movq	p(%rip), %rax
	leaq	1(%rax), %rdx
	movq	%rdx, p(%rip)
	movzbl	(%rax), %eax
	movsbl	%al, %eax
	andl	$15, %eax
	addl	%ecx, %eax
	movl	%eax, -4(%rbp)
.L11:
	movq	p(%rip), %rax
	movzbl	(%rax), %eax
	cmpb	$47, %al
	jg	.L12
	movl	-4(%rbp), %eax
	popq	%rbp
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE2:
	.size	getint, .-getint
	.section	.rodata
.LC0:
	.string	"%lld\n"
	.text
	.globl	main
	.type	main, @function
main:
.LFB3:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	pushq	%rbx
	subq	$56, %rsp
	.cfi_offset 3, -24
	jmp	.L15
.L17:
	movl	$0, %eax
	call	getint
	movl	%eax, -60(%rbp)
	movq	p(%rip), %rax
	addq	$1, %rax
	movq	%rax, p(%rip)
	movl	$0, %eax
	call	getint
	movl	%eax, -56(%rbp)
	movq	p(%rip), %rax
	addq	$1, %rax
	movq	%rax, p(%rip)
	movl	$0, %eax
	call	getint
	movl	%eax, -52(%rbp)
	movq	p(%rip), %rax
	addq	$1, %rax
	movq	%rax, p(%rip)
	movl	$0, %eax
	call	getint
	movl	%eax, -48(%rbp)
	movq	p(%rip), %rax
	addq	$1, %rax
	movq	%rax, p(%rip)
	movl	$0, %eax
	call	getint
	movl	%eax, -44(%rbp)
	movq	p(%rip), %rax
	addq	$1, %rax
	movq	%rax, p(%rip)
	movl	$0, %eax
	call	getint
	movl	%eax, -40(%rbp)
	movq	p(%rip), %rax
	addq	$1, %rax
	movq	%rax, p(%rip)
	movl	-56(%rbp), %edx
	movl	-60(%rbp), %eax
	movl	%edx, %esi
	movl	%eax, %edi
	call	carmichael
	movl	%eax, -36(%rbp)
	movl	-48(%rbp), %edx
	movl	-52(%rbp), %eax
	movl	%edx, %esi
	movl	%eax, %edi
	call	carmichael
	movl	%eax, -32(%rbp)
	movl	-40(%rbp), %edx
	movl	-44(%rbp), %eax
	movl	%edx, %esi
	movl	%eax, %edi
	call	carmichael
	movl	%eax, -28(%rbp)
	movl	-36(%rbp), %eax
	movslq	%eax, %rbx
	movl	-32(%rbp), %eax
	movslq	%eax, %rdx
	movl	-36(%rbp), %eax
	cltq
	movq	%rdx, %rsi
	movq	%rax, %rdi
	call	gcd
	movq	%rax, %rcx
	movq	%rbx, %rax
	cqto
	idivq	%rcx
	movq	%rax, %rdx
	movl	-32(%rbp), %eax
	cltq
	imulq	%rdx, %rax
	movq	%rax, -24(%rbp)
	movl	-28(%rbp), %eax
	movslq	%eax, %rdx
	movq	-24(%rbp), %rax
	movq	%rdx, %rsi
	movq	%rax, %rdi
	call	gcd
	movq	%rax, %rcx
	movq	-24(%rbp), %rax
	cqto
	idivq	%rcx
	movq	%rax, %rdx
	movl	-28(%rbp), %eax
	cltq
	imulq	%rdx, %rax
	movq	%rax, -24(%rbp)
	movq	-24(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
.L15:
	movq	stdin(%rip), %rdx
	leaq	buf(%rip), %rax
	movq	%rax, p(%rip)
	movq	p(%rip), %rax
	movl	$40, %esi
	movq	%rax, %rdi
	call	fgets@PLT
	testq	%rax, %rax
	je	.L16
	movq	p(%rip), %rax
	movzbl	(%rax), %eax
	cmpb	$48, %al
	jne	.L17
.L16:
	movl	$0, %eax
	movq	-8(%rbp), %rbx
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE3:
	.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:
