#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 */
float getSlope(float, float, float, float);
float getYInt(float, float, float);
float lerp(float x1, float y1, float x2, float y2, float progress) {
  return ((progress * x2) * getSlope(x1, y1, x2, y2)) +
         getYInt(getSlope(x1, y1, x2, y2), x2, y2);
}


x86 assembly (clang, -O0):
<lerp>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movss  %xmm0,-0x4(%rbp)
movss  %xmm1,-0x8(%rbp)
movss  %xmm2,-0xc(%rbp)
movss  %xmm3,-0x10(%rbp)
movss  %xmm4,-0x14(%rbp)
movss  -0x14(%rbp),%xmm0
mulss  -0xc(%rbp),%xmm0
movss  %xmm0,-0x18(%rbp)
movss  -0x4(%rbp),%xmm0
movss  -0x8(%rbp),%xmm1
movss  -0xc(%rbp),%xmm2
movss  -0x10(%rbp),%xmm3
call   1040 <getSlope@plt>
movss  %xmm0,-0x1c(%rbp)
movss  -0x4(%rbp),%xmm0
movss  -0x8(%rbp),%xmm1
movss  -0xc(%rbp),%xmm2
movss  -0x10(%rbp),%xmm3
call   1040 <getSlope@plt>
movss  -0xc(%rbp),%xmm1
movss  -0x10(%rbp),%xmm2
call   1030 <getYInt@plt>
movss  -0x1c(%rbp),%xmm2
movaps %xmm0,%xmm1
movss  -0x18(%rbp),%xmm0
mulss  %xmm2,%xmm0
addss  %xmm1,%xmm0
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<lerp>:
sub    $0x18,%rsp
movss  %xmm3,0x4(%rsp)
movss  %xmm2,(%rsp)
movss  %xmm1,0xc(%rsp)
movss  %xmm0,0x8(%rsp)
mulss  %xmm2,%xmm4
movss  %xmm4,0x14(%rsp)
call   1040 <getSlope@plt>
movss  %xmm0,0x10(%rsp)
movss  0x8(%rsp),%xmm0
movss  0xc(%rsp),%xmm1
movss  (%rsp),%xmm2
movss  0x4(%rsp),%xmm3
call   1040 <getSlope@plt>
movss  (%rsp),%xmm1
movss  0x4(%rsp),%xmm2
call   1030 <getYInt@plt>
movss  0x10(%rsp),%xmm1
mulss  0x14(%rsp),%xmm1
addss  %xmm1,%xmm0
add    $0x18,%rsp
ret

LLVM IR (-O0):
define float @lerp(float %0, float %1, float %2, float %3, float %4) {
%6 = alloca float
%7 = alloca float
%8 = alloca float
%9 = alloca float
%10 = alloca float
store float %0, float* %6
store float %1, float* %7
store float %2, float* %8
store float %3, float* %9
store float %4, float* %10
%11 = load float, float* %10
%12 = load float, float* %8
%13 = fmul float %11, %12
%14 = load float, float* %6
%15 = load float, float* %7
%16 = load float, float* %8
%17 = load float, float* %9
%18 = call float @getSlope(float %14, float %15, float %16, float %17)
%19 = load float, float* %6
%20 = load float, float* %7
%21 = load float, float* %8
%22 = load float, float* %9
%23 = call float @getSlope(float %19, float %20, float %21, float %22)
%24 = load float, float* %8
%25 = load float, float* %9
%26 = call float @getYInt(float %23, float %24, float %25)
%27 = call float @llvm.fmuladd.f32(float %13, float %18, float %26)
ret float %27
}

LLVM IR (-O2):
define float @lerp(float %0, float %1, float %2, float %3, float %4) {
%6 = fmul float %2, %4
%7 = tail call float @getSlope(float %0, float %1, float %2, float %3)
%8 = tail call float @getSlope(float %0, float %1, float %2, float %3)
%9 = tail call float @getYInt(float %8, float %2, float %3)
%10 = tail call float @llvm.fmuladd.f32(float %6, float %7, float %9)
ret float %10
}