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>
#include <math.h>
#define rad(x) (x)*M_PI/180.0
int main(void) {
    double theta1,phi1,theta2,phi2,alpha,x1,x2,y1,y2,z1,z2,r=6378.1;
    while (scanf("%lf%lf%lf%lf",&theta1,&phi1,&theta2,&phi2)!=EOF&&(theta1!=-1||theta2!=-1||phi1!=-1||phi2!=-1)) {
        x1=cos(rad(theta1))*cos(rad(phi1));
        x2=cos(rad(theta2))*cos(rad(phi2));
        y1=cos(rad(theta1))*sin(rad(phi1));
        y2=cos(rad(theta2))*sin(rad(phi2));
        z1=sin(rad(theta1));
        z2=sin(rad(theta2));
        alpha=acos(x1*x2+y1*y2+z1*z2);
        printf("%d\n",(int)(r*alpha+0.5));
    }
    return 0;
}```

Unoptimized Assembly Code:

```assembly
	.file	"temp.c"
	.text
	.section	.rodata
.LC4:
	.string	"%d\n"
.LC5:
	.string	"%lf%lf%lf%lf"
	.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
	addq	$-128, %rsp
	movq	%fs:40, %rax
	movq	%rax, -8(%rbp)
	xorl	%eax, %eax
	movsd	.LC0(%rip), %xmm0
	movsd	%xmm0, -72(%rbp)
	jmp	.L2
.L4:
	movsd	-104(%rbp), %xmm1
	movsd	.LC1(%rip), %xmm0
	mulsd	%xmm1, %xmm0
	movsd	.LC2(%rip), %xmm1
	divsd	%xmm1, %xmm0
	movq	%xmm0, %rax
	movq	%rax, %xmm0
	call	cos@PLT
	movsd	%xmm0, -120(%rbp)
	movsd	-96(%rbp), %xmm1
	movsd	.LC1(%rip), %xmm0
	mulsd	%xmm1, %xmm0
	movsd	.LC2(%rip), %xmm1
	movapd	%xmm0, %xmm2
	divsd	%xmm1, %xmm2
	movq	%xmm2, %rax
	movq	%rax, %xmm0
	call	cos@PLT
	mulsd	-120(%rbp), %xmm0
	movsd	%xmm0, -64(%rbp)
	movsd	-88(%rbp), %xmm1
	movsd	.LC1(%rip), %xmm0
	mulsd	%xmm1, %xmm0
	movsd	.LC2(%rip), %xmm1
	divsd	%xmm1, %xmm0
	movq	%xmm0, %rax
	movq	%rax, %xmm0
	call	cos@PLT
	movsd	%xmm0, -120(%rbp)
	movsd	-80(%rbp), %xmm1
	movsd	.LC1(%rip), %xmm0
	mulsd	%xmm1, %xmm0
	movsd	.LC2(%rip), %xmm1
	movapd	%xmm0, %xmm3
	divsd	%xmm1, %xmm3
	movq	%xmm3, %rax
	movq	%rax, %xmm0
	call	cos@PLT
	mulsd	-120(%rbp), %xmm0
	movsd	%xmm0, -56(%rbp)
	movsd	-104(%rbp), %xmm1
	movsd	.LC1(%rip), %xmm0
	mulsd	%xmm1, %xmm0
	movsd	.LC2(%rip), %xmm1
	divsd	%xmm1, %xmm0
	movq	%xmm0, %rax
	movq	%rax, %xmm0
	call	cos@PLT
	movsd	%xmm0, -120(%rbp)
	movsd	-96(%rbp), %xmm1
	movsd	.LC1(%rip), %xmm0
	mulsd	%xmm1, %xmm0
	movsd	.LC2(%rip), %xmm1
	movapd	%xmm0, %xmm4
	divsd	%xmm1, %xmm4
	movq	%xmm4, %rax
	movq	%rax, %xmm0
	call	sin@PLT
	mulsd	-120(%rbp), %xmm0
	movsd	%xmm0, -48(%rbp)
	movsd	-88(%rbp), %xmm1
	movsd	.LC1(%rip), %xmm0
	mulsd	%xmm1, %xmm0
	movsd	.LC2(%rip), %xmm1
	divsd	%xmm1, %xmm0
	movq	%xmm0, %rax
	movq	%rax, %xmm0
	call	cos@PLT
	movsd	%xmm0, -120(%rbp)
	movsd	-80(%rbp), %xmm1
	movsd	.LC1(%rip), %xmm0
	mulsd	%xmm1, %xmm0
	movsd	.LC2(%rip), %xmm1
	movapd	%xmm0, %xmm5
	divsd	%xmm1, %xmm5
	movq	%xmm5, %rax
	movq	%rax, %xmm0
	call	sin@PLT
	mulsd	-120(%rbp), %xmm0
	movsd	%xmm0, -40(%rbp)
	movsd	-104(%rbp), %xmm1
	movsd	.LC1(%rip), %xmm0
	mulsd	%xmm1, %xmm0
	movsd	.LC2(%rip), %xmm1
	divsd	%xmm1, %xmm0
	movq	%xmm0, %rax
	movq	%rax, %xmm0
	call	sin@PLT
	movq	%xmm0, %rax
	movq	%rax, -32(%rbp)
	movsd	-88(%rbp), %xmm1
	movsd	.LC1(%rip), %xmm0
	mulsd	%xmm1, %xmm0
	movsd	.LC2(%rip), %xmm1
	divsd	%xmm1, %xmm0
	movq	%xmm0, %rax
	movq	%rax, %xmm0
	call	sin@PLT
	movq	%xmm0, %rax
	movq	%rax, -24(%rbp)
	movsd	-64(%rbp), %xmm0
	movapd	%xmm0, %xmm1
	mulsd	-56(%rbp), %xmm1
	movsd	-48(%rbp), %xmm0
	mulsd	-40(%rbp), %xmm0
	addsd	%xmm0, %xmm1
	movsd	-32(%rbp), %xmm0
	mulsd	-24(%rbp), %xmm0
	addsd	%xmm0, %xmm1
	movq	%xmm1, %rax
	movq	%rax, %xmm0
	call	acos@PLT
	movq	%xmm0, %rax
	movq	%rax, -16(%rbp)
	movsd	-72(%rbp), %xmm0
	movapd	%xmm0, %xmm1
	mulsd	-16(%rbp), %xmm1
	movsd	.LC3(%rip), %xmm0
	addsd	%xmm1, %xmm0
	cvttsd2sil	%xmm0, %eax
	movl	%eax, %esi
	leaq	.LC4(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
.L2:
	leaq	-80(%rbp), %rsi
	leaq	-88(%rbp), %rcx
	leaq	-96(%rbp), %rdx
	leaq	-104(%rbp), %rax
	movq	%rsi, %r8
	movq	%rax, %rsi
	leaq	.LC5(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	cmpl	$-1, %eax
	je	.L3
	movsd	-104(%rbp), %xmm0
	movsd	.LC6(%rip), %xmm1
	ucomisd	%xmm1, %xmm0
	jp	.L4
	movsd	.LC6(%rip), %xmm1
	ucomisd	%xmm1, %xmm0
	jne	.L4
	movsd	-88(%rbp), %xmm0
	movsd	.LC6(%rip), %xmm1
	ucomisd	%xmm1, %xmm0
	jp	.L4
	movsd	.LC6(%rip), %xmm1
	ucomisd	%xmm1, %xmm0
	jne	.L4
	movsd	-96(%rbp), %xmm0
	movsd	.LC6(%rip), %xmm1
	ucomisd	%xmm1, %xmm0
	jp	.L4
	movsd	.LC6(%rip), %xmm1
	ucomisd	%xmm1, %xmm0
	jne	.L4
	movsd	-80(%rbp), %xmm0
	movsd	.LC6(%rip), %xmm1
	ucomisd	%xmm1, %xmm0
	jp	.L4
	movsd	.LC6(%rip), %xmm1
	ucomisd	%xmm1, %xmm0
	jne	.L4
.L3:
	movl	$0, %eax
	movq	-8(%rbp), %rdx
	subq	%fs:40, %rdx
	je	.L10
	call	__stack_chk_fail@PLT
.L10:
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE0:
	.size	main, .-main
	.section	.rodata
	.align 8
.LC0:
	.long	-1717986918
	.long	1085860377
	.align 8
.LC1:
	.long	1413754136
	.long	1074340347
	.align 8
.LC2:
	.long	0
	.long	1080459264
	.align 8
.LC3:
	.long	0
	.long	1071644672
	.align 8
.LC6:
	.long	0
	.long	-1074790400
	.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
.LC4:
	.string	"%d\n"
.LC5:
	.string	"%lf%lf%lf%lf"
	.section	.text.startup,"ax",@progbits
	.p2align 4
	.globl	main
	.type	main, @function
main:
.LFB23:
	.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	.LC5(%rip), %rbx
	subq	$136, %rsp
	.cfi_def_cfa_offset 192
	movq	%fs:40, %rax
	movq	%rax, 120(%rsp)
	xorl	%eax, %eax
	leaq	88(%rsp), %rax
	leaq	112(%rsp), %r14
	movq	%rax, 56(%rsp)
	leaq	104(%rsp), %r13
	leaq	96(%rsp), %r12
	jmp	.L2
	.p2align 4,,10
	.p2align 3
.L18:
	movsd	88(%rsp), %xmm1
	ucomisd	.LC6(%rip), %xmm1
	movsd	104(%rsp), %xmm2
	movsd	96(%rsp), %xmm3
	movsd	112(%rsp), %xmm4
	jp	.L4
	jne	.L4
	ucomisd	.LC6(%rip), %xmm2
	jp	.L4
	jne	.L4
	ucomisd	.LC6(%rip), %xmm3
	jp	.L4
	jne	.L4
	ucomisd	.LC6(%rip), %xmm4
	jp	.L4
	je	.L3
	.p2align 4,,10
	.p2align 3
.L4:
	leaq	72(%rsp), %r15
	leaq	64(%rsp), %rbp
	mulsd	.LC0(%rip), %xmm1
	movsd	%xmm4, 48(%rsp)
	divsd	.LC1(%rip), %xmm1
	movq	%rbp, %rsi
	movapd	%xmm1, %xmm0
	movq	%r15, %rdi
	movsd	%xmm2, 16(%rsp)
	movsd	%xmm3, 8(%rsp)
	call	sincos@PLT
	movsd	64(%rsp), %xmm5
	movq	%rbp, %rsi
	movq	%r15, %rdi
	movsd	72(%rsp), %xmm1
	movsd	8(%rsp), %xmm3
	mulsd	.LC0(%rip), %xmm3
	movsd	%xmm5, 40(%rsp)
	divsd	.LC1(%rip), %xmm3
	movapd	%xmm3, %xmm0
	movsd	%xmm1, (%rsp)
	call	sincos@PLT
	movsd	64(%rsp), %xmm1
	movq	%rbp, %rsi
	movq	%r15, %rdi
	movsd	72(%rsp), %xmm6
	movsd	16(%rsp), %xmm2
	mulsd	.LC0(%rip), %xmm2
	movsd	%xmm1, 32(%rsp)
	divsd	.LC1(%rip), %xmm2
	movapd	%xmm2, %xmm0
	movsd	%xmm6, 8(%rsp)
	call	sincos@PLT
	movsd	64(%rsp), %xmm2
	movq	%rbp, %rsi
	movq	%r15, %rdi
	movsd	72(%rsp), %xmm7
	movsd	48(%rsp), %xmm4
	mulsd	.LC0(%rip), %xmm4
	movsd	%xmm2, 24(%rsp)
	divsd	.LC1(%rip), %xmm4
	movapd	%xmm4, %xmm0
	movsd	%xmm7, 16(%rsp)
	call	sincos@PLT
	movsd	32(%rsp), %xmm1
	movsd	40(%rsp), %xmm5
	movsd	8(%rsp), %xmm6
	movsd	24(%rsp), %xmm2
	movsd	64(%rsp), %xmm7
	movapd	%xmm1, %xmm0
	mulsd	%xmm5, %xmm6
	mulsd	%xmm2, %xmm7
	mulsd	%xmm5, %xmm0
	mulsd	72(%rsp), %xmm2
	movapd	%xmm6, %xmm1
	mulsd	%xmm7, %xmm0
	mulsd	%xmm2, %xmm1
	addsd	%xmm1, %xmm0
	movsd	(%rsp), %xmm1
	mulsd	16(%rsp), %xmm1
	addsd	%xmm1, %xmm0
	call	acos@PLT
	mulsd	.LC2(%rip), %xmm0
	leaq	.LC4(%rip), %rsi
	xorl	%eax, %eax
	addsd	.LC3(%rip), %xmm0
	movl	$1, %edi
	cvttsd2sil	%xmm0, %edx
	call	__printf_chk@PLT
.L2:
	movq	56(%rsp), %rsi
	xorl	%eax, %eax
	movq	%r14, %r8
	movq	%r13, %rcx
	movq	%r12, %rdx
	movq	%rbx, %rdi
	call	__isoc99_scanf@PLT
	cmpl	$-1, %eax
	jne	.L18
.L3:
	movq	120(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L19
	addq	$136, %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
.L19:
	.cfi_restore_state
	call	__stack_chk_fail@PLT
	.cfi_endproc
.LFE23:
	.size	main, .-main
	.section	.rodata.cst8,"aM",@progbits,8
	.align 8
.LC0:
	.long	1413754136
	.long	1074340347
	.align 8
.LC1:
	.long	0
	.long	1080459264
	.align 8
.LC2:
	.long	-1717986918
	.long	1085860377
	.align 8
.LC3:
	.long	0
	.long	1071644672
	.align 8
.LC6:
	.long	0
	.long	-1074790400
	.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
.LC4:
	.string	"%d\n"
.LC5:
	.string	"%lf%lf%lf%lf"
	.section	.text.startup,"ax",@progbits
	.p2align 4
	.globl	main
	.type	main, @function
main:
.LFB23:
	.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	.LC5(%rip), %rbx
	subq	$136, %rsp
	.cfi_def_cfa_offset 192
	movq	%fs:40, %rax
	movq	%rax, 120(%rsp)
	xorl	%eax, %eax
	leaq	88(%rsp), %rax
	leaq	112(%rsp), %r14
	movq	%rax, 56(%rsp)
	leaq	104(%rsp), %r13
	leaq	96(%rsp), %r12
	jmp	.L2
	.p2align 4,,10
	.p2align 3
.L18:
	movsd	88(%rsp), %xmm1
	ucomisd	.LC6(%rip), %xmm1
	movsd	104(%rsp), %xmm2
	movsd	96(%rsp), %xmm3
	movsd	112(%rsp), %xmm4
	jp	.L4
	jne	.L4
	ucomisd	.LC6(%rip), %xmm2
	jp	.L4
	jne	.L4
	ucomisd	.LC6(%rip), %xmm3
	jp	.L4
	jne	.L4
	ucomisd	.LC6(%rip), %xmm4
	jp	.L4
	je	.L3
	.p2align 4,,10
	.p2align 3
.L4:
	leaq	72(%rsp), %r15
	leaq	64(%rsp), %rbp
	mulsd	.LC0(%rip), %xmm1
	movsd	%xmm4, 48(%rsp)
	divsd	.LC1(%rip), %xmm1
	movq	%rbp, %rsi
	movapd	%xmm1, %xmm0
	movq	%r15, %rdi
	movsd	%xmm2, 16(%rsp)
	movsd	%xmm3, 8(%rsp)
	call	sincos@PLT
	movsd	64(%rsp), %xmm5
	movq	%rbp, %rsi
	movq	%r15, %rdi
	movsd	72(%rsp), %xmm1
	movsd	8(%rsp), %xmm3
	mulsd	.LC0(%rip), %xmm3
	movsd	%xmm5, 40(%rsp)
	divsd	.LC1(%rip), %xmm3
	movapd	%xmm3, %xmm0
	movsd	%xmm1, (%rsp)
	call	sincos@PLT
	movsd	64(%rsp), %xmm1
	movq	%rbp, %rsi
	movq	%r15, %rdi
	movsd	72(%rsp), %xmm6
	movsd	16(%rsp), %xmm2
	mulsd	.LC0(%rip), %xmm2
	movsd	%xmm1, 32(%rsp)
	divsd	.LC1(%rip), %xmm2
	movapd	%xmm2, %xmm0
	movsd	%xmm6, 8(%rsp)
	call	sincos@PLT
	movsd	64(%rsp), %xmm2
	movq	%rbp, %rsi
	movq	%r15, %rdi
	movsd	72(%rsp), %xmm7
	movsd	48(%rsp), %xmm4
	mulsd	.LC0(%rip), %xmm4
	movsd	%xmm2, 24(%rsp)
	divsd	.LC1(%rip), %xmm4
	movapd	%xmm4, %xmm0
	movsd	%xmm7, 16(%rsp)
	call	sincos@PLT
	movsd	32(%rsp), %xmm1
	movsd	40(%rsp), %xmm5
	movsd	8(%rsp), %xmm6
	movsd	24(%rsp), %xmm2
	movsd	64(%rsp), %xmm7
	movapd	%xmm1, %xmm0
	mulsd	%xmm5, %xmm6
	mulsd	%xmm2, %xmm7
	mulsd	%xmm5, %xmm0
	mulsd	72(%rsp), %xmm2
	movapd	%xmm6, %xmm1
	mulsd	%xmm7, %xmm0
	mulsd	%xmm2, %xmm1
	addsd	%xmm1, %xmm0
	movsd	(%rsp), %xmm1
	mulsd	16(%rsp), %xmm1
	addsd	%xmm1, %xmm0
	call	acos@PLT
	mulsd	.LC2(%rip), %xmm0
	leaq	.LC4(%rip), %rsi
	xorl	%eax, %eax
	addsd	.LC3(%rip), %xmm0
	movl	$1, %edi
	cvttsd2sil	%xmm0, %edx
	call	__printf_chk@PLT
.L2:
	movq	56(%rsp), %rsi
	xorl	%eax, %eax
	movq	%r14, %r8
	movq	%r13, %rcx
	movq	%r12, %rdx
	movq	%rbx, %rdi
	call	__isoc99_scanf@PLT
	cmpl	$-1, %eax
	jne	.L18
.L3:
	movq	120(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L19
	addq	$136, %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
.L19:
	.cfi_restore_state
	call	__stack_chk_fail@PLT
	.cfi_endproc
.LFE23:
	.size	main, .-main
	.section	.rodata.cst8,"aM",@progbits,8
	.align 8
.LC0:
	.long	1413754136
	.long	1074340347
	.align 8
.LC1:
	.long	0
	.long	1080459264
	.align 8
.LC2:
	.long	-1717986918
	.long	1085860377
	.align 8
.LC3:
	.long	0
	.long	1071644672
	.align 8
.LC6:
	.long	0
	.long	-1074790400
	.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>
#include <math.h>
#define rad(x) (x)*M_PI/180.0
int main(void) {
    double theta1,phi1,theta2,phi2,alpha,x1,x2,y1,y2,z1,z2,r=6378.1;
    while (scanf("%lf%lf%lf%lf",&theta1,&phi1,&theta2,&phi2)!=EOF&&(theta1!=-1||theta2!=-1||phi1!=-1||phi2!=-1)) {
        x1=cos(rad(theta1))*cos(rad(phi1));
        x2=cos(rad(theta2))*cos(rad(phi2));
        y1=cos(rad(theta1))*sin(rad(phi1));
        y2=cos(rad(theta2))*sin(rad(phi2));
        z1=sin(rad(theta1));
        z2=sin(rad(theta2));
        alpha=acos(x1*x2+y1*y2+z1*z2);
        printf("%d\n",(int)(r*alpha+0.5));
    }
    return 0;
}
35.997652258458864 139.77 51.15 359.82
1.37 103.92 41.78 272.25
51.15 359.82 -34.58 301.52
-1 -1 -1 -1
 35.68 139.77 51.15 359.82
1.37 103.92 41.78 272.25
51.15 359.82 -34.03920544232073 301.52
-1 -1 -1 -1
 35.997652258458864 139.77 51.15 359.82
1.37 103.92 41.78 272.25
51.15 359.82 -34.58 302.04903635880555
-1 -1 -1 -1
 35.68 139.77 51.15 359.82
1.37 103.92 42.40751195136165 272.25
51.15 359.82 -34.03920544232073 301.52
-1 -1 -1 -1
 35.68 139.77 51.15 360.2993625222263
1.37 103.92 42.40751195136165 272.25
51.15 359.82 -34.03920544232073 301.52
-1 -1 -1 -1
 35.68 139.77 51.15 359.82
1.37 103.92 41.78 272.25
51.99657446150969 359.82 -34.58 301.52
-1 -1 -1 -1
 35.997652258458864 139.77 51.15 359.82
1.37 103.92 41.78 272.25
51.15 359.82 -34.03891385785915 301.52
-1 -1 -1 -1
 35.68 139.77 51.15 359.82
1.5789515272885046 103.92 41.78 272.25
51.15 359.82 -34.03920544232073 301.52
-1 -1 -1 -1
 35.997652258458864 140.28396755648947 51.15 359.82
1.37 103.92 41.78 272.25
51.15 359.82 -34.58 302.04903635880555
-1 -1 -1 -1
 35.68 139.77 51.15 359.82
1.37 103.92 42.40751195136165 272.25
51.15 359.82 -34.03920544232073 302.3019500184568
-1 -1 -1 -1

9577
15092
11112
 9609
15092
11062
 9577
15092
11086
 9609
15025
11062
 9591
15025
11062
 9609
15092
11178
 9577
15092
11062
 9609
15069
11062
 9595
15092
11086
 9609
15025
11023

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>
#include <math.h>
#define rad(x) (x)*M_PI/180.0
int main(void) {
    double theta1,phi1,theta2,phi2,alpha,x1,x2,y1,y2,z1,z2,r=6378.1;
    while (scanf("%lf%lf%lf%lf",&theta1,&phi1,&theta2,&phi2)!=EOF&&(theta1!=-1||theta2!=-1||phi1!=-1||phi2!=-1)) {
        x1=cos(rad(theta1))*cos(rad(phi1));
        x2=cos(rad(theta2))*cos(rad(phi2));
        y1=cos(rad(theta1))*sin(rad(phi1));
        y2=cos(rad(theta2))*sin(rad(phi2));
        z1=sin(rad(theta1));
        z2=sin(rad(theta2));
        alpha=acos(x1*x2+y1*y2+z1*z2);
        printf("%d\n",(int)(r*alpha+0.5));
    }
    return 0;
}```

Unoptimized Assembly Code:

```assembly
	.file	"temp.c"
	.text
	.section	.rodata
.LC4:
	.string	"%d\n"
.LC5:
	.string	"%lf%lf%lf%lf"
	.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
	addq	$-128, %rsp
	movq	%fs:40, %rax
	movq	%rax, -8(%rbp)
	xorl	%eax, %eax
	movsd	.LC0(%rip), %xmm0
	movsd	%xmm0, -72(%rbp)
	jmp	.L2
.L4:
	movsd	-104(%rbp), %xmm1
	movsd	.LC1(%rip), %xmm0
	mulsd	%xmm1, %xmm0
	movsd	.LC2(%rip), %xmm1
	divsd	%xmm1, %xmm0
	movq	%xmm0, %rax
	movq	%rax, %xmm0
	call	cos@PLT
	movsd	%xmm0, -120(%rbp)
	movsd	-96(%rbp), %xmm1
	movsd	.LC1(%rip), %xmm0
	mulsd	%xmm1, %xmm0
	movsd	.LC2(%rip), %xmm1
	movapd	%xmm0, %xmm2
	divsd	%xmm1, %xmm2
	movq	%xmm2, %rax
	movq	%rax, %xmm0
	call	cos@PLT
	mulsd	-120(%rbp), %xmm0
	movsd	%xmm0, -64(%rbp)
	movsd	-88(%rbp), %xmm1
	movsd	.LC1(%rip), %xmm0
	mulsd	%xmm1, %xmm0
	movsd	.LC2(%rip), %xmm1
	divsd	%xmm1, %xmm0
	movq	%xmm0, %rax
	movq	%rax, %xmm0
	call	cos@PLT
	movsd	%xmm0, -120(%rbp)
	movsd	-80(%rbp), %xmm1
	movsd	.LC1(%rip), %xmm0
	mulsd	%xmm1, %xmm0
	movsd	.LC2(%rip), %xmm1
	movapd	%xmm0, %xmm3
	divsd	%xmm1, %xmm3
	movq	%xmm3, %rax
	movq	%rax, %xmm0
	call	cos@PLT
	mulsd	-120(%rbp), %xmm0
	movsd	%xmm0, -56(%rbp)
	movsd	-104(%rbp), %xmm1
	movsd	.LC1(%rip), %xmm0
	mulsd	%xmm1, %xmm0
	movsd	.LC2(%rip), %xmm1
	divsd	%xmm1, %xmm0
	movq	%xmm0, %rax
	movq	%rax, %xmm0
	call	cos@PLT
	movsd	%xmm0, -120(%rbp)
	movsd	-96(%rbp), %xmm1
	movsd	.LC1(%rip), %xmm0
	mulsd	%xmm1, %xmm0
	movsd	.LC2(%rip), %xmm1
	movapd	%xmm0, %xmm4
	divsd	%xmm1, %xmm4
	movq	%xmm4, %rax
	movq	%rax, %xmm0
	call	sin@PLT
	mulsd	-120(%rbp), %xmm0
	movsd	%xmm0, -48(%rbp)
	movsd	-88(%rbp), %xmm1
	movsd	.LC1(%rip), %xmm0
	mulsd	%xmm1, %xmm0
	movsd	.LC2(%rip), %xmm1
	divsd	%xmm1, %xmm0
	movq	%xmm0, %rax
	movq	%rax, %xmm0
	call	cos@PLT
	movsd	%xmm0, -120(%rbp)
	movsd	-80(%rbp), %xmm1
	movsd	.LC1(%rip), %xmm0
	mulsd	%xmm1, %xmm0
	movsd	.LC2(%rip), %xmm1
	movapd	%xmm0, %xmm5
	divsd	%xmm1, %xmm5
	movq	%xmm5, %rax
	movq	%rax, %xmm0
	call	sin@PLT
	mulsd	-120(%rbp), %xmm0
	movsd	%xmm0, -40(%rbp)
	movsd	-104(%rbp), %xmm1
	movsd	.LC1(%rip), %xmm0
	mulsd	%xmm1, %xmm0
	movsd	.LC2(%rip), %xmm1
	divsd	%xmm1, %xmm0
	movq	%xmm0, %rax
	movq	%rax, %xmm0
	call	sin@PLT
	movq	%xmm0, %rax
	movq	%rax, -32(%rbp)
	movsd	-88(%rbp), %xmm1
	movsd	.LC1(%rip), %xmm0
	mulsd	%xmm1, %xmm0
	movsd	.LC2(%rip), %xmm1
	divsd	%xmm1, %xmm0
	movq	%xmm0, %rax
	movq	%rax, %xmm0
	call	sin@PLT
	movq	%xmm0, %rax
	movq	%rax, -24(%rbp)
	movsd	-64(%rbp), %xmm0
	movapd	%xmm0, %xmm1
	mulsd	-56(%rbp), %xmm1
	movsd	-48(%rbp), %xmm0
	mulsd	-40(%rbp), %xmm0
	addsd	%xmm0, %xmm1
	movsd	-32(%rbp), %xmm0
	mulsd	-24(%rbp), %xmm0
	addsd	%xmm0, %xmm1
	movq	%xmm1, %rax
	movq	%rax, %xmm0
	call	acos@PLT
	movq	%xmm0, %rax
	movq	%rax, -16(%rbp)
	movsd	-72(%rbp), %xmm0
	movapd	%xmm0, %xmm1
	mulsd	-16(%rbp), %xmm1
	movsd	.LC3(%rip), %xmm0
	addsd	%xmm1, %xmm0
	cvttsd2sil	%xmm0, %eax
	movl	%eax, %esi
	leaq	.LC4(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
.L2:
	leaq	-80(%rbp), %rsi
	leaq	-88(%rbp), %rcx
	leaq	-96(%rbp), %rdx
	leaq	-104(%rbp), %rax
	movq	%rsi, %r8
	movq	%rax, %rsi
	leaq	.LC5(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	cmpl	$-1, %eax
	je	.L3
	movsd	-104(%rbp), %xmm0
	movsd	.LC6(%rip), %xmm1
	ucomisd	%xmm1, %xmm0
	jp	.L4
	movsd	.LC6(%rip), %xmm1
	ucomisd	%xmm1, %xmm0
	jne	.L4
	movsd	-88(%rbp), %xmm0
	movsd	.LC6(%rip), %xmm1
	ucomisd	%xmm1, %xmm0
	jp	.L4
	movsd	.LC6(%rip), %xmm1
	ucomisd	%xmm1, %xmm0
	jne	.L4
	movsd	-96(%rbp), %xmm0
	movsd	.LC6(%rip), %xmm1
	ucomisd	%xmm1, %xmm0
	jp	.L4
	movsd	.LC6(%rip), %xmm1
	ucomisd	%xmm1, %xmm0
	jne	.L4
	movsd	-80(%rbp), %xmm0
	movsd	.LC6(%rip), %xmm1
	ucomisd	%xmm1, %xmm0
	jp	.L4
	movsd	.LC6(%rip), %xmm1
	ucomisd	%xmm1, %xmm0
	jne	.L4
.L3:
	movl	$0, %eax
	movq	-8(%rbp), %rdx
	subq	%fs:40, %rdx
	je	.L10
	call	__stack_chk_fail@PLT
.L10:
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE0:
	.size	main, .-main
	.section	.rodata
	.align 8
.LC0:
	.long	-1717986918
	.long	1085860377
	.align 8
.LC1:
	.long	1413754136
	.long	1074340347
	.align 8
.LC2:
	.long	0
	.long	1080459264
	.align 8
.LC3:
	.long	0
	.long	1071644672
	.align 8
.LC6:
	.long	0
	.long	-1074790400
	.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
	.section	.rodata
.LC4:
	.string	"%d\n"
.LC5:
	.string	"%lf%lf%lf%lf"
	.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
	addq	$-128, %rsp
	movq	%fs:40, %rax
	movq	%rax, -8(%rbp)
	xorl	%eax, %eax
	movsd	.LC0(%rip), %xmm0
	movsd	%xmm0, -72(%rbp)
	jmp	.L2
.L4:
	movsd	-104(%rbp), %xmm1
	movsd	.LC1(%rip), %xmm0
	mulsd	%xmm1, %xmm0
	movsd	.LC2(%rip), %xmm1
	divsd	%xmm1, %xmm0
	movq	%xmm0, %rax
	movq	%rax, %xmm0
	call	cos@PLT
	movsd	%xmm0, -120(%rbp)
	movsd	-96(%rbp), %xmm1
	movsd	.LC1(%rip), %xmm0
	mulsd	%xmm1, %xmm0
	movsd	.LC2(%rip), %xmm1
	movapd	%xmm0, %xmm2
	divsd	%xmm1, %xmm2
	movq	%xmm2, %rax
	movq	%rax, %xmm0
	call	cos@PLT
	mulsd	-120(%rbp), %xmm0
	movsd	%xmm0, -64(%rbp)
	movsd	-88(%rbp), %xmm1
	movsd	.LC1(%rip), %xmm0
	mulsd	%xmm1, %xmm0
	movsd	.LC2(%rip), %xmm1
	divsd	%xmm1, %xmm0
	movq	%xmm0, %rax
	movq	%rax, %xmm0
	call	cos@PLT
	movsd	%xmm0, -120(%rbp)
	movsd	-80(%rbp), %xmm1
	movsd	.LC1(%rip), %xmm0
	mulsd	%xmm1, %xmm0
	movsd	.LC2(%rip), %xmm1
	movapd	%xmm0, %xmm3
	divsd	%xmm1, %xmm3
	movq	%xmm3, %rax
	movq	%rax, %xmm0
	call	cos@PLT
	mulsd	-120(%rbp), %xmm0
	movsd	%xmm0, -56(%rbp)
	movsd	-104(%rbp), %xmm1
	movsd	.LC1(%rip), %xmm0
	mulsd	%xmm1, %xmm0
	movsd	.LC2(%rip), %xmm1
	divsd	%xmm1, %xmm0
	movq	%xmm0, %rax
	movq	%rax, %xmm0
	call	cos@PLT
	movsd	%xmm0, -120(%rbp)
	movsd	-96(%rbp), %xmm1
	movsd	.LC1(%rip), %xmm0
	mulsd	%xmm1, %xmm0
	movsd	.LC2(%rip), %xmm1
	movapd	%xmm0, %xmm4
	divsd	%xmm1, %xmm4
	movq	%xmm4, %rax
	movq	%rax, %xmm0
	call	sin@PLT
	mulsd	-120(%rbp), %xmm0
	movsd	%xmm0, -48(%rbp)
	movsd	-88(%rbp), %xmm1
	movsd	.LC1(%rip), %xmm0
	mulsd	%xmm1, %xmm0
	movsd	.LC2(%rip), %xmm1
	divsd	%xmm1, %xmm0
	movq	%xmm0, %rax
	movq	%rax, %xmm0
	call	cos@PLT
	movsd	%xmm0, -120(%rbp)
	movsd	-80(%rbp), %xmm1
	movsd	.LC1(%rip), %xmm0
	mulsd	%xmm1, %xmm0
	movsd	.LC2(%rip), %xmm1
	movapd	%xmm0, %xmm5
	divsd	%xmm1, %xmm5
	movq	%xmm5, %rax
	movq	%rax, %xmm0
	call	sin@PLT
	mulsd	-120(%rbp), %xmm0
	movsd	%xmm0, -40(%rbp)
	movsd	-104(%rbp), %xmm1
	movsd	.LC1(%rip), %xmm0
	mulsd	%xmm1, %xmm0
	movsd	.LC2(%rip), %xmm1
	divsd	%xmm1, %xmm0
	movq	%xmm0, %rax
	movq	%rax, %xmm0
	call	sin@PLT
	movq	%xmm0, %rax
	movq	%rax, -32(%rbp)
	movsd	-88(%rbp), %xmm1
	movsd	.LC1(%rip), %xmm0
	mulsd	%xmm1, %xmm0
	movsd	.LC2(%rip), %xmm1
	divsd	%xmm1, %xmm0
	movq	%xmm0, %rax
	movq	%rax, %xmm0
	call	sin@PLT
	movq	%xmm0, %rax
	movq	%rax, -24(%rbp)
	movsd	-64(%rbp), %xmm0
	movapd	%xmm0, %xmm1
	mulsd	-56(%rbp), %xmm1
	movsd	-48(%rbp), %xmm0
	mulsd	-40(%rbp), %xmm0
	addsd	%xmm0, %xmm1
	movsd	-32(%rbp), %xmm0
	mulsd	-24(%rbp), %xmm0
	addsd	%xmm0, %xmm1
	movq	%xmm1, %rax
	movq	%rax, %xmm0
	call	acos@PLT
	movq	%xmm0, %rax
	movq	%rax, -16(%rbp)
	movsd	-72(%rbp), %xmm0
	movapd	%xmm0, %xmm1
	mulsd	-16(%rbp), %xmm1
	movsd	.LC3(%rip), %xmm0
	addsd	%xmm1, %xmm0
	cvttsd2sil	%xmm0, %eax
	movl	%eax, %esi
	leaq	.LC4(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
.L2:
	leaq	-80(%rbp), %rsi
	leaq	-88(%rbp), %rcx
	leaq	-96(%rbp), %rdx
	leaq	-104(%rbp), %rax
	movq	%rsi, %r8
	movq	%rax, %rsi
	leaq	.LC5(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	cmpl	$-1, %eax
	je	.L3
	movsd	-104(%rbp), %xmm0
	movsd	.LC6(%rip), %xmm1
	ucomisd	%xmm1, %xmm0
	jp	.L4
	movsd	.LC6(%rip), %xmm1
	ucomisd	%xmm1, %xmm0
	jne	.L4
	movsd	-88(%rbp), %xmm0
	movsd	.LC6(%rip), %xmm1
	ucomisd	%xmm1, %xmm0
	jp	.L4
	movsd	.LC6(%rip), %xmm1
	ucomisd	%xmm1, %xmm0
	jne	.L4
	movsd	-96(%rbp), %xmm0
	movsd	.LC6(%rip), %xmm1
	ucomisd	%xmm1, %xmm0
	jp	.L4
	movsd	.LC6(%rip), %xmm1
	ucomisd	%xmm1, %xmm0
	jne	.L4
	movsd	-80(%rbp), %xmm0
	movsd	.LC6(%rip), %xmm1
	ucomisd	%xmm1, %xmm0
	jp	.L4
	movsd	.LC6(%rip), %xmm1
	ucomisd	%xmm1, %xmm0
	jne	.L4
.L3:
	movl	$0, %eax
	movq	-8(%rbp), %rdx
	subq	%fs:40, %rdx
	je	.L10
	call	__stack_chk_fail@PLT
.L10:
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE0:
	.size	main, .-main
	.section	.rodata
	.align 8
.LC0:
	.long	-1717986918
	.long	1085860377
	.align 8
.LC1:
	.long	1413754136
	.long	1074340347
	.align 8
.LC2:
	.long	0
	.long	1080459264
	.align 8
.LC3:
	.long	0
	.long	1071644672
	.align 8
.LC6:
	.long	0
	.long	-1074790400
	.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:
