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

```asm
<PPChi2>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  push   %rbx
  sub    $0xd8,%rsp
  movsd  %xmm0,-0xb8(%rbp)
  movsd  %xmm1,-0xc0(%rbp)
  movsd  %xmm2,-0xc8(%rbp)
  mov    %rdi,-0xd0(%rbp)
  mov    %fs:0x28,%rax
  mov    %rax,-0x18(%rbp)
  xor    %eax,%eax
  mov    -0xd0(%rbp),%rax
  movl   $0x1,(%rax)
  pxor   %xmm0,%xmm0
  comisd -0xb8(%rbp),%xmm0
  ja     L184
  movsd  -0xb8(%rbp),%xmm0
  movsd  D488(%rip),%xmm1
  comisd %xmm1,%xmm0
  jb     L122
L184:
  movsd  D757(%rip),%xmm0
  jmp    L17
L122:
  mov    -0xd0(%rbp),%rax
  movl   $0x2,(%rax)
  pxor   %xmm0,%xmm0
  comisd -0xc0(%rbp),%xmm0
  jb     L32
  movsd  D757(%rip),%xmm0
  jmp    L17
L32:
  mov    -0xd0(%rbp),%rax
  movl   $0x0,(%rax)
  movsd  -0xc0(%rbp),%xmm1
  movsd  D4(%rip),%xmm0
  mulsd  %xmm1,%xmm0
  movsd  %xmm0,-0x98(%rbp)
  movsd  -0x98(%rbp),%xmm0
  movsd  D488(%rip),%xmm1
  subsd  %xmm1,%xmm0
  movsd  %xmm0,-0x90(%rbp)
  mov    -0xb8(%rbp),%rax
  movq   %rax,%xmm0
  call   <log@plt>
  movsd  D326(%rip),%xmm1
  mulsd  %xmm1,%xmm0
  comisd -0xc0(%rbp),%xmm0
  jbe    L102
  movsd  D488(%rip),%xmm0
  divsd  -0x98(%rbp),%xmm0
  movsd  %xmm0,-0xd8(%rbp)
  movsd  -0xb8(%rbp),%xmm0
  movapd %xmm0,%xmm5
  mulsd  -0x98(%rbp),%xmm5
  movsd  %xmm5,-0xe0(%rbp)
  movsd  -0x98(%rbp),%xmm1
  movsd  D457(%rip),%xmm0
  mulsd  %xmm1,%xmm0
  movapd %xmm0,%xmm6
  addsd  -0xc8(%rbp),%xmm6
  movq   %xmm6,%rax
  movq   %rax,%xmm0
  call   <exp@plt>
  movapd %xmm0,%xmm7
  mulsd  -0xe0(%rbp),%xmm7
  movq   %xmm7,%rax
  movsd  -0xd8(%rbp),%xmm1
  movq   %rax,%xmm0
  call   <pow@plt>
  movq   %xmm0,%rax
  mov    %rax,-0xa0(%rbp)
  movsd  D356(%rip),%xmm0
  comisd -0xa0(%rbp),%xmm0
  jbe    L3
  movsd  -0xa0(%rbp),%xmm0
  jmp    L17
L102:
  movsd  -0xc0(%rbp),%xmm0
  comisd D364(%rip),%xmm0
  jbe    L87
  lea    -0xa8(%rbp),%rdx
  mov    -0xb8(%rbp),%rax
  mov    %rdx,%rdi
  movq   %rax,%xmm0
  mov    $0x1,%eax
  call   <PPND16@plt>
  pxor   %xmm0,%xmm0
  cvtsi2sd %eax,%xmm0
  movsd  %xmm0,-0x60(%rbp)
  movsd  D388(%rip),%xmm0
  divsd  -0xc0(%rbp),%xmm0
  movsd  %xmm0,-0x78(%rbp)
  mov    -0x78(%rbp),%rax
  movq   %rax,%xmm0
  call   <sqrt@plt>
  movq   %xmm0,%rax
  movq   %rax,%xmm1
  mulsd  -0x60(%rbp),%xmm1
  movsd  D488(%rip),%xmm0
  addsd  %xmm1,%xmm0
  subsd  -0x78(%rbp),%xmm0
  movsd  %xmm0,-0x58(%rbp)
  movsd  -0xc0(%rbp),%xmm0
  mulsd  -0x58(%rbp),%xmm0
  mulsd  -0x58(%rbp),%xmm0
  movsd  -0x58(%rbp),%xmm1
  mulsd  %xmm1,%xmm0
  movsd  %xmm0,-0xa0(%rbp)
  movsd  -0xc0(%rbp),%xmm1
  movsd  D622(%rip),%xmm0
  mulsd  %xmm0,%xmm1
  movsd  D527(%rip),%xmm0
  addsd  %xmm0,%xmm1
  movsd  -0xa0(%rbp),%xmm0
  comisd %xmm1,%xmm0
  jbe    L3
  movsd  D488(%rip),%xmm0
  subsd  -0xb8(%rbp),%xmm0
  movq   %xmm0,%rax
  movq   %rax,%xmm0
  call   <log@plt>
  movq   %xmm0,%rbx
  movsd  -0xa0(%rbp),%xmm1
  movsd  D4(%rip),%xmm0
  mulsd  %xmm0,%xmm1
  movq   %xmm1,%rax
  movq   %rax,%xmm0
  call   <log@plt>
  movq   %xmm0,%rax
  movq   %rax,%xmm1
  mulsd  -0x90(%rbp),%xmm1
  movq   %rbx,%xmm0
  subsd  %xmm1,%xmm0
  movapd %xmm0,%xmm1
  addsd  -0xc8(%rbp),%xmm1
  movsd  D385(%rip),%xmm0
  mulsd  %xmm1,%xmm0
  movsd  %xmm0,-0xa0(%rbp)
  jmp    L3
L87:
  movsd  D83(%rip),%xmm0
  movsd  %xmm0,-0xa0(%rbp)
  movsd  D488(%rip),%xmm0
  subsd  -0xb8(%rbp),%xmm0
  movq   %xmm0,%rax
  movq   %rax,%xmm0
  call   <log@plt>
  movq   %xmm0,%rax
  mov    %rax,-0x88(%rbp)
L166:
  movsd  -0xa0(%rbp),%xmm0
  movsd  %xmm0,-0x80(%rbp)
  movsd  -0xa0(%rbp),%xmm1
  movsd  D618(%rip),%xmm0
  addsd  %xmm1,%xmm0
  movapd %xmm0,%xmm1
  mulsd  -0xa0(%rbp),%xmm1
  movsd  D488(%rip),%xmm0
  addsd  %xmm1,%xmm0
  movsd  %xmm0,-0x78(%rbp)
  movsd  -0xa0(%rbp),%xmm1
  movsd  D416(%rip),%xmm0
  addsd  %xmm1,%xmm0
  movapd %xmm0,%xmm1
  mulsd  -0xa0(%rbp),%xmm1
  movsd  D247(%rip),%xmm0
  addsd  %xmm1,%xmm0
  movsd  -0xa0(%rbp),%xmm1
  mulsd  %xmm1,%xmm0
  movsd  %xmm0,-0x70(%rbp)
  movsd  -0xa0(%rbp),%xmm0
  movapd %xmm0,%xmm1
  addsd  %xmm0,%xmm1
  movsd  D618(%rip),%xmm0
  addsd  %xmm1,%xmm0
  divsd  -0x78(%rbp),%xmm0
  movsd  D4(%rip),%xmm1
  subsd  %xmm1,%xmm0
  movsd  -0xa0(%rbp),%xmm2
  movsd  D595(%rip),%xmm1
  mulsd  %xmm1,%xmm2
  movsd  D362(%rip),%xmm1
  addsd  %xmm2,%xmm1
  movapd %xmm1,%xmm2
  mulsd  -0xa0(%rbp),%xmm2
  movsd  D247(%rip),%xmm1
  addsd  %xmm2,%xmm1
  divsd  -0x70(%rbp),%xmm1
  subsd  %xmm1,%xmm0
  movsd  %xmm0,-0x68(%rbp)
  movsd  -0x88(%rbp),%xmm0
  movapd %xmm0,%xmm1
  addsd  -0xc8(%rbp),%xmm1
  movsd  -0xa0(%rbp),%xmm2
  movsd  D4(%rip),%xmm0
  mulsd  %xmm2,%xmm0
  addsd  %xmm0,%xmm1
  movsd  -0x90(%rbp),%xmm2
  movsd  D457(%rip),%xmm0
  mulsd  %xmm2,%xmm0
  addsd  %xmm0,%xmm1
  movq   %xmm1,%rax
  movq   %rax,%xmm0
  call   <exp@plt>
  movq   %xmm0,%rax
  movq   %rax,%xmm0
  mulsd  -0x70(%rbp),%xmm0
  movapd %xmm0,%xmm1
  divsd  -0x78(%rbp),%xmm1
  movsd  D488(%rip),%xmm0
  subsd  %xmm1,%xmm0
  movapd %xmm0,%xmm1
  divsd  -0x68(%rbp),%xmm1
  movsd  -0xa0(%rbp),%xmm0
  subsd  %xmm1,%xmm0
  movsd  %xmm0,-0xa0(%rbp)
  movsd  -0x80(%rbp),%xmm0
  divsd  -0xa0(%rbp),%xmm0
  movsd  D488(%rip),%xmm1
  subsd  %xmm1,%xmm0
  movq   D615(%rip),%xmm1
  andpd  %xmm1,%xmm0
  comisd D93(%rip),%xmm0
  ja     L166
L3:
  movl   $0x1,-0xa4(%rbp)
  jmp    L140
L155:
  movsd  -0xa0(%rbp),%xmm0
  movsd  %xmm0,-0x80(%rbp)
  movsd  -0xa0(%rbp),%xmm1
  movsd  D4(%rip),%xmm0
  mulsd  %xmm1,%xmm0
  movsd  %xmm0,-0x78(%rbp)
  lea    -0xa8(%rbp),%rdx
  movsd  -0x98(%rbp),%xmm0
  mov    -0x78(%rbp),%rax
  mov    %rdx,%rdi
  movapd %xmm0,%xmm1
  movq   %rax,%xmm0
  mov    $0x2,%eax
  call   <GammaD@plt>
  pxor   %xmm1,%xmm1
  cvtsi2sd %eax,%xmm1
  movsd  -0xb8(%rbp),%xmm0
  subsd  %xmm1,%xmm0
  movsd  %xmm0,-0x70(%rbp)
  mov    -0xa8(%rbp),%eax
  test   %eax,%eax
  jne    L79
  movsd  -0x98(%rbp),%xmm1
  movsd  D457(%rip),%xmm0
  mulsd  %xmm1,%xmm0
  addsd  -0xc8(%rbp),%xmm0
  addsd  -0x78(%rbp),%xmm0
  movsd  %xmm0,-0xd8(%rbp)
  mov    -0xa0(%rbp),%rax
  movq   %rax,%xmm0
  call   <log@plt>
  movq   %xmm0,%rax
  movq   %rax,%xmm6
  mulsd  -0x90(%rbp),%xmm6
  movapd %xmm6,%xmm0
  movsd  -0xd8(%rbp),%xmm4
  subsd  %xmm0,%xmm4
  movq   %xmm4,%rax
  movq   %rax,%xmm0
  call   <exp@plt>
  movsd  -0x70(%rbp),%xmm1
  mulsd  %xmm1,%xmm0
  movsd  %xmm0,-0x68(%rbp)
  movsd  -0x68(%rbp),%xmm0
  divsd  -0xa0(%rbp),%xmm0
  movsd  %xmm0,-0x50(%rbp)
  movsd  -0x68(%rbp),%xmm1
  movsd  D4(%rip),%xmm0
  mulsd  %xmm1,%xmm0
  movsd  -0x50(%rbp),%xmm1
  mulsd  -0x90(%rbp),%xmm1
  subsd  %xmm1,%xmm0
  movsd  %xmm0,-0x88(%rbp)
  movsd  -0x88(%rbp),%xmm1
  movsd  D560(%rip),%xmm0
  mulsd  %xmm0,%xmm1
  movsd  D454(%rip),%xmm0
  addsd  %xmm1,%xmm0
  movapd %xmm0,%xmm1
  mulsd  -0x88(%rbp),%xmm1
  movsd  D606(%rip),%xmm0
  addsd  %xmm1,%xmm0
  movapd %xmm0,%xmm1
  mulsd  -0x88(%rbp),%xmm1
  movsd  D358(%rip),%xmm0
  addsd  %xmm1,%xmm0
  movapd %xmm0,%xmm1
  mulsd  -0x88(%rbp),%xmm1
  movsd  D700(%rip),%xmm0
  addsd  %xmm1,%xmm0
  movapd %xmm0,%xmm1
  mulsd  -0x88(%rbp),%xmm1
  movsd  D164(%rip),%xmm0
  addsd  %xmm1,%xmm0
  movsd  D669(%rip),%xmm1
  divsd  %xmm1,%xmm0
  movsd  %xmm0,-0x48(%rbp)
  movsd  -0x88(%rbp),%xmm1
  movsd  D585(%rip),%xmm0
  mulsd  %xmm0,%xmm1
  movsd  D163(%rip),%xmm0
  addsd  %xmm1,%xmm0
  movapd %xmm0,%xmm1
  mulsd  -0x88(%rbp),%xmm1
  movsd  D538(%rip),%xmm0
  addsd  %xmm1,%xmm0
  movapd %xmm0,%xmm1
  mulsd  -0x88(%rbp),%xmm1
  movsd  D645(%rip),%xmm0
  addsd  %xmm1,%xmm0
  movapd %xmm0,%xmm1
  mulsd  -0x88(%rbp),%xmm1
  movsd  D669(%rip),%xmm0
  addsd  %xmm1,%xmm0
  movsd  D168(%rip),%xmm1
  divsd  %xmm1,%xmm0
  movsd  %xmm0,-0x40(%rbp)
  movsd  -0x88(%rbp),%xmm1
  movsd  D283(%rip),%xmm0
  mulsd  %xmm0,%xmm1
  movsd  D383(%rip),%xmm0
  addsd  %xmm1,%xmm0
  movapd %xmm0,%xmm1
  mulsd  -0x88(%rbp),%xmm1
  movsd  D28(%rip),%xmm0
  addsd  %xmm1,%xmm0
  movapd %xmm0,%xmm1
  mulsd  -0x88(%rbp),%xmm1
  movsd  D164(%rip),%xmm0
  addsd  %xmm1,%xmm0
  movsd  D168(%rip),%xmm1
  divsd  %xmm1,%xmm0
  movsd  %xmm0,-0x38(%rbp)
  movsd  -0x88(%rbp),%xmm1
  movsd  D361(%rip),%xmm0
  mulsd  %xmm0,%xmm1
  movsd  D258(%rip),%xmm0
  addsd  %xmm1,%xmm0
  movapd %xmm0,%xmm1
  mulsd  -0x88(%rbp),%xmm1
  movsd  D574(%rip),%xmm0
  addsd  %xmm0,%xmm1
  movsd  -0x88(%rbp),%xmm2
  movsd  D590(%rip),%xmm0
  mulsd  %xmm0,%xmm2
  movsd  D598(%rip),%xmm0
  addsd  %xmm2,%xmm0
  movapd %xmm0,%xmm2
  mulsd  -0x88(%rbp),%xmm2
  movsd  D44(%rip),%xmm0
  addsd  %xmm2,%xmm0
  mulsd  -0x90(%rbp),%xmm0
  addsd  %xmm1,%xmm0
  movsd  D441(%rip),%xmm1
  divsd  %xmm1,%xmm0
  movsd  %xmm0,-0x30(%rbp)
  movsd  -0x88(%rbp),%xmm1
  movsd  D169(%rip),%xmm0
  mulsd  %xmm0,%xmm1
  movsd  D606(%rip),%xmm0
  addsd  %xmm0,%xmm1
  movsd  -0x88(%rbp),%xmm2
  movsd  D322(%rip),%xmm0
  mulsd  %xmm0,%xmm2
  movsd  D263(%rip),%xmm0
  addsd  %xmm2,%xmm0
  mulsd  -0x90(%rbp),%xmm0
  addsd  %xmm1,%xmm0
  movsd  D168(%rip),%xmm1
  divsd  %xmm1,%xmm0
  movsd  %xmm0,-0x28(%rbp)
  movsd  -0x90(%rbp),%xmm1
  movsd  D386(%rip),%xmm0
  mulsd  %xmm0,%xmm1
  movsd  D300(%rip),%xmm0
  addsd  %xmm1,%xmm0
  movapd %xmm0,%xmm1
  mulsd  -0x90(%rbp),%xmm1
  movsd  D660(%rip),%xmm0
  addsd  %xmm1,%xmm0
  movsd  D441(%rip),%xmm1
  divsd  %xmm1,%xmm0
  movsd  %xmm0,-0x20(%rbp)
  movsd  -0x68(%rbp),%xmm1
  movsd  D4(%rip),%xmm0
  mulsd  %xmm1,%xmm0
  movapd %xmm0,%xmm1
  mulsd  -0x48(%rbp),%xmm1
  movsd  D488(%rip),%xmm0
  addsd  %xmm1,%xmm0
  movsd  -0x50(%rbp),%xmm1
  movapd %xmm1,%xmm2
  mulsd  -0x90(%rbp),%xmm2
  movsd  -0x50(%rbp),%xmm1
  movapd %xmm1,%xmm3
  mulsd  -0x20(%rbp),%xmm3
  movsd  -0x28(%rbp),%xmm1
  subsd  %xmm3,%xmm1
  movapd %xmm1,%xmm3
  mulsd  -0x50(%rbp),%xmm3
  movsd  -0x30(%rbp),%xmm1
  subsd  %xmm3,%xmm1
  movapd %xmm1,%xmm3
  mulsd  -0x50(%rbp),%xmm3
  movsd  -0x38(%rbp),%xmm1
  subsd  %xmm3,%xmm1
  movapd %xmm1,%xmm3
  mulsd  -0x50(%rbp),%xmm3
  movsd  -0x40(%rbp),%xmm1
  subsd  %xmm3,%xmm1
  movapd %xmm1,%xmm3
  mulsd  -0x50(%rbp),%xmm3
  movsd  -0x48(%rbp),%xmm1
  subsd  %xmm3,%xmm1
  mulsd  %xmm2,%xmm1
  subsd  %xmm1,%xmm0
  mulsd  -0x68(%rbp),%xmm0
  movsd  -0xa0(%rbp),%xmm1
  addsd  %xmm1,%xmm0
  movsd  %xmm0,-0xa0(%rbp)
  movsd  -0x80(%rbp),%xmm0
  divsd  -0xa0(%rbp),%xmm0
  movsd  D488(%rip),%xmm1
  subsd  %xmm1,%xmm0
  movq   D615(%rip),%xmm1
  andpd  %xmm1,%xmm0
  comisd D356(%rip),%xmm0
  jbe    L67
  movsd  -0xa0(%rbp),%xmm0
  jmp    L17
L79:
  mov    -0xd0(%rbp),%rax
  movl   $0x3,(%rax)
  movsd  D757(%rip),%xmm0
  jmp    L17
L67:
  addl   $0x1,-0xa4(%rbp)
L140:
  cmpl   $0x14,-0xa4(%rbp)
  jle    L155
  mov    -0xd0(%rbp),%rax
  movl   $0x4,(%rax)
  movsd  -0xa0(%rbp),%xmm0
L17:
  movq   %xmm0,%rax
  mov    -0x18(%rbp),%rdx
  sub    %fs:0x28,%rdx
  je     L170
  call   <__stack_chk_fail@plt>
L170:
  movq   %rax,%xmm0
  mov    -0x8(%rbp),%rbx
  leave
  ret
```

tool_calls: name: extract_symbolic_data
arguments: tag: D488
type_infered: f64
name: extract_symbolic_data
arguments: tag: D757
type_infered: f32[2]
name: extract_symbolic_data
arguments: tag: D4
type_infered: f64
name: extract_symbolic_data
arguments: tag: D326
type_infered: byte[8]
name: extract_symbolic_data
arguments: tag: D457
type_infered: f64
name: extract_symbolic_data
arguments: tag: D356
type_infered: byte[16]
name: extract_symbolic_data
arguments: tag: D364
type_infered: f64[2]
name: extract_symbolic_data
arguments: tag: D388
type_infered: f64
name: extract_symbolic_data
arguments: tag: D622
type_infered: f64
name: extract_symbolic_data
arguments: tag: D527
type_infered: f64
name: extract_symbolic_data
arguments: tag: D385
type_infered: f32[2]
name: extract_symbolic_data
arguments: tag: D83
type_infered: f64
name: extract_symbolic_data
arguments: tag: D618
type_infered: f64
name: extract_symbolic_data
arguments: tag: D416
type_infered: f64
name: extract_symbolic_data
arguments: tag: D247
type_infered: f64
name: extract_symbolic_data
arguments: tag: D595
type_infered: f64
name: extract_symbolic_data
arguments: tag: D362
type_infered: f64
name: extract_symbolic_data
arguments: tag: D615
type_infered: qword
name: extract_symbolic_data
arguments: tag: D93
type_infered: f64[2]
name: extract_symbolic_data
arguments: tag: D560
type_infered: f64
name: extract_symbolic_data
arguments: tag: D454
type_infered: f64
name: extract_symbolic_data
arguments: tag: D606
type_infered: f64
name: extract_symbolic_data
arguments: tag: D358
type_infered: f64
name: extract_symbolic_data
arguments: tag: D700
type_infered: f64
name: extract_symbolic_data
arguments: tag: D164
type_infered: f64
name: extract_symbolic_data
arguments: tag: D669
type_infered: f64
name: extract_symbolic_data
arguments: tag: D585
type_infered: f64
name: extract_symbolic_data
arguments: tag: D163
type_infered: f64
name: extract_symbolic_data
arguments: tag: D538
type_infered: f64
name: extract_symbolic_data
arguments: tag: D645
type_infered: f64
name: extract_symbolic_data
arguments: tag: D168
type_infered: f64
name: extract_symbolic_data
arguments: tag: D283
type_infered: f64
name: extract_symbolic_data
arguments: tag: D383
type_infered: f64
name: extract_symbolic_data
arguments: tag: D28
type_infered: f64
name: extract_symbolic_data
arguments: tag: D361
type_infered: f64
name: extract_symbolic_data
arguments: tag: D258
type_infered: f64
name: extract_symbolic_data
arguments: tag: D574
type_infered: f64
name: extract_symbolic_data
arguments: tag: D590
type_infered: f64
name: extract_symbolic_data
arguments: tag: D598
type_infered: f64
name: extract_symbolic_data
arguments: tag: D44
type_infered: f64
name: extract_symbolic_data
arguments: tag: D441
type_infered: f64
name: extract_symbolic_data
arguments: tag: D169
type_infered: f64
name: extract_symbolic_data
arguments: tag: D322
type_infered: f64
name: extract_symbolic_data
arguments: tag: D263
type_infered: f64
name: extract_symbolic_data
arguments: tag: D386
type_infered: f64
name: extract_symbolic_data
arguments: tag: D300
type_infered: f64
name: extract_symbolic_data
arguments: tag: D660
type_infered: f64

tool: D488: 1

tool: {"D757": [0.0,-1.875]}

tool: D4: 0.5

tool: {"D326": [0xd7,0xa3,0x70,0x3d,0x0a,0xd7,0xf3,0xbf]}

tool: D457: 0.6931471806

tool: {"D356": [0x8d,0xed,0xb5,0xa0,0xf7,0xc6,0xa0,0x3e,0x7b,0x14,0xae,0x47,0xe1,0x7a,0xd4,0x3f]}

tool: {"D364": [0.32,0.222222]}

tool: D388: 0.222222

tool: D622: 2.2

tool: D527: 6

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

tool: D83: 0.4

tool: D618: 4.67

tool: D416: 6.66

tool: D247: 6.73

tool: D595: 3

tool: D362: 13.32

tool: D615: 9223372036854775807

tool: {"D93": [0.01,60.0]}

tool: D560: 60

tool: D454: 70

tool: D606: 84

tool: D358: 105

tool: D700: 140

tool: D164: 210

tool: D669: 420

tool: D585: 1278

tool: D163: 1141

tool: D538: 966

tool: D645: 735

tool: D168: 2520

tool: D283: 932

tool: D383: 707

tool: D28: 462

tool: D361: 1182

tool: D258: 672

tool: D574: 252

tool: D590: 1740

tool: D598: 889

tool: D44: 294

tool: D441: 5040

tool: D169: 2264

tool: D322: 606

tool: D263: 1175

tool: D386: 127

tool: D300: 346

tool: D660: 120

assistant: ```c
double PPChi2(p, v, g, ifault)
double p, v, g;
int *ifault;
{
  int i, if1;
  double a, b, c, q, t, x, p1, p2, s1, s2, s3, s4, s5, s6, ch, xx, tmp;
  *ifault = 1;
  if ((p < 0.0) || (p >= 1.0))
    return -1.0;
  *ifault = 2;
  if (v <= 0.0)
    return -1.0;
  *ifault = 0;
  xx = 0.5 * v;
  c = xx - 1.0;
  if (v < -1.24 * log(p)) {
    ch = pow(p * xx * (exp(g + xx * 0.6931471806)), 1.0 / xx);
    if (ch < 5e-7)
      return ch;
  } else {
    if (v > 0.32) {
      x = PPND16(p, &if1);
      p1 = 0.222222 / v;
      tmp = x * sqrt(p1) + 1.0 - p1;
      ch = v * tmp * tmp * tmp;
      if (ch > 2.2 * v + 6.0)
        ch = -2.0 * (log(1.0 - p) - c * log(0.5 * ch) + g);
    } else {
      ch = 0.4;
      a = log(1.0 - p);
      do {
        q = ch;
        p1 = 1.0 + ch * (4.67 + ch);
        p2 = ch * (6.73 + ch * (6.66 + ch));
        t = -0.5 + (4.67 + 2.0 * ch) / p1 - (6.73 + ch * (13.32 + 3.0 * ch)) / p2;
        ch -= (1.0 - (exp(a + g + 0.5 * ch + c * 0.6931471806)) * p2 / p1) / t;
      } while (fabs(q / ch - 1.0) > 0.01);
    }
  }
  for (i = 1; i <= 20; ++i) {
    q = ch;
    p1 = 0.5 * ch;
    p2 = p - GammaD(p1, xx, &if1);
    if (if1 == 0) {
      t = p2 * (exp(xx * 0.6931471806 + g + p1 - c * log(ch)));
      b = t / ch;
      a = 0.5 * t - b * c;
      s1 = (210.0 + a * (140.0 + a * (105.0 + a * (84.0 + a * (70.0 + 60.0 * a))))) / 420.0;
      s2 = (420.0 + a * (735.0 + a * (966.0 + a * (1141.0 + 1278.0 * a)))) / 2520.0;
      s3 = (210.0 + a * (462.0 + a * (707.0 + 932.0 * a))) / 2520.0;
      s4 = (252.0 + a * (672.0 + 1182.0 * a) + c * (294.0 + a * (889.0 + 1740.0 * a))) / 5040.0;
      s5 = (84.0 + 2264.0 * a + c * (1175.0 + 606.0 * a)) / 2520.0;
      s6 = (120.0 + c * (346.0 + 127.0 * c)) / 5040.0;
      ch += t * (1.0 + 0.5 * t * s1 - b * c * (s1 - b * (s2 - b * (s3 - b * (s4 - b * (s5 - b * s6))))));
      if (fabs(q / ch - 1.0) > 5e-7)
        return ch;
    } else {
      *ifault = 3;
      return -1.0;
    }
  }
  *ifault = 4;
  return ch;
}
```