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

```asm
<dbltoa>:
  endbr64
  push   %r13
  pxor   %xmm6,%xmm6
  push   %r12
  push   %rbp
  movslq %edi,%rbp
  push   %rbx
  xor    %ebx,%ebx
  sub    $0x58,%rsp
  mov    %fs:0x28,%rax
  mov    %rax,0x48(%rsp)
  xor    %eax,%eax
  comisd %xmm0,%xmm6
  jbe    L34
  xorpd  D86(%rip),%xmm0
  mov    $0x1,%ebx
L34:
  movsd  D10(%rip),%xmm7
  test   %ebp,%ebp
  jle    L117
  movq   D130(%rip),%xmm5
  movapd %xmm0,%xmm1
  movapd %xmm0,%xmm2
  andpd  %xmm5,%xmm1
  movapd %xmm5,%xmm3
  ucomisd %xmm1,%xmm7
  ja     L1
L96:
  movapd %xmm0,%xmm1
  movsd  D166(%rip),%xmm3
  lea    -0x1(%rbp),%edx
  mov    $0x1,%eax
  subsd  %xmm2,%xmm1
  nopl   0x0(%rax)
L102:
  lea    (%rax,%rax,4),%eax
  mulsd  %xmm3,%xmm1
  add    %eax,%eax
  sub    $0x1,%edx
  jae    L102
  addsd  D167(%rip),%xmm1
  cvttsd2si %xmm1,%r8d
  cmp    %eax,%r8d
  jge    L7
  comisd %xmm6,%xmm2
  jbe    L78
L126:
  movsd  D166(%rip),%xmm3
  xor    %edx,%edx
  mov    %rsp,%rsi
  lea    D108(%rip),%r9
  movsd  D137(%rip),%xmm8
  movsd  D145(%rip),%xmm9
  nopl   0x0(%rax)
L10:
  movapd %xmm2,%xmm0
  movapd %xmm2,%xmm1
  movslq %edx,%rax
  divsd  %xmm3,%xmm0
  movapd %xmm0,%xmm2
  andpd  %xmm5,%xmm2
  ucomisd %xmm2,%xmm7
  jbe    L79
  cvttsd2si %xmm0,%rcx
  pxor   %xmm2,%xmm2
  cvtsi2sd %rcx,%xmm2
  movapd %xmm2,%xmm4
  cmpnlesd %xmm0,%xmm4
  andpd  %xmm9,%xmm4
  subsd  %xmm4,%xmm2
  movapd %xmm5,%xmm4
  andnpd %xmm0,%xmm4
  orpd   %xmm4,%xmm2
  movapd %xmm2,%xmm0
L79:
  movapd %xmm0,%xmm4
  movapd %xmm0,%xmm2
  mov    $0x2a,%edi
  mulsd  %xmm3,%xmm4
  subsd  %xmm4,%xmm1
  addsd  %xmm8,%xmm1
  cvttsd2si %xmm1,%ecx
  cmp    $0x9,%ecx
  ja     L51
  movslq %ecx,%rcx
  movzbl (%r9,%rcx,1),%edi
L51:
  mov    %dil,(%rsi,%rdx,1)
  add    $0x1,%rdx
  comisd %xmm6,%xmm0
  ja     L10
  movzbl (%rsp),%edx
L140:
  lea    D55(%rip),%r12
  mov    %dl,(%rsp)
  mov    %r12,%rdx
  test   %ebx,%ebx
  je     L192
  movb   $0x28,D55(%rip)
  add    $0x1,%rdx
L192:
  xor    %r9d,%r9d
  jmp    L173
  nop
L174:
  imul   $0xaaaaaaab,%eax,%ecx
  add    $0x2aaaaaaa,%ecx
  cmp    $0x55555554,%ecx
  ja     L112
  movb   $0x2c,0x1(%rdx)
  add    $0x2,%rdx
L182:
  sub    $0x1,%rax
  cmp    $0xffffffff,%eax
  je     L15
L173:
  movzbl (%rsi,%rax,1),%ecx
  lea    0x1(%rdx),%rdi
  mov    %cl,(%rdx)
  cmp    %rax,%r9
  jne    L174
L218:
  test   %ebp,%ebp
  jle    L242
  movb   $0x2e,(%rdi)
  lea    0x1(%rdi),%r13
  mov    %r8d,%ecx
  mov    %ebp,%edx
  mov    %r13,%rdi
  lea    D13(%rip),%rsi
  call   <sprintf@plt>
  lea    0x0(%r13,%rbp,1),%rdi
L242:
  test   %ebx,%ebx
  je     L60
  movb   $0x29,(%rdi)
  add    $0x1,%rdi
L60:
  movb   $0x0,(%rdi)
  mov    0x48(%rsp),%rax
  sub    %fs:0x28,%rax
  jne    L57
  add    $0x58,%rsp
  mov    %r12,%rax
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  ret
  nopl   0x0(%rax)
L112:
  mov    %rdi,%rdx
  jmp    L182
  nopl   (%rax)
L7:
  movsd  D145(%rip),%xmm3
  movapd %xmm5,%xmm1
  addsd  %xmm3,%xmm0
  movapd %xmm0,%xmm2
  andpd  %xmm5,%xmm0
  ucomisd %xmm0,%xmm7
  ja     L47
L135:
  xor    %r8d,%r8d
L143:
  comisd %xmm6,%xmm2
  ja     L126
L78:
  xor    %eax,%eax
  mov    $0x30,%edx
  mov    %rsp,%rsi
  jmp    L140
  cs nopw 0x0(%rax,%rax,1)
L1:
  cvttsd2si %xmm0,%rax
  pxor   %xmm1,%xmm1
  movsd  D145(%rip),%xmm4
  andnpd %xmm0,%xmm3
  cvtsi2sd %rax,%xmm1
  movapd %xmm1,%xmm2
  cmpnlesd %xmm0,%xmm2
  andpd  %xmm4,%xmm2
  subsd  %xmm2,%xmm1
  orpd   %xmm3,%xmm1
  movapd %xmm1,%xmm2
  jmp    L96
  nopl   0x0(%rax,%rax,1)
L117:
  addsd  D167(%rip),%xmm0
  movq   D130(%rip),%xmm5
  movapd %xmm5,%xmm1
  movapd %xmm0,%xmm2
  andpd  %xmm5,%xmm0
  ucomisd %xmm0,%xmm7
  jbe    L135
  cvttsd2si %xmm2,%rax
  pxor   %xmm0,%xmm0
  andnpd %xmm2,%xmm1
  xor    %r8d,%r8d
  movsd  D145(%rip),%xmm4
  cvtsi2sd %rax,%xmm0
  movapd %xmm0,%xmm3
  cmpnlesd %xmm2,%xmm3
  andpd  %xmm4,%xmm3
  subsd  %xmm3,%xmm0
  orpd   %xmm1,%xmm0
  movapd %xmm0,%xmm2
  jmp    L143
  nopl   0x0(%rax)
L47:
  cvttsd2si %xmm2,%rax
  pxor   %xmm0,%xmm0
  andnpd %xmm2,%xmm1
  xor    %r8d,%r8d
  cvtsi2sd %rax,%xmm0
  movapd %xmm0,%xmm4
  cmpnlesd %xmm2,%xmm4
  andpd  %xmm3,%xmm4
  subsd  %xmm4,%xmm0
  orpd   %xmm1,%xmm0
  movapd %xmm0,%xmm2
  jmp    L143
L57:
  call   <__stack_chk_fail@plt>
L15:
  mov    %rdx,%rdi
  jmp    L218
```

tool_calls: name: read_data
arguments: tag: D86
type_guessed: f32[4]
name: read_data
arguments: tag: D10
type_guessed: f32[2]
name: read_data
arguments: tag: D130
type_guessed: byte[8]
name: read_data
arguments: tag: D166
type_guessed: f64
name: read_data
arguments: tag: D167
type_guessed: f64
name: read_data
arguments: tag: D108
type_guessed: string
name: read_data
arguments: tag: D137
type_guessed: f64
name: read_data
arguments: tag: D145
type_guessed: f32[2]
name: read_data
arguments: tag: D13
type_guessed: string

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

tool: {"D10": [0.0,176.0]}

tool: {"D130": [0xff,0xff,0xff,0xff,0xff,0xff,0xff,0x7f]}

tool: D166: 10

tool: D167: 0.5

tool: D108: 0123456789*

tool: D137: 0.01

tool: {"D145": [0.0,1.875]}

tool: D13: %0*d

assistant: ```c
char *dbltoa(double dblval, int npts) {
  static char finval[256];
  static char digittbl[32] = "0123456789*";
  char *finptr = finval;
  double floor();
  double dbldigit;
  int digit;
  int isneg = 0;
  int ifrac = 0;
  char digits[64];
  int ndigits = 0;
  if (dblval < 0.0) {
    isneg = 1;
    dblval = (-dblval);
  }
  if (npts > 0) {
    int ipts = npts;
    dbldigit = dblval - floor(dblval);
    digit = 1;
    while (--ipts >= 0) {
      dbldigit *= 10.0;
      digit *= 10;
    }
    ifrac = (int)(dbldigit + 0.5);
    if (ifrac >= digit) {
      dblval++;
      ifrac = 0;
    }
  } else
    dblval += 0.5;
  dblval = floor(dblval);
  while (dblval > 0.0) {
    dbldigit = floor(dblval / 10.0);
    digit = (int)(dblval - 10.0 * dbldigit + 0.01);
    if (digit < 0 || digit > 9)
      digit = 10;
    digits[ndigits++] = digittbl[digit];
    dblval = dbldigit;
  }
  if (ndigits < 1)
    digits[ndigits++] = '0';
  if (isneg)
    *finptr++ = '(';
  for (digit = ndigits - 1; digit >= 0; digit--) {
    *finptr++ = digits[digit];
    if (digit > 0 && digit % 3 == 0)
      *finptr++ = ',';
  }
  if (npts > 0) {
    *finptr++ = '.';
    sprintf(finptr, "%0*d", npts, ifrac);
    finptr += npts;
  }
  if (isneg)
    *finptr++ = ')';
  *finptr = '\000';
  return (finval);
}
```