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

```asm
<integrated_profile>:
  endbr64
  push   %r15
  mov    %edi,%eax
  push   %r14
  push   %r13
  push   %r12
  push   %rbp
  mov    %edx,%ebp
  push   %rbx
  mov    %esi,%ebx
  sub    $0x208,%rsp
  movsd  0x8(%rcx),%xmm6
  movsd  0x20(%rcx),%xmm5
  movsd  %xmm1,0x38(%rsp)
  cvttsd2si (%rcx),%r13d
  movsd  0x10(%rcx),%xmm1
  mov    0x240(%rsp),%rdi
  movsd  0x18(%rcx),%xmm4
  mov    %r8,0x40(%rsp)
  mov    %r9,0x48(%rsp)
  mov    %rdi,0x50(%rsp)
  movsd  %xmm0,0x30(%rsp)
  mov    %fs:0x28,%rdx
  mov    %rdx,0x1f8(%rsp)
  xor    %edx,%edx
  movsd  %xmm6,0x20(%rsp)
  movsd  0x28(%rcx),%xmm6
  movsd  %xmm5,0x8(%rsp)
  movsd  %xmm6,0x28(%rsp)
  test   %eax,%eax
  je     L132
  pxor   %xmm2,%xmm2
  cmp    $0x1,%eax
  je     L158
L204:
  mov    0x1f8(%rsp),%rax
  sub    %fs:0x28,%rax
  jne    L277
  add    $0x208,%rsp
  movapd %xmm2,%xmm0
  pop    %rbx
  pop    %rbp
  pop    %r12
  pop    %r13
  pop    %r14
  pop    %r15
  ret
  nop
L158:
  movsd  D255(%rip),%xmm0
  movsd  D361(%rip),%xmm3
  movapd %xmm1,%xmm5
  movapd %xmm4,%xmm10
  movsd  D98(%rip),%xmm8
  movsd  D57(%rip),%xmm7
  mulsd  %xmm4,%xmm10
  movq   $0x0,0x138(%rsp)
  movsd  %xmm0,0x1d0(%rsp)
  mulsd  %xmm1,%xmm5
  mov    D378(%rip),%rax
  movsd  D397(%rip),%xmm6
  movsd  %xmm0,0x1e8(%rsp)
  pxor   %xmm0,%xmm0
  movsd  %xmm3,0x1d8(%rsp)
  cvtsi2sd %ebp,%xmm0
  movsd  %xmm3,0x1e0(%rsp)
  pxor   %xmm3,%xmm3
  cvtsi2sd %esi,%xmm3
  mov    %rax,0x130(%rsp)
  mov    D372(%rip),%rax
  movq   $0x0,0x148(%rsp)
  subsd  %xmm8,%xmm0
  mov    %rax,0x140(%rsp)
  mov    D376(%rip),%rax
  movq   $0x0,0x1c8(%rsp)
  subsd  %xmm8,%xmm3
  mov    %rax,0x150(%rsp)
  mov    D350(%rip),%rax
  movsd  %xmm6,0x1b0(%rsp)
  movapd %xmm0,%xmm9
  addsd  %xmm7,%xmm9
  mov    %rax,0x158(%rsp)
  mov    D173(%rip),%rax
  movsd  %xmm6,0x1c0(%rsp)
  addsd  %xmm7,%xmm3
  mov    %rax,0x160(%rsp)
  mov    D392(%rip),%rax
  movsd  %xmm10,0x80(%rsp)
  movapd %xmm9,%xmm7
  movapd %xmm3,%xmm0
  mov    %rax,0x168(%rsp)
  mov    D257(%rip),%rax
  movsd  %xmm9,0x88(%rsp)
  mulsd  %xmm3,%xmm0
  mulsd  %xmm9,%xmm7
  mov    %rax,0x1b8(%rsp)
  divsd  %xmm5,%xmm0
  divsd  %xmm10,%xmm7
  addsd  %xmm7,%xmm0
  movapd %xmm9,%xmm7
  mulsd  %xmm3,%xmm7
  mulsd  0x8(%rsp),%xmm7
  addsd  %xmm7,%xmm0
  mulsd  D130(%rip),%xmm0
  addsd  D207(%rip),%xmm0
  comisd D82(%rip),%xmm0
  ja     L204
  mulsd  %xmm4,%xmm1
  mov    D176(%rip),%rax
  movsd  %xmm2,0x60(%rsp)
  movsd  %xmm3,0x18(%rsp)
  movsd  %xmm5,0x10(%rsp)
  movsd  %xmm1,0x58(%rsp)
  movq   %rax,%xmm1
  call   <pow@plt>
  mulsd  0x58(%rsp),%xmm0
  movsd  D207(%rip),%xmm1
  movsd  0x10(%rsp),%xmm5
  movsd  0x18(%rsp),%xmm3
  movsd  0x60(%rsp),%xmm2
  divsd  %xmm0,%xmm1
  comisd D285(%rip),%xmm1
  jae    L13
  comisd D44(%rip),%xmm1
  jae    L83
  movsd  D133(%rip),%xmm0
  mov    D397(%rip),%rax
  comisd %xmm0,%xmm1
  movq   %rax,%xmm6
  jae    L237
  comisd D393(%rip),%xmm1
  jb     L137
  movsd  D197(%rip),%xmm4
  movapd %xmm4,%xmm2
  mulsd  %xmm1,%xmm2
  jmp    L137
  nopl   0x0(%rax,%rax,1)
L132:
  pxor   %xmm2,%xmm2
  movsd  D57(%rip),%xmm0
  movsd  %xmm4,0x58(%rsp)
  cvtsi2sd %esi,%xmm2
  subsd  D98(%rip),%xmm2
  mulsd  D94(%rip),%xmm1
  addsd  %xmm2,%xmm0
  movsd  %xmm2,0x18(%rsp)
  movsd  %xmm1,0x10(%rsp)
  divsd  %xmm1,%xmm0
  call   <erf@plt>
  movsd  0x18(%rsp),%xmm2
  subsd  D57(%rip),%xmm2
  movsd  0x10(%rsp),%xmm1
  movq   %xmm0,%r15
  divsd  %xmm1,%xmm2
  movapd %xmm2,%xmm0
  call   <erf@plt>
  pxor   %xmm1,%xmm1
  movsd  D57(%rip),%xmm7
  movsd  0x58(%rsp),%xmm4
  cvtsi2sd %ebp,%xmm1
  subsd  D98(%rip),%xmm1
  mulsd  D94(%rip),%xmm4
  movsd  %xmm0,0x10(%rsp)
  addsd  %xmm1,%xmm7
  movsd  %xmm1,0x58(%rsp)
  movsd  %xmm4,0x18(%rsp)
  movapd %xmm7,%xmm0
  divsd  %xmm4,%xmm0
  call   <erf@plt>
  movsd  0x58(%rsp),%xmm1
  subsd  D57(%rip),%xmm1
  movsd  0x18(%rsp),%xmm4
  movq   %xmm0,%r14
  divsd  %xmm4,%xmm1
  movapd %xmm1,%xmm0
  call   <erf@plt>
  movsd  D57(%rip),%xmm2
  movq   %r15,%xmm4
  mov    %r13d,%eax
  mulsd  0x20(%rsp),%xmm2
  movapd %xmm0,%xmm1
  subsd  0x10(%rsp),%xmm4
  shr    $0x1f,%eax
  mulsd  D304(%rip),%xmm2
  movsd  D231(%rip),%xmm0
  add    %r13d,%eax
  sar    %eax
  lea    -0xf(%rax,%rbx,2),%edx
  mulsd  %xmm0,%xmm2
  mulsd  %xmm0,%xmm2
  movq   %r14,%xmm0
  subsd  %xmm1,%xmm0
  mulsd  %xmm4,%xmm2
  mulsd  %xmm0,%xmm2
  test   %edx,%edx
  js     L204
  cmp    %edx,%r13d
  jle    L204
  lea    -0xf(%rax,%rbp,2),%eax
  test   %eax,%eax
  js     L204
  cmp    %eax,%r13d
  jle    L204
  imul   %r13d,%eax
  add    %edx,%eax
L110:
  mov    0x48(%rsp),%rsi
  cltq
  movsd  0x30(%rsp),%xmm0
  subsd  0x28(%rsp),%xmm0
  movsd  0x38(%rsp),%xmm1
  mulsd  (%rsi,%rax,8),%xmm0
  mov    0x40(%rsp),%rsi
  subsd  0x8(%rsp),%xmm1
  addsd  (%rsi,%rax,8),%xmm0
  mov    0x50(%rsp),%rsi
  mulsd  (%rsi,%rax,8),%xmm1
  addsd  %xmm1,%xmm0
  addsd  %xmm0,%xmm2
  jmp    L204
  nopw   0x0(%rax,%rax,1)
L13:
  movsd  D133(%rip),%xmm0
  mov    $0x4,%r12d
L137:
  comisd %xmm0,%xmm1
  jae    L283
L160:
  mulsd  0x20(%rsp),%xmm2
  mov    %r13d,%eax
  shr    $0x1f,%eax
  add    %r13d,%eax
  sar    %eax
  lea    -0xf(%rax,%rbx,2),%edx
  test   %edx,%edx
  js     L204
  cmp    %edx,%r13d
  jle    L204
  lea    -0xf(%rax,%rbp,2),%eax
  test   %eax,%eax
  js     L204
  cmp    %eax,%r13d
  jle    L204
  imul   %eax,%r13d
  lea    0x0(%r13,%rdx,1),%eax
  jmp    L110
  nopl   (%rax)
L83:
  movsd  D133(%rip),%xmm0
  mov    $0x3,%r12d
  jmp    L137
L283:
  movslq %r12d,%rcx
  mov    %rcx,%rax
  shl    $0x5,%rax
  movsd  0x170(%rsp,%rax,1),%xmm7
  movsd  0xf0(%rsp,%rax,1),%xmm0
  movsd  %xmm7,0x90(%rsp)
L67:
  mov    %rcx,%rax
  movapd %xmm0,%xmm1
  mov    %r12d,%esi
  shl    $0x5,%rax
  lea    0xb0(%rsp),%r14
  lea    0xd0(%rsp),%r15
  mov    %rax,%rdi
  lea    0xf0(%rsp,%rax,1),%rdx
  xor    %eax,%eax
L124:
  addsd  %xmm3,%xmm1
  movsd  %xmm1,(%r14,%rax,8)
  mulsd  %xmm1,%xmm1
  divsd  %xmm5,%xmm1
  movsd  %xmm1,(%r15,%rax,8)
  add    $0x1,%rax
  cmp    %eax,%esi
  jle    L193
  movsd  (%rdx,%rax,8),%xmm1
  jmp    L124
  nopw   0x0(%rax,%rax,1)
L193:
  lea    -0x1(%r12),%eax
  movsd  D197(%rip),%xmm6
  movsd  0x90(%rsp),%xmm4
  mov    %ebp,0xac(%rsp)
  lea    (%rax,%rcx,4),%rax
  mov    %r12d,%esi
  mov    %r13d,0xa4(%rsp)
  mov    %rdi,%r12
  shl    $0x3,%rax
  mov    %ebx,0xa8(%rsp)
  mov    %esi,%ebx
  mov    %rax,0x98(%rsp)
  lea    0x170(%rsp,%rdi,1),%rax
  movsd  %xmm4,0x70(%rsp)
  mov    %rax,%r13
  movsd  %xmm6,0x78(%rsp)
L173:
  addsd  0x88(%rsp),%xmm0
  xor    %ebp,%ebp
  movsd  0x90(%rsp),%xmm3
  movsd  %xmm0,0x60(%rsp)
  mulsd  %xmm0,%xmm0
  divsd  0x80(%rsp),%xmm0
  movsd  %xmm0,0x68(%rsp)
L227:
  movsd  0x60(%rsp),%xmm1
  mulsd  (%r14,%rbp,8),%xmm1
  movsd  %xmm3,0x18(%rsp)
  mulsd  0x8(%rsp),%xmm1
  movsd  0x68(%rsp),%xmm0
  movsd  %xmm2,0x10(%rsp)
  addsd  (%r15,%rbp,8),%xmm0
  mov    D176(%rip),%rax
  add    $0x1,%rbp
  addsd  %xmm1,%xmm0
  mulsd  D130(%rip),%xmm0
  movq   %rax,%xmm1
  addsd  D207(%rip),%xmm0
  call   <pow@plt>
  mulsd  0x58(%rsp),%xmm0
  movsd  0x78(%rsp),%xmm1
  movsd  0x18(%rsp),%xmm3
  mulsd  0x70(%rsp),%xmm3
  movsd  0x10(%rsp),%xmm2
  divsd  %xmm0,%xmm1
  movapd %xmm3,%xmm0
  mulsd  %xmm1,%xmm0
  addsd  %xmm0,%xmm2
  cmp    %ebp,%ebx
  jle    L184
  movsd  0x0(%r13,%rbp,8),%xmm3
  jmp    L227
  nopl   0x0(%rax)
L184:
  cmp    %r12,0x98(%rsp)
  je     L194
  movsd  0x178(%rsp,%r12,1),%xmm6
  movsd  0xf8(%rsp,%r12,1),%xmm0
  add    $0x8,%r12
  movsd  %xmm6,0x70(%rsp)
  jmp    L173
  nopl   (%rax)
L194:
  mov    0xa4(%rsp),%r13d
  mov    0xa8(%rsp),%ebx
  mov    0xac(%rsp),%ebp
  jmp    L160
  nopl   0x0(%rax,%rax,1)
L237:
  mov    D378(%rip),%rax
  mov    $0x2,%r12d
  mov    $0x2,%ecx
  movsd  %xmm6,0x90(%rsp)
  movq   %rax,%xmm0
  jmp    L67
L277:
  call   <__stack_chk_fail@plt>
```

tool_calls: name: unpack_data
arguments: data_tag: D255
type_infered: f64
name: unpack_data
arguments: data_tag: D361
type_infered: f64
name: unpack_data
arguments: data_tag: D98
type_infered: f64
name: unpack_data
arguments: data_tag: D57
type_infered: f64
name: unpack_data
arguments: data_tag: D378
type_infered: byte[8]
name: unpack_data
arguments: data_tag: D397
type_infered: f64
name: unpack_data
arguments: data_tag: D372
type_infered: f64
name: unpack_data
arguments: data_tag: D376
type_infered: byte[8]
name: unpack_data
arguments: data_tag: D350
type_infered: byte[8]
name: unpack_data
arguments: data_tag: D173
type_infered: f64
name: unpack_data
arguments: data_tag: D392
type_infered: f64
name: unpack_data
arguments: data_tag: D257
type_infered: f64
name: unpack_data
arguments: data_tag: D130
type_infered: f64
name: unpack_data
arguments: data_tag: D207
type_infered: f64
name: unpack_data
arguments: data_tag: D82
type_infered: f64[2]
name: unpack_data
arguments: data_tag: D176
type_infered: f64
name: unpack_data
arguments: data_tag: D285
type_infered: f64[2]
name: unpack_data
arguments: data_tag: D44
type_infered: f64[2]
name: unpack_data
arguments: data_tag: D133
type_infered: f64
name: unpack_data
arguments: data_tag: D393
type_infered: byte[16]
name: unpack_data
arguments: data_tag: D197
type_infered: f32[2]
name: unpack_data
arguments: data_tag: D94
type_infered: f64
name: unpack_data
arguments: data_tag: D304
type_infered: f64
name: unpack_data
arguments: data_tag: D231
type_infered: f64

tool: D255: 0.17392742

tool: D361: 0.32607258

tool: D98: 7.5

tool: D57: 0.5

tool: {"D378": [0x7e,0x4e,0x49,0xef,0x7e,0xc9,0xd8,0xbf]}

tool: D397: 0.27777778

tool: D372: 0.38729833

tool: {"D376": [0x80,0x87,0x79,0xc1,0x6d,0x8e,0xdb,0xbf]}

tool: {"D350": [0x27,0xd8,0x03,0xd6,0x3f,0xc2,0xc5,0xbf]}

tool: D173: 0.16999052

tool: D392: 0.43056816

tool: D257: 0.44444444

tool: D130: 0.3195079

tool: D207: 1

tool: {"D82": [10000.0,2.5]}

tool: D176: 2.5

tool: {"D285": [0.046,0.0022]}

tool: {"D44": [0.0022,0.0001]}

tool: D133: 0.0001

tool: {"D393": [0xbb,0xbd,0xd7,0xd9,0xdf,0x7c,0xdb,0x3d,0x00,0x00,0x00,0x00,0x00,0x00,0xf8,0x3f]}

tool: {"D197": [0.0,1.9375]}

tool: D94: 1.41421356

tool: D304: 3.14159265

tool: D231: 0.8493218

assistant: ```c
double integrated_profile(int profile_type, int idx, int idy, double xpos, double ypos, double *psf_parameters, double *lut_0, double *lut_xd, double *lut_yd) {
  int psf_size;
  double psf_height, psf_sigma_x, psf_sigma_y, psf_xpos, psf_ypos;
  double p0;
  int ip, jp;
  double pi = 3.14159265, fwtosig = 0.8493218;
  psf_size = (int)psf_parameters[0];
  psf_height = psf_parameters[1];
  psf_sigma_x = psf_parameters[2];
  psf_sigma_y = psf_parameters[3];
  psf_ypos = psf_parameters[4];
  psf_xpos = psf_parameters[5];
  if (profile_type == 0) {
    p0 = 0.5 * psf_height * pi * fwtosig * fwtosig * (erf((idx - 7.5 + 0.5) / (1.41421356 * psf_sigma_x)) - erf((idx - 7.5 - 0.5) / (1.41421356 * psf_sigma_x))) * (erf((idy - 7.5 + 0.5) / (1.41421356 * psf_sigma_y)) - erf((idy - 7.5 - 0.5) / (1.41421356 * psf_sigma_y)));
    ip = psf_size / 2 + 2 * idx - 15;
    jp = psf_size / 2 + 2 * idy - 15;
    if ((ip >= 0) && (ip <= psf_size - 1) && (jp >= 0) && (jp <= psf_size - 1)) {
      p0 += lut_0[ip + psf_size * jp] + lut_xd[ip + psf_size * jp] * (xpos - psf_xpos) + lut_yd[ip + psf_size * jp] * (ypos - psf_ypos);
    }
    return p0;
  } else if (profile_type == 1) {
    double d[4][4] = {{0.0, 0.0, 0.0, 0.0}, {-0.28867513, 0.28867513, 0.0, 0.0}, {-0.38729833, 0.0, 0.38729833, 0.0}, {-0.43056816, -0.16999052, 0.16999052, 0.43056816}};
    double w[4][4] = {{1.0, 0.0, 0.0, 0.0}, {0.5, 0.5, 0.0, 0.0}, {0.27777778, 0.44444444, 0.27777778, 0.0}, {0.17392742, 0.32607258, 0.32607258, 0.17392742}};
    double alpha = 0.3195079;
    double p1sq, p2sq, p1p2, dx, dy, xy, denom, func, x[4], xsq[4], p1xsq[4];
    double y, ysq, p2ysq, wt, p4fod, wp4fod, wf;
    int npt, ix, iy;
    p1sq = psf_parameters[2] * psf_parameters[2];
    p2sq = psf_parameters[3] * psf_parameters[3];
    p1p2 = psf_parameters[2] * psf_parameters[3];
    dx = idx - 7.5 + 0.5;
    dy = idy - 7.5 + 0.5;
    xy = dx * dy;
    denom = 1.0 + alpha * (dx * dx / p1sq + dy * dy / p2sq + xy * psf_parameters[4]);
    if (denom > 1.0e4) {
      return 0.0;
    }
    p0 = 0.0;
    func = 1.0 / (p1p2 * pow(denom, 2.5));
    if (func >= 0.046) {
      npt = 4;
    } else if (func >= 0.0022) {
      npt = 3;
    } else if (func >= 0.0001) {
      npt = 2;
    } else if (func >= 1.0e-10) {
      p0 = (2.5 - 1.0) * func;
    }
    if (func >= 0.0001) {
      for (ix = 0; ix < npt; ix++) {
        x[ix] = dx + d[npt][ix];
        xsq[ix] = x[ix] * x[ix];
        p1xsq[ix] = xsq[ix] / p1sq;
      }
      for (iy = 0; iy < npt; iy++) {
        y = dy + d[npt][iy];
        ysq = y * y;
        p2ysq = ysq / p2sq;
        for (ix = 0; ix < npt; ix++) {
          wt = w[npt][iy] * w[npt][ix];
          xy = x[ix] * y;
          denom = 1.0 + alpha * (p1xsq[ix] + p2ysq + xy * psf_parameters[4]);
          func = (2.5 - 1.0) / (p1p2 * pow(denom, 2.5));
          p4fod = 2.5 * alpha * func / denom;
          wp4fod = wt * p4fod;
          wf = wt * func;
          p0 += wf;
        }
      }
    }
    p0 *= psf_parameters[1];
    ip = psf_size / 2 + 2 * idx - 15;
    jp = psf_size / 2 + 2 * idy - 15;
    if ((ip >= 0) && (ip <= psf_size - 1) && (jp >= 0) && (jp <= psf_size - 1)) {
      p0 += lut_0[ip + psf_size * jp] + lut_xd[ip + psf_size * jp] * (xpos - psf_xpos) + lut_yd[ip + psf_size * jp] * (ypos - psf_ypos);
    }
    return p0;
  } else {
    return 0.0;
  }
}
```