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

```asm
<four1>:
  endbr64
  push   %r13
  push   %r12
  push   %rbp
  push   %rbx
  lea    (%rsi,%rsi,1),%ebx
  sub    $0x28,%rsp
  cmp    $0x1,%ebx
  jle    L158
  cmp    $0x1,%esi
  mov    %edx,%r9d
  mov    %rdi,%r12
  mov    $0x3,%ecx
  setg   %r8b
  mov    $0x1,%edx
  nopl   0x0(%rax)
L51:
  mov    %esi,%eax
  cmp    %esi,%edx
  jle    L43
  test   %r8b,%r8b
  jne    L142
  jmp    L43
  nopl   (%rax)
L0:
  cmp    %eax,%edx
  jle    L43
L142:
  sub    %eax,%edx
  sar    %eax
  cmp    $0x1,%eax
  jg     L0
L43:
  add    %eax,%edx
  cmp    %ecx,%ebx
  jle    L2
  cmp    %ecx,%edx
  jle    L77
  movslq %edx,%rax
  movsd  -0x8(%r12,%rcx,8),%xmm1
  shl    $0x3,%rax
  lea    -0x8(%r12,%rax,1),%rdi
  add    %r12,%rax
  movsd  (%rdi),%xmm0
  movsd  %xmm1,(%rdi)
  movsd  (%r12,%rcx,8),%xmm1
  movsd  %xmm0,-0x8(%r12,%rcx,8)
  movsd  (%rax),%xmm0
  movsd  %xmm1,(%rax)
  movsd  %xmm0,(%r12,%rcx,8)
L77:
  add    $0x2,%rcx
  jmp    L51
  xchg   %ax,%ax
L28:
  cmp    %ebp,%ebx
  jg     L86
L158:
  add    $0x28,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  ret
L2:
  cmp    $0x2,%ebx
  jle    L158
  pxor   %xmm6,%xmm6
  mov    $0x2,%ebp
  cvtsi2sd %r9d,%xmm6
  movsd  %xmm6,0x18(%rsp)
  nopl   0x0(%rax,%rax,1)
L86:
  mov    %ebp,%r13d
  pxor   %xmm0,%xmm0
  movsd  D13(%rip),%xmm1
  add    %ebp,%ebp
  cvtsi2sd %r13d,%xmm0
  divsd  %xmm0,%xmm1
  movsd  D2(%rip),%xmm0
  mulsd  0x18(%rsp),%xmm1
  mulsd  %xmm1,%xmm0
  movsd  %xmm1,0x8(%rsp)
  call   <sin@plt>
  movsd  D21(%rip),%xmm5
  movsd  0x8(%rsp),%xmm1
  mulsd  %xmm0,%xmm5
  mulsd  %xmm0,%xmm5
  movapd %xmm1,%xmm0
  movsd  %xmm5,0x10(%rsp)
  call   <sin@plt>
  movapd %xmm0,%xmm6
  cmp    $0x1,%r13d
  jle    L28
  movslq %ebp,%rsi
  movslq %r13d,%rax
  movsd  0x10(%rsp),%xmm5
  pxor   %xmm4,%xmm4
  mov    D27(%rip),%rdi
  lea    0x8(%r12),%r8
  shl    $0x3,%rsi
  lea    -0x8(,%rax,8),%r9
  movq   %rdi,%xmm3
  mov    $0x1,%edi
  nopl   0x0(%rax)
L9:
  lea    (%r9,%r8,1),%rdx
  mov    %r8,%rax
  mov    %edi,%ecx
  cmp    %edi,%ebx
  jl     L98
  nopl   (%rax)
L63:
  movsd  (%rdx),%xmm2
  movsd  0x8(%rdx),%xmm0
  add    %ebp,%ecx
  movapd %xmm2,%xmm1
  movapd %xmm0,%xmm7
  mulsd  %xmm3,%xmm1
  mulsd  %xmm4,%xmm7
  mulsd  %xmm4,%xmm2
  mulsd  %xmm3,%xmm0
  subsd  %xmm7,%xmm1
  addsd  %xmm2,%xmm0
  movsd  -0x8(%rax),%xmm2
  subsd  %xmm1,%xmm2
  movsd  %xmm2,(%rdx)
  movsd  (%rax),%xmm2
  subsd  %xmm0,%xmm2
  movsd  %xmm2,0x8(%rdx)
  addsd  -0x8(%rax),%xmm1
  addsd  (%rax),%xmm0
  add    %rsi,%rdx
  movsd  %xmm1,-0x8(%rax)
  movsd  %xmm0,(%rax)
  add    %rsi,%rax
  cmp    %ecx,%ebx
  jge    L63
L98:
  movapd %xmm5,%xmm0
  movapd %xmm6,%xmm1
  add    $0x2,%edi
  add    $0x10,%r8
  mulsd  %xmm4,%xmm1
  mulsd  %xmm3,%xmm0
  subsd  %xmm1,%xmm0
  movapd %xmm5,%xmm1
  mulsd  %xmm4,%xmm1
  addsd  %xmm3,%xmm0
  mulsd  %xmm6,%xmm3
  addsd  %xmm1,%xmm3
  addsd  %xmm3,%xmm4
  cmp    %r13d,%edi
  jge    L28
  movapd %xmm0,%xmm3
  jmp    L9
```

tool_calls: name: unpack_data
arguments: data_label: D13
type: f64
name: unpack_data
arguments: data_label: D2
type: f64
name: unpack_data
arguments: data_label: D21
type: f32[2]
name: unpack_data
arguments: data_label: D27
type: f64

tool: D13: 6.28318530717959

tool: D2: 0.5

tool: {"D21": [0.0,-2.0]}

tool: D27: 1

assistant: ```c
void four1(double *data, int nn, int isign) {
  int n, mmax, m, j, istep, i;
  double wtemp, wr, wpr, wpi, wi, theta;
  double tempr, tempi;
  n = nn << 1;
  j = 1;
  for (i = 1; i < n; i += 2) {
    if (j > i) {
      tempr = (data[j - 1]);
      (data[j - 1]) = (data[i - 1]);
      (data[i - 1]) = tempr;
      tempr = (data[j]);
      (data[j]) = (data[i]);
      (data[i]) = tempr;
    }
    m = nn;
    while (m >= 2 && j > m) {
      j -= m;
      m >>= 1;
    }
    j += m;
  }
  mmax = 2;
  while (n > mmax) {
    istep = mmax << 1;
    theta = isign * (6.28318530717959 / mmax);
    wtemp = sin(0.5 * theta);
    wpr = -2.0 * wtemp * wtemp;
    wpi = sin(theta);
    wr = 1.0;
    wi = 0.0;
    for (m = 1; m < mmax; m += 2) {
      for (i = m; i <= n; i += istep) {
        j = i + mmax;
        tempr = wr * data[j - 1] - wi * data[j];
        tempi = wr * data[j] + wi * data[j - 1];
        data[j - 1] = data[i - 1] - tempr;
        data[j] = data[i] - tempi;
        data[i - 1] += tempr;
        data[i] += tempi;
      }
      wr = (wtemp = wr) * wpr - wi * wpi + wr;
      wi = wi * wpr + wtemp * wpi + wi;
    }
    mmax = istep;
  }
}
```