#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 int /*<<< orphan*/ uint8_t;

/* Variables and functions */
void *clipp(double);
uint8_t *YUV2RGB(double Y, double U, double V, uint8_t *out) {
  *out++ = clipp(Y + 1.4075 * (V - 128));
  *out++ = clipp(Y - 0.3455 * (U - 128) - (0.7169 * (V - 128)));
  *out++ = clipp(Y + 1.7790 * (U - 128));
  return out;
}


x86 assembly (clang, -O0):
<YUV2RGB>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movsd  %xmm0,-0x8(%rbp)
movsd  %xmm1,-0x10(%rbp)
movsd  %xmm2,-0x18(%rbp)
mov    %rdi,-0x20(%rbp)
movsd  -0x8(%rbp),%xmm1
movsd  -0x18(%rbp),%xmm0
movsd  0xecb(%rip),%xmm2
subsd  %xmm2,%xmm0
movsd  0xed7(%rip),%xmm2
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
call   1030 <clipp@plt>
mov    %eax,%ecx
mov    -0x20(%rbp),%rax
mov    %rax,%rdx
add    $0x4,%rdx
mov    %rdx,-0x20(%rbp)
mov    %ecx,(%rax)
movsd  -0x8(%rbp),%xmm0
movsd  -0x10(%rbp),%xmm1
movsd  0xe8d(%rip),%xmm2
subsd  %xmm2,%xmm1
movsd  0xe91(%rip),%xmm2
mulsd  %xmm2,%xmm1
addsd  %xmm0,%xmm1
movsd  -0x18(%rbp),%xmm0
movsd  0xe6c(%rip),%xmm2
subsd  %xmm2,%xmm0
movsd  0xe68(%rip),%xmm2
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
call   1030 <clipp@plt>
mov    %eax,%ecx
mov    -0x20(%rbp),%rax
mov    %rax,%rdx
add    $0x4,%rdx
mov    %rdx,-0x20(%rbp)
mov    %ecx,(%rax)
movsd  -0x8(%rbp),%xmm1
movsd  -0x10(%rbp),%xmm0
movsd  0xe2e(%rip),%xmm2
subsd  %xmm2,%xmm0
movsd  0xe1a(%rip),%xmm2
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
call   1030 <clipp@plt>
mov    %eax,%ecx
mov    -0x20(%rbp),%rax
mov    %rax,%rdx
add    $0x4,%rdx
mov    %rdx,-0x20(%rbp)
mov    %ecx,(%rax)
mov    -0x20(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<YUV2RGB>:
push   %rbx
sub    $0x20,%rsp
mov    %rdi,%rbx
movsd  %xmm1,0x8(%rsp)
movapd %xmm0,%xmm1
movsd  %xmm0,0x10(%rsp)
addsd  0xed0(%rip),%xmm2
movsd  %xmm2,0x18(%rsp)
movsd  0xeca(%rip),%xmm0
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
call   1030 <clipp@plt>
mov    %eax,(%rbx)
movsd  0x8(%rsp),%xmm1
addsd  0xea5(%rip),%xmm1
movsd  %xmm1,0x8(%rsp)
movsd  0xea7(%rip),%xmm0
mulsd  %xmm1,%xmm0
addsd  0x10(%rsp),%xmm0
movsd  0x18(%rsp),%xmm1
mulsd  0xe97(%rip),%xmm1
addsd  %xmm0,%xmm1
movapd %xmm1,%xmm0
call   1030 <clipp@plt>
mov    %eax,0x4(%rbx)
movsd  0x8(%rsp),%xmm0
mulsd  0xe81(%rip),%xmm0
addsd  0x10(%rsp),%xmm0
call   1030 <clipp@plt>
mov    %eax,0x8(%rbx)
add    $0xc,%rbx
mov    %rbx,%rax
add    $0x20,%rsp
pop    %rbx
ret

LLVM IR (-O0):
define i32* @YUV2RGB(double %0, double %1, double %2, i32* %3) {
%5 = alloca double
%6 = alloca double
%7 = alloca double
%8 = alloca i32*
store double %0, double* %5
store double %1, double* %6
store double %2, double* %7
store i32* %3, i32** %8
%9 = load double, double* %5
%10 = load double, double* %7
%11 = fsub double %10, 1.280000e+02
%12 = call double @llvm.fmuladd.f64(double 1.407500e+00, double %11, double %9)
%13 = call i8* @clipp(double %12)
%14 = ptrtoint i8* %13 to i32
%15 = load i32*, i32** %8
%16 = getelementptr inbounds i32, i32* %15, i32 1
store i32* %16, i32** %8
store i32 %14, i32* %15
%17 = load double, double* %5
%18 = load double, double* %6
%19 = fsub double %18, 1.280000e+02
%20 = call double @llvm.fmuladd.f64(double -3.455000e-01, double %19, double %17)
%21 = load double, double* %7
%22 = fsub double %21, 1.280000e+02
%23 = call double @llvm.fmuladd.f64(double -7.169000e-01, double %22, double %20)
%24 = call i8* @clipp(double %23)
%25 = ptrtoint i8* %24 to i32
%26 = load i32*, i32** %8
%27 = getelementptr inbounds i32, i32* %26, i32 1
store i32* %27, i32** %8
store i32 %25, i32* %26
%28 = load double, double* %5
%29 = load double, double* %6
%30 = fsub double %29, 1.280000e+02
%31 = call double @llvm.fmuladd.f64(double 1.779000e+00, double %30, double %28)
%32 = call i8* @clipp(double %31)
%33 = ptrtoint i8* %32 to i32
%34 = load i32*, i32** %8
%35 = getelementptr inbounds i32, i32* %34, i32 1
store i32* %35, i32** %8
store i32 %33, i32* %34
%36 = load i32*, i32** %8
ret i32* %36
}

LLVM IR (-O2):
define i32* @YUV2RGB(double %0, double %1, double %2, i32* writeonly %3) {
%5 = fadd double %2, -1.280000e+02
%6 = tail call double @llvm.fmuladd.f64(double %5, double 1.407500e+00, double %0)
%7 = tail call i8* @clipp(double %6)
%8 = ptrtoint i8* %7 to i64
%9 = trunc i64 %8 to i32
%10 = getelementptr inbounds i32, i32* %3, i64 1
store i32 %9, i32* %3
%11 = fadd double %1, -1.280000e+02
%12 = tail call double @llvm.fmuladd.f64(double %11, double -3.455000e-01, double %0)
%13 = tail call double @llvm.fmuladd.f64(double %5, double -7.169000e-01, double %12)
%14 = tail call i8* @clipp(double %13)
%15 = ptrtoint i8* %14 to i64
%16 = trunc i64 %15 to i32
%17 = getelementptr inbounds i32, i32* %3, i64 2
store i32 %16, i32* %10
%18 = tail call double @llvm.fmuladd.f64(double %11, double 1.779000e+00, double %0)
%19 = tail call i8* @clipp(double %18)
%20 = ptrtoint i8* %19 to i64
%21 = trunc i64 %20 to i32
%22 = getelementptr inbounds i32, i32* %3, i64 3
store i32 %21, i32* %17
ret i32* %22
}