#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 */
scalar_t__ abs(double);
double deriv2(double *, int, int, double);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, ...);
double function(double *, int, int, double);
double pow(double, int);
int /*<<< orphan*/ scanf(char *, long *);
int /*<<< orphan*/ stdout;
double integ_trap(double *param, int dimension, int functiontype,
                  double *errorinteg, int conv, double extr_a, double extr_b) {
  double funz_extr_a;
  double funz_extr_b;
  double integ;
  int i;
  long int n;
  double base;
  fprintf(stdout, "Input The Number Of Intervals : ");
  scanf("%li", &n);
  double X[n];
  double Y[n];
  base = (extr_b - extr_a) / n;
  funz_extr_a = function(param, dimension, functiontype, extr_a);
  funz_extr_b = function(param, dimension, functiontype, extr_b);
  if (extr_b > extr_a) {
    X[0] = extr_a;
  }
  if (extr_b < extr_a) {
    X[0] = extr_b;
  }
  Y[0] = function(param, dimension, functiontype, X[0]);
  integ = base * (((funz_extr_b - funz_extr_a) / 2) + Y[0]);
  for (i = 1; i < n; i++) {
    X[i] = X[i - 1] + base;
    Y[i] = function(param, dimension, functiontype, X[i]);
    integ += base * Y[i];
    fprintf(stdout, " [*] %i : Integ = %lf\n", i, integ);
  }
  if (conv >= 8) {
    int diff;
    diff = (int)(abs(extr_b - extr_a)) * 1000;
    double x[diff];
    double dd[diff];
    double M;
    if (extr_a > extr_b) {
      x[0] = extr_a;
    }
    if (extr_b > extr_a) {
      x[0] = extr_b;
    }
    dd[0] = deriv2(param, dimension, functiontype, X[0]);
    M = dd[0];
    for (i = 1; i <= diff; i++) {
      x[i] = x[i - 1] + 0.001;
      dd[i] = deriv2(param, dimension, functiontype, x[i]);
      if (dd[i] > M) {
        M = dd[i];
      }
    }
    *errorinteg = ((pow((extr_b - extr_a), 3)) * M) / (12 * n * n);
  } else {
    *errorinteg = 0;
  }
  return integ;
}


x86 assembly (clang, -O0):
<integ_trap>:
push   %rbp
mov    %rsp,%rbp
sub    $0xc0,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %edx,-0x10(%rbp)
mov    %rcx,-0x18(%rbp)
mov    %r8d,-0x1c(%rbp)
movsd  %xmm0,-0x28(%rbp)
movsd  %xmm1,-0x30(%rbp)
mov    0x2e52(%rip),%rax
mov    (%rax),%edi
lea    0xe79(%rip),%rsi
xor    %eax,%eax
call   1050 <fprintf@plt>
lea    0xe8c(%rip),%rdi
lea    -0x58(%rbp),%rsi
call   1060 <scanf@plt>
mov    -0x58(%rbp),%rax
mov    %rsp,%rcx
mov    %rcx,-0x68(%rbp)
lea    0xf(,%rax,8),%rdx
and    $0xfffffffffffffff0,%rdx
mov    %rsp,%rcx
sub    %rdx,%rcx
mov    %rcx,-0xb0(%rbp)
mov    %rcx,%rsp
mov    %rax,-0x70(%rbp)
mov    -0x58(%rbp),%rax
lea    0xf(,%rax,8),%rdx
and    $0xfffffffffffffff0,%rdx
mov    %rsp,%rcx
sub    %rdx,%rcx
mov    %rcx,-0xa8(%rbp)
mov    %rcx,%rsp
mov    %rax,-0x78(%rbp)
movsd  -0x30(%rbp),%xmm0
subsd  -0x28(%rbp),%xmm0
cvtsi2sdq -0x58(%rbp),%xmm1
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x60(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%esi
mov    -0x10(%rbp),%edx
movsd  -0x28(%rbp),%xmm0
call   1070 <function@plt>
movsd  %xmm0,-0x38(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%esi
mov    -0x10(%rbp),%edx
movsd  -0x30(%rbp),%xmm0
call   1070 <function@plt>
movsd  %xmm0,-0x40(%rbp)
movsd  -0x30(%rbp),%xmm0
ucomisd -0x28(%rbp),%xmm0
jbe    1268 <integ_trap+0x108>
mov    -0xb0(%rbp),%rax
movsd  -0x28(%rbp),%xmm0
movsd  %xmm0,(%rax)
movsd  -0x30(%rbp),%xmm1
movsd  -0x28(%rbp),%xmm0
ucomisd %xmm1,%xmm0
jbe    128c <integ_trap+0x12c>
mov    -0xb0(%rbp),%rax
movsd  -0x30(%rbp),%xmm0
movsd  %xmm0,(%rax)
mov    -0xb0(%rbp),%rax
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%esi
mov    -0x10(%rbp),%edx
movsd  (%rax),%xmm0
call   1070 <function@plt>
mov    -0xa8(%rbp),%rax
movsd  %xmm0,(%rax)
movsd  -0x60(%rbp),%xmm0
movsd  -0x40(%rbp),%xmm1
subsd  -0x38(%rbp),%xmm1
movsd  0xd38(%rip),%xmm2
divsd  %xmm2,%xmm1
addsd  (%rax),%xmm1
mulsd  %xmm1,%xmm0
movsd  %xmm0,-0x48(%rbp)
movl   $0x1,-0x4c(%rbp)
movslq -0x4c(%rbp),%rax
cmp    -0x58(%rbp),%rax
jge    1386 <integ_trap+0x226>
mov    -0xb0(%rbp),%rax
mov    -0x4c(%rbp),%ecx
sub    $0x1,%ecx
movslq %ecx,%rcx
movsd  (%rax,%rcx,8),%xmm0
addsd  -0x60(%rbp),%xmm0
movslq -0x4c(%rbp),%rcx
movsd  %xmm0,(%rax,%rcx,8)
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%esi
mov    -0x10(%rbp),%edx
movslq -0x4c(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
call   1070 <function@plt>
mov    -0xa8(%rbp),%rax
movslq -0x4c(%rbp),%rcx
movsd  %xmm0,(%rax,%rcx,8)
movsd  -0x60(%rbp),%xmm0
movslq -0x4c(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm2
movsd  -0x48(%rbp),%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x48(%rbp)
mov    0x2c80(%rip),%rax
mov    (%rax),%edi
mov    -0x4c(%rbp),%edx
movsd  -0x48(%rbp),%xmm0
lea    0xcc4(%rip),%rsi
mov    $0x1,%al
call   1050 <fprintf@plt>
mov    -0x4c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x4c(%rbp)
jmp    12e0 <integ_trap+0x180>
cmpl   $0x8,-0x1c(%rbp)
jl     155c <integ_trap+0x3fc>
movsd  -0x30(%rbp),%xmm0
movsd  -0x28(%rbp),%xmm1
subsd  %xmm1,%xmm0
call   1030 <abs@plt>
imul   $0x3e8,%eax,%eax
mov    %eax,-0x7c(%rbp)
mov    -0x7c(%rbp),%eax
mov    %rsp,%rcx
mov    %rcx,-0x88(%rbp)
lea    0xf(,%rax,8),%rdx
and    $0xfffffffffffffff0,%rdx
mov    %rsp,%rcx
sub    %rdx,%rcx
mov    %rcx,-0xc0(%rbp)
mov    %rcx,%rsp
mov    %rax,-0x90(%rbp)
mov    -0x7c(%rbp),%eax
lea    0xf(,%rax,8),%rdx
and    $0xfffffffffffffff0,%rdx
mov    %rsp,%rcx
sub    %rdx,%rcx
mov    %rcx,-0xb8(%rbp)
mov    %rcx,%rsp
mov    %rax,-0x98(%rbp)
movsd  -0x28(%rbp),%xmm0
ucomisd -0x30(%rbp),%xmm0
jbe    1422 <integ_trap+0x2c2>
mov    -0xc0(%rbp),%rax
movsd  -0x28(%rbp),%xmm0
movsd  %xmm0,(%rax)
movsd  -0x30(%rbp),%xmm0
ucomisd -0x28(%rbp),%xmm0
jbe    1442 <integ_trap+0x2e2>
mov    -0xc0(%rbp),%rax
movsd  -0x30(%rbp),%xmm0
movsd  %xmm0,(%rax)
mov    -0xb0(%rbp),%rax
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%esi
mov    -0x10(%rbp),%edx
movsd  (%rax),%xmm0
call   1040 <deriv2@plt>
mov    -0xb8(%rbp),%rax
movsd  %xmm0,(%rax)
movsd  (%rax),%xmm0
movsd  %xmm0,-0xa0(%rbp)
ff
movl   $0x1,-0x4c(%rbp)
mov    -0x4c(%rbp),%eax
cmp    -0x7c(%rbp),%eax
jg     1516 <integ_trap+0x3b6>
mov    -0xc0(%rbp),%rax
mov    -0x4c(%rbp),%ecx
sub    $0x1,%ecx
movslq %ecx,%rcx
movsd  0xb6a(%rip),%xmm0
addsd  (%rax,%rcx,8),%xmm0
movslq -0x4c(%rbp),%rcx
movsd  %xmm0,(%rax,%rcx,8)
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%esi
mov    -0x10(%rbp),%edx
movslq -0x4c(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
call   1040 <deriv2@plt>
mov    -0xb8(%rbp),%rax
movslq -0x4c(%rbp),%rcx
movsd  %xmm0,(%rax,%rcx,8)
movslq -0x4c(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
ucomisd -0xa0(%rbp),%xmm0
ff
jbe    1503 <integ_trap+0x3a3>
mov    -0xb8(%rbp),%rax
movslq -0x4c(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
movsd  %xmm0,-0xa0(%rbp)
ff
jmp    1508 <integ_trap+0x3a8>
mov    -0x4c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x4c(%rbp)
jmp    147a <integ_trap+0x31a>
movsd  -0x30(%rbp),%xmm0
subsd  -0x28(%rbp),%xmm0
mov    $0x3,%edi
call   1080 <pow@plt>
mulsd  -0xa0(%rbp),%xmm0
ff
imul   $0xc,-0x58(%rbp),%rax
imul   -0x58(%rbp),%rax
cvtsi2sd %rax,%xmm1
divsd  %xmm1,%xmm0
mov    -0x18(%rbp),%rax
movsd  %xmm0,(%rax)
mov    -0x88(%rbp),%rax
mov    %rax,%rsp
jmp    1567 <integ_trap+0x407>
mov    -0x18(%rbp),%rax
xorps  %xmm0,%xmm0
movsd  %xmm0,(%rax)
movsd  -0x48(%rbp),%xmm0
mov    -0x68(%rbp),%rax
mov    %rax,%rsp
mov    %rbp,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<integ_trap>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x58,%rsp
movsd  %xmm1,(%rsp)
movsd  %xmm0,0x20(%rsp)
mov    %r8d,0x34(%rsp)
mov    %rcx,0x48(%rsp)
mov    %edx,%r15d
mov    %esi,%r13d
mov    %rdi,%rbp
mov    0x2e4d(%rip),%r12
mov    (%r12),%edi
lea    0xe72(%rip),%rsi
xor    %eax,%eax
call   1050 <fprintf@plt>
lea    0xe85(%rip),%rdi
lea    0x18(%rsp),%rsi
call   1060 <scanf@plt>
mov    %rsp,0x50(%rsp)
movsd  (%rsp),%xmm1
movsd  0x20(%rsp),%xmm0
subsd  %xmm0,%xmm1
cvtsi2sdq 0x18(%rsp),%xmm2
movsd  %xmm1,0x40(%rsp)
divsd  %xmm2,%xmm1
movsd  %xmm1,0x8(%rsp)
mov    %rbp,%rdi
mov    %r13d,%esi
mov    %r15d,%edx
call   1070 <function@plt>
movsd  %xmm0,0x28(%rsp)
mov    %rbp,%rdi
mov    %r13d,%esi
mov    %r15d,%edx
movsd  (%rsp),%xmm0
call   1070 <function@plt>
movsd  %xmm0,0x10(%rsp)
movsd  (%rsp),%xmm0
minsd  0x20(%rsp),%xmm0
mov    %rbp,%rdi
mov    %r13d,%esi
mov    %r15d,%edx
movsd  %xmm0,0x38(%rsp)
call   1070 <function@plt>
movsd  0x8(%rsp),%xmm1
movsd  0x10(%rsp),%xmm2
subsd  0x28(%rsp),%xmm2
mulsd  0xdb9(%rip),%xmm2
addsd  %xmm0,%xmm2
mulsd  %xmm1,%xmm2
cmpq   $0x2,0x18(%rsp)
movsd  %xmm2,0x10(%rsp)
jl     12c9 <integ_trap+0x169>
mov    $0x1,%ebx
lea    0xdcc(%rip),%r14
movsd  0x38(%rsp),%xmm0
nop
addsd  %xmm1,%xmm0
movsd  %xmm0,0x28(%rsp)
mov    %rbp,%rdi
mov    %r13d,%esi
mov    %r15d,%edx
call   1070 <function@plt>
mulsd  0x8(%rsp),%xmm0
movsd  0x10(%rsp),%xmm1
addsd  %xmm0,%xmm1
mov    (%r12),%edi
mov    %r14,%rsi
mov    %ebx,%edx
movsd  %xmm1,0x10(%rsp)
movapd %xmm1,%xmm0
mov    $0x1,%al
call   1050 <fprintf@plt>
movsd  0x28(%rsp),%xmm0
movsd  0x8(%rsp),%xmm1
add    $0x1,%rbx
cmp    %rbx,0x18(%rsp)
jg     1270 <integ_trap+0x110>
cmpl   $0x8,0x34(%rsp)
jl     1361 <integ_trap+0x201>
movsd  0x40(%rsp),%xmm0
call   1030 <abs@plt>
mov    %rax,%rbx
mov    %rsp,%r14
mov    %rbp,%rdi
mov    %r13d,%esi
mov    %r15d,%edx
movsd  0x38(%rsp),%xmm0
call   1040 <deriv2@plt>
test   %ebx,%ebx
jle    136f <integ_trap+0x20f>
movsd  (%rsp),%xmm1
maxsd  0x20(%rsp),%xmm1
imul   $0x3e8,%ebx,%eax
cmp    $0x2,%eax
mov    $0x1,%ebx
cmovge %eax,%ebx
nopl   0x0(%rax)
movsd  %xmm0,0x8(%rsp)
addsd  0xcda(%rip),%xmm1
movsd  %xmm1,(%rsp)
mov    %rbp,%rdi
mov    %r13d,%esi
mov    %r15d,%edx
movsd  (%rsp),%xmm0
call   1040 <deriv2@plt>
movapd %xmm0,%xmm2
movsd  (%rsp),%xmm1
maxsd  0x8(%rsp),%xmm2
movapd %xmm2,%xmm0
add    $0xffffffffffffffff,%rbx
jne    1320 <integ_trap+0x1c0>
jmp    1373 <integ_trap+0x213>
mov    0x48(%rsp),%rax
movq   $0x0,(%rax)
jmp    13b6 <integ_trap+0x256>
movapd %xmm0,%xmm2
movsd  %xmm2,(%rsp)
movsd  0x40(%rsp),%xmm0
mov    $0x3,%edi
call   1080 <pow@plt>
mulsd  (%rsp),%xmm0
mov    0x18(%rsp),%rax
imul   %rax,%rax
shl    $0x2,%rax
lea    (%rax,%rax,2),%rax
xorps  %xmm1,%xmm1
cvtsi2sd %rax,%xmm1
divsd  %xmm1,%xmm0
mov    0x48(%rsp),%rax
movsd  %xmm0,(%rax)
mov    %r14,%rsp
mov    0x50(%rsp),%rsp
movsd  0x10(%rsp),%xmm0
add    $0x58,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@stdout = global i32 0
@.str = [33 x i8] c"Input The Number Of Intervals : \00"
@.str.1 = [4 x i8] c"%li\00"
@.str.2 = [23 x i8] c" [*] %i : Integ = %lf\0A\00"
define double @integ_trap(double* %0, i32 %1, i32 %2, double* %3, i32 %4, double %5, double %6) {
%8 = alloca double*
%9 = alloca i32
%10 = alloca i32
%11 = alloca double*
%12 = alloca i32
%13 = alloca double
%14 = alloca double
%15 = alloca double
%16 = alloca double
%17 = alloca double
%18 = alloca i32
%19 = alloca i64
%20 = alloca double
%21 = alloca i8*
%22 = alloca i64
%23 = alloca i64
%24 = alloca i32
%25 = alloca i8*
%26 = alloca i64
%27 = alloca i64
%28 = alloca double
store double* %0, double** %8
store i32 %1, i32* %9
store i32 %2, i32* %10
store double* %3, double** %11
store i32 %4, i32* %12
store double %5, double* %13
store double %6, double* %14
%29 = load i32, i32* @stdout
%30 = call i32 (i32, i8*, ...) @fprintf(i32 %29, i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str, i64 0, i64 0))
%31 = call i32 @scanf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i64* %19)
%32 = load i64, i64* %19
%33 = call i8* @llvm.stacksave()
store i8* %33, i8** %21
%34 = alloca double, i64 %32
store i64 %32, i64* %22
%35 = load i64, i64* %19
%36 = alloca double, i64 %35
store i64 %35, i64* %23
%37 = load double, double* %14
%38 = load double, double* %13
%39 = fsub double %37, %38
%40 = load i64, i64* %19
%41 = sitofp i64 %40 to double
%42 = fdiv double %39, %41
store double %42, double* %20
%43 = load double*, double** %8
%44 = load i32, i32* %9
%45 = load i32, i32* %10
%46 = load double, double* %13
%47 = call double @function(double* %43, i32 %44, i32 %45, double %46)
store double %47, double* %15
%48 = load double*, double** %8
%49 = load i32, i32* %9
%50 = load i32, i32* %10
%51 = load double, double* %14
%52 = call double @function(double* %48, i32 %49, i32 %50, double %51)
store double %52, double* %16
%53 = load double, double* %14
%54 = load double, double* %13
%55 = fcmp ogt double %53, %54
br i1 %55, label %56, label %59
56: ; preds = %7
%57 = load double, double* %13
%58 = getelementptr inbounds double, double* %34, i64 0
store double %57, double* %58
br label %59
59: ; preds = %56, %7
%60 = load double, double* %14
%61 = load double, double* %13
%62 = fcmp olt double %60, %61
br i1 %62, label %63, label %66
63: ; preds = %59
%64 = load double, double* %14
%65 = getelementptr inbounds double, double* %34, i64 0
store double %64, double* %65
br label %66
66: ; preds = %63, %59
%67 = load double*, double** %8
%68 = load i32, i32* %9
%69 = load i32, i32* %10
%70 = getelementptr inbounds double, double* %34, i64 0
%71 = load double, double* %70
%72 = call double @function(double* %67, i32 %68, i32 %69, double %71)
%73 = getelementptr inbounds double, double* %36, i64 0
store double %72, double* %73
%74 = load double, double* %20
%75 = load double, double* %16
%76 = load double, double* %15
%77 = fsub double %75, %76
%78 = fdiv double %77, 2.000000e+00
%79 = getelementptr inbounds double, double* %36, i64 0
%80 = load double, double* %79
%81 = fadd double %78, %80
%82 = fmul double %74, %81
store double %82, double* %17
store i32 1, i32* %18
br label %83
83: ; preds = %121, %66
%84 = load i32, i32* %18
%85 = sext i32 %84 to i64
%86 = load i64, i64* %19
%87 = icmp slt i64 %85, %86
br i1 %87, label %88, label %124
88: ; preds = %83
%89 = load i32, i32* %18
%90 = sub nsw i32 %89, 1
%91 = sext i32 %90 to i64
%92 = getelementptr inbounds double, double* %34, i64 %91
%93 = load double, double* %92
%94 = load double, double* %20
%95 = fadd double %93, %94
%96 = load i32, i32* %18
%97 = sext i32 %96 to i64
%98 = getelementptr inbounds double, double* %34, i64 %97
store double %95, double* %98
%99 = load double*, double** %8
%100 = load i32, i32* %9
%101 = load i32, i32* %10
%102 = load i32, i32* %18
%103 = sext i32 %102 to i64
%104 = getelementptr inbounds double, double* %34, i64 %103
%105 = load double, double* %104
%106 = call double @function(double* %99, i32 %100, i32 %101, double %105)
%107 = load i32, i32* %18
%108 = sext i32 %107 to i64
%109 = getelementptr inbounds double, double* %36, i64 %108
store double %106, double* %109
%110 = load double, double* %20
%111 = load i32, i32* %18
%112 = sext i32 %111 to i64
%113 = getelementptr inbounds double, double* %36, i64 %112
%114 = load double, double* %113
%115 = load double, double* %17
%116 = call double @llvm.fmuladd.f64(double %110, double %114, double %115)
store double %116, double* %17
%117 = load i32, i32* @stdout
%118 = load i32, i32* %18
%119 = load double, double* %17
%120 = call i32 (i32, i8*, ...) @fprintf(i32 %117, i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.2, i64 0, i64 0), i32 %118, double %119)
br label %121
121: ; preds = %88
%122 = load i32, i32* %18
%123 = add nsw i32 %122, 1
store i32 %123, i32* %18
br label %83
124: ; preds = %83
%125 = load i32, i32* %12
%126 = icmp sge i32 %125, 8
br i1 %126, label %127, label %219
127: ; preds = %124
%128 = load double, double* %14
%129 = load double, double* %13
%130 = fsub double %128, %129
%131 = call i64 @abs(double %130)
%132 = trunc i64 %131 to i32
%133 = mul nsw i32 %132, 1000
store i32 %133, i32* %24
%134 = load i32, i32* %24
%135 = zext i32 %134 to i64
%136 = call i8* @llvm.stacksave()
store i8* %136, i8** %25
%137 = alloca double, i64 %135
store i64 %135, i64* %26
%138 = load i32, i32* %24
%139 = zext i32 %138 to i64
%140 = alloca double, i64 %139
store i64 %139, i64* %27
%141 = load double, double* %13
%142 = load double, double* %14
%143 = fcmp ogt double %141, %142
br i1 %143, label %144, label %147
144: ; preds = %127
%145 = load double, double* %13
%146 = getelementptr inbounds double, double* %137, i64 0
store double %145, double* %146
br label %147
147: ; preds = %144, %127
%148 = load double, double* %14
%149 = load double, double* %13
%150 = fcmp ogt double %148, %149
br i1 %150, label %151, label %154
151: ; preds = %147
%152 = load double, double* %14
%153 = getelementptr inbounds double, double* %137, i64 0
store double %152, double* %153
br label %154
154: ; preds = %151, %147
%155 = load double*, double** %8
%156 = load i32, i32* %9
%157 = load i32, i32* %10
%158 = getelementptr inbounds double, double* %34, i64 0
%159 = load double, double* %158
%160 = call double @deriv2(double* %155, i32 %156, i32 %157, double %159)
%161 = getelementptr inbounds double, double* %140, i64 0
store double %160, double* %161
%162 = getelementptr inbounds double, double* %140, i64 0
%163 = load double, double* %162
store double %163, double* %28
store i32 1, i32* %18
br label %164
164: ; preds = %201, %154
%165 = load i32, i32* %18
%166 = load i32, i32* %24
%167 = icmp sle i32 %165, %166
br i1 %167, label %168, label %204
168: ; preds = %164
%169 = load i32, i32* %18
%170 = sub nsw i32 %169, 1
%171 = sext i32 %170 to i64
%172 = getelementptr inbounds double, double* %137, i64 %171
%173 = load double, double* %172
%174 = fadd double %173, 1.000000e-03
%175 = load i32, i32* %18
%176 = sext i32 %175 to i64
%177 = getelementptr inbounds double, double* %137, i64 %176
store double %174, double* %177
%178 = load double*, double** %8
%179 = load i32, i32* %9
%180 = load i32, i32* %10
%181 = load i32, i32* %18
%182 = sext i32 %181 to i64
%183 = getelementptr inbounds double, double* %137, i64 %182
%184 = load double, double* %183
%185 = call double @deriv2(double* %178, i32 %179, i32 %180, double %184)
%186 = load i32, i32* %18
%187 = sext i32 %186 to i64
%188 = getelementptr inbounds double, double* %140, i64 %187
store double %185, double* %188
%189 = load i32, i32* %18
%190 = sext i32 %189 to i64
%191 = getelementptr inbounds double, double* %140, i64 %190
%192 = load double, double* %191
%193 = load double, double* %28
%194 = fcmp ogt double %192, %193
br i1 %194, label %195, label %200
195: ; preds = %168
%196 = load i32, i32* %18
%197 = sext i32 %196 to i64
%198 = getelementptr inbounds double, double* %140, i64 %197
%199 = load double, double* %198
store double %199, double* %28
br label %200
200: ; preds = %195, %168
br label %201
201: ; preds = %200
%202 = load i32, i32* %18
%203 = add nsw i32 %202, 1
store i32 %203, i32* %18
br label %164
204: ; preds = %164
%205 = load double, double* %14
%206 = load double, double* %13
%207 = fsub double %205, %206
%208 = call double @pow(double %207, i32 3)
%209 = load double, double* %28
%210 = fmul double %208, %209
%211 = load i64, i64* %19
%212 = mul nsw i64 12, %211
%213 = load i64, i64* %19
%214 = mul nsw i64 %212, %213
%215 = sitofp i64 %214 to double
%216 = fdiv double %210, %215
%217 = load double*, double** %11
store double %216, double* %217
%218 = load i8*, i8** %25
br label %221
219: ; preds = %124
%220 = load double*, double** %11
store double 0.000000e+00, double* %220
br label %221
221: ; preds = %219, %204
%222 = load double, double* %17
%223 = load i8*, i8** %21
ret double %222
}

LLVM IR (-O2):
@stdout = global i32 0
@.str = [33 x i8] c"Input The Number Of Intervals : \00"
@.str.1 = [4 x i8] c"%li\00"
@.str.2 = [23 x i8] c" [*] %i : Integ = %lf\0A\00"
define double @integ_trap(double* %0, i32 %1, i32 %2, double* nocapture writeonly %3, i32 %4, double %5, double %6) {
%8 = alloca i64
%9 = bitcast i64* %8 to i8*
%10 = load i32, i32* @stdout
%11 = tail call i32 (i32, i8*, ...) @fprintf(i32 %10, i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str, i64 0, i64 0))
%12 = call i32 @scanf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i64* %8)
%13 = call i8* @llvm.stacksave()
%14 = load i64, i64* %8
%15 = fsub double %6, %5
%16 = sitofp i64 %14 to double
%17 = fdiv double %15, %16
%18 = call double @function(double* %0, i32 %1, i32 %2, double %5)
%19 = call double @function(double* %0, i32 %1, i32 %2, double %6)
%20 = fcmp ogt double %6, %5
%21 = fcmp olt double %6, %5
%22 = select i1 %21, double %6, double %5
%23 = call double @function(double* %0, i32 %1, i32 %2, double %22)
%24 = fsub double %19, %18
%25 = fmul double %24, 5.000000e-01
%26 = fadd double %25, %23
%27 = fmul double %17, %26
%28 = load i64, i64* %8
%29 = icmp sgt i64 %28, 1
br i1 %29, label %30, label %43
30: ; preds = %7, %30
%31 = phi double [ %34, %30 ], [ %22, %7 ]
%32 = phi i64 [ %40, %30 ], [ 1, %7 ]
%33 = phi double [ %36, %30 ], [ %27, %7 ]
%34 = fadd double %17, %31
%35 = call double @function(double* %0, i32 %1, i32 %2, double %34)
%36 = call double @llvm.fmuladd.f64(double %17, double %35, double %33)
%37 = load i32, i32* @stdout
%38 = trunc i64 %32 to i32
%39 = call i32 (i32, i8*, ...) @fprintf(i32 %37, i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.2, i64 0, i64 0), i32 %38, double %36)
%40 = add nuw nsw i64 %32, 1
%41 = load i64, i64* %8
%42 = icmp sgt i64 %41, %40
br i1 %42, label %30, label %43
43: ; preds = %30, %7
%44 = phi double [ %27, %7 ], [ %36, %30 ]
%45 = icmp sgt i32 %4, 7
br i1 %45, label %46, label %77
46: ; preds = %43
%47 = call i64 @abs(double %15)
%48 = trunc i64 %47 to i32
%49 = call i8* @llvm.stacksave()
%50 = call double @deriv2(double* %0, i32 %1, i32 %2, double %22)
%51 = icmp slt i32 %48, 1
br i1 %51, label %68, label %52
52: ; preds = %46
%53 = select i1 %20, double %6, double %5
%54 = mul i32 %48, 1000
%55 = call i32 @llvm.smax.i32(i32 %54, i32 1)
%56 = add nuw nsw i32 %55, 1
%57 = zext i32 %56 to i64
br label %58
58: ; preds = %52, %58
%59 = phi double [ %53, %52 ], [ %62, %58 ]
%60 = phi i64 [ 1, %52 ], [ %66, %58 ]
%61 = phi double [ %50, %52 ], [ %65, %58 ]
%62 = fadd double %59, 1.000000e-03
%63 = call double @deriv2(double* %0, i32 %1, i32 %2, double %62)
%64 = fcmp ogt double %63, %61
%65 = select i1 %64, double %63, double %61
%66 = add nuw nsw i64 %60, 1
%67 = icmp eq i64 %66, %57
br i1 %67, label %68, label %58
68: ; preds = %58, %46
%69 = phi double [ %50, %46 ], [ %65, %58 ]
%70 = call double @pow(double %15, i32 3)
%71 = fmul double %69, %70
%72 = load i64, i64* %8
%73 = mul nsw i64 %72, 12
%74 = mul nsw i64 %73, %72
%75 = sitofp i64 %74 to double
%76 = fdiv double %71, %75
store double %76, double* %3
br label %78
77: ; preds = %43
store double 0.000000e+00, double* %3
br label %78
78: ; preds = %77, %68
ret double %44
}