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

```asm
<spiralOrder0>:
  endbr64
  push   %r15
  mov    %esi,%r15d
  push   %r14
  push   %r13
  push   %r12
  push   %rbp
  movslq %edx,%rbp
  push   %rbx
  mov    %rdi,%rbx
  mov    %esi,%edi
  imul   %ebp,%edi
  sub    $0x48,%rsp
  mov    %edi,0x14(%rsp)
  mov    %edi,%r14d
  shl    $0x2,%edi
  mov    %esi,0x2c(%rsp)
  call   <malloc@plt>
  lea    -0x1(%rbp),%edx
  mov    %edx,0xc(%rsp)
  mov    %rax,%r10
  test   %r14d,%r14d
  jle    L206
  neg    %rax
  mov    %r15d,%edi
  xor    %r14d,%r14d
  sub    $0x1,%r15d
  add    %rax,%rax
  movslq %edx,%rcx
  mov    %r15d,0x10(%rsp)
  mov    %edx,%r9d
  mov    %rax,0x18(%rsp)
  movslq %edi,%rax
  shl    $0x2,%rcx
  xor    %edi,%edi
  sub    %rbp,%rax
  xor    %edx,%edx
  lea    (%rbx,%rax,8),%rax
  mov    %rax,0x38(%rsp)
  lea    0x4(%r10),%rax
  mov    %rax,0x20(%rsp)
  mov    %r14,%rax
  mov    %r15d,%r14d
  mov    %rax,%r15
  nop
L79:
  mov    %r15d,0x28(%rsp)
  mov    %r15d,%esi
  cmp    %r15d,0xc(%rsp)
  jl     L209
  movslq %edx,%r13
  mov    (%rbx,%r15,8),%r11
  lea    0x0(,%r13,4),%r12
  lea    (%r10,%r12,1),%rax
  lea    0x4(%r11,%rdi,1),%rbp
  mov    %rax,%r8
  mov    %rax,0x30(%rsp)
  sub    %rbp,%r8
  cmp    $0x8,%r8
  jbe    L126
  cmp    $0x2,%r9d
  jbe    L126
  lea    0x1(%r9),%r13d
  mov    %r13d,%r8d
  shr    $0x2,%r8d
  sub    $0x1,%r8d
  shl    $0x4,%r8
  lea    0x10(%rax,%r8,1),%r12
  mov    %rdi,%r8
  sub    %rax,%r8
  add    %r11,%r8
  nopl   0x0(%rax,%rax,1)
L184:
  movdqu (%rax,%r8,1),%xmm1
  add    $0x10,%rax
  movups %xmm1,-0x10(%rax)
  cmp    %r12,%rax
  jne    L184
  mov    0x28(%rsp),%ebp
  mov    %r13d,%eax
  and    $0xfffffffc,%eax
  lea    (%rdx,%rax,1),%r8d
  add    %eax,%ebp
  cmp    %eax,%r13d
  je     L17
  movslq %ebp,%rax
  lea    0x1(%r8),%r12d
  movslq %r8d,%r8
  mov    (%r11,%rax,4),%eax
  mov    %eax,(%r10,%r8,4)
  lea    0x1(%rbp),%eax
  cmp    %eax,0xc(%rsp)
  jl     L17
  cltq
  movslq %r12d,%r8
  add    $0x2,%ebp
  lea    0x0(,%rax,4),%r13
  mov    (%r11,%rax,4),%eax
  lea    0x0(,%r8,4),%r12
  mov    %eax,(%r10,%r8,4)
  cmp    %ebp,0xc(%rsp)
  jl     L17
  mov    0x4(%r11,%r13,1),%eax
  mov    %eax,0x4(%r10,%r12,1)
L17:
  lea    0x1(%rdx,%r9,1),%edx
L209:
  cmp    %edx,0x14(%rsp)
  je     L206
  mov    0x2c(%rsp),%eax
  sub    %r14d,%eax
  cmp    %eax,%r14d
  jl     L212
  mov    0x10(%rsp),%r11d
  movslq %edx,%r8
  mov    0x20(%rsp),%rbp
  lea    (%r10,%r8,4),%rax
  sub    $0x1,%r11d
  add    %r8,%r11
  neg    %r8
  lea    0x0(%rbp,%r11,4),%rbp
  mov    0x18(%rsp),%r11
  lea    (%r11,%r8,8),%r11
  add    %rbx,%r11
  nopw   0x0(%rax,%rax,1)
L21:
  mov    0x8(%r11,%rax,2),%r8
  add    $0x4,%rax
  mov    (%r8,%rcx,1),%r8d
  mov    %r8d,-0x4(%rax)
  cmp    %rbp,%rax
  jne    L21
  add    0x10(%rsp),%edx
  cmp    0x14(%rsp),%edx
  je     L206
L212:
  subl   $0x1,0xc(%rsp)
  mov    0xc(%rsp),%eax
  cmp    %esi,%eax
  jl     L166
  mov    %r9d,%r8d
  mov    0x38(%rsp),%rax
  movslq %edx,%r12
  mov    %r8,%rbp
  add    %r12,%r8
  lea    (%r10,%r12,4),%r11
  mov    (%rax,%rcx,2),%rax
  neg    %rbp
  lea    (%r10,%r8,4),%r8
  lea    (%rcx,%rbp,4),%rbp
  add    %rax,%rbp
  cmp    %r8,%rbp
  lea    (%rax,%rcx,1),%r8
  setae  %bpl
  cmp    %r8,%r11
  setae  %r8b
  or     %bpl,%r8b
  je     L66
  lea    -0x1(%r9),%r8d
  cmp    $0x2,%r8d
  jbe    L66
  mov    %r9d,%r12d
  lea    -0x10(%rax,%rcx,1),%r8
  shr    $0x2,%r12d
  lea    -0x10(%r8),%rbp
  sub    $0x1,%r12d
  shl    $0x4,%r12
  sub    %r12,%rbp
  lea    (%r8,%r11,1),%r12
  nopl   0x0(%rax)
L100:
  movdqu (%r8),%xmm2
  mov    %r12,%r11
  sub    %r8,%r11
  sub    $0x10,%r8
  pshufd $0x1b,%xmm2,%xmm0
  movups %xmm0,(%r11)
  cmp    %rbp,%r8
  jne    L100
  mov    0xc(%rsp),%r8d
  mov    %r9d,%ebp
  and    $0xfffffffc,%ebp
  lea    (%rdx,%rbp,1),%r11d
  sub    %ebp,%r8d
  cmp    %r9d,%ebp
  je     L15
  movslq %r8d,%r12
  lea    0x1(%r11),%ebp
  movslq %r11d,%r11
  mov    (%rax,%r12,4),%r12d
  mov    %r12d,(%r10,%r11,4)
  lea    -0x1(%r8),%r11d
  cmp    %esi,%r11d
  jl     L15
  movslq %r11d,%r11
  movslq %ebp,%rbp
  sub    $0x2,%r8d
  lea    0x0(,%r11,4),%r13
  mov    (%rax,%r11,4),%r11d
  lea    0x0(,%rbp,4),%r12
  mov    %r11d,(%r10,%rbp,4)
  cmp    %esi,%r8d
  jl     L15
  mov    -0x4(%rax,%r13,1),%eax
  mov    %eax,0x4(%r10,%r12,1)
L15:
  add    %r9d,%edx
L166:
  sub    $0x1,%r14d
  cmp    %esi,%r14d
  jle    L225
  movslq %edx,%r8
  movslq %r14d,%rax
  lea    (%r10,%r8,4),%r8
  xchg   %ax,%ax
L186:
  mov    (%rbx,%rax,8),%r11
  sub    $0x1,%rax
  add    $0x4,%r8
  mov    (%r11,%rdi,1),%r11d
  mov    %r11d,-0x4(%r8)
  cmp    %eax,%esi
  jl     L186
  mov    0x10(%rsp),%eax
  lea    -0x1(%rdx,%rax,1),%edx
L225:
  add    $0x1,%r15
  sub    $0x2,%r9d
  add    $0x4,%rdi
  sub    $0x4,%rcx
  subl   $0x2,0x10(%rsp)
  addq   $0x8,0x18(%rsp)
  cmp    %edx,0x14(%rsp)
  jg     L79
L206:
  add    $0x48,%rsp
  mov    %r10,%rax
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
  nopw   0x0(%rax,%rax,1)
L126:
  mov    0x20(%rsp),%r8
  mov    %r9d,%eax
  mov    %rdi,%rbp
  add    %r13,%rax
  sub    %r10,%rbp
  lea    (%r8,%rax,4),%rax
  sub    %r12,%rbp
  mov    0x30(%rsp),%r8
  add    %rbp,%r11
L164:
  mov    (%r11,%r8,1),%ebp
  add    $0x4,%r8
  mov    %ebp,-0x4(%r8)
  cmp    %rax,%r8
  jne    L164
  jmp    L17
  cs nopw 0x0(%rax,%rax,1)
L66:
  movslq 0xc(%rsp),%r8
  nopl   (%rax)
L258:
  mov    (%rax,%r8,4),%ebp
  sub    $0x1,%r8
  add    $0x4,%r11
  mov    %ebp,-0x4(%r11)
  cmp    %r8d,%esi
  jle    L258
  jmp    L15
```

assistant: ```c
int *spiralOrder0(int **matrix, int rSize, int cSize) {
  int count = 0;
  int size = rSize * cSize;
  int *arr = (int *)malloc(sizeof(int) * size);
  int rmin = 0, rmax = rSize - 1;
  int cmin = 0, cmax = cSize - 1;
  while (count < size) {
    for (int c = cmin; c <= cmax; c++)
      arr[count++] = matrix[rmin][c];
    if (count == size)
      break;
    for (int r = rmin + 1; r <= rmax; r++)
      arr[count++] = matrix[r][cmax];
    if (count == size)
      break;
    for (int c = cmax - 1; c >= cmin; c--)
      arr[count++] = matrix[rmax][c];
    for (int r = rmax - 1; r > rmin; r--)
      arr[count++] = matrix[r][cmin];
    rmin++;
    rmax--;
    cmin++;
    cmax--;
  }
  return arr;
}
```