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

```asm
<tonum>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  sub    $0x60,%rsp
  mov    %rdi,-0x48(%rbp)
  mov    %esi,-0x4c(%rbp)
  mov    %rdx,-0x58(%rbp)
  mov    %fs:0x28,%rax
  mov    %rax,-0x8(%rbp)
  xor    %eax,%eax
  movl   $0x0,-0x34(%rbp)
  movl   $0x0,-0x30(%rbp)
  movsd  D1(%rip),%xmm0
  movsd  %xmm0,-0x10(%rbp)
  pxor   %xmm0,%xmm0
  movsd  %xmm0,-0x20(%rbp)
  pxor   %xmm0,%xmm0
  movsd  %xmm0,-0x18(%rbp)
  cmpl   $0x1,-0x4c(%rbp)
  jne    L170
  mov    -0x48(%rbp),%rax
  movzbl (%rax),%eax
  cmp    $0x2e,%al
  je     L36
  mov    -0x48(%rbp),%rax
  movzbl (%rax),%eax
  cmp    $0x2d,%al
  je     L36
  mov    -0x48(%rbp),%rax
  movzbl (%rax),%eax
  cmp    $0x2b,%al
  jne    L170
L36:
  mov    $0x0,%eax
  jmp    L183
L170:
  cmpl   $0x1,-0x4c(%rbp)
  jle    L74
  mov    -0x48(%rbp),%rax
  movzbl (%rax),%eax
  cmp    $0x2d,%al
  jne    L74
  mov    -0x48(%rbp),%rax
  add    $0x1,%rax
  movzbl (%rax),%eax
  cmp    $0x2d,%al
  je     L74
  movsd  D17(%rip),%xmm0
  movsd  %xmm0,-0x10(%rbp)
  addq   $0x1,-0x48(%rbp)
  subl   $0x1,-0x4c(%rbp)
L74:
  lea    -0x28(%rbp),%rcx
  mov    -0x34(%rbp),%edx
  mov    -0x4c(%rbp),%esi
  mov    -0x48(%rbp),%rax
  mov    %rax,%rdi
  call   <readsigned@plt>
  mov    %eax,-0x34(%rbp)
  movsd  -0x28(%rbp),%xmm1
  pxor   %xmm0,%xmm0
  comisd %xmm1,%xmm0
  jbe    L90
  movsd  D17(%rip),%xmm0
  movsd  %xmm0,-0x10(%rbp)
  movsd  -0x28(%rbp),%xmm0
  movq   D24(%rip),%xmm1
  xorpd  %xmm1,%xmm0
  movsd  %xmm0,-0x28(%rbp)
L90:
  mov    -0x34(%rbp),%eax
  cmp    -0x4c(%rbp),%eax
  jge    L45
  mov    -0x34(%rbp),%eax
  movslq %eax,%rdx
  mov    -0x48(%rbp),%rax
  add    %rdx,%rax
  movzbl (%rax),%eax
  cmp    $0x2e,%al
  jne    L45
  addl   $0x1,-0x34(%rbp)
  lea    -0x20(%rbp),%rcx
  mov    -0x34(%rbp),%edx
  mov    -0x4c(%rbp),%esi
  mov    -0x48(%rbp),%rax
  mov    $0xa,%r8d
  mov    %rax,%rdi
  call   <readint@plt>
  sub    -0x34(%rbp),%eax
  mov    %eax,-0x30(%rbp)
  mov    -0x30(%rbp),%eax
  add    %eax,-0x34(%rbp)
L45:
  cmpl   $0x0,-0x34(%rbp)
  jne    L69
  mov    $0x0,%eax
  jmp    L183
L69:
  mov    -0x34(%rbp),%eax
  cmp    -0x4c(%rbp),%eax
  jge    L21
  mov    -0x34(%rbp),%eax
  movslq %eax,%rdx
  mov    -0x48(%rbp),%rax
  add    %rdx,%rax
  movzbl (%rax),%eax
  cmp    $0x65,%al
  je     L54
  mov    -0x34(%rbp),%eax
  movslq %eax,%rdx
  mov    -0x48(%rbp),%rax
  add    %rdx,%rax
  movzbl (%rax),%eax
  cmp    $0x45,%al
  jne    L21
L54:
  mov    -0x34(%rbp),%eax
  add    $0x1,%eax
  mov    %eax,-0x2c(%rbp)
  mov    -0x34(%rbp),%eax
  lea    0x1(%rax),%edi
  lea    -0x18(%rbp),%rdx
  mov    -0x4c(%rbp),%esi
  mov    -0x48(%rbp),%rax
  mov    %rdx,%rcx
  mov    %edi,%edx
  mov    %rax,%rdi
  call   <readsigned@plt>
  mov    %eax,-0x34(%rbp)
  mov    -0x34(%rbp),%eax
  cmp    -0x2c(%rbp),%eax
  jne    L21
  mov    $0x0,%eax
  jmp    L183
L21:
  mov    -0x30(%rbp),%eax
  neg    %eax
  pxor   %xmm3,%xmm3
  cvtsi2sd %eax,%xmm3
  movq   %xmm3,%rax
  movq   %rax,%xmm0
  call   <decpow@plt>
  movsd  -0x20(%rbp),%xmm1
  mulsd  %xmm0,%xmm1
  movsd  -0x28(%rbp),%xmm0
  addsd  %xmm1,%xmm0
  mulsd  -0x10(%rbp),%xmm0
  movsd  %xmm0,-0x60(%rbp)
  mov    -0x18(%rbp),%rax
  movq   %rax,%xmm0
  call   <decpow@plt>
  mulsd  -0x60(%rbp),%xmm0
  mov    -0x58(%rbp),%rax
  movsd  %xmm0,(%rax)
  mov    -0x34(%rbp),%eax
  cmp    -0x4c(%rbp),%eax
  jge    L117
  mov    $0x0,%eax
  jmp    L183
L117:
  mov    $0x1,%eax
L183:
  mov    -0x8(%rbp),%rdx
  sub    %fs:0x28,%rdx
  je     L134
  call   <__stack_chk_fail@plt>
L134:
  leave
  ret
```

tool_calls: name: unpack_data
arguments: tag: D1
type_guessed: f64
name: unpack_data
arguments: tag: D17
type_guessed: f32[2]
name: unpack_data
arguments: tag: D24
type_guessed: f32[2]

tool: D1: 1

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

tool: {"D24": [0.0,-0.0]}

assistant: ```c
int tonum(unsigned char *s, int len, double *result) {
  int i = 0, fraclen = 0;
  double sgn = 1, val, frac = 0, exp = 0;
  if (len == 1 && (*s == '.' || *s == '-' || *s == '+'))
    return 0;
  if (len > 1 && s[0] == '-' && s[1] != '-') {
    sgn = -1;
    s++;
    len--;
  }
  i = readsigned(s, len, i, &val);
  if (val < 0) {
    sgn = -1;
    val = -val;
  }
  if (i < len && s[i] == '.') {
    i++;
    fraclen = readint(s, len, i, &frac, 10) - i;
    i += fraclen;
  }
  if (i == 0)
    return 0;
  if (i < len && (s[i] == 'e' || s[i] == 'E')) {
    int i0 = i + 1;
    i = readsigned(s, len, i + 1, &exp);
    if (i == i0)
      return 0;
  }
  *result = sgn * (val + frac * decpow(-fraclen)) * decpow(exp);
  if (i < len)
    return 0;
  return 1;
}
```