#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 */
unsigned char blerp(unsigned char, unsigned char, int);
void lerp_rgb(unsigned char *dst, unsigned char *a, unsigned char *b, int f) {
  dst[0] = blerp(a[0], b[0], f);
  dst[1] = blerp(a[1], b[1], f);
  dst[2] = blerp(a[2], b[2], f);
}


x86 assembly (clang, -O0):
<lerp_rgb>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %ecx,-0x1c(%rbp)
mov    -0x10(%rbp),%rax
mov    (%rax),%cl
mov    -0x18(%rbp),%rax
mov    (%rax),%al
mov    -0x1c(%rbp),%edx
movzbl %cl,%edi
movzbl %al,%esi
call   1030 <blerp@plt>
mov    %al,%cl
mov    -0x8(%rbp),%rax
mov    %cl,(%rax)
mov    -0x10(%rbp),%rax
mov    0x1(%rax),%cl
mov    -0x18(%rbp),%rax
mov    0x1(%rax),%al
mov    -0x1c(%rbp),%edx
movzbl %cl,%edi
movzbl %al,%esi
call   1030 <blerp@plt>
mov    %al,%cl
mov    -0x8(%rbp),%rax
mov    %cl,0x1(%rax)
mov    -0x10(%rbp),%rax
mov    0x2(%rax),%cl
mov    -0x18(%rbp),%rax
mov    0x2(%rax),%al
mov    -0x1c(%rbp),%edx
movzbl %cl,%edi
movzbl %al,%esi
call   1030 <blerp@plt>
mov    %al,%cl
mov    -0x8(%rbp),%rax
mov    %cl,0x2(%rax)
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<lerp_rgb>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
mov    %ecx,%r14d
mov    %rdx,%rbx
mov    %rsi,%rbp
mov    %rdi,%r15
movzbl (%rsi),%edi
movzbl (%rdx),%esi
mov    %ecx,%edx
call   1030 <blerp@plt>
mov    %al,(%r15)
movzbl 0x1(%rbp),%edi
movzbl 0x1(%rbx),%esi
mov    %r14d,%edx
call   1030 <blerp@plt>
mov    %al,0x1(%r15)
movzbl 0x2(%rbp),%edi
movzbl 0x2(%rbx),%esi
mov    %r14d,%edx
call   1030 <blerp@plt>
mov    %al,0x2(%r15)
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
define void @lerp_rgb(i8* %0, i8* %1, i8* %2, i32 %3) {
%5 = alloca i8*
%6 = alloca i8*
%7 = alloca i8*
%8 = alloca i32
store i8* %0, i8** %5
store i8* %1, i8** %6
store i8* %2, i8** %7
store i32 %3, i32* %8
%9 = load i8*, i8** %6
%10 = getelementptr inbounds i8, i8* %9, i64 0
%11 = load i8, i8* %10
%12 = load i8*, i8** %7
%13 = getelementptr inbounds i8, i8* %12, i64 0
%14 = load i8, i8* %13
%15 = load i32, i32* %8
%16 = call zeroext i8 @blerp(i8 zeroext %11, i8 zeroext %14, i32 %15)
%17 = load i8*, i8** %5
%18 = getelementptr inbounds i8, i8* %17, i64 0
store i8 %16, i8* %18
%19 = load i8*, i8** %6
%20 = getelementptr inbounds i8, i8* %19, i64 1
%21 = load i8, i8* %20
%22 = load i8*, i8** %7
%23 = getelementptr inbounds i8, i8* %22, i64 1
%24 = load i8, i8* %23
%25 = load i32, i32* %8
%26 = call zeroext i8 @blerp(i8 zeroext %21, i8 zeroext %24, i32 %25)
%27 = load i8*, i8** %5
%28 = getelementptr inbounds i8, i8* %27, i64 1
store i8 %26, i8* %28
%29 = load i8*, i8** %6
%30 = getelementptr inbounds i8, i8* %29, i64 2
%31 = load i8, i8* %30
%32 = load i8*, i8** %7
%33 = getelementptr inbounds i8, i8* %32, i64 2
%34 = load i8, i8* %33
%35 = load i32, i32* %8
%36 = call zeroext i8 @blerp(i8 zeroext %31, i8 zeroext %34, i32 %35)
%37 = load i8*, i8** %5
%38 = getelementptr inbounds i8, i8* %37, i64 2
store i8 %36, i8* %38
ret void
}

LLVM IR (-O2):
define void @lerp_rgb(i8* nocapture writeonly %0, i8* nocapture %1, i8* nocapture %2, i32 %3) {
%5 = load i8, i8* %1
%6 = load i8, i8* %2
%7 = tail call zeroext i8 @blerp(i8 zeroext %5, i8 zeroext %6, i32 %3)
store i8 %7, i8* %0
%8 = getelementptr inbounds i8, i8* %1, i64 1
%9 = load i8, i8* %8
%10 = getelementptr inbounds i8, i8* %2, i64 1
%11 = load i8, i8* %10
%12 = tail call zeroext i8 @blerp(i8 zeroext %9, i8 zeroext %11, i32 %3)
%13 = getelementptr inbounds i8, i8* %0, i64 1
store i8 %12, i8* %13
%14 = getelementptr inbounds i8, i8* %1, i64 2
%15 = load i8, i8* %14
%16 = getelementptr inbounds i8, i8* %2, i64 2
%17 = load i8, i8* %16
%18 = tail call zeroext i8 @blerp(i8 zeroext %15, i8 zeroext %17, i32 %3)
%19 = getelementptr inbounds i8, i8* %0, i64 2
store i8 %18, i8* %19
ret void
}