#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 acos(double);
double pow(int, double);
double tan(double);
void thornthwaite(double tempSeries[], int n, double lat, double etpSeries[]) {
  double T, J, J2, J3, c, N, omega, K[13], tanLatMonth;
  int month, i, k;
  double pi = 3.14159265358979;
  double tanLat = tan(0.0174532925 * lat);
  double tanDelta[13] = {-0.37012566, -0.23853358, -0.04679872, 0.16321764,
                         0.32930908,  0.40677729,  0.3747741,   0.239063,
                         0.04044485,  -0.16905776, -0.33306377, -0.40743608};
  double days[13] = {31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31};
  J = 0;
  for (month = 1; month < 13; month++) {
    T = k = 0;
    for (i = month - 1; i < n; i += 12) {
      T = T + tempSeries[i];
      k++;
    }
    T = T / k;
    if (T > 0)
      J = J + pow(T / 5, 1.514);
  }
  J2 = J * J;
  J3 = J2 * J;
  c = 0.000000675 * J3 - 0.0000771 * J2 + 0.01792 * J + 0.49239;
  for (month = 1; month < 13; month++) {
    tanLatMonth = tanLat * tanDelta[month - 1];
    if (tanLatMonth > -1 && tanLatMonth < 1)
      omega = acos(-tanLatMonth);
    if (tanLatMonth <= -1)
      omega = 0;
    if (tanLatMonth >= 1)
      omega = pi;
    N = 24 * omega / pi;
    K[month] = N / 12 * days[month - 1] / 30;
  }
  month = 1;
  for (i = 0; i < n; i++) {
    if (tempSeries[i] > 0 && J > 0)
      etpSeries[i] = K[month] * 16 * pow((10 * tempSeries[i] / J), c);
    else
      etpSeries[i] = 0;
    if (month < 12)
      month++;
    else
      month = 1;
  }
}


x86 assembly (clang, -O0):
<thornthwaite>:
push   %rbp
mov    %rsp,%rbp
sub    $0x1d0,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
movsd  %xmm0,-0x18(%rbp)
mov    %rdx,-0x20(%rbp)
movsd  0xea5(%rip),%xmm0
movsd  %xmm0,-0xe0(%rbp)
ff
movsd  0xe8d(%rip),%xmm0
mulsd  -0x18(%rbp),%xmm0
call   1050 <tan@plt>
movsd  %xmm0,-0xe8(%rbp)
ff
lea    -0x150(%rbp),%rdi
lea    0xeed(%rip),%rsi
mov    $0x68,%edx
call   1040 <memcpy@plt>
lea    -0x1c0(%rbp),%rdi
lea    0xf45(%rip),%rsi
mov    $0x68,%edx
call   1040 <memcpy@plt>
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x30(%rbp)
movl   $0x1,-0xcc(%rbp)
cmpl   $0xd,-0xcc(%rbp)
jge    12c5 <thornthwaite+0x185>
movl   $0x0,-0xd4(%rbp)
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x28(%rbp)
mov    -0xcc(%rbp),%eax
sub    $0x1,%eax
mov    %eax,-0xd0(%rbp)
mov    -0xd0(%rbp),%eax
cmp    -0xc(%rbp),%eax
jge    1241 <thornthwaite+0x101>
movsd  -0x28(%rbp),%xmm0
mov    -0x8(%rbp),%rax
movslq -0xd0(%rbp),%rcx
addsd  (%rax,%rcx,8),%xmm0
movsd  %xmm0,-0x28(%rbp)
mov    -0xd4(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xd4(%rbp)
mov    -0xd0(%rbp),%eax
add    $0xc,%eax
mov    %eax,-0xd0(%rbp)
jmp    11f5 <thornthwaite+0xb5>
movsd  -0x28(%rbp),%xmm0
cvtsi2sdl -0xd4(%rbp),%xmm1
ff
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x28(%rbp)
movsd  -0x28(%rbp),%xmm0
xorps  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
jbe    12ac <thornthwaite+0x16c>
movsd  -0x30(%rbp),%xmm0
movsd  %xmm0,-0x1c8(%rbp)
ff
movsd  -0x28(%rbp),%xmm0
movsd  0xded(%rip),%xmm1
divsd  %xmm1,%xmm0
cvttsd2si %xmm0,%edi
movsd  0xdd5(%rip),%xmm0
call   1060 <pow@plt>
movaps %xmm0,%xmm1
movsd  -0x1c8(%rbp),%xmm0
ff
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x30(%rbp)
jmp    12b1 <thornthwaite+0x171>
mov    -0xcc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xcc(%rbp)
jmp    11c7 <thornthwaite+0x87>
movsd  -0x30(%rbp),%xmm0
mulsd  -0x30(%rbp),%xmm0
movsd  %xmm0,-0x38(%rbp)
movsd  -0x38(%rbp),%xmm0
mulsd  -0x30(%rbp),%xmm0
movsd  %xmm0,-0x40(%rbp)
movsd  -0x40(%rbp),%xmm1
movsd  0xd38(%rip),%xmm0
mulsd  -0x38(%rbp),%xmm0
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
movsd  0xd0c(%rip),%xmm2
mulsd  %xmm2,%xmm1
addsd  %xmm0,%xmm1
movsd  -0x30(%rbp),%xmm0
movsd  0xcef(%rip),%xmm2
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  0xcd7(%rip),%xmm1
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x48(%rbp)
movl   $0x1,-0xcc(%rbp)
cmpl   $0xd,-0xcc(%rbp)
jge    148a <thornthwaite+0x34a>
movsd  -0xe8(%rbp),%xmm0
ff
mov    -0xcc(%rbp),%eax
sub    $0x1,%eax
cltq
mulsd  -0x150(%rbp,%rax,8),%xmm0
ff ff
movsd  %xmm0,-0xc8(%rbp)
ff
movsd  -0xc8(%rbp),%xmm0
ff
movsd  0xcb3(%rip),%xmm1
ucomisd %xmm1,%xmm0
jbe    13d6 <thornthwaite+0x296>
movsd  0xca9(%rip),%xmm0
ucomisd -0xc8(%rbp),%xmm0
ff
jbe    13d6 <thornthwaite+0x296>
movsd  -0xc8(%rbp),%xmm0
ff
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
call   1030 <acos@plt>
movsd  %xmm0,-0x58(%rbp)
movsd  0xc62(%rip),%xmm0
ucomisd -0xc8(%rbp),%xmm0
ff
jb     13f4 <thornthwaite+0x2b4>
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x58(%rbp)
movsd  -0xc8(%rbp),%xmm0
ff
movsd  0xc44(%rip),%xmm1
ucomisd %xmm1,%xmm0
jb     141b <thornthwaite+0x2db>
movsd  -0xe0(%rbp),%xmm0
ff
movsd  %xmm0,-0x58(%rbp)
movsd  0xc3d(%rip),%xmm0
mulsd  -0x58(%rbp),%xmm0
divsd  -0xe0(%rbp),%xmm0
ff
movsd  %xmm0,-0x50(%rbp)
movsd  -0x50(%rbp),%xmm0
movsd  0xc16(%rip),%xmm1
divsd  %xmm1,%xmm0
mov    -0xcc(%rbp),%eax
sub    $0x1,%eax
cltq
mulsd  -0x1c0(%rbp,%rax,8),%xmm0
ff ff
movsd  0xbee(%rip),%xmm1
divsd  %xmm1,%xmm0
movslq -0xcc(%rbp),%rax
movsd  %xmm0,-0xc0(%rbp,%rax,8)
ff ff
mov    -0xcc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xcc(%rbp)
jmp    134c <thornthwaite+0x20c>
movl   $0x1,-0xcc(%rbp)
movl   $0x0,-0xd0(%rbp)
mov    -0xd0(%rbp),%eax
cmp    -0xc(%rbp),%eax
jge    15a2 <thornthwaite+0x462>
mov    -0x8(%rbp),%rax
movslq -0xd0(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
xorps  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
jbe    154b <thornthwaite+0x40b>
movsd  -0x30(%rbp),%xmm0
xorps  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
jbe    154b <thornthwaite+0x40b>
movslq -0xcc(%rbp),%rax
movsd  0xb4d(%rip),%xmm0
mulsd  -0xc0(%rbp,%rax,8),%xmm0
ff ff
movsd  %xmm0,-0x1d0(%rbp)
ff
mov    -0x8(%rbp),%rax
movslq -0xd0(%rbp),%rcx
movsd  0xb21(%rip),%xmm0
mulsd  (%rax,%rcx,8),%xmm0
divsd  -0x30(%rbp),%xmm0
cvttsd2si %xmm0,%edi
movsd  -0x48(%rbp),%xmm0
call   1060 <pow@plt>
movaps %xmm0,%xmm1
movsd  -0x1d0(%rbp),%xmm0
ff
mulsd  %xmm1,%xmm0
mov    -0x20(%rbp),%rax
movslq -0xd0(%rbp),%rcx
movsd  %xmm0,(%rax,%rcx,8)
jmp    155e <thornthwaite+0x41e>
mov    -0x20(%rbp),%rax
movslq -0xd0(%rbp),%rcx
xorps  %xmm0,%xmm0
movsd  %xmm0,(%rax,%rcx,8)
cmpl   $0xc,-0xcc(%rbp)
jge    157f <thornthwaite+0x43f>
mov    -0xcc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xcc(%rbp)
jmp    1589 <thornthwaite+0x449>
movl   $0x1,-0xcc(%rbp)
jmp    158e <thornthwaite+0x44e>
mov    -0xd0(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xd0(%rbp)
jmp    149e <thornthwaite+0x35e>
add    $0x1d0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<thornthwaite>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x98,%rsp
mov    %rdx,%r14
mov    %esi,%r15d
mov    %rdi,%r12
mulsd  0xeae(%rip),%xmm0
call   1040 <tan@plt>
movsd  %xmm0,0x18(%rsp)
movslq %r15d,%rbp
mov    $0x1,%r13d
xorpd  %xmm2,%xmm2
xor    %ebx,%ebx
xorpd  %xmm0,%xmm0
movsd  %xmm0,0x8(%rsp)
jmp    118e <thornthwaite+0x5e>
nopl   0x0(%rax,%rax,1)
add    $0x1,%r13d
add    $0x1,%rbx
cmp    $0xc,%rbx
je     1205 <thornthwaite+0xd5>
mov    $0x0,%eax
xorpd  %xmm0,%xmm0
cmp    %r15d,%r13d
jg     11c2 <thornthwaite+0x92>
xor    %eax,%eax
xorpd  %xmm0,%xmm0
mov    %rbx,%rcx
cs nopw 0x0(%rax,%rax,1)
nop
addsd  (%r12,%rcx,8),%xmm0
add    $0x1,%eax
add    $0xc,%rcx
cmp    %rbp,%rcx
jl     11b0 <thornthwaite+0x80>
xorps  %xmm1,%xmm1
cvtsi2sd %eax,%xmm1
divsd  %xmm1,%xmm0
ucomisd %xmm2,%xmm0
jbe    1180 <thornthwaite+0x50>
divsd  0xe2d(%rip),%xmm0
cvttsd2si %xmm0,%edi
movsd  0xe29(%rip),%xmm0
call   1050 <pow@plt>
xorpd  %xmm2,%xmm2
movsd  0x8(%rsp),%xmm1
addsd  %xmm0,%xmm1
movsd  %xmm1,0x8(%rsp)
jmp    1180 <thornthwaite+0x50>
movsd  0x8(%rsp),%xmm2
movapd %xmm2,%xmm0
mulsd  %xmm2,%xmm0
movapd %xmm2,%xmm1
mulsd  %xmm0,%xmm1
mulsd  0xdf5(%rip),%xmm0
mulsd  0xdf5(%rip),%xmm1
addsd  %xmm0,%xmm1
movsd  0xdf1(%rip),%xmm0
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,0x10(%rsp)
xor    %ebx,%ebx
lea    0xe42(%rip),%r13
movsd  0xdda(%rip),%xmm2
movsd  0xdda(%rip),%xmm3
movsd  0xdda(%rip),%xmm4
movsd  0xdd9(%rip),%xmm8
movsd  0xdd9(%rip),%xmm6
lea    0xe82(%rip),%rbp
movsd  0xdd2(%rip),%xmm7
jmp    12dc <thornthwaite+0x1ac>
nopl   0x0(%rax,%rax,1)
movapd %xmm3,%xmm5
cmpnlesd %xmm1,%xmm5
cmpnlesd %xmm2,%xmm1
andpd  %xmm0,%xmm1
andpd  %xmm5,%xmm1
andnpd %xmm4,%xmm5
orpd   %xmm1,%xmm5
movapd %xmm5,%xmm0
movapd %xmm5,%xmm1
mulsd  %xmm8,%xmm1
divsd  %xmm4,%xmm1
divsd  %xmm6,%xmm1
mulsd  (%rbx,%rbp,1),%xmm1
divsd  %xmm7,%xmm1
movsd  %xmm1,0x38(%rsp,%rbx,1)
add    $0x8,%rbx
cmp    $0x60,%rbx
je     1347 <thornthwaite+0x217>
movsd  (%rbx,%r13,1),%xmm1
mulsd  0x18(%rsp),%xmm1
ucomisd %xmm2,%xmm1
jbe    1290 <thornthwaite+0x160>
ucomisd %xmm1,%xmm3
jbe    1290 <thornthwaite+0x160>
movapd %xmm1,%xmm0
xorpd  0xd80(%rip),%xmm0
movapd %xmm1,0x20(%rsp)
call   1030 <acos@plt>
movapd 0x20(%rsp),%xmm1
movsd  0xd3f(%rip),%xmm7
movsd  0xd2f(%rip),%xmm6
movsd  0xd1e(%rip),%xmm8
movsd  0xd0e(%rip),%xmm4
movsd  0xcfe(%rip),%xmm3
movsd  0xcee(%rip),%xmm2
jmp    1290 <thornthwaite+0x160>
test   %r15d,%r15d
jle    13fb <thornthwaite+0x2cb>
movsd  0x10(%rsp),%xmm0
addsd  0xd02(%rip),%xmm0
movsd  %xmm0,0x10(%rsp)
mov    %r15d,%r13d
mov    $0x1,%r15d
xor    %ebp,%ebp
xorpd  %xmm2,%xmm2
mov    $0x1,%ebx
jmp    139b <thornthwaite+0x26b>
nopw   0x0(%rax,%rax,1)
movsd  %xmm0,(%r14,%rbp,8)
cmp    $0xc,%ebx
lea    0x1(%rbx),%eax
cmovge %r15d,%eax
add    $0x1,%rbp
mov    %eax,%ebx
cmp    %rbp,%r13
je     13fb <thornthwaite+0x2cb>
movsd  (%r12,%rbp,8),%xmm1
ucomisd %xmm2,%xmm1
xorpd  %xmm0,%xmm0
jbe    1380 <thornthwaite+0x250>
movsd  0x8(%rsp),%xmm0
ucomisd %xmm2,%xmm0
xorpd  %xmm0,%xmm0
jbe    1380 <thornthwaite+0x250>
movslq %ebx,%rax
movsd  0x30(%rsp,%rax,8),%xmm0
mulsd  0xc9c(%rip),%xmm0
movsd  %xmm0,0x18(%rsp)
mulsd  0xc96(%rip),%xmm1
divsd  0x8(%rsp),%xmm1
cvttsd2si %xmm1,%edi
movsd  0x10(%rsp),%xmm0
call   1050 <pow@plt>
xorpd  %xmm2,%xmm2
mulsd  0x18(%rsp),%xmm0
jmp    1380 <thornthwaite+0x250>
add    $0x98,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@__const.thornthwaite.tanDelta = [13 x double] [double 0xBFD7B0238947110C, double 0xBFCE8844B28C84B3, double 0xBFA7F60077CA1106, double 0x3FC4E450CCF7141E, double 0x3FD5136664380DE3, double 0x3FDA08A39D538D71, double 0x3FD7FC4C81B8D244, double 2.390630e-01, double 0x3FA4B52FF8154FF3, double 0xBFC5A3AF472AE1D6, double 0xBFD550EAB3E87A52, double 0xBFDA136EC7B3DE3E, double 0.000000e+00]
@__const.thornthwaite.days = [13 x double] [double 3.100000e+01, double 2.800000e+01, double 3.100000e+01, double 3.000000e+01, double 3.100000e+01, double 3.000000e+01, double 3.100000e+01, double 3.100000e+01, double 3.000000e+01, double 3.100000e+01, double 3.000000e+01, double 3.100000e+01, double 0.000000e+00]
define void @thornthwaite(double* %0, i32 %1, double %2, double* %3) {
%5 = alloca double*
%6 = alloca i32
%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 [13 x double]
%17 = alloca double
%18 = alloca i32
%19 = alloca i32
%20 = alloca i32
%21 = alloca double
%22 = alloca double
%23 = alloca [13 x double]
%24 = alloca [13 x double]
store double* %0, double** %5
store i32 %1, i32* %6
store double %2, double* %7
store double* %3, double** %8
store double 0x400921FB54442D11, double* %21
%25 = load double, double* %7
%26 = fmul double 0x3F91DF46A1FAE711, %25
%27 = call double @tan(double %26)
store double %27, double* %22
%28 = bitcast [13 x double]* %23 to i8*
%29 = bitcast [13 x double]* %24 to i8*
store double 0.000000e+00, double* %10
store i32 1, i32* %18
br label %30
30: ; preds = %68, %4
%31 = load i32, i32* %18
%32 = icmp slt i32 %31, 13
br i1 %32, label %33, label %71
33: ; preds = %30
store i32 0, i32* %20
store double 0.000000e+00, double* %9
%34 = load i32, i32* %18
%35 = sub nsw i32 %34, 1
store i32 %35, i32* %19
br label %36
36: ; preds = %50, %33
%37 = load i32, i32* %19
%38 = load i32, i32* %6
%39 = icmp slt i32 %37, %38
br i1 %39, label %40, label %53
40: ; preds = %36
%41 = load double, double* %9
%42 = load double*, double** %5
%43 = load i32, i32* %19
%44 = sext i32 %43 to i64
%45 = getelementptr inbounds double, double* %42, i64 %44
%46 = load double, double* %45
%47 = fadd double %41, %46
store double %47, double* %9
%48 = load i32, i32* %20
%49 = add nsw i32 %48, 1
store i32 %49, i32* %20
br label %50
50: ; preds = %40
%51 = load i32, i32* %19
%52 = add nsw i32 %51, 12
store i32 %52, i32* %19
br label %36
53: ; preds = %36
%54 = load double, double* %9
%55 = load i32, i32* %20
%56 = sitofp i32 %55 to double
%57 = fdiv double %54, %56
store double %57, double* %9
%58 = load double, double* %9
%59 = fcmp ogt double %58, 0.000000e+00
br i1 %59, label %60, label %67
60: ; preds = %53
%61 = load double, double* %10
%62 = load double, double* %9
%63 = fdiv double %62, 5.000000e+00
%64 = fptosi double %63 to i32
%65 = call double @pow(i32 %64, double 1.514000e+00)
%66 = fadd double %61, %65
store double %66, double* %10
br label %67
67: ; preds = %60, %53
br label %68
68: ; preds = %67
%69 = load i32, i32* %18
%70 = add nsw i32 %69, 1
store i32 %70, i32* %18
br label %30
71: ; preds = %30
%72 = load double, double* %10
%73 = load double, double* %10
%74 = fmul double %72, %73
store double %74, double* %11
%75 = load double, double* %11
%76 = load double, double* %10
%77 = fmul double %75, %76
store double %77, double* %12
%78 = load double, double* %12
%79 = load double, double* %11
%80 = fmul double 7.710000e-05, %79
%81 = fneg double %80
%82 = call double @llvm.fmuladd.f64(double 0x3EA6A634B28F33E5, double %78, double %81)
%83 = load double, double* %10
%84 = call double @llvm.fmuladd.f64(double 1.792000e-02, double %83, double %82)
%85 = fadd double %84, 4.923900e-01
store double %85, double* %13
store i32 1, i32* %18
br label %86
86: ; preds = %132, %71
%87 = load i32, i32* %18
%88 = icmp slt i32 %87, 13
br i1 %88, label %89, label %135
89: ; preds = %86
%90 = load double, double* %22
%91 = load i32, i32* %18
%92 = sub nsw i32 %91, 1
%93 = sext i32 %92 to i64
%94 = getelementptr inbounds [13 x double], [13 x double]* %23, i64 0, i64 %93
%95 = load double, double* %94
%96 = fmul double %90, %95
store double %96, double* %17
%97 = load double, double* %17
%98 = fcmp ogt double %97, -1.000000e+00
br i1 %98, label %99, label %106
99: ; preds = %89
%100 = load double, double* %17
%101 = fcmp olt double %100, 1.000000e+00
br i1 %101, label %102, label %106
102: ; preds = %99
%103 = load double, double* %17
%104 = fneg double %103
%105 = call double @acos(double %104)
store double %105, double* %15
br label %106
106: ; preds = %102, %99, %89
%107 = load double, double* %17
%108 = fcmp ole double %107, -1.000000e+00
br i1 %108, label %109, label %110
109: ; preds = %106
store double 0.000000e+00, double* %15
br label %110
110: ; preds = %109, %106
%111 = load double, double* %17
%112 = fcmp oge double %111, 1.000000e+00
br i1 %112, label %113, label %115
113: ; preds = %110
%114 = load double, double* %21
store double %114, double* %15
br label %115
115: ; preds = %113, %110
%116 = load double, double* %15
%117 = fmul double 2.400000e+01, %116
%118 = load double, double* %21
%119 = fdiv double %117, %118
store double %119, double* %14
%120 = load double, double* %14
%121 = fdiv double %120, 1.200000e+01
%122 = load i32, i32* %18
%123 = sub nsw i32 %122, 1
%124 = sext i32 %123 to i64
%125 = getelementptr inbounds [13 x double], [13 x double]* %24, i64 0, i64 %124
%126 = load double, double* %125
%127 = fmul double %121, %126
%128 = fdiv double %127, 3.000000e+01
%129 = load i32, i32* %18
%130 = sext i32 %129 to i64
%131 = getelementptr inbounds [13 x double], [13 x double]* %16, i64 0, i64 %130
store double %128, double* %131
br label %132
132: ; preds = %115
%133 = load i32, i32* %18
%134 = add nsw i32 %133, 1
store i32 %134, i32* %18
br label %86
135: ; preds = %86
store i32 1, i32* %18
store i32 0, i32* %19
br label %136
136: ; preds = %185, %135
%137 = load i32, i32* %19
%138 = load i32, i32* %6
%139 = icmp slt i32 %137, %138
br i1 %139, label %140, label %188
140: ; preds = %136
%141 = load double*, double** %5
%142 = load i32, i32* %19
%143 = sext i32 %142 to i64
%144 = getelementptr inbounds double, double* %141, i64 %143
%145 = load double, double* %144
%146 = fcmp ogt double %145, 0.000000e+00
br i1 %146, label %147, label %172
147: ; preds = %140
%148 = load double, double* %10
%149 = fcmp ogt double %148, 0.000000e+00
br i1 %149, label %150, label %172
150: ; preds = %147
%151 = load i32, i32* %18
%152 = sext i32 %151 to i64
%153 = getelementptr inbounds [13 x double], [13 x double]* %16, i64 0, i64 %152
%154 = load double, double* %153
%155 = fmul double %154, 1.600000e+01
%156 = load double*, double** %5
%157 = load i32, i32* %19
%158 = sext i32 %157 to i64
%159 = getelementptr inbounds double, double* %156, i64 %158
%160 = load double, double* %159
%161 = fmul double 1.000000e+01, %160
%162 = load double, double* %10
%163 = fdiv double %161, %162
%164 = fptosi double %163 to i32
%165 = load double, double* %13
%166 = call double @pow(i32 %164, double %165)
%167 = fmul double %155, %166
%168 = load double*, double** %8
%169 = load i32, i32* %19
%170 = sext i32 %169 to i64
%171 = getelementptr inbounds double, double* %168, i64 %170
store double %167, double* %171
br label %177
172: ; preds = %147, %140
%173 = load double*, double** %8
%174 = load i32, i32* %19
%175 = sext i32 %174 to i64
%176 = getelementptr inbounds double, double* %173, i64 %175
store double 0.000000e+00, double* %176
br label %177
177: ; preds = %172, %150
%178 = load i32, i32* %18
%179 = icmp slt i32 %178, 12
br i1 %179, label %180, label %183
180: ; preds = %177
%181 = load i32, i32* %18
%182 = add nsw i32 %181, 1
store i32 %182, i32* %18
br label %184
183: ; preds = %177
store i32 1, i32* %18
br label %184
184: ; preds = %183, %180
br label %185
185: ; preds = %184
%186 = load i32, i32* %19
%187 = add nsw i32 %186, 1
store i32 %187, i32* %19
br label %136
188: ; preds = %136
ret void
}

LLVM IR (-O2):
@__const.thornthwaite.tanDelta = [13 x double] [double 0xBFD7B0238947110C, double 0xBFCE8844B28C84B3, double 0xBFA7F60077CA1106, double 0x3FC4E450CCF7141E, double 0x3FD5136664380DE3, double 0x3FDA08A39D538D71, double 0x3FD7FC4C81B8D244, double 2.390630e-01, double 0x3FA4B52FF8154FF3, double 0xBFC5A3AF472AE1D6, double 0xBFD550EAB3E87A52, double 0xBFDA136EC7B3DE3E, double 0.000000e+00]
@__const.thornthwaite.days = [13 x double] [double 3.100000e+01, double 2.800000e+01, double 3.100000e+01, double 3.000000e+01, double 3.100000e+01, double 3.000000e+01, double 3.100000e+01, double 3.100000e+01, double 3.000000e+01, double 3.100000e+01, double 3.000000e+01, double 3.100000e+01, double 0.000000e+00]
define void @thornthwaite(double* nocapture %0, i32 %1, double %2, double* nocapture writeonly %3) {
%5 = alloca [13 x double]
%6 = bitcast [13 x double]* %5 to i8*
%7 = fmul double %2, 0x3F91DF46A1FAE711
%8 = tail call double @tan(double %7)
%9 = sext i32 %1 to i64
br label %10
10: ; preds = %4, %36
%11 = phi i64 [ 0, %4 ], [ %39, %36 ]
%12 = phi double [ 0.000000e+00, %4 ], [ %37, %36 ]
%13 = phi i32 [ 1, %4 ], [ %38, %36 ]
%14 = icmp sgt i32 %13, %1
br i1 %14, label %25, label %15
15: ; preds = %10, %15
%16 = phi i64 [ %23, %15 ], [ %11, %10 ]
%17 = phi double [ %21, %15 ], [ 0.000000e+00, %10 ]
%18 = phi i32 [ %22, %15 ], [ 0, %10 ]
%19 = getelementptr inbounds double, double* %0, i64 %16
%20 = load double, double* %19
%21 = fadd double %17, %20
%22 = add nuw nsw i32 %18, 1
%23 = add nuw nsw i64 %16, 12
%24 = icmp slt i64 %23, %9
br i1 %24, label %15, label %25
25: ; preds = %15, %10
%26 = phi i32 [ 0, %10 ], [ %22, %15 ]
%27 = phi double [ 0.000000e+00, %10 ], [ %21, %15 ]
%28 = sitofp i32 %26 to double
%29 = fdiv double %27, %28
%30 = fcmp ogt double %29, 0.000000e+00
br i1 %30, label %31, label %36
31: ; preds = %25
%32 = fdiv double %29, 5.000000e+00
%33 = fptosi double %32 to i32
%34 = tail call double @pow(i32 %33, double 1.514000e+00)
%35 = fadd double %12, %34
br label %36
36: ; preds = %25, %31
%37 = phi double [ %35, %31 ], [ %12, %25 ]
%38 = add nuw nsw i32 %13, 1
%39 = add nuw nsw i64 %11, 1
%40 = icmp eq i64 %39, 12
br i1 %40, label %41, label %10
41: ; preds = %36
%42 = fmul double %37, %37
%43 = fmul double %37, %42
%44 = fmul double %42, -7.710000e-05
%45 = tail call double @llvm.fmuladd.f64(double %43, double 0x3EA6A634B28F33E5, double %44)
%46 = tail call double @llvm.fmuladd.f64(double %37, double 1.792000e-02, double %45)
br label %53
47: ; preds = %66
%48 = fadd double %46, 4.923900e-01
%49 = icmp sgt i32 %1, 0
br i1 %49, label %50, label %107
50: ; preds = %47
%51 = fcmp ogt double %37, 0.000000e+00
%52 = zext i32 %1 to i64
br label %82
53: ; preds = %41, %66
%54 = phi i64 [ 1, %41 ], [ %80, %66 ]
%55 = phi double [ undef, %41 ], [ %71, %66 ]
%56 = add nsw i64 %54, -1
%57 = getelementptr inbounds [13 x double], [13 x double]* @__const.thornthwaite.tanDelta, i64 0, i64 %56
%58 = load double, double* %57
%59 = fmul double %8, %58
%60 = fcmp ogt double %59, -1.000000e+00
%61 = fcmp olt double %59, 1.000000e+00
%62 = and i1 %60, %61
br i1 %62, label %63, label %66
63: ; preds = %53
%64 = fneg double %59
%65 = tail call double @acos(double %64)
br label %66
66: ; preds = %63, %53
%67 = phi double [ %65, %63 ], [ %55, %53 ]
%68 = fcmp ugt double %59, -1.000000e+00
%69 = select i1 %68, double %67, double 0.000000e+00
%70 = fcmp ult double %59, 1.000000e+00
%71 = select i1 %70, double %69, double 0x400921FB54442D11
%72 = fmul double %71, 2.400000e+01
%73 = fdiv double %72, 0x400921FB54442D11
%74 = fdiv double %73, 1.200000e+01
%75 = getelementptr inbounds [13 x double], [13 x double]* @__const.thornthwaite.days, i64 0, i64 %56
%76 = load double, double* %75
%77 = fmul double %76, %74
%78 = fdiv double %77, 3.000000e+01
%79 = getelementptr inbounds [13 x double], [13 x double]* %5, i64 0, i64 %54
store double %78, double* %79
%80 = add nuw nsw i64 %54, 1
%81 = icmp eq i64 %80, 13
br i1 %81, label %47, label %53
82: ; preds = %50, %99
%83 = phi i64 [ 0, %50 ], [ %105, %99 ]
%84 = phi i32 [ 1, %50 ], [ %104, %99 ]
%85 = getelementptr inbounds double, double* %0, i64 %83
%86 = load double, double* %85
%87 = fcmp ogt double %86, 0.000000e+00
%88 = select i1 %87, i1 %51, i1 false
br i1 %88, label %89, label %99
89: ; preds = %82
%90 = sext i32 %84 to i64
%91 = getelementptr inbounds [13 x double], [13 x double]* %5, i64 0, i64 %90
%92 = load double, double* %91
%93 = fmul double %92, 1.600000e+01
%94 = fmul double %86, 1.000000e+01
%95 = fdiv double %94, %37
%96 = fptosi double %95 to i32
%97 = tail call double @pow(i32 %96, double %48)
%98 = fmul double %93, %97
br label %99
99: ; preds = %82, %89
%100 = phi double [ %98, %89 ], [ 0.000000e+00, %82 ]
%101 = getelementptr inbounds double, double* %3, i64 %83
store double %100, double* %101
%102 = icmp slt i32 %84, 12
%103 = add nsw i32 %84, 1
%104 = select i1 %102, i32 %103, i32 1
%105 = add nuw nsw i64 %83, 1
%106 = icmp eq i64 %105, %52
br i1 %106, label %107, label %82
107: ; preds = %99, %47
ret void
}