#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 pow(double, double);
int sqrt(double);
double ldintensity(double r, double lda[5]) {
  double mu;
  mu = sqrt(1 - r * r);
  return 1 - lda[1] * (1 - sqrt(mu)) - lda[2] * (1 - mu) -
         lda[3] * (1 - pow(mu, 1.5)) - lda[4] * (1 - mu * mu);
}


x86 assembly (clang, -O0):
<ldintensity>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movsd  %xmm0,-0x8(%rbp)
mov    %rdi,-0x10(%rbp)
movsd  -0x8(%rbp),%xmm0
movsd  -0x8(%rbp),%xmm1
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
mulsd  %xmm1,%xmm0
movsd  0xea2(%rip),%xmm1
addsd  %xmm1,%xmm0
call   1040 <sqrt@plt>
cvtsi2sd %eax,%xmm0
movsd  %xmm0,-0x18(%rbp)
mov    -0x10(%rbp),%rax
movsd  0x8(%rax),%xmm0
movsd  %xmm0,-0x30(%rbp)
movsd  -0x18(%rbp),%xmm0
call   1040 <sqrt@plt>
movsd  -0x30(%rbp),%xmm1
mov    %eax,%ecx
mov    $0x1,%eax
sub    %ecx,%eax
cvtsi2sd %eax,%xmm0
movq   %xmm1,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm1
mulsd  %xmm0,%xmm1
movsd  0xe43(%rip),%xmm0
addsd  %xmm0,%xmm1
mov    -0x10(%rbp),%rax
movsd  0x10(%rax),%xmm0
movsd  0xe2e(%rip),%xmm2
subsd  -0x18(%rbp),%xmm2
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x20(%rbp)
mov    -0x10(%rbp),%rax
movsd  0x18(%rax),%xmm0
movsd  %xmm0,-0x28(%rbp)
movsd  -0x18(%rbp),%xmm0
movsd  0xdf2(%rip),%xmm1
call   1030 <pow@plt>
movsd  -0x28(%rbp),%xmm1
movsd  -0x20(%rbp),%xmm0
mov    %eax,%ecx
mov    $0x1,%eax
sub    %ecx,%eax
cvtsi2sd %eax,%xmm2
movq   %xmm1,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm1
mulsd  %xmm2,%xmm1
addsd  %xmm0,%xmm1
mov    -0x10(%rbp),%rax
movsd  0x20(%rax),%xmm0
movsd  -0x18(%rbp),%xmm2
movsd  -0x18(%rbp),%xmm3
movq   %xmm2,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm2
mulsd  %xmm3,%xmm2
movsd  0xd79(%rip),%xmm3
addsd  %xmm3,%xmm2
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<ldintensity>:
push   %rbp
push   %rbx
sub    $0x18,%rsp
mov    %rdi,%rbx
mulsd  %xmm0,%xmm0
movsd  0xecb(%rip),%xmm1
subsd  %xmm0,%xmm1
movapd %xmm1,%xmm0
call   1040 <sqrt@plt>
xorps  %xmm0,%xmm0
cvtsi2sd %eax,%xmm0
movsd  %xmm0,0x8(%rsp)
movsd  0x8(%rbx),%xmm1
movsd  %xmm1,(%rsp)
call   1040 <sqrt@plt>
mov    $0x1,%ecx
sub    %eax,%ecx
xorps  %xmm0,%xmm0
cvtsi2sd %ecx,%xmm0
mov    $0x1,%ebp
mulsd  (%rsp),%xmm0
movsd  0xe82(%rip),%xmm2
movapd %xmm2,%xmm1
subsd  %xmm0,%xmm1
movsd  0x8(%rsp),%xmm0
subsd  %xmm0,%xmm2
mulsd  0x10(%rbx),%xmm2
subsd  %xmm2,%xmm1
movsd  %xmm1,(%rsp)
movsd  0x18(%rbx),%xmm1
movsd  %xmm1,0x10(%rsp)
movsd  0xe57(%rip),%xmm1
call   1030 <pow@plt>
sub    %eax,%ebp
xorps  %xmm0,%xmm0
cvtsi2sd %ebp,%xmm0
mulsd  0x10(%rsp),%xmm0
movsd  (%rsp),%xmm1
subsd  %xmm0,%xmm1
movsd  0x8(%rsp),%xmm2
mulsd  %xmm2,%xmm2
movsd  0xe20(%rip),%xmm0
subsd  %xmm2,%xmm0
mulsd  0x20(%rbx),%xmm0
subsd  %xmm0,%xmm1
movapd %xmm1,%xmm0
add    $0x18,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
define double @ldintensity(double %0, double* %1) {
%3 = alloca double
%4 = alloca double*
%5 = alloca double
store double %0, double* %3
store double* %1, double** %4
%6 = load double, double* %3
%7 = load double, double* %3
%8 = fneg double %6
%9 = call double @llvm.fmuladd.f64(double %8, double %7, double 1.000000e+00)
%10 = call i32 @sqrt(double %9)
%11 = sitofp i32 %10 to double
store double %11, double* %5
%12 = load double*, double** %4
%13 = getelementptr inbounds double, double* %12, i64 1
%14 = load double, double* %13
%15 = load double, double* %5
%16 = call i32 @sqrt(double %15)
%17 = sub nsw i32 1, %16
%18 = sitofp i32 %17 to double
%19 = fneg double %14
%20 = call double @llvm.fmuladd.f64(double %19, double %18, double 1.000000e+00)
%21 = load double*, double** %4
%22 = getelementptr inbounds double, double* %21, i64 2
%23 = load double, double* %22
%24 = load double, double* %5
%25 = fsub double 1.000000e+00, %24
%26 = fneg double %23
%27 = call double @llvm.fmuladd.f64(double %26, double %25, double %20)
%28 = load double*, double** %4
%29 = getelementptr inbounds double, double* %28, i64 3
%30 = load double, double* %29
%31 = load double, double* %5
%32 = call i32 @pow(double %31, double 1.500000e+00)
%33 = sub nsw i32 1, %32
%34 = sitofp i32 %33 to double
%35 = fneg double %30
%36 = call double @llvm.fmuladd.f64(double %35, double %34, double %27)
%37 = load double*, double** %4
%38 = getelementptr inbounds double, double* %37, i64 4
%39 = load double, double* %38
%40 = load double, double* %5
%41 = load double, double* %5
%42 = fneg double %40
%43 = call double @llvm.fmuladd.f64(double %42, double %41, double 1.000000e+00)
%44 = fneg double %39
%45 = call double @llvm.fmuladd.f64(double %44, double %43, double %36)
ret double %45
}

LLVM IR (-O2):
define double @ldintensity(double %0, double* nocapture %1) {
%3 = fneg double %0
%4 = tail call double @llvm.fmuladd.f64(double %3, double %0, double 1.000000e+00)
%5 = tail call i32 @sqrt(double %4)
%6 = sitofp i32 %5 to double
%7 = getelementptr inbounds double, double* %1, i64 1
%8 = load double, double* %7
%9 = tail call i32 @sqrt(double %6)
%10 = sub nsw i32 1, %9
%11 = sitofp i32 %10 to double
%12 = fneg double %8
%13 = tail call double @llvm.fmuladd.f64(double %12, double %11, double 1.000000e+00)
%14 = getelementptr inbounds double, double* %1, i64 2
%15 = load double, double* %14
%16 = fsub double 1.000000e+00, %6
%17 = fneg double %15
%18 = tail call double @llvm.fmuladd.f64(double %17, double %16, double %13)
%19 = getelementptr inbounds double, double* %1, i64 3
%20 = load double, double* %19
%21 = tail call i32 @pow(double %6, double 1.500000e+00)
%22 = sub nsw i32 1, %21
%23 = sitofp i32 %22 to double
%24 = fneg double %20
%25 = tail call double @llvm.fmuladd.f64(double %24, double %23, double %18)
%26 = getelementptr inbounds double, double* %1, i64 4
%27 = load double, double* %26
%28 = fneg double %6
%29 = tail call double @llvm.fmuladd.f64(double %28, double %6, double 1.000000e+00)
%30 = fneg double %27
%31 = tail call double @llvm.fmuladd.f64(double %30, double %29, double %25)
ret double %31
}