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

```c
#include <limits.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>

int f(long h[2], const int a[2], const int b[2]){
	if(a[0]*b[1]>a[1]*b[0]){
		long r = (h[1]+a[1]-1)/a[1];
		h[0] = r*a[0];
		h[1] = r*a[1];
	}else{
		long r = (h[0]+a[0]-1)/a[0];
		h[0] = r*a[0];
		h[1] = r*a[1];
	}
}

int main(void){
	int n, i;
	long h[2]={1,1};
	int a[2], b[2]={1,1};
	scanf("%d", &n);
	for(i=0; i<n; i++){
		scanf("%d%d", a, a+1);
		f(h, a, b);
		b[0]=a[0], b[1]=a[1];
	}
	printf("%ld\n", h[0]+h[1]);
}
```

Unoptimized Assembly Code:

```assembly
	.file	"temp.c"
	.text
	.globl	f
	.type	f, @function
f:
.LFB6:
	.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	%rdx, -40(%rbp)
	movq	-32(%rbp), %rax
	movl	(%rax), %edx
	movq	-40(%rbp), %rax
	addq	$4, %rax
	movl	(%rax), %eax
	imull	%eax, %edx
	movq	-32(%rbp), %rax
	addq	$4, %rax
	movl	(%rax), %ecx
	movq	-40(%rbp), %rax
	movl	(%rax), %eax
	imull	%ecx, %eax
	cmpl	%eax, %edx
	jle	.L2
	movq	-24(%rbp), %rax
	addq	$8, %rax
	movq	(%rax), %rdx
	movq	-32(%rbp), %rax
	addq	$4, %rax
	movl	(%rax), %eax
	cltq
	addq	%rdx, %rax
	subq	$1, %rax
	movq	-32(%rbp), %rdx
	addq	$4, %rdx
	movl	(%rdx), %edx
	movslq	%edx, %rsi
	cqto
	idivq	%rsi
	movq	%rax, -8(%rbp)
	movq	-32(%rbp), %rax
	movl	(%rax), %eax
	cltq
	imulq	-8(%rbp), %rax
	movq	%rax, %rdx
	movq	-24(%rbp), %rax
	movq	%rdx, (%rax)
	movq	-32(%rbp), %rax
	addq	$4, %rax
	movl	(%rax), %eax
	cltq
	movq	-24(%rbp), %rdx
	addq	$8, %rdx
	imulq	-8(%rbp), %rax
	movq	%rax, (%rdx)
	jmp	.L3
.L2:
	movq	-24(%rbp), %rax
	movq	(%rax), %rdx
	movq	-32(%rbp), %rax
	movl	(%rax), %eax
	cltq
	addq	%rdx, %rax
	leaq	-1(%rax), %rcx
	movq	-32(%rbp), %rax
	movl	(%rax), %eax
	movslq	%eax, %rdi
	movq	%rcx, %rax
	cqto
	idivq	%rdi
	movq	%rax, -16(%rbp)
	movq	-32(%rbp), %rax
	movl	(%rax), %eax
	cltq
	imulq	-16(%rbp), %rax
	movq	%rax, %rdx
	movq	-24(%rbp), %rax
	movq	%rdx, (%rax)
	movq	-32(%rbp), %rax
	addq	$4, %rax
	movl	(%rax), %eax
	cltq
	movq	-24(%rbp), %rdx
	addq	$8, %rdx
	imulq	-16(%rbp), %rax
	movq	%rax, (%rdx)
.L3:
	nop
	popq	%rbp
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE6:
	.size	f, .-f
	.section	.rodata
.LC0:
	.string	"%d"
.LC1:
	.string	"%d%d"
.LC2:
	.string	"%ld\n"
	.text
	.globl	main
	.type	main, @function
main:
.LFB7:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	subq	$64, %rsp
	movq	%fs:40, %rax
	movq	%rax, -8(%rbp)
	xorl	%eax, %eax
	movq	$1, -32(%rbp)
	movq	$1, -24(%rbp)
	movl	$1, -40(%rbp)
	movl	$1, -36(%rbp)
	leaq	-56(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	$0, -52(%rbp)
	jmp	.L5
.L6:
	leaq	-48(%rbp), %rax
	addq	$4, %rax
	leaq	-48(%rbp), %rcx
	movq	%rax, %rdx
	movq	%rcx, %rsi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	leaq	-40(%rbp), %rdx
	leaq	-48(%rbp), %rcx
	leaq	-32(%rbp), %rax
	movq	%rcx, %rsi
	movq	%rax, %rdi
	call	f
	movl	-48(%rbp), %eax
	movl	%eax, -40(%rbp)
	movl	-44(%rbp), %eax
	movl	%eax, -36(%rbp)
	addl	$1, -52(%rbp)
.L5:
	movl	-56(%rbp), %eax
	cmpl	%eax, -52(%rbp)
	jl	.L6
	movq	-32(%rbp), %rdx
	movq	-24(%rbp), %rax
	addq	%rdx, %rax
	movq	%rax, %rsi
	leaq	.LC2(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	movl	$0, %eax
	movq	-8(%rbp), %rdx
	subq	%fs:40, %rdx
	je	.L8
	call	__stack_chk_fail@PLT
.L8:
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE7:
	.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	f
	.type	f, @function
f:
.LFB51:
	.cfi_startproc
	endbr64
	movl	(%rsi), %r8d
	movq	%rdi, %rcx
	movslq	4(%rsi), %rdi
	movslq	%r8d, %rsi
	imull	4(%rdx), %r8d
	movq	%rdi, %rax
	imull	(%rdx), %eax
	cmpl	%eax, %r8d
	jle	.L2
	movq	8(%rcx), %rax
	addq	%rdi, %rax
	subq	$1, %rax
	cqto
	idivq	%rdi
	imulq	%rax, %rsi
	imulq	%rax, %rdi
	movq	%rsi, (%rcx)
	movq	%rdi, 8(%rcx)
	ret
	.p2align 4,,10
	.p2align 3
.L2:
	movq	(%rcx), %rax
	addq	%rsi, %rax
	subq	$1, %rax
	cqto
	idivq	%rsi
	imulq	%rax, %rsi
	imulq	%rax, %rdi
	movq	%rsi, (%rcx)
	movq	%rdi, 8(%rcx)
	ret
	.cfi_endproc
.LFE51:
	.size	f, .-f
	.section	.rodata.str1.1,"aMS",@progbits,1
.LC0:
	.string	"%d"
.LC1:
	.string	"%d%d"
.LC2:
	.string	"%ld\n"
	.section	.text.startup,"ax",@progbits
	.p2align 4
	.globl	main
	.type	main, @function
main:
.LFB52:
	.cfi_startproc
	endbr64
	pushq	%r15
	.cfi_def_cfa_offset 16
	.cfi_offset 15, -16
	leaq	.LC0(%rip), %rdi
	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
	subq	$56, %rsp
	.cfi_def_cfa_offset 112
	movq	%fs:40, %rax
	movq	%rax, 40(%rsp)
	xorl	%eax, %eax
	leaq	28(%rsp), %rsi
	call	__isoc99_scanf@PLT
	movl	28(%rsp), %eax
	testl	%eax, %eax
	jle	.L11
	leaq	36(%rsp), %rax
	movl	$1, %r14d
	movl	$1, %ebp
	movl	$1, %ebx
	movq	%rax, 8(%rsp)
	movl	$1, %r12d
	xorl	%r13d, %r13d
	leaq	32(%rsp), %r15
	jmp	.L9
	.p2align 4,,10
	.p2align 3
.L14:
	movslq	%r14d, %rsi
	movslq	%ebp, %r12
	addl	$1, %r13d
	leaq	-1(%rbx,%rsi), %rax
	movq	%rsi, %rbx
	cqto
	idivq	%rsi
	imulq	%rax, %r12
	imulq	%rax, %rbx
	cmpl	%r13d, 28(%rsp)
	jle	.L6
.L9:
	movq	8(%rsp), %rdx
	movq	%r15, %rsi
	leaq	.LC1(%rip), %rdi
	xorl	%eax, %eax
	call	__isoc99_scanf@PLT
	movl	%ebp, %eax
	movl	%r14d, %edx
	movl	32(%rsp), %ebp
	movl	36(%rsp), %r14d
	imull	%ebp, %edx
	imull	%r14d, %eax
	cmpl	%eax, %edx
	jg	.L14
	movslq	%ebp, %rsi
	movslq	%r14d, %rbx
	addl	$1, %r13d
	leaq	-1(%r12,%rsi), %rax
	cqto
	idivq	%rsi
	imulq	%rax, %rsi
	imulq	%rax, %rbx
	movq	%rsi, %r12
	cmpl	%r13d, 28(%rsp)
	jg	.L9
.L6:
	xorl	%eax, %eax
	leaq	(%r12,%rbx), %rdx
	movl	$1, %edi
	leaq	.LC2(%rip), %rsi
	call	__printf_chk@PLT
	movq	40(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L15
	addq	$56, %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
.L11:
	.cfi_restore_state
	movl	$1, %ebx
	movl	$1, %r12d
	jmp	.L6
.L15:
	call	__stack_chk_fail@PLT
	.cfi_endproc
.LFE52:
	.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	f
	.type	f, @function
f:
.LFB51:
	.cfi_startproc
	endbr64
	movl	(%rsi), %r8d
	movq	%rdi, %rcx
	movslq	4(%rsi), %rdi
	movslq	%r8d, %rsi
	imull	4(%rdx), %r8d
	movq	%rdi, %rax
	imull	(%rdx), %eax
	cmpl	%eax, %r8d
	jle	.L2
	movq	8(%rcx), %rax
	addq	%rdi, %rax
	subq	$1, %rax
	cqto
	idivq	%rdi
	imulq	%rax, %rsi
	imulq	%rax, %rdi
	movq	%rsi, (%rcx)
	movq	%rdi, 8(%rcx)
	ret
	.p2align 4,,10
	.p2align 3
.L2:
	movq	(%rcx), %rax
	addq	%rsi, %rax
	subq	$1, %rax
	cqto
	idivq	%rsi
	imulq	%rax, %rsi
	imulq	%rax, %rdi
	movq	%rsi, (%rcx)
	movq	%rdi, 8(%rcx)
	ret
	.cfi_endproc
.LFE51:
	.size	f, .-f
	.section	.rodata.str1.1,"aMS",@progbits,1
.LC0:
	.string	"%d"
.LC1:
	.string	"%d%d"
.LC2:
	.string	"%ld\n"
	.section	.text.startup,"ax",@progbits
	.p2align 4
	.globl	main
	.type	main, @function
main:
.LFB52:
	.cfi_startproc
	endbr64
	pushq	%r15
	.cfi_def_cfa_offset 16
	.cfi_offset 15, -16
	leaq	.LC0(%rip), %rdi
	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
	subq	$56, %rsp
	.cfi_def_cfa_offset 112
	movq	%fs:40, %rax
	movq	%rax, 40(%rsp)
	xorl	%eax, %eax
	leaq	28(%rsp), %rsi
	call	__isoc99_scanf@PLT
	movl	28(%rsp), %eax
	testl	%eax, %eax
	jle	.L11
	leaq	36(%rsp), %rax
	movl	$1, %r14d
	movl	$1, %ebp
	movl	$1, %ebx
	movq	%rax, 8(%rsp)
	movl	$1, %r12d
	xorl	%r13d, %r13d
	leaq	32(%rsp), %r15
	jmp	.L9
	.p2align 4,,10
	.p2align 3
.L14:
	movslq	%r14d, %rsi
	movslq	%ebp, %r12
	addl	$1, %r13d
	leaq	-1(%rbx,%rsi), %rax
	movq	%rsi, %rbx
	cqto
	idivq	%rsi
	imulq	%rax, %r12
	imulq	%rax, %rbx
	cmpl	%r13d, 28(%rsp)
	jle	.L6
.L9:
	movq	8(%rsp), %rdx
	movq	%r15, %rsi
	leaq	.LC1(%rip), %rdi
	xorl	%eax, %eax
	call	__isoc99_scanf@PLT
	movl	%ebp, %eax
	movl	%r14d, %edx
	movl	32(%rsp), %ebp
	movl	36(%rsp), %r14d
	imull	%ebp, %edx
	imull	%r14d, %eax
	cmpl	%eax, %edx
	jg	.L14
	movslq	%ebp, %rsi
	movslq	%r14d, %rbx
	addl	$1, %r13d
	leaq	-1(%r12,%rsi), %rax
	cqto
	idivq	%rsi
	imulq	%rax, %rsi
	imulq	%rax, %rbx
	movq	%rsi, %r12
	cmpl	%r13d, 28(%rsp)
	jg	.L9
.L6:
	xorl	%eax, %eax
	leaq	(%r12,%rbx), %rdx
	movl	$1, %edi
	leaq	.LC2(%rip), %rsi
	call	__printf_chk@PLT
	movq	40(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L15
	addq	$56, %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
.L11:
	.cfi_restore_state
	movl	$1, %ebx
	movl	$1, %r12d
	jmp	.L6
.L15:
	call	__stack_chk_fail@PLT
	.cfi_endproc
.LFE52:
	.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 <limits.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>

int f(long h[2], const int a[2], const int b[2]){
	if(a[0]*b[1]>a[1]*b[0]){
		long r = (h[1]+a[1]-1)/a[1];
		h[0] = r*a[0];
		h[1] = r*a[1];
	}else{
		long r = (h[0]+a[0]-1)/a[0];
		h[0] = r*a[0];
		h[1] = r*a[1];
	}
}

int main(void){
	int n, i;
	long h[2]={1,1};
	int a[2], b[2]={1,1};
	scanf("%d", &n);
	for(i=0; i<n; i++){
		scanf("%d%d", a, a+1);
		f(h, a, b);
		b[0]=a[0], b[1]=a[1];
	}
	printf("%ld\n", h[0]+h[1]);
}

5
3 1
48 17
31 199
231 23
3 2
 4
1 1
1 1
1 9
1 100
 3
3 3
1 1
3 2
 3
4 3
1 1
3 1
 3
4 3
1 2
3 1
 3
2 3
1 1
1 2
 4
1 2
1 1
1 9
1 100
 5
3 10
48 28
31 199
319 23
3 2
 3
4 3
1 1
1 2
 5
3 10
48 28
31 199
300 23
3 2

6930
 101
 10
 16
 32
 9
 202
 9570
 12
 9000

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

```c
#include <limits.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>

int f(long h[2], const int a[2], const int b[2]){
	if(a[0]*b[1]>a[1]*b[0]){
		long r = (h[1]+a[1]-1)/a[1];
		h[0] = r*a[0];
		h[1] = r*a[1];
	}else{
		long r = (h[0]+a[0]-1)/a[0];
		h[0] = r*a[0];
		h[1] = r*a[1];
	}
}

int main(void){
	int n, i;
	long h[2]={1,1};
	int a[2], b[2]={1,1};
	scanf("%d", &n);
	for(i=0; i<n; i++){
		scanf("%d%d", a, a+1);
		f(h, a, b);
		b[0]=a[0], b[1]=a[1];
	}
	printf("%ld\n", h[0]+h[1]);
}
```

Unoptimized Assembly Code:

```assembly
	.file	"temp.c"
	.text
	.globl	f
	.type	f, @function
f:
.LFB6:
	.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	%rdx, -40(%rbp)
	movq	-32(%rbp), %rax
	movl	(%rax), %edx
	movq	-40(%rbp), %rax
	addq	$4, %rax
	movl	(%rax), %eax
	imull	%eax, %edx
	movq	-32(%rbp), %rax
	addq	$4, %rax
	movl	(%rax), %ecx
	movq	-40(%rbp), %rax
	movl	(%rax), %eax
	imull	%ecx, %eax
	cmpl	%eax, %edx
	jle	.L2
	movq	-24(%rbp), %rax
	addq	$8, %rax
	movq	(%rax), %rdx
	movq	-32(%rbp), %rax
	addq	$4, %rax
	movl	(%rax), %eax
	cltq
	addq	%rdx, %rax
	subq	$1, %rax
	movq	-32(%rbp), %rdx
	addq	$4, %rdx
	movl	(%rdx), %edx
	movslq	%edx, %rsi
	cqto
	idivq	%rsi
	movq	%rax, -8(%rbp)
	movq	-32(%rbp), %rax
	movl	(%rax), %eax
	cltq
	imulq	-8(%rbp), %rax
	movq	%rax, %rdx
	movq	-24(%rbp), %rax
	movq	%rdx, (%rax)
	movq	-32(%rbp), %rax
	addq	$4, %rax
	movl	(%rax), %eax
	cltq
	movq	-24(%rbp), %rdx
	addq	$8, %rdx
	imulq	-8(%rbp), %rax
	movq	%rax, (%rdx)
	jmp	.L3
.L2:
	movq	-24(%rbp), %rax
	movq	(%rax), %rdx
	movq	-32(%rbp), %rax
	movl	(%rax), %eax
	cltq
	addq	%rdx, %rax
	leaq	-1(%rax), %rcx
	movq	-32(%rbp), %rax
	movl	(%rax), %eax
	movslq	%eax, %rdi
	movq	%rcx, %rax
	cqto
	idivq	%rdi
	movq	%rax, -16(%rbp)
	movq	-32(%rbp), %rax
	movl	(%rax), %eax
	cltq
	imulq	-16(%rbp), %rax
	movq	%rax, %rdx
	movq	-24(%rbp), %rax
	movq	%rdx, (%rax)
	movq	-32(%rbp), %rax
	addq	$4, %rax
	movl	(%rax), %eax
	cltq
	movq	-24(%rbp), %rdx
	addq	$8, %rdx
	imulq	-16(%rbp), %rax
	movq	%rax, (%rdx)
.L3:
	nop
	popq	%rbp
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE6:
	.size	f, .-f
	.section	.rodata
.LC0:
	.string	"%d"
.LC1:
	.string	"%d%d"
.LC2:
	.string	"%ld\n"
	.text
	.globl	main
	.type	main, @function
main:
.LFB7:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	subq	$64, %rsp
	movq	%fs:40, %rax
	movq	%rax, -8(%rbp)
	xorl	%eax, %eax
	movq	$1, -32(%rbp)
	movq	$1, -24(%rbp)
	movl	$1, -40(%rbp)
	movl	$1, -36(%rbp)
	leaq	-56(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	$0, -52(%rbp)
	jmp	.L5
.L6:
	leaq	-48(%rbp), %rax
	addq	$4, %rax
	leaq	-48(%rbp), %rcx
	movq	%rax, %rdx
	movq	%rcx, %rsi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	leaq	-40(%rbp), %rdx
	leaq	-48(%rbp), %rcx
	leaq	-32(%rbp), %rax
	movq	%rcx, %rsi
	movq	%rax, %rdi
	call	f
	movl	-48(%rbp), %eax
	movl	%eax, -40(%rbp)
	movl	-44(%rbp), %eax
	movl	%eax, -36(%rbp)
	addl	$1, -52(%rbp)
.L5:
	movl	-56(%rbp), %eax
	cmpl	%eax, -52(%rbp)
	jl	.L6
	movq	-32(%rbp), %rdx
	movq	-24(%rbp), %rax
	addq	%rdx, %rax
	movq	%rax, %rsi
	leaq	.LC2(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	movl	$0, %eax
	movq	-8(%rbp), %rdx
	subq	%fs:40, %rdx
	je	.L8
	call	__stack_chk_fail@PLT
.L8:
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE7:
	.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	f
	.type	f, @function
f:
.LFB6:
	.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	%rdx, -40(%rbp)
	movq	-32(%rbp), %rax
	movl	(%rax), %edx
	movq	-40(%rbp), %rax
	addq	$4, %rax
	movl	(%rax), %eax
	imull	%eax, %edx
	movq	-32(%rbp), %rax
	addq	$4, %rax
	movl	(%rax), %ecx
	movq	-40(%rbp), %rax
	movl	(%rax), %eax
	imull	%ecx, %eax
	cmpl	%eax, %edx
	jle	.L2
	movq	-24(%rbp), %rax
	addq	$8, %rax
	movq	(%rax), %rdx
	movq	-32(%rbp), %rax
	addq	$4, %rax
	movl	(%rax), %eax
	cltq
	addq	%rdx, %rax
	subq	$1, %rax
	movq	-32(%rbp), %rdx
	addq	$4, %rdx
	movl	(%rdx), %edx
	movslq	%edx, %rsi
	cqto
	idivq	%rsi
	movq	%rax, -8(%rbp)
	movq	-32(%rbp), %rax
	movl	(%rax), %eax
	cltq
	imulq	-8(%rbp), %rax
	movq	%rax, %rdx
	movq	-24(%rbp), %rax
	movq	%rdx, (%rax)
	movq	-32(%rbp), %rax
	addq	$4, %rax
	movl	(%rax), %eax
	cltq
	movq	-24(%rbp), %rdx
	addq	$8, %rdx
	imulq	-8(%rbp), %rax
	movq	%rax, (%rdx)
	jmp	.L3
.L2:
	movq	-24(%rbp), %rax
	movq	(%rax), %rdx
	movq	-32(%rbp), %rax
	movl	(%rax), %eax
	cltq
	addq	%rdx, %rax
	leaq	-1(%rax), %rcx
	movq	-32(%rbp), %rax
	movl	(%rax), %eax
	movslq	%eax, %rdi
	movq	%rcx, %rax
	cqto
	idivq	%rdi
	movq	%rax, -16(%rbp)
	movq	-32(%rbp), %rax
	movl	(%rax), %eax
	cltq
	imulq	-16(%rbp), %rax
	movq	%rax, %rdx
	movq	-24(%rbp), %rax
	movq	%rdx, (%rax)
	movq	-32(%rbp), %rax
	addq	$4, %rax
	movl	(%rax), %eax
	cltq
	movq	-24(%rbp), %rdx
	addq	$8, %rdx
	imulq	-16(%rbp), %rax
	movq	%rax, (%rdx)
.L3:
	nop
	popq	%rbp
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE6:
	.size	f, .-f
	.section	.rodata
.LC0:
	.string	"%d"
.LC1:
	.string	"%d%d"
.LC2:
	.string	"%ld\n"
	.text
	.globl	main
	.type	main, @function
main:
.LFB7:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	subq	$64, %rsp
	movq	%fs:40, %rax
	movq	%rax, -8(%rbp)
	xorl	%eax, %eax
	movq	$1, -32(%rbp)
	movq	$1, -24(%rbp)
	movl	$1, -40(%rbp)
	movl	$1, -36(%rbp)
	leaq	-56(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	$0, -52(%rbp)
	jmp	.L5
.L6:
	leaq	-48(%rbp), %rax
	addq	$4, %rax
	leaq	-48(%rbp), %rcx
	movq	%rax, %rdx
	movq	%rcx, %rsi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	leaq	-40(%rbp), %rdx
	leaq	-48(%rbp), %rcx
	leaq	-32(%rbp), %rax
	movq	%rcx, %rsi
	movq	%rax, %rdi
	call	f
	movl	-48(%rbp), %eax
	movl	%eax, -40(%rbp)
	movl	-44(%rbp), %eax
	movl	%eax, -36(%rbp)
	addl	$1, -52(%rbp)
.L5:
	movl	-56(%rbp), %eax
	cmpl	%eax, -52(%rbp)
	jl	.L6
	movq	-32(%rbp), %rdx
	movq	-24(%rbp), %rax
	addq	%rdx, %rax
	movq	%rax, %rsi
	leaq	.LC2(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	movl	$0, %eax
	movq	-8(%rbp), %rdx
	subq	%fs:40, %rdx
	je	.L8
	call	__stack_chk_fail@PLT
.L8:
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE7:
	.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:
