double r_g(double z) {
  double pnorms(double), phi(double), a, b;
  extern int mm;
  extern double *ww, *xx, rs, r1;
  int i;
  double tem;
  for (i = 0, tem = 1.; i < mm; i++) {
    a = (ww[i] - rs * z) / r1;
    b = (xx[i] - rs * z) / r1;
    tem *= pnorms(b) - pnorms(a);
  }
  tem *= phi(z);
  return (tem);
}


x86 assembly (clang, -O0):
<r_g>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movsd  %xmm0,-0x8(%rbp)
movl   $0x0,-0x1c(%rbp)
movsd  0xec4(%rip),%xmm0
movsd  %xmm0,-0x28(%rbp)
mov    -0x1c(%rbp),%eax
mov    0x2ead(%rip),%rcx
cmp    (%rcx),%eax
jge    1234 <r_g+0x114>
mov    0x2e6e(%rip),%rax
mov    (%rax),%rax
movslq -0x1c(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm1
mov    0x2e53(%rip),%rax
movsd  (%rax),%xmm0
movsd  -0x8(%rbp),%xmm2
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
mov    0x2e54(%rip),%rax
divsd  (%rax),%xmm0
movsd  %xmm0,-0x10(%rbp)
mov    0x2e24(%rip),%rax
mov    (%rax),%rax
movslq -0x1c(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm1
mov    0x2e01(%rip),%rax
movsd  (%rax),%xmm0
movsd  -0x8(%rbp),%xmm2
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
mov    0x2e02(%rip),%rax
divsd  (%rax),%xmm0
movsd  %xmm0,-0x18(%rbp)
movsd  -0x18(%rbp),%xmm0
call   1030 <pnorms@plt>
movsd  %xmm0,-0x30(%rbp)
movsd  -0x10(%rbp),%xmm0
call   1030 <pnorms@plt>
movaps %xmm0,%xmm1
movsd  -0x30(%rbp),%xmm0
subsd  %xmm1,%xmm0
mulsd  -0x28(%rbp),%xmm0
movsd  %xmm0,-0x28(%rbp)
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
jmp    1141 <r_g+0x21>
movsd  -0x8(%rbp),%xmm0
call   1040 <phi@plt>
mulsd  -0x28(%rbp),%xmm0
movsd  %xmm0,-0x28(%rbp)
movsd  -0x28(%rbp),%xmm0
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<r_g>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x28,%rsp
movapd %xmm0,%xmm1
mov    0x2ebf(%rip),%r14
cmpl   $0x0,(%r14)
jle    11ff <r_g+0xdf>
movsd  0xeb5(%rip),%xmm0
movsd  %xmm0,0x8(%rsp)
xor    %ebx,%ebx
mov    0x2e6e(%rip),%r15
mov    0x2e5f(%rip),%r12
mov    0x2e88(%rip),%r13
mov    0x2e61(%rip),%rbp
movsd  %xmm1,0x10(%rsp)
cs nopw 0x0(%rax,%rax,1)
nop
mov    (%r15),%rax
movsd  (%r12),%xmm0
xorpd  0xe7f(%rip),%xmm0
mulsd  %xmm1,%xmm0
movsd  (%rax,%rbx,8),%xmm2
addsd  %xmm0,%xmm2
movsd  0x0(%r13),%xmm1
divsd  %xmm1,%xmm2
movsd  %xmm2,0x20(%rsp)
mov    0x0(%rbp),%rax
addsd  (%rax,%rbx,8),%xmm0
divsd  %xmm1,%xmm0
call   1030 <pnorms@plt>
movsd  %xmm0,0x18(%rsp)
movsd  0x20(%rsp),%xmm0
call   1030 <pnorms@plt>
movsd  0x10(%rsp),%xmm1
movsd  0x18(%rsp),%xmm2
subsd  %xmm0,%xmm2
movsd  0x8(%rsp),%xmm0
mulsd  %xmm2,%xmm0
movsd  %xmm0,0x8(%rsp)
add    $0x1,%rbx
movslq (%r14),%rax
cmp    %rax,%rbx
jl     1180 <r_g+0x60>
jmp    120d <r_g+0xed>
movsd  0xdf9(%rip),%xmm0
movsd  %xmm0,0x8(%rsp)
movapd %xmm1,%xmm0
call   1040 <phi@plt>
mulsd  0x8(%rsp),%xmm0
add    $0x28,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@mm = external global i32
@ww = external global double*
@rs = external global double
@r1 = external global double
@xx = external global double*
define double @r_g(double %0) {
%2 = alloca double
%3 = alloca double
%4 = alloca double
%5 = alloca i32
%6 = alloca double
store double %0, double* %2
store i32 0, i32* %5
store double 1.000000e+00, double* %6
br label %7
7: ; preds = %41, %1
%8 = load i32, i32* %5
%9 = load i32, i32* @mm
%10 = icmp slt i32 %8, %9
br i1 %10, label %11, label %44
11: ; preds = %7
%12 = load double*, double** @ww
%13 = load i32, i32* %5
%14 = sext i32 %13 to i64
%15 = getelementptr inbounds double, double* %12, i64 %14
%16 = load double, double* %15
%17 = load double, double* @rs
%18 = load double, double* %2
%19 = fneg double %17
%20 = call double @llvm.fmuladd.f64(double %19, double %18, double %16)
%21 = load double, double* @r1
%22 = fdiv double %20, %21
store double %22, double* %3
%23 = load double*, double** @xx
%24 = load i32, i32* %5
%25 = sext i32 %24 to i64
%26 = getelementptr inbounds double, double* %23, i64 %25
%27 = load double, double* %26
%28 = load double, double* @rs
%29 = load double, double* %2
%30 = fneg double %28
%31 = call double @llvm.fmuladd.f64(double %30, double %29, double %27)
%32 = load double, double* @r1
%33 = fdiv double %31, %32
store double %33, double* %4
%34 = load double, double* %4
%35 = call double @pnorms(double %34)
%36 = load double, double* %3
%37 = call double @pnorms(double %36)
%38 = fsub double %35, %37
%39 = load double, double* %6
%40 = fmul double %39, %38
store double %40, double* %6
br label %41
41: ; preds = %11
%42 = load i32, i32* %5
%43 = add nsw i32 %42, 1
store i32 %43, i32* %5
br label %7
44: ; preds = %7
%45 = load double, double* %2
%46 = call double @phi(double %45)
%47 = load double, double* %6
%48 = fmul double %47, %46
store double %48, double* %6
%49 = load double, double* %6
ret double %49
}

LLVM IR (-O2):
@mm = external global i32
@ww = external global double*
@rs = external global double
@r1 = external global double
@xx = external global double*
define double @r_g(double %0) {
%2 = load i32, i32* @mm
%3 = icmp sgt i32 %2, 0
br i1 %3, label %4, label %28
4: ; preds = %1, %4
%5 = phi i64 [ %24, %4 ], [ 0, %1 ]
%6 = phi double [ %23, %4 ], [ 1.000000e+00, %1 ]
%7 = load double*, double** @ww
%8 = getelementptr inbounds double, double* %7, i64 %5
%9 = load double, double* %8
%10 = load double, double* @rs
%11 = fneg double %10
%12 = tail call double @llvm.fmuladd.f64(double %11, double %0, double %9)
%13 = load double, double* @r1
%14 = fdiv double %12, %13
%15 = load double*, double** @xx
%16 = getelementptr inbounds double, double* %15, i64 %5
%17 = load double, double* %16
%18 = tail call double @llvm.fmuladd.f64(double %11, double %0, double %17)
%19 = fdiv double %18, %13
%20 = tail call double @pnorms(double %19)
%21 = tail call double @pnorms(double %14)
%22 = fsub double %20, %21
%23 = fmul double %6, %22
%24 = add nuw nsw i64 %5, 1
%25 = load i32, i32* @mm
%26 = sext i32 %25 to i64
%27 = icmp slt i64 %24, %26
br i1 %27, label %4, label %28
28: ; preds = %4, %1
%29 = phi double [ 1.000000e+00, %1 ], [ %23, %4 ]
%30 = tail call double @phi(double %0)
%31 = fmul double %29, %30
ret double %31
}