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

```asm
<hexdump>:
  endbr64
  push   %r15
  push   %r14
  mov    %rcx,%r14
  push   %r13
  push   %r12
  mov    %rsi,%r12
  push   %rbp
  push   %rbx
  sub    $0x58,%rsp
  mov    %rdx,0x10(%rsp)
  mov    %fs:0x28,%rax
  mov    %rax,0x48(%rsp)
  xor    %eax,%eax
  test   %rdi,%rdi
  je     L27
  mov    %rdi,%rdx
  lea    D39(%rip),%rsi
  mov    %rcx,%rdi
  call   <fprintf@plt>
L27:
  mov    0x10(%rsp),%rax
  mov    %eax,%ebp
  test   %eax,%eax
  je     L18
  mov    0x10(%rsp),%eax
  xor    %r15d,%r15d
  lea    D45(%rip),%r13
  mov    %rax,0x8(%rsp)
  lea    0x30(%rsp),%rax
  mov    %rax,0x18(%rsp)
  lea    D25(%rip),%rax
  mov    %rax,0x20(%rsp)
  nopl   0x0(%rax)
L52:
  mov    %r15d,%ebx
  mov    %r15d,%r8d
  and    $0xf,%ebx
  jne    L163
L166:
  test   %r15d,%r15d
  jne    L147
L145:
  mov    %r8d,%edx
  lea    D30(%rip),%rsi
  mov    %r14,%rdi
  xor    %eax,%eax
  call   <fprintf@plt>
L74:
  movzbl (%r12,%r15,1),%edx
  mov    %r13,%rsi
  mov    %r14,%rdi
  xor    %eax,%eax
  call   <fprintf@plt>
  movzbl (%r12,%r15,1),%eax
  lea    -0x20(%rax),%edx
  cmp    $0x5e,%dl
  jbe    L135
  mov    %ebx,%eax
  add    $0x1,%ebx
  add    $0x1,%r15
  movb   $0x2e,0x30(%rsp,%rax,1)
  movb   $0x0,0x30(%rsp,%rbx,1)
  cmp    0x8(%rsp),%r15
  jne    L52
L157:
  mov    0x10(%rsp),%eax
  and    $0xf,%eax
  lea    -0x1(%rax),%edx
  cmp    $0x7,%edx
  jbe    L46
  test   %eax,%eax
  je     L92
L139:
  lea    D52(%rip),%rbx
  nopw   0x0(%rax,%rax,1)
L66:
  mov    %r14,%rcx
  mov    $0x3,%edx
  mov    $0x1,%esi
  mov    %rbx,%rdi
  call   <fwrite@plt>
  add    $0x1,%ebp
  test   $0xf,%bpl
  jne    L66
L92:
  mov    0x18(%rsp),%rdx
  mov    0x20(%rsp),%rsi
  xor    %eax,%eax
  mov    %r14,%rdi
  call   <fprintf@plt>
  mov    0x48(%rsp),%rax
  sub    %fs:0x28,%rax
  jne    L103
  add    $0x58,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
  nopl   (%rax)
L135:
  mov    %ebx,%edx
  add    $0x1,%ebx
  add    $0x1,%r15
  mov    %al,0x30(%rsp,%rdx,1)
  movb   $0x0,0x30(%rsp,%rbx,1)
  cmp    %r15,0x8(%rsp)
  je     L157
  mov    %r15d,%ebx
  mov    %r15d,%r8d
  and    $0xf,%ebx
  je     L166
L163:
  test   $0x7,%r15b
  jne    L74
  mov    %r14,%rsi
  mov    $0x20,%edi
  call   <fputc@plt>
  jmp    L74
L147:
  mov    0x18(%rsp),%rdx
  mov    0x20(%rsp),%rsi
  mov    %r14,%rdi
  xor    %eax,%eax
  mov    %r15d,0x2c(%rsp)
  call   <fprintf@plt>
  mov    0x2c(%rsp),%r8d
  jmp    L145
  nopl   0x0(%rax,%rax,1)
L46:
  mov    %r14,%rsi
  mov    $0x20,%edi
  call   <fputc@plt>
  jmp    L139
  nopw   0x0(%rax,%rax,1)
L18:
  lea    0x30(%rsp),%rax
  mov    %rax,0x18(%rsp)
  lea    D25(%rip),%rax
  mov    %rax,0x20(%rsp)
  jmp    L92
L103:
  call   <__stack_chk_fail@plt>
```

tool_calls: name: retrieve_data
arguments: label: D39
type_guessed: string
name: retrieve_data
arguments: label: D45
type_guessed: string
name: retrieve_data
arguments: label: D25
type_guessed: string
name: retrieve_data
arguments: label: D30
type_guessed: string
name: retrieve_data
arguments: label: D52
type_guessed: string

tool: D39: %s:


tool: D45:  %02x

tool: D25:   |%s|


tool: D30: %08x 

tool: D52:    

assistant: ```c
void hexdump(const char *desc, const void *addr, size_t len, FILE *fp) {
  unsigned int i;
  unsigned char buf[17];
  const unsigned char *pc = (const unsigned char *)addr;
  if (desc != NULL)
    fprintf(fp, "%s:\n", desc);
  for (i = 0; i < (unsigned int)len; i++) {
    if ((i % 16) == 0) {
      if (i != 0)
        fprintf(fp, "  |%s|\n", buf);
      fprintf(fp, "%08x ", i);
    } else if ((i % 8) == 0) {
      fprintf(fp, " ");
    }
    fprintf(fp, " %02x", pc[i]);
    if ((pc[i] < 0x20) || (pc[i] > 0x7e)) {
      buf[i % 16] = '.';
    } else {
      buf[i % 16] = pc[i];
    }
    buf[(i % 16) + 1] = '\0';
  }
  if (i % 16 <= 8 && i % 16 != 0)
    fprintf(fp, " ");
  while ((i % 16) != 0) {
    fprintf(fp, "   ");
    i++;
  }
  fprintf(fp, "  |%s|\n", buf);
}
```