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

```asm
<spiralOrder>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  sub    $0x40,%rsp
  mov    %rdi,-0x38(%rbp)
  mov    %esi,-0x3c(%rbp)
  mov    %edx,-0x40(%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)
  cmpl   $0x1,-0x3c(%rbp)
  jne    L30
  movl   $0x0,-0x2c(%rbp)
  jmp    L83
L1:
  mov    -0x38(%rbp),%rax
  mov    (%rax),%rdx
  mov    -0x2c(%rbp),%eax
  cltq
  shl    $0x2,%rax
  add    %rdx,%rax
  mov    -0x2c(%rbp),%edx
  movslq %edx,%rdx
  lea    0x0(,%rdx,4),%rcx
  mov    -0x8(%rbp),%rdx
  add    %rcx,%rdx
  mov    (%rax),%eax
  mov    %eax,(%rdx)
  addl   $0x1,-0x2c(%rbp)
L83:
  mov    -0x2c(%rbp),%eax
  cmp    -0x40(%rbp),%eax
  jl     L1
  mov    -0x8(%rbp),%rax
  jmp    L107
L30:
  cmpl   $0x1,-0x40(%rbp)
  jne    L15
  movl   $0x0,-0x28(%rbp)
  jmp    L40
L48:
  mov    -0x28(%rbp),%eax
  cltq
  lea    0x0(,%rax,8),%rdx
  mov    -0x38(%rbp),%rax
  add    %rdx,%rax
  mov    (%rax),%rax
  mov    -0x28(%rbp),%edx
  movslq %edx,%rdx
  lea    0x0(,%rdx,4),%rcx
  mov    -0x8(%rbp),%rdx
  add    %rcx,%rdx
  mov    (%rax),%eax
  mov    %eax,(%rdx)
  addl   $0x1,-0x28(%rbp)
L40:
  mov    -0x28(%rbp),%eax
  cmp    -0x3c(%rbp),%eax
  jl     L48
  mov    -0x8(%rbp),%rax
  jmp    L107
L15:
  movl   $0x0,-0x24(%rbp)
  movl   $0x0,-0x20(%rbp)
  jmp    L80
L24:
  mov    -0x24(%rbp),%eax
  mov    %eax,-0x1c(%rbp)
  jmp    L70
L111:
  mov    -0x24(%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
  add    %rdx,%rax
  mov    -0x20(%rbp),%edx
  movslq %edx,%rdx
  lea    0x0(,%rdx,4),%rcx
  mov    -0x8(%rbp),%rdx
  add    %rcx,%rdx
  mov    (%rax),%eax
  mov    %eax,(%rdx)
  addl   $0x1,-0x1c(%rbp)
  addl   $0x1,-0x20(%rbp)
L70:
  mov    -0x40(%rbp),%eax
  sub    $0x1,%eax
  sub    -0x24(%rbp),%eax
  cmp    %eax,-0x1c(%rbp)
  jl     L111
  mov    -0x24(%rbp),%eax
  mov    %eax,-0x18(%rbp)
  jmp    L129
L6:
  mov    -0x18(%rbp),%eax
  cltq
  lea    0x0(,%rax,8),%rdx
  mov    -0x38(%rbp),%rax
  add    %rdx,%rax
  mov    (%rax),%rdx
  mov    -0x40(%rbp),%eax
  sub    $0x1,%eax
  sub    -0x24(%rbp),%eax
  cltq
  shl    $0x2,%rax
  add    %rdx,%rax
  mov    -0x20(%rbp),%edx
  movslq %edx,%rdx
  lea    0x0(,%rdx,4),%rcx
  mov    -0x8(%rbp),%rdx
  add    %rcx,%rdx
  mov    (%rax),%eax
  mov    %eax,(%rdx)
  addl   $0x1,-0x18(%rbp)
  addl   $0x1,-0x20(%rbp)
L129:
  mov    -0x3c(%rbp),%eax
  sub    $0x1,%eax
  sub    -0x24(%rbp),%eax
  cmp    %eax,-0x18(%rbp)
  jl     L6
  mov    -0x24(%rbp),%eax
  mov    %eax,-0x14(%rbp)
  jmp    L35
L169:
  mov    -0x3c(%rbp),%eax
  sub    $0x1,%eax
  sub    -0x24(%rbp),%eax
  cltq
  lea    0x0(,%rax,8),%rdx
  mov    -0x38(%rbp),%rax
  add    %rdx,%rax
  mov    (%rax),%rdx
  mov    -0x40(%rbp),%eax
  sub    $0x1,%eax
  sub    -0x14(%rbp),%eax
  cltq
  shl    $0x2,%rax
  add    %rdx,%rax
  mov    -0x20(%rbp),%edx
  movslq %edx,%rdx
  lea    0x0(,%rdx,4),%rcx
  mov    -0x8(%rbp),%rdx
  add    %rcx,%rdx
  mov    (%rax),%eax
  mov    %eax,(%rdx)
  addl   $0x1,-0x14(%rbp)
  addl   $0x1,-0x20(%rbp)
L35:
  mov    -0x40(%rbp),%eax
  sub    $0x1,%eax
  sub    -0x24(%rbp),%eax
  cmp    %eax,-0x14(%rbp)
  jl     L169
  mov    -0x24(%rbp),%eax
  mov    %eax,-0x10(%rbp)
  jmp    L60
L189:
  mov    -0x3c(%rbp),%eax
  sub    $0x1,%eax
  sub    -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
  add    %rdx,%rax
  mov    -0x20(%rbp),%edx
  movslq %edx,%rdx
  lea    0x0(,%rdx,4),%rcx
  mov    -0x8(%rbp),%rdx
  add    %rcx,%rdx
  mov    (%rax),%eax
  mov    %eax,(%rdx)
  addl   $0x1,-0x10(%rbp)
  addl   $0x1,-0x20(%rbp)
L60:
  mov    -0x3c(%rbp),%eax
  sub    $0x1,%eax
  sub    -0x24(%rbp),%eax
  cmp    %eax,-0x10(%rbp)
  jl     L189
  addl   $0x1,-0x24(%rbp)
L80:
  mov    -0xc(%rbp),%eax
  sub    $0x1,%eax
  cmp    %eax,-0x20(%rbp)
  jl     L24
  mov    -0x3c(%rbp),%eax
  cmp    -0x40(%rbp),%eax
  jne    L138
  mov    -0x3c(%rbp),%eax
  mov    %eax,%edx
  shr    $0x1f,%edx
  add    %edx,%eax
  sar    %eax
  cltq
  lea    0x0(,%rax,8),%rdx
  mov    -0x38(%rbp),%rax
  add    %rdx,%rax
  mov    (%rax),%rdx
  mov    -0x40(%rbp),%eax
  mov    %eax,%ecx
  shr    $0x1f,%ecx
  add    %ecx,%eax
  sar    %eax
  cltq
  shl    $0x2,%rax
  add    %rdx,%rax
  mov    -0x20(%rbp),%edx
  movslq %edx,%rdx
  lea    0x0(,%rdx,4),%rcx
  mov    -0x8(%rbp),%rdx
  add    %rcx,%rdx
  mov    (%rax),%eax
  mov    %eax,(%rdx)
L138:
  mov    -0x8(%rbp),%rax
L107:
  leave
  ret
```

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