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

```asm
<gauss_fit>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  sub    $0xc0,%rsp
  mov    %rdi,-0x98(%rbp)
  mov    %esi,-0x9c(%rbp)
  mov    %rdx,-0xa8(%rbp)
  mov    %rcx,-0xb0(%rbp)
  mov    %r8,-0xb8(%rbp)
  mov    %fs:0x28,%rax
  mov    %rax,-0x8(%rbp)
  xor    %eax,%eax
  movsd  D96(%rip),%xmm0
  movsd  %xmm0,-0x40(%rbp)
  movsd  D23(%rip),%xmm0
  movsd  %xmm0,-0x38(%rbp)
  movsd  D82(%rip),%xmm0
  movsd  %xmm0,-0x30(%rbp)
  movsd  D23(%rip),%xmm0
  movsd  %xmm0,-0x20(%rbp)
  movsd  D23(%rip),%xmm0
  movsd  %xmm0,-0x18(%rbp)
  movsd  D23(%rip),%xmm0
  movsd  %xmm0,-0x10(%rbp)
  movl   $0xc8,-0x80(%rbp)
  mov    -0xa8(%rbp),%rax
  movss  (%rax),%xmm0
  cvtss2sd %xmm0,%xmm0
  movsd  %xmm0,-0x60(%rbp)
  mov    -0xb0(%rbp),%rax
  movss  (%rax),%xmm0
  cvtss2sd %xmm0,%xmm0
  movsd  %xmm0,-0x58(%rbp)
  mov    -0xb8(%rbp),%rax
  movss  (%rax),%xmm0
  cvtss2sd %xmm0,%xmm0
  movsd  %xmm0,-0x50(%rbp)
L160:
  movsd  -0x50(%rbp),%xmm1
  movsd  -0x58(%rbp),%xmm0
  mov    -0x60(%rbp),%rsi
  mov    -0x9c(%rbp),%ecx
  mov    -0x98(%rbp),%rax
  mov    $0x3,%edx
  movapd %xmm1,%xmm2
  movapd %xmm0,%xmm1
  movq   %rsi,%xmm0
  mov    %ecx,%esi
  mov    %rax,%rdi
  call   <gauss_gradients@plt>
  movq   %xmm0,%rax
  mov    %rax,-0x68(%rbp)
  movsd  D100(%rip),%xmm0
  comisd -0x68(%rbp),%xmm0
  jbe    L77
  mov    $0x0,%eax
  jmp    L240
L77:
  movl   $0x0,-0x88(%rbp)
  jmp    L2
L301:
  movsd  -0x50(%rbp),%xmm1
  movsd  -0x58(%rbp),%xmm0
  mov    -0x60(%rbp),%rsi
  mov    -0x88(%rbp),%edx
  mov    -0x9c(%rbp),%ecx
  mov    -0x98(%rbp),%rax
  movapd %xmm1,%xmm2
  movapd %xmm0,%xmm1
  movq   %rsi,%xmm0
  mov    %ecx,%esi
  mov    %rax,%rdi
  call   <gauss_gradients@plt>
  movq   %xmm0,%rax
  mov    %rax,-0x70(%rbp)
  movsd  D100(%rip),%xmm0
  comisd -0x70(%rbp),%xmm0
  jbe    L29
  mov    $0x0,%eax
  jmp    L240
L29:
  pxor   %xmm0,%xmm0
  ucomisd -0x70(%rbp),%xmm0
  jp     L19
  pxor   %xmm0,%xmm0
  ucomisd -0x70(%rbp),%xmm0
  je     L230
L19:
  movsd  -0x70(%rbp),%xmm0
  pxor   %xmm1,%xmm1
  comisd %xmm1,%xmm0
  jbe    L76
  movl   $0x1,-0x8c(%rbp)
  mov    -0x88(%rbp),%eax
  cltq
  movsd  -0x40(%rbp,%rax,8),%xmm0
  movq   D90(%rip),%xmm1
  xorpd  %xmm1,%xmm0
  movsd  %xmm0,-0x78(%rbp)
  jmp    L89
L76:
  movl   $0xffffffff,-0x8c(%rbp)
  mov    -0x88(%rbp),%eax
  cltq
  movsd  -0x40(%rbp,%rax,8),%xmm0
  movsd  %xmm0,-0x78(%rbp)
  jmp    L89
L26:
  mov    -0x8c(%rbp),%eax
  mov    %eax,-0x7c(%rbp)
  jmp    L302
L297:
  mov    -0x88(%rbp),%eax
  cltq
  movsd  -0x60(%rbp,%rax,8),%xmm0
  addsd  -0x78(%rbp),%xmm0
  mov    -0x88(%rbp),%eax
  cltq
  movsd  %xmm0,-0x60(%rbp,%rax,8)
  movsd  -0x50(%rbp),%xmm1
  movsd  -0x58(%rbp),%xmm0
  mov    -0x60(%rbp),%rsi
  mov    -0x88(%rbp),%edx
  mov    -0x9c(%rbp),%ecx
  mov    -0x98(%rbp),%rax
  movapd %xmm1,%xmm2
  movapd %xmm0,%xmm1
  movq   %rsi,%xmm0
  mov    %ecx,%esi
  mov    %rax,%rdi
  call   <gauss_gradients@plt>
  movq   %xmm0,%rax
  mov    %rax,-0x70(%rbp)
  movsd  D100(%rip),%xmm0
  comisd -0x70(%rbp),%xmm0
  jbe    L24
  mov    $0x0,%eax
  jmp    L240
L24:
  pxor   %xmm0,%xmm0
  ucomisd -0x70(%rbp),%xmm0
  jp     L309
  pxor   %xmm0,%xmm0
  ucomisd -0x70(%rbp),%xmm0
  je     L200
L309:
  movsd  -0x70(%rbp),%xmm0
  pxor   %xmm1,%xmm1
  comisd %xmm1,%xmm0
  jbe    L184
  movl   $0x1,-0x8c(%rbp)
  jmp    L302
L184:
  movl   $0xffffffff,-0x8c(%rbp)
L302:
  mov    -0x8c(%rbp),%eax
  cmp    -0x7c(%rbp),%eax
  je     L297
  jmp    L313
L200:
  nop
L313:
  movsd  -0x78(%rbp),%xmm1
  movsd  D28(%rip),%xmm0
  mulsd  %xmm1,%xmm0
  movsd  %xmm0,-0x78(%rbp)
L89:
  movsd  -0x70(%rbp),%xmm0
  cvttsd2si %xmm0,%eax
  mov    %eax,%edi
  call   <fabs@plt>
  movq   %xmm0,%rax
  mov    -0x88(%rbp),%edx
  movslq %edx,%rdx
  movsd  -0x20(%rbp,%rdx,8),%xmm0
  movq   %rax,%xmm4
  comisd %xmm0,%xmm4
  ja     L26
  addl   $0x1,-0x88(%rbp)
L2:
  cmpl   $0x2,-0x88(%rbp)
  jle    L301
  jmp    L273
L230:
  nop
L273:
  movsd  -0x50(%rbp),%xmm1
  movsd  -0x58(%rbp),%xmm0
  mov    -0x60(%rbp),%rsi
  mov    -0x9c(%rbp),%ecx
  mov    -0x98(%rbp),%rax
  mov    $0x0,%edx
  movapd %xmm1,%xmm2
  movapd %xmm0,%xmm1
  movq   %rsi,%xmm0
  mov    %ecx,%esi
  mov    %rax,%rdi
  call   <gauss_gradients@plt>
  movsd  -0x20(%rbp),%xmm1
  comisd %xmm0,%xmm1
  seta   %al
  movzbl %al,%eax
  mov    %eax,%edi
  call   <fabs@plt>
  movq   %xmm0,%rax
  pxor   %xmm0,%xmm0
  movq   %rax,%xmm5
  ucomisd %xmm0,%xmm5
  jp     L276
  pxor   %xmm0,%xmm0
  movq   %rax,%xmm6
  ucomisd %xmm0,%xmm6
  je     L135
L276:
  movsd  -0x50(%rbp),%xmm1
  movsd  -0x58(%rbp),%xmm0
  mov    -0x60(%rbp),%rsi
  mov    -0x9c(%rbp),%ecx
  mov    -0x98(%rbp),%rax
  mov    $0x1,%edx
  movapd %xmm1,%xmm2
  movapd %xmm0,%xmm1
  movq   %rsi,%xmm0
  mov    %ecx,%esi
  mov    %rax,%rdi
  call   <gauss_gradients@plt>
  movsd  -0x18(%rbp),%xmm1
  comisd %xmm0,%xmm1
  seta   %al
  movzbl %al,%eax
  mov    %eax,%edi
  call   <fabs@plt>
  movq   %xmm0,%rax
  pxor   %xmm0,%xmm0
  movq   %rax,%xmm7
  ucomisd %xmm0,%xmm7
  jp     L172
  pxor   %xmm0,%xmm0
  movq   %rax,%xmm3
  ucomisd %xmm0,%xmm3
  je     L135
L172:
  movsd  -0x50(%rbp),%xmm1
  movsd  -0x58(%rbp),%xmm0
  mov    -0x60(%rbp),%rsi
  mov    -0x9c(%rbp),%ecx
  mov    -0x98(%rbp),%rax
  mov    $0x2,%edx
  movapd %xmm1,%xmm2
  movapd %xmm0,%xmm1
  movq   %rsi,%xmm0
  mov    %ecx,%esi
  mov    %rax,%rdi
  call   <gauss_gradients@plt>
  movsd  -0x10(%rbp),%xmm1
  comisd %xmm0,%xmm1
  seta   %al
  movzbl %al,%eax
  mov    %eax,%edi
  call   <fabs@plt>
  movq   %xmm0,%rax
  pxor   %xmm0,%xmm0
  movq   %rax,%xmm4
  ucomisd %xmm0,%xmm4
  jp     L59
  pxor   %xmm0,%xmm0
  movq   %rax,%xmm5
  ucomisd %xmm0,%xmm5
  je     L135
L59:
  movl   $0x1,-0x84(%rbp)
  jmp    L39
L135:
  movl   $0x0,-0x84(%rbp)
L39:
  subl   $0x1,-0x80(%rbp)
  cmpl   $0x0,-0x80(%rbp)
  jne    L176
  lea    D101(%rip),%rax
  mov    %rax,%rdi
  call   <puts@plt>
  mov    $0x0,%eax
  jmp    L240
L176:
  cmpl   $0x0,-0x84(%rbp)
  je     L160
  movsd  -0x50(%rbp),%xmm1
  movsd  -0x58(%rbp),%xmm0
  mov    -0x60(%rbp),%rsi
  mov    -0x9c(%rbp),%ecx
  mov    -0x98(%rbp),%rax
  mov    $0x3,%edx
  movapd %xmm1,%xmm2
  movapd %xmm0,%xmm1
  movq   %rsi,%xmm0
  mov    %ecx,%esi
  mov    %rax,%rdi
  call   <gauss_gradients@plt>
  movq   %xmm0,%rax
  mov    %rax,-0x68(%rbp)
  movsd  -0x50(%rbp),%xmm1
  movsd  -0x58(%rbp),%xmm0
  mov    -0x60(%rbp),%rax
  movsd  -0x68(%rbp),%xmm2
  movapd %xmm2,%xmm3
  movapd %xmm1,%xmm2
  movapd %xmm0,%xmm1
  movq   %rax,%xmm0
  lea    D70(%rip),%rax
  mov    %rax,%rdi
  mov    $0x4,%eax
  call   <printf@plt>
  movsd  -0x60(%rbp),%xmm0
  cvtsd2ss %xmm0,%xmm0
  mov    -0xa8(%rbp),%rax
  movss  %xmm0,(%rax)
  movsd  -0x58(%rbp),%xmm0
  cvtsd2ss %xmm0,%xmm0
  mov    -0xb0(%rbp),%rax
  movss  %xmm0,(%rax)
  movsd  -0x50(%rbp),%xmm0
  cvtsd2ss %xmm0,%xmm0
  mov    -0xb8(%rbp),%rax
  movss  %xmm0,(%rax)
  mov    $0x1,%eax
L240:
  mov    -0x8(%rbp),%rdx
  sub    %fs:0x28,%rdx
  je     L223
  call   <__stack_chk_fail@plt>
L223:
  leave
  ret
```

tool_calls: name: read_data
arguments: data_label: D96
type_guessed: f64
name: read_data
arguments: data_label: D23
type_guessed: f64
name: read_data
arguments: data_label: D82
type_guessed: f32[2]
name: read_data
arguments: data_label: D100
type_guessed: byte[8]
name: read_data
arguments: data_label: D90
type_guessed: f32[2]
name: read_data
arguments: data_label: D28
type_guessed: f32[2]
name: read_data
arguments: data_label: D101
type_guessed: string
name: read_data
arguments: data_label: D70
type_guessed: string

tool: D96: 5

tool: D23: 1

tool: {"D82": [0.0,1.75]}

tool: {"D100": [0x40,0x8c,0xb5,0x78,0x1d,0xaf,0x15,0xc4]}

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

tool: {"D28": [0.0,-1.75]}

tool: D101: Fit taking too long.

tool: D70: Final Params: mu=%e, sig=%e, scale=%e (S=%e)


assistant: ```c
int gauss_fit(float *y, int n_points, float *mu_fit, float *sig_fit, float *scale_fit) {
  double x[3];
  double dx[] = {5.0, 1.0, .5};
  double smallest_grad[] = {1.0, 1.0, 1.0};
  double step, grad;
  double s;
  int old_direction, new_direction;
  int i, j;
  int count_down = 200;
  x[0] = (double)(*mu_fit);
  x[1] = (double)(*sig_fit);
  x[2] = (double)(*scale_fit);
  do {
    s = gauss_gradients(y, n_points, x[0], x[1], x[2], 3);
    if (s < -1.0e20) {
      return 0;
    }
    for (i = 0; i < 3; i++) {
      grad = gauss_gradients(y, n_points, x[0], x[1], x[2], i);
      if (grad < -1.0e20) {
        return 0;
      }
      if (grad == 0.0) {
        break;
      } else if (grad > 0.0) {
        new_direction = 1;
        step = -dx[i];
      } else {
        new_direction = -1;
        step = dx[i];
      }
      while (fabs(grad) > smallest_grad[i]) {
        old_direction = new_direction;
        while (new_direction == old_direction) {
          x[i] += step;
          grad = gauss_gradients(y, n_points, x[0], x[1], x[2], i);
          if (grad < -1.0e20) {
            return 0;
          }
          if (grad == 0.0) {
            break;
          } else if (grad > 0.0) {
            new_direction = 1;
          } else {
            new_direction = -1;
          }
        }
        step *= (-.5);
      }
    }
    if ((fabs(gauss_gradients(y, n_points, x[0], x[1], x[2], 0) < smallest_grad[0])) && (fabs(gauss_gradients(y, n_points, x[0], x[1], x[2], 1) < smallest_grad[1])) && (fabs(gauss_gradients(y, n_points, x[0], x[1], x[2], 2) < smallest_grad[2]))) {
      j = 1;
    } else {
      j = 0;
    }
    count_down--;
    if (count_down == 0) {
      printf("Fit taking too long.\n");
      return 0;
    }
  } while (j == 0);
  s = gauss_gradients(y, n_points, x[0], x[1], x[2], 3);
  printf("Final Params: mu=%e, sig=%e, scale=%e (S=%e)\n", x[0], x[1], x[2], s);
  (*mu_fit) = (float)x[0];
  (*sig_fit) = (float)x[1];
  (*scale_fit) = (float)x[2];
  return 1;
}
```