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

```asm
<ft_ftohex>:
  endbr64
  push   %r13
  push   %r12
  push   %rbp
  push   %rbx
  sub    $0x28,%rsp
  fldt   0x50(%rsp)
  fld    %st(0)
  fstpt  (%rsp)
  fldz
  fxch   %st(1)
  fucomip %st(1),%st
  fstp   %st(0)
  jp     L93
  je     L53
L93:
  mov    $0x14,%edi
  call   <ft_strnew@plt>
  fldt   (%rsp)
  fldz
  mov    %rax,%r12
  fcomip %st(1),%st
  fstp   %st(0)
  ja     L29
  mov    %rax,%rdi
  call   <ft_init_hex@plt>
  fldt   (%rsp)
  fnstcw 0x1e(%rsp)
  mov    %rax,%rbx
  mov    %eax,%r13d
  movzwl 0x1e(%rsp),%eax
  or     $0xc,%ah
  mov    %ax,0x1c(%rsp)
  fldcw  0x1c(%rsp)
  fistpl 0x18(%rsp)
  fldcw  0x1e(%rsp)
  cmpl   $0x1,0x18(%rsp)
  je     L55
  fldt   (%rsp)
  mov    $0xffffffff,%ebp
  jmp    L5
  cs nopw 0x0(%rax,%rax,1)
L76:
  add    $0x1,%ebp
  mov    $0x2,%edi
  mov    %ebp,%esi
  call   <ft_power@plt>
  fldt   (%rsp)
  fdivp  %st,%st(1)
L105:
  fnstcw 0x1e(%rsp)
  movzwl 0x1e(%rsp),%eax
  or     $0xc,%ah
  mov    %ax,0x1c(%rsp)
  fld    %st(0)
  fldcw  0x1c(%rsp)
  fistpl 0x18(%rsp)
  fldcw  0x1e(%rsp)
  cmpl   $0x1,0x18(%rsp)
  je     L114
L5:
  fld1
  fxch   %st(1)
  fcomip %st(1),%st
  fstp   %st(0)
  ja     L76
  sub    $0x1,%ebp
  mov    $0x2,%edi
  mov    %ebp,%esi
  call   <ft_power@plt>
  fldt   (%rsp)
  fdivp  %st,%st(1)
  jmp    L105
  xchg   %ax,%ax
L29:
  movb   $0x2d,(%rax)
  lea    0x1(%rax),%rdi
  call   <ft_init_hex@plt>
  fldt   (%rsp)
  fnstcw 0x1e(%rsp)
  lea    0x1(%rax),%r13d
  mov    %r13d,%ebx
  movzwl 0x1e(%rsp),%eax
  or     $0xc,%ah
  mov    %ax,0x1c(%rsp)
  fld    %st(0)
  fldcw  0x1c(%rsp)
  fistpl 0x18(%rsp)
  fldcw  0x1e(%rsp)
  cmpl   $0xffffffff,0x18(%rsp)
  je     L64
  mov    $0xffffffff,%ebp
  jmp    L119
  nopw   0x0(%rax,%rax,1)
L30:
  sub    $0x1,%ebp
  mov    $0x2,%edi
  mov    %ebp,%esi
  call   <ft_power@plt>
  fldt   (%rsp)
  fdivp  %st,%st(1)
L22:
  fnstcw 0x1e(%rsp)
  movzwl 0x1e(%rsp),%edx
  or     $0xc,%dh
  mov    %dx,0x1c(%rsp)
  fld    %st(0)
  fldcw  0x1c(%rsp)
  fistpl 0x18(%rsp)
  fldcw  0x1e(%rsp)
  cmpl   $0xffffffff,0x18(%rsp)
  je     L114
L119:
  fld1
  fchs
  fcomip %st(1),%st
  fstp   %st(0)
  jbe    L30
  add    $0x1,%ebp
  mov    $0x2,%edi
  mov    %ebp,%esi
  call   <ft_power@plt>
  fldt   (%rsp)
  fdivp  %st,%st(1)
  jmp    L22
  nopw   0x0(%rax,%rax,1)
L114:
  fildl  0x18(%rsp)
  movslq %ebx,%rdi
  sub    $0x10,%rsp
  add    %r12,%rdi
  fmulp  %st,%st(1)
  fstpt  (%rsp)
  call   <ft_ftohex2@plt>
  add    %r13d,%eax
  movslq %eax,%rdx
  movb   $0x70,(%r12,%rdx,1)
  pop    %rcx
  pop    %rsi
  test   %ebp,%ebp
  jle    L98
  add    $0x1,%eax
  cltq
  movb   $0x2b,(%r12,%rax,1)
L98:
  mov    %ebp,%edi
  call   <ft_itoa@plt>
  add    $0x28,%rsp
  mov    %r12,%rdi
  mov    $0x1,%ecx
  pop    %rbx
  mov    %eax,%esi
  pop    %rbp
  mov    $0x1,%edx
  pop    %r12
  pop    %r13
  jmp    10c0 <ft_strfjoin@plt>
  nopl   0x0(%rax,%rax,1)
L53:
  add    $0x28,%rsp
  lea    D8(%rip),%rdi
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  jmp    10f0 <ft_strdup@plt>
L64:
  fstp   %st(0)
  nopl   0x0(%rax,%rax,1)
L55:
  fildl  0x18(%rsp)
  movslq %ebx,%rdi
  sub    $0x10,%rsp
  mov    $0xffffffff,%ebp
  add    %r12,%rdi
  fldt   0x10(%rsp)
  fmulp  %st,%st(1)
  fstpt  (%rsp)
  call   <ft_ftohex2@plt>
  add    %r13d,%eax
  cltq
  movb   $0x70,(%r12,%rax,1)
  pop    %rax
  pop    %rdx
  jmp    L98
```

tool_calls: name: parse_data
arguments: label: D8
type_guessed: string

tool: D8: 0x0p+0

assistant: ```c
char *ft_ftohex(long double f) {
  char *s;
  int i;
  long double res;
  int x;
  int sign;
  if ((x = -1) && f == 0.0)
    return (ft_strdup("0x0p+0"));
  i = 0;
  s = ft_strnew(20);
  if ((sign = (f < 0 ? -1 : 1)) == -1)
    s[i++] = '-';
  i += ft_init_hex(s + i);
  res = f;
  while ((int)res != sign) {
    if ((sign == 1 ? (res > 1) : (res < -1)))
      res = f / ft_power(2, ++x);
    else
      res = f / ft_power(2, --x);
  }
  i += ft_ftohex2(s + i, res * sign);
  if ((s[i++] = 'p') && x > 0)
    s[i++] = '+';
  return (s = ft_strfjoin(s, ft_itoa(x), 1, 1));
}
```