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>
#define max(x, y) ((x)<(y) ? (y) : (x))
#define upfloor(x, y) ((x)/(y) + ((x)%(y) ? 1 : 0))

int main(){
  int n;  scanf("%d", &n);
  long nowt, nowa;  scanf("%ld %ld", &nowt, &nowa);
  while(n-- > 1){
    long t, a;  scanf("%ld %ld", &t, &a);    
    long x = max(upfloor(nowt, t), upfloor(nowa, a));
    nowt = t * x;
    nowa = a * x;
  }

  printf("%ld\n", nowt+nowa);

  return 0;
}
```

Assembly Code:

```assembly
	.file	"temp.c"
	.text
	.section	.rodata.str1.1,"aMS",@progbits,1
.LC0:
	.string	"%d"
.LC1:
	.string	"%ld %ld"
.LC2:
	.string	"%ld\n"
	.section	.text.startup,"ax",@progbits
	.p2align 4
	.globl	main
	.type	main, @function
main:
.LFB23:
	.cfi_startproc
	endbr64
	pushq	%r12
	.cfi_def_cfa_offset 16
	.cfi_offset 12, -16
	leaq	.LC0(%rip), %rdi
	pushq	%rbp
	.cfi_def_cfa_offset 24
	.cfi_offset 6, -24
	pushq	%rbx
	.cfi_def_cfa_offset 32
	.cfi_offset 3, -32
	leaq	.LC1(%rip), %rbx
	subq	$48, %rsp
	.cfi_def_cfa_offset 80
	movq	%fs:40, %rax
	movq	%rax, 40(%rsp)
	xorl	%eax, %eax
	leaq	4(%rsp), %rsi
	call	__isoc99_scanf@PLT
	leaq	16(%rsp), %rdx
	movq	%rbx, %rdi
	xorl	%eax, %eax
	leaq	8(%rsp), %rsi
	call	__isoc99_scanf@PLT
	movl	4(%rsp), %eax
	leal	-1(%rax), %edx
	movl	%edx, 4(%rsp)
	cmpl	$1, %eax
	jle	.L2
	leaq	32(%rsp), %r12
	leaq	24(%rsp), %rbp
	.p2align 4,,10
	.p2align 3
.L3:
	movq	%r12, %rdx
	movq	%rbp, %rsi
	movq	%rbx, %rdi
	xorl	%eax, %eax
	call	__isoc99_scanf@PLT
	movq	8(%rsp), %rax
	movq	24(%rsp), %rsi
	movq	32(%rsp), %rdi
	cqto
	idivq	%rsi
	cmpq	$1, %rdx
	sbbq	$-1, %rax
	movq	%rax, %rcx
	movq	16(%rsp), %rax
	cqto
	idivq	%rdi
	cmpq	$1, %rdx
	sbbq	$-1, %rax
	cmpq	%rcx, %rax
	cmovl	%rcx, %rax
	imulq	%rax, %rsi
	imulq	%rax, %rdi
	movl	4(%rsp), %eax
	leal	-1(%rax), %edx
	movq	%rsi, 8(%rsp)
	movq	%rdi, 16(%rsp)
	movl	%edx, 4(%rsp)
	cmpl	$1, %eax
	jg	.L3
.L4:
	leaq	(%rsi,%rdi), %rdx
	xorl	%eax, %eax
	leaq	.LC2(%rip), %rsi
	movl	$1, %edi
	call	__printf_chk@PLT
	movq	40(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L9
	addq	$48, %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
.L2:
	.cfi_restore_state
	movq	8(%rsp), %rsi
	movq	16(%rsp), %rdi
	jmp	.L4
.L9:
	call	__stack_chk_fail@PLT
	.cfi_endproc
.LFE23:
	.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
	.section	.rodata.str1.1,"aMS",@progbits,1
.LC0:
	.string	"%d"
.LC1:
	.string	"%ld %ld"
.LC2:
	.string	"%ld\n"
	.section	.text.startup,"ax",@progbits
	.p2align 4
	.globl	main
	.type	main, @function
main:
.LFB23:
	.cfi_startproc
	endbr64
	pushq	%r12
	.cfi_def_cfa_offset 16
	.cfi_offset 12, -16
	leaq	.LC0(%rip), %rdi
	pushq	%rbp
	.cfi_def_cfa_offset 24
	.cfi_offset 6, -24
	pushq	%rbx
	.cfi_def_cfa_offset 32
	.cfi_offset 3, -32
	leaq	.LC1(%rip), %rbx
	subq	$48, %rsp
	.cfi_def_cfa_offset 80
	movq	%fs:40, %rax
	movq	%rax, 40(%rsp)
	xorl	%eax, %eax
	leaq	4(%rsp), %rsi
	call	__isoc99_scanf@PLT
	leaq	16(%rsp), %rdx
	movq	%rbx, %rdi
	xorl	%eax, %eax
	leaq	8(%rsp), %rsi
	call	__isoc99_scanf@PLT
	movl	4(%rsp), %eax
	leal	-1(%rax), %edx
	movl	%edx, 4(%rsp)
	cmpl	$1, %eax
	jle	.L2
	leaq	32(%rsp), %r12
	leaq	24(%rsp), %rbp
	.p2align 4,,10
	.p2align 3
.L3:
	movq	%r12, %rdx
	movq	%rbp, %rsi
	movq	%rbx, %rdi
	xorl	%eax, %eax
	call	__isoc99_scanf@PLT
	movq	8(%rsp), %rax
	movq	24(%rsp), %rsi
	movq	32(%rsp), %rdi
	cqto
	idivq	%rsi
	cmpq	$1, %rdx
	sbbq	$-1, %rax
	movq	%rax, %rcx
	movq	16(%rsp), %rax
	cqto
	idivq	%rdi
	cmpq	$1, %rdx
	sbbq	$-1, %rax
	cmpq	%rcx, %rax
	cmovl	%rcx, %rax
	imulq	%rax, %rsi
	imulq	%rax, %rdi
	movl	4(%rsp), %eax
	leal	-1(%rax), %edx
	movq	%rsi, 8(%rsp)
	movq	%rdi, 16(%rsp)
	movl	%edx, 4(%rsp)
	cmpl	$1, %eax
	jg	.L3
.L4:
	leaq	(%rsi,%rdi), %rdx
	xorl	%eax, %eax
	leaq	.LC2(%rip), %rsi
	movl	$1, %edi
	call	__printf_chk@PLT
	movq	40(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L9
	addq	$48, %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
.L2:
	.cfi_restore_state
	movq	8(%rsp), %rsi
	movq	16(%rsp), %rdi
	jmp	.L4
.L9:
	call	__stack_chk_fail@PLT
	.cfi_endproc
.LFE23:
	.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
	.section	.rodata.str1.1,"aMS",@progbits,1
.LC0:
	.string	"%d"
.LC1:
	.string	"%ld %ld"
.LC2:
	.string	"%ld\n"
	.section	.text.startup,"ax",@progbits
	.p2align 4
	.globl	main
	.type	main, @function
main:
.LFB23:
	.cfi_startproc
	endbr64
	pushq	%r12
	.cfi_def_cfa_offset 16
	.cfi_offset 12, -16
	leaq	.LC0(%rip), %rdi
	pushq	%rbp
	.cfi_def_cfa_offset 24
	.cfi_offset 6, -24
	pushq	%rbx
	.cfi_def_cfa_offset 32
	.cfi_offset 3, -32
	leaq	.LC1(%rip), %rbx
	subq	$48, %rsp
	.cfi_def_cfa_offset 80
	movq	%fs:40, %rax
	movq	%rax, 40(%rsp)
	xorl	%eax, %eax
	leaq	4(%rsp), %rsi
	call	__isoc99_scanf@PLT
	leaq	16(%rsp), %rdx
	movq	%rbx, %rdi
	xorl	%eax, %eax
	leaq	8(%rsp), %rsi
	call	__isoc99_scanf@PLT
	movl	4(%rsp), %eax
	leal	-1(%rax), %edx
	movl	%edx, 4(%rsp)
	cmpl	$1, %eax
	jle	.L2
	leaq	32(%rsp), %r12
	leaq	24(%rsp), %rbp
	.p2align 4,,10
	.p2align 3
.L3:
	movq	%r12, %rdx
	movq	%rbp, %rsi
	movq	%rbx, %rdi
	xorl	%eax, %eax
	call	__isoc99_scanf@PLT
	movq	8(%rsp), %rax
	movq	24(%rsp), %rsi
	movq	32(%rsp), %rdi
	cqto
	idivq	%rsi
	cmpq	$1, %rdx
	sbbq	$-1, %rax
	movq	%rax, %rcx
	movq	16(%rsp), %rax
	cqto
	idivq	%rdi
	cmpq	$1, %rdx
	sbbq	$-1, %rax
	cmpq	%rcx, %rax
	cmovl	%rcx, %rax
	imulq	%rax, %rsi
	imulq	%rax, %rdi
	movl	4(%rsp), %eax
	leal	-1(%rax), %edx
	movq	%rsi, 8(%rsp)
	movq	%rdi, 16(%rsp)
	movl	%edx, 4(%rsp)
	cmpl	$1, %eax
	jg	.L3
.L4:
	leaq	(%rsi,%rdi), %rdx
	xorl	%eax, %eax
	leaq	.LC2(%rip), %rsi
	movl	$1, %edi
	call	__printf_chk@PLT
	movq	40(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L9
	addq	$48, %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
.L2:
	.cfi_restore_state
	movq	8(%rsp), %rsi
	movq	16(%rsp), %rdi
	jmp	.L4
.L9:
	call	__stack_chk_fail@PLT
	.cfi_endproc
.LFE23:
	.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>
#define max(x, y) ((x)<(y) ? (y) : (x))
#define upfloor(x, y) ((x)/(y) + ((x)%(y) ? 1 : 0))

int main(){
  int n;  scanf("%d", &n);
  long nowt, nowa;  scanf("%ld %ld", &nowt, &nowa);
  while(n-- > 1){
    long t, a;  scanf("%ld %ld", &t, &a);    
    long x = max(upfloor(nowt, t), upfloor(nowa, a));
    nowt = t * x;
    nowa = a * x;
  }

  printf("%ld\n", nowt+nowa);

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

```c
#include <stdio.h>
#define max(x, y) ((x)<(y) ? (y) : (x))
#define upfloor(x, y) ((x)/(y) + ((x)%(y) ? 1 : 0))

int main(){
  int n;  scanf("%d", &n);
  long nowt, nowa;  scanf("%ld %ld", &nowt, &nowa);
  while(n-- > 1){
    long t, a;  scanf("%ld %ld", &t, &a);    
    long x = max(upfloor(nowt, t), upfloor(nowa, a));
    nowt = t * x;
    nowa = a * x;
  }

  printf("%ld\n", nowt+nowa);

  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:

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 assembly code, your task is to generate highly optimized x86-64 assembly code.
C Code:

```c
#include <stdio.h>
#define max(x, y) ((x)<(y) ? (y) : (x))
#define upfloor(x, y) ((x)/(y) + ((x)%(y) ? 1 : 0))

int main(){
  int n;  scanf("%d", &n);
  long nowt, nowa;  scanf("%ld %ld", &nowt, &nowa);
  while(n-- > 1){
    long t, a;  scanf("%ld %ld", &t, &a);    
    long x = max(upfloor(nowt, t), upfloor(nowa, a));
    nowt = t * x;
    nowa = a * x;
  }

  printf("%ld\n", nowt+nowa);

  return 0;
}
```

Assembly Code:

```assembly
	.file	"temp.c"
	.text
	.section	.rodata.str1.1,"aMS",@progbits,1
.LC0:
	.string	"%d"
.LC1:
	.string	"%ld %ld"
.LC2:
	.string	"%ld\n"
	.section	.text.startup,"ax",@progbits
	.p2align 4
	.globl	main
	.type	main, @function
main:
.LFB23:
	.cfi_startproc
	endbr64
	pushq	%r12
	.cfi_def_cfa_offset 16
	.cfi_offset 12, -16
	leaq	.LC0(%rip), %rdi
	pushq	%rbp
	.cfi_def_cfa_offset 24
	.cfi_offset 6, -24
	pushq	%rbx
	.cfi_def_cfa_offset 32
	.cfi_offset 3, -32
	leaq	.LC1(%rip), %rbx
	subq	$48, %rsp
	.cfi_def_cfa_offset 80
	movq	%fs:40, %rax
	movq	%rax, 40(%rsp)
	xorl	%eax, %eax
	leaq	4(%rsp), %rsi
	call	__isoc99_scanf@PLT
	leaq	16(%rsp), %rdx
	movq	%rbx, %rdi
	xorl	%eax, %eax
	leaq	8(%rsp), %rsi
	call	__isoc99_scanf@PLT
	movl	4(%rsp), %eax
	leal	-1(%rax), %edx
	movl	%edx, 4(%rsp)
	cmpl	$1, %eax
	jle	.L2
	leaq	32(%rsp), %r12
	leaq	24(%rsp), %rbp
	.p2align 4,,10
	.p2align 3
.L3:
	movq	%r12, %rdx
	movq	%rbp, %rsi
	movq	%rbx, %rdi
	xorl	%eax, %eax
	call	__isoc99_scanf@PLT
	movq	8(%rsp), %rax
	movq	24(%rsp), %rsi
	movq	32(%rsp), %rdi
	cqto
	idivq	%rsi
	cmpq	$1, %rdx
	sbbq	$-1, %rax
	movq	%rax, %rcx
	movq	16(%rsp), %rax
	cqto
	idivq	%rdi
	cmpq	$1, %rdx
	sbbq	$-1, %rax
	cmpq	%rcx, %rax
	cmovl	%rcx, %rax
	imulq	%rax, %rsi
	imulq	%rax, %rdi
	movl	4(%rsp), %eax
	leal	-1(%rax), %edx
	movq	%rsi, 8(%rsp)
	movq	%rdi, 16(%rsp)
	movl	%edx, 4(%rsp)
	cmpl	$1, %eax
	jg	.L3
.L4:
	leaq	(%rsi,%rdi), %rdx
	xorl	%eax, %eax
	leaq	.LC2(%rip), %rsi
	movl	$1, %edi
	call	__printf_chk@PLT
	movq	40(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L9
	addq	$48, %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
.L2:
	.cfi_restore_state
	movq	8(%rsp), %rsi
	movq	16(%rsp), %rdi
	jmp	.L4
.L9:
	call	__stack_chk_fail@PLT
	.cfi_endproc
.LFE23:
	.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
	.section	.rodata.str1.1,"aMS",@progbits,1
.LC0:
	.string	"%d"
.LC1:
	.string	"%ld %ld"
.LC2:
	.string	"%ld\n"
	.section	.text.startup,"ax",@progbits
	.p2align 4
	.globl	main
	.type	main, @function
main:
.LFB23:
	.cfi_startproc
	endbr64
	pushq	%r12
	.cfi_def_cfa_offset 16
	.cfi_offset 12, -16
	leaq	.LC0(%rip), %rdi
	pushq	%rbp
	.cfi_def_cfa_offset 24
	.cfi_offset 6, -24
	pushq	%rbx
	.cfi_def_cfa_offset 32
	.cfi_offset 3, -32
	leaq	.LC1(%rip), %rbx
	subq	$48, %rsp
	.cfi_def_cfa_offset 80
	movq	%fs:40, %rax
	movq	%rax, 40(%rsp)
	xorl	%eax, %eax
	leaq	4(%rsp), %rsi
	call	__isoc99_scanf@PLT
	leaq	16(%rsp), %rdx
	movq	%rbx, %rdi
	xorl	%eax, %eax
	leaq	8(%rsp), %rsi
	call	__isoc99_scanf@PLT
	movl	4(%rsp), %eax
	leal	-1(%rax), %edx
	movl	%edx, 4(%rsp)
	cmpl	$1, %eax
	jle	.L2
	leaq	32(%rsp), %r12
	leaq	24(%rsp), %rbp
	.p2align 4,,10
	.p2align 3
.L3:
	movq	%r12, %rdx
	movq	%rbp, %rsi
	movq	%rbx, %rdi
	xorl	%eax, %eax
	call	__isoc99_scanf@PLT
	movq	8(%rsp), %rax
	movq	24(%rsp), %rsi
	movq	32(%rsp), %rdi
	cqto
	idivq	%rsi
	cmpq	$1, %rdx
	sbbq	$-1, %rax
	movq	%rax, %rcx
	movq	16(%rsp), %rax
	cqto
	idivq	%rdi
	cmpq	$1, %rdx
	sbbq	$-1, %rax
	cmpq	%rcx, %rax
	cmovl	%rcx, %rax
	imulq	%rax, %rsi
	imulq	%rax, %rdi
	movl	4(%rsp), %eax
	leal	-1(%rax), %edx
	movq	%rsi, 8(%rsp)
	movq	%rdi, 16(%rsp)
	movl	%edx, 4(%rsp)
	cmpl	$1, %eax
	jg	.L3
.L4:
	leaq	(%rsi,%rdi), %rdx
	xorl	%eax, %eax
	leaq	.LC2(%rip), %rsi
	movl	$1, %edi
	call	__printf_chk@PLT
	movq	40(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L9
	addq	$48, %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
.L2:
	.cfi_restore_state
	movq	8(%rsp), %rsi
	movq	16(%rsp), %rdi
	jmp	.L4
.L9:
	call	__stack_chk_fail@PLT
	.cfi_endproc
.LFE23:
	.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:
```