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

```asm
<ks2>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  sub    $0x60,%rsp
  mov    %rdi,-0x38(%rbp)
  mov    %esi,-0x3c(%rbp)
  mov    %rdx,-0x48(%rbp)
  mov    %rcx,-0x50(%rbp)
  mov    %r8,-0x58(%rbp)
  cmpl   $0x1,-0x3c(%rbp)
  jg     L217
  mov    -0x58(%rbp),%rax
  movsd  D27(%rip),%xmm0
  movsd  %xmm0,(%rax)
  pxor   %xmm0,%xmm0
  jmp    L158
L217:
  mov    -0x50(%rbp),%rax
  movl   $0x0,(%rax)
  mov    -0x50(%rbp),%rax
  mov    (%rax),%edx
  mov    -0x48(%rbp),%rax
  mov    %edx,(%rax)
  movl   $0x0,-0x2c(%rbp)
  jmp    L24
L175:
  mov    -0x2c(%rbp),%eax
  cltq
  lea    0x0(,%rax,4),%rdx
  mov    -0x38(%rbp),%rax
  add    %rdx,%rax
  mov    (%rax),%eax
  cmp    $0x1,%eax
  jg     L115
  mov    -0x2c(%rbp),%eax
  cltq
  lea    0x0(,%rax,4),%rdx
  mov    -0x38(%rbp),%rax
  add    %rdx,%rax
  mov    (%rax),%eax
  test   %eax,%eax
  js     L143
  mov    -0x2c(%rbp),%eax
  cltq
  lea    0x0(,%rax,4),%rdx
  mov    -0x38(%rbp),%rax
  add    %rdx,%rax
  mov    (%rax),%eax
  test   %eax,%eax
  jne    L172
  mov    -0x48(%rbp),%rax
  mov    (%rax),%eax
  lea    0x1(%rax),%edx
  mov    -0x48(%rbp),%rax
  mov    %edx,(%rax)
L172:
  mov    -0x2c(%rbp),%eax
  cltq
  lea    0x0(,%rax,4),%rdx
  mov    -0x38(%rbp),%rax
  add    %rdx,%rax
  mov    (%rax),%eax
  cmp    $0x1,%eax
  jne    L5
  mov    -0x50(%rbp),%rax
  mov    (%rax),%eax
  lea    0x1(%rax),%edx
  mov    -0x50(%rbp),%rax
  mov    %edx,(%rax)
  jmp    L5
L115:
  nop
  jmp    L5
L143:
  nop
L5:
  addl   $0x1,-0x2c(%rbp)
L24:
  mov    -0x2c(%rbp),%eax
  cmp    -0x3c(%rbp),%eax
  jl     L175
  mov    -0x50(%rbp),%rax
  mov    (%rax),%edx
  mov    -0x48(%rbp),%rax
  mov    (%rax),%eax
  cmp    %eax,%edx
  cmovle %edx,%eax
  test   %eax,%eax
  jne    L146
  mov    -0x58(%rbp),%rax
  movsd  D27(%rip),%xmm0
  movsd  %xmm0,(%rax)
  pxor   %xmm0,%xmm0
  jmp    L158
L146:
  mov    -0x48(%rbp),%rax
  mov    (%rax),%eax
  pxor   %xmm0,%xmm0
  cvtsi2sd %eax,%xmm0
  movsd  %xmm0,-0x18(%rbp)
  mov    -0x50(%rbp),%rax
  mov    (%rax),%eax
  pxor   %xmm0,%xmm0
  cvtsi2sd %eax,%xmm0
  movsd  %xmm0,-0x10(%rbp)
  pxor   %xmm0,%xmm0
  movsd  %xmm0,-0x28(%rbp)
  movsd  -0x28(%rbp),%xmm0
  movsd  %xmm0,-0x20(%rbp)
  movl   $0x0,-0x2c(%rbp)
  jmp    L162
L85:
  mov    -0x2c(%rbp),%eax
  cltq
  lea    0x0(,%rax,4),%rdx
  mov    -0x38(%rbp),%rax
  add    %rdx,%rax
  mov    (%rax),%eax
  cmp    $0x1,%eax
  jg     L174
  mov    -0x2c(%rbp),%eax
  cltq
  lea    0x0(,%rax,4),%rdx
  mov    -0x38(%rbp),%rax
  add    %rdx,%rax
  mov    (%rax),%eax
  test   %eax,%eax
  js     L192
  mov    -0x2c(%rbp),%eax
  cltq
  lea    0x0(,%rax,4),%rdx
  mov    -0x38(%rbp),%rax
  add    %rdx,%rax
  mov    (%rax),%eax
  test   %eax,%eax
  jne    L133
  movsd  D27(%rip),%xmm0
  divsd  -0x18(%rbp),%xmm0
  movsd  -0x28(%rbp),%xmm1
  addsd  %xmm1,%xmm0
  movsd  %xmm0,-0x28(%rbp)
L133:
  mov    -0x2c(%rbp),%eax
  cltq
  lea    0x0(,%rax,4),%rdx
  mov    -0x38(%rbp),%rax
  add    %rdx,%rax
  mov    (%rax),%eax
  cmp    $0x1,%eax
  jne    L25
  movsd  D27(%rip),%xmm0
  movapd %xmm0,%xmm1
  divsd  -0x10(%rbp),%xmm1
  movsd  -0x28(%rbp),%xmm0
  subsd  %xmm1,%xmm0
  movsd  %xmm0,-0x28(%rbp)
L25:
  movsd  -0x28(%rbp),%xmm0
  movq   D15(%rip),%xmm1
  andpd  %xmm1,%xmm0
  comisd -0x20(%rbp),%xmm0
  jbe    L126
  movsd  -0x28(%rbp),%xmm0
  movq   D15(%rip),%xmm1
  andpd  %xmm1,%xmm0
  jmp    L113
L126:
  movsd  -0x20(%rbp),%xmm0
L113:
  movsd  %xmm0,-0x20(%rbp)
  jmp    L56
L174:
  nop
  jmp    L56
L192:
  nop
L56:
  addl   $0x1,-0x2c(%rbp)
L162:
  mov    -0x2c(%rbp),%eax
  cmp    -0x3c(%rbp),%eax
  jl     L85
  movsd  -0x18(%rbp),%xmm0
  mulsd  -0x10(%rbp),%xmm0
  movsd  -0x18(%rbp),%xmm1
  addsd  -0x10(%rbp),%xmm1
  divsd  %xmm1,%xmm0
  movq   %xmm0,%rax
  movq   %rax,%xmm0
  call   <sqrt@plt>
  movq   %xmm0,%rax
  mov    %rax,-0x8(%rbp)
  movsd  -0x8(%rbp),%xmm1
  movsd  D8(%rip),%xmm0
  addsd  %xmm0,%xmm1
  movsd  D65(%rip),%xmm0
  divsd  -0x8(%rbp),%xmm0
  addsd  %xmm1,%xmm0
  movsd  %xmm0,-0x28(%rbp)
  movsd  -0x28(%rbp),%xmm0
  mulsd  -0x20(%rbp),%xmm0
  movsd  %xmm0,-0x28(%rbp)
  mov    -0x28(%rbp),%rax
  movq   %rax,%xmm0
  call   <probks@plt>
  movq   %xmm0,%rax
  mov    -0x58(%rbp),%rdx
  mov    %rax,(%rdx)
  movsd  -0x28(%rbp),%xmm0
L158:
  movq   %xmm0,%rax
  movq   %rax,%xmm0
  leave
  ret
```

tool_calls: name: parse_data
arguments: label: D27
datatype: f64
name: parse_data
arguments: label: D15
datatype: qword
name: parse_data
arguments: label: D8
datatype: byte[8]
name: parse_data
arguments: label: D65
datatype: f64

tool: D27: 1

tool: D15: 9223372036854775807

tool: {"D8": [0xb8,0x1e,0x85,0xeb,0x51,0xb8,0xbe,0x3f]}

tool: D65: 0.11

assistant: ```c
double ks2(int *cls, int len, int *n0, int *n1, double *kstail) {
  int i;
  double en0, en1, en;
  double y, ymax;
  if (len <= 1) {
    *kstail = 1.0;
    return 0;
  }
  *n0 = *n1 = 0;
  for (i = 0; i < len; i++) {
    if (cls[i] > 1)
      continue;
    if (cls[i] < 0)
      continue;
    if (cls[i] == 0)
      ++*n0;
    if (cls[i] == 1)
      ++*n1;
  }
  if (((*n0) < (*n1) ? (*n0) : (*n1)) == 0) {
    *kstail = 1.0;
    return 0;
  }
  en0 = (double)*n0;
  en1 = (double)*n1;
  ymax = y = 0.0;
  ;
  for (i = 0; i < len; i++) {
    if (cls[i] > 1)
      continue;
    if (cls[i] < 0)
      continue;
    if (cls[i] == 0)
      y += 1.0 / en0;
    if (cls[i] == 1)
      y -= 1.0 / en1;
    ymax = ((ymax) < (fabs(y)) ? (fabs(y)) : (ymax));
  }
  en = sqrt(en0 * en1 / (en0 + en1));
  y = en + .12 + (0.11 / en);
  y *= ymax;
  *kstail = probks(y);
  return y;
}
```