user: 请从给定的汇编指令推导出C源代码：

```asm
<rotate>:
  endbr64
  push   %r15
  push   %r14
  xor    %r14d,%r14d
  push   %r13
  push   %r12
  push   %rbp
  mov    %rdi,%rbp
  push   %rbx
  sub    $0x48,%rsp
  mov    %fs:0x28,%rax
  mov    %rax,0x38(%rsp)
  xor    %eax,%eax
  lea    0x34(%rsp),%r13
  lea    0x30(%rsp),%r12
L0:
  mov    %r14d,%ebx
  lea    -0x3(%r14),%eax
  xor    %ecx,%ecx
  sar    %ebx
  mov    %eax,0x2c(%rsp)
  movslq %ebx,%rbx
  shl    $0x4,%rbx
  add    %rbp,%rbx
L29:
  mov    %ecx,%r15d
  mov    0x2c(%rsp),%eax
  mov    %r13,%rsi
  mov    %r12,%rdi
  sar    %r15d
  mov    %ecx,0x28(%rsp)
  movslq %r15d,%r15
  mov    %eax,0x30(%rsp)
  lea    -0x3(%rcx),%eax
  mov    (%rbx,%r15,4),%r9d
  mov    %eax,0x34(%rsp)
  mov    %r9d,0x24(%rsp)
  call   <R90deg@plt>
  mov    0x30(%rsp),%eax
  mov    %r13,%rsi
  mov    %r12,%rdi
  add    $0x3,%eax
  mov    %eax,%r10d
  shr    $0x1f,%r10d
  add    %eax,%r10d
  mov    0x34(%rsp),%eax
  sar    %r10d
  add    $0x3,%eax
  movslq %r10d,%r10
  mov    %eax,%r11d
  shl    $0x4,%r10
  shr    $0x1f,%r11d
  add    %rbp,%r10
  add    %eax,%r11d
  mov    %r10,0x18(%rsp)
  sar    %r11d
  movslq %r11d,%r11
  mov    (%r10,%r11,4),%eax
  mov    %r11,0x10(%rsp)
  mov    %eax,(%rbx,%r15,4)
  call   <R90deg@plt>
  mov    0x30(%rsp),%eax
  mov    %r13,%rsi
  mov    %r12,%rdi
  mov    0x10(%rsp),%r11
  mov    0x18(%rsp),%r10
  add    $0x3,%eax
  mov    %eax,%r15d
  shr    $0x1f,%r15d
  add    %eax,%r15d
  mov    0x34(%rsp),%eax
  sar    %r15d
  add    $0x3,%eax
  movslq %r15d,%r15
  mov    %eax,%edx
  shl    $0x4,%r15
  shr    $0x1f,%edx
  add    %rbp,%r15
  add    %eax,%edx
  sar    %edx
  movslq %edx,%rdx
  mov    (%r15,%rdx,4),%eax
  mov    %rdx,0x8(%rsp)
  mov    %eax,(%r10,%r11,4)
  call   <R90deg@plt>
  mov    0x30(%rsp),%eax
  mov    0x34(%rsp),%ecx
  mov    0x8(%rsp),%rdx
  mov    0x24(%rsp),%r9d
  lea    0x3(%rax),%esi
  lea    0x3(%rcx),%edi
  mov    0x28(%rsp),%ecx
  mov    %esi,%eax
  shr    $0x1f,%eax
  add    %esi,%eax
  mov    %edi,%esi
  sar    %eax
  shr    $0x1f,%esi
  add    %edi,%esi
  cltq
  shl    $0x4,%rax
  sar    %esi
  add    %rbp,%rax
  movslq %esi,%rsi
  add    $0x2,%ecx
  mov    (%rax,%rsi,4),%edi
  mov    %edi,(%r15,%rdx,4)
  mov    %r9d,(%rax,%rsi,4)
  cmp    $0x4,%ecx
  jne    L29
  add    $0x2,%r14d
  cmp    $0x4,%r14d
  jne    L0
  mov    0x38(%rsp),%rax
  sub    %fs:0x28,%rax
  jne    L24
  add    $0x48,%rsp
  xor    %eax,%eax
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
L24:
  call   <__stack_chk_fail@plt>
```

assistant: ```c
int rotate(int field[][4]) {
  int tmp = 0, offset = (4 * 2 - 1) / 2, step = 2;
  for (int i = 0, x = 0, ox = 0; i < step * 4 / 2; i += step) {
    for (int j = 0, y = 0, oy = 0; j < step * 4 / 2; j += step) {
      x = i - offset, y = j - offset;
      tmp = field[(x + offset) / step][(y + offset) / step];
      ox = x, oy = y;
      R90deg(&x, &y);
      field[(ox + offset) / step][(oy + offset) / step] = field[(x + offset) / step][(y + offset) / step];
      ox = x, oy = y;
      R90deg(&x, &y);
      field[(ox + offset) / step][(oy + offset) / step] = field[(x + offset) / step][(y + offset) / step];
      ox = x, oy = y;
      R90deg(&x, &y);
      field[(ox + offset) / step][(oy + offset) / step] = field[(x + offset) / step][(y + offset) / step];
      field[(x + offset) / step][(y + offset) / step] = tmp;
    }
  }
  return 0;
}
```