#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*/ assert(int);
float fmax(float const, float const);
void interpolate_rgb(float *c, const float *c1, const float *c2, float f) {
  assert(f >= 0.f && f <= 1.f);
  c[0] = c1[0] + f * (c2[0] - c1[0]);
  c[1] = c1[1] + f * (c2[1] - c1[1]);
  c[2] = c1[2] + f * (c2[2] - c1[2]);
  c[3] = fmax(c1[3], c2[3]);
}


x86 assembly (clang, -O0):
<interpolate_rgb>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
movss  %xmm0,-0x1c(%rbp)
movss  -0x1c(%rbp),%xmm0
xor    %eax,%eax
xorps  %xmm1,%xmm1
ucomiss %xmm1,%xmm0
mov    %al,-0x1d(%rbp)
jb     1161 <interpolate_rgb+0x41>
movss  0xea9(%rip),%xmm0
ucomiss -0x1c(%rbp),%xmm0
setae  %al
mov    %al,-0x1d(%rbp)
mov    -0x1d(%rbp),%al
and    $0x1,%al
movzbl %al,%edi
call   1030 <assert@plt>
mov    -0x10(%rbp),%rax
movss  (%rax),%xmm1
movss  -0x1c(%rbp),%xmm0
mov    -0x18(%rbp),%rax
movss  (%rax),%xmm2
mov    -0x10(%rbp),%rax
subss  (%rax),%xmm2
mulss  %xmm2,%xmm0
addss  %xmm1,%xmm0
mov    -0x8(%rbp),%rax
movss  %xmm0,(%rax)
mov    -0x10(%rbp),%rax
movss  0x4(%rax),%xmm1
movss  -0x1c(%rbp),%xmm0
mov    -0x18(%rbp),%rax
movss  0x4(%rax),%xmm2
mov    -0x10(%rbp),%rax
subss  0x4(%rax),%xmm2
mulss  %xmm2,%xmm0
addss  %xmm1,%xmm0
mov    -0x8(%rbp),%rax
movss  %xmm0,0x4(%rax)
mov    -0x10(%rbp),%rax
movss  0x8(%rax),%xmm1
movss  -0x1c(%rbp),%xmm0
mov    -0x18(%rbp),%rax
movss  0x8(%rax),%xmm2
mov    -0x10(%rbp),%rax
subss  0x8(%rax),%xmm2
mulss  %xmm2,%xmm0
addss  %xmm1,%xmm0
mov    -0x8(%rbp),%rax
movss  %xmm0,0x8(%rax)
mov    -0x10(%rbp),%rax
movss  0xc(%rax),%xmm0
mov    -0x18(%rbp),%rax
movss  0xc(%rax),%xmm1
call   1040 <fmax@plt>
mov    -0x8(%rbp),%rax
movss  %xmm0,0xc(%rax)
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<interpolate_rgb>:
push   %r15
push   %r14
push   %rbx
sub    $0x10,%rsp
movss  %xmm0,0xc(%rsp)
xorps  %xmm1,%xmm1
ucomiss %xmm1,%xmm0
setae  %al
movss  0xed0(%rip),%xmm1
ucomiss %xmm0,%xmm1
mov    %rdx,%r15
mov    %rsi,%rbx
mov    %rdi,%r14
setae  %cl
and    %al,%cl
movzbl %cl,%edi
call   1030 <assert@plt>
movss  (%rbx),%xmm0
movss  (%r15),%xmm1
subss  %xmm0,%xmm1
movss  0xc(%rsp),%xmm2
mulss  %xmm2,%xmm1
addss  %xmm0,%xmm1
movss  %xmm1,(%r14)
movss  0x4(%rbx),%xmm0
movss  0x4(%r15),%xmm1
subss  %xmm0,%xmm1
mulss  %xmm2,%xmm1
addss  %xmm0,%xmm1
movss  %xmm1,0x4(%r14)
movss  0x8(%rbx),%xmm0
movss  0x8(%r15),%xmm1
subss  %xmm0,%xmm1
mulss  %xmm2,%xmm1
addss  %xmm0,%xmm1
movss  %xmm1,0x8(%r14)
movss  0xc(%rbx),%xmm0
movss  0xc(%r15),%xmm1
movaps %xmm0,%xmm2
cmpunordss %xmm0,%xmm2
movaps %xmm2,%xmm3
andps  %xmm1,%xmm3
maxss  %xmm0,%xmm1
andnps %xmm1,%xmm2
orps   %xmm3,%xmm2
movss  %xmm2,0xc(%r14)
add    $0x10,%rsp
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
define void @interpolate_rgb(float* %0, float* %1, float* %2, float %3) {
%5 = alloca float*
%6 = alloca float*
%7 = alloca float*
%8 = alloca float
store float* %0, float** %5
store float* %1, float** %6
store float* %2, float** %7
store float %3, float* %8
%9 = load float, float* %8
%10 = fcmp oge float %9, 0.000000e+00
br i1 %10, label %11, label %14
11: ; preds = %4
%12 = load float, float* %8
%13 = fcmp ole float %12, 1.000000e+00
br label %14
14: ; preds = %11, %4
%15 = phi i1 [ false, %4 ], [ %13, %11 ]
%16 = zext i1 %15 to i32
%17 = call i32 @assert(i32 %16)
%18 = load float*, float** %6
%19 = getelementptr inbounds float, float* %18, i64 0
%20 = load float, float* %19
%21 = load float, float* %8
%22 = load float*, float** %7
%23 = getelementptr inbounds float, float* %22, i64 0
%24 = load float, float* %23
%25 = load float*, float** %6
%26 = getelementptr inbounds float, float* %25, i64 0
%27 = load float, float* %26
%28 = fsub float %24, %27
%29 = call float @llvm.fmuladd.f32(float %21, float %28, float %20)
%30 = load float*, float** %5
%31 = getelementptr inbounds float, float* %30, i64 0
store float %29, float* %31
%32 = load float*, float** %6
%33 = getelementptr inbounds float, float* %32, i64 1
%34 = load float, float* %33
%35 = load float, float* %8
%36 = load float*, float** %7
%37 = getelementptr inbounds float, float* %36, i64 1
%38 = load float, float* %37
%39 = load float*, float** %6
%40 = getelementptr inbounds float, float* %39, i64 1
%41 = load float, float* %40
%42 = fsub float %38, %41
%43 = call float @llvm.fmuladd.f32(float %35, float %42, float %34)
%44 = load float*, float** %5
%45 = getelementptr inbounds float, float* %44, i64 1
store float %43, float* %45
%46 = load float*, float** %6
%47 = getelementptr inbounds float, float* %46, i64 2
%48 = load float, float* %47
%49 = load float, float* %8
%50 = load float*, float** %7
%51 = getelementptr inbounds float, float* %50, i64 2
%52 = load float, float* %51
%53 = load float*, float** %6
%54 = getelementptr inbounds float, float* %53, i64 2
%55 = load float, float* %54
%56 = fsub float %52, %55
%57 = call float @llvm.fmuladd.f32(float %49, float %56, float %48)
%58 = load float*, float** %5
%59 = getelementptr inbounds float, float* %58, i64 2
store float %57, float* %59
%60 = load float*, float** %6
%61 = getelementptr inbounds float, float* %60, i64 3
%62 = load float, float* %61
%63 = load float*, float** %7
%64 = getelementptr inbounds float, float* %63, i64 3
%65 = load float, float* %64
%66 = call float @fmax(float %62, float %65)
%67 = load float*, float** %5
%68 = getelementptr inbounds float, float* %67, i64 3
store float %66, float* %68
ret void
}

LLVM IR (-O2):
define void @interpolate_rgb(float* nocapture writeonly %0, float* nocapture %1, float* nocapture %2, float %3) {
%5 = fcmp oge float %3, 0.000000e+00
%6 = fcmp ole float %3, 1.000000e+00
%7 = and i1 %5, %6
%8 = zext i1 %7 to i32
%9 = tail call i32 @assert(i32 %8)
%10 = load float, float* %1
%11 = load float, float* %2
%12 = fsub float %11, %10
%13 = tail call float @llvm.fmuladd.f32(float %3, float %12, float %10)
store float %13, float* %0
%14 = getelementptr inbounds float, float* %1, i64 1
%15 = load float, float* %14
%16 = getelementptr inbounds float, float* %2, i64 1
%17 = load float, float* %16
%18 = fsub float %17, %15
%19 = tail call float @llvm.fmuladd.f32(float %3, float %18, float %15)
%20 = getelementptr inbounds float, float* %0, i64 1
store float %19, float* %20
%21 = getelementptr inbounds float, float* %1, i64 2
%22 = load float, float* %21
%23 = getelementptr inbounds float, float* %2, i64 2
%24 = load float, float* %23
%25 = fsub float %24, %22
%26 = tail call float @llvm.fmuladd.f32(float %3, float %25, float %22)
%27 = getelementptr inbounds float, float* %0, i64 2
store float %26, float* %27
%28 = getelementptr inbounds float, float* %1, i64 3
%29 = load float, float* %28
%30 = getelementptr inbounds float, float* %2, i64 3
%31 = load float, float* %30
%32 = tail call nsz float @llvm.maxnum.f32(float %29, float %31)
%33 = getelementptr inbounds float, float* %0, i64 3
store float %32, float* %33
ret void
}