user: 提供的汇编代码用C语言表示会是什么样子:

```asm
<Riemann_solver_exact>:
  endbr64
  push   %r15
  push   %r14
  push   %r13
  mov    %rsi,%r13
  push   %r12
  mov    %rdi,%r12
  push   %rbp
  mov    %ecx,%ebp
  push   %rbx
  mov    %rdx,%rbx
  sub    $0x98,%rsp
  comisd %xmm3,%xmm4
  movsd  %xmm1,0x48(%rsp)
  movsd  D185(%rip),%xmm1
  movsd  %xmm5,0x38(%rsp)
  movapd %xmm0,%xmm5
  addsd  %xmm5,%xmm1
  movsd  %xmm0,0x30(%rsp)
  movsd  %xmm6,0x40(%rsp)
  movapd %xmm0,%xmm6
  addsd  %xmm0,%xmm0
  subsd  D185(%rip),%xmm6
  movsd  %xmm2,0x50(%rsp)
  movapd %xmm1,%xmm2
  movsd  %xmm7,0x60(%rsp)
  divsd  %xmm0,%xmm2
  movsd  %xmm6,0x58(%rsp)
  divsd  %xmm0,%xmm6
  movsd  %xmm2,0x10(%rsp)
  movq   %xmm6,%r15
  jbe    L17
  movapd %xmm4,%xmm1
  subsd  %xmm3,%xmm1
  mulsd  %xmm1,%xmm2
  movapd %xmm2,%xmm0
  pxor   %xmm2,%xmm2
  divsd  %xmm3,%xmm0
  movq   %xmm2,%r14
  addsd  D185(%rip),%xmm0
  ucomisd %xmm0,%xmm2
  ja     L161
  sqrtsd %xmm0,%xmm0
L70:
  mulsd  0x38(%rsp),%xmm1
  comisd %xmm4,%xmm3
  movsd  0x48(%rsp),%xmm2
  divsd  0x30(%rsp),%xmm1
  divsd  %xmm3,%xmm1
  divsd  %xmm0,%xmm1
  subsd  %xmm1,%xmm2
  ja     L234
L74:
  movapd %xmm3,%xmm0
  movq   %r15,%xmm1
  movsd  %xmm4,(%rsp)
  divsd  %xmm4,%xmm0
  movsd  %xmm2,0x18(%rsp)
  movsd  %xmm3,0x8(%rsp)
  call   <pow@plt>
  movsd  0x40(%rsp),%xmm3
  movsd  0x18(%rsp),%xmm2
  subsd  D185(%rip),%xmm0
  movsd  (%rsp),%xmm4
  movapd %xmm3,%xmm1
  addsd  %xmm3,%xmm1
  movsd  0x8(%rsp),%xmm3
  mulsd  %xmm1,%xmm0
  divsd  0x58(%rsp),%xmm0
  addsd  0x50(%rsp),%xmm0
L195:
  movsd  0x48(%rsp),%xmm7
  movsd  0x60(%rsp),%xmm5
  xor    %eax,%eax
  movsd  0x50(%rsp),%xmm8
  movapd %xmm7,%xmm1
  subsd  %xmm5,%xmm1
  comisd %xmm1,%xmm0
  movapd %xmm8,%xmm1
  addsd  %xmm5,%xmm1
  seta   %al
  movd   %eax,%xmm0
  xor    %eax,%eax
  comisd %xmm1,%xmm2
  movsd  0x30(%rsp),%xmm2
  setbe  %al
  movd   %eax,%xmm6
  punpckldq %xmm6,%xmm0
  movq   %xmm0,(%rbx)
  movsd  0x38(%rsp),%xmm0
  xorpd  D163(%rip),%xmm0
  divsd  %xmm3,%xmm0
  movapd %xmm0,%xmm6
  movsd  0x40(%rsp),%xmm0
  divsd  %xmm2,%xmm6
  divsd  %xmm4,%xmm0
  movapd %xmm6,%xmm5
  movsd  %xmm6,0x28(%rsp)
  mulsd  %xmm3,%xmm5
  divsd  %xmm2,%xmm0
  movapd %xmm5,%xmm2
  subsd  %xmm0,%xmm6
  mulsd  %xmm4,%xmm0
  movsd  %xmm6,0x68(%rsp)
  subsd  %xmm0,%xmm2
  subsd  %xmm7,%xmm2
  movq   %r14,%xmm7
  addsd  %xmm8,%xmm2
  divsd  %xmm6,%xmm2
  comisd %xmm2,%xmm7
  jbe    L180
  movapd %xmm3,%xmm2
  minsd  %xmm4,%xmm2
L180:
  mulsd  D18(%rip),%xmm2
  comisd %xmm3,%xmm2
  jbe    L26
  movapd %xmm2,%xmm1
  movsd  0x10(%rsp),%xmm0
  movq   %r14,%xmm5
  subsd  %xmm3,%xmm1
  mulsd  %xmm1,%xmm0
  divsd  %xmm3,%xmm0
  addsd  D185(%rip),%xmm0
  ucomisd %xmm0,%xmm5
  ja     L314
  sqrtsd %xmm0,%xmm0
L101:
  mulsd  0x38(%rsp),%xmm1
  movsd  0x48(%rsp),%xmm6
  comisd %xmm4,%xmm2
  divsd  0x30(%rsp),%xmm1
  divsd  %xmm3,%xmm1
  divsd  %xmm0,%xmm1
  subsd  %xmm1,%xmm6
  movsd  %xmm6,0x18(%rsp)
  ja     L245
L251:
  movapd %xmm2,%xmm5
  movq   %r15,%xmm1
  movsd  %xmm3,0x78(%rsp)
  divsd  %xmm4,%xmm5
  movsd  %xmm2,0x70(%rsp)
  movsd  %xmm4,0x8(%rsp)
  movapd %xmm5,%xmm0
  movsd  %xmm5,(%rsp)
  call   <pow@plt>
  movsd  (%rsp),%xmm5
  movq   %r15,%xmm1
  movapd %xmm5,%xmm0
  call   <pow@plt>
  movsd  0x40(%rsp),%xmm3
  subsd  D185(%rip),%xmm0
  movsd  0x70(%rsp),%xmm2
  movsd  0x8(%rsp),%xmm4
  movapd %xmm3,%xmm1
  addsd  %xmm3,%xmm1
  movsd  0x78(%rsp),%xmm3
  mulsd  %xmm0,%xmm1
  divsd  0x58(%rsp),%xmm1
  addsd  0x50(%rsp),%xmm1
  movsd  %xmm1,0x20(%rsp)
L295:
  movsd  0x18(%rsp),%xmm0
  subsd  0x20(%rsp),%xmm0
  andpd  D43(%rip),%xmm0
  test   %ebp,%ebp
  je     L106
  comisd 0x60(%rsp),%xmm0
  jbe    L106
  movsd  0x30(%rsp),%xmm5
  movsd  0x38(%rsp),%xmm7
  xor    %ebx,%ebx
  movsd  %xmm3,(%rsp)
  movsd  0x40(%rsp),%xmm6
  movsd  %xmm4,0x8(%rsp)
  divsd  %xmm5,%xmm7
  divsd  %xmm5,%xmm6
  movsd  %xmm7,0x70(%rsp)
  movsd  %xmm6,0x78(%rsp)
  jmp    L394
  nopw   0x0(%rax,%rax,1)
L21:
  movapd %xmm2,%xmm4
  movsd  0x10(%rsp),%xmm0
  movq   %r14,%xmm6
  subsd  %xmm7,%xmm4
  mulsd  %xmm4,%xmm0
  divsd  %xmm7,%xmm0
  addsd  D185(%rip),%xmm0
  ucomisd %xmm0,%xmm6
  ja     L119
  sqrtsd %xmm0,%xmm0
L204:
  movsd  D185(%rip),%xmm3
  mov    D95(%rip),%rax
  movsd  %xmm2,0x80(%rsp)
  movsd  %xmm4,0x68(%rsp)
  divsd  %xmm0,%xmm3
  movq   %rax,%xmm1
  movapd %xmm3,%xmm0
  movsd  %xmm3,0x28(%rsp)
  call   <pow@plt>
  movsd  (%rsp),%xmm6
  movsd  0x70(%rsp),%xmm1
  movapd %xmm0,%xmm5
  movsd  0x68(%rsp),%xmm4
  movsd  D18(%rip),%xmm0
  divsd  %xmm6,%xmm1
  movsd  0x28(%rsp),%xmm3
  movsd  0x80(%rsp),%xmm2
  mulsd  %xmm1,%xmm0
  mulsd  0x10(%rsp),%xmm0
  mulsd  %xmm1,%xmm3
  divsd  %xmm6,%xmm0
  mulsd  %xmm4,%xmm0
  mulsd  %xmm5,%xmm0
  movsd  0x8(%rsp),%xmm5
  comisd %xmm5,%xmm2
  subsd  %xmm3,%xmm0
  movsd  %xmm0,0x28(%rsp)
  jbe    L143
L376:
  movapd %xmm2,%xmm3
  movsd  0x10(%rsp),%xmm0
  subsd  %xmm5,%xmm3
  mulsd  %xmm3,%xmm0
  divsd  %xmm5,%xmm0
  movq   %r14,%xmm5
  addsd  D185(%rip),%xmm0
  ucomisd %xmm0,%xmm5
  ja     L76
  sqrtsd %xmm0,%xmm0
L205:
  movsd  D185(%rip),%xmm5
  mov    D95(%rip),%rax
  movsd  %xmm2,0x88(%rsp)
  movsd  %xmm3,0x80(%rsp)
  divsd  %xmm0,%xmm5
  movq   %rax,%xmm1
  movapd %xmm5,%xmm0
  movsd  %xmm5,0x68(%rsp)
  call   <pow@plt>
  movsd  0x8(%rsp),%xmm7
  movsd  0x68(%rsp),%xmm5
  movsd  0x80(%rsp),%xmm3
  movapd %xmm0,%xmm4
  movsd  0x78(%rsp),%xmm0
  movsd  0x88(%rsp),%xmm2
  divsd  %xmm7,%xmm0
  mulsd  %xmm0,%xmm5
  mulsd  D18(%rip),%xmm0
  mulsd  0x10(%rsp),%xmm0
  movapd %xmm5,%xmm1
  divsd  %xmm7,%xmm0
  mulsd  %xmm3,%xmm0
  mulsd  %xmm4,%xmm0
  subsd  %xmm0,%xmm1
L256:
  movsd  0x28(%rsp),%xmm6
  movsd  0x20(%rsp),%xmm0
  subsd  0x18(%rsp),%xmm0
  subsd  %xmm1,%xmm6
  divsd  %xmm6,%xmm0
  movsd  %xmm6,0x68(%rsp)
  movq   %r14,%xmm6
  addsd  %xmm2,%xmm0
  comisd %xmm0,%xmm6
  ja     L267
  movapd %xmm0,%xmm2
L193:
  movsd  (%rsp),%xmm4
  add    $0x1,%ebx
  comisd %xmm4,%xmm2
  jbe    L392
  movapd %xmm2,%xmm1
  movsd  0x10(%rsp),%xmm0
  movq   %r14,%xmm7
  subsd  %xmm4,%xmm1
  mulsd  %xmm1,%xmm0
  divsd  %xmm4,%xmm0
  addsd  D185(%rip),%xmm0
  ucomisd %xmm0,%xmm7
  ja     L120
  sqrtsd %xmm0,%xmm0
L370:
  mulsd  0x38(%rsp),%xmm1
  movsd  0x48(%rsp),%xmm6
  divsd  0x30(%rsp),%xmm1
  divsd  (%rsp),%xmm1
  divsd  %xmm0,%xmm1
  subsd  %xmm1,%xmm6
  movsd  %xmm6,0x18(%rsp)
L340:
  movsd  0x8(%rsp),%xmm3
  comisd %xmm3,%xmm2
  jbe    L112
  movapd %xmm2,%xmm1
  movsd  0x10(%rsp),%xmm0
  movq   %r14,%xmm7
  subsd  %xmm3,%xmm1
  mulsd  %xmm1,%xmm0
  divsd  %xmm3,%xmm0
  addsd  D185(%rip),%xmm0
  ucomisd %xmm0,%xmm7
  ja     L285
  sqrtsd %xmm0,%xmm0
L342:
  mulsd  0x40(%rsp),%xmm1
  divsd  0x30(%rsp),%xmm1
  divsd  0x8(%rsp),%xmm1
  divsd  %xmm0,%xmm1
  addsd  0x50(%rsp),%xmm1
  movsd  %xmm1,0x20(%rsp)
L192:
  movsd  0x18(%rsp),%xmm0
  subsd  0x20(%rsp),%xmm0
  andpd  D43(%rip),%xmm0
  cmp    %ebx,%ebp
  je     L106
  comisd 0x60(%rsp),%xmm0
  jbe    L106
L394:
  movsd  (%rsp),%xmm7
  comisd %xmm7,%xmm2
  ja     L21
  movsd  0x10(%rsp),%xmm1
  movapd %xmm2,%xmm0
  movsd  %xmm2,0x68(%rsp)
  divsd  (%rsp),%xmm0
  call   <pow@plt>
  movsd  0x68(%rsp),%xmm2
  movsd  0x8(%rsp),%xmm5
  movapd %xmm0,%xmm1
  movsd  D185(%rip),%xmm0
  comisd %xmm5,%xmm2
  divsd  %xmm1,%xmm0
  movsd  0x70(%rsp),%xmm1
  divsd  (%rsp),%xmm1
  xorpd  D163(%rip),%xmm0
  mulsd  %xmm1,%xmm0
  movsd  %xmm0,0x28(%rsp)
  ja     L376
L143:
  movsd  0x10(%rsp),%xmm1
  movapd %xmm2,%xmm0
  movsd  %xmm2,0x68(%rsp)
  divsd  0x8(%rsp),%xmm0
  call   <pow@plt>
  movsd  0x68(%rsp),%xmm2
  movapd %xmm0,%xmm1
  movsd  D185(%rip),%xmm0
  divsd  %xmm1,%xmm0
  movsd  0x78(%rsp),%xmm1
  divsd  0x8(%rsp),%xmm1
  mulsd  %xmm0,%xmm1
  jmp    L256
  nopl   0x0(%rax,%rax,1)
L17:
  movapd %xmm4,%xmm0
  movapd %xmm6,%xmm1
  movsd  %xmm4,0x8(%rsp)
  divsd  %xmm3,%xmm0
  movsd  %xmm3,(%rsp)
  call   <pow@plt>
  movsd  0x38(%rsp),%xmm4
  movsd  (%rsp),%xmm3
  movapd %xmm0,%xmm1
  subsd  D185(%rip),%xmm1
  movsd  0x48(%rsp),%xmm2
  movapd %xmm4,%xmm0
  addsd  %xmm4,%xmm0
  pxor   %xmm4,%xmm4
  movq   %xmm4,%r14
  movsd  0x8(%rsp),%xmm4
  mulsd  %xmm1,%xmm0
  comisd %xmm4,%xmm3
  divsd  0x58(%rsp),%xmm0
  subsd  %xmm0,%xmm2
  jbe    L74
L234:
  movapd %xmm3,%xmm1
  movsd  0x10(%rsp),%xmm0
  movq   %r14,%xmm6
  subsd  %xmm4,%xmm1
  mulsd  %xmm1,%xmm0
  divsd  %xmm4,%xmm0
  addsd  D185(%rip),%xmm0
  ucomisd %xmm0,%xmm6
  ja     L69
  movapd %xmm0,%xmm5
  sqrtsd %xmm5,%xmm5
L20:
  mulsd  0x40(%rsp),%xmm1
  movapd %xmm1,%xmm0
  divsd  0x30(%rsp),%xmm0
  divsd  %xmm4,%xmm0
  divsd  %xmm5,%xmm0
  addsd  0x50(%rsp),%xmm0
  jmp    L195
  nopl   0x0(%rax,%rax,1)
L26:
  movapd %xmm2,%xmm0
  movq   %r15,%xmm1
  movsd  %xmm3,(%rsp)
  divsd  %xmm3,%xmm0
  movsd  %xmm4,0x20(%rsp)
  movsd  %xmm2,0x8(%rsp)
  call   <pow@plt>
  movsd  0x38(%rsp),%xmm4
  movsd  0x8(%rsp),%xmm2
  movapd %xmm0,%xmm1
  subsd  D185(%rip),%xmm1
  movsd  (%rsp),%xmm3
  movapd %xmm4,%xmm0
  addsd  %xmm4,%xmm0
  movsd  0x48(%rsp),%xmm4
  mulsd  %xmm1,%xmm0
  divsd  0x58(%rsp),%xmm0
  subsd  %xmm0,%xmm4
  movsd  %xmm4,0x18(%rsp)
  movsd  0x20(%rsp),%xmm4
  comisd %xmm4,%xmm2
  jbe    L251
L245:
  movapd %xmm2,%xmm1
  movsd  0x10(%rsp),%xmm0
  movq   %r14,%xmm5
  subsd  %xmm4,%xmm1
  mulsd  %xmm1,%xmm0
  divsd  %xmm4,%xmm0
  addsd  D185(%rip),%xmm0
  ucomisd %xmm0,%xmm5
  ja     L352
  sqrtsd %xmm0,%xmm0
L316:
  mulsd  0x40(%rsp),%xmm1
  divsd  0x30(%rsp),%xmm1
  divsd  %xmm4,%xmm1
  divsd  %xmm0,%xmm1
  addsd  0x50(%rsp),%xmm1
  movsd  %xmm1,0x20(%rsp)
  jmp    L295
  nopl   0x0(%rax,%rax,1)
L112:
  movq   %r15,%xmm1
  movapd %xmm2,%xmm0
  movsd  %xmm2,0x80(%rsp)
  divsd  0x8(%rsp),%xmm0
  call   <pow@plt>
  movsd  0x40(%rsp),%xmm5
  subsd  D185(%rip),%xmm0
  movsd  0x80(%rsp),%xmm2
  movapd %xmm5,%xmm1
  addsd  %xmm5,%xmm1
  mulsd  %xmm1,%xmm0
  divsd  0x58(%rsp),%xmm0
  addsd  0x50(%rsp),%xmm0
  movsd  %xmm0,0x20(%rsp)
  jmp    L192
  nopw   0x0(%rax,%rax,1)
L392:
  movq   %r15,%xmm1
  movapd %xmm2,%xmm0
  movsd  %xmm2,0x20(%rsp)
  divsd  (%rsp),%xmm0
  call   <pow@plt>
  movsd  0x38(%rsp),%xmm6
  subsd  D185(%rip),%xmm0
  movsd  0x48(%rsp),%xmm4
  movsd  0x20(%rsp),%xmm2
  movapd %xmm6,%xmm1
  addsd  %xmm6,%xmm1
  mulsd  %xmm1,%xmm0
  divsd  0x58(%rsp),%xmm0
  subsd  %xmm0,%xmm4
  movsd  %xmm4,0x18(%rsp)
  jmp    L340
  nopl   0x0(%rax)
L267:
  mulsd  D18(%rip),%xmm2
  jmp    L193
  nopl   (%rax)
L106:
  movsd  0x18(%rsp),%xmm4
  movsd  0x20(%rsp),%xmm1
  movsd  %xmm2,0x0(%r13)
  subsd  %xmm4,%xmm1
  mulsd  0x28(%rsp),%xmm1
  divsd  0x68(%rsp),%xmm1
  addsd  %xmm4,%xmm1
  movsd  %xmm1,(%r12)
  add    $0x98,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
L285:
  movsd  %xmm2,0x80(%rsp)
  movsd  %xmm1,0x20(%rsp)
  call   <sqrt@plt>
  movsd  0x20(%rsp),%xmm1
  movsd  0x80(%rsp),%xmm2
  jmp    L342
L120:
  movsd  %xmm2,0x20(%rsp)
  movsd  %xmm1,0x18(%rsp)
  call   <sqrt@plt>
  movsd  0x20(%rsp),%xmm2
  movsd  0x18(%rsp),%xmm1
  jmp    L370
L76:
  movsd  %xmm2,0x80(%rsp)
  movsd  %xmm3,0x68(%rsp)
  call   <sqrt@plt>
  movsd  0x68(%rsp),%xmm3
  movsd  0x80(%rsp),%xmm2
  jmp    L205
L119:
  movsd  %xmm2,0x68(%rsp)
  movsd  %xmm4,0x28(%rsp)
  call   <sqrt@plt>
  movsd  0x68(%rsp),%xmm2
  movsd  0x28(%rsp),%xmm4
  jmp    L204
L161:
  movsd  %xmm4,0x18(%rsp)
  movsd  %xmm3,0x8(%rsp)
  movsd  %xmm1,(%rsp)
  call   <sqrt@plt>
  movsd  0x18(%rsp),%xmm4
  movsd  0x8(%rsp),%xmm3
  movsd  (%rsp),%xmm1
  jmp    L70
L352:
  movsd  %xmm4,0x70(%rsp)
  movsd  %xmm3,0x20(%rsp)
  movsd  %xmm1,0x8(%rsp)
  movsd  %xmm2,(%rsp)
  call   <sqrt@plt>
  movsd  0x70(%rsp),%xmm4
  movsd  0x20(%rsp),%xmm3
  movsd  0x8(%rsp),%xmm1
  movsd  (%rsp),%xmm2
  jmp    L316
L314:
  movsd  %xmm4,0x20(%rsp)
  movsd  %xmm3,0x18(%rsp)
  movsd  %xmm1,0x8(%rsp)
  movsd  %xmm2,(%rsp)
  call   <sqrt@plt>
  movsd  0x20(%rsp),%xmm4
  movsd  0x18(%rsp),%xmm3
  movsd  0x8(%rsp),%xmm1
  movsd  (%rsp),%xmm2
  jmp    L101
L69:
  movsd  %xmm4,0x20(%rsp)
  movsd  %xmm3,0x18(%rsp)
  movsd  %xmm1,0x8(%rsp)
  movsd  %xmm2,(%rsp)
  call   <sqrt@plt>
  movsd  0x20(%rsp),%xmm4
  movsd  0x18(%rsp),%xmm3
  movsd  0x8(%rsp),%xmm1
  movsd  (%rsp),%xmm2
  movapd %xmm0,%xmm5
  jmp    L20
```

tool_calls: name: read_data
arguments: data_tag: D185
type_guessed: f64
name: read_data
arguments: data_tag: D163
type_guessed: f32[4]
name: read_data
arguments: data_tag: D18
type_guessed: f64
name: read_data
arguments: data_tag: D43
type_guessed: qword[2]
name: read_data
arguments: data_tag: D95
type_guessed: f64

tool: D185: 1

tool: {"D163": [0.0,-0.0,0.0,0.0]}

tool: D18: 0.5

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

tool: D95: 3

assistant: ```c
double Riemann_solver_exact(double *U_star, double *P_star, double gamma, double u_L, double u_R, double p_L, double p_R, double c_L, double c_R, int *CRW, double tol, int N) {
  double mu, nu, sigma;
  double delta_p, u_LR, u_RL;
  double k1, k3, p_INT, p_INT0, u_INT;
  double rho_star_l, rho_star_r;
  double v_L, v_R, gap;
  double temp1, temp2, temp3;
  double dbg = 2;
  int n = 0;
  mu = (gamma - 1.0) / (2.0 * gamma);
  nu = (gamma + 1.0) / (2.0 * gamma);
  sigma = (gamma - 1.0) / (gamma + 1.0);
  if (p_R > p_L) {
    delta_p = p_R - p_L;
    u_LR = sqrt(1.0 + nu * delta_p / p_L);
    u_LR = delta_p * c_L / gamma / p_L / u_LR;
    u_LR = u_L - u_LR;
  } else {
    u_LR = pow(p_R / p_L, mu) - 1.0;
    u_LR = 2.0 * c_L * u_LR / (gamma - 1.0);
    u_LR = u_L - u_LR;
  }
  if (p_L > p_R) {
    delta_p = p_L - p_R;
    u_RL = sqrt(1.0 + nu * delta_p / p_R);
    u_RL = delta_p * c_R / gamma / p_R / u_RL;
    u_RL = u_R + u_RL;
  } else {
    u_RL = pow(p_L / p_R, mu) - 1.0;
    u_RL = 2.0 * c_R * u_RL / (gamma - 1.0);
    u_RL = u_R + u_RL;
  }
  if (u_LR > u_R + tol)
    CRW[1] = 0;
  else
    CRW[1] = 1;
  if (u_RL > u_L - tol)
    CRW[0] = 1;
  else
    CRW[0] = 0;
  k1 = -c_L / p_L / gamma;
  k3 = c_R / p_R / gamma;
  p_INT = (k1 * p_L - k3 * p_R - u_L + u_R) / (k1 - k3);
  if (p_INT < 0)
    p_INT = (p_L < p_R) ? p_L : p_R;
  p_INT = 0.5 * p_INT;
  if (p_INT > p_L) {
    delta_p = p_INT - p_L;
    v_L = sqrt(1.0 + nu * delta_p / p_L);
    v_L = delta_p * c_L / gamma / p_L / v_L;
    v_L = u_L - v_L;
  } else {
    v_L = pow(p_INT / p_L, mu) - 1.0;
    v_L = 2.0 * c_L * v_L / (gamma - 1.0);
    v_L = u_L - v_L;
  }
  if (p_INT > p_R) {
    delta_p = p_INT - p_R;
    v_R = sqrt(1.0 + nu * delta_p / p_R);
    v_R = delta_p * c_R / gamma / p_R / v_R;
    v_R = u_R + v_R;
  } else {
    dbg = pow(p_INT / p_R, mu);
    v_R = pow(p_INT / p_R, mu) - 1.0;
    v_R = 2.0 * c_R * v_R / (gamma - 1.0);
    v_R = u_R + v_R;
  }
  gap = fabs(v_L - v_R);
  while ((gap > tol) && (n != N)) {
    if (p_INT > p_L) {
      delta_p = p_INT - p_L;
      temp1 = 1.0 / sqrt(1.0 + nu * delta_p / p_L);
      temp2 = c_L / gamma / p_L;
      temp3 = 0.5 * temp2 * nu / p_L;
      k1 = temp3 * delta_p * pow(temp1, 3.0) - temp2 * temp1;
    } else {
      temp2 = c_L / gamma / p_L;
      temp1 = 1.0 / pow(p_INT / p_L, nu);
      k1 = -temp1 * temp2;
    }
    if (p_INT > p_R) {
      delta_p = p_INT - p_R;
      temp1 = 1.0 / sqrt(1.0 + nu * delta_p / p_R);
      temp2 = c_R / gamma / p_R;
      temp3 = 0.5 * temp2 * nu / p_R;
      k3 = temp2 * temp1 - temp3 * delta_p * pow(temp1, 3.0);
    } else {
      temp2 = c_R / gamma / p_R;
      temp1 = 1.0 / pow(p_INT / p_R, nu);
      k3 = temp1 * temp2;
    }
    p_INT0 = p_INT + (v_R - v_L) / (k1 - k3);
    if (p_INT0 < 0.0)
      p_INT = 0.5 * p_INT;
    else
      p_INT = p_INT0;
    ++n;
    if (p_INT > p_L) {
      delta_p = p_INT - p_L;
      v_L = sqrt(1.0 + nu * delta_p / p_L);
      v_L = delta_p * c_L / gamma / p_L / v_L;
      v_L = u_L - v_L;
    } else {
      v_L = pow(p_INT / p_L, mu) - 1.0;
      v_L = 2.0 * c_L * v_L / (gamma - 1.0);
      v_L = u_L - v_L;
    }
    if (p_INT > p_R) {
      delta_p = p_INT - p_R;
      v_R = sqrt(1.0 + nu * delta_p / p_R);
      v_R = delta_p * c_R / gamma / p_R / v_R;
      v_R = u_R + v_R;
    } else {
      v_R = pow(p_INT / p_R, mu) - 1.0;
      v_R = 2.0 * c_R * v_R / (gamma - 1.0);
      v_R = u_R + v_R;
    }
    gap = fabs(v_L - v_R);
  }
  u_INT = k1 * (v_R - v_L) / (k1 - k3) + v_L;
  *P_star = p_INT;
  *U_star = u_INT;
  return gap;
}
```