#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 exp(double);
void rdfreverserxn(double *r, double *rdf, int n, double step, double b,
                   double flux) {
  int i;
  double rr, k;
  k = 1.0 / (4.0 * 3.14159265358979323846 * 2.50662827462 * step * step * step);
  if (b == 0) {
    for (i = 0; i < n; i++) {
      rr = r[i] / step;
      rdf[i] += flux * k * 2.0 * exp(-rr * rr / 2.0);
    }
  } else {
    b /= step;
    if (r[i = 0] == 0)
      rdf[i++] += flux * k * 2.0 * exp(-b * b / 2.0);
    for (; i < n; i++) {
      rr = r[i] / step;
      rdf[i] +=
          flux * k / rr / b *
          (exp(-(rr - b) * (rr - b) / 2.0) - exp(-(rr + b) * (rr + b) / 2.0));
    }
  }
  return;
}


x86 assembly (clang, -O0):
<rdfreverserxn>:
push   %rbp
mov    %rsp,%rbp
sub    $0x70,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
movsd  %xmm0,-0x20(%rbp)
movsd  %xmm1,-0x28(%rbp)
movsd  %xmm2,-0x30(%rbp)
movsd  0xece(%rip),%xmm1
mulsd  -0x20(%rbp),%xmm1
mulsd  -0x20(%rbp),%xmm1
mulsd  -0x20(%rbp),%xmm1
movsd  0xeaf(%rip),%xmm0
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x48(%rbp)
movsd  -0x28(%rbp),%xmm0
xorps  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
jne    121e <rdfreverserxn+0x10e>
jp     121e <rdfreverserxn+0x10e>
movl   $0x0,-0x34(%rbp)
mov    -0x34(%rbp),%eax
cmp    -0x14(%rbp),%eax
jge    1219 <rdfreverserxn+0x109>
mov    -0x8(%rbp),%rax
movslq -0x34(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
divsd  -0x20(%rbp),%xmm0
movsd  %xmm0,-0x40(%rbp)
movsd  -0x30(%rbp),%xmm0
mulsd  -0x48(%rbp),%xmm0
movsd  0xe62(%rip),%xmm1
mulsd  %xmm1,%xmm0
movsd  %xmm0,-0x50(%rbp)
movsd  -0x40(%rbp),%xmm0
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
mulsd  -0x40(%rbp),%xmm0
movsd  0xe30(%rip),%xmm1
divsd  %xmm1,%xmm0
call   1030 <exp@plt>
movaps %xmm0,%xmm2
movsd  -0x50(%rbp),%xmm0
mov    -0x10(%rbp),%rax
movslq -0x34(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,(%rax,%rcx,8)
mov    -0x34(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x34(%rbp)
jmp    1179 <rdfreverserxn+0x69>
jmp    13d0 <rdfreverserxn+0x2c0>
movsd  -0x20(%rbp),%xmm1
movsd  -0x28(%rbp),%xmm0
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x28(%rbp)
mov    -0x8(%rbp),%rax
movl   $0x0,-0x34(%rbp)
movsd  (%rax),%xmm0
xorps  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
jne    12cc <rdfreverserxn+0x1bc>
jp     12cc <rdfreverserxn+0x1bc>
movsd  -0x30(%rbp),%xmm0
mulsd  -0x48(%rbp),%xmm0
movsd  0xdab(%rip),%xmm1
mulsd  %xmm1,%xmm0
movsd  %xmm0,-0x58(%rbp)
movsd  -0x28(%rbp),%xmm0
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
mulsd  -0x28(%rbp),%xmm0
movsd  0xd79(%rip),%xmm1
divsd  %xmm1,%xmm0
call   1030 <exp@plt>
movaps %xmm0,%xmm2
movsd  -0x58(%rbp),%xmm0
mov    -0x10(%rbp),%rax
mov    -0x34(%rbp),%ecx
mov    %ecx,%edx
add    $0x1,%edx
mov    %edx,-0x34(%rbp)
movslq %ecx,%rcx
movsd  (%rax,%rcx,8),%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,(%rax,%rcx,8)
jmp    12d1 <rdfreverserxn+0x1c1>
mov    -0x34(%rbp),%eax
cmp    -0x14(%rbp),%eax
jge    13cb <rdfreverserxn+0x2bb>
mov    -0x8(%rbp),%rax
movslq -0x34(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
divsd  -0x20(%rbp),%xmm0
movsd  %xmm0,-0x40(%rbp)
movsd  -0x30(%rbp),%xmm0
mulsd  -0x48(%rbp),%xmm0
divsd  -0x40(%rbp),%xmm0
divsd  -0x28(%rbp),%xmm0
movsd  %xmm0,-0x60(%rbp)
movsd  -0x40(%rbp),%xmm0
subsd  -0x28(%rbp),%xmm0
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
movsd  -0x40(%rbp),%xmm1
subsd  -0x28(%rbp),%xmm1
mulsd  %xmm1,%xmm0
movsd  0xccc(%rip),%xmm1
divsd  %xmm1,%xmm0
call   1030 <exp@plt>
movsd  %xmm0,-0x68(%rbp)
movsd  -0x40(%rbp),%xmm0
addsd  -0x28(%rbp),%xmm0
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
movsd  -0x40(%rbp),%xmm1
addsd  -0x28(%rbp),%xmm1
mulsd  %xmm1,%xmm0
movsd  0xc87(%rip),%xmm1
divsd  %xmm1,%xmm0
call   1030 <exp@plt>
movsd  -0x68(%rbp),%xmm2
movaps %xmm0,%xmm1
movsd  -0x60(%rbp),%xmm0
subsd  %xmm1,%xmm2
mov    -0x10(%rbp),%rax
movslq -0x34(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,(%rax,%rcx,8)
mov    -0x34(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x34(%rbp)
jmp    12d1 <rdfreverserxn+0x1c1>
jmp    13d0 <rdfreverserxn+0x2c0>
add    $0x70,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<rdfreverserxn>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
sub    $0x40,%rsp
movapd %xmm0,%xmm5
mov    %edx,%r15d
mov    %rsi,%r12
mov    %rdi,%r14
movsd  0xecf(%rip),%xmm0
mulsd  %xmm5,%xmm0
mulsd  %xmm5,%xmm0
mulsd  %xmm5,%xmm0
movsd  0xec3(%rip),%xmm3
divsd  %xmm0,%xmm3
xorpd  %xmm0,%xmm0
ucomisd %xmm0,%xmm1
movsd  %xmm5,0x28(%rsp)
jne    11c5 <rdfreverserxn+0xb5>
jp     11c5 <rdfreverserxn+0xb5>
test   %r15d,%r15d
jle    1311 <rdfreverserxn+0x201>
mulsd  %xmm2,%xmm3
addsd  %xmm3,%xmm3
mov    %r15d,%ebp
xor    %ebx,%ebx
movsd  %xmm3,0x8(%rsp)
nopw   0x0(%rax,%rax,1)
movsd  (%r14,%rbx,8),%xmm0
divsd  %xmm5,%xmm0
mulsd  %xmm0,%xmm0
mulsd  0xe7a(%rip),%xmm0
call   1030 <exp@plt>
movsd  0x8(%rsp),%xmm3
movsd  0x28(%rsp),%xmm5
mulsd  %xmm3,%xmm0
addsd  (%r12,%rbx,8),%xmm0
movsd  %xmm0,(%r12,%rbx,8)
add    $0x1,%rbx
cmp    %rbx,%rbp
jne    1180 <rdfreverserxn+0x70>
jmp    1311 <rdfreverserxn+0x201>
divsd  %xmm5,%xmm1
movsd  (%r14),%xmm4
ucomisd %xmm0,%xmm4
movsd  %xmm1,0x20(%rsp)
jne    123a <rdfreverserxn+0x12a>
jp     123a <rdfreverserxn+0x12a>
movapd %xmm3,%xmm0
mulsd  %xmm2,%xmm0
addsd  %xmm0,%xmm0
movsd  %xmm0,0x10(%rsp)
movapd %xmm1,%xmm0
mulsd  %xmm1,%xmm0
mulsd  0xe12(%rip),%xmm0
movsd  %xmm3,0x8(%rsp)
movsd  %xmm2,0x18(%rsp)
call   1030 <exp@plt>
movsd  0x18(%rsp),%xmm2
movsd  0x8(%rsp),%xmm3
movsd  0x28(%rsp),%xmm5
mulsd  0x10(%rsp),%xmm0
addsd  (%r12),%xmm0
movsd  %xmm0,(%r12)
mov    $0x1,%eax
jmp    123c <rdfreverserxn+0x12c>
xor    %eax,%eax
cmp    %r15d,%eax
movsd  0x20(%rsp),%xmm0
jge    1311 <rdfreverserxn+0x201>
mulsd  %xmm2,%xmm3
mov    %eax,%ebp
mov    %r15d,%r15d
movsd  %xmm3,0x8(%rsp)
nopw   0x0(%rax,%rax,1)
movsd  (%r14,%rbp,8),%xmm1
divsd  %xmm5,%xmm1
movapd %xmm1,0x30(%rsp)
divsd  %xmm1,%xmm3
divsd  %xmm0,%xmm3
movsd  %xmm3,0x18(%rsp)
subsd  %xmm0,%xmm1
movapd %xmm1,%xmm0
movapd 0xd92(%rip),%xmm2
xorpd  %xmm2,%xmm0
mulsd  %xmm1,%xmm0
movsd  0xd7a(%rip),%xmm1
mulsd  %xmm1,%xmm0
call   1030 <exp@plt>
movsd  %xmm0,0x10(%rsp)
movapd 0x30(%rsp),%xmm1
addsd  0x20(%rsp),%xmm1
movapd %xmm1,%xmm0
xorpd  0xd5b(%rip),%xmm0
mulsd  %xmm1,%xmm0
mulsd  0xd47(%rip),%xmm0
call   1030 <exp@plt>
movsd  0x8(%rsp),%xmm3
movsd  0x28(%rsp),%xmm5
movsd  0x10(%rsp),%xmm1
subsd  %xmm0,%xmm1
movsd  0x20(%rsp),%xmm0
mulsd  0x18(%rsp),%xmm1
addsd  (%r12,%rbp,8),%xmm1
movsd  %xmm1,(%r12,%rbp,8)
add    $0x1,%rbp
cmp    %rbp,%r15
jne    1260 <rdfreverserxn+0x150>
add    $0x40,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
ret

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

LLVM IR (-O2):
define void @rdfreverserxn(double* nocapture %0, double* nocapture %1, i32 %2, double %3, double %4, double %5) {
%7 = fmul double %3, 0x403F7FCCDFF2ACAF
%8 = fmul double %7, %3
%9 = fmul double %8, %3
%10 = fdiv double 1.000000e+00, %9
%11 = fcmp oeq double %4, 0.000000e+00
br i1 %11, label %12, label %32
12: ; preds = %6
%13 = icmp sgt i32 %2, 0
br i1 %13, label %14, label %75
14: ; preds = %12
%15 = fmul double %10, %5
%16 = fmul double %15, 2.000000e+00
%17 = zext i32 %2 to i64
br label %18
18: ; preds = %14, %18
%19 = phi i64 [ 0, %14 ], [ %30, %18 ]
%20 = getelementptr inbounds double, double* %0, i64 %19
%21 = load double, double* %20
%22 = fdiv double %21, %3
%23 = fneg double %22
%24 = fmul double %22, %23
%25 = fmul double %24, 5.000000e-01
%26 = tail call double @exp(double %25)
%27 = getelementptr inbounds double, double* %1, i64 %19
%28 = load double, double* %27
%29 = tail call double @llvm.fmuladd.f64(double %16, double %26, double %28)
store double %29, double* %27
%30 = add nuw nsw i64 %19, 1
%31 = icmp eq i64 %30, %17
br i1 %31, label %75, label %18
32: ; preds = %6
%33 = fdiv double %4, %3
%34 = load double, double* %0
%35 = fcmp oeq double %34, 0.000000e+00
br i1 %35, label %36, label %45
36: ; preds = %32
%37 = fmul double %10, %5
%38 = fmul double %37, 2.000000e+00
%39 = fneg double %33
%40 = fmul double %33, %39
%41 = fmul double %40, 5.000000e-01
%42 = tail call double @exp(double %41)
%43 = load double, double* %1
%44 = tail call double @llvm.fmuladd.f64(double %38, double %42, double %43)
store double %44, double* %1
br label %45
45: ; preds = %36, %32
%46 = phi i32 [ 1, %36 ], [ 0, %32 ]
%47 = icmp slt i32 %46, %2
br i1 %47, label %48, label %75
48: ; preds = %45
%49 = fmul double %10, %5
%50 = zext i32 %46 to i64
%51 = zext i32 %2 to i64
br label %52
52: ; preds = %48, %52
%53 = phi i64 [ %50, %48 ], [ %73, %52 ]
%54 = getelementptr inbounds double, double* %0, i64 %53
%55 = load double, double* %54
%56 = fdiv double %55, %3
%57 = fdiv double %49, %56
%58 = fdiv double %57, %33
%59 = fsub double %56, %33
%60 = fneg double %59
%61 = fmul double %59, %60
%62 = fmul double %61, 5.000000e-01
%63 = tail call double @exp(double %62)
%64 = fadd double %33, %56
%65 = fneg double %64
%66 = fmul double %64, %65
%67 = fmul double %66, 5.000000e-01
%68 = tail call double @exp(double %67)
%69 = fsub double %63, %68
%70 = getelementptr inbounds double, double* %1, i64 %53
%71 = load double, double* %70
%72 = tail call double @llvm.fmuladd.f64(double %58, double %69, double %71)
store double %72, double* %70
%73 = add nuw nsw i64 %53, 1
%74 = icmp eq i64 %73, %51
br i1 %74, label %75, label %52
75: ; preds = %52, %18, %45, %12
ret void
}