user: Translate the below assembly code into C programming language:

```asm
<dump_mem>:
  endbr64
  push   %r15
  push   %r14
  push   %r13
  push   %r12
  push   %rbp
  push   %rbx
  sub    $0x58,%rsp
  mov    %rsi,0x20(%rsp)
  mov    %rdx,0x8(%rsp)
  mov    %fs:0x28,%rax
  mov    %rax,0x48(%rsp)
  xor    %eax,%eax
  test   %rdi,%rdi
  je     L71
  mov    %rdi,%rsi
  xor    %eax,%eax
  lea    D0(%rip),%rdi
  call   <ssh_log@plt>
L77:
  lea    0x30(%rsp),%rax
  cmpq   $0x0,0x8(%rsp)
  movq   $0x0,(%rsp)
  lea    D73(%rip),%r13
  mov    %rax,0x28(%rsp)
  lea    D19(%rip),%rbp
  je     L109
  nopw   0x0(%rax,%rax,1)
L121:
  xor    %eax,%eax
  lea    D33(%rip),%rdi
  mov    $0x10,%ebx
  call   <ssh_log@plt>
  mov    (%rsp),%rcx
  mov    0x8(%rsp),%rax
  sub    %rcx,%rax
  cmp    %rbx,%rax
  mov    %rax,0x18(%rsp)
  cmovbe %rax,%rbx
  mov    0x20(%rsp),%rax
  xor    %r15d,%r15d
  xor    %r14d,%r14d
  lea    (%rax,%rcx,4),%r12
  jmp    L86
  nopl   0x0(%rax)
L87:
  add    $0x1,%r14
  mov    %rdx,%r15
  cmp    %r14,%rbx
  je     L63
L86:
  mov    (%r12,%r14,4),%esi
  xor    %eax,%eax
  mov    %r13,%rdi
  call   <ssh_log@plt>
  mov    (%r12,%r14,4),%eax
  mov    $0x2e,%ecx
  lea    -0x20(%rax),%edx
  cmp    $0x5f,%edx
  lea    0x1(%r15),%rdx
  cmovae %ecx,%eax
  mov    %al,0x30(%rsp,%r15,1)
  cmp    $0x7,%r14
  jne    L87
  xor    %eax,%eax
  mov    %rdx,0x10(%rsp)
  add    $0x1,%r14
  add    $0x2,%r15
  lea    D46(%rip),%rdi
  call   <ssh_log@plt>
  mov    0x10(%rsp),%rdx
  movb   $0x20,0x30(%rsp,%rdx,1)
  cmp    %r14,%rbx
  jne    L86
  nopl   (%rax)
L63:
  add    %rbx,(%rsp)
  cmpq   $0xf,0x18(%rsp)
  movb   $0x0,0x30(%rsp,%r15,1)
  jbe    L50
  jmp    L49
  nopl   0x0(%rax)
L14:
  cmp    $0x10,%r12
  je     L49
L138:
  mov    %r12,%rbx
L50:
  mov    %rbp,%rdi
  xor    %eax,%eax
  lea    0x1(%rbx),%r12
  call   <ssh_log@plt>
  cmp    $0x7,%rbx
  jne    L14
  lea    D46(%rip),%rdi
  xor    %eax,%eax
  call   <ssh_log@plt>
  jmp    L138
  nopl   (%rax)
L49:
  mov    0x28(%rsp),%rsi
  lea    D20(%rip),%rdi
  xor    %eax,%eax
  call   <ssh_log@plt>
  mov    (%rsp),%rcx
  cmp    %rcx,0x8(%rsp)
  ja     L121
L109:
  mov    0x48(%rsp),%rax
  sub    %fs:0x28,%rax
  jne    L40
  add    $0x58,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
L71:
  mov    %edx,%esi
  lea    D79(%rip),%rdi
  call   <ssh_log@plt>
  jmp    L77
L40:
  call   <__stack_chk_fail@plt>
```

tool_calls: name: disassemble_data
arguments: data_label: D0
type: string
name: disassemble_data
arguments: data_label: D73
type: string
name: disassemble_data
arguments: data_label: D19
type: string
name: disassemble_data
arguments: data_label: D33
type: string
name: disassemble_data
arguments: data_label: D46
type: string
name: disassemble_data
arguments: data_label: D20
type: string
name: disassemble_data
arguments: data_label: D79
type: string

tool: D0: %s (%u bytes)


tool: D73: %02x 

tool: D19:    

tool: D33: | 

tool: D46:  

tool: D20: | %-17s |


tool: D79: * dumping %u bytes


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