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

```asm
<_dump_buf_with_offset>:
  endbr64
  push   %r15
  mov    %esi,%eax
  push   %r14
  sub    %edi,%eax
  push   %r13
  push   %r12
  push   %rbp
  push   %rbx
  mov    %esi,%ebx
  sub    $0x18,%rsp
  cmp    %edi,%esi
  cmova  %eax,%ebx
  mov    %rdx,0x8(%rsp)
  test   %ebx,%ebx
  jle    L102
  mov    %rdi,%rbp
  lea    D3(%rip),%r12
  lea    D11(%rip),%r14
  nopl   0x0(%rax,%rax,1)
L6:
  mov    0x8(%rsp),%rax
  test   %rax,%rax
  je     L17
  mov    %ebp,%esi
  lea    D78(%rip),%rdi
  sub    %eax,%esi
  xor    %eax,%eax
  call   <_printk@plt>
L58:
  xor    %r15d,%r15d
  jmp    L15
  nopl   (%rax)
L111:
  movzbl 0x0(%rbp,%r15,1),%esi
  xor    %eax,%eax
  lea    D87(%rip),%rdi
  call   <_printk@plt>
  test   $0x1,%r13b
  jne    L84
L29:
  mov    %r13d,%ecx
  and    $0x7,%ecx
  cmp    $0x7,%ecx
  je     L125
L49:
  add    $0x1,%r15
  cmp    $0x10,%r15
  je     L43
L15:
  mov    %r15d,%r13d
  cmp    %r15d,%ebx
  jg     L111
  xor    %eax,%eax
  mov    %r14,%rdi
  call   <_printk@plt>
  test   $0x1,%r13b
  je     L29
L84:
  lea    D61(%rip),%rdi
  xor    %eax,%eax
  call   <_printk@plt>
  mov    %r13d,%ecx
  and    $0x7,%ecx
  cmp    $0x7,%ecx
  jne    L49
L125:
  lea    D61(%rip),%rdi
  xor    %eax,%eax
  add    $0x1,%r15
  call   <_printk@plt>
  cmp    $0x10,%r15
  jne    L15
L43:
  lea    D89(%rip),%rdi
  xor    %eax,%eax
  xor    %r15d,%r15d
  call   <_printk@plt>
  nopl   0x0(%rax)
L79:
  mov    $0x20,%esi
  cmp    %r15d,%ebx
  jle    L89
  movzbl 0x0(%rbp,%r15,1),%esi
  lea    -0x20(%rsi),%eax
  cmp    $0x5e,%eax
  mov    $0x2e,%eax
  cmova  %eax,%esi
L89:
  mov    %r12,%rdi
  xor    %eax,%eax
  add    $0x1,%r15
  call   <_printk@plt>
  cmp    $0x10,%r15
  jne    L79
  lea    D71(%rip),%rdi
  xor    %eax,%eax
  sub    $0x10,%ebx
  add    $0x10,%rbp
  call   <_printk@plt>
  test   %ebx,%ebx
  jg     L6
L102:
  add    $0x18,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
  cs nopw 0x0(%rax,%rax,1)
L17:
  mov    %rbp,%rsi
  lea    D78(%rip),%rdi
  xor    %eax,%eax
  call   <_printk@plt>
  jmp    L58
```

tool_calls: name: unpack_data
arguments: data_label: D3
type_infered: string
name: unpack_data
arguments: data_label: D11
type_infered: string
name: unpack_data
arguments: data_label: D78
type_infered: string
name: unpack_data
arguments: data_label: D87
type_infered: string
name: unpack_data
arguments: data_label: D61
type_infered: string
name: unpack_data
arguments: data_label: D89
type_infered: string
name: unpack_data
arguments: data_label: D71
type_infered: string

tool: D3: %c

tool: D11:   

tool: D78: %06X: 

tool: D87: %02X

tool: D61:  

tool: D89:  |

tool: D71: |


assistant: ```c
void _dump_buf_with_offset(unsigned char *p, int s, unsigned char *base) {
  int i, c;
  if ((unsigned int)s > (unsigned int)p) {
    s = (unsigned int)s - (unsigned int)p;
  }
  while (s > 0) {
    if (base) {
      _printk("%06X: ", (int)p - (int)base);
    } else {
      _printk("%06X: ", p);
    }
    for (i = 0; i < 16; i++) {
      if (i < s) {
        _printk("%02X", p[i] & 0xFF);
      } else {
        _printk("  ");
      }
      if ((i % 2) == 1)
        _printk(" ");
      if ((i % 8) == 7)
        _printk(" ");
    }
    _printk(" |");
    for (i = 0; i < 16; i++) {
      if (i < s) {
        c = p[i] & 0xFF;
        if ((c < 0x20) || (c >= 0x7F))
          c = '.';
      } else {
        c = ' ';
      }
      _printk("%c", c);
    }
    _printk("|\n");
    s -= 16;
    p += 16;
  }
}
```