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

```asm
<_dump_buf_with_offset>:
  endbr64
  push   %r15
  push   %r14
  push   %r13
  push   %r12
  push   %rbp
  push   %rbx
  sub    $0x18,%rsp
  mov    %esi,%r12d
  mov    %rdx,0x8(%rsp)
  mov    %esi,%eax
  sub    %edi,%eax
  cmp    %edi,%esi
  cmova  %eax,%r12d
  test   %r12d,%r12d
  jle    L113
  mov    %rdi,%r13
  lea    D65(%rip),%r15
  jmp    L157
L71:
  mov    %r13,%rsi
  lea    D41(%rip),%rdi
  mov    $0x0,%eax
  call   <_printk@plt>
  jmp    L156
L124:
  mov    %r15,%rdi
  mov    $0x0,%eax
  call   <_printk@plt>
L52:
  mov    %ebx,%edx
  shr    $0x1f,%edx
  lea    (%rbx,%rdx,1),%eax
  and    $0x1,%eax
  sub    %edx,%eax
  cmp    $0x1,%eax
  je     L33
L38:
  mov    %ebx,%eax
  sar    $0x1f,%eax
  shr    $0x1d,%eax
  add    %eax,%ebx
  and    $0x7,%ebx
  sub    %eax,%ebx
  cmp    $0x7,%ebx
  je     L2
L145:
  add    $0x1,%rbp
  cmp    $0x10,%rbp
  je     L103
L4:
  mov    %ebp,%ebx
  cmp    %ebp,%r12d
  jle    L124
  movzbl 0x0(%r13,%rbp,1),%esi
  lea    D43(%rip),%rdi
  mov    $0x0,%eax
  call   <_printk@plt>
  jmp    L52
L33:
  lea    D61(%rip),%rdi
  mov    $0x0,%eax
  call   <_printk@plt>
  jmp    L38
L2:
  lea    D61(%rip),%rdi
  mov    $0x0,%eax
  call   <_printk@plt>
  jmp    L145
L103:
  lea    D57(%rip),%rdi
  mov    $0x0,%eax
  call   <_printk@plt>
  mov    $0x0,%ebx
  lea    D78(%rip),%rbp
  jmp    L101
L151:
  mov    %rbp,%rdi
  mov    $0x0,%eax
  call   <_printk@plt>
  add    $0x1,%rbx
  cmp    $0x10,%rbx
  je     L65
L101:
  mov    $0x20,%esi
  cmp    %ebx,%r14d
  jle    L151
  movzbl 0x0(%r13,%rbx,1),%esi
  movzbl %sil,%eax
  sub    $0x20,%eax
  movzbl %sil,%esi
  cmp    $0x5f,%eax
  mov    $0x2e,%eax
  cmovae %eax,%esi
  jmp    L151
L65:
  lea    D50(%rip),%rdi
  mov    $0x0,%eax
  call   <_printk@plt>
  add    $0x10,%r13
  sub    $0x10,%r12d
  test   %r12d,%r12d
  jle    L113
L157:
  mov    0x8(%rsp),%rax
  test   %rax,%rax
  je     L71
  mov    %r13d,%esi
  sub    %eax,%esi
  lea    D41(%rip),%rdi
  mov    $0x0,%eax
  call   <_printk@plt>
L156:
  mov    $0x0,%ebp
  mov    %r12d,%r14d
  jmp    L4
L113:
  add    $0x18,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
```

tool_calls: name: extract_symbolic_data
arguments: data_tag: D65
datatype: string
name: extract_symbolic_data
arguments: data_tag: D41
datatype: string
name: extract_symbolic_data
arguments: data_tag: D43
datatype: string
name: extract_symbolic_data
arguments: data_tag: D61
datatype: string
name: extract_symbolic_data
arguments: data_tag: D57
datatype: string
name: extract_symbolic_data
arguments: data_tag: D78
datatype: string
name: extract_symbolic_data
arguments: data_tag: D50
datatype: string

tool: D65:   

tool: D41: %06X: 

tool: D43: %02X

tool: D61:  

tool: D57:  |

tool: D78: %c

tool: D50: |


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;
  }
}
```