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

```asm
<ft_itoa_hex>:
  endbr64
  movabs $0xfffffffffffff,%rcx
  push   %r14
  mov    %esi,%r14d
  push   %r13
  movq   %xmm0,%r13
  push   %r12
  mov    %edi,%r12d
  mov    $0xe,%edi
  push   %rbp
  mov    %esi,%ebp
  push   %rbx
  mov    %rcx,%rbx
  and    %r13,%rbx
  and    $0xf,%r13d
  call   <malloc@plt>
  mov    %ebx,%ecx
  lea    -0xa(%r14),%edx
  and    $0xf,%ecx
  movb   $0x0,0xd(%rax)
  lea    0x30(%rcx),%esi
  add    %edx,%ecx
  cmp    $0x9,%r13
  cmovbe %esi,%ecx
  mov    %rbx,%rsi
  shr    $0x4,%rsi
  mov    %cl,0xc(%rax)
  mov    %ebx,%ecx
  and    $0xf,%esi
  shr    $0x4,%cl
  lea    0x30(%rcx),%edi
  add    %edx,%ecx
  cmp    $0x9,%rsi
  mov    %rbx,%rsi
  cmovbe %edi,%ecx
  shr    $0x8,%rsi
  mov    %cl,0xb(%rax)
  mov    %esi,%ecx
  and    $0xf,%esi
  and    $0xf,%ecx
  lea    0x30(%rcx),%edi
  add    %edx,%ecx
  cmp    $0x9,%rsi
  mov    %rbx,%rsi
  cmovbe %edi,%ecx
  shr    $0xc,%rsi
  mov    %cl,0xa(%rax)
  mov    %esi,%ecx
  and    $0xf,%esi
  and    $0xf,%ecx
  lea    0x30(%rcx),%edi
  add    %edx,%ecx
  cmp    $0x9,%rsi
  mov    %rbx,%rsi
  cmovbe %edi,%ecx
  shr    $0x10,%rsi
  mov    %cl,0x9(%rax)
  mov    %esi,%ecx
  and    $0xf,%esi
  and    $0xf,%ecx
  lea    0x30(%rcx),%edi
  add    %edx,%ecx
  cmp    $0x9,%rsi
  mov    %rbx,%rsi
  cmovbe %edi,%ecx
  shr    $0x14,%rsi
  mov    %cl,0x8(%rax)
  mov    %esi,%ecx
  and    $0xf,%esi
  and    $0xf,%ecx
  lea    0x30(%rcx),%edi
  add    %edx,%ecx
  cmp    $0x9,%rsi
  mov    %rbx,%rsi
  cmovbe %edi,%ecx
  shr    $0x18,%rsi
  mov    %cl,0x7(%rax)
  mov    %esi,%ecx
  and    $0xf,%esi
  and    $0xf,%ecx
  lea    0x30(%rcx),%edi
  add    %edx,%ecx
  cmp    $0x9,%rsi
  mov    %rbx,%rsi
  cmovbe %edi,%ecx
  shr    $0x1c,%rsi
  mov    %cl,0x6(%rax)
  mov    %esi,%ecx
  and    $0xf,%esi
  and    $0xf,%ecx
  lea    0x30(%rcx),%edi
  add    %edx,%ecx
  cmp    $0x9,%rsi
  mov    %rbx,%rsi
  cmovbe %edi,%ecx
  shr    $0x20,%rsi
  mov    %cl,0x5(%rax)
  mov    %esi,%ecx
  and    $0xf,%esi
  and    $0xf,%ecx
  lea    0x30(%rcx),%edi
  add    %edx,%ecx
  cmp    $0x9,%rsi
  mov    %rbx,%rsi
  cmovbe %edi,%ecx
  shr    $0x24,%rsi
  mov    %cl,0x4(%rax)
  mov    %esi,%ecx
  and    $0xf,%esi
  and    $0xf,%ecx
  lea    0x30(%rcx),%edi
  add    %edx,%ecx
  cmp    $0x9,%rsi
  mov    %rbx,%rsi
  cmovbe %edi,%ecx
  shr    $0x28,%rsi
  mov    %cl,0x3(%rax)
  mov    %esi,%ecx
  and    $0xf,%esi
  and    $0xf,%ecx
  lea    0x30(%rcx),%edi
  add    %edx,%ecx
  cmp    $0x9,%rsi
  mov    %rbx,%rsi
  cmovbe %edi,%ecx
  shr    $0x2c,%rsi
  mov    %cl,0x2(%rax)
  mov    %esi,%ecx
  and    $0xf,%esi
  and    $0xf,%ecx
  lea    0x30(%rcx),%edi
  add    %edx,%ecx
  cmp    $0x9,%rsi
  cmovbe %edi,%ecx
  shr    $0x30,%rbx
  add    %ebx,%edx
  lea    0x30(%rbx),%esi
  cmp    $0xa,%rbx
  cmovb  %esi,%edx
  mov    %cl,0x1(%rax)
  mov    %dl,(%rax)
  cmp    $0xffffffff,%r12d
  je     L67
  cmp    $0xc,%r12d
  jg     L67
  movslq %r12d,%rcx
  cmpb   $0x37,(%rax,%rcx,1)
  jg     L149
L67:
  cmpb   $0x30,0xc(%rax)
  jne    L114
  cmpb   $0x30,0xb(%rax)
  movb   $0x0,0xc(%rax)
  jne    L114
  cmpb   $0x30,0xa(%rax)
  movb   $0x0,0xb(%rax)
  jne    L114
  cmpb   $0x30,0x9(%rax)
  movb   $0x0,0xa(%rax)
  jne    L114
  cmpb   $0x30,0x8(%rax)
  movb   $0x0,0x9(%rax)
  jne    L114
  cmpb   $0x30,0x7(%rax)
  movb   $0x0,0x8(%rax)
  jne    L114
  cmpb   $0x30,0x6(%rax)
  movb   $0x0,0x7(%rax)
  jne    L114
  cmpb   $0x30,0x5(%rax)
  movb   $0x0,0x6(%rax)
  jne    L114
  cmpb   $0x30,0x4(%rax)
  movb   $0x0,0x5(%rax)
  jne    L114
  cmpb   $0x30,0x3(%rax)
  movb   $0x0,0x4(%rax)
  jne    L114
  cmpb   $0x30,0x2(%rax)
  movb   $0x0,0x3(%rax)
  jne    L114
  cmpb   $0x30,0x1(%rax)
  movb   $0x0,0x2(%rax)
  jne    L114
  cmpb   $0x30,(%rax)
  movb   $0x0,0x1(%rax)
  jne    L114
  movb   $0x0,(%rax)
L114:
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  ret
  nopl   0x0(%rax)
L149:
  lea    -0x1(%rax,%rcx,1),%rdx
  movzbl (%rdx),%edi
  lea    0x1(%rdi),%esi
  cmp    $0x39,%dil
  cmove  %ebp,%esi
  mov    %sil,(%rdx)
  cmp    $0x1,%r12d
  jle    L67
  lea    -0x2(%r12),%esi
  sub    $0x2,%rcx
  sub    %rsi,%rcx
  lea    (%rcx,%rax,1),%rsi
  nopw   0x0(%rax,%rax,1)
L137:
  movzbl (%rdx),%ecx
  and    $0xffffffdf,%ecx
  cmp    $0x47,%cl
  jne    L67
  movb   $0x30,(%rdx)
  movzbl -0x1(%rdx),%ecx
  sub    $0x1,%rdx
  cmp    $0x39,%cl
  je     L122
  add    $0x1,%ecx
  mov    %cl,(%rdx)
  cmp    %rsi,%rdx
  jne    L137
  jmp    L67
  xchg   %ax,%ax
L122:
  mov    %bpl,(%rdx)
  cmp    %rsi,%rdx
  jne    L137
  jmp    L67
```

assistant: ```c
char *ft_itoa_hex(double flo, int p, char spec) {
  int len;
  char *hex;
  unsigned long long n;
  n = *((unsigned long long *)&flo) & 0x000FFFFFFFFFFFFFULL;
  len = 13;
  hex = (char *)malloc(sizeof(char) * (len + 1));
  hex[len] = '\0';
  while (len-- > 0) {
    hex[len] = ((n % 16) > 9) ? (spec + (n % 16) - 10) : ((n % 16) + '0');
    n /= 16;
  }
  if ((len = 13) && p != -1 && p < 13 && hex[p] > '7') {
    hex[p - 1] = (hex[p - 1] != '9') ? (hex[p - 1] + 1) : spec;
    while (--p > 0 && (hex[p] == 'g' || hex[p] == 'G')) {
      hex[p] = '0';
      hex[p - 1] = (hex[p - 1] != '9') ? (hex[p - 1] + 1) : spec;
    }
  }
  while (--len >= 0 && hex[len] == '0')
    hex[len] = '\0';
  return (hex);
}
```