int main() {
  double y0, x0, y1, x1, y1_0, a, n, h, f, f1;
  int j, count, flag;
  printf("\nEnter the value of x0: ");
  scanf("%lf", &x0);
  printf("\nEnter the value of y0: ");
  scanf("%lf", &y0);
  printf("\nEnter the value of h: ");
  scanf("%lf", &h);
  printf("\nEnter the value of last point: ");
  scanf("%lf", &n);
  for (x1 = x0 + h, j = 1; x1 <= n + h; x1 = x1 + h, j++) {
    count = 0;
    flag = 0;
    f = (x0) * (x0) + (y0);
    y1_0 = y0 + (h * f);
    printf("\n\n * * y%d_0 = %.3lf * *", j, y1_0);
    do {
      count++;
      f = (x0) * (x0) + (y0);
      f1 = (x1) * (x1) + (y1_0);
      y1 = y0 + h / 2 * (f + f1);
      printf("\n\n * * x = %.3lf => y%d_%d = %.3lf * *", x1, j, count, y1);
      if (fabs(y1 - y1_0) < 0.00001) {
        printf("\n\n\n\n * * * * y%d = %.3lf * * * *\n\n", j, y1);
        flag = 1;
      } else
        y1_0 = y1;
    } while (flag != 1);
    y0 = y1;
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x70,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeea(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xef5(%rip),%rdi
lea    -0x18(%rbp),%rsi
mov    $0x0,%al
call   1040 <scanf@plt>
lea    0xee7(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xed5(%rip),%rdi
lea    -0x10(%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    -0x48(%rbp),%rsi
mov    $0x0,%al
call   1040 <scanf@plt>
lea    0xed8(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xe95(%rip),%rdi
lea    -0x40(%rbp),%rsi
mov    $0x0,%al
call   1040 <scanf@plt>
movsd  -0x18(%rbp),%xmm0
addsd  -0x48(%rbp),%xmm0
movsd  %xmm0,-0x28(%rbp)
movl   $0x1,-0x5c(%rbp)
movsd  -0x28(%rbp),%xmm1
movsd  -0x40(%rbp),%xmm0
addsd  -0x48(%rbp),%xmm0
ucomisd %xmm1,%xmm0
jb     134f <main+0x22f>
movl   $0x0,-0x60(%rbp)
movl   $0x0,-0x64(%rbp)
movsd  -0x18(%rbp),%xmm0
movsd  -0x18(%rbp),%xmm2
movsd  -0x10(%rbp),%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x50(%rbp)
movsd  -0x10(%rbp),%xmm1
movsd  -0x48(%rbp),%xmm0
movsd  -0x50(%rbp),%xmm2
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x30(%rbp)
mov    -0x5c(%rbp),%esi
movsd  -0x30(%rbp),%xmm0
lea    0xe5c(%rip),%rdi
mov    $0x1,%al
call   1030 <printf@plt>
mov    -0x60(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x60(%rbp)
movsd  -0x18(%rbp),%xmm0
movsd  -0x18(%rbp),%xmm2
movsd  -0x10(%rbp),%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x50(%rbp)
movsd  -0x28(%rbp),%xmm0
movsd  -0x28(%rbp),%xmm2
movsd  -0x30(%rbp),%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x58(%rbp)
movsd  -0x10(%rbp),%xmm1
movsd  -0x48(%rbp),%xmm0
movsd  0xd7b(%rip),%xmm2
divsd  %xmm2,%xmm0
movsd  -0x50(%rbp),%xmm2
addsd  -0x58(%rbp),%xmm2
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x20(%rbp)
movsd  -0x28(%rbp),%xmm0
mov    -0x5c(%rbp),%esi
mov    -0x60(%rbp),%edx
movsd  -0x20(%rbp),%xmm1
lea    0xde9(%rip),%rdi
mov    $0x2,%al
call   1030 <printf@plt>
movsd  -0x20(%rbp),%xmm1
subsd  -0x30(%rbp),%xmm1
movaps 0xd39(%rip),%xmm0
pand   %xmm0,%xmm1
movsd  0xd1d(%rip),%xmm0
ucomisd %xmm1,%xmm0
jbe    130f <main+0x1ef>
mov    -0x5c(%rbp),%esi
movsd  -0x20(%rbp),%xmm0
lea    0xdd3(%rip),%rdi
mov    $0x1,%al
call   1030 <printf@plt>
movl   $0x1,-0x64(%rbp)
jmp    1319 <main+0x1f9>
movsd  -0x20(%rbp),%xmm0
movsd  %xmm0,-0x30(%rbp)
jmp    131e <main+0x1fe>
cmpl   $0x1,-0x64(%rbp)
jne    123a <main+0x11a>
movsd  -0x20(%rbp),%xmm0
movsd  %xmm0,-0x10(%rbp)
movsd  -0x28(%rbp),%xmm0
addsd  -0x48(%rbp),%xmm0
movsd  %xmm0,-0x28(%rbp)
mov    -0x5c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x5c(%rbp)
jmp    11c5 <main+0xa5>
xor    %eax,%eax
add    $0x70,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
sub    $0x50,%rsp
lea    0xeed(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
lea    0xef8(%rip),%rbx
lea    0x8(%rsp),%rsi
mov    %rbx,%rdi
xor    %eax,%eax
call   1040 <scanf@plt>
lea    0xee6(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
lea    0x10(%rsp),%rsi
mov    %rbx,%rdi
xor    %eax,%eax
call   1040 <scanf@plt>
lea    0xee2(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
mov    %rsp,%rsi
mov    %rbx,%rdi
xor    %eax,%eax
call   1040 <scanf@plt>
lea    0xedf(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
lea    0x18(%rsp),%rsi
mov    %rbx,%rdi
xor    %eax,%eax
call   1040 <scanf@plt>
movsd  0x8(%rsp),%xmm1
movsd  (%rsp),%xmm4
movapd %xmm1,%xmm3
addsd  %xmm4,%xmm3
movsd  0x18(%rsp),%xmm2
addsd  %xmm4,%xmm2
ucomisd %xmm3,%xmm2
jae    11d7 <main+0xb7>
xor    %eax,%eax
add    $0x50,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
ret
movapd %xmm3,0x30(%rsp)
mov    $0x1,%ebx
movsd  0x10(%rsp),%xmm0
lea    0xea0(%rip),%r14
lea    0xeb2(%rip),%r15
lea    0xed2(%rip),%r12
nopl   (%rax)
mulsd  %xmm1,%xmm1
addsd  %xmm0,%xmm1
mulsd  %xmm4,%xmm1
addsd  %xmm1,%xmm0
movapd %xmm0,0x20(%rsp)
mov    %r14,%rdi
mov    %ebx,%esi
mov    $0x1,%al
call   1030 <printf@plt>
movapd 0x20(%rsp),%xmm0
mov    $0x1,%ebp
nopl   (%rax)
movapd %xmm0,%xmm4
movapd %xmm0,0x40(%rsp)
movsd  0x10(%rsp),%xmm3
movsd  0x8(%rsp),%xmm1
movapd 0x30(%rsp),%xmm0
movapd %xmm0,%xmm2
unpcklpd %xmm1,%xmm2
movapd %xmm4,%xmm1
unpcklpd %xmm3,%xmm1
mulpd  %xmm2,%xmm2
addpd  %xmm1,%xmm2
movsd  (%rsp),%xmm4
mulsd  0xd8f(%rip),%xmm4
movapd %xmm2,%xmm1
unpckhpd %xmm2,%xmm1
addsd  %xmm2,%xmm1
mulsd  %xmm4,%xmm1
addsd  %xmm3,%xmm1
movapd %xmm1,0x20(%rsp)
mov    %r15,%rdi
mov    %ebx,%esi
mov    %ebp,%edx
mov    $0x2,%al
call   1030 <printf@plt>
movapd 0x20(%rsp),%xmm0
movapd %xmm0,%xmm1
subsd  0x40(%rsp),%xmm1
andpd  0xd5f(%rip),%xmm1
add    $0x1,%ebp
movsd  0xd4c(%rip),%xmm2
ucomisd %xmm1,%xmm2
jbe    1230 <main+0x110>
mov    %r12,%rdi
mov    %ebx,%esi
mov    $0x1,%al
call   1030 <printf@plt>
movapd 0x20(%rsp),%xmm0
movsd  %xmm0,0x10(%rsp)
movsd  (%rsp),%xmm4
movapd 0x30(%rsp),%xmm2
addsd  %xmm4,%xmm2
movsd  0x18(%rsp),%xmm1
addsd  %xmm4,%xmm1
ucomisd %xmm2,%xmm1
jb     11c8 <main+0xa8>
movapd %xmm2,%xmm1
movapd %xmm2,0x30(%rsp)
add    $0x1,%ebx
movsd  0x8(%rsp),%xmm1
jmp    1200 <main+0xe0>

LLVM IR (-O0):
@.str = [25 x i8] c"\0AEnter the value of x0: \00"
@.str.1 = [4 x i8] c"%lf\00"
@.str.2 = [25 x i8] c"\0AEnter the value of y0: \00"
@.str.3 = [24 x i8] c"\0AEnter the value of h: \00"
@.str.4 = [33 x i8] c"\0AEnter the value of last point: \00"
@.str.5 = [25 x i8] c"\0A\0A * * y%d_0 = %.3lf * *\00"
@.str.6 = [39 x i8] c"\0A\0A * * x = %.3lf => y%d_%d = %.3lf * *\00"
@.str.7 = [35 x i8] c"\0A\0A\0A\0A * * * * y%d = %.3lf * * * *\0A\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca double
%3 = alloca double
%4 = alloca double
%5 = alloca double
%6 = alloca double
%7 = alloca double
%8 = alloca double
%9 = alloca double
%10 = alloca double
%11 = alloca double
%12 = alloca i32
%13 = alloca i32
%14 = alloca i32
store i32 0, i32* %1
%15 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str, i64 0, i64 0))
%16 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), double* %3)
%17 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.2, i64 0, i64 0))
%18 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), double* %2)
%19 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.3, i64 0, i64 0))
%20 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), double* %9)
%21 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str.4, i64 0, i64 0))
%22 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), double* %8)
%23 = load double, double* %3
%24 = load double, double* %9
%25 = fadd double %23, %24
store double %25, double* %5
store i32 1, i32* %12
br label %26
26: ; preds = %84, %0
%27 = load double, double* %5
%28 = load double, double* %8
%29 = load double, double* %9
%30 = fadd double %28, %29
%31 = fcmp ole double %27, %30
br i1 %31, label %32, label %90
32: ; preds = %26
store i32 0, i32* %13
store i32 0, i32* %14
%33 = load double, double* %3
%34 = load double, double* %3
%35 = load double, double* %2
%36 = call double @llvm.fmuladd.f64(double %33, double %34, double %35)
store double %36, double* %10
%37 = load double, double* %2
%38 = load double, double* %9
%39 = load double, double* %10
%40 = call double @llvm.fmuladd.f64(double %38, double %39, double %37)
store double %40, double* %6
%41 = load i32, i32* %12
%42 = load double, double* %6
%43 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.5, i64 0, i64 0), i32 %41, double %42)
br label %44
44: ; preds = %79, %32
%45 = load i32, i32* %13
%46 = add nsw i32 %45, 1
store i32 %46, i32* %13
%47 = load double, double* %3
%48 = load double, double* %3
%49 = load double, double* %2
%50 = call double @llvm.fmuladd.f64(double %47, double %48, double %49)
store double %50, double* %10
%51 = load double, double* %5
%52 = load double, double* %5
%53 = load double, double* %6
%54 = call double @llvm.fmuladd.f64(double %51, double %52, double %53)
store double %54, double* %11
%55 = load double, double* %2
%56 = load double, double* %9
%57 = fdiv double %56, 2.000000e+00
%58 = load double, double* %10
%59 = load double, double* %11
%60 = fadd double %58, %59
%61 = call double @llvm.fmuladd.f64(double %57, double %60, double %55)
store double %61, double* %4
%62 = load double, double* %5
%63 = load i32, i32* %12
%64 = load i32, i32* %13
%65 = load double, double* %4
%66 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([39 x i8], [39 x i8]* @.str.6, i64 0, i64 0), double %62, i32 %63, i32 %64, double %65)
%67 = load double, double* %4
%68 = load double, double* %6
%69 = fsub double %67, %68
%70 = call double @llvm.fabs.f64(double %69)
%71 = fcmp olt double %70, 1.000000e-05
br i1 %71, label %72, label %76
72: ; preds = %44
%73 = load i32, i32* %12
%74 = load double, double* %4
%75 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str.7, i64 0, i64 0), i32 %73, double %74)
store i32 1, i32* %14
br label %78
76: ; preds = %44
%77 = load double, double* %4
store double %77, double* %6
br label %78
78: ; preds = %76, %72
br label %79
79: ; preds = %78
%80 = load i32, i32* %14
%81 = icmp ne i32 %80, 1
br i1 %81, label %44, label %82
82: ; preds = %79
%83 = load double, double* %4
store double %83, double* %2
br label %84
84: ; preds = %82
%85 = load double, double* %5
%86 = load double, double* %9
%87 = fadd double %85, %86
store double %87, double* %5
%88 = load i32, i32* %12
%89 = add nsw i32 %88, 1
store i32 %89, i32* %12
br label %26
90: ; preds = %26
ret i32 0
}

LLVM IR (-O2):
@.str = [25 x i8] c"\0AEnter the value of x0: \00"
@.str.1 = [4 x i8] c"%lf\00"
@.str.2 = [25 x i8] c"\0AEnter the value of y0: \00"
@.str.3 = [24 x i8] c"\0AEnter the value of h: \00"
@.str.4 = [33 x i8] c"\0AEnter the value of last point: \00"
@.str.5 = [25 x i8] c"\0A\0A * * y%d_0 = %.3lf * *\00"
@.str.6 = [39 x i8] c"\0A\0A * * x = %.3lf => y%d_%d = %.3lf * *\00"
@.str.7 = [35 x i8] c"\0A\0A\0A\0A * * * * y%d = %.3lf * * * *\0A\0A\00"
define i32 @main() {
%1 = alloca double
%2 = alloca double
%3 = alloca double
%4 = alloca double
%5 = bitcast double* %1 to i8*
%6 = bitcast double* %2 to i8*
%7 = bitcast double* %3 to i8*
%8 = bitcast double* %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 ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), double* %2)
%11 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([25 x i8], [25 x i8]* @.str.2, i64 0, i64 0))
%12 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), double* %1)
%13 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([24 x i8], [24 x i8]* @.str.3, i64 0, i64 0))
%14 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), double* %4)
%15 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([33 x i8], [33 x i8]* @.str.4, i64 0, i64 0))
%16 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), double* %3)
%17 = load double, double* %2
%18 = load double, double* %4
%19 = fadd double %17, %18
%20 = load double, double* %3
%21 = fadd double %20, %18
%22 = fcmp ugt double %19, %21
br i1 %22, label %67, label %23
23: ; preds = %0
%24 = load double, double* %1
br label %25
25: ; preds = %64, %23
%26 = phi double [ %52, %64 ], [ %24, %23 ]
%27 = phi double [ %66, %64 ], [ %17, %23 ]
%28 = phi double [ %59, %64 ], [ %18, %23 ]
%29 = phi i32 [ %65, %64 ], [ 1, %23 ]
%30 = phi double [ %60, %64 ], [ %19, %23 ]
%31 = call double @llvm.fmuladd.f64(double %27, double %27, double %26)
%32 = call double @llvm.fmuladd.f64(double %28, double %31, double %26)
%33 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([25 x i8], [25 x i8]* @.str.5, i64 0, i64 0), i32 %29, double %32)
%34 = insertelement <2 x double> poison, double %30, i64 0
%35 = insertelement <2 x double> poison, double %30, i64 0
br label %36
36: ; preds = %36, %25
%37 = phi double [ %32, %25 ], [ %52, %36 ]
%38 = phi i32 [ 0, %25 ], [ %39, %36 ]
%39 = add nuw nsw i32 %38, 1
%40 = load double, double* %2
%41 = load double, double* %1
%42 = insertelement <2 x double> %34, double %40, i64 1
%43 = insertelement <2 x double> %35, double %40, i64 1
%44 = insertelement <2 x double> poison, double %37, i64 0
%45 = insertelement <2 x double> %44, double %41, i64 1
%46 = call <2 x double> @llvm.fmuladd.v2f64(<2 x double> %42, <2 x double> %43, <2 x double> %45)
%47 = load double, double* %4
%48 = fmul double %47, 5.000000e-01
%49 = shufflevector <2 x double> %46, <2 x double> poison, <2 x i32> <i32 1, i32 undef>
%50 = fadd <2 x double> %46, %49
%51 = extractelement <2 x double> %50, i64 0
%52 = call double @llvm.fmuladd.f64(double %48, double %51, double %41)
%53 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([39 x i8], [39 x i8]* @.str.6, i64 0, i64 0), double %30, i32 %29, i32 %39, double %52)
%54 = fsub double %52, %37
%55 = call double @llvm.fabs.f64(double %54)
%56 = fcmp olt double %55, 1.000000e-05
br i1 %56, label %57, label %36
57: ; preds = %36
%58 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([35 x i8], [35 x i8]* @.str.7, i64 0, i64 0), i32 %29, double %52)
store double %52, double* %1
%59 = load double, double* %4
%60 = fadd double %30, %59
%61 = load double, double* %3
%62 = fadd double %61, %59
%63 = fcmp ugt double %60, %62
br i1 %63, label %67, label %64
64: ; preds = %57
%65 = add nuw nsw i32 %29, 1
%66 = load double, double* %2
br label %25
67: ; preds = %57, %0
ret i32 0
}