#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 cl255(float);
void yuv_comp_to_rgb(unsigned char y, unsigned char u, unsigned char v,
                     unsigned char *rgb) {
  float b = y;
  float va = v * 1.140;
  float vb = v * -0.581;
  float ub = u * -0.395;
  float uc = u * 2.032;
  rgb[0] = cl255(b + va);
  rgb[1] = cl255(b + vb + ub);
  rgb[2] = cl255(b + uc);
}


x86 assembly (clang, -O0):
<yuv_comp_to_rgb>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %dl,%al
mov    %sil,%dl
mov    %dil,%sil
mov    %sil,-0x1(%rbp)
mov    %dl,-0x2(%rbp)
mov    %al,-0x3(%rbp)
mov    %rcx,-0x10(%rbp)
movzbl -0x1(%rbp),%eax
cvtsi2ss %eax,%xmm0
movss  %xmm0,-0x14(%rbp)
movzbl -0x3(%rbp),%eax
cvtsi2sd %eax,%xmm0
movsd  0xecd(%rip),%xmm1
mulsd  %xmm1,%xmm0
cvtsd2ss %xmm0,%xmm0
movss  %xmm0,-0x18(%rbp)
movzbl -0x3(%rbp),%eax
cvtsi2sd %eax,%xmm0
movsd  0xea8(%rip),%xmm1
mulsd  %xmm1,%xmm0
cvtsd2ss %xmm0,%xmm0
movss  %xmm0,-0x1c(%rbp)
movzbl -0x2(%rbp),%eax
cvtsi2sd %eax,%xmm0
movsd  0xe83(%rip),%xmm1
mulsd  %xmm1,%xmm0
cvtsd2ss %xmm0,%xmm0
movss  %xmm0,-0x20(%rbp)
movzbl -0x2(%rbp),%eax
cvtsi2sd %eax,%xmm0
movsd  0xe5e(%rip),%xmm1
mulsd  %xmm1,%xmm0
cvtsd2ss %xmm0,%xmm0
movss  %xmm0,-0x24(%rbp)
movss  -0x14(%rbp),%xmm0
addss  -0x18(%rbp),%xmm0
call   1030 <cl255@plt>
mov    %al,%cl
mov    -0x10(%rbp),%rax
mov    %cl,(%rax)
movss  -0x14(%rbp),%xmm0
addss  -0x1c(%rbp),%xmm0
addss  -0x20(%rbp),%xmm0
call   1030 <cl255@plt>
mov    %al,%cl
mov    -0x10(%rbp),%rax
mov    %cl,0x1(%rax)
movss  -0x14(%rbp),%xmm0
addss  -0x24(%rbp),%xmm0
call   1030 <cl255@plt>
mov    %al,%cl
mov    -0x10(%rbp),%rax
mov    %cl,0x2(%rax)
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<yuv_comp_to_rgb>:
push   %rbx
sub    $0x10,%rsp
cvtsi2ss %edi,%xmm3
movss  %xmm3,(%rsp)
cvtsi2sd %edx,%xmm1
movsd  0xed6(%rip),%xmm0
mulsd  %xmm1,%xmm0
cvtsd2ss %xmm0,%xmm0
mulsd  0xece(%rip),%xmm1
cvtsd2ss %xmm1,%xmm1
movss  %xmm1,0x8(%rsp)
xorps  %xmm1,%xmm1
cvtsi2sd %esi,%xmm1
movsd  0xebd(%rip),%xmm2
mulsd  %xmm1,%xmm2
cvtsd2ss %xmm2,%xmm2
movss  %xmm2,0x4(%rsp)
mulsd  0xeaf(%rip),%xmm1
mov    %rcx,%rbx
cvtsd2ss %xmm1,%xmm1
movss  %xmm1,0xc(%rsp)
addss  %xmm3,%xmm0
call   1030 <cl255@plt>
mov    %al,(%rbx)
movss  0x8(%rsp),%xmm0
addss  (%rsp),%xmm0
addss  0x4(%rsp),%xmm0
call   1030 <cl255@plt>
mov    %al,0x1(%rbx)
movss  0xc(%rsp),%xmm0
addss  (%rsp),%xmm0
call   1030 <cl255@plt>
mov    %al,0x2(%rbx)
add    $0x10,%rsp
pop    %rbx
ret

LLVM IR (-O0):
define void @yuv_comp_to_rgb(i8 zeroext %0, i8 zeroext %1, i8 zeroext %2, i8* %3) {
%5 = alloca i8
%6 = alloca i8
%7 = alloca i8
%8 = alloca i8*
%9 = alloca float
%10 = alloca float
%11 = alloca float
%12 = alloca float
%13 = alloca float
store i8 %0, i8* %5
store i8 %1, i8* %6
store i8 %2, i8* %7
store i8* %3, i8** %8
%14 = load i8, i8* %5
%15 = uitofp i8 %14 to float
store float %15, float* %9
%16 = load i8, i8* %7
%17 = zext i8 %16 to i32
%18 = sitofp i32 %17 to double
%19 = fmul double %18, 1.140000e+00
%20 = fptrunc double %19 to float
store float %20, float* %10
%21 = load i8, i8* %7
%22 = zext i8 %21 to i32
%23 = sitofp i32 %22 to double
%24 = fmul double %23, -5.810000e-01
%25 = fptrunc double %24 to float
store float %25, float* %11
%26 = load i8, i8* %6
%27 = zext i8 %26 to i32
%28 = sitofp i32 %27 to double
%29 = fmul double %28, -3.950000e-01
%30 = fptrunc double %29 to float
store float %30, float* %12
%31 = load i8, i8* %6
%32 = zext i8 %31 to i32
%33 = sitofp i32 %32 to double
%34 = fmul double %33, 2.032000e+00
%35 = fptrunc double %34 to float
store float %35, float* %13
%36 = load float, float* %9
%37 = load float, float* %10
%38 = fadd float %36, %37
%39 = call zeroext i8 @cl255(float %38)
%40 = load i8*, i8** %8
%41 = getelementptr inbounds i8, i8* %40, i64 0
store i8 %39, i8* %41
%42 = load float, float* %9
%43 = load float, float* %11
%44 = fadd float %42, %43
%45 = load float, float* %12
%46 = fadd float %44, %45
%47 = call zeroext i8 @cl255(float %46)
%48 = load i8*, i8** %8
%49 = getelementptr inbounds i8, i8* %48, i64 1
store i8 %47, i8* %49
%50 = load float, float* %9
%51 = load float, float* %13
%52 = fadd float %50, %51
%53 = call zeroext i8 @cl255(float %52)
%54 = load i8*, i8** %8
%55 = getelementptr inbounds i8, i8* %54, i64 2
store i8 %53, i8* %55
ret void
}

LLVM IR (-O2):
define void @yuv_comp_to_rgb(i8 zeroext %0, i8 zeroext %1, i8 zeroext %2, i8* nocapture writeonly %3) {
%5 = uitofp i8 %0 to float
%6 = uitofp i8 %2 to double
%7 = fmul double %6, 1.140000e+00
%8 = fptrunc double %7 to float
%9 = fmul double %6, -5.810000e-01
%10 = fptrunc double %9 to float
%11 = uitofp i8 %1 to double
%12 = fmul double %11, -3.950000e-01
%13 = fptrunc double %12 to float
%14 = fmul double %11, 2.032000e+00
%15 = fptrunc double %14 to float
%16 = fadd float %5, %8
%17 = tail call zeroext i8 @cl255(float %16)
store i8 %17, i8* %3
%18 = fadd float %5, %10
%19 = fadd float %18, %13
%20 = tail call zeroext i8 @cl255(float %19)
%21 = getelementptr inbounds i8, i8* %3, i64 1
store i8 %20, i8* %21
%22 = fadd float %5, %15
%23 = tail call zeroext i8 @cl255(float %22)
%24 = getelementptr inbounds i8, i8* %3, i64 2
store i8 %23, i8* %24
ret void
}