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

```asm
<convert>:
  endbr64
  push   %r14
  push   %r13
  mov    %rdi,%r13
  push   %r12
  push   %rbp
  push   %rbx
  mov    %esi,%ebx
  call   <strlen@plt>
  cmp    $0x2,%eax
  jle    L242
  cmp    $0x1,%ebx
  je     L242
  mov    %eax,%edi
  mov    %eax,%r12d
  call   <malloc@plt>
  lea    -0x1(%rbx),%r11d
  xor    %esi,%esi
  xor    %edi,%edi
  mov    %rax,%r8
  mov    %r12d,%eax
  lea    (%r11,%r11,1),%r10d
  cltd
  idiv   %r10d
  xor    %edx,%edx
  jmp    L247
  nopl   0x0(%rax)
L22:
  test   %edx,%edx
  je     L279
  cmp    %ecx,%r12d
  jle    L47
  movslq %ecx,%rcx
  lea    0x1(%rsi),%ebp
  movzbl 0x0(%r13,%rcx,1),%r14d
  movslq %esi,%rcx
  mov    %r14b,(%r8,%rcx,1)
  lea    -0x2(%r9,%rbx,2),%ecx
  sub    %edx,%ecx
  cmp    %ecx,%r12d
  jle    L133
  movslq %ecx,%rcx
  movslq %ebp,%rbp
  add    $0x2,%esi
  movzbl 0x0(%r13,%rcx,1),%ecx
  mov    %cl,(%r8,%rbp,1)
  cmp    %edi,%eax
  jle    L47
L53:
  add    $0x1,%edi
L220:
  cmp    %r12d,%esi
  jge    L1
L247:
  mov    %r10d,%r9d
  imul   %edi,%r9d
  lea    (%rdx,%r9,1),%ecx
  cmp    %edx,%r11d
  jne    L22
L279:
  cmp    %ecx,%r12d
  jle    L47
  movslq %ecx,%rcx
  movzbl 0x0(%r13,%rcx,1),%r9d
  movslq %esi,%rcx
  add    $0x1,%esi
  mov    %r9b,(%r8,%rcx,1)
  cmp    %edi,%eax
  jg     L53
L47:
  add    $0x1,%edx
  xor    %edi,%edi
  cmp    %r12d,%esi
  jl     L247
L1:
  lea    0x1(%r8),%rdx
  mov    %r13,%rax
  sub    %rdx,%rax
  cmp    $0xe,%rax
  jbe    L71
  cmp    $0x7,%r12d
  jle    L71
  test   %r12d,%r12d
  mov    $0x1,%eax
  cmovg  %r12d,%eax
  mov    %eax,%edx
  cmp    $0xf,%r12d
  jle    L243
  mov    %eax,%ecx
  mov    %r13,%rsi
  mov    %r8,%rax
  shr    $0x4,%ecx
  sub    %r8,%rsi
  shl    $0x4,%rcx
  add    %r8,%rcx
  nopl   0x0(%rax)
L58:
  movdqu (%rax),%xmm0
  movups %xmm0,(%rsi,%rax,1)
  add    $0x10,%rax
  cmp    %rax,%rcx
  jne    L58
  mov    %edx,%esi
  and    $0xfffffff0,%esi
  mov    %esi,%ecx
  cmp    %esi,%edx
  je     L131
L48:
  mov    %edx,%eax
  sub    %esi,%eax
  lea    -0x1(%rax),%edx
  cmp    $0x6,%edx
  jbe    L12
  mov    (%r8,%rsi,1),%rdx
  mov    %rdx,0x0(%r13,%rsi,1)
  mov    %eax,%edx
  and    $0xfffffff8,%edx
  add    %edx,%ecx
  cmp    %edx,%eax
  je     L131
L12:
  movslq %ecx,%rax
  movzbl (%r8,%rax,1),%edx
  mov    %dl,0x0(%r13,%rax,1)
  lea    0x1(%rcx),%eax
  cmp    %r12d,%eax
  jge    L131
  cltq
  movzbl (%r8,%rax,1),%edx
  mov    %dl,0x0(%r13,%rax,1)
  lea    0x2(%rcx),%eax
  cmp    %eax,%r12d
  jle    L131
  cltq
  movzbl (%r8,%rax,1),%edx
  mov    %dl,0x0(%r13,%rax,1)
  lea    0x3(%rcx),%eax
  cmp    %eax,%r12d
  jle    L131
  cltq
  movzbl (%r8,%rax,1),%edx
  mov    %dl,0x0(%r13,%rax,1)
  lea    0x4(%rcx),%eax
  cmp    %eax,%r12d
  jle    L131
  cltq
  movzbl (%r8,%rax,1),%edx
  mov    %dl,0x0(%r13,%rax,1)
  lea    0x5(%rcx),%eax
  cmp    %eax,%r12d
  jle    L131
  cltq
  add    $0x6,%ecx
  movzbl (%r8,%rax,1),%edx
  mov    %dl,0x0(%r13,%rax,1)
  cmp    %ecx,%r12d
  jle    L131
  movslq %ecx,%rcx
  movzbl (%r8,%rcx,1),%eax
  mov    %al,0x0(%r13,%rcx,1)
L131:
  mov    %r8,%rdi
  call   <free@plt>
L242:
  pop    %rbx
  mov    %r13,%rax
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  ret
  xchg   %ax,%ax
L133:
  add    $0x1,%edx
  mov    %ebp,%esi
  xor    %edi,%edi
  jmp    L220
  nopl   0x0(%rax)
L71:
  xor    %eax,%eax
  nopw   0x0(%rax,%rax,1)
L66:
  movzbl (%r8,%rax,1),%edx
  mov    %dl,0x0(%r13,%rax,1)
  add    $0x1,%rax
  cmp    %eax,%r12d
  jg     L66
  jmp    L131
L243:
  xor    %esi,%esi
  xor    %ecx,%ecx
  jmp    L48
```

assistant: ```c
char *convert(char *s, int numRows) {
  int lenth = strlen(s);
  if (lenth <= 2 || numRows == 1)
    return s;
  char *p = (char *)malloc(lenth);
  int n = 0, m = 0;
  int cycle = numRows + numRows - 2;
  int numCols = lenth / cycle + 1;
  for (int i = 0; i < lenth;) {
    if (n == 0 || n == numRows - 1) {
      int index = m * cycle + n;
      if (index >= lenth) {
        n++;
        m = 0;
        continue;
      }
      p[i++] = s[index];
    } else {
      int index = m * cycle + n;
      if (index >= lenth) {
        n++;
        m = 0;
        continue;
      }
      p[i++] = s[index];
      index = m * cycle + numRows - 1 + numRows - 1 - n;
      if (index >= lenth) {
        n++;
        m = 0;
        continue;
      }
      p[i++] = s[index];
    }
    if (++m >= numCols) {
      m = 0;
      n++;
    }
  }
  for (int i = 0; i < lenth; i++) {
    s[i] = p[i];
  }
  free(p);
  return s;
}
```