user: 请从给定的汇编指令推导出C源代码：

```asm
<ls_closest_approach>:
  endbr64
  push   %r15
  mov    %r8,%r15
  push   %r14
  mov    %rsi,%r14
  push   %r13
  mov    %r9,%r13
  push   %r12
  push   %rbp
  mov    %rcx,%rbp
  push   %rbx
  mov    %rdx,%rbx
  sub    $0xf8,%rsp
  movsd  (%rdx),%xmm2
  movsd  (%r8),%xmm1
  mov    %rdi,0x8(%rsp)
  movsd  (%r9),%xmm0
  mov    %fs:0x28,%rax
  mov    %rax,0xe8(%rsp)
  xor    %eax,%eax
  ucomisd (%rcx),%xmm2
  jp     L459
  jne    L459
  movsd  0x8(%rdx),%xmm2
  ucomisd 0x8(%rcx),%xmm2
  jp     L459
  jne    L459
  movsd  0x10(%rdx),%xmm2
  ucomisd 0x10(%rcx),%xmm2
  jp     L459
  jne    L459
  ucomisd %xmm0,%xmm1
  jp     L77
  jne    L77
  movsd  0x8(%r8),%xmm0
  ucomisd 0x8(%r9),%xmm0
  jp     L77
  je     L58
L77:
  mov    0x8(%rsp),%rdi
  xor    %eax,%eax
  mov    %rbx,%rsi
  call   <cp_3d@plt>
  mov    0xe8(%rsp),%rax
  sub    %fs:0x28,%rax
  jne    L359
  add    $0xf8,%rsp
  mov    %rbx,%rcx
  mov    %r13,%rdx
  mov    %r15,%rsi
  pop    %rbx
  mov    %r14,%rdi
  pop    %rbp
  xor    %eax,%eax
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  jmp    1140 <p_ls_closest_approach@plt>
  nopl   0x0(%rax)
L459:
  ucomisd %xmm0,%xmm1
  jp     L452
  jne    L452
  movsd  0x8(%r13),%xmm0
  ucomisd 0x8(%r15),%xmm0
  jp     L452
  jne    L452
  movsd  0x10(%r15),%xmm0
  ucomisd 0x10(%r13),%xmm0
  jp     L452
  jne    L452
  mov    %r15,%rsi
  mov    %r14,%rdi
  xor    %eax,%eax
  call   <cp_3d@plt>
  mov    0x8(%rsp),%rdi
  mov    %r15,%rcx
  mov    %rbp,%rdx
  mov    %rbx,%rsi
  xor    %eax,%eax
  call   <p_ls_closest_approach@plt>
L452:
  lea    0xa0(%rsp),%r9
  mov    %rbx,%rdx
  mov    %rbp,%rsi
  xor    %eax,%eax
  lea    0x80(%rsp),%r12
  mov    %r9,%rdi
  mov    %r9,0x10(%rsp)
  call   <projmatrix@plt>
  mov    %rbx,%rdx
  mov    %rbp,%rsi
  mov    %r12,%rdi
  xor    %eax,%eax
  call   <diff_3d@plt>
  mov    0x10(%rsp),%rsi
  mov    %r12,%rdx
  xor    %eax,%eax
  lea    0x20(%rsp),%rdi
  call   <mat_vmult_3d@plt>
  mov    %rbx,%rdx
  mov    %r15,%rsi
  mov    %r12,%rdi
  xor    %eax,%eax
  call   <diff_3d@plt>
  mov    0x10(%rsp),%r9
  mov    %r12,%rdx
  xor    %eax,%eax
  lea    0x40(%rsp),%r10
  mov    %r10,%rdi
  mov    %r9,%rsi
  mov    %r10,0x10(%rsp)
  mov    %r9,0x18(%rsp)
  call   <mat_vmult_3d@plt>
  mov    %rbx,%rdx
  mov    %r13,%rsi
  mov    %r12,%rdi
  xor    %eax,%eax
  call   <diff_3d@plt>
  lea    0x60(%rsp),%r11
  mov    %r12,%rdx
  xor    %eax,%eax
  mov    0x18(%rsp),%rsi
  mov    %r11,%rdi
  mov    %r11,0x18(%rsp)
  call   <mat_vmult_3d@plt>
  mov    0x10(%rsp),%rdx
  mov    %r12,%rdi
  xor    %eax,%eax
  mov    0x18(%rsp),%rsi
  call   <diff_3d@plt>
  xor    %eax,%eax
  mov    %r12,%rdi
  call   <norm2_2d@plt>
  mov    0x10(%rsp),%r10
  test   %eax,%eax
  jne    L17
  movsd  0x50(%rsp),%xmm1
  pxor   %xmm0,%xmm0
  comisd %xmm1,%xmm0
  ja     L361
L75:
  movsd  0x30(%rsp),%xmm2
  comisd %xmm2,%xmm1
  jbe    L73
  movsd  0x70(%rsp),%xmm3
  comisd %xmm2,%xmm3
  ja     L175
L73:
  comisd %xmm0,%xmm1
  jb     L408
  comisd %xmm1,%xmm2
  jae    L304
L408:
  movsd  0x70(%rsp),%xmm1
  comisd %xmm0,%xmm1
  jb     L375
  comisd %xmm1,%xmm2
  jae    L431
L375:
  mov    0x8(%rsp),%rdi
  mov    %rbx,%rsi
  xor    %eax,%eax
  call   <cp_3d@plt>
  pxor   %xmm0,%xmm0
  mov    %r15,%rsi
  mov    %r12,%rdi
  movsd  0x50(%rsp),%xmm1
  movsd  0x70(%rsp),%xmm2
  mov    $0x1,%eax
  subsd  %xmm1,%xmm0
  subsd  %xmm1,%xmm2
  movapd %xmm0,%xmm1
  movsd  D25(%rip),%xmm0
  divsd  %xmm2,%xmm1
  subsd  %xmm1,%xmm0
  movsd  %xmm1,0x8(%rsp)
  call   <scale_3d@plt>
  mov    %r13,%rsi
  mov    %r14,%rdi
  mov    $0x1,%eax
  movsd  0x8(%rsp),%xmm1
  movapd %xmm1,%xmm0
  call   <scale_3d@plt>
  mov    %r12,%rdx
  mov    %r14,%rsi
  mov    %r14,%rdi
  xor    %eax,%eax
  call   <sum_3d@plt>
  jmp    L141
  nopl   0x0(%rax)
L17:
  mov    %eax,0x10(%rsp)
  mov    %r10,%rsi
  xor    %eax,%eax
  mov    %r12,%rdi
  call   <inner_2d@plt>
  mov    0x10(%rsp),%edx
  pxor   %xmm1,%xmm1
  pxor   %xmm0,%xmm0
  neg    %eax
  pxor   %xmm3,%xmm3
  movsd  0x70(%rsp),%xmm2
  movsd  0x30(%rsp),%xmm5
  cvtsi2sd %edx,%xmm0
  cvtsi2sd %eax,%xmm1
  divsd  %xmm0,%xmm1
  movsd  0x50(%rsp),%xmm0
  comisd %xmm3,%xmm1
  jb     L3
  movsd  D25(%rip),%xmm4
  comisd %xmm1,%xmm4
  jae    L395
L3:
  mov    %r15,%rcx
  mov    %rbp,%rdx
  mov    %rbx,%rsi
  mov    %r12,%rdi
  xor    %eax,%eax
  call   <p_ls_closest_approach@plt>
  mov    %r12,%rsi
  mov    %r15,%rdi
  xor    %eax,%eax
  call   <cart2_3d@plt>
  mov    0x8(%rsp),%rdi
  mov    %r12,%rsi
  mov    %eax,0x10(%rsp)
  xor    %eax,%eax
  call   <cp_3d@plt>
  mov    %r15,%rsi
  mov    %r14,%rdi
  xor    %eax,%eax
  call   <cp_3d@plt>
  mov    %r13,%rcx
  mov    %rbp,%rdx
  mov    %rbx,%rsi
  mov    %r12,%rdi
  xor    %eax,%eax
  call   <p_ls_closest_approach@plt>
  mov    %r12,%rsi
  mov    %r13,%rdi
  xor    %eax,%eax
  call   <cart2_3d@plt>
  mov    0x10(%rsp),%r9d
  cmp    %eax,%r9d
  jg     L444
  pxor   %xmm5,%xmm5
  cvtsi2sd %r9d,%xmm5
  movsd  %xmm5,0x10(%rsp)
L94:
  mov    %rbx,%rcx
  mov    %r13,%rdx
  mov    %r15,%rsi
  mov    %r12,%rdi
  xor    %eax,%eax
  call   <p_ls_closest_approach@plt>
  xor    %eax,%eax
  mov    %r12,%rsi
  mov    %rbx,%rdi
  call   <cart2_3d@plt>
  pxor   %xmm0,%xmm0
  movsd  0x10(%rsp),%xmm7
  cvtsi2sd %eax,%xmm0
  comisd %xmm0,%xmm7
  ja     L217
L371:
  mov    %rbp,%rcx
  mov    %r13,%rdx
  mov    %r15,%rsi
  mov    %r12,%rdi
  xor    %eax,%eax
  call   <p_ls_closest_approach@plt>
  xor    %eax,%eax
  mov    %r12,%rsi
  mov    %rbp,%rdi
  call   <cart2_3d@plt>
  pxor   %xmm0,%xmm0
  movsd  0x10(%rsp),%xmm6
  cvtsi2sd %eax,%xmm0
  comisd %xmm0,%xmm6
  ja     L51
L141:
  mov    0xe8(%rsp),%rax
  sub    %fs:0x28,%rax
  jne    L359
  add    $0xf8,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
  nopw   0x0(%rax,%rax,1)
L395:
  mulsd  %xmm1,%xmm2
  movapd %xmm4,%xmm6
  subsd  %xmm1,%xmm6
  mulsd  %xmm6,%xmm0
  addsd  %xmm0,%xmm2
  divsd  %xmm5,%xmm2
  comisd %xmm3,%xmm2
  jb     L3
  comisd %xmm2,%xmm4
  jb     L3
  movapd %xmm6,%xmm0
  mov    %r15,%rsi
  mov    %r12,%rdi
  mov    $0x1,%eax
  movsd  %xmm2,0x18(%rsp)
  movsd  %xmm1,0x10(%rsp)
  call   <scale_3d@plt>
  mov    %r13,%rsi
  mov    %r14,%rdi
  mov    $0x1,%eax
  movsd  0x10(%rsp),%xmm1
  movapd %xmm1,%xmm0
  call   <scale_3d@plt>
  mov    %r12,%rdx
  mov    %r14,%rsi
  mov    %r14,%rdi
  xor    %eax,%eax
  call   <sum_3d@plt>
  mov    D25(%rip),%rax
  mov    %rbx,%rsi
  mov    %r12,%rdi
  movsd  0x18(%rsp),%xmm2
  movq   %rax,%xmm4
  mov    $0x1,%eax
  subsd  %xmm2,%xmm4
  movsd  %xmm2,0x10(%rsp)
  movapd %xmm4,%xmm0
  call   <scale_3d@plt>
  movsd  0x10(%rsp),%xmm2
  movapd %xmm2,%xmm0
  jmp    L274
  nopl   (%rax)
L361:
  comisd 0x70(%rsp),%xmm0
  jbe    L75
  mov    0x8(%rsp),%rdi
  xor    %eax,%eax
  mov    %rbx,%rsi
  call   <cp_3d@plt>
  movsd  0x50(%rsp),%xmm0
  comisd 0x70(%rsp),%xmm0
  jmp    L413
  nopl   0x0(%rax)
L444:
  pxor   %xmm7,%xmm7
  mov    0x8(%rsp),%rdi
  mov    %r12,%rsi
  cvtsi2sd %eax,%xmm7
  xor    %eax,%eax
  movsd  %xmm7,0x10(%rsp)
  call   <cp_3d@plt>
  mov    %r13,%rsi
  mov    %r14,%rdi
  xor    %eax,%eax
  call   <cp_3d@plt>
  jmp    L94
  nopw   0x0(%rax,%rax,1)
L51:
  mov    %r12,%rsi
  mov    %r14,%rdi
  xor    %eax,%eax
  call   <cp_3d@plt>
  mov    0x8(%rsp),%rdi
  mov    %rbp,%rsi
  xor    %eax,%eax
  call   <cp_3d@plt>
  jmp    L141
  nopl   0x0(%rax)
L217:
  mov    %r12,%rsi
  mov    %r14,%rdi
  xor    %eax,%eax
  movsd  %xmm0,0x10(%rsp)
  call   <cp_3d@plt>
  mov    0x8(%rsp),%rdi
  mov    %rbx,%rsi
  xor    %eax,%eax
  call   <cp_3d@plt>
  jmp    L371
  nop
L431:
  mov    %r13,%rsi
  mov    %r14,%rdi
  xor    %eax,%eax
  call   <cp_3d@plt>
  movsd  0x70(%rsp),%xmm1
L142:
  movsd  D25(%rip),%xmm0
  divsd  0x30(%rsp),%xmm1
  mov    %rbx,%rsi
  mov    %r12,%rdi
  mov    $0x1,%eax
  movsd  %xmm1,0x10(%rsp)
  subsd  %xmm1,%xmm0
  call   <scale_3d@plt>
  movsd  0x10(%rsp),%xmm1
  movapd %xmm1,%xmm0
L274:
  mov    0x8(%rsp),%rbx
  mov    %rbp,%rsi
  mov    $0x1,%eax
  mov    %rbx,%rdi
  call   <scale_3d@plt>
  mov    %r12,%rdx
  mov    %rbx,%rsi
  mov    %rbx,%rdi
  xor    %eax,%eax
  call   <sum_3d@plt>
  jmp    L141
  nop
L304:
  mov    %r15,%rsi
  mov    %r14,%rdi
  xor    %eax,%eax
  call   <cp_3d@plt>
  movsd  0x50(%rsp),%xmm1
  jmp    L142
  nopl   (%rax)
L175:
  mov    0x8(%rsp),%rdi
  xor    %eax,%eax
  mov    %rbp,%rsi
  call   <cp_3d@plt>
  movsd  0x70(%rsp),%xmm0
  comisd 0x50(%rsp),%xmm0
L413:
  cmovb  %r13,%r15
  mov    %r14,%rdi
  xor    %eax,%eax
  mov    %r15,%rsi
  call   <cp_3d@plt>
  jmp    L141
L359:
  call   <__stack_chk_fail@plt>
L58:
  movsd  0x10(%r8),%xmm0
  ucomisd 0x10(%r9),%xmm0
  jp     L77
  jne    L77
  xor    %eax,%eax
  mov    %rbx,%rsi
  call   <cp_3d@plt>
  mov    0xe8(%rsp),%rax
  sub    %fs:0x28,%rax
  jne    L359
  add    $0xf8,%rsp
  mov    %r15,%rsi
  mov    %r14,%rdi
  xor    %eax,%eax
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  jmp    1170 <cp_3d@plt>
```

tool_calls: name: unpack_data
arguments: label: D25
type_guessed: f64

tool: D25: 1

assistant: ```c
void ls_closest_approach(double p0[3], double p1[3], double a0[3], double b0[3], double c0[3], double d0[3]) {
  double q1[3], q2[3], b[3], c[3], d[3], scr[3];
  double mat[9];
  double alpha, beta, d2;
  {
    char ab0, cd0;
    ab0 = (a0[0] == b0[0] && a0[1] == b0[1] && a0[2] == b0[2]);
    cd0 = (c0[0] == d0[0] && c0[1] == d0[1] && c0[2] == d0[2]);
    if (ab0) {
      cp_3d(p0, a0);
      if (cd0) {
        cp_3d(p1, c0);
        return;
      } else {
        p_ls_closest_approach(p1, c0, d0, a0);
        return;
      }
    }
    if (cd0) {
      cp_3d(p1, c0);
      p_ls_closest_approach(p0, a0, b0, c0);
    }
  }
  projmatrix(mat, b0, a0);
  diff_3d(scr, b0, a0);
  mat_vmult_3d(b, mat, scr);
  diff_3d(scr, c0, a0);
  mat_vmult_3d(c, mat, scr);
  diff_3d(scr, d0, a0);
  mat_vmult_3d(d, mat, scr);
  diff_3d(scr, d, c);
  d2 = norm2_2d(scr);
  if (d2 == 0)
    goto parallel;
  alpha = -inner_2d(scr, c) / d2;
  beta = ((1.0 - alpha) * c[2] + alpha * d[2]) / b[2];
  if (alpha >= 0 && alpha <= 1 && beta >= 0 && beta <= 1) {
    scale_3d(scr, c0, (1.0 - alpha));
    scale_3d(p1, d0, alpha);
    sum_3d(p1, p1, scr);
    scale_3d(scr, a0, (1.0 - beta));
    scale_3d(p0, b0, beta);
    sum_3d(p0, p0, scr);
    return;
  }
  {
    char found_one = 0;
    double d2, c2;
    p_ls_closest_approach(scr, a0, b0, c0);
    d2 = cart2_3d(c0, scr);
    cp_3d(p0, scr);
    cp_3d(p1, c0);
    p_ls_closest_approach(scr, a0, b0, d0);
    c2 = cart2_3d(d0, scr);
    if (c2 < d2) {
      d2 = c2;
      cp_3d(p0, scr);
      cp_3d(p1, d0);
    }
    p_ls_closest_approach(scr, c0, d0, a0);
    c2 = cart2_3d(a0, scr);
    if (c2 < d2) {
      d2 = c2;
      cp_3d(p1, scr);
      cp_3d(p0, a0);
    }
    p_ls_closest_approach(scr, c0, d0, b0);
    c2 = cart2_3d(b0, scr);
    if (c2 < d2) {
      d2 = c2;
      cp_3d(p1, scr);
      cp_3d(p0, b0);
    }
  }
  return;
parallel:
  if (c[2] < 0 && d[2] < 0) {
    cp_3d(p0, a0);
    cp_3d(p1, (c[2] >= d[2]) ? c0 : d0);
    return;
  }
  if (c[2] > b[2] && d[2] > b[2]) {
    cp_3d(p0, b0);
    cp_3d(p1, (c[2] <= d[2]) ? c0 : d0);
    return;
  }
  if (c[2] >= 0 && c[2] <= b[2]) {
    cp_3d(p1, c0);
    alpha = c[2] / b[2];
    scale_3d(scr, a0, (1.0 - alpha));
    scale_3d(p0, b0, alpha);
    sum_3d(p0, p0, scr);
    return;
  }
  if (d[2] >= 0 && d[2] <= b[2]) {
    cp_3d(p1, d0);
    alpha = d[2] / b[2];
    scale_3d(scr, a0, (1.0 - alpha));
    scale_3d(p0, b0, alpha);
    sum_3d(p0, p0, scr);
    return;
  }
  cp_3d(p0, a0);
  alpha = (0 - c[2]) / (d[2] - c[2]);
  scale_3d(scr, c0, (1.0 - alpha));
  scale_3d(p1, d0, alpha);
  sum_3d(p1, p1, scr);
  return;
}
```