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

```asm
<dtostrf>:
  endbr64
  push   %r13
  push   %r12
  push   %rbp
  push   %rbx
  sub    $0x18,%rsp
  movsd  %xmm0,0x8(%rsp)
  mov    %edi,%r13d
  mov    %esi,%r12d
  mov    %rdx,%rbp
  mov    %esi,%ebx
  call   <isnan@plt>
  test   %rax,%rax
  jne    L20
  movsd  0x8(%rsp),%xmm0
  call   <isinf@plt>
  test   %rax,%rax
  jne    L2
  movsbl %r13b,%edx
  test   %r12b,%r12b
  je     L188
  movzbl %r12b,%eax
  add    $0x1,%eax
  sub    %eax,%edx
  pxor   %xmm0,%xmm0
  comisd 0x8(%rsp),%xmm0
  ja     L39
  mov    $0x0,%edi
L189:
  mov    $0x0,%eax
  movsd  D6(%rip),%xmm1
  movsd  D64(%rip),%xmm0
L137:
  mulsd  %xmm0,%xmm1
  add    $0x1,%eax
  cmp    %al,%bl
  ja     L137
L91:
  movsd  D125(%rip),%xmm0
  divsd  %xmm1,%xmm0
  addsd  0x8(%rsp),%xmm0
  mov    $0x1,%ecx
  movsd  D64(%rip),%xmm1
  movapd %xmm1,%xmm3
  comisd %xmm1,%xmm0
  jb     L19
L203:
  add    $0x1,%ecx
  movapd %xmm1,%xmm2
  mulsd  %xmm3,%xmm1
  comisd %xmm1,%xmm0
  jae    L203
L112:
  divsd  %xmm2,%xmm0
  sub    %ecx,%edx
  test   %edx,%edx
  jle    L9
  mov    %edx,%esi
  add    %rbp,%rsi
  mov    %rbp,%rax
L175:
  add    $0x1,%rax
  movb   $0x20,-0x1(%rax)
  cmp    %rsi,%rax
  jne    L175
  mov    %edx,%edx
  add    %rbp,%rdx
L29:
  test   %edi,%edi
  je     L171
  movb   $0x2d,(%rdx)
  lea    0x1(%rdx),%rdx
L171:
  movzbl %r12b,%r12d
  lea    (%r12,%rcx,1),%eax
  lea    -0x1(%rax),%ecx
  test   %eax,%eax
  jle    L35
  movsd  D64(%rip),%xmm2
  jmp    L30
L20:
  lea    D74(%rip),%rsi
  mov    %rbp,%rdi
  call   <strcpy@plt>
  jmp    L182
L2:
  lea    D8(%rip),%rsi
  mov    %rbp,%rdi
  call   <strcpy@plt>
  jmp    L182
L19:
  mov    $0x1,%ecx
  movsd  D125(%rip),%xmm2
  jmp    L112
L9:
  mov    %rbp,%rdx
  jmp    L29
L118:
  pxor   %xmm1,%xmm1
  cvtsi2sd %eax,%xmm1
  subsd  %xmm1,%xmm0
  mulsd  %xmm2,%xmm0
  test   %edi,%edi
  jle    L133
L164:
  sub    $0x1,%ecx
  mov    %rsi,%rdx
L30:
  cvttsd2si %xmm0,%eax
  mov    $0x9,%esi
  cmp    %esi,%eax
  cmovg  %esi,%eax
  lea    0x1(%rdx),%rsi
  mov    %eax,%edi
  or     $0x30,%edi
  mov    %dil,(%rdx)
  mov    %ecx,%edi
  test   %bl,%bl
  je     L118
  cmp    %ecx,%r12d
  jne    L118
  lea    0x2(%rdx),%rsi
  movb   $0x2e,0x1(%rdx)
  pxor   %xmm1,%xmm1
  cvtsi2sd %eax,%xmm1
  subsd  %xmm1,%xmm0
  mulsd  D64(%rip),%xmm0
  jmp    L164
L35:
  mov    %rdx,%rsi
L133:
  movb   $0x0,(%rsi)
L182:
  mov    %rbp,%rax
  add    $0x18,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  ret
L188:
  pxor   %xmm0,%xmm0
  mov    $0x0,%edi
  movsd  D6(%rip),%xmm1
  comisd 0x8(%rsp),%xmm0
  jbe    L91
  sub    $0x1,%edx
  movsd  0x8(%rsp),%xmm7
  xorpd  D86(%rip),%xmm7
  movsd  %xmm7,0x8(%rsp)
  mov    $0x1,%edi
  movsd  D6(%rip),%xmm1
  jmp    L91
L39:
  sub    $0x1,%edx
  movsd  0x8(%rsp),%xmm7
  xorpd  D86(%rip),%xmm7
  movsd  %xmm7,0x8(%rsp)
  mov    $0x1,%edi
  jmp    L189
```

tool_calls: name: extract_symbolic_data
arguments: label: D6
datatype: f64
name: extract_symbolic_data
arguments: label: D64
datatype: f64
name: extract_symbolic_data
arguments: label: D125
datatype: f64
name: extract_symbolic_data
arguments: label: D74
datatype: string
name: extract_symbolic_data
arguments: label: D8
datatype: string
name: extract_symbolic_data
arguments: label: D86
datatype: f32[4]

tool: D6: 2

tool: D64: 10

tool: D125: 1

tool: D74: nan

tool: D8: inf

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

assistant: ```c
char *dtostrf(double number, signed char width, unsigned char prec, char *s) {
  bool negative = false;
  if (isnan(number)) {
    strcpy(s, "nan");
    return s;
  }
  if (isinf(number)) {
    strcpy(s, "inf");
    return s;
  }
  char *out = s;
  int fillme = width;
  if (prec > 0) {
    fillme -= (prec + 1);
  }
  if (number < 0.0) {
    negative = true;
    fillme--;
    number = -number;
  }
  double rounding = 2.0;
  for (uint8_t i = 0; i < prec; ++i)
    rounding *= 10.0;
  rounding = 1.0 / rounding;
  number += rounding;
  double tenpow = 1.0;
  int digitcount = 1;
  while (number >= 10.0 * tenpow) {
    tenpow *= 10.0;
    digitcount++;
  }
  number /= tenpow;
  fillme -= digitcount;
  while (fillme-- > 0) {
    *out++ = ' ';
  }
  if (negative)
    *out++ = '-';
  digitcount += prec;
  int8_t digit = 0;
  while (digitcount-- > 0) {
    digit = (int8_t)number;
    if (digit > 9)
      digit = 9;
    *out++ = (char)('0' | digit);
    if ((digitcount == prec) && (prec > 0)) {
      *out++ = '.';
    }
    number -= digit;
    number *= 10.0;
  }
  *out = 0;
  return s;
}
```