user: 请将以下的汇编代码转换成C语言代码：

```asm
<phi_gradient>:
  endbr64
  movapd %xmm0,%xmm6
  movapd %xmm2,%xmm7
  movsd  D9(%rip),%xmm2
  subsd  %xmm5,%xmm6
  comisd %xmm2,%xmm6
  jbe    L55
  subsd  D78(%rip),%xmm6
L59:
  subsd  %xmm5,%xmm1
  comisd %xmm2,%xmm1
  jbe    L40
  subsd  D78(%rip),%xmm1
L15:
  movapd %xmm1,%xmm0
  subsd  %xmm6,%xmm0
  comisd %xmm0,%xmm2
  jbe    L33
  comisd D30(%rip),%xmm0
  jbe    L33
  mulsd  %xmm3,%xmm6
  mulsd  %xmm1,%xmm4
  movapd %xmm6,%xmm0
  addsd  %xmm4,%xmm0
  mulsd  %xmm7,%xmm0
  ret
  nopl   (%rax)
L33:
  comisd D63(%rip),%xmm6
  movsd  D76(%rip),%xmm8
  jbe    L42
L49:
  movsd  D77(%rip),%xmm5
  movapd %xmm6,%xmm0
  movapd %xmm6,%xmm9
  andpd  D52(%rip),%xmm7
  subsd  %xmm2,%xmm9
  mulsd  %xmm5,%xmm0
  mulsd  %xmm1,%xmm5
  mulsd  %xmm9,%xmm0
  movapd %xmm2,%xmm9
  subsd  %xmm6,%xmm2
  addsd  %xmm1,%xmm9
  addsd  %xmm1,%xmm6
  mulsd  %xmm9,%xmm5
  mulsd  %xmm8,%xmm6
  mulsd  %xmm3,%xmm0
  mulsd  %xmm4,%xmm5
  subsd  %xmm3,%xmm4
  mulsd  %xmm4,%xmm2
  subsd  %xmm5,%xmm0
  divsd  %xmm7,%xmm2
  addsd  %xmm3,%xmm2
  mulsd  %xmm6,%xmm2
  addsd  %xmm2,%xmm0
  ret
  nopl   0x0(%rax,%rax,1)
L40:
  movsd  D30(%rip),%xmm0
  comisd %xmm1,%xmm0
  jbe    L15
  addsd  D78(%rip),%xmm1
  jmp    L15
  nopw   0x0(%rax,%rax,1)
L55:
  movsd  D30(%rip),%xmm0
  comisd %xmm6,%xmm0
  jbe    L59
  addsd  D78(%rip),%xmm6
  jmp    L59
  nop
L42:
  movsd  D53(%rip),%xmm8
  movsd  D30(%rip),%xmm2
  jmp    L49
```

tool_calls: name: read_data
arguments: label: D9
type_guessed: f64
name: read_data
arguments: label: D78
type_guessed: byte[8]
name: read_data
arguments: label: D30
type_guessed: byte[16]
name: read_data
arguments: label: D63
type_guessed: f64
name: read_data
arguments: label: D76
type_guessed: byte[8]
name: read_data
arguments: label: D77
type_guessed: f64
name: read_data
arguments: label: D52
type_guessed: qword[2]
name: read_data
arguments: label: D53
type_guessed: byte[8]

tool: D9: 3.141592653589793

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

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

tool: D63: 0

tool: {"D76": [0x18,0x2d,0x44,0x54,0xfb,0x21,0xf9,0x3f]}

tool: D77: 0.5

tool: {"D52": [0x7fffffffffffffff,0x0000000000000000]}

tool: {"D53": [0x18,0x2d,0x44,0x54,0xfb,0x21,0xf9,0xbf]}

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