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

```asm
<xsq_to_stddev>:
  endbr64
  push   %r14
  push   %rbp
  push   %rbx
  sub    $0x30,%rsp
  movapd %xmm0,%xmm3
  movq   %xmm1,%rbx
  movsd  %xmm2,0x18(%rsp)
  mov    %rdi,%rbp
  movapd %xmm1,%xmm0
  divsd  %xmm2,%xmm0
  movapd %xmm0,%xmm1
  addsd  %xmm3,%xmm1
  movq   %rbx,%xmm4
  subsd  D116(%rip),%xmm4
  movsd  %xmm1,0x10(%rsp)
  movapd %xmm1,%xmm0
  movsd  %xmm4,0x8(%rsp)
  divsd  %xmm4,%xmm0
  call   <log@plt>
  movsd  0x10(%rsp),%xmm1
  movsd  0x8(%rsp),%xmm4
  subsd  %xmm4,%xmm1
  mulsd  %xmm4,%xmm0
  subsd  %xmm0,%xmm1
  pxor   %xmm0,%xmm0
  comisd %xmm1,%xmm0
  ja     L21
  ucomisd %xmm1,%xmm0
  ja     L99
L19:
  sqrtsd %xmm1,%xmm1
  movsd  %xmm1,0x20(%rsp)
L64:
  movsd  D57(%rip),%xmm0
  divsd  0x8(%rsp),%xmm0
  pxor   %xmm1,%xmm1
  ucomisd %xmm0,%xmm1
  ja     L23
  sqrtsd %xmm0,%xmm0
L24:
  movapd %xmm0,%xmm5
  divsd  D92(%rip),%xmm5
  movsd  %xmm5,0x28(%rsp)
  movsd  0x8(%rsp),%xmm7
  comisd 0x10(%rsp),%xmm7
  jb     L25
  subsd  0x20(%rsp),%xmm5
  movq   %xmm5,%rbx
L74:
  movq   %rbx,%xmm6
  andpd  D49(%rip),%xmm6
  movq   %xmm6,%r14
  movsd  0x8(%rsp),%xmm0
  addsd  %xmm0,%xmm0
  pxor   %xmm1,%xmm1
  ucomisd %xmm0,%xmm1
  ja     L119
  sqrtsd %xmm0,%xmm0
L34:
  movsd  0x18(%rsp),%xmm1
  divsd  %xmm0,%xmm1
  movq   %r14,%xmm3
  comisd %xmm1,%xmm3
  seta   %al
  movzbl %al,%eax
  mov    %eax,0x0(%rbp)
  movq   %rbx,%xmm0
  add    $0x30,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r14
  ret
L21:
  pxor   %xmm1,%xmm1
  jmp    L19
L99:
  movapd %xmm1,%xmm0
  call   <sqrt@plt>
  movsd  %xmm0,0x20(%rsp)
  jmp    L64
L23:
  call   <sqrt@plt>
  jmp    L24
L25:
  movsd  0x18(%rsp),%xmm0
  addsd  0x10(%rsp),%xmm0
  xorpd  D70(%rip),%xmm0
  movq   %rbx,%xmm2
  divsd  %xmm2,%xmm0
  call   <exp@plt>
  movapd %xmm0,%xmm2
  movsd  0x10(%rsp),%xmm3
  divsd  0x18(%rsp),%xmm3
  movapd %xmm3,%xmm0
  addsd  D116(%rip),%xmm0
  movq   %rbx,%xmm1
  divsd  %xmm0,%xmm1
  movsd  D116(%rip),%xmm3
  subsd  %xmm2,%xmm3
  mulsd  %xmm3,%xmm1
  movapd %xmm1,%xmm6
  addsd  %xmm1,%xmm6
  movsd  %xmm6,0x10(%rsp)
  movq   %rbx,%xmm5
  divsd  %xmm1,%xmm5
  movapd %xmm5,%xmm0
  call   <log@plt>
  movapd %xmm0,%xmm1
  movsd  0x18(%rsp),%xmm7
  movapd %xmm7,%xmm0
  addsd  %xmm7,%xmm0
  subsd  D116(%rip),%xmm0
  movsd  0x10(%rsp),%xmm6
  subsd  %xmm6,%xmm0
  mulsd  %xmm1,%xmm0
  subsd  %xmm6,%xmm0
  addsd  D109(%rip),%xmm0
  movapd %xmm0,%xmm7
  movsd  D65(%rip),%xmm0
  comisd %xmm7,%xmm0
  ja     L12
  movsd  %xmm7,0x10(%rsp)
  movapd %xmm7,%xmm0
  subsd  D109(%rip),%xmm0
  call   <log@plt>
  movapd %xmm0,%xmm1
  movsd  0x10(%rsp),%xmm0
  subsd  %xmm1,%xmm0
  subsd  D109(%rip),%xmm0
  pxor   %xmm1,%xmm1
  ucomisd %xmm0,%xmm1
  jbe    L125
  call   <sqrt@plt>
  movq   %xmm0,%rbx
  jmp    L124
L12:
  movsd  D19(%rip),%xmm0
L125:
  sqrtsd %xmm0,%xmm0
  movq   %xmm0,%rbx
L124:
  movsd  0x28(%rsp),%xmm0
  addsd  0x20(%rsp),%xmm0
  movq   %rbx,%xmm7
  minsd  %xmm0,%xmm7
  movq   %xmm7,%rbx
  jmp    L74
L119:
  call   <sqrt@plt>
  jmp    L34
```

tool_calls: name: disassemble_data
arguments: label: D116
datatype: f64
name: disassemble_data
arguments: label: D57
datatype: f64
name: disassemble_data
arguments: label: D92
datatype: f64
name: disassemble_data
arguments: label: D49
datatype: qword[2]
name: disassemble_data
arguments: label: D70
datatype: f32[4]
name: disassemble_data
arguments: label: D109
datatype: f64
name: disassemble_data
arguments: label: D65
datatype: f64
name: disassemble_data
arguments: label: D19
datatype: byte[8]

tool: D116: 1

tool: D57: 2

tool: D92: 3

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

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

tool: D109: 1.837877

tool: D65: 2.83

tool: {"D19": [0x88,0x39,0x68,0xb6,0x0c,0xfa,0x8e,0x40]}

assistant: ```c
double xsq_to_stddev(xsq, k, n, approx)
double xsq, k, n;
int *approx;
{
  double stddev, v, wsq, w, a, keff, twologp, u;
  xsq = xsq + k / n;
  v = k - 1.0;
  wsq = xsq - v - v * log(xsq / v);
  if (wsq < 0.0)
    wsq = 0.0;
  w = sqrt(wsq);
  a = sqrt(2.0 / v) / 3.0;
  if (xsq <= v) {
    stddev = -w + a;
  } else {
    keff = k / (1.0 + xsq / n) * (1.0 - exp(-(xsq + n) / k));
    twologp = (2.0 * n - 1.0 - 2.0 * keff) * log(k / keff) - 2.0 * keff + 1.837877;
    if (twologp < 2.83)
      twologp = 1000.0;
    u = sqrt(twologp - log(twologp - 1.837877) - 1.837877);
    stddev = (((u) < (w + a)) ? (u) : (w + a));
  }
  if (fabs(stddev) > n / sqrt(2.0 * v)) {
    *approx = 1;
  } else {
    *approx = 0;
  }
  return (stddev);
}
```