int main(void) {
  float x0, y0, x1, y1, h, x, newy1, error, xn;
  printf("Enter the value of x(0):");
  scanf("%f", &x0);
  printf("\nEnter the value of y(0):");
  scanf("%f", &y0);
  printf("\nEnter the value of step(h):");
  scanf("%f", &h);
  printf("\nEnter the x bound");
  scanf("%f", &xn);
  x1 = x0 + h;
  int i = 1, j;
  while (x1 <= xn + h) {
    y1 = y0 + (h) * (2 * x0 * x0) + (2 * y0);
    printf("For x = %f ,the corresponding y i's are\n", x1);
    j = 1;
    error = 1;
    while (error > 0.00005) {
      newy1 =
          y0 + (h / 2) * ((2 * x0 * x0) + (2 * y0) + (2 * x1 * x1) + (2 * y1));
      error = fabs(newy1 - y1);
      printf("y(%d)(%d) = %0.3f\t\t error =%f\n", i, j, newy1, error);
      y1 = newy1;
      j++;
    }
    printf("\n\nTherefore y(%d) is %0.3f\n", i, y1);
    x0 = x0 + h;
    y0 = y1;
    x1 = x0 + h;
    i++;
  }
  printf("Hence the answer is %0.3f\n", y1);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeea(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xef5(%rip),%rdi
lea    -0x8(%rbp),%rsi
mov    $0x0,%al
call   1040 <scanf@plt>
lea    0xee6(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xed5(%rip),%rdi
lea    -0xc(%rbp),%rsi
mov    $0x0,%al
call   1040 <scanf@plt>
lea    0xee0(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xeb5(%rip),%rdi
lea    -0x18(%rbp),%rsi
mov    $0x0,%al
call   1040 <scanf@plt>
lea    0xedd(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xe95(%rip),%rdi
lea    -0x28(%rbp),%rsi
mov    $0x0,%al
call   1040 <scanf@plt>
movss  -0x8(%rbp),%xmm0
addss  -0x18(%rbp),%xmm0
movss  %xmm0,-0x10(%rbp)
movl   $0x1,-0x2c(%rbp)
movss  -0x10(%rbp),%xmm1
movss  -0x28(%rbp),%xmm0
addss  -0x18(%rbp),%xmm0
ucomiss %xmm1,%xmm0
jb     137a <main+0x25a>
movss  -0xc(%rbp),%xmm0
movss  -0x18(%rbp),%xmm1
movss  0xe15(%rip),%xmm2
mulss  -0x8(%rbp),%xmm2
mulss  -0x8(%rbp),%xmm2
mulss  %xmm2,%xmm1
addss  %xmm0,%xmm1
movss  -0xc(%rbp),%xmm0
addss  %xmm0,%xmm0
addss  %xmm1,%xmm0
movss  %xmm0,-0x14(%rbp)
movss  -0x10(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
lea    0xe63(%rip),%rdi
mov    $0x1,%al
call   1030 <printf@plt>
movl   $0x1,-0x30(%rbp)
movss  0xdc7(%rip),%xmm0
movss  %xmm0,-0x24(%rbp)
movss  -0x24(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
movsd  0xdb9(%rip),%xmm1
ucomisd %xmm1,%xmm0
jbe    132a <main+0x20a>
movss  -0xc(%rbp),%xmm1
movss  -0x18(%rbp),%xmm0
movss  0xd99(%rip),%xmm2
divss  %xmm2,%xmm0
movss  0xd8d(%rip),%xmm2
mulss  -0x8(%rbp),%xmm2
movss  -0x8(%rbp),%xmm4
movss  0xd7b(%rip),%xmm3
mulss  -0xc(%rbp),%xmm3
mulss  %xmm4,%xmm2
addss  %xmm3,%xmm2
movss  0xd66(%rip),%xmm3
mulss  -0x10(%rbp),%xmm3
movss  -0x10(%rbp),%xmm4
mulss  %xmm4,%xmm3
addss  %xmm2,%xmm3
movss  -0x14(%rbp),%xmm2
addss  %xmm2,%xmm2
addss  %xmm3,%xmm2
mulss  %xmm2,%xmm0
addss  %xmm1,%xmm0
movss  %xmm0,-0x20(%rbp)
movss  -0x20(%rbp),%xmm0
subss  -0x14(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
movaps 0xd31(%rip),%xmm1
pand   %xmm1,%xmm0
cvtsd2ss %xmm0,%xmm0
movss  %xmm0,-0x24(%rbp)
mov    -0x2c(%rbp),%esi
mov    -0x30(%rbp),%edx
movss  -0x20(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
movss  -0x24(%rbp),%xmm1
cvtss2sd %xmm1,%xmm1
lea    0xda4(%rip),%rdi
mov    $0x2,%al
call   1030 <printf@plt>
movss  -0x20(%rbp),%xmm0
movss  %xmm0,-0x14(%rbp)
mov    -0x30(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x30(%rbp)
jmp    123e <main+0x11e>
mov    -0x2c(%rbp),%esi
movss  -0x14(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
lea    0xd91(%rip),%rdi
mov    $0x1,%al
call   1030 <printf@plt>
movss  -0x8(%rbp),%xmm0
addss  -0x18(%rbp),%xmm0
movss  %xmm0,-0x8(%rbp)
movss  -0x14(%rbp),%xmm0
movss  %xmm0,-0xc(%rbp)
movss  -0x8(%rbp),%xmm0
addss  -0x18(%rbp),%xmm0
movss  %xmm0,-0x10(%rbp)
mov    -0x2c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x2c(%rbp)
jmp    11c5 <main+0xa5>
movss  -0x14(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
lea    0xd60(%rip),%rdi
mov    $0x1,%al
call   1030 <printf@plt>
mov    -0x4(%rbp),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
sub    $0x30,%rsp
lea    0xef5(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
lea    0xf00(%rip),%rbx
lea    0x8(%rsp),%rsi
mov    %rbx,%rdi
xor    %eax,%eax
call   1040 <scanf@plt>
lea    0xeed(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
lea    0x14(%rsp),%rsi
mov    %rbx,%rdi
xor    %eax,%eax
call   1040 <scanf@plt>
lea    0xeea(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
lea    0x10(%rsp),%rsi
mov    %rbx,%rdi
xor    %eax,%eax
call   1040 <scanf@plt>
lea    0xeea(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
lea    0x1c(%rsp),%rsi
mov    %rbx,%rdi
xor    %eax,%eax
call   1040 <scanf@plt>
movss  0x8(%rsp),%xmm1
movss  0x10(%rsp),%xmm0
movaps %xmm1,%xmm2
addss  %xmm0,%xmm2
movss  %xmm2,0x4(%rsp)
mov    $0x1,%ebx
movss  0x14(%rsp),%xmm3
lea    0xebc(%rip),%r14
lea    0xede(%rip),%r15
lea    0xef6(%rip),%r12
movaps %xmm1,%xmm2
addss  %xmm1,%xmm2
mulss  %xmm1,%xmm2
mulss  %xmm0,%xmm2
addss  %xmm3,%xmm2
addss  %xmm3,%xmm3
addss  %xmm2,%xmm3
movss  %xmm3,0xc(%rsp)
movss  0x4(%rsp),%xmm0
cvtss2sd %xmm0,%xmm0
mov    %r14,%rdi
mov    $0x1,%al
call   1030 <printf@plt>
movss  0x4(%rsp),%xmm0
addss  %xmm0,%xmm0
movss  %xmm0,0x18(%rsp)
mov    $0x1,%ebp
nopw   0x0(%rax,%rax,1)
movss  0xc(%rsp),%xmm6
movaps %xmm6,%xmm0
movss  0x14(%rsp),%xmm1
movss  0x10(%rsp),%xmm2
mulss  0xdb3(%rip),%xmm2
movss  0x8(%rsp),%xmm3
movaps %xmm3,%xmm4
addss  %xmm3,%xmm4
movaps %xmm1,%xmm5
addss  %xmm1,%xmm5
mulss  %xmm3,%xmm4
addss  %xmm5,%xmm4
movss  0x18(%rsp),%xmm3
mulss  0x4(%rsp),%xmm3
addss  %xmm4,%xmm3
addss  %xmm6,%xmm6
addss  %xmm3,%xmm6
mulss  %xmm2,%xmm6
addss  %xmm1,%xmm6
movaps %xmm6,%xmm1
subss  %xmm0,%xmm1
andps  0xd79(%rip),%xmm1
movss  %xmm6,0xc(%rsp)
xorps  %xmm0,%xmm0
cvtss2sd %xmm6,%xmm0
cvtss2sd %xmm1,%xmm1
movsd  %xmm1,0x28(%rsp)
mov    %r15,%rdi
mov    %ebx,%esi
mov    %ebp,%edx
movsd  %xmm0,0x20(%rsp)
mov    $0x2,%al
call   1030 <printf@plt>
add    $0x1,%ebp
movsd  0x28(%rsp),%xmm0
ucomisd 0xd4d(%rip),%xmm0
ja     1230 <main+0x110>
mov    %r12,%rdi
mov    %ebx,%esi
movsd  0x20(%rsp),%xmm0
mov    $0x1,%al
call   1030 <printf@plt>
movss  0x10(%rsp),%xmm0
movss  0x8(%rsp),%xmm1
addss  %xmm0,%xmm1
movss  %xmm1,0x8(%rsp)
movss  0xc(%rsp),%xmm3
movss  %xmm3,0x14(%rsp)
movaps %xmm0,%xmm4
addss  %xmm1,%xmm4
add    $0x1,%ebx
movss  0x1c(%rsp),%xmm2
addss  %xmm0,%xmm2
movss  %xmm4,0x4(%rsp)
ucomiss %xmm4,%xmm2
jae    11e0 <main+0xc0>
lea    0xdbb(%rip),%rdi
movsd  0x20(%rsp),%xmm0
mov    $0x1,%al
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x30,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [25 x i8] c"Enter the value of x(0):\00"
@.str.1 = [3 x i8] c"%f\00"
@.str.2 = [26 x i8] c"\0AEnter the value of y(0):\00"
@.str.3 = [29 x i8] c"\0AEnter the value of step(h):\00"
@.str.4 = [19 x i8] c"\0AEnter the x bound\00"
@.str.5 = [41 x i8] c"For x = %f ,the corresponding y i's are\0A\00"
@.str.6 = [31 x i8] c"y(%d)(%d) = %0.3f\09\09 error =%f\0A\00"
@.str.7 = [28 x i8] c"\0A\0ATherefore y(%d) is %0.3f\0A\00"
@.str.8 = [27 x i8] c"Hence the answer is %0.3f\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca float
%3 = alloca float
%4 = alloca float
%5 = alloca float
%6 = alloca float
%7 = alloca float
%8 = alloca float
%9 = alloca float
%10 = alloca float
%11 = alloca i32
%12 = alloca i32
store i32 0, i32* %1
%13 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str, i64 0, i64 0))
%14 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), float* %2)
%15 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.2, i64 0, i64 0))
%16 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), float* %3)
%17 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.3, i64 0, i64 0))
%18 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), float* %6)
%19 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.4, i64 0, i64 0))
%20 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), float* %10)
%21 = load float, float* %2
%22 = load float, float* %6
%23 = fadd float %21, %22
store float %23, float* %4
store i32 1, i32* %11
br label %24
24: ; preds = %80, %0
%25 = load float, float* %4
%26 = load float, float* %10
%27 = load float, float* %6
%28 = fadd float %26, %27
%29 = fcmp ole float %25, %28
br i1 %29, label %30, label %94
30: ; preds = %24
%31 = load float, float* %3
%32 = load float, float* %6
%33 = load float, float* %2
%34 = fmul float 2.000000e+00, %33
%35 = load float, float* %2
%36 = fmul float %34, %35
%37 = call float @llvm.fmuladd.f32(float %32, float %36, float %31)
%38 = load float, float* %3
%39 = call float @llvm.fmuladd.f32(float 2.000000e+00, float %38, float %37)
store float %39, float* %5
%40 = load float, float* %4
%41 = fpext float %40 to double
%42 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([41 x i8], [41 x i8]* @.str.5, i64 0, i64 0), double %41)
store i32 1, i32* %12
store float 1.000000e+00, float* %9
br label %43
43: ; preds = %47, %30
%44 = load float, float* %9
%45 = fpext float %44 to double
%46 = fcmp ogt double %45, 5.000000e-05
br i1 %46, label %47, label %80
47: ; preds = %43
%48 = load float, float* %3
%49 = load float, float* %6
%50 = fdiv float %49, 2.000000e+00
%51 = load float, float* %2
%52 = fmul float 2.000000e+00, %51
%53 = load float, float* %2
%54 = load float, float* %3
%55 = fmul float 2.000000e+00, %54
%56 = call float @llvm.fmuladd.f32(float %52, float %53, float %55)
%57 = load float, float* %4
%58 = fmul float 2.000000e+00, %57
%59 = load float, float* %4
%60 = call float @llvm.fmuladd.f32(float %58, float %59, float %56)
%61 = load float, float* %5
%62 = call float @llvm.fmuladd.f32(float 2.000000e+00, float %61, float %60)
%63 = call float @llvm.fmuladd.f32(float %50, float %62, float %48)
store float %63, float* %8
%64 = load float, float* %8
%65 = load float, float* %5
%66 = fsub float %64, %65
%67 = fpext float %66 to double
%68 = call double @llvm.fabs.f64(double %67)
%69 = fptrunc double %68 to float
store float %69, float* %9
%70 = load i32, i32* %11
%71 = load i32, i32* %12
%72 = load float, float* %8
%73 = fpext float %72 to double
%74 = load float, float* %9
%75 = fpext float %74 to double
%76 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str.6, i64 0, i64 0), i32 %70, i32 %71, double %73, double %75)
%77 = load float, float* %8
store float %77, float* %5
%78 = load i32, i32* %12
%79 = add nsw i32 %78, 1
store i32 %79, i32* %12
br label %43
80: ; preds = %43
%81 = load i32, i32* %11
%82 = load float, float* %5
%83 = fpext float %82 to double
%84 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.7, i64 0, i64 0), i32 %81, double %83)
%85 = load float, float* %2
%86 = load float, float* %6
%87 = fadd float %85, %86
store float %87, float* %2
%88 = load float, float* %5
store float %88, float* %3
%89 = load float, float* %2
%90 = load float, float* %6
%91 = fadd float %89, %90
store float %91, float* %4
%92 = load i32, i32* %11
%93 = add nsw i32 %92, 1
store i32 %93, i32* %11
br label %24
94: ; preds = %24
%95 = load float, float* %5
%96 = fpext float %95 to double
%97 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.8, i64 0, i64 0), double %96)
%98 = load i32, i32* %1
ret i32 %98
}

LLVM IR (-O2):
@.str = [25 x i8] c"Enter the value of x(0):\00"
@.str.1 = [3 x i8] c"%f\00"
@.str.2 = [26 x i8] c"\0AEnter the value of y(0):\00"
@.str.3 = [29 x i8] c"\0AEnter the value of step(h):\00"
@.str.4 = [19 x i8] c"\0AEnter the x bound\00"
@.str.5 = [41 x i8] c"For x = %f ,the corresponding y i's are\0A\00"
@.str.6 = [31 x i8] c"y(%d)(%d) = %0.3f\09\09 error =%f\0A\00"
@.str.7 = [28 x i8] c"\0A\0ATherefore y(%d) is %0.3f\0A\00"
@.str.8 = [27 x i8] c"Hence the answer is %0.3f\0A\00"
define i32 @main() {
%1 = alloca float
%2 = alloca float
%3 = alloca float
%4 = alloca float
%5 = bitcast float* %1 to i8*
%6 = bitcast float* %2 to i8*
%7 = bitcast float* %3 to i8*
%8 = bitcast float* %4 to i8*
%9 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([25 x i8], [25 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), float* %1)
%11 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([26 x i8], [26 x i8]* @.str.2, i64 0, i64 0))
%12 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), float* %2)
%13 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([29 x i8], [29 x i8]* @.str.3, i64 0, i64 0))
%14 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), float* %3)
%15 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([19 x i8], [19 x i8]* @.str.4, i64 0, i64 0))
%16 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), float* %4)
%17 = load float, float* %1
%18 = load float, float* %3
%19 = fadd float %17, %18
%20 = load float, float* %4
%21 = fadd float %20, %18
%22 = fcmp ole float %19, %21
%23 = load float, float* %2
br label %24
24: ; preds = %0, %57
%25 = phi float [ %61, %57 ], [ %17, %0 ]
%26 = phi float [ %49, %57 ], [ %23, %0 ]
%27 = phi float [ %60, %57 ], [ %18, %0 ]
%28 = phi i32 [ %63, %57 ], [ 1, %0 ]
%29 = phi float [ %62, %57 ], [ %19, %0 ]
%30 = fmul float %25, 2.000000e+00
%31 = fmul float %25, %30
%32 = call float @llvm.fmuladd.f32(float %27, float %31, float %26)
%33 = call float @llvm.fmuladd.f32(float %26, float 2.000000e+00, float %32)
%34 = fpext float %29 to double
%35 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([41 x i8], [41 x i8]* @.str.5, i64 0, i64 0), double %34)
%36 = fmul float %29, 2.000000e+00
br label %37
37: ; preds = %24, %37
%38 = phi i32 [ 1, %24 ], [ %55, %37 ]
%39 = phi float [ %33, %24 ], [ %49, %37 ]
%40 = load float, float* %2
%41 = load float, float* %3
%42 = fmul float %41, 5.000000e-01
%43 = load float, float* %1
%44 = fmul float %43, 2.000000e+00
%45 = fmul float %40, 2.000000e+00
%46 = call float @llvm.fmuladd.f32(float %44, float %43, float %45)
%47 = call float @llvm.fmuladd.f32(float %36, float %29, float %46)
%48 = call float @llvm.fmuladd.f32(float %39, float 2.000000e+00, float %47)
%49 = call float @llvm.fmuladd.f32(float %42, float %48, float %40)
%50 = fsub float %49, %39
%51 = call float @llvm.fabs.f32(float %50)
%52 = fpext float %49 to double
%53 = fpext float %51 to double
%54 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([31 x i8], [31 x i8]* @.str.6, i64 0, i64 0), i32 %28, i32 %38, double %52, double %53)
%55 = add nuw nsw i32 %38, 1
%56 = fcmp ogt double %53, 5.000000e-05
br i1 %56, label %37, label %57
57: ; preds = %37
%58 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([28 x i8], [28 x i8]* @.str.7, i64 0, i64 0), i32 %28, double %52)
%59 = load float, float* %1
%60 = load float, float* %3
%61 = fadd float %59, %60
store float %61, float* %1
store float %49, float* %2
%62 = fadd float %60, %61
%63 = add nuw nsw i32 %28, 1
%64 = load float, float* %4
%65 = fadd float %64, %60
%66 = fcmp ugt float %62, %65
br i1 %66, label %67, label %24
67: ; preds = %57
%68 = fpext float %49 to double
%69 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([27 x i8], [27 x i8]* @.str.8, i64 0, i64 0), double %68)
ret i32 0
}