user: Please show me the C implementation that matches the assembly code listed below:

```asm
<BlastKarlinLHtoK>:
  endbr64
  push   %r15
  pxor   %xmm3,%xmm3
  push   %r14
  push   %r13
  push   %r12
  push   %rbp
  push   %rbx
  sub    $0x68,%rsp
  comisd %xmm0,%xmm3
  mov    %esi,(%rsp)
  mov    %edx,0x20(%rsp)
  movsd  %xmm0,0x40(%rsp)
  jae    L233
  comisd %xmm1,%xmm3
  jae    L233
  divsd  %xmm0,%xmm1
  mov    %rdi,%rbx
  cvttsd2si %xmm0,%edi
  movsd  %xmm1,0x58(%rsp)
  call   <exp@plt>
  pxor   %xmm4,%xmm4
  cmpl   $0xffffffff,(%rsp)
  cvtsi2sd %eax,%xmm4
  je     L308
  cmpl   $0x1,0x20(%rsp)
  je     L308
  mov    0x20(%rsp),%r13d
  mov    (%rsp),%r14d
  movsd  %xmm4,0x28(%rsp)
  mov    %r13d,%r15d
  sub    %r14d,%r15d
  imul   $0x64,%r15d,%eax
  mov    %r15d,0x3c(%rsp)
  cmp    $0x10c8e0,%eax
  jle    L54
L233:
  movsd  D82(%rip),%xmm2
L87:
  add    $0x68,%rsp
  movapd %xmm2,%xmm0
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
L54:
  lea    0x8(,%rax,8),%edi
  call   <malloc@plt>
  mov    %rax,%rbp
  test   %rax,%rax
  je     L233
  mov    D33(%rip),%rax
  movslq %r14d,%r14
  movl   $0x0,0x24(%rsp)
  pxor   %xmm3,%xmm3
  mov    %r14,%rsi
  movsd  0x28(%rsp),%xmm4
  mov    (%rsp),%edi
  lea    (%rbx,%r14,8),%r12
  mov    %rax,0x0(%rbp)
  movslq %r13d,%rax
  not    %esi
  movapd %xmm3,%xmm5
  sub    %r14,%rax
  mov    %esi,0x38(%rsp)
  movslq %r15d,%r13
  shl    $0x3,%rax
  movl   $0x0,0x14(%rsp)
  mov    %rax,0x50(%rsp)
  add    %rbp,%rax
  mov    %rax,0x18(%rsp)
  mov    D33(%rip),%rax
  movl   $0x0,0x8(%rsp)
  mov    %rax,0x48(%rsp)
L36:
  mov    0x18(%rsp),%rax
  add    %edi,0x14(%rsp)
  mov    0x20(%rsp),%edi
  add    %edi,0x24(%rsp)
  mov    %rax,%r15
  cmp    %rax,%rbp
  ja     L365
  mov    0x3c(%rsp),%r10d
  mov    %rax,%rdi
  mov    %r10d,%r15d
  nopl   0x0(%rax,%rax,1)
L110:
  movslq %r10d,%rdx
  movslq %r15d,%rax
  mov    %rdi,%rcx
  mov    %rdi,%r9
  lea    0x0(,%rdx,8),%r8
  shl    $0x3,%rax
  sub    %r8,%rcx
  sub    %rax,%r9
  lea    (%r12,%r8,1),%rsi
  cmp    %r9,%rcx
  jb     L100
  sub    %r8,%rax
  mov    %rax,%r9
  shr    $0x3,%r9
  add    $0x1,%r9
  cmp    $0x7,%rax
  jbe    L126
  mov    $0xfffffffffffffff8,%rax
  mov    %r9,%r11
  movapd %xmm3,%xmm1
  add    %r14,%rdx
  sub    %r8,%rax
  shr    %r11
  lea    (%rbx,%rdx,8),%rdx
  add    %rdi,%rax
  shl    $0x4,%r11
  mov    %rax,%r8
  sub    %r11,%r8
  nopl   0x0(%rax,%rax,1)
L304:
  movupd (%rax),%xmm0
  movupd (%rdx),%xmm7
  sub    $0x10,%rax
  add    $0x10,%rdx
  shufpd $0x1,%xmm0,%xmm0
  mulpd  %xmm7,%xmm0
  addsd  %xmm0,%xmm1
  unpckhpd %xmm0,%xmm0
  addsd  %xmm0,%xmm1
  cmp    %r8,%rax
  jne    L304
  mov    %r9,%rdx
  and    $0xfffffffffffffffe,%rdx
  mov    %rdx,%rax
  neg    %rax
  shl    $0x3,%rax
  add    %rax,%rcx
  sub    %rax,%rsi
  cmp    %r9,%rdx
  je     L197
L145:
  movsd  (%rsi),%xmm0
  mulsd  (%rcx),%xmm0
  addsd  %xmm0,%xmm1
L197:
  cmp    $0x1,%r10d
  mov    %rdi,%rax
  adc    $0xffffffff,%r10d
  sub    %rbp,%rax
  sar    $0x3,%rax
  cmp    %r13,%rax
  setle  %al
  sub    $0x8,%rdi
  movzbl %al,%eax
  movsd  %xmm1,0x8(%rdi)
  sub    %eax,%r15d
  cmp    %rdi,%rbp
  jbe    L110
  mov    0x18(%rsp),%rax
  mov    %rax,%r15
  sub    %rbp,%r15
  not    %r15
  and    $0xfffffffffffffff8,%r15
  add    %rax,%r15
L365:
  mov    0x14(%rsp),%eax
  movapd %xmm4,%xmm0
  movsd  %xmm5,0x30(%rsp)
  movsd  %xmm4,0x28(%rsp)
  lea    -0x1(%rax),%edi
  call   <pow@plt>
  mov    0x14(%rsp),%eax
  movsd  0x28(%rsp),%xmm4
  pxor   %xmm3,%xmm3
  movsd  0x30(%rsp),%xmm5
  movapd %xmm0,%xmm1
  test   %eax,%eax
  je     L115
  mov    0x38(%rsp),%eax
  movapd %xmm3,%xmm0
  lea    0x8(%r15,%rax,8),%rdx
L62:
  mulsd  %xmm4,%xmm1
  movsd  0x8(%r15),%xmm2
  add    $0x8,%r15
  mulsd  %xmm1,%xmm2
  addsd  %xmm2,%xmm0
  cmp    %rdx,%r15
  jne    L62
L220:
  mov    0x24(%rsp),%eax
  test   %eax,%eax
  js     L270
  lea    0x1(%rax),%esi
  je     L335
  mov    %esi,%ecx
  lea    0x8(%rdx),%rax
  shr    %ecx
  sub    $0x1,%ecx
  shl    $0x4,%rcx
  lea    0x18(%rdx,%rcx,1),%rcx
  nopl   0x0(%rax)
L385:
  movsd  (%rax),%xmm1
  add    $0x10,%rax
  addsd  %xmm1,%xmm0
  movsd  -0x8(%rax),%xmm1
  addsd  %xmm1,%xmm0
  cmp    %rcx,%rax
  jne    L385
  mov    %esi,%eax
  and    $0xfffffffe,%eax
  mov    %eax,%ecx
  lea    (%rdx,%rcx,8),%rdx
  cmp    %esi,%eax
  je     L270
L335:
  addsd  0x8(%rdx),%xmm0
L270:
  addl   $0x1,0x8(%rsp)
  mov    0x8(%rsp),%eax
  pxor   %xmm2,%xmm2
  movapd %xmm0,%xmm1
  cvtsi2sd %eax,%xmm2
  divsd  %xmm2,%xmm1
  addsd  %xmm1,%xmm5
  cmp    $0x64,%eax
  je     L317
  mov    0x50(%rsp),%rsi
  mov    (%rsp),%edi
  add    %rsi,0x18(%rsp)
  sub    %edi,0x38(%rsp)
  comisd D35(%rip),%xmm1
  jbe    L317
  movsd  %xmm0,0x48(%rsp)
  jmp    L36
  cs nopw 0x0(%rax,%rax,1)
L100:
  movapd %xmm3,%xmm1
  jmp    L197
L126:
  movapd %xmm3,%xmm1
  jmp    L145
L115:
  mov    %r15,%rdx
  movapd %xmm3,%xmm0
  jmp    L220
L308:
  movsd  D33(%rip),%xmm0
  movsd  0x58(%rsp),%xmm2
  movapd %xmm0,%xmm1
  divsd  %xmm4,%xmm1
  subsd  %xmm1,%xmm0
  mulsd  %xmm0,%xmm2
  jmp    L87
L317:
  movapd %xmm0,%xmm7
  divsd  0x48(%rsp),%xmm7
  comisd D79(%rip),%xmm7
  movsd  D82(%rip),%xmm2
  jae    L122
  movsd  D41(%rip),%xmm6
  comisd %xmm6,%xmm1
  jbe    L333
  mov    0x8(%rsp),%eax
L389:
  mulsd  %xmm7,%xmm0
  add    $0x1,%eax
  pxor   %xmm2,%xmm2
  cvtsi2sd %eax,%xmm2
  movapd %xmm0,%xmm1
  divsd  %xmm2,%xmm1
  comisd %xmm6,%xmm1
  addsd  %xmm1,%xmm5
  ja     L389
L333:
  mov    (%rsp),%eax
  mov    0x3c(%rsp),%r14d
  mov    %eax,%r13d
  neg    %r13d
  test   %r14d,%r14d
  jle    L194
  cmp    $0xffffffff,%eax
  jge    L194
  add    $0x8,%r12
  mov    $0x1,%ebx
  mov    %r13d,%edi
  movq   %xmm5,%r15
  jmp    L388
L207:
  add    $0x1,%ebx
  add    $0x8,%r12
  cmp    %ebx,%r14d
  jl     L81
  cmp    $0x1,%edi
  jle    L81
L388:
  ucomisd (%r12),%xmm3
  jp     L139
  je     L207
L139:
  mov    %ebx,%esi
  movsd  %xmm4,(%rsp)
  call   <gcd@plt>
  movsd  (%rsp),%xmm4
  pxor   %xmm3,%xmm3
  mov    %eax,%edi
  jmp    L207
L81:
  mov    %edi,%eax
  mov    %edi,%r13d
  movq   %r15,%xmm5
  neg    %eax
  mov    %eax,(%rsp)
L194:
  pxor   %xmm0,%xmm0
  cvtsi2sd %r13d,%xmm0
  mulsd  %xmm4,%xmm0
  comisd D40(%rip),%xmm0
  ja     L156
  mulsd  D18(%rip),%xmm5
  cvttsd2si %xmm5,%edi
  call   <exp@plt>
  mov    (%rsp),%r14d
  pxor   %xmm0,%xmm0
  mov    %eax,%ebx
  cvtsi2sd %r14d,%xmm0
  mulsd  0x40(%rsp),%xmm0
  imul   %r14d,%ebx
  cvttsd2si %xmm0,%edi
  call   <exp@plt>
  pxor   %xmm0,%xmm0
  pxor   %xmm2,%xmm2
  sub    $0x1,%eax
  cvtsi2sd %ebx,%xmm2
  cvtsi2sd %eax,%xmm0
  mulsd  0x58(%rsp),%xmm0
  divsd  %xmm0,%xmm2
L122:
  mov    %rbp,%rdi
  movsd  %xmm2,(%rsp)
  call   <free@plt>
  movsd  (%rsp),%xmm2
  jmp    L87
L156:
  mov    (%rsp),%edi
  movapd %xmm4,%xmm0
  movsd  %xmm5,0x8(%rsp)
  call   <pow@plt>
  movsd  0x8(%rsp),%xmm5
  mulsd  D18(%rip),%xmm5
  movsd  %xmm0,(%rsp)
  cvttsd2si %xmm5,%edi
  call   <exp@plt>
  movsd  0x58(%rsp),%xmm0
  pxor   %xmm2,%xmm2
  movsd  D33(%rip),%xmm4
  imul   %r13d,%eax
  subsd  (%rsp),%xmm4
  mulsd  %xmm4,%xmm0
  cvtsi2sd %eax,%xmm2
  divsd  %xmm0,%xmm2
  jmp    L122
```

tool_calls: name: unpack_data
arguments: tag: D82
data_type: f32[2]
name: unpack_data
arguments: tag: D33
data_type: f64
name: unpack_data
arguments: tag: D35
data_type: f64[2]
name: unpack_data
arguments: tag: D79
data_type: byte[16]
name: unpack_data
arguments: tag: D41
data_type: byte[8]
name: unpack_data
arguments: tag: D40
data_type: f64[2]
name: unpack_data
arguments: tag: D18
data_type: f32[2]

tool: {"D82": [0.0,-1.875]}

tool: D33: 1

tool: {"D35": [0.01,0.99999]}

tool: {"D79": [0x1d,0x77,0x4a,0x07,0xeb,0xff,0xef,0x3f,0x2d,0x43,0x1c,0xeb,0xe2,0x36,0x1a,0x3f]}

tool: {"D41": [0x2d,0x43,0x1c,0xeb,0xe2,0x36,0x1a,0x3f]}

tool: {"D40": [0.05,-2.0]}

tool: {"D18": [0.0,-2.0]}

assistant: ```c
double BlastKarlinLHtoK(double *sfp, int32_t min, int32_t max, double lambda, double H) {
  double *P0 = NULL;
  int32_t low;
  int32_t high;
  double K;
  double ratio;
  int32_t i, j;
  int32_t range, lo, hi, first, last;
  double sum;
  double Sum, av, oldsum, oldsum2;
  int32_t iter;
  double sumlimit;
  double *p, *ptrP, *ptr1, *ptr2, *ptr1e;
  double etolami, etolam;
  if (lambda <= 0. || H <= 0.) {
    return -1.;
  }
  low = min;
  high = max;
  range = high - low;
  av = H / lambda;
  etolam = exp((double)lambda);
  if (low == -1 || high == 1) {
    K = av;
    return K * (1.0 - 1. / etolam);
  }
  sumlimit = 0.01;
  iter = 100;
  if ((iter * range + 1) > (100 * ((1000) - (-10000)) + 1)) {
    return -1.;
  }
  P0 = (double *)malloc((iter * range + 1) * sizeof(*P0));
  if (P0 == NULL)
    return -1.;
  Sum = 0.;
  lo = hi = 0;
  p = &sfp[low];
  P0[0] = sum = oldsum = oldsum2 = 1.;
  for (j = 0; j < iter && sum > sumlimit; Sum += sum /= ++j) {
    first = last = range;
    lo += low;
    hi += high;
    for (ptrP = P0 + (hi - lo); ptrP >= P0; *ptrP-- = sum) {
      ptr1 = ptrP - first;
      ptr1e = ptrP - last;
      ptr2 = p + first;
      for (sum = 0.; ptr1 >= ptr1e;)
        sum += *ptr1-- * *ptr2++;
      if (first)
        --first;
      if (ptrP - P0 <= range)
        --last;
    }
    etolami = pow((double)etolam, lo - 1);
    for (sum = 0., i = lo; i != 0; ++i) {
      etolami *= etolam;
      sum += *++ptrP * etolami;
    }
    for (; i <= hi; ++i)
      sum += *++ptrP;
    oldsum2 = oldsum;
    oldsum = sum;
  }
  ratio = oldsum / oldsum2;
  if (ratio >= (1.0 - sumlimit * 0.001)) {
    K = -1.;
    goto CleanUp;
  }
  sumlimit *= 0.01;
  while (sum > sumlimit) {
    oldsum *= ratio;
    Sum += sum = oldsum / ++j;
  }
  for (i = 1, j = -low; i <= range && j > 1; ++i)
    if (p[i])
      j = gcd(j, i);
  if (j * etolam > 0.05) {
    etolami = pow((double)etolam, -j);
    K = j * exp((double)-2.0 * Sum) / (av * (1.0 - etolami));
  } else
    K = -j * exp((double)-2.0 * Sum) / (av * (exp(-j * (double)lambda) - 1));
CleanUp:
  if (P0 != NULL)
    free(P0);
  return K;
}
```