user: Converte this assembly snippet into its equivalent C code:

```asm
<dtoa>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  sub    $0x30,%rsp
  movsd  %xmm0,-0x18(%rbp)
  mov    %rdi,-0x20(%rbp)
  mov    %esi,-0x24(%rbp)
  pxor   %xmm0,%xmm0
  comisd -0x18(%rbp),%xmm0
  jbe    L60
  mov    -0x20(%rbp),%rax
  movb   $0x2d,(%rax)
  addq   $0x1,-0x20(%rbp)
  movsd  -0x18(%rbp),%xmm0
  movq   D18(%rip),%xmm1
  xorpd  %xmm1,%xmm0
  movsd  %xmm0,-0x18(%rbp)
L60:
  mov    -0x24(%rbp),%eax
  mov    %eax,%esi
  mov    $0xa,%edi
  call   <powi@plt>
  movsd  D1(%rip),%xmm1
  divsd  %xmm0,%xmm1
  movsd  -0x18(%rbp),%xmm0
  addsd  %xmm1,%xmm0
  movsd  %xmm0,-0x18(%rbp)
  movsd  -0x18(%rbp),%xmm0
  cvttsd2si %xmm0,%eax
  mov    %eax,-0xc(%rbp)
  pxor   %xmm1,%xmm1
  cvtsi2sdl -0xc(%rbp),%xmm1
  movsd  -0x18(%rbp),%xmm0
  subsd  %xmm1,%xmm0
  movsd  %xmm0,-0x18(%rbp)
  mov    -0xc(%rbp),%eax
  mov    -0x20(%rbp),%rcx
  mov    $0x0,%edx
  mov    %rcx,%rsi
  mov    %eax,%edi
  call   <itoa2@plt>
  mov    %rax,-0x20(%rbp)
  cmpl   $0x0,-0x24(%rbp)
  jle    L86
  mov    -0x20(%rbp),%rax
  movb   $0x2e,(%rax)
  addq   $0x1,-0x20(%rbp)
  jmp    L86
L38:
  cmpl   $0x9,-0x24(%rbp)
  jg     L2
  mov    -0x24(%rbp),%eax
  mov    %eax,%esi
  mov    $0xa,%edi
  call   <powi@plt>
  movq   %xmm0,%rax
  movq   %rax,%xmm0
  mulsd  -0x18(%rbp),%xmm0
  cvttsd2si %xmm0,%rax
  mov    %eax,-0x4(%rbp)
  mov    -0x24(%rbp),%edx
  mov    -0x20(%rbp),%rcx
  mov    -0x4(%rbp),%eax
  mov    %rcx,%rsi
  mov    %eax,%edi
  call   <itoa2@plt>
  mov    %rax,-0x20(%rbp)
  movl   $0x0,-0x24(%rbp)
  jmp    L86
L2:
  mov    $0x9,%esi
  mov    $0xa,%edi
  call   <powi@plt>
  movq   %xmm0,%rax
  movq   %rax,%xmm0
  mulsd  -0x18(%rbp),%xmm0
  cvttsd2si %xmm0,%rax
  mov    %eax,-0x8(%rbp)
  mov    -0x20(%rbp),%rcx
  mov    -0x8(%rbp),%eax
  mov    $0x9,%edx
  mov    %rcx,%rsi
  mov    %eax,%edi
  call   <itoa2@plt>
  mov    %rax,-0x20(%rbp)
  mov    $0x9,%esi
  mov    $0xa,%edi
  call   <powi@plt>
  movq   %xmm0,%rax
  movq   %rax,%xmm1
  mulsd  -0x18(%rbp),%xmm1
  mov    -0x8(%rbp),%eax
  test   %rax,%rax
  js     L0
  pxor   %xmm0,%xmm0
  cvtsi2sd %rax,%xmm0
  jmp    L76
L0:
  mov    %rax,%rdx
  shr    %rdx
  and    $0x1,%eax
  or     %rax,%rdx
  pxor   %xmm0,%xmm0
  cvtsi2sd %rdx,%xmm0
  addsd  %xmm0,%xmm0
L76:
  subsd  %xmm0,%xmm1
  movsd  %xmm1,-0x18(%rbp)
  subl   $0x9,-0x24(%rbp)
L86:
  cmpl   $0x0,-0x24(%rbp)
  jle    L65
  movsd  -0x18(%rbp),%xmm0
  pxor   %xmm1,%xmm1
  comisd %xmm1,%xmm0
  ja     L38
L65:
  mov    -0x20(%rbp),%rax
  movb   $0x0,(%rax)
  nop
  leave
  ret
```

tool_calls: name: unpack_data
arguments: data_tag: D18
type_infered: byte[8]
name: unpack_data
arguments: data_tag: D1
type_infered: byte[8]

tool: {"D18": [0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x80]}

tool: {"D1": [0x00,0x00,0x00,0x00,0x00,0x00,0xe0,0x3f]}

assistant: ```c
void dtoa(double n, char *buf, int p) {
  if (n < 0) {
    *buf = '-';
    buf++;
    n *= -1;
  }
  n += .5 / (powi(10, p));
  int pe = (int)n;
  n -= pe;
  buf = itoa2(pe, buf, 0);
  if (p > 0) {
    *buf = '.';
    buf++;
  }
  while (p > 0 && n > 0) {
    if (p <= 9) {
      unsigned int fp = n * powi(10, p);
      buf = itoa2(fp, buf, p);
      p = 0;
    } else {
      unsigned int fp = n * powi(10, 9);
      buf = itoa2(fp, buf, 9);
      n = n * powi(10, 9) - fp;
      p -= 9;
    }
  }
  *buf = '\0';
}
```