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>

int main(int argc,char* argv[]){
  
  for(;;){
    int n,i;
    double rad,x,y;
    scanf("%d",&n);
    if(n == -1){break;}
    

    x = y = 1.0;
    rad = M_PI/4;
    for(i = 0; i < (n-2); i++){
      x += cos(rad + M_PI/2);
      y += sin(rad + M_PI/2);
      rad = atan2(y,x);
    }

    printf("%.2lf\n%.2lf\n",x,y);
  }
  
  return 0;
  
}```

Unoptimized Assembly Code:

```assembly
	.file	"temp.c"
	.text
	.section	.rodata
.LC0:
	.string	"%d"
.LC4:
	.string	"%.2lf\n%.2lf\n"
	.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	$64, %rsp
	movl	%edi, -52(%rbp)
	movq	%rsi, -64(%rbp)
	movq	%fs:40, %rax
	movq	%rax, -8(%rbp)
	xorl	%eax, %eax
.L6:
	leaq	-40(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	-40(%rbp), %eax
	cmpl	$-1, %eax
	jne	.L2
	movl	$0, %eax
	movq	-8(%rbp), %rdx
	subq	%fs:40, %rdx
	je	.L7
	jmp	.L8
.L2:
	movsd	.LC1(%rip), %xmm0
	movsd	%xmm0, -16(%rbp)
	movsd	-16(%rbp), %xmm0
	movsd	%xmm0, -24(%rbp)
	movsd	.LC2(%rip), %xmm0
	movsd	%xmm0, -32(%rbp)
	movl	$0, -36(%rbp)
	jmp	.L4
.L5:
	movsd	-32(%rbp), %xmm1
	movsd	.LC3(%rip), %xmm0
	addsd	%xmm0, %xmm1
	movq	%xmm1, %rax
	movq	%rax, %xmm0
	call	cos@PLT
	movsd	-24(%rbp), %xmm1
	addsd	%xmm1, %xmm0
	movsd	%xmm0, -24(%rbp)
	movsd	-32(%rbp), %xmm1
	movsd	.LC3(%rip), %xmm0
	addsd	%xmm0, %xmm1
	movq	%xmm1, %rax
	movq	%rax, %xmm0
	call	sin@PLT
	movsd	-16(%rbp), %xmm1
	addsd	%xmm1, %xmm0
	movsd	%xmm0, -16(%rbp)
	movsd	-24(%rbp), %xmm0
	movq	-16(%rbp), %rax
	movapd	%xmm0, %xmm1
	movq	%rax, %xmm0
	call	atan2@PLT
	movq	%xmm0, %rax
	movq	%rax, -32(%rbp)
	addl	$1, -36(%rbp)
.L4:
	movl	-40(%rbp), %eax
	subl	$2, %eax
	cmpl	%eax, -36(%rbp)
	jl	.L5
	movsd	-16(%rbp), %xmm0
	movq	-24(%rbp), %rax
	movapd	%xmm0, %xmm1
	movq	%rax, %xmm0
	leaq	.LC4(%rip), %rax
	movq	%rax, %rdi
	movl	$2, %eax
	call	printf@PLT
	jmp	.L6
.L8:
	call	__stack_chk_fail@PLT
.L7:
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE0:
	.size	main, .-main
	.section	.rodata
	.align 8
.LC1:
	.long	0
	.long	1072693248
	.align 8
.LC2:
	.long	1413754136
	.long	1072243195
	.align 8
.LC3:
	.long	1413754136
	.long	1073291771
	.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
.LC3:
	.string	"%d"
.LC5:
	.string	"%.2lf\n%.2lf\n"
	.section	.text.startup,"ax",@progbits
	.p2align 4
	.globl	main
	.type	main, @function
main:
.LFB23:
	.cfi_startproc
	endbr64
	pushq	%r13
	.cfi_def_cfa_offset 16
	.cfi_offset 13, -16
	pushq	%r12
	.cfi_def_cfa_offset 24
	.cfi_offset 12, -24
	leaq	.LC3(%rip), %r12
	pushq	%rbp
	.cfi_def_cfa_offset 32
	.cfi_offset 6, -32
	pushq	%rbx
	.cfi_def_cfa_offset 40
	.cfi_offset 3, -40
	subq	$56, %rsp
	.cfi_def_cfa_offset 96
	movq	%fs:40, %rax
	movq	%rax, 40(%rsp)
	xorl	%eax, %eax
	leaq	36(%rsp), %r13
	.p2align 4,,10
	.p2align 3
.L5:
	movq	%r13, %rsi
	movq	%r12, %rdi
	xorl	%eax, %eax
	call	__isoc99_scanf@PLT
	movl	36(%rsp), %ebp
	cmpl	$-1, %ebp
	je	.L2
	subl	$2, %ebp
	testl	%ebp, %ebp
	jle	.L7
	movq	.LC0(%rip), %rax
	movsd	.LC2(%rip), %xmm2
	xorl	%ebx, %ebx
	movq	%rax, %xmm1
	movq	.LC1(%rip), %rax
	movapd	%xmm2, %xmm3
	movq	%rax, %xmm0
	jmp	.L4
	.p2align 4,,10
	.p2align 3
.L10:
	leaq	24(%rsp), %rdi
	leaq	16(%rsp), %rsi
	movsd	%xmm3, (%rsp)
	addsd	.LC4(%rip), %xmm0
	movsd	%xmm2, 8(%rsp)
	call	sincos@PLT
	movsd	16(%rsp), %xmm1
	movsd	(%rsp), %xmm3
	movsd	24(%rsp), %xmm0
	movsd	8(%rsp), %xmm2
.L4:
	addsd	%xmm1, %xmm3
	addsd	%xmm0, %xmm2
	addl	$1, %ebx
	movapd	%xmm3, %xmm1
	movapd	%xmm2, %xmm0
	movsd	%xmm3, 8(%rsp)
	movsd	%xmm2, (%rsp)
	call	atan2@PLT
	cmpl	%ebp, %ebx
	movsd	(%rsp), %xmm2
	movsd	8(%rsp), %xmm3
	jne	.L10
.L3:
	movapd	%xmm2, %xmm1
	movapd	%xmm3, %xmm0
	movl	$1, %edi
	movl	$2, %eax
	leaq	.LC5(%rip), %rsi
	call	__printf_chk@PLT
	jmp	.L5
	.p2align 4,,10
	.p2align 3
.L2:
	movq	40(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L11
	addq	$56, %rsp
	.cfi_remember_state
	.cfi_def_cfa_offset 40
	xorl	%eax, %eax
	popq	%rbx
	.cfi_def_cfa_offset 32
	popq	%rbp
	.cfi_def_cfa_offset 24
	popq	%r12
	.cfi_def_cfa_offset 16
	popq	%r13
	.cfi_def_cfa_offset 8
	ret
	.p2align 4,,10
	.p2align 3
.L7:
	.cfi_restore_state
	movsd	.LC2(%rip), %xmm2
	movapd	%xmm2, %xmm3
	jmp	.L3
.L11:
	call	__stack_chk_fail@PLT
	.cfi_endproc
.LFE23:
	.size	main, .-main
	.section	.rodata.cst8,"aM",@progbits,8
	.align 8
.LC0:
	.long	1719614412
	.long	-1075404642
	.align 8
.LC1:
	.long	1719614413
	.long	1072079006
	.align 8
.LC2:
	.long	0
	.long	1072693248
	.align 8
.LC4:
	.long	1413754136
	.long	1073291771
	.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
.LC3:
	.string	"%d"
.LC5:
	.string	"%.2lf\n%.2lf\n"
	.section	.text.startup,"ax",@progbits
	.p2align 4
	.globl	main
	.type	main, @function
main:
.LFB23:
	.cfi_startproc
	endbr64
	pushq	%r13
	.cfi_def_cfa_offset 16
	.cfi_offset 13, -16
	pushq	%r12
	.cfi_def_cfa_offset 24
	.cfi_offset 12, -24
	leaq	.LC3(%rip), %r12
	pushq	%rbp
	.cfi_def_cfa_offset 32
	.cfi_offset 6, -32
	pushq	%rbx
	.cfi_def_cfa_offset 40
	.cfi_offset 3, -40
	subq	$56, %rsp
	.cfi_def_cfa_offset 96
	movq	%fs:40, %rax
	movq	%rax, 40(%rsp)
	xorl	%eax, %eax
	leaq	36(%rsp), %r13
	.p2align 4,,10
	.p2align 3
.L5:
	movq	%r13, %rsi
	movq	%r12, %rdi
	xorl	%eax, %eax
	call	__isoc99_scanf@PLT
	movl	36(%rsp), %ebp
	cmpl	$-1, %ebp
	je	.L2
	subl	$2, %ebp
	testl	%ebp, %ebp
	jle	.L7
	movq	.LC0(%rip), %rax
	movsd	.LC2(%rip), %xmm2
	xorl	%ebx, %ebx
	movq	%rax, %xmm1
	movq	.LC1(%rip), %rax
	movapd	%xmm2, %xmm3
	movq	%rax, %xmm0
	jmp	.L4
	.p2align 4,,10
	.p2align 3
.L10:
	leaq	24(%rsp), %rdi
	leaq	16(%rsp), %rsi
	movsd	%xmm3, (%rsp)
	addsd	.LC4(%rip), %xmm0
	movsd	%xmm2, 8(%rsp)
	call	sincos@PLT
	movsd	16(%rsp), %xmm1
	movsd	(%rsp), %xmm3
	movsd	24(%rsp), %xmm0
	movsd	8(%rsp), %xmm2
.L4:
	addsd	%xmm1, %xmm3
	addsd	%xmm0, %xmm2
	addl	$1, %ebx
	movapd	%xmm3, %xmm1
	movapd	%xmm2, %xmm0
	movsd	%xmm3, 8(%rsp)
	movsd	%xmm2, (%rsp)
	call	atan2@PLT
	cmpl	%ebp, %ebx
	movsd	(%rsp), %xmm2
	movsd	8(%rsp), %xmm3
	jne	.L10
.L3:
	movapd	%xmm2, %xmm1
	movapd	%xmm3, %xmm0
	movl	$1, %edi
	movl	$2, %eax
	leaq	.LC5(%rip), %rsi
	call	__printf_chk@PLT
	jmp	.L5
	.p2align 4,,10
	.p2align 3
.L2:
	movq	40(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L11
	addq	$56, %rsp
	.cfi_remember_state
	.cfi_def_cfa_offset 40
	xorl	%eax, %eax
	popq	%rbx
	.cfi_def_cfa_offset 32
	popq	%rbp
	.cfi_def_cfa_offset 24
	popq	%r12
	.cfi_def_cfa_offset 16
	popq	%r13
	.cfi_def_cfa_offset 8
	ret
	.p2align 4,,10
	.p2align 3
.L7:
	.cfi_restore_state
	movsd	.LC2(%rip), %xmm2
	movapd	%xmm2, %xmm3
	jmp	.L3
.L11:
	call	__stack_chk_fail@PLT
	.cfi_endproc
.LFE23:
	.size	main, .-main
	.section	.rodata.cst8,"aM",@progbits,8
	.align 8
.LC0:
	.long	1719614412
	.long	-1075404642
	.align 8
.LC1:
	.long	1719614413
	.long	1072079006
	.align 8
.LC2:
	.long	0
	.long	1072693248
	.align 8
.LC4:
	.long	1413754136
	.long	1073291771
	.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>

int main(int argc,char* argv[]){
  
  for(;;){
    int n,i;
    double rad,x,y;
    scanf("%d",&n);
    if(n == -1){break;}
    

    x = y = 1.0;
    rad = M_PI/4;
    for(i = 0; i < (n-2); i++){
      x += cos(rad + M_PI/2);
      y += sin(rad + M_PI/2);
      rad = atan2(y,x);
    }

    printf("%.2lf\n%.2lf\n",x,y);
  }
  
  return 0;
  
}
3
2
-1
 3
3
-1
 3
1
-1
 3
5
-1
 3
4
-1
 3
-1
-1
 3
8
-1
 3
11
-1
 3
21
-1
 3
39
-1

0.29
1.71
1.00
1.00
 0.29
1.71
0.29
1.71
 0.29
1.71
1.00
1.00
 0.29
1.71
-1.63
1.53
 0.29
1.71
-0.69
1.88
 0.29
1.71
 0.29
1.71
-2.59
-1.14
 0.29
1.71
-0.62
-3.26
 0.29
1.71
3.32
3.16
 0.29
1.71
-3.71
-5.02

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>

int main(int argc,char* argv[]){
  
  for(;;){
    int n,i;
    double rad,x,y;
    scanf("%d",&n);
    if(n == -1){break;}
    

    x = y = 1.0;
    rad = M_PI/4;
    for(i = 0; i < (n-2); i++){
      x += cos(rad + M_PI/2);
      y += sin(rad + M_PI/2);
      rad = atan2(y,x);
    }

    printf("%.2lf\n%.2lf\n",x,y);
  }
  
  return 0;
  
}```

Unoptimized Assembly Code:

```assembly
	.file	"temp.c"
	.text
	.section	.rodata
.LC0:
	.string	"%d"
.LC4:
	.string	"%.2lf\n%.2lf\n"
	.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	$64, %rsp
	movl	%edi, -52(%rbp)
	movq	%rsi, -64(%rbp)
	movq	%fs:40, %rax
	movq	%rax, -8(%rbp)
	xorl	%eax, %eax
.L6:
	leaq	-40(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	-40(%rbp), %eax
	cmpl	$-1, %eax
	jne	.L2
	movl	$0, %eax
	movq	-8(%rbp), %rdx
	subq	%fs:40, %rdx
	je	.L7
	jmp	.L8
.L2:
	movsd	.LC1(%rip), %xmm0
	movsd	%xmm0, -16(%rbp)
	movsd	-16(%rbp), %xmm0
	movsd	%xmm0, -24(%rbp)
	movsd	.LC2(%rip), %xmm0
	movsd	%xmm0, -32(%rbp)
	movl	$0, -36(%rbp)
	jmp	.L4
.L5:
	movsd	-32(%rbp), %xmm1
	movsd	.LC3(%rip), %xmm0
	addsd	%xmm0, %xmm1
	movq	%xmm1, %rax
	movq	%rax, %xmm0
	call	cos@PLT
	movsd	-24(%rbp), %xmm1
	addsd	%xmm1, %xmm0
	movsd	%xmm0, -24(%rbp)
	movsd	-32(%rbp), %xmm1
	movsd	.LC3(%rip), %xmm0
	addsd	%xmm0, %xmm1
	movq	%xmm1, %rax
	movq	%rax, %xmm0
	call	sin@PLT
	movsd	-16(%rbp), %xmm1
	addsd	%xmm1, %xmm0
	movsd	%xmm0, -16(%rbp)
	movsd	-24(%rbp), %xmm0
	movq	-16(%rbp), %rax
	movapd	%xmm0, %xmm1
	movq	%rax, %xmm0
	call	atan2@PLT
	movq	%xmm0, %rax
	movq	%rax, -32(%rbp)
	addl	$1, -36(%rbp)
.L4:
	movl	-40(%rbp), %eax
	subl	$2, %eax
	cmpl	%eax, -36(%rbp)
	jl	.L5
	movsd	-16(%rbp), %xmm0
	movq	-24(%rbp), %rax
	movapd	%xmm0, %xmm1
	movq	%rax, %xmm0
	leaq	.LC4(%rip), %rax
	movq	%rax, %rdi
	movl	$2, %eax
	call	printf@PLT
	jmp	.L6
.L8:
	call	__stack_chk_fail@PLT
.L7:
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE0:
	.size	main, .-main
	.section	.rodata
	.align 8
.LC1:
	.long	0
	.long	1072693248
	.align 8
.LC2:
	.long	1413754136
	.long	1072243195
	.align 8
.LC3:
	.long	1413754136
	.long	1073291771
	.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
.LC0:
	.string	"%d"
.LC4:
	.string	"%.2lf\n%.2lf\n"
	.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	$64, %rsp
	movl	%edi, -52(%rbp)
	movq	%rsi, -64(%rbp)
	movq	%fs:40, %rax
	movq	%rax, -8(%rbp)
	xorl	%eax, %eax
.L6:
	leaq	-40(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	-40(%rbp), %eax
	cmpl	$-1, %eax
	jne	.L2
	movl	$0, %eax
	movq	-8(%rbp), %rdx
	subq	%fs:40, %rdx
	je	.L7
	jmp	.L8
.L2:
	movsd	.LC1(%rip), %xmm0
	movsd	%xmm0, -16(%rbp)
	movsd	-16(%rbp), %xmm0
	movsd	%xmm0, -24(%rbp)
	movsd	.LC2(%rip), %xmm0
	movsd	%xmm0, -32(%rbp)
	movl	$0, -36(%rbp)
	jmp	.L4
.L5:
	movsd	-32(%rbp), %xmm1
	movsd	.LC3(%rip), %xmm0
	addsd	%xmm0, %xmm1
	movq	%xmm1, %rax
	movq	%rax, %xmm0
	call	cos@PLT
	movsd	-24(%rbp), %xmm1
	addsd	%xmm1, %xmm0
	movsd	%xmm0, -24(%rbp)
	movsd	-32(%rbp), %xmm1
	movsd	.LC3(%rip), %xmm0
	addsd	%xmm0, %xmm1
	movq	%xmm1, %rax
	movq	%rax, %xmm0
	call	sin@PLT
	movsd	-16(%rbp), %xmm1
	addsd	%xmm1, %xmm0
	movsd	%xmm0, -16(%rbp)
	movsd	-24(%rbp), %xmm0
	movq	-16(%rbp), %rax
	movapd	%xmm0, %xmm1
	movq	%rax, %xmm0
	call	atan2@PLT
	movq	%xmm0, %rax
	movq	%rax, -32(%rbp)
	addl	$1, -36(%rbp)
.L4:
	movl	-40(%rbp), %eax
	subl	$2, %eax
	cmpl	%eax, -36(%rbp)
	jl	.L5
	movsd	-16(%rbp), %xmm0
	movq	-24(%rbp), %rax
	movapd	%xmm0, %xmm1
	movq	%rax, %xmm0
	leaq	.LC4(%rip), %rax
	movq	%rax, %rdi
	movl	$2, %eax
	call	printf@PLT
	jmp	.L6
.L8:
	call	__stack_chk_fail@PLT
.L7:
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE0:
	.size	main, .-main
	.section	.rodata
	.align 8
.LC1:
	.long	0
	.long	1072693248
	.align 8
.LC2:
	.long	1413754136
	.long	1072243195
	.align 8
.LC3:
	.long	1413754136
	.long	1073291771
	.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:
