#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 */
typedef scalar_t__ uint_fast8_t;
typedef int /*<<< orphan*/ uint32_t;
typedef scalar_t__ int_fast16_t;

/* Variables and functions */
int /*<<< orphan*/ clamp(scalar_t__);
int /*<<< orphan*/ color(int /*<<< orphan*/, int /*<<< orphan*/,
                         int /*<<< orphan*/, int);
uint32_t applicate_color_alpha(uint_fast8_t c[3], int_fast16_t m,
                               int transparent) {
  return color(clamp(c[0] + m), clamp(c[1] + m), clamp(c[2] + m),
               transparent ? 0 : 255);
}


x86 assembly (clang, -O0):
<applicate_color_alpha>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
mov    -0x8(%rbp),%rax
mov    (%rax),%rdi
add    -0x10(%rbp),%rdi
call   1030 <clamp@plt>
mov    %eax,-0x1c(%rbp)
mov    -0x8(%rbp),%rax
mov    0x8(%rax),%rdi
add    -0x10(%rbp),%rdi
call   1030 <clamp@plt>
mov    %eax,-0x18(%rbp)
mov    -0x8(%rbp),%rax
mov    0x10(%rax),%rdi
add    -0x10(%rbp),%rdi
call   1030 <clamp@plt>
mov    -0x1c(%rbp),%edi
mov    -0x18(%rbp),%esi
mov    %eax,%edx
mov    -0x14(%rbp),%r8d
mov    $0xff,%ecx
xor    %eax,%eax
cmp    $0x0,%r8d
cmovne %eax,%ecx
call   1040 <color@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<applicate_color_alpha>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
mov    %edx,%r14d
mov    %rsi,%rbx
mov    %rdi,%rbp
mov    (%rdi),%rdi
add    %rsi,%rdi
call   1030 <clamp@plt>
mov    %eax,%r15d
mov    0x8(%rbp),%rdi
add    %rbx,%rdi
call   1030 <clamp@plt>
mov    %eax,%r12d
add    0x10(%rbp),%rbx
mov    %rbx,%rdi
call   1030 <clamp@plt>
xor    %edx,%edx
test   %r14d,%r14d
mov    $0xff,%ecx
cmovne %edx,%ecx
mov    %r15d,%edi
mov    %r12d,%esi
mov    %eax,%edx
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
jmp    1040 <color@plt>

LLVM IR (-O0):
define i32 @applicate_color_alpha(i64* %0, i64 %1, i32 %2) {
%4 = alloca i64*
%5 = alloca i64
%6 = alloca i32
store i64* %0, i64** %4
store i64 %1, i64* %5
store i32 %2, i32* %6
%7 = load i64*, i64** %4
%8 = getelementptr inbounds i64, i64* %7, i64 0
%9 = load i64, i64* %8
%10 = load i64, i64* %5
%11 = add nsw i64 %9, %10
%12 = call i32 @clamp(i64 %11)
%13 = load i64*, i64** %4
%14 = getelementptr inbounds i64, i64* %13, i64 1
%15 = load i64, i64* %14
%16 = load i64, i64* %5
%17 = add nsw i64 %15, %16
%18 = call i32 @clamp(i64 %17)
%19 = load i64*, i64** %4
%20 = getelementptr inbounds i64, i64* %19, i64 2
%21 = load i64, i64* %20
%22 = load i64, i64* %5
%23 = add nsw i64 %21, %22
%24 = call i32 @clamp(i64 %23)
%25 = load i32, i32* %6
%26 = icmp ne i32 %25, 0
%27 = zext i1 %26 to i64
%28 = select i1 %26, i32 0, i32 255
%29 = call i32 @color(i32 %12, i32 %18, i32 %24, i32 %28)
ret i32 %29
}

LLVM IR (-O2):
define i32 @applicate_color_alpha(i64* nocapture %0, i64 %1, i32 %2) {
%4 = load i64, i64* %0
%5 = add nsw i64 %4, %1
%6 = tail call i32 @clamp(i64 %5)
%7 = getelementptr inbounds i64, i64* %0, i64 1
%8 = load i64, i64* %7
%9 = add nsw i64 %8, %1
%10 = tail call i32 @clamp(i64 %9)
%11 = getelementptr inbounds i64, i64* %0, i64 2
%12 = load i64, i64* %11
%13 = add nsw i64 %12, %1
%14 = tail call i32 @clamp(i64 %13)
%15 = icmp eq i32 %2, 0
%16 = select i1 %15, i32 255, i32 0
%17 = tail call i32 @color(i32 %6, i32 %10, i32 %14, i32 %16)
ret i32 %17
}