user: Converte this assembly snippet into its equivalent C code:

```asm
<linear_GRP_solver_LAG>:
  endbr64
  push   %rbp
  movapd %xmm0,%xmm12
  movapd %xmm4,%xmm15
  pxor   %xmm11,%xmm11
  push   %rbx
  mov    %rsi,%rbp
  mov    %rdi,%rbx
  sub    $0xc8,%rsp
  movsd  D162(%rip),%xmm8
  movsd  0x100(%rsp),%xmm9
  movsd  %xmm3,0x68(%rsp)
  movsd  0xe0(%rsp),%xmm3
  movsd  %xmm2,0x60(%rsp)
  movapd %xmm5,%xmm2
  movsd  0xe8(%rsp),%xmm10
  movapd %xmm9,%xmm5
  movapd %xmm9,%xmm4
  movapd %xmm9,%xmm0
  movsd  %xmm1,0x8(%rsp)
  mulsd  %xmm3,%xmm5
  addsd  %xmm8,%xmm4
  subsd  %xmm8,%xmm0
  movsd  %xmm6,0x28(%rsp)
  movsd  %xmm7,0x30(%rsp)
  mov    %fs:0x28,%rax
  mov    %rax,0xb8(%rsp)
  xor    %eax,%eax
  divsd  %xmm4,%xmm0
  movsd  %xmm4,0x58(%rsp)
  divsd  %xmm12,%xmm5
  movsd  %xmm0,0x10(%rsp)
  ucomisd %xmm5,%xmm11
  ja     L39
  sqrtsd %xmm5,%xmm5
L20:
  movapd %xmm9,%xmm6
  mulsd  %xmm10,%xmm6
  divsd  0x8(%rsp),%xmm6
  ucomisd %xmm6,%xmm11
  ja     L56
  sqrtsd %xmm6,%xmm6
L41:
  movapd %xmm12,%xmm7
  movapd %xmm10,%xmm4
  movapd %xmm15,%xmm1
  mov    $0x1f4,%ecx
  mulsd  %xmm5,%xmm7
  movapd %xmm9,%xmm0
  lea    0xb0(%rsp),%rdx
  movsd  %xmm12,0x50(%rsp)
  lea    0xa8(%rsp),%rsi
  movsd  %xmm5,0x48(%rsp)
  lea    0xa0(%rsp),%rdi
  movsd  %xmm10,0xe8(%rsp)
  movsd  %xmm3,0xe0(%rsp)
  movsd  %xmm2,0x40(%rsp)
  movsd  %xmm7,0x18(%rsp)
  movsd  0x8(%rsp),%xmm7
  movsd  %xmm15,0x38(%rsp)
  movsd  %xmm9,0x100(%rsp)
  mulsd  %xmm6,%xmm7
  movsd  %xmm7,0x20(%rsp)
  movsd  0x108(%rsp),%xmm7
  call   <Riemann_solver_exact@plt>
  movsd  0x40(%rsp),%xmm2
  pxor   %xmm11,%xmm11
  movsd  0xa8(%rsp),%xmm13
  movsd  0xe0(%rsp),%xmm3
  mov    D162(%rip),%rax
  movsd  0x100(%rsp),%xmm9
  movsd  0x38(%rsp),%xmm15
  comisd %xmm3,%xmm13
  movsd  0x48(%rsp),%xmm5
  movsd  0xe8(%rsp),%xmm10
  movq   %rax,%xmm8
  movsd  0x50(%rsp),%xmm12
  jbe    L152
  movsd  0x10(%rsp),%xmm7
  comisd %xmm10,%xmm13
  movapd %xmm7,%xmm6
  mulsd  %xmm3,%xmm6
  mulsd  %xmm13,%xmm7
  addsd  %xmm13,%xmm6
  movapd %xmm7,%xmm0
  addsd  %xmm3,%xmm0
  mulsd  %xmm12,%xmm6
  divsd  %xmm0,%xmm6
  jbe    L144
L8:
  movsd  0x10(%rsp),%xmm4
  movapd %xmm4,%xmm7
  mulsd  %xmm10,%xmm7
  mulsd  %xmm13,%xmm4
  addsd  %xmm13,%xmm7
  mulsd  0x8(%rsp),%xmm7
  movapd %xmm4,%xmm0
  addsd  %xmm10,%xmm0
  divsd  %xmm0,%xmm7
L36:
  movapd %xmm13,%xmm12
  movsd  %xmm13,0x10(%rbp)
  movsd  0xa0(%rsp),%xmm4
  mulsd  %xmm9,%xmm12
  movsd  %xmm6,0x0(%rbp)
  movsd  %xmm4,0x8(%rbp)
  movsd  %xmm7,0x18(%rbp)
  movapd %xmm12,%xmm14
  divsd  %xmm6,%xmm14
  ucomisd %xmm14,%xmm11
  ja     L43
  sqrtsd %xmm14,%xmm14
L1:
  divsd  %xmm7,%xmm12
  ucomisd %xmm12,%xmm11
  ja     L83
  sqrtsd %xmm12,%xmm12
L181:
  subsd  %xmm2,%xmm15
  mulsd  %xmm12,%xmm7
  movapd %xmm3,%xmm1
  subsd  %xmm10,%xmm1
  mulsd  %xmm14,%xmm6
  mulsd  %xmm15,%xmm15
  mulsd  %xmm1,%xmm1
  movapd %xmm1,%xmm3
  addsd  %xmm15,%xmm3
  ucomisd %xmm3,%xmm11
  ja     L80
  sqrtsd %xmm3,%xmm3
L82:
  movsd  0x108(%rsp),%xmm0
  movapd %xmm8,%xmm15
  mulsd  D106(%rip),%xmm0
  divsd  %xmm6,%xmm15
  comisd %xmm3,%xmm0
  jbe    L87
  movapd %xmm8,%xmm0
  movq   D174(%rip),%xmm2
  movsd  0x18(%rsp),%xmm5
  movapd %xmm15,%xmm4
  movsd  0x20(%rsp),%xmm3
  movsd  0x28(%rsp),%xmm1
  movsd  D112(%rip),%xmm11
  xorpd  %xmm2,%xmm4
  mulsd  %xmm5,%xmm1
  addsd  0xf0(%rsp),%xmm1
  mulsd  %xmm4,%xmm5
  mulsd  %xmm5,%xmm1
  divsd  %xmm7,%xmm0
  xorpd  %xmm0,%xmm2
  mulsd  %xmm3,%xmm2
  mulsd  0x30(%rsp),%xmm3
  subsd  0xf8(%rsp),%xmm3
  mulsd  %xmm3,%xmm2
L105:
  mulsd  %xmm2,%xmm15
  movapd %xmm1,%xmm3
  movapd %xmm0,%xmm5
  mulsd  %xmm0,%xmm3
  subsd  %xmm4,%xmm5
  subsd  %xmm0,%xmm4
  mulsd  %xmm11,%xmm1
  movapd %xmm8,%xmm0
  divsd  %xmm14,%xmm0
  subsd  %xmm15,%xmm3
  subsd  %xmm2,%xmm1
  divsd  %xmm12,%xmm8
  divsd  %xmm4,%xmm1
  divsd  %xmm14,%xmm0
  movsd  %xmm1,0x10(%rbx)
  divsd  %xmm12,%xmm8
  mulsd  %xmm1,%xmm0
  movsd  %xmm0,(%rbx)
  divsd  %xmm5,%xmm3
  mulsd  %xmm1,%xmm8
  movsd  %xmm8,0x18(%rbx)
  movsd  %xmm3,0x8(%rbx)
  mov    0xb8(%rsp),%rax
  sub    %fs:0x28,%rax
  jne    L89
  add    $0xc8,%rsp
  pop    %rbx
  pop    %rbp
  ret
  nopw   0x0(%rax,%rax,1)
L152:
  movapd %xmm13,%xmm0
  movq   %rax,%xmm1
  movsd  %xmm10,0xe8(%rsp)
  divsd  %xmm3,%xmm0
  movsd  %xmm2,0x70(%rsp)
  movsd  %xmm15,0x50(%rsp)
  movsd  %xmm12,0x48(%rsp)
  movsd  %xmm5,0x40(%rsp)
  movsd  %xmm13,0x38(%rsp)
  movsd  %xmm3,0xe0(%rsp)
  movsd  %xmm9,0x100(%rsp)
  divsd  %xmm9,%xmm1
  call   <pow@plt>
  movsd  0x70(%rsp),%xmm2
  pxor   %xmm11,%xmm11
  movsd  0xe8(%rsp),%xmm10
  movsd  0x38(%rsp),%xmm13
  movsd  0x48(%rsp),%xmm12
  movapd %xmm0,%xmm6
  mov    D162(%rip),%rax
  movsd  0x50(%rsp),%xmm15
  mulsd  %xmm12,%xmm6
  comisd %xmm10,%xmm13
  movsd  0x40(%rsp),%xmm5
  movsd  0xe0(%rsp),%xmm3
  movsd  0x100(%rsp),%xmm9
  movq   %rax,%xmm8
  ja     L8
L144:
  movapd %xmm13,%xmm0
  movapd %xmm8,%xmm1
  movsd  %xmm3,0xe0(%rsp)
  divsd  %xmm10,%xmm0
  movsd  %xmm2,0x70(%rsp)
  movsd  %xmm15,0x50(%rsp)
  movsd  %xmm5,0x48(%rsp)
  movsd  %xmm6,0x40(%rsp)
  movsd  %xmm13,0x38(%rsp)
  movsd  %xmm10,0xe8(%rsp)
  movsd  %xmm9,0x100(%rsp)
  divsd  %xmm9,%xmm1
  call   <pow@plt>
  movsd  0x8(%rsp),%xmm7
  mov    D162(%rip),%rax
  pxor   %xmm11,%xmm11
  movsd  0xe0(%rsp),%xmm3
  movsd  0x70(%rsp),%xmm2
  mulsd  %xmm0,%xmm7
  movsd  0x50(%rsp),%xmm15
  movsd  0x48(%rsp),%xmm5
  movq   %rax,%xmm8
  movsd  0x40(%rsp),%xmm6
  movsd  0x38(%rsp),%xmm13
  movsd  0xe8(%rsp),%xmm10
  movsd  0x100(%rsp),%xmm9
  jmp    L36
  nopl   0x0(%rax)
L87:
  mulsd  D153(%rip),%xmm9
  movapd %xmm6,%xmm0
  movsd  D44(%rip),%xmm3
  movsd  %xmm10,0xe8(%rsp)
  movsd  %xmm2,0x98(%rsp)
  divsd  0x18(%rsp),%xmm0
  movsd  %xmm15,0x90(%rsp)
  movsd  %xmm7,0x88(%rsp)
  movsd  %xmm12,0x80(%rsp)
  subsd  %xmm8,%xmm9
  movsd  %xmm14,0x78(%rsp)
  movsd  %xmm5,0x70(%rsp)
  movsd  %xmm4,0x50(%rsp)
  movapd %xmm9,%xmm1
  movsd  %xmm13,0x48(%rsp)
  mulsd  %xmm3,%xmm1
  movsd  %xmm9,0x40(%rsp)
  movsd  %xmm6,0x38(%rsp)
  divsd  0x58(%rsp),%xmm1
  call   <pow@plt>
  movsd  0x18(%rsp),%xmm2
  pxor   %xmm11,%xmm11
  mov    D162(%rip),%rax
  movsd  0x40(%rsp),%xmm9
  movsd  0x70(%rsp),%xmm5
  movq   %rax,%xmm1
  movsd  0x38(%rsp),%xmm6
  movq   %rax,%xmm8
  mov    D44(%rip),%rax
  divsd  %xmm2,%xmm1
  subsd  %xmm8,%xmm0
  movsd  0x48(%rsp),%xmm13
  movsd  0x50(%rsp),%xmm4
  mulsd  %xmm5,%xmm5
  movsd  0x78(%rsp),%xmm14
  movsd  0x80(%rsp),%xmm12
  movq   %rax,%xmm3
  movsd  0x88(%rsp),%xmm7
  mulsd  0x60(%rsp),%xmm5
  subsd  0xf0(%rsp),%xmm5
  movsd  0x90(%rsp),%xmm15
  movsd  0xe8(%rsp),%xmm10
  divsd  %xmm9,%xmm1
  mulsd  %xmm5,%xmm1
  movsd  0xf0(%rsp),%xmm5
  divsd  %xmm2,%xmm5
  mulsd  %xmm6,%xmm2
  mulsd  %xmm0,%xmm1
  ucomisd %xmm2,%xmm11
  movapd %xmm2,%xmm0
  movsd  0x98(%rsp),%xmm2
  addsd  0x28(%rsp),%xmm5
  addsd  %xmm5,%xmm1
  ja     L156
  sqrtsd %xmm0,%xmm0
L110:
  movapd %xmm13,%xmm5
  subsd  %xmm2,%xmm4
  movq   D174(%rip),%xmm6
  subsd  %xmm10,%xmm5
  mulsd  0x10(%rsp),%xmm10
  xorpd  %xmm6,%xmm0
  mulsd  %xmm0,%xmm1
  movapd %xmm5,%xmm2
  movapd %xmm5,%xmm9
  mulsd  %xmm3,%xmm2
  addsd  %xmm13,%xmm10
  divsd  %xmm4,%xmm9
  movsd  D74(%rip),%xmm13
  movapd %xmm13,%xmm11
  movapd %xmm2,%xmm0
  movq   %xmm2,%rax
  divsd  %xmm10,%xmm0
  subsd  %xmm0,%xmm11
  movapd %xmm9,%xmm0
  xorpd  %xmm6,%xmm0
  divsd  %xmm7,%xmm0
  divsd  %xmm7,%xmm0
  movapd %xmm11,%xmm7
  subsd  %xmm8,%xmm7
  movapd %xmm7,%xmm2
  movsd  0x20(%rsp),%xmm7
  mulsd  %xmm7,%xmm7
  divsd  %xmm9,%xmm2
  divsd  %xmm9,%xmm7
  subsd  %xmm2,%xmm0
  movsd  0x10(%rsp),%xmm2
  mulsd  %xmm5,%xmm2
  mulsd  %xmm3,%xmm2
  divsd  %xmm10,%xmm2
  addsd  %xmm8,%xmm2
  mulsd  %xmm7,%xmm2
  movsd  0x8(%rsp),%xmm7
  mulsd  %xmm7,%xmm4
  mulsd  %xmm3,%xmm4
  mulsd  0x10(%rsp),%xmm3
  addsd  %xmm9,%xmm4
  mulsd  %xmm5,%xmm3
  addsd  %xmm4,%xmm2
  mulsd  0x30(%rsp),%xmm2
  movapd %xmm11,%xmm4
  mulsd  %xmm15,%xmm4
  divsd  %xmm10,%xmm3
  addsd  %xmm13,%xmm3
  mulsd  0xf8(%rsp),%xmm3
  subsd  %xmm3,%xmm2
  movq   %rax,%xmm3
  xorpd  %xmm6,%xmm3
  divsd  %xmm7,%xmm3
  mulsd  0x68(%rsp),%xmm3
  addsd  %xmm3,%xmm2
  jmp    L105
L56:
  movapd %xmm6,%xmm0
  movsd  %xmm2,0x40(%rsp)
  movsd  %xmm9,0x100(%rsp)
  movsd  %xmm10,0xe8(%rsp)
  movsd  %xmm3,0xe0(%rsp)
  movsd  %xmm15,0x38(%rsp)
  movsd  %xmm12,0x20(%rsp)
  movsd  %xmm5,0x18(%rsp)
  call   <sqrt@plt>
  movsd  0x40(%rsp),%xmm2
  movsd  0x100(%rsp),%xmm9
  movsd  0xe8(%rsp),%xmm10
  movsd  0x38(%rsp),%xmm15
  movapd %xmm0,%xmm6
  movsd  0xe0(%rsp),%xmm3
  movsd  0x20(%rsp),%xmm12
  movsd  0x18(%rsp),%xmm5
  jmp    L41
L39:
  movapd %xmm5,%xmm0
  movsd  %xmm2,0x38(%rsp)
  movsd  %xmm9,0x100(%rsp)
  movsd  %xmm10,0xe8(%rsp)
  movsd  %xmm3,0xe0(%rsp)
  movsd  %xmm15,0x20(%rsp)
  movsd  %xmm12,0x18(%rsp)
  call   <sqrt@plt>
  movsd  0x38(%rsp),%xmm2
  pxor   %xmm11,%xmm11
  movsd  0x100(%rsp),%xmm9
  movsd  0xe8(%rsp),%xmm10
  movsd  0x20(%rsp),%xmm15
  movapd %xmm0,%xmm5
  movsd  0xe0(%rsp),%xmm3
  movsd  0x18(%rsp),%xmm12
  jmp    L20
L43:
  movapd %xmm14,%xmm0
  movsd  %xmm5,0x78(%rsp)
  movsd  %xmm9,0x100(%rsp)
  movsd  %xmm10,0xe8(%rsp)
  movsd  %xmm3,0xe0(%rsp)
  movsd  %xmm2,0x88(%rsp)
  movsd  %xmm15,0x80(%rsp)
  movsd  %xmm7,0x70(%rsp)
  movsd  %xmm6,0x50(%rsp)
  movsd  %xmm12,0x48(%rsp)
  movsd  %xmm4,0x40(%rsp)
  movsd  %xmm13,0x38(%rsp)
  call   <sqrt@plt>
  movsd  0x78(%rsp),%xmm5
  pxor   %xmm11,%xmm11
  mov    D162(%rip),%rax
  movsd  0x100(%rsp),%xmm9
  movsd  0x70(%rsp),%xmm7
  movapd %xmm0,%xmm14
  movsd  0xe8(%rsp),%xmm10
  movsd  0x50(%rsp),%xmm6
  movq   %rax,%xmm8
  movsd  0xe0(%rsp),%xmm3
  movsd  0x48(%rsp),%xmm12
  movsd  0x88(%rsp),%xmm2
  movsd  0x40(%rsp),%xmm4
  movsd  0x80(%rsp),%xmm15
  movsd  0x38(%rsp),%xmm13
  jmp    L1
L80:
  movapd %xmm3,%xmm0
  movsd  %xmm7,0x78(%rsp)
  movsd  %xmm9,0x100(%rsp)
  movsd  %xmm10,0xe8(%rsp)
  movsd  %xmm2,0x88(%rsp)
  movsd  %xmm6,0x80(%rsp)
  movsd  %xmm12,0x70(%rsp)
  movsd  %xmm14,0x50(%rsp)
  movsd  %xmm5,0x48(%rsp)
  movsd  %xmm4,0x40(%rsp)
  movsd  %xmm13,0x38(%rsp)
  call   <sqrt@plt>
  mov    D162(%rip),%rax
  movsd  0x100(%rsp),%xmm9
  movsd  0x78(%rsp),%xmm7
  movsd  0x48(%rsp),%xmm5
  movapd %xmm0,%xmm3
  movsd  0xe8(%rsp),%xmm10
  movsd  0x70(%rsp),%xmm12
  movq   %rax,%xmm8
  movsd  0x88(%rsp),%xmm2
  movsd  0x50(%rsp),%xmm14
  movsd  0x80(%rsp),%xmm6
  movsd  0x40(%rsp),%xmm4
  movsd  0x38(%rsp),%xmm13
  jmp    L82
L83:
  movapd %xmm12,%xmm0
  movsd  %xmm14,0x78(%rsp)
  movsd  %xmm9,0x100(%rsp)
  movsd  %xmm10,0xe8(%rsp)
  movsd  %xmm3,0xe0(%rsp)
  movsd  %xmm2,0x88(%rsp)
  movsd  %xmm15,0x80(%rsp)
  movsd  %xmm5,0x70(%rsp)
  movsd  %xmm7,0x50(%rsp)
  movsd  %xmm6,0x48(%rsp)
  movsd  %xmm4,0x40(%rsp)
  movsd  %xmm13,0x38(%rsp)
  call   <sqrt@plt>
  movsd  0x70(%rsp),%xmm5
  pxor   %xmm11,%xmm11
  mov    D162(%rip),%rax
  movsd  0x100(%rsp),%xmm9
  movsd  0x78(%rsp),%xmm14
  movapd %xmm0,%xmm12
  movsd  0xe8(%rsp),%xmm10
  movsd  0x50(%rsp),%xmm7
  movq   %rax,%xmm8
  movsd  0xe0(%rsp),%xmm3
  movsd  0x48(%rsp),%xmm6
  movsd  0x88(%rsp),%xmm2
  movsd  0x40(%rsp),%xmm4
  movsd  0x80(%rsp),%xmm15
  movsd  0x38(%rsp),%xmm13
  jmp    L181
L89:
  call   <__stack_chk_fail@plt>
L156:
  movsd  %xmm10,0xe8(%rsp)
  movsd  %xmm2,0x60(%rsp)
  movsd  %xmm15,0x58(%rsp)
  movsd  %xmm1,0x50(%rsp)
  movsd  %xmm7,0x48(%rsp)
  movsd  %xmm12,0x40(%rsp)
  movsd  %xmm14,0x38(%rsp)
  movsd  %xmm4,0x28(%rsp)
  movsd  %xmm13,0x18(%rsp)
  call   <sqrt@plt>
  mov    D44(%rip),%rax
  movsd  0xe8(%rsp),%xmm10
  movsd  0x60(%rsp),%xmm2
  movsd  0x58(%rsp),%xmm15
  movq   %rax,%xmm3
  mov    D162(%rip),%rax
  movsd  0x50(%rsp),%xmm1
  movsd  0x48(%rsp),%xmm7
  movsd  0x40(%rsp),%xmm12
  movsd  0x38(%rsp),%xmm14
  movsd  0x28(%rsp),%xmm4
  movq   %rax,%xmm8
  movsd  0x18(%rsp),%xmm13
  jmp    L110
```

tool_calls: name: extract_symbolic_data
arguments: data_tag: D162
type_infered: f64
name: extract_symbolic_data
arguments: data_tag: D106
type_infered: byte[8]
name: extract_symbolic_data
arguments: data_tag: D174
type_infered: byte[8]
name: extract_symbolic_data
arguments: data_tag: D112
type_infered: byte[8]
name: extract_symbolic_data
arguments: data_tag: D153
type_infered: f64
name: extract_symbolic_data
arguments: data_tag: D44
type_infered: f64
name: extract_symbolic_data
arguments: data_tag: D74
type_infered: f64

tool: D162: 1

tool: {"D106": [0x00,0x00,0x00,0x00,0x00,0x40,0x8f,0x40]}

tool: {"D174": [0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x80]}

tool: {"D112": [0x00,0x00,0x00,0x00,0x00,0x00,0xf0,0xbf]}

tool: D153: 3

tool: D44: 0.5

tool: D74: 2

assistant: ```c
void linear_GRP_solver_LAG(double *direvative, double *mid, double rho_L, double rho_R, double s_rho_L, double s_rho_R, double u_L, double u_R, double s_u_L, double s_u_R, double p_L, double p_R, double s_p_L, double s_p_R, double gamma, double eps) {
  double dist;
  int CRW[2];
  double c_L, c_R, g_L, g_R;
  double rho_star, u_star, p_star, rho_star_L, rho_star_R, c_star_L, c_star_R, g_star_L, g_star_R, beta_star;
  double a_L, b_L, d_L, a_R, b_R, d_R, L_rho, L_u, L_p, sigma;
  double zeta = (gamma - 1.0) / (gamma + 1.0);
  c_L = sqrt(gamma * p_L / rho_L);
  c_R = sqrt(gamma * p_R / rho_R);
  g_L = rho_L * c_L;
  g_R = rho_R * c_R;
  Riemann_solver_exact(&u_star, &p_star, gamma, u_L, u_R, p_L, p_R, c_L, c_R, CRW, eps, 500);
  if (p_star > p_L)
    rho_star_L = rho_L * (p_star + zeta * p_L) / (p_L + zeta * p_star);
  else
    rho_star_L = rho_L * pow(p_star / p_L, 1.0 / gamma);
  if (p_star > p_R)
    rho_star_R = rho_R * (p_star + zeta * p_R) / (p_R + zeta * p_star);
  else
    rho_star_R = rho_R * pow(p_star / p_R, 1.0 / gamma);
  mid[1] = u_star;
  mid[2] = p_star;
  mid[0] = rho_star_L;
  mid[3] = rho_star_R;
  c_star_L = sqrt(gamma * p_star / rho_star_L);
  c_star_R = sqrt(gamma * p_star / rho_star_R);
  g_star_R = rho_star_R * c_star_R;
  g_star_L = rho_star_L * c_star_L;
  beta_star = g_star_L / g_L;
  dist = sqrt((u_L - u_R) * (u_L - u_R) + (p_L - p_R) * (p_L - p_R));
  if ((dist < eps * 1000)) {
    a_L = 1.0;
    b_L = 1.0 / g_star_L;
    d_L = -1.0 / g_star_L * g_L * (g_L * s_u_L + s_p_L);
    a_R = -1.0;
    b_R = 1.0 / g_star_R;
    d_R = -1.0 / g_star_R * g_R * (g_R * s_u_R - s_p_R);
  } else {
    a_L = 1.0;
    b_L = 1.0 / g_star_L;
    d_L = (s_u_L + s_p_L / g_L) + 1.0 / g_L / (3.0 * gamma - 1.0) * (c_L * c_L * s_rho_L - s_p_L) * (pow(beta_star, (3.0 * gamma - 1.0) / 2.0 / (gamma + 1.0)) - 1.0);
    d_L = (-1.0) * sqrt(g_L * g_star_L) * d_L;
    sigma = (p_star - p_R) / (u_star - u_R);
    a_R = 2.0 - 0.5 * (p_star - p_R) / (p_star + zeta * p_R);
    b_R = -1.0 * sigma / g_star_R / g_star_R - (a_R - 1) / sigma;
    L_rho = -1.0 * (p_star - p_R) / 2.0 / rho_R;
    L_u = sigma + rho_R * (u_star - u_R) / 2.0 + g_R * g_R / sigma * (1.0 + zeta * (p_star - p_R) / 2.0 / (p_star + zeta * p_R));
    L_p = -1.0 * (2 + zeta / 2.0 * (p_star - p_R) / (p_star + zeta * p_R));
    d_R = L_u * s_u_R + L_p * s_p_R + L_rho * s_rho_R;
  }
  direvative[1] = (d_L * b_R - d_R * b_L) / (a_L * b_R - a_R * b_L);
  direvative[2] = (d_L * a_R - d_R * a_L) / (b_L * a_R - b_R * a_L);
  direvative[0] = 1.0 / c_star_L / c_star_L * direvative[2];
  direvative[3] = 1.0 / c_star_R / c_star_R * direvative[2];
}
```