#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 f(float);
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ scanf(char *, ...);
int main() {
  float a, b, s, h;
  int i, n, m;
  printf("Enter the value of n");
  scanf("%d", &n);
  printf("Enter the value of a and b");
  scanf("%f %f", &a, &b);
  s = 0;
  h = (b - a) / n;
  m = n / 6;
  for (i = 1; i <= m; i++) {
    s = s + ((3 * h) / 10) *
                (f(a) + 5 * f(a + h) + f(a + 2 * h) + 6 * f(a + 3 * h) +
                 f(a + 4 * h) + 5 * f(a + 5 * h) + f(a + 6 * h));
    a = a + 6 * h;
  }
  printf("%f", s);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xece(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    0xed5(%rip),%rdi
lea    -0x1c(%rbp),%rsi
mov    $0x0,%al
call   1050 <scanf@plt>
lea    0xec6(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    0xed3(%rip),%rdi
lea    -0x8(%rbp),%rsi
lea    -0xc(%rbp),%rdx
mov    $0x0,%al
call   1050 <scanf@plt>
xorps  %xmm0,%xmm0
movss  %xmm0,-0x10(%rbp)
movss  -0xc(%rbp),%xmm0
subss  -0x8(%rbp),%xmm0
cvtsi2ssl -0x1c(%rbp),%xmm1
divss  %xmm1,%xmm0
movss  %xmm0,-0x14(%rbp)
mov    -0x1c(%rbp),%eax
mov    $0x6,%ecx
cltd
idiv   %ecx
mov    %eax,-0x20(%rbp)
movl   $0x1,-0x18(%rbp)
mov    -0x18(%rbp),%eax
cmp    -0x20(%rbp),%eax
jg     1325 <main+0x1f5>
movss  -0x10(%rbp),%xmm0
movss  %xmm0,-0x28(%rbp)
movss  0xe36(%rip),%xmm0
mulss  -0x14(%rbp),%xmm0
movss  0xe2d(%rip),%xmm1
divss  %xmm1,%xmm0
movss  %xmm0,-0x2c(%rbp)
movss  -0x8(%rbp),%xmm0
call   1030 <f@plt>
mov    %eax,-0x40(%rbp)
movss  -0x8(%rbp),%xmm0
addss  -0x14(%rbp),%xmm0
call   1030 <f@plt>
mov    %eax,%ecx
mov    -0x40(%rbp),%eax
imul   $0x5,%ecx,%ecx
add    %ecx,%eax
mov    %eax,-0x3c(%rbp)
movss  -0x8(%rbp),%xmm1
movss  -0x14(%rbp),%xmm0
addss  %xmm0,%xmm0
addss  %xmm1,%xmm0
call   1030 <f@plt>
mov    %eax,%ecx
mov    -0x3c(%rbp),%eax
add    %ecx,%eax
mov    %eax,-0x38(%rbp)
movss  -0x8(%rbp),%xmm1
movss  -0x14(%rbp),%xmm0
movss  0xdc4(%rip),%xmm2
mulss  %xmm2,%xmm0
addss  %xmm1,%xmm0
call   1030 <f@plt>
mov    %eax,%ecx
mov    -0x38(%rbp),%eax
imul   $0x6,%ecx,%ecx
add    %ecx,%eax
mov    %eax,-0x34(%rbp)
movss  -0x8(%rbp),%xmm1
movss  -0x14(%rbp),%xmm0
movss  0xd94(%rip),%xmm2
mulss  %xmm2,%xmm0
addss  %xmm1,%xmm0
call   1030 <f@plt>
mov    %eax,%ecx
mov    -0x34(%rbp),%eax
add    %ecx,%eax
mov    %eax,-0x30(%rbp)
movss  -0x8(%rbp),%xmm1
movss  -0x14(%rbp),%xmm0
movss  0xd67(%rip),%xmm2
mulss  %xmm2,%xmm0
addss  %xmm1,%xmm0
call   1030 <f@plt>
mov    %eax,%ecx
mov    -0x30(%rbp),%eax
imul   $0x5,%ecx,%ecx
add    %ecx,%eax
mov    %eax,-0x24(%rbp)
movss  -0x8(%rbp),%xmm1
movss  -0x14(%rbp),%xmm0
movss  0xd37(%rip),%xmm2
mulss  %xmm2,%xmm0
addss  %xmm1,%xmm0
call   1030 <f@plt>
movss  -0x2c(%rbp),%xmm0
movss  -0x28(%rbp),%xmm1
mov    %eax,%ecx
mov    -0x24(%rbp),%eax
add    %ecx,%eax
cvtsi2ss %eax,%xmm2
mulss  %xmm2,%xmm0
addss  %xmm1,%xmm0
movss  %xmm0,-0x10(%rbp)
movss  -0x8(%rbp),%xmm1
movss  -0x14(%rbp),%xmm0
movss  0xcf6(%rip),%xmm2
mulss  %xmm2,%xmm0
addss  %xmm1,%xmm0
movss  %xmm0,-0x8(%rbp)
mov    -0x18(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x18(%rbp)
jmp    11b8 <main+0x88>
movss  -0x10(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
lea    0xd15(%rip),%rdi
mov    $0x1,%al
call   1040 <printf@plt>
mov    -0x4(%rbp),%eax
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x38,%rsp
lea    0xecf(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xed6(%rip),%rdi
lea    0x30(%rsp),%rsi
xor    %eax,%eax
call   1050 <scanf@plt>
lea    0xec6(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xed3(%rip),%rdi
lea    0x8(%rsp),%rsi
lea    0x34(%rsp),%rdx
xor    %eax,%eax
call   1050 <scanf@plt>
mov    0x30(%rsp),%eax
xorps  %xmm0,%xmm0
cmp    $0x6,%eax
jl     1303 <main+0x1d3>
movss  0x34(%rsp),%xmm2
movss  0x8(%rsp),%xmm0
subss  %xmm0,%xmm2
cvtsi2ss %eax,%xmm1
divss  %xmm1,%xmm2
mov    %eax,%eax
mov    $0xaaaaaaab,%r13d
imul   %rax,%r13
shr    $0x22,%r13
movss  0xe3b(%rip),%xmm1
mulss  %xmm2,%xmm1
movss  %xmm1,0x20(%rsp)
divss  0xe2d(%rip),%xmm1
movss  %xmm1,0x1c(%rsp)
xorps  %xmm1,%xmm1
movaps %xmm2,%xmm3
addss  %xmm2,%xmm3
movss  %xmm3,0x18(%rsp)
movss  0xe13(%rip),%xmm3
mulss  %xmm2,%xmm3
movss  %xmm3,0x14(%rsp)
movss  0xe05(%rip),%xmm3
mulss  %xmm2,%xmm3
movss  %xmm3,0x10(%rsp)
movss  0xdf7(%rip),%xmm3
movss  %xmm2,0x24(%rsp)
mulss  %xmm2,%xmm3
movss  %xmm3,0xc(%rsp)
nopl   0x0(%rax)
movss  %xmm1,0x2c(%rsp)
call   1030 <f@plt>
mov    %eax,0x28(%rsp)
movss  0x8(%rsp),%xmm0
addss  0x24(%rsp),%xmm0
call   1030 <f@plt>
mov    %eax,%r15d
movss  0x8(%rsp),%xmm0
addss  0x18(%rsp),%xmm0
call   1030 <f@plt>
mov    %eax,%ebx
movss  0x8(%rsp),%xmm0
addss  0x20(%rsp),%xmm0
call   1030 <f@plt>
lea    (%rax,%rax,2),%r14d
movss  0x8(%rsp),%xmm0
addss  0x14(%rsp),%xmm0
call   1030 <f@plt>
mov    %eax,%r12d
movss  0x8(%rsp),%xmm0
addss  0x10(%rsp),%xmm0
call   1030 <f@plt>
mov    %eax,%ebp
movss  0x8(%rsp),%xmm0
addss  0xc(%rsp),%xmm0
call   1030 <f@plt>
movss  0x2c(%rsp),%xmm1
add    %r15d,%ebp
lea    0x0(%rbp,%rbp,4),%ecx
add    0x28(%rsp),%ebx
lea    (%rbx,%r14,2),%edx
add    %r12d,%edx
add    %eax,%edx
add    %ecx,%edx
xorps  %xmm0,%xmm0
cvtsi2ss %edx,%xmm0
mulss  0x1c(%rsp),%xmm0
addss  %xmm0,%xmm1
movss  0x8(%rsp),%xmm0
addss  0xc(%rsp),%xmm0
movss  %xmm0,0x8(%rsp)
add    $0xffffffff,%r13d
jne    1230 <main+0x100>
xorps  %xmm0,%xmm0
cvtss2sd %xmm1,%xmm0
lea    0xd40(%rip),%rdi
mov    $0x1,%al
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x38,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [21 x i8] c"Enter the value of n\00"
@.str.1 = [3 x i8] c"%d\00"
@.str.2 = [27 x i8] c"Enter the value of a and b\00"
@.str.3 = [6 x i8] c"%f %f\00"
@.str.4 = [3 x i8] c"%f\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca float
%3 = alloca float
%4 = alloca float
%5 = alloca float
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
store i32 0, i32* %1
%9 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str, i64 0, i64 0))
%10 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %7)
%11 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.2, i64 0, i64 0))
%12 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.3, i64 0, i64 0), float* %2, float* %3)
store float 0.000000e+00, float* %4
%13 = load float, float* %3
%14 = load float, float* %2
%15 = fsub float %13, %14
%16 = load i32, i32* %7
%17 = sitofp i32 %16 to float
%18 = fdiv float %15, %17
store float %18, float* %5
%19 = load i32, i32* %7
%20 = sdiv i32 %19, 6
store i32 %20, i32* %8
store i32 1, i32* %6
br label %21
21: ; preds = %70, %0
%22 = load i32, i32* %6
%23 = load i32, i32* %8
%24 = icmp sle i32 %22, %23
br i1 %24, label %25, label %73
25: ; preds = %21
%26 = load float, float* %4
%27 = load float, float* %5
%28 = fmul float 3.000000e+00, %27
%29 = fdiv float %28, 1.000000e+01
%30 = load float, float* %2
%31 = call i32 @f(float %30)
%32 = load float, float* %2
%33 = load float, float* %5
%34 = fadd float %32, %33
%35 = call i32 @f(float %34)
%36 = mul nsw i32 5, %35
%37 = add nsw i32 %31, %36
%38 = load float, float* %2
%39 = load float, float* %5
%40 = call float @llvm.fmuladd.f32(float 2.000000e+00, float %39, float %38)
%41 = call i32 @f(float %40)
%42 = add nsw i32 %37, %41
%43 = load float, float* %2
%44 = load float, float* %5
%45 = call float @llvm.fmuladd.f32(float 3.000000e+00, float %44, float %43)
%46 = call i32 @f(float %45)
%47 = mul nsw i32 6, %46
%48 = add nsw i32 %42, %47
%49 = load float, float* %2
%50 = load float, float* %5
%51 = call float @llvm.fmuladd.f32(float 4.000000e+00, float %50, float %49)
%52 = call i32 @f(float %51)
%53 = add nsw i32 %48, %52
%54 = load float, float* %2
%55 = load float, float* %5
%56 = call float @llvm.fmuladd.f32(float 5.000000e+00, float %55, float %54)
%57 = call i32 @f(float %56)
%58 = mul nsw i32 5, %57
%59 = add nsw i32 %53, %58
%60 = load float, float* %2
%61 = load float, float* %5
%62 = call float @llvm.fmuladd.f32(float 6.000000e+00, float %61, float %60)
%63 = call i32 @f(float %62)
%64 = add nsw i32 %59, %63
%65 = sitofp i32 %64 to float
%66 = call float @llvm.fmuladd.f32(float %29, float %65, float %26)
store float %66, float* %4
%67 = load float, float* %2
%68 = load float, float* %5
%69 = call float @llvm.fmuladd.f32(float 6.000000e+00, float %68, float %67)
store float %69, float* %2
br label %70
70: ; preds = %25
%71 = load i32, i32* %6
%72 = add nsw i32 %71, 1
store i32 %72, i32* %6
br label %21
73: ; preds = %21
%74 = load float, float* %4
%75 = fpext float %74 to double
%76 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0), double %75)
%77 = load i32, i32* %1
ret i32 %77
}

LLVM IR (-O2):
@.str = [21 x i8] c"Enter the value of n\00"
@.str.1 = [3 x i8] c"%d\00"
@.str.2 = [27 x i8] c"Enter the value of a and b\00"
@.str.3 = [6 x i8] c"%f %f\00"
@.str.4 = [3 x i8] c"%f\00"
define i32 @main() {
%1 = alloca float
%2 = alloca float
%3 = alloca i32
%4 = bitcast float* %1 to i8*
%5 = bitcast float* %2 to i8*
%6 = bitcast i32* %3 to i8*
%7 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([21 x i8], [21 x i8]* @.str, i64 0, i64 0))
%8 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %3)
%9 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([27 x i8], [27 x i8]* @.str.2, i64 0, i64 0))
%10 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.3, i64 0, i64 0), float* %1, float* %2)
%11 = load float, float* %2
%12 = load float, float* %1
%13 = fsub float %11, %12
%14 = load i32, i32* %3
%15 = sitofp i32 %14 to float
%16 = fdiv float %13, %15
%17 = icmp slt i32 %14, 6
br i1 %17, label %61, label %18
18: ; preds = %0
%19 = udiv i32 %14, 6
%20 = fmul float %16, 3.000000e+00
%21 = fdiv float %20, 1.000000e+01
br label %22
22: ; preds = %18, %22
%23 = phi float [ %12, %18 ], [ %56, %22 ]
%24 = phi float [ 0.000000e+00, %18 ], [ %54, %22 ]
%25 = phi i32 [ 1, %18 ], [ %57, %22 ]
%26 = call i32 @f(float %23)
%27 = load float, float* %1
%28 = fadd float %16, %27
%29 = call i32 @f(float %28)
%30 = load float, float* %1
%31 = call float @llvm.fmuladd.f32(float %16, float 2.000000e+00, float %30)
%32 = call i32 @f(float %31)
%33 = load float, float* %1
%34 = call float @llvm.fmuladd.f32(float %16, float 3.000000e+00, float %33)
%35 = call i32 @f(float %34)
%36 = mul nsw i32 %35, 6
%37 = load float, float* %1
%38 = call float @llvm.fmuladd.f32(float %16, float 4.000000e+00, float %37)
%39 = call i32 @f(float %38)
%40 = load float, float* %1
%41 = call float @llvm.fmuladd.f32(float %16, float 5.000000e+00, float %40)
%42 = call i32 @f(float %41)
%43 = load float, float* %1
%44 = call float @llvm.fmuladd.f32(float %16, float 6.000000e+00, float %43)
%45 = call i32 @f(float %44)
%46 = add i32 %42, %29
%47 = mul i32 %46, 5
%48 = add i32 %32, %26
%49 = add i32 %48, %36
%50 = add i32 %49, %39
%51 = add i32 %50, %45
%52 = add i32 %51, %47
%53 = sitofp i32 %52 to float
%54 = call float @llvm.fmuladd.f32(float %21, float %53, float %24)
%55 = load float, float* %1
%56 = call float @llvm.fmuladd.f32(float %16, float 6.000000e+00, float %55)
store float %56, float* %1
%57 = add nuw nsw i32 %25, 1
%58 = icmp eq i32 %25, %19
br i1 %58, label %59, label %22
59: ; preds = %22
%60 = fpext float %54 to double
br label %61
61: ; preds = %59, %0
%62 = phi double [ 0.000000e+00, %0 ], [ %60, %59 ]
%63 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0), double %62)
ret i32 0
}