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

```asm
<QuantileChi2>:
  endbr64
  movapd %xmm0,%xmm7
  movsd  D462(%rip),%xmm0
  comisd %xmm7,%xmm0
  ja     L1
  push   %rbx
  sub    $0x60,%rsp
  comisd D453(%rip),%xmm7
  movsd  D131(%rip),%xmm0
  movsd  %xmm7,0x40(%rsp)
  ja     L118
  pxor   %xmm5,%xmm5
  movsd  D99(%rip),%xmm0
  comisd %xmm1,%xmm5
  jae    L118
  movsd  D549(%rip),%xmm5
  movsd  %xmm1,0x18(%rsp)
  mulsd  %xmm1,%xmm5
  movapd %xmm5,%xmm0
  movsd  %xmm5,(%rsp)
  call   <LnGamma@plt>
  movsd  (%rsp),%xmm5
  subsd  D498(%rip),%xmm5
  movsd  %xmm0,0x8(%rsp)
  movsd  0x40(%rsp),%xmm0
  movsd  %xmm5,0x10(%rsp)
  call   <log@plt>
  mulsd  D796(%rip),%xmm0
  movsd  0x18(%rsp),%xmm2
  comisd %xmm0,%xmm2
  jb     L77
  comisd D124(%rip),%xmm2
  jbe    L61
  movsd  0x40(%rsp),%xmm0
  movsd  %xmm2,0x18(%rsp)
  call   <QuantileNormal@plt>
  movsd  0x18(%rsp),%xmm2
  pxor   %xmm6,%xmm6
  movsd  D754(%rip),%xmm3
  movapd %xmm0,%xmm1
  divsd  %xmm2,%xmm3
  ucomisd %xmm3,%xmm6
  ja     L16
  movapd %xmm3,%xmm0
  sqrtsd %xmm0,%xmm0
L78:
  mulsd  %xmm1,%xmm0
  movsd  D277(%rip),%xmm1
  movsd  %xmm2,0x18(%rsp)
  addsd  D498(%rip),%xmm0
  subsd  %xmm3,%xmm0
  call   <pow@plt>
  movsd  0x18(%rsp),%xmm2
  movapd %xmm0,%xmm4
  mulsd  %xmm2,%xmm4
  mulsd  D183(%rip),%xmm2
  addsd  D395(%rip),%xmm2
  comisd %xmm2,%xmm4
  ja     L119
  movsd  D762(%rip),%xmm6
  movsd  D590(%rip),%xmm5
  movq   D536(%rip),%xmm7
  movsd  %xmm6,0x48(%rsp)
  movsd  %xmm5,0x50(%rsp)
  movaps %xmm7,0x30(%rsp)
  jmp    L96
  nopl   0x0(%rax)
L118:
  add    $0x60,%rsp
  pop    %rbx
  ret
  xchg   %ax,%ax
L1:
  pxor   %xmm0,%xmm0
  ret
  nopl   (%rax)
L77:
  movsd  D762(%rip),%xmm7
  movsd  (%rsp),%xmm0
  mulsd  %xmm7,%xmm0
  movsd  %xmm7,0x48(%rsp)
  addsd  0x8(%rsp),%xmm0
  call   <exp@plt>
  movsd  (%rsp),%xmm7
  movapd %xmm0,%xmm1
  movsd  0x40(%rsp),%xmm0
  mulsd  %xmm7,%xmm0
  mulsd  %xmm1,%xmm0
  movsd  D498(%rip),%xmm1
  divsd  %xmm7,%xmm1
  call   <pow@plt>
  movsd  D590(%rip),%xmm7
  movapd %xmm0,%xmm1
  movapd %xmm0,%xmm4
  subsd  %xmm7,%xmm1
  movsd  %xmm7,0x50(%rsp)
  pxor   %xmm7,%xmm7
  comisd %xmm1,%xmm7
  ja     L118
L159:
  movq   D536(%rip),%xmm5
  movaps %xmm5,0x30(%rsp)
L96:
  lea    D367(%rip),%rbx
  jmp    L139
  nopl   0x0(%rax,%rax,1)
L153:
  movsd  0x40(%rsp),%xmm7
  movsd  %xmm4,0x28(%rsp)
  subsd  %xmm0,%xmm7
  movapd %xmm4,%xmm0
  movsd  %xmm7,0x20(%rsp)
  call   <log@plt>
  movapd %xmm0,%xmm1
  movsd  (%rsp),%xmm0
  mulsd  0x10(%rsp),%xmm1
  mulsd  0x48(%rsp),%xmm0
  addsd  0x8(%rsp),%xmm0
  addsd  0x18(%rsp),%xmm0
  subsd  %xmm1,%xmm0
  call   <exp@plt>
  movsd  0x20(%rsp),%xmm5
  movsd  0x28(%rsp),%xmm4
  movsd  0x10(%rsp),%xmm11
  movsd  D21(%rip),%xmm8
  mulsd  %xmm0,%xmm5
  movsd  D549(%rip),%xmm0
  movsd  D532(%rip),%xmm1
  movapd %xmm11,%xmm7
  movsd  D293(%rip),%xmm10
  movsd  D368(%rip),%xmm3
  movsd  D152(%rip),%xmm9
  mulsd  %xmm5,%xmm0
  movapd %xmm5,%xmm6
  divsd  %xmm4,%xmm6
  movapd %xmm0,%xmm2
  mulsd  %xmm6,%xmm7
  subsd  %xmm7,%xmm2
  mulsd  %xmm2,%xmm8
  addsd  D148(%rip),%xmm8
  mulsd  %xmm2,%xmm1
  addsd  D448(%rip),%xmm1
  mulsd  %xmm2,%xmm10
  addsd  D410(%rip),%xmm10
  mulsd  %xmm2,%xmm3
  mulsd  %xmm2,%xmm8
  addsd  D230(%rip),%xmm3
  addsd  D20(%rip),%xmm8
  mulsd  %xmm2,%xmm1
  addsd  D236(%rip),%xmm1
  mulsd  %xmm2,%xmm10
  addsd  D501(%rip),%xmm10
  mulsd  %xmm2,%xmm3
  mulsd  %xmm11,%xmm8
  addsd  D534(%rip),%xmm3
  mulsd  %xmm2,%xmm1
  mulsd  %xmm2,%xmm9
  addsd  D135(%rip),%xmm1
  addsd  D768(%rip),%xmm9
  mulsd  %xmm2,%xmm3
  addsd  D464(%rip),%xmm3
  addsd  %xmm10,%xmm8
  mulsd  %xmm2,%xmm1
  movsd  D314(%rip),%xmm10
  divsd  D170(%rip),%xmm8
  mulsd  %xmm2,%xmm9
  addsd  D539(%rip),%xmm1
  addsd  D271(%rip),%xmm9
  mulsd  %xmm2,%xmm10
  addsd  D771(%rip),%xmm10
  mulsd  %xmm2,%xmm3
  mulsd  %xmm2,%xmm1
  addsd  D3(%rip),%xmm3
  divsd  D438(%rip),%xmm3
  mulsd  %xmm2,%xmm9
  addsd  D354(%rip),%xmm1
  divsd  D3(%rip),%xmm1
  addsd  D354(%rip),%xmm9
  mulsd  %xmm1,%xmm0
  divsd  D438(%rip),%xmm9
  mulsd  %xmm11,%xmm10
  addsd  D498(%rip),%xmm0
  mulsd  D128(%rip),%xmm2
  addsd  D236(%rip),%xmm2
  addsd  %xmm2,%xmm10
  movsd  D214(%rip),%xmm2
  divsd  D438(%rip),%xmm10
  mulsd  %xmm11,%xmm2
  addsd  D172(%rip),%xmm2
  mulsd  %xmm11,%xmm2
  addsd  D325(%rip),%xmm2
  divsd  D170(%rip),%xmm2
  mulsd  %xmm6,%xmm2
  subsd  %xmm2,%xmm10
  movapd %xmm8,%xmm2
  mulsd  %xmm6,%xmm10
  subsd  %xmm10,%xmm2
  mulsd  %xmm6,%xmm2
  subsd  %xmm2,%xmm9
  mulsd  %xmm6,%xmm9
  subsd  %xmm9,%xmm3
  mulsd  %xmm6,%xmm3
  subsd  %xmm3,%xmm1
  mulsd  %xmm7,%xmm1
  subsd  %xmm1,%xmm0
  mulsd  %xmm5,%xmm0
  addsd  %xmm4,%xmm0
  divsd  %xmm0,%xmm4
  subsd  D498(%rip),%xmm4
  andpd  0x30(%rsp),%xmm4
  comisd 0x50(%rsp),%xmm4
  jbe    L118
  movapd %xmm0,%xmm4
L139:
  movsd  D549(%rip),%xmm5
  movsd  0x8(%rsp),%xmm2
  movsd  %xmm4,0x20(%rsp)
  movsd  (%rsp),%xmm1
  mulsd  %xmm4,%xmm5
  movapd %xmm5,%xmm0
  movsd  %xmm5,0x18(%rsp)
  call   <IncompleteGamma@plt>
  pxor   %xmm6,%xmm6
  movsd  0x20(%rsp),%xmm4
  comisd %xmm0,%xmm6
  jbe    L153
  mov    %rbx,%rdi
  movsd  %xmm4,0x28(%rsp)
  movsd  %xmm0,0x20(%rsp)
  call   <error2@plt>
  movsd  0x28(%rsp),%xmm4
  movsd  0x20(%rsp),%xmm0
  jmp    L153
  nopl   0x0(%rax)
L61:
  movsd  D498(%rip),%xmm0
  subsd  0x40(%rsp),%xmm0
  call   <log@plt>
  movsd  D762(%rip),%xmm7
  movsd  0x10(%rsp),%xmm6
  addsd  0x8(%rsp),%xmm0
  movq   D536(%rip),%xmm5
  mulsd  %xmm7,%xmm6
  movsd  D716(%rip),%xmm4
  movsd  %xmm7,0x48(%rsp)
  movaps %xmm5,0x30(%rsp)
  movsd  %xmm0,0x58(%rsp)
  movsd  %xmm6,0x50(%rsp)
  nopw   0x0(%rax,%rax,1)
L13:
  movsd  D419(%rip),%xmm2
  movsd  D101(%rip),%xmm1
  movsd  %xmm4,0x18(%rsp)
  movsd  D549(%rip),%xmm0
  addsd  %xmm4,%xmm2
  addsd  %xmm4,%xmm1
  mulsd  %xmm4,%xmm0
  addsd  0x58(%rsp),%xmm0
  addsd  0x50(%rsp),%xmm0
  mulsd  %xmm4,%xmm2
  addsd  D409(%rip),%xmm2
  mulsd  %xmm4,%xmm1
  addsd  D498(%rip),%xmm1
  mulsd  %xmm4,%xmm2
  movsd  %xmm1,0x28(%rsp)
  movsd  %xmm2,0x20(%rsp)
  call   <exp@plt>
  movsd  0x20(%rsp),%xmm2
  movsd  0x28(%rsp),%xmm1
  pxor   %xmm5,%xmm5
  movsd  0x18(%rsp),%xmm4
  movsd  D498(%rip),%xmm3
  mulsd  %xmm2,%xmm0
  divsd  %xmm1,%xmm0
  subsd  %xmm0,%xmm3
  movapd %xmm4,%xmm0
  addsd  %xmm4,%xmm0
  addsd  D101(%rip),%xmm0
  divsd  %xmm1,%xmm0
  movsd  D277(%rip),%xmm1
  mulsd  %xmm4,%xmm1
  addsd  D670(%rip),%xmm1
  mulsd  %xmm4,%xmm1
  addsd  D409(%rip),%xmm1
  divsd  %xmm2,%xmm1
  subsd  D549(%rip),%xmm0
  subsd  %xmm1,%xmm0
  divsd  %xmm0,%xmm3
  movapd %xmm4,%xmm0
  subsd  %xmm3,%xmm4
  divsd  %xmm4,%xmm0
  subsd  D498(%rip),%xmm0
  andpd  0x30(%rsp),%xmm0
  subsd  D266(%rip),%xmm0
  comisd %xmm0,%xmm5
  jb     L13
  movsd  D590(%rip),%xmm7
  movsd  %xmm7,0x50(%rsp)
  jmp    L96
  nopl   0x0(%rax)
L119:
  movsd  D498(%rip),%xmm0
  subsd  0x40(%rsp),%xmm0
  movsd  %xmm4,0x18(%rsp)
  call   <log@plt>
  movsd  0x18(%rsp),%xmm4
  movq   %xmm0,%rbx
  movsd  D549(%rip),%xmm0
  mulsd  %xmm4,%xmm0
  call   <log@plt>
  movsd  0x10(%rsp),%xmm1
  movsd  D7(%rip),%xmm4
  movsd  D762(%rip),%xmm7
  movsd  D590(%rip),%xmm6
  mulsd  %xmm0,%xmm1
  movq   %rbx,%xmm0
  movsd  %xmm7,0x48(%rsp)
  movsd  %xmm6,0x50(%rsp)
  subsd  %xmm1,%xmm0
  addsd  0x8(%rsp),%xmm0
  mulsd  %xmm0,%xmm4
  jmp    L159
L16:
  movsd  %xmm0,0x20(%rsp)
  movapd %xmm3,%xmm0
  movsd  %xmm2,0x28(%rsp)
  movsd  %xmm3,0x18(%rsp)
  call   <sqrt@plt>
  movsd  0x28(%rsp),%xmm2
  movsd  0x20(%rsp),%xmm1
  movsd  0x18(%rsp),%xmm3
  jmp    L78
```

tool_calls: name: retrieve_data
arguments: label: D462
type_infered: byte[8]
name: retrieve_data
arguments: label: D453
type_infered: byte[16]
name: retrieve_data
arguments: label: D131
type_infered: f32[2]
name: retrieve_data
arguments: label: D99
type_infered: f32[2]
name: retrieve_data
arguments: label: D549
type_infered: f64
name: retrieve_data
arguments: label: D498
type_infered: f32[2]
name: retrieve_data
arguments: label: D796
type_infered: byte[8]
name: retrieve_data
arguments: label: D124
type_infered: byte[16]
name: retrieve_data
arguments: label: D754
type_infered: f64
name: retrieve_data
arguments: label: D277
type_infered: f64
name: retrieve_data
arguments: label: D183
type_infered: f64
name: retrieve_data
arguments: label: D395
type_infered: f32[2]
name: retrieve_data
arguments: label: D762
type_infered: byte[8]
name: retrieve_data
arguments: label: D590
type_infered: byte[8]
name: retrieve_data
arguments: label: D536
type_infered: qword
name: retrieve_data
arguments: label: D367
type_infered: string
name: retrieve_data
arguments: label: D21
type_infered: f32[2]
name: retrieve_data
arguments: label: D532
type_infered: f32[2]
name: retrieve_data
arguments: label: D293
type_infered: f32[2]
name: retrieve_data
arguments: label: D368
type_infered: f32[2]
name: retrieve_data
arguments: label: D152
type_infered: f32[2]
name: retrieve_data
arguments: label: D148
type_infered: f32[2]
name: retrieve_data
arguments: label: D448
type_infered: f32[2]
name: retrieve_data
arguments: label: D410
type_infered: f32[2]
name: retrieve_data
arguments: label: D230
type_infered: f32[2]
name: retrieve_data
arguments: label: D20
type_infered: f32[2]
name: retrieve_data
arguments: label: D236
type_infered: f32[2]
name: retrieve_data
arguments: label: D501
type_infered: f32[2]
name: retrieve_data
arguments: label: D534
type_infered: f32[2]
name: retrieve_data
arguments: label: D135
type_infered: f32[2]
name: retrieve_data
arguments: label: D768
type_infered: f32[2]
name: retrieve_data
arguments: label: D464
type_infered: f32[2]
name: retrieve_data
arguments: label: D314
type_infered: f32[2]
name: retrieve_data
arguments: label: D170
type_infered: f32[2]
name: retrieve_data
arguments: label: D539
type_infered: f32[2]
name: retrieve_data
arguments: label: D271
type_infered: f32[2]
name: retrieve_data
arguments: label: D771
type_infered: f32[2]
name: retrieve_data
arguments: label: D3
type_infered: f32[2]
name: retrieve_data
arguments: label: D438
type_infered: f32[2]
name: retrieve_data
arguments: label: D354
type_infered: f32[2]
name: retrieve_data
arguments: label: D128
type_infered: f32[2]
name: retrieve_data
arguments: label: D214
type_infered: f32[2]
name: retrieve_data
arguments: label: D172
type_infered: f32[2]
name: retrieve_data
arguments: label: D325
type_infered: f32[2]
name: retrieve_data
arguments: label: D716
type_infered: f64
name: retrieve_data
arguments: label: D419
type_infered: f64
name: retrieve_data
arguments: label: D101
type_infered: f64
name: retrieve_data
arguments: label: D409
type_infered: f64
name: retrieve_data
arguments: label: D670
type_infered: f64
name: retrieve_data
arguments: label: D266
type_infered: byte[8]
name: retrieve_data
arguments: label: D7
type_infered: f32[2]

tool: {"D462": [0x8d,0xed,0xb5,0xa0,0xf7,0xc6,0xb0,0x3e]}

tool: {"D453": [0xe9,0x0b,0x21,0xe7,0xfd,0xff,0xef,0x3f,0x00,0x00,0x00,0x00,0x00,0x00,0xe0,0x3f]}

tool: {"D131": [0.0,6.11029052734375]}

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

tool: D549: 0.5

tool: {"D498": [0.0,1.875]}

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

tool: {"D124": [0x7b,0x14,0xae,0x47,0xe1,0x7a,0xd4,0x3f,0xcc,0xfc,0xf1,0xfe,0x42,0x2e,0xe6,0x3f]}

tool: D754: 0.222222

tool: D277: 3

tool: D183: 2.2

tool: {"D395": [0.0,2.375]}

tool: {"D762": [0xcc,0xfc,0xf1,0xfe,0x42,0x2e,0xe6,0x3f]}

tool: {"D590": [0x8d,0xed,0xb5,0xa0,0xf7,0xc6,0xa0,0x3e]}

tool: D536: 9223372036854775807

tool: D367: 
IncompleteGamma

tool: {"D21": [0.0,4.849609375]}

tool: {"D532": [0.0,3.21875]}

tool: {"D293": [0.0,4.5771484375]}

tool: {"D368": [0.0,4.6240234375]}

tool: {"D152": [0.0,4.41015625]}

tool: {"D148": [0.0,4.3681640625]}

tool: {"D448": [0.0,3.2734375]}

tool: {"D410": [0.0,4.15625]}

tool: {"D230": [0.0,4.55712890625]}

tool: {"D20": [0.0,3.787109375]}

tool: {"D236": [0.0,3.328125]}

tool: {"D501": [0.0,3.7421875]}

tool: {"D534": [0.0,4.443359375]}

tool: {"D135": [0.0,3.41015625]}

tool: {"D768": [0.0,4.1904296875]}

tool: {"D464": [0.0,4.2177734375]}

tool: {"D314": [0.0,4.091796875]}

tool: {"D170": [0.0,5.615234375]}

tool: {"D539": [0.0,3.5234375]}

tool: {"D271": [0.0,3.951171875]}

tool: {"D771": [0.0,3.591796875]}

tool: {"D3": [0.0,3.91015625]}

tool: {"D438": [0.0,5.115234375]}

tool: {"D354": [0.0,3.66015625]}

tool: {"D128": [0.0,3.7578125]}

tool: {"D214": [0.0,3.49609375]}

tool: {"D172": [0.0,3.837890625]}

tool: {"D325": [0.0,3.46875]}

tool: D716: 0.4

tool: D419: 6.66

tool: D101: 4.67

tool: D409: 6.73

tool: D670: 13.32

tool: {"D266": [0x7b,0x14,0xae,0x47,0xe1,0x7a,0x84,0x3f]}

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

assistant: ```c
double QuantileChi2(double prob, double v) {
  double e = .5e-6, aa = .6931471805, p = prob, g, small = 1e-6;
  double xx, c, ch, a = 0, q = 0, p1 = 0, p2 = 0, t = 0, x = 0, b = 0, s1, s2, s3, s4, s5, s6;
  if (p < small)
    return (0);
  if (p > 1 - small)
    return (9999);
  if (v <= 0)
    return (-1);
  g = LnGamma(v / 2);
  xx = v / 2;
  c = xx - 1;
  if (v >= -1.24 * log(p))
    goto l1;
  ch = pow((p * xx * exp(g + xx * aa)), 1 / xx);
  if (ch - e < 0)
    return (ch);
  goto l4;
l1:
  if (v > .32)
    goto l3;
  ch = 0.4;
  a = log(1 - p);
l2:
  q = ch;
  p1 = 1 + ch * (4.67 + ch);
  p2 = ch * (6.73 + ch * (6.66 + ch));
  t = -0.5 + (4.67 + 2 * ch) / p1 - (6.73 + ch * (13.32 + 3 * ch)) / p2;
  ch -= (1 - exp(a + g + .5 * ch + c * aa) * p2 / p1) / t;
  if (fabs(q / ch - 1) - .01 <= 0)
    goto l4;
  else
    goto l2;
l3:
  x = QuantileNormal(p);
  p1 = 0.222222 / v;
  ch = v * pow((x * sqrt(p1) + 1 - p1), 3.0);
  if (ch > 2.2 * v + 6)
    ch = -2 * (log(1 - p) - c * log(.5 * ch) + g);
l4:
  q = ch;
  p1 = .5 * ch;
  if ((t = IncompleteGamma(p1, xx, g)) < 0)
    error2("\nIncompleteGamma");
  p2 = p - t;
  t = p2 * exp(xx * aa + g + p1 - c * log(ch));
  b = t / ch;
  a = 0.5 * t - b * c;
  s1 = (210 + a * (140 + a * (105 + a * (84 + a * (70 + 60 * a))))) / 420;
  s2 = (420 + a * (735 + a * (966 + a * (1141 + 1278 * a)))) / 2520;
  s3 = (210 + a * (462 + a * (707 + 932 * a))) / 2520;
  s4 = (252 + a * (672 + 1182 * a) + c * (294 + a * (889 + 1740 * a))) / 5040;
  s5 = (84 + 264 * a + c * (175 + 606 * a)) / 2520;
  s6 = (120 + c * (346 + 127 * c)) / 5040;
  ch += t * (1 + 0.5 * t * s1 - b * c * (s1 - b * (s2 - b * (s3 - b * (s4 - b * (s5 - b * s6))))));
  if (fabs(q / ch - 1) > e)
    goto l4;
  return (ch);
}
```