#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 */
int /*<<< orphan*/ dt_Lab_to_XYZ(float const *const, float *);
void dt_Lab_to_prophotorgb(const float *const Lab, float *rgb) {
  const float xyz_to_rgb[3][3] = {
      {1.3459433, -0.2556075, -0.0511118},
      {-0.5445989, 1.5081673, 0.0205351},
      {0.0000000, 0.0000000, 1.2118128},
  };
  float XYZ[3];
  dt_Lab_to_XYZ(Lab, XYZ);
  rgb[0] = rgb[1] = rgb[2] = 0.0f;
  for (int r = 0; r < 3; r++)
    for (int c = 0; c < 3; c++)
      rgb[r] += xyz_to_rgb[r][c] * XYZ[c];
}


x86 assembly (clang, -O0):
<dt_Lab_to_prophotorgb>:
push   %rbp
mov    %rsp,%rbp
sub    $0x60,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
lea    -0x40(%rbp),%rdi
lea    0xec5(%rip),%rsi
mov    $0x24,%edx
call   1040 <memcpy@plt>
mov    -0x8(%rbp),%rdi
lea    -0x4c(%rbp),%rsi
call   1030 <dt_Lab_to_XYZ@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)
movl   $0x0,-0x50(%rbp)
cmpl   $0x3,-0x50(%rbp)
jge    11f4 <dt_Lab_to_prophotorgb+0xd4>
movl   $0x0,-0x54(%rbp)
cmpl   $0x3,-0x54(%rbp)
jge    11e1 <dt_Lab_to_prophotorgb+0xc1>
movslq -0x50(%rbp),%rcx
lea    -0x40(%rbp),%rax
imul   $0xc,%rcx,%rcx
add    %rcx,%rax
movslq -0x54(%rbp),%rcx
movss  (%rax,%rcx,4),%xmm0
movslq -0x54(%rbp),%rax
movss  -0x4c(%rbp,%rax,4),%xmm2
mov    -0x10(%rbp),%rax
movslq -0x50(%rbp),%rcx
movss  (%rax,%rcx,4),%xmm1
mulss  %xmm2,%xmm0
addss  %xmm1,%xmm0
movss  %xmm0,(%rax,%rcx,4)
mov    -0x54(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x54(%rbp)
jmp    118d <dt_Lab_to_prophotorgb+0x6d>
jmp    11e6 <dt_Lab_to_prophotorgb+0xc6>
mov    -0x50(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x50(%rbp)
jmp    117c <dt_Lab_to_prophotorgb+0x5c>
add    $0x60,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<dt_Lab_to_prophotorgb>:
push   %rbx
sub    $0x10,%rsp
mov    %rsi,%rbx
lea    0x4(%rsp),%rsi
call   1030 <dt_Lab_to_XYZ@plt>
movss  0x4(%rsp),%xmm1
movss  0x8(%rsp),%xmm0
movss  0xeca(%rip),%xmm3
mulss  %xmm1,%xmm3
xorps  %xmm2,%xmm2
addss  %xmm2,%xmm3
movss  0xebb(%rip),%xmm4
mulss  %xmm0,%xmm4
addss  %xmm3,%xmm4
movss  0xc(%rsp),%xmm3
movss  0xea9(%rip),%xmm5
mulss  %xmm3,%xmm5
addss  %xmm4,%xmm5
movss  %xmm5,(%rbx)
movss  0xe99(%rip),%xmm4
mulss  %xmm1,%xmm4
addss  %xmm2,%xmm4
movss  0xe8d(%rip),%xmm5
mulss  %xmm0,%xmm5
addss  %xmm4,%xmm5
movss  0xe81(%rip),%xmm4
mulss  %xmm3,%xmm4
addss  %xmm5,%xmm4
movss  %xmm4,0x4(%rbx)
mulss  %xmm2,%xmm1
addss  %xmm2,%xmm1
mulss  %xmm2,%xmm0
addss  %xmm1,%xmm0
mulss  0xe60(%rip),%xmm3
addss  %xmm0,%xmm3
movss  %xmm3,0x8(%rbx)
add    $0x10,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@__const.dt_Lab_to_prophotorgb.xyz_to_rgb = [3 x [3 x float]] [[3 x float] [float 0x3FF588FBE0000000, float 0xBFD05BDF80000000, float 0xBFAA2B5360000000], [3 x float] [float 0xBFE16D5AA0000000, float 0x3FF8217400000000, float 0x3F95072740000000], [3 x float] [float 0.000000e+00, float 0.000000e+00, float 0x3FF36395E0000000]]
define void @dt_Lab_to_prophotorgb(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
store float* %0, float** %3
store float* %1, float** %4
%9 = bitcast [3 x [3 x float]]* %5 to i8*
%10 = load float*, float** %3
%11 = getelementptr inbounds [3 x float], [3 x float]* %6, i64 0, i64 0
%12 = call i32 @dt_Lab_to_XYZ(float* %10, float* %11)
%13 = load float*, float** %4
%14 = getelementptr inbounds float, float* %13, i64 2
store float 0.000000e+00, float* %14
%15 = load float*, float** %4
%16 = getelementptr inbounds float, float* %15, i64 1
store float 0.000000e+00, float* %16
%17 = load float*, float** %4
%18 = getelementptr inbounds float, float* %17, i64 0
store float 0.000000e+00, float* %18
store i32 0, i32* %7
br label %19
19: ; preds = %48, %2
%20 = load i32, i32* %7
%21 = icmp slt i32 %20, 3
br i1 %21, label %22, label %51
22: ; preds = %19
store i32 0, i32* %8
br label %23
23: ; preds = %44, %22
%24 = load i32, i32* %8
%25 = icmp slt i32 %24, 3
br i1 %25, label %26, label %47
26: ; preds = %23
%27 = load i32, i32* %7
%28 = sext i32 %27 to i64
%29 = getelementptr inbounds [3 x [3 x float]], [3 x [3 x float]]* %5, i64 0, i64 %28
%30 = load i32, i32* %8
%31 = sext i32 %30 to i64
%32 = getelementptr inbounds [3 x float], [3 x float]* %29, i64 0, i64 %31
%33 = load float, float* %32
%34 = load i32, i32* %8
%35 = sext i32 %34 to i64
%36 = getelementptr inbounds [3 x float], [3 x float]* %6, i64 0, i64 %35
%37 = load float, float* %36
%38 = load float*, float** %4
%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 = call float @llvm.fmuladd.f32(float %33, float %37, float %42)
store float %43, float* %41
br label %44
44: ; preds = %26
%45 = load i32, i32* %8
%46 = add nsw i32 %45, 1
store i32 %46, i32* %8
br label %23
47: ; preds = %23
br label %48
48: ; preds = %47
%49 = load i32, i32* %7
%50 = add nsw i32 %49, 1
store i32 %50, i32* %7
br label %19
51: ; preds = %19
ret void
}

LLVM IR (-O2):
define void @dt_Lab_to_prophotorgb(float* %0, float* nocapture %1) {
%3 = alloca [3 x float]
%4 = bitcast [3 x float]* %3 to i8*
%5 = getelementptr inbounds [3 x float], [3 x float]* %3, i64 0, i64 0
%6 = call i32 @dt_Lab_to_XYZ(float* %0, float* %5)
%7 = getelementptr inbounds float, float* %1, i64 2
%8 = getelementptr inbounds float, float* %1, i64 1
%9 = load float, float* %5
%10 = call float @llvm.fmuladd.f32(float %9, float 0x3FF588FBE0000000, float 0.000000e+00)
%11 = getelementptr inbounds [3 x float], [3 x float]* %3, i64 0, i64 1
%12 = load float, float* %11
%13 = call float @llvm.fmuladd.f32(float %12, float 0xBFD05BDF80000000, float %10)
%14 = getelementptr inbounds [3 x float], [3 x float]* %3, i64 0, i64 2
%15 = load float, float* %14
%16 = call float @llvm.fmuladd.f32(float %15, float 0xBFAA2B5360000000, float %13)
store float %16, float* %1
%17 = call float @llvm.fmuladd.f32(float %9, float 0xBFE16D5AA0000000, float 0.000000e+00)
%18 = call float @llvm.fmuladd.f32(float %12, float 0x3FF8217400000000, float %17)
%19 = call float @llvm.fmuladd.f32(float %15, float 0x3F95072740000000, float %18)
store float %19, float* %8
%20 = call float @llvm.fmuladd.f32(float %9, float 0.000000e+00, float 0.000000e+00)
%21 = call float @llvm.fmuladd.f32(float %12, float 0.000000e+00, float %20)
%22 = call float @llvm.fmuladd.f32(float %15, float 0x3FF36395E0000000, float %21)
store float %22, float* %7
ret void
}