Given the following C code and unoptimized assembly code, your task is to generate highly optimized x86-64 assembly code.
C Code:

```c
// AOJ 1127: Building a Space Station
// 2017.9.19 bal4u@uu
// 2017.11.23

#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>

#define R 10
long long x[101], y[101], z[101], r[101];
char f[101];

char buf[100], *p;

long long dbl2int()
{
	int n = 0;
	while (*p >= '0') n = (n<<3) + (n<<1) + (*p++ & 0xf);
	if (*p == '.') p++;
	while (*p >= '0') n = (n<<3) + (n<<1) + (*p++ & 0xf);
	return n << R;
}

long long dist(long long dx, long long dy, long long dz)
{
	return (long long)sqrt((double)(dx*dx + dy*dy + dz*dz));
}

int main()
{
    int i, j, n, cnt, nx;
	long long ans, min, d;

    while (fgets(buf, 10, stdin) && *buf != '0') {
		n = atoi(buf);
		memset(f, 0, n);
		for (i = 0; i < n; i++) {
			fgets(p=buf, 100, stdin);
			x[i] = dbl2int(), p++, y[i] = dbl2int(), p++, z[i] = dbl2int(), p++, r[i] = dbl2int();
		}
        ans = 0, f[1] = 1, cnt = 1;
        while (cnt < n) {
            for (nx = -1, min = 1LL<<60, i = 0; i < n; i++) {
                if (f[i] == 0) continue;
                for (j = 0; j < n; j++) {
                    if (f[j]) continue;
					d = dist(x[i]-x[j], y[i]-y[j], z[i]-z[j]) - (r[i]+r[j]);
					if (nx < 0 || d < min) min = d, nx = j;
                }
            }
            f[nx] = 1, cnt++; if (min > 0) ans += min;
        }
		ans = (ans+512) >> R;
        printf("%lld.%03lld\n", ans/1000, ans%1000);
    }
    return 0;
}```

Unoptimized Assembly Code:

```assembly
	.file	"temp.c"
	.text
	.globl	x
	.bss
	.align 32
	.type	x, @object
	.size	x, 808
x:
	.zero	808
	.globl	y
	.align 32
	.type	y, @object
	.size	y, 808
y:
	.zero	808
	.globl	z
	.align 32
	.type	z, @object
	.size	z, 808
z:
	.zero	808
	.globl	r
	.align 32
	.type	r, @object
	.size	r, 808
r:
	.zero	808
	.globl	f
	.align 32
	.type	f, @object
	.size	f, 101
f:
	.zero	101
	.globl	buf
	.align 32
	.type	buf, @object
	.size	buf, 100
buf:
	.zero	100
	.globl	p
	.align 8
	.type	p, @object
	.size	p, 8
p:
	.zero	8
	.text
	.globl	dbl2int
	.type	dbl2int, @function
dbl2int:
.LFB6:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	movl	$0, -4(%rbp)
	jmp	.L2
.L3:
	movl	-4(%rbp), %eax
	leal	0(,%rax,8), %edx
	movl	-4(%rbp), %eax
	addl	%eax, %eax
	leal	(%rdx,%rax), %ecx
	movq	p(%rip), %rax
	leaq	1(%rax), %rdx
	movq	%rdx, p(%rip)
	movzbl	(%rax), %eax
	movsbl	%al, %eax
	andl	$15, %eax
	addl	%ecx, %eax
	movl	%eax, -4(%rbp)
.L2:
	movq	p(%rip), %rax
	movzbl	(%rax), %eax
	cmpb	$47, %al
	jg	.L3
	movq	p(%rip), %rax
	movzbl	(%rax), %eax
	cmpb	$46, %al
	jne	.L5
	movq	p(%rip), %rax
	addq	$1, %rax
	movq	%rax, p(%rip)
	jmp	.L5
.L6:
	movl	-4(%rbp), %eax
	leal	0(,%rax,8), %edx
	movl	-4(%rbp), %eax
	addl	%eax, %eax
	leal	(%rdx,%rax), %ecx
	movq	p(%rip), %rax
	leaq	1(%rax), %rdx
	movq	%rdx, p(%rip)
	movzbl	(%rax), %eax
	movsbl	%al, %eax
	andl	$15, %eax
	addl	%ecx, %eax
	movl	%eax, -4(%rbp)
.L5:
	movq	p(%rip), %rax
	movzbl	(%rax), %eax
	cmpb	$47, %al
	jg	.L6
	movl	-4(%rbp), %eax
	sall	$10, %eax
	cltq
	popq	%rbp
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE6:
	.size	dbl2int, .-dbl2int
	.globl	dist
	.type	dist, @function
dist:
.LFB7:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	subq	$32, %rsp
	movq	%rdi, -8(%rbp)
	movq	%rsi, -16(%rbp)
	movq	%rdx, -24(%rbp)
	movq	-8(%rbp), %rax
	imulq	%rax, %rax
	movq	%rax, %rdx
	movq	-16(%rbp), %rax
	imulq	%rax, %rax
	addq	%rax, %rdx
	movq	-24(%rbp), %rax
	imulq	%rax, %rax
	addq	%rdx, %rax
	pxor	%xmm1, %xmm1
	cvtsi2sdq	%rax, %xmm1
	movq	%xmm1, %rax
	movq	%rax, %xmm0
	call	sqrt@PLT
	cvttsd2siq	%xmm0, %rax
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE7:
	.size	dist, .-dist
	.section	.rodata
.LC0:
	.string	"%lld.%03lld\n"
	.text
	.globl	main
	.type	main, @function
main:
.LFB8:
	.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
	jmp	.L11
.L26:
	leaq	buf(%rip), %rax
	movq	%rax, %rdi
	call	atoi@PLT
	movl	%eax, -28(%rbp)
	movl	-28(%rbp), %eax
	cltq
	movq	%rax, %rdx
	movl	$0, %esi
	leaq	f(%rip), %rax
	movq	%rax, %rdi
	call	memset@PLT
	movl	$0, -44(%rbp)
	jmp	.L12
.L13:
	movq	stdin(%rip), %rdx
	leaq	buf(%rip), %rax
	movq	%rax, p(%rip)
	movq	p(%rip), %rax
	movl	$100, %esi
	movq	%rax, %rdi
	call	fgets@PLT
	movl	$0, %eax
	call	dbl2int
	movl	-44(%rbp), %edx
	movslq	%edx, %rdx
	leaq	0(,%rdx,8), %rcx
	leaq	x(%rip), %rdx
	movq	%rax, (%rcx,%rdx)
	movq	p(%rip), %rax
	addq	$1, %rax
	movq	%rax, p(%rip)
	movl	$0, %eax
	call	dbl2int
	movl	-44(%rbp), %edx
	movslq	%edx, %rdx
	leaq	0(,%rdx,8), %rcx
	leaq	y(%rip), %rdx
	movq	%rax, (%rcx,%rdx)
	movq	p(%rip), %rax
	addq	$1, %rax
	movq	%rax, p(%rip)
	movl	$0, %eax
	call	dbl2int
	movl	-44(%rbp), %edx
	movslq	%edx, %rdx
	leaq	0(,%rdx,8), %rcx
	leaq	z(%rip), %rdx
	movq	%rax, (%rcx,%rdx)
	movq	p(%rip), %rax
	addq	$1, %rax
	movq	%rax, p(%rip)
	movl	$0, %eax
	call	dbl2int
	movl	-44(%rbp), %edx
	movslq	%edx, %rdx
	leaq	0(,%rdx,8), %rcx
	leaq	r(%rip), %rdx
	movq	%rax, (%rcx,%rdx)
	addl	$1, -44(%rbp)
.L12:
	movl	-44(%rbp), %eax
	cmpl	-28(%rbp), %eax
	jl	.L13
	movq	$0, -24(%rbp)
	movb	$1, 1+f(%rip)
	movl	$1, -36(%rbp)
	jmp	.L14
.L24:
	movl	$-1, -32(%rbp)
	movabsq	$1152921504606846976, %rax
	movq	%rax, -16(%rbp)
	movl	$0, -44(%rbp)
	jmp	.L15
.L23:
	movl	-44(%rbp), %eax
	cltq
	leaq	f(%rip), %rdx
	movzbl	(%rax,%rdx), %eax
	testb	%al, %al
	je	.L28
	movl	$0, -40(%rbp)
	jmp	.L18
.L22:
	movl	-40(%rbp), %eax
	cltq
	leaq	f(%rip), %rdx
	movzbl	(%rax,%rdx), %eax
	testb	%al, %al
	jne	.L29
	movl	-44(%rbp), %eax
	cltq
	leaq	0(,%rax,8), %rdx
	leaq	z(%rip), %rax
	movq	(%rdx,%rax), %rax
	movl	-40(%rbp), %edx
	movslq	%edx, %rdx
	leaq	0(,%rdx,8), %rcx
	leaq	z(%rip), %rdx
	movq	(%rcx,%rdx), %rcx
	subq	%rcx, %rax
	movq	%rax, %rdx
	movl	-44(%rbp), %eax
	cltq
	leaq	0(,%rax,8), %rcx
	leaq	y(%rip), %rax
	movq	(%rcx,%rax), %rax
	movl	-40(%rbp), %ecx
	movslq	%ecx, %rcx
	leaq	0(,%rcx,8), %rsi
	leaq	y(%rip), %rcx
	movq	(%rsi,%rcx), %rsi
	subq	%rsi, %rax
	movq	%rax, %rcx
	movl	-44(%rbp), %eax
	cltq
	leaq	0(,%rax,8), %rsi
	leaq	x(%rip), %rax
	movq	(%rsi,%rax), %rax
	movl	-40(%rbp), %esi
	movslq	%esi, %rsi
	leaq	0(,%rsi,8), %rdi
	leaq	x(%rip), %rsi
	movq	(%rdi,%rsi), %rsi
	subq	%rsi, %rax
	movq	%rcx, %rsi
	movq	%rax, %rdi
	call	dist
	movl	-44(%rbp), %edx
	movslq	%edx, %rdx
	leaq	0(,%rdx,8), %rcx
	leaq	r(%rip), %rdx
	movq	(%rcx,%rdx), %rsi
	movl	-40(%rbp), %edx
	movslq	%edx, %rdx
	leaq	0(,%rdx,8), %rcx
	leaq	r(%rip), %rdx
	movq	(%rcx,%rdx), %rdx
	addq	%rsi, %rdx
	subq	%rdx, %rax
	movq	%rax, -8(%rbp)
	cmpl	$0, -32(%rbp)
	js	.L21
	movq	-8(%rbp), %rax
	cmpq	-16(%rbp), %rax
	jge	.L20
.L21:
	movq	-8(%rbp), %rax
	movq	%rax, -16(%rbp)
	movl	-40(%rbp), %eax
	movl	%eax, -32(%rbp)
	jmp	.L20
.L29:
	nop
.L20:
	addl	$1, -40(%rbp)
.L18:
	movl	-40(%rbp), %eax
	cmpl	-28(%rbp), %eax
	jl	.L22
	jmp	.L17
.L28:
	nop
.L17:
	addl	$1, -44(%rbp)
.L15:
	movl	-44(%rbp), %eax
	cmpl	-28(%rbp), %eax
	jl	.L23
	movl	-32(%rbp), %eax
	cltq
	leaq	f(%rip), %rdx
	movb	$1, (%rax,%rdx)
	addl	$1, -36(%rbp)
	cmpq	$0, -16(%rbp)
	jle	.L14
	movq	-16(%rbp), %rax
	addq	%rax, -24(%rbp)
.L14:
	movl	-36(%rbp), %eax
	cmpl	-28(%rbp), %eax
	jl	.L24
	movq	-24(%rbp), %rax
	addq	$512, %rax
	sarq	$10, %rax
	movq	%rax, -24(%rbp)
	movq	-24(%rbp), %rsi
	movabsq	$2361183241434822607, %rdx
	movq	%rsi, %rax
	imulq	%rdx
	movq	%rdx, %rax
	sarq	$7, %rax
	movq	%rsi, %rdx
	sarq	$63, %rdx
	subq	%rdx, %rax
	movq	%rax, %rcx
	imulq	$1000, %rcx, %rax
	subq	%rax, %rsi
	movq	%rsi, %rcx
	movq	-24(%rbp), %rsi
	movabsq	$2361183241434822607, %rdx
	movq	%rsi, %rax
	imulq	%rdx
	movq	%rdx, %rax
	sarq	$7, %rax
	sarq	$63, %rsi
	movq	%rsi, %rdx
	subq	%rdx, %rax
	movq	%rcx, %rdx
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
.L11:
	movq	stdin(%rip), %rax
	movq	%rax, %rdx
	movl	$10, %esi
	leaq	buf(%rip), %rax
	movq	%rax, %rdi
	call	fgets@PLT
	testq	%rax, %rax
	je	.L25
	movzbl	buf(%rip), %eax
	cmpb	$48, %al
	jne	.L26
.L25:
	movl	$0, %eax
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE8:
	.size	main, .-main
	.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
	.p2align 4
	.globl	dbl2int
	.type	dbl2int, @function
dbl2int:
.LFB51:
	.cfi_startproc
	endbr64
	movq	p(%rip), %rdx
	movzbl	(%rdx), %esi
	cmpb	$47, %sil
	jle	.L7
	leaq	1(%rdx), %rcx
	xorl	%eax, %eax
	.p2align 4,,10
	.p2align 3
.L3:
	movq	%rcx, p(%rip)
	leal	(%rax,%rax,4), %esi
	movzbl	-1(%rcx), %eax
	movq	%rcx, %rdx
	addq	$1, %rcx
	andl	$15, %eax
	leal	(%rax,%rsi,2), %eax
	movzbl	-1(%rcx), %esi
	cmpb	$47, %sil
	jg	.L3
.L2:
	cmpb	$46, %sil
	jne	.L4
	leaq	1(%rdx), %rcx
	movq	%rcx, p(%rip)
	cmpb	$47, 1(%rdx)
	jle	.L4
	addq	$2, %rdx
	.p2align 4,,10
	.p2align 3
.L5:
	movq	%rdx, p(%rip)
	leal	(%rax,%rax,4), %ecx
	movzbl	-1(%rdx), %eax
	addq	$1, %rdx
	andl	$15, %eax
	cmpb	$47, -1(%rdx)
	leal	(%rax,%rcx,2), %eax
	jg	.L5
.L4:
	sall	$10, %eax
	cltq
	ret
	.p2align 4,,10
	.p2align 3
.L7:
	xorl	%eax, %eax
	jmp	.L2
	.cfi_endproc
.LFE51:
	.size	dbl2int, .-dbl2int
	.p2align 4
	.globl	dist
	.type	dist, @function
dist:
.LFB52:
	.cfi_startproc
	endbr64
	imulq	%rdi, %rdi
	pxor	%xmm0, %xmm0
	pxor	%xmm1, %xmm1
	imulq	%rsi, %rsi
	imulq	%rdx, %rdx
	addq	%rsi, %rdi
	addq	%rdx, %rdi
	cvtsi2sdq	%rdi, %xmm0
	ucomisd	%xmm0, %xmm1
	ja	.L17
	sqrtsd	%xmm0, %xmm0
	cvttsd2siq	%xmm0, %rax
	ret
.L17:
	pushq	%rax
	.cfi_def_cfa_offset 16
	call	sqrt@PLT
	popq	%rdx
	.cfi_def_cfa_offset 8
	cvttsd2siq	%xmm0, %rax
	ret
	.cfi_endproc
.LFE52:
	.size	dist, .-dist
	.section	.rodata.str1.1,"aMS",@progbits,1
.LC1:
	.string	"%lld.%03lld\n"
	.section	.text.startup,"ax",@progbits
	.p2align 4
	.globl	main
	.type	main, @function
main:
.LFB53:
	.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
	subq	$56, %rsp
	.cfi_def_cfa_offset 112
.L22:
	movq	stdin(%rip), %rdx
	movl	$10, %esi
	leaq	buf(%rip), %rdi
	call	fgets@PLT
	testq	%rax, %rax
	je	.L75
	leaq	buf(%rip), %rax
	cmpb	$48, (%rax)
	je	.L75
	xorl	%esi, %esi
	movl	$10, %edx
	leaq	buf(%rip), %rdi
	call	strtol@PLT
	leaq	f(%rip), %r11
	xorl	%esi, %esi
	movl	$101, %ecx
	movq	%rax, %rbp
	movslq	%eax, %rdx
	movq	%r11, %rdi
	movl	%eax, 20(%rsp)
	call	__memset_chk@PLT
	testl	%ebp, %ebp
	jle	.L94
	leal	-1(%rbp), %ebx
	xorl	%r12d, %r12d
	leaq	x(%rip), %r14
	movl	%ebx, 16(%rsp)
	leaq	y(%rip), %r15
	leaq	r(%rip), %r13
	.p2align 4,,10
	.p2align 3
.L43:
	leaq	buf(%rip), %rax
	movq	stdin(%rip), %rdx
	movl	$100, %esi
	movq	%rax, %rdi
	movq	%rax, p(%rip)
	call	fgets@PLT
	movq	p(%rip), %rdx
	leaq	z(%rip), %r8
	leaq	f(%rip), %r11
	pxor	%xmm1, %xmm1
	movzbl	(%rdx), %esi
	cmpb	$47, %sil
	jle	.L61
	leaq	1(%rdx), %rcx
	xorl	%eax, %eax
	.p2align 4,,10
	.p2align 3
.L28:
	movq	%rcx, p(%rip)
	leal	(%rax,%rax,4), %esi
	movzbl	-1(%rcx), %eax
	movq	%rcx, %rdx
	addq	$1, %rcx
	andl	$15, %eax
	leal	(%rax,%rsi,2), %eax
	movzbl	-1(%rcx), %esi
	cmpb	$47, %sil
	jg	.L28
.L27:
	cmpb	$46, %sil
	jne	.L29
	leaq	1(%rdx), %rcx
	movq	%rcx, p(%rip)
	cmpb	$47, 1(%rdx)
	jle	.L62
	leaq	2(%rdx), %rcx
	.p2align 4,,10
	.p2align 3
.L30:
	movq	%rcx, p(%rip)
	leal	(%rax,%rax,4), %esi
	movzbl	-1(%rcx), %eax
	movq	%rcx, %rdx
	addq	$1, %rcx
	andl	$15, %eax
	cmpb	$47, -1(%rcx)
	leal	(%rax,%rsi,2), %eax
	jg	.L30
.L29:
	sall	$10, %eax
	leaq	1(%rdx), %rcx
	cltq
	movq	%rcx, p(%rip)
	movq	%rax, (%r14,%r12,8)
	movzbl	1(%rdx), %esi
	cmpb	$47, %sil
	jle	.L63
	addq	$2, %rdx
	xorl	%eax, %eax
	.p2align 4,,10
	.p2align 3
.L32:
	movq	%rdx, p(%rip)
	leal	(%rax,%rax,4), %esi
	movzbl	-1(%rdx), %eax
	movq	%rdx, %rcx
	addq	$1, %rdx
	andl	$15, %eax
	leal	(%rax,%rsi,2), %eax
	movzbl	-1(%rdx), %esi
	cmpb	$47, %sil
	jg	.L32
.L31:
	cmpb	$46, %sil
	jne	.L33
	leaq	1(%rcx), %rdx
	movq	%rdx, p(%rip)
	cmpb	$47, 1(%rcx)
	jle	.L64
	leaq	2(%rcx), %rdx
	.p2align 4,,10
	.p2align 3
.L34:
	movq	%rdx, p(%rip)
	leal	(%rax,%rax,4), %esi
	movzbl	-1(%rdx), %eax
	movq	%rdx, %rcx
	addq	$1, %rdx
	andl	$15, %eax
	cmpb	$47, -1(%rdx)
	leal	(%rax,%rsi,2), %eax
	jg	.L34
.L33:
	sall	$10, %eax
	leaq	1(%rcx), %rdx
	cltq
	movq	%rdx, p(%rip)
	movq	%rax, (%r15,%r12,8)
	movzbl	1(%rcx), %esi
	cmpb	$47, %sil
	jle	.L65
	addq	$2, %rcx
	xorl	%eax, %eax
	.p2align 4,,10
	.p2align 3
.L36:
	movq	%rcx, p(%rip)
	leal	(%rax,%rax,4), %esi
	movzbl	-1(%rcx), %eax
	movq	%rcx, %rdx
	addq	$1, %rcx
	andl	$15, %eax
	leal	(%rax,%rsi,2), %eax
	movzbl	-1(%rcx), %esi
	cmpb	$47, %sil
	jg	.L36
.L35:
	cmpb	$46, %sil
	jne	.L37
	leaq	1(%rdx), %rcx
	movq	%rcx, p(%rip)
	cmpb	$47, 1(%rdx)
	jle	.L66
	leaq	2(%rdx), %rcx
	.p2align 4,,10
	.p2align 3
.L38:
	movq	%rcx, p(%rip)
	leal	(%rax,%rax,4), %esi
	movzbl	-1(%rcx), %eax
	movq	%rcx, %rdx
	addq	$1, %rcx
	andl	$15, %eax
	cmpb	$47, -1(%rcx)
	leal	(%rax,%rsi,2), %eax
	jg	.L38
.L37:
	sall	$10, %eax
	leaq	1(%rdx), %rcx
	cltq
	movq	%rcx, p(%rip)
	movq	%rax, (%r8,%r12,8)
	movzbl	1(%rdx), %esi
	cmpb	$47, %sil
	jle	.L67
	addq	$2, %rdx
	xorl	%eax, %eax
	.p2align 4,,10
	.p2align 3
.L40:
	movq	%rdx, p(%rip)
	leal	(%rax,%rax,4), %esi
	movzbl	-1(%rdx), %eax
	movq	%rdx, %rcx
	addq	$1, %rdx
	andl	$15, %eax
	leal	(%rax,%rsi,2), %eax
	movzbl	-1(%rdx), %esi
	cmpb	$47, %sil
	jg	.L40
.L39:
	cmpb	$46, %sil
	jne	.L41
	leaq	1(%rcx), %rdx
	movq	%rdx, p(%rip)
	cmpb	$47, 1(%rcx)
	jle	.L41
	leaq	2(%rcx), %rdx
	.p2align 4,,10
	.p2align 3
.L42:
	movq	%rdx, p(%rip)
	leal	(%rax,%rax,4), %ecx
	movzbl	-1(%rdx), %eax
	addq	$1, %rdx
	andl	$15, %eax
	cmpb	$47, -1(%rdx)
	leal	(%rax,%rcx,2), %eax
	jg	.L42
.L41:
	sall	$10, %eax
	cltq
	movq	%rax, 0(%r13,%r12,8)
	leaq	1(%r12), %rax
	cmpq	%r12, %rbx
	je	.L95
	movq	%rax, %r12
	jmp	.L43
.L67:
	xorl	%eax, %eax
	jmp	.L39
.L65:
	xorl	%eax, %eax
	jmp	.L35
.L95:
	movb	$1, 1+f(%rip)
	cmpl	$1, %ebp
	jle	.L93
	movl	$1, 12(%rsp)
	xorl	%r10d, %r10d
	.p2align 4,,10
	.p2align 3
.L25:
	movl	16(%rsp), %r12d
	xorl	%ebp, %ebp
	movq	$-1, %rdi
	movabsq	$1152921504606846976, %r9
	jmp	.L52
	.p2align 4,,10
	.p2align 3
.L97:
	leaq	1(%rbp), %rax
	cmpq	%rbp, %r12
	je	.L96
.L70:
	movq	%rax, %rbp
.L52:
	xorl	%ebx, %ebx
	cmpb	$0, (%r11,%rbp)
	jne	.L51
	leaq	1(%rbp), %rax
	cmpq	%rbp, %r12
	jne	.L70
.L96:
	addl	$1, 12(%rsp)
	leaq	(%r10,%r9), %rax
	testq	%r9, %r9
	movb	$1, (%r11,%rdi)
	cmovg	%rax, %r10
	movl	12(%rsp), %edi
	cmpl	20(%rsp), %edi
	jne	.L25
	addq	$512, %r10
	movabsq	$2361183241434822607, %rcx
	sarq	$10, %r10
	movq	%r10, %rdx
	shrq	$3, %rdx
	movq	%rdx, %rax
	mulq	%rcx
	movq	%rdx, %rcx
	shrq	$4, %rdx
	shrq	$4, %rcx
	imulq	$1000, %rcx, %rax
	movq	%r10, %rcx
	subq	%rax, %rcx
.L26:
	leaq	.LC1(%rip), %rsi
	movl	$1, %edi
	xorl	%eax, %eax
	call	__printf_chk@PLT
	jmp	.L22
	.p2align 4,,10
	.p2align 3
.L72:
	movq	%rax, %r9
	movslq	%edx, %rdi
	.p2align 4,,10
	.p2align 3
.L46:
	leaq	1(%rbx), %rax
	cmpq	%rbx, %r12
	je	.L97
	movq	%rax, %rbx
.L51:
	cmpb	$0, (%r11,%rbx)
	movl	%ebx, %edx
	jne	.L46
	movq	(%r15,%rbp,8), %rax
	movq	(%r14,%rbp,8), %rsi
	pxor	%xmm0, %xmm0
	subq	(%r15,%rbx,8), %rax
	subq	(%r14,%rbx,8), %rsi
	imulq	%rsi, %rsi
	movq	(%r8,%rbp,8), %rcx
	subq	(%r8,%rbx,8), %rcx
	imulq	%rax, %rax
	imulq	%rcx, %rcx
	addq	%rsi, %rax
	addq	%rcx, %rax
	cvtsi2sdq	%rax, %xmm0
	ucomisd	%xmm0, %xmm1
	ja	.L91
	sqrtsd	%xmm0, %xmm0
.L49:
	cvttsd2siq	%xmm0, %rax
	subq	0(%r13,%rbx,8), %rax
	subq	0(%r13,%rbp,8), %rax
	testl	%edi, %edi
	js	.L72
	cmpq	%r9, %rax
	jge	.L46
	movq	%rax, %r9
	movslq	%edx, %rdi
	jmp	.L46
.L63:
	xorl	%eax, %eax
	jmp	.L31
.L61:
	xorl	%eax, %eax
	jmp	.L27
.L75:
	addq	$56, %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
.L94:
	.cfi_restore_state
	movb	$1, 1+f(%rip)
.L93:
	xorl	%edx, %edx
	xorl	%ecx, %ecx
	jmp	.L26
.L91:
	movq	%r10, 40(%rsp)
	movq	%r9, 32(%rsp)
	movl	%edi, 28(%rsp)
	movl	%ebx, 24(%rsp)
	call	sqrt@PLT
	movq	40(%rsp), %r10
	movq	32(%rsp), %r9
	pxor	%xmm1, %xmm1
	movslq	28(%rsp), %rdi
	movl	24(%rsp), %edx
	leaq	f(%rip), %r11
	leaq	z(%rip), %r8
	jmp	.L49
.L66:
	movq	%rcx, %rdx
	jmp	.L37
.L64:
	movq	%rdx, %rcx
	jmp	.L33
.L62:
	movq	%rcx, %rdx
	jmp	.L29
	.cfi_endproc
.LFE53:
	.size	main, .-main
	.globl	p
	.bss
	.align 8
	.type	p, @object
	.size	p, 8
p:
	.zero	8
	.globl	buf
	.align 32
	.type	buf, @object
	.size	buf, 100
buf:
	.zero	100
	.globl	f
	.align 32
	.type	f, @object
	.size	f, 101
f:
	.zero	101
	.globl	r
	.align 32
	.type	r, @object
	.size	r, 808
r:
	.zero	808
	.globl	z
	.align 32
	.type	z, @object
	.size	z, 808
z:
	.zero	808
	.globl	y
	.align 32
	.type	y, @object
	.size	y, 808
y:
	.zero	808
	.globl	x
	.align 32
	.type	x, @object
	.size	x, 808
x:
	.zero	808
	.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
	.p2align 4
	.globl	dbl2int
	.type	dbl2int, @function
dbl2int:
.LFB51:
	.cfi_startproc
	endbr64
	movq	p(%rip), %rdx
	movzbl	(%rdx), %esi
	cmpb	$47, %sil
	jle	.L7
	leaq	1(%rdx), %rcx
	xorl	%eax, %eax
	.p2align 4,,10
	.p2align 3
.L3:
	movq	%rcx, p(%rip)
	leal	(%rax,%rax,4), %esi
	movzbl	-1(%rcx), %eax
	movq	%rcx, %rdx
	addq	$1, %rcx
	andl	$15, %eax
	leal	(%rax,%rsi,2), %eax
	movzbl	-1(%rcx), %esi
	cmpb	$47, %sil
	jg	.L3
.L2:
	cmpb	$46, %sil
	jne	.L4
	leaq	1(%rdx), %rcx
	movq	%rcx, p(%rip)
	cmpb	$47, 1(%rdx)
	jle	.L4
	addq	$2, %rdx
	.p2align 4,,10
	.p2align 3
.L5:
	movq	%rdx, p(%rip)
	leal	(%rax,%rax,4), %ecx
	movzbl	-1(%rdx), %eax
	addq	$1, %rdx
	andl	$15, %eax
	cmpb	$47, -1(%rdx)
	leal	(%rax,%rcx,2), %eax
	jg	.L5
.L4:
	sall	$10, %eax
	cltq
	ret
	.p2align 4,,10
	.p2align 3
.L7:
	xorl	%eax, %eax
	jmp	.L2
	.cfi_endproc
.LFE51:
	.size	dbl2int, .-dbl2int
	.p2align 4
	.globl	dist
	.type	dist, @function
dist:
.LFB52:
	.cfi_startproc
	endbr64
	imulq	%rdi, %rdi
	pxor	%xmm0, %xmm0
	pxor	%xmm1, %xmm1
	imulq	%rsi, %rsi
	imulq	%rdx, %rdx
	addq	%rsi, %rdi
	addq	%rdx, %rdi
	cvtsi2sdq	%rdi, %xmm0
	ucomisd	%xmm0, %xmm1
	ja	.L17
	sqrtsd	%xmm0, %xmm0
	cvttsd2siq	%xmm0, %rax
	ret
.L17:
	pushq	%rax
	.cfi_def_cfa_offset 16
	call	sqrt@PLT
	popq	%rdx
	.cfi_def_cfa_offset 8
	cvttsd2siq	%xmm0, %rax
	ret
	.cfi_endproc
.LFE52:
	.size	dist, .-dist
	.section	.rodata.str1.1,"aMS",@progbits,1
.LC1:
	.string	"%lld.%03lld\n"
	.section	.text.startup,"ax",@progbits
	.p2align 4
	.globl	main
	.type	main, @function
main:
.LFB53:
	.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
	subq	$56, %rsp
	.cfi_def_cfa_offset 112
.L22:
	movq	stdin(%rip), %rdx
	movl	$10, %esi
	leaq	buf(%rip), %rdi
	call	fgets@PLT
	testq	%rax, %rax
	je	.L75
	leaq	buf(%rip), %rax
	cmpb	$48, (%rax)
	je	.L75
	xorl	%esi, %esi
	movl	$10, %edx
	leaq	buf(%rip), %rdi
	call	strtol@PLT
	leaq	f(%rip), %r11
	xorl	%esi, %esi
	movl	$101, %ecx
	movq	%rax, %rbp
	movslq	%eax, %rdx
	movq	%r11, %rdi
	movl	%eax, 20(%rsp)
	call	__memset_chk@PLT
	testl	%ebp, %ebp
	jle	.L94
	leal	-1(%rbp), %ebx
	xorl	%r12d, %r12d
	leaq	x(%rip), %r14
	movl	%ebx, 16(%rsp)
	leaq	y(%rip), %r15
	leaq	r(%rip), %r13
	.p2align 4,,10
	.p2align 3
.L43:
	leaq	buf(%rip), %rax
	movq	stdin(%rip), %rdx
	movl	$100, %esi
	movq	%rax, %rdi
	movq	%rax, p(%rip)
	call	fgets@PLT
	movq	p(%rip), %rdx
	leaq	z(%rip), %r8
	leaq	f(%rip), %r11
	pxor	%xmm1, %xmm1
	movzbl	(%rdx), %esi
	cmpb	$47, %sil
	jle	.L61
	leaq	1(%rdx), %rcx
	xorl	%eax, %eax
	.p2align 4,,10
	.p2align 3
.L28:
	movq	%rcx, p(%rip)
	leal	(%rax,%rax,4), %esi
	movzbl	-1(%rcx), %eax
	movq	%rcx, %rdx
	addq	$1, %rcx
	andl	$15, %eax
	leal	(%rax,%rsi,2), %eax
	movzbl	-1(%rcx), %esi
	cmpb	$47, %sil
	jg	.L28
.L27:
	cmpb	$46, %sil
	jne	.L29
	leaq	1(%rdx), %rcx
	movq	%rcx, p(%rip)
	cmpb	$47, 1(%rdx)
	jle	.L62
	leaq	2(%rdx), %rcx
	.p2align 4,,10
	.p2align 3
.L30:
	movq	%rcx, p(%rip)
	leal	(%rax,%rax,4), %esi
	movzbl	-1(%rcx), %eax
	movq	%rcx, %rdx
	addq	$1, %rcx
	andl	$15, %eax
	cmpb	$47, -1(%rcx)
	leal	(%rax,%rsi,2), %eax
	jg	.L30
.L29:
	sall	$10, %eax
	leaq	1(%rdx), %rcx
	cltq
	movq	%rcx, p(%rip)
	movq	%rax, (%r14,%r12,8)
	movzbl	1(%rdx), %esi
	cmpb	$47, %sil
	jle	.L63
	addq	$2, %rdx
	xorl	%eax, %eax
	.p2align 4,,10
	.p2align 3
.L32:
	movq	%rdx, p(%rip)
	leal	(%rax,%rax,4), %esi
	movzbl	-1(%rdx), %eax
	movq	%rdx, %rcx
	addq	$1, %rdx
	andl	$15, %eax
	leal	(%rax,%rsi,2), %eax
	movzbl	-1(%rdx), %esi
	cmpb	$47, %sil
	jg	.L32
.L31:
	cmpb	$46, %sil
	jne	.L33
	leaq	1(%rcx), %rdx
	movq	%rdx, p(%rip)
	cmpb	$47, 1(%rcx)
	jle	.L64
	leaq	2(%rcx), %rdx
	.p2align 4,,10
	.p2align 3
.L34:
	movq	%rdx, p(%rip)
	leal	(%rax,%rax,4), %esi
	movzbl	-1(%rdx), %eax
	movq	%rdx, %rcx
	addq	$1, %rdx
	andl	$15, %eax
	cmpb	$47, -1(%rdx)
	leal	(%rax,%rsi,2), %eax
	jg	.L34
.L33:
	sall	$10, %eax
	leaq	1(%rcx), %rdx
	cltq
	movq	%rdx, p(%rip)
	movq	%rax, (%r15,%r12,8)
	movzbl	1(%rcx), %esi
	cmpb	$47, %sil
	jle	.L65
	addq	$2, %rcx
	xorl	%eax, %eax
	.p2align 4,,10
	.p2align 3
.L36:
	movq	%rcx, p(%rip)
	leal	(%rax,%rax,4), %esi
	movzbl	-1(%rcx), %eax
	movq	%rcx, %rdx
	addq	$1, %rcx
	andl	$15, %eax
	leal	(%rax,%rsi,2), %eax
	movzbl	-1(%rcx), %esi
	cmpb	$47, %sil
	jg	.L36
.L35:
	cmpb	$46, %sil
	jne	.L37
	leaq	1(%rdx), %rcx
	movq	%rcx, p(%rip)
	cmpb	$47, 1(%rdx)
	jle	.L66
	leaq	2(%rdx), %rcx
	.p2align 4,,10
	.p2align 3
.L38:
	movq	%rcx, p(%rip)
	leal	(%rax,%rax,4), %esi
	movzbl	-1(%rcx), %eax
	movq	%rcx, %rdx
	addq	$1, %rcx
	andl	$15, %eax
	cmpb	$47, -1(%rcx)
	leal	(%rax,%rsi,2), %eax
	jg	.L38
.L37:
	sall	$10, %eax
	leaq	1(%rdx), %rcx
	cltq
	movq	%rcx, p(%rip)
	movq	%rax, (%r8,%r12,8)
	movzbl	1(%rdx), %esi
	cmpb	$47, %sil
	jle	.L67
	addq	$2, %rdx
	xorl	%eax, %eax
	.p2align 4,,10
	.p2align 3
.L40:
	movq	%rdx, p(%rip)
	leal	(%rax,%rax,4), %esi
	movzbl	-1(%rdx), %eax
	movq	%rdx, %rcx
	addq	$1, %rdx
	andl	$15, %eax
	leal	(%rax,%rsi,2), %eax
	movzbl	-1(%rdx), %esi
	cmpb	$47, %sil
	jg	.L40
.L39:
	cmpb	$46, %sil
	jne	.L41
	leaq	1(%rcx), %rdx
	movq	%rdx, p(%rip)
	cmpb	$47, 1(%rcx)
	jle	.L41
	leaq	2(%rcx), %rdx
	.p2align 4,,10
	.p2align 3
.L42:
	movq	%rdx, p(%rip)
	leal	(%rax,%rax,4), %ecx
	movzbl	-1(%rdx), %eax
	addq	$1, %rdx
	andl	$15, %eax
	cmpb	$47, -1(%rdx)
	leal	(%rax,%rcx,2), %eax
	jg	.L42
.L41:
	sall	$10, %eax
	cltq
	movq	%rax, 0(%r13,%r12,8)
	leaq	1(%r12), %rax
	cmpq	%r12, %rbx
	je	.L95
	movq	%rax, %r12
	jmp	.L43
.L67:
	xorl	%eax, %eax
	jmp	.L39
.L65:
	xorl	%eax, %eax
	jmp	.L35
.L95:
	movb	$1, 1+f(%rip)
	cmpl	$1, %ebp
	jle	.L93
	movl	$1, 12(%rsp)
	xorl	%r10d, %r10d
	.p2align 4,,10
	.p2align 3
.L25:
	movl	16(%rsp), %r12d
	xorl	%ebp, %ebp
	movq	$-1, %rdi
	movabsq	$1152921504606846976, %r9
	jmp	.L52
	.p2align 4,,10
	.p2align 3
.L97:
	leaq	1(%rbp), %rax
	cmpq	%rbp, %r12
	je	.L96
.L70:
	movq	%rax, %rbp
.L52:
	xorl	%ebx, %ebx
	cmpb	$0, (%r11,%rbp)
	jne	.L51
	leaq	1(%rbp), %rax
	cmpq	%rbp, %r12
	jne	.L70
.L96:
	addl	$1, 12(%rsp)
	leaq	(%r10,%r9), %rax
	testq	%r9, %r9
	movb	$1, (%r11,%rdi)
	cmovg	%rax, %r10
	movl	12(%rsp), %edi
	cmpl	20(%rsp), %edi
	jne	.L25
	addq	$512, %r10
	movabsq	$2361183241434822607, %rcx
	sarq	$10, %r10
	movq	%r10, %rdx
	shrq	$3, %rdx
	movq	%rdx, %rax
	mulq	%rcx
	movq	%rdx, %rcx
	shrq	$4, %rdx
	shrq	$4, %rcx
	imulq	$1000, %rcx, %rax
	movq	%r10, %rcx
	subq	%rax, %rcx
.L26:
	leaq	.LC1(%rip), %rsi
	movl	$1, %edi
	xorl	%eax, %eax
	call	__printf_chk@PLT
	jmp	.L22
	.p2align 4,,10
	.p2align 3
.L72:
	movq	%rax, %r9
	movslq	%edx, %rdi
	.p2align 4,,10
	.p2align 3
.L46:
	leaq	1(%rbx), %rax
	cmpq	%rbx, %r12
	je	.L97
	movq	%rax, %rbx
.L51:
	cmpb	$0, (%r11,%rbx)
	movl	%ebx, %edx
	jne	.L46
	movq	(%r15,%rbp,8), %rax
	movq	(%r14,%rbp,8), %rsi
	pxor	%xmm0, %xmm0
	subq	(%r15,%rbx,8), %rax
	subq	(%r14,%rbx,8), %rsi
	imulq	%rsi, %rsi
	movq	(%r8,%rbp,8), %rcx
	subq	(%r8,%rbx,8), %rcx
	imulq	%rax, %rax
	imulq	%rcx, %rcx
	addq	%rsi, %rax
	addq	%rcx, %rax
	cvtsi2sdq	%rax, %xmm0
	ucomisd	%xmm0, %xmm1
	ja	.L91
	sqrtsd	%xmm0, %xmm0
.L49:
	cvttsd2siq	%xmm0, %rax
	subq	0(%r13,%rbx,8), %rax
	subq	0(%r13,%rbp,8), %rax
	testl	%edi, %edi
	js	.L72
	cmpq	%r9, %rax
	jge	.L46
	movq	%rax, %r9
	movslq	%edx, %rdi
	jmp	.L46
.L63:
	xorl	%eax, %eax
	jmp	.L31
.L61:
	xorl	%eax, %eax
	jmp	.L27
.L75:
	addq	$56, %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
.L94:
	.cfi_restore_state
	movb	$1, 1+f(%rip)
.L93:
	xorl	%edx, %edx
	xorl	%ecx, %ecx
	jmp	.L26
.L91:
	movq	%r10, 40(%rsp)
	movq	%r9, 32(%rsp)
	movl	%edi, 28(%rsp)
	movl	%ebx, 24(%rsp)
	call	sqrt@PLT
	movq	40(%rsp), %r10
	movq	32(%rsp), %r9
	pxor	%xmm1, %xmm1
	movslq	28(%rsp), %rdi
	movl	24(%rsp), %edx
	leaq	f(%rip), %r11
	leaq	z(%rip), %r8
	jmp	.L49
.L66:
	movq	%rcx, %rdx
	jmp	.L37
.L64:
	movq	%rdx, %rcx
	jmp	.L33
.L62:
	movq	%rcx, %rdx
	jmp	.L29
	.cfi_endproc
.LFE53:
	.size	main, .-main
	.globl	p
	.bss
	.align 8
	.type	p, @object
	.size	p, 8
p:
	.zero	8
	.globl	buf
	.align 32
	.type	buf, @object
	.size	buf, 100
buf:
	.zero	100
	.globl	f
	.align 32
	.type	f, @object
	.size	f, 101
f:
	.zero	101
	.globl	r
	.align 32
	.type	r, @object
	.size	r, 808
r:
	.zero	808
	.globl	z
	.align 32
	.type	z, @object
	.size	z, 808
z:
	.zero	808
	.globl	y
	.align 32
	.type	y, @object
	.size	y, 808
y:
	.zero	808
	.globl	x
	.align 32
	.type	x, @object
	.size	x, 808
x:
	.zero	808
	.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:

// AOJ 1127: Building a Space Station
// 2017.9.19 bal4u@uu
// 2017.11.23

#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>

#define R 10
long long x[101], y[101], z[101], r[101];
char f[101];

char buf[100], *p;

long long dbl2int()
{
	int n = 0;
	while (*p >= '0') n = (n<<3) + (n<<1) + (*p++ & 0xf);
	if (*p == '.') p++;
	while (*p >= '0') n = (n<<3) + (n<<1) + (*p++ & 0xf);
	return n << R;
}

long long dist(long long dx, long long dy, long long dz)
{
	return (long long)sqrt((double)(dx*dx + dy*dy + dz*dz));
}

int main()
{
    int i, j, n, cnt, nx;
	long long ans, min, d;

    while (fgets(buf, 10, stdin) && *buf != '0') {
		n = atoi(buf);
		memset(f, 0, n);
		for (i = 0; i < n; i++) {
			fgets(p=buf, 100, stdin);
			x[i] = dbl2int(), p++, y[i] = dbl2int(), p++, z[i] = dbl2int(), p++, r[i] = dbl2int();
		}
        ans = 0, f[1] = 1, cnt = 1;
        while (cnt < n) {
            for (nx = -1, min = 1LL<<60, i = 0; i < n; i++) {
                if (f[i] == 0) continue;
                for (j = 0; j < n; j++) {
                    if (f[j]) continue;
					d = dist(x[i]-x[j], y[i]-y[j], z[i]-z[j]) - (r[i]+r[j]);
					if (nx < 0 || d < min) min = d, nx = j;
                }
            }
            f[nx] = 1, cnt++; if (min > 0) ans += min;
        }
		ans = (ans+512) >> R;
        printf("%lld.%03lld\n", ans/1000, ans%1000);
    }
    return 0;
}
3
10.000 10.000 50.000 10.000
40.000 10.000 50.9661040800581 10.000
40.000 40.000 50.000 10.000
2
30.000 30.000 30.000 20.000
40.000 40.000 40.000 20.000
5
5.729 15.143 3.996 25.837
6.013 14.372 4.818 10.671
80.115 63.292 84.477 15.120
64.095 80.924 70.029 14.881
39.472 85.116 71.369 5.553
0
 3
10.000 10.000 50.000 10.000
40.000 10.000 50.9661040800581 10.000
40.000 40.000 50.000 10.000
2
30.000 30.000 30.000 20.000
40.000 40.000 40.000 20.000
5
5.729 15.143 3.996 25.837
6.013 14.372 4.818 10.671
80.115 63.292 84.477 15.120
64.095 80.924 70.029 15.74744436670293
39.472 85.116 71.369 5.553
0
 3
10.000 10.000 50.000 10.000
40.000 10.000 50.9661040800581 10.000
40.000 40.000 50.000 10.000
2
30.000 30.000 30.000 20.000
40.000 40.000 40.000 20.000
5
5.729 15.143 3.996 25.837
6.013 14.372 4.818 10.671
80.115 63.292 84.96291652289682 15.120
64.095 80.924 70.029 15.74744436670293
39.472 85.116 72.06363785181492 5.553
0
 3
10.000 10.000 50.000 10.000
40.000 10.000 50.9661040800581 10.000
40.000 40.000 50.000 10.000
2
30.000 30.000 30.000 20.000
40.000 40.000 40.000 20.000
5
5.729 15.143 3.996 25.837
6.013 14.372 4.818 11.285102790232827
80.115 63.292 84.96291652289682 15.120
64.095 80.924 70.029 15.74744436670293
39.472 85.116 72.67566488438055 5.553
0
 3
10.000 10.000 50.000 10.000
40.000 10.000 50.9661040800581 10.000
40.000 40.000 50.000 10.89540561727416
2
30.000 30.000 30.000 20.000
40.000 40.000 40.000 20.000
5
5.729 15.143 3.996 25.837
6.013 14.372 4.818 11.285102790232827
80.115 63.292 84.96291652289682 15.120
64.095 80.924 70.029 15.74744436670293
39.472 85.116 72.67566488438055 5.553
0
 3
10.000 10.000 50.000 10.000
40.000 10.000 51.219861131766976 10.000
40.000 40.000 50.000 10.89540561727416
2
30.000 30.000 30.787057368701163 20.000
40.000 40.000 40.000 20.000
5
5.729 15.143 3.996 25.837
6.013 14.372 4.818 12.169672589379822
80.115 63.292 84.96291652289682 15.120
64.095 80.924 70.029 15.74744436670293
39.472 85.116 72.67566488438055 5.553
0
 3
10.000 10.000 50.000 10.000
40.000 10.000 51.219861131766976 10.000
40.000 40.000 50.000 10.89540561727416
2
30.000 30.000 30.787057368701163 20.000
40.000 40.897526923182255 40.000 20.000
5
5.729 15.143 4.635408214127903 25.837
6.013 14.372 4.818 12.169672589379822
80.115 63.292 84.96291652289682 15.120
64.095 80.924 70.029 15.74744436670293
39.472 85.116 72.67566488438055 5.553
0
 3
10.000 10.000 50.000 10.000
40.000 10.000 51.219861131766976 10.000
40.000 40.51646067399203 50.000 10.89540561727416
2
30.000 30.000 30.787057368701163 20.128299631926932
40.000 40.897526923182255 40.000 20.000
5
5.729 15.143 4.635408214127903 25.837
6.013 14.372 4.818 12.169672589379822
80.115 63.292 84.96291652289682 15.120
64.095 80.924 70.029 15.74744436670293
39.472 85.116 72.67566488438055 5.553
0
 3
10.000 10.000 50.000 10.000
40.000 10.000 51.219861131766976 10.000
40.000 40.51646067399203 50.343828752057796 10.89540561727416
2
30.571866538226903 30.000 30.787057368701163 20.128299631926932
40.000 40.897526923182255 40.000 20.000
5
5.729 15.143 4.635408214127903 25.837
6.013 14.372 5.37263216776346 12.169672589379822
80.115 63.292 84.96291652289682 15.120
64.095 80.924 70.029 15.74744436670293
39.472 85.116 72.67566488438055 5.553
0
 3
10.428063836405636 10.000 50.000 10.000
40.000 10.000 51.219861131766976 10.000
40.000 40.51646067399203 50.343828752057796 10.89540561727416
2
30.571866538226903 30.000 30.787057368701163 20.128299631926932
40.000 40.897526923182255 40.000 20.000
5
5.729 15.143 4.635408214127903 25.837
6.013 14.372 5.37263216776346 12.169672589379822
80.115 63.292 84.96291652289682 15.120
64.095 80.924 70.029 15.74744436670293
39.472 85.116 72.67566488438055 5.553
0

670.737
0.000
73.834
 670.737
0.000
0.000
 670.737
0.000
1299.431
 670.737
0.000
601.103
 2356.073
0.000
601.103
 2513.284
1828.683
2872.906
 2513.284
2033.306
2841.831
 4188.130
2160.166
2841.831
 4414.624
2985.208
3105.441
 5285.175
2985.208
3105.441

Given the following C code and unoptimized assembly code, your task is to generate highly optimized x86-64 assembly code.
C Code:

```c
// AOJ 1127: Building a Space Station
// 2017.9.19 bal4u@uu
// 2017.11.23

#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>

#define R 10
long long x[101], y[101], z[101], r[101];
char f[101];

char buf[100], *p;

long long dbl2int()
{
	int n = 0;
	while (*p >= '0') n = (n<<3) + (n<<1) + (*p++ & 0xf);
	if (*p == '.') p++;
	while (*p >= '0') n = (n<<3) + (n<<1) + (*p++ & 0xf);
	return n << R;
}

long long dist(long long dx, long long dy, long long dz)
{
	return (long long)sqrt((double)(dx*dx + dy*dy + dz*dz));
}

int main()
{
    int i, j, n, cnt, nx;
	long long ans, min, d;

    while (fgets(buf, 10, stdin) && *buf != '0') {
		n = atoi(buf);
		memset(f, 0, n);
		for (i = 0; i < n; i++) {
			fgets(p=buf, 100, stdin);
			x[i] = dbl2int(), p++, y[i] = dbl2int(), p++, z[i] = dbl2int(), p++, r[i] = dbl2int();
		}
        ans = 0, f[1] = 1, cnt = 1;
        while (cnt < n) {
            for (nx = -1, min = 1LL<<60, i = 0; i < n; i++) {
                if (f[i] == 0) continue;
                for (j = 0; j < n; j++) {
                    if (f[j]) continue;
					d = dist(x[i]-x[j], y[i]-y[j], z[i]-z[j]) - (r[i]+r[j]);
					if (nx < 0 || d < min) min = d, nx = j;
                }
            }
            f[nx] = 1, cnt++; if (min > 0) ans += min;
        }
		ans = (ans+512) >> R;
        printf("%lld.%03lld\n", ans/1000, ans%1000);
    }
    return 0;
}```

Unoptimized Assembly Code:

```assembly
	.file	"temp.c"
	.text
	.globl	x
	.bss
	.align 32
	.type	x, @object
	.size	x, 808
x:
	.zero	808
	.globl	y
	.align 32
	.type	y, @object
	.size	y, 808
y:
	.zero	808
	.globl	z
	.align 32
	.type	z, @object
	.size	z, 808
z:
	.zero	808
	.globl	r
	.align 32
	.type	r, @object
	.size	r, 808
r:
	.zero	808
	.globl	f
	.align 32
	.type	f, @object
	.size	f, 101
f:
	.zero	101
	.globl	buf
	.align 32
	.type	buf, @object
	.size	buf, 100
buf:
	.zero	100
	.globl	p
	.align 8
	.type	p, @object
	.size	p, 8
p:
	.zero	8
	.text
	.globl	dbl2int
	.type	dbl2int, @function
dbl2int:
.LFB6:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	movl	$0, -4(%rbp)
	jmp	.L2
.L3:
	movl	-4(%rbp), %eax
	leal	0(,%rax,8), %edx
	movl	-4(%rbp), %eax
	addl	%eax, %eax
	leal	(%rdx,%rax), %ecx
	movq	p(%rip), %rax
	leaq	1(%rax), %rdx
	movq	%rdx, p(%rip)
	movzbl	(%rax), %eax
	movsbl	%al, %eax
	andl	$15, %eax
	addl	%ecx, %eax
	movl	%eax, -4(%rbp)
.L2:
	movq	p(%rip), %rax
	movzbl	(%rax), %eax
	cmpb	$47, %al
	jg	.L3
	movq	p(%rip), %rax
	movzbl	(%rax), %eax
	cmpb	$46, %al
	jne	.L5
	movq	p(%rip), %rax
	addq	$1, %rax
	movq	%rax, p(%rip)
	jmp	.L5
.L6:
	movl	-4(%rbp), %eax
	leal	0(,%rax,8), %edx
	movl	-4(%rbp), %eax
	addl	%eax, %eax
	leal	(%rdx,%rax), %ecx
	movq	p(%rip), %rax
	leaq	1(%rax), %rdx
	movq	%rdx, p(%rip)
	movzbl	(%rax), %eax
	movsbl	%al, %eax
	andl	$15, %eax
	addl	%ecx, %eax
	movl	%eax, -4(%rbp)
.L5:
	movq	p(%rip), %rax
	movzbl	(%rax), %eax
	cmpb	$47, %al
	jg	.L6
	movl	-4(%rbp), %eax
	sall	$10, %eax
	cltq
	popq	%rbp
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE6:
	.size	dbl2int, .-dbl2int
	.globl	dist
	.type	dist, @function
dist:
.LFB7:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	subq	$32, %rsp
	movq	%rdi, -8(%rbp)
	movq	%rsi, -16(%rbp)
	movq	%rdx, -24(%rbp)
	movq	-8(%rbp), %rax
	imulq	%rax, %rax
	movq	%rax, %rdx
	movq	-16(%rbp), %rax
	imulq	%rax, %rax
	addq	%rax, %rdx
	movq	-24(%rbp), %rax
	imulq	%rax, %rax
	addq	%rdx, %rax
	pxor	%xmm1, %xmm1
	cvtsi2sdq	%rax, %xmm1
	movq	%xmm1, %rax
	movq	%rax, %xmm0
	call	sqrt@PLT
	cvttsd2siq	%xmm0, %rax
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE7:
	.size	dist, .-dist
	.section	.rodata
.LC0:
	.string	"%lld.%03lld\n"
	.text
	.globl	main
	.type	main, @function
main:
.LFB8:
	.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
	jmp	.L11
.L26:
	leaq	buf(%rip), %rax
	movq	%rax, %rdi
	call	atoi@PLT
	movl	%eax, -28(%rbp)
	movl	-28(%rbp), %eax
	cltq
	movq	%rax, %rdx
	movl	$0, %esi
	leaq	f(%rip), %rax
	movq	%rax, %rdi
	call	memset@PLT
	movl	$0, -44(%rbp)
	jmp	.L12
.L13:
	movq	stdin(%rip), %rdx
	leaq	buf(%rip), %rax
	movq	%rax, p(%rip)
	movq	p(%rip), %rax
	movl	$100, %esi
	movq	%rax, %rdi
	call	fgets@PLT
	movl	$0, %eax
	call	dbl2int
	movl	-44(%rbp), %edx
	movslq	%edx, %rdx
	leaq	0(,%rdx,8), %rcx
	leaq	x(%rip), %rdx
	movq	%rax, (%rcx,%rdx)
	movq	p(%rip), %rax
	addq	$1, %rax
	movq	%rax, p(%rip)
	movl	$0, %eax
	call	dbl2int
	movl	-44(%rbp), %edx
	movslq	%edx, %rdx
	leaq	0(,%rdx,8), %rcx
	leaq	y(%rip), %rdx
	movq	%rax, (%rcx,%rdx)
	movq	p(%rip), %rax
	addq	$1, %rax
	movq	%rax, p(%rip)
	movl	$0, %eax
	call	dbl2int
	movl	-44(%rbp), %edx
	movslq	%edx, %rdx
	leaq	0(,%rdx,8), %rcx
	leaq	z(%rip), %rdx
	movq	%rax, (%rcx,%rdx)
	movq	p(%rip), %rax
	addq	$1, %rax
	movq	%rax, p(%rip)
	movl	$0, %eax
	call	dbl2int
	movl	-44(%rbp), %edx
	movslq	%edx, %rdx
	leaq	0(,%rdx,8), %rcx
	leaq	r(%rip), %rdx
	movq	%rax, (%rcx,%rdx)
	addl	$1, -44(%rbp)
.L12:
	movl	-44(%rbp), %eax
	cmpl	-28(%rbp), %eax
	jl	.L13
	movq	$0, -24(%rbp)
	movb	$1, 1+f(%rip)
	movl	$1, -36(%rbp)
	jmp	.L14
.L24:
	movl	$-1, -32(%rbp)
	movabsq	$1152921504606846976, %rax
	movq	%rax, -16(%rbp)
	movl	$0, -44(%rbp)
	jmp	.L15
.L23:
	movl	-44(%rbp), %eax
	cltq
	leaq	f(%rip), %rdx
	movzbl	(%rax,%rdx), %eax
	testb	%al, %al
	je	.L28
	movl	$0, -40(%rbp)
	jmp	.L18
.L22:
	movl	-40(%rbp), %eax
	cltq
	leaq	f(%rip), %rdx
	movzbl	(%rax,%rdx), %eax
	testb	%al, %al
	jne	.L29
	movl	-44(%rbp), %eax
	cltq
	leaq	0(,%rax,8), %rdx
	leaq	z(%rip), %rax
	movq	(%rdx,%rax), %rax
	movl	-40(%rbp), %edx
	movslq	%edx, %rdx
	leaq	0(,%rdx,8), %rcx
	leaq	z(%rip), %rdx
	movq	(%rcx,%rdx), %rcx
	subq	%rcx, %rax
	movq	%rax, %rdx
	movl	-44(%rbp), %eax
	cltq
	leaq	0(,%rax,8), %rcx
	leaq	y(%rip), %rax
	movq	(%rcx,%rax), %rax
	movl	-40(%rbp), %ecx
	movslq	%ecx, %rcx
	leaq	0(,%rcx,8), %rsi
	leaq	y(%rip), %rcx
	movq	(%rsi,%rcx), %rsi
	subq	%rsi, %rax
	movq	%rax, %rcx
	movl	-44(%rbp), %eax
	cltq
	leaq	0(,%rax,8), %rsi
	leaq	x(%rip), %rax
	movq	(%rsi,%rax), %rax
	movl	-40(%rbp), %esi
	movslq	%esi, %rsi
	leaq	0(,%rsi,8), %rdi
	leaq	x(%rip), %rsi
	movq	(%rdi,%rsi), %rsi
	subq	%rsi, %rax
	movq	%rcx, %rsi
	movq	%rax, %rdi
	call	dist
	movl	-44(%rbp), %edx
	movslq	%edx, %rdx
	leaq	0(,%rdx,8), %rcx
	leaq	r(%rip), %rdx
	movq	(%rcx,%rdx), %rsi
	movl	-40(%rbp), %edx
	movslq	%edx, %rdx
	leaq	0(,%rdx,8), %rcx
	leaq	r(%rip), %rdx
	movq	(%rcx,%rdx), %rdx
	addq	%rsi, %rdx
	subq	%rdx, %rax
	movq	%rax, -8(%rbp)
	cmpl	$0, -32(%rbp)
	js	.L21
	movq	-8(%rbp), %rax
	cmpq	-16(%rbp), %rax
	jge	.L20
.L21:
	movq	-8(%rbp), %rax
	movq	%rax, -16(%rbp)
	movl	-40(%rbp), %eax
	movl	%eax, -32(%rbp)
	jmp	.L20
.L29:
	nop
.L20:
	addl	$1, -40(%rbp)
.L18:
	movl	-40(%rbp), %eax
	cmpl	-28(%rbp), %eax
	jl	.L22
	jmp	.L17
.L28:
	nop
.L17:
	addl	$1, -44(%rbp)
.L15:
	movl	-44(%rbp), %eax
	cmpl	-28(%rbp), %eax
	jl	.L23
	movl	-32(%rbp), %eax
	cltq
	leaq	f(%rip), %rdx
	movb	$1, (%rax,%rdx)
	addl	$1, -36(%rbp)
	cmpq	$0, -16(%rbp)
	jle	.L14
	movq	-16(%rbp), %rax
	addq	%rax, -24(%rbp)
.L14:
	movl	-36(%rbp), %eax
	cmpl	-28(%rbp), %eax
	jl	.L24
	movq	-24(%rbp), %rax
	addq	$512, %rax
	sarq	$10, %rax
	movq	%rax, -24(%rbp)
	movq	-24(%rbp), %rsi
	movabsq	$2361183241434822607, %rdx
	movq	%rsi, %rax
	imulq	%rdx
	movq	%rdx, %rax
	sarq	$7, %rax
	movq	%rsi, %rdx
	sarq	$63, %rdx
	subq	%rdx, %rax
	movq	%rax, %rcx
	imulq	$1000, %rcx, %rax
	subq	%rax, %rsi
	movq	%rsi, %rcx
	movq	-24(%rbp), %rsi
	movabsq	$2361183241434822607, %rdx
	movq	%rsi, %rax
	imulq	%rdx
	movq	%rdx, %rax
	sarq	$7, %rax
	sarq	$63, %rsi
	movq	%rsi, %rdx
	subq	%rdx, %rax
	movq	%rcx, %rdx
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
.L11:
	movq	stdin(%rip), %rax
	movq	%rax, %rdx
	movl	$10, %esi
	leaq	buf(%rip), %rax
	movq	%rax, %rdi
	call	fgets@PLT
	testq	%rax, %rax
	je	.L25
	movzbl	buf(%rip), %eax
	cmpb	$48, %al
	jne	.L26
.L25:
	movl	$0, %eax
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE8:
	.size	main, .-main
	.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	x
	.bss
	.align 32
	.type	x, @object
	.size	x, 808
x:
	.zero	808
	.globl	y
	.align 32
	.type	y, @object
	.size	y, 808
y:
	.zero	808
	.globl	z
	.align 32
	.type	z, @object
	.size	z, 808
z:
	.zero	808
	.globl	r
	.align 32
	.type	r, @object
	.size	r, 808
r:
	.zero	808
	.globl	f
	.align 32
	.type	f, @object
	.size	f, 101
f:
	.zero	101
	.globl	buf
	.align 32
	.type	buf, @object
	.size	buf, 100
buf:
	.zero	100
	.globl	p
	.align 8
	.type	p, @object
	.size	p, 8
p:
	.zero	8
	.text
	.globl	dbl2int
	.type	dbl2int, @function
dbl2int:
.LFB6:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	movl	$0, -4(%rbp)
	jmp	.L2
.L3:
	movl	-4(%rbp), %eax
	leal	0(,%rax,8), %edx
	movl	-4(%rbp), %eax
	addl	%eax, %eax
	leal	(%rdx,%rax), %ecx
	movq	p(%rip), %rax
	leaq	1(%rax), %rdx
	movq	%rdx, p(%rip)
	movzbl	(%rax), %eax
	movsbl	%al, %eax
	andl	$15, %eax
	addl	%ecx, %eax
	movl	%eax, -4(%rbp)
.L2:
	movq	p(%rip), %rax
	movzbl	(%rax), %eax
	cmpb	$47, %al
	jg	.L3
	movq	p(%rip), %rax
	movzbl	(%rax), %eax
	cmpb	$46, %al
	jne	.L5
	movq	p(%rip), %rax
	addq	$1, %rax
	movq	%rax, p(%rip)
	jmp	.L5
.L6:
	movl	-4(%rbp), %eax
	leal	0(,%rax,8), %edx
	movl	-4(%rbp), %eax
	addl	%eax, %eax
	leal	(%rdx,%rax), %ecx
	movq	p(%rip), %rax
	leaq	1(%rax), %rdx
	movq	%rdx, p(%rip)
	movzbl	(%rax), %eax
	movsbl	%al, %eax
	andl	$15, %eax
	addl	%ecx, %eax
	movl	%eax, -4(%rbp)
.L5:
	movq	p(%rip), %rax
	movzbl	(%rax), %eax
	cmpb	$47, %al
	jg	.L6
	movl	-4(%rbp), %eax
	sall	$10, %eax
	cltq
	popq	%rbp
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE6:
	.size	dbl2int, .-dbl2int
	.globl	dist
	.type	dist, @function
dist:
.LFB7:
	.cfi_startproc
	endbr64
	pushq	%rbp
	.cfi_def_cfa_offset 16
	.cfi_offset 6, -16
	movq	%rsp, %rbp
	.cfi_def_cfa_register 6
	subq	$32, %rsp
	movq	%rdi, -8(%rbp)
	movq	%rsi, -16(%rbp)
	movq	%rdx, -24(%rbp)
	movq	-8(%rbp), %rax
	imulq	%rax, %rax
	movq	%rax, %rdx
	movq	-16(%rbp), %rax
	imulq	%rax, %rax
	addq	%rax, %rdx
	movq	-24(%rbp), %rax
	imulq	%rax, %rax
	addq	%rdx, %rax
	pxor	%xmm1, %xmm1
	cvtsi2sdq	%rax, %xmm1
	movq	%xmm1, %rax
	movq	%rax, %xmm0
	call	sqrt@PLT
	cvttsd2siq	%xmm0, %rax
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE7:
	.size	dist, .-dist
	.section	.rodata
.LC0:
	.string	"%lld.%03lld\n"
	.text
	.globl	main
	.type	main, @function
main:
.LFB8:
	.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
	jmp	.L11
.L26:
	leaq	buf(%rip), %rax
	movq	%rax, %rdi
	call	atoi@PLT
	movl	%eax, -28(%rbp)
	movl	-28(%rbp), %eax
	cltq
	movq	%rax, %rdx
	movl	$0, %esi
	leaq	f(%rip), %rax
	movq	%rax, %rdi
	call	memset@PLT
	movl	$0, -44(%rbp)
	jmp	.L12
.L13:
	movq	stdin(%rip), %rdx
	leaq	buf(%rip), %rax
	movq	%rax, p(%rip)
	movq	p(%rip), %rax
	movl	$100, %esi
	movq	%rax, %rdi
	call	fgets@PLT
	movl	$0, %eax
	call	dbl2int
	movl	-44(%rbp), %edx
	movslq	%edx, %rdx
	leaq	0(,%rdx,8), %rcx
	leaq	x(%rip), %rdx
	movq	%rax, (%rcx,%rdx)
	movq	p(%rip), %rax
	addq	$1, %rax
	movq	%rax, p(%rip)
	movl	$0, %eax
	call	dbl2int
	movl	-44(%rbp), %edx
	movslq	%edx, %rdx
	leaq	0(,%rdx,8), %rcx
	leaq	y(%rip), %rdx
	movq	%rax, (%rcx,%rdx)
	movq	p(%rip), %rax
	addq	$1, %rax
	movq	%rax, p(%rip)
	movl	$0, %eax
	call	dbl2int
	movl	-44(%rbp), %edx
	movslq	%edx, %rdx
	leaq	0(,%rdx,8), %rcx
	leaq	z(%rip), %rdx
	movq	%rax, (%rcx,%rdx)
	movq	p(%rip), %rax
	addq	$1, %rax
	movq	%rax, p(%rip)
	movl	$0, %eax
	call	dbl2int
	movl	-44(%rbp), %edx
	movslq	%edx, %rdx
	leaq	0(,%rdx,8), %rcx
	leaq	r(%rip), %rdx
	movq	%rax, (%rcx,%rdx)
	addl	$1, -44(%rbp)
.L12:
	movl	-44(%rbp), %eax
	cmpl	-28(%rbp), %eax
	jl	.L13
	movq	$0, -24(%rbp)
	movb	$1, 1+f(%rip)
	movl	$1, -36(%rbp)
	jmp	.L14
.L24:
	movl	$-1, -32(%rbp)
	movabsq	$1152921504606846976, %rax
	movq	%rax, -16(%rbp)
	movl	$0, -44(%rbp)
	jmp	.L15
.L23:
	movl	-44(%rbp), %eax
	cltq
	leaq	f(%rip), %rdx
	movzbl	(%rax,%rdx), %eax
	testb	%al, %al
	je	.L28
	movl	$0, -40(%rbp)
	jmp	.L18
.L22:
	movl	-40(%rbp), %eax
	cltq
	leaq	f(%rip), %rdx
	movzbl	(%rax,%rdx), %eax
	testb	%al, %al
	jne	.L29
	movl	-44(%rbp), %eax
	cltq
	leaq	0(,%rax,8), %rdx
	leaq	z(%rip), %rax
	movq	(%rdx,%rax), %rax
	movl	-40(%rbp), %edx
	movslq	%edx, %rdx
	leaq	0(,%rdx,8), %rcx
	leaq	z(%rip), %rdx
	movq	(%rcx,%rdx), %rcx
	subq	%rcx, %rax
	movq	%rax, %rdx
	movl	-44(%rbp), %eax
	cltq
	leaq	0(,%rax,8), %rcx
	leaq	y(%rip), %rax
	movq	(%rcx,%rax), %rax
	movl	-40(%rbp), %ecx
	movslq	%ecx, %rcx
	leaq	0(,%rcx,8), %rsi
	leaq	y(%rip), %rcx
	movq	(%rsi,%rcx), %rsi
	subq	%rsi, %rax
	movq	%rax, %rcx
	movl	-44(%rbp), %eax
	cltq
	leaq	0(,%rax,8), %rsi
	leaq	x(%rip), %rax
	movq	(%rsi,%rax), %rax
	movl	-40(%rbp), %esi
	movslq	%esi, %rsi
	leaq	0(,%rsi,8), %rdi
	leaq	x(%rip), %rsi
	movq	(%rdi,%rsi), %rsi
	subq	%rsi, %rax
	movq	%rcx, %rsi
	movq	%rax, %rdi
	call	dist
	movl	-44(%rbp), %edx
	movslq	%edx, %rdx
	leaq	0(,%rdx,8), %rcx
	leaq	r(%rip), %rdx
	movq	(%rcx,%rdx), %rsi
	movl	-40(%rbp), %edx
	movslq	%edx, %rdx
	leaq	0(,%rdx,8), %rcx
	leaq	r(%rip), %rdx
	movq	(%rcx,%rdx), %rdx
	addq	%rsi, %rdx
	subq	%rdx, %rax
	movq	%rax, -8(%rbp)
	cmpl	$0, -32(%rbp)
	js	.L21
	movq	-8(%rbp), %rax
	cmpq	-16(%rbp), %rax
	jge	.L20
.L21:
	movq	-8(%rbp), %rax
	movq	%rax, -16(%rbp)
	movl	-40(%rbp), %eax
	movl	%eax, -32(%rbp)
	jmp	.L20
.L29:
	nop
.L20:
	addl	$1, -40(%rbp)
.L18:
	movl	-40(%rbp), %eax
	cmpl	-28(%rbp), %eax
	jl	.L22
	jmp	.L17
.L28:
	nop
.L17:
	addl	$1, -44(%rbp)
.L15:
	movl	-44(%rbp), %eax
	cmpl	-28(%rbp), %eax
	jl	.L23
	movl	-32(%rbp), %eax
	cltq
	leaq	f(%rip), %rdx
	movb	$1, (%rax,%rdx)
	addl	$1, -36(%rbp)
	cmpq	$0, -16(%rbp)
	jle	.L14
	movq	-16(%rbp), %rax
	addq	%rax, -24(%rbp)
.L14:
	movl	-36(%rbp), %eax
	cmpl	-28(%rbp), %eax
	jl	.L24
	movq	-24(%rbp), %rax
	addq	$512, %rax
	sarq	$10, %rax
	movq	%rax, -24(%rbp)
	movq	-24(%rbp), %rsi
	movabsq	$2361183241434822607, %rdx
	movq	%rsi, %rax
	imulq	%rdx
	movq	%rdx, %rax
	sarq	$7, %rax
	movq	%rsi, %rdx
	sarq	$63, %rdx
	subq	%rdx, %rax
	movq	%rax, %rcx
	imulq	$1000, %rcx, %rax
	subq	%rax, %rsi
	movq	%rsi, %rcx
	movq	-24(%rbp), %rsi
	movabsq	$2361183241434822607, %rdx
	movq	%rsi, %rax
	imulq	%rdx
	movq	%rdx, %rax
	sarq	$7, %rax
	sarq	$63, %rsi
	movq	%rsi, %rdx
	subq	%rdx, %rax
	movq	%rcx, %rdx
	movq	%rax, %rsi
	leaq	.LC0(%rip), %rax
	movq	%rax, %rdi
	movl	$0, %eax
	call	printf@PLT
.L11:
	movq	stdin(%rip), %rax
	movq	%rax, %rdx
	movl	$10, %esi
	leaq	buf(%rip), %rax
	movq	%rax, %rdi
	call	fgets@PLT
	testq	%rax, %rax
	je	.L25
	movzbl	buf(%rip), %eax
	cmpb	$48, %al
	jne	.L26
.L25:
	movl	$0, %eax
	leave
	.cfi_def_cfa 7, 8
	ret
	.cfi_endproc
.LFE8:
	.size	main, .-main
	.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:
