#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 */
int /*<<< orphan*/ vec_add(float *, float const *, float *);
int /*<<< orphan*/ vec_scale(float *, float, float *);
int /*<<< orphan*/ vec_sub(float *, float const *, float const *);
void vec_lerp(float *a, const float *b, const float *c, float frac) {
  float diff[3], tmp[3];
  vec_sub(diff, c, b);
  vec_scale(tmp, frac, diff);
  vec_add(a, b, tmp);
}


x86 assembly (clang, -O0):
<vec_lerp>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
movss  %xmm0,-0x1c(%rbp)
lea    -0x28(%rbp),%rdi
mov    -0x18(%rbp),%rsi
mov    -0x10(%rbp),%rdx
call   1040 <vec_sub@plt>
lea    -0x34(%rbp),%rdi
movss  -0x1c(%rbp),%xmm0
lea    -0x28(%rbp),%rsi
call   1050 <vec_scale@plt>
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
lea    -0x34(%rbp),%rdx
call   1030 <vec_add@plt>
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<vec_lerp>:
push   %r15
push   %r14
push   %r12
push   %rbx
sub    $0x28,%rsp
movss  %xmm0,0xc(%rsp)
mov    %rsi,%rbx
mov    %rdi,%r14
lea    0x1c(%rsp),%r15
mov    %r15,%rdi
mov    %rdx,%rsi
mov    %rbx,%rdx
call   1040 <vec_sub@plt>
lea    0x10(%rsp),%r12
mov    %r12,%rdi
movss  0xc(%rsp),%xmm0
mov    %r15,%rsi
call   1050 <vec_scale@plt>
mov    %r14,%rdi
mov    %rbx,%rsi
mov    %r12,%rdx
call   1030 <vec_add@plt>
add    $0x28,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
define void @vec_lerp(float* %0, float* %1, float* %2, float %3) {
%5 = alloca float*
%6 = alloca float*
%7 = alloca float*
%8 = alloca float
%9 = alloca [3 x float]
%10 = alloca [3 x float]
store float* %0, float** %5
store float* %1, float** %6
store float* %2, float** %7
store float %3, float* %8
%11 = getelementptr inbounds [3 x float], [3 x float]* %9, i64 0, i64 0
%12 = load float*, float** %7
%13 = load float*, float** %6
%14 = call i32 @vec_sub(float* %11, float* %12, float* %13)
%15 = getelementptr inbounds [3 x float], [3 x float]* %10, i64 0, i64 0
%16 = load float, float* %8
%17 = getelementptr inbounds [3 x float], [3 x float]* %9, i64 0, i64 0
%18 = call i32 @vec_scale(float* %15, float %16, float* %17)
%19 = load float*, float** %5
%20 = load float*, float** %6
%21 = getelementptr inbounds [3 x float], [3 x float]* %10, i64 0, i64 0
%22 = call i32 @vec_add(float* %19, float* %20, float* %21)
ret void
}

LLVM IR (-O2):
define void @vec_lerp(float* %0, float* %1, float* %2, float %3) {
%5 = alloca [3 x float]
%6 = alloca [3 x float]
%7 = bitcast [3 x float]* %5 to i8*
%8 = bitcast [3 x float]* %6 to i8*
%9 = getelementptr inbounds [3 x float], [3 x float]* %5, i64 0, i64 0
%10 = call i32 @vec_sub(float* %9, float* %2, float* %1)
%11 = getelementptr inbounds [3 x float], [3 x float]* %6, i64 0, i64 0
%12 = call i32 @vec_scale(float* %11, float %3, float* %9)
%13 = call i32 @vec_add(float* %0, float* %1, float* %11)
ret void
}