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

```asm
<c_chapman>:
  endbr64
  push   %rbp
  mov    %rsp,%rbp
  push   %r13
  push   %r12
  push   %rbx
  sub    $0xa8,%rsp
  mov    %edi,-0x84(%rbp)
  movsd  %xmm0,-0x90(%rbp)
  mov    %rsi,-0x98(%rbp)
  mov    %edx,-0x88(%rbp)
  mov    %rcx,-0xa0(%rbp)
  mov    %r8,-0xa8(%rbp)
  movsd  %xmm1,-0xb0(%rbp)
  movsd  %xmm2,-0xb8(%rbp)
  movsd  -0xb0(%rbp),%xmm1
  movsd  D57(%rip),%xmm0
  mulsd  %xmm1,%xmm0
  movsd  %xmm0,-0x50(%rbp)
  mov    -0x84(%rbp),%eax
  cltq
  lea    0x0(,%rax,8),%rdx
  mov    -0xa0(%rbp),%rax
  add    %rdx,%rax
  movsd  (%rax),%xmm0
  movapd %xmm0,%xmm1
  addsd  -0xb8(%rbp),%xmm1
  mov    -0x84(%rbp),%eax
  cltq
  shl    $0x3,%rax
  lea    -0x8(%rax),%rdx
  mov    -0xa0(%rbp),%rax
  add    %rdx,%rax
  movsd  (%rax),%xmm0
  mov    -0x84(%rbp),%eax
  cltq
  lea    0x0(,%rax,8),%rdx
  mov    -0xa0(%rbp),%rax
  add    %rdx,%rax
  movsd  (%rax),%xmm2
  subsd  %xmm2,%xmm0
  mulsd  -0x90(%rbp),%xmm0
  addsd  %xmm1,%xmm0
  movsd  %xmm0,-0x48(%rbp)
  mov    -0x50(%rbp),%rax
  movq   %rax,%xmm0
  call   <sin@plt>
  movsd  -0x48(%rbp),%xmm1
  mulsd  %xmm1,%xmm0
  movsd  %xmm0,-0x40(%rbp)
  movsd  -0xb0(%rbp),%xmm0
  comisd D10(%rip),%xmm0
  jbe    L63
  movsd  -0xb8(%rbp),%xmm0
  comisd -0x40(%rbp),%xmm0
  jbe    L63
  movsd  D85(%rip),%xmm0
  jmp    L127
L63:
  mov    -0x84(%rbp),%r12d
  movsd  -0xb0(%rbp),%xmm0
  comisd D10(%rip),%xmm0
  jbe    L52
  mov    -0x84(%rbp),%ebx
  jmp    L161
L17:
  movslq %ebx,%rax
  shl    $0x3,%rax
  lea    -0x8(%rax),%rdx
  mov    -0xa0(%rbp),%rax
  add    %rdx,%rax
  movsd  (%rax),%xmm0
  addsd  -0xb8(%rbp),%xmm0
  comisd -0x40(%rbp),%xmm0
  jbe    L174
  movslq %ebx,%rax
  lea    0x0(,%rax,8),%rdx
  mov    -0xa0(%rbp),%rax
  add    %rdx,%rax
  movsd  (%rax),%xmm0
  movapd %xmm0,%xmm1
  addsd  -0xb8(%rbp),%xmm1
  movsd  -0x40(%rbp),%xmm0
  comisd %xmm1,%xmm0
  jb     L174
  mov    %ebx,%r12d
L174:
  add    $0x1,%ebx
L161:
  cmp    -0x88(%rbp),%ebx
  jle    L17
L52:
  pxor   %xmm0,%xmm0
  movsd  %xmm0,-0x78(%rbp)
  mov    $0x1,%ebx
  jmp    L175
L5:
  movsd  D33(%rip),%xmm0
  movsd  %xmm0,-0x70(%rbp)
  movsd  D33(%rip),%xmm0
  movsd  %xmm0,-0x68(%rbp)
  cmp    -0x84(%rbp),%ebx
  jle    L60
  movsd  D17(%rip),%xmm0
  movsd  %xmm0,-0x70(%rbp)
  jmp    L105
L60:
  cmp    -0x84(%rbp),%ebx
  jne    L105
  cmp    %r12d,-0x84(%rbp)
  jne    L105
  movsd  -0xb0(%rbp),%xmm0
  comisd D10(%rip),%xmm0
  jbe    L105
  movsd  D52(%rip),%xmm0
  movsd  %xmm0,-0x68(%rbp)
L105:
  movslq %ebx,%rax
  shl    $0x3,%rax
  lea    -0x8(%rax),%rdx
  mov    -0xa0(%rbp),%rax
  add    %rdx,%rax
  movsd  (%rax),%xmm0
  movsd  -0xb8(%rbp),%xmm1
  addsd  %xmm1,%xmm0
  movsd  %xmm0,-0x28(%rbp)
  movslq %ebx,%rax
  lea    0x0(,%rax,8),%rdx
  mov    -0xa0(%rbp),%rax
  add    %rdx,%rax
  movsd  (%rax),%xmm0
  movsd  -0xb8(%rbp),%xmm1
  addsd  %xmm1,%xmm0
  movsd  %xmm0,-0x60(%rbp)
  cmp    -0x84(%rbp),%ebx
  jne    L206
  cmp    -0x84(%rbp),%r12d
  jne    L206
  movsd  -0x48(%rbp),%xmm0
  movsd  %xmm0,-0x60(%rbp)
L206:
  movslq %ebx,%rax
  shl    $0x3,%rax
  lea    -0x8(%rax),%rdx
  mov    -0xa0(%rbp),%rax
  add    %rdx,%rax
  movsd  (%rax),%xmm0
  movslq %ebx,%rax
  lea    0x0(,%rax,8),%rdx
  mov    -0xa0(%rbp),%rax
  add    %rdx,%rax
  movsd  (%rax),%xmm1
  subsd  %xmm1,%xmm0
  movsd  %xmm0,-0x38(%rbp)
  cmp    -0x84(%rbp),%r12d
  jle    L88
  cmp    %r12d,%ebx
  jne    L88
  movsd  -0x28(%rbp),%xmm0
  movapd %xmm0,%xmm1
  mulsd  %xmm0,%xmm1
  movsd  -0x40(%rbp),%xmm0
  mulsd  %xmm0,%xmm0
  subsd  %xmm0,%xmm1
  movq   %xmm1,%rax
  movq   %rax,%xmm0
  call   <sqrt@plt>
  movq   %xmm0,%rax
  mov    %rax,-0x58(%rbp)
  jmp    L0
L88:
  movsd  -0x28(%rbp),%xmm0
  movapd %xmm0,%xmm1
  mulsd  %xmm0,%xmm1
  movsd  -0x40(%rbp),%xmm0
  mulsd  %xmm0,%xmm0
  subsd  %xmm0,%xmm1
  movq   %xmm1,%rax
  movq   %rax,%xmm0
  call   <sqrt@plt>
  movq   %xmm0,%r13
  movsd  -0x60(%rbp),%xmm0
  movapd %xmm0,%xmm1
  mulsd  %xmm0,%xmm1
  movsd  -0x40(%rbp),%xmm0
  mulsd  %xmm0,%xmm0
  subsd  %xmm0,%xmm1
  movq   %xmm1,%rax
  movq   %rax,%xmm0
  call   <sqrt@plt>
  movq   %xmm0,%rax
  movq   %rax,%xmm1
  mulsd  -0x68(%rbp),%xmm1
  movq   %r13,%xmm0
  subsd  %xmm1,%xmm0
  movsd  %xmm0,-0x58(%rbp)
L0:
  movslq %ebx,%rax
  shl    $0x3,%rax
  lea    -0x8(%rax),%rdx
  mov    -0xa8(%rbp),%rax
  add    %rdx,%rax
  movsd  (%rax),%xmm0
  mulsd  -0x70(%rbp),%xmm0
  mulsd  -0x58(%rbp),%xmm0
  divsd  -0x38(%rbp),%xmm0
  movsd  -0x78(%rbp),%xmm1
  addsd  %xmm1,%xmm0
  movsd  %xmm0,-0x78(%rbp)
  add    $0x1,%ebx
L175:
  cmp    %r12d,%ebx
  jle    L5
  cmp    -0x84(%rbp),%r12d
  jle    L133
  mov    -0x84(%rbp),%eax
  cltq
  shl    $0x3,%rax
  lea    -0x8(%rax),%rdx
  mov    -0xa0(%rbp),%rax
  add    %rdx,%rax
  movsd  (%rax),%xmm0
  mov    -0x84(%rbp),%eax
  cltq
  lea    0x0(,%rax,8),%rdx
  mov    -0xa0(%rbp),%rax
  add    %rdx,%rax
  movsd  (%rax),%xmm1
  subsd  %xmm1,%xmm0
  movsd  %xmm0,-0x38(%rbp)
  movsd  -0x48(%rbp),%xmm0
  movapd %xmm0,%xmm1
  mulsd  %xmm0,%xmm1
  movsd  -0x40(%rbp),%xmm0
  mulsd  %xmm0,%xmm0
  subsd  %xmm0,%xmm1
  movq   %xmm1,%rax
  movq   %rax,%xmm0
  call   <sqrt@plt>
  movq   %xmm0,%rbx
  mov    -0x84(%rbp),%eax
  cltq
  lea    0x0(,%rax,8),%rdx
  mov    -0xa0(%rbp),%rax
  add    %rdx,%rax
  movsd  (%rax),%xmm0
  movsd  -0xb8(%rbp),%xmm1
  addsd  %xmm1,%xmm0
  movsd  %xmm0,-0x30(%rbp)
  movsd  -0x30(%rbp),%xmm0
  movapd %xmm0,%xmm1
  mulsd  %xmm0,%xmm1
  movsd  -0x40(%rbp),%xmm0
  mulsd  %xmm0,%xmm0
  subsd  %xmm0,%xmm1
  movq   %xmm1,%rax
  movq   %rax,%xmm0
  call   <sqrt@plt>
  movapd %xmm0,%xmm1
  movq   %rbx,%xmm0
  subsd  %xmm1,%xmm0
  movsd  %xmm0,-0x58(%rbp)
  mov    -0x84(%rbp),%eax
  cltq
  shl    $0x3,%rax
  lea    -0x8(%rax),%rdx
  mov    -0xa8(%rbp),%rax
  add    %rdx,%rax
  movsd  (%rax),%xmm0
  mulsd  -0x58(%rbp),%xmm0
  divsd  -0x38(%rbp),%xmm0
  movsd  -0x78(%rbp),%xmm1
  addsd  %xmm1,%xmm0
  movsd  %xmm0,-0x78(%rbp)
L133:
  movsd  -0x78(%rbp),%xmm0
L127:
  movq   %xmm0,%rax
  movq   %rax,%xmm0
  add    $0xa8,%rsp
  pop    %rbx
  pop    %r12
  pop    %r13
  pop    %rbp
  ret
```

tool_calls: name: disassemble_data
arguments: data_label: D57
type_guessed: byte[8]
name: disassemble_data
arguments: data_label: D10
type_guessed: f64[2]
name: disassemble_data
arguments: data_label: D85
type_guessed: byte[8]
name: disassemble_data
arguments: data_label: D33
type_guessed: f64
name: disassemble_data
arguments: data_label: D17
type_guessed: f64
name: disassemble_data
arguments: data_label: D52
type_guessed: f32[2]

tool: {"D57": [0x39,0x9d,0x52,0xa2,0x46,0xdf,0x91,0x3f]}

tool: {"D10": [90.0,1e20]}

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

tool: D33: 1

tool: D17: 2

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

assistant: ```c
double c_chapman(int lc, double taup, double *tauc, int nlyr, double *zd, double *dtau_c, double zenang, double r) {
  register int id, j;
  double zenrad, xp, xpsinz, sum, fact, fact2, rj, rjp1, dhj, dsj;
  zenrad = zenang * (3.14159265358979323846 / 180.);
  xp = r + zd[lc] + (zd[lc - 1] - zd[lc]) * taup;
  xpsinz = xp * sin(zenrad);
  if (zenang > 90. && xpsinz < r) {
    return 1.e+20;
  }
  id = lc;
  if (zenang > 90.) {
    for (j = lc; j <= nlyr; j++) {
      if (xpsinz < (zd[j - 1] + r) && (xpsinz >= zd[j] + r)) {
        id = j;
      }
    }
  }
  sum = 0.;
  for (j = 1; j <= id; j++) {
    fact = 1.;
    fact2 = 1.;
    if (j > lc) {
      fact = 2.;
    } else if (j == lc && lc == id && zenang > 90.) {
      fact2 = -1.;
    }
    rj = r + zd[j - 1];
    rjp1 = r + zd[j];
    if (j == lc && id == lc) {
      rjp1 = xp;
    }
    dhj = zd[j - 1] - zd[j];
    if (id > lc && j == id) {
      dsj = sqrt(rj * rj - xpsinz * xpsinz);
    } else {
      dsj = sqrt(rj * rj - xpsinz * xpsinz) - fact2 * sqrt(rjp1 * rjp1 - xpsinz * xpsinz);
    }
    sum += dtau_c[j - 1] * fact * dsj / dhj;
  }
  if (id > lc) {
    dhj = zd[lc - 1] - zd[lc];
    dsj = sqrt(xp * xp - xpsinz * xpsinz) - sqrt(({
                                                   const double _x = (double)(zd[lc] + r);
                                                   _x *_x;
                                                 }) -
                                                 xpsinz * xpsinz);
    sum += dtau_c[lc - 1] * dsj / dhj;
  }
  return sum;
}
```