#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 */
float fclampf(float, float, float);
void ycbcr2rgb(float *io) {
  float WR = 0.2126f;
  float WB = 0.0722f;
  float WG = 1.0f - WR - WB;
  float UMAX = 0.5f;
  float VMAX = 0.5f;
  float y = io[0], u = io[1], v = io[2];
  io[0] = fclampf(y + (1.0f - WR) / VMAX * v, 0.0f, 1.0f);
  io[1] = fclampf(y - WB * (1.0f - WB) / (UMAX * WG) * u -
                      WR * (1.0f - WR) / (VMAX * WG) * v,
                  0.0f, 1.0f);
  io[2] = fclampf(y + (1.0f - WB) / UMAX * u, 0.0f, 1.0f);
}


x86 assembly (clang, -O0):
<ycbcr2rgb>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
movss  0xee8(%rip),%xmm0
movss  %xmm0,-0xc(%rbp)
movss  0xed7(%rip),%xmm0
movss  %xmm0,-0x10(%rbp)
movss  0xec2(%rip),%xmm0
subss  -0xc(%rbp),%xmm0
subss  -0x10(%rbp),%xmm0
movss  %xmm0,-0x14(%rbp)
movss  0xeaf(%rip),%xmm0
movss  %xmm0,-0x18(%rbp)
movss  0xea2(%rip),%xmm0
movss  %xmm0,-0x1c(%rbp)
mov    -0x8(%rbp),%rax
movss  (%rax),%xmm0
movss  %xmm0,-0x20(%rbp)
mov    -0x8(%rbp),%rax
movss  0x4(%rax),%xmm0
movss  %xmm0,-0x24(%rbp)
mov    -0x8(%rbp),%rax
movss  0x8(%rax),%xmm0
movss  %xmm0,-0x28(%rbp)
movss  -0x20(%rbp),%xmm1
movss  0xe63(%rip),%xmm0
subss  -0xc(%rbp),%xmm0
divss  -0x1c(%rbp),%xmm0
movss  -0x28(%rbp),%xmm2
mulss  %xmm2,%xmm0
addss  %xmm1,%xmm0
xorps  %xmm1,%xmm1
movss  0xe41(%rip),%xmm2
call   1030 <fclampf@plt>
mov    -0x8(%rbp),%rax
movss  %xmm0,(%rax)
movss  -0x20(%rbp),%xmm0
movss  -0x10(%rbp),%xmm1
movss  0xe22(%rip),%xmm2
subss  -0x10(%rbp),%xmm2
mulss  %xmm2,%xmm1
movss  -0x18(%rbp),%xmm2
mulss  -0x14(%rbp),%xmm2
divss  %xmm2,%xmm1
movss  -0x24(%rbp),%xmm2
movd   %xmm1,%eax
xor    $0x80000000,%eax
movd   %eax,%xmm1
mulss  %xmm2,%xmm1
addss  %xmm0,%xmm1
movss  -0xc(%rbp),%xmm0
movss  0xde4(%rip),%xmm2
subss  -0xc(%rbp),%xmm2
mulss  %xmm2,%xmm0
movss  -0x1c(%rbp),%xmm2
mulss  -0x14(%rbp),%xmm2
divss  %xmm2,%xmm0
movss  -0x28(%rbp),%xmm2
movd   %xmm0,%eax
xor    $0x80000000,%eax
movd   %eax,%xmm0
mulss  %xmm2,%xmm0
addss  %xmm1,%xmm0
xorps  %xmm1,%xmm1
movss  0xda8(%rip),%xmm2
call   1030 <fclampf@plt>
mov    -0x8(%rbp),%rax
movss  %xmm0,0x4(%rax)
movss  -0x20(%rbp),%xmm1
movss  0xd8d(%rip),%xmm0
subss  -0x10(%rbp),%xmm0
divss  -0x18(%rbp),%xmm0
movss  -0x24(%rbp),%xmm2
mulss  %xmm2,%xmm0
addss  %xmm1,%xmm0
xorps  %xmm1,%xmm1
movss  0xd6b(%rip),%xmm2
call   1030 <fclampf@plt>
mov    -0x8(%rbp),%rax
movss  %xmm0,0x8(%rax)
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<ycbcr2rgb>:
push   %rbx
sub    $0x10,%rsp
mov    %rdi,%rbx
movss  (%rdi),%xmm1
movss  %xmm1,0x4(%rsp)
movss  0x4(%rdi),%xmm0
movss  %xmm0,0x8(%rsp)
movss  0x8(%rdi),%xmm2
movss  %xmm2,0xc(%rsp)
movss  0xec0(%rip),%xmm0
mulss  %xmm2,%xmm0
addss  %xmm1,%xmm0
movss  0xeb4(%rip),%xmm2
xorps  %xmm1,%xmm1
call   1030 <fclampf@plt>
movss  %xmm0,(%rbx)
movss  0xea4(%rip),%xmm0
mulss  0x8(%rsp),%xmm0
addss  0x4(%rsp),%xmm0
movss  0xc(%rsp),%xmm1
mulss  0xe8e(%rip),%xmm1
addss  %xmm0,%xmm1
movaps %xmm1,%xmm0
xorps  %xmm1,%xmm1
movss  0xe74(%rip),%xmm2
call   1030 <fclampf@plt>
movss  %xmm0,0x4(%rbx)
movss  0x8(%rsp),%xmm0
mulss  0xe68(%rip),%xmm0
addss  0x4(%rsp),%xmm0
xorps  %xmm1,%xmm1
movss  0xe4b(%rip),%xmm2
call   1030 <fclampf@plt>
movss  %xmm0,0x8(%rbx)
add    $0x10,%rsp
pop    %rbx
ret

LLVM IR (-O0):
define void @ycbcr2rgb(float* %0) {
%2 = alloca float*
%3 = alloca float
%4 = alloca float
%5 = alloca float
%6 = alloca float
%7 = alloca float
%8 = alloca float
%9 = alloca float
%10 = alloca float
store float* %0, float** %2
store float 0x3FCB367A00000000, float* %3
store float 0x3FB27BB300000000, float* %4
%11 = load float, float* %3
%12 = fsub float 1.000000e+00, %11
%13 = load float, float* %4
%14 = fsub float %12, %13
store float %14, float* %5
store float 5.000000e-01, float* %6
store float 5.000000e-01, float* %7
%15 = load float*, float** %2
%16 = getelementptr inbounds float, float* %15, i64 0
%17 = load float, float* %16
store float %17, float* %8
%18 = load float*, float** %2
%19 = getelementptr inbounds float, float* %18, i64 1
%20 = load float, float* %19
store float %20, float* %9
%21 = load float*, float** %2
%22 = getelementptr inbounds float, float* %21, i64 2
%23 = load float, float* %22
store float %23, float* %10
%24 = load float, float* %8
%25 = load float, float* %3
%26 = fsub float 1.000000e+00, %25
%27 = load float, float* %7
%28 = fdiv float %26, %27
%29 = load float, float* %10
%30 = call float @llvm.fmuladd.f32(float %28, float %29, float %24)
%31 = call float @fclampf(float %30, float 0.000000e+00, float 1.000000e+00)
%32 = load float*, float** %2
%33 = getelementptr inbounds float, float* %32, i64 0
store float %31, float* %33
%34 = load float, float* %8
%35 = load float, float* %4
%36 = load float, float* %4
%37 = fsub float 1.000000e+00, %36
%38 = fmul float %35, %37
%39 = load float, float* %6
%40 = load float, float* %5
%41 = fmul float %39, %40
%42 = fdiv float %38, %41
%43 = load float, float* %9
%44 = fneg float %42
%45 = call float @llvm.fmuladd.f32(float %44, float %43, float %34)
%46 = load float, float* %3
%47 = load float, float* %3
%48 = fsub float 1.000000e+00, %47
%49 = fmul float %46, %48
%50 = load float, float* %7
%51 = load float, float* %5
%52 = fmul float %50, %51
%53 = fdiv float %49, %52
%54 = load float, float* %10
%55 = fneg float %53
%56 = call float @llvm.fmuladd.f32(float %55, float %54, float %45)
%57 = call float @fclampf(float %56, float 0.000000e+00, float 1.000000e+00)
%58 = load float*, float** %2
%59 = getelementptr inbounds float, float* %58, i64 1
store float %57, float* %59
%60 = load float, float* %8
%61 = load float, float* %4
%62 = fsub float 1.000000e+00, %61
%63 = load float, float* %6
%64 = fdiv float %62, %63
%65 = load float, float* %9
%66 = call float @llvm.fmuladd.f32(float %64, float %65, float %60)
%67 = call float @fclampf(float %66, float 0.000000e+00, float 1.000000e+00)
%68 = load float*, float** %2
%69 = getelementptr inbounds float, float* %68, i64 2
store float %67, float* %69
ret void
}

LLVM IR (-O2):
define void @ycbcr2rgb(float* nocapture %0) {
%2 = load float, float* %0
%3 = getelementptr inbounds float, float* %0, i64 1
%4 = load float, float* %3
%5 = getelementptr inbounds float, float* %0, i64 2
%6 = load float, float* %5
%7 = tail call float @llvm.fmuladd.f32(float %6, float 0x3FF9326180000000, float %2)
%8 = tail call float @fclampf(float %7, float 0.000000e+00, float 1.000000e+00)
store float %8, float* %0
%9 = tail call float @llvm.fmuladd.f32(float %4, float 0xBFC7FA3DC0000000, float %2)
%10 = tail call float @llvm.fmuladd.f32(float %6, float 0xBFDDF5BF80000000, float %9)
%11 = tail call float @fclampf(float %10, float 0.000000e+00, float 1.000000e+00)
store float %11, float* %3
%12 = tail call float @llvm.fmuladd.f32(float %4, float 0x3FFDB089A0000000, float %2)
%13 = tail call float @fclampf(float %12, float 0.000000e+00, float 1.000000e+00)
store float %13, float* %5
ret void
}