#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 */
struct Delay {
  int dummy;
};

/* Variables and functions */
float Delay_peek(struct Delay *, int);
int lrintf(float);
float Delay_get_at(struct Delay *this, float f) {
  int n = lrintf(f - 0.5f);
  f -= (float)n;
  return (1.0f - f) * Delay_peek(this, n) + f * Delay_peek(this, n + 1);
}


x86 assembly (clang, -O0):
<Delay_get_at>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
movss  %xmm0,-0xc(%rbp)
movss  -0xc(%rbp),%xmm0
movss  0xec6(%rip),%xmm1
subss  %xmm1,%xmm0
call   1040 <lrintf@plt>
mov    %eax,-0x10(%rbp)
cvtsi2ssl -0x10(%rbp),%xmm1
movss  -0xc(%rbp),%xmm0
subss  %xmm1,%xmm0
movss  %xmm0,-0xc(%rbp)
movss  0xe9b(%rip),%xmm0
subss  -0xc(%rbp),%xmm0
movss  %xmm0,-0x14(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%esi
call   1030 <Delay_peek@plt>
movss  %xmm0,-0x18(%rbp)
movss  -0xc(%rbp),%xmm0
movss  %xmm0,-0x1c(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%esi
add    $0x1,%esi
call   1030 <Delay_peek@plt>
movss  -0x1c(%rbp),%xmm1
movss  -0x18(%rbp),%xmm2
movaps %xmm0,%xmm3
movss  -0x14(%rbp),%xmm0
mulss  %xmm3,%xmm1
mulss  %xmm2,%xmm0
addss  %xmm1,%xmm0
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<Delay_get_at>:
push   %rbp
push   %rbx
sub    $0x18,%rsp
movaps %xmm0,%xmm1
movss  %xmm0,0xc(%rsp)
mov    %rdi,%rbx
movss  0xec6(%rip),%xmm0
addss  %xmm1,%xmm0
call   1040 <lrintf@plt>
mov    %eax,%ebp
xorps  %xmm0,%xmm0
cvtsi2ss %eax,%xmm0
movss  0xc(%rsp),%xmm1
subss  %xmm0,%xmm1
movss  %xmm1,0xc(%rsp)
movss  0xea0(%rip),%xmm0
subss  %xmm1,%xmm0
movss  %xmm0,0x14(%rsp)
mov    %rbx,%rdi
mov    %eax,%esi
call   1030 <Delay_peek@plt>
movss  %xmm0,0x10(%rsp)
add    $0x1,%ebp
mov    %rbx,%rdi
mov    %ebp,%esi
call   1030 <Delay_peek@plt>
mulss  0xc(%rsp),%xmm0
movss  0x10(%rsp),%xmm1
mulss  0x14(%rsp),%xmm1
addss  %xmm1,%xmm0
add    $0x18,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
%struct.Delay = type { i32 }
define float @Delay_get_at(%struct.Delay* %0, float %1) {
%3 = alloca %struct.Delay*
%4 = alloca float
%5 = alloca i32
store %struct.Delay* %0, %struct.Delay** %3
store float %1, float* %4
%6 = load float, float* %4
%7 = fsub float %6, 5.000000e-01
%8 = call i32 @lrintf(float %7)
store i32 %8, i32* %5
%9 = load i32, i32* %5
%10 = sitofp i32 %9 to float
%11 = load float, float* %4
%12 = fsub float %11, %10
store float %12, float* %4
%13 = load float, float* %4
%14 = fsub float 1.000000e+00, %13
%15 = load %struct.Delay*, %struct.Delay** %3
%16 = load i32, i32* %5
%17 = call float @Delay_peek(%struct.Delay* %15, i32 %16)
%18 = load float, float* %4
%19 = load %struct.Delay*, %struct.Delay** %3
%20 = load i32, i32* %5
%21 = add nsw i32 %20, 1
%22 = call float @Delay_peek(%struct.Delay* %19, i32 %21)
%23 = fmul float %18, %22
%24 = call float @llvm.fmuladd.f32(float %14, float %17, float %23)
ret float %24
}

LLVM IR (-O2):
%struct.Delay = type { i32 }
define float @Delay_get_at(%struct.Delay* %0, float %1) {
%3 = fadd float %1, -5.000000e-01
%4 = tail call i32 @lrintf(float %3)
%5 = sitofp i32 %4 to float
%6 = fsub float %1, %5
%7 = fsub float 1.000000e+00, %6
%8 = tail call float @Delay_peek(%struct.Delay* %0, i32 %4)
%9 = add nsw i32 %4, 1
%10 = tail call float @Delay_peek(%struct.Delay* %0, i32 %9)
%11 = fmul float %6, %10
%12 = tail call float @llvm.fmuladd.f32(float %7, float %8, float %11)
ret float %12
}