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

```c
long p,a,k=1e18;main(i){for(;~scanf("%ld",&a);)p=--i?1.*p*a>k?k+1:p*a:1;printf("%ld",p>k?-1:p);}```

Unoptimized Assembly Code:

```assembly
	.file	"temp.c"
	.text
	.globl	p
	.bss
	.align 8
	.type	p, @object
	.size	p, 8
p:
	.zero	8
	.globl	a
	.align 8
	.type	a, @object
	.size	a, 8
a:
	.zero	8
	.globl	k
	.data
	.align 8
	.type	k, @object
	.size	k, 8
k:
	.quad	1000000000000000000
	.section	.rodata
.LC0:
	.string	"%ld"
	.text
	.globl	main
	.type	main, @function
main:
.LFB0:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	subq	$16, %rsp
	movl	%edi, -4(%rbp)
	jmp	.L2
.L8:
	subl	$1, -4(%rbp)
	cmpl	$0, -4(%rbp)
	je	.L3
	movq	p(%rip), %rax
	pxor	%xmm1, %xmm1
	cvtsi2sdq	%rax, %xmm1
	movq	a(%rip), %rax
	pxor	%xmm0, %xmm0
	cvtsi2sdq	%rax, %xmm0
	mulsd	%xmm1, %xmm0
	movq	k(%rip), %rax
	pxor	%xmm1, %xmm1
	cvtsi2sdq	%rax, %xmm1
	comisd	%xmm1, %xmm0
	jbe	.L13
	movq	k(%rip), %rax
	addq	$1, %rax
	jmp	.L7
.L13:
	movq	p(%rip), %rdx
	movq	a(%rip), %rax
	imulq	%rdx, %rax
	jmp	.L7
.L3:
	movl	$1, %eax
.L7:
	movq	%rax, p(%rip)
.L2:
	leaq	a(%rip), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	scanf@PLT
	cmpl	$-1, %eax
	jne	.L8
	movq	p(%rip), %rdx
	movq	k(%rip), %rax
	cmpq	%rax, %rdx
	jg	.L9
	movq	p(%rip), %rax
	jmp	.L10
.L9:
	movq	$-1, %rax
.L10:
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	movl	$0, %eax
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE0:
	.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
	.section	.rodata.str1.1,"aMS",@progbits,1
.LC0:
	.string	"%ld"
	.section	.text.startup,"ax",@progbits
	.p2align 4
	.globl	main
	.type	main, @function
main:
.LFB0:
	.cfi_startproc
	endbr64
	pushq	%r12
	.cfi_def_cfa_offset 16
	.cfi_offset 12, -16
	leaq	.LC0(%rip), %r12
	pushq	%rbp
	.cfi_def_cfa_offset 24
	.cfi_offset 6, -24
	leaq	a(%rip), %rbp
	pushq	%rbx
	.cfi_def_cfa_offset 32
	.cfi_offset 3, -32
	movl	%edi, %ebx
	jmp	.L2
	.p2align 4,,10
	.p2align 3
.L6:
	movl	$1, %eax
	subl	$1, %ebx
	je	.L3
	movq	p(%rip), %rcx
	movq	a(%rip), %rdx
	pxor	%xmm0, %xmm0
	pxor	%xmm1, %xmm1
	movq	k(%rip), %rax
	cvtsi2sdq	%rdx, %xmm1
	cvtsi2sdq	%rcx, %xmm0
	mulsd	%xmm1, %xmm0
	pxor	%xmm1, %xmm1
	cvtsi2sdq	%rax, %xmm1
	addq	$1, %rax
	comisd	%xmm1, %xmm0
	ja	.L3
	movq	%rcx, %rax
	imulq	%rdx, %rax
.L3:
	movq	%rax, p(%rip)
.L2:
	xorl	%eax, %eax
	movq	%rbp, %rsi
	movq	%r12, %rdi
	call	scanf@PLT
	cmpl	$-1, %eax
	jne	.L6
	movq	p(%rip), %rsi
	movq	$-1, %rax
	cmpq	k(%rip), %rsi
	movq	%r12, %rdi
	cmovg	%rax, %rsi
	xorl	%eax, %eax
	call	printf@PLT
	popq	%rbx
	.cfi_def_cfa_offset 24
	xorl	%eax, %eax
	popq	%rbp
	.cfi_def_cfa_offset 16
	popq	%r12
	.cfi_def_cfa_offset 8
	ret
	.cfi_endproc
.LFE0:
	.size	main, .-main
	.globl	k
	.data
	.align 8
	.type	k, @object
	.size	k, 8
k:
	.quad	1000000000000000000
	.globl	a
	.bss
	.align 8
	.type	a, @object
	.size	a, 8
a:
	.zero	8
	.globl	p
	.align 8
	.type	p, @object
	.size	p, 8
p:
	.zero	8
	.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
	.section	.rodata.str1.1,"aMS",@progbits,1
.LC0:
	.string	"%ld"
	.section	.text.startup,"ax",@progbits
	.p2align 4
	.globl	main
	.type	main, @function
main:
.LFB0:
	.cfi_startproc
	endbr64
	pushq	%r12
	.cfi_def_cfa_offset 16
	.cfi_offset 12, -16
	leaq	.LC0(%rip), %r12
	pushq	%rbp
	.cfi_def_cfa_offset 24
	.cfi_offset 6, -24
	leaq	a(%rip), %rbp
	pushq	%rbx
	.cfi_def_cfa_offset 32
	.cfi_offset 3, -32
	movl	%edi, %ebx
	jmp	.L2
	.p2align 4,,10
	.p2align 3
.L6:
	movl	$1, %eax
	subl	$1, %ebx
	je	.L3
	movq	p(%rip), %rcx
	movq	a(%rip), %rdx
	pxor	%xmm0, %xmm0
	pxor	%xmm1, %xmm1
	movq	k(%rip), %rax
	cvtsi2sdq	%rdx, %xmm1
	cvtsi2sdq	%rcx, %xmm0
	mulsd	%xmm1, %xmm0
	pxor	%xmm1, %xmm1
	cvtsi2sdq	%rax, %xmm1
	addq	$1, %rax
	comisd	%xmm1, %xmm0
	ja	.L3
	movq	%rcx, %rax
	imulq	%rdx, %rax
.L3:
	movq	%rax, p(%rip)
.L2:
	xorl	%eax, %eax
	movq	%rbp, %rsi
	movq	%r12, %rdi
	call	scanf@PLT
	cmpl	$-1, %eax
	jne	.L6
	movq	p(%rip), %rsi
	movq	$-1, %rax
	cmpq	k(%rip), %rsi
	movq	%r12, %rdi
	cmovg	%rax, %rsi
	xorl	%eax, %eax
	call	printf@PLT
	popq	%rbx
	.cfi_def_cfa_offset 24
	xorl	%eax, %eax
	popq	%rbp
	.cfi_def_cfa_offset 16
	popq	%r12
	.cfi_def_cfa_offset 8
	ret
	.cfi_endproc
.LFE0:
	.size	main, .-main
	.globl	k
	.data
	.align 8
	.type	k, @object
	.size	k, 8
k:
	.quad	1000000000000000000
	.globl	a
	.bss
	.align 8
	.type	a, @object
	.size	a, 8
a:
	.zero	8
	.globl	p
	.align 8
	.type	p, @object
	.size	p, 8
p:
	.zero	8
	.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:

long p,a,k=1e18;main(i){for(;~scanf("%ld",&a);)p=--i?1.*p*a>k?k+1:p*a:1;printf("%ld",p>k?-1:p);}
3
101 9901 1693005451348
 31
4 1 5 9 2 6 5 3 5 8 9 7 9 3 2 3 8 4 6 2 6 4 3 3 8 0 2 7 9 5 0
 3
101 8497 834116832270
 3
101 5000 834116832270
 3
101 5000 29935402316
 3
111 5000 29935402316
 3
111 5000 36731156058
 3
011 5000 36731156058
 2
0000100010 1001010010
 3
101 5000 36731156058

-1 0 715836563103617190 421229000296350000 15117378169580000 16614148285380000 20385791612190000 2020213583190000 100111011100100 18549233809290000
Given the following C code and unoptimized assembly code, your task is to generate highly optimized x86-64 assembly code.
C Code:

```c
long p,a,k=1e18;main(i){for(;~scanf("%ld",&a);)p=--i?1.*p*a>k?k+1:p*a:1;printf("%ld",p>k?-1:p);}```

Unoptimized Assembly Code:

```assembly
	.file	"temp.c"
	.text
	.globl	p
	.bss
	.align 8
	.type	p, @object
	.size	p, 8
p:
	.zero	8
	.globl	a
	.align 8
	.type	a, @object
	.size	a, 8
a:
	.zero	8
	.globl	k
	.data
	.align 8
	.type	k, @object
	.size	k, 8
k:
	.quad	1000000000000000000
	.section	.rodata
.LC0:
	.string	"%ld"
	.text
	.globl	main
	.type	main, @function
main:
.LFB0:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	subq	$16, %rsp
	movl	%edi, -4(%rbp)
	jmp	.L2
.L8:
	subl	$1, -4(%rbp)
	cmpl	$0, -4(%rbp)
	je	.L3
	movq	p(%rip), %rax
	pxor	%xmm1, %xmm1
	cvtsi2sdq	%rax, %xmm1
	movq	a(%rip), %rax
	pxor	%xmm0, %xmm0
	cvtsi2sdq	%rax, %xmm0
	mulsd	%xmm1, %xmm0
	movq	k(%rip), %rax
	pxor	%xmm1, %xmm1
	cvtsi2sdq	%rax, %xmm1
	comisd	%xmm1, %xmm0
	jbe	.L13
	movq	k(%rip), %rax
	addq	$1, %rax
	jmp	.L7
.L13:
	movq	p(%rip), %rdx
	movq	a(%rip), %rax
	imulq	%rdx, %rax
	jmp	.L7
.L3:
	movl	$1, %eax
.L7:
	movq	%rax, p(%rip)
.L2:
	leaq	a(%rip), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	scanf@PLT
	cmpl	$-1, %eax
	jne	.L8
	movq	p(%rip), %rdx
	movq	k(%rip), %rax
	cmpq	%rax, %rdx
	jg	.L9
	movq	p(%rip), %rax
	jmp	.L10
.L9:
	movq	$-1, %rax
.L10:
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	movl	$0, %eax
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE0:
	.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	p
	.bss
	.align 8
	.type	p, @object
	.size	p, 8
p:
	.zero	8
	.globl	a
	.align 8
	.type	a, @object
	.size	a, 8
a:
	.zero	8
	.globl	k
	.data
	.align 8
	.type	k, @object
	.size	k, 8
k:
	.quad	1000000000000000000
	.section	.rodata
.LC0:
	.string	"%ld"
	.text
	.globl	main
	.type	main, @function
main:
.LFB0:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	subq	$16, %rsp
	movl	%edi, -4(%rbp)
	jmp	.L2
.L8:
	subl	$1, -4(%rbp)
	cmpl	$0, -4(%rbp)
	je	.L3
	movq	p(%rip), %rax
	pxor	%xmm1, %xmm1
	cvtsi2sdq	%rax, %xmm1
	movq	a(%rip), %rax
	pxor	%xmm0, %xmm0
	cvtsi2sdq	%rax, %xmm0
	mulsd	%xmm1, %xmm0
	movq	k(%rip), %rax
	pxor	%xmm1, %xmm1
	cvtsi2sdq	%rax, %xmm1
	comisd	%xmm1, %xmm0
	jbe	.L13
	movq	k(%rip), %rax
	addq	$1, %rax
	jmp	.L7
.L13:
	movq	p(%rip), %rdx
	movq	a(%rip), %rax
	imulq	%rdx, %rax
	jmp	.L7
.L3:
	movl	$1, %eax
.L7:
	movq	%rax, p(%rip)
.L2:
	leaq	a(%rip), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	scanf@PLT
	cmpl	$-1, %eax
	jne	.L8
	movq	p(%rip), %rdx
	movq	k(%rip), %rax
	cmpq	%rax, %rdx
	jg	.L9
	movq	p(%rip), %rax
	jmp	.L10
.L9:
	movq	$-1, %rax
.L10:
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	movl	$0, %eax
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE0:
	.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:
