#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 abs(double);
double deriv4(double *, int, int, double);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *);
double function(double *, int, int, double);
int pow(long, int);
int /*<<< orphan*/ scanf(char *, long *);
int /*<<< orphan*/ stdout;
double integ_cav_simpson(double *param, int dimension, int functiontype,
                         double *errorinteg, int conv, double extr_a,
                         double extr_b) {
  double integ;
  int i;
  long int n;
  double base;
  double odd_sum;
  double even_sum;
  fprintf(stdout, "Input The Number Of Intervals : ");
  scanf("%li", &n);
  double X[2 * n];
  double Y[2 * n];
  base = abs((extr_b - extr_a)) / (2 * n);
  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]);
  for (i = 1; i <= (2 * n); i++) {
    X[i] = X[i - 1] + base;
    Y[i] = X[i] * X[i] * X[i];
  }
  odd_sum = 0;
  for (i = 1; i <= (2 * n - 1); i += 2) {
    odd_sum += Y[i];
  }
  even_sum = 0;
  for (i = 2; i <= (2 * n - 2); i += 2) {
    even_sum += Y[i];
  }
  integ = (2 * base / 6) * (Y[0] + Y[2 * n] + 2 * odd_sum + 4 * even_sum);
  if (conv == 9) {
    int diff;
    diff = (int)(abs(extr_b - extr_a)) * 1000;
    double x[diff];
    double d_q[diff];
    double M;
    if (extr_a > extr_b) {
      x[0] = extr_a;
    }
    if (extr_b > extr_a) {
      x[0] = extr_b;
    }
    d_q[0] = deriv4(param, dimension, functiontype, x[0]);
    M = d_q[0];
    for (i = 1; i <= diff; i++) {
      x[i] = x[i - 1] + 0.001;
      d_q[i] = deriv4(param, dimension, functiontype, x[i]);
      if (d_q[i] > M) {
        M = d_q[i];
      }
    }
    *errorinteg = (pow((extr_b - extr_a), 5) * M) / (2880 * (pow(n, 4)));
  } else {
    *errorinteg = 0;
  }
  return integ;
}


x86 assembly (clang, -O0):
<integ_cav_simpson>:
push   %rbp
mov    %rsp,%rbp
sub    $0xd0,%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    0xe89(%rip),%rsi
call   1050 <fprintf@plt>
lea    0xe9e(%rip),%rdi
lea    -0x48(%rbp),%rsi
call   1060 <scanf@plt>
mov    -0x48(%rbp),%rdx
mov    %rdx,%rax
add    %rax,%rax
mov    %rsp,%rcx
mov    %rcx,-0x68(%rbp)
shl    $0x4,%rdx
mov    %rsp,%rcx
sub    %rdx,%rcx
mov    %rcx,-0xb0(%rbp)
mov    %rcx,%rsp
mov    %rax,-0x70(%rbp)
mov    -0x48(%rbp),%rdx
mov    %rdx,%rax
add    %rax,%rax
shl    $0x4,%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
call   1030 <abs@plt>
cltq
mov    -0x48(%rbp),%rcx
shl    $0x1,%rcx
cqto
idiv   %rcx
cvtsi2sd %rax,%xmm0
movsd  %xmm0,-0x50(%rbp)
movsd  -0x30(%rbp),%xmm0
ucomisd -0x28(%rbp),%xmm0
jbe    123f <integ_cav_simpson+0xdf>
mov    -0xb0(%rbp),%rax
movsd  -0x28(%rbp),%xmm0
movsd  %xmm0,(%rax)
movsd  -0x30(%rbp),%xmm1
movsd  -0x28(%rbp),%xmm0
ucomisd %xmm1,%xmm0
jbe    1263 <integ_cav_simpson+0x103>
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)
movl   $0x1,-0x3c(%rbp)
movslq -0x3c(%rbp),%rax
mov    -0x48(%rbp),%rcx
shl    $0x1,%rcx
cmp    %rcx,%rax
jg     1300 <integ_cav_simpson+0x1a0>
mov    -0xa8(%rbp),%rax
mov    -0xb0(%rbp),%rcx
mov    -0x3c(%rbp),%edx
sub    $0x1,%edx
movslq %edx,%rdx
movsd  (%rcx,%rdx,8),%xmm0
addsd  -0x50(%rbp),%xmm0
movslq -0x3c(%rbp),%rdx
movsd  %xmm0,(%rcx,%rdx,8)
movslq -0x3c(%rbp),%rdx
movsd  (%rcx,%rdx,8),%xmm0
movslq -0x3c(%rbp),%rdx
mulsd  (%rcx,%rdx,8),%xmm0
movslq -0x3c(%rbp),%rdx
mulsd  (%rcx,%rdx,8),%xmm0
movslq -0x3c(%rbp),%rcx
movsd  %xmm0,(%rax,%rcx,8)
mov    -0x3c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x3c(%rbp)
jmp    128f <integ_cav_simpson+0x12f>
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x58(%rbp)
movl   $0x1,-0x3c(%rbp)
movslq -0x3c(%rbp),%rax
mov    -0x48(%rbp),%rcx
shl    $0x1,%rcx
sub    $0x1,%rcx
cmp    %rcx,%rax
jg     1350 <integ_cav_simpson+0x1f0>
mov    -0xa8(%rbp),%rax
movslq -0x3c(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
addsd  -0x58(%rbp),%xmm0
movsd  %xmm0,-0x58(%rbp)
mov    -0x3c(%rbp),%eax
add    $0x2,%eax
mov    %eax,-0x3c(%rbp)
jmp    130f <integ_cav_simpson+0x1af>
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x60(%rbp)
movl   $0x2,-0x3c(%rbp)
movslq -0x3c(%rbp),%rax
mov    -0x48(%rbp),%rcx
shl    $0x1,%rcx
sub    $0x2,%rcx
cmp    %rcx,%rax
jg     13a0 <integ_cav_simpson+0x240>
mov    -0xa8(%rbp),%rax
movslq -0x3c(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
addsd  -0x60(%rbp),%xmm0
movsd  %xmm0,-0x60(%rbp)
mov    -0x3c(%rbp),%eax
add    $0x2,%eax
mov    %eax,-0x3c(%rbp)
jmp    135f <integ_cav_simpson+0x1ff>
mov    -0xa8(%rbp),%rax
movsd  0xc61(%rip),%xmm0
mulsd  -0x50(%rbp),%xmm0
movsd  0xc4c(%rip),%xmm1
divsd  %xmm1,%xmm0
movsd  (%rax),%xmm1
mov    -0x48(%rbp),%rcx
shl    $0x1,%rcx
addsd  (%rax,%rcx,8),%xmm1
movsd  -0x58(%rbp),%xmm2
addsd  %xmm2,%xmm2
addsd  %xmm1,%xmm2
movsd  -0x60(%rbp),%xmm1
movsd  0xc15(%rip),%xmm3
mulsd  %xmm3,%xmm1
addsd  %xmm2,%xmm1
mulsd  %xmm1,%xmm0
movsd  %xmm0,-0x38(%rbp)
cmpl   $0x9,-0x1c(%rbp)
jne    15f4 <integ_cav_simpson+0x494>
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    1498 <integ_cav_simpson+0x338>
mov    -0xc0(%rbp),%rax
movsd  -0x28(%rbp),%xmm0
movsd  %xmm0,(%rax)
movsd  -0x30(%rbp),%xmm0
ucomisd -0x28(%rbp),%xmm0
jbe    14b8 <integ_cav_simpson+0x358>
mov    -0xc0(%rbp),%rax
movsd  -0x30(%rbp),%xmm0
movsd  %xmm0,(%rax)
mov    -0xc0(%rbp),%rax
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%esi
mov    -0x10(%rbp),%edx
movsd  (%rax),%xmm0
call   1040 <deriv4@plt>
mov    -0xb8(%rbp),%rax
movsd  %xmm0,(%rax)
movsd  (%rax),%xmm0
movsd  %xmm0,-0xa0(%rbp)
ff
movl   $0x1,-0x3c(%rbp)
mov    -0x3c(%rbp),%eax
cmp    -0x7c(%rbp),%eax
jg     158c <integ_cav_simpson+0x42c>
mov    -0xc0(%rbp),%rax
mov    -0x3c(%rbp),%ecx
sub    $0x1,%ecx
movslq %ecx,%rcx
movsd  0xb04(%rip),%xmm0
addsd  (%rax,%rcx,8),%xmm0
movslq -0x3c(%rbp),%rcx
movsd  %xmm0,(%rax,%rcx,8)
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%esi
mov    -0x10(%rbp),%edx
movslq -0x3c(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
call   1040 <deriv4@plt>
mov    -0xb8(%rbp),%rax
movslq -0x3c(%rbp),%rcx
movsd  %xmm0,(%rax,%rcx,8)
movslq -0x3c(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
ucomisd -0xa0(%rbp),%xmm0
ff
jbe    1579 <integ_cav_simpson+0x419>
mov    -0xb8(%rbp),%rax
movslq -0x3c(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
movsd  %xmm0,-0xa0(%rbp)
ff
jmp    157e <integ_cav_simpson+0x41e>
mov    -0x3c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x3c(%rbp)
jmp    14f0 <integ_cav_simpson+0x390>
movsd  -0x30(%rbp),%xmm0
subsd  -0x28(%rbp),%xmm0
cvttsd2si %xmm0,%rdi
mov    $0x5,%esi
call   1080 <pow@plt>
cvtsi2sd %eax,%xmm0
mulsd  -0xa0(%rbp),%xmm0
ff
movsd  %xmm0,-0xc8(%rbp)
ff
mov    -0x48(%rbp),%rdi
mov    $0x4,%esi
call   1080 <pow@plt>
movsd  -0xc8(%rbp),%xmm0
ff
imul   $0xb40,%eax,%eax
cvtsi2sd %eax,%xmm1
divsd  %xmm1,%xmm0
mov    -0x18(%rbp),%rax
movsd  %xmm0,(%rax)
mov    -0x88(%rbp),%rax
mov    %rax,%rsp
jmp    15ff <integ_cav_simpson+0x49f>
mov    -0x18(%rbp),%rax
xorps  %xmm0,%xmm0
movsd  %xmm0,(%rax)
movsd  -0x38(%rbp),%xmm0
mov    -0x68(%rbp),%rax
mov    %rax,%rsp
mov    %rbp,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<integ_cav_simpson>:
push   %rbp
mov    %rsp,%rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x58,%rsp
movsd  %xmm1,-0x30(%rbp)
movsd  %xmm0,-0x38(%rbp)
mov    %r8d,%ebx
mov    %rcx,-0x60(%rbp)
mov    %edx,%r15d
mov    %esi,%r12d
mov    %rdi,%r13
mov    0x2e4e(%rip),%rax
mov    (%rax),%edi
lea    0xe7d(%rip),%rsi
call   1050 <fprintf@plt>
lea    0xe92(%rip),%rdi
lea    -0x50(%rbp),%rsi
call   1060 <scanf@plt>
mov    %rsp,-0x80(%rbp)
mov    -0x50(%rbp),%rax
mov    %rsp,%r14
shl    $0x4,%rax
sub    %rax,%r14
mov    %r14,%rsp
movsd  -0x30(%rbp),%xmm0
subsd  -0x38(%rbp),%xmm0
movsd  %xmm0,-0x58(%rbp)
call   1030 <abs@plt>
movslq %eax,%rcx
mov    -0x50(%rbp),%rsi
add    %rsi,%rsi
mov    %rcx,%rdx
or     %rsi,%rdx
shr    $0x20,%rdx
je     11f9 <integ_cav_simpson+0x99>
mov    %rcx,%rax
cqto
idiv   %rsi
jmp    11fd <integ_cav_simpson+0x9d>
xor    %edx,%edx
div    %esi
movsd  -0x30(%rbp),%xmm0
xorps  %xmm1,%xmm1
cvtsi2sd %rax,%xmm1
movsd  %xmm1,-0x48(%rbp)
minsd  -0x38(%rbp),%xmm0
mov    %r13,%rdi
mov    %r12d,%esi
mov    %r15d,%edx
movsd  %xmm0,-0x40(%rbp)
call   1070 <function@plt>
movsd  %xmm0,(%r14)
mov    -0x50(%rbp),%rcx
lea    (%rcx,%rcx,1),%rax
xorpd  %xmm3,%xmm3
test   %rcx,%rcx
jle    1287 <integ_cav_simpson+0x127>
mov    %ebx,%r8d
mov    %rax,%rdx
or     $0x1,%rdx
cmp    $0x3,%rdx
mov    $0x2,%ebx
cmovge %rdx,%rbx
lea    -0x1(%rbx),%rdi
add    $0xfffffffffffffffe,%rbx
mov    %edi,%edx
and    $0x3,%edx
mov    $0x1,%esi
cmp    $0x3,%rbx
jae    1295 <integ_cav_simpson+0x135>
movsd  -0x48(%rbp),%xmm1
mov    %r8d,%ebx
movsd  -0x40(%rbp),%xmm4
test   %rdx,%rdx
jne    1321 <integ_cav_simpson+0x1c1>
jmp    134e <integ_cav_simpson+0x1ee>
xorpd  %xmm2,%xmm2
movsd  -0x48(%rbp),%xmm1
jmp    139f <integ_cav_simpson+0x23f>
and    $0xfffffffffffffffc,%rdi
xor    %esi,%esi
movsd  -0x48(%rbp),%xmm1
movsd  -0x40(%rbp),%xmm4
cs nopw 0x0(%rax,%rax,1)
nop
addsd  %xmm1,%xmm4
movapd %xmm4,%xmm2
mulsd  %xmm4,%xmm2
mulsd  %xmm4,%xmm2
movsd  %xmm2,0x8(%r14,%rsi,8)
addsd  %xmm1,%xmm4
movapd %xmm4,%xmm2
mulsd  %xmm4,%xmm2
mulsd  %xmm4,%xmm2
movsd  %xmm2,0x10(%r14,%rsi,8)
addsd  %xmm1,%xmm4
movapd %xmm4,%xmm2
mulsd  %xmm4,%xmm2
mulsd  %xmm4,%xmm2
movsd  %xmm2,0x18(%r14,%rsi,8)
addsd  %xmm1,%xmm4
movapd %xmm4,%xmm2
mulsd  %xmm4,%xmm2
mulsd  %xmm4,%xmm2
movsd  %xmm2,0x20(%r14,%rsi,8)
add    $0x4,%rsi
cmp    %rsi,%rdi
jne    12b0 <integ_cav_simpson+0x150>
add    $0x1,%rsi
mov    %r8d,%ebx
test   %rdx,%rdx
je     134e <integ_cav_simpson+0x1ee>
lea    (%r14,%rsi,8),%rsi
xor    %edi,%edi
nopw   0x0(%rax,%rax,1)
addsd  %xmm1,%xmm4
movapd %xmm4,%xmm2
mulsd  %xmm4,%xmm2
mulsd  %xmm4,%xmm2
movsd  %xmm2,(%rsi,%rdi,8)
add    $0x1,%rdi
cmp    %rdi,%rdx
jne    1330 <integ_cav_simpson+0x1d0>
xorpd  %xmm2,%xmm2
test   %rcx,%rcx
jle    139f <integ_cav_simpson+0x23f>
xorpd  %xmm3,%xmm3
mov    $0x1,%edx
addsd  (%r14,%rdx,8),%xmm3
add    $0x2,%rdx
cmp    %rdx,%rax
jg     1360 <integ_cav_simpson+0x200>
xorpd  %xmm2,%xmm2
cmp    $0x2,%rcx
jl     139f <integ_cav_simpson+0x23f>
lea    -0x2(%rax),%rcx
xorpd  %xmm2,%xmm2
mov    $0x2,%edx
cs nopw 0x0(%rax,%rax,1)
addsd  (%r14,%rdx,8),%xmm2
add    $0x2,%rdx
cmp    %rdx,%rcx
jge    1390 <integ_cav_simpson+0x230>
movsd  (%r14,%rax,8),%xmm4
cmp    $0x9,%ebx
jne    144e <integ_cav_simpson+0x2ee>
movsd  %xmm4,-0x68(%rbp)
movsd  %xmm2,-0x70(%rbp)
movsd  %xmm3,-0x78(%rbp)
movsd  %xmm0,-0x40(%rbp)
movsd  -0x58(%rbp),%xmm0
call   1030 <abs@plt>
mov    %eax,%ebx
mov    %rsp,%r14
movsd  -0x30(%rbp),%xmm0
maxsd  -0x38(%rbp),%xmm0
mov    %r13,%rdi
mov    %r12d,%esi
mov    %r15d,%edx
movsd  %xmm0,-0x30(%rbp)
call   1040 <deriv4@plt>
test   %ebx,%ebx
jle    145b <integ_cav_simpson+0x2fb>
imul   $0x3e8,%ebx,%eax
cmp    $0x2,%eax
mov    $0x1,%ebx
cmovge %eax,%ebx
movsd  -0x30(%rbp),%xmm2
nopl   0x0(%rax,%rax,1)
movsd  %xmm0,-0x38(%rbp)
addsd  0xbe3(%rip),%xmm2
movsd  %xmm2,-0x30(%rbp)
mov    %r13,%rdi
mov    %r12d,%esi
mov    %r15d,%edx
movapd %xmm2,%xmm0
call   1040 <deriv4@plt>
movsd  -0x30(%rbp),%xmm2
movapd %xmm0,%xmm1
maxsd  -0x38(%rbp),%xmm1
movapd %xmm1,%xmm0
add    $0xffffffffffffffff,%rbx
jne    1410 <integ_cav_simpson+0x2b0>
jmp    145f <integ_cav_simpson+0x2ff>
mov    -0x60(%rbp),%rax
movq   $0x0,(%rax)
jmp    14cd <integ_cav_simpson+0x36d>
movapd %xmm0,%xmm1
movsd  %xmm1,-0x30(%rbp)
cvttsd2si -0x58(%rbp),%rdi
mov    $0x5,%esi
call   1080 <pow@plt>
xorps  %xmm0,%xmm0
cvtsi2sd %eax,%xmm0
mulsd  -0x30(%rbp),%xmm0
movsd  %xmm0,-0x30(%rbp)
mov    -0x50(%rbp),%rdi
mov    $0x4,%esi
call   1080 <pow@plt>
imul   $0xb40,%eax,%eax
xorps  %xmm0,%xmm0
cvtsi2sd %eax,%xmm0
movsd  -0x30(%rbp),%xmm1
divsd  %xmm0,%xmm1
mov    -0x60(%rbp),%rax
movsd  %xmm1,(%rax)
mov    %r14,%rsp
movsd  -0x48(%rbp),%xmm1
movsd  -0x40(%rbp),%xmm0
movsd  -0x78(%rbp),%xmm3
movsd  -0x70(%rbp),%xmm2
movsd  -0x68(%rbp),%xmm4
addsd  %xmm1,%xmm1
divsd  0xb2f(%rip),%xmm1
addsd  %xmm4,%xmm0
addsd  %xmm3,%xmm3
addsd  %xmm0,%xmm3
mulsd  0xb23(%rip),%xmm2
addsd  %xmm3,%xmm2
mulsd  %xmm1,%xmm2
mov    -0x80(%rbp),%rsp
movapd %xmm2,%xmm0
lea    -0x28(%rbp),%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"
define double @integ_cav_simpson(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 i32
%17 = alloca i64
%18 = alloca double
%19 = alloca double
%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 @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* %17)
%32 = load i64, i64* %17
%33 = mul nsw i64 2, %32
%34 = call i8* @llvm.stacksave()
store i8* %34, i8** %21
%35 = alloca double, i64 %33
store i64 %33, i64* %22
%36 = load i64, i64* %17
%37 = mul nsw i64 2, %36
%38 = alloca double, i64 %37
store i64 %37, i64* %23
%39 = load double, double* %14
%40 = load double, double* %13
%41 = fsub double %39, %40
%42 = call i32 @abs(double %41)
%43 = sext i32 %42 to i64
%44 = load i64, i64* %17
%45 = mul nsw i64 2, %44
%46 = sdiv i64 %43, %45
%47 = sitofp i64 %46 to double
store double %47, double* %18
%48 = load double, double* %14
%49 = load double, double* %13
%50 = fcmp ogt double %48, %49
br i1 %50, label %51, label %54
51: ; preds = %7
%52 = load double, double* %13
%53 = getelementptr inbounds double, double* %35, i64 0
store double %52, double* %53
br label %54
54: ; preds = %51, %7
%55 = load double, double* %14
%56 = load double, double* %13
%57 = fcmp olt double %55, %56
br i1 %57, label %58, label %61
58: ; preds = %54
%59 = load double, double* %14
%60 = getelementptr inbounds double, double* %35, i64 0
store double %59, double* %60
br label %61
61: ; preds = %58, %54
%62 = load double*, double** %8
%63 = load i32, i32* %9
%64 = load i32, i32* %10
%65 = getelementptr inbounds double, double* %35, i64 0
%66 = load double, double* %65
%67 = call double @function(double* %62, i32 %63, i32 %64, double %66)
%68 = getelementptr inbounds double, double* %38, i64 0
store double %67, double* %68
store i32 1, i32* %16
br label %69
69: ; preds = %103, %61
%70 = load i32, i32* %16
%71 = sext i32 %70 to i64
%72 = load i64, i64* %17
%73 = mul nsw i64 2, %72
%74 = icmp sle i64 %71, %73
br i1 %74, label %75, label %106
75: ; preds = %69
%76 = load i32, i32* %16
%77 = sub nsw i32 %76, 1
%78 = sext i32 %77 to i64
%79 = getelementptr inbounds double, double* %35, i64 %78
%80 = load double, double* %79
%81 = load double, double* %18
%82 = fadd double %80, %81
%83 = load i32, i32* %16
%84 = sext i32 %83 to i64
%85 = getelementptr inbounds double, double* %35, i64 %84
store double %82, double* %85
%86 = load i32, i32* %16
%87 = sext i32 %86 to i64
%88 = getelementptr inbounds double, double* %35, i64 %87
%89 = load double, double* %88
%90 = load i32, i32* %16
%91 = sext i32 %90 to i64
%92 = getelementptr inbounds double, double* %35, i64 %91
%93 = load double, double* %92
%94 = fmul double %89, %93
%95 = load i32, i32* %16
%96 = sext i32 %95 to i64
%97 = getelementptr inbounds double, double* %35, i64 %96
%98 = load double, double* %97
%99 = fmul double %94, %98
%100 = load i32, i32* %16
%101 = sext i32 %100 to i64
%102 = getelementptr inbounds double, double* %38, i64 %101
store double %99, double* %102
br label %103
103: ; preds = %75
%104 = load i32, i32* %16
%105 = add nsw i32 %104, 1
store i32 %105, i32* %16
br label %69
106: ; preds = %69
store double 0.000000e+00, double* %19
store i32 1, i32* %16
br label %107
107: ; preds = %121, %106
%108 = load i32, i32* %16
%109 = sext i32 %108 to i64
%110 = load i64, i64* %17
%111 = mul nsw i64 2, %110
%112 = sub nsw i64 %111, 1
%113 = icmp sle i64 %109, %112
br i1 %113, label %114, label %124
114: ; preds = %107
%115 = load i32, i32* %16
%116 = sext i32 %115 to i64
%117 = getelementptr inbounds double, double* %38, i64 %116
%118 = load double, double* %117
%119 = load double, double* %19
%120 = fadd double %119, %118
store double %120, double* %19
br label %121
121: ; preds = %114
%122 = load i32, i32* %16
%123 = add nsw i32 %122, 2
store i32 %123, i32* %16
br label %107
124: ; preds = %107
store double 0.000000e+00, double* %20
store i32 2, i32* %16
br label %125
125: ; preds = %139, %124
%126 = load i32, i32* %16
%127 = sext i32 %126 to i64
%128 = load i64, i64* %17
%129 = mul nsw i64 2, %128
%130 = sub nsw i64 %129, 2
%131 = icmp sle i64 %127, %130
br i1 %131, label %132, label %142
132: ; preds = %125
%133 = load i32, i32* %16
%134 = sext i32 %133 to i64
%135 = getelementptr inbounds double, double* %38, i64 %134
%136 = load double, double* %135
%137 = load double, double* %20
%138 = fadd double %137, %136
store double %138, double* %20
br label %139
139: ; preds = %132
%140 = load i32, i32* %16
%141 = add nsw i32 %140, 2
store i32 %141, i32* %16
br label %125
142: ; preds = %125
%143 = load double, double* %18
%144 = fmul double 2.000000e+00, %143
%145 = fdiv double %144, 6.000000e+00
%146 = getelementptr inbounds double, double* %38, i64 0
%147 = load double, double* %146
%148 = load i64, i64* %17
%149 = mul nsw i64 2, %148
%150 = getelementptr inbounds double, double* %38, i64 %149
%151 = load double, double* %150
%152 = fadd double %147, %151
%153 = load double, double* %19
%154 = call double @llvm.fmuladd.f64(double 2.000000e+00, double %153, double %152)
%155 = load double, double* %20
%156 = call double @llvm.fmuladd.f64(double 4.000000e+00, double %155, double %154)
%157 = fmul double %145, %156
store double %157, double* %15
%158 = load i32, i32* %12
%159 = icmp eq i32 %158, 9
br i1 %159, label %160, label %252
160: ; preds = %142
%161 = load double, double* %14
%162 = load double, double* %13
%163 = fsub double %161, %162
%164 = call i32 @abs(double %163)
%165 = mul nsw i32 %164, 1000
store i32 %165, i32* %24
%166 = load i32, i32* %24
%167 = zext i32 %166 to i64
%168 = call i8* @llvm.stacksave()
store i8* %168, i8** %25
%169 = alloca double, i64 %167
store i64 %167, i64* %26
%170 = load i32, i32* %24
%171 = zext i32 %170 to i64
%172 = alloca double, i64 %171
store i64 %171, i64* %27
%173 = load double, double* %13
%174 = load double, double* %14
%175 = fcmp ogt double %173, %174
br i1 %175, label %176, label %179
176: ; preds = %160
%177 = load double, double* %13
%178 = getelementptr inbounds double, double* %169, i64 0
store double %177, double* %178
br label %179
179: ; preds = %176, %160
%180 = load double, double* %14
%181 = load double, double* %13
%182 = fcmp ogt double %180, %181
br i1 %182, label %183, label %186
183: ; preds = %179
%184 = load double, double* %14
%185 = getelementptr inbounds double, double* %169, i64 0
store double %184, double* %185
br label %186
186: ; preds = %183, %179
%187 = load double*, double** %8
%188 = load i32, i32* %9
%189 = load i32, i32* %10
%190 = getelementptr inbounds double, double* %169, i64 0
%191 = load double, double* %190
%192 = call double @deriv4(double* %187, i32 %188, i32 %189, double %191)
%193 = getelementptr inbounds double, double* %172, i64 0
store double %192, double* %193
%194 = getelementptr inbounds double, double* %172, i64 0
%195 = load double, double* %194
store double %195, double* %28
store i32 1, i32* %16
br label %196
196: ; preds = %233, %186
%197 = load i32, i32* %16
%198 = load i32, i32* %24
%199 = icmp sle i32 %197, %198
br i1 %199, label %200, label %236
200: ; preds = %196
%201 = load i32, i32* %16
%202 = sub nsw i32 %201, 1
%203 = sext i32 %202 to i64
%204 = getelementptr inbounds double, double* %169, i64 %203
%205 = load double, double* %204
%206 = fadd double %205, 1.000000e-03
%207 = load i32, i32* %16
%208 = sext i32 %207 to i64
%209 = getelementptr inbounds double, double* %169, i64 %208
store double %206, double* %209
%210 = load double*, double** %8
%211 = load i32, i32* %9
%212 = load i32, i32* %10
%213 = load i32, i32* %16
%214 = sext i32 %213 to i64
%215 = getelementptr inbounds double, double* %169, i64 %214
%216 = load double, double* %215
%217 = call double @deriv4(double* %210, i32 %211, i32 %212, double %216)
%218 = load i32, i32* %16
%219 = sext i32 %218 to i64
%220 = getelementptr inbounds double, double* %172, i64 %219
store double %217, double* %220
%221 = load i32, i32* %16
%222 = sext i32 %221 to i64
%223 = getelementptr inbounds double, double* %172, i64 %222
%224 = load double, double* %223
%225 = load double, double* %28
%226 = fcmp ogt double %224, %225
br i1 %226, label %227, label %232
227: ; preds = %200
%228 = load i32, i32* %16
%229 = sext i32 %228 to i64
%230 = getelementptr inbounds double, double* %172, i64 %229
%231 = load double, double* %230
store double %231, double* %28
br label %232
232: ; preds = %227, %200
br label %233
233: ; preds = %232
%234 = load i32, i32* %16
%235 = add nsw i32 %234, 1
store i32 %235, i32* %16
br label %196
236: ; preds = %196
%237 = load double, double* %14
%238 = load double, double* %13
%239 = fsub double %237, %238
%240 = fptosi double %239 to i64
%241 = call i32 @pow(i64 %240, i32 5)
%242 = sitofp i32 %241 to double
%243 = load double, double* %28
%244 = fmul double %242, %243
%245 = load i64, i64* %17
%246 = call i32 @pow(i64 %245, i32 4)
%247 = mul nsw i32 2880, %246
%248 = sitofp i32 %247 to double
%249 = fdiv double %244, %248
%250 = load double*, double** %11
store double %249, double* %250
%251 = load i8*, i8** %25
br label %254
252: ; preds = %142
%253 = load double*, double** %11
store double 0.000000e+00, double* %253
br label %254
254: ; preds = %252, %236
%255 = load double, double* %15
%256 = load i8*, i8** %21
ret double %255
}

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"
define double @integ_cav_simpson(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 @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 = shl nsw i64 %14, 1
%16 = alloca double, i64 %15
%17 = fsub double %6, %5
%18 = call i32 @abs(double %17)
%19 = sext i32 %18 to i64
%20 = load i64, i64* %8
%21 = shl nsw i64 %20, 1
%22 = sdiv i64 %19, %21
%23 = sitofp i64 %22 to double
%24 = fcmp ogt double %6, %5
%25 = fcmp olt double %6, %5
%26 = select i1 %25, double %6, double %5
%27 = call double @function(double* %0, i32 %1, i32 %2, double %26)
store double %27, double* %16
%28 = load i64, i64* %8
%29 = shl i64 %28, 1
%30 = icmp slt i64 %28, 1
br i1 %30, label %102, label %31
31: ; preds = %7
%32 = or i64 %29, 1
%33 = call i64 @llvm.smax.i64(i64 %32, i64 2)
%34 = add nsw i64 %33, -1
%35 = add nsw i64 %33, -2
%36 = and i64 %34, 3
%37 = icmp ult i64 %35, 3
br i1 %37, label %40, label %38
38: ; preds = %31
%39 = and i64 %34, -4
br label %57
40: ; preds = %57, %31
%41 = phi double [ %26, %31 ], [ %76, %57 ]
%42 = phi i64 [ 1, %31 ], [ %80, %57 ]
%43 = icmp eq i64 %36, 0
br i1 %43, label %55, label %44
44: ; preds = %40, %44
%45 = phi double [ %48, %44 ], [ %41, %40 ]
%46 = phi i64 [ %52, %44 ], [ %42, %40 ]
%47 = phi i64 [ %53, %44 ], [ 0, %40 ]
%48 = fadd double %45, %23
%49 = fmul double %48, %48
%50 = fmul double %48, %49
%51 = getelementptr inbounds double, double* %16, i64 %46
store double %50, double* %51
%52 = add nuw nsw i64 %46, 1
%53 = add i64 %47, 1
%54 = icmp eq i64 %53, %36
br i1 %54, label %55, label %44
55: ; preds = %44, %40
%56 = icmp sgt i64 %28, 0
br i1 %56, label %86, label %102
57: ; preds = %57, %38
%58 = phi double [ %26, %38 ], [ %76, %57 ]
%59 = phi i64 [ 1, %38 ], [ %80, %57 ]
%60 = phi i64 [ 0, %38 ], [ %81, %57 ]
%61 = fadd double %58, %23
%62 = fmul double %61, %61
%63 = fmul double %61, %62
%64 = getelementptr inbounds double, double* %16, i64 %59
store double %63, double* %64
%65 = add nuw nsw i64 %59, 1
%66 = fadd double %61, %23
%67 = fmul double %66, %66
%68 = fmul double %66, %67
%69 = getelementptr inbounds double, double* %16, i64 %65
store double %68, double* %69
%70 = add nuw nsw i64 %59, 2
%71 = fadd double %66, %23
%72 = fmul double %71, %71
%73 = fmul double %71, %72
%74 = getelementptr inbounds double, double* %16, i64 %70
store double %73, double* %74
%75 = add nuw nsw i64 %59, 3
%76 = fadd double %71, %23
%77 = fmul double %76, %76
%78 = fmul double %76, %77
%79 = getelementptr inbounds double, double* %16, i64 %75
store double %78, double* %79
%80 = add nuw nsw i64 %59, 4
%81 = add i64 %60, 4
%82 = icmp eq i64 %81, %39
br i1 %82, label %40, label %57
83: ; preds = %86
%84 = add nsw i64 %29, -2
%85 = icmp slt i64 %28, 2
br i1 %85, label %102, label %94
86: ; preds = %55, %86
%87 = phi i64 [ %92, %86 ], [ 1, %55 ]
%88 = phi double [ %91, %86 ], [ 0.000000e+00, %55 ]
%89 = getelementptr inbounds double, double* %16, i64 %87
%90 = load double, double* %89
%91 = fadd double %88, %90
%92 = add nuw nsw i64 %87, 2
%93 = icmp sgt i64 %29, %92
br i1 %93, label %86, label %83
94: ; preds = %83, %94
%95 = phi i64 [ %100, %94 ], [ 2, %83 ]
%96 = phi double [ %99, %94 ], [ 0.000000e+00, %83 ]
%97 = getelementptr inbounds double, double* %16, i64 %95
%98 = load double, double* %97
%99 = fadd double %96, %98
%100 = add nuw nsw i64 %95, 2
%101 = icmp slt i64 %84, %100
br i1 %101, label %102, label %94
102: ; preds = %94, %7, %55, %83
%103 = phi double [ %91, %83 ], [ 0.000000e+00, %55 ], [ 0.000000e+00, %7 ], [ %91, %94 ]
%104 = phi double [ 0.000000e+00, %83 ], [ 0.000000e+00, %55 ], [ 0.000000e+00, %7 ], [ %99, %94 ]
%105 = getelementptr inbounds double, double* %16, i64 %29
%106 = load double, double* %105
%107 = icmp eq i32 %4, 9
br i1 %107, label %108, label %140
108: ; preds = %102
%109 = call i32 @abs(double %17)
%110 = call i8* @llvm.stacksave()
%111 = select i1 %24, double %6, double %5
%112 = call double @deriv4(double* %0, i32 %1, i32 %2, double %111)
%113 = icmp slt i32 %109, 1
br i1 %113, label %129, label %114
114: ; preds = %108
%115 = mul i32 %109, 1000
%116 = call i32 @llvm.smax.i32(i32 %115, i32 1)
%117 = add nuw nsw i32 %116, 1
%118 = zext i32 %117 to i64
br label %119
119: ; preds = %114, %119
%120 = phi double [ %111, %114 ], [ %123, %119 ]
%121 = phi i64 [ 1, %114 ], [ %127, %119 ]
%122 = phi double [ %112, %114 ], [ %126, %119 ]
%123 = fadd double %120, 1.000000e-03
%124 = call double @deriv4(double* %0, i32 %1, i32 %2, double %123)
%125 = fcmp ogt double %124, %122
%126 = select i1 %125, double %124, double %122
%127 = add nuw nsw i64 %121, 1
%128 = icmp eq i64 %127, %118
br i1 %128, label %129, label %119
129: ; preds = %119, %108
%130 = phi double [ %112, %108 ], [ %126, %119 ]
%131 = fptosi double %17 to i64
%132 = call i32 @pow(i64 %131, i32 5)
%133 = sitofp i32 %132 to double
%134 = fmul double %130, %133
%135 = load i64, i64* %8
%136 = call i32 @pow(i64 %135, i32 4)
%137 = mul nsw i32 %136, 2880
%138 = sitofp i32 %137 to double
%139 = fdiv double %134, %138
store double %139, double* %3
br label %141
140: ; preds = %102
store double 0.000000e+00, double* %3
br label %141
141: ; preds = %140, %129
%142 = fmul double %23, 2.000000e+00
%143 = fdiv double %142, 6.000000e+00
%144 = fadd double %27, %106
%145 = call double @llvm.fmuladd.f64(double %103, double 2.000000e+00, double %144)
%146 = call double @llvm.fmuladd.f64(double %104, double 4.000000e+00, double %145)
%147 = fmul double %143, %146
ret double %147
}