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     L75
  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    L158
L80:
  movb   $0x0,0x31(%rsp)
  mov    0x18(%rsp),%rdx
  lea    D13(%rip),%rsi
  mov    %r14,%rdi
  mov    $0x0,%eax
  call   <fprintf@plt>
  mov    $0x0,%ebx
  jmp    L13
L113:
  movb   $0x20,0x28(%rsp)
  mov    %r14,%rsi
  mov    $0x20,%edi
  call   <fputc@plt>
  mov    $0x9,%ebx
  jmp    L13
L136:
  mov    $0x2e,%r13d
L119:
  mov    %ebx,%eax
  mov    %r13b,0x20(%rsp,%rax,1)
  mov    0x8(%rsp),%rax
  mov    (%rax),%edx
  lea    D19(%rip),%rsi
  mov    %r14,%rdi
  mov    $0x0,%eax
  call   <fprintf@plt>
  add    $0x1,%ebx
  add    $0x4,%rbp
  cmp    0x10(%rsp),%rbp
  je     L54
L158:
  cmp    $0x11,%ebx
  je     L80
  cmp    $0x8,%ebx
  je     L113
L13:
  mov    %rbp,0x8(%rsp)
  mov    0x0(%rbp),%r12d
  mov    %r12d,%r13d
  movsbl %r12b,%r15d
  mov    %r15d,%edi
  call   <isprint@plt>
  test   %rax,%rax
  je     L136
  cmp    $0x20,%r12b
  je     L119
  mov    %r15d,%edi
  call   <isspace@plt>
  test   %eax,%eax
  mov    $0x2e,%eax
  cmovne %eax,%r13d
  jmp    L119
L54:
  test   %ebx,%ebx
  je     L75
  mov    %ebx,%eax
  movb   $0x0,0x20(%rsp,%rax,1)
  cmp    $0x10,%ebx
  ja     L40
  lea    D42(%rip),%rbp
  lea    D17(%rip),%r12
  jmp    L12
L133:
  movb   $0x20,0x28(%rsp)
  mov    %r14,%rcx
  mov    $0x4,%edx
  mov    $0x1,%esi
  mov    %r12,%rdi
  call   <fwrite@plt>
  mov    $0xa,%ebx
L12:
  cmp    $0x8,%ebx
  je     L133
  mov    %r14,%rcx
  mov    $0x3,%edx
  mov    $0x1,%esi
  mov    %rbp,%rdi
  call   <fwrite@plt>
  add    $0x1,%ebx
  cmp    $0x10,%ebx
  jbe    L12
L40:
  lea    0x20(%rsp),%rdx
  lea    D13(%rip),%rsi
  mov    %r14,%rdi
  mov    $0x0,%eax
  call   <fprintf@plt>
L75:
  mov    0x38(%rsp),%rax
  sub    %fs:0x28,%rax
  jne    L87
  add    $0x48,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
L87:
  call   <__stack_chk_fail@plt>
```

tool_calls: name: disassemble_data
arguments: tag: D13
data_type: string
name: disassemble_data
arguments: tag: D19
data_type: string
name: disassemble_data
arguments: tag: D42
data_type: string
name: disassemble_data
arguments: tag: D17
data_type: string

tool: D13:   %s


tool: D19: %02X 

tool: D42:    

tool: D17:     

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) {
    str[pos] = 0;
    for (; pos < 17; pos++) {
      if (pos == 8) {
        str[pos] = ' ';
        pos++;
        fprintf(fp, "%s", "    ");
      } else {
        fprintf(fp, "%s", "   ");
      }
    }
    fprintf(fp, "  %s\n", str);
  }
}
```