user: What is the c source code of the assembly code below?

```asm
<SNPHWE_pValue>:
  endbr64
  push   %r14
  mov    %edx,%eax
  push   %r13
  push   %r12
  mov    %ecx,%r12d
  push   %rbp
  movslq %edi,%rbp
  push   %rbx
  sub    $0x10,%rsp
  cmp    %edx,%esi
  cmovle %esi,%eax
  cmovge %esi,%edx
  lea    0x0(%rbp,%rax,2),%ebx
  mov    %edx,%r14d
  add    %ebp,%r14d
  lea    0x1(%rbx),%r13d
  add    %eax,%r14d
  lea    0x0(,%r13,8),%edi
  call   <malloc@plt>
  lea    (%r14,%r14,1),%ecx
  movsd  D16(%rip),%xmm4
  mov    %r14d,%r9d
  mov    %rax,%r8
  mov    %ecx,%eax
  sub    %ebx,%eax
  imul   %ebx,%eax
  cltd
  idiv   %ecx
  mov    %ebx,%edx
  xor    %eax,%edx
  and    $0x1,%edx
  cmp    $0x1,%edx
  mov    %ebx,%edx
  sbb    $0xffffffff,%eax
  sub    %eax,%edx
  sub    %eax,%r9d
  mov    %edx,%ecx
  shr    $0x1f,%ecx
  add    %edx,%ecx
  movslq %eax,%rdx
  sar    %ecx
  lea    (%r8,%rdx,8),%r11
  sub    %ecx,%r9d
  movsd  %xmm4,(%r11)
  cmp    $0x1,%eax
  jle    L94
  mov    %r9d,%r10d
  movsd  D39(%rip),%xmm5
  mov    %rdx,%rsi
  mov    %ecx,%edi
  movapd %xmm4,%xmm0
  movapd %xmm4,%xmm3
  sub    %ecx,%r10d
  nopw   0x0(%rax,%rax,1)
L175:
  pxor   %xmm1,%xmm1
  pxor   %xmm2,%xmm2
  lea    (%r10,%rdi,1),%r14d
  cvtsi2sd %esi,%xmm1
  cvtsi2sd %edi,%xmm2
  add    $0x1,%edi
  mulsd  %xmm1,%xmm0
  subsd  %xmm4,%xmm1
  addsd  %xmm4,%xmm2
  mulsd  %xmm5,%xmm2
  mulsd  %xmm1,%xmm0
  pxor   %xmm1,%xmm1
  cvtsi2sd %r14d,%xmm1
  addsd  %xmm4,%xmm1
  mulsd  %xmm2,%xmm1
  divsd  %xmm1,%xmm0
  movsd  %xmm0,-0x10(%r8,%rsi,8)
  sub    $0x2,%rsi
  addsd  %xmm0,%xmm3
  cmp    $0x1,%esi
  jg     L175
L64:
  lea    -0x1(%rbx),%esi
  cmp    %esi,%eax
  jge    L124
  movsd  (%r11),%xmm0
  movsd  D39(%rip),%xmm5
  sub    %ecx,%r9d
  movsd  D22(%rip),%xmm6
  nopl   0x0(%rax,%rax,1)
L68:
  mulsd  %xmm5,%xmm0
  pxor   %xmm2,%xmm2
  lea    (%r9,%rcx,1),%eax
  cvtsi2sd %ecx,%xmm2
  pxor   %xmm1,%xmm1
  sub    $0x1,%ecx
  cvtsi2sd %edx,%xmm1
  mulsd  %xmm2,%xmm0
  pxor   %xmm2,%xmm2
  cvtsi2sd %eax,%xmm2
  mulsd  %xmm2,%xmm0
  movapd %xmm1,%xmm2
  addsd  %xmm4,%xmm1
  addsd  %xmm6,%xmm2
  mulsd  %xmm2,%xmm1
  divsd  %xmm1,%xmm0
  movsd  %xmm0,0x10(%r8,%rdx,8)
  add    $0x2,%rdx
  addsd  %xmm0,%xmm3
  cmp    %edx,%esi
  jg     L68
L124:
  test   %ebx,%ebx
  js     L87
  je     L93
  mov    %r13d,%edx
  movapd %xmm3,%xmm1
  mov    %r8,%rax
  shr    %edx
  unpcklpd %xmm1,%xmm1
  shl    $0x4,%rdx
  add    %r8,%rdx
  nop
L209:
  movupd (%rax),%xmm0
  add    $0x10,%rax
  divpd  %xmm1,%xmm0
  movups %xmm0,-0x10(%rax)
  cmp    %rax,%rdx
  jne    L209
  mov    %r13d,%eax
  and    $0xfffffffe,%eax
  and    $0x1,%r13d
  je     L186
L122:
  cltq
  lea    (%r8,%rax,8),%rax
  movsd  (%rax),%xmm0
  divsd  %xmm3,%xmm0
  movsd  %xmm0,(%rax)
L186:
  cmp    $0x1,%r12d
  je     L28
L158:
  cmp    $0x2,%r12d
  je     L203
L81:
  mov    %r8,%rdi
  call   <free@plt>
  add    $0x10,%rsp
  pxor   %xmm0,%xmm0
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  ret
  nopl   0x0(%rax)
L203:
  cmp    %ebx,%ebp
  jg     L81
  mov    %ebx,%eax
  sub    %ebp,%eax
  lea    0x1(%rax),%ecx
  cmp    %ebx,%ebp
  je     L80
  mov    %ecx,%edx
  movslq %ebp,%rax
  pxor   %xmm0,%xmm0
  shr    %edx
  lea    (%r8,%rax,8),%rax
  shl    $0x4,%rdx
  add    %rax,%rdx
  nopl   0x0(%rax)
L159:
  movsd  (%rax),%xmm1
  add    $0x10,%rax
  addsd  %xmm1,%xmm0
  movsd  -0x8(%rax),%xmm1
  addsd  %xmm1,%xmm0
  cmp    %rdx,%rax
  jne    L159
  mov    %ecx,%eax
  and    $0xfffffffe,%eax
  lea    (%rax,%rbp,1),%ebx
  cmp    %ecx,%eax
  je     L70
L8:
  movslq %ebx,%rbx
  addsd  (%r8,%rbx,8),%xmm0
L70:
  mov    %r8,%rdi
  movsd  %xmm0,0x8(%rsp)
  call   <free@plt>
  mov    D16(%rip),%rax
  movsd  0x8(%rsp),%xmm0
  add    $0x10,%rsp
  pop    %rbx
  pop    %rbp
  movq   %rax,%xmm4
  pop    %r12
  pop    %r13
  minsd  %xmm0,%xmm4
  pop    %r14
  movapd %xmm4,%xmm0
  ret
  nopl   0x0(%rax)
L28:
  movslq %ebx,%rbx
  movsd  (%r8,%rbp,8),%xmm2
  mov    %r8,%rax
  pxor   %xmm0,%xmm0
  lea    0x8(%r8,%rbx,8),%rdx
  nopl   (%rax)
L153:
  movsd  (%rax),%xmm1
  comisd %xmm2,%xmm1
  ja     L6
  addsd  %xmm1,%xmm0
L6:
  add    $0x8,%rax
  cmp    %rax,%rdx
  jne    L153
  jmp    L70
  nopl   0x0(%rax)
L94:
  movapd %xmm4,%xmm3
  jmp    L64
  nopl   0x0(%rax)
L87:
  cmp    $0x1,%r12d
  jne    L158
  jmp    L81
L93:
  xor    %eax,%eax
  jmp    L122
L80:
  pxor   %xmm0,%xmm0
  jmp    L8
```

tool_calls: name: unpack_data
arguments: data_tag: D16
type_infered: f64
name: unpack_data
arguments: data_tag: D39
type_infered: f64
name: unpack_data
arguments: data_tag: D22
type_infered: f64

tool: D16: 1

tool: D39: 4

tool: D22: 2

assistant: ```c
double SNPHWE_pValue(int obs_hets, int obs_hom1, int obs_hom2, int ctype) {
  int i;
  double p_hwe;
  int obs_homc = (obs_hom1 < obs_hom2) ? obs_hom2 : obs_hom1;
  int obs_homr = (obs_hom1 < obs_hom2) ? obs_hom1 : obs_hom2;
  int rare_copies = 2 * obs_homr + obs_hets;
  int genotypes = obs_hets + obs_homc + obs_homr;
  double *het_probs = malloc((rare_copies + 1) * sizeof(double));
  int mid = rare_copies * (2 * genotypes - rare_copies) / (2 * genotypes);
  if ((rare_copies & 1) ^ (mid & 1)) {
    mid++;
  }
  int curr_hets = mid;
  int curr_homr = (rare_copies - mid) / 2;
  int curr_homc = genotypes - curr_hets - curr_homr;
  het_probs[mid] = 1.0;
  double sum = het_probs[mid];
  for (curr_hets = mid; curr_hets > 1; curr_hets -= 2) {
    het_probs[curr_hets - 2] = het_probs[curr_hets] * curr_hets * (curr_hets - 1.0) / (4.0 * (curr_homr + 1.0) * (curr_homc + 1.0));
    sum += het_probs[curr_hets - 2];
    curr_homr++;
    curr_homc++;
  }
  curr_hets = mid;
  curr_homr = (rare_copies - mid) / 2;
  curr_homc = genotypes - curr_hets - curr_homr;
  for (curr_hets = mid; curr_hets <= rare_copies - 2; curr_hets += 2) {
    het_probs[curr_hets + 2] = het_probs[curr_hets] * 4.0 * curr_homr * curr_homc / ((curr_hets + 2.0) * (curr_hets + 1.0));
    sum += het_probs[curr_hets + 2];
    curr_homr--;
    curr_homc--;
  }
  for (i = 0; i <= rare_copies; i++) {
    het_probs[i] /= sum;
  }
  p_hwe = 0.0;
  if (ctype == 1) {
    for (i = 0; i <= rare_copies; i++) {
      if (het_probs[i] > het_probs[obs_hets])
        continue;
      p_hwe += het_probs[i];
    }
  } else if (ctype == 2) {
    for (i = obs_hets; i <= rare_copies; i++) {
      p_hwe += het_probs[i];
    }
  }
  free(het_probs);
  return (p_hwe > 1.0) ? 1.0 : p_hwe;
}
```