user: 请从给定的汇编指令推导出C源代码：

```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     L89
  je     L16
L89:
  mov    $0x14,%edi
  call   <ft_strnew@plt>
  fldt   (%rsp)
  fldz
  mov    %rax,%r12
  fcomip %st(1),%st
  fstp   %st(0)
  ja     L102
  mov    %rax,%rdi
  xor    %r13d,%r13d
  mov    $0x1,%ebx
L56:
  call   <ft_init_hex@plt>
  fldt   (%rsp)
  fnstcw 0x1e(%rsp)
  add    %eax,%r13d
  movzwl 0x1e(%rsp),%eax
  or     $0xc,%ah
  mov    %ax,0x1c(%rsp)
  fld    %st(0)
  fldcw  0x1c(%rsp)
  fistpl 0x18(%rsp)
  fldcw  0x1e(%rsp)
  mov    0x18(%rsp),%eax
  cmp    %eax,%ebx
  je     L40
  mov    $0xffffffff,%ebp
  jmp    L80
  nopl   0x0(%rax,%rax,1)
L21:
  fld1
  fchs
  fcomip %st(1),%st
  fstp   %st(0)
  jbe    L49
L38:
  add    $0x1,%ebp
  mov    $0x2,%edi
  mov    %ebp,%esi
  call   <ft_power@plt>
  fldt   (%rsp)
  fdivp  %st,%st(1)
L126:
  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)
  mov    0x18(%rsp),%eax
  cmp    %ebx,%eax
  je     L91
L80:
  cmp    $0x1,%ebx
  jne    L21
  fld1
  fxch   %st(1)
  fcomip %st(1),%st
  fstp   %st(0)
  ja     L38
L49:
  sub    $0x1,%ebp
  mov    $0x2,%edi
  mov    %ebp,%esi
  call   <ft_power@plt>
  fldt   (%rsp)
  fdivp  %st,%st(1)
  jmp    L126
  nopw   0x0(%rax,%rax,1)
L102:
  movb   $0x2d,(%rax)
  lea    0x1(%rax),%rdi
  mov    $0x1,%r13d
  mov    $0xffffffff,%ebx
  jmp    L56
  nopw   0x0(%rax,%rax,1)
L91:
  mov    %ebx,0x18(%rsp)
  fildl  0x18(%rsp)
  movslq %r13d,%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    L24
  add    $0x1,%eax
  cltq
  movb   $0x2b,(%r12,%rax,1)
L24:
  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)
L16:
  add    $0x28,%rsp
  lea    D3(%rip),%rdi
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  jmp    10f0 <ft_strdup@plt>
  cs nopw 0x0(%rax,%rax,1)
L40:
  fstp   %st(0)
  mov    %ebx,0x18(%rsp)
  fildl  0x18(%rsp)
  movslq %r13d,%rdi
  sub    $0x10,%rsp
  add    %r12,%rdi
  mov    $0xffffffff,%ebp
  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    L24
```

tool_calls: name: unpack_data
arguments: data_tag: D3
type: string

tool: D3: 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));
}
```