#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 cos(float);
float sin(float);
void Msh2Lab(float M, float s, float h, float *L, float *a, float *b) {
  *L = M * cos(s);
  *a = M * sin(s) * cos(h);
  *b = M * sin(s) * sin(h);
}


x86 assembly (clang, -O0):
<Msh2Lab>:
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  %xmm0,-0x3c(%rbp)
movss  -0x8(%rbp),%xmm0
call   1040 <cos@plt>
movaps %xmm0,%xmm1
movss  -0x3c(%rbp),%xmm0
mulss  %xmm1,%xmm0
mov    -0x18(%rbp),%rax
movss  %xmm0,(%rax)
movss  -0x4(%rbp),%xmm0
movss  %xmm0,-0x38(%rbp)
movss  -0x8(%rbp),%xmm0
call   1030 <sin@plt>
movaps %xmm0,%xmm1
movss  -0x38(%rbp),%xmm0
mulss  %xmm1,%xmm0
movss  %xmm0,-0x34(%rbp)
movss  -0xc(%rbp),%xmm0
call   1040 <cos@plt>
movaps %xmm0,%xmm1
movss  -0x34(%rbp),%xmm0
mulss  %xmm1,%xmm0
mov    -0x20(%rbp),%rax
movss  %xmm0,(%rax)
movss  -0x4(%rbp),%xmm0
movss  %xmm0,-0x30(%rbp)
movss  -0x8(%rbp),%xmm0
call   1030 <sin@plt>
movaps %xmm0,%xmm1
movss  -0x30(%rbp),%xmm0
mulss  %xmm1,%xmm0
movss  %xmm0,-0x2c(%rbp)
movss  -0xc(%rbp),%xmm0
call   1030 <sin@plt>
movaps %xmm0,%xmm1
movss  -0x2c(%rbp),%xmm0
mulss  %xmm1,%xmm0
mov    -0x28(%rbp),%rax
movss  %xmm0,(%rax)
add    $0x40,%rsp
pop    %rbp
ret

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

LLVM IR (-O0):
define void @Msh2Lab(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*
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
%13 = load float, float* %7
%14 = load float, float* %8
%15 = call float @cos(float %14)
%16 = fmul float %13, %15
%17 = load float*, float** %10
store float %16, float* %17
%18 = load float, float* %7
%19 = load float, float* %8
%20 = call float @sin(float %19)
%21 = fmul float %18, %20
%22 = load float, float* %9
%23 = call float @cos(float %22)
%24 = fmul float %21, %23
%25 = load float*, float** %11
store float %24, float* %25
%26 = load float, float* %7
%27 = load float, float* %8
%28 = call float @sin(float %27)
%29 = fmul float %26, %28
%30 = load float, float* %9
%31 = call float @sin(float %30)
%32 = fmul float %29, %31
%33 = load float*, float** %12
store float %32, float* %33
ret void
}

LLVM IR (-O2):
define void @Msh2Lab(float %0, float %1, float %2, float* nocapture writeonly %3, float* nocapture writeonly %4, float* nocapture writeonly %5) {
%7 = tail call float @cos(float %1)
%8 = fmul float %7, %0
store float %8, float* %3
%9 = tail call float @sin(float %1)
%10 = fmul float %9, %0
%11 = tail call float @cos(float %2)
%12 = fmul float %10, %11
store float %12, float* %4
%13 = tail call float @sin(float %1)
%14 = fmul float %13, %0
%15 = tail call float @sin(float %2)
%16 = fmul float %14, %15
store float %16, float* %5
ret void
}