user: 请将这段汇编代码片段转换成等效的C代码：

```asm
<hex_to_double>:
  endbr64
  push   %r15
  push   %r14
  push   %r13
  push   %r12
  push   %rbp
  push   %rbx
  sub    $0x18,%rsp
  mov    %rdi,%rbx
L43:
  mov    %rbx,%rdx
  add    $0x1,%rbx
  movzbl -0x1(%rbx),%eax
  cmp    $0x20,%al
  je     L43
  cmp    $0xc,%al
  jg     L20
  cmp    $0x8,%al
  jg     L43
  mov    D10(%rip),%r14
L38:
  movq   %r14,%xmm0
  mulsd  D11(%rip),%xmm0
L32:
  add    $0x18,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
L20:
  mov    D10(%rip),%r14
  cmp    $0x2d,%al
  jne    L137
  movzbl (%rbx),%eax
  lea    0x2(%rdx),%rbx
  mov    D23(%rip),%r14
L137:
  cmp    $0x2e,%al
  jne    L38
  mov    %rbx,%rbp
L61:
  mov    %rbp,%r13
  add    $0x1,%rbp
  movzbl -0x1(%rbp),%r15d
  movsbl %r15b,%edi
  call   <hexdig@plt>
  test   %eax,%eax
  jns    L61
  cmp    %r13,%rbx
  jae    L131
  mov    %r13,%r12
  pxor   %xmm3,%xmm3
  movsd  %xmm3,0x8(%rsp)
L86:
  sub    $0x1,%r12
  movsbl (%r12),%edi
  call   <hexdig@plt>
  pxor   %xmm0,%xmm0
  cvtsi2sd %eax,%xmm0
  addsd  0x8(%rsp),%xmm0
  mulsd  D35(%rip),%xmm0
  movsd  %xmm0,0x8(%rsp)
  cmp    %r12,%rbx
  jne    L86
L105:
  and    $0xffffffdf,%r15d
  mov    $0x0,%edi
  cmp    $0x58,%r15b
  jne    L129
  movzbl 0x0(%rbp),%edi
  cmp    $0x2d,%dil
  je     L65
  add    $0x2,%r13
  mov    $0x1,%ebp
L101:
  mov    $0x0,%ebx
L134:
  movsbl %dil,%edi
  call   <hexdig@plt>
  test   %eax,%eax
  js     L149
  shl    $0x4,%ebx
  add    %eax,%ebx
  add    $0x1,%r13
  movzbl -0x1(%r13),%edi
  jmp    L134
L131:
  pxor   %xmm4,%xmm4
  movsd  %xmm4,0x8(%rsp)
  jmp    L105
L65:
  lea    0x2(%rbp),%r13
  movzbl 0x1(%rbp),%edi
  mov    $0xffffffff,%ebp
  jmp    L101
L149:
  imul   %ebp,%ebx
  mov    %ebx,%edi
L129:
  movsd  0x8(%rsp),%xmm0
  call   <ldexp@plt>
  movq   %r14,%xmm2
  mulsd  %xmm2,%xmm0
  jmp    L32
```

tool_calls: name: retrieve_data
arguments: tag: D10
datatype: f64
name: retrieve_data
arguments: tag: D11
datatype: f64
name: retrieve_data
arguments: tag: D23
datatype: byte[8]
name: retrieve_data
arguments: tag: D35
datatype: f64

tool: D10: 1

tool: D11: 0

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

tool: D35: 0.0625

assistant: ```c
double hex_to_double(char *s) {
  char c;
  char *p1;
  char *p2;
  int digit;
  int expon;
  int esign;
  double msign;
  double mant;
  double value;
  for (;;) {
    c = *s++;
    if (c == ' ')
      continue;
    if (c == '\n')
      continue;
    if (c == '\t')
      continue;
    if (c == '\f')
      continue;
    if (c != '\v')
      break;
  }
  msign = 1.0;
  if (c == '-') {
    msign = -1.0;
    c = *s++;
  }
  mant = 0.0;
  if (c != '.')
    return (msign * mant);
  p1 = s;
  for (;;) {
    c = *s++;
    digit = hexdig(c);
    if (digit < 0)
      break;
  }
  for (p2 = s - 1; p2 > p1;) {
    digit = hexdig(*--p2);
    mant += ((double)digit);
    mant *= 0.0625;
  }
  expon = 0;
  if ((c == 'x') || (c == 'X')) {
    c = *s++;
    esign = 1;
    if (c == '-') {
      esign = -1;
      c = *s++;
    }
    for (;;) {
      digit = hexdig(c);
      if (digit < 0)
        break;
      expon = (expon << 4) + digit;
      c = *s++;
    }
    expon *= esign;
  }
  value = msign * ldexp(mant, expon);
  return (value);
}
```