#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 log10(double);
int pow(double, int);
int sqrt(double);
double bb_spectrum(double gamma, double end_point, double enu) {
  double part;
  double result, root;
  double gye, ye;
  double baseline = 1000.;
  ye = 0.511E-3 / (end_point + 0.511E-3);
  gye = (1. / 60) *
        (sqrt(1 - pow(ye, 2)) * (2 - 9 * pow(ye, 2) - 8 * pow(ye, 4)) +
         15 * pow(ye, 4) * log10(ye / (1 - sqrt(1 - pow(ye, 2)))));
  part = enu / (2 * gamma * (end_point + 0.511E-3));
  if (part >= 1)
    return 0.0;
  root = (1 - part) * (1 - part) - ye * ye;
  if (root <= 0)
    return 0.0;
  result = (1. / 3.1415 / gye / pow(baseline, 2)) * (gamma * gamma / enu) *
           pow(part, 3) * (1 - part) * sqrt(root);
  return result;
}


x86 assembly (clang, -O0):
<bb_spectrum>:
push   %rbp
mov    %rsp,%rbp
sub    $0x80,%rsp
movsd  %xmm0,-0x10(%rbp)
movsd  %xmm1,-0x18(%rbp)
movsd  %xmm2,-0x20(%rbp)
movsd  0xece(%rip),%xmm0
movsd  %xmm0,-0x50(%rbp)
movsd  0xea9(%rip),%xmm1
addsd  -0x18(%rbp),%xmm1
movsd  0xe9c(%rip),%xmm0
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x48(%rbp)
movsd  -0x48(%rbp),%xmm0
mov    $0x2,%edi
call   1030 <pow@plt>
mov    %eax,%ecx
mov    $0x1,%eax
sub    %ecx,%eax
cvtsi2sd %eax,%xmm0
call   1050 <sqrt@plt>
mov    %eax,-0x64(%rbp)
movsd  -0x48(%rbp),%xmm0
mov    $0x2,%edi
call   1030 <pow@plt>
imul   $0x9,%eax,%ecx
mov    $0x2,%eax
sub    %ecx,%eax
mov    %eax,-0x68(%rbp)
movsd  -0x48(%rbp),%xmm0
mov    $0x4,%edi
call   1030 <pow@plt>
mov    -0x68(%rbp),%ecx
mov    %eax,%edx
mov    -0x64(%rbp),%eax
shl    $0x3,%edx
sub    %edx,%ecx
imul   %ecx,%eax
mov    %eax,-0x54(%rbp)
movsd  -0x48(%rbp),%xmm0
mov    $0x4,%edi
call   1030 <pow@plt>
imul   $0xf,%eax,%eax
mov    %eax,-0x58(%rbp)
movsd  -0x48(%rbp),%xmm0
movsd  %xmm0,-0x60(%rbp)
movsd  -0x48(%rbp),%xmm0
mov    $0x2,%edi
call   1030 <pow@plt>
mov    %eax,%ecx
mov    $0x1,%eax
sub    %ecx,%eax
cvtsi2sd %eax,%xmm0
call   1050 <sqrt@plt>
movsd  -0x60(%rbp),%xmm0
mov    %eax,%ecx
mov    $0x1,%eax
sub    %ecx,%eax
cvtsi2sd %eax,%xmm1
divsd  %xmm1,%xmm0
call   1040 <log10@plt>
mov    -0x58(%rbp),%ecx
mov    %eax,%edx
mov    -0x54(%rbp),%eax
imul   %edx,%ecx
add    %ecx,%eax
cvtsi2sd %eax,%xmm1
movsd  0xdcd(%rip),%xmm0
mulsd  %xmm1,%xmm0
movsd  %xmm0,-0x40(%rbp)
movsd  -0x20(%rbp),%xmm0
movsd  0xdaf(%rip),%xmm1
mulsd  -0x10(%rbp),%xmm1
movsd  0xd9a(%rip),%xmm2
addsd  -0x18(%rbp),%xmm2
mulsd  %xmm2,%xmm1
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x28(%rbp)
movsd  -0x28(%rbp),%xmm0
movsd  0xd73(%rip),%xmm1
ucomisd %xmm1,%xmm0
jb     12a4 <bb_spectrum+0x174>
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x8(%rbp)
jmp    13a5 <bb_spectrum+0x275>
movsd  0xd54(%rip),%xmm0
subsd  -0x28(%rbp),%xmm0
movsd  0xd47(%rip),%xmm2
subsd  -0x28(%rbp),%xmm2
movsd  -0x48(%rbp),%xmm1
mulsd  -0x48(%rbp),%xmm1
movq   %xmm1,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x38(%rbp)
xorps  %xmm0,%xmm0
ucomisd -0x38(%rbp),%xmm0
jb     1307 <bb_spectrum+0x1d7>
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x8(%rbp)
jmp    13a5 <bb_spectrum+0x275>
movsd  0xd19(%rip),%xmm0
divsd  -0x40(%rbp),%xmm0
movsd  %xmm0,-0x80(%rbp)
movsd  -0x50(%rbp),%xmm0
mov    $0x2,%edi
call   1030 <pow@plt>
movsd  -0x80(%rbp),%xmm0
cvtsi2sd %eax,%xmm1
divsd  %xmm1,%xmm0
movsd  -0x10(%rbp),%xmm1
mulsd  -0x10(%rbp),%xmm1
divsd  -0x20(%rbp),%xmm1
mulsd  %xmm1,%xmm0
movsd  %xmm0,-0x78(%rbp)
movsd  -0x28(%rbp),%xmm0
mov    $0x3,%edi
call   1030 <pow@plt>
movsd  -0x78(%rbp),%xmm0
cvtsi2sd %eax,%xmm1
mulsd  %xmm1,%xmm0
movsd  0xc8f(%rip),%xmm1
subsd  -0x28(%rbp),%xmm1
mulsd  %xmm1,%xmm0
movsd  %xmm0,-0x70(%rbp)
movsd  -0x38(%rbp),%xmm0
call   1050 <sqrt@plt>
movsd  -0x70(%rbp),%xmm0
cvtsi2sd %eax,%xmm1
mulsd  %xmm1,%xmm0
movsd  %xmm0,-0x30(%rbp)
movsd  -0x30(%rbp),%xmm0
movsd  %xmm0,-0x8(%rbp)
movsd  -0x8(%rbp),%xmm0
add    $0x80,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<bb_spectrum>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x58,%rsp
movaps %xmm2,0x20(%rsp)
movaps %xmm0,0x10(%rsp)
movsd  0xeb0(%rip),%xmm0
addsd  %xmm0,%xmm1
movsd  %xmm1,0x8(%rsp)
divsd  %xmm1,%xmm0
movsd  %xmm0,(%rsp)
mov    $0x2,%r13d
mov    $0x2,%edi
call   1030 <pow@plt>
mov    $0x1,%ebx
mov    $0x1,%ecx
sub    %eax,%ecx
xorps  %xmm0,%xmm0
cvtsi2sd %ecx,%xmm0
call   1050 <sqrt@plt>
mov    %eax,%r14d
movsd  (%rsp),%xmm0
mov    $0x2,%edi
call   1030 <pow@plt>
mov    %eax,%r15d
movsd  (%rsp),%xmm0
mov    $0x4,%edi
call   1030 <pow@plt>
mov    %eax,%r12d
movsd  (%rsp),%xmm0
mov    $0x4,%edi
call   1030 <pow@plt>
mov    %eax,%ebp
movsd  (%rsp),%xmm0
mov    $0x2,%edi
call   1030 <pow@plt>
mov    $0x1,%ecx
sub    %eax,%ecx
xorps  %xmm0,%xmm0
cvtsi2sd %ecx,%xmm0
call   1050 <sqrt@plt>
sub    %eax,%ebx
xorps  %xmm1,%xmm1
cvtsi2sd %ebx,%xmm1
movsd  (%rsp),%xmm0
divsd  %xmm1,%xmm0
call   1040 <log10@plt>
movapd 0x10(%rsp),%xmm0
addsd  %xmm0,%xmm0
mulsd  0x8(%rsp),%xmm0
movapd 0x20(%rsp),%xmm2
divsd  %xmm0,%xmm2
xorpd  %xmm0,%xmm0
ucomisd 0xdee(%rip),%xmm2
jae    132c <bb_spectrum+0x1fc>
movsd  0xde0(%rip),%xmm1
subsd  %xmm2,%xmm1
movsd  (%rsp),%xmm0
mulsd  %xmm0,%xmm0
movapd %xmm1,%xmm3
mulsd  %xmm1,%xmm3
subsd  %xmm0,%xmm3
xorpd  %xmm0,%xmm0
ucomisd %xmm3,%xmm0
jae    132c <bb_spectrum+0x1fc>
lea    (%r15,%r15,8),%ecx
lea    (%rcx,%r12,8),%ecx
sub    %ecx,%r13d
imul   %r14d,%r13d
imul   %eax,%ebp
lea    0x0(%rbp,%rbp,4),%eax
lea    (%rax,%rax,2),%eax
add    %r13d,%eax
xorps  %xmm0,%xmm0
cvtsi2sd %eax,%xmm0
mulsd  0xd86(%rip),%xmm0
movapd %xmm0,0x30(%rsp)
movsd  0xd88(%rip),%xmm0
mov    $0x2,%edi
movsd  %xmm1,(%rsp)
movapd %xmm2,0x40(%rsp)
movsd  %xmm3,0x8(%rsp)
call   1030 <pow@plt>
xorps  %xmm0,%xmm0
cvtsi2sd %eax,%xmm0
movapd 0x10(%rsp),%xmm1
mulsd  %xmm1,%xmm1
shufpd $0x2,0xd5b(%rip),%xmm1
movapd 0x20(%rsp),%xmm2
unpcklpd 0x30(%rsp),%xmm2
divpd  %xmm2,%xmm1
movapd %xmm1,%xmm2
unpckhpd %xmm1,%xmm2
divsd  %xmm0,%xmm2
mulsd  %xmm1,%xmm2
movapd %xmm2,0x10(%rsp)
movaps 0x40(%rsp),%xmm0
mov    $0x3,%edi
call   1030 <pow@plt>
xorps  %xmm0,%xmm0
cvtsi2sd %eax,%xmm0
mulsd  0x10(%rsp),%xmm0
movsd  (%rsp),%xmm1
mulsd  %xmm0,%xmm1
movsd  %xmm1,(%rsp)
movsd  0x8(%rsp),%xmm0
call   1050 <sqrt@plt>
xorps  %xmm0,%xmm0
cvtsi2sd %eax,%xmm0
mulsd  (%rsp),%xmm0
add    $0x58,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
define double @bb_spectrum(double %0, double %1, double %2) {
%4 = alloca double
%5 = alloca double
%6 = alloca double
%7 = alloca double
%8 = alloca double
%9 = alloca double
%10 = alloca double
%11 = alloca double
%12 = alloca double
%13 = alloca double
store double %0, double* %5
store double %1, double* %6
store double %2, double* %7
store double 1.000000e+03, double* %13
%14 = load double, double* %6
%15 = fadd double %14, 5.110000e-04
%16 = fdiv double 5.110000e-04, %15
store double %16, double* %12
%17 = load double, double* %12
%18 = call i32 @pow(double %17, i32 2)
%19 = sub nsw i32 1, %18
%20 = sitofp i32 %19 to double
%21 = call i32 @sqrt(double %20)
%22 = load double, double* %12
%23 = call i32 @pow(double %22, i32 2)
%24 = mul nsw i32 9, %23
%25 = sub nsw i32 2, %24
%26 = load double, double* %12
%27 = call i32 @pow(double %26, i32 4)
%28 = mul nsw i32 8, %27
%29 = sub nsw i32 %25, %28
%30 = mul nsw i32 %21, %29
%31 = load double, double* %12
%32 = call i32 @pow(double %31, i32 4)
%33 = mul nsw i32 15, %32
%34 = load double, double* %12
%35 = load double, double* %12
%36 = call i32 @pow(double %35, i32 2)
%37 = sub nsw i32 1, %36
%38 = sitofp i32 %37 to double
%39 = call i32 @sqrt(double %38)
%40 = sub nsw i32 1, %39
%41 = sitofp i32 %40 to double
%42 = fdiv double %34, %41
%43 = call i32 @log10(double %42)
%44 = mul nsw i32 %33, %43
%45 = add nsw i32 %30, %44
%46 = sitofp i32 %45 to double
%47 = fmul double 0x3F91111111111111, %46
store double %47, double* %11
%48 = load double, double* %7
%49 = load double, double* %5
%50 = fmul double 2.000000e+00, %49
%51 = load double, double* %6
%52 = fadd double %51, 5.110000e-04
%53 = fmul double %50, %52
%54 = fdiv double %48, %53
store double %54, double* %8
%55 = load double, double* %8
%56 = fcmp oge double %55, 1.000000e+00
br i1 %56, label %57, label %58
57: ; preds = %3
store double 0.000000e+00, double* %4
br label %96
58: ; preds = %3
%59 = load double, double* %8
%60 = fsub double 1.000000e+00, %59
%61 = load double, double* %8
%62 = fsub double 1.000000e+00, %61
%63 = load double, double* %12
%64 = load double, double* %12
%65 = fmul double %63, %64
%66 = fneg double %65
%67 = call double @llvm.fmuladd.f64(double %60, double %62, double %66)
store double %67, double* %10
%68 = load double, double* %10
%69 = fcmp ole double %68, 0.000000e+00
br i1 %69, label %70, label %71
70: ; preds = %58
store double 0.000000e+00, double* %4
br label %96
71: ; preds = %58
%72 = load double, double* %11
%73 = fdiv double 0x3FD45F57CE20D722, %72
%74 = load double, double* %13
%75 = call i32 @pow(double %74, i32 2)
%76 = sitofp i32 %75 to double
%77 = fdiv double %73, %76
%78 = load double, double* %5
%79 = load double, double* %5
%80 = fmul double %78, %79
%81 = load double, double* %7
%82 = fdiv double %80, %81
%83 = fmul double %77, %82
%84 = load double, double* %8
%85 = call i32 @pow(double %84, i32 3)
%86 = sitofp i32 %85 to double
%87 = fmul double %83, %86
%88 = load double, double* %8
%89 = fsub double 1.000000e+00, %88
%90 = fmul double %87, %89
%91 = load double, double* %10
%92 = call i32 @sqrt(double %91)
%93 = sitofp i32 %92 to double
%94 = fmul double %90, %93
store double %94, double* %9
%95 = load double, double* %9
store double %95, double* %4
br label %96
96: ; preds = %71, %70, %57
%97 = load double, double* %4
ret double %97
}

LLVM IR (-O2):
define double @bb_spectrum(double %0, double %1, double %2) {
%4 = fadd double %1, 5.110000e-04
%5 = fdiv double 5.110000e-04, %4
%6 = tail call i32 @pow(double %5, i32 2)
%7 = sub nsw i32 1, %6
%8 = sitofp i32 %7 to double
%9 = tail call i32 @sqrt(double %8)
%10 = tail call i32 @pow(double %5, i32 2)
%11 = mul i32 %10, -9
%12 = add i32 %11, 2
%13 = tail call i32 @pow(double %5, i32 4)
%14 = mul i32 %13, -8
%15 = add i32 %12, %14
%16 = mul nsw i32 %15, %9
%17 = tail call i32 @pow(double %5, i32 4)
%18 = mul nsw i32 %17, 15
%19 = tail call i32 @pow(double %5, i32 2)
%20 = sub nsw i32 1, %19
%21 = sitofp i32 %20 to double
%22 = tail call i32 @sqrt(double %21)
%23 = sub nsw i32 1, %22
%24 = sitofp i32 %23 to double
%25 = fdiv double %5, %24
%26 = tail call i32 @log10(double %25)
%27 = mul nsw i32 %18, %26
%28 = add nsw i32 %27, %16
%29 = sitofp i32 %28 to double
%30 = fmul double %29, 0x3F91111111111111
%31 = fmul double %0, 2.000000e+00
%32 = fmul double %31, %4
%33 = fdiv double %2, %32
%34 = fcmp ult double %33, 1.000000e+00
br i1 %34, label %35, label %60
35: ; preds = %3
%36 = fsub double 1.000000e+00, %33
%37 = fneg double %5
%38 = fmul double %5, %37
%39 = tail call double @llvm.fmuladd.f64(double %36, double %36, double %38)
%40 = fcmp ugt double %39, 0.000000e+00
br i1 %40, label %41, label %60
41: ; preds = %35
%42 = tail call i32 @pow(double 1.000000e+03, i32 2)
%43 = sitofp i32 %42 to double
%44 = fmul double %0, %0
%45 = insertelement <2 x double> <double poison, double 0x3FD45F57CE20D722>, double %44, i64 0
%46 = insertelement <2 x double> poison, double %2, i64 0
%47 = insertelement <2 x double> %46, double %30, i64 1
%48 = fdiv <2 x double> %45, %47
%49 = extractelement <2 x double> %48, i64 1
%50 = fdiv double %49, %43
%51 = extractelement <2 x double> %48, i64 0
%52 = fmul double %51, %50
%53 = tail call i32 @pow(double %33, i32 3)
%54 = sitofp i32 %53 to double
%55 = fmul double %52, %54
%56 = fmul double %36, %55
%57 = tail call i32 @sqrt(double %39)
%58 = sitofp i32 %57 to double
%59 = fmul double %56, %58
br label %60
60: ; preds = %35, %3, %41
%61 = phi double [ %59, %41 ], [ 0.000000e+00, %3 ], [ 0.000000e+00, %35 ]
ret double %61
}