user: Converte this assembly snippet into its equivalent C code:

```asm
<prtable>:
  endbr64
  push   %r15
  push   %r14
  push   %r13
  push   %r12
  push   %rbp
  push   %rbx
  sub    $0x38,%rsp
  mov    %esi,0x4(%rsp)
  mov    %r8,0x8(%rsp)
  mov    %r9,0x10(%rsp)
  test   %esi,%esi
  jne    L207
  add    $0x38,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
L207:
  mov    %edx,%ebx
  mov    %r9,%rdx
  mov    %rdi,%r12
  mov    %ecx,%r13d
  call   <get_maxlen@plt>
  lea    0x1(%rax),%edx
  mov    %edx,0x1c(%rsp)
  test   %ebx,%ebx
  jle    L143
L140:
  mov    0x4(%rsp),%eax
  sub    $0x1,%eax
  cltd
  mov    %eax,0x24(%rsp)
  idiv   %ebx
  mov    %eax,0x2c(%rsp)
  add    $0x1,%eax
  mov    %eax,0x20(%rsp)
  test   %eax,%eax
  jle    L138
  movl   $0x1,0x28(%rsp)
  mov    0x28(%rsp),%edx
  nop
L127:
  mov    0x4(%rsp),%eax
  xor    %r14d,%r14d
  jmp    L117
  nopl   0x0(%rax)
L119:
  lea    0x1(%r14),%r10d
  cmp    %edx,%r10d
  je     L156
  mov    %r10d,%r14d
L117:
  cmp    %eax,%r14d
  jl     L119
L160:
  mov    D2(%rip),%rax
  xor    %r14d,%r14d
  xor    %esi,%esi
  mov    %r14d,%edx
  mov    (%rax),%edi
  call   <getyx@plt>
  mov    %r14d,%edi
  call   <__USE@plt>
  xor    %esi,%esi
  mov    $0x1,%edi
  call   <move@plt>
  mov    0x28(%rsp),%ecx
  lea    0x1(%rcx),%eax
  cmp    %ecx,0x2c(%rsp)
  jl     L138
  mov    %eax,0x28(%rsp)
  mov    %eax,%edx
  jmp    L127
L156:
  mov    0x20(%rsp),%ebp
  mov    0x28(%rsp),%r13d
  mov    %r10d,0x18(%rsp)
  xor    %eax,%eax
  mov    0x1c(%rsp),%ebx
  add    %r13d,%ebp
  mov    %ebp,%r15d
  mov    %eax,%ebp
L125:
  mov    0x8(%rsp),%rax
  mov    %r14d,%esi
  mov    %r12,%rdi
  call   *%rax
  mov    0x10(%rsp),%rax
  mov    %r14d,%esi
  mov    %r12,%rdi
  call   *%rax
  mov    0x18(%rsp),%edx
  add    %eax,%ebp
  cmp    %edx,0x4(%rsp)
  jle    L160
  lea    0x1(%r13),%eax
  cmp    %r15d,%eax
  jge    L183
  mov    0x24(%rsp),%edx
  mov    %r13d,%edi
  lea    0x1(%r14),%esi
  sub    %edi,%esi
  lea    (%rdx,%r13,1),%ecx
  sub    %r14d,%ecx
  mov    %ecx,%r13d
  jmp    L37
  nopl   0x0(%rax)
L171:
  add    $0x1,%eax
  cmp    %r15d,%eax
  je     L206
L37:
  lea    (%rsi,%rax,1),%r14d
  cmp    %eax,%r13d
  jne    L171
L158:
  add    0x1c(%rsp),%ebx
  add    0x20(%rsp),%r15d
  cmp    0x4(%rsp),%r14d
  jge    L160
L161:
  lea    0x1(%r14),%eax
  mov    %eax,0x18(%rsp)
  jmp    L125
  nop
L206:
  mov    %r15d,%r13d
  cmp    %ebx,%ebp
  jge    L158
  nopw   0x0(%rax,%rax,1)
L62:
  mov    $0x20,%edi
  add    $0x1,%ebp
  call   <addch@plt>
  cmp    %ebx,%ebp
  jne    L62
  jmp    L158
L183:
  mov    %edx,%r14d
  mov    %eax,%r13d
  cmp    %ebp,%ebx
  jg     L62
  add    0x1c(%rsp),%ebx
  add    0x20(%rsp),%r15d
  jmp    L161
L138:
  add    $0x38,%rsp
  xor    %eax,%eax
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  jmp    10d0 <refresh@plt>
L143:
  mov    %r13d,%eax
  mov    %edx,%ecx
  cltd
  idiv   %ecx
  mov    %eax,%ebx
  test   %eax,%eax
  jne    L140
  mov    $0x5,%ebx
  jmp    L140
```

assistant: ```c
void prtable(const char *const base[], int num, int d_cols, int width, void (*prentry)(const char *const[], int), int (*length)(const char *const[], int)) {
  int c, j;
  int a, b, cols, loc, maxlen, nrows, z;
  int col, row;
  if (num == 0)
    return;
  maxlen = get_maxlen(base, num, length) + 1;
  if (d_cols > 0)
    cols = d_cols;
  else
    cols = width / maxlen;
  if (cols == 0)
    cols = 5;
  nrows = (num - 1) / cols + 1;
  for (a = 1; a <= nrows; a++) {
    b = c = z = loc = 0;
    for (j = 0; j < num; j++) {
      c++;
      if (c >= a + b)
        break;
    }
    while (j < num) {
      (*prentry)(base, j);
      loc += (*length)(base, j);
      z++;
      b += nrows;
      for (j++; j < num; j++) {
        c++;
        if (c >= a + b)
          break;
      }
      if (j < num) {
        while (loc < z * maxlen) {
          addch(' ');
          loc++;
        }
      }
    }
    getyx(stdscr, row, col);
    __USE(col);
    move(row + 1, 0);
  }
  refresh();
}
```