user: 请将这段汇编代码片段转换成等效的C代码:

```asm
<dump_mem>:
  endbr64
  push   %r15
  push   %r14
  push   %r13
  push   %r12
  push   %rbp
  push   %rbx
  sub    $0x48,%rsp
  mov    %rsi,0x18(%rsp)
  mov    %rdx,0x8(%rsp)
  mov    %fs:0x28,%rax
  mov    %rax,0x38(%rsp)
  xor    %eax,%eax
  test   %rdi,%rdi
  je     L52
  mov    0x8(%rsp),%edx
  mov    %rdi,%rsi
  lea    D18(%rip),%rdi
  mov    $0x0,%eax
  call   <ssh_log@plt>
L0:
  movq   $0x0,(%rsp)
  cmpq   $0x0,0x8(%rsp)
  jne    L20
L99:
  mov    0x38(%rsp),%rax
  sub    %fs:0x28,%rax
  jne    L143
  add    $0x48,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
L52:
  mov    0x8(%rsp),%esi
  lea    D71(%rip),%rdi
  call   <ssh_log@plt>
  jmp    L0
L76:
  lea    D42(%rip),%rdi
  mov    $0x0,%eax
  call   <ssh_log@plt>
  add    $0x2,%r12
  movb   $0x20,0x20(%rsp,%r14,1)
L71:
  add    $0x1,%rbx
  cmp    %rbx,%rbp
  jbe    L107
L140:
  mov    0x0(%r13,%rbx,4),%esi
  lea    D19(%rip),%rdi
  mov    $0x0,%eax
  call   <ssh_log@plt>
  mov    0x0(%r13,%rbx,4),%eax
  lea    -0x20(%rax),%edx
  cmp    $0x5f,%edx
  cmovae %r15d,%eax
  lea    0x1(%r12),%r14
  mov    %al,0x20(%rsp,%r12,1)
  cmp    $0x7,%rbx
  je     L76
  mov    %r14,%r12
  jmp    L71
L107:
  movb   $0x0,0x20(%rsp,%r12,1)
  add    %rbp,(%rsp)
  cmpq   $0xf,0x10(%rsp)
  ja     L119
L58:
  add    $0x1,%rbp
  jmp    L132
L122:
  lea    D42(%rip),%rdi
  mov    $0x0,%eax
  call   <ssh_log@plt>
L65:
  add    $0x1,%rbp
L132:
  lea    D17(%rip),%rdi
  mov    $0x0,%eax
  call   <ssh_log@plt>
  cmp    $0x8,%rbp
  je     L122
  cmp    $0xf,%rbp
  jbe    L65
L119:
  lea    0x20(%rsp),%rsi
  lea    D35(%rip),%rdi
  mov    $0x0,%eax
  call   <ssh_log@plt>
  mov    0x8(%rsp),%rcx
  cmp    %rcx,(%rsp)
  jae    L99
L20:
  lea    D46(%rip),%rdi
  mov    $0x0,%eax
  call   <ssh_log@plt>
  mov    0x8(%rsp),%rax
  mov    %rax,%rcx
  mov    (%rsp),%rdx
  sub    %rdx,%rcx
  mov    %rcx,0x10(%rsp)
  mov    $0x10,%ebp
  cmp    %rbp,%rcx
  cmovbe %rcx,%rbp
  cmp    %rdx,%rax
  je     L139
  mov    0x18(%rsp),%rax
  lea    (%rax,%rdx,4),%r13
  mov    $0x0,%r12d
  mov    $0x0,%ebx
  mov    $0x2e,%r15d
  jmp    L140
L139:
  movb   $0x0,0x20(%rsp)
  add    %rbp,(%rsp)
  jmp    L58
L143:
  call   <__stack_chk_fail@plt>
```

tool_calls: name: parse_data
arguments: tag: D18
data_type: string
name: parse_data
arguments: tag: D71
data_type: string
name: parse_data
arguments: tag: D42
data_type: string
name: parse_data
arguments: tag: D19
data_type: string
name: parse_data
arguments: tag: D17
data_type: string
name: parse_data
arguments: tag: D35
data_type: string
name: parse_data
arguments: tag: D46
data_type: string

tool: D18: %s (%u bytes)


tool: D71: * dumping %u bytes


tool: D42:  

tool: D19: %02x 

tool: D17:    

tool: D35: | %-17s |


tool: D46: | 

assistant: ```c
void dump_mem(const char *label, const void *data, size_t len) {
  char str[18];
  size_t cur, str_len;
  if (label == NULL)
    ssh_log("* dumping %u bytes\n", (unsigned int)len);
  else
    ssh_log("%s (%u bytes)\n", label, (unsigned int)len);
  cur = 0;
  while (cur < len) {
    const uint8_t *line = (const uint8_t *)data + cur;
    size_t i, si;
    ssh_log("| ");
    str_len = (len - cur > 16) ? 16 : len - cur;
    for (si = i = 0; i < str_len; i++) {
      ssh_log("%02x ", line[i]);
      str[si++] = (line[i] >= 32 && line[i] < 127) ? line[i] : '.';
      if (i == 7) {
        ssh_log(" ");
        str[si++] = ' ';
      }
    }
    str[si++] = '\0';
    cur += str_len;
    for (i = str_len; i < 16; i++) {
      ssh_log("   ");
      if (i == 7)
        ssh_log(" ");
    }
    ssh_log("| %-17s |\n", str);
  }
}
```