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

```asm
<convertToTitle>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  sub    $0x30,%rsp
  mov    %edi,-0x24(%rbp)
  cmpl   $0x0,-0x24(%rbp)
  jg     L90
  mov    $0x0,%eax
  jmp    L42
L90:
  cmpl   $0x1a,-0x24(%rbp)
  jg     L40
  mov    $0x2,%edi
  call   <malloc@plt>
  mov    %rax,-0x8(%rbp)
  mov    -0x24(%rbp),%eax
  add    $0x40,%eax
  mov    %eax,%edx
  mov    -0x8(%rbp),%rax
  mov    %dl,(%rax)
  mov    -0x8(%rbp),%rax
  add    $0x1,%rax
  movb   $0x0,(%rax)
  mov    -0x8(%rbp),%rax
  jmp    L42
L40:
  mov    $0x1,%edi
  call   <malloc@plt>
  mov    %rax,-0x8(%rbp)
  movq   $0x0,-0x8(%rbp)
  movl   $0x0,-0x14(%rbp)
  jmp    L43
L24:
  mov    -0x24(%rbp),%eax
  movslq %eax,%rdx
  imul   $0x4ec4ec4f,%rdx,%rdx
  shr    $0x20,%rdx
  sar    $0x3,%edx
  mov    %eax,%ecx
  sar    $0x1f,%ecx
  sub    %ecx,%edx
  imul   $0x1a,%edx,%edx
  sub    %edx,%eax
  mov    %eax,-0x10(%rbp)
  mov    -0x24(%rbp),%eax
  sub    $0x1,%eax
  movslq %eax,%rdx
  imul   $0x4ec4ec4f,%rdx,%rdx
  shr    $0x20,%rdx
  sar    $0x3,%edx
  sar    $0x1f,%eax
  mov    %eax,%ecx
  mov    %edx,%eax
  sub    %ecx,%eax
  mov    %eax,-0x24(%rbp)
  mov    -0x8(%rbp),%rax
  mov    $0x9,%esi
  mov    %rax,%rdi
  call   <realloc@plt>
  mov    %rax,-0x8(%rbp)
  cmpl   $0x0,-0x10(%rbp)
  jne    L9
  mov    -0x14(%rbp),%eax
  lea    0x1(%rax),%edx
  mov    %edx,-0x14(%rbp)
  movslq %eax,%rdx
  mov    -0x8(%rbp),%rax
  add    %rdx,%rax
  movb   $0x5a,(%rax)
  jmp    L43
L9:
  mov    -0x10(%rbp),%eax
  lea    0x40(%rax),%ecx
  mov    -0x14(%rbp),%eax
  lea    0x1(%rax),%edx
  mov    %edx,-0x14(%rbp)
  movslq %eax,%rdx
  mov    -0x8(%rbp),%rax
  add    %rdx,%rax
  mov    %ecx,%edx
  mov    %dl,(%rax)
L43:
  cmpl   $0x0,-0x24(%rbp)
  jg     L24
  mov    -0x14(%rbp),%eax
  movslq %eax,%rdx
  mov    -0x8(%rbp),%rax
  add    %rdx,%rax
  movb   $0x0,(%rax)
  mov    -0x8(%rbp),%rax
  mov    %rax,%rdi
  call   <strlen@plt>
  mov    %eax,-0xc(%rbp)
  movl   $0x0,-0x10(%rbp)
  jmp    L4
L65:
  mov    -0xc(%rbp),%eax
  sub    $0x1,%eax
  sub    -0x10(%rbp),%eax
  movslq %eax,%rdx
  mov    -0x8(%rbp),%rax
  add    %rdx,%rax
  movzbl (%rax),%eax
  movsbl %al,%eax
  mov    %eax,-0x14(%rbp)
  mov    -0x10(%rbp),%eax
  movslq %eax,%rdx
  mov    -0x8(%rbp),%rax
  add    %rdx,%rax
  mov    -0xc(%rbp),%edx
  sub    $0x1,%edx
  sub    -0x10(%rbp),%edx
  movslq %edx,%rcx
  mov    -0x8(%rbp),%rdx
  add    %rcx,%rdx
  movzbl (%rax),%eax
  mov    %al,(%rdx)
  mov    -0x10(%rbp),%eax
  movslq %eax,%rdx
  mov    -0x8(%rbp),%rax
  add    %rdx,%rax
  mov    -0x14(%rbp),%edx
  mov    %dl,(%rax)
  addl   $0x1,-0x10(%rbp)
L4:
  mov    -0xc(%rbp),%eax
  mov    %eax,%edx
  shr    $0x1f,%edx
  add    %edx,%eax
  sar    %eax
  cmp    %eax,-0x10(%rbp)
  jl     L65
  mov    -0x8(%rbp),%rax
L42:
  leave
  ret
```

assistant: ```c
char *convertToTitle(int n) {
  char *buf;
  if (n <= 0)
    return NULL;
  if (n <= 26) {
    buf = malloc(2);
    buf[0] = 'A' + n - 1;
    buf[1] = 0;
    return buf;
  }
  int p, r, l;
  buf = malloc(1);
  buf = 0;
  p = 0;
  while (n > 0) {
    r = n % 26;
    n = (n - 1) / 26;
    buf = realloc(buf, sizeof(buf) + 1);
    if (r == 0)
      buf[p++] = 'Z';
    else
      buf[p++] = 'A' + r - 1;
  }
  buf[p] = 0;
  for (l = strlen(buf), r = 0; r < l / 2; r++) {
    p = buf[l - 1 - r];
    buf[l - 1 - r] = buf[r];
    buf[r] = p;
  }
  return buf;
}
```