#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 cos(double);
double fabs(double);
double sin(double);
double box_ctrlon(double ll_lon, double ll_lat, double ur_lon, double ur_lat,
                  double clon) {
  double phi1, phi2, dphi, lat1, lat2, dphi1, dphi2;
  double f1, f2, fac, fint;
  double ctrlon = 0.0;
  int i;
  clon = clon;
  for (i = 0; i < 2; i++) {
    if (i == 0) {
      phi1 = ur_lon;
      phi2 = ll_lon;
      lat1 = lat2 = ll_lat;
    } else {
      phi1 = ll_lon;
      phi2 = ur_lon;
      lat1 = lat2 = ur_lat;
    }
    dphi = phi1 - phi2;
    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 (fabs(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) / fabs(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):
<box_ctrlon>:
push   %rbp
mov    %rsp,%rbp
sub    $0xa0,%rsp
movsd  %xmm0,-0x8(%rbp)
movsd  %xmm1,-0x10(%rbp)
movsd  %xmm2,-0x18(%rbp)
movsd  %xmm3,-0x20(%rbp)
movsd  %xmm4,-0x28(%rbp)
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x88(%rbp)
ff
movsd  -0x28(%rbp),%xmm0
movsd  %xmm0,-0x28(%rbp)
movl   $0x0,-0x8c(%rbp)
cmpl   $0x2,-0x8c(%rbp)
jge    15b2 <box_ctrlon+0x492>
cmpl   $0x0,-0x8c(%rbp)
jne    11a5 <box_ctrlon+0x85>
movsd  -0x18(%rbp),%xmm0
movsd  %xmm0,-0x30(%rbp)
movsd  -0x8(%rbp),%xmm0
movsd  %xmm0,-0x38(%rbp)
movsd  -0x10(%rbp),%xmm0
movsd  %xmm0,-0x50(%rbp)
movsd  %xmm0,-0x48(%rbp)
jmp    11c8 <box_ctrlon+0xa8>
movsd  -0x8(%rbp),%xmm0
movsd  %xmm0,-0x30(%rbp)
movsd  -0x18(%rbp),%xmm0
movsd  %xmm0,-0x38(%rbp)
movsd  -0x20(%rbp),%xmm0
movsd  %xmm0,-0x50(%rbp)
movsd  %xmm0,-0x48(%rbp)
movsd  -0x30(%rbp),%xmm0
subsd  -0x38(%rbp),%xmm0
movsd  %xmm0,-0x40(%rbp)
movsd  -0x48(%rbp),%xmm0
call   1040 <cos@plt>
movsd  %xmm0,-0xa0(%rbp)
ff
movsd  -0x48(%rbp),%xmm0
call   1030 <sin@plt>
movsd  -0xa0(%rbp),%xmm1
ff
movaps %xmm0,%xmm2
movsd  -0x48(%rbp),%xmm0
mulsd  %xmm2,%xmm1
addsd  %xmm0,%xmm1
movsd  0xdf5(%rip),%xmm0
mulsd  %xmm1,%xmm0
movsd  %xmm0,-0x68(%rbp)
movsd  -0x50(%rbp),%xmm0
call   1040 <cos@plt>
movsd  %xmm0,-0x98(%rbp)
ff
movsd  -0x50(%rbp),%xmm0
call   1030 <sin@plt>
movsd  -0x98(%rbp),%xmm1
ff
movaps %xmm0,%xmm2
movsd  -0x50(%rbp),%xmm0
mulsd  %xmm2,%xmm1
addsd  %xmm0,%xmm1
movsd  0xdb0(%rip),%xmm0
mulsd  %xmm1,%xmm0
movsd  %xmm0,-0x70(%rbp)
movsd  -0x40(%rbp),%xmm0
mov    0x2d7b(%rip),%rax
ucomisd (%rax),%xmm0
jbe    1294 <box_ctrlon+0x174>
movsd  -0x40(%rbp),%xmm0
mov    0x2d65(%rip),%rax
movsd  (%rax),%xmm1
addsd  %xmm1,%xmm1
subsd  %xmm1,%xmm0
movsd  %xmm0,-0x40(%rbp)
movsd  -0x40(%rbp),%xmm1
mov    0x2d48(%rip),%rax
movsd  (%rax),%xmm0
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
ucomisd %xmm1,%xmm0
jbe    12e2 <box_ctrlon+0x1c2>
movsd  -0x40(%rbp),%xmm1
mov    0x2d17(%rip),%rax
movsd  (%rax),%xmm0
addsd  %xmm0,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x40(%rbp)
movsd  -0x30(%rbp),%xmm0
subsd  -0x28(%rbp),%xmm0
movsd  %xmm0,-0x58(%rbp)
movsd  -0x58(%rbp),%xmm0
mov    0x2ceb(%rip),%rax
ucomisd (%rax),%xmm0
jbe    1324 <box_ctrlon+0x204>
mov    0x2cda(%rip),%rax
movsd  (%rax),%xmm1
movsd  -0x58(%rbp),%xmm0
addsd  %xmm1,%xmm1
subsd  %xmm1,%xmm0
movsd  %xmm0,-0x58(%rbp)
movsd  -0x58(%rbp),%xmm1
mov    0x2cb8(%rip),%rax
movsd  (%rax),%xmm0
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
ucomisd %xmm1,%xmm0
jbe    1372 <box_ctrlon+0x252>
mov    0x2c8c(%rip),%rax
movsd  (%rax),%xmm0
movsd  -0x58(%rbp),%xmm1
addsd  %xmm0,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x58(%rbp)
movsd  -0x38(%rbp),%xmm0
subsd  -0x28(%rbp),%xmm0
movsd  %xmm0,-0x60(%rbp)
movsd  -0x60(%rbp),%xmm0
mov    0x2c5b(%rip),%rax
ucomisd (%rax),%xmm0
jbe    13b4 <box_ctrlon+0x294>
mov    0x2c4a(%rip),%rax
movsd  (%rax),%xmm1
movsd  -0x60(%rbp),%xmm0
addsd  %xmm1,%xmm1
subsd  %xmm1,%xmm0
movsd  %xmm0,-0x60(%rbp)
movsd  -0x60(%rbp),%xmm1
mov    0x2c28(%rip),%rax
movsd  (%rax),%xmm0
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
ucomisd %xmm1,%xmm0
jbe    1402 <box_ctrlon+0x2e2>
mov    0x2bfc(%rip),%rax
movsd  (%rax),%xmm0
movsd  -0x60(%rbp),%xmm1
addsd  %xmm0,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x60(%rbp)
movsd  -0x60(%rbp),%xmm1
subsd  -0x58(%rbp),%xmm1
movaps 0xc0d(%rip),%xmm0
pand   %xmm0,%xmm1
mov    0x2bca(%rip),%rax
movsd  (%rax),%xmm0
ucomisd %xmm1,%xmm0
jbe    1476 <box_ctrlon+0x356>
movsd  -0x40(%rbp),%xmm1
movsd  -0x58(%rbp),%xmm0
movsd  -0x68(%rbp),%xmm3
movsd  -0x60(%rbp),%xmm2
mulsd  -0x70(%rbp),%xmm2
mulsd  %xmm3,%xmm0
addsd  %xmm2,%xmm0
mulsd  %xmm0,%xmm1
movsd  0xbb7(%rip),%xmm0
divsd  %xmm0,%xmm1
movsd  -0x88(%rbp),%xmm0
ff
subsd  %xmm1,%xmm0
movsd  %xmm0,-0x88(%rbp)
ff
jmp    1599 <box_ctrlon+0x479>
movsd  -0x58(%rbp),%xmm0
xorps  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
jbe    149d <box_ctrlon+0x37d>
mov    0x2b59(%rip),%rax
movsd  (%rax),%xmm0
movsd  %xmm0,-0x78(%rbp)
jmp    14c4 <box_ctrlon+0x3a4>
mov    0x2b44(%rip),%rax
movsd  (%rax),%xmm0
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
movsd  %xmm0,-0x78(%rbp)
movsd  -0x68(%rbp),%xmm0
movsd  -0x70(%rbp),%xmm1
subsd  -0x68(%rbp),%xmm1
movsd  -0x78(%rbp),%xmm2
subsd  -0x58(%rbp),%xmm2
mulsd  %xmm2,%xmm1
movsd  -0x40(%rbp),%xmm2
movaps 0xb33(%rip),%xmm3
pand   %xmm3,%xmm2
divsd  %xmm2,%xmm1
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x80(%rbp)
movsd  0xb02(%rip),%xmm0
mulsd  -0x58(%rbp),%xmm0
movsd  -0x58(%rbp),%xmm1
subsd  -0x78(%rbp),%xmm1
mulsd  %xmm1,%xmm0
movsd  -0x68(%rbp),%xmm2
movsd  0xae2(%rip),%xmm1
mulsd  -0x60(%rbp),%xmm1
movsd  -0x60(%rbp),%xmm3
addsd  -0x78(%rbp),%xmm3
mulsd  %xmm3,%xmm1
mulsd  -0x70(%rbp),%xmm1
movq   %xmm1,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  0xaa3(%rip),%xmm1
mulsd  -0x78(%rbp),%xmm1
movsd  -0x58(%rbp),%xmm2
addsd  -0x60(%rbp),%xmm2
mulsd  %xmm2,%xmm1
movsd  -0x80(%rbp),%xmm2
mulsd  %xmm2,%xmm1
addsd  %xmm0,%xmm1
movsd  -0x88(%rbp),%xmm0
ff
subsd  %xmm1,%xmm0
movsd  %xmm0,-0x88(%rbp)
ff
jmp    159e <box_ctrlon+0x47e>
mov    -0x8c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8c(%rbp)
jmp    1163 <box_ctrlon+0x43>
movsd  0xa46(%rip),%xmm0
mulsd  -0x88(%rbp),%xmm0
ff
movsd  0xa36(%rip),%xmm1
mulsd  %xmm1,%xmm0
add    $0xa0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<box_ctrlon>:
push   %r14
push   %rbx
sub    $0x88,%rsp
movsd  %xmm4,0x48(%rsp)
movsd  %xmm3,0x38(%rsp)
movsd  %xmm2,0x20(%rsp)
movsd  %xmm1,0x40(%rsp)
movsd  %xmm0,0x18(%rsp)
xorpd  %xmm0,%xmm0
mov    $0x1,%bl
mov    0x2e93(%rip),%r14
jmp    1206 <box_ctrlon+0xe6>
nopw   0x0(%rax,%rax,1)
xorpd  %xmm6,%xmm6
cmpltsd %xmm3,%xmm6
andpd  %xmm6,%xmm2
andnpd %xmm8,%xmm6
orpd   %xmm2,%xmm6
movapd %xmm0,%xmm4
movsd  0x28(%rsp),%xmm8
subsd  %xmm8,%xmm4
movapd %xmm6,%xmm2
subsd  %xmm3,%xmm2
mulsd  %xmm4,%xmm2
andpd  %xmm7,%xmm1
divsd  %xmm1,%xmm2
addsd  %xmm8,%xmm2
movapd %xmm3,%xmm1
mulsd  %xmm10,%xmm1
movapd %xmm3,%xmm4
subsd  %xmm6,%xmm4
mulsd  %xmm1,%xmm4
addsd  %xmm5,%xmm3
movapd %xmm5,%xmm1
addsd  %xmm6,%xmm1
mulsd  0xe48(%rip),%xmm5
mulsd  %xmm1,%xmm5
mulsd  %xmm0,%xmm5
mulsd  %xmm8,%xmm4
addsd  %xmm5,%xmm4
mulsd  %xmm10,%xmm6
mulsd  %xmm3,%xmm6
mulsd  %xmm2,%xmm6
addsd  %xmm4,%xmm6
movapd %xmm6,%xmm1
movsd  0x30(%rsp),%xmm0
subsd  %xmm1,%xmm0
test   $0x1,%bl
mov    $0x0,%ebx
je     140e <box_ctrlon+0x2ee>
movsd  %xmm0,0x30(%rsp)
movsd  0x40(%rsp),%xmm0
movsd  0x18(%rsp),%xmm2
movsd  0x20(%rsp),%xmm1
test   $0x1,%bl
jne    1235 <box_ctrlon+0x115>
movsd  0x38(%rsp),%xmm0
movsd  0x20(%rsp),%xmm2
movsd  0x18(%rsp),%xmm1
movsd  %xmm0,0x8(%rsp)
movapd %xmm1,0x60(%rsp)
movapd %xmm2,0x70(%rsp)
subsd  %xmm2,%xmm1
movapd %xmm1,0x50(%rsp)
call   1040 <cos@plt>
movsd  %xmm0,0x10(%rsp)
movsd  0x8(%rsp),%xmm0
call   1030 <sin@plt>
movapd %xmm0,%xmm1
mulsd  0x10(%rsp),%xmm1
movsd  0x8(%rsp),%xmm2
addsd  %xmm2,%xmm1
movsd  0xd7d(%rip),%xmm0
mulsd  %xmm0,%xmm1
movsd  %xmm1,0x28(%rsp)
movapd %xmm2,%xmm0
call   1040 <cos@plt>
movsd  %xmm0,0x10(%rsp)
movsd  0x8(%rsp),%xmm0
call   1030 <sin@plt>
movsd  0xd50(%rip),%xmm10
mulsd  0x10(%rsp),%xmm0
addsd  0x8(%rsp),%xmm0
mulsd  %xmm10,%xmm0
movsd  (%r14),%xmm2
movapd %xmm2,%xmm5
mulsd  0xd36(%rip),%xmm5
movapd %xmm5,%xmm1
movapd 0x50(%rsp),%xmm4
addsd  %xmm4,%xmm1
movapd %xmm2,%xmm3
cmpltsd %xmm4,%xmm3
movapd %xmm4,%xmm6
movapd %xmm3,%xmm4
andnpd %xmm6,%xmm4
andpd  %xmm1,%xmm3
orpd   %xmm4,%xmm3
movapd %xmm2,%xmm8
xorpd  0xd15(%rip),%xmm8
movapd %xmm2,%xmm6
addsd  %xmm2,%xmm6
movapd %xmm6,%xmm7
addsd  %xmm3,%xmm7
movapd %xmm3,%xmm1
cmpltsd %xmm8,%xmm1
andpd  %xmm1,%xmm7
andnpd %xmm3,%xmm1
orpd   %xmm7,%xmm1
movsd  0x48(%rsp),%xmm9
movapd 0x60(%rsp),%xmm4
subsd  %xmm9,%xmm4
movapd %xmm5,%xmm3
addsd  %xmm4,%xmm3
movapd %xmm2,%xmm7
cmpltsd %xmm4,%xmm7
movapd %xmm4,%xmm11
movapd %xmm7,%xmm4
andnpd %xmm11,%xmm4
andpd  %xmm3,%xmm7
orpd   %xmm4,%xmm7
movapd %xmm6,%xmm4
addsd  %xmm7,%xmm4
movapd %xmm7,%xmm3
cmpltsd %xmm8,%xmm3
andpd  %xmm3,%xmm4
andnpd %xmm7,%xmm3
orpd   %xmm4,%xmm3
movapd 0x70(%rsp),%xmm7
subsd  %xmm9,%xmm7
addsd  %xmm7,%xmm5
movapd %xmm2,%xmm4
cmpltsd %xmm7,%xmm4
movapd %xmm7,%xmm9
movapd %xmm4,%xmm7
andnpd %xmm9,%xmm7
andpd  %xmm5,%xmm4
orpd   %xmm7,%xmm4
addsd  %xmm4,%xmm6
movapd %xmm4,%xmm5
cmpltsd %xmm8,%xmm5
andpd  %xmm5,%xmm6
andnpd %xmm4,%xmm5
orpd   %xmm6,%xmm5
movapd %xmm5,%xmm4
subsd  %xmm3,%xmm4
movapd 0xc50(%rip),%xmm7
andpd  %xmm7,%xmm4
ucomisd %xmm4,%xmm2
jbe    1160 <box_ctrlon+0x40>
mulsd  %xmm5,%xmm0
movsd  0x28(%rsp),%xmm2
mulsd  %xmm3,%xmm2
addsd  %xmm0,%xmm2
mulsd  %xmm2,%xmm1
mulsd  %xmm10,%xmm1
jmp    11ee <box_ctrlon+0xce>
movsd  0xc02(%rip),%xmm1
mulsd  %xmm1,%xmm0
mulsd  %xmm1,%xmm0
add    $0x88,%rsp
pop    %rbx
pop    %r14
ret

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

LLVM IR (-O2):
@M_PI = global double 0.000000e+00
define double @box_ctrlon(double %0, double %1, double %2, double %3, double %4) {
br label %6
6: ; preds = %5, %72
%7 = phi i1 [ true, %5 ], [ false, %72 ]
%8 = phi double [ 0.000000e+00, %5 ], [ %74, %72 ]
%9 = select i1 %7, double %1, double %3
%10 = select i1 %7, double %0, double %2
%11 = select i1 %7, double %2, double %0
%12 = fsub double %11, %10
%13 = tail call double @cos(double %9)
%14 = tail call double @sin(double %9)
%15 = tail call double @llvm.fmuladd.f64(double %13, double %14, double %9)
%16 = fmul double %15, 5.000000e-01
%17 = tail call double @cos(double %9)
%18 = tail call double @sin(double %9)
%19 = tail call double @llvm.fmuladd.f64(double %17, double %18, double %9)
%20 = fmul double %19, 5.000000e-01
%21 = load double, double* @M_PI
%22 = fcmp ogt double %12, %21
%23 = tail call double @llvm.fmuladd.f64(double %21, double -2.000000e+00, double %12)
%24 = select i1 %22, double %23, double %12
%25 = fneg double %21
%26 = fcmp olt double %24, %25
%27 = tail call double @llvm.fmuladd.f64(double %21, double 2.000000e+00, double %24)
%28 = select i1 %26, double %27, double %24
%29 = fsub double %11, %4
%30 = fcmp ogt double %29, %21
%31 = tail call double @llvm.fmuladd.f64(double %21, double -2.000000e+00, double %29)
%32 = select i1 %30, double %31, double %29
%33 = fcmp olt double %32, %25
%34 = tail call double @llvm.fmuladd.f64(double %21, double 2.000000e+00, double %32)
%35 = select i1 %33, double %34, double %32
%36 = fsub double %10, %4
%37 = fcmp ogt double %36, %21
%38 = tail call double @llvm.fmuladd.f64(double %21, double -2.000000e+00, double %36)
%39 = select i1 %37, double %38, double %36
%40 = fcmp olt double %39, %25
%41 = tail call double @llvm.fmuladd.f64(double %21, double 2.000000e+00, double %39)
%42 = select i1 %40, double %41, double %39
%43 = fsub double %42, %35
%44 = tail call double @llvm.fabs.f64(double %43)
%45 = fcmp olt double %44, %21
br i1 %45, label %46, label %51
46: ; preds = %6
%47 = fmul double %20, %42
%48 = tail call double @llvm.fmuladd.f64(double %35, double %16, double %47)
%49 = fmul double %28, %48
%50 = fmul double %49, 5.000000e-01
br label %72
51: ; preds = %6
%52 = fcmp ogt double %35, 0.000000e+00
%53 = select i1 %52, double %21, double %25
%54 = fsub double %20, %16
%55 = fsub double %53, %35
%56 = fmul double %54, %55
%57 = tail call double @llvm.fabs.f64(double %28)
%58 = fdiv double %56, %57
%59 = fadd double %16, %58
%60 = fmul double %35, 5.000000e-01
%61 = fsub double %35, %53
%62 = fmul double %60, %61
%63 = fadd double %42, %53
%64 = fmul double %42, -5.000000e-01
%65 = fmul double %64, %63
%66 = fmul double %20, %65
%67 = tail call double @llvm.fmuladd.f64(double %62, double %16, double %66)
%68 = fmul double %53, 5.000000e-01
%69 = fadd double %35, %42
%70 = fmul double %69, %68
%71 = tail call double @llvm.fmuladd.f64(double %70, double %59, double %67)
br label %72
72: ; preds = %46, %51
%73 = phi double [ %50, %46 ], [ %71, %51 ]
%74 = fsub double %8, %73
br i1 %7, label %6, label %75
75: ; preds = %72
%76 = fmul double %74, 6.371000e+06
%77 = fmul double %76, 6.371000e+06
ret double %77
}