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

int i,j,n,nxt,code,MAX,sel;
int num[20],dist[20],wei[20],next[36000][20];
double time[36000][20],speed[36000],ttt,tim;

int main(){
	scanf("%d",&n);

	for(i=0;i<n;i++){
		scanf("%d %d %d",&num[i],&dist[i],&wei[i]);
		wei[i]*=20;
	}

	MAX=1<<n;

	for(code=MAX-2;code>=0;code--){
		sel=0;
		for(j=0;j<n;j++){
			if(code >> j & 1)sel+=wei[j];
		}
		speed[code]=2000.0/(sel+70);
	}

	for(code=MAX-2;code>0;code--){
		for(i=0;i<n;i++){
			if(code >> i & 1){
				ttt=99999999;
				for(j=0;j<n;j++){
					if( !(code>>j&1) ){
						tim=time[code+ (1<<j) ][j]+abs(dist[i]-dist[j])/speed[code];
						if(tim<ttt){ttt=tim;sel=j;}
					}
				}
				time[code][i]=ttt;
				next[code][i]=sel;
			}
		}
	}

	ttt=99999999;
	for(j=0;j<n;j++){
		tim=time[1<<j][j];
		if(tim<ttt){ttt=tim;sel=j;}
	}
	next[0][0]=sel;

	for(i=0,j=0;i<MAX-1;){
		nxt=next[i][j];
		printf("%s%d",i>0?" ":"",num[nxt]);
		i+=1<<nxt;
		j=nxt;
	}
	printf("\n");

	return 0;
}```

Unoptimized Assembly Code:

```assembly
	.file	"temp.c"
	.text
	.globl	i
	.bss
	.align 4
	.type	i, @object
	.size	i, 4
i:
	.zero	4
	.globl	j
	.align 4
	.type	j, @object
	.size	j, 4
j:
	.zero	4
	.globl	n
	.align 4
	.type	n, @object
	.size	n, 4
n:
	.zero	4
	.globl	nxt
	.align 4
	.type	nxt, @object
	.size	nxt, 4
nxt:
	.zero	4
	.globl	code
	.align 4
	.type	code, @object
	.size	code, 4
code:
	.zero	4
	.globl	MAX
	.align 4
	.type	MAX, @object
	.size	MAX, 4
MAX:
	.zero	4
	.globl	sel
	.align 4
	.type	sel, @object
	.size	sel, 4
sel:
	.zero	4
	.globl	num
	.align 32
	.type	num, @object
	.size	num, 80
num:
	.zero	80
	.globl	dist
	.align 32
	.type	dist, @object
	.size	dist, 80
dist:
	.zero	80
	.globl	wei
	.align 32
	.type	wei, @object
	.size	wei, 80
wei:
	.zero	80
	.globl	next
	.align 32
	.type	next, @object
	.size	next, 2880000
next:
	.zero	2880000
	.globl	time
	.align 32
	.type	time, @object
	.size	time, 5760000
time:
	.zero	5760000
	.globl	speed
	.align 32
	.type	speed, @object
	.size	speed, 288000
speed:
	.zero	288000
	.globl	ttt
	.align 8
	.type	ttt, @object
	.size	ttt, 8
ttt:
	.zero	8
	.globl	tim
	.align 8
	.type	tim, @object
	.size	tim, 8
tim:
	.zero	8
	.section	.rodata
.LC0:
	.string	"%d"
.LC1:
	.string	"%d %d %d"
.LC4:
	.string	" "
.LC5:
	.string	""
.LC6:
	.string	"%s%d"
	.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	n(%rip), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	$0, i(%rip)
	jmp	.L2
.L3:
	movl	i(%rip), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	wei(%rip), %rax
	leaq	(%rdx,%rax), %rcx
	movl	i(%rip), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	dist(%rip), %rax
	addq	%rax, %rdx
	movl	i(%rip), %eax
	cltq
	leaq	0(,%rax,4), %rsi
	leaq	num(%rip), %rax
	addq	%rsi, %rax
	movq	%rax, %rsi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	i(%rip), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	wei(%rip), %rax
	movl	(%rdx,%rax), %edx
	movl	i(%rip), %ecx
	movl	%edx, %eax
	sall	$2, %eax
	addl	%edx, %eax
	sall	$2, %eax
	movl	%eax, %esi
	movslq	%ecx, %rax
	leaq	0(,%rax,4), %rdx
	leaq	wei(%rip), %rax
	movl	%esi, (%rdx,%rax)
	movl	i(%rip), %eax
	addl	$1, %eax
	movl	%eax, i(%rip)
.L2:
	movl	i(%rip), %edx
	movl	n(%rip), %eax
	cmpl	%eax, %edx
	jl	.L3
	movl	n(%rip), %eax
	movl	$1, %edx
	movl	%eax, %ecx
	sall	%cl, %edx
	movl	%edx, %eax
	movl	%eax, MAX(%rip)
	movl	MAX(%rip), %eax
	subl	$2, %eax
	movl	%eax, code(%rip)
	jmp	.L4
.L8:
	movl	$0, sel(%rip)
	movl	$0, j(%rip)
	jmp	.L5
.L7:
	movl	code(%rip), %edx
	movl	j(%rip), %eax
	movl	%eax, %ecx
	sarl	%cl, %edx
	movl	%edx, %eax
	andl	$1, %eax
	testl	%eax, %eax
	je	.L6
	movl	j(%rip), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	wei(%rip), %rax
	movl	(%rdx,%rax), %edx
	movl	sel(%rip), %eax
	addl	%edx, %eax
	movl	%eax, sel(%rip)
.L6:
	movl	j(%rip), %eax
	addl	$1, %eax
	movl	%eax, j(%rip)
.L5:
	movl	j(%rip), %edx
	movl	n(%rip), %eax
	cmpl	%eax, %edx
	jl	.L7
	movl	sel(%rip), %eax
	addl	$70, %eax
	pxor	%xmm1, %xmm1
	cvtsi2sdl	%eax, %xmm1
	movl	code(%rip), %eax
	movsd	.LC2(%rip), %xmm0
	divsd	%xmm1, %xmm0
	cltq
	leaq	0(,%rax,8), %rdx
	leaq	speed(%rip), %rax
	movsd	%xmm0, (%rdx,%rax)
	movl	code(%rip), %eax
	subl	$1, %eax
	movl	%eax, code(%rip)
.L4:
	movl	code(%rip), %eax
	testl	%eax, %eax
	jns	.L8
	movl	MAX(%rip), %eax
	subl	$2, %eax
	movl	%eax, code(%rip)
	jmp	.L9
.L17:
	movl	$0, i(%rip)
	jmp	.L10
.L16:
	movl	code(%rip), %edx
	movl	i(%rip), %eax
	movl	%eax, %ecx
	sarl	%cl, %edx
	movl	%edx, %eax
	andl	$1, %eax
	testl	%eax, %eax
	je	.L11
	movsd	.LC3(%rip), %xmm0
	movsd	%xmm0, ttt(%rip)
	movl	$0, j(%rip)
	jmp	.L12
.L15:
	movl	code(%rip), %edx
	movl	j(%rip), %eax
	movl	%eax, %ecx
	sarl	%cl, %edx
	movl	%edx, %eax
	andl	$1, %eax
	testl	%eax, %eax
	jne	.L13
	movl	j(%rip), %eax
	movl	$1, %edx
	movl	%eax, %ecx
	sall	%cl, %edx
	movl	code(%rip), %eax
	addl	%eax, %edx
	movl	j(%rip), %eax
	movslq	%eax, %rcx
	movslq	%edx, %rdx
	movq	%rdx, %rax
	salq	$2, %rax
	addq	%rdx, %rax
	salq	$2, %rax
	addq	%rcx, %rax
	leaq	0(,%rax,8), %rdx
	leaq	time(%rip), %rax
	movsd	(%rdx,%rax), %xmm1
	movl	i(%rip), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	dist(%rip), %rax
	movl	(%rdx,%rax), %eax
	movl	j(%rip), %edx
	movslq	%edx, %rdx
	leaq	0(,%rdx,4), %rcx
	leaq	dist(%rip), %rdx
	movl	(%rcx,%rdx), %edx
	subl	%edx, %eax
	movl	%eax, %edx
	negl	%edx
	cmovns	%edx, %eax
	pxor	%xmm0, %xmm0
	cvtsi2sdl	%eax, %xmm0
	movl	code(%rip), %eax
	cltq
	leaq	0(,%rax,8), %rdx
	leaq	speed(%rip), %rax
	movsd	(%rdx,%rax), %xmm2
	divsd	%xmm2, %xmm0
	addsd	%xmm1, %xmm0
	movsd	%xmm0, tim(%rip)
	movsd	tim(%rip), %xmm1
	movsd	ttt(%rip), %xmm0
	comisd	%xmm1, %xmm0
	jbe	.L13
	movsd	tim(%rip), %xmm0
	movsd	%xmm0, ttt(%rip)
	movl	j(%rip), %eax
	movl	%eax, sel(%rip)
.L13:
	movl	j(%rip), %eax
	addl	$1, %eax
	movl	%eax, j(%rip)
.L12:
	movl	j(%rip), %edx
	movl	n(%rip), %eax
	cmpl	%eax, %edx
	jl	.L15
	movl	code(%rip), %eax
	movl	i(%rip), %edx
	movsd	ttt(%rip), %xmm0
	movslq	%edx, %rcx
	movslq	%eax, %rdx
	movq	%rdx, %rax
	salq	$2, %rax
	addq	%rdx, %rax
	salq	$2, %rax
	addq	%rcx, %rax
	leaq	0(,%rax,8), %rdx
	leaq	time(%rip), %rax
	movsd	%xmm0, (%rdx,%rax)
	movl	code(%rip), %eax
	movl	i(%rip), %ecx
	movl	sel(%rip), %edx
	movslq	%ecx, %rsi
	movslq	%eax, %rcx
	movq	%rcx, %rax
	salq	$2, %rax
	addq	%rcx, %rax
	salq	$2, %rax
	addq	%rsi, %rax
	leaq	0(,%rax,4), %rcx
	leaq	next(%rip), %rax
	movl	%edx, (%rcx,%rax)
.L11:
	movl	i(%rip), %eax
	addl	$1, %eax
	movl	%eax, i(%rip)
.L10:
	movl	i(%rip), %edx
	movl	n(%rip), %eax
	cmpl	%eax, %edx
	jl	.L16
	movl	code(%rip), %eax
	subl	$1, %eax
	movl	%eax, code(%rip)
.L9:
	movl	code(%rip), %eax
	testl	%eax, %eax
	jg	.L17
	movsd	.LC3(%rip), %xmm0
	movsd	%xmm0, ttt(%rip)
	movl	$0, j(%rip)
	jmp	.L18
.L21:
	movl	j(%rip), %eax
	movl	$1, %edx
	movl	%eax, %ecx
	sall	%cl, %edx
	movl	j(%rip), %eax
	movslq	%eax, %rcx
	movslq	%edx, %rdx
	movq	%rdx, %rax
	salq	$2, %rax
	addq	%rdx, %rax
	salq	$2, %rax
	addq	%rcx, %rax
	leaq	0(,%rax,8), %rdx
	leaq	time(%rip), %rax
	movsd	(%rdx,%rax), %xmm0
	movsd	%xmm0, tim(%rip)
	movsd	tim(%rip), %xmm1
	movsd	ttt(%rip), %xmm0
	comisd	%xmm1, %xmm0
	jbe	.L19
	movsd	tim(%rip), %xmm0
	movsd	%xmm0, ttt(%rip)
	movl	j(%rip), %eax
	movl	%eax, sel(%rip)
.L19:
	movl	j(%rip), %eax
	addl	$1, %eax
	movl	%eax, j(%rip)
.L18:
	movl	j(%rip), %edx
	movl	n(%rip), %eax
	cmpl	%eax, %edx
	jl	.L21
	movl	sel(%rip), %eax
	movl	%eax, next(%rip)
	movl	$0, i(%rip)
	movl	$0, j(%rip)
	jmp	.L22
.L25:
	movl	i(%rip), %eax
	movl	j(%rip), %edx
	movslq	%edx, %rcx
	movslq	%eax, %rdx
	movq	%rdx, %rax
	salq	$2, %rax
	addq	%rdx, %rax
	salq	$2, %rax
	addq	%rcx, %rax
	leaq	0(,%rax,4), %rdx
	leaq	next(%rip), %rax
	movl	(%rdx,%rax), %eax
	movl	%eax, nxt(%rip)
	movl	nxt(%rip), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	num(%rip), %rax
	movl	(%rdx,%rax), %edx
	movl	i(%rip), %eax
	testl	%eax, %eax
	jle	.L23
	leaq	.LC4(%rip), %rax
	jmp	.L24
.L23:
	leaq	.LC5(%rip), %rax
.L24:
	movq	%rax, %rsi
	leaq	.LC6(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	movl	nxt(%rip), %eax
	movl	$1, %edx
	movl	%eax, %ecx
	sall	%cl, %edx
	movl	i(%rip), %eax
	addl	%edx, %eax
	movl	%eax, i(%rip)
	movl	nxt(%rip), %eax
	movl	%eax, j(%rip)
.L22:
	movl	MAX(%rip), %eax
	leal	-1(%rax), %edx
	movl	i(%rip), %eax
	cmpl	%eax, %edx
	jg	.L25
	movl	$10, %edi
	call	putchar@PLT
	movl	$0, %eax
	popq	%rbp
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE6:
	.size	main, .-main
	.section	.rodata
	.align 8
.LC2:
	.long	0
	.long	1084178432
	.align 8
.LC3:
	.long	-67108864
	.long	1100470147
	.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	"%d"
.LC3:
	.string	"%d %d %d"
.LC5:
	.string	" "
.LC6:
	.string	"%s%d"
.LC7:
	.string	""
	.section	.text.startup,"ax",@progbits
	.p2align 4
	.globl	main
	.type	main, @function
main:
.LFB39:
	.cfi_startproc
	endbr64
	pushq	%r15
	.cfi_def_cfa_offset 16
	.cfi_offset 15, -16
	xorl	%eax, %eax
	leaq	n(%rip), %rsi
	leaq	.LC2(%rip), %rdi
	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
	subq	$24, %rsp
	.cfi_def_cfa_offset 80
	movsd	%xmm0, (%rsp)
	call	__isoc99_scanf@PLT
	movl	n(%rip), %r12d
	movsd	(%rsp), %xmm0
	movl	$0, i(%rip)
	testl	%r12d, %r12d
	jle	.L2
	xorl	%eax, %eax
	leaq	wei(%rip), %r14
	leaq	dist(%rip), %r13
	leaq	num(%rip), %rbx
	leaq	.LC3(%rip), %rbp
	.p2align 4,,10
	.p2align 3
.L3:
	movslq	%eax, %rsi
	movq	%rbp, %rdi
	xorl	%eax, %eax
	salq	$2, %rsi
	leaq	(%r14,%rsi), %rcx
	leaq	0(%r13,%rsi), %rdx
	addq	%rbx, %rsi
	call	__isoc99_scanf@PLT
	movslq	i(%rip), %rcx
	movl	n(%rip), %r12d
	movl	(%r14,%rcx,4), %edx
	movq	%rcx, %rax
	addl	$1, %eax
	leal	(%rdx,%rdx,4), %edx
	movl	%eax, i(%rip)
	sall	$2, %edx
	movl	%edx, (%r14,%rcx,4)
	cmpl	%r12d, %eax
	jl	.L3
	movsd	(%rsp), %xmm0
.L2:
	movl	$1, %eax
	movl	%r12d, %ecx
	sall	%cl, %eax
	leal	-2(%rax), %r10d
	movl	%eax, 8(%rsp)
	movl	%eax, MAX(%rip)
	movl	%r10d, code(%rip)
	testl	%r10d, %r10d
	js	.L63
	movslq	%r10d, %r13
	movsd	.LC4(%rip), %xmm3
	movslq	%r12d, %rcx
	leaq	speed(%rip), %r8
	movq	%r13, %rsi
	leaq	wei(%rip), %rdi
	.p2align 4,,10
	.p2align 3
.L8:
	movl	%esi, %edx
	testl	%r12d, %r12d
	jle	.L32
	xorl	%eax, %eax
	xorl	%r9d, %r9d
	.p2align 4,,10
	.p2align 3
.L7:
	btl	%eax, %edx
	jnc	.L6
	addl	(%rdi,%rax,4), %r9d
.L6:
	addq	$1, %rax
	cmpq	%rcx, %rax
	jne	.L7
	leal	70(%r9), %eax
	pxor	%xmm2, %xmm2
	movapd	%xmm3, %xmm1
	cvtsi2sdl	%eax, %xmm2
	divsd	%xmm2, %xmm1
.L5:
	movsd	%xmm1, (%r8,%rsi,8)
	subq	$1, %rsi
	testl	%esi, %esi
	jns	.L8
	movl	%r9d, sel(%rip)
	movl	%r10d, code(%rip)
	testl	%r10d, %r10d
	jle	.L63
	leaq	0(%r13,%r13,4), %rax
	movl	%r12d, (%rsp)
	xorl	%r14d, %r14d
	xorl	%esi, %esi
	salq	$5, %rax
	leaq	time(%rip), %r11
	movl	$1, %ebx
	movsd	.LC1(%rip), %xmm2
	leaq	(%r11,%rax), %r15
	movslq	8(%rsp), %rax
	leaq	(%r8,%rax,8), %r10
	leaq	dist(%rip), %r8
	.p2align 4,,10
	.p2align 3
.L16:
	movl	(%rsp), %eax
	movl	%r13d, %edi
	testl	%eax, %eax
	jle	.L11
	leaq	0(%r13,%r13,4), %r12
	movslq	%eax, %rbp
	leaq	next(%rip), %rax
	xorl	%edx, %edx
	salq	$4, %r12
	addq	%rax, %r12
	jmp	.L15
	.p2align 4,,10
	.p2align 3
.L12:
	addq	$1, %rdx
	cmpq	%rdx, %rbp
	je	.L11
.L15:
	btl	%edx, %edi
	jnc	.L12
	xorl	%ecx, %ecx
	movapd	%xmm2, %xmm1
	.p2align 4,,10
	.p2align 3
.L14:
	btl	%ecx, %edi
	jc	.L13
	movl	(%r8,%rdx,4), %eax
	subl	(%r8,%rcx,4), %eax
	pxor	%xmm0, %xmm0
	movl	%eax, %esi
	negl	%esi
	cmovns	%esi, %eax
	movl	%ebx, %esi
	sall	%cl, %esi
	addl	%edi, %esi
	cvtsi2sdl	%eax, %xmm0
	movslq	%ecx, %rax
	divsd	-16(%r10), %xmm0
	movslq	%esi, %rsi
	leaq	(%rsi,%rsi,4), %rsi
	leaq	(%rax,%rsi,4), %rax
	addsd	(%r11,%rax,8), %xmm0
	comisd	%xmm0, %xmm1
	jbe	.L62
	movl	%ecx, %r9d
	movapd	%xmm0, %xmm1
	movl	$1, %r14d
.L62:
	movl	$1, %esi
.L13:
	addq	$1, %rcx
	cmpq	%rcx, %rbp
	jne	.L14
	movl	%r9d, (%r12,%rdx,4)
	movsd	%xmm1, (%r15,%rdx,8)
	addq	$1, %rdx
	cmpq	%rdx, %rbp
	jne	.L15
.L11:
	subq	$1, %r13
	subq	$160, %r15
	subq	$8, %r10
	testl	%r13d, %r13d
	jg	.L16
	movl	$0, code(%rip)
	movl	(%rsp), %r12d
	testb	%r14b, %r14b
	je	.L17
	movl	%r9d, sel(%rip)
.L17:
	testb	%sil, %sil
	je	.L10
	movsd	%xmm0, tim(%rip)
.L10:
	movsd	%xmm2, ttt(%rip)
	testl	%r12d, %r12d
	jle	.L21
	movl	12(%rsp), %r8d
	xorl	%ecx, %ecx
	xorl	%esi, %esi
	leaq	time(%rip), %r11
	movl	$1, %edi
	.p2align 4,,10
	.p2align 3
.L24:
	movl	%edi, %eax
	movslq	%ecx, %rdx
	sall	%cl, %eax
	cltq
	leaq	(%rax,%rax,4), %rax
	leaq	(%rdx,%rax,4), %rax
	movsd	(%r11,%rax,8), %xmm0
	comisd	%xmm0, %xmm2
	jbe	.L22
	movl	%ecx, %r8d
	movapd	%xmm0, %xmm2
	movl	$1, %esi
.L22:
	addl	$1, %ecx
	cmpl	%ecx, %r12d
	jne	.L24
	movsd	%xmm0, tim(%rip)
	testb	%sil, %sil
	je	.L21
	movl	%r8d, sel(%rip)
	movsd	%xmm2, ttt(%rip)
.L21:
	movslq	sel(%rip), %rdx
	cmpl	$1, 8(%rsp)
	movl	$0, i(%rip)
	movl	$0, j(%rip)
	movl	%edx, next(%rip)
	jle	.L26
	xorl	%eax, %eax
	leaq	num(%rip), %rbx
	leaq	.LC6(%rip), %rbp
	leaq	.LC7(%rip), %r14
	leaq	.LC5(%rip), %r13
	leaq	next(%rip), %r12
	jmp	.L29
	.p2align 4,,10
	.p2align 3
.L66:
	movq	%r13, %rdx
	movl	$1, %edi
	movq	%rbp, %rsi
	xorl	%eax, %eax
	call	__printf_chk@PLT
	movl	MAX(%rip), %edi
	movl	$1, %eax
	movslq	nxt(%rip), %rcx
	leal	-1(%rdi), %edx
	sall	%cl, %eax
	addl	i(%rip), %eax
	movl	%ecx, j(%rip)
	movl	%eax, i(%rip)
	cmpl	%eax, %edx
	jle	.L26
.L28:
	movslq	%eax, %rdx
	leaq	(%rdx,%rdx,4), %rdx
	leaq	(%rcx,%rdx,4), %rdx
	movslq	(%r12,%rdx,4), %rdx
.L29:
	movl	%edx, nxt(%rip)
	movl	(%rbx,%rdx,4), %ecx
	testl	%eax, %eax
	jg	.L66
	movq	%r14, %rdx
	movl	$1, %edi
	movq	%rbp, %rsi
	xorl	%eax, %eax
	call	__printf_chk@PLT
	movl	MAX(%rip), %edi
	movl	$1, %eax
	movslq	nxt(%rip), %rcx
	leal	-1(%rdi), %edx
	sall	%cl, %eax
	addl	i(%rip), %eax
	movl	%ecx, j(%rip)
	movl	%eax, i(%rip)
	cmpl	%edx, %eax
	jl	.L28
.L26:
	movl	$10, %edi
	call	putchar@PLT
	addq	$24, %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
.L32:
	.cfi_restore_state
	movq	.LC0(%rip), %rax
	xorl	%r9d, %r9d
	movq	%rax, %xmm1
	jmp	.L5
.L63:
	movsd	.LC1(%rip), %xmm2
	jmp	.L10
	.cfi_endproc
.LFE39:
	.size	main, .-main
	.globl	tim
	.bss
	.align 8
	.type	tim, @object
	.size	tim, 8
tim:
	.zero	8
	.globl	ttt
	.align 8
	.type	ttt, @object
	.size	ttt, 8
ttt:
	.zero	8
	.globl	speed
	.align 32
	.type	speed, @object
	.size	speed, 288000
speed:
	.zero	288000
	.globl	time
	.align 32
	.type	time, @object
	.size	time, 5760000
time:
	.zero	5760000
	.globl	next
	.align 32
	.type	next, @object
	.size	next, 2880000
next:
	.zero	2880000
	.globl	wei
	.align 32
	.type	wei, @object
	.size	wei, 80
wei:
	.zero	80
	.globl	dist
	.align 32
	.type	dist, @object
	.size	dist, 80
dist:
	.zero	80
	.globl	num
	.align 32
	.type	num, @object
	.size	num, 80
num:
	.zero	80
	.globl	sel
	.align 4
	.type	sel, @object
	.size	sel, 4
sel:
	.zero	4
	.globl	MAX
	.align 4
	.type	MAX, @object
	.size	MAX, 4
MAX:
	.zero	4
	.globl	code
	.align 4
	.type	code, @object
	.size	code, 4
code:
	.zero	4
	.globl	nxt
	.align 4
	.type	nxt, @object
	.size	nxt, 4
nxt:
	.zero	4
	.globl	n
	.align 4
	.type	n, @object
	.size	n, 4
n:
	.zero	4
	.globl	j
	.align 4
	.type	j, @object
	.size	j, 4
j:
	.zero	4
	.globl	i
	.align 4
	.type	i, @object
	.size	i, 4
i:
	.zero	4
	.section	.rodata.cst8,"aM",@progbits,8
	.align 8
.LC0:
	.long	613566757
	.long	1077711433
	.align 8
.LC1:
	.long	-67108864
	.long	1100470147
	.align 8
.LC4:
	.long	0
	.long	1084178432
	.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	"%d"
.LC3:
	.string	"%d %d %d"
.LC5:
	.string	" "
.LC6:
	.string	"%s%d"
.LC7:
	.string	""
	.section	.text.startup,"ax",@progbits
	.p2align 4
	.globl	main
	.type	main, @function
main:
.LFB39:
	.cfi_startproc
	endbr64
	pushq	%r15
	.cfi_def_cfa_offset 16
	.cfi_offset 15, -16
	xorl	%eax, %eax
	leaq	n(%rip), %rsi
	leaq	.LC2(%rip), %rdi
	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
	subq	$24, %rsp
	.cfi_def_cfa_offset 80
	movsd	%xmm0, (%rsp)
	call	__isoc99_scanf@PLT
	movl	n(%rip), %r12d
	movsd	(%rsp), %xmm0
	movl	$0, i(%rip)
	testl	%r12d, %r12d
	jle	.L2
	xorl	%eax, %eax
	leaq	wei(%rip), %r14
	leaq	dist(%rip), %r13
	leaq	num(%rip), %rbx
	leaq	.LC3(%rip), %rbp
	.p2align 4,,10
	.p2align 3
.L3:
	movslq	%eax, %rsi
	movq	%rbp, %rdi
	xorl	%eax, %eax
	salq	$2, %rsi
	leaq	(%r14,%rsi), %rcx
	leaq	0(%r13,%rsi), %rdx
	addq	%rbx, %rsi
	call	__isoc99_scanf@PLT
	movslq	i(%rip), %rcx
	movl	n(%rip), %r12d
	movl	(%r14,%rcx,4), %edx
	movq	%rcx, %rax
	addl	$1, %eax
	leal	(%rdx,%rdx,4), %edx
	movl	%eax, i(%rip)
	sall	$2, %edx
	movl	%edx, (%r14,%rcx,4)
	cmpl	%r12d, %eax
	jl	.L3
	movsd	(%rsp), %xmm0
.L2:
	movl	$1, %eax
	movl	%r12d, %ecx
	sall	%cl, %eax
	leal	-2(%rax), %r10d
	movl	%eax, 8(%rsp)
	movl	%eax, MAX(%rip)
	movl	%r10d, code(%rip)
	testl	%r10d, %r10d
	js	.L63
	movslq	%r10d, %r13
	movsd	.LC4(%rip), %xmm3
	movslq	%r12d, %rcx
	leaq	speed(%rip), %r8
	movq	%r13, %rsi
	leaq	wei(%rip), %rdi
	.p2align 4,,10
	.p2align 3
.L8:
	movl	%esi, %edx
	testl	%r12d, %r12d
	jle	.L32
	xorl	%eax, %eax
	xorl	%r9d, %r9d
	.p2align 4,,10
	.p2align 3
.L7:
	btl	%eax, %edx
	jnc	.L6
	addl	(%rdi,%rax,4), %r9d
.L6:
	addq	$1, %rax
	cmpq	%rcx, %rax
	jne	.L7
	leal	70(%r9), %eax
	pxor	%xmm2, %xmm2
	movapd	%xmm3, %xmm1
	cvtsi2sdl	%eax, %xmm2
	divsd	%xmm2, %xmm1
.L5:
	movsd	%xmm1, (%r8,%rsi,8)
	subq	$1, %rsi
	testl	%esi, %esi
	jns	.L8
	movl	%r9d, sel(%rip)
	movl	%r10d, code(%rip)
	testl	%r10d, %r10d
	jle	.L63
	leaq	0(%r13,%r13,4), %rax
	movl	%r12d, (%rsp)
	xorl	%r14d, %r14d
	xorl	%esi, %esi
	salq	$5, %rax
	leaq	time(%rip), %r11
	movl	$1, %ebx
	movsd	.LC1(%rip), %xmm2
	leaq	(%r11,%rax), %r15
	movslq	8(%rsp), %rax
	leaq	(%r8,%rax,8), %r10
	leaq	dist(%rip), %r8
	.p2align 4,,10
	.p2align 3
.L16:
	movl	(%rsp), %eax
	movl	%r13d, %edi
	testl	%eax, %eax
	jle	.L11
	leaq	0(%r13,%r13,4), %r12
	movslq	%eax, %rbp
	leaq	next(%rip), %rax
	xorl	%edx, %edx
	salq	$4, %r12
	addq	%rax, %r12
	jmp	.L15
	.p2align 4,,10
	.p2align 3
.L12:
	addq	$1, %rdx
	cmpq	%rdx, %rbp
	je	.L11
.L15:
	btl	%edx, %edi
	jnc	.L12
	xorl	%ecx, %ecx
	movapd	%xmm2, %xmm1
	.p2align 4,,10
	.p2align 3
.L14:
	btl	%ecx, %edi
	jc	.L13
	movl	(%r8,%rdx,4), %eax
	subl	(%r8,%rcx,4), %eax
	pxor	%xmm0, %xmm0
	movl	%eax, %esi
	negl	%esi
	cmovns	%esi, %eax
	movl	%ebx, %esi
	sall	%cl, %esi
	addl	%edi, %esi
	cvtsi2sdl	%eax, %xmm0
	movslq	%ecx, %rax
	divsd	-16(%r10), %xmm0
	movslq	%esi, %rsi
	leaq	(%rsi,%rsi,4), %rsi
	leaq	(%rax,%rsi,4), %rax
	addsd	(%r11,%rax,8), %xmm0
	comisd	%xmm0, %xmm1
	jbe	.L62
	movl	%ecx, %r9d
	movapd	%xmm0, %xmm1
	movl	$1, %r14d
.L62:
	movl	$1, %esi
.L13:
	addq	$1, %rcx
	cmpq	%rcx, %rbp
	jne	.L14
	movl	%r9d, (%r12,%rdx,4)
	movsd	%xmm1, (%r15,%rdx,8)
	addq	$1, %rdx
	cmpq	%rdx, %rbp
	jne	.L15
.L11:
	subq	$1, %r13
	subq	$160, %r15
	subq	$8, %r10
	testl	%r13d, %r13d
	jg	.L16
	movl	$0, code(%rip)
	movl	(%rsp), %r12d
	testb	%r14b, %r14b
	je	.L17
	movl	%r9d, sel(%rip)
.L17:
	testb	%sil, %sil
	je	.L10
	movsd	%xmm0, tim(%rip)
.L10:
	movsd	%xmm2, ttt(%rip)
	testl	%r12d, %r12d
	jle	.L21
	movl	12(%rsp), %r8d
	xorl	%ecx, %ecx
	xorl	%esi, %esi
	leaq	time(%rip), %r11
	movl	$1, %edi
	.p2align 4,,10
	.p2align 3
.L24:
	movl	%edi, %eax
	movslq	%ecx, %rdx
	sall	%cl, %eax
	cltq
	leaq	(%rax,%rax,4), %rax
	leaq	(%rdx,%rax,4), %rax
	movsd	(%r11,%rax,8), %xmm0
	comisd	%xmm0, %xmm2
	jbe	.L22
	movl	%ecx, %r8d
	movapd	%xmm0, %xmm2
	movl	$1, %esi
.L22:
	addl	$1, %ecx
	cmpl	%ecx, %r12d
	jne	.L24
	movsd	%xmm0, tim(%rip)
	testb	%sil, %sil
	je	.L21
	movl	%r8d, sel(%rip)
	movsd	%xmm2, ttt(%rip)
.L21:
	movslq	sel(%rip), %rdx
	cmpl	$1, 8(%rsp)
	movl	$0, i(%rip)
	movl	$0, j(%rip)
	movl	%edx, next(%rip)
	jle	.L26
	xorl	%eax, %eax
	leaq	num(%rip), %rbx
	leaq	.LC6(%rip), %rbp
	leaq	.LC7(%rip), %r14
	leaq	.LC5(%rip), %r13
	leaq	next(%rip), %r12
	jmp	.L29
	.p2align 4,,10
	.p2align 3
.L66:
	movq	%r13, %rdx
	movl	$1, %edi
	movq	%rbp, %rsi
	xorl	%eax, %eax
	call	__printf_chk@PLT
	movl	MAX(%rip), %edi
	movl	$1, %eax
	movslq	nxt(%rip), %rcx
	leal	-1(%rdi), %edx
	sall	%cl, %eax
	addl	i(%rip), %eax
	movl	%ecx, j(%rip)
	movl	%eax, i(%rip)
	cmpl	%eax, %edx
	jle	.L26
.L28:
	movslq	%eax, %rdx
	leaq	(%rdx,%rdx,4), %rdx
	leaq	(%rcx,%rdx,4), %rdx
	movslq	(%r12,%rdx,4), %rdx
.L29:
	movl	%edx, nxt(%rip)
	movl	(%rbx,%rdx,4), %ecx
	testl	%eax, %eax
	jg	.L66
	movq	%r14, %rdx
	movl	$1, %edi
	movq	%rbp, %rsi
	xorl	%eax, %eax
	call	__printf_chk@PLT
	movl	MAX(%rip), %edi
	movl	$1, %eax
	movslq	nxt(%rip), %rcx
	leal	-1(%rdi), %edx
	sall	%cl, %eax
	addl	i(%rip), %eax
	movl	%ecx, j(%rip)
	movl	%eax, i(%rip)
	cmpl	%edx, %eax
	jl	.L28
.L26:
	movl	$10, %edi
	call	putchar@PLT
	addq	$24, %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
.L32:
	.cfi_restore_state
	movq	.LC0(%rip), %rax
	xorl	%r9d, %r9d
	movq	%rax, %xmm1
	jmp	.L5
.L63:
	movsd	.LC1(%rip), %xmm2
	jmp	.L10
	.cfi_endproc
.LFE39:
	.size	main, .-main
	.globl	tim
	.bss
	.align 8
	.type	tim, @object
	.size	tim, 8
tim:
	.zero	8
	.globl	ttt
	.align 8
	.type	ttt, @object
	.size	ttt, 8
ttt:
	.zero	8
	.globl	speed
	.align 32
	.type	speed, @object
	.size	speed, 288000
speed:
	.zero	288000
	.globl	time
	.align 32
	.type	time, @object
	.size	time, 5760000
time:
	.zero	5760000
	.globl	next
	.align 32
	.type	next, @object
	.size	next, 2880000
next:
	.zero	2880000
	.globl	wei
	.align 32
	.type	wei, @object
	.size	wei, 80
wei:
	.zero	80
	.globl	dist
	.align 32
	.type	dist, @object
	.size	dist, 80
dist:
	.zero	80
	.globl	num
	.align 32
	.type	num, @object
	.size	num, 80
num:
	.zero	80
	.globl	sel
	.align 4
	.type	sel, @object
	.size	sel, 4
sel:
	.zero	4
	.globl	MAX
	.align 4
	.type	MAX, @object
	.size	MAX, 4
MAX:
	.zero	4
	.globl	code
	.align 4
	.type	code, @object
	.size	code, 4
code:
	.zero	4
	.globl	nxt
	.align 4
	.type	nxt, @object
	.size	nxt, 4
nxt:
	.zero	4
	.globl	n
	.align 4
	.type	n, @object
	.size	n, 4
n:
	.zero	4
	.globl	j
	.align 4
	.type	j, @object
	.size	j, 4
j:
	.zero	4
	.globl	i
	.align 4
	.type	i, @object
	.size	i, 4
i:
	.zero	4
	.section	.rodata.cst8,"aM",@progbits,8
	.align 8
.LC0:
	.long	613566757
	.long	1077711433
	.align 8
.LC1:
	.long	-67108864
	.long	1100470147
	.align 8
.LC4:
	.long	0
	.long	1084178432
	.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>
#include <stdlib.h>

int i,j,n,nxt,code,MAX,sel;
int num[20],dist[20],wei[20],next[36000][20];
double time[36000][20],speed[36000],ttt,tim;

int main(){
	scanf("%d",&n);

	for(i=0;i<n;i++){
		scanf("%d %d %d",&num[i],&dist[i],&wei[i]);
		wei[i]*=20;
	}

	MAX=1<<n;

	for(code=MAX-2;code>=0;code--){
		sel=0;
		for(j=0;j<n;j++){
			if(code >> j & 1)sel+=wei[j];
		}
		speed[code]=2000.0/(sel+70);
	}

	for(code=MAX-2;code>0;code--){
		for(i=0;i<n;i++){
			if(code >> i & 1){
				ttt=99999999;
				for(j=0;j<n;j++){
					if( !(code>>j&1) ){
						tim=time[code+ (1<<j) ][j]+abs(dist[i]-dist[j])/speed[code];
						if(tim<ttt){ttt=tim;sel=j;}
					}
				}
				time[code][i]=ttt;
				next[code][i]=sel;
			}
		}
	}

	ttt=99999999;
	for(j=0;j<n;j++){
		tim=time[1<<j][j];
		if(tim<ttt){ttt=tim;sel=j;}
	}
	next[0][0]=sel;

	for(i=0,j=0;i<MAX-1;){
		nxt=next[i][j];
		printf("%s%d",i>0?" ":"",num[nxt]);
		i+=1<<nxt;
		j=nxt;
	}
	printf("\n");

	return 0;
}
5
13 199 1
93 1000 1
37 350 10
27 300 2
99 200 1000
 3
9 100 1
13 200 20
12 300 3
 2
2 100 1
2 200 2
 5
13 199 1
93 1000 1
37 350 10
27 300 2
82 200 1000
 3
9 100 1
13 200 20
19 300 3
 5
13 199 1
93 1000 1
37 350 10
27 300 2
123 200 1100
 3
9 100 0
13 200 20
24 300 3
 3
9 100 0
26 200 20
24 300 3
 5
11 199 0
93 1000 1
37 350 10
27 300 2
123 200 1100
 3
9 100 0
26 30 20
24 300 3

93 37 27 13 99
 9 12 13
 2 2
 93 37 27 13 82
 9 19 13
 93 37 27 13 123
 9 24 13
 9 24 26
 93 37 27 11 123
 24 9 26

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

int i,j,n,nxt,code,MAX,sel;
int num[20],dist[20],wei[20],next[36000][20];
double time[36000][20],speed[36000],ttt,tim;

int main(){
	scanf("%d",&n);

	for(i=0;i<n;i++){
		scanf("%d %d %d",&num[i],&dist[i],&wei[i]);
		wei[i]*=20;
	}

	MAX=1<<n;

	for(code=MAX-2;code>=0;code--){
		sel=0;
		for(j=0;j<n;j++){
			if(code >> j & 1)sel+=wei[j];
		}
		speed[code]=2000.0/(sel+70);
	}

	for(code=MAX-2;code>0;code--){
		for(i=0;i<n;i++){
			if(code >> i & 1){
				ttt=99999999;
				for(j=0;j<n;j++){
					if( !(code>>j&1) ){
						tim=time[code+ (1<<j) ][j]+abs(dist[i]-dist[j])/speed[code];
						if(tim<ttt){ttt=tim;sel=j;}
					}
				}
				time[code][i]=ttt;
				next[code][i]=sel;
			}
		}
	}

	ttt=99999999;
	for(j=0;j<n;j++){
		tim=time[1<<j][j];
		if(tim<ttt){ttt=tim;sel=j;}
	}
	next[0][0]=sel;

	for(i=0,j=0;i<MAX-1;){
		nxt=next[i][j];
		printf("%s%d",i>0?" ":"",num[nxt]);
		i+=1<<nxt;
		j=nxt;
	}
	printf("\n");

	return 0;
}```

Unoptimized Assembly Code:

```assembly
	.file	"temp.c"
	.text
	.globl	i
	.bss
	.align 4
	.type	i, @object
	.size	i, 4
i:
	.zero	4
	.globl	j
	.align 4
	.type	j, @object
	.size	j, 4
j:
	.zero	4
	.globl	n
	.align 4
	.type	n, @object
	.size	n, 4
n:
	.zero	4
	.globl	nxt
	.align 4
	.type	nxt, @object
	.size	nxt, 4
nxt:
	.zero	4
	.globl	code
	.align 4
	.type	code, @object
	.size	code, 4
code:
	.zero	4
	.globl	MAX
	.align 4
	.type	MAX, @object
	.size	MAX, 4
MAX:
	.zero	4
	.globl	sel
	.align 4
	.type	sel, @object
	.size	sel, 4
sel:
	.zero	4
	.globl	num
	.align 32
	.type	num, @object
	.size	num, 80
num:
	.zero	80
	.globl	dist
	.align 32
	.type	dist, @object
	.size	dist, 80
dist:
	.zero	80
	.globl	wei
	.align 32
	.type	wei, @object
	.size	wei, 80
wei:
	.zero	80
	.globl	next
	.align 32
	.type	next, @object
	.size	next, 2880000
next:
	.zero	2880000
	.globl	time
	.align 32
	.type	time, @object
	.size	time, 5760000
time:
	.zero	5760000
	.globl	speed
	.align 32
	.type	speed, @object
	.size	speed, 288000
speed:
	.zero	288000
	.globl	ttt
	.align 8
	.type	ttt, @object
	.size	ttt, 8
ttt:
	.zero	8
	.globl	tim
	.align 8
	.type	tim, @object
	.size	tim, 8
tim:
	.zero	8
	.section	.rodata
.LC0:
	.string	"%d"
.LC1:
	.string	"%d %d %d"
.LC4:
	.string	" "
.LC5:
	.string	""
.LC6:
	.string	"%s%d"
	.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	n(%rip), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	$0, i(%rip)
	jmp	.L2
.L3:
	movl	i(%rip), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	wei(%rip), %rax
	leaq	(%rdx,%rax), %rcx
	movl	i(%rip), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	dist(%rip), %rax
	addq	%rax, %rdx
	movl	i(%rip), %eax
	cltq
	leaq	0(,%rax,4), %rsi
	leaq	num(%rip), %rax
	addq	%rsi, %rax
	movq	%rax, %rsi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	i(%rip), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	wei(%rip), %rax
	movl	(%rdx,%rax), %edx
	movl	i(%rip), %ecx
	movl	%edx, %eax
	sall	$2, %eax
	addl	%edx, %eax
	sall	$2, %eax
	movl	%eax, %esi
	movslq	%ecx, %rax
	leaq	0(,%rax,4), %rdx
	leaq	wei(%rip), %rax
	movl	%esi, (%rdx,%rax)
	movl	i(%rip), %eax
	addl	$1, %eax
	movl	%eax, i(%rip)
.L2:
	movl	i(%rip), %edx
	movl	n(%rip), %eax
	cmpl	%eax, %edx
	jl	.L3
	movl	n(%rip), %eax
	movl	$1, %edx
	movl	%eax, %ecx
	sall	%cl, %edx
	movl	%edx, %eax
	movl	%eax, MAX(%rip)
	movl	MAX(%rip), %eax
	subl	$2, %eax
	movl	%eax, code(%rip)
	jmp	.L4
.L8:
	movl	$0, sel(%rip)
	movl	$0, j(%rip)
	jmp	.L5
.L7:
	movl	code(%rip), %edx
	movl	j(%rip), %eax
	movl	%eax, %ecx
	sarl	%cl, %edx
	movl	%edx, %eax
	andl	$1, %eax
	testl	%eax, %eax
	je	.L6
	movl	j(%rip), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	wei(%rip), %rax
	movl	(%rdx,%rax), %edx
	movl	sel(%rip), %eax
	addl	%edx, %eax
	movl	%eax, sel(%rip)
.L6:
	movl	j(%rip), %eax
	addl	$1, %eax
	movl	%eax, j(%rip)
.L5:
	movl	j(%rip), %edx
	movl	n(%rip), %eax
	cmpl	%eax, %edx
	jl	.L7
	movl	sel(%rip), %eax
	addl	$70, %eax
	pxor	%xmm1, %xmm1
	cvtsi2sdl	%eax, %xmm1
	movl	code(%rip), %eax
	movsd	.LC2(%rip), %xmm0
	divsd	%xmm1, %xmm0
	cltq
	leaq	0(,%rax,8), %rdx
	leaq	speed(%rip), %rax
	movsd	%xmm0, (%rdx,%rax)
	movl	code(%rip), %eax
	subl	$1, %eax
	movl	%eax, code(%rip)
.L4:
	movl	code(%rip), %eax
	testl	%eax, %eax
	jns	.L8
	movl	MAX(%rip), %eax
	subl	$2, %eax
	movl	%eax, code(%rip)
	jmp	.L9
.L17:
	movl	$0, i(%rip)
	jmp	.L10
.L16:
	movl	code(%rip), %edx
	movl	i(%rip), %eax
	movl	%eax, %ecx
	sarl	%cl, %edx
	movl	%edx, %eax
	andl	$1, %eax
	testl	%eax, %eax
	je	.L11
	movsd	.LC3(%rip), %xmm0
	movsd	%xmm0, ttt(%rip)
	movl	$0, j(%rip)
	jmp	.L12
.L15:
	movl	code(%rip), %edx
	movl	j(%rip), %eax
	movl	%eax, %ecx
	sarl	%cl, %edx
	movl	%edx, %eax
	andl	$1, %eax
	testl	%eax, %eax
	jne	.L13
	movl	j(%rip), %eax
	movl	$1, %edx
	movl	%eax, %ecx
	sall	%cl, %edx
	movl	code(%rip), %eax
	addl	%eax, %edx
	movl	j(%rip), %eax
	movslq	%eax, %rcx
	movslq	%edx, %rdx
	movq	%rdx, %rax
	salq	$2, %rax
	addq	%rdx, %rax
	salq	$2, %rax
	addq	%rcx, %rax
	leaq	0(,%rax,8), %rdx
	leaq	time(%rip), %rax
	movsd	(%rdx,%rax), %xmm1
	movl	i(%rip), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	dist(%rip), %rax
	movl	(%rdx,%rax), %eax
	movl	j(%rip), %edx
	movslq	%edx, %rdx
	leaq	0(,%rdx,4), %rcx
	leaq	dist(%rip), %rdx
	movl	(%rcx,%rdx), %edx
	subl	%edx, %eax
	movl	%eax, %edx
	negl	%edx
	cmovns	%edx, %eax
	pxor	%xmm0, %xmm0
	cvtsi2sdl	%eax, %xmm0
	movl	code(%rip), %eax
	cltq
	leaq	0(,%rax,8), %rdx
	leaq	speed(%rip), %rax
	movsd	(%rdx,%rax), %xmm2
	divsd	%xmm2, %xmm0
	addsd	%xmm1, %xmm0
	movsd	%xmm0, tim(%rip)
	movsd	tim(%rip), %xmm1
	movsd	ttt(%rip), %xmm0
	comisd	%xmm1, %xmm0
	jbe	.L13
	movsd	tim(%rip), %xmm0
	movsd	%xmm0, ttt(%rip)
	movl	j(%rip), %eax
	movl	%eax, sel(%rip)
.L13:
	movl	j(%rip), %eax
	addl	$1, %eax
	movl	%eax, j(%rip)
.L12:
	movl	j(%rip), %edx
	movl	n(%rip), %eax
	cmpl	%eax, %edx
	jl	.L15
	movl	code(%rip), %eax
	movl	i(%rip), %edx
	movsd	ttt(%rip), %xmm0
	movslq	%edx, %rcx
	movslq	%eax, %rdx
	movq	%rdx, %rax
	salq	$2, %rax
	addq	%rdx, %rax
	salq	$2, %rax
	addq	%rcx, %rax
	leaq	0(,%rax,8), %rdx
	leaq	time(%rip), %rax
	movsd	%xmm0, (%rdx,%rax)
	movl	code(%rip), %eax
	movl	i(%rip), %ecx
	movl	sel(%rip), %edx
	movslq	%ecx, %rsi
	movslq	%eax, %rcx
	movq	%rcx, %rax
	salq	$2, %rax
	addq	%rcx, %rax
	salq	$2, %rax
	addq	%rsi, %rax
	leaq	0(,%rax,4), %rcx
	leaq	next(%rip), %rax
	movl	%edx, (%rcx,%rax)
.L11:
	movl	i(%rip), %eax
	addl	$1, %eax
	movl	%eax, i(%rip)
.L10:
	movl	i(%rip), %edx
	movl	n(%rip), %eax
	cmpl	%eax, %edx
	jl	.L16
	movl	code(%rip), %eax
	subl	$1, %eax
	movl	%eax, code(%rip)
.L9:
	movl	code(%rip), %eax
	testl	%eax, %eax
	jg	.L17
	movsd	.LC3(%rip), %xmm0
	movsd	%xmm0, ttt(%rip)
	movl	$0, j(%rip)
	jmp	.L18
.L21:
	movl	j(%rip), %eax
	movl	$1, %edx
	movl	%eax, %ecx
	sall	%cl, %edx
	movl	j(%rip), %eax
	movslq	%eax, %rcx
	movslq	%edx, %rdx
	movq	%rdx, %rax
	salq	$2, %rax
	addq	%rdx, %rax
	salq	$2, %rax
	addq	%rcx, %rax
	leaq	0(,%rax,8), %rdx
	leaq	time(%rip), %rax
	movsd	(%rdx,%rax), %xmm0
	movsd	%xmm0, tim(%rip)
	movsd	tim(%rip), %xmm1
	movsd	ttt(%rip), %xmm0
	comisd	%xmm1, %xmm0
	jbe	.L19
	movsd	tim(%rip), %xmm0
	movsd	%xmm0, ttt(%rip)
	movl	j(%rip), %eax
	movl	%eax, sel(%rip)
.L19:
	movl	j(%rip), %eax
	addl	$1, %eax
	movl	%eax, j(%rip)
.L18:
	movl	j(%rip), %edx
	movl	n(%rip), %eax
	cmpl	%eax, %edx
	jl	.L21
	movl	sel(%rip), %eax
	movl	%eax, next(%rip)
	movl	$0, i(%rip)
	movl	$0, j(%rip)
	jmp	.L22
.L25:
	movl	i(%rip), %eax
	movl	j(%rip), %edx
	movslq	%edx, %rcx
	movslq	%eax, %rdx
	movq	%rdx, %rax
	salq	$2, %rax
	addq	%rdx, %rax
	salq	$2, %rax
	addq	%rcx, %rax
	leaq	0(,%rax,4), %rdx
	leaq	next(%rip), %rax
	movl	(%rdx,%rax), %eax
	movl	%eax, nxt(%rip)
	movl	nxt(%rip), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	num(%rip), %rax
	movl	(%rdx,%rax), %edx
	movl	i(%rip), %eax
	testl	%eax, %eax
	jle	.L23
	leaq	.LC4(%rip), %rax
	jmp	.L24
.L23:
	leaq	.LC5(%rip), %rax
.L24:
	movq	%rax, %rsi
	leaq	.LC6(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	movl	nxt(%rip), %eax
	movl	$1, %edx
	movl	%eax, %ecx
	sall	%cl, %edx
	movl	i(%rip), %eax
	addl	%edx, %eax
	movl	%eax, i(%rip)
	movl	nxt(%rip), %eax
	movl	%eax, j(%rip)
.L22:
	movl	MAX(%rip), %eax
	leal	-1(%rax), %edx
	movl	i(%rip), %eax
	cmpl	%eax, %edx
	jg	.L25
	movl	$10, %edi
	call	putchar@PLT
	movl	$0, %eax
	popq	%rbp
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE6:
	.size	main, .-main
	.section	.rodata
	.align 8
.LC2:
	.long	0
	.long	1084178432
	.align 8
.LC3:
	.long	-67108864
	.long	1100470147
	.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	i
	.bss
	.align 4
	.type	i, @object
	.size	i, 4
i:
	.zero	4
	.globl	j
	.align 4
	.type	j, @object
	.size	j, 4
j:
	.zero	4
	.globl	n
	.align 4
	.type	n, @object
	.size	n, 4
n:
	.zero	4
	.globl	nxt
	.align 4
	.type	nxt, @object
	.size	nxt, 4
nxt:
	.zero	4
	.globl	code
	.align 4
	.type	code, @object
	.size	code, 4
code:
	.zero	4
	.globl	MAX
	.align 4
	.type	MAX, @object
	.size	MAX, 4
MAX:
	.zero	4
	.globl	sel
	.align 4
	.type	sel, @object
	.size	sel, 4
sel:
	.zero	4
	.globl	num
	.align 32
	.type	num, @object
	.size	num, 80
num:
	.zero	80
	.globl	dist
	.align 32
	.type	dist, @object
	.size	dist, 80
dist:
	.zero	80
	.globl	wei
	.align 32
	.type	wei, @object
	.size	wei, 80
wei:
	.zero	80
	.globl	next
	.align 32
	.type	next, @object
	.size	next, 2880000
next:
	.zero	2880000
	.globl	time
	.align 32
	.type	time, @object
	.size	time, 5760000
time:
	.zero	5760000
	.globl	speed
	.align 32
	.type	speed, @object
	.size	speed, 288000
speed:
	.zero	288000
	.globl	ttt
	.align 8
	.type	ttt, @object
	.size	ttt, 8
ttt:
	.zero	8
	.globl	tim
	.align 8
	.type	tim, @object
	.size	tim, 8
tim:
	.zero	8
	.section	.rodata
.LC0:
	.string	"%d"
.LC1:
	.string	"%d %d %d"
.LC4:
	.string	" "
.LC5:
	.string	""
.LC6:
	.string	"%s%d"
	.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	n(%rip), %rax
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	$0, i(%rip)
	jmp	.L2
.L3:
	movl	i(%rip), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	wei(%rip), %rax
	leaq	(%rdx,%rax), %rcx
	movl	i(%rip), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	dist(%rip), %rax
	addq	%rax, %rdx
	movl	i(%rip), %eax
	cltq
	leaq	0(,%rax,4), %rsi
	leaq	num(%rip), %rax
	addq	%rsi, %rax
	movq	%rax, %rsi
	leaq	.LC1(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	__isoc99_scanf@PLT
	movl	i(%rip), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	wei(%rip), %rax
	movl	(%rdx,%rax), %edx
	movl	i(%rip), %ecx
	movl	%edx, %eax
	sall	$2, %eax
	addl	%edx, %eax
	sall	$2, %eax
	movl	%eax, %esi
	movslq	%ecx, %rax
	leaq	0(,%rax,4), %rdx
	leaq	wei(%rip), %rax
	movl	%esi, (%rdx,%rax)
	movl	i(%rip), %eax
	addl	$1, %eax
	movl	%eax, i(%rip)
.L2:
	movl	i(%rip), %edx
	movl	n(%rip), %eax
	cmpl	%eax, %edx
	jl	.L3
	movl	n(%rip), %eax
	movl	$1, %edx
	movl	%eax, %ecx
	sall	%cl, %edx
	movl	%edx, %eax
	movl	%eax, MAX(%rip)
	movl	MAX(%rip), %eax
	subl	$2, %eax
	movl	%eax, code(%rip)
	jmp	.L4
.L8:
	movl	$0, sel(%rip)
	movl	$0, j(%rip)
	jmp	.L5
.L7:
	movl	code(%rip), %edx
	movl	j(%rip), %eax
	movl	%eax, %ecx
	sarl	%cl, %edx
	movl	%edx, %eax
	andl	$1, %eax
	testl	%eax, %eax
	je	.L6
	movl	j(%rip), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	wei(%rip), %rax
	movl	(%rdx,%rax), %edx
	movl	sel(%rip), %eax
	addl	%edx, %eax
	movl	%eax, sel(%rip)
.L6:
	movl	j(%rip), %eax
	addl	$1, %eax
	movl	%eax, j(%rip)
.L5:
	movl	j(%rip), %edx
	movl	n(%rip), %eax
	cmpl	%eax, %edx
	jl	.L7
	movl	sel(%rip), %eax
	addl	$70, %eax
	pxor	%xmm1, %xmm1
	cvtsi2sdl	%eax, %xmm1
	movl	code(%rip), %eax
	movsd	.LC2(%rip), %xmm0
	divsd	%xmm1, %xmm0
	cltq
	leaq	0(,%rax,8), %rdx
	leaq	speed(%rip), %rax
	movsd	%xmm0, (%rdx,%rax)
	movl	code(%rip), %eax
	subl	$1, %eax
	movl	%eax, code(%rip)
.L4:
	movl	code(%rip), %eax
	testl	%eax, %eax
	jns	.L8
	movl	MAX(%rip), %eax
	subl	$2, %eax
	movl	%eax, code(%rip)
	jmp	.L9
.L17:
	movl	$0, i(%rip)
	jmp	.L10
.L16:
	movl	code(%rip), %edx
	movl	i(%rip), %eax
	movl	%eax, %ecx
	sarl	%cl, %edx
	movl	%edx, %eax
	andl	$1, %eax
	testl	%eax, %eax
	je	.L11
	movsd	.LC3(%rip), %xmm0
	movsd	%xmm0, ttt(%rip)
	movl	$0, j(%rip)
	jmp	.L12
.L15:
	movl	code(%rip), %edx
	movl	j(%rip), %eax
	movl	%eax, %ecx
	sarl	%cl, %edx
	movl	%edx, %eax
	andl	$1, %eax
	testl	%eax, %eax
	jne	.L13
	movl	j(%rip), %eax
	movl	$1, %edx
	movl	%eax, %ecx
	sall	%cl, %edx
	movl	code(%rip), %eax
	addl	%eax, %edx
	movl	j(%rip), %eax
	movslq	%eax, %rcx
	movslq	%edx, %rdx
	movq	%rdx, %rax
	salq	$2, %rax
	addq	%rdx, %rax
	salq	$2, %rax
	addq	%rcx, %rax
	leaq	0(,%rax,8), %rdx
	leaq	time(%rip), %rax
	movsd	(%rdx,%rax), %xmm1
	movl	i(%rip), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	dist(%rip), %rax
	movl	(%rdx,%rax), %eax
	movl	j(%rip), %edx
	movslq	%edx, %rdx
	leaq	0(,%rdx,4), %rcx
	leaq	dist(%rip), %rdx
	movl	(%rcx,%rdx), %edx
	subl	%edx, %eax
	movl	%eax, %edx
	negl	%edx
	cmovns	%edx, %eax
	pxor	%xmm0, %xmm0
	cvtsi2sdl	%eax, %xmm0
	movl	code(%rip), %eax
	cltq
	leaq	0(,%rax,8), %rdx
	leaq	speed(%rip), %rax
	movsd	(%rdx,%rax), %xmm2
	divsd	%xmm2, %xmm0
	addsd	%xmm1, %xmm0
	movsd	%xmm0, tim(%rip)
	movsd	tim(%rip), %xmm1
	movsd	ttt(%rip), %xmm0
	comisd	%xmm1, %xmm0
	jbe	.L13
	movsd	tim(%rip), %xmm0
	movsd	%xmm0, ttt(%rip)
	movl	j(%rip), %eax
	movl	%eax, sel(%rip)
.L13:
	movl	j(%rip), %eax
	addl	$1, %eax
	movl	%eax, j(%rip)
.L12:
	movl	j(%rip), %edx
	movl	n(%rip), %eax
	cmpl	%eax, %edx
	jl	.L15
	movl	code(%rip), %eax
	movl	i(%rip), %edx
	movsd	ttt(%rip), %xmm0
	movslq	%edx, %rcx
	movslq	%eax, %rdx
	movq	%rdx, %rax
	salq	$2, %rax
	addq	%rdx, %rax
	salq	$2, %rax
	addq	%rcx, %rax
	leaq	0(,%rax,8), %rdx
	leaq	time(%rip), %rax
	movsd	%xmm0, (%rdx,%rax)
	movl	code(%rip), %eax
	movl	i(%rip), %ecx
	movl	sel(%rip), %edx
	movslq	%ecx, %rsi
	movslq	%eax, %rcx
	movq	%rcx, %rax
	salq	$2, %rax
	addq	%rcx, %rax
	salq	$2, %rax
	addq	%rsi, %rax
	leaq	0(,%rax,4), %rcx
	leaq	next(%rip), %rax
	movl	%edx, (%rcx,%rax)
.L11:
	movl	i(%rip), %eax
	addl	$1, %eax
	movl	%eax, i(%rip)
.L10:
	movl	i(%rip), %edx
	movl	n(%rip), %eax
	cmpl	%eax, %edx
	jl	.L16
	movl	code(%rip), %eax
	subl	$1, %eax
	movl	%eax, code(%rip)
.L9:
	movl	code(%rip), %eax
	testl	%eax, %eax
	jg	.L17
	movsd	.LC3(%rip), %xmm0
	movsd	%xmm0, ttt(%rip)
	movl	$0, j(%rip)
	jmp	.L18
.L21:
	movl	j(%rip), %eax
	movl	$1, %edx
	movl	%eax, %ecx
	sall	%cl, %edx
	movl	j(%rip), %eax
	movslq	%eax, %rcx
	movslq	%edx, %rdx
	movq	%rdx, %rax
	salq	$2, %rax
	addq	%rdx, %rax
	salq	$2, %rax
	addq	%rcx, %rax
	leaq	0(,%rax,8), %rdx
	leaq	time(%rip), %rax
	movsd	(%rdx,%rax), %xmm0
	movsd	%xmm0, tim(%rip)
	movsd	tim(%rip), %xmm1
	movsd	ttt(%rip), %xmm0
	comisd	%xmm1, %xmm0
	jbe	.L19
	movsd	tim(%rip), %xmm0
	movsd	%xmm0, ttt(%rip)
	movl	j(%rip), %eax
	movl	%eax, sel(%rip)
.L19:
	movl	j(%rip), %eax
	addl	$1, %eax
	movl	%eax, j(%rip)
.L18:
	movl	j(%rip), %edx
	movl	n(%rip), %eax
	cmpl	%eax, %edx
	jl	.L21
	movl	sel(%rip), %eax
	movl	%eax, next(%rip)
	movl	$0, i(%rip)
	movl	$0, j(%rip)
	jmp	.L22
.L25:
	movl	i(%rip), %eax
	movl	j(%rip), %edx
	movslq	%edx, %rcx
	movslq	%eax, %rdx
	movq	%rdx, %rax
	salq	$2, %rax
	addq	%rdx, %rax
	salq	$2, %rax
	addq	%rcx, %rax
	leaq	0(,%rax,4), %rdx
	leaq	next(%rip), %rax
	movl	(%rdx,%rax), %eax
	movl	%eax, nxt(%rip)
	movl	nxt(%rip), %eax
	cltq
	leaq	0(,%rax,4), %rdx
	leaq	num(%rip), %rax
	movl	(%rdx,%rax), %edx
	movl	i(%rip), %eax
	testl	%eax, %eax
	jle	.L23
	leaq	.LC4(%rip), %rax
	jmp	.L24
.L23:
	leaq	.LC5(%rip), %rax
.L24:
	movq	%rax, %rsi
	leaq	.LC6(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
	movl	nxt(%rip), %eax
	movl	$1, %edx
	movl	%eax, %ecx
	sall	%cl, %edx
	movl	i(%rip), %eax
	addl	%edx, %eax
	movl	%eax, i(%rip)
	movl	nxt(%rip), %eax
	movl	%eax, j(%rip)
.L22:
	movl	MAX(%rip), %eax
	leal	-1(%rax), %edx
	movl	i(%rip), %eax
	cmpl	%eax, %edx
	jg	.L25
	movl	$10, %edi
	call	putchar@PLT
	movl	$0, %eax
	popq	%rbp
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE6:
	.size	main, .-main
	.section	.rodata
	.align 8
.LC2:
	.long	0
	.long	1084178432
	.align 8
.LC3:
	.long	-67108864
	.long	1100470147
	.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:
