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 <math.h>
int main(void) {
	int N,K,tmp,i;
	double ans;
	scanf("%d %d",&N,&K);
	int count[100000]={};
	for(i=0;i<N;i++){
		tmp=i+1;
		while(1){
			if(tmp>=K){
				break;
			}else{
				tmp=tmp*2;
				count[i]++;
			}
		}
	}
	for(i=0;i<N;i++){
		ans=ans+(1/(double)N)*pow(0.5,count[i]);
	}
	printf("%.12f",ans);
	
	return 0;
}
```

Unoptimized Assembly Code:

```assembly
	.file	"temp.c"
	.text
	.section	.rodata
.LC0:
	.string	"%d %d"
.LC3:
	.string	"%.12f"
	.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
	leaq	-397312(%rsp), %r11
.LPSRL0:
	subq	$4096, %rsp
	orq	$0, (%rsp)
	cmpq	%r11, %rsp
	jne	.LPSRL0
	subq	$2752, %rsp
	movq	%fs:40, %rax
	movq	%rax, -8(%rbp)
	xorl	%eax, %eax
	leaq	-400036(%rbp), %rdx
	leaq	-400040(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	leaq	-400016(%rbp), %rax
	movl	$400000, %edx
	movl	$0, %esi
	movq	%rax, %rdi
	call	memset@PLT
	movl	$0, -400028(%rbp)
	jmp	.L2
.L6:
	movl	-400028(%rbp), %eax
	addl	$1, %eax
	movl	%eax, -400032(%rbp)
.L5:
	movl	-400036(%rbp), %eax
	cmpl	%eax, -400032(%rbp)
	jge	.L12
	sall	-400032(%rbp)
	movl	-400028(%rbp), %eax
	cltq
	movl	-400016(%rbp,%rax,4), %eax
	leal	1(%rax), %edx
	movl	-400028(%rbp), %eax
	cltq
	movl	%edx, -400016(%rbp,%rax,4)
	jmp	.L5
.L12:
	nop
	addl	$1, -400028(%rbp)
.L2:
	movl	-400040(%rbp), %eax
	cmpl	%eax, -400028(%rbp)
	jl	.L6
	movl	$0, -400028(%rbp)
	jmp	.L7
.L8:
	movl	-400040(%rbp), %eax
	pxor	%xmm1, %xmm1
	cvtsi2sdl	%eax, %xmm1
	movsd	.LC1(%rip), %xmm0
	divsd	%xmm1, %xmm0
	movsd	%xmm0, -400056(%rbp)
	movl	-400028(%rbp), %eax
	cltq
	movl	-400016(%rbp,%rax,4), %eax
	pxor	%xmm0, %xmm0
	cvtsi2sdl	%eax, %xmm0
	movq	.LC2(%rip), %rax
	movapd	%xmm0, %xmm1
	movq	%rax, %xmm0
	call	pow@PLT
	mulsd	-400056(%rbp), %xmm0
	movsd	-400024(%rbp), %xmm1
	addsd	%xmm1, %xmm0
	movsd	%xmm0, -400024(%rbp)
	addl	$1, -400028(%rbp)
.L7:
	movl	-400040(%rbp), %eax
	cmpl	%eax, -400028(%rbp)
	jl	.L8
	movq	-400024(%rbp), %rax
	movq	%rax, %xmm0
	leaq	.LC3(%rip), %rax
	movq	%rax, %rdi
	movl	$1, %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
.LC1:
	.long	0
	.long	1072693248
	.align 8
.LC2:
	.long	0
	.long	1071644672
	.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	"%d %d"
.LC3:
	.string	"%.12f"
	.section	.text.startup,"ax",@progbits
	.p2align 4
	.globl	main
	.type	main, @function
main:
.LFB39:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	pushq	%rbx
	.cfi_def_cfa_offset 24
	.cfi_offset 3, -24
	leaq	-397312(%rsp), %r11
	.cfi_def_cfa 11, 397336
.LPSRL0:
	subq	$4096, %rsp
	orq	$0, (%rsp)
	cmpq	%r11, %rsp
	jne	.LPSRL0
	.cfi_def_cfa_register 7
	subq	$2744, %rsp
	.cfi_def_cfa_offset 400080
	leaq	.LC0(%rip), %rdi
	movq	%fs:40, %rax
	movq	%rax, 400040(%rsp)
	xorl	%eax, %eax
	leaq	28(%rsp), %rdx
	leaq	24(%rsp), %rsi
	call	__isoc99_scanf@PLT
	leaq	32(%rsp), %r10
	movl	$400000, %edx
	xorl	%esi, %esi
	movq	%r10, %rdi
	call	memset@PLT
	movl	24(%rsp), %r9d
	testl	%r9d, %r9d
	jle	.L2
	movl	28(%rsp), %ecx
	movq	%rax, %r10
	movq	%rax, %rbx
	movq	%rax, %r8
	xorl	%edi, %edi
	.p2align 4,,10
	.p2align 3
.L5:
	addl	$1, %edi
	cmpl	%ecx, %edi
	jge	.L3
	movl	(%r8), %eax
	movl	%edi, %edx
	addl	$1, %eax
	.p2align 4,,10
	.p2align 3
.L4:
	addl	%edx, %edx
	movl	%eax, %esi
	addl	$1, %eax
	cmpl	%ecx, %edx
	jl	.L4
	movl	%esi, (%r8)
.L3:
	addq	$4, %r8
	cmpl	%r9d, %edi
	jne	.L5
	pxor	%xmm0, %xmm0
	movsd	.LC1(%rip), %xmm1
	leal	-1(%rdi), %eax
	cvtsi2sdl	%edi, %xmm0
	leaq	4(%r10,%rax,4), %rbp
	divsd	%xmm0, %xmm1
	movsd	%xmm1, 8(%rsp)
	.p2align 4,,10
	.p2align 3
.L6:
	pxor	%xmm1, %xmm1
	movq	.LC2(%rip), %rax
	addq	$4, %rbx
	cvtsi2sdl	-4(%rbx), %xmm1
	movq	%rax, %xmm0
	call	pow@PLT
	mulsd	8(%rsp), %xmm0
	addsd	(%rsp), %xmm0
	movsd	%xmm0, (%rsp)
	cmpq	%rbp, %rbx
	jne	.L6
.L2:
	movsd	(%rsp), %xmm0
	movl	$1, %edi
	movl	$1, %eax
	leaq	.LC3(%rip), %rsi
	call	__printf_chk@PLT
	movq	400040(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L13
	addq	$400056, %rsp
	.cfi_remember_state
	.cfi_def_cfa_offset 24
	xorl	%eax, %eax
	popq	%rbx
	.cfi_def_cfa_offset 16
	popq	%rbp
	.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
.LC2:
	.long	0
	.long	1071644672
	.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	"%d %d"
.LC3:
	.string	"%.12f"
	.section	.text.startup,"ax",@progbits
	.p2align 4
	.globl	main
	.type	main, @function
main:
.LFB39:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	pushq	%rbx
	.cfi_def_cfa_offset 24
	.cfi_offset 3, -24
	leaq	-397312(%rsp), %r11
	.cfi_def_cfa 11, 397336
.LPSRL0:
	subq	$4096, %rsp
	orq	$0, (%rsp)
	cmpq	%r11, %rsp
	jne	.LPSRL0
	.cfi_def_cfa_register 7
	subq	$2744, %rsp
	.cfi_def_cfa_offset 400080
	leaq	.LC0(%rip), %rdi
	movq	%fs:40, %rax
	movq	%rax, 400040(%rsp)
	xorl	%eax, %eax
	leaq	28(%rsp), %rdx
	leaq	24(%rsp), %rsi
	call	__isoc99_scanf@PLT
	leaq	32(%rsp), %r10
	movl	$400000, %edx
	xorl	%esi, %esi
	movq	%r10, %rdi
	call	memset@PLT
	movl	24(%rsp), %r9d
	testl	%r9d, %r9d
	jle	.L2
	movl	28(%rsp), %ecx
	movq	%rax, %r10
	movq	%rax, %rbx
	movq	%rax, %r8
	xorl	%edi, %edi
	.p2align 4,,10
	.p2align 3
.L5:
	addl	$1, %edi
	cmpl	%ecx, %edi
	jge	.L3
	movl	(%r8), %eax
	movl	%edi, %edx
	addl	$1, %eax
	.p2align 4,,10
	.p2align 3
.L4:
	addl	%edx, %edx
	movl	%eax, %esi
	addl	$1, %eax
	cmpl	%ecx, %edx
	jl	.L4
	movl	%esi, (%r8)
.L3:
	addq	$4, %r8
	cmpl	%r9d, %edi
	jne	.L5
	pxor	%xmm0, %xmm0
	movsd	.LC1(%rip), %xmm1
	leal	-1(%rdi), %eax
	cvtsi2sdl	%edi, %xmm0
	leaq	4(%r10,%rax,4), %rbp
	divsd	%xmm0, %xmm1
	movsd	%xmm1, 8(%rsp)
	.p2align 4,,10
	.p2align 3
.L6:
	pxor	%xmm1, %xmm1
	movq	.LC2(%rip), %rax
	addq	$4, %rbx
	cvtsi2sdl	-4(%rbx), %xmm1
	movq	%rax, %xmm0
	call	pow@PLT
	mulsd	8(%rsp), %xmm0
	addsd	(%rsp), %xmm0
	movsd	%xmm0, (%rsp)
	cmpq	%rbp, %rbx
	jne	.L6
.L2:
	movsd	(%rsp), %xmm0
	movl	$1, %edi
	movl	$1, %eax
	leaq	.LC3(%rip), %rsi
	call	__printf_chk@PLT
	movq	400040(%rsp), %rax
	subq	%fs:40, %rax
	jne	.L13
	addq	$400056, %rsp
	.cfi_remember_state
	.cfi_def_cfa_offset 24
	xorl	%eax, %eax
	popq	%rbx
	.cfi_def_cfa_offset 16
	popq	%rbp
	.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
.LC2:
	.long	0
	.long	1071644672
	.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 <math.h>
int main(void) {
	int N,K,tmp,i;
	double ans;
	scanf("%d %d",&N,&K);
	int count[100000]={};
	for(i=0;i<N;i++){
		tmp=i+1;
		while(1){
			if(tmp>=K){
				break;
			}else{
				tmp=tmp*2;
				count[i]++;
			}
		}
	}
	for(i=0;i<N;i++){
		ans=ans+(1/(double)N)*pow(0.5,count[i]);
	}
	printf("%.12f",ans);
	
	return 0;
}

3 4
 100000 8
 3 7
 100000 7
 6 7
 100100 7
 4 7
 100100 6

0.416666666667 0.999956249998 0.208333333333 0.999961249998 0.354166666667 inf 0.281250000000 inf
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 <math.h>
int main(void) {
	int N,K,tmp,i;
	double ans;
	scanf("%d %d",&N,&K);
	int count[100000]={};
	for(i=0;i<N;i++){
		tmp=i+1;
		while(1){
			if(tmp>=K){
				break;
			}else{
				tmp=tmp*2;
				count[i]++;
			}
		}
	}
	for(i=0;i<N;i++){
		ans=ans+(1/(double)N)*pow(0.5,count[i]);
	}
	printf("%.12f",ans);
	
	return 0;
}
```

Unoptimized Assembly Code:

```assembly
	.file	"temp.c"
	.text
	.section	.rodata
.LC0:
	.string	"%d %d"
.LC3:
	.string	"%.12f"
	.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
	leaq	-397312(%rsp), %r11
.LPSRL0:
	subq	$4096, %rsp
	orq	$0, (%rsp)
	cmpq	%r11, %rsp
	jne	.LPSRL0
	subq	$2752, %rsp
	movq	%fs:40, %rax
	movq	%rax, -8(%rbp)
	xorl	%eax, %eax
	leaq	-400036(%rbp), %rdx
	leaq	-400040(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	leaq	-400016(%rbp), %rax
	movl	$400000, %edx
	movl	$0, %esi
	movq	%rax, %rdi
	call	memset@PLT
	movl	$0, -400028(%rbp)
	jmp	.L2
.L6:
	movl	-400028(%rbp), %eax
	addl	$1, %eax
	movl	%eax, -400032(%rbp)
.L5:
	movl	-400036(%rbp), %eax
	cmpl	%eax, -400032(%rbp)
	jge	.L12
	sall	-400032(%rbp)
	movl	-400028(%rbp), %eax
	cltq
	movl	-400016(%rbp,%rax,4), %eax
	leal	1(%rax), %edx
	movl	-400028(%rbp), %eax
	cltq
	movl	%edx, -400016(%rbp,%rax,4)
	jmp	.L5
.L12:
	nop
	addl	$1, -400028(%rbp)
.L2:
	movl	-400040(%rbp), %eax
	cmpl	%eax, -400028(%rbp)
	jl	.L6
	movl	$0, -400028(%rbp)
	jmp	.L7
.L8:
	movl	-400040(%rbp), %eax
	pxor	%xmm1, %xmm1
	cvtsi2sdl	%eax, %xmm1
	movsd	.LC1(%rip), %xmm0
	divsd	%xmm1, %xmm0
	movsd	%xmm0, -400056(%rbp)
	movl	-400028(%rbp), %eax
	cltq
	movl	-400016(%rbp,%rax,4), %eax
	pxor	%xmm0, %xmm0
	cvtsi2sdl	%eax, %xmm0
	movq	.LC2(%rip), %rax
	movapd	%xmm0, %xmm1
	movq	%rax, %xmm0
	call	pow@PLT
	mulsd	-400056(%rbp), %xmm0
	movsd	-400024(%rbp), %xmm1
	addsd	%xmm1, %xmm0
	movsd	%xmm0, -400024(%rbp)
	addl	$1, -400028(%rbp)
.L7:
	movl	-400040(%rbp), %eax
	cmpl	%eax, -400028(%rbp)
	jl	.L8
	movq	-400024(%rbp), %rax
	movq	%rax, %xmm0
	leaq	.LC3(%rip), %rax
	movq	%rax, %rdi
	movl	$1, %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
.LC1:
	.long	0
	.long	1072693248
	.align 8
.LC2:
	.long	0
	.long	1071644672
	.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 %d"
.LC3:
	.string	"%.12f"
	.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
	leaq	-397312(%rsp), %r11
.LPSRL0:
	subq	$4096, %rsp
	orq	$0, (%rsp)
	cmpq	%r11, %rsp
	jne	.LPSRL0
	subq	$2752, %rsp
	movq	%fs:40, %rax
	movq	%rax, -8(%rbp)
	xorl	%eax, %eax
	leaq	-400036(%rbp), %rdx
	leaq	-400040(%rbp), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	leaq	-400016(%rbp), %rax
	movl	$400000, %edx
	movl	$0, %esi
	movq	%rax, %rdi
	call	memset@PLT
	movl	$0, -400028(%rbp)
	jmp	.L2
.L6:
	movl	-400028(%rbp), %eax
	addl	$1, %eax
	movl	%eax, -400032(%rbp)
.L5:
	movl	-400036(%rbp), %eax
	cmpl	%eax, -400032(%rbp)
	jge	.L12
	sall	-400032(%rbp)
	movl	-400028(%rbp), %eax
	cltq
	movl	-400016(%rbp,%rax,4), %eax
	leal	1(%rax), %edx
	movl	-400028(%rbp), %eax
	cltq
	movl	%edx, -400016(%rbp,%rax,4)
	jmp	.L5
.L12:
	nop
	addl	$1, -400028(%rbp)
.L2:
	movl	-400040(%rbp), %eax
	cmpl	%eax, -400028(%rbp)
	jl	.L6
	movl	$0, -400028(%rbp)
	jmp	.L7
.L8:
	movl	-400040(%rbp), %eax
	pxor	%xmm1, %xmm1
	cvtsi2sdl	%eax, %xmm1
	movsd	.LC1(%rip), %xmm0
	divsd	%xmm1, %xmm0
	movsd	%xmm0, -400056(%rbp)
	movl	-400028(%rbp), %eax
	cltq
	movl	-400016(%rbp,%rax,4), %eax
	pxor	%xmm0, %xmm0
	cvtsi2sdl	%eax, %xmm0
	movq	.LC2(%rip), %rax
	movapd	%xmm0, %xmm1
	movq	%rax, %xmm0
	call	pow@PLT
	mulsd	-400056(%rbp), %xmm0
	movsd	-400024(%rbp), %xmm1
	addsd	%xmm1, %xmm0
	movsd	%xmm0, -400024(%rbp)
	addl	$1, -400028(%rbp)
.L7:
	movl	-400040(%rbp), %eax
	cmpl	%eax, -400028(%rbp)
	jl	.L8
	movq	-400024(%rbp), %rax
	movq	%rax, %xmm0
	leaq	.LC3(%rip), %rax
	movq	%rax, %rdi
	movl	$1, %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
.LC1:
	.long	0
	.long	1072693248
	.align 8
.LC2:
	.long	0
	.long	1071644672
	.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:
