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 <stdlib.h>
#include <float.h>
#include <math.h>

int main(void){

	double x, y;
	unsigned int X;
	unsigned int K = 0;

	x=1.;
	y=0.;

    scanf("%3d", &X);
	const double theta_x = X * (M_PI / 180.0);
  	double theta = 0;

	while(1){
            theta += theta_x;
		x += cos(theta);
		y += sin(theta);
		K++;
      if(fabs(x)-0. < 1e-7 && fabs(y)-0. < 1e-7){
        break;
    }
      }
  
	printf("%d\n", K+1);

	return 0;
}```

Unoptimized Assembly Code:

```assembly
	.file	"temp.c"
	.text
	.section	.rodata
.LC2:
	.string	"%3d"
.LC6:
	.string	"%d\n"
	.text
	.globl	main
	.type	main, @function
main:
.LFB6:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	subq	$48, %rsp
	movq	%fs:40, %rax
	movq	%rax, -8(%rbp)
	xorl	%eax, %eax
	movl	$0, -44(%rbp)
	movsd	.LC0(%rip), %xmm0
	movsd	%xmm0, -40(%rbp)
	pxor	%xmm0, %xmm0
	movsd	%xmm0, -32(%rbp)
	leaq	-48(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC2(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	-48(%rbp), %eax
	movl	%eax, %eax
	testq	%rax, %rax
	js	.L2
	pxor	%xmm0, %xmm0
	cvtsi2sdq	%rax, %xmm0
	jmp	.L3
.L2:
	movq	%rax, %rdx
	shrq	%rdx
	andl	$1, %eax
	orq	%rax, %rdx
	pxor	%xmm0, %xmm0
	cvtsi2sdq	%rdx, %xmm0
	addsd	%xmm0, %xmm0
.L3:
	movsd	.LC3(%rip), %xmm1
	mulsd	%xmm1, %xmm0
	movsd	%xmm0, -16(%rbp)
	pxor	%xmm0, %xmm0
	movsd	%xmm0, -24(%rbp)
.L8:
	movsd	-24(%rbp), %xmm0
	addsd	-16(%rbp), %xmm0
	movsd	%xmm0, -24(%rbp)
	movq	-24(%rbp), %rax
	movq	%rax, %xmm0
	call	cos@PLT
	movsd	-40(%rbp), %xmm1
	addsd	%xmm1, %xmm0
	movsd	%xmm0, -40(%rbp)
	movq	-24(%rbp), %rax
	movq	%rax, %xmm0
	call	sin@PLT
	movsd	-32(%rbp), %xmm1
	addsd	%xmm1, %xmm0
	movsd	%xmm0, -32(%rbp)
	addl	$1, -44(%rbp)
	movsd	-40(%rbp), %xmm0
	movq	.LC4(%rip), %xmm1
	andpd	%xmm0, %xmm1
	movsd	.LC5(%rip), %xmm0
	comisd	%xmm1, %xmm0
	jbe	.L4
	movsd	-32(%rbp), %xmm0
	movq	.LC4(%rip), %xmm1
	andpd	%xmm0, %xmm1
	movsd	.LC5(%rip), %xmm0
	comisd	%xmm1, %xmm0
	ja	.L12
.L4:
	jmp	.L8
.L12:
	nop
	movl	-44(%rbp), %eax
	addl	$1, %eax
	movl	%eax, %esi
	leaq	.LC6(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	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
.LFE6:
	.size	main, .-main
	.section	.rodata
	.align 8
.LC0:
	.long	0
	.long	1072693248
	.align 8
.LC3:
	.long	-1571644103
	.long	1066524486
	.align 16
.LC4:
	.long	-1
	.long	2147483647
	.long	0
	.long	0
	.align 8
.LC5:
	.long	-1698910392
	.long	1048238066
	.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
.LC2:
	.string	"%3d"
.LC6:
	.string	"%d\n"
	.section	.text.startup,"ax",@progbits
	.p2align 4
	.globl	main
	.type	main, @function
main:
.LFB39:
	.cfi_startproc
	endbr64
	pushq	%r12
	.cfi_def_cfa_offset 16
	.cfi_offset 12, -16
	leaq	.LC2(%rip), %rdi
	pushq	%rbp
	.cfi_def_cfa_offset 24
	.cfi_offset 6, -24
	pushq	%rbx
	.cfi_def_cfa_offset 32
	.cfi_offset 3, -32
	xorl	%ebx, %ebx
	subq	$64, %rsp
	.cfi_def_cfa_offset 96
	movq	%fs:40, %rax
	movq	%rax, 56(%rsp)
	xorl	%eax, %eax
	leaq	52(%rsp), %rsi
	leaq	40(%rsp), %r12
	leaq	32(%rsp), %rbp
	call	__isoc99_scanf@PLT
	movl	52(%rsp), %eax
	pxor	%xmm0, %xmm0
	movsd	.LC1(%rip), %xmm1
	cvtsi2sdq	%rax, %xmm0
	mulsd	.LC3(%rip), %xmm0
	movsd	%xmm0, 24(%rsp)
	pxor	%xmm0, %xmm0
	movapd	%xmm0, %xmm2
	.p2align 4,,10
	.p2align 3
.L10:
	addsd	24(%rsp), %xmm0
	movq	%rbp, %rsi
	movq	%r12, %rdi
	movsd	%xmm2, 16(%rsp)
	movsd	%xmm1, 8(%rsp)
	movsd	%xmm0, (%rsp)
	call	sincos@PLT
	movsd	8(%rsp), %xmm1
	movl	%ebx, %edx
	addsd	32(%rsp), %xmm1
	movsd	.LC5(%rip), %xmm5
	addl	$1, %ebx
	movsd	16(%rsp), %xmm2
	movsd	(%rsp), %xmm0
	addsd	40(%rsp), %xmm2
	movapd	%xmm1, %xmm3
	andpd	.LC4(%rip), %xmm3
	comisd	%xmm3, %xmm5
	jbe	.L10
	movapd	%xmm2, %xmm3
	andpd	.LC4(%rip), %xmm3
	comisd	%xmm3, %xmm5
	jbe	.L10
	addl	$2, %edx
	xorl	%eax, %eax
	movl	$1, %edi
	leaq	.LC6(%rip), %rsi
	call	__printf_chk@PLT
	movq	56(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L13
	addq	$64, %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
.L13:
	.cfi_restore_state
	call	__stack_chk_fail@PLT
	.cfi_endproc
.LFE39:
	.size	main, .-main
	.section	.rodata.cst8,"aM",@progbits,8
	.align 8
.LC1:
	.long	0
	.long	1072693248
	.align 8
.LC3:
	.long	-1571644103
	.long	1066524486
	.section	.rodata.cst16,"aM",@progbits,16
	.align 16
.LC4:
	.long	-1
	.long	2147483647
	.long	0
	.long	0
	.section	.rodata.cst8
	.align 8
.LC5:
	.long	-1698910392
	.long	1048238066
	.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
.LC2:
	.string	"%3d"
.LC6:
	.string	"%d\n"
	.section	.text.startup,"ax",@progbits
	.p2align 4
	.globl	main
	.type	main, @function
main:
.LFB39:
	.cfi_startproc
	endbr64
	pushq	%r12
	.cfi_def_cfa_offset 16
	.cfi_offset 12, -16
	leaq	.LC2(%rip), %rdi
	pushq	%rbp
	.cfi_def_cfa_offset 24
	.cfi_offset 6, -24
	pushq	%rbx
	.cfi_def_cfa_offset 32
	.cfi_offset 3, -32
	xorl	%ebx, %ebx
	subq	$64, %rsp
	.cfi_def_cfa_offset 96
	movq	%fs:40, %rax
	movq	%rax, 56(%rsp)
	xorl	%eax, %eax
	leaq	52(%rsp), %rsi
	leaq	40(%rsp), %r12
	leaq	32(%rsp), %rbp
	call	__isoc99_scanf@PLT
	movl	52(%rsp), %eax
	pxor	%xmm0, %xmm0
	movsd	.LC1(%rip), %xmm1
	cvtsi2sdq	%rax, %xmm0
	mulsd	.LC3(%rip), %xmm0
	movsd	%xmm0, 24(%rsp)
	pxor	%xmm0, %xmm0
	movapd	%xmm0, %xmm2
	.p2align 4,,10
	.p2align 3
.L10:
	addsd	24(%rsp), %xmm0
	movq	%rbp, %rsi
	movq	%r12, %rdi
	movsd	%xmm2, 16(%rsp)
	movsd	%xmm1, 8(%rsp)
	movsd	%xmm0, (%rsp)
	call	sincos@PLT
	movsd	8(%rsp), %xmm1
	movl	%ebx, %edx
	addsd	32(%rsp), %xmm1
	movsd	.LC5(%rip), %xmm5
	addl	$1, %ebx
	movsd	16(%rsp), %xmm2
	movsd	(%rsp), %xmm0
	addsd	40(%rsp), %xmm2
	movapd	%xmm1, %xmm3
	andpd	.LC4(%rip), %xmm3
	comisd	%xmm3, %xmm5
	jbe	.L10
	movapd	%xmm2, %xmm3
	andpd	.LC4(%rip), %xmm3
	comisd	%xmm3, %xmm5
	jbe	.L10
	addl	$2, %edx
	xorl	%eax, %eax
	movl	$1, %edi
	leaq	.LC6(%rip), %rsi
	call	__printf_chk@PLT
	movq	56(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L13
	addq	$64, %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
.L13:
	.cfi_restore_state
	call	__stack_chk_fail@PLT
	.cfi_endproc
.LFE39:
	.size	main, .-main
	.section	.rodata.cst8,"aM",@progbits,8
	.align 8
.LC1:
	.long	0
	.long	1072693248
	.align 8
.LC3:
	.long	-1571644103
	.long	1066524486
	.section	.rodata.cst16,"aM",@progbits,16
	.align 16
.LC4:
	.long	-1
	.long	2147483647
	.long	0
	.long	0
	.section	.rodata.cst8
	.align 8
.LC5:
	.long	-1698910392
	.long	1048238066
	.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 <stdlib.h>
#include <float.h>
#include <math.h>

int main(void){

	double x, y;
	unsigned int X;
	unsigned int K = 0;

	x=1.;
	y=0.;

    scanf("%3d", &X);
	const double theta_x = X * (M_PI / 180.0);
  	double theta = 0;

	while(1){
            theta += theta_x;
		x += cos(theta);
		y += sin(theta);
		K++;
      if(fabs(x)-0. < 1e-7 && fabs(y)-0. < 1e-7){
        break;
    }
      }
  
	printf("%d\n", K+1);

	return 0;
}
155
 2
 297
 408
 643
 810
 928
 1780
 33
 70

72
 180
 40
 15
 360
 4
 45
 180
 120
 36

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 <stdlib.h>
#include <float.h>
#include <math.h>

int main(void){

	double x, y;
	unsigned int X;
	unsigned int K = 0;

	x=1.;
	y=0.;

    scanf("%3d", &X);
	const double theta_x = X * (M_PI / 180.0);
  	double theta = 0;

	while(1){
            theta += theta_x;
		x += cos(theta);
		y += sin(theta);
		K++;
      if(fabs(x)-0. < 1e-7 && fabs(y)-0. < 1e-7){
        break;
    }
      }
  
	printf("%d\n", K+1);

	return 0;
}```

Unoptimized Assembly Code:

```assembly
	.file	"temp.c"
	.text
	.section	.rodata
.LC2:
	.string	"%3d"
.LC6:
	.string	"%d\n"
	.text
	.globl	main
	.type	main, @function
main:
.LFB6:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	subq	$48, %rsp
	movq	%fs:40, %rax
	movq	%rax, -8(%rbp)
	xorl	%eax, %eax
	movl	$0, -44(%rbp)
	movsd	.LC0(%rip), %xmm0
	movsd	%xmm0, -40(%rbp)
	pxor	%xmm0, %xmm0
	movsd	%xmm0, -32(%rbp)
	leaq	-48(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC2(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	-48(%rbp), %eax
	movl	%eax, %eax
	testq	%rax, %rax
	js	.L2
	pxor	%xmm0, %xmm0
	cvtsi2sdq	%rax, %xmm0
	jmp	.L3
.L2:
	movq	%rax, %rdx
	shrq	%rdx
	andl	$1, %eax
	orq	%rax, %rdx
	pxor	%xmm0, %xmm0
	cvtsi2sdq	%rdx, %xmm0
	addsd	%xmm0, %xmm0
.L3:
	movsd	.LC3(%rip), %xmm1
	mulsd	%xmm1, %xmm0
	movsd	%xmm0, -16(%rbp)
	pxor	%xmm0, %xmm0
	movsd	%xmm0, -24(%rbp)
.L8:
	movsd	-24(%rbp), %xmm0
	addsd	-16(%rbp), %xmm0
	movsd	%xmm0, -24(%rbp)
	movq	-24(%rbp), %rax
	movq	%rax, %xmm0
	call	cos@PLT
	movsd	-40(%rbp), %xmm1
	addsd	%xmm1, %xmm0
	movsd	%xmm0, -40(%rbp)
	movq	-24(%rbp), %rax
	movq	%rax, %xmm0
	call	sin@PLT
	movsd	-32(%rbp), %xmm1
	addsd	%xmm1, %xmm0
	movsd	%xmm0, -32(%rbp)
	addl	$1, -44(%rbp)
	movsd	-40(%rbp), %xmm0
	movq	.LC4(%rip), %xmm1
	andpd	%xmm0, %xmm1
	movsd	.LC5(%rip), %xmm0
	comisd	%xmm1, %xmm0
	jbe	.L4
	movsd	-32(%rbp), %xmm0
	movq	.LC4(%rip), %xmm1
	andpd	%xmm0, %xmm1
	movsd	.LC5(%rip), %xmm0
	comisd	%xmm1, %xmm0
	ja	.L12
.L4:
	jmp	.L8
.L12:
	nop
	movl	-44(%rbp), %eax
	addl	$1, %eax
	movl	%eax, %esi
	leaq	.LC6(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	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
.LFE6:
	.size	main, .-main
	.section	.rodata
	.align 8
.LC0:
	.long	0
	.long	1072693248
	.align 8
.LC3:
	.long	-1571644103
	.long	1066524486
	.align 16
.LC4:
	.long	-1
	.long	2147483647
	.long	0
	.long	0
	.align 8
.LC5:
	.long	-1698910392
	.long	1048238066
	.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
.LC2:
	.string	"%3d"
.LC6:
	.string	"%d\n"
	.text
	.globl	main
	.type	main, @function
main:
.LFB6:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	subq	$48, %rsp
	movq	%fs:40, %rax
	movq	%rax, -8(%rbp)
	xorl	%eax, %eax
	movl	$0, -44(%rbp)
	movsd	.LC0(%rip), %xmm0
	movsd	%xmm0, -40(%rbp)
	pxor	%xmm0, %xmm0
	movsd	%xmm0, -32(%rbp)
	leaq	-48(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC2(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	-48(%rbp), %eax
	movl	%eax, %eax
	testq	%rax, %rax
	js	.L2
	pxor	%xmm0, %xmm0
	cvtsi2sdq	%rax, %xmm0
	jmp	.L3
.L2:
	movq	%rax, %rdx
	shrq	%rdx
	andl	$1, %eax
	orq	%rax, %rdx
	pxor	%xmm0, %xmm0
	cvtsi2sdq	%rdx, %xmm0
	addsd	%xmm0, %xmm0
.L3:
	movsd	.LC3(%rip), %xmm1
	mulsd	%xmm1, %xmm0
	movsd	%xmm0, -16(%rbp)
	pxor	%xmm0, %xmm0
	movsd	%xmm0, -24(%rbp)
.L8:
	movsd	-24(%rbp), %xmm0
	addsd	-16(%rbp), %xmm0
	movsd	%xmm0, -24(%rbp)
	movq	-24(%rbp), %rax
	movq	%rax, %xmm0
	call	cos@PLT
	movsd	-40(%rbp), %xmm1
	addsd	%xmm1, %xmm0
	movsd	%xmm0, -40(%rbp)
	movq	-24(%rbp), %rax
	movq	%rax, %xmm0
	call	sin@PLT
	movsd	-32(%rbp), %xmm1
	addsd	%xmm1, %xmm0
	movsd	%xmm0, -32(%rbp)
	addl	$1, -44(%rbp)
	movsd	-40(%rbp), %xmm0
	movq	.LC4(%rip), %xmm1
	andpd	%xmm0, %xmm1
	movsd	.LC5(%rip), %xmm0
	comisd	%xmm1, %xmm0
	jbe	.L4
	movsd	-32(%rbp), %xmm0
	movq	.LC4(%rip), %xmm1
	andpd	%xmm0, %xmm1
	movsd	.LC5(%rip), %xmm0
	comisd	%xmm1, %xmm0
	ja	.L12
.L4:
	jmp	.L8
.L12:
	nop
	movl	-44(%rbp), %eax
	addl	$1, %eax
	movl	%eax, %esi
	leaq	.LC6(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	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
.LFE6:
	.size	main, .-main
	.section	.rodata
	.align 8
.LC0:
	.long	0
	.long	1072693248
	.align 8
.LC3:
	.long	-1571644103
	.long	1066524486
	.align 16
.LC4:
	.long	-1
	.long	2147483647
	.long	0
	.long	0
	.align 8
.LC5:
	.long	-1698910392
	.long	1048238066
	.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:
