#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 der;
int /*<<< orphan*/ free(double *);
scalar_t__ malloc(int);
double phi(double);
double sqrt(int);
double sum;
double tem;
void r_emvndrh(int *m, double *w, double *x, double *rh, double *eps,
               double *deriv) {
  double r_grh(double), der, tem, sum;
  double romberg(double (*)(double), double, double, double);
  double pnorms(double), phi(double);
  int i, k;
  double *t;
  extern int mm;
  extern double *ww, *xx, rs, r1, r32;
  mm = *m;
  rs = sqrt(*rh);
  r1 = sqrt(1. - (*rh));
  r32 = r1 * (1. - (*rh));
  xx = (double *)malloc(mm * sizeof(double));
  ww = (double *)malloc(mm * sizeof(double));
  t = (double *)malloc(mm * sizeof(double));
  for (i = 0; i < mm; i++) {
    ww[i] = w[i];
    xx[i] = x[i];
  }
  if ((*rh) >= 0.)
    der = romberg(r_grh, -6., 6., *eps);
  else {
    for (i = 0; i < mm; i++)
      t[i] = pnorms(x[i]) - pnorms(w[i]);
    for (k = 0, sum = 0.; k < mm; k++) {
      for (i = 0, tem = 1.; i < mm; i++) {
        if (i != k) {
          tem *= t[i];
        } else
          tem *= (x[i] * phi(x[i]) - w[i] * phi(w[i]));
      }
      sum += tem;
    }
    der = .5 * sum;
  }
  free(xx);
  free(ww);
  free(t);
  *deriv = der;
}


x86 assembly (clang, -O0):
<r_emvndrh>:
push   %rbp
mov    %rsp,%rbp
sub    $0x80,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
mov    %r8,-0x28(%rbp)
mov    %r9,-0x30(%rbp)
mov    -0x8(%rbp),%rax
mov    (%rax),%ecx
mov    0x2e68(%rip),%rax
mov    %ecx,(%rax)
mov    -0x20(%rbp),%rax
cvttsd2si (%rax),%edi
call   1080 <sqrt@plt>
mov    0x2e0a(%rip),%rax
movsd  %xmm0,(%rax)
mov    -0x20(%rbp),%rax
movsd  0xe4a(%rip),%xmm0
subsd  (%rax),%xmm0
cvttsd2si %xmm0,%edi
call   1080 <sqrt@plt>
mov    0x2e26(%rip),%rax
movsd  %xmm0,(%rax)
mov    0x2e1b(%rip),%rax
movsd  (%rax),%xmm0
mov    -0x20(%rbp),%rax
movsd  0xe1b(%rip),%xmm1
subsd  (%rax),%xmm1
mulsd  %xmm1,%xmm0
mov    0x2dcc(%rip),%rax
movsd  %xmm0,(%rax)
mov    0x2df9(%rip),%rax
movslq (%rax),%rax
shl    $0x3,%rax
mov    %eax,%edi
call   1070 <malloc@plt>
mov    %rax,%rcx
mov    0x2db9(%rip),%rax
mov    %rcx,(%rax)
mov    0x2dd7(%rip),%rax
movslq (%rax),%rax
shl    $0x3,%rax
mov    %eax,%edi
call   1070 <malloc@plt>
mov    %rax,%rcx
mov    0x2d8f(%rip),%rax
mov    %rcx,(%rax)
mov    0x2db5(%rip),%rax
movslq (%rax),%rax
shl    $0x3,%rax
mov    %eax,%edi
call   1070 <malloc@plt>
mov    %rax,-0x58(%rbp)
movl   $0x0,-0x4c(%rbp)
mov    -0x4c(%rbp),%eax
mov    0x2d92(%rip),%rcx
cmp    (%rcx),%eax
jge    12bc <r_emvndrh+0x15c>
mov    -0x10(%rbp),%rax
movslq -0x4c(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
mov    0x2d46(%rip),%rax
mov    (%rax),%rax
movslq -0x4c(%rbp),%rcx
movsd  %xmm0,(%rax,%rcx,8)
mov    -0x18(%rbp),%rax
movslq -0x4c(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
mov    0x2d2e(%rip),%rax
mov    (%rax),%rax
movslq -0x4c(%rbp),%rcx
movsd  %xmm0,(%rax,%rcx,8)
mov    -0x4c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x4c(%rbp)
jmp    125c <r_emvndrh+0xfc>
mov    -0x20(%rbp),%rax
movsd  (%rax),%xmm0
xorps  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
jb     12ff <r_emvndrh+0x19f>
mov    -0x28(%rbp),%rax
movsd  (%rax),%xmm2
mov    0x2cd8(%rip),%rdi
movsd  0xd28(%rip),%xmm0
movsd  0xd28(%rip),%xmm1
call   1060 <romberg@plt>
movsd  %xmm0,-0x38(%rbp)
jmp    14a5 <r_emvndrh+0x345>
movl   $0x0,-0x4c(%rbp)
mov    -0x4c(%rbp),%eax
mov    0x2ce8(%rip),%rcx
cmp    (%rcx),%eax
jge    1368 <r_emvndrh+0x208>
mov    -0x18(%rbp),%rax
movslq -0x4c(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
call   1040 <pnorms@plt>
movsd  %xmm0,-0x60(%rbp)
mov    -0x10(%rbp),%rax
movslq -0x4c(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
call   1040 <pnorms@plt>
movaps %xmm0,%xmm1
movsd  -0x60(%rbp),%xmm0
subsd  %xmm1,%xmm0
mov    -0x58(%rbp),%rax
movslq -0x4c(%rbp),%rcx
movsd  %xmm0,(%rax,%rcx,8)
mov    -0x4c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x4c(%rbp)
jmp    1306 <r_emvndrh+0x1a6>
movl   $0x0,-0x50(%rbp)
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x48(%rbp)
mov    -0x50(%rbp),%eax
mov    0x2c77(%rip),%rcx
cmp    (%rcx),%eax
jge    1493 <r_emvndrh+0x333>
movl   $0x0,-0x4c(%rbp)
movsd  0xc68(%rip),%xmm0
movsd  %xmm0,-0x40(%rbp)
mov    -0x4c(%rbp),%eax
mov    0x2c51(%rip),%rcx
cmp    (%rcx),%eax
jge    1476 <r_emvndrh+0x316>
mov    -0x4c(%rbp),%eax
cmp    -0x50(%rbp),%eax
je     13d7 <r_emvndrh+0x277>
mov    -0x58(%rbp),%rax
movslq -0x4c(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
mulsd  -0x40(%rbp),%xmm0
movsd  %xmm0,-0x40(%rbp)
jmp    1463 <r_emvndrh+0x303>
mov    -0x18(%rbp),%rax
movslq -0x4c(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
movsd  %xmm0,-0x68(%rbp)
mov    -0x18(%rbp),%rax
movslq -0x4c(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
call   1050 <phi@plt>
movsd  %xmm0,-0x70(%rbp)
mov    -0x10(%rbp),%rax
movslq -0x4c(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
movsd  %xmm0,-0x78(%rbp)
mov    -0x10(%rbp),%rax
movslq -0x4c(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
call   1050 <phi@plt>
movsd  -0x78(%rbp),%xmm1
movsd  -0x70(%rbp),%xmm2
movaps %xmm0,%xmm3
movsd  -0x68(%rbp),%xmm0
mulsd  %xmm3,%xmm1
movq   %xmm1,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
mulsd  -0x40(%rbp),%xmm0
movsd  %xmm0,-0x40(%rbp)
jmp    1468 <r_emvndrh+0x308>
mov    -0x4c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x4c(%rbp)
jmp    139d <r_emvndrh+0x23d>
movsd  -0x40(%rbp),%xmm0
addsd  -0x48(%rbp),%xmm0
movsd  %xmm0,-0x48(%rbp)
mov    -0x50(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x50(%rbp)
jmp    1377 <r_emvndrh+0x217>
movsd  0xb6d(%rip),%xmm0
mulsd  -0x48(%rbp),%xmm0
movsd  %xmm0,-0x38(%rbp)
mov    0x2b24(%rip),%rax
mov    (%rax),%rdi
call   1030 <free@plt>
mov    0x2b0d(%rip),%rax
mov    (%rax),%rdi
call   1030 <free@plt>
mov    -0x58(%rbp),%rdi
call   1030 <free@plt>
movsd  -0x38(%rbp),%xmm0
mov    -0x30(%rbp),%rax
movsd  %xmm0,(%rax)
add    $0x80,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<r_emvndrh>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x38,%rsp
mov    %r9,0x10(%rsp)
mov    %r8,0x28(%rsp)
mov    %rcx,%rbx
mov    %rdx,%r15
mov    %rsi,%r13
mov    (%rdi),%eax
mov    0x2e6e(%rip),%r14
mov    %eax,(%r14)
cvttsd2si (%rcx),%edi
call   1080 <sqrt@plt>
mov    0x2e13(%rip),%rax
movsd  %xmm0,(%rax)
movsd  0xe57(%rip),%xmm0
subsd  (%rbx),%xmm0
cvttsd2si %xmm0,%edi
call   1080 <sqrt@plt>
mov    0x2e33(%rip),%rax
movsd  %xmm0,(%rax)
movsd  0xe37(%rip),%xmm1
subsd  (%rbx),%xmm1
mulsd  %xmm0,%xmm1
mov    0x2de8(%rip),%rax
movsd  %xmm1,(%rax)
mov    (%r14),%edi
shl    $0x3,%edi
call   1070 <malloc@plt>
mov    0x2de2(%rip),%rcx
mov    %rax,(%rcx)
mov    (%r14),%edi
shl    $0x3,%edi
call   1070 <malloc@plt>
mov    0x2dc5(%rip),%rbp
mov    %rax,0x0(%rbp)
mov    (%r14),%edi
shl    $0x3,%edi
call   1070 <malloc@plt>
mov    %rax,%r12
mov    (%r14),%eax
test   %eax,%eax
jle    12bf <r_emvndrh+0x15f>
mov    %rbx,0x8(%rsp)
mov    0x0(%rbp),%rcx
mov    0x2da0(%rip),%rbx
mov    (%rbx),%rdx
cmp    $0x4,%eax
jae    12e2 <r_emvndrh+0x182>
xor    %esi,%esi
mov    0x10(%rsp),%rbp
mov    0x8(%rsp),%r9
mov    %rsi,%rdi
not    %rdi
test   $0x1,%al
je     126d <r_emvndrh+0x10d>
movsd  0x0(%r13,%rsi,8),%xmm0
movsd  %xmm0,(%rcx,%rsi,8)
movsd  (%r15,%rsi,8),%xmm0
movsd  %xmm0,(%rdx,%rsi,8)
or     $0x1,%rsi
add    %rax,%rdi
je     146a <r_emvndrh+0x30a>
cs nopw 0x0(%rax,%rax,1)
movsd  0x0(%r13,%rsi,8),%xmm0
movsd  %xmm0,(%rcx,%rsi,8)
movsd  (%r15,%rsi,8),%xmm0
movsd  %xmm0,(%rdx,%rsi,8)
movsd  0x8(%r13,%rsi,8),%xmm0
movsd  %xmm0,0x8(%rcx,%rsi,8)
movsd  0x8(%r15,%rsi,8),%xmm0
movsd  %xmm0,0x8(%rdx,%rsi,8)
add    $0x2,%rsi
cmp    %rsi,%rax
jne    1280 <r_emvndrh+0x120>
jmp    146a <r_emvndrh+0x30a>
movsd  (%rbx),%xmm0
xorpd  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
mov    0x10(%rsp),%rbp
mov    0x2cf9(%rip),%rbx
jb     15ce <r_emvndrh+0x46e>
jmp    15a5 <r_emvndrh+0x445>
lea    (%rcx,%rax,8),%rsi
lea    (%rdx,%rax,8),%r11
lea    0x0(,%rax,8),%rbp
add    %r13,%rbp
lea    (%r15,%rax,8),%rdi
cmp    %r11,%rcx
setb   0x20(%rsp)
cmp    %rsi,%rdx
setb   0x30(%rsp)
cmp    %rbp,%rcx
setb   %r9b
cmp    %r13,%rsi
seta   0x18(%rsp)
cmp    %rdi,%rcx
setb   %r10b
cmp    %r15,%rsi
seta   0x7(%rsp)
cmp    %rbp,%rdx
setb   %r8b
cmp    %r13,%r11
seta   %bpl
cmp    %rdi,%rdx
setb   %dil
cmp    %r15,%r11
seta   %r11b
xor    %esi,%esi
mov    0x30(%rsp),%bl
test   %bl,0x20(%rsp)
jne    1623 <r_emvndrh+0x4c3>
mov    %r11b,0x20(%rsp)
mov    %ebp,%r11d
and    0x18(%rsp),%r9b
mov    0x10(%rsp),%rbp
jne    1628 <r_emvndrh+0x4c8>
and    0x7(%rsp),%r10b
mov    0x2c59(%rip),%rbx
jne    1243 <r_emvndrh+0xe3>
and    %r11b,%r8b
jne    1243 <r_emvndrh+0xe3>
and    0x20(%rsp),%dil
mov    0x8(%rsp),%r9
jne    1248 <r_emvndrh+0xe8>
mov    %eax,%esi
and    $0xfffffffc,%esi
lea    -0x4(%rsi),%rdi
mov    %rdi,%r8
shr    $0x2,%r8
add    $0x1,%r8
test   %rdi,%rdi
je     1425 <r_emvndrh+0x2c5>
mov    %r8,%rbx
and    $0xfffffffffffffffe,%rbx
xor    %edi,%edi
nopl   0x0(%rax,%rax,1)
movups 0x0(%r13,%rdi,8),%xmm0
movups 0x10(%r13,%rdi,8),%xmm1
movups %xmm0,(%rcx,%rdi,8)
movups %xmm1,0x10(%rcx,%rdi,8)
movups (%r15,%rdi,8),%xmm0
movups 0x10(%r15,%rdi,8),%xmm1
movups %xmm0,(%rdx,%rdi,8)
movups %xmm1,0x10(%rdx,%rdi,8)
movups 0x20(%r13,%rdi,8),%xmm0
movups 0x30(%r13,%rdi,8),%xmm1
movups %xmm0,0x20(%rcx,%rdi,8)
movups %xmm1,0x30(%rcx,%rdi,8)
movupd 0x20(%r15,%rdi,8),%xmm0
movupd 0x30(%r15,%rdi,8),%xmm1
movupd %xmm0,0x20(%rdx,%rdi,8)
movupd %xmm1,0x30(%rdx,%rdi,8)
add    $0x8,%rdi
add    $0xfffffffffffffffe,%rbx
jne    13c0 <r_emvndrh+0x260>
jmp    1427 <r_emvndrh+0x2c7>
xor    %edi,%edi
test   $0x1,%r8b
mov    0x2b9e(%rip),%rbx
je     1461 <r_emvndrh+0x301>
movups 0x0(%r13,%rdi,8),%xmm0
movups 0x10(%r13,%rdi,8),%xmm1
movups %xmm0,(%rcx,%rdi,8)
movups %xmm1,0x10(%rcx,%rdi,8)
movupd (%r15,%rdi,8),%xmm0
movupd 0x10(%r15,%rdi,8),%xmm1
movupd %xmm0,(%rdx,%rdi,8)
movupd %xmm1,0x10(%rdx,%rdi,8)
cmp    %rax,%rsi
jne    1248 <r_emvndrh+0xe8>
movsd  (%r9),%xmm0
xorpd  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
jae    15a5 <r_emvndrh+0x445>
test   %eax,%eax
jle    15ce <r_emvndrh+0x46e>
xor    %ebx,%ebx
nopw   0x0(%rax,%rax,1)
movsd  (%r15,%rbx,8),%xmm0
call   1040 <pnorms@plt>
movsd  %xmm0,0x28(%rsp)
movsd  0x0(%r13,%rbx,8),%xmm0
call   1040 <pnorms@plt>
movsd  0x28(%rsp),%xmm1
subsd  %xmm0,%xmm1
movsd  %xmm1,(%r12,%rbx,8)
add    $0x1,%rbx
movslq (%r14),%rax
cmp    %rax,%rbx
jl     1490 <r_emvndrh+0x330>
test   %eax,%eax
mov    0x2afe(%rip),%rbx
xorpd  %xmm1,%xmm1
jle    15ce <r_emvndrh+0x46e>
xorpd  %xmm1,%xmm1
xor    %ebp,%ebp
jmp    150c <r_emvndrh+0x3ac>
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
movsd  0xb08(%rip),%xmm3
addsd  %xmm3,%xmm1
add    $0x1,%rbp
movslq %eax,%rcx
cmp    %rcx,%rbp
jge    160d <r_emvndrh+0x4ad>
test   %eax,%eax
jle    14f0 <r_emvndrh+0x390>
xor    %ebx,%ebx
movsd  0xae6(%rip),%xmm3
movsd  %xmm1,0x18(%rsp)
jmp    1598 <r_emvndrh+0x438>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
movsd  (%r15,%rbp,8),%xmm0
movsd  %xmm0,0x8(%rsp)
movsd  %xmm3,0x28(%rsp)
call   1050 <phi@plt>
movsd  %xmm0,0x30(%rsp)
movsd  0x0(%r13,%rbp,8),%xmm0
movsd  %xmm0,0x20(%rsp)
call   1050 <phi@plt>
movsd  0x30(%rsp),%xmm2
movsd  0x18(%rsp),%xmm1
mulsd  0x20(%rsp),%xmm0
mulsd  0x8(%rsp),%xmm2
subsd  %xmm0,%xmm2
movsd  0x28(%rsp),%xmm3
mov    (%r14),%eax
mulsd  %xmm2,%xmm3
add    $0x1,%rbx
movslq %eax,%rcx
cmp    %rcx,%rbx
jge    14f8 <r_emvndrh+0x398>
cmp    %rbx,%rbp
je     1530 <r_emvndrh+0x3d0>
movsd  (%r12,%rbx,8),%xmm2
jmp    1584 <r_emvndrh+0x424>
mov    0x28(%rsp),%rax
movsd  (%rax),%xmm2
mov    0x2a03(%rip),%rdi
movsd  0xa4b(%rip),%xmm0
movsd  0xa4b(%rip),%xmm1
call   1060 <romberg@plt>
movapd %xmm0,%xmm1
movsd  %xmm1,0x18(%rsp)
mov    (%rbx),%rdi
call   1030 <free@plt>
mov    0x29e5(%rip),%rax
mov    (%rax),%rdi
call   1030 <free@plt>
mov    %r12,%rdi
call   1030 <free@plt>
movsd  0x18(%rsp),%xmm0
movsd  %xmm0,0x0(%rbp)
add    $0x38,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
mulsd  0xa03(%rip),%xmm1
mov    0x10(%rsp),%rbp
mov    0x29af(%rip),%rbx
jmp    15ce <r_emvndrh+0x46e>
mov    0x10(%rsp),%rbp
mov    0x29a1(%rip),%rbx
jmp    1243 <r_emvndrh+0xe3>

LLVM IR (-O0):
@mm = external global i32
@rs = external global double
@r1 = external global double
@r32 = external global double
@xx = external global double*
@ww = external global double*
@der = global double 0.000000e+00
@sum = global double 0.000000e+00
@tem = global double 0.000000e+00
define void @r_emvndrh(i32* %0, double* %1, double* %2, double* %3, double* %4, double* %5) {
%7 = alloca i32*
%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 i32
%17 = alloca i32
%18 = alloca double*
store i32* %0, i32** %7
store double* %1, double** %8
store double* %2, double** %9
store double* %3, double** %10
store double* %4, double** %11
store double* %5, double** %12
%19 = load i32*, i32** %7
%20 = load i32, i32* %19
store i32 %20, i32* @mm
%21 = load double*, double** %10
%22 = load double, double* %21
%23 = fptosi double %22 to i32
%24 = call double @sqrt(i32 %23)
store double %24, double* @rs
%25 = load double*, double** %10
%26 = load double, double* %25
%27 = fsub double 1.000000e+00, %26
%28 = fptosi double %27 to i32
%29 = call double @sqrt(i32 %28)
store double %29, double* @r1
%30 = load double, double* @r1
%31 = load double*, double** %10
%32 = load double, double* %31
%33 = fsub double 1.000000e+00, %32
%34 = fmul double %30, %33
store double %34, double* @r32
%35 = load i32, i32* @mm
%36 = sext i32 %35 to i64
%37 = mul i64 %36, 8
%38 = trunc i64 %37 to i32
%39 = call i64 @malloc(i32 %38)
%40 = inttoptr i64 %39 to double*
store double* %40, double** @xx
%41 = load i32, i32* @mm
%42 = sext i32 %41 to i64
%43 = mul i64 %42, 8
%44 = trunc i64 %43 to i32
%45 = call i64 @malloc(i32 %44)
%46 = inttoptr i64 %45 to double*
store double* %46, double** @ww
%47 = load i32, i32* @mm
%48 = sext i32 %47 to i64
%49 = mul i64 %48, 8
%50 = trunc i64 %49 to i32
%51 = call i64 @malloc(i32 %50)
%52 = inttoptr i64 %51 to double*
store double* %52, double** %18
store i32 0, i32* %16
br label %53
53: ; preds = %76, %6
%54 = load i32, i32* %16
%55 = load i32, i32* @mm
%56 = icmp slt i32 %54, %55
br i1 %56, label %57, label %79
57: ; preds = %53
%58 = load double*, double** %8
%59 = load i32, i32* %16
%60 = sext i32 %59 to i64
%61 = getelementptr inbounds double, double* %58, i64 %60
%62 = load double, double* %61
%63 = load double*, double** @ww
%64 = load i32, i32* %16
%65 = sext i32 %64 to i64
%66 = getelementptr inbounds double, double* %63, i64 %65
store double %62, double* %66
%67 = load double*, double** %9
%68 = load i32, i32* %16
%69 = sext i32 %68 to i64
%70 = getelementptr inbounds double, double* %67, i64 %69
%71 = load double, double* %70
%72 = load double*, double** @xx
%73 = load i32, i32* %16
%74 = sext i32 %73 to i64
%75 = getelementptr inbounds double, double* %72, i64 %74
store double %71, double* %75
br label %76
76: ; preds = %57
%77 = load i32, i32* %16
%78 = add nsw i32 %77, 1
store i32 %78, i32* %16
br label %53
79: ; preds = %53
%80 = load double*, double** %10
%81 = load double, double* %80
%82 = fcmp oge double %81, 0.000000e+00
br i1 %82, label %83, label %87
83: ; preds = %79
%84 = load double*, double** %11
%85 = load double, double* %84
%86 = call double @romberg(double (double)* @r_grh, double -6.000000e+00, double 6.000000e+00, double %85)
store double %86, double* %13
br label %177
87: ; preds = %79
store i32 0, i32* %16
br label %88
88: ; preds = %110, %87
%89 = load i32, i32* %16
%90 = load i32, i32* @mm
%91 = icmp slt i32 %89, %90
br i1 %91, label %92, label %113
92: ; preds = %88
%93 = load double*, double** %9
%94 = load i32, i32* %16
%95 = sext i32 %94 to i64
%96 = getelementptr inbounds double, double* %93, i64 %95
%97 = load double, double* %96
%98 = call double @pnorms(double %97)
%99 = load double*, double** %8
%100 = load i32, i32* %16
%101 = sext i32 %100 to i64
%102 = getelementptr inbounds double, double* %99, i64 %101
%103 = load double, double* %102
%104 = call double @pnorms(double %103)
%105 = fsub double %98, %104
%106 = load double*, double** %18
%107 = load i32, i32* %16
%108 = sext i32 %107 to i64
%109 = getelementptr inbounds double, double* %106, i64 %108
store double %105, double* %109
br label %110
110: ; preds = %92
%111 = load i32, i32* %16
%112 = add nsw i32 %111, 1
store i32 %112, i32* %16
br label %88
113: ; preds = %88
store i32 0, i32* %17
store double 0.000000e+00, double* %15
br label %114
114: ; preds = %171, %113
%115 = load i32, i32* %17
%116 = load i32, i32* @mm
%117 = icmp slt i32 %115, %116
br i1 %117, label %118, label %174
118: ; preds = %114
store i32 0, i32* %16
store double 1.000000e+00, double* %14
br label %119
119: ; preds = %164, %118
%120 = load i32, i32* %16
%121 = load i32, i32* @mm
%122 = icmp slt i32 %120, %121
br i1 %122, label %123, label %167
123: ; preds = %119
%124 = load i32, i32* %16
%125 = load i32, i32* %17
%126 = icmp ne i32 %124, %125
br i1 %126, label %127, label %135
127: ; preds = %123
%128 = load double*, double** %18
%129 = load i32, i32* %16
%130 = sext i32 %129 to i64
%131 = getelementptr inbounds double, double* %128, i64 %130
%132 = load double, double* %131
%133 = load double, double* %14
%134 = fmul double %133, %132
store double %134, double* %14
br label %163
135: ; preds = %123
%136 = load double*, double** %9
%137 = load i32, i32* %16
%138 = sext i32 %137 to i64
%139 = getelementptr inbounds double, double* %136, i64 %138
%140 = load double, double* %139
%141 = load double*, double** %9
%142 = load i32, i32* %16
%143 = sext i32 %142 to i64
%144 = getelementptr inbounds double, double* %141, i64 %143
%145 = load double, double* %144
%146 = call double @phi(double %145)
%147 = load double*, double** %8
%148 = load i32, i32* %16
%149 = sext i32 %148 to i64
%150 = getelementptr inbounds double, double* %147, i64 %149
%151 = load double, double* %150
%152 = load double*, double** %8
%153 = load i32, i32* %16
%154 = sext i32 %153 to i64
%155 = getelementptr inbounds double, double* %152, i64 %154
%156 = load double, double* %155
%157 = call double @phi(double %156)
%158 = fmul double %151, %157
%159 = fneg double %158
%160 = call double @llvm.fmuladd.f64(double %140, double %146, double %159)
%161 = load double, double* %14
%162 = fmul double %161, %160
store double %162, double* %14
br label %163
163: ; preds = %135, %127
br label %164
164: ; preds = %163
%165 = load i32, i32* %16
%166 = add nsw i32 %165, 1
store i32 %166, i32* %16
br label %119
167: ; preds = %119
%168 = load double, double* %14
%169 = load double, double* %15
%170 = fadd double %169, %168
store double %170, double* %15
br label %171
171: ; preds = %167
%172 = load i32, i32* %17
%173 = add nsw i32 %172, 1
store i32 %173, i32* %17
br label %114
174: ; preds = %114
%175 = load double, double* %15
%176 = fmul double 5.000000e-01, %175
store double %176, double* %13
br label %177
177: ; preds = %174, %83
%178 = load double*, double** @xx
%179 = call i32 @free(double* %178)
%180 = load double*, double** @ww
%181 = call i32 @free(double* %180)
%182 = load double*, double** %18
%183 = call i32 @free(double* %182)
%184 = load double, double* %13
%185 = load double*, double** %12
store double %184, double* %185
ret void
}

LLVM IR (-O2):
@mm = external global i32
@rs = external global double
@r1 = external global double
@r32 = external global double
@xx = external global double*
@ww = external global double*
@der = global double 0.000000e+00
@sum = global double 0.000000e+00
@tem = global double 0.000000e+00
define void @r_emvndrh(i32* nocapture %0, double* nocapture %1, double* nocapture %2, double* nocapture %3, double* nocapture %4, double* nocapture writeonly %5) {
%7 = load i32, i32* %0
store i32 %7, i32* @mm
%8 = load double, double* %3
%9 = fptosi double %8 to i32
%10 = tail call double @sqrt(i32 %9)
store double %10, double* @rs
%11 = load double, double* %3
%12 = fsub double 1.000000e+00, %11
%13 = fptosi double %12 to i32
%14 = tail call double @sqrt(i32 %13)
store double %14, double* @r1
%15 = load double, double* %3
%16 = fsub double 1.000000e+00, %15
%17 = fmul double %14, %16
store double %17, double* @r32
%18 = load i32, i32* @mm
%19 = shl i32 %18, 3
%20 = tail call i64 @malloc(i32 %19)
%21 = inttoptr i64 %20 to double*
store double* %21, double** @xx
%22 = load i32, i32* @mm
%23 = shl i32 %22, 3
%24 = tail call i64 @malloc(i32 %23)
%25 = inttoptr i64 %24 to double*
store double* %25, double** @ww
%26 = load i32, i32* @mm
%27 = shl i32 %26, 3
%28 = tail call i64 @malloc(i32 %27)
%29 = inttoptr i64 %28 to double*
%30 = load i32, i32* @mm
%31 = icmp sgt i32 %30, 0
br i1 %31, label %32, label %180
32: ; preds = %6
%33 = load double*, double** @ww
%34 = load double*, double** @xx
%35 = zext i32 %30 to i64
%36 = icmp ult i32 %30, 4
br i1 %36, label %143, label %37
37: ; preds = %32
%38 = getelementptr double, double* %33, i64 %35
%39 = getelementptr double, double* %34, i64 %35
%40 = getelementptr double, double* %1, i64 %35
%41 = getelementptr double, double* %2, i64 %35
%42 = icmp ult double* %33, %39
%43 = icmp ult double* %34, %38
%44 = and i1 %42, %43
%45 = icmp ult double* %33, %40
%46 = icmp ugt double* %38, %1
%47 = and i1 %45, %46
%48 = or i1 %44, %47
%49 = icmp ult double* %33, %41
%50 = icmp ugt double* %38, %2
%51 = and i1 %49, %50
%52 = or i1 %48, %51
%53 = icmp ult double* %34, %40
%54 = icmp ugt double* %39, %1
%55 = and i1 %53, %54
%56 = or i1 %52, %55
%57 = icmp ult double* %34, %41
%58 = icmp ugt double* %39, %2
%59 = and i1 %57, %58
%60 = or i1 %56, %59
br i1 %60, label %143, label %61
61: ; preds = %37
%62 = and i64 %35, 4294967292
%63 = add nsw i64 %62, -4
%64 = lshr exact i64 %63, 2
%65 = add nuw nsw i64 %64, 1
%66 = and i64 %65, 1
%67 = icmp eq i64 %63, 0
br i1 %67, label %117, label %68
68: ; preds = %61
%69 = and i64 %65, 9223372036854775806
br label %70
70: ; preds = %70, %68
%71 = phi i64 [ 0, %68 ], [ %114, %70 ]
%72 = phi i64 [ 0, %68 ], [ %115, %70 ]
%73 = getelementptr inbounds double, double* %1, i64 %71
%74 = bitcast double* %73 to <2 x double>*
%75 = load <2 x double>, <2 x double>* %74
%76 = getelementptr inbounds double, double* %73, i64 2
%77 = bitcast double* %76 to <2 x double>*
%78 = load <2 x double>, <2 x double>* %77
%79 = getelementptr inbounds double, double* %33, i64 %71
%80 = bitcast double* %79 to <2 x double>*
store <2 x double> %75, <2 x double>* %80
%81 = getelementptr inbounds double, double* %79, i64 2
%82 = bitcast double* %81 to <2 x double>*
store <2 x double> %78, <2 x double>* %82
%83 = getelementptr inbounds double, double* %2, i64 %71
%84 = bitcast double* %83 to <2 x double>*
%85 = load <2 x double>, <2 x double>* %84
%86 = getelementptr inbounds double, double* %83, i64 2
%87 = bitcast double* %86 to <2 x double>*
%88 = load <2 x double>, <2 x double>* %87
%89 = getelementptr inbounds double, double* %34, i64 %71
%90 = bitcast double* %89 to <2 x double>*
store <2 x double> %85, <2 x double>* %90
%91 = getelementptr inbounds double, double* %89, i64 2
%92 = bitcast double* %91 to <2 x double>*
store <2 x double> %88, <2 x double>* %92
%93 = or i64 %71, 4
%94 = getelementptr inbounds double, double* %1, i64 %93
%95 = bitcast double* %94 to <2 x double>*
%96 = load <2 x double>, <2 x double>* %95
%97 = getelementptr inbounds double, double* %94, i64 2
%98 = bitcast double* %97 to <2 x double>*
%99 = load <2 x double>, <2 x double>* %98
%100 = getelementptr inbounds double, double* %33, i64 %93
%101 = bitcast double* %100 to <2 x double>*
store <2 x double> %96, <2 x double>* %101
%102 = getelementptr inbounds double, double* %100, i64 2
%103 = bitcast double* %102 to <2 x double>*
store <2 x double> %99, <2 x double>* %103
%104 = getelementptr inbounds double, double* %2, i64 %93
%105 = bitcast double* %104 to <2 x double>*
%106 = load <2 x double>, <2 x double>* %105
%107 = getelementptr inbounds double, double* %104, i64 2
%108 = bitcast double* %107 to <2 x double>*
%109 = load <2 x double>, <2 x double>* %108
%110 = getelementptr inbounds double, double* %34, i64 %93
%111 = bitcast double* %110 to <2 x double>*
store <2 x double> %106, <2 x double>* %111
%112 = getelementptr inbounds double, double* %110, i64 2
%113 = bitcast double* %112 to <2 x double>*
store <2 x double> %109, <2 x double>* %113
%114 = add nuw i64 %71, 8
%115 = add i64 %72, 2
%116 = icmp eq i64 %115, %69
br i1 %116, label %117, label %70
117: ; preds = %70, %61
%118 = phi i64 [ 0, %61 ], [ %114, %70 ]
%119 = icmp eq i64 %66, 0
br i1 %119, label %141, label %120
120: ; preds = %117
%121 = getelementptr inbounds double, double* %1, i64 %118
%122 = bitcast double* %121 to <2 x double>*
%123 = load <2 x double>, <2 x double>* %122
%124 = getelementptr inbounds double, double* %121, i64 2
%125 = bitcast double* %124 to <2 x double>*
%126 = load <2 x double>, <2 x double>* %125
%127 = getelementptr inbounds double, double* %33, i64 %118
%128 = bitcast double* %127 to <2 x double>*
store <2 x double> %123, <2 x double>* %128
%129 = getelementptr inbounds double, double* %127, i64 2
%130 = bitcast double* %129 to <2 x double>*
store <2 x double> %126, <2 x double>* %130
%131 = getelementptr inbounds double, double* %2, i64 %118
%132 = bitcast double* %131 to <2 x double>*
%133 = load <2 x double>, <2 x double>* %132
%134 = getelementptr inbounds double, double* %131, i64 2
%135 = bitcast double* %134 to <2 x double>*
%136 = load <2 x double>, <2 x double>* %135
%137 = getelementptr inbounds double, double* %34, i64 %118
%138 = bitcast double* %137 to <2 x double>*
store <2 x double> %133, <2 x double>* %138
%139 = getelementptr inbounds double, double* %137, i64 2
%140 = bitcast double* %139 to <2 x double>*
store <2 x double> %136, <2 x double>* %140
br label %141
141: ; preds = %117, %120
%142 = icmp eq i64 %62, %35
br i1 %142, label %177, label %143
143: ; preds = %37, %32, %141
%144 = phi i64 [ 0, %37 ], [ 0, %32 ], [ %62, %141 ]
%145 = xor i64 %144, -1
%146 = and i64 %35, 1
%147 = icmp eq i64 %146, 0
br i1 %147, label %156, label %148
148: ; preds = %143
%149 = getelementptr inbounds double, double* %1, i64 %144
%150 = load double, double* %149
%151 = getelementptr inbounds double, double* %33, i64 %144
store double %150, double* %151
%152 = getelementptr inbounds double, double* %2, i64 %144
%153 = load double, double* %152
%154 = getelementptr inbounds double, double* %34, i64 %144
store double %153, double* %154
%155 = or i64 %144, 1
br label %156
156: ; preds = %148, %143
%157 = phi i64 [ %144, %143 ], [ %155, %148 ]
%158 = sub nsw i64 0, %35
%159 = icmp eq i64 %145, %158
br i1 %159, label %177, label %160
160: ; preds = %156, %160
%161 = phi i64 [ %175, %160 ], [ %157, %156 ]
%162 = getelementptr inbounds double, double* %1, i64 %161
%163 = load double, double* %162
%164 = getelementptr inbounds double, double* %33, i64 %161
store double %163, double* %164
%165 = getelementptr inbounds double, double* %2, i64 %161
%166 = load double, double* %165
%167 = getelementptr inbounds double, double* %34, i64 %161
store double %166, double* %167
%168 = add nuw nsw i64 %161, 1
%169 = getelementptr inbounds double, double* %1, i64 %168
%170 = load double, double* %169
%171 = getelementptr inbounds double, double* %33, i64 %168
store double %170, double* %171
%172 = getelementptr inbounds double, double* %2, i64 %168
%173 = load double, double* %172
%174 = getelementptr inbounds double, double* %34, i64 %168
store double %173, double* %174
%175 = add nuw nsw i64 %161, 2
%176 = icmp eq i64 %175, %35
br i1 %176, label %177, label %160
177: ; preds = %156, %160, %141
%178 = load double, double* %3
%179 = fcmp ult double %178, 0.000000e+00
br i1 %179, label %183, label %184
180: ; preds = %6
%181 = load double, double* %3
%182 = fcmp ult double %181, 0.000000e+00
br i1 %182, label %246, label %184
183: ; preds = %177
br i1 %31, label %189, label %246
184: ; preds = %180, %177
%185 = load double, double* %4
%186 = tail call double @romberg(double (double)* @r_grh, double -6.000000e+00, double 6.000000e+00, double %185)
br label %246
187: ; preds = %189
%188 = icmp sgt i32 %200, 0
br i1 %188, label %203, label %246
189: ; preds = %183, %189
%190 = phi i64 [ %199, %189 ], [ 0, %183 ]
%191 = getelementptr inbounds double, double* %2, i64 %190
%192 = load double, double* %191
%193 = tail call double @pnorms(double %192)
%194 = getelementptr inbounds double, double* %1, i64 %190
%195 = load double, double* %194
%196 = tail call double @pnorms(double %195)
%197 = fsub double %193, %196
%198 = getelementptr inbounds double, double* %29, i64 %190
store double %197, double* %198
%199 = add nuw nsw i64 %190, 1
%200 = load i32, i32* @mm
%201 = sext i32 %200 to i64
%202 = icmp slt i64 %199, %201
br i1 %202, label %189, label %187
203: ; preds = %187, %237
%204 = phi i32 [ %238, %237 ], [ %200, %187 ]
%205 = phi i64 [ %241, %237 ], [ 0, %187 ]
%206 = phi double [ %240, %237 ], [ 0.000000e+00, %187 ]
%207 = icmp sgt i32 %204, 0
br i1 %207, label %208, label %237
208: ; preds = %203
%209 = getelementptr inbounds double, double* %2, i64 %205
%210 = getelementptr inbounds double, double* %1, i64 %205
br label %211
211: ; preds = %208, %229
%212 = phi i32 [ %204, %208 ], [ %230, %229 ]
%213 = phi i32 [ %204, %208 ], [ %231, %229 ]
%214 = phi i64 [ 0, %208 ], [ %234, %229 ]
%215 = phi double [ 1.000000e+00, %208 ], [ %233, %229 ]
%216 = icmp eq i64 %214, %205
br i1 %216, label %220, label %217
217: ; preds = %211
%218 = getelementptr inbounds double, double* %29, i64 %214
%219 = load double, double* %218
br label %229
220: ; preds = %211
%221 = load double, double* %209
%222 = tail call double @phi(double %221)
%223 = load double, double* %210
%224 = tail call double @phi(double %223)
%225 = fneg double %223
%226 = fmul double %224, %225
%227 = tail call double @llvm.fmuladd.f64(double %221, double %222, double %226)
%228 = load i32, i32* @mm
br label %229
229: ; preds = %217, %220
%230 = phi i32 [ %212, %217 ], [ %228, %220 ]
%231 = phi i32 [ %213, %217 ], [ %228, %220 ]
%232 = phi double [ %219, %217 ], [ %227, %220 ]
%233 = fmul double %215, %232
%234 = add nuw nsw i64 %214, 1
%235 = sext i32 %231 to i64
%236 = icmp slt i64 %234, %235
br i1 %236, label %211, label %237
237: ; preds = %229, %203
%238 = phi i32 [ %204, %203 ], [ %230, %229 ]
%239 = phi double [ 1.000000e+00, %203 ], [ %233, %229 ]
%240 = fadd double %206, %239
%241 = add nuw nsw i64 %205, 1
%242 = sext i32 %238 to i64
%243 = icmp slt i64 %241, %242
br i1 %243, label %203, label %244
244: ; preds = %237
%245 = fmul double %240, 5.000000e-01
br label %246
246: ; preds = %180, %183, %187, %244, %184
%247 = phi double [ %186, %184 ], [ 0.000000e+00, %187 ], [ %245, %244 ], [ 0.000000e+00, %183 ], [ 0.000000e+00, %180 ]
%248 = load double*, double** @xx
%249 = tail call i32 @free(double* %248)
%250 = load double*, double** @ww
%251 = tail call i32 @free(double* %250)
%252 = tail call i32 @free(double* %29)
store double %247, double* %5
ret void
}