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

```asm
<m_atof>:
  endbr64
  push   %r15
  push   %r14
  push   %r13
  push   %r12
  push   %rbp
  push   %rbx
  sub    $0x18,%rsp
  movl   $0x1,0xc(%rsp)
  cmpb   $0x2d,(%rdi)
  je     L169
L122:
  lea    0x1(%rdi),%r12
  movsbl (%rdi),%ebp
  test   %ebp,%ebp
  je     L139
  mov    D29(%rip),%rbx
L98:
  mov    %ebp,%edi
  call   <isdigit@plt>
  test   %rax,%rax
  je     L85
  movq   %rbx,%xmm0
  mulsd  D44(%rip),%xmm0
  sub    $0x30,%ebp
  pxor   %xmm1,%xmm1
  cvtsi2sd %ebp,%xmm1
  addsd  %xmm0,%xmm1
  movq   %xmm1,%rbx
  add    $0x1,%r12
  movsbl -0x1(%r12),%ebp
  test   %ebp,%ebp
  jne    L98
  jmp    L77
L169:
  add    $0x1,%rdi
  movl   $0xffffffff,0xc(%rsp)
  jmp    L122
L85:
  cmp    $0x2e,%ebp
  jne    L241
  lea    0x1(%r12),%r13
  movsbl (%r12),%r12d
  mov    $0x0,%ebp
  test   %r12d,%r12d
  je     L137
L138:
  mov    %r12d,%edi
  call   <isdigit@plt>
  test   %rax,%rax
  je     L131
  movq   %rbx,%xmm0
  mulsd  D44(%rip),%xmm0
  sub    $0x30,%r12d
  pxor   %xmm1,%xmm1
  cvtsi2sd %r12d,%xmm1
  addsd  %xmm0,%xmm1
  movq   %xmm1,%rbx
  sub    $0x1,%ebp
  add    $0x1,%r13
  movsbl -0x1(%r13),%r12d
  test   %r12d,%r12d
  jne    L138
  jmp    L71
L131:
  and    $0xffffffdf,%r12d
  cmp    $0x45,%r12d
  jne    L71
  mov    %r13,%r12
  jmp    L210
L128:
  lea    0x2(%r12),%r14
  movsbl 0x1(%r12),%r13d
  mov    $0x1,%r15d
  jmp    L65
L147:
  lea    0x2(%r12),%r14
  movsbl 0x1(%r12),%r13d
  mov    $0xffffffff,%r15d
  jmp    L65
L186:
  lea    (%r12,%r12,4),%eax
  lea    -0x30(%r13,%rax,2),%r12d
  add    $0x1,%r14
  movsbl -0x1(%r14),%r13d
L144:
  mov    %r13d,%edi
  call   <isdigit@plt>
  test   %rax,%rax
  jne    L186
  imul   %r15d,%r12d
  add    %r12d,%ebp
L71:
  test   %ebp,%ebp
  jle    L66
  movsd  D44(%rip),%xmm0
L11:
  movq   %rbx,%xmm2
  mulsd  %xmm0,%xmm2
  movq   %xmm2,%rbx
  sub    $0x1,%ebp
  jne    L11
L77:
  pxor   %xmm0,%xmm0
  cvtsi2sdl 0xc(%rsp),%xmm0
  movq   %rbx,%xmm4
  mulsd  %xmm4,%xmm0
  add    $0x18,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
L66:
  mov    %ebp,%r12d
L137:
  test   %r12d,%r12d
  jns    L77
  movsd  D33(%rip),%xmm0
L235:
  movq   %rbx,%xmm3
  mulsd  %xmm0,%xmm3
  movq   %xmm3,%rbx
  add    $0x1,%r12d
  jne    L235
  jmp    L77
L241:
  and    $0xffffffdf,%ebp
  cmp    $0x45,%ebp
  jne    L77
  mov    $0x0,%ebp
L210:
  movsbl (%r12),%r13d
  cmp    $0x2b,%r13d
  je     L128
  lea    0x1(%r12),%r14
  mov    $0x1,%r15d
  cmp    $0x2d,%r13d
  je     L147
L65:
  mov    $0x0,%r12d
  jmp    L144
L139:
  mov    D29(%rip),%rbx
  jmp    L77
```

tool_calls: name: unpack_data
arguments: data_label: D29
type_guessed: f64
name: unpack_data
arguments: data_label: D44
type_guessed: f64
name: unpack_data
arguments: data_label: D33
type_guessed: f64

tool: D29: 0

tool: D44: 10

tool: D33: 0.1

assistant: ```c
double m_atof(char *s) {
  double a = 0.0;
  int e = 0;
  int c;
  int negative = 1;
  if (*s == '-') {
    negative = -1;
    s += 1;
  }
  while ((c = *s++) != '\0' && isdigit(c)) {
    a = a * 10.0 + (c - '0');
  }
  if (c == '.') {
    while ((c = *s++) != '\0' && isdigit(c)) {
      a = a * 10.0 + (c - '0');
      e = e - 1;
    }
  }
  if (c == 'e' || c == 'E') {
    int sign = 1;
    int i = 0;
    c = *s++;
    if (c == '+')
      c = *s++;
    else if (c == '-') {
      c = *s++;
      sign = -1;
    }
    while (isdigit(c)) {
      i = i * 10 + (c - '0');
      c = *s++;
    }
    e += i * sign;
  }
  while (e > 0) {
    a *= 10.0;
    e--;
  }
  while (e < 0) {
    a *= 0.1;
    e++;
  }
  return a * negative;
}
```