#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*/ convert_linear_xyz_to_linear_lms(float, float, float,
                                                    float *, float *, float *);
void compute_lms_scaling_factors(float x, float y, float z, float *scale_l,
                                 float *scale_m, float *scale_s) {
  float l, m, s;
  convert_linear_xyz_to_linear_lms(x, y, z, &l, &m, &s);
  *scale_l = y / l;
  *scale_m = *scale_l * (l / m);
  *scale_s = *scale_l * (l / s);
}


x86 assembly (clang, -O0):
<compute_lms_scaling_factors>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
movss  %xmm0,-0x4(%rbp)
movss  %xmm1,-0x8(%rbp)
movss  %xmm2,-0xc(%rbp)
mov    %rdi,-0x18(%rbp)
mov    %rsi,-0x20(%rbp)
mov    %rdx,-0x28(%rbp)
movss  -0x4(%rbp),%xmm0
movss  -0x8(%rbp),%xmm1
movss  -0xc(%rbp),%xmm2
lea    -0x2c(%rbp),%rdi
lea    -0x30(%rbp),%rsi
lea    -0x34(%rbp),%rdx
call   1030 <convert_linear_xyz_to_linear_lms@plt>
movss  -0x8(%rbp),%xmm0
divss  -0x2c(%rbp),%xmm0
mov    -0x18(%rbp),%rax
movss  %xmm0,(%rax)
mov    -0x18(%rbp),%rax
movss  (%rax),%xmm0
movss  -0x2c(%rbp),%xmm1
divss  -0x30(%rbp),%xmm1
mulss  %xmm1,%xmm0
mov    -0x20(%rbp),%rax
movss  %xmm0,(%rax)
mov    -0x18(%rbp),%rax
movss  (%rax),%xmm0
movss  -0x2c(%rbp),%xmm1
divss  -0x34(%rbp),%xmm1
mulss  %xmm1,%xmm0
mov    -0x28(%rbp),%rax
movss  %xmm0,(%rax)
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<compute_lms_scaling_factors>:
push   %r15
push   %r14
push   %rbx
sub    $0x10,%rsp
mov    %rdx,%r14
mov    %rsi,%r15
mov    %rdi,%rbx
movss  %xmm1,(%rsp)
lea    0xc(%rsp),%rdi
lea    0x8(%rsp),%rsi
lea    0x4(%rsp),%rdx
call   1030 <convert_linear_xyz_to_linear_lms@plt>
movss  0xc(%rsp),%xmm0
movss  (%rsp),%xmm1
divss  %xmm0,%xmm1
movss  %xmm1,(%rbx)
movaps %xmm1,%xmm2
movaps %xmm0,%xmm1
divss  0x8(%rsp),%xmm1
mulss  %xmm2,%xmm1
movss  %xmm1,(%r15)
divss  0x4(%rsp),%xmm0
mulss  (%rbx),%xmm0
movss  %xmm0,(%r14)
add    $0x10,%rsp
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
define void @compute_lms_scaling_factors(float %0, float %1, float %2, float* %3, float* %4, float* %5) {
%7 = alloca float
%8 = alloca float
%9 = alloca float
%10 = alloca float*
%11 = alloca float*
%12 = alloca float*
%13 = alloca float
%14 = alloca float
%15 = alloca float
store float %0, float* %7
store float %1, float* %8
store float %2, float* %9
store float* %3, float** %10
store float* %4, float** %11
store float* %5, float** %12
%16 = load float, float* %7
%17 = load float, float* %8
%18 = load float, float* %9
%19 = call i32 @convert_linear_xyz_to_linear_lms(float %16, float %17, float %18, float* %13, float* %14, float* %15)
%20 = load float, float* %8
%21 = load float, float* %13
%22 = fdiv float %20, %21
%23 = load float*, float** %10
store float %22, float* %23
%24 = load float*, float** %10
%25 = load float, float* %24
%26 = load float, float* %13
%27 = load float, float* %14
%28 = fdiv float %26, %27
%29 = fmul float %25, %28
%30 = load float*, float** %11
store float %29, float* %30
%31 = load float*, float** %10
%32 = load float, float* %31
%33 = load float, float* %13
%34 = load float, float* %15
%35 = fdiv float %33, %34
%36 = fmul float %32, %35
%37 = load float*, float** %12
store float %36, float* %37
ret void
}

LLVM IR (-O2):
define void @compute_lms_scaling_factors(float %0, float %1, float %2, float* nocapture %3, float* nocapture writeonly %4, float* nocapture writeonly %5) {
%7 = alloca float
%8 = alloca float
%9 = alloca float
%10 = bitcast float* %7 to i8*
%11 = bitcast float* %8 to i8*
%12 = bitcast float* %9 to i8*
%13 = call i32 @convert_linear_xyz_to_linear_lms(float %0, float %1, float %2, float* %7, float* %8, float* %9)
%14 = load float, float* %7
%15 = fdiv float %1, %14
store float %15, float* %3
%16 = load float, float* %8
%17 = fdiv float %14, %16
%18 = fmul float %15, %17
store float %18, float* %4
%19 = load float, float* %3
%20 = load float, float* %9
%21 = fdiv float %14, %20
%22 = fmul float %19, %21
store float %22, float* %5
ret void
}