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

```asm
<spiralOrder>:
  endbr64
  push   %r15
  push   %r14
  push   %r13
  push   %r12
  push   %rbp
  push   %rbx
  sub    $0x48,%rsp
  mov    %rdi,%rbx
  mov    %esi,%r15d
  mov    %esi,0x3c(%rsp)
  mov    %edx,0x38(%rsp)
  mov    %esi,%r12d
  imul   %edx,%r12d
  lea    0x0(,%r12,4),%edi
  call   <malloc@plt>
  mov    %rax,%rbp
  cmp    $0x1,%r15d
  je     L206
  mov    0x38(%rsp),%edi
  cmp    $0x1,%edi
  je     L193
  lea    -0x1(%r12),%eax
  mov    %eax,0x2c(%rsp)
  test   %eax,%eax
  jle    L109
  lea    -0x1(%rdi),%r14d
  mov    0x3c(%rsp),%ecx
  lea    -0x1(%rcx),%eax
  mov    %rbp,%rdx
  neg    %rdx
  add    %rdx,%rdx
  mov    %rdx,0x20(%rsp)
  movslq %ecx,%rcx
  lea    (%rbx,%rcx,8),%r8
  movslq %edi,%rdi
  mov    %rdi,0x8(%rsp)
  movslq %eax,%rdx
  sub    %rcx,%rdx
  lea    0x0(,%rdx,8),%rdi
  mov    %rdi,0x30(%rsp)
  mov    %r14d,%r13d
  mov    %eax,%r15d
  mov    $0x0,%ecx
  mov    $0x0,%r12d
  mov    $0x0,%edi
  lea    0x4(%rbp),%rdx
  mov    %rdx,0x10(%rsp)
  mov    %r14d,0x18(%rsp)
  jmp    L47
L206:
  test   %r12d,%r12d
  jle    L122
  mov    %r12d,%ecx
  shl    $0x2,%rcx
  mov    $0x0,%eax
L157:
  mov    (%rbx),%rdx
  mov    (%rdx,%rax,1),%edx
  mov    %edx,0x0(%rbp,%rax,1)
  add    $0x4,%rax
  cmp    %rcx,%rax
  jne    L157
  jmp    L122
L193:
  test   %r12d,%r12d
  jle    L122
  mov    %r12d,%r12d
  lea    (%rax,%r12,4),%rsi
  mov    %rax,%rdx
  neg    %rdx
  lea    (%rbx,%rdx,2),%rcx
L85:
  mov    (%rcx,%rax,2),%rdx
  mov    (%rdx),%edx
  mov    %edx,(%rax)
  add    $0x4,%rax
  cmp    %rsi,%rax
  jne    L85
  jmp    L122
L131:
  lea    -0x1(%r13),%edx
  lea    0x1(%r12,%rdx,1),%r11
  shl    $0x2,%r11
  movslq %edi,%rdx
  lea    0x0(%rbp,%rdx,4),%r9
  sub    %rcx,%r9
  mov    %rcx,%rdx
L138:
  mov    (%rbx,%rcx,2),%rsi
  mov    (%rsi,%rdx,1),%esi
  mov    %esi,(%rdx,%r9,1)
  add    $0x4,%rdx
  cmp    %r11,%rdx
  jne    L138
  add    %r13d,%edi
L81:
  mov    %r15d,0x28(%rsp)
  cmp    %r15d,%r10d
  jge    L83
  mov    0x8(%rsp),%rsi
  lea    -0x4(,%rsi,4),%r14
  movslq %edi,%rsi
  lea    0x0(%rbp,%rsi,4),%rdx
  lea    -0x1(%rax),%r9d
  add    %rsi,%r9
  mov    0x10(%rsp),%r11
  lea    (%r11,%r9,4),%r11
  neg    %rsi
  mov    0x20(%rsp),%r9
  lea    (%r9,%rsi,8),%r9
  add    %rbx,%r9
L86:
  mov    (%r9,%rdx,2),%rsi
  mov    (%rsi,%r14,1),%esi
  mov    %esi,(%rdx)
  add    $0x4,%rdx
  cmp    %r11,%rdx
  jne    L86
  add    %eax,%edi
L83:
  cmp    %r10d,0x1c(%rsp)
  jle    L198
  movslq %edi,%rsi
  lea    0x0(%rbp,%rsi,4),%rdx
  lea    -0x1(%r13),%r9d
  add    %rsi,%r9
  mov    0x10(%rsp),%r14
  lea    (%r14,%r9,4),%r14
  add    0x8(%rsp),%rsi
  lea    -0x4(%rbp,%rsi,4),%r11
L108:
  mov    %r11,%rsi
  sub    %rdx,%rsi
  mov    -0x8(%r8),%r9
  mov    (%r9,%rsi,1),%esi
  mov    %esi,(%rdx)
  add    $0x4,%rdx
  cmp    %r14,%rdx
  jne    L108
  add    %r13d,%edi
L198:
  cmp    0x28(%rsp),%r10d
  jge    L188
  mov    0x30(%rsp),%rsi
  add    %r8,%rsi
  movslq %edi,%r10
  lea    0x0(%rbp,%r10,4),%rdx
  lea    -0x1(%rax),%r9d
  add    %r10,%r9
  mov    0x10(%rsp),%r14
  lea    (%r14,%r9,4),%r10
L126:
  mov    (%rsi),%r9
  mov    (%r9,%rcx,1),%r9d
  mov    %r9d,(%rdx)
  sub    $0x8,%rsi
  add    $0x4,%rdx
  cmp    %r10,%rdx
  jne    L126
  add    %eax,%edi
L188:
  add    $0x1,%r12
  subl   $0x1,0x18(%rsp)
  sub    $0x2,%eax
  sub    $0x1,%r15d
  sub    $0x2,%r13d
  add    $0x4,%rcx
  addq   $0x8,0x20(%rsp)
  sub    $0x8,%r8
  subq   $0x1,0x8(%rsp)
  cmp    %edi,0x2c(%rsp)
  jle    L205
L47:
  mov    0x18(%rsp),%edx
  mov    %edx,0x1c(%rsp)
  mov    %r12d,%r10d
  cmp    %r12d,%edx
  jg     L131
  jmp    L81
L109:
  mov    $0x0,%edi
L205:
  mov    0x38(%rsp),%ecx
  cmp    %ecx,0x3c(%rsp)
  je     L133
L122:
  mov    %rbp,%rax
  add    $0x48,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
L133:
  mov    0x3c(%rsp),%eax
  mov    %eax,%edx
  shr    $0x1f,%edx
  add    %eax,%edx
  sar    %edx
  movslq %edx,%rdx
  mov    %ecx,%eax
  shr    $0x1f,%eax
  add    %ecx,%eax
  sar    %eax
  cltq
  mov    (%rbx,%rdx,8),%rdx
  mov    (%rdx,%rax,4),%eax
  movslq %edi,%rdi
  mov    %eax,0x0(%rbp,%rdi,4)
  jmp    L122
```

assistant: ```c
int *spiralOrder(int **matrix, int matrixRowSize, int matrixColSize) {
  int size = matrixRowSize * matrixColSize;
  int *ret = (int *)malloc(size * sizeof(int));
  if (matrixRowSize == 1) {
    for (int i = 0; i < matrixColSize; i++)
      ret[i] = matrix[0][i];
    return ret;
  }
  if (matrixColSize == 1) {
    for (int i = 0; i < matrixRowSize; i++)
      ret[i] = matrix[i][0];
    return ret;
  }
  int round = 0;
  int i = 0;
  while (i < size - 1) {
    for (int j = round; j < matrixColSize - 1 - round; j++, i++)
      ret[i] = matrix[round][j];
    for (int j = round; j < matrixRowSize - 1 - round; j++, i++)
      ret[i] = matrix[j][matrixColSize - 1 - round];
    for (int j = round; j < matrixColSize - 1 - round; j++, i++)
      ret[i] = matrix[matrixRowSize - 1 - round][matrixColSize - 1 - j];
    for (int j = round; j < matrixRowSize - 1 - round; j++, i++)
      ret[i] = matrix[matrixRowSize - 1 - j][round];
    round++;
  }
  if (matrixRowSize == matrixColSize)
    ret[i] = matrix[matrixRowSize / 2][matrixColSize / 2];
  return ret;
}
```