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

```asm
<ftoa>:
  endbr64
  push   %r14
  pxor   %xmm3,%xmm3
  movaps %xmm0,%xmm2
  push   %r13
  push   %r12
  push   %rbp
  push   %rbx
  mov    %rdi,%rbx
  sub    $0x10,%rsp
  comiss %xmm0,%xmm3
  ja     L91
  mov    %rdi,%r13
  mov    $0x2,%ebp
  mov    $0x1,%r14d
L101:
  pxor   %xmm4,%xmm4
  ucomiss %xmm4,%xmm2
  jp     L89
  pxor   %xmm1,%xmm1
  mov    $0x0,%r12d
  jne    L89
L52:
  movsd  D39(%rip),%xmm0
  movss  %xmm2,0xc(%rsp)
  add    %rbx,%r14
  call   <pow@plt>
  movss  0xc(%rsp),%xmm2
  divss  %xmm0,%xmm2
  comiss D14(%rip),%xmm2
  movaps %xmm2,%xmm0
  jbe    L104
  pxor   %xmm5,%xmm5
  mov    $0x1,%edx
  ucomiss %xmm5,%xmm2
  setp   %al
  cmovne %edx,%eax
  test   %al,%al
  je     L104
  movss  D1(%rip),%xmm1
  comiss %xmm2,%xmm1
  ja     L100
L104:
  cvttss2si %xmm0,%eax
  pxor   %xmm1,%xmm1
  movss  D58(%rip),%xmm2
  cvtsi2ss %eax,%xmm1
  lea    0x30(%rax),%edx
  subss  %xmm1,%xmm0
L5:
  mov    %dl,0x0(%r13)
  movslq %ebp,%rdx
  movb   $0x2e,(%r14)
  lea    (%rbx,%rdx,1),%rax
  lea    0x4(%rbx,%rdx,1),%rsi
L27:
  mulss  %xmm2,%xmm0
  pxor   %xmm1,%xmm1
  add    $0x1,%rax
  cvttss2si %xmm0,%edx
  cvtsi2ss %edx,%xmm1
  lea    0x30(%rdx),%ecx
  mov    %cl,-0x1(%rax)
  subss  %xmm1,%xmm0
  cmp    %rsi,%rax
  jne    L27
  lea    0x4(%rbp),%eax
  cltq
  add    %rbx,%rax
  test   %r12d,%r12d
  jne    L21
  movb   $0x0,(%rax)
  add    $0x10,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  ret
L91:
  movb   $0x2d,(%rdi)
  xorps  D31(%rip),%xmm2
  lea    0x1(%rdi),%r13
  mov    $0x3,%ebp
  mov    $0x2,%r14d
  jmp    L101
  xchg   %ax,%ax
L89:
  movaps %xmm2,%xmm0
  movss  %xmm2,0xc(%rsp)
  call   <log10@plt>
  pxor   %xmm1,%xmm1
  movss  0xc(%rsp),%xmm2
  cvtsi2sd %eax,%xmm1
  mov    %eax,%r12d
  jmp    L52
  nopl   0x0(%rax)
L21:
  movb   $0x78,(%rax)
  lea    0x5(%rbp),%eax
  mov    %r12d,%edi
  cltq
  movb   $0x31,(%rbx,%rax,1)
  lea    0x6(%rbp),%eax
  cltq
  movb   $0x30,(%rbx,%rax,1)
  lea    0x7(%rbp),%eax
  add    $0x8,%ebp
  cltq
  movslq %ebp,%rbp
  movb   $0x65,(%rbx,%rax,1)
  add    $0x10,%rsp
  lea    (%rbx,%rbp,1),%rsi
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  jmp    1090 <ltoa@plt>
  nopl   0x0(%rax)
L100:
  movss  D58(%rip),%xmm2
  pxor   %xmm1,%xmm1
  sub    $0x1,%r12d
  mulss  %xmm2,%xmm0
  cvttss2si %xmm0,%eax
  cvtsi2ss %eax,%xmm1
  lea    0x30(%rax),%edx
  subss  %xmm1,%xmm0
  jmp    L5
```

tool_calls: name: unpack_data
arguments: tag: D39
type: f64
name: unpack_data
arguments: tag: D14
type: byte[4]
name: unpack_data
arguments: tag: D1
type: f32
name: unpack_data
arguments: tag: D58
type: byte[4]
name: unpack_data
arguments: tag: D31
type: byte[16]

tool: D39: 10

tool: {"D14": [0x00,0x00,0x80,0xbf]}

tool: D1: 1

tool: {"D58": [0x00,0x00,0x20,0x41]}

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

assistant: ```c
void ftoa(float fval, char *buf) {
  int index = 0, count, exponent;
  double temp1, temp2;
  if (fval < 0) {
    buf[index++] = '-';
    fval = -fval;
  }
  exponent = fval != 0.0 ? log10(fval) : 0;
  fval /= pow((double)10.0, (double)exponent);
  if ((fval > -1.0) && (fval < 1.0) && (fval != 0.0)) {
    fval *= 10;
    exponent--;
    buf[index++] = '0' + (int)fval;
    fval -= (int)fval;
    buf[index++] = '.';
  } else {
    buf[index++] = '0' + (int)fval;
    fval -= (int)fval;
    buf[index++] = '.';
  }
  for (count = 0; count < 4; count++) {
    fval *= 10;
    buf[index++] = '0' + (int)fval;
    fval -= (int)fval;
  }
  if (exponent) {
    buf[index++] = 'x';
    buf[index++] = '1';
    buf[index++] = '0';
    buf[index++] = 'e';
    ltoa(exponent, buf + index);
  } else {
    buf[index] = '\0';
  }
}
```