user: 请显示与下面列出的汇编代码相匹配的C语言实现：

```asm
<convert>:
  endbr64
  push   %r15
  push   %r14
  push   %r13
  push   %r12
  mov    %esi,%r12d
  push   %rbp
  mov    %rdi,%rbp
  push   %rbx
  sub    $0x28,%rsp
  call   <strlen@plt>
  lea    0x1(%rax),%edi
  mov    %eax,%ebx
  call   <malloc@plt>
  mov    %rax,%r11
  test   %ebx,%ebx
  js     L115
  movslq %ebx,%rdx
  xor    %esi,%esi
  mov    %rax,%rdi
  add    $0x1,%rdx
  call   <memset@plt>
  mov    %rax,%r11
L115:
  cmp    $0x2,%r12d
  jle    L196
  lea    -0x2(%r12,%r12,1),%eax
  mov    %eax,0x18(%rsp)
L40:
  test   %ebx,%ebx
  jle    L125
  lea    0x1(%r11),%rax
  movslq 0x18(%rsp),%rsi
  cmp    %r12d,%ebx
  mov    %r12d,%r14d
  mov    %rax,0x10(%rsp)
  cmovle %ebx,%r14d
  lea    -0x1(%r12),%r15d
  xor    %edi,%edi
  mov    %r12d,0x1c(%rsp)
  mov    %esi,%r10d
  xor    %r13d,%r13d
  xor    %r8d,%r8d
  nopw   0x0(%rax,%rax,1)
L197:
  test   %r8d,%r8d
  je     L227
  cmp    %r8d,%r15d
  je     L201
  movslq %edi,%rdx
  mov    %r13,%rax
  xor    %r9d,%r9d
  lea    (%rdx,%r11,1),%rcx
  nop
L58:
  movzbl 0x0(%rbp,%rax,1),%r12d
  add    %rsi,%rax
  add    $0x1,%r9d
  add    $0x2,%rcx
  mov    %r12b,-0x2(%rcx)
  cmp    %eax,%ebx
  jg     L58
  lea    (%rdi,%r9,2),%r12d
  cmp    %r10d,%ebx
  jle    L22
  mov    %edi,0xc(%rsp)
  movslq %r10d,%rax
  add    0x10(%rsp),%rdx
  mov    $0x1,%ecx
  nopl   0x0(%rax,%rax,1)
L220:
  movzbl 0x0(%rbp,%rax,1),%edi
  add    %rsi,%rax
  mov    %ecx,%r9d
  add    $0x2,%rdx
  add    $0x1,%ecx
  mov    %dil,-0x2(%rdx)
  cmp    %eax,%ebx
  jg     L220
  mov    0xc(%rsp),%edi
  lea    (%rdi,%r9,2),%edi
L22:
  add    $0x1,%edi
  cmp    %r12d,%edi
  cmovg  %r12d,%edi
L110:
  add    $0x1,%r8d
  add    $0x1,%r13
  sub    $0x1,%r10d
  cmp    %r14d,%r8d
  jl     L197
  mov    0x1c(%rsp),%r12d
  cmp    %r8d,%r12d
  jle    L75
L235:
  movslq 0x18(%rsp),%rsi
  movslq %r8d,%r10
  lea    -0x1(%r12),%r13d
  lea    0x1(%r11),%r14
  mov    %esi,%r9d
  sub    %r8d,%r9d
  xchg   %ax,%ax
L206:
  test   %r8d,%r8d
  je     L62
  cmp    %r8d,%r13d
  je     L62
  cmp    %r9d,%ebx
  jle    L119
  mov    %edi,0xc(%rsp)
  movslq %edi,%rdx
  movslq %r9d,%rax
  mov    $0x1,%ecx
  add    %r14,%rdx
  nopl   (%rax)
L59:
  movzbl 0x0(%rbp,%rax,1),%edi
  add    %rsi,%rax
  mov    %ecx,%r15d
  add    $0x2,%rdx
  add    $0x1,%ecx
  mov    %dil,-0x2(%rdx)
  cmp    %eax,%ebx
  jg     L59
  mov    0xc(%rsp),%edi
  lea    (%rdi,%r15,2),%eax
L103:
  add    $0x1,%eax
  cmp    %eax,%edi
  cmovg  %eax,%edi
L66:
  add    $0x1,%r8d
  sub    $0x1,%r9d
  add    $0x1,%r10
  cmp    %r12d,%r8d
  jl     L206
L75:
  add    $0x28,%rsp
  mov    %r11,%rax
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
  nopl   (%rax)
L62:
  cmp    %r8d,%ebx
  jle    L66
  movslq %edi,%rax
  mov    $0x1,%r15d
  mov    %r10,%rdx
  add    %r11,%rax
  sub    %eax,%r15d
  nop
L98:
  movzbl 0x0(%rbp,%rdx,1),%ecx
  add    %rsi,%rdx
  mov    %cl,(%rax)
  lea    (%r15,%rax,1),%ecx
  add    $0x1,%rax
  cmp    %edx,%ebx
  jg     L98
  add    %ecx,%edi
  jmp    L66
  nopw   0x0(%rax,%rax,1)
L201:
  cmp    %r15d,%ebx
  jle    L110
L227:
  movslq %edi,%rax
  mov    $0x1,%r9d
  mov    %r13,%rdx
  add    %r11,%rax
  sub    %eax,%r9d
  nopl   0x0(%rax,%rax,1)
L191:
  movzbl 0x0(%rbp,%rdx,1),%ecx
  add    %rsi,%rdx
  mov    %cl,(%rax)
  lea    (%r9,%rax,1),%ecx
  add    $0x1,%rax
  cmp    %edx,%ebx
  jg     L191
  add    %ecx,%edi
  jmp    L110
  nopl   (%rax)
L125:
  xor    %edi,%edi
  xor    %r8d,%r8d
  jmp    L235
  nopw   0x0(%rax,%rax,1)
L119:
  mov    %edi,%eax
  jmp    L103
  nopw   0x0(%rax,%rax,1)
L196:
  mov    %r12d,0x18(%rsp)
  test   %r12d,%r12d
  jg     L40
  jmp    L75
```

assistant: ```c
char *convert(char *s, int num_row) {
  int length = strlen(s);
  char *retval = (char *)malloc(length + 1);
  int i, r, mem, mem1, mem2;
  int num_per_trk;
  for (i = 0; i < length + 1; i++)
    retval[i] = 0;
  num_per_trk = (num_row > 2) ? (2 * num_row - 2) : num_row;
  mem = 0;
  for (r = 0; r < num_row; r++) {
    if (r == 0 || r == num_row - 1) {
      for (i = 0; i * num_per_trk + r < length; i++)
        retval[mem + i] = s[i * num_per_trk + r];
      mem += i;
      continue;
    }
    for (i = 0; i * num_per_trk + r < length; i++)
      retval[mem + i * 2] = s[i * num_per_trk + r];
    mem1 = mem + i * 2;
    for (i = 0; i * num_per_trk + num_per_trk - r < length; i++)
      retval[mem + i * 2 + 1] = s[i * num_per_trk + num_per_trk - r];
    mem2 = mem + i * 2 + 1;
    mem = (mem1 < mem2) ? mem1 : mem2;
  }
  return retval;
}
```