#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 */
struct qcms_modular_transform {
  int dummy;
};

/* Variables and functions */
double pow(float, double);
void qcms_transform_module_XYZ_to_LAB(struct qcms_modular_transform *transform,
                                      float *src, float *dest, size_t length) {
  size_t i;
  float WhitePointX = 0.9642f;
  float WhitePointY = 1.0f;
  float WhitePointZ = 0.8249f;
  for (i = 0; i < length; i++) {
    float device_x = *src++ * (1.0 + 32767.0 / 32768.0) / WhitePointX;
    float device_y = *src++ * (1.0 + 32767.0 / 32768.0) / WhitePointY;
    float device_z = *src++ * (1.0 + 32767.0 / 32768.0) / WhitePointZ;
    float fx =
        (device_x <= (24.0f / 116.0f) * (24.0f / 116.0f) * (24.0f / 116.0f))
            ? ((841.0 / 108.0) * device_x + (16.0 / 116.0))
            : pow(device_x, 1.0 / 3.0);
    float fy =
        (device_y <= (24.0f / 116.0f) * (24.0f / 116.0f) * (24.0f / 116.0f))
            ? ((841.0 / 108.0) * device_y + (16.0 / 116.0))
            : pow(device_y, 1.0 / 3.0);
    float fz =
        (device_z <= (24.0f / 116.0f) * (24.0f / 116.0f) * (24.0f / 116.0f))
            ? ((841.0 / 108.0) * device_z + (16.0 / 116.0))
            : pow(device_z, 1.0 / 3.0);
    float L = 116.0f * fy - 16.0f;
    float a = 500.0f * (fx - fy);
    float b = 200.0f * (fy - fz);
    *dest++ = L / 100.0f;
    *dest++ = (a + 128.0f) / 255.0f;
    *dest++ = (b + 128.0f) / 255.0f;
  }
}


x86 assembly (clang, -O0):
<qcms_transform_module_XYZ_to_LAB>:
push   %rbp
mov    %rsp,%rbp
sub    $0x70,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
movss  0xed8(%rip),%xmm0
movss  %xmm0,-0x2c(%rbp)
movss  0xec7(%rip),%xmm0
movss  %xmm0,-0x30(%rbp)
movss  0xeb6(%rip),%xmm0
movss  %xmm0,-0x34(%rbp)
movq   $0x0,-0x28(%rbp)
mov    -0x28(%rbp),%rax
cmp    -0x20(%rbp),%rax
jae    141b <qcms_transform_module_XYZ_to_LAB+0x30b>
mov    -0x10(%rbp),%rax
mov    %rax,%rcx
add    $0x4,%rcx
mov    %rcx,-0x10(%rbp)
movss  (%rax),%xmm0
cvtss2sd %xmm0,%xmm0
movsd  0xeac(%rip),%xmm1
mulsd  %xmm1,%xmm0
movss  -0x2c(%rbp),%xmm1
cvtss2sd %xmm1,%xmm1
divsd  %xmm1,%xmm0
cvtsd2ss %xmm0,%xmm0
movss  %xmm0,-0x38(%rbp)
mov    -0x10(%rbp),%rax
mov    %rax,%rcx
add    $0x4,%rcx
mov    %rcx,-0x10(%rbp)
movss  (%rax),%xmm0
cvtss2sd %xmm0,%xmm0
movsd  0xe73(%rip),%xmm1
mulsd  %xmm1,%xmm0
movss  -0x30(%rbp),%xmm1
cvtss2sd %xmm1,%xmm1
divsd  %xmm1,%xmm0
cvtsd2ss %xmm0,%xmm0
movss  %xmm0,-0x3c(%rbp)
mov    -0x10(%rbp),%rax
mov    %rax,%rcx
add    $0x4,%rcx
mov    %rcx,-0x10(%rbp)
movss  (%rax),%xmm0
cvtss2sd %xmm0,%xmm0
movsd  0xe3a(%rip),%xmm1
mulsd  %xmm1,%xmm0
movss  -0x34(%rbp),%xmm1
cvtss2sd %xmm1,%xmm1
divsd  %xmm1,%xmm0
cvtsd2ss %xmm0,%xmm0
movss  %xmm0,-0x40(%rbp)
movss  0xdf4(%rip),%xmm0
ucomiss -0x38(%rbp),%xmm0
jb     124d <qcms_transform_module_XYZ_to_LAB+0x13d>
movss  -0x38(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
movsd  0xe0d(%rip),%xmm1
mulsd  %xmm1,%xmm0
movsd  0xe09(%rip),%xmm1
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x60(%rbp)
jmp    1264 <qcms_transform_module_XYZ_to_LAB+0x154>
movss  -0x38(%rbp),%xmm0
movsd  0xdde(%rip),%xmm1
call   1030 <pow@plt>
movsd  %xmm0,-0x60(%rbp)
movsd  -0x60(%rbp),%xmm0
cvtsd2ss %xmm0,%xmm0
movss  %xmm0,-0x44(%rbp)
movss  0xd92(%rip),%xmm0
ucomiss -0x3c(%rbp),%xmm0
jb     12af <qcms_transform_module_XYZ_to_LAB+0x19f>
movss  -0x3c(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
movsd  0xdab(%rip),%xmm1
mulsd  %xmm1,%xmm0
movsd  0xda7(%rip),%xmm1
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x68(%rbp)
jmp    12c6 <qcms_transform_module_XYZ_to_LAB+0x1b6>
movss  -0x3c(%rbp),%xmm0
movsd  0xd7c(%rip),%xmm1
call   1030 <pow@plt>
movsd  %xmm0,-0x68(%rbp)
movsd  -0x68(%rbp),%xmm0
cvtsd2ss %xmm0,%xmm0
movss  %xmm0,-0x48(%rbp)
movss  0xd30(%rip),%xmm0
ucomiss -0x40(%rbp),%xmm0
jb     1311 <qcms_transform_module_XYZ_to_LAB+0x201>
movss  -0x40(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
movsd  0xd49(%rip),%xmm1
mulsd  %xmm1,%xmm0
movsd  0xd45(%rip),%xmm1
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x70(%rbp)
jmp    1328 <qcms_transform_module_XYZ_to_LAB+0x218>
movss  -0x40(%rbp),%xmm0
movsd  0xd1a(%rip),%xmm1
call   1030 <pow@plt>
movsd  %xmm0,-0x70(%rbp)
movsd  -0x70(%rbp),%xmm0
cvtsd2ss %xmm0,%xmm0
movss  %xmm0,-0x4c(%rbp)
movss  -0x48(%rbp),%xmm0
movss  0xce1(%rip),%xmm1
mulss  %xmm1,%xmm0
movss  0xcd9(%rip),%xmm1
addss  %xmm1,%xmm0
movss  %xmm0,-0x50(%rbp)
movss  -0x44(%rbp),%xmm1
subss  -0x48(%rbp),%xmm1
movss  0xcb6(%rip),%xmm0
mulss  %xmm1,%xmm0
movss  %xmm0,-0x54(%rbp)
movss  -0x48(%rbp),%xmm1
subss  -0x4c(%rbp),%xmm1
movss  0xc97(%rip),%xmm0
mulss  %xmm1,%xmm0
movss  %xmm0,-0x58(%rbp)
movss  -0x50(%rbp),%xmm0
movss  0xc7d(%rip),%xmm1
divss  %xmm1,%xmm0
mov    -0x18(%rbp),%rax
mov    %rax,%rcx
add    $0x4,%rcx
mov    %rcx,-0x18(%rbp)
movss  %xmm0,(%rax)
movss  0xc5a(%rip),%xmm0
addss  -0x54(%rbp),%xmm0
movss  0xc49(%rip),%xmm1
divss  %xmm1,%xmm0
mov    -0x18(%rbp),%rax
mov    %rax,%rcx
add    $0x4,%rcx
mov    %rcx,-0x18(%rbp)
movss  %xmm0,(%rax)
movss  0xc2e(%rip),%xmm0
addss  -0x58(%rbp),%xmm0
movss  0xc1d(%rip),%xmm1
divss  %xmm1,%xmm0
mov    -0x18(%rbp),%rax
mov    %rax,%rcx
add    $0x4,%rcx
mov    %rcx,-0x18(%rbp)
movss  %xmm0,(%rax)
mov    -0x28(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x28(%rbp)
jmp    1157 <qcms_transform_module_XYZ_to_LAB+0x47>
add    $0x70,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<qcms_transform_module_XYZ_to_LAB>:
push   %r15
push   %r14
push   %r12
push   %rbx
sub    $0x18,%rsp
test   %rcx,%rcx
je     12e3 <qcms_transform_module_XYZ_to_LAB+0x1d3>
mov    %rcx,%r12
mov    %rdx,%r14
mov    %rsi,%r15
xor    %ebx,%ebx
movss  0xefd(%rip),%xmm4
jmp    11e8 <qcms_transform_module_XYZ_to_LAB+0xd8>
nopl   0x0(%rax)
movsd  0xee0(%rip),%xmm1
movsd  %xmm2,0x8(%rsp)
call   1030 <pow@plt>
movsd  0x8(%rsp),%xmm2
movss  0xed3(%rip),%xmm4
movsd  0x10(%rsp),%xmm1
cvtsd2ss %xmm1,%xmm1
cvtsd2ss %xmm2,%xmm2
cvtsd2ss %xmm0,%xmm0
movaps %xmm2,%xmm3
mulss  0xeba(%rip),%xmm3
addss  0xeb6(%rip),%xmm3
subss  %xmm2,%xmm1
mulss  0xeae(%rip),%xmm1
subss  %xmm0,%xmm2
mulss  0xea6(%rip),%xmm2
divss  0xea2(%rip),%xmm3
movss  %xmm3,(%r14,%rbx,1)
movss  0xe98(%rip),%xmm0
addss  %xmm0,%xmm1
movss  0xe90(%rip),%xmm3
divss  %xmm3,%xmm1
movss  %xmm1,0x4(%r14,%rbx,1)
addss  %xmm0,%xmm2
divss  %xmm3,%xmm2
movss  %xmm2,0x8(%r14,%rbx,1)
add    $0xc,%rbx
add    $0xffffffffffffffff,%r12
je     12e3 <qcms_transform_module_XYZ_to_LAB+0x1d3>
movss  (%r15,%rbx,1),%xmm0
cvtss2sd %xmm0,%xmm0
movsd  0xe06(%rip),%xmm2
mulsd  %xmm2,%xmm0
divsd  0xe02(%rip),%xmm0
cvtsd2ss %xmm0,%xmm0
movss  0x4(%r15,%rbx,1),%xmm3
mulss  0xe17(%rip),%xmm3
movss  0x8(%r15,%rbx,1),%xmm1
cvtss2sd %xmm1,%xmm1
mulsd  %xmm2,%xmm1
divsd  0xde0(%rip),%xmm1
ucomiss %xmm0,%xmm4
movsd  %xmm1,0x8(%rsp)
jae    1260 <qcms_transform_module_XYZ_to_LAB+0x150>
movsd  0xde5(%rip),%xmm1
movss  %xmm3,0x10(%rsp)
call   1030 <pow@plt>
movss  0x10(%rsp),%xmm3
movss  0xdd8(%rip),%xmm4
jmp    1274 <qcms_transform_module_XYZ_to_LAB+0x164>
xchg   %ax,%ax
cvtss2sd %xmm0,%xmm0
mulsd  0xdac(%rip),%xmm0
addsd  0xdac(%rip),%xmm0
ucomiss %xmm3,%xmm4
movsd  %xmm0,0x10(%rsp)
jae    12a0 <qcms_transform_module_XYZ_to_LAB+0x190>
movaps %xmm3,%xmm0
movsd  0xd9e(%rip),%xmm1
call   1030 <pow@plt>
movss  0xd9d(%rip),%xmm4
movaps %xmm0,%xmm2
jmp    12b7 <qcms_transform_module_XYZ_to_LAB+0x1a7>
nopl   0x0(%rax)
xorps  %xmm2,%xmm2
cvtss2sd %xmm3,%xmm2
mulsd  0xd69(%rip),%xmm2
addsd  0xd69(%rip),%xmm2
movsd  0x8(%rsp),%xmm0
cvtsd2ss %xmm0,%xmm0
ucomiss %xmm0,%xmm4
jb     1140 <qcms_transform_module_XYZ_to_LAB+0x30>
cvtss2sd %xmm0,%xmm0
mulsd  0xd42(%rip),%xmm0
addsd  0xd42(%rip),%xmm0
jmp    1161 <qcms_transform_module_XYZ_to_LAB+0x51>
add    $0x18,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
%struct.qcms_modular_transform = type { i32 }
define void @qcms_transform_module_XYZ_to_LAB(%struct.qcms_modular_transform* %0, float* %1, float* %2, i64 %3) {
%5 = alloca %struct.qcms_modular_transform*
%6 = alloca float*
%7 = alloca float*
%8 = alloca i64
%9 = alloca i64
%10 = alloca float
%11 = alloca float
%12 = alloca float
%13 = alloca float
%14 = alloca float
%15 = alloca float
%16 = alloca float
%17 = alloca float
%18 = alloca float
%19 = alloca float
%20 = alloca float
%21 = alloca float
store %struct.qcms_modular_transform* %0, %struct.qcms_modular_transform** %5
store float* %1, float** %6
store float* %2, float** %7
store i64 %3, i64* %8
store float 0x3FEEDABA00000000, float* %10
store float 1.000000e+00, float* %11
store float 0x3FEA6594A0000000, float* %12
store i64 0, i64* %9
br label %22
22: ; preds = %114, %4
%23 = load i64, i64* %9
%24 = load i64, i64* %8
%25 = icmp ult i64 %23, %24
br i1 %25, label %26, label %117
26: ; preds = %22
%27 = load float*, float** %6
%28 = getelementptr inbounds float, float* %27, i32 1
store float* %28, float** %6
%29 = load float, float* %27
%30 = fpext float %29 to double
%31 = fmul double %30, 0x3FFFFFE000000000
%32 = load float, float* %10
%33 = fpext float %32 to double
%34 = fdiv double %31, %33
%35 = fptrunc double %34 to float
store float %35, float* %13
%36 = load float*, float** %6
%37 = getelementptr inbounds float, float* %36, i32 1
store float* %37, float** %6
%38 = load float, float* %36
%39 = fpext float %38 to double
%40 = fmul double %39, 0x3FFFFFE000000000
%41 = load float, float* %11
%42 = fpext float %41 to double
%43 = fdiv double %40, %42
%44 = fptrunc double %43 to float
store float %44, float* %14
%45 = load float*, float** %6
%46 = getelementptr inbounds float, float* %45, i32 1
store float* %46, float** %6
%47 = load float, float* %45
%48 = fpext float %47 to double
%49 = fmul double %48, 0x3FFFFFE000000000
%50 = load float, float* %12
%51 = fpext float %50 to double
%52 = fdiv double %49, %51
%53 = fptrunc double %52 to float
store float %53, float* %15
%54 = load float, float* %13
%55 = fcmp ole float %54, 0x3F822354E0000000
br i1 %55, label %56, label %60
56: ; preds = %26
%57 = load float, float* %13
%58 = fpext float %57 to double
%59 = call double @llvm.fmuladd.f64(double 0x401F25ED097B425F, double %58, double 0x3FC1A7B9611A7B96)
br label %63
60: ; preds = %26
%61 = load float, float* %13
%62 = call double @pow(float %61, double 0x3FD5555555555555)
br label %63
63: ; preds = %60, %56
%64 = phi double [ %59, %56 ], [ %62, %60 ]
%65 = fptrunc double %64 to float
store float %65, float* %16
%66 = load float, float* %14
%67 = fcmp ole float %66, 0x3F822354E0000000
br i1 %67, label %68, label %72
68: ; preds = %63
%69 = load float, float* %14
%70 = fpext float %69 to double
%71 = call double @llvm.fmuladd.f64(double 0x401F25ED097B425F, double %70, double 0x3FC1A7B9611A7B96)
br label %75
72: ; preds = %63
%73 = load float, float* %14
%74 = call double @pow(float %73, double 0x3FD5555555555555)
br label %75
75: ; preds = %72, %68
%76 = phi double [ %71, %68 ], [ %74, %72 ]
%77 = fptrunc double %76 to float
store float %77, float* %17
%78 = load float, float* %15
%79 = fcmp ole float %78, 0x3F822354E0000000
br i1 %79, label %80, label %84
80: ; preds = %75
%81 = load float, float* %15
%82 = fpext float %81 to double
%83 = call double @llvm.fmuladd.f64(double 0x401F25ED097B425F, double %82, double 0x3FC1A7B9611A7B96)
br label %87
84: ; preds = %75
%85 = load float, float* %15
%86 = call double @pow(float %85, double 0x3FD5555555555555)
br label %87
87: ; preds = %84, %80
%88 = phi double [ %83, %80 ], [ %86, %84 ]
%89 = fptrunc double %88 to float
store float %89, float* %18
%90 = load float, float* %17
%91 = call float @llvm.fmuladd.f32(float 1.160000e+02, float %90, float -1.600000e+01)
store float %91, float* %19
%92 = load float, float* %16
%93 = load float, float* %17
%94 = fsub float %92, %93
%95 = fmul float 5.000000e+02, %94
store float %95, float* %20
%96 = load float, float* %17
%97 = load float, float* %18
%98 = fsub float %96, %97
%99 = fmul float 2.000000e+02, %98
store float %99, float* %21
%100 = load float, float* %19
%101 = fdiv float %100, 1.000000e+02
%102 = load float*, float** %7
%103 = getelementptr inbounds float, float* %102, i32 1
store float* %103, float** %7
store float %101, float* %102
%104 = load float, float* %20
%105 = fadd float %104, 1.280000e+02
%106 = fdiv float %105, 2.550000e+02
%107 = load float*, float** %7
%108 = getelementptr inbounds float, float* %107, i32 1
store float* %108, float** %7
store float %106, float* %107
%109 = load float, float* %21
%110 = fadd float %109, 1.280000e+02
%111 = fdiv float %110, 2.550000e+02
%112 = load float*, float** %7
%113 = getelementptr inbounds float, float* %112, i32 1
store float* %113, float** %7
store float %111, float* %112
br label %114
114: ; preds = %87
%115 = load i64, i64* %9
%116 = add i64 %115, 1
store i64 %116, i64* %9
br label %22
117: ; preds = %22
ret void
}

LLVM IR (-O2):
%struct.qcms_modular_transform = type { i32 }
define void @qcms_transform_module_XYZ_to_LAB(%struct.qcms_modular_transform* nocapture readnone %0, float* nocapture %1, float* nocapture writeonly %2, i64 %3) {
%5 = icmp eq i64 %3, 0
br i1 %5, label %67, label %6
6: ; preds = %4, %49
%7 = phi float* [ %19, %49 ], [ %1, %4 ]
%8 = phi float* [ %64, %49 ], [ %2, %4 ]
%9 = phi i64 [ %65, %49 ], [ 0, %4 ]
%10 = getelementptr inbounds float, float* %7, i64 1
%11 = load float, float* %7
%12 = fpext float %11 to double
%13 = fmul double %12, 0x3FFFFFE000000000
%14 = fdiv double %13, 0x3FEEDABA00000000
%15 = fptrunc double %14 to float
%16 = getelementptr inbounds float, float* %7, i64 2
%17 = load float, float* %10
%18 = fmul float %17, 0x3FFFFFE000000000
%19 = getelementptr inbounds float, float* %7, i64 3
%20 = load float, float* %16
%21 = fpext float %20 to double
%22 = fmul double %21, 0x3FFFFFE000000000
%23 = fdiv double %22, 0x3FEA6594A0000000
%24 = fptrunc double %23 to float
%25 = fcmp ugt float %15, 0x3F822354E0000000
br i1 %25, label %29, label %26
26: ; preds = %6
%27 = fpext float %15 to double
%28 = tail call double @llvm.fmuladd.f64(double %27, double 0x401F25ED097B425F, double 0x3FC1A7B9611A7B96)
br label %31
29: ; preds = %6
%30 = tail call double @pow(float %15, double 0x3FD5555555555555)
br label %31
31: ; preds = %29, %26
%32 = phi double [ %28, %26 ], [ %30, %29 ]
%33 = fptrunc double %32 to float
%34 = fcmp ugt float %18, 0x3F822354E0000000
br i1 %34, label %38, label %35
35: ; preds = %31
%36 = fpext float %18 to double
%37 = tail call double @llvm.fmuladd.f64(double %36, double 0x401F25ED097B425F, double 0x3FC1A7B9611A7B96)
br label %40
38: ; preds = %31
%39 = tail call double @pow(float %18, double 0x3FD5555555555555)
br label %40
40: ; preds = %38, %35
%41 = phi double [ %37, %35 ], [ %39, %38 ]
%42 = fptrunc double %41 to float
%43 = fcmp ugt float %24, 0x3F822354E0000000
br i1 %43, label %47, label %44
44: ; preds = %40
%45 = fpext float %24 to double
%46 = tail call double @llvm.fmuladd.f64(double %45, double 0x401F25ED097B425F, double 0x3FC1A7B9611A7B96)
br label %49
47: ; preds = %40
%48 = tail call double @pow(float %24, double 0x3FD5555555555555)
br label %49
49: ; preds = %47, %44
%50 = phi double [ %46, %44 ], [ %48, %47 ]
%51 = fptrunc double %50 to float
%52 = tail call float @llvm.fmuladd.f32(float %42, float 1.160000e+02, float -1.600000e+01)
%53 = fsub float %33, %42
%54 = fmul float %53, 5.000000e+02
%55 = fsub float %42, %51
%56 = fmul float %55, 2.000000e+02
%57 = fdiv float %52, 1.000000e+02
%58 = getelementptr inbounds float, float* %8, i64 1
store float %57, float* %8
%59 = fadd float %54, 1.280000e+02
%60 = fdiv float %59, 2.550000e+02
%61 = getelementptr inbounds float, float* %8, i64 2
store float %60, float* %58
%62 = fadd float %56, 1.280000e+02
%63 = fdiv float %62, 2.550000e+02
%64 = getelementptr inbounds float, float* %8, i64 3
store float %63, float* %61
%65 = add nuw i64 %9, 1
%66 = icmp eq i64 %65, %3
br i1 %66, label %67, label %6
67: ; preds = %49, %4
ret void
}