int main(argc, argv)
int argc;
char **argv;
{
  double array[10];
  array[0] = 1.0;
  array[2] = 3.0;
  linear_interpolate(array, 0, 2);
  printf("should be 1.0 is %lf\n", array[0]);
  printf("should be 2.0 is %lf\n", array[1]);
  printf("should be 3.0 is %lf\n", array[2]);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x60,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movsd  0xeca(%rip),%xmm0
movsd  %xmm0,-0x60(%rbp)
movsd  0xeb5(%rip),%xmm0
movsd  %xmm0,-0x50(%rbp)
lea    -0x60(%rbp),%rdi
xor    %esi,%esi
mov    $0x2,%edx
mov    $0x0,%al
call   1040 <linear_interpolate@plt>
movsd  -0x60(%rbp),%xmm0
lea    0xea2(%rip),%rdi
mov    $0x1,%al
call   1030 <printf@plt>
movsd  -0x58(%rbp),%xmm0
lea    0xea5(%rip),%rdi
mov    $0x1,%al
call   1030 <printf@plt>
movsd  -0x50(%rbp),%xmm0
lea    0xea8(%rip),%rdi
mov    $0x1,%al
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x60,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
sub    $0x58,%rsp
movabs $0x3ff0000000000000,%rax
mov    %rax,(%rsp)
movabs $0x4008000000000000,%rax
mov    %rax,0x10(%rsp)
mov    %rsp,%rdi
xor    %esi,%esi
mov    $0x2,%edx
xor    %eax,%eax
call   1040 <linear_interpolate@plt>
movsd  (%rsp),%xmm0
lea    0xea2(%rip),%rdi
mov    $0x1,%al
call   1030 <printf@plt>
movsd  0x8(%rsp),%xmm0
lea    0xea4(%rip),%rdi
mov    $0x1,%al
call   1030 <printf@plt>
movsd  0x10(%rsp),%xmm0
lea    0xea6(%rip),%rdi
mov    $0x1,%al
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x58,%rsp
ret

LLVM IR (-O0):
@.str = [22 x i8] c"should be 1.0 is %lf\0A\00"
@.str.1 = [22 x i8] c"should be 2.0 is %lf\0A\00"
@.str.2 = [22 x i8] c"should be 3.0 is %lf\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca [10 x double]
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%7 = getelementptr inbounds [10 x double], [10 x double]* %6, i64 0, i64 0
store double 1.000000e+00, double* %7
%8 = getelementptr inbounds [10 x double], [10 x double]* %6, i64 0, i64 2
store double 3.000000e+00, double* %8
%9 = getelementptr inbounds [10 x double], [10 x double]* %6, i64 0, i64 0
%10 = call i32 (double*, i32, i32, ...) bitcast (i32 (...)* @linear_interpolate to i32 (double*, i32, i32, ...)*)(double* %9, i32 0, i32 2)
%11 = getelementptr inbounds [10 x double], [10 x double]* %6, i64 0, i64 0
%12 = load double, double* %11
%13 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str, i64 0, i64 0), double %12)
%14 = getelementptr inbounds [10 x double], [10 x double]* %6, i64 0, i64 1
%15 = load double, double* %14
%16 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.1, i64 0, i64 0), double %15)
%17 = getelementptr inbounds [10 x double], [10 x double]* %6, i64 0, i64 2
%18 = load double, double* %17
%19 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.2, i64 0, i64 0), double %18)
ret i32 0
}

LLVM IR (-O2):
@.str = [22 x i8] c"should be 1.0 is %lf\0A\00"
@.str.1 = [22 x i8] c"should be 2.0 is %lf\0A\00"
@.str.2 = [22 x i8] c"should be 3.0 is %lf\0A\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = alloca [10 x double]
%4 = bitcast [10 x double]* %3 to i8*
%5 = getelementptr inbounds [10 x double], [10 x double]* %3, i64 0, i64 0
store double 1.000000e+00, double* %5
%6 = getelementptr inbounds [10 x double], [10 x double]* %3, i64 0, i64 2
store double 3.000000e+00, double* %6
%7 = call i32 (double*, i32, i32, ...) bitcast (i32 (...)* @linear_interpolate to i32 (double*, i32, i32, ...)*)(double* %5, i32 0, i32 2)
%8 = load double, double* %5
%9 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([22 x i8], [22 x i8]* @.str, i64 0, i64 0), double %8)
%10 = getelementptr inbounds [10 x double], [10 x double]* %3, i64 0, i64 1
%11 = load double, double* %10
%12 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([22 x i8], [22 x i8]* @.str.1, i64 0, i64 0), double %11)
%13 = load double, double* %6
%14 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([22 x i8], [22 x i8]* @.str.2, i64 0, i64 0), double %13)
ret i32 0
}