#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 */
scalar_t__ ceil(double);
scalar_t__ floor(double);
double calcG01(double fracYearIndex, double fracYear) {
  static int g01[23] = {-31543, -31464, -31354,   -31212,   -31060,  -30926,
                        -30805, -30715, -30654,   -30594,   -30554,  -30500,
                        -30421, -30334, -30220,   -30100,   -29992,  -29873,
                        -29775, -29692, -29619.4, -29556.8, -29512.8};
  return (g01[(int)floor(fracYearIndex)] * (1.0 - fracYear) +
          g01[(int)ceil(fracYearIndex)] * fracYear);
}


x86 assembly (clang, -O0):
<calcG01>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movsd  %xmm0,-0x8(%rbp)
movsd  %xmm1,-0x10(%rbp)
movsd  -0x8(%rbp),%xmm0
call   1040 <floor@plt>
movslq %eax,%rcx
lea    0x2efa(%rip),%rax
cvtsi2sdl (%rax,%rcx,4),%xmm0
movsd  %xmm0,-0x20(%rbp)
movsd  0xea8(%rip),%xmm0
subsd  -0x10(%rbp),%xmm0
movsd  %xmm0,-0x18(%rbp)
movsd  -0x8(%rbp),%xmm0
call   1030 <ceil@plt>
movsd  -0x20(%rbp),%xmm0
movsd  -0x18(%rbp),%xmm2
movslq %eax,%rcx
lea    0x2ec0(%rip),%rax
cvtsi2sdl (%rax,%rcx,4),%xmm1
mulsd  -0x10(%rbp),%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<calcG01>:
push   %rbx
sub    $0x20,%rsp
movsd  %xmm1,0x8(%rsp)
movsd  %xmm0,0x18(%rsp)
call   1040 <floor@plt>
cltq
lea    0xed1(%rip),%rbx
xorps  %xmm0,%xmm0
cvtsi2sdl (%rbx,%rax,4),%xmm0
movsd  0xeb1(%rip),%xmm1
subsd  0x8(%rsp),%xmm1
mulsd  %xmm0,%xmm1
movsd  %xmm1,0x10(%rsp)
movsd  0x18(%rsp),%xmm0
call   1030 <ceil@plt>
cltq
xorps  %xmm0,%xmm0
cvtsi2sdl (%rbx,%rax,4),%xmm0
mulsd  0x8(%rsp),%xmm0
addsd  0x10(%rsp),%xmm0
add    $0x20,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@calcG01.g01 = internal global [23 x i32] [i32 -31543, i32 -31464, i32 -31354, i32 -31212, i32 -31060, i32 -30926, i32 -30805, i32 -30715, i32 -30654, i32 -30594, i32 -30554, i32 -30500, i32 -30421, i32 -30334, i32 -30220, i32 -30100, i32 -29992, i32 -29873, i32 -29775, i32 -29692, i32 -29619, i32 -29556, i32 -29512]
define double @calcG01(double %0, double %1) {
%3 = alloca double
%4 = alloca double
store double %0, double* %3
store double %1, double* %4
%5 = load double, double* %3
%6 = call i64 @floor(double %5)
%7 = trunc i64 %6 to i32
%8 = sext i32 %7 to i64
%9 = getelementptr inbounds [23 x i32], [23 x i32]* @calcG01.g01, i64 0, i64 %8
%10 = load i32, i32* %9
%11 = sitofp i32 %10 to double
%12 = load double, double* %4
%13 = fsub double 1.000000e+00, %12
%14 = load double, double* %3
%15 = call i64 @ceil(double %14)
%16 = trunc i64 %15 to i32
%17 = sext i32 %16 to i64
%18 = getelementptr inbounds [23 x i32], [23 x i32]* @calcG01.g01, i64 0, i64 %17
%19 = load i32, i32* %18
%20 = sitofp i32 %19 to double
%21 = load double, double* %4
%22 = fmul double %20, %21
%23 = call double @llvm.fmuladd.f64(double %11, double %13, double %22)
ret double %23
}

LLVM IR (-O2):
@calcG01.g01 = internal unnamed_addr constant [23 x i32] [i32 -31543, i32 -31464, i32 -31354, i32 -31212, i32 -31060, i32 -30926, i32 -30805, i32 -30715, i32 -30654, i32 -30594, i32 -30554, i32 -30500, i32 -30421, i32 -30334, i32 -30220, i32 -30100, i32 -29992, i32 -29873, i32 -29775, i32 -29692, i32 -29619, i32 -29556, i32 -29512]
define double @calcG01(double %0, double %1) {
%3 = tail call i64 @floor(double %0)
%4 = shl i64 %3, 32
%5 = ashr exact i64 %4, 32
%6 = getelementptr inbounds [23 x i32], [23 x i32]* @calcG01.g01, i64 0, i64 %5
%7 = load i32, i32* %6
%8 = sitofp i32 %7 to double
%9 = fsub double 1.000000e+00, %1
%10 = tail call i64 @ceil(double %0)
%11 = shl i64 %10, 32
%12 = ashr exact i64 %11, 32
%13 = getelementptr inbounds [23 x i32], [23 x i32]* @calcG01.g01, i64 0, i64 %12
%14 = load i32, i32* %13
%15 = sitofp i32 %14 to double
%16 = fmul double %15, %1
%17 = tail call double @llvm.fmuladd.f64(double %8, double %9, double %16)
ret double %17
}