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

```asm
<spotbounds>:
  endbr64
  push   %r15
  pxor   %xmm2,%xmm2
  push   %r14
  push   %r13
  push   %r12
  push   %rbp
  mov    %edx,%ebp
  push   %rbx
  mov    %r8,%rbx
  sub    $0x68,%rsp
  movq   $0x0,(%rcx)
  mov    %rdi,0x20(%rsp)
  mov    %esi,0x4c(%rsp)
  mov    %rcx,0x50(%rsp)
  movq   $0x0,(%r8)
  movsd  %xmm0,0x40(%rsp)
  movsd  %xmm1,0x58(%rsp)
  test   %esi,%esi
  jle    L11
  movslq %esi,%rax
  add    $0x8,%rdi
  movapd %xmm2,%xmm3
  xor    %esi,%esi
  mov    %rax,0x38(%rsp)
  lea    0x0(,%rax,8),%r13
  lea    -0x1(%rdx),%eax
  movapd %xmm2,%xmm1
  movsd  D57(%rip),%xmm7
  mov    %eax,0x48(%rsp)
  lea    (%rdi,%rax,8),%r15
  mov    %rdi,0x30(%rsp)
  movsd  %xmm7,0x8(%rsp)
  nopw   0x0(%rax,%rax,1)
L132:
  mov    0x20(%rsp),%rax
  test   %ebp,%ebp
  jle    L231
  nopl   0x0(%rax)
L56:
  mov    (%rax),%rdx
  movsd  (%rdx,%rsi,1),%xmm0
  comisd %xmm2,%xmm0
  jbe    L218
  addsd  %xmm0,%xmm1
  addsd  0x8(%rsp),%xmm3
L218:
  add    $0x8,%rax
  cmp    %r15,%rax
  jne    L56
L231:
  add    $0x8,%rsi
  cmp    %r13,%rsi
  jne    L132
  divsd  %xmm3,%xmm1
  xor    %r12d,%r12d
  movsd  %xmm2,0x10(%rsp)
  movsd  %xmm1,0x28(%rsp)
  nopl   (%rax)
L26:
  mov    0x20(%rsp),%r14
  test   %ebp,%ebp
  jle    L30
  nopl   0x0(%rax)
L64:
  mov    (%r14),%rax
  movsd  (%rax,%r12,1),%xmm0
  comisd %xmm2,%xmm0
  jbe    L166
  subsd  0x28(%rsp),%xmm0
  mov    D47(%rip),%rax
  movsd  %xmm3,0x18(%rsp)
  movq   %rax,%xmm1
  call   <pow@plt>
  pxor   %xmm0,%xmm0
  movsd  0x18(%rsp),%xmm3
  pxor   %xmm2,%xmm2
  cvtsi2sd %rax,%xmm0
  addsd  0x10(%rsp),%xmm0
  movsd  %xmm0,0x10(%rsp)
L166:
  add    $0x8,%r14
  cmp    %r15,%r14
  jne    L64
L30:
  add    $0x8,%r12
  cmp    %r13,%r12
  jne    L26
  subsd  0x8(%rsp),%xmm3
  movsd  0x10(%rsp),%xmm0
  divsd  %xmm3,%xmm0
  ucomisd %xmm0,%xmm2
  ja     L188
L249:
  sqrtsd %xmm0,%xmm0
  movsd  0x28(%rsp),%xmm1
  movslq 0x4c(%rsp),%rax
  mulsd  0x40(%rsp),%xmm0
  subsd  %xmm0,%xmm1
  movsd  %xmm1,(%rbx)
  test   %eax,%eax
  jle    L6
  mov    %rax,0x38(%rsp)
  lea    -0x1(%rbp),%eax
  movsd  D57(%rip),%xmm7
  mov    %eax,0x48(%rsp)
  mov    0x20(%rsp),%rax
  movsd  %xmm7,0x8(%rsp)
  add    $0x8,%rax
  mov    %rax,0x30(%rsp)
L200:
  mov    0x38(%rsp),%r12
  mov    0x48(%rsp),%eax
  xor    %ecx,%ecx
  movapd %xmm2,%xmm3
  mov    0x30(%rsp),%rdi
  movapd %xmm2,%xmm4
  shl    $0x3,%r12
  lea    (%rdi,%rax,8),%r14
  nopl   0x0(%rax)
L69:
  mov    0x20(%rsp),%rax
  test   %ebp,%ebp
  jle    L107
  nopl   0x0(%rax)
L219:
  mov    (%rax),%rdx
  movsd  (%rdx,%rcx,1),%xmm0
  comisd %xmm2,%xmm0
  jbe    L57
  comisd %xmm0,%xmm1
  jb     L57
  addsd  %xmm0,%xmm4
  addsd  0x8(%rsp),%xmm3
L57:
  add    $0x8,%rax
  cmp    %rax,%r14
  jne    L219
L107:
  add    $0x8,%rcx
  cmp    %rcx,%r12
  jne    L69
  divsd  %xmm3,%xmm4
  xor    %r15d,%r15d
  movsd  %xmm2,0x10(%rsp)
  movsd  %xmm4,0x28(%rsp)
  nopl   0x0(%rax,%rax,1)
L94:
  mov    0x20(%rsp),%r13
  test   %ebp,%ebp
  jg     L247
  jmp    L118
  nopl   0x0(%rax,%rax,1)
L237:
  add    $0x8,%r13
  cmp    %r13,%r14
  je     L118
L247:
  mov    0x0(%r13),%rax
  movsd  (%rax,%r15,1),%xmm0
  comisd %xmm2,%xmm0
  jbe    L237
  movsd  (%rbx),%xmm1
  comisd %xmm0,%xmm1
  jb     L237
  subsd  0x28(%rsp),%xmm0
  mov    D47(%rip),%rax
  movsd  %xmm3,0x18(%rsp)
  add    $0x8,%r13
  movq   %rax,%xmm1
  call   <pow@plt>
  pxor   %xmm0,%xmm0
  movsd  0x18(%rsp),%xmm3
  pxor   %xmm2,%xmm2
  cvtsi2sd %rax,%xmm0
  addsd  0x10(%rsp),%xmm0
  movsd  %xmm0,0x10(%rsp)
  cmp    %r13,%r14
  jne    L247
  nopl   0x0(%rax,%rax,1)
L118:
  add    $0x8,%r15
  cmp    %r15,%r12
  jne    L94
  subsd  0x8(%rsp),%xmm3
  movsd  0x10(%rsp),%xmm0
  divsd  %xmm3,%xmm0
  ucomisd %xmm0,%xmm2
  ja     L51
L183:
  sqrtsd %xmm0,%xmm0
L32:
  mulsd  0x58(%rsp),%xmm0
  movsd  0x28(%rsp),%xmm1
  mov    0x50(%rsp),%rax
  subsd  %xmm0,%xmm1
  movsd  %xmm1,(%rax)
  add    $0x68,%rsp
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
L11:
  movapd %xmm2,%xmm7
  movsd  D42(%rip),%xmm0
  divsd  %xmm2,%xmm7
  movsd  %xmm7,0x28(%rsp)
  jmp    L249
L6:
  divsd  %xmm2,%xmm2
  movsd  D42(%rip),%xmm0
  movsd  %xmm2,0x28(%rsp)
  jmp    L183
L188:
  call   <sqrt@plt>
  mulsd  0x40(%rsp),%xmm0
  movsd  0x28(%rsp),%xmm1
  pxor   %xmm2,%xmm2
  subsd  %xmm0,%xmm1
  movsd  %xmm1,(%rbx)
  jmp    L200
L51:
  call   <sqrt@plt>
  jmp    L32
```

tool_calls: name: read_data
arguments: label: D57
data_type: f64
name: read_data
arguments: label: D47
data_type: f64
name: read_data
arguments: label: D42
data_type: f32[2]

tool: D57: 1

tool: D47: 2

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

assistant: ```c
void spotbounds(double **cdat, int naxis1, int naxis2, double *umb, double *pen, double umb_sig, double pen_sig) {
  double mean, stdev;
  double smean, sstdev;
  int i, j;
  double counter;
  counter = 0.0;
  mean = smean = 0.0;
  stdev = sstdev = 0.0;
  *umb = 0.0;
  *pen = 0.0;
  for (i = 0; i < naxis1; i++) {
    for (j = 0; j < naxis2; j++) {
      if (cdat[j][i] > 0) {
        mean += cdat[j][i];
        counter++;
      }
    }
  }
  mean /= counter;
  for (i = 0; i < naxis1; i++) {
    for (j = 0; j < naxis2; j++) {
      if (cdat[j][i] > 0) {
        stdev += pow(cdat[j][i] - mean, 2.0);
      }
    }
  }
  stdev = sqrt(stdev / (counter - 1.0));
  *pen = mean - umb_sig * stdev;
  counter = 0.0;
  for (i = 0; i < naxis1; i++) {
    for (j = 0; j < naxis2; j++) {
      if ((cdat[j][i] > 0) && (cdat[j][i] <= *pen)) {
        smean += cdat[j][i];
        counter++;
      }
    }
  }
  smean /= counter;
  for (i = 0; i < naxis1; i++) {
    for (j = 0; j < naxis2; j++) {
      if ((cdat[j][i] > 0) && (cdat[j][i] <= *pen)) {
        sstdev += pow(cdat[j][i] - smean, 2.0);
      }
    }
  }
  sstdev = sqrt(sstdev / (counter - 1.0));
  *umb = smean - pen_sig * sstdev;
  return;
}
```