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

```asm
<spiralOrder>:
  endbr64
  push   %r15
  push   %r14
  push   %r13
  push   %r12
  push   %rbp
  push   %rbx
  sub    $0x28,%rsp
  mov    %rdi,%rbx
  mov    %esi,%ebp
  mov    %edx,%r12d
  mov    %esi,%edi
  imul   %edx,%edi
  shl    $0x2,%edi
  call   <malloc@plt>
  mov    %rax,%r11
  lea    -0x1(%rbp),%eax
  mov    %eax,0x14(%rsp)
  mov    %r11,%rax
  neg    %rax
  add    %rax,%rax
  mov    %rax,(%rsp)
  mov    %r12d,%r9d
  mov    $0x0,%esi
  mov    $0xffffffff,%r10d
  mov    $0x0,%r14d
  mov    %ebp,%eax
  sub    %r12d,%eax
  mov    %eax,0x1c(%rsp)
  lea    0x4(%r11),%rdi
  mov    %rdi,0x8(%rsp)
  sub    $0x2,%eax
  mov    %eax,0x18(%rsp)
  jmp    L76
L36:
  mov    0x1c(%rsp),%eax
  lea    -0x2(%r12,%rax,1),%r14d
  add    %r8d,%r14d
  sub    $0x2,%r9d
  add    $0x1,%rsi
  subl   $0x1,0x14(%rsp)
  addq   $0x8,(%rsp)
  test   %r9d,%r9d
  jle    L89
  mov    %edi,%ebp
L76:
  test   %r9d,%r9d
  jle    L100
  movslq %r10d,%rdx
  lea    0x4(,%rdx,4),%rax
  mov    %r9d,%r8d
  lea    -0x1(%r9),%ecx
  lea    0x2(%rdx,%rcx,1),%rdi
  shl    $0x2,%rdi
  movslq %r14d,%rcx
  lea    (%r11,%rcx,4),%rcx
  shl    $0x2,%rdx
  sub    %rdx,%rcx
L78:
  mov    (%rbx,%rsi,8),%rdx
  mov    (%rdx,%rax,1),%edx
  mov    %edx,-0x4(%rax,%rcx,1)
  add    $0x4,%rax
  cmp    %rdi,%rax
  jne    L78
  add    %r8d,%r10d
  add    %r8d,%r14d
L100:
  mov    %ebp,%r15d
  lea    -0x1(%rbp),%eax
  test   %eax,%eax
  jle    L89
  movslq %r10d,%r13
  lea    0x0(,%r13,4),%r8
  movslq %r14d,%rdx
  lea    (%r11,%rdx,4),%rax
  mov    %r9d,%r12d
  mov    0x18(%rsp),%edi
  lea    (%rdi,%r9,1),%ecx
  add    %rdx,%rcx
  mov    0x8(%rsp),%rdi
  lea    (%rdi,%rcx,4),%rdi
  neg    %rdx
  mov    (%rsp),%rcx
  lea    (%rcx,%rdx,8),%rcx
  add    %rbx,%rcx
L39:
  mov    0x8(%rcx,%rax,2),%rdx
  mov    (%rdx,%r8,1),%edx
  mov    %edx,(%rax)
  add    $0x4,%rax
  cmp    %rdi,%rax
  jne    L39
  lea    -0x1(%r14,%r15,1),%r14d
  lea    -0x1(%r12),%eax
  test   %eax,%eax
  jle    L89
  movslq 0x14(%rsp),%r15
  lea    (%rbx,%r15,8),%r8
  lea    -0x4(,%r13,4),%rax
  lea    -0x2(%r12),%ecx
  mov    %r13,%rdx
  sub    %rcx,%rdx
  lea    -0x8(,%rdx,4),%rdi
  movslq %r14d,%rdx
  add    %r13,%rdx
  lea    -0x4(%r11,%rdx,4),%r13
L15:
  mov    (%r8),%rdx
  mov    (%rdx,%rax,1),%ecx
  mov    %r13,%rdx
  sub    %rax,%rdx
  mov    %ecx,(%rdx)
  sub    $0x4,%rax
  cmp    %rdi,%rax
  jne    L15
  mov    $0x1,%ecx
  sub    %r12d,%ecx
  add    %r10d,%ecx
  mov    %ecx,%r10d
  lea    -0x1(%r14,%r12,1),%r8d
  lea    -0x2(%rbp),%edi
  test   %edi,%edi
  jle    L89
  movslq %ecx,%rcx
  shl    $0x2,%rcx
  lea    -0x8(%rbx,%r15,8),%rdx
  movslq %r8d,%r13
  lea    (%r11,%r13,4),%rax
  lea    -0x3(%rbp),%ebp
  add    %r13,%rbp
  mov    0x8(%rsp),%r15
  lea    (%r15,%rbp,4),%r13
L84:
  mov    (%rdx),%rbp
  mov    0x0(%rbp,%rcx,1),%ebp
  mov    %ebp,(%rax)
  sub    $0x8,%rdx
  add    $0x4,%rax
  cmp    %r13,%rax
  jne    L84
  jmp    L36
L89:
  mov    %r11,%rax
  add    $0x28,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
```

assistant: ```c
int *spiralOrder(int **matrix, int matrixRowSize, int matrixColSize) {
  int *ret = (int *)malloc(sizeof(int) * matrixRowSize * matrixColSize);
  int i;
  int count = 0;
  int m = 0;
  int n = -1;
  while (1) {
    for (i = 0; i < matrixColSize; i++) {
      ret[count++] = matrix[m][++n];
    }
    if (--matrixRowSize <= 0) {
      break;
    }
    for (i = 0; i < matrixRowSize; i++) {
      ret[count++] = matrix[++m][n];
    }
    if (--matrixColSize <= 0) {
      break;
    }
    for (i = 0; i < matrixColSize; i++) {
      ret[count++] = matrix[m][--n];
    }
    if (--matrixRowSize <= 0) {
      break;
    }
    for (i = 0; i < matrixRowSize; i++) {
      ret[count++] = matrix[--m][n];
    }
    if (--matrixColSize <= 0) {
      break;
    }
  }
  return ret;
}
```