user: What is the c source code of the assembly code below?

```asm
<best_wf>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  sub    $0x40,%rsp
  mov    %edi,-0x24(%rbp)
  mov    %esi,-0x28(%rbp)
  mov    %edx,-0x2c(%rbp)
  mov    %ecx,-0x30(%rbp)
  mov    %r8,-0x38(%rbp)
  mov    %r9,-0x40(%rbp)
  mov    -0x28(%rbp),%eax
  mov    %eax,%edx
  shr    $0x1f,%edx
  add    %edx,%eax
  sar    %eax
  cmp    %eax,-0x30(%rbp)
  jl     L100
  movsd  D10(%rip),%xmm0
  jmp    L58
L100:
  mov    -0x30(%rbp),%edx
  mov    -0x28(%rbp),%esi
  mov    -0x24(%rbp),%eax
  mov    $0x0,%ecx
  mov    %eax,%edi
  call   <memory_compl@plt>
  movq   %xmm0,%rax
  mov    %rax,-0x10(%rbp)
  movsd  -0x10(%rbp),%xmm1
  movsd  D0(%rip),%xmm0
  addsd  %xmm1,%xmm0
  cvttsd2si %xmm0,%eax
  mov    %eax,-0x14(%rbp)
  mov    -0x14(%rbp),%edi
  mov    -0x30(%rbp),%ecx
  mov    -0x2c(%rbp),%edx
  mov    -0x28(%rbp),%esi
  mov    -0x24(%rbp),%eax
  mov    %edi,%r8d
  mov    %eax,%edi
  call   <cout_total@plt>
  movq   %xmm0,%rax
  mov    %rax,-0x10(%rbp)
  mov    -0x38(%rbp),%rax
  mov    -0x14(%rbp),%edx
  mov    %edx,(%rax)
  mov    -0x14(%rbp),%eax
  add    $0x1,%eax
  mov    %eax,-0x18(%rbp)
  jmp    L105
L86:
  mov    -0x18(%rbp),%edi
  mov    -0x30(%rbp),%ecx
  mov    -0x2c(%rbp),%edx
  mov    -0x28(%rbp),%esi
  mov    -0x24(%rbp),%eax
  mov    %edi,%r8d
  mov    %eax,%edi
  call   <cout_total@plt>
  movq   %xmm0,%rax
  mov    %rax,-0x8(%rbp)
  movsd  -0x10(%rbp),%xmm0
  comisd -0x8(%rbp),%xmm0
  ja     L1
  jmp    L101
L1:
  movsd  -0x8(%rbp),%xmm0
  movsd  %xmm0,-0x10(%rbp)
  mov    -0x38(%rbp),%rax
  mov    -0x18(%rbp),%edx
  mov    %edx,(%rax)
  addl   $0x1,-0x18(%rbp)
L105:
  mov    -0x24(%rbp),%eax
  sub    -0x28(%rbp),%eax
  cmp    %eax,-0x18(%rbp)
  jl     L86
L101:
  mov    -0x14(%rbp),%eax
  add    $0x1,%eax
  cmp    %eax,-0x18(%rbp)
  jne    L47
  mov    -0x14(%rbp),%eax
  sub    $0x1,%eax
  mov    %eax,-0x18(%rbp)
  jmp    L69
L37:
  mov    -0x18(%rbp),%edi
  mov    -0x30(%rbp),%ecx
  mov    -0x2c(%rbp),%edx
  mov    -0x28(%rbp),%esi
  mov    -0x24(%rbp),%eax
  mov    %edi,%r8d
  mov    %eax,%edi
  call   <cout_total@plt>
  movq   %xmm0,%rax
  mov    %rax,-0x8(%rbp)
  movsd  -0x10(%rbp),%xmm0
  comisd -0x8(%rbp),%xmm0
  ja     L40
  jmp    L47
L40:
  movsd  -0x8(%rbp),%xmm0
  movsd  %xmm0,-0x10(%rbp)
  mov    -0x38(%rbp),%rax
  mov    -0x18(%rbp),%edx
  mov    %edx,(%rax)
  subl   $0x1,-0x18(%rbp)
L69:
  cmpl   $0x0,-0x18(%rbp)
  jg     L37
L47:
  mov    -0x30(%rbp),%edx
  mov    -0x28(%rbp),%esi
  mov    -0x24(%rbp),%eax
  mov    $0x0,%ecx
  mov    %eax,%edi
  call   <memory_compl@plt>
  movq   %xmm0,%rax
  mov    -0x40(%rbp),%rdx
  mov    %rax,(%rdx)
  movsd  -0x10(%rbp),%xmm0
L58:
  movq   %xmm0,%rax
  movq   %rax,%xmm0
  leave
  ret
```

tool_calls: name: unpack_data
arguments: data_label: D10
data_type: byte[8]
name: unpack_data
arguments: data_label: D0
data_type: byte[8]

tool: {"D10": [0x00,0x00,0x00,0x00,0x00,0x00,0xf0,0xbf]}

tool: {"D0": [0x00,0x00,0x00,0x00,0x00,0x00,0x14,0x40]}

assistant: ```c
double best_wf(int n, int k, int w, int p, int *lmin, double *mem) {
  int u, l;
  double lwf, min;
  if (p >= k / 2)
    return -1;
  min = memory_compl(n, k, p, 0);
  u = min + 5;
  min = cout_total(n, k, w, p, u);
  *lmin = u;
  for (l = u + 1; l < n - k; ++l) {
    lwf = cout_total(n, k, w, p, l);
    if (lwf < min) {
      min = lwf;
      *lmin = l;
    } else
      break;
  }
  if (l == u + 1)
    for (l = u - 1; l > 0; --l) {
      lwf = cout_total(n, k, w, p, l);
      if (lwf < min) {
        min = lwf;
        *lmin = l;
      } else
        break;
    }
  *mem = memory_compl(n, k, p, 0);
  return min;
}
```