user: 请将这段汇编代码片段转换成等效的C代码:

```asm
<spiralOrder0>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  sub    $0x40,%rsp
  mov    %rdi,-0x38(%rbp)
  mov    %esi,-0x3c(%rbp)
  mov    %edx,-0x40(%rbp)
  movl   $0x0,-0x30(%rbp)
  mov    -0x3c(%rbp),%eax
  imul   -0x40(%rbp),%eax
  mov    %eax,-0xc(%rbp)
  mov    -0xc(%rbp),%eax
  cltq
  shl    $0x2,%eax
  mov    %eax,%edi
  call   <malloc@plt>
  mov    %rax,-0x8(%rbp)
  movl   $0x0,-0x2c(%rbp)
  mov    -0x3c(%rbp),%eax
  sub    $0x1,%eax
  mov    %eax,-0x28(%rbp)
  movl   $0x0,-0x24(%rbp)
  mov    -0x40(%rbp),%eax
  sub    $0x1,%eax
  mov    %eax,-0x20(%rbp)
  jmp    L119
L87:
  mov    -0x24(%rbp),%eax
  mov    %eax,-0x1c(%rbp)
  jmp    L25
L110:
  mov    -0x2c(%rbp),%eax
  cltq
  lea    0x0(,%rax,8),%rdx
  mov    -0x38(%rbp),%rax
  add    %rdx,%rax
  mov    (%rax),%rdx
  mov    -0x1c(%rbp),%eax
  cltq
  shl    $0x2,%rax
  lea    (%rdx,%rax,1),%rcx
  mov    -0x30(%rbp),%eax
  lea    0x1(%rax),%edx
  mov    %edx,-0x30(%rbp)
  cltq
  lea    0x0(,%rax,4),%rdx
  mov    -0x8(%rbp),%rax
  add    %rax,%rdx
  mov    (%rcx),%eax
  mov    %eax,(%rdx)
  addl   $0x1,-0x1c(%rbp)
L25:
  mov    -0x1c(%rbp),%eax
  cmp    -0x20(%rbp),%eax
  jle    L110
  mov    -0x30(%rbp),%eax
  cmp    -0xc(%rbp),%eax
  je     L123
  mov    -0x2c(%rbp),%eax
  add    $0x1,%eax
  mov    %eax,-0x18(%rbp)
  jmp    L118
L137:
  mov    -0x18(%rbp),%eax
  cltq
  lea    0x0(,%rax,8),%rdx
  mov    -0x38(%rbp),%rax
  add    %rdx,%rax
  mov    (%rax),%rdx
  mov    -0x20(%rbp),%eax
  cltq
  shl    $0x2,%rax
  lea    (%rdx,%rax,1),%rcx
  mov    -0x30(%rbp),%eax
  lea    0x1(%rax),%edx
  mov    %edx,-0x30(%rbp)
  cltq
  lea    0x0(,%rax,4),%rdx
  mov    -0x8(%rbp),%rax
  add    %rax,%rdx
  mov    (%rcx),%eax
  mov    %eax,(%rdx)
  addl   $0x1,-0x18(%rbp)
L118:
  mov    -0x18(%rbp),%eax
  cmp    -0x28(%rbp),%eax
  jle    L137
  mov    -0x30(%rbp),%eax
  cmp    -0xc(%rbp),%eax
  je     L55
  mov    -0x20(%rbp),%eax
  sub    $0x1,%eax
  mov    %eax,-0x14(%rbp)
  jmp    L104
L121:
  mov    -0x28(%rbp),%eax
  cltq
  lea    0x0(,%rax,8),%rdx
  mov    -0x38(%rbp),%rax
  add    %rdx,%rax
  mov    (%rax),%rdx
  mov    -0x14(%rbp),%eax
  cltq
  shl    $0x2,%rax
  lea    (%rdx,%rax,1),%rcx
  mov    -0x30(%rbp),%eax
  lea    0x1(%rax),%edx
  mov    %edx,-0x30(%rbp)
  cltq
  lea    0x0(,%rax,4),%rdx
  mov    -0x8(%rbp),%rax
  add    %rax,%rdx
  mov    (%rcx),%eax
  mov    %eax,(%rdx)
  subl   $0x1,-0x14(%rbp)
L104:
  mov    -0x14(%rbp),%eax
  cmp    -0x24(%rbp),%eax
  jge    L121
  mov    -0x28(%rbp),%eax
  sub    $0x1,%eax
  mov    %eax,-0x10(%rbp)
  jmp    L74
L101:
  mov    -0x10(%rbp),%eax
  cltq
  lea    0x0(,%rax,8),%rdx
  mov    -0x38(%rbp),%rax
  add    %rdx,%rax
  mov    (%rax),%rdx
  mov    -0x24(%rbp),%eax
  cltq
  shl    $0x2,%rax
  lea    (%rdx,%rax,1),%rcx
  mov    -0x30(%rbp),%eax
  lea    0x1(%rax),%edx
  mov    %edx,-0x30(%rbp)
  cltq
  lea    0x0(,%rax,4),%rdx
  mov    -0x8(%rbp),%rax
  add    %rax,%rdx
  mov    (%rcx),%eax
  mov    %eax,(%rdx)
  subl   $0x1,-0x10(%rbp)
L74:
  mov    -0x10(%rbp),%eax
  cmp    -0x2c(%rbp),%eax
  jg     L101
  addl   $0x1,-0x2c(%rbp)
  subl   $0x1,-0x28(%rbp)
  addl   $0x1,-0x24(%rbp)
  subl   $0x1,-0x20(%rbp)
L119:
  mov    -0x30(%rbp),%eax
  cmp    -0xc(%rbp),%eax
  jl     L87
  jmp    L17
L123:
  nop
  jmp    L17
L55:
  nop
L17:
  mov    -0x8(%rbp),%rax
  leave
  ret
```

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;
}
```