#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 dcs_bremsstrahlung_tsai_d2_cutoff(double, double, double, double, double,
                                         double *, double *);
int log(int);
double dcs_bremsstrahlung_tsai_d2(double Z, double A, double m, double K,
                                  double nu, double mu) {
  double mu0, muni;
  const double mumax =
      dcs_bremsstrahlung_tsai_d2_cutoff(Z, A, m, K, nu, &mu0, &muni);
  if (mu >= mumax)
    return 0.;
  const double E = K + m;
  const double y = nu / E;
  const double c1 = (2 * (1. - y) + y * y) * mu0;
  const double c2 = 4 * (1. - y) * mu0 * mu0;
  const double mus = mu0 + mu;
  const double mu2 = mus * mus;
  const double d1 = 1 / mu2;
  const double d2 = d1 * d1;
  double ddcs = c1 * d1 - mu * c2 * d2;
  const double l2 = mu2 / (mu0 * mu0);
  const double q = muni * l2;
  const double r = mu0 * l2;
  const double qr = q * r;
  const double X = Z * Z *
                   ((1. + 2 * qr) * log((1. + qr) / (r + qr)) -
                    (1. - r) * (1 + 2 * q) / (1 + q));
  ddcs *= 2 * 7.2973525693E-03 * 2.817940285E-15 * 2.817940285E-15 * X / nu;
  return ddcs;
}


x86 assembly (clang, -O0):
<dcs_bremsstrahlung_tsai_d2>:
push   %rbp
mov    %rsp,%rbp
sub    $0xd0,%rsp
movsd  %xmm0,-0x10(%rbp)
movsd  %xmm1,-0x18(%rbp)
movsd  %xmm2,-0x20(%rbp)
movsd  %xmm3,-0x28(%rbp)
movsd  %xmm4,-0x30(%rbp)
movsd  %xmm5,-0x38(%rbp)
movsd  -0x10(%rbp),%xmm0
movsd  -0x18(%rbp),%xmm1
movsd  -0x20(%rbp),%xmm2
movsd  -0x28(%rbp),%xmm3
movsd  -0x30(%rbp),%xmm4
lea    -0x40(%rbp),%rdi
lea    -0x48(%rbp),%rsi
call   1040 <dcs_bremsstrahlung_tsai_d2_cutoff@plt>
movsd  %xmm0,-0x50(%rbp)
movsd  -0x38(%rbp),%xmm0
ucomisd -0x50(%rbp),%xmm0
jb     1191 <dcs_bremsstrahlung_tsai_d2+0x71>
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x8(%rbp)
jmp    13fe <dcs_bremsstrahlung_tsai_d2+0x2de>
movsd  -0x28(%rbp),%xmm0
addsd  -0x20(%rbp),%xmm0
movsd  %xmm0,-0x58(%rbp)
movsd  -0x30(%rbp),%xmm0
divsd  -0x58(%rbp),%xmm0
movsd  %xmm0,-0x60(%rbp)
movsd  0xe51(%rip),%xmm0
subsd  -0x60(%rbp),%xmm0
movsd  -0x60(%rbp),%xmm1
mulsd  -0x60(%rbp),%xmm1
addsd  %xmm0,%xmm0
addsd  %xmm1,%xmm0
mulsd  -0x40(%rbp),%xmm0
movsd  %xmm0,-0x68(%rbp)
movsd  0xe28(%rip),%xmm1
subsd  -0x60(%rbp),%xmm1
movsd  0xe23(%rip),%xmm0
mulsd  %xmm1,%xmm0
mulsd  -0x40(%rbp),%xmm0
mulsd  -0x40(%rbp),%xmm0
movsd  %xmm0,-0x70(%rbp)
movsd  -0x40(%rbp),%xmm0
addsd  -0x38(%rbp),%xmm0
movsd  %xmm0,-0x78(%rbp)
movsd  -0x78(%rbp),%xmm0
mulsd  -0x78(%rbp),%xmm0
movsd  %xmm0,-0x80(%rbp)
movsd  0xde2(%rip),%xmm0
divsd  -0x80(%rbp),%xmm0
movsd  %xmm0,-0x88(%rbp)
ff
movsd  -0x88(%rbp),%xmm0
ff
mulsd  -0x88(%rbp),%xmm0
ff
movsd  %xmm0,-0x90(%rbp)
ff
movsd  -0x68(%rbp),%xmm0
movsd  -0x88(%rbp),%xmm2
ff
movsd  -0x38(%rbp),%xmm1
mulsd  -0x70(%rbp),%xmm1
mulsd  -0x90(%rbp),%xmm1
ff
movq   %xmm1,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x98(%rbp)
ff
movsd  -0x80(%rbp),%xmm0
movsd  -0x40(%rbp),%xmm1
mulsd  -0x40(%rbp),%xmm1
divsd  %xmm1,%xmm0
movsd  %xmm0,-0xa0(%rbp)
ff
movsd  -0x48(%rbp),%xmm0
mulsd  -0xa0(%rbp),%xmm0
ff
movsd  %xmm0,-0xa8(%rbp)
ff
movsd  -0x40(%rbp),%xmm0
mulsd  -0xa0(%rbp),%xmm0
ff
movsd  %xmm0,-0xb0(%rbp)
ff
movsd  -0xa8(%rbp),%xmm0
ff
mulsd  -0xb0(%rbp),%xmm0
ff
movsd  %xmm0,-0xb8(%rbp)
ff
movsd  -0x10(%rbp),%xmm0
mulsd  -0x10(%rbp),%xmm0
movsd  %xmm0,-0xc8(%rbp)
ff
movsd  -0xb8(%rbp),%xmm0
ff
addsd  %xmm0,%xmm0
movsd  0xcf4(%rip),%xmm1
addsd  %xmm1,%xmm0
movsd  %xmm0,-0xd0(%rbp)
ff
movsd  0xce0(%rip),%xmm0
addsd  -0xb8(%rbp),%xmm0
ff
movsd  -0xb0(%rbp),%xmm1
ff
addsd  -0xb8(%rbp),%xmm1
ff
divsd  %xmm1,%xmm0
cvttsd2si %xmm0,%edi
call   1030 <log@plt>
movsd  -0xd0(%rbp),%xmm1
ff
movsd  -0xc8(%rbp),%xmm0
ff
cvtsi2sd %eax,%xmm3
movsd  0xc9f(%rip),%xmm2
subsd  -0xb0(%rbp),%xmm2
ff
movsd  -0xa8(%rbp),%xmm4
ff
addsd  %xmm4,%xmm4
movsd  0xc83(%rip),%xmm5
addsd  %xmm5,%xmm4
mulsd  %xmm4,%xmm2
movsd  0xc73(%rip),%xmm4
addsd  -0xa8(%rbp),%xmm4
ff
divsd  %xmm4,%xmm2
movq   %xmm2,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm2
mulsd  %xmm3,%xmm1
addsd  %xmm2,%xmm1
mulsd  %xmm1,%xmm0
movsd  %xmm0,-0xc0(%rbp)
ff
movsd  0xc2c(%rip),%xmm0
mulsd  -0xc0(%rbp),%xmm0
ff
divsd  -0x30(%rbp),%xmm0
mulsd  -0x98(%rbp),%xmm0
ff
movsd  %xmm0,-0x98(%rbp)
ff
movsd  -0x98(%rbp),%xmm0
ff
movsd  %xmm0,-0x8(%rbp)
movsd  -0x8(%rbp),%xmm0
add    $0xd0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<dcs_bremsstrahlung_tsai_d2>:
sub    $0x48,%rsp
movsd  %xmm5,0x18(%rsp)
lea    0x40(%rsp),%rdi
lea    0x38(%rsp),%rsi
movsd  %xmm0,0x20(%rsp)
movsd  %xmm2,0x10(%rsp)
movsd  %xmm3,0x8(%rsp)
movsd  %xmm4,0x28(%rsp)
call   1040 <dcs_bremsstrahlung_tsai_d2_cutoff@plt>
movsd  0x18(%rsp),%xmm5
movapd %xmm0,%xmm1
xorpd  %xmm0,%xmm0
ucomisd %xmm1,%xmm5
jae    12a7 <dcs_bremsstrahlung_tsai_d2+0x187>
movsd  0x10(%rsp),%xmm1
addsd  0x8(%rsp),%xmm1
movsd  0x28(%rsp),%xmm0
divsd  %xmm1,%xmm0
movsd  0xe79(%rip),%xmm3
movapd %xmm3,%xmm2
subsd  %xmm0,%xmm2
mulsd  %xmm0,%xmm0
movapd %xmm2,%xmm1
addsd  %xmm2,%xmm1
addsd  %xmm0,%xmm1
movsd  0x40(%rsp),%xmm6
mulsd  %xmm6,%xmm1
movapd %xmm6,%xmm4
addsd  %xmm5,%xmm4
mulsd  %xmm4,%xmm4
movapd %xmm3,%xmm0
divsd  %xmm4,%xmm0
mulsd  %xmm0,%xmm1
mulsd  0xe3f(%rip),%xmm2
mulsd  %xmm0,%xmm0
mulsd  %xmm6,%xmm2
mulsd  %xmm6,%xmm2
mulsd  %xmm5,%xmm2
mulsd  %xmm0,%xmm2
addsd  %xmm1,%xmm2
movsd  %xmm2,0x18(%rsp)
movapd %xmm6,%xmm0
mulsd  %xmm6,%xmm0
divsd  %xmm0,%xmm4
mulsd  %xmm4,%xmm6
movsd  %xmm6,0x8(%rsp)
mulsd  0x38(%rsp),%xmm4
movsd  %xmm4,0x10(%rsp)
movapd %xmm4,%xmm0
mulsd  %xmm6,%xmm0
movsd  0x20(%rsp),%xmm1
mulsd  %xmm1,%xmm1
movsd  %xmm1,0x20(%rsp)
movapd %xmm0,%xmm1
addsd  %xmm0,%xmm1
addsd  %xmm3,%xmm1
movsd  %xmm1,0x30(%rsp)
movapd %xmm6,%xmm1
addsd  %xmm0,%xmm1
addsd  %xmm3,%xmm0
divsd  %xmm1,%xmm0
cvttsd2si %xmm0,%edi
call   1030 <log@plt>
xorps  %xmm0,%xmm0
cvtsi2sd %eax,%xmm0
mulsd  0x30(%rsp),%xmm0
movsd  0xd9f(%rip),%xmm4
movapd %xmm4,%xmm1
subsd  0x8(%rsp),%xmm1
movsd  0x10(%rsp),%xmm3
movapd %xmm3,%xmm2
addsd  %xmm3,%xmm2
addsd  %xmm4,%xmm2
mulsd  %xmm1,%xmm2
addsd  %xmm4,%xmm3
divsd  %xmm3,%xmm2
subsd  %xmm2,%xmm0
mulsd  0x20(%rsp),%xmm0
mulsd  0xd75(%rip),%xmm0
divsd  0x28(%rsp),%xmm0
mulsd  0x18(%rsp),%xmm0
add    $0x48,%rsp
ret

LLVM IR (-O0):
define double @dcs_bremsstrahlung_tsai_d2(double %0, double %1, double %2, double %3, double %4, double %5) {
%7 = alloca double
%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
%17 = alloca double
%18 = alloca double
%19 = alloca double
%20 = alloca double
%21 = alloca double
%22 = alloca double
%23 = alloca double
%24 = alloca double
%25 = alloca double
%26 = alloca double
%27 = alloca double
%28 = alloca double
%29 = alloca double
%30 = 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
%31 = load double, double* %8
%32 = load double, double* %9
%33 = load double, double* %10
%34 = load double, double* %11
%35 = load double, double* %12
%36 = call double @dcs_bremsstrahlung_tsai_d2_cutoff(double %31, double %32, double %33, double %34, double %35, double* %14, double* %15)
store double %36, double* %16
%37 = load double, double* %13
%38 = load double, double* %16
%39 = fcmp oge double %37, %38
br i1 %39, label %40, label %41
40: ; preds = %6
store double 0.000000e+00, double* %7
br label %129
41: ; preds = %6
%42 = load double, double* %11
%43 = load double, double* %10
%44 = fadd double %42, %43
store double %44, double* %17
%45 = load double, double* %12
%46 = load double, double* %17
%47 = fdiv double %45, %46
store double %47, double* %18
%48 = load double, double* %18
%49 = fsub double 1.000000e+00, %48
%50 = load double, double* %18
%51 = load double, double* %18
%52 = fmul double %50, %51
%53 = call double @llvm.fmuladd.f64(double 2.000000e+00, double %49, double %52)
%54 = load double, double* %14
%55 = fmul double %53, %54
store double %55, double* %19
%56 = load double, double* %18
%57 = fsub double 1.000000e+00, %56
%58 = fmul double 4.000000e+00, %57
%59 = load double, double* %14
%60 = fmul double %58, %59
%61 = load double, double* %14
%62 = fmul double %60, %61
store double %62, double* %20
%63 = load double, double* %14
%64 = load double, double* %13
%65 = fadd double %63, %64
store double %65, double* %21
%66 = load double, double* %21
%67 = load double, double* %21
%68 = fmul double %66, %67
store double %68, double* %22
%69 = load double, double* %22
%70 = fdiv double 1.000000e+00, %69
store double %70, double* %23
%71 = load double, double* %23
%72 = load double, double* %23
%73 = fmul double %71, %72
store double %73, double* %24
%74 = load double, double* %19
%75 = load double, double* %23
%76 = load double, double* %13
%77 = load double, double* %20
%78 = fmul double %76, %77
%79 = load double, double* %24
%80 = fmul double %78, %79
%81 = fneg double %80
%82 = call double @llvm.fmuladd.f64(double %74, double %75, double %81)
store double %82, double* %25
%83 = load double, double* %22
%84 = load double, double* %14
%85 = load double, double* %14
%86 = fmul double %84, %85
%87 = fdiv double %83, %86
store double %87, double* %26
%88 = load double, double* %15
%89 = load double, double* %26
%90 = fmul double %88, %89
store double %90, double* %27
%91 = load double, double* %14
%92 = load double, double* %26
%93 = fmul double %91, %92
store double %93, double* %28
%94 = load double, double* %27
%95 = load double, double* %28
%96 = fmul double %94, %95
store double %96, double* %29
%97 = load double, double* %8
%98 = load double, double* %8
%99 = fmul double %97, %98
%100 = load double, double* %29
%101 = call double @llvm.fmuladd.f64(double 2.000000e+00, double %100, double 1.000000e+00)
%102 = load double, double* %29
%103 = fadd double 1.000000e+00, %102
%104 = load double, double* %28
%105 = load double, double* %29
%106 = fadd double %104, %105
%107 = fdiv double %103, %106
%108 = fptosi double %107 to i32
%109 = call i32 @log(i32 %108)
%110 = sitofp i32 %109 to double
%111 = load double, double* %28
%112 = fsub double 1.000000e+00, %111
%113 = load double, double* %27
%114 = call double @llvm.fmuladd.f64(double 2.000000e+00, double %113, double 1.000000e+00)
%115 = fmul double %112, %114
%116 = load double, double* %27
%117 = fadd double 1.000000e+00, %116
%118 = fdiv double %115, %117
%119 = fneg double %118
%120 = call double @llvm.fmuladd.f64(double %101, double %110, double %119)
%121 = fmul double %99, %120
store double %121, double* %30
%122 = load double, double* %30
%123 = fmul double 0x3982CE068F9EC2AD, %122
%124 = load double, double* %12
%125 = fdiv double %123, %124
%126 = load double, double* %25
%127 = fmul double %126, %125
store double %127, double* %25
%128 = load double, double* %25
store double %128, double* %7
br label %129
129: ; preds = %41, %40
%130 = load double, double* %7
ret double %130
}

LLVM IR (-O2):
define double @dcs_bremsstrahlung_tsai_d2(double %0, double %1, double %2, double %3, double %4, double %5) {
%7 = alloca double
%8 = alloca double
%9 = bitcast double* %7 to i8*
%10 = bitcast double* %8 to i8*
%11 = call double @dcs_bremsstrahlung_tsai_d2_cutoff(double %0, double %1, double %2, double %3, double %4, double* %7, double* %8)
%12 = fcmp ugt double %11, %5
br i1 %12, label %13, label %56
13: ; preds = %6
%14 = fadd double %2, %3
%15 = fdiv double %4, %14
%16 = fsub double 1.000000e+00, %15
%17 = fmul double %15, %15
%18 = call double @llvm.fmuladd.f64(double %16, double 2.000000e+00, double %17)
%19 = load double, double* %7
%20 = fmul double %18, %19
%21 = fadd double %19, %5
%22 = fmul double %21, %21
%23 = fdiv double 1.000000e+00, %22
%24 = fmul double %23, %23
%25 = fmul double %16, -4.000000e+00
%26 = fmul double %25, %19
%27 = fmul double %19, %26
%28 = fmul double %27, %5
%29 = fmul double %28, %24
%30 = call double @llvm.fmuladd.f64(double %20, double %23, double %29)
%31 = fmul double %19, %19
%32 = fdiv double %22, %31
%33 = load double, double* %8
%34 = fmul double %33, %32
%35 = fmul double %19, %32
%36 = fmul double %34, %35
%37 = fmul double %0, %0
%38 = call double @llvm.fmuladd.f64(double %36, double 2.000000e+00, double 1.000000e+00)
%39 = fadd double %36, 1.000000e+00
%40 = fadd double %35, %36
%41 = fdiv double %39, %40
%42 = fptosi double %41 to i32
%43 = call i32 @log(i32 %42)
%44 = sitofp i32 %43 to double
%45 = fsub double 1.000000e+00, %35
%46 = call double @llvm.fmuladd.f64(double %34, double 2.000000e+00, double 1.000000e+00)
%47 = fadd double %34, 1.000000e+00
%48 = fneg double %45
%49 = fmul double %46, %48
%50 = fdiv double %49, %47
%51 = call double @llvm.fmuladd.f64(double %38, double %44, double %50)
%52 = fmul double %37, %51
%53 = fmul double %52, 0x3982CE068F9EC2AD
%54 = fdiv double %53, %4
%55 = fmul double %30, %54
br label %56
56: ; preds = %6, %13
%57 = phi double [ %55, %13 ], [ 0.000000e+00, %6 ]
ret double %57
}