#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 floorf(float);
void srgb2rct(float *io) {
  float R = io[0];
  float G = io[1];
  float B = io[2];
  float Y = floorf((R + 2.f * G + B) / 4.f);
  float U = R - G;
  float V = B - G;
  io[0] = Y;
  io[1] = U;
  io[2] = V;
}


x86 assembly (clang, -O0):
<srgb2rct>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
movss  (%rax),%xmm0
movss  %xmm0,-0xc(%rbp)
mov    -0x8(%rbp),%rax
movss  0x4(%rax),%xmm0
movss  %xmm0,-0x10(%rbp)
mov    -0x8(%rbp),%rax
movss  0x8(%rax),%xmm0
movss  %xmm0,-0x14(%rbp)
movss  -0xc(%rbp),%xmm1
movss  -0x10(%rbp),%xmm0
addss  %xmm0,%xmm0
addss  %xmm1,%xmm0
addss  -0x14(%rbp),%xmm0
movss  0xe9c(%rip),%xmm1
divss  %xmm1,%xmm0
call   1030 <floorf@plt>
movss  %xmm0,-0x18(%rbp)
movss  -0xc(%rbp),%xmm0
subss  -0x10(%rbp),%xmm0
movss  %xmm0,-0x1c(%rbp)
movss  -0x14(%rbp),%xmm0
subss  -0x10(%rbp),%xmm0
movss  %xmm0,-0x20(%rbp)
movss  -0x18(%rbp),%xmm0
mov    -0x8(%rbp),%rax
movss  %xmm0,(%rax)
movss  -0x1c(%rbp),%xmm0
mov    -0x8(%rbp),%rax
movss  %xmm0,0x4(%rax)
movss  -0x20(%rbp),%xmm0
mov    -0x8(%rbp),%rax
movss  %xmm0,0x8(%rax)
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<srgb2rct>:
push   %rbx
sub    $0x10,%rsp
mov    %rdi,%rbx
movss  (%rdi),%xmm1
movss  %xmm1,0x8(%rsp)
movss  0x4(%rdi),%xmm0
movss  %xmm0,0xc(%rsp)
movss  0x8(%rdi),%xmm2
movss  %xmm2,0x4(%rsp)
addss  %xmm0,%xmm0
addss  %xmm1,%xmm0
addss  %xmm2,%xmm0
mulss  0xeb4(%rip),%xmm0
call   1030 <floorf@plt>
movss  0x8(%rsp),%xmm1
movss  0xc(%rsp),%xmm3
subss  %xmm3,%xmm1
movss  0x4(%rsp),%xmm2
subss  %xmm3,%xmm2
movss  %xmm0,(%rbx)
movss  %xmm1,0x4(%rbx)
movss  %xmm2,0x8(%rbx)
add    $0x10,%rsp
pop    %rbx
ret

LLVM IR (-O0):
define void @srgb2rct(float* %0) {
%2 = alloca float*
%3 = alloca float
%4 = alloca float
%5 = alloca float
%6 = alloca float
%7 = alloca float
%8 = alloca float
store float* %0, float** %2
%9 = load float*, float** %2
%10 = getelementptr inbounds float, float* %9, i64 0
%11 = load float, float* %10
store float %11, float* %3
%12 = load float*, float** %2
%13 = getelementptr inbounds float, float* %12, i64 1
%14 = load float, float* %13
store float %14, float* %4
%15 = load float*, float** %2
%16 = getelementptr inbounds float, float* %15, i64 2
%17 = load float, float* %16
store float %17, float* %5
%18 = load float, float* %3
%19 = load float, float* %4
%20 = call float @llvm.fmuladd.f32(float 2.000000e+00, float %19, float %18)
%21 = load float, float* %5
%22 = fadd float %20, %21
%23 = fdiv float %22, 4.000000e+00
%24 = call float @llvm.floor.f32(float %23)
store float %24, float* %6
%25 = load float, float* %3
%26 = load float, float* %4
%27 = fsub float %25, %26
store float %27, float* %7
%28 = load float, float* %5
%29 = load float, float* %4
%30 = fsub float %28, %29
store float %30, float* %8
%31 = load float, float* %6
%32 = load float*, float** %2
%33 = getelementptr inbounds float, float* %32, i64 0
store float %31, float* %33
%34 = load float, float* %7
%35 = load float*, float** %2
%36 = getelementptr inbounds float, float* %35, i64 1
store float %34, float* %36
%37 = load float, float* %8
%38 = load float*, float** %2
%39 = getelementptr inbounds float, float* %38, i64 2
store float %37, float* %39
ret void
}

LLVM IR (-O2):
define void @srgb2rct(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 %4, float 2.000000e+00, float %2)
%8 = fadd float %7, %6
%9 = fmul float %8, 2.500000e-01
%10 = tail call float @llvm.floor.f32(float %9)
%11 = fsub float %2, %4
%12 = fsub float %6, %4
store float %10, float* %0
store float %11, float* %3
store float %12, float* %5
ret void
}