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

```asm
<unbiasedest>:
  endbr64
  push   %r15
  push   %r14
  push   %r13
  push   %r12
  push   %rbp
  push   %rbx
  sub    $0xa8,%rsp
  mov    %rdi,0x28(%rsp)
  mov    %esi,%r14d
  mov    %rdx,%r13
  mov    %fs:0x28,%rax
  mov    %rax,0x98(%rsp)
  xor    %eax,%eax
  lea    0x34(%rsp),%rdx
  mov    $0x0,%ecx
  call   <ivmaxmin@plt>
  mov    0x34(%rsp),%eax
  lea    0x1(%rax),%edi
  mov    $0x4,%esi
  call   <calloc@plt>
  mov    %rax,0x20(%rsp)
  test   %rax,%rax
  je     L156
L132:
  mov    0x34(%rsp),%edx
  test   %edx,%edx
  js     L167
  mov    0x20(%rsp),%rcx
  mov    $0x0,%eax
L253:
  mov    0x0(%r13,%rax,8),%rsi
  mov    0x4(%rsi),%edx
  add    (%rsi),%edx
  mov    %edx,(%rcx)
  mov    0x34(%rsp),%edx
  add    $0x1,%rax
  add    $0x4,%rcx
  cmp    %eax,%edx
  jge    L253
L167:
  lea    0x1(%rdx),%edi
  pxor   %xmm0,%xmm0
  mov    %r14d,%esi
  call   <initarray_2Ddouble@plt>
  mov    %rax,0x38(%rsp)
  cmpl   $0x0,0x34(%rsp)
  js     L291
  mov    0x20(%rsp),%rax
  mov    %rax,0x18(%rsp)
  movq   $0x0,0x10(%rsp)
  jmp    L202
L156:
  mov    0x34(%rsp),%eax
  lea    0x1(%rax),%esi
  lea    D52(%rip),%rdi
  call   <fatalx@plt>
  jmp    L132
L87:
  mov    0x38(%rsp),%rax
  mov    (%rax,%r15,1),%rax
  movq   %rbp,%xmm1
  divsd  %xmm0,%xmm1
  movsd  %xmm1,(%rax,%r12,1)
L198:
  add    $0x1,%ebx
  add    $0x8,%r12
  cmp    %ebx,%r14d
  jl     L189
L161:
  mov    0x0(%r13),%rax
  mov    %ebx,%esi
  mov    (%rax),%edi
  call   <ifall@plt>
  movq   %xmm0,%rbp
  mov    %ebx,%esi
  mov    0x8(%rsp),%rax
  mov    (%rax),%edi
  call   <ifall@plt>
  movsd  D92(%rip),%xmm2
  comisd %xmm0,%xmm2
  jb     L87
  mov    0x38(%rsp),%rax
  mov    (%rax,%r15,1),%rax
  movsd  D97(%rip),%xmm3
  movsd  %xmm3,(%rax,%r12,1)
  jmp    L198
L189:
  addq   $0x1,0x10(%rsp)
  mov    0x10(%rsp),%rax
  add    $0x8,%r13
  addq   $0x4,0x18(%rsp)
  cmp    %eax,0x34(%rsp)
  jl     L291
L202:
  mov    0x10(%rsp),%rcx
  lea    0x0(,%rcx,8),%r15
  mov    0x38(%rsp),%rax
  mov    (%rax,%rcx,8),%rax
  mov    D105(%rip),%rcx
  mov    %rcx,(%rax)
  test   %r14d,%r14d
  jle    L189
  mov    0x18(%rsp),%rax
  mov    %rax,0x8(%rsp)
  mov    $0x8,%r12d
  mov    $0x1,%ebx
  jmp    L161
L291:
  mov    $0x1,%r12d
  mov    %r14d,%ecx
  shl    %cl,%r12d
  test   %r12d,%r12d
  jle    L30
  lea    -0x1(%r14),%eax
  mov    0x28(%rsp),%rdx
  lea    0x4(%rdx,%rax,4),%rbx
  mov    $0x0,%ebp
  mov    D38(%rip),%r13
L266:
  mov    0x34(%rsp),%eax
  lea    0x1(%rax),%esi
  lea    0x40(%rsp),%rdi
  call   <ivzero@plt>
  test   %r14d,%r14d
  jle    L144
  mov    0x28(%rsp),%rdx
  mov    %ebp,%ecx
  jmp    L190
L5:
  cltq
  addl   $0x1,0x40(%rsp,%rax,4)
  add    $0x4,%rdx
  cmp    %rbx,%rdx
  je     L144
L190:
  mov    %ecx,%eax
  and    $0x1,%eax
  sar    %ecx
  test   %eax,%eax
  je     L5
  mov    (%rdx),%eax
  jmp    L5
L144:
  mov    0x34(%rsp),%esi
  test   %esi,%esi
  js     L246
  mov    0x38(%rsp),%rdi
  mov    $0x0,%eax
  movsd  D105(%rip),%xmm1
  jmp    L89
L214:
  mov    0x20(%rsp),%rdi
  call   <free@plt>
  mov    0x34(%rsp),%eax
  lea    0x1(%rax),%esi
  lea    0x38(%rsp),%rdi
  call   <free2D@plt>
  mov    D97(%rip),%r13
L46:
  mov    0x98(%rsp),%rax
  sub    %fs:0x28,%rax
  jne    L250
  movq   %r13,%xmm0
  add    $0xa8,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
L246:
  movsd  D105(%rip),%xmm1
L276:
  movq   %r13,%xmm6
  addsd  %xmm1,%xmm6
  movq   %xmm6,%r13
  add    $0x1,%ebp
  cmp    %ebp,%r12d
  jne    L266
  jmp    L176
L30:
  mov    D38(%rip),%r13
L176:
  movq   %r13,%xmm0
  call   <fabs@plt>
  cmp    $0x63,%eax
  jle    L292
  mov    D97(%rip),%r13
L292:
  mov    0x20(%rsp),%rdi
  call   <free@plt>
  mov    0x34(%rsp),%eax
  lea    0x1(%rax),%esi
  lea    0x38(%rsp),%rdi
  call   <free2D@plt>
  jmp    L46
L262:
  movslq %edx,%rdx
  mov    (%rdi,%rax,8),%rcx
  movsd  (%rcx,%rdx,8),%xmm0
  movsd  D95(%rip),%xmm5
  comisd %xmm0,%xmm5
  ja     L214
L195:
  mulsd  %xmm0,%xmm1
  add    $0x1,%rax
  cmp    %eax,%esi
  jl     L276
L89:
  mov    0x40(%rsp,%rax,4),%edx
  test   %eax,%eax
  jle    L262
  mov    %edx,%r8d
  shr    $0x1f,%r8d
  lea    (%rdx,%r8,1),%ecx
  and    $0x1,%ecx
  sub    %r8d,%ecx
  movslq %edx,%rdx
  mov    (%rdi,%rax,8),%r8
  movsd  (%r8,%rdx,8),%xmm0
  movsd  D95(%rip),%xmm4
  comisd %xmm0,%xmm4
  ja     L214
  cmp    $0x1,%ecx
  jne    L195
  xorpd  D108(%rip),%xmm0
  jmp    L195
L250:
  call   <__stack_chk_fail@plt>
```

tool_calls: name: retrieve_data
arguments: tag: D52
type: string
name: retrieve_data
arguments: tag: D92
type: f64
name: retrieve_data
arguments: tag: D97
type: f32[2]
name: retrieve_data
arguments: tag: D105
type: f64
name: retrieve_data
arguments: tag: D38
type: f32[2]
name: retrieve_data
arguments: tag: D95
type: f32[2]
name: retrieve_data
arguments: tag: D108
type: f32[4]

tool: D52: Unable to allocate %d unit(s) for item 


tool: D92: 0.1

tool: {"D97": [0.0,-6.1103515625]}

tool: D105: 1

tool: {"D38": [0.0,0.0]}

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

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

assistant: ```c
double unbiasedest(int *ndx, int ndsize, int **counts) {
  double xtop, xbot, yest, y;
  int popind[20];
  int popmax, j, k, n, nmax, a, t, s;
  int *tcounts;
  double **xmomest, yp;
  ivmaxmin(ndx, ndsize, &popmax, NULL);
  if ((tcounts = (int *)calloc((popmax + 1), sizeof(int))) == NULL)
    fatalx("Unable to allocate %d unit(s) for item \n", popmax + 1);
  for (j = 0; j <= popmax; ++j) {
    tcounts[j] = counts[j][0] + counts[j][1];
  }
  xmomest = initarray_2Ddouble(popmax + 1, ndsize, 0.0);
  for (j = 0; j <= popmax; ++j) {
    xmomest[j][0] = 1.0;
    for (k = 1; k <= ndsize; ++k) {
      xtop = ifall(counts[j][0], k);
      xbot = ifall(tcounts[j], k);
      if (xbot <= 0.1)
        xmomest[j][k] = -10000.0;
      else
        xmomest[j][k] = (double)xtop / (double)xbot;
    }
  }
  nmax = (1 << (ndsize)) - 1;
  yest = 0.0;
  for (n = 0; n <= nmax; ++n) {
    t = n;
    ivzero(popind, popmax + 1);
    for (k = 0; k < ndsize; ++k) {
      a = 0;
      s = t & 1;
      t = t >> 1;
      if (s == 1)
        a = ndx[k];
      ++popind[a];
    }
    yp = 1.0;
    for (j = 0; j <= popmax; ++j) {
      t = popind[j];
      s = 0;
      if (j > 0)
        s = t % 2;
      y = xmomest[j][t];
      if (y < -1.0) {
        free(tcounts);
        free2D(&xmomest, popmax + 1);
        return (-10000.0);
      }
      if (s == 1)
        y = -y;
      yp *= y;
    }
    yest += yp;
  }
  if (fabs(yest) >= 100)
    yest = -10000;
  free(tcounts);
  free2D(&xmomest, popmax + 1);
  return (yest);
}
```