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

```asm
<DumpHex>:
  endbr64
  push   %r15
  push   %r14
  push   %r13
  push   %r12
  push   %rbp
  push   %rbx
  sub    $0x48,%rsp
  mov    %fs:0x28,%rax
  mov    %rax,0x38(%rsp)
  xor    %eax,%eax
  test   %edx,%edx
  je     L145
  mov    %rdi,%r14
  mov    %rsi,%rbp
  lea    -0x1(%rdx),%eax
  lea    0x4(%rsi,%rax,4),%rax
  mov    %rax,0x10(%rsp)
  mov    $0x0,%ebx
  lea    0x20(%rsp),%rax
  mov    %rax,0x18(%rsp)
  jmp    L151
L92:
  movb   $0x0,0x31(%rsp)
  mov    0x18(%rsp),%rdx
  lea    D36(%rip),%rsi
  mov    %r14,%rdi
  mov    $0x0,%eax
  call   <fprintf@plt>
  mov    $0x0,%ebx
  jmp    L9
L90:
  movb   $0x20,0x28(%rsp)
  mov    %r14,%rsi
  mov    $0x20,%edi
  call   <fputc@plt>
  mov    $0x9,%ebx
  jmp    L9
L155:
  mov    $0x2e,%r13d
L62:
  mov    %ebx,%eax
  mov    %r13b,0x20(%rsp,%rax,1)
  mov    0x8(%rsp),%rax
  mov    (%rax),%edx
  lea    D9(%rip),%rsi
  mov    %r14,%rdi
  mov    $0x0,%eax
  call   <fprintf@plt>
  add    $0x1,%ebx
  add    $0x4,%rbp
  cmp    %rbp,0x10(%rsp)
  je     L55
L151:
  cmp    $0x11,%ebx
  je     L92
  cmp    $0x8,%ebx
  je     L90
L9:
  mov    %rbp,0x8(%rsp)
  mov    0x0(%rbp),%r12d
  mov    %r12d,%r13d
  movsbl %r12b,%r15d
  mov    %r15d,%edi
  call   <isprint@plt>
  test   %rax,%rax
  je     L155
  cmp    $0x20,%r12b
  je     L62
  mov    %r15d,%edi
  call   <isspace@plt>
  test   %eax,%eax
  mov    $0x2e,%eax
  cmovne %eax,%r13d
  jmp    L62
L55:
  test   %ebx,%ebx
  je     L145
  cmp    $0x10,%ebx
  ja     L7
  lea    D21(%rip),%rbp
  lea    D48(%rip),%r12
  jmp    L68
L28:
  movb   $0x20,0x28(%rsp)
  mov    %r14,%rcx
  mov    $0x4,%edx
  mov    $0x1,%esi
  mov    %r12,%rdi
  call   <fwrite@plt>
  movb   $0x0,0x29(%rsp)
  mov    $0xa,%ebx
L68:
  cmp    $0x8,%ebx
  je     L28
  mov    %r14,%rcx
  mov    $0x3,%edx
  mov    $0x1,%esi
  mov    %rbp,%rdi
  call   <fwrite@plt>
  mov    %ebx,%eax
  movb   $0x0,0x20(%rsp,%rax,1)
  add    $0x1,%ebx
  cmp    $0x10,%ebx
  jbe    L68
L7:
  mov    %ebx,%ebx
  movb   $0x0,0x20(%rsp,%rbx,1)
  lea    0x20(%rsp),%rdx
  lea    D36(%rip),%rsi
  mov    %r14,%rdi
  mov    $0x0,%eax
  call   <fprintf@plt>
L145:
  mov    0x38(%rsp),%rax
  sub    %fs:0x28,%rax
  jne    L76
  add    $0x48,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
L76:
  call   <__stack_chk_fail@plt>
```

tool_calls: name: disassemble_data
arguments: label: D36
type: string
name: disassemble_data
arguments: label: D9
type: string
name: disassemble_data
arguments: label: D21
type: string
name: disassemble_data
arguments: label: D48
type: string

tool: D36:   %s


tool: D9: %02X 

tool: D21:    

tool: D48:     

assistant: ```c
void DumpHex(FILE *fp, const uint8_t *data, unsigned len) {
  char str[18];
  unsigned i;
  unsigned pos;
  char c;
  for (i = 0, pos = 0; i < len; i++, pos++) {
    if (pos == 17) {
      str[pos] = 0;
      fprintf(fp, "  %s\n", str);
      pos = 0;
    } else if (pos == 8) {
      str[pos] = ' ';
      pos++;
      fprintf(fp, "%s", " ");
    }
    c = (char)data[i];
    if (isprint(c) && (c == ' ' || !isspace(c)))
      str[pos] = c;
    else
      str[pos] = '.';
    fprintf(fp, "%02X ", data[i]);
  }
  if (pos) {
    for (; pos < 17; pos++) {
      if (pos == 8) {
        str[pos] = ' ';
        pos++;
        fprintf(fp, "%s", "    ");
      } else {
        fprintf(fp, "%s", "   ");
      }
      str[pos] = 0;
    }
    str[pos] = 0;
    fprintf(fp, "  %s\n", str);
  }
}
```