#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 M_PI;
int exp(double);
int log(int);
double sigma_proton_(double *rr, double *YY) {
  double r = *rr;
  double Y = *YY;
  if (Y <= 0)
    return 0.0;
  double N0 = 0.7;
  double kappa = 9.9;
  double gc = 0.7376;
  double lambda = 0.2197;
  double x0 = 0.1632e-4;
  double Rp2 = 3.344 * 3.344;
  double Qs2 = exp(lambda * (Y + log(x0)));
  double lQs = 0.5 * log(Qs2);
  double z = -log(r / 2.0) - lQs;
  double a = gc * N0 / (1 - N0);
  a = a * a / log(1 / (1 - N0));
  double lrqsb = z - (1 - N0) / gc / N0 * log(1 / (1 - N0));
  return 2.0 * M_PI * Rp2 *
         ((z > 0) ? N0 * exp(-2.0 * z * (gc + z / (kappa * lambda * Y)))
                  : 1 - exp(-a * lrqsb * lrqsb));
}


x86 assembly (clang, -O0):
<sigma_proton_>:
push   %rbp
mov    %rsp,%rbp
sub    $0xc0,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    -0x10(%rbp),%rax
movsd  (%rax),%xmm0
movsd  %xmm0,-0x20(%rbp)
mov    -0x18(%rbp),%rax
movsd  (%rax),%xmm0
movsd  %xmm0,-0x28(%rbp)
xorps  %xmm0,%xmm0
ucomisd -0x28(%rbp),%xmm0
jb     1168 <sigma_proton_+0x48>
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x8(%rbp)
jmp    142c <sigma_proton_+0x30c>
movsd  0xed0(%rip),%xmm0
movsd  %xmm0,-0x30(%rbp)
movsd  0xebb(%rip),%xmm0
movsd  %xmm0,-0x38(%rbp)
movsd  0xea6(%rip),%xmm0
movsd  %xmm0,-0x40(%rbp)
movsd  0xe91(%rip),%xmm0
movsd  %xmm0,-0x48(%rbp)
movsd  0xe7c(%rip),%xmm0
movsd  %xmm0,-0x50(%rbp)
movsd  0xe67(%rip),%xmm0
movsd  %xmm0,-0x58(%rbp)
movsd  -0x48(%rbp),%xmm0
movsd  %xmm0,-0xa8(%rbp)
ff
movsd  -0x28(%rbp),%xmm0
movsd  %xmm0,-0xb0(%rbp)
ff
cvttsd2si -0x50(%rbp),%edi
call   1040 <log@plt>
movsd  -0xb0(%rbp),%xmm1
ff
movsd  -0xa8(%rbp),%xmm0
ff
cvtsi2sd %eax,%xmm2
addsd  %xmm2,%xmm1
mulsd  %xmm1,%xmm0
call   1030 <exp@plt>
cvtsi2sd %eax,%xmm0
movsd  %xmm0,-0x60(%rbp)
cvttsd2si -0x60(%rbp),%edi
call   1040 <log@plt>
cvtsi2sd %eax,%xmm1
movsd  0xdf6(%rip),%xmm0
mulsd  %xmm1,%xmm0
movsd  %xmm0,-0x68(%rbp)
movsd  -0x20(%rbp),%xmm0
movsd  0xdd0(%rip),%xmm1
divsd  %xmm1,%xmm0
cvttsd2si %xmm0,%edi
call   1040 <log@plt>
mov    %eax,%ecx
xor    %eax,%eax
sub    %ecx,%eax
cvtsi2sd %eax,%xmm0
subsd  -0x68(%rbp),%xmm0
movsd  %xmm0,-0x70(%rbp)
movsd  -0x40(%rbp),%xmm0
mulsd  -0x30(%rbp),%xmm0
movsd  0xda5(%rip),%xmm1
subsd  -0x30(%rbp),%xmm1
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x78(%rbp)
movsd  -0x78(%rbp),%xmm0
mulsd  -0x78(%rbp),%xmm0
movsd  %xmm0,-0xa0(%rbp)
ff
movsd  0xd7d(%rip),%xmm1
subsd  -0x30(%rbp),%xmm1
movsd  0xd70(%rip),%xmm0
divsd  %xmm1,%xmm0
cvttsd2si %xmm0,%edi
call   1040 <log@plt>
movsd  -0xa0(%rbp),%xmm0
ff
cvtsi2sd %eax,%xmm1
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x78(%rbp)
movsd  -0x70(%rbp),%xmm0
movsd  %xmm0,-0x90(%rbp)
ff
movsd  0xd39(%rip),%xmm0
subsd  -0x30(%rbp),%xmm0
divsd  -0x40(%rbp),%xmm0
divsd  -0x30(%rbp),%xmm0
movsd  %xmm0,-0x98(%rbp)
ff
movsd  0xd1a(%rip),%xmm1
subsd  -0x30(%rbp),%xmm1
movsd  0xd0d(%rip),%xmm0
divsd  %xmm1,%xmm0
cvttsd2si %xmm0,%edi
call   1040 <log@plt>
movsd  -0x98(%rbp),%xmm0
ff
movsd  -0x90(%rbp),%xmm1
ff
cvtsi2sd %eax,%xmm2
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x80(%rbp)
movsd  0xcb8(%rip),%xmm0
mov    0x2c99(%rip),%rax
mulsd  (%rax),%xmm0
mulsd  -0x58(%rbp),%xmm0
movsd  %xmm0,-0x88(%rbp)
ff
movsd  -0x70(%rbp),%xmm0
xorps  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
jbe    13d3 <sigma_proton_+0x2b3>
movsd  -0x30(%rbp),%xmm0
movsd  %xmm0,-0xc0(%rbp)
ff
movsd  0xcc1(%rip),%xmm0
mulsd  -0x70(%rbp),%xmm0
movsd  -0x40(%rbp),%xmm1
movsd  -0x70(%rbp),%xmm2
movsd  -0x38(%rbp),%xmm3
mulsd  -0x48(%rbp),%xmm3
mulsd  -0x28(%rbp),%xmm3
divsd  %xmm3,%xmm2
addsd  %xmm2,%xmm1
mulsd  %xmm1,%xmm0
call   1030 <exp@plt>
movsd  -0xc0(%rbp),%xmm0
ff
cvtsi2sd %eax,%xmm1
mulsd  %xmm1,%xmm0
movsd  %xmm0,-0xb8(%rbp)
ff
jmp    1413 <sigma_proton_+0x2f3>
movsd  -0x78(%rbp),%xmm0
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
mulsd  -0x80(%rbp),%xmm0
mulsd  -0x80(%rbp),%xmm0
call   1030 <exp@plt>
mov    %eax,%ecx
mov    $0x1,%eax
sub    %ecx,%eax
cvtsi2sd %eax,%xmm0
movsd  %xmm0,-0xb8(%rbp)
ff
movsd  -0x88(%rbp),%xmm0
ff
movsd  -0xb8(%rbp),%xmm1
ff
mulsd  %xmm1,%xmm0
movsd  %xmm0,-0x8(%rbp)
movsd  -0x8(%rbp),%xmm0
add    $0xc0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<sigma_proton_>:
push   %rbx
sub    $0x20,%rsp
movsd  (%rsi),%xmm1
xorpd  %xmm0,%xmm0
movsd  %xmm1,0x18(%rsp)
ucomisd %xmm1,%xmm0
jae    1277 <sigma_proton_+0x157>
movsd  (%rdi),%xmm1
mulsd  0xeb7(%rip),%xmm1
movsd  %xmm1,0x10(%rsp)
xor    %edi,%edi
call   1040 <log@plt>
xorps  %xmm0,%xmm0
cvtsi2sd %eax,%xmm0
addsd  0x18(%rsp),%xmm0
mulsd  0xe9d(%rip),%xmm0
call   1030 <exp@plt>
mov    %eax,%edi
call   1040 <log@plt>
xorps  %xmm0,%xmm0
cvtsi2sd %eax,%xmm0
mulsd  0xe7a(%rip),%xmm0
movsd  %xmm0,0x8(%rsp)
cvttsd2si 0x10(%rsp),%edi
call   1040 <log@plt>
neg    %eax
xorps  %xmm0,%xmm0
cvtsi2sd %eax,%xmm0
subsd  0x8(%rsp),%xmm0
movsd  %xmm0,0x8(%rsp)
mov    $0x3,%edi
call   1040 <log@plt>
mov    %eax,%ebx
mov    $0x3,%edi
call   1040 <log@plt>
movsd  0x8(%rsp),%xmm0
mov    0x2e19(%rip),%rcx
movsd  (%rcx),%xmm1
addsd  %xmm1,%xmm1
mulsd  0xe39(%rip),%xmm1
movsd  %xmm1,0x10(%rsp)
xorpd  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
jbe    122f <sigma_proton_+0x10f>
movsd  0xe31(%rip),%xmm2
mulsd  %xmm0,%xmm2
movsd  0x18(%rsp),%xmm1
mulsd  0xe27(%rip),%xmm1
divsd  %xmm1,%xmm0
addsd  0xe23(%rip),%xmm0
mulsd  %xmm2,%xmm0
call   1030 <exp@plt>
xorps  %xmm1,%xmm1
cvtsi2sd %eax,%xmm1
mulsd  0xe13(%rip),%xmm1
jmp    126d <sigma_proton_+0x14d>
xorps  %xmm1,%xmm1
cvtsi2sd %eax,%xmm1
mulsd  0xdd2(%rip),%xmm1
addsd  %xmm0,%xmm1
cvtsi2sd %ebx,%xmm2
movsd  0xdd2(%rip),%xmm0
divsd  %xmm2,%xmm0
mulsd  %xmm1,%xmm0
mulsd  %xmm1,%xmm0
call   1030 <exp@plt>
mov    $0x1,%ecx
sub    %eax,%ecx
xorps  %xmm1,%xmm1
cvtsi2sd %ecx,%xmm1
movsd  0x10(%rsp),%xmm0
mulsd  %xmm1,%xmm0
add    $0x20,%rsp
pop    %rbx
ret

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

LLVM IR (-O2):
@M_PI = global double 0.000000e+00
define double @sigma_proton_(double* nocapture %0, double* nocapture %1) {
%3 = load double, double* %1
%4 = fcmp ugt double %3, 0.000000e+00
br i1 %4, label %5, label %49
5: ; preds = %2
%6 = load double, double* %0
%7 = tail call i32 @log(i32 0)
%8 = sitofp i32 %7 to double
%9 = fadd double %3, %8
%10 = fmul double %9, 2.197000e-01
%11 = tail call i32 @exp(double %10)
%12 = tail call i32 @log(i32 %11)
%13 = sitofp i32 %12 to double
%14 = fmul double %13, 5.000000e-01
%15 = fmul double %6, 5.000000e-01
%16 = fptosi double %15 to i32
%17 = tail call i32 @log(i32 %16)
%18 = sub nsw i32 0, %17
%19 = sitofp i32 %18 to double
%20 = fsub double %19, %14
%21 = tail call i32 @log(i32 3)
%22 = tail call i32 @log(i32 3)
%23 = sitofp i32 %22 to double
%24 = tail call double @llvm.fmuladd.f64(double %23, double 0xBFE297D6BF81122C, double %20)
%25 = load double, double* @M_PI
%26 = fmul double %25, 2.000000e+00
%27 = fmul double %26, 0x40265D5B24E9C454
%28 = fcmp ogt double %20, 0.000000e+00
br i1 %28, label %29, label %38
29: ; preds = %5
%30 = fmul double %20, -2.000000e+00
%31 = fmul double %3, 2.175030e+00
%32 = fdiv double %20, %31
%33 = fadd double %32, 7.376000e-01
%34 = fmul double %30, %33
%35 = tail call i32 @exp(double %34)
%36 = sitofp i32 %35 to double
%37 = fmul double %36, 0x3FE6666666666666
br label %46
38: ; preds = %5
%39 = sitofp i32 %21 to double
%40 = fdiv double 0xC007B25200CEF4CE, %39
%41 = fmul double %40, %24
%42 = fmul double %24, %41
%43 = tail call i32 @exp(double %42)
%44 = sub nsw i32 1, %43
%45 = sitofp i32 %44 to double
br label %46
46: ; preds = %38, %29
%47 = phi double [ %37, %29 ], [ %45, %38 ]
%48 = fmul double %27, %47
br label %49
49: ; preds = %2, %46
%50 = phi double [ %48, %46 ], [ 0.000000e+00, %2 ]
ret double %50
}