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

```asm
<convert>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  push   %r15
  push   %r14
  push   %r13
  push   %r12
  push   %rbx
  sub    $0x38,%rsp
  mov    %rdi,-0x50(%rbp)
  mov    %esi,%r15d
  mov    %fs:0x28,%rax
  mov    %rax,-0x38(%rbp)
  xor    %eax,%eax
  call   <strlen@plt>
  mov    %eax,-0x54(%rbp)
  cmp    $0x1,%r15d
  jle    L36
  cmp    %r15d,%eax
  jle    L36
  movslq %r15d,%rbx
  lea    0xf(,%rbx,4),%rax
  mov    %rax,%rcx
  and    $0xfffffffffffffff0,%rcx
  and    $0xfffffffffffff000,%rax
  mov    %rsp,%rdx
  sub    %rax,%rdx
L101:
  cmp    %rdx,%rsp
  je     L137
  sub    $0x1000,%rsp
  orq    $0x0,0xff8(%rsp)
  jmp    L101
L137:
  mov    %rcx,%rax
  and    $0xfff,%eax
  sub    %rax,%rsp
  test   %rax,%rax
  je     L35
  orq    $0x0,-0x8(%rsp,%rax,1)
L35:
  mov    %rsp,%r13
  lea    0x0(,%r15,4),%edx
  mov    $0x0,%esi
  mov    %r13,%rdi
  call   <memset@plt>
  mov    -0x54(%rbp),%ecx
  mov    %ecx,%eax
  shr    $0x1f,%eax
  add    %ecx,%eax
  sar    %eax
  add    $0x1,%eax
  cltq
  mov    %rax,-0x48(%rbp)
  imul   %rax,%rbx
  add    $0xf,%rbx
  mov    %rbx,%rdx
  and    $0xfffffffffffffff0,%rdx
  and    $0xfffffffffffff000,%rbx
  mov    %rsp,%rax
  sub    %rbx,%rax
L149:
  cmp    %rax,%rsp
  je     L28
  sub    $0x1000,%rsp
  orq    $0x0,0xff8(%rsp)
  jmp    L149
L28:
  mov    %rdx,%rax
  and    $0xfff,%eax
  sub    %rax,%rsp
  test   %rax,%rax
  je     L27
  orq    $0x0,-0x8(%rsp,%rax,1)
L27:
  mov    %rsp,%r12
  mov    -0x54(%rbp),%eax
  test   %eax,%eax
  jle    L8
  mov    -0x50(%rbp),%rsi
  mov    %rsi,%rcx
  lea    -0x1(%rax),%eax
  lea    0x1(%rsi,%rax,1),%r8
  mov    $0x1,%esi
  mov    $0x0,%edx
  lea    -0x1(%r15),%edi
  mov    $0x1,%r9d
  jmp    L59
L109:
  test   %edx,%edx
  cmove  %r9d,%esi
L82:
  add    %esi,%edx
  add    $0x1,%rcx
  cmp    %r8,%rcx
  je     L8
L59:
  movslq %edx,%r10
  mov    0x0(%r13,%r10,4),%eax
  lea    0x1(%rax),%r11d
  mov    %r11d,0x0(%r13,%r10,4)
  cltq
  imul   -0x48(%rbp),%r10
  add    %r12,%rax
  movzbl (%rcx),%r11d
  mov    %r11b,(%rax,%r10,1)
  cmp    %edx,%edi
  jne    L109
  mov    $0xffffffff,%esi
  jmp    L82
L8:
  mov    -0x54(%rbp),%eax
  lea    0x1(%rax),%edi
  call   <malloc@plt>
  mov    %rax,-0x50(%rbp)
  mov    $0x0,%ebx
  mov    $0x0,%r14d
L91:
  mov    0x0(%r13,%rbx,4),%edx
  movslq %r14d,%rdi
  add    -0x50(%rbp),%rdi
  mov    %r12,%rsi
  call   <memcpy@plt>
  add    0x0(%r13,%rbx,4),%r14d
  add    $0x1,%rbx
  add    -0x48(%rbp),%r12
  cmp    %ebx,%r15d
  jg     L91
  movslq -0x54(%rbp),%rax
  mov    -0x50(%rbp),%rcx
  movb   $0x0,(%rcx,%rax,1)
L36:
  mov    -0x38(%rbp),%rax
  sub    %fs:0x28,%rax
  jne    L140
  mov    -0x50(%rbp),%rax
  lea    -0x28(%rbp),%rsp
  pop    %rbx
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  pop    %rbp
  ret
L140:
  call   <__stack_chk_fail@plt>
```

assistant: ```c
char *convert(char *s, int rows) {
  int n = strlen(s);
  if (rows <= 1 || rows >= n)
    return s;
  int count[rows];
  memset(count, 0, sizeof(count));
  char rows_result[rows][n / 2 + 1];
  int step = 0;
  int direct = 1;
  int i = 0, j = 0;
  for (i = 0; i < n; i++) {
    rows_result[step][count[step]++] = s[i];
    if (step == rows - 1)
      direct = -1;
    if (step == 0)
      direct = 1;
    step += direct;
  }
  char *result = malloc(n + 1);
  int cusor = 0;
  for (i = 0; i < rows; i++) {
    memcpy(result + cusor, rows_result[i], count[i]);
    cusor += count[i];
  }
  result[n] = '\0';
  return result;
}
```