#define NULL ((void *)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t;
typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1

/* Forward declarations */

/* Type definitions */

/* Variables and functions */
double sin(double);
double sqrt(double);
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;
}


x86 assembly (clang, -O0):
<c_chapman>:
push   %rbp
mov    %rsp,%rbp
sub    $0xd0,%rsp
mov    %edi,-0xc(%rbp)
movsd  %xmm0,-0x18(%rbp)
mov    %rsi,-0x20(%rbp)
mov    %edx,-0x24(%rbp)
mov    %rcx,-0x30(%rbp)
mov    %r8,-0x38(%rbp)
movsd  %xmm1,-0x40(%rbp)
movsd  %xmm2,-0x48(%rbp)
movsd  0xeb4(%rip),%xmm0
mulsd  -0x40(%rbp),%xmm0
movsd  %xmm0,-0x58(%rbp)
movsd  -0x48(%rbp),%xmm1
mov    -0x30(%rbp),%rax
movslq -0xc(%rbp),%rcx
addsd  (%rax,%rcx,8),%xmm1
mov    -0x30(%rbp),%rax
mov    -0xc(%rbp),%ecx
sub    $0x1,%ecx
movslq %ecx,%rcx
movsd  (%rax,%rcx,8),%xmm0
mov    -0x30(%rbp),%rax
movslq -0xc(%rbp),%rcx
subsd  (%rax,%rcx,8),%xmm0
movsd  -0x18(%rbp),%xmm2
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x60(%rbp)
movsd  -0x60(%rbp),%xmm0
movsd  %xmm0,-0xb8(%rbp)
ff
movsd  -0x58(%rbp),%xmm0
call   1030 <sin@plt>
movaps %xmm0,%xmm1
movsd  -0xb8(%rbp),%xmm0
ff
mulsd  %xmm1,%xmm0
movsd  %xmm0,-0x68(%rbp)
movsd  -0x40(%rbp),%xmm0
movsd  0xe27(%rip),%xmm1
ucomisd %xmm1,%xmm0
jbe    1209 <c_chapman+0xe9>
movsd  -0x68(%rbp),%xmm1
movsd  -0x48(%rbp),%xmm0
ucomisd %xmm1,%xmm0
jbe    1209 <c_chapman+0xe9>
movsd  0xe29(%rip),%xmm0
movsd  %xmm0,-0x8(%rbp)
jmp    164b <c_chapman+0x52b>
mov    -0xc(%rbp),%eax
mov    %eax,-0x4c(%rbp)
movsd  -0x40(%rbp),%xmm0
movsd  0xde4(%rip),%xmm1
ucomisd %xmm1,%xmm0
jbe    129d <c_chapman+0x17d>
mov    -0xc(%rbp),%eax
mov    %eax,-0x50(%rbp)
mov    -0x50(%rbp),%eax
cmp    -0x24(%rbp),%eax
jg     1298 <c_chapman+0x178>
movsd  -0x68(%rbp),%xmm1
mov    -0x30(%rbp),%rax
mov    -0x50(%rbp),%ecx
sub    $0x1,%ecx
movslq %ecx,%rcx
movsd  (%rax,%rcx,8),%xmm0
addsd  -0x48(%rbp),%xmm0
ucomisd %xmm1,%xmm0
jbe    1285 <c_chapman+0x165>
movsd  -0x68(%rbp),%xmm0
mov    -0x30(%rbp),%rax
movslq -0x50(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm1
addsd  -0x48(%rbp),%xmm1
ucomisd %xmm1,%xmm0
jb     1285 <c_chapman+0x165>
mov    -0x50(%rbp),%eax
mov    %eax,-0x4c(%rbp)
jmp    128a <c_chapman+0x16a>
mov    -0x50(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x50(%rbp)
jmp    122c <c_chapman+0x10c>
jmp    129d <c_chapman+0x17d>
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x70(%rbp)
movl   $0x1,-0x50(%rbp)
mov    -0x50(%rbp),%eax
cmp    -0x4c(%rbp),%eax
jg     1523 <c_chapman+0x403>
movsd  0xd50(%rip),%xmm0
movsd  %xmm0,-0x78(%rbp)
movsd  0xd43(%rip),%xmm0
movsd  %xmm0,-0x80(%rbp)
mov    -0x50(%rbp),%eax
cmp    -0xc(%rbp),%eax
jle    12f0 <c_chapman+0x1d0>
movsd  0xd3a(%rip),%xmm0
movsd  %xmm0,-0x78(%rbp)
jmp    1331 <c_chapman+0x211>
mov    -0x50(%rbp),%eax
cmp    -0xc(%rbp),%eax
jne    132c <c_chapman+0x20c>
mov    -0xc(%rbp),%eax
cmp    -0x4c(%rbp),%eax
jne    132c <c_chapman+0x20c>
movsd  -0x40(%rbp),%xmm0
movsd  0xceb(%rip),%xmm1
ucomisd %xmm1,%xmm0
jbe    132c <c_chapman+0x20c>
movsd  0xcf1(%rip),%xmm0
movsd  %xmm0,-0x80(%rbp)
jmp    1331 <c_chapman+0x211>
movsd  -0x48(%rbp),%xmm0
mov    -0x30(%rbp),%rax
mov    -0x50(%rbp),%ecx
sub    $0x1,%ecx
movslq %ecx,%rcx
addsd  (%rax,%rcx,8),%xmm0
movsd  %xmm0,-0x88(%rbp)
ff
movsd  -0x48(%rbp),%xmm0
mov    -0x30(%rbp),%rax
movslq -0x50(%rbp),%rcx
addsd  (%rax,%rcx,8),%xmm0
movsd  %xmm0,-0x90(%rbp)
ff
mov    -0x50(%rbp),%eax
cmp    -0xc(%rbp),%eax
jne    138f <c_chapman+0x26f>
mov    -0x4c(%rbp),%eax
cmp    -0xc(%rbp),%eax
jne    138f <c_chapman+0x26f>
movsd  -0x60(%rbp),%xmm0
movsd  %xmm0,-0x90(%rbp)
ff
mov    -0x30(%rbp),%rax
mov    -0x50(%rbp),%ecx
sub    $0x1,%ecx
movslq %ecx,%rcx
movsd  (%rax,%rcx,8),%xmm0
mov    -0x30(%rbp),%rax
movslq -0x50(%rbp),%rcx
subsd  (%rax,%rcx,8),%xmm0
movsd  %xmm0,-0x98(%rbp)
ff
mov    -0x4c(%rbp),%eax
cmp    -0xc(%rbp),%eax
jle    1419 <c_chapman+0x2f9>
mov    -0x50(%rbp),%eax
cmp    -0x4c(%rbp),%eax
jne    1419 <c_chapman+0x2f9>
movsd  -0x88(%rbp),%xmm0
ff
movsd  -0x88(%rbp),%xmm2
ff
movsd  -0x68(%rbp),%xmm1
mulsd  -0x68(%rbp),%xmm1
movq   %xmm1,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
call   1040 <sqrt@plt>
movsd  %xmm0,-0xa0(%rbp)
ff
jmp    14e4 <c_chapman+0x3c4>
movsd  -0x88(%rbp),%xmm0
ff
movsd  -0x88(%rbp),%xmm2
ff
movsd  -0x68(%rbp),%xmm1
mulsd  -0x68(%rbp),%xmm1
movq   %xmm1,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
call   1040 <sqrt@plt>
movsd  %xmm0,-0xc8(%rbp)
ff
movsd  -0x80(%rbp),%xmm0
movsd  %xmm0,-0xc0(%rbp)
ff
movsd  -0x90(%rbp),%xmm0
ff
movsd  -0x90(%rbp),%xmm2
ff
movsd  -0x68(%rbp),%xmm1
mulsd  -0x68(%rbp),%xmm1
movq   %xmm1,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
call   1040 <sqrt@plt>
movsd  -0xc8(%rbp),%xmm1
ff
movaps %xmm0,%xmm2
movsd  -0xc0(%rbp),%xmm0
ff
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0xa0(%rbp)
ff
mov    -0x38(%rbp),%rax
mov    -0x50(%rbp),%ecx
sub    $0x1,%ecx
movslq %ecx,%rcx
movsd  (%rax,%rcx,8),%xmm0
mulsd  -0x78(%rbp),%xmm0
mulsd  -0xa0(%rbp),%xmm0
ff
divsd  -0x98(%rbp),%xmm0
ff
addsd  -0x70(%rbp),%xmm0
movsd  %xmm0,-0x70(%rbp)
mov    -0x50(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x50(%rbp)
jmp    12ac <c_chapman+0x18c>
mov    -0x4c(%rbp),%eax
cmp    -0xc(%rbp),%eax
jle    1641 <c_chapman+0x521>
mov    -0x30(%rbp),%rax
mov    -0xc(%rbp),%ecx
sub    $0x1,%ecx
movslq %ecx,%rcx
movsd  (%rax,%rcx,8),%xmm0
mov    -0x30(%rbp),%rax
movslq -0xc(%rbp),%rcx
subsd  (%rax,%rcx,8),%xmm0
movsd  %xmm0,-0x98(%rbp)
ff
movsd  -0x60(%rbp),%xmm0
movsd  -0x60(%rbp),%xmm2
movsd  -0x68(%rbp),%xmm1
mulsd  -0x68(%rbp),%xmm1
movq   %xmm1,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
call   1040 <sqrt@plt>
movsd  %xmm0,-0xd0(%rbp)
ff
mov    -0x30(%rbp),%rax
movslq -0xc(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
addsd  -0x48(%rbp),%xmm0
movsd  %xmm0,-0xa8(%rbp)
ff
movsd  -0xa8(%rbp),%xmm0
ff
mulsd  -0xa8(%rbp),%xmm0
ff
movsd  %xmm0,-0xb0(%rbp)
ff
movsd  -0xb0(%rbp),%xmm1
ff
movsd  -0x68(%rbp),%xmm0
movsd  -0x68(%rbp),%xmm2
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
call   1040 <sqrt@plt>
movaps %xmm0,%xmm1
movsd  -0xd0(%rbp),%xmm0
ff
subsd  %xmm1,%xmm0
movsd  %xmm0,-0xa0(%rbp)
ff
mov    -0x38(%rbp),%rax
mov    -0xc(%rbp),%ecx
sub    $0x1,%ecx
movslq %ecx,%rcx
movsd  (%rax,%rcx,8),%xmm0
mulsd  -0xa0(%rbp),%xmm0
ff
divsd  -0x98(%rbp),%xmm0
ff
addsd  -0x70(%rbp),%xmm0
movsd  %xmm0,-0x70(%rbp)
movsd  -0x70(%rbp),%xmm0
movsd  %xmm0,-0x8(%rbp)
movsd  -0x8(%rbp),%xmm0
add    $0xd0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<c_chapman>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0xa8,%rsp
movsd  %xmm2,0x28(%rsp)
movsd  %xmm1,0x10(%rsp)
mov    %r8,0x58(%rsp)
mov    %rcx,%rbx
mov    %edx,%r15d
mov    %edi,%r13d
movsd  0xead(%rip),%xmm4
mulsd  %xmm1,%xmm4
movslq %edi,%rax
movsd  -0x8(%rcx,%rax,8),%xmm1
mov    %rax,0x20(%rsp)
movsd  (%rcx,%rax,8),%xmm3
subsd  %xmm3,%xmm1
addsd  %xmm2,%xmm3
mulsd  %xmm0,%xmm1
addsd  %xmm3,%xmm1
movsd  %xmm1,0x50(%rsp)
movapd %xmm4,%xmm0
call   1030 <sin@plt>
movsd  0x10(%rsp),%xmm2
movsd  0x28(%rsp),%xmm9
movapd %xmm0,%xmm8
mulsd  0x50(%rsp),%xmm8
ucomisd 0xe5e(%rip),%xmm2
jbe    11c0 <c_chapman+0xa0>
ucomisd %xmm8,%xmm9
jbe    11c0 <c_chapman+0xa0>
movsd  0xe55(%rip),%xmm2
jmp    15bc <c_chapman+0x49c>
ucomisd 0xe40(%rip),%xmm2
mov    %r13d,%ebp
mov    0x20(%rsp),%rsi
jbe    11fb <c_chapman+0xdb>
mov    %r13d,%ebp
cmp    %r13d,%r15d
jl     11fb <c_chapman+0xdb>
lea    0x1(%r15),%ecx
mov    %ecx,%edx
sub    %r13d,%edx
mov    %rsi,%rax
test   $0x1,%dl
je     11ef <c_chapman+0xcf>
lea    0x1(%rsi),%rax
mov    %r13d,%ebp
cmp    %r13d,%r15d
jne    14d1 <c_chapman+0x3b1>
test   %ebp,%ebp
movapd %xmm8,0x60(%rsp)
jle    146f <c_chapman+0x34f>
ucomisd 0xdf6(%rip),%xmm2
seta   %al
cmp    %r13d,%ebp
sete   %cl
and    %al,%cl
mov    %cl,0xf(%rsp)
movapd 0xe07(%rip),%xmm4
xorpd  %xmm8,%xmm4
mulsd  %xmm8,%xmm4
mov    %ebp,%eax
mov    %rax,0x90(%rsp)
mov    %r13d,%eax
mov    %rax,0x88(%rsp)
lea    0x1(%rbp),%eax
mov    %rax,0xa0(%rsp)
xorpd  %xmm5,%xmm5
mov    $0x1,%r14d
xorpd  %xmm2,%xmm2
movapd %xmm4,0x70(%rsp)
jmp    1303 <c_chapman+0x1e3>
nopl   0x0(%rax)
movapd %xmm3,%xmm0
movsd  %xmm1,0x48(%rsp)
call   1040 <sqrt@plt>
movsd  0x48(%rsp),%xmm1
xorpd  %xmm5,%xmm5
movapd 0x70(%rsp),%xmm4
movsd  0x28(%rsp),%xmm9
mov    0x20(%rsp),%rsi
movapd 0x60(%rsp),%xmm8
movsd  0x10(%rsp),%xmm2
movsd  0x18(%rsp),%xmm6
movsd  0x30(%rsp),%xmm7
movsd  0x98(%rsp),%xmm3
mulsd  %xmm0,%xmm3
subsd  %xmm3,%xmm1
mov    %r15b,%r12b
lea    0xd71(%rip),%rax
movsd  (%rax,%r12,8),%xmm0
subsd  %xmm7,%xmm6
mov    0x58(%rsp),%rax
mulsd  -0x8(%rax,%r14,8),%xmm0
mulsd  %xmm1,%xmm0
divsd  %xmm6,%xmm0
addsd  %xmm0,%xmm2
add    $0x1,%r14
cmp    %r14,0xa0(%rsp)
je     1473 <c_chapman+0x353>
xor    %r12d,%r12d
cmp    %rsi,%r14
setg   %r15b
movsd  -0x8(%rbx,%r14,8),%xmm6
movsd  (%rbx,%r14,8),%xmm7
movapd %xmm6,%xmm0
addsd  %xmm9,%xmm0
cmp    %r13d,%ebp
jle    1350 <c_chapman+0x230>
cmp    %r14,0x90(%rsp)
jne    1350 <c_chapman+0x230>
mulsd  %xmm0,%xmm0
addsd  %xmm4,%xmm0
ucomisd %xmm5,%xmm0
jb     1420 <c_chapman+0x300>
xorps  %xmm1,%xmm1
sqrtsd %xmm0,%xmm1
jmp    12c5 <c_chapman+0x1a5>
movsd  %xmm2,0x10(%rsp)
movsd  0xcba(%rip),%xmm1
cmpb   $0x0,0xf(%rsp)
jne    136d <c_chapman+0x24d>
movsd  0xcb3(%rip),%xmm1
movapd %xmm7,%xmm2
addsd  %xmm9,%xmm2
movsd  0x50(%rsp),%xmm3
cmp    %r13d,%ebp
je     1385 <c_chapman+0x265>
movapd %xmm2,%xmm3
cmp    %r14,0x88(%rsp)
je     139b <c_chapman+0x27b>
movsd  0xc89(%rip),%xmm1
movapd %xmm2,%xmm3
movsd  0xc7d(%rip),%xmm2
cmp    %rsi,%r14
jg     13ab <c_chapman+0x28b>
movaps %xmm1,%xmm2
mulsd  %xmm0,%xmm0
addsd  %xmm4,%xmm0
ucomisd %xmm5,%xmm0
movsd  %xmm6,0x18(%rsp)
movsd  %xmm7,0x30(%rsp)
movsd  %xmm2,0x98(%rsp)
jb     13e0 <c_chapman+0x2c0>
xorps  %xmm1,%xmm1
sqrtsd %xmm0,%xmm1
jmp    13ff <c_chapman+0x2df>
nopw   0x0(%rax,%rax,1)
movsd  %xmm3,0x48(%rsp)
call   1040 <sqrt@plt>
movsd  0x48(%rsp),%xmm3
xorpd  %xmm5,%xmm5
movapd 0x70(%rsp),%xmm4
movapd %xmm0,%xmm1
mulsd  %xmm3,%xmm3
addsd  %xmm4,%xmm3
ucomisd %xmm5,%xmm3
jb     1270 <c_chapman+0x150>
xorps  %xmm0,%xmm0
sqrtsd %xmm3,%xmm0
jmp    128f <c_chapman+0x16f>
nopl   (%rax)
movsd  %xmm2,0x10(%rsp)
movsd  %xmm6,0x18(%rsp)
movsd  %xmm7,0x30(%rsp)
call   1040 <sqrt@plt>
movsd  0x30(%rsp),%xmm7
movsd  0x18(%rsp),%xmm6
xorpd  %xmm5,%xmm5
movapd 0x70(%rsp),%xmm4
movsd  0x10(%rsp),%xmm2
movapd 0x60(%rsp),%xmm8
mov    0x20(%rsp),%rsi
movsd  0x28(%rsp),%xmm9
movapd %xmm0,%xmm1
jmp    12c5 <c_chapman+0x1a5>
xorpd  %xmm2,%xmm2
cmp    %r13d,%ebp
jle    15bc <c_chapman+0x49c>
movsd  %xmm2,0x10(%rsp)
lea    -0x1(%rsi),%rbp
movsd  (%rbx,%rbp,8),%xmm0
subsd  (%rbx,%rsi,8),%xmm0
movsd  %xmm0,0x18(%rsp)
movapd 0xb92(%rip),%xmm1
xorpd  %xmm8,%xmm1
movapd %xmm8,%xmm2
mulsd  %xmm8,%xmm2
movsd  0x50(%rsp),%xmm0
mulsd  %xmm0,%xmm0
subsd  %xmm2,%xmm0
xorpd  %xmm2,%xmm2
ucomisd %xmm2,%xmm0
jb     1539 <c_chapman+0x419>
xorps  %xmm3,%xmm3
sqrtsd %xmm0,%xmm3
jmp    1565 <c_chapman+0x445>
mov    %ecx,%ecx
mov    %r13d,%ebp
jmp    14ec <c_chapman+0x3cc>
nopl   0x0(%rax,%rax,1)
add    $0x2,%rax
cmp    %eax,%ecx
je     11fb <c_chapman+0xdb>
movsd  -0x8(%rbx,%rax,8),%xmm0
addsd  %xmm9,%xmm0
ucomisd %xmm8,%xmm0
jbe    1511 <c_chapman+0x3f1>
movsd  (%rbx,%rax,8),%xmm0
addsd  %xmm9,%xmm0
ucomisd %xmm0,%xmm8
jb     1511 <c_chapman+0x3f1>
mov    %eax,%ebp
movsd  (%rbx,%rax,8),%xmm0
addsd  %xmm9,%xmm0
ucomisd %xmm8,%xmm0
jbe    14e0 <c_chapman+0x3c0>
movsd  0x8(%rbx,%rax,8),%xmm0
addsd  %xmm9,%xmm0
ucomisd %xmm0,%xmm8
jb     14e0 <c_chapman+0x3c0>
lea    0x1(%rax),%ebp
jmp    14e0 <c_chapman+0x3c0>
movapd %xmm1,0x30(%rsp)
call   1040 <sqrt@plt>
xorpd  %xmm2,%xmm2
movapd 0x30(%rsp),%xmm1
movapd 0x60(%rsp),%xmm8
mov    0x20(%rsp),%rsi
movsd  0x28(%rsp),%xmm9
movapd %xmm0,%xmm3
addsd  (%rbx,%rsi,8),%xmm9
mulsd  %xmm9,%xmm9
mulsd  %xmm8,%xmm1
addsd  %xmm9,%xmm1
ucomisd %xmm2,%xmm1
jb     1589 <c_chapman+0x469>
xorps  %xmm0,%xmm0
sqrtsd %xmm1,%xmm0
jmp    159e <c_chapman+0x47e>
movapd %xmm1,%xmm0
movsd  %xmm3,0x30(%rsp)
call   1040 <sqrt@plt>
movsd  0x30(%rsp),%xmm3
movsd  0x10(%rsp),%xmm2
subsd  %xmm0,%xmm3
mov    0x58(%rsp),%rax
mulsd  (%rax,%rbp,8),%xmm3
divsd  0x18(%rsp),%xmm3
addsd  %xmm3,%xmm2
movapd %xmm2,%xmm0
add    $0xa8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
define double @c_chapman(i32 %0, double %1, double* %2, i32 %3, double* %4, double* %5, double %6, double %7) {
%9 = alloca double
%10 = alloca i32
%11 = alloca double
%12 = alloca double*
%13 = alloca i32
%14 = alloca double*
%15 = alloca double*
%16 = alloca double
%17 = alloca double
%18 = alloca i32
%19 = alloca i32
%20 = alloca double
%21 = alloca double
%22 = alloca double
%23 = alloca double
%24 = alloca double
%25 = alloca double
%26 = alloca double
%27 = alloca double
%28 = alloca double
%29 = alloca double
%30 = alloca double
%31 = alloca double
store i32 %0, i32* %10
store double %1, double* %11
store double* %2, double** %12
store i32 %3, i32* %13
store double* %4, double** %14
store double* %5, double** %15
store double %6, double* %16
store double %7, double* %17
%32 = load double, double* %16
%33 = fmul double %32, 0x3F91DF46A2529D39
store double %33, double* %20
%34 = load double, double* %17
%35 = load double*, double** %14
%36 = load i32, i32* %10
%37 = sext i32 %36 to i64
%38 = getelementptr inbounds double, double* %35, i64 %37
%39 = load double, double* %38
%40 = fadd double %34, %39
%41 = load double*, double** %14
%42 = load i32, i32* %10
%43 = sub nsw i32 %42, 1
%44 = sext i32 %43 to i64
%45 = getelementptr inbounds double, double* %41, i64 %44
%46 = load double, double* %45
%47 = load double*, double** %14
%48 = load i32, i32* %10
%49 = sext i32 %48 to i64
%50 = getelementptr inbounds double, double* %47, i64 %49
%51 = load double, double* %50
%52 = fsub double %46, %51
%53 = load double, double* %11
%54 = call double @llvm.fmuladd.f64(double %52, double %53, double %40)
store double %54, double* %21
%55 = load double, double* %21
%56 = load double, double* %20
%57 = call double @sin(double %56)
%58 = fmul double %55, %57
store double %58, double* %22
%59 = load double, double* %16
%60 = fcmp ogt double %59, 9.000000e+01
br i1 %60, label %61, label %66
61: ; preds = %8
%62 = load double, double* %22
%63 = load double, double* %17
%64 = fcmp olt double %62, %63
br i1 %64, label %65, label %66
65: ; preds = %61
store double 1.000000e+20, double* %9
br label %275
66: ; preds = %61, %8
%67 = load i32, i32* %10
store i32 %67, i32* %18
%68 = load double, double* %16
%69 = fcmp ogt double %68, 9.000000e+01
br i1 %69, label %70, label %104
70: ; preds = %66
%71 = load i32, i32* %10
store i32 %71, i32* %19
br label %72
72: ; preds = %100, %70
%73 = load i32, i32* %19
%74 = load i32, i32* %13
%75 = icmp sle i32 %73, %74
br i1 %75, label %76, label %103
76: ; preds = %72
%77 = load double, double* %22
%78 = load double*, double** %14
%79 = load i32, i32* %19
%80 = sub nsw i32 %79, 1
%81 = sext i32 %80 to i64
%82 = getelementptr inbounds double, double* %78, i64 %81
%83 = load double, double* %82
%84 = load double, double* %17
%85 = fadd double %83, %84
%86 = fcmp olt double %77, %85
br i1 %86, label %87, label %99
87: ; preds = %76
%88 = load double, double* %22
%89 = load double*, double** %14
%90 = load i32, i32* %19
%91 = sext i32 %90 to i64
%92 = getelementptr inbounds double, double* %89, i64 %91
%93 = load double, double* %92
%94 = load double, double* %17
%95 = fadd double %93, %94
%96 = fcmp oge double %88, %95
br i1 %96, label %97, label %99
97: ; preds = %87
%98 = load i32, i32* %19
store i32 %98, i32* %18
br label %99
99: ; preds = %97, %87, %76
br label %100
100: ; preds = %99
%101 = load i32, i32* %19
%102 = add nsw i32 %101, 1
store i32 %102, i32* %19
br label %72
103: ; preds = %72
br label %104
104: ; preds = %103, %66
store double 0.000000e+00, double* %23
store i32 1, i32* %19
br label %105
105: ; preds = %216, %104
%106 = load i32, i32* %19
%107 = load i32, i32* %18
%108 = icmp sle i32 %106, %107
br i1 %108, label %109, label %219
109: ; preds = %105
store double 1.000000e+00, double* %24
store double 1.000000e+00, double* %25
%110 = load i32, i32* %19
%111 = load i32, i32* %10
%112 = icmp sgt i32 %110, %111
br i1 %112, label %113, label %114
113: ; preds = %109
store double 2.000000e+00, double* %24
br label %127
114: ; preds = %109
%115 = load i32, i32* %19
%116 = load i32, i32* %10
%117 = icmp eq i32 %115, %116
br i1 %117, label %118, label %126
118: ; preds = %114
%119 = load i32, i32* %10
%120 = load i32, i32* %18
%121 = icmp eq i32 %119, %120
br i1 %121, label %122, label %126
122: ; preds = %118
%123 = load double, double* %16
%124 = fcmp ogt double %123, 9.000000e+01
br i1 %124, label %125, label %126
125: ; preds = %122
store double -1.000000e+00, double* %25
br label %126
126: ; preds = %125, %122, %118, %114
br label %127
127: ; preds = %126, %113
%128 = load double, double* %17
%129 = load double*, double** %14
%130 = load i32, i32* %19
%131 = sub nsw i32 %130, 1
%132 = sext i32 %131 to i64
%133 = getelementptr inbounds double, double* %129, i64 %132
%134 = load double, double* %133
%135 = fadd double %128, %134
store double %135, double* %26
%136 = load double, double* %17
%137 = load double*, double** %14
%138 = load i32, i32* %19
%139 = sext i32 %138 to i64
%140 = getelementptr inbounds double, double* %137, i64 %139
%141 = load double, double* %140
%142 = fadd double %136, %141
store double %142, double* %27
%143 = load i32, i32* %19
%144 = load i32, i32* %10
%145 = icmp eq i32 %143, %144
br i1 %145, label %146, label %152
146: ; preds = %127
%147 = load i32, i32* %18
%148 = load i32, i32* %10
%149 = icmp eq i32 %147, %148
br i1 %149, label %150, label %152
150: ; preds = %146
%151 = load double, double* %21
store double %151, double* %27
br label %152
152: ; preds = %150, %146, %127
%153 = load double*, double** %14
%154 = load i32, i32* %19
%155 = sub nsw i32 %154, 1
%156 = sext i32 %155 to i64
%157 = getelementptr inbounds double, double* %153, i64 %156
%158 = load double, double* %157
%159 = load double*, double** %14
%160 = load i32, i32* %19
%161 = sext i32 %160 to i64
%162 = getelementptr inbounds double, double* %159, i64 %161
%163 = load double, double* %162
%164 = fsub double %158, %163
store double %164, double* %28
%165 = load i32, i32* %18
%166 = load i32, i32* %10
%167 = icmp sgt i32 %165, %166
br i1 %167, label %168, label %181
168: ; preds = %152
%169 = load i32, i32* %19
%170 = load i32, i32* %18
%171 = icmp eq i32 %169, %170
br i1 %171, label %172, label %181
172: ; preds = %168
%173 = load double, double* %26
%174 = load double, double* %26
%175 = load double, double* %22
%176 = load double, double* %22
%177 = fmul double %175, %176
%178 = fneg double %177
%179 = call double @llvm.fmuladd.f64(double %173, double %174, double %178)
%180 = call double @sqrt(double %179)
store double %180, double* %29
br label %201
181: ; preds = %168, %152
%182 = load double, double* %26
%183 = load double, double* %26
%184 = load double, double* %22
%185 = load double, double* %22
%186 = fmul double %184, %185
%187 = fneg double %186
%188 = call double @llvm.fmuladd.f64(double %182, double %183, double %187)
%189 = call double @sqrt(double %188)
%190 = load double, double* %25
%191 = load double, double* %27
%192 = load double, double* %27
%193 = load double, double* %22
%194 = load double, double* %22
%195 = fmul double %193, %194
%196 = fneg double %195
%197 = call double @llvm.fmuladd.f64(double %191, double %192, double %196)
%198 = call double @sqrt(double %197)
%199 = fneg double %190
%200 = call double @llvm.fmuladd.f64(double %199, double %198, double %189)
store double %200, double* %29
br label %201
201: ; preds = %181, %172
%202 = load double*, double** %15
%203 = load i32, i32* %19
%204 = sub nsw i32 %203, 1
%205 = sext i32 %204 to i64
%206 = getelementptr inbounds double, double* %202, i64 %205
%207 = load double, double* %206
%208 = load double, double* %24
%209 = fmul double %207, %208
%210 = load double, double* %29
%211 = fmul double %209, %210
%212 = load double, double* %28
%213 = fdiv double %211, %212
%214 = load double, double* %23
%215 = fadd double %214, %213
store double %215, double* %23
br label %216
216: ; preds = %201
%217 = load i32, i32* %19
%218 = add nsw i32 %217, 1
store i32 %218, i32* %19
br label %105
219: ; preds = %105
%220 = load i32, i32* %18
%221 = load i32, i32* %10
%222 = icmp sgt i32 %220, %221
br i1 %222, label %223, label %273
223: ; preds = %219
%224 = load double*, double** %14
%225 = load i32, i32* %10
%226 = sub nsw i32 %225, 1
%227 = sext i32 %226 to i64
%228 = getelementptr inbounds double, double* %224, i64 %227
%229 = load double, double* %228
%230 = load double*, double** %14
%231 = load i32, i32* %10
%232 = sext i32 %231 to i64
%233 = getelementptr inbounds double, double* %230, i64 %232
%234 = load double, double* %233
%235 = fsub double %229, %234
store double %235, double* %28
%236 = load double, double* %21
%237 = load double, double* %21
%238 = load double, double* %22
%239 = load double, double* %22
%240 = fmul double %238, %239
%241 = fneg double %240
%242 = call double @llvm.fmuladd.f64(double %236, double %237, double %241)
%243 = call double @sqrt(double %242)
%244 = load double*, double** %14
%245 = load i32, i32* %10
%246 = sext i32 %245 to i64
%247 = getelementptr inbounds double, double* %244, i64 %246
%248 = load double, double* %247
%249 = load double, double* %17
%250 = fadd double %248, %249
store double %250, double* %30
%251 = load double, double* %30
%252 = load double, double* %30
%253 = fmul double %251, %252
store double %253, double* %31
%254 = load double, double* %31
%255 = load double, double* %22
%256 = load double, double* %22
%257 = fneg double %255
%258 = call double @llvm.fmuladd.f64(double %257, double %256, double %254)
%259 = call double @sqrt(double %258)
%260 = fsub double %243, %259
store double %260, double* %29
%261 = load double*, double** %15
%262 = load i32, i32* %10
%263 = sub nsw i32 %262, 1
%264 = sext i32 %263 to i64
%265 = getelementptr inbounds double, double* %261, i64 %264
%266 = load double, double* %265
%267 = load double, double* %29
%268 = fmul double %266, %267
%269 = load double, double* %28
%270 = fdiv double %268, %269
%271 = load double, double* %23
%272 = fadd double %271, %270
store double %272, double* %23
br label %273
273: ; preds = %223, %219
%274 = load double, double* %23
store double %274, double* %9
br label %275
275: ; preds = %273, %65
%276 = load double, double* %9
ret double %276
}

LLVM IR (-O2):
define double @c_chapman(i32 %0, double %1, double* nocapture readnone %2, i32 %3, double* nocapture %4, double* nocapture %5, double %6, double %7) {
%9 = fmul double %6, 0x3F91DF46A2529D39
%10 = sext i32 %0 to i64
%11 = getelementptr inbounds double, double* %4, i64 %10
%12 = load double, double* %11
%13 = fadd double %12, %7
%14 = add nsw i32 %0, -1
%15 = sext i32 %14 to i64
%16 = getelementptr inbounds double, double* %4, i64 %15
%17 = load double, double* %16
%18 = fsub double %17, %12
%19 = tail call double @llvm.fmuladd.f64(double %18, double %1, double %13)
%20 = tail call double @sin(double %9)
%21 = fmul double %20, %19
%22 = fcmp ogt double %6, 9.000000e+01
%23 = fcmp olt double %21, %7
%24 = select i1 %22, i1 %23, i1 false
br i1 %24, label %153, label %25
25: ; preds = %8
%26 = icmp sge i32 %3, %0
%27 = and i1 %22, %26
br i1 %27, label %28, label %77
28: ; preds = %25
%29 = add i32 %3, 1
%30 = sub i32 %29, %0
%31 = and i32 %30, 1
%32 = icmp eq i32 %31, 0
br i1 %32, label %40, label %33
33: ; preds = %28
%34 = add nsw i64 %10, -1
%35 = getelementptr inbounds double, double* %4, i64 %34
%36 = load double, double* %35
%37 = fadd double %36, %7
%38 = fcmp olt double %21, %37
%39 = add nsw i64 %10, 1
br label %40
40: ; preds = %33, %28
%41 = phi i64 [ %10, %28 ], [ %39, %33 ]
%42 = icmp eq i32 %3, %0
br i1 %42, label %77, label %43
43: ; preds = %40, %72
%44 = phi i64 [ %74, %72 ], [ %41, %40 ]
%45 = phi i32 [ %73, %72 ], [ %0, %40 ]
%46 = add nsw i64 %44, -1
%47 = getelementptr inbounds double, double* %4, i64 %46
%48 = load double, double* %47
%49 = fadd double %48, %7
%50 = fcmp olt double %21, %49
br i1 %50, label %51, label %58
51: ; preds = %43
%52 = getelementptr inbounds double, double* %4, i64 %44
%53 = load double, double* %52
%54 = fadd double %53, %7
%55 = fcmp ult double %21, %54
br i1 %55, label %58, label %56
56: ; preds = %51
%57 = trunc i64 %44 to i32
br label %58
58: ; preds = %43, %51, %56
%59 = phi i32 [ %57, %56 ], [ %45, %51 ], [ %45, %43 ]
%60 = add nsw i64 %44, 1
%61 = getelementptr inbounds double, double* %4, i64 %44
%62 = load double, double* %61
%63 = fadd double %62, %7
%64 = fcmp olt double %21, %63
br i1 %64, label %65, label %72
65: ; preds = %58
%66 = getelementptr inbounds double, double* %4, i64 %60
%67 = load double, double* %66
%68 = fadd double %67, %7
%69 = fcmp ult double %21, %68
br i1 %69, label %72, label %70
70: ; preds = %65
%71 = trunc i64 %60 to i32
br label %72
72: ; preds = %70, %65, %58
%73 = phi i32 [ %71, %70 ], [ %59, %65 ], [ %59, %58 ]
%74 = add nsw i64 %44, 2
%75 = trunc i64 %74 to i32
%76 = icmp eq i32 %29, %75
br i1 %76, label %77, label %43
77: ; preds = %40, %72, %25
%78 = phi i32 [ %0, %25 ], [ %0, %40 ], [ %73, %72 ]
%79 = icmp slt i32 %78, 1
br i1 %79, label %131, label %80
80: ; preds = %77
%81 = icmp eq i32 %78, %0
%82 = and i1 %22, %81
%83 = icmp sgt i32 %78, %0
%84 = fneg double %21
%85 = fmul double %21, %84
%86 = zext i32 %78 to i64
%87 = zext i32 %0 to i64
%88 = add nuw i32 %78, 1
%89 = zext i32 %88 to i64
br label %90
90: ; preds = %80, %121
%91 = phi i64 [ 1, %80 ], [ %129, %121 ]
%92 = phi double [ 0.000000e+00, %80 ], [ %128, %121 ]
%93 = icmp sgt i64 %91, %10
%94 = select i1 %93, double 2.000000e+00, double 1.000000e+00
%95 = add nsw i64 %91, -1
%96 = getelementptr inbounds double, double* %4, i64 %95
%97 = load double, double* %96
%98 = fadd double %97, %7
%99 = getelementptr inbounds double, double* %4, i64 %91
%100 = load double, double* %99
%101 = fsub double %97, %100
%102 = icmp eq i64 %91, %86
%103 = select i1 %83, i1 %102, i1 false
br i1 %103, label %104, label %107
104: ; preds = %90
%105 = tail call double @llvm.fmuladd.f64(double %98, double %98, double %85)
%106 = tail call double @sqrt(double %105)
br label %121
107: ; preds = %90
%108 = icmp eq i64 %91, %87
%109 = select i1 %108, i1 %82, i1 false
%110 = select i1 %109, double -1.000000e+00, double 1.000000e+00
%111 = select i1 %93, double 1.000000e+00, double %110
%112 = select i1 %108, i1 %81, i1 false
%113 = fadd double %100, %7
%114 = select i1 %112, double %19, double %113
%115 = tail call double @llvm.fmuladd.f64(double %98, double %98, double %85)
%116 = tail call double @sqrt(double %115)
%117 = tail call double @llvm.fmuladd.f64(double %114, double %114, double %85)
%118 = tail call double @sqrt(double %117)
%119 = fneg double %111
%120 = tail call double @llvm.fmuladd.f64(double %119, double %118, double %116)
br label %121
121: ; preds = %107, %104
%122 = phi double [ %106, %104 ], [ %120, %107 ]
%123 = getelementptr inbounds double, double* %5, i64 %95
%124 = load double, double* %123
%125 = fmul double %94, %124
%126 = fmul double %122, %125
%127 = fdiv double %126, %101
%128 = fadd double %92, %127
%129 = add nuw nsw i64 %91, 1
%130 = icmp eq i64 %129, %89
br i1 %130, label %131, label %90
131: ; preds = %121, %77
%132 = phi double [ 0.000000e+00, %77 ], [ %128, %121 ]
%133 = icmp sgt i32 %78, %0
br i1 %133, label %134, label %153
134: ; preds = %131
%135 = load double, double* %16
%136 = load double, double* %11
%137 = fsub double %135, %136
%138 = fneg double %21
%139 = fmul double %21, %138
%140 = tail call double @llvm.fmuladd.f64(double %19, double %19, double %139)
%141 = tail call double @sqrt(double %140)
%142 = load double, double* %11
%143 = fadd double %142, %7
%144 = fmul double %143, %143
%145 = tail call double @llvm.fmuladd.f64(double %138, double %21, double %144)
%146 = tail call double @sqrt(double %145)
%147 = fsub double %141, %146
%148 = getelementptr inbounds double, double* %5, i64 %15
%149 = load double, double* %148
%150 = fmul double %149, %147
%151 = fdiv double %150, %137
%152 = fadd double %132, %151
br label %153
153: ; preds = %131, %134, %8
%154 = phi double [ 1.000000e+20, %8 ], [ %152, %134 ], [ %132, %131 ]
ret double %154
}