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

```asm
<convert>:
  endbr64
  pxor   %xmm3,%xmm3
  sub    $0x18,%rsp
  movapd %xmm0,%xmm4
  comisd %xmm0,%xmm3
  jae    L12
  movsd  D105(%rip),%xmm0
  comisd %xmm4,%xmm0
  ja     L61
L89:
  movsd  D41(%rip),%xmm0
  comisd %xmm4,%xmm0
  jae    L116
  mov    D48(%rip),%rax
  movsd  D43(%rip),%xmm5
  movq   %rax,%xmm1
  mov    $0x1,%eax
  jmp    L78
  nopl   0x0(%rax)
L16:
  comisd %xmm1,%xmm0
  jbe    L85
  add    $0x1,%eax
  addsd  %xmm1,%xmm3
  cmp    $0x65,%eax
  je     L102
L78:
  pxor   %xmm2,%xmm2
  movapd %xmm1,%xmm0
  cvtsi2sd %eax,%xmm2
  divsd  %xmm4,%xmm2
  mulsd  %xmm2,%xmm1
  comisd %xmm1,%xmm5
  jbe    L16
L102:
  movapd %xmm4,%xmm0
  movsd  %xmm3,0x8(%rsp)
  movsd  %xmm4,(%rsp)
  call   <exp@plt>
  movsd  0x8(%rsp),%xmm3
  movsd  (%rsp),%xmm4
  addsd  D48(%rip),%xmm3
  add    $0x18,%rsp
  mulsd  %xmm3,%xmm0
  divsd  %xmm4,%xmm0
  ret
  nopl   0x0(%rax)
L116:
  movsd  D48(%rip),%xmm0
  movapd %xmm3,%xmm1
  mov    $0x1,%eax
  movsd  D43(%rip),%xmm5
  jmp    L80
  nopl   0x0(%rax,%rax,1)
L39:
  add    $0x1,%eax
  cmp    $0x65,%eax
  je     L81
L80:
  pxor   %xmm3,%xmm3
  movapd %xmm4,%xmm2
  cvtsi2sd %eax,%xmm3
  divsd  %xmm3,%xmm2
  mulsd  %xmm2,%xmm0
  movapd %xmm0,%xmm2
  divsd  %xmm3,%xmm2
  addsd  %xmm2,%xmm1
  movapd %xmm1,%xmm3
  mulsd  %xmm5,%xmm3
  comisd %xmm2,%xmm3
  jbe    L39
L49:
  movapd %xmm4,%xmm0
  movsd  %xmm1,(%rsp)
  call   <log@plt>
  movsd  (%rsp),%xmm1
  addsd  %xmm1,%xmm0
  addsd  D107(%rip),%xmm0
  add    $0x18,%rsp
  ret
  cs nopw 0x0(%rax,%rax,1)
L12:
  lea    D63(%rip),%rdi
  movsd  %xmm0,(%rsp)
  call   <printf@plt>
  movsd  (%rsp),%xmm4
  pxor   %xmm3,%xmm3
  movsd  D105(%rip),%xmm0
  comisd %xmm4,%xmm0
  jbe    L89
L61:
  movapd %xmm4,%xmm0
  call   <log@plt>
  addsd  D107(%rip),%xmm0
  add    $0x18,%rsp
  ret
  nopw   0x0(%rax,%rax,1)
L85:
  subsd  %xmm0,%xmm3
  jmp    L102
  nopl   0x0(%rax)
L81:
  lea    D3(%rip),%rdi
  movsd  %xmm4,0x8(%rsp)
  movsd  %xmm1,(%rsp)
  call   <printf@plt>
  movsd  (%rsp),%xmm1
  movsd  0x8(%rsp),%xmm4
  jmp    L49
```

tool_calls: name: read_data
arguments: tag: D105
type_guessed: byte[8]
name: read_data
arguments: tag: D41
type_guessed: byte[8]
name: read_data
arguments: tag: D48
type_guessed: f64
name: read_data
arguments: tag: D43
type_guessed: byte[8]
name: read_data
arguments: tag: D107
type_guessed: f64
name: read_data
arguments: tag: D63
type_guessed: string
name: read_data
arguments: tag: D3
type_guessed: string

tool: {"D105": [0x0d,0xc6,0x40,0x2c,0x18,0xfa,0x21,0x00]}

tool: {"D41": [0xac,0xe8,0xf5,0xab,0xaf,0x9d,0x41,0x40]}

tool: D48: 1

tool: {"D43": [0x16,0x56,0xe7,0x9e,0xaf,0x03,0xc2,0x3c]}

tool: D107: 0.5772156649

tool: D63: Bad argument in convert


tool: D3: series failed in convert


assistant: ```c
double convert(double x) {
  int k;
  double fact, prev, sum, term;
  if (x <= 0.0)
    printf("Bad argument in convert\n");
  if (x < 5.0e-308)
    return log(x) + 0.5772156649;
  if (x <= -log(5.0e-16)) {
    sum = 0.0;
    fact = 1.0;
    for (k = 1; k <= 100; k++) {
      fact *= x / k;
      term = fact / k;
      sum += term;
      if (term < 5.0e-16 * sum)
        break;
    }
    if (k > 100)
      printf("series failed in convert\n");
    return sum + log(x) + 0.5772156649;
  } else {
    sum = 0.0;
    term = 1.0;
    for (k = 1; k <= 100; k++) {
      prev = term;
      term *= k / x;
      if (term < 5.0e-16)
        break;
      if (term < prev)
        sum += term;
      else {
        sum -= prev;
        break;
      }
    }
    return exp(x) * (1.0 + sum) / x;
  }
}
```