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>
#define LLI long long int

LLI flymove(LLI a,LLI m){
  LLI c=1,p=1;
  while((p=p*a%m)!=1) {
    c++;
  }
  return c;
}

LLI lcm(LLI r,LLI s){
  LLI t=1;
  while(r*t%s!=0)t++;
  return r*t;
}

int main(){
  LLI a1,m1,a2,m2,a3,m3;
  LLI x,y,z;
  while(scanf("%lld %lld %lld %lld %lld %lld",&a1,&m1,&a2,&m2,&a3,&m3)){
    if((a1|m1|a2|m2|a3|m3)==0) break;
    x=flymove(a1,m1);
    y=flymove(a2,m2);
    z=flymove(a3,m3);
    printf("%lld\n",lcm(lcm(x,y),z));
  }
  return 0;
}```

Unoptimized Assembly Code:

```assembly
	.file	"temp.c"
	.text
	.globl	flymove
	.type	flymove, @function
flymove:
.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	$1, -16(%rbp)
	movq	$1, -8(%rbp)
	jmp	.L2
.L3:
	addq	$1, -16(%rbp)
.L2:
	movq	-8(%rbp), %rax
	imulq	-24(%rbp), %rax
	cqto
	idivq	-32(%rbp)
	movq	%rdx, -8(%rbp)
	cmpq	$1, -8(%rbp)
	jne	.L3
	movq	-16(%rbp), %rax
	popq	%rbp
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE0:
	.size	flymove, .-flymove
	.globl	lcm
	.type	lcm, @function
lcm:
.LFB1:
	.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	$1, -8(%rbp)
	jmp	.L6
.L7:
	addq	$1, -8(%rbp)
.L6:
	movq	-24(%rbp), %rax
	imulq	-8(%rbp), %rax
	cqto
	idivq	-32(%rbp)
	movq	%rdx, %rax
	testq	%rax, %rax
	jne	.L7
	movq	-24(%rbp), %rax
	imulq	-8(%rbp), %rax
	popq	%rbp
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE1:
	.size	lcm, .-lcm
	.section	.rodata
.LC0:
	.string	"%lld\n"
.LC1:
	.string	"%lld %lld %lld %lld %lld %lld"
	.text
	.globl	main
	.type	main, @function
main:
.LFB2:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	subq	$80, %rsp
	movq	%fs:40, %rax
	movq	%rax, -8(%rbp)
	xorl	%eax, %eax
	jmp	.L10
.L13:
	movq	-80(%rbp), %rdx
	movq	-72(%rbp), %rax
	orq	%rax, %rdx
	movq	-64(%rbp), %rax
	orq	%rax, %rdx
	movq	-56(%rbp), %rax
	orq	%rax, %rdx
	movq	-48(%rbp), %rax
	orq	%rax, %rdx
	movq	-40(%rbp), %rax
	orq	%rdx, %rax
	testq	%rax, %rax
	je	.L16
	movq	-72(%rbp), %rdx
	movq	-80(%rbp), %rax
	movq	%rdx, %rsi
	movq	%rax, %rdi
	call	flymove
	movq	%rax, -32(%rbp)
	movq	-56(%rbp), %rdx
	movq	-64(%rbp), %rax
	movq	%rdx, %rsi
	movq	%rax, %rdi
	call	flymove
	movq	%rax, -24(%rbp)
	movq	-40(%rbp), %rdx
	movq	-48(%rbp), %rax
	movq	%rdx, %rsi
	movq	%rax, %rdi
	call	flymove
	movq	%rax, -16(%rbp)
	movq	-24(%rbp), %rdx
	movq	-32(%rbp), %rax
	movq	%rdx, %rsi
	movq	%rax, %rdi
	call	lcm
	movq	%rax, %rdx
	movq	-16(%rbp), %rax
	movq	%rax, %rsi
	movq	%rdx, %rdi
	call	lcm
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
.L10:
	leaq	-48(%rbp), %r8
	leaq	-56(%rbp), %rdi
	leaq	-64(%rbp), %rcx
	leaq	-72(%rbp), %rdx
	leaq	-80(%rbp), %rax
	subq	$8, %rsp
	leaq	-40(%rbp), %rsi
	pushq	%rsi
	movq	%r8, %r9
	movq	%rdi, %r8
	movq	%rax, %rsi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	addq	$16, %rsp
	testl	%eax, %eax
	jne	.L13
	jmp	.L12
.L16:
	nop
.L12:
	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
.LFE2:
	.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	flymove
	.type	flymove, @function
flymove:
.LFB23:
	.cfi_startproc
	endbr64
	movq	%rdi, %rax
	movl	$1, %r8d
	cqto
	idivq	%rsi
	cmpq	$1, %rdx
	je	.L1
	.p2align 4,,10
	.p2align 3
.L3:
	movq	%rdx, %rax
	addq	$1, %r8
	imulq	%rdi, %rax
	cqto
	idivq	%rsi
	cmpq	$1, %rdx
	jne	.L3
.L1:
	movq	%r8, %rax
	ret
	.cfi_endproc
.LFE23:
	.size	flymove, .-flymove
	.p2align 4
	.globl	lcm
	.type	lcm, @function
lcm:
.LFB24:
	.cfi_startproc
	endbr64
	movq	%rdi, %rax
	cqto
	idivq	%rsi
	testq	%rdx, %rdx
	je	.L10
	leaq	(%rdi,%rdi), %rcx
	.p2align 4,,10
	.p2align 3
.L9:
	movq	%rcx, %r8
	addq	%rdi, %rcx
	movq	%r8, %rax
	cqto
	idivq	%rsi
	testq	%rdx, %rdx
	jne	.L9
	movq	%r8, %rax
	ret
	.p2align 4,,10
	.p2align 3
.L10:
	movq	%rdi, %r8
	movq	%r8, %rax
	ret
	.cfi_endproc
.LFE24:
	.size	lcm, .-lcm
	.section	.rodata.str1.1,"aMS",@progbits,1
.LC0:
	.string	"%lld\n"
.LC1:
	.string	"%lld %lld %lld %lld %lld %lld"
	.section	.text.startup,"ax",@progbits
	.p2align 4
	.globl	main
	.type	main, @function
main:
.LFB25:
	.cfi_startproc
	endbr64
	pushq	%r15
	.cfi_def_cfa_offset 16
	.cfi_offset 15, -16
	pushq	%r14
	.cfi_def_cfa_offset 24
	.cfi_offset 14, -24
	pushq	%r13
	.cfi_def_cfa_offset 32
	.cfi_offset 13, -32
	pushq	%r12
	.cfi_def_cfa_offset 40
	.cfi_offset 12, -40
	pushq	%rbp
	.cfi_def_cfa_offset 48
	.cfi_offset 6, -48
	pushq	%rbx
	.cfi_def_cfa_offset 56
	.cfi_offset 3, -56
	leaq	.LC1(%rip), %rbx
	subq	$88, %rsp
	.cfi_def_cfa_offset 144
	movq	%fs:40, %rax
	movq	%rax, 72(%rsp)
	xorl	%eax, %eax
	leaq	64(%rsp), %rax
	leaq	56(%rsp), %r15
	movq	%rax, 8(%rsp)
	leaq	48(%rsp), %r14
	leaq	40(%rsp), %r13
	leaq	32(%rsp), %r12
	leaq	24(%rsp), %rbp
	.p2align 4,,10
	.p2align 3
.L13:
	subq	$8, %rsp
	.cfi_def_cfa_offset 152
	movq	%r13, %rcx
	movq	%r12, %rdx
	movq	%r15, %r9
	pushq	16(%rsp)
	.cfi_def_cfa_offset 160
	movq	%r14, %r8
	movq	%rbp, %rsi
	movq	%rbx, %rdi
	xorl	%eax, %eax
	call	__isoc99_scanf@PLT
	popq	%rdx
	.cfi_def_cfa_offset 152
	popq	%rcx
	.cfi_def_cfa_offset 144
	testl	%eax, %eax
	je	.L14
	movq	24(%rsp), %r11
	movq	32(%rsp), %rcx
	movq	40(%rsp), %r9
	movq	48(%rsp), %rsi
	movq	%r11, %rax
	movq	56(%rsp), %r10
	movq	64(%rsp), %rdi
	orq	%rcx, %rax
	orq	%r9, %rax
	orq	%rsi, %rax
	orq	%r10, %rax
	orq	%rdi, %rax
	je	.L14
	movq	%r11, %rax
	movl	$1, %r8d
	cqto
	idivq	%rcx
	cmpq	$1, %rdx
	je	.L15
	.p2align 4,,10
	.p2align 3
.L16:
	movq	%rdx, %rax
	addq	$1, %r8
	imulq	%r11, %rax
	cqto
	idivq	%rcx
	cmpq	$1, %rdx
	jne	.L16
.L15:
	movq	%r9, %rax
	movl	$1, %ecx
	cqto
	idivq	%rsi
	cmpq	$1, %rdx
	je	.L50
	.p2align 4,,10
	.p2align 3
.L17:
	movq	%rdx, %rax
	addq	$1, %rcx
	imulq	%r9, %rax
	cqto
	idivq	%rsi
	cmpq	$1, %rdx
	jne	.L17
	movq	%r8, %rax
	cqto
	idivq	%rcx
	movq	%r10, %rax
	movq	%rdx, %r11
	movq	%rdx, %r9
	cqto
	idivq	%rdi
	cmpq	$1, %rdx
	je	.L20
.L18:
	movl	$1, %esi
	.p2align 4,,10
	.p2align 3
.L21:
	movq	%rdx, %rax
	addq	$1, %rsi
	imulq	%r10, %rax
	cqto
	idivq	%rdi
	cmpq	$1, %rdx
	jne	.L21
	testq	%r9, %r9
	je	.L22
.L26:
	movq	%r8, %r9
	leaq	(%r8,%r8), %rdi
	.p2align 4,,10
	.p2align 3
.L23:
	movq	%rdi, %r8
	addq	%r9, %rdi
	movq	%r8, %rax
	cqto
	idivq	%rcx
	testq	%rdx, %rdx
	jne	.L23
.L22:
	movq	%r8, %rax
	cqto
	idivq	%rsi
	testq	%rdx, %rdx
	je	.L19
	movq	%r8, %rdi
	leaq	(%r8,%r8), %rcx
	.p2align 4,,10
	.p2align 3
.L24:
	movq	%rcx, %r8
	addq	%rdi, %rcx
	movq	%r8, %rax
	cqto
	idivq	%rsi
	testq	%rdx, %rdx
	jne	.L24
.L19:
	movq	%r8, %rdx
	leaq	.LC0(%rip), %rsi
	movl	$1, %edi
	xorl	%eax, %eax
	call	__printf_chk@PLT
	jmp	.L13
	.p2align 4,,10
	.p2align 3
.L14:
	movq	72(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L51
	addq	$88, %rsp
	.cfi_remember_state
	.cfi_def_cfa_offset 56
	xorl	%eax, %eax
	popq	%rbx
	.cfi_def_cfa_offset 48
	popq	%rbp
	.cfi_def_cfa_offset 40
	popq	%r12
	.cfi_def_cfa_offset 32
	popq	%r13
	.cfi_def_cfa_offset 24
	popq	%r14
	.cfi_def_cfa_offset 16
	popq	%r15
	.cfi_def_cfa_offset 8
	ret
	.p2align 4,,10
	.p2align 3
.L50:
	.cfi_restore_state
	movq	%r10, %rax
	xorl	%r9d, %r9d
	cqto
	idivq	%rdi
	cmpq	$1, %rdx
	jne	.L18
	jmp	.L19
	.p2align 4,,10
	.p2align 3
.L20:
	movl	$1, %esi
	testq	%r11, %r11
	jne	.L26
	jmp	.L19
.L51:
	call	__stack_chk_fail@PLT
	.cfi_endproc
.LFE25:
	.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
	.p2align 4
	.globl	flymove
	.type	flymove, @function
flymove:
.LFB23:
	.cfi_startproc
	endbr64
	movq	%rdi, %rax
	movl	$1, %r8d
	cqto
	idivq	%rsi
	cmpq	$1, %rdx
	je	.L1
	.p2align 4,,10
	.p2align 3
.L3:
	movq	%rdx, %rax
	addq	$1, %r8
	imulq	%rdi, %rax
	cqto
	idivq	%rsi
	cmpq	$1, %rdx
	jne	.L3
.L1:
	movq	%r8, %rax
	ret
	.cfi_endproc
.LFE23:
	.size	flymove, .-flymove
	.p2align 4
	.globl	lcm
	.type	lcm, @function
lcm:
.LFB24:
	.cfi_startproc
	endbr64
	movq	%rdi, %rax
	cqto
	idivq	%rsi
	testq	%rdx, %rdx
	je	.L10
	leaq	(%rdi,%rdi), %rcx
	.p2align 4,,10
	.p2align 3
.L9:
	movq	%rcx, %r8
	addq	%rdi, %rcx
	movq	%r8, %rax
	cqto
	idivq	%rsi
	testq	%rdx, %rdx
	jne	.L9
	movq	%r8, %rax
	ret
	.p2align 4,,10
	.p2align 3
.L10:
	movq	%rdi, %r8
	movq	%r8, %rax
	ret
	.cfi_endproc
.LFE24:
	.size	lcm, .-lcm
	.section	.rodata.str1.1,"aMS",@progbits,1
.LC0:
	.string	"%lld\n"
.LC1:
	.string	"%lld %lld %lld %lld %lld %lld"
	.section	.text.startup,"ax",@progbits
	.p2align 4
	.globl	main
	.type	main, @function
main:
.LFB25:
	.cfi_startproc
	endbr64
	pushq	%r15
	.cfi_def_cfa_offset 16
	.cfi_offset 15, -16
	pushq	%r14
	.cfi_def_cfa_offset 24
	.cfi_offset 14, -24
	pushq	%r13
	.cfi_def_cfa_offset 32
	.cfi_offset 13, -32
	pushq	%r12
	.cfi_def_cfa_offset 40
	.cfi_offset 12, -40
	pushq	%rbp
	.cfi_def_cfa_offset 48
	.cfi_offset 6, -48
	pushq	%rbx
	.cfi_def_cfa_offset 56
	.cfi_offset 3, -56
	leaq	.LC1(%rip), %rbx
	subq	$88, %rsp
	.cfi_def_cfa_offset 144
	movq	%fs:40, %rax
	movq	%rax, 72(%rsp)
	xorl	%eax, %eax
	leaq	64(%rsp), %rax
	leaq	56(%rsp), %r15
	movq	%rax, 8(%rsp)
	leaq	48(%rsp), %r14
	leaq	40(%rsp), %r13
	leaq	32(%rsp), %r12
	leaq	24(%rsp), %rbp
	.p2align 4,,10
	.p2align 3
.L13:
	subq	$8, %rsp
	.cfi_def_cfa_offset 152
	movq	%r13, %rcx
	movq	%r12, %rdx
	movq	%r15, %r9
	pushq	16(%rsp)
	.cfi_def_cfa_offset 160
	movq	%r14, %r8
	movq	%rbp, %rsi
	movq	%rbx, %rdi
	xorl	%eax, %eax
	call	__isoc99_scanf@PLT
	popq	%rdx
	.cfi_def_cfa_offset 152
	popq	%rcx
	.cfi_def_cfa_offset 144
	testl	%eax, %eax
	je	.L14
	movq	24(%rsp), %r11
	movq	32(%rsp), %rcx
	movq	40(%rsp), %r9
	movq	48(%rsp), %rsi
	movq	%r11, %rax
	movq	56(%rsp), %r10
	movq	64(%rsp), %rdi
	orq	%rcx, %rax
	orq	%r9, %rax
	orq	%rsi, %rax
	orq	%r10, %rax
	orq	%rdi, %rax
	je	.L14
	movq	%r11, %rax
	movl	$1, %r8d
	cqto
	idivq	%rcx
	cmpq	$1, %rdx
	je	.L15
	.p2align 4,,10
	.p2align 3
.L16:
	movq	%rdx, %rax
	addq	$1, %r8
	imulq	%r11, %rax
	cqto
	idivq	%rcx
	cmpq	$1, %rdx
	jne	.L16
.L15:
	movq	%r9, %rax
	movl	$1, %ecx
	cqto
	idivq	%rsi
	cmpq	$1, %rdx
	je	.L50
	.p2align 4,,10
	.p2align 3
.L17:
	movq	%rdx, %rax
	addq	$1, %rcx
	imulq	%r9, %rax
	cqto
	idivq	%rsi
	cmpq	$1, %rdx
	jne	.L17
	movq	%r8, %rax
	cqto
	idivq	%rcx
	movq	%r10, %rax
	movq	%rdx, %r11
	movq	%rdx, %r9
	cqto
	idivq	%rdi
	cmpq	$1, %rdx
	je	.L20
.L18:
	movl	$1, %esi
	.p2align 4,,10
	.p2align 3
.L21:
	movq	%rdx, %rax
	addq	$1, %rsi
	imulq	%r10, %rax
	cqto
	idivq	%rdi
	cmpq	$1, %rdx
	jne	.L21
	testq	%r9, %r9
	je	.L22
.L26:
	movq	%r8, %r9
	leaq	(%r8,%r8), %rdi
	.p2align 4,,10
	.p2align 3
.L23:
	movq	%rdi, %r8
	addq	%r9, %rdi
	movq	%r8, %rax
	cqto
	idivq	%rcx
	testq	%rdx, %rdx
	jne	.L23
.L22:
	movq	%r8, %rax
	cqto
	idivq	%rsi
	testq	%rdx, %rdx
	je	.L19
	movq	%r8, %rdi
	leaq	(%r8,%r8), %rcx
	.p2align 4,,10
	.p2align 3
.L24:
	movq	%rcx, %r8
	addq	%rdi, %rcx
	movq	%r8, %rax
	cqto
	idivq	%rsi
	testq	%rdx, %rdx
	jne	.L24
.L19:
	movq	%r8, %rdx
	leaq	.LC0(%rip), %rsi
	movl	$1, %edi
	xorl	%eax, %eax
	call	__printf_chk@PLT
	jmp	.L13
	.p2align 4,,10
	.p2align 3
.L14:
	movq	72(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L51
	addq	$88, %rsp
	.cfi_remember_state
	.cfi_def_cfa_offset 56
	xorl	%eax, %eax
	popq	%rbx
	.cfi_def_cfa_offset 48
	popq	%rbp
	.cfi_def_cfa_offset 40
	popq	%r12
	.cfi_def_cfa_offset 32
	popq	%r13
	.cfi_def_cfa_offset 24
	popq	%r14
	.cfi_def_cfa_offset 16
	popq	%r15
	.cfi_def_cfa_offset 8
	ret
	.p2align 4,,10
	.p2align 3
.L50:
	.cfi_restore_state
	movq	%r10, %rax
	xorl	%r9d, %r9d
	cqto
	idivq	%rdi
	cmpq	$1, %rdx
	jne	.L18
	jmp	.L19
	.p2align 4,,10
	.p2align 3
.L20:
	movl	$1, %esi
	testq	%r11, %r11
	jne	.L26
	jmp	.L19
.L51:
	call	__stack_chk_fail@PLT
	.cfi_endproc
.LFE25:
	.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>
#define LLI long long int

LLI flymove(LLI a,LLI m){
  LLI c=1,p=1;
  while((p=p*a%m)!=1) {
    c++;
  }
  return c;
}

LLI lcm(LLI r,LLI s){
  LLI t=1;
  while(r*t%s!=0)t++;
  return r*t;
}

int main(){
  LLI a1,m1,a2,m2,a3,m3;
  LLI x,y,z;
  while(scanf("%lld %lld %lld %lld %lld %lld",&a1,&m1,&a2,&m2,&a3,&m3)){
    if((a1|m1|a2|m2|a3|m3)==0) break;
    x=flymove(a1,m1);
    y=flymove(a2,m2);
    z=flymove(a3,m3);
    printf("%lld\n",lcm(lcm(x,y),z));
  }
  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
#include <stdio.h>
#define LLI long long int

LLI flymove(LLI a,LLI m){
  LLI c=1,p=1;
  while((p=p*a%m)!=1) {
    c++;
  }
  return c;
}

LLI lcm(LLI r,LLI s){
  LLI t=1;
  while(r*t%s!=0)t++;
  return r*t;
}

int main(){
  LLI a1,m1,a2,m2,a3,m3;
  LLI x,y,z;
  while(scanf("%lld %lld %lld %lld %lld %lld",&a1,&m1,&a2,&m2,&a3,&m3)){
    if((a1|m1|a2|m2|a3|m3)==0) break;
    x=flymove(a1,m1);
    y=flymove(a2,m2);
    z=flymove(a3,m3);
    printf("%lld\n",lcm(lcm(x,y),z));
  }
  return 0;
}```

Unoptimized Assembly Code:

```assembly
	.file	"temp.c"
	.text
	.globl	flymove
	.type	flymove, @function
flymove:
.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	$1, -16(%rbp)
	movq	$1, -8(%rbp)
	jmp	.L2
.L3:
	addq	$1, -16(%rbp)
.L2:
	movq	-8(%rbp), %rax
	imulq	-24(%rbp), %rax
	cqto
	idivq	-32(%rbp)
	movq	%rdx, -8(%rbp)
	cmpq	$1, -8(%rbp)
	jne	.L3
	movq	-16(%rbp), %rax
	popq	%rbp
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE0:
	.size	flymove, .-flymove
	.globl	lcm
	.type	lcm, @function
lcm:
.LFB1:
	.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	$1, -8(%rbp)
	jmp	.L6
.L7:
	addq	$1, -8(%rbp)
.L6:
	movq	-24(%rbp), %rax
	imulq	-8(%rbp), %rax
	cqto
	idivq	-32(%rbp)
	movq	%rdx, %rax
	testq	%rax, %rax
	jne	.L7
	movq	-24(%rbp), %rax
	imulq	-8(%rbp), %rax
	popq	%rbp
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE1:
	.size	lcm, .-lcm
	.section	.rodata
.LC0:
	.string	"%lld\n"
.LC1:
	.string	"%lld %lld %lld %lld %lld %lld"
	.text
	.globl	main
	.type	main, @function
main:
.LFB2:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	subq	$80, %rsp
	movq	%fs:40, %rax
	movq	%rax, -8(%rbp)
	xorl	%eax, %eax
	jmp	.L10
.L13:
	movq	-80(%rbp), %rdx
	movq	-72(%rbp), %rax
	orq	%rax, %rdx
	movq	-64(%rbp), %rax
	orq	%rax, %rdx
	movq	-56(%rbp), %rax
	orq	%rax, %rdx
	movq	-48(%rbp), %rax
	orq	%rax, %rdx
	movq	-40(%rbp), %rax
	orq	%rdx, %rax
	testq	%rax, %rax
	je	.L16
	movq	-72(%rbp), %rdx
	movq	-80(%rbp), %rax
	movq	%rdx, %rsi
	movq	%rax, %rdi
	call	flymove
	movq	%rax, -32(%rbp)
	movq	-56(%rbp), %rdx
	movq	-64(%rbp), %rax
	movq	%rdx, %rsi
	movq	%rax, %rdi
	call	flymove
	movq	%rax, -24(%rbp)
	movq	-40(%rbp), %rdx
	movq	-48(%rbp), %rax
	movq	%rdx, %rsi
	movq	%rax, %rdi
	call	flymove
	movq	%rax, -16(%rbp)
	movq	-24(%rbp), %rdx
	movq	-32(%rbp), %rax
	movq	%rdx, %rsi
	movq	%rax, %rdi
	call	lcm
	movq	%rax, %rdx
	movq	-16(%rbp), %rax
	movq	%rax, %rsi
	movq	%rdx, %rdi
	call	lcm
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
.L10:
	leaq	-48(%rbp), %r8
	leaq	-56(%rbp), %rdi
	leaq	-64(%rbp), %rcx
	leaq	-72(%rbp), %rdx
	leaq	-80(%rbp), %rax
	subq	$8, %rsp
	leaq	-40(%rbp), %rsi
	pushq	%rsi
	movq	%r8, %r9
	movq	%rdi, %r8
	movq	%rax, %rsi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	addq	$16, %rsp
	testl	%eax, %eax
	jne	.L13
	jmp	.L12
.L16:
	nop
.L12:
	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
.LFE2:
	.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	flymove
	.type	flymove, @function
flymove:
.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	$1, -16(%rbp)
	movq	$1, -8(%rbp)
	jmp	.L2
.L3:
	addq	$1, -16(%rbp)
.L2:
	movq	-8(%rbp), %rax
	imulq	-24(%rbp), %rax
	cqto
	idivq	-32(%rbp)
	movq	%rdx, -8(%rbp)
	cmpq	$1, -8(%rbp)
	jne	.L3
	movq	-16(%rbp), %rax
	popq	%rbp
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE0:
	.size	flymove, .-flymove
	.globl	lcm
	.type	lcm, @function
lcm:
.LFB1:
	.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	$1, -8(%rbp)
	jmp	.L6
.L7:
	addq	$1, -8(%rbp)
.L6:
	movq	-24(%rbp), %rax
	imulq	-8(%rbp), %rax
	cqto
	idivq	-32(%rbp)
	movq	%rdx, %rax
	testq	%rax, %rax
	jne	.L7
	movq	-24(%rbp), %rax
	imulq	-8(%rbp), %rax
	popq	%rbp
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE1:
	.size	lcm, .-lcm
	.section	.rodata
.LC0:
	.string	"%lld\n"
.LC1:
	.string	"%lld %lld %lld %lld %lld %lld"
	.text
	.globl	main
	.type	main, @function
main:
.LFB2:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	subq	$80, %rsp
	movq	%fs:40, %rax
	movq	%rax, -8(%rbp)
	xorl	%eax, %eax
	jmp	.L10
.L13:
	movq	-80(%rbp), %rdx
	movq	-72(%rbp), %rax
	orq	%rax, %rdx
	movq	-64(%rbp), %rax
	orq	%rax, %rdx
	movq	-56(%rbp), %rax
	orq	%rax, %rdx
	movq	-48(%rbp), %rax
	orq	%rax, %rdx
	movq	-40(%rbp), %rax
	orq	%rdx, %rax
	testq	%rax, %rax
	je	.L16
	movq	-72(%rbp), %rdx
	movq	-80(%rbp), %rax
	movq	%rdx, %rsi
	movq	%rax, %rdi
	call	flymove
	movq	%rax, -32(%rbp)
	movq	-56(%rbp), %rdx
	movq	-64(%rbp), %rax
	movq	%rdx, %rsi
	movq	%rax, %rdi
	call	flymove
	movq	%rax, -24(%rbp)
	movq	-40(%rbp), %rdx
	movq	-48(%rbp), %rax
	movq	%rdx, %rsi
	movq	%rax, %rdi
	call	flymove
	movq	%rax, -16(%rbp)
	movq	-24(%rbp), %rdx
	movq	-32(%rbp), %rax
	movq	%rdx, %rsi
	movq	%rax, %rdi
	call	lcm
	movq	%rax, %rdx
	movq	-16(%rbp), %rax
	movq	%rax, %rsi
	movq	%rdx, %rdi
	call	lcm
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
.L10:
	leaq	-48(%rbp), %r8
	leaq	-56(%rbp), %rdi
	leaq	-64(%rbp), %rcx
	leaq	-72(%rbp), %rdx
	leaq	-80(%rbp), %rax
	subq	$8, %rsp
	leaq	-40(%rbp), %rsi
	pushq	%rsi
	movq	%r8, %r9
	movq	%rdi, %r8
	movq	%rax, %rsi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	addq	$16, %rsp
	testl	%eax, %eax
	jne	.L13
	jmp	.L12
.L16:
	nop
.L12:
	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
.LFE2:
	.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:
