#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 const powf(float const, double);
void dt_sRGB_to_XYZ(const float *const sRGB, float *XYZ) {
  const float srgb_to_xyz[3][3] = {{0.4360747, 0.3850649, 0.1430804},
                                   {0.2225045, 0.7168786, 0.0606169},
                                   {0.0139322, 0.0971045, 0.7141733}};
  XYZ[0] = XYZ[1] = XYZ[2] = 0.0;
  float rgb[3] = {0};
  for (int c = 0; c < 3; c++)
    rgb[c] = sRGB[c] <= 0.04045 ? sRGB[c] / 12.92
                                : powf((sRGB[c] + 0.055) / (1 + 0.055), 2.4);
  for (int r = 0; r < 3; r++)
    for (int c = 0; c < 3; c++)
      XYZ[r] += srgb_to_xyz[r][c] * rgb[c];
}


x86 assembly (clang, -O0):
<dt_sRGB_to_XYZ>:
push   %rbp
mov    %rsp,%rbp
sub    $0x60,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
lea    -0x40(%rbp),%rdi
lea    0xee5(%rip),%rsi
mov    $0x24,%edx
call   1050 <memcpy@plt>
mov    -0x10(%rbp),%rax
xorps  %xmm0,%xmm0
movss  %xmm0,0x8(%rax)
mov    -0x10(%rbp),%rax
xorps  %xmm0,%xmm0
movss  %xmm0,0x4(%rax)
mov    -0x10(%rbp),%rax
xorps  %xmm0,%xmm0
movss  %xmm0,(%rax)
lea    -0x4c(%rbp),%rdi
xor    %esi,%esi
mov    $0xc,%edx
call   1040 <memset@plt>
movl   $0x0,-0x50(%rbp)
cmpl   $0x3,-0x50(%rbp)
jge    1247 <dt_sRGB_to_XYZ+0x117>
mov    -0x8(%rbp),%rax
movslq -0x50(%rbp),%rcx
movss  (%rax,%rcx,4),%xmm0
cvtss2sd %xmm0,%xmm1
movsd  0xe4e(%rip),%xmm0
ucomisd %xmm1,%xmm0
jb     11e3 <dt_sRGB_to_XYZ+0xb3>
mov    -0x8(%rbp),%rax
movslq -0x50(%rbp),%rcx
movss  (%rax,%rcx,4),%xmm0
cvtss2sd %xmm0,%xmm0
movsd  0xe4b(%rip),%xmm1
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x60(%rbp)
jmp    1226 <dt_sRGB_to_XYZ+0xf6>
mov    -0x8(%rbp),%rax
movslq -0x50(%rbp),%rcx
movss  (%rax,%rcx,4),%xmm0
cvtss2sd %xmm0,%xmm0
movsd  0xe1c(%rip),%xmm1
addsd  %xmm1,%xmm0
movsd  0xe08(%rip),%xmm1
divsd  %xmm1,%xmm0
cvtsd2ss %xmm0,%xmm0
movsd  0xdf0(%rip),%xmm1
call   1030 <powf@plt>
cvtss2sd %xmm0,%xmm0
movsd  %xmm0,-0x60(%rbp)
movsd  -0x60(%rbp),%xmm0
cvtsd2ss %xmm0,%xmm0
movslq -0x50(%rbp),%rax
movss  %xmm0,-0x4c(%rbp,%rax,4)
mov    -0x50(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x50(%rbp)
jmp    118f <dt_sRGB_to_XYZ+0x5f>
movl   $0x0,-0x54(%rbp)
cmpl   $0x3,-0x54(%rbp)
jge    12c6 <dt_sRGB_to_XYZ+0x196>
movl   $0x0,-0x58(%rbp)
cmpl   $0x3,-0x58(%rbp)
jge    12b3 <dt_sRGB_to_XYZ+0x183>
movslq -0x54(%rbp),%rcx
lea    -0x40(%rbp),%rax
imul   $0xc,%rcx,%rcx
add    %rcx,%rax
movslq -0x58(%rbp),%rcx
movss  (%rax,%rcx,4),%xmm0
movslq -0x58(%rbp),%rax
movss  -0x4c(%rbp,%rax,4),%xmm2
mov    -0x10(%rbp),%rax
movslq -0x54(%rbp),%rcx
movss  (%rax,%rcx,4),%xmm1
mulss  %xmm2,%xmm0
addss  %xmm1,%xmm0
movss  %xmm0,(%rax,%rcx,4)
mov    -0x58(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x58(%rbp)
jmp    125f <dt_sRGB_to_XYZ+0x12f>
jmp    12b8 <dt_sRGB_to_XYZ+0x188>
mov    -0x54(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x54(%rbp)
jmp    124e <dt_sRGB_to_XYZ+0x11e>
add    $0x60,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<dt_sRGB_to_XYZ>:
push   %r14
push   %rbx
sub    $0x18,%rsp
mov    %rsi,%rbx
mov    %rdi,%r14
movl   $0x0,0x8(%rsi)
movq   $0x0,(%rsi)
movss  (%rdi),%xmm0
cvtss2sd %xmm0,%xmm2
movsd  0xec5(%rip),%xmm1
ucomisd %xmm2,%xmm1
jae    1176 <dt_sRGB_to_XYZ+0x66>
addsd  0xec7(%rip),%xmm2
divsd  0xec7(%rip),%xmm2
xorps  %xmm0,%xmm0
cvtsd2ss %xmm2,%xmm0
movsd  0xec0(%rip),%xmm1
call   1030 <powf@plt>
movsd  0xe93(%rip),%xmm1
xorps  %xmm2,%xmm2
cvtss2sd %xmm0,%xmm2
jmp    117e <dt_sRGB_to_XYZ+0x6e>
divsd  0xe8a(%rip),%xmm2
movss  0x4(%r14),%xmm0
cvtss2sd %xmm0,%xmm0
ucomisd %xmm0,%xmm1
jae    11c9 <dt_sRGB_to_XYZ+0xb9>
addsd  0xe7a(%rip),%xmm0
divsd  0xe7a(%rip),%xmm0
cvtsd2ss %xmm0,%xmm0
movsd  0xe76(%rip),%xmm1
movsd  %xmm2,0x8(%rsp)
call   1030 <powf@plt>
movsd  0x8(%rsp),%xmm2
movsd  0xe3d(%rip),%xmm1
cvtss2sd %xmm0,%xmm0
jmp    11d1 <dt_sRGB_to_XYZ+0xc1>
divsd  0xe37(%rip),%xmm0
cvtsd2ss %xmm2,%xmm4
cvtsd2ss %xmm0,%xmm3
movss  0x8(%r14),%xmm0
cvtss2sd %xmm0,%xmm0
ucomisd %xmm0,%xmm1
jae    1228 <dt_sRGB_to_XYZ+0x118>
addsd  0xe1f(%rip),%xmm0
divsd  0xe1f(%rip),%xmm0
cvtsd2ss %xmm0,%xmm0
movsd  0xe1b(%rip),%xmm1
movss  %xmm3,0x8(%rsp)
movss  %xmm4,0x14(%rsp)
call   1030 <powf@plt>
movss  0x14(%rsp),%xmm4
movss  0x8(%rsp),%xmm3
cvtss2sd %xmm0,%xmm0
jmp    1230 <dt_sRGB_to_XYZ+0x120>
divsd  0xdd8(%rip),%xmm0
cvtsd2ss %xmm0,%xmm0
movss  0xdec(%rip),%xmm1
mulss  %xmm4,%xmm1
addss  (%rbx),%xmm1
movss  0xde0(%rip),%xmm2
mulss  %xmm3,%xmm2
addss  %xmm1,%xmm2
movss  0xdd4(%rip),%xmm1
mulss  %xmm0,%xmm1
addss  %xmm2,%xmm1
movss  %xmm1,(%rbx)
movss  0xdc4(%rip),%xmm1
mulss  %xmm4,%xmm1
addss  0x4(%rbx),%xmm1
movss  0xdb7(%rip),%xmm2
mulss  %xmm3,%xmm2
addss  %xmm1,%xmm2
movss  0xdab(%rip),%xmm1
mulss  %xmm0,%xmm1
addss  %xmm2,%xmm1
movss  %xmm1,0x4(%rbx)
mulss  0xd9a(%rip),%xmm4
addss  0x8(%rbx),%xmm4
mulss  0xd91(%rip),%xmm3
addss  %xmm4,%xmm3
mulss  0xd89(%rip),%xmm0
addss  %xmm3,%xmm0
movss  %xmm0,0x8(%rbx)
add    $0x18,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@__const.dt_sRGB_to_XYZ.srgb_to_xyz = [3 x [3 x float]] [[3 x float] [float 0x3FDBE8A5E0000000, float 0x3FD8A4E740000000, float 0x3FC2507560000000], [3 x float] [float 0x3FCC7B0700000000, float 0x3FE6F0AB60000000, float 0x3FAF092DA0000000], [3 x float] [float 0x3F8C887C40000000, float 0x3FB8DBD720000000, float 0x3FE6DA8200000000]]
define void @dt_sRGB_to_XYZ(float* %0, float* %1) {
%3 = alloca float*
%4 = alloca float*
%5 = alloca [3 x [3 x float]]
%6 = alloca [3 x float]
%7 = alloca i32
%8 = alloca i32
%9 = alloca i32
store float* %0, float** %3
store float* %1, float** %4
%10 = bitcast [3 x [3 x float]]* %5 to i8*
%11 = load float*, float** %4
%12 = getelementptr inbounds float, float* %11, i64 2
store float 0.000000e+00, float* %12
%13 = load float*, float** %4
%14 = getelementptr inbounds float, float* %13, i64 1
store float 0.000000e+00, float* %14
%15 = load float*, float** %4
%16 = getelementptr inbounds float, float* %15, i64 0
store float 0.000000e+00, float* %16
%17 = bitcast [3 x float]* %6 to i8*
store i32 0, i32* %7
br label %18
18: ; preds = %55, %2
%19 = load i32, i32* %7
%20 = icmp slt i32 %19, 3
br i1 %20, label %21, label %58
21: ; preds = %18
%22 = load float*, float** %3
%23 = load i32, i32* %7
%24 = sext i32 %23 to i64
%25 = getelementptr inbounds float, float* %22, i64 %24
%26 = load float, float* %25
%27 = fpext float %26 to double
%28 = fcmp ole double %27, 4.045000e-02
br i1 %28, label %29, label %37
29: ; preds = %21
%30 = load float*, float** %3
%31 = load i32, i32* %7
%32 = sext i32 %31 to i64
%33 = getelementptr inbounds float, float* %30, i64 %32
%34 = load float, float* %33
%35 = fpext float %34 to double
%36 = fdiv double %35, 1.292000e+01
br label %49
37: ; preds = %21
%38 = load float*, float** %3
%39 = load i32, i32* %7
%40 = sext i32 %39 to i64
%41 = getelementptr inbounds float, float* %38, i64 %40
%42 = load float, float* %41
%43 = fpext float %42 to double
%44 = fadd double %43, 5.500000e-02
%45 = fdiv double %44, 1.055000e+00
%46 = fptrunc double %45 to float
%47 = call float @powf(float %46, double 2.400000e+00)
%48 = fpext float %47 to double
br label %49
49: ; preds = %37, %29
%50 = phi double [ %36, %29 ], [ %48, %37 ]
%51 = fptrunc double %50 to float
%52 = load i32, i32* %7
%53 = sext i32 %52 to i64
%54 = getelementptr inbounds [3 x float], [3 x float]* %6, i64 0, i64 %53
store float %51, float* %54
br label %55
55: ; preds = %49
%56 = load i32, i32* %7
%57 = add nsw i32 %56, 1
store i32 %57, i32* %7
br label %18
58: ; preds = %18
store i32 0, i32* %8
br label %59
59: ; preds = %88, %58
%60 = load i32, i32* %8
%61 = icmp slt i32 %60, 3
br i1 %61, label %62, label %91
62: ; preds = %59
store i32 0, i32* %9
br label %63
63: ; preds = %84, %62
%64 = load i32, i32* %9
%65 = icmp slt i32 %64, 3
br i1 %65, label %66, label %87
66: ; preds = %63
%67 = load i32, i32* %8
%68 = sext i32 %67 to i64
%69 = getelementptr inbounds [3 x [3 x float]], [3 x [3 x float]]* %5, i64 0, i64 %68
%70 = load i32, i32* %9
%71 = sext i32 %70 to i64
%72 = getelementptr inbounds [3 x float], [3 x float]* %69, i64 0, i64 %71
%73 = load float, float* %72
%74 = load i32, i32* %9
%75 = sext i32 %74 to i64
%76 = getelementptr inbounds [3 x float], [3 x float]* %6, i64 0, i64 %75
%77 = load float, float* %76
%78 = load float*, float** %4
%79 = load i32, i32* %8
%80 = sext i32 %79 to i64
%81 = getelementptr inbounds float, float* %78, i64 %80
%82 = load float, float* %81
%83 = call float @llvm.fmuladd.f32(float %73, float %77, float %82)
store float %83, float* %81
br label %84
84: ; preds = %66
%85 = load i32, i32* %9
%86 = add nsw i32 %85, 1
store i32 %86, i32* %9
br label %63
87: ; preds = %63
br label %88
88: ; preds = %87
%89 = load i32, i32* %8
%90 = add nsw i32 %89, 1
store i32 %90, i32* %8
br label %59
91: ; preds = %59
ret void
}

LLVM IR (-O2):
define void @dt_sRGB_to_XYZ(float* nocapture %0, float* nocapture %1) {
%3 = getelementptr inbounds float, float* %1, i64 2
store float 0.000000e+00, float* %3
%4 = getelementptr inbounds float, float* %1, i64 1
store float 0.000000e+00, float* %4
store float 0.000000e+00, float* %1
%5 = load float, float* %0
%6 = fpext float %5 to double
%7 = fcmp ugt double %6, 4.045000e-02
br i1 %7, label %10, label %8
8: ; preds = %2
%9 = fdiv double %6, 1.292000e+01
br label %16
10: ; preds = %2
%11 = fadd double %6, 5.500000e-02
%12 = fdiv double %11, 1.055000e+00
%13 = fptrunc double %12 to float
%14 = tail call float @powf(float %13, double 2.400000e+00)
%15 = fpext float %14 to double
br label %16
16: ; preds = %10, %8
%17 = phi double [ %9, %8 ], [ %15, %10 ]
%18 = fptrunc double %17 to float
%19 = getelementptr inbounds float, float* %0, i64 1
%20 = load float, float* %19
%21 = fpext float %20 to double
%22 = fcmp ugt double %21, 4.045000e-02
br i1 %22, label %25, label %23
23: ; preds = %16
%24 = fdiv double %21, 1.292000e+01
br label %31
25: ; preds = %16
%26 = fadd double %21, 5.500000e-02
%27 = fdiv double %26, 1.055000e+00
%28 = fptrunc double %27 to float
%29 = tail call float @powf(float %28, double 2.400000e+00)
%30 = fpext float %29 to double
br label %31
31: ; preds = %25, %23
%32 = phi double [ %24, %23 ], [ %30, %25 ]
%33 = fptrunc double %32 to float
%34 = getelementptr inbounds float, float* %0, i64 2
%35 = load float, float* %34
%36 = fpext float %35 to double
%37 = fcmp ugt double %36, 4.045000e-02
br i1 %37, label %40, label %38
38: ; preds = %31
%39 = fdiv double %36, 1.292000e+01
br label %46
40: ; preds = %31
%41 = fadd double %36, 5.500000e-02
%42 = fdiv double %41, 1.055000e+00
%43 = fptrunc double %42 to float
%44 = tail call float @powf(float %43, double 2.400000e+00)
%45 = fpext float %44 to double
br label %46
46: ; preds = %40, %38
%47 = phi double [ %39, %38 ], [ %45, %40 ]
%48 = fptrunc double %47 to float
%49 = load float, float* %1
%50 = tail call float @llvm.fmuladd.f32(float %18, float 0x3FDBE8A5E0000000, float %49)
%51 = tail call float @llvm.fmuladd.f32(float %33, float 0x3FD8A4E740000000, float %50)
%52 = tail call float @llvm.fmuladd.f32(float %48, float 0x3FC2507560000000, float %51)
store float %52, float* %1
%53 = load float, float* %4
%54 = tail call float @llvm.fmuladd.f32(float %18, float 0x3FCC7B0700000000, float %53)
%55 = tail call float @llvm.fmuladd.f32(float %33, float 0x3FE6F0AB60000000, float %54)
%56 = tail call float @llvm.fmuladd.f32(float %48, float 0x3FAF092DA0000000, float %55)
store float %56, float* %4
%57 = load float, float* %3
%58 = tail call float @llvm.fmuladd.f32(float %18, float 0x3F8C887C40000000, float %57)
%59 = tail call float @llvm.fmuladd.f32(float %33, float 0x3FB8DBD720000000, float %58)
%60 = tail call float @llvm.fmuladd.f32(float %48, float 0x3FE6DA8200000000, float %59)
store float %60, float* %3
ret void
}