#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 */
double log(double);
double sqrt(int);
double intensity(double x, double c1, double c2, double c3, double c4,
                 double c5, double c6) {
  if (x > 0.99995)
    x = 0.99995;
  double mu = sqrt(1. - x * x);
  double norm = 2. * 3.14159265358979323846 *
                (-c1 / 6. - c2 * c3 / 2. + c2 / 4. + 0.5 +
                 c2 * c3 * c3 * log(1. + 1. / c3) / 2.);
  return (1. - c1 * (1. - mu) - c2 * log((mu + c3) / (1. + c3))) / norm;
}


x86 assembly (clang, -O0):
<intensity>:
push   %rbp
mov    %rsp,%rbp
sub    $0x70,%rsp
movsd  %xmm0,-0x8(%rbp)
movsd  %xmm1,-0x10(%rbp)
movsd  %xmm2,-0x18(%rbp)
movsd  %xmm3,-0x20(%rbp)
movsd  %xmm4,-0x28(%rbp)
movsd  %xmm5,-0x30(%rbp)
movsd  %xmm6,-0x38(%rbp)
movsd  -0x8(%rbp),%xmm0
movsd  0xea8(%rip),%xmm1
ucomisd %xmm1,%xmm0
jbe    116f <intensity+0x4f>
movsd  0xe96(%rip),%xmm0
movsd  %xmm0,-0x8(%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  0xe6c(%rip),%xmm1
addsd  %xmm1,%xmm0
cvttsd2si %xmm0,%edi
call   1040 <sqrt@plt>
movsd  %xmm0,-0x40(%rbp)
movsd  -0x10(%rbp),%xmm0
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
movsd  0xe5e(%rip),%xmm1
divsd  %xmm1,%xmm0
movsd  -0x18(%rbp),%xmm1
mulsd  -0x20(%rbp),%xmm1
movsd  0xe30(%rip),%xmm2
divsd  %xmm2,%xmm1
subsd  %xmm1,%xmm0
movsd  -0x18(%rbp),%xmm1
movsd  0xe2b(%rip),%xmm2
divsd  %xmm2,%xmm1
addsd  %xmm1,%xmm0
movsd  0xe13(%rip),%xmm1
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x68(%rbp)
movsd  -0x18(%rbp),%xmm0
mulsd  -0x20(%rbp),%xmm0
mulsd  -0x20(%rbp),%xmm0
movsd  %xmm0,-0x60(%rbp)
movsd  0xdd6(%rip),%xmm1
divsd  -0x20(%rbp),%xmm1
movsd  0xdc9(%rip),%xmm0
addsd  %xmm1,%xmm0
call   1030 <log@plt>
movsd  -0x68(%rbp),%xmm1
movaps %xmm0,%xmm2
movsd  -0x60(%rbp),%xmm0
mulsd  %xmm2,%xmm0
movsd  0xdb7(%rip),%xmm2
divsd  %xmm2,%xmm0
addsd  %xmm0,%xmm1
movsd  0xd9f(%rip),%xmm0
mulsd  %xmm1,%xmm0
movsd  %xmm0,-0x48(%rbp)
movsd  -0x10(%rbp),%xmm0
movsd  0xd81(%rip),%xmm1
subsd  -0x40(%rbp),%xmm1
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
mulsd  %xmm1,%xmm0
movsd  0xd59(%rip),%xmm1
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x58(%rbp)
movsd  -0x18(%rbp),%xmm0
movsd  %xmm0,-0x50(%rbp)
movsd  -0x40(%rbp),%xmm0
addsd  -0x20(%rbp),%xmm0
movsd  0xd34(%rip),%xmm1
addsd  -0x20(%rbp),%xmm1
divsd  %xmm1,%xmm0
call   1030 <log@plt>
movsd  -0x58(%rbp),%xmm1
movaps %xmm0,%xmm2
movsd  -0x50(%rbp),%xmm0
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
divsd  -0x48(%rbp),%xmm0
add    $0x70,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<intensity>:
sub    $0x38,%rsp
movsd  %xmm3,0x18(%rsp)
movsd  %xmm2,0x20(%rsp)
movsd  %xmm1,0x8(%rsp)
movsd  0xec2(%rip),%xmm1
minsd  %xmm0,%xmm1
mulsd  %xmm1,%xmm1
movsd  0xeba(%rip),%xmm0
subsd  %xmm1,%xmm0
cvttsd2si %xmm0,%edi
call   1040 <sqrt@plt>
movsd  0x8(%rsp),%xmm1
divsd  0xea7(%rip),%xmm1
movsd  %xmm0,0x30(%rsp)
movsd  0x20(%rsp),%xmm2
movapd %xmm2,%xmm5
movsd  0x18(%rsp),%xmm3
mulsd  %xmm3,%xmm5
movsd  0xe8d(%rip),%xmm4
movapd %xmm5,%xmm0
mulsd  %xmm4,%xmm0
subsd  %xmm0,%xmm1
movsd  0xe81(%rip),%xmm0
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
addsd  %xmm4,%xmm0
movsd  %xmm0,0x10(%rsp)
mulsd  %xmm3,%xmm5
movsd  %xmm5,0x28(%rsp)
movsd  0xe45(%rip),%xmm2
movapd %xmm2,%xmm0
divsd  %xmm3,%xmm0
addsd  %xmm2,%xmm0
call   1030 <log@plt>
mulsd  0x28(%rsp),%xmm0
mulsd  0xe36(%rip),%xmm0
addsd  0x10(%rsp),%xmm0
mulsd  0xe38(%rip),%xmm0
movsd  %xmm0,0x10(%rsp)
movsd  0xe0a(%rip),%xmm2
movapd %xmm2,%xmm0
movsd  0x30(%rsp),%xmm3
subsd  %xmm3,%xmm0
mulsd  0x8(%rsp),%xmm0
movsd  0x18(%rsp),%xmm1
addsd  %xmm1,%xmm3
addsd  %xmm2,%xmm1
subsd  %xmm0,%xmm2
movsd  %xmm2,0x8(%rsp)
divsd  %xmm1,%xmm3
movapd %xmm3,%xmm0
call   1030 <log@plt>
mulsd  0x20(%rsp),%xmm0
movsd  0x8(%rsp),%xmm1
subsd  %xmm0,%xmm1
divsd  0x10(%rsp),%xmm1
movapd %xmm1,%xmm0
add    $0x38,%rsp
ret

LLVM IR (-O0):
define double @intensity(double %0, double %1, double %2, double %3, double %4, double %5, double %6) {
%8 = alloca double
%9 = alloca double
%10 = alloca double
%11 = alloca double
%12 = alloca double
%13 = alloca double
%14 = alloca double
%15 = alloca double
%16 = alloca double
store double %0, double* %8
store double %1, double* %9
store double %2, double* %10
store double %3, double* %11
store double %4, double* %12
store double %5, double* %13
store double %6, double* %14
%17 = load double, double* %8
%18 = fcmp ogt double %17, 9.999500e-01
br i1 %18, label %19, label %20
19: ; preds = %7
store double 9.999500e-01, double* %8
br label %20
20: ; preds = %19, %7
%21 = load double, double* %8
%22 = load double, double* %8
%23 = fneg double %21
%24 = call double @llvm.fmuladd.f64(double %23, double %22, double 1.000000e+00)
%25 = fptosi double %24 to i32
%26 = call double @sqrt(i32 %25)
store double %26, double* %15
%27 = load double, double* %9
%28 = fneg double %27
%29 = fdiv double %28, 6.000000e+00
%30 = load double, double* %10
%31 = load double, double* %11
%32 = fmul double %30, %31
%33 = fdiv double %32, 2.000000e+00
%34 = fsub double %29, %33
%35 = load double, double* %10
%36 = fdiv double %35, 4.000000e+00
%37 = fadd double %34, %36
%38 = fadd double %37, 5.000000e-01
%39 = load double, double* %10
%40 = load double, double* %11
%41 = fmul double %39, %40
%42 = load double, double* %11
%43 = fmul double %41, %42
%44 = load double, double* %11
%45 = fdiv double 1.000000e+00, %44
%46 = fadd double 1.000000e+00, %45
%47 = call double @log(double %46)
%48 = fmul double %43, %47
%49 = fdiv double %48, 2.000000e+00
%50 = fadd double %38, %49
%51 = fmul double 0x401921FB54442D18, %50
store double %51, double* %16
%52 = load double, double* %9
%53 = load double, double* %15
%54 = fsub double 1.000000e+00, %53
%55 = fneg double %52
%56 = call double @llvm.fmuladd.f64(double %55, double %54, double 1.000000e+00)
%57 = load double, double* %10
%58 = load double, double* %15
%59 = load double, double* %11
%60 = fadd double %58, %59
%61 = load double, double* %11
%62 = fadd double 1.000000e+00, %61
%63 = fdiv double %60, %62
%64 = call double @log(double %63)
%65 = fneg double %57
%66 = call double @llvm.fmuladd.f64(double %65, double %64, double %56)
%67 = load double, double* %16
%68 = fdiv double %66, %67
ret double %68
}

LLVM IR (-O2):
define double @intensity(double %0, double %1, double %2, double %3, double %4, double %5, double %6) {
%8 = fcmp ogt double %0, 9.999500e-01
%9 = select i1 %8, double 9.999500e-01, double %0
%10 = fneg double %9
%11 = tail call double @llvm.fmuladd.f64(double %10, double %9, double 1.000000e+00)
%12 = fptosi double %11 to i32
%13 = tail call double @sqrt(i32 %12)
%14 = fneg double %1
%15 = fdiv double %1, -6.000000e+00
%16 = fmul double %2, %3
%17 = fmul double %16, 5.000000e-01
%18 = fsub double %15, %17
%19 = fmul double %2, 2.500000e-01
%20 = fadd double %19, %18
%21 = fadd double %20, 5.000000e-01
%22 = fmul double %16, %3
%23 = fdiv double 1.000000e+00, %3
%24 = fadd double %23, 1.000000e+00
%25 = tail call double @log(double %24)
%26 = fmul double %22, %25
%27 = fmul double %26, 5.000000e-01
%28 = fadd double %21, %27
%29 = fmul double %28, 0x401921FB54442D18
%30 = fsub double 1.000000e+00, %13
%31 = tail call double @llvm.fmuladd.f64(double %14, double %30, double 1.000000e+00)
%32 = fadd double %13, %3
%33 = fadd double %3, 1.000000e+00
%34 = fdiv double %32, %33
%35 = tail call double @log(double %34)
%36 = fneg double %2
%37 = tail call double @llvm.fmuladd.f64(double %36, double %35, double %31)
%38 = fdiv double %37, %29
ret double %38
}