#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 */
int /*<<< orphan*/ _Normal(double, double, double);
double _f(int /*<<< orphan*/);
double dgl32(double a, double b) {
  static double g[16] = {
      0.048307665687738316, 0.144471961582796494, 0.239287362252137075,
      0.331868602282127650, 0.421351276130635345, 0.506899908932229390,
      0.587715757240762329, 0.663044266930215201, 0.732182118740289680,
      0.794483795967942407, 0.849367613732569970, 0.896321155766052124,
      0.934906075937739690, 0.964762255587506431, 0.985611511545268335,
      0.997263861849481564};
  static double w[16] = {
      0.096540088514727801, 0.095638720079274859, 0.093844399080804566,
      0.091173878695763885, 0.087652093004403811, 0.083311924226946755,
      0.078193895787070306, 0.072345794108848506, 0.065822222776361847,
      0.058684093478535547, 0.050998059262376176, 0.042835898022226681,
      0.034273862913021433, 0.025392065309262059, 0.016274394730905671,
      0.007018610009470097};
  double s;
  int i, mflag;
  if (a == b)
    return 0.;
  mflag = 0;
  if (a > b) {
    mflag = 1;
    s = a;
    a = b;
    b = s;
  }
  for (i = 0, s = 0.; i < 16; i++)
    s += w[i] * (_f(_Normal(a, b, g[i])) + _f(_Normal(a, b, -g[i])));
  s *= ((b - a) / 2.);
  if (mflag)
    return -s;
  return s;
}


x86 assembly (clang, -O0):
<dgl32>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
movsd  %xmm0,-0x10(%rbp)
movsd  %xmm1,-0x18(%rbp)
movsd  -0x10(%rbp),%xmm0
ucomisd -0x18(%rbp),%xmm0
jne    1155 <dgl32+0x35>
jp     1155 <dgl32+0x35>
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x8(%rbp)
jmp    12b2 <dgl32+0x192>
movl   $0x0,-0x28(%rbp)
movsd  -0x10(%rbp),%xmm0
ucomisd -0x18(%rbp),%xmm0
jbe    1191 <dgl32+0x71>
movl   $0x1,-0x28(%rbp)
movsd  -0x10(%rbp),%xmm0
movsd  %xmm0,-0x20(%rbp)
movsd  -0x18(%rbp),%xmm0
movsd  %xmm0,-0x10(%rbp)
movsd  -0x20(%rbp),%xmm0
movsd  %xmm0,-0x18(%rbp)
movl   $0x0,-0x24(%rbp)
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x20(%rbp)
cmpl   $0x10,-0x24(%rbp)
jge    1258 <dgl32+0x138>
movslq -0x24(%rbp),%rcx
lea    0x2f0b(%rip),%rax
movsd  (%rax,%rcx,8),%xmm0
movsd  %xmm0,-0x30(%rbp)
movsd  -0x10(%rbp),%xmm0
movsd  -0x18(%rbp),%xmm1
movslq -0x24(%rbp),%rcx
lea    0x2e6c(%rip),%rax
movsd  (%rax,%rcx,8),%xmm2
call   1030 <_Normal@plt>
mov    %eax,%edi
call   1040 <_f@plt>
movsd  %xmm0,-0x38(%rbp)
movsd  -0x10(%rbp),%xmm0
movsd  -0x18(%rbp),%xmm1
movslq -0x24(%rbp),%rcx
lea    0x2e41(%rip),%rax
movsd  (%rax,%rcx,8),%xmm2
movq   %xmm2,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm2
call   1030 <_Normal@plt>
mov    %eax,%edi
call   1040 <_f@plt>
movsd  -0x38(%rbp),%xmm2
movaps %xmm0,%xmm1
movsd  -0x30(%rbp),%xmm0
addsd  %xmm1,%xmm2
movsd  -0x20(%rbp),%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x20(%rbp)
mov    -0x24(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x24(%rbp)
jmp    11a0 <dgl32+0x80>
movsd  -0x18(%rbp),%xmm0
subsd  -0x10(%rbp),%xmm0
movsd  0xd96(%rip),%xmm1
divsd  %xmm1,%xmm0
mulsd  -0x20(%rbp),%xmm0
movsd  %xmm0,-0x20(%rbp)
cmpl   $0x0,-0x28(%rbp)
je     12a8 <dgl32+0x188>
movsd  -0x20(%rbp),%xmm0
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
movsd  %xmm0,-0x8(%rbp)
jmp    12b2 <dgl32+0x192>
movsd  -0x20(%rbp),%xmm0
movsd  %xmm0,-0x8(%rbp)
movsd  -0x8(%rbp),%xmm0
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<dgl32>:
push   %r15
push   %r14
push   %rbx
sub    $0x50,%rsp
movapd %xmm0,%xmm2
xorpd  %xmm0,%xmm0
ucomisd %xmm1,%xmm2
jne    113d <dgl32+0x1d>
jnp    1224 <dgl32+0x104>
movapd %xmm1,%xmm0
minsd  %xmm2,%xmm0
movsd  %xmm0,0x8(%rsp)
movsd  %xmm2,0x20(%rsp)
movsd  %xmm1,0x28(%rsp)
maxsd  %xmm1,%xmm2
movapd %xmm2,0x10(%rsp)
xorpd  %xmm1,%xmm1
xor    %ebx,%ebx
lea    0xf32(%rip),%r14
lea    0xeab(%rip),%r15
cs nopw 0x0(%rax,%rax,1)
nop
movsd  %xmm1,0x38(%rsp)
movsd  (%rbx,%r15,1),%xmm2
movaps %xmm2,0x40(%rsp)
movsd  0x8(%rsp),%xmm0
movaps 0x10(%rsp),%xmm1
call   1030 <_Normal@plt>
mov    %eax,%edi
call   1040 <_f@plt>
movsd  %xmm0,0x30(%rsp)
movapd 0x40(%rsp),%xmm2
xorpd  0xe44(%rip),%xmm2
movsd  0x8(%rsp),%xmm0
movaps 0x10(%rsp),%xmm1
call   1030 <_Normal@plt>
mov    %eax,%edi
call   1040 <_f@plt>
movsd  0x38(%rsp),%xmm1
addsd  0x30(%rsp),%xmm0
mulsd  (%rbx,%r14,1),%xmm0
addsd  %xmm0,%xmm1
add    $0x8,%rbx
cmp    $0x80,%rbx
jne    1180 <dgl32+0x60>
movsd  0x20(%rsp),%xmm0
ucomisd 0x28(%rsp),%xmm0
movapd 0x10(%rsp),%xmm0
subsd  0x8(%rsp),%xmm0
mulsd  0xdfa(%rip),%xmm0
mulsd  %xmm1,%xmm0
jbe    1224 <dgl32+0x104>
xorpd  0xddc(%rip),%xmm0
add    $0x50,%rsp
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@dgl32.g = internal global [16 x double] [double 0x3FA8BBC8488CC499, double 0x3FC27E0EA717F237, double 0x3FCEA0F7E19C094B, double 0x3FD53D55CE57BDF6, double 0x3FDAF76B57C6F8F1, double 0x3FE038862866B29D, double 0x3FE2CE9146962CA4, double 0x3FE537A89C487F8A, double 0x3FE76E0931D693BA, double 0x3FE96C69481C4BC5, double 0x3FEB2E04FD686A13, double 0x3FECAEA9B4574CB9, double 0x3FEDEAC0259F7F42, double 0x3FEEDF5518053BAA, double 0x3FEF8A212714BCDC, double 0x3FEFE995E70409B6]
@dgl32.w = internal global [16 x double] [double 0x3FB8B6D9EAEC77AD, double 0x3FB87BC776F8C6D7, double 0x3FB8062FC0F6FEF9, double 0x3FB7572BDB3F6E51, double 0x3FB6705E18E13ED1, double 0x3FB553EE25EBEBC6, double 0x3FB40483E126FD14, double 0x3FB2854103B35E0C, double 0x3FB0D9B9A62CAC10, double 0x3FAE0BD76C924981, double 0x3FAA1C6AE961FBFA, double 0x3FA5EE963A335495, double 0x3FA18C5800A355D9, double 0x3F9A0060A8531FFA, double 0x3F90AA3C248696C9, double 0x3F7CBF8BC743CC5D]
define double @dgl32(double %0, double %1) {
%3 = alloca double
%4 = alloca double
%5 = alloca double
%6 = alloca double
%7 = alloca i32
%8 = alloca i32
store double %0, double* %4
store double %1, double* %5
%9 = load double, double* %4
%10 = load double, double* %5
%11 = fcmp oeq double %9, %10
br i1 %11, label %12, label %13
12: ; preds = %2
store double 0.000000e+00, double* %3
br label %67
13: ; preds = %2
store i32 0, i32* %8
%14 = load double, double* %4
%15 = load double, double* %5
%16 = fcmp ogt double %14, %15
br i1 %16, label %17, label %21
17: ; preds = %13
store i32 1, i32* %8
%18 = load double, double* %4
store double %18, double* %6
%19 = load double, double* %5
store double %19, double* %4
%20 = load double, double* %6
store double %20, double* %5
br label %21
21: ; preds = %17, %13
store i32 0, i32* %7
store double 0.000000e+00, double* %6
br label %22
22: ; preds = %50, %21
%23 = load i32, i32* %7
%24 = icmp slt i32 %23, 16
br i1 %24, label %25, label %53
25: ; preds = %22
%26 = load i32, i32* %7
%27 = sext i32 %26 to i64
%28 = getelementptr inbounds [16 x double], [16 x double]* @dgl32.w, i64 0, i64 %27
%29 = load double, double* %28
%30 = load double, double* %4
%31 = load double, double* %5
%32 = load i32, i32* %7
%33 = sext i32 %32 to i64
%34 = getelementptr inbounds [16 x double], [16 x double]* @dgl32.g, i64 0, i64 %33
%35 = load double, double* %34
%36 = call i32 @_Normal(double %30, double %31, double %35)
%37 = call double @_f(i32 %36)
%38 = load double, double* %4
%39 = load double, double* %5
%40 = load i32, i32* %7
%41 = sext i32 %40 to i64
%42 = getelementptr inbounds [16 x double], [16 x double]* @dgl32.g, i64 0, i64 %41
%43 = load double, double* %42
%44 = fneg double %43
%45 = call i32 @_Normal(double %38, double %39, double %44)
%46 = call double @_f(i32 %45)
%47 = fadd double %37, %46
%48 = load double, double* %6
%49 = call double @llvm.fmuladd.f64(double %29, double %47, double %48)
store double %49, double* %6
br label %50
50: ; preds = %25
%51 = load i32, i32* %7
%52 = add nsw i32 %51, 1
store i32 %52, i32* %7
br label %22
53: ; preds = %22
%54 = load double, double* %5
%55 = load double, double* %4
%56 = fsub double %54, %55
%57 = fdiv double %56, 2.000000e+00
%58 = load double, double* %6
%59 = fmul double %58, %57
store double %59, double* %6
%60 = load i32, i32* %8
%61 = icmp ne i32 %60, 0
br i1 %61, label %62, label %65
62: ; preds = %53
%63 = load double, double* %6
%64 = fneg double %63
store double %64, double* %3
br label %67
65: ; preds = %53
%66 = load double, double* %6
store double %66, double* %3
br label %67
67: ; preds = %65, %62, %12
%68 = load double, double* %3
ret double %68
}

LLVM IR (-O2):
@dgl32.g = internal unnamed_addr constant [16 x double] [double 0x3FA8BBC8488CC499, double 0x3FC27E0EA717F237, double 0x3FCEA0F7E19C094B, double 0x3FD53D55CE57BDF6, double 0x3FDAF76B57C6F8F1, double 0x3FE038862866B29D, double 0x3FE2CE9146962CA4, double 0x3FE537A89C487F8A, double 0x3FE76E0931D693BA, double 0x3FE96C69481C4BC5, double 0x3FEB2E04FD686A13, double 0x3FECAEA9B4574CB9, double 0x3FEDEAC0259F7F42, double 0x3FEEDF5518053BAA, double 0x3FEF8A212714BCDC, double 0x3FEFE995E70409B6]
@dgl32.w = internal unnamed_addr constant [16 x double] [double 0x3FB8B6D9EAEC77AD, double 0x3FB87BC776F8C6D7, double 0x3FB8062FC0F6FEF9, double 0x3FB7572BDB3F6E51, double 0x3FB6705E18E13ED1, double 0x3FB553EE25EBEBC6, double 0x3FB40483E126FD14, double 0x3FB2854103B35E0C, double 0x3FB0D9B9A62CAC10, double 0x3FAE0BD76C924981, double 0x3FAA1C6AE961FBFA, double 0x3FA5EE963A335495, double 0x3FA18C5800A355D9, double 0x3F9A0060A8531FFA, double 0x3F90AA3C248696C9, double 0x3F7CBF8BC743CC5D]
define double @dgl32(double %0, double %1) {
%3 = fcmp oeq double %0, %1
br i1 %3, label %30, label %4
4: ; preds = %2
%5 = fcmp ogt double %0, %1
%6 = select i1 %5, double %1, double %0
%7 = select i1 %5, double %0, double %1
br label %8
8: ; preds = %4, %8
%9 = phi i64 [ 0, %4 ], [ %22, %8 ]
%10 = phi double [ 0.000000e+00, %4 ], [ %21, %8 ]
%11 = getelementptr inbounds [16 x double], [16 x double]* @dgl32.w, i64 0, i64 %9
%12 = load double, double* %11
%13 = getelementptr inbounds [16 x double], [16 x double]* @dgl32.g, i64 0, i64 %9
%14 = load double, double* %13
%15 = tail call i32 @_Normal(double %6, double %7, double %14)
%16 = tail call double @_f(i32 %15)
%17 = fneg double %14
%18 = tail call i32 @_Normal(double %6, double %7, double %17)
%19 = tail call double @_f(i32 %18)
%20 = fadd double %16, %19
%21 = tail call double @llvm.fmuladd.f64(double %12, double %20, double %10)
%22 = add nuw nsw i64 %9, 1
%23 = icmp eq i64 %22, 16
br i1 %23, label %24, label %8
24: ; preds = %8
%25 = fsub double %7, %6
%26 = fmul double %25, 5.000000e-01
%27 = fmul double %26, %21
br i1 %5, label %28, label %30
28: ; preds = %24
%29 = fneg double %27
br label %30
30: ; preds = %24, %2, %28
%31 = phi double [ %29, %28 ], [ 0.000000e+00, %2 ], [ %27, %24 ]
ret double %31
}