user: Demonstrate the C code that generates the assembly output below:

```asm
<CSPL_Stats_percentile>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  push   %rbx
  sub    $0x48,%rsp
  mov    %rdi,-0x38(%rbp)
  movsd  %xmm0,-0x40(%rbp)
  mov    %rsi,-0x48(%rbp)
  mov    -0x48(%rbp),%rax
  mov    $0x8,%esi
  mov    %eax,%edi
  call   <calloc@plt>
  mov    %rax,-0x20(%rbp)
  mov    -0x48(%rbp),%rax
  add    $0x1,%eax
  mov    $0x8,%esi
  mov    %eax,%edi
  call   <calloc@plt>
  mov    %rax,-0x18(%rbp)
  mov    -0x48(%rbp),%rax
  add    $0x1,%rax
  shl    $0x3,%eax
  mov    %eax,%edx
  mov    -0x38(%rbp),%rcx
  mov    -0x18(%rbp),%rax
  mov    %rcx,%rsi
  mov    %rax,%rdi
  call   <memcpy@plt>
  mov    -0x48(%rbp),%rdx
  mov    -0x18(%rbp),%rax
  mov    %rdx,%rsi
  mov    %rax,%rdi
  call   <CSPL_Sort_mergesort@plt>
  movq   $0x0,-0x30(%rbp)
  jmp    L36
L46:
  mov    -0x30(%rbp),%rax
  lea    0x0(,%rax,8),%rdx
  mov    -0x20(%rbp),%rax
  lea    (%rdx,%rax,1),%rbx
  mov    -0x48(%rbp),%rdx
  mov    -0x30(%rbp),%rax
  mov    %rdx,%rsi
  mov    %rax,%rdi
  call   <CSPL_Stats_percent_rank@plt>
  movq   %xmm0,%rax
  mov    %rax,(%rbx)
  mov    -0x30(%rbp),%rax
  lea    0x0(,%rax,8),%rdx
  mov    -0x20(%rbp),%rax
  add    %rdx,%rax
  movsd  (%rax),%xmm0
  comisd -0x40(%rbp),%xmm0
  jbe    L6
  cmpq   $0x0,-0x30(%rbp)
  jne    L6
  mov    -0x30(%rbp),%rax
  lea    0x0(,%rax,8),%rdx
  mov    -0x18(%rbp),%rax
  add    %rdx,%rax
  movsd  (%rax),%xmm0
  movsd  %xmm0,-0x28(%rbp)
  jmp    L29
L6:
  mov    -0x30(%rbp),%rax
  lea    0x0(,%rax,8),%rdx
  mov    -0x20(%rbp),%rax
  add    %rdx,%rax
  movsd  (%rax),%xmm0
  ucomisd -0x40(%rbp),%xmm0
  jp     L16
  ucomisd -0x40(%rbp),%xmm0
  jne    L16
  mov    -0x30(%rbp),%rax
  lea    0x0(,%rax,8),%rdx
  mov    -0x18(%rbp),%rax
  add    %rdx,%rax
  movsd  (%rax),%xmm0
  movsd  %xmm0,-0x28(%rbp)
  jmp    L29
L16:
  mov    -0x30(%rbp),%rax
  lea    0x0(,%rax,8),%rdx
  mov    -0x20(%rbp),%rax
  add    %rdx,%rax
  movsd  (%rax),%xmm0
  comisd -0x40(%rbp),%xmm0
  jbe    L50
  mov    -0x30(%rbp),%rax
  shl    $0x3,%rax
  lea    -0x8(%rax),%rdx
  mov    -0x38(%rbp),%rax
  add    %rdx,%rax
  movsd  (%rax),%xmm1
  pxor   %xmm2,%xmm2
  cvtsi2sdq -0x48(%rbp),%xmm2
  mov    -0x30(%rbp),%rax
  shl    $0x3,%rax
  lea    -0x8(%rax),%rdx
  mov    -0x20(%rbp),%rax
  add    %rdx,%rax
  movsd  (%rax),%xmm3
  movsd  -0x40(%rbp),%xmm0
  subsd  %xmm3,%xmm0
  movsd  D3(%rip),%xmm3
  divsd  %xmm3,%xmm0
  mulsd  %xmm0,%xmm2
  mov    -0x30(%rbp),%rax
  lea    0x0(,%rax,8),%rdx
  mov    -0x38(%rbp),%rax
  add    %rdx,%rax
  movsd  (%rax),%xmm0
  mov    -0x30(%rbp),%rax
  shl    $0x3,%rax
  lea    -0x8(%rax),%rdx
  mov    -0x38(%rbp),%rax
  add    %rdx,%rax
  movsd  (%rax),%xmm3
  subsd  %xmm3,%xmm0
  mulsd  %xmm2,%xmm0
  addsd  %xmm1,%xmm0
  movsd  %xmm0,-0x28(%rbp)
  jmp    L29
L50:
  mov    -0x30(%rbp),%rax
  lea    0x0(,%rax,8),%rdx
  mov    -0x18(%rbp),%rax
  add    %rdx,%rax
  movsd  (%rax),%xmm0
  movsd  %xmm0,-0x28(%rbp)
  addq   $0x1,-0x30(%rbp)
L36:
  mov    -0x30(%rbp),%rax
  cmp    -0x48(%rbp),%rax
  jl     L46
L29:
  mov    -0x18(%rbp),%rax
  mov    %rax,%rdi
  call   <free@plt>
  mov    -0x20(%rbp),%rax
  mov    %rax,%rdi
  call   <free@plt>
  movsd  -0x28(%rbp),%xmm0
  movq   %xmm0,%rax
  movq   %rax,%xmm0
  mov    -0x8(%rbp),%rbx
  leave
  ret
```

tool_calls: name: retrieve_data
arguments: label: D3
datatype: f64

tool: D3: 100

assistant: ```c
double CSPL_Stats_percentile(double *inval, double percentile, long n) {
  long i;
  double *incopy;
  double *rank;
  double answer;
  rank = (double *)calloc(n, sizeof(double));
  {
    incopy = (double *)calloc((n) - (0) + 1, sizeof(double));
    memcpy((incopy), &(inval)[(0)], sizeof(double) * ((n) - (0) + 1));
  };
  CSPL_Sort_mergesort(incopy, n);
  for (i = 0; i < n; i++) {
    rank[i] = CSPL_Stats_percent_rank(i, n);
    if ((rank[i] > percentile) && (0 == i)) {
      answer = incopy[i];
      break;
    }
    if (rank[i] == percentile) {
      answer = incopy[i];
      break;
    } else if (rank[i] > percentile) {
      answer = inval[i - 1] + (n * ((percentile - rank[i - 1]) / 100.)) * (inval[i] - inval[i - 1]);
      break;
    }
    answer = incopy[i];
  }
  free(incopy);
  free(rank);
  return (answer);
}
```