#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 M_PI;
double abs(double);
double cos(double);
double sin(double);
double poly_ctrlon(const double x[], const double y[], int n, double clon) {
  double ctrlon = 0.0;
  int i;
  clon = clon;
  for (i = 0; i < n; i++) {
    int ip = (i + 1) % n;
    double phi1, phi2, dphi, lat1, lat2, dphi1, dphi2;
    double f1, f2, fac, fint;
    phi1 = x[ip];
    phi2 = x[i];
    lat1 = y[ip];
    lat2 = y[i];
    dphi = phi1 - phi2;
    if (dphi == 0.0)
      continue;
    f1 = 0.5 * (cos(lat1) * sin(lat1) + lat1);
    f2 = 0.5 * (cos(lat2) * sin(lat2) + lat2);
    if (dphi > M_PI)
      dphi = dphi - 2.0 * M_PI;
    if (dphi < -M_PI)
      dphi = dphi + 2.0 * M_PI;
    dphi1 = phi1 - clon;
    if (dphi1 > M_PI)
      dphi1 -= 2.0 * M_PI;
    if (dphi1 < -M_PI)
      dphi1 += 2.0 * M_PI;
    dphi2 = phi2 - clon;
    if (dphi2 > M_PI)
      dphi2 -= 2.0 * M_PI;
    if (dphi2 < -M_PI)
      dphi2 += 2.0 * M_PI;
    if (abs(dphi2 - dphi1) < M_PI) {
      ctrlon -= dphi * (dphi1 * f1 + dphi2 * f2) / 2.0;
    } else {
      if (dphi1 > 0.0)
        fac = M_PI;
      else
        fac = -M_PI;
      fint = f1 + (f2 - f1) * (fac - dphi1) / abs(dphi);
      ctrlon -= 0.5 * dphi1 * (dphi1 - fac) * f1 -
                0.5 * dphi2 * (dphi2 + fac) * f2 +
                0.5 * fac * (dphi1 + dphi2) * fint;
    }
  }
  return (ctrlon * (6371000.) * (6371000.));
}


x86 assembly (clang, -O0):
<poly_ctrlon>:
push   %rbp
mov    %rsp,%rbp
sub    $0xb0,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
movsd  %xmm0,-0x20(%rbp)
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x28(%rbp)
movsd  -0x20(%rbp),%xmm0
movsd  %xmm0,-0x20(%rbp)
movl   $0x0,-0x2c(%rbp)
mov    -0x2c(%rbp),%eax
cmp    -0x14(%rbp),%eax
jge    15da <poly_ctrlon+0x4aa>
mov    -0x2c(%rbp),%eax
add    $0x1,%eax
cltd
idivl  -0x14(%rbp)
mov    %edx,-0x30(%rbp)
mov    -0x8(%rbp),%rax
movslq -0x30(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
movsd  %xmm0,-0x38(%rbp)
mov    -0x8(%rbp),%rax
movslq -0x2c(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
movsd  %xmm0,-0x40(%rbp)
mov    -0x10(%rbp),%rax
movslq -0x30(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
movsd  %xmm0,-0x50(%rbp)
mov    -0x10(%rbp),%rax
movslq -0x2c(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
movsd  %xmm0,-0x58(%rbp)
movsd  -0x38(%rbp),%xmm0
subsd  -0x40(%rbp),%xmm0
movsd  %xmm0,-0x48(%rbp)
movsd  -0x48(%rbp),%xmm0
xorps  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
jne    11f1 <poly_ctrlon+0xc1>
jp     11f1 <poly_ctrlon+0xc1>
jmp    15cc <poly_ctrlon+0x49c>
movsd  -0x50(%rbp),%xmm0
call   1050 <cos@plt>
movsd  %xmm0,-0x98(%rbp)
ff
movsd  -0x50(%rbp),%xmm0
call   1040 <sin@plt>
movsd  -0x98(%rbp),%xmm1
ff
movaps %xmm0,%xmm2
movsd  -0x50(%rbp),%xmm0
mulsd  %xmm2,%xmm1
addsd  %xmm0,%xmm1
movsd  0xddb(%rip),%xmm0
mulsd  %xmm1,%xmm0
movsd  %xmm0,-0x70(%rbp)
movsd  -0x58(%rbp),%xmm0
call   1050 <cos@plt>
movsd  %xmm0,-0x90(%rbp)
ff
movsd  -0x58(%rbp),%xmm0
call   1040 <sin@plt>
movsd  -0x90(%rbp),%xmm1
ff
movaps %xmm0,%xmm2
movsd  -0x58(%rbp),%xmm0
mulsd  %xmm2,%xmm1
addsd  %xmm0,%xmm1
movsd  0xd96(%rip),%xmm0
mulsd  %xmm1,%xmm0
movsd  %xmm0,-0x78(%rbp)
movsd  -0x48(%rbp),%xmm0
mov    0x2d61(%rip),%rax
ucomisd (%rax),%xmm0
jbe    12ae <poly_ctrlon+0x17e>
movsd  -0x48(%rbp),%xmm0
mov    0x2d4b(%rip),%rax
movsd  (%rax),%xmm1
addsd  %xmm1,%xmm1
subsd  %xmm1,%xmm0
movsd  %xmm0,-0x48(%rbp)
movsd  -0x48(%rbp),%xmm1
mov    0x2d2e(%rip),%rax
movsd  (%rax),%xmm0
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
ucomisd %xmm1,%xmm0
jbe    12fc <poly_ctrlon+0x1cc>
movsd  -0x48(%rbp),%xmm1
mov    0x2cfd(%rip),%rax
movsd  (%rax),%xmm0
addsd  %xmm0,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x48(%rbp)
movsd  -0x38(%rbp),%xmm0
subsd  -0x20(%rbp),%xmm0
movsd  %xmm0,-0x60(%rbp)
movsd  -0x60(%rbp),%xmm0
mov    0x2cd1(%rip),%rax
ucomisd (%rax),%xmm0
jbe    133e <poly_ctrlon+0x20e>
mov    0x2cc0(%rip),%rax
movsd  (%rax),%xmm1
movsd  -0x60(%rbp),%xmm0
addsd  %xmm1,%xmm1
subsd  %xmm1,%xmm0
movsd  %xmm0,-0x60(%rbp)
movsd  -0x60(%rbp),%xmm1
mov    0x2c9e(%rip),%rax
movsd  (%rax),%xmm0
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
ucomisd %xmm1,%xmm0
jbe    138c <poly_ctrlon+0x25c>
mov    0x2c72(%rip),%rax
movsd  (%rax),%xmm0
movsd  -0x60(%rbp),%xmm1
addsd  %xmm0,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x60(%rbp)
movsd  -0x40(%rbp),%xmm0
subsd  -0x20(%rbp),%xmm0
movsd  %xmm0,-0x68(%rbp)
movsd  -0x68(%rbp),%xmm0
mov    0x2c41(%rip),%rax
ucomisd (%rax),%xmm0
jbe    13ce <poly_ctrlon+0x29e>
mov    0x2c30(%rip),%rax
movsd  (%rax),%xmm1
movsd  -0x68(%rbp),%xmm0
addsd  %xmm1,%xmm1
subsd  %xmm1,%xmm0
movsd  %xmm0,-0x68(%rbp)
movsd  -0x68(%rbp),%xmm1
mov    0x2c0e(%rip),%rax
movsd  (%rax),%xmm0
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
ucomisd %xmm1,%xmm0
jbe    141c <poly_ctrlon+0x2ec>
mov    0x2be2(%rip),%rax
movsd  (%rax),%xmm0
movsd  -0x68(%rbp),%xmm1
addsd  %xmm0,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x68(%rbp)
movsd  -0x68(%rbp),%xmm0
subsd  -0x60(%rbp),%xmm0
call   1030 <abs@plt>
movaps %xmm0,%xmm1
mov    0x2bb3(%rip),%rax
movsd  (%rax),%xmm0
ucomisd %xmm1,%xmm0
jbe    1487 <poly_ctrlon+0x357>
movsd  -0x48(%rbp),%xmm1
movsd  -0x60(%rbp),%xmm0
movsd  -0x70(%rbp),%xmm3
movsd  -0x68(%rbp),%xmm2
mulsd  -0x78(%rbp),%xmm2
mulsd  %xmm3,%xmm0
addsd  %xmm2,%xmm0
mulsd  %xmm0,%xmm1
movsd  0xba0(%rip),%xmm0
divsd  %xmm0,%xmm1
movsd  -0x28(%rbp),%xmm0
subsd  %xmm1,%xmm0
movsd  %xmm0,-0x28(%rbp)
jmp    15c7 <poly_ctrlon+0x497>
movsd  -0x60(%rbp),%xmm0
xorps  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
jbe    14ae <poly_ctrlon+0x37e>
mov    0x2b48(%rip),%rax
movsd  (%rax),%xmm0
movsd  %xmm0,-0x80(%rbp)
jmp    14d5 <poly_ctrlon+0x3a5>
mov    0x2b33(%rip),%rax
movsd  (%rax),%xmm0
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
movsd  %xmm0,-0x80(%rbp)
movsd  -0x70(%rbp),%xmm0
movsd  %xmm0,-0xa0(%rbp)
ff
movsd  -0x78(%rbp),%xmm0
subsd  -0x70(%rbp),%xmm0
movsd  -0x80(%rbp),%xmm1
subsd  -0x60(%rbp),%xmm1
mulsd  %xmm1,%xmm0
movsd  %xmm0,-0xa8(%rbp)
ff
movsd  -0x48(%rbp),%xmm0
call   1030 <abs@plt>
movsd  -0xa8(%rbp),%xmm1
ff
movaps %xmm0,%xmm2
movsd  -0xa0(%rbp),%xmm0
ff
divsd  %xmm2,%xmm1
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x88(%rbp)
ff
movsd  0xad1(%rip),%xmm0
mulsd  -0x60(%rbp),%xmm0
movsd  -0x60(%rbp),%xmm1
subsd  -0x80(%rbp),%xmm1
mulsd  %xmm1,%xmm0
movsd  -0x70(%rbp),%xmm2
movsd  0xab1(%rip),%xmm1
mulsd  -0x68(%rbp),%xmm1
movsd  -0x68(%rbp),%xmm3
addsd  -0x80(%rbp),%xmm3
mulsd  %xmm3,%xmm1
mulsd  -0x78(%rbp),%xmm1
movq   %xmm1,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  0xa72(%rip),%xmm1
mulsd  -0x80(%rbp),%xmm1
movsd  -0x60(%rbp),%xmm2
addsd  -0x68(%rbp),%xmm2
mulsd  %xmm2,%xmm1
movsd  -0x88(%rbp),%xmm2
ff
mulsd  %xmm2,%xmm1
addsd  %xmm0,%xmm1
movsd  -0x28(%rbp),%xmm0
subsd  %xmm1,%xmm0
movsd  %xmm0,-0x28(%rbp)
jmp    15cc <poly_ctrlon+0x49c>
mov    -0x2c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x2c(%rbp)
jmp    1164 <poly_ctrlon+0x34>
movsd  0xa1e(%rip),%xmm0
mulsd  -0x28(%rbp),%xmm0
movsd  0xa11(%rip),%xmm1
mulsd  %xmm1,%xmm0
add    $0xb0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<poly_ctrlon>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x88,%rsp
test   %edx,%edx
jle    1444 <poly_ctrlon+0x314>
mov    %rsi,%r14
mov    %rdi,%r15
mov    %edx,%r12d
unpcklpd %xmm0,%xmm0
neg    %r12
xorpd  %xmm2,%xmm2
mov    $0x1,%ebx
xor    %r13d,%r13d
mov    0x2e7c(%rip),%rbp
xorpd  %xmm1,%xmm1
movapd %xmm0,0x70(%rsp)
jmp    1273 <poly_ctrlon+0x143>
xorpd  %xmm3,%xmm3
movapd 0x20(%rsp),%xmm0
cmpltsd %xmm0,%xmm3
movapd %xmm0,%xmm4
movapd %xmm3,%xmm0
andpd  %xmm1,%xmm0
movapd 0xe82(%rip),%xmm2
xorpd  %xmm2,%xmm1
andnpd %xmm1,%xmm3
orpd   %xmm0,%xmm3
movapd %xmm3,0x10(%rsp)
movsd  (%rsp),%xmm0
subsd  0x8(%rsp),%xmm0
subsd  %xmm4,%xmm3
mulsd  %xmm0,%xmm3
movapd %xmm3,0x60(%rsp)
movapd 0x40(%rsp),%xmm0
call   1030 <abs@plt>
movapd 0x60(%rsp),%xmm1
divsd  %xmm0,%xmm1
movsd  0x8(%rsp),%xmm7
addsd  %xmm7,%xmm1
movapd %xmm1,%xmm6
movapd 0x20(%rsp),%xmm4
movapd %xmm4,%xmm0
movsd  0xe02(%rip),%xmm3
mulsd  %xmm3,%xmm0
movapd %xmm4,%xmm1
movapd 0x10(%rsp),%xmm5
subsd  %xmm5,%xmm1
mulsd  %xmm0,%xmm1
movapd 0x50(%rsp),%xmm2
addsd  %xmm2,%xmm4
movapd %xmm2,%xmm0
addsd  %xmm5,%xmm0
mulsd  0xdda(%rip),%xmm2
mulsd  %xmm0,%xmm2
mulsd  (%rsp),%xmm2
mulsd  %xmm7,%xmm1
addsd  %xmm2,%xmm1
mulsd  %xmm3,%xmm5
mulsd  %xmm4,%xmm5
mulsd  %xmm6,%xmm5
addsd  %xmm1,%xmm5
movsd  0x38(%rsp),%xmm1
xorpd  %xmm2,%xmm2
subsd  %xmm5,%xmm1
lea    (%r12,%rbx,1),%rax
add    $0x1,%rax
add    $0x1,%rbx
cmp    $0x1,%rax
je     1448 <poly_ctrlon+0x318>
mov    %r12,%rax
add    %rbx,%rax
mov    %rbx,%rax
cmove  %r13,%rax
movsd  (%r15,%rax,8),%xmm6
movsd  -0x8(%r15,%rbx,8),%xmm5
movapd %xmm6,%xmm7
subsd  %xmm5,%xmm7
ucomisd %xmm2,%xmm7
jne    129d <poly_ctrlon+0x16d>
jnp    125d <poly_ctrlon+0x12d>
movsd  %xmm1,0x38(%rsp)
movsd  (%r14,%rax,8),%xmm2
movsd  %xmm2,0x8(%rsp)
movsd  -0x8(%r14,%rbx,8),%xmm1
movsd  %xmm1,(%rsp)
movaps %xmm2,%xmm0
movapd %xmm5,0x50(%rsp)
movapd %xmm6,0x20(%rsp)
movapd %xmm7,0x40(%rsp)
call   1050 <cos@plt>
movsd  %xmm0,0x10(%rsp)
movsd  0x8(%rsp),%xmm0
call   1040 <sin@plt>
mulsd  0x10(%rsp),%xmm0
addsd  0x8(%rsp),%xmm0
mulsd  0xd06(%rip),%xmm0
movsd  %xmm0,0x8(%rsp)
movsd  (%rsp),%xmm0
call   1050 <cos@plt>
movsd  %xmm0,0x10(%rsp)
movsd  (%rsp),%xmm0
call   1040 <sin@plt>
mulsd  0x10(%rsp),%xmm0
addsd  (%rsp),%xmm0
mulsd  0xcd3(%rip),%xmm0
movsd  %xmm0,(%rsp)
movsd  0x0(%rbp),%xmm1
movapd %xmm1,%xmm0
addsd  %xmm1,%xmm0
movapd 0x40(%rsp),%xmm4
movapd %xmm4,%xmm2
subsd  %xmm0,%xmm2
movapd %xmm1,%xmm3
cmpltsd %xmm4,%xmm3
andpd  %xmm3,%xmm2
andnpd %xmm4,%xmm3
orpd   %xmm2,%xmm3
movapd %xmm1,%xmm2
xorpd  0xcb2(%rip),%xmm2
movapd %xmm0,%xmm4
addsd  %xmm3,%xmm4
movapd %xmm3,%xmm5
cmpltsd %xmm2,%xmm5
andpd  %xmm5,%xmm4
andnpd %xmm3,%xmm5
orpd   %xmm4,%xmm5
movapd %xmm5,0x40(%rsp)
movapd 0x50(%rsp),%xmm4
unpcklpd 0x20(%rsp),%xmm4
subpd  0x70(%rsp),%xmm4
unpcklpd %xmm1,%xmm1
cmpltpd %xmm4,%xmm1
unpcklpd %xmm0,%xmm0
movapd %xmm1,%xmm3
andnpd %xmm4,%xmm3
subpd  %xmm0,%xmm4
andpd  %xmm1,%xmm4
orpd   %xmm3,%xmm4
pshufd $0x44,%xmm2,%xmm1
movapd %xmm4,%xmm2
cmpltpd %xmm1,%xmm2
addpd  %xmm4,%xmm0
andpd  %xmm2,%xmm0
andnpd %xmm4,%xmm2
orpd   %xmm0,%xmm2
pshufd $0xee,%xmm2,%xmm1
movaps %xmm2,0x50(%rsp)
movapd %xmm2,%xmm0
movdqa %xmm1,0x20(%rsp)
subsd  %xmm1,%xmm0
call   1030 <abs@plt>
movsd  0x0(%rbp),%xmm1
ucomisd %xmm0,%xmm1
jbe    117b <poly_ctrlon+0x4b>
movsd  (%rsp),%xmm1
mulsd  0x50(%rsp),%xmm1
movsd  0x8(%rsp),%xmm0
mulsd  0x20(%rsp),%xmm0
addsd  %xmm1,%xmm0
movapd 0x40(%rsp),%xmm5
mulsd  %xmm0,%xmm5
movsd  0xbc5(%rip),%xmm0
mulsd  %xmm0,%xmm5
jmp    124f <poly_ctrlon+0x11f>
xorpd  %xmm1,%xmm1
movsd  0xbc0(%rip),%xmm0
mulsd  %xmm0,%xmm1
mulsd  %xmm0,%xmm1
movapd %xmm1,%xmm0
add    $0x88,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@M_PI = global double 0.000000e+00
define double @poly_ctrlon(double* %0, double* %1, i32 %2, double %3) {
%5 = alloca double*
%6 = alloca double*
%7 = alloca i32
%8 = alloca double
%9 = alloca double
%10 = alloca i32
%11 = alloca i32
%12 = alloca double
%13 = alloca double
%14 = alloca double
%15 = alloca double
%16 = alloca double
%17 = alloca double
%18 = alloca double
%19 = alloca double
%20 = alloca double
%21 = alloca double
%22 = alloca double
store double* %0, double** %5
store double* %1, double** %6
store i32 %2, i32* %7
store double %3, double* %8
store double 0.000000e+00, double* %9
%23 = load double, double* %8
store double %23, double* %8
store i32 0, i32* %10
br label %24
24: ; preds = %198, %4
%25 = load i32, i32* %10
%26 = load i32, i32* %7
%27 = icmp slt i32 %25, %26
br i1 %27, label %28, label %201
28: ; preds = %24
%29 = load i32, i32* %10
%30 = add nsw i32 %29, 1
%31 = load i32, i32* %7
%32 = srem i32 %30, %31
store i32 %32, i32* %11
%33 = load double*, double** %5
%34 = load i32, i32* %11
%35 = sext i32 %34 to i64
%36 = getelementptr inbounds double, double* %33, i64 %35
%37 = load double, double* %36
store double %37, double* %12
%38 = load double*, double** %5
%39 = load i32, i32* %10
%40 = sext i32 %39 to i64
%41 = getelementptr inbounds double, double* %38, i64 %40
%42 = load double, double* %41
store double %42, double* %13
%43 = load double*, double** %6
%44 = load i32, i32* %11
%45 = sext i32 %44 to i64
%46 = getelementptr inbounds double, double* %43, i64 %45
%47 = load double, double* %46
store double %47, double* %15
%48 = load double*, double** %6
%49 = load i32, i32* %10
%50 = sext i32 %49 to i64
%51 = getelementptr inbounds double, double* %48, i64 %50
%52 = load double, double* %51
store double %52, double* %16
%53 = load double, double* %12
%54 = load double, double* %13
%55 = fsub double %53, %54
store double %55, double* %14
%56 = load double, double* %14
%57 = fcmp oeq double %56, 0.000000e+00
br i1 %57, label %58, label %59
58: ; preds = %28
br label %198
59: ; preds = %28
%60 = load double, double* %15
%61 = call double @cos(double %60)
%62 = load double, double* %15
%63 = call double @sin(double %62)
%64 = load double, double* %15
%65 = call double @llvm.fmuladd.f64(double %61, double %63, double %64)
%66 = fmul double 5.000000e-01, %65
store double %66, double* %19
%67 = load double, double* %16
%68 = call double @cos(double %67)
%69 = load double, double* %16
%70 = call double @sin(double %69)
%71 = load double, double* %16
%72 = call double @llvm.fmuladd.f64(double %68, double %70, double %71)
%73 = fmul double 5.000000e-01, %72
store double %73, double* %20
%74 = load double, double* %14
%75 = load double, double* @M_PI
%76 = fcmp ogt double %74, %75
br i1 %76, label %77, label %81
77: ; preds = %59
%78 = load double, double* %14
%79 = load double, double* @M_PI
%80 = call double @llvm.fmuladd.f64(double -2.000000e+00, double %79, double %78)
store double %80, double* %14
br label %81
81: ; preds = %77, %59
%82 = load double, double* %14
%83 = load double, double* @M_PI
%84 = fneg double %83
%85 = fcmp olt double %82, %84
br i1 %85, label %86, label %90
86: ; preds = %81
%87 = load double, double* %14
%88 = load double, double* @M_PI
%89 = call double @llvm.fmuladd.f64(double 2.000000e+00, double %88, double %87)
store double %89, double* %14
br label %90
90: ; preds = %86, %81
%91 = load double, double* %12
%92 = load double, double* %8
%93 = fsub double %91, %92
store double %93, double* %17
%94 = load double, double* %17
%95 = load double, double* @M_PI
%96 = fcmp ogt double %94, %95
br i1 %96, label %97, label %101
97: ; preds = %90
%98 = load double, double* @M_PI
%99 = load double, double* %17
%100 = call double @llvm.fmuladd.f64(double -2.000000e+00, double %98, double %99)
store double %100, double* %17
br label %101
101: ; preds = %97, %90
%102 = load double, double* %17
%103 = load double, double* @M_PI
%104 = fneg double %103
%105 = fcmp olt double %102, %104
br i1 %105, label %106, label %110
106: ; preds = %101
%107 = load double, double* @M_PI
%108 = load double, double* %17
%109 = call double @llvm.fmuladd.f64(double 2.000000e+00, double %107, double %108)
store double %109, double* %17
br label %110
110: ; preds = %106, %101
%111 = load double, double* %13
%112 = load double, double* %8
%113 = fsub double %111, %112
store double %113, double* %18
%114 = load double, double* %18
%115 = load double, double* @M_PI
%116 = fcmp ogt double %114, %115
br i1 %116, label %117, label %121
117: ; preds = %110
%118 = load double, double* @M_PI
%119 = load double, double* %18
%120 = call double @llvm.fmuladd.f64(double -2.000000e+00, double %118, double %119)
store double %120, double* %18
br label %121
121: ; preds = %117, %110
%122 = load double, double* %18
%123 = load double, double* @M_PI
%124 = fneg double %123
%125 = fcmp olt double %122, %124
br i1 %125, label %126, label %130
126: ; preds = %121
%127 = load double, double* @M_PI
%128 = load double, double* %18
%129 = call double @llvm.fmuladd.f64(double 2.000000e+00, double %127, double %128)
store double %129, double* %18
br label %130
130: ; preds = %126, %121
%131 = load double, double* %18
%132 = load double, double* %17
%133 = fsub double %131, %132
%134 = call double @abs(double %133)
%135 = load double, double* @M_PI
%136 = fcmp olt double %134, %135
br i1 %136, label %137, label %149
137: ; preds = %130
%138 = load double, double* %14
%139 = load double, double* %17
%140 = load double, double* %19
%141 = load double, double* %18
%142 = load double, double* %20
%143 = fmul double %141, %142
%144 = call double @llvm.fmuladd.f64(double %139, double %140, double %143)
%145 = fmul double %138, %144
%146 = fdiv double %145, 2.000000e+00
%147 = load double, double* %9
%148 = fsub double %147, %146
store double %148, double* %9
br label %197
149: ; preds = %130
%150 = load double, double* %17
%151 = fcmp ogt double %150, 0.000000e+00
br i1 %151, label %152, label %154
152: ; preds = %149
%153 = load double, double* @M_PI
store double %153, double* %21
br label %157
154: ; preds = %149
%155 = load double, double* @M_PI
%156 = fneg double %155
store double %156, double* %21
br label %157
157: ; preds = %154, %152
%158 = load double, double* %19
%159 = load double, double* %20
%160 = load double, double* %19
%161 = fsub double %159, %160
%162 = load double, double* %21
%163 = load double, double* %17
%164 = fsub double %162, %163
%165 = fmul double %161, %164
%166 = load double, double* %14
%167 = call double @abs(double %166)
%168 = fdiv double %165, %167
%169 = fadd double %158, %168
store double %169, double* %22
%170 = load double, double* %17
%171 = fmul double 5.000000e-01, %170
%172 = load double, double* %17
%173 = load double, double* %21
%174 = fsub double %172, %173
%175 = fmul double %171, %174
%176 = load double, double* %19
%177 = load double, double* %18
%178 = fmul double 5.000000e-01, %177
%179 = load double, double* %18
%180 = load double, double* %21
%181 = fadd double %179, %180
%182 = fmul double %178, %181
%183 = load double, double* %20
%184 = fmul double %182, %183
%185 = fneg double %184
%186 = call double @llvm.fmuladd.f64(double %175, double %176, double %185)
%187 = load double, double* %21
%188 = fmul double 5.000000e-01, %187
%189 = load double, double* %17
%190 = load double, double* %18
%191 = fadd double %189, %190
%192 = fmul double %188, %191
%193 = load double, double* %22
%194 = call double @llvm.fmuladd.f64(double %192, double %193, double %186)
%195 = load double, double* %9
%196 = fsub double %195, %194
store double %196, double* %9
br label %197
197: ; preds = %157, %137
br label %198
198: ; preds = %197, %58
%199 = load i32, i32* %10
%200 = add nsw i32 %199, 1
store i32 %200, i32* %10
br label %24
201: ; preds = %24
%202 = load double, double* %9
%203 = fmul double %202, 6.371000e+06
%204 = fmul double %203, 6.371000e+06
ret double %204
}

LLVM IR (-O2):
@M_PI = global double 0.000000e+00
define double @poly_ctrlon(double* nocapture %0, double* nocapture %1, i32 %2, double %3) {
%5 = icmp sgt i32 %2, 0
br i1 %5, label %6, label %96
6: ; preds = %4
%7 = zext i32 %2 to i64
%8 = insertelement <2 x double> poison, double %3, i64 0
%9 = shufflevector <2 x double> %8, <2 x double> poison, <2 x i32> zeroinitializer
br label %10
10: ; preds = %6, %93
%11 = phi i64 [ 0, %6 ], [ %13, %93 ]
%12 = phi double [ 0.000000e+00, %6 ], [ %94, %93 ]
%13 = add nuw nsw i64 %11, 1
%14 = icmp eq i64 %13, %7
%15 = and i64 %13, 4294967295
%16 = select i1 %14, i64 0, i64 %15
%17 = getelementptr inbounds double, double* %0, i64 %16
%18 = load double, double* %17
%19 = getelementptr inbounds double, double* %0, i64 %11
%20 = load double, double* %19
%21 = getelementptr inbounds double, double* %1, i64 %16
%22 = load double, double* %21
%23 = getelementptr inbounds double, double* %1, i64 %11
%24 = load double, double* %23
%25 = fsub double %18, %20
%26 = fcmp oeq double %25, 0.000000e+00
br i1 %26, label %93, label %27
27: ; preds = %10
%28 = tail call double @cos(double %22)
%29 = tail call double @sin(double %22)
%30 = tail call double @llvm.fmuladd.f64(double %28, double %29, double %22)
%31 = fmul double %30, 5.000000e-01
%32 = tail call double @cos(double %24)
%33 = tail call double @sin(double %24)
%34 = tail call double @llvm.fmuladd.f64(double %32, double %33, double %24)
%35 = fmul double %34, 5.000000e-01
%36 = load double, double* @M_PI
%37 = fcmp ogt double %25, %36
%38 = tail call double @llvm.fmuladd.f64(double %36, double -2.000000e+00, double %25)
%39 = select i1 %37, double %38, double %25
%40 = fneg double %36
%41 = fcmp olt double %39, %40
%42 = tail call double @llvm.fmuladd.f64(double %36, double 2.000000e+00, double %39)
%43 = select i1 %41, double %42, double %39
%44 = insertelement <2 x double> poison, double %20, i64 0
%45 = insertelement <2 x double> %44, double %18, i64 1
%46 = fsub <2 x double> %45, %9
%47 = insertelement <2 x double> poison, double %36, i64 0
%48 = shufflevector <2 x double> %47, <2 x double> poison, <2 x i32> zeroinitializer
%49 = fcmp ogt <2 x double> %46, %48
%50 = call <2 x double> @llvm.fmuladd.v2f64(<2 x double> %48, <2 x double> <double -2.000000e+00, double -2.000000e+00>, <2 x double> %46)
%51 = select <2 x i1> %49, <2 x double> %50, <2 x double> %46
%52 = insertelement <2 x double> poison, double %40, i64 0
%53 = shufflevector <2 x double> %52, <2 x double> poison, <2 x i32> zeroinitializer
%54 = fcmp olt <2 x double> %51, %53
%55 = call <2 x double> @llvm.fmuladd.v2f64(<2 x double> %48, <2 x double> <double 2.000000e+00, double 2.000000e+00>, <2 x double> %51)
%56 = select <2 x i1> %54, <2 x double> %55, <2 x double> %51
%57 = extractelement <2 x double> %56, i64 0
%58 = extractelement <2 x double> %56, i64 1
%59 = fsub double %57, %58
%60 = tail call double @abs(double %59)
%61 = load double, double* @M_PI
%62 = fcmp olt double %60, %61
br i1 %62, label %63, label %68
63: ; preds = %27
%64 = fmul double %35, %57
%65 = tail call double @llvm.fmuladd.f64(double %58, double %31, double %64)
%66 = fmul double %43, %65
%67 = fmul double %66, 5.000000e-01
br label %90
68: ; preds = %27
%69 = fcmp ogt double %58, 0.000000e+00
%70 = fneg double %61
%71 = select i1 %69, double %61, double %70
%72 = fsub double %35, %31
%73 = fsub double %71, %58
%74 = fmul double %72, %73
%75 = tail call double @abs(double %43)
%76 = fdiv double %74, %75
%77 = fadd double %31, %76
%78 = fmul double %58, 5.000000e-01
%79 = fsub double %58, %71
%80 = fmul double %78, %79
%81 = fadd double %57, %71
%82 = fmul double %57, -5.000000e-01
%83 = fmul double %82, %81
%84 = fmul double %35, %83
%85 = tail call double @llvm.fmuladd.f64(double %80, double %31, double %84)
%86 = fmul double %71, 5.000000e-01
%87 = fadd double %58, %57
%88 = fmul double %87, %86
%89 = tail call double @llvm.fmuladd.f64(double %88, double %77, double %85)
br label %90
90: ; preds = %68, %63
%91 = phi double [ %67, %63 ], [ %89, %68 ]
%92 = fsub double %12, %91
br label %93
93: ; preds = %10, %90
%94 = phi double [ %92, %90 ], [ %12, %10 ]
%95 = icmp eq i64 %13, %7
br i1 %95, label %96, label %10
96: ; preds = %93, %4
%97 = phi double [ 0.000000e+00, %4 ], [ %94, %93 ]
%98 = fmul double %97, 6.371000e+06
%99 = fmul double %98, 6.371000e+06
ret double %99
}