#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 dgl20(double a, double b) {
  static double g[10] = {0.076526521133497333, 0.227785851141645078,
                         0.373706088715419561, 0.510867001950827098,
                         0.636053680726515025, 0.746331906460150793,
                         0.839116971822218823, 0.912234428251325906,
                         0.963971927277913791, 0.993128599185094925};
  static double w[10] = {0.152753387130725851, 0.149172986472603747,
                         0.142096109318382051, 0.131688638449176627,
                         0.118194531961518417, 0.101930119817240435,
                         0.083276741576704749, 0.062672048334109064,
                         0.040601429800386941, 0.017614007139152118};
  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 < 10; 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):
<dgl20>:
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 <dgl20+0x35>
jp     1155 <dgl20+0x35>
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x8(%rbp)
jmp    12b2 <dgl20+0x192>
movl   $0x0,-0x28(%rbp)
movsd  -0x10(%rbp),%xmm0
ucomisd -0x18(%rbp),%xmm0
jbe    1191 <dgl20+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   $0xa,-0x24(%rbp)
jge    1258 <dgl20+0x138>
movslq -0x24(%rbp),%rcx
lea    0x2edb(%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 <dgl20+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 <dgl20+0x188>
movsd  -0x20(%rbp),%xmm0
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
movsd  %xmm0,-0x8(%rbp)
jmp    12b2 <dgl20+0x192>
movsd  -0x20(%rbp),%xmm0
movsd  %xmm0,-0x8(%rbp)
movsd  -0x8(%rbp),%xmm0
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<dgl20>:
push   %r15
push   %r14
push   %rbx
sub    $0x50,%rsp
movapd %xmm0,%xmm2
xorpd  %xmm0,%xmm0
ucomisd %xmm1,%xmm2
jne    113d <dgl20+0x1d>
jnp    1221 <dgl20+0x101>
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    0xf02(%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    $0x50,%rbx
jne    1180 <dgl20+0x60>
movsd  0x20(%rsp),%xmm0
ucomisd 0x28(%rsp),%xmm0
movapd 0x10(%rsp),%xmm0
subsd  0x8(%rsp),%xmm0
mulsd  0xdfd(%rip),%xmm0
mulsd  %xmm1,%xmm0
jbe    1221 <dgl20+0x101>
xorpd  0xddf(%rip),%xmm0
add    $0x50,%rsp
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@dgl20.g = internal global [10 x double] [double 0x3FB3973DF98B86B0, double 0x3FCD281636928BC0, double 0x3FD7EACCF15652C4, double 0x3FE05905C13F7FF7, double 0x3FE45A8D3FA710DB, double 0x3FE7E1F37346A54E, double 0x3FEADA0BD5EFD6E7, double 0x3FED31064173FD92, double 0x3FEED8DBA7BD769F, double 0x3FEFC7B5A0C71CE0]
@dgl20.w = internal global [10 x double] [double 0x3FC38D6C490A3370, double 0x3FC31819B52C5992, double 0x3FC230348F34A535, double 0x3FC0DB2C5DB26DFF, double 0x3FBE41FF31573B48, double 0x3FBA1817A317A821, double 0x3FB5519FE196E24A, double 0x3FB00B467DF7E475, double 0x3FA4C9B5EA53B67F, double 0x3F9209680274E8AF]
define double @dgl20(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, 10
br i1 %24, label %25, label %53
25: ; preds = %22
%26 = load i32, i32* %7
%27 = sext i32 %26 to i64
%28 = getelementptr inbounds [10 x double], [10 x double]* @dgl20.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 [10 x double], [10 x double]* @dgl20.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 [10 x double], [10 x double]* @dgl20.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):
@dgl20.g = internal unnamed_addr constant [10 x double] [double 0x3FB3973DF98B86B0, double 0x3FCD281636928BC0, double 0x3FD7EACCF15652C4, double 0x3FE05905C13F7FF7, double 0x3FE45A8D3FA710DB, double 0x3FE7E1F37346A54E, double 0x3FEADA0BD5EFD6E7, double 0x3FED31064173FD92, double 0x3FEED8DBA7BD769F, double 0x3FEFC7B5A0C71CE0]
@dgl20.w = internal unnamed_addr constant [10 x double] [double 0x3FC38D6C490A3370, double 0x3FC31819B52C5992, double 0x3FC230348F34A535, double 0x3FC0DB2C5DB26DFF, double 0x3FBE41FF31573B48, double 0x3FBA1817A317A821, double 0x3FB5519FE196E24A, double 0x3FB00B467DF7E475, double 0x3FA4C9B5EA53B67F, double 0x3F9209680274E8AF]
define double @dgl20(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 [10 x double], [10 x double]* @dgl20.w, i64 0, i64 %9
%12 = load double, double* %11
%13 = getelementptr inbounds [10 x double], [10 x double]* @dgl20.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, 10
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
}