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

```asm
<phi_gradient>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  movsd  %xmm0,-0x38(%rbp)
  movsd  %xmm1,-0x40(%rbp)
  movsd  %xmm2,-0x48(%rbp)
  movsd  %xmm3,-0x50(%rbp)
  movsd  %xmm4,-0x58(%rbp)
  movsd  %xmm5,-0x60(%rbp)
  movsd  -0x38(%rbp),%xmm0
  subsd  -0x60(%rbp),%xmm0
  movsd  %xmm0,-0x18(%rbp)
  movsd  -0x18(%rbp),%xmm0
  comisd D123(%rip),%xmm0
  jbe    L14
  movsd  -0x18(%rbp),%xmm0
  movsd  D106(%rip),%xmm1
  subsd  %xmm1,%xmm0
  movsd  %xmm0,-0x18(%rbp)
  jmp    L89
L14:
  movsd  D132(%rip),%xmm0
  comisd -0x18(%rbp),%xmm0
  jbe    L89
  movsd  -0x18(%rbp),%xmm1
  movsd  D106(%rip),%xmm0
  addsd  %xmm1,%xmm0
  movsd  %xmm0,-0x18(%rbp)
L89:
  movsd  -0x40(%rbp),%xmm0
  subsd  -0x60(%rbp),%xmm0
  movsd  %xmm0,-0x10(%rbp)
  movsd  -0x10(%rbp),%xmm0
  comisd D123(%rip),%xmm0
  jbe    L32
  movsd  -0x10(%rbp),%xmm0
  movsd  D106(%rip),%xmm1
  subsd  %xmm1,%xmm0
  movsd  %xmm0,-0x10(%rbp)
  jmp    L75
L32:
  movsd  D132(%rip),%xmm0
  comisd -0x10(%rbp),%xmm0
  jbe    L75
  movsd  -0x10(%rbp),%xmm1
  movsd  D106(%rip),%xmm0
  addsd  %xmm1,%xmm0
  movsd  %xmm0,-0x10(%rbp)
L75:
  movsd  -0x10(%rbp),%xmm0
  movapd %xmm0,%xmm1
  subsd  -0x18(%rbp),%xmm1
  movsd  D123(%rip),%xmm0
  comisd %xmm1,%xmm0
  jbe    L6
  movsd  -0x10(%rbp),%xmm0
  subsd  -0x18(%rbp),%xmm0
  comisd D132(%rip),%xmm0
  jbe    L6
  movsd  -0x18(%rbp),%xmm0
  movapd %xmm0,%xmm1
  mulsd  -0x50(%rbp),%xmm1
  movsd  -0x10(%rbp),%xmm0
  mulsd  -0x58(%rbp),%xmm0
  addsd  %xmm1,%xmm0
  movsd  -0x48(%rbp),%xmm1
  mulsd  %xmm1,%xmm0
  movsd  %xmm0,-0x20(%rbp)
  jmp    L24
L6:
  movsd  -0x18(%rbp),%xmm0
  pxor   %xmm1,%xmm1
  comisd %xmm1,%xmm0
  jbe    L102
  movsd  D123(%rip),%xmm0
  movsd  %xmm0,-0x28(%rbp)
  jmp    L33
L102:
  movsd  D132(%rip),%xmm0
  movsd  %xmm0,-0x28(%rbp)
L33:
  movsd  -0x58(%rbp),%xmm0
  movapd %xmm0,%xmm1
  subsd  -0x50(%rbp),%xmm1
  movsd  -0x28(%rbp),%xmm0
  subsd  -0x18(%rbp),%xmm0
  mulsd  %xmm1,%xmm0
  movsd  -0x48(%rbp),%xmm1
  movq   D113(%rip),%xmm2
  andpd  %xmm2,%xmm1
  divsd  %xmm1,%xmm0
  movsd  -0x50(%rbp),%xmm1
  addsd  %xmm1,%xmm0
  movsd  %xmm0,-0x8(%rbp)
  movsd  -0x18(%rbp),%xmm1
  movsd  D8(%rip),%xmm0
  mulsd  %xmm0,%xmm1
  movsd  -0x18(%rbp),%xmm0
  subsd  -0x28(%rbp),%xmm0
  mulsd  %xmm1,%xmm0
  mulsd  -0x50(%rbp),%xmm0
  movsd  -0x10(%rbp),%xmm2
  movsd  D8(%rip),%xmm1
  mulsd  %xmm1,%xmm2
  movsd  -0x10(%rbp),%xmm1
  addsd  -0x28(%rbp),%xmm1
  mulsd  %xmm2,%xmm1
  movapd %xmm1,%xmm2
  mulsd  -0x58(%rbp),%xmm2
  movapd %xmm0,%xmm1
  subsd  %xmm2,%xmm1
  movsd  -0x28(%rbp),%xmm2
  movsd  D8(%rip),%xmm0
  mulsd  %xmm0,%xmm2
  movsd  -0x18(%rbp),%xmm0
  addsd  -0x10(%rbp),%xmm0
  mulsd  %xmm2,%xmm0
  mulsd  -0x8(%rbp),%xmm0
  addsd  %xmm1,%xmm0
  movsd  %xmm0,-0x20(%rbp)
L24:
  movsd  -0x20(%rbp),%xmm0
  movq   %xmm0,%rax
  movq   %rax,%xmm0
  pop    %rbp
  ret
```

tool_calls: name: extract_symbolic_data
arguments: tag: D123
type: f64[2]
name: extract_symbolic_data
arguments: tag: D106
type: byte[8]
name: extract_symbolic_data
arguments: tag: D132
type: byte[16]
name: extract_symbolic_data
arguments: tag: D113
type: qword
name: extract_symbolic_data
arguments: tag: D8
type: f64

tool: {"D123": [3.141592653589793,6.283185307179586]}

tool: {"D106": [0x18,0x2d,0x44,0x54,0xfb,0x21,0x19,0x40]}

tool: {"D132": [0x18,0x2d,0x44,0x54,0xfb,0x21,0x09,0xc0,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00]}

tool: D113: 9223372036854775807

tool: D8: 0.5

assistant: ```c
double phi_gradient(double in_phi1, double in_phi2, double dphi, double f1, double f2, double grid_lon) {
  double fint, fac;
  double weight;
  double phi1, phi2;
  phi1 = in_phi1 - grid_lon;
  if (phi1 > 3.14159265358979323846)
    phi1 -= (2.0 * 3.14159265358979323846);
  else if (phi1 < -3.14159265358979323846)
    phi1 += (2.0 * 3.14159265358979323846);
  phi2 = in_phi2 - grid_lon;
  if (phi2 > 3.14159265358979323846)
    phi2 -= (2.0 * 3.14159265358979323846);
  else if (phi2 < -3.14159265358979323846)
    phi2 += (2.0 * 3.14159265358979323846);
  if ((phi2 - phi1) < 3.14159265358979323846 && (phi2 - phi1) > -3.14159265358979323846)
    weight = dphi * (phi1 * f1 + phi2 * f2);
  else {
    if (phi1 > 0.0)
      fac = 3.14159265358979323846;
    else
      fac = -3.14159265358979323846;
    fint = f1 + (f2 - f1) * (fac - phi1) / fabs(dphi);
    weight = 0.5 * phi1 * (phi1 - fac) * f1 - 0.5 * phi2 * (phi2 + fac) * f2 + 0.5 * fac * (phi1 + phi2) * fint;
  }
  return weight;
}
```