#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 /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ scanf(char *, float *);
main() {
  float a, x;
  int i = 1;
  printf("enter the first approximation:");
  scanf("%f", &a);
  printf("\n");
  x = a - (((a * a * a) - (4 * a) - 9) / ((3 * a * a) - 4));
  printf("%dapproximation of the root:%f", i, x);
  printf("\tf(x)=%f", ((x * x * x) - (4 * x) - 9));
  i++;
  printf("\n");
  while (((x * x * x) - (4 * x) - 9) > 0.00001 ||
         ((x * x * x) - (4 * x) - 9) < -0.00001) {
    a = x;
    x = a - (((a * a * a) - (4 * a) - 9) / ((3 * a * a) - 4));
    printf("%dapproximation of the root:%f", i, x);
    printf("\tf(x)=%f", ((x * x * x) - (4 * x) - 9));
    i++;
    printf("\n");
  }
  printf("\n");
  printf("root of the equation is:%f", x);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x1,-0x10(%rbp)
lea    0xee3(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xf36(%rip),%rdi
lea    -0x8(%rbp),%rsi
call   1040 <scanf@plt>
lea    0xee4(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movss  -0x8(%rbp),%xmm0
movss  -0x8(%rbp),%xmm1
mulss  -0x8(%rbp),%xmm1
movss  -0x8(%rbp),%xmm3
movss  0xe86(%rip),%xmm2
mulss  -0x8(%rbp),%xmm2
movd   %xmm2,%eax
xor    $0x80000000,%eax
movd   %eax,%xmm2
mulss  %xmm3,%xmm1
addss  %xmm2,%xmm1
movss  0xe60(%rip),%xmm2
subss  %xmm2,%xmm1
movss  0xe60(%rip),%xmm2
mulss  -0x8(%rbp),%xmm2
movss  -0x8(%rbp),%xmm3
mulss  %xmm3,%xmm2
movss  0xe46(%rip),%xmm3
addss  %xmm3,%xmm2
divss  %xmm2,%xmm1
subss  %xmm1,%xmm0
movss  %xmm0,-0xc(%rbp)
mov    -0x10(%rbp),%esi
movss  -0xc(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
lea    0xe5b(%rip),%rdi
mov    $0x1,%al
call   1030 <printf@plt>
movss  -0xc(%rbp),%xmm0
mulss  -0xc(%rbp),%xmm0
movss  -0xc(%rbp),%xmm2
movss  0xe00(%rip),%xmm1
mulss  -0xc(%rbp),%xmm1
movd   %xmm1,%eax
xor    $0x80000000,%eax
movd   %eax,%xmm1
mulss  %xmm2,%xmm0
addss  %xmm1,%xmm0
movss  0xdda(%rip),%xmm1
subss  %xmm1,%xmm0
cvtss2sd %xmm0,%xmm0
lea    0xe2b(%rip),%rdi
mov    $0x1,%al
call   1030 <printf@plt>
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
lea    0xdf3(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movss  -0xc(%rbp),%xmm0
mulss  -0xc(%rbp),%xmm0
movss  -0xc(%rbp),%xmm2
movss  0xd9a(%rip),%xmm1
mulss  -0xc(%rbp),%xmm1
movd   %xmm1,%eax
xor    $0x80000000,%eax
movd   %eax,%xmm1
mulss  %xmm2,%xmm0
addss  %xmm1,%xmm0
movss  0xd74(%rip),%xmm1
subss  %xmm1,%xmm0
cvtss2sd %xmm0,%xmm0
mov    $0x1,%al
movsd  0xd72(%rip),%xmm1
ucomisd %xmm1,%xmm0
mov    %al,-0x11(%rbp)
ja     12fe <main+0x1de>
movss  -0xc(%rbp),%xmm0
mulss  -0xc(%rbp),%xmm0
movss  -0xc(%rbp),%xmm2
movss  0xd42(%rip),%xmm1
mulss  -0xc(%rbp),%xmm1
movd   %xmm1,%eax
xor    $0x80000000,%eax
movd   %eax,%xmm1
mulss  %xmm2,%xmm0
addss  %xmm1,%xmm0
movss  0xd1c(%rip),%xmm1
subss  %xmm1,%xmm0
cvtss2sd %xmm0,%xmm1
movsd  0xd24(%rip),%xmm0
ucomisd %xmm1,%xmm0
seta   %al
mov    %al,-0x11(%rbp)
mov    -0x11(%rbp),%al
test   $0x1,%al
jne    130e <main+0x1ee>
jmp    140e <main+0x2ee>
movss  -0xc(%rbp),%xmm0
movss  %xmm0,-0x8(%rbp)
movss  -0x8(%rbp),%xmm0
movss  -0x8(%rbp),%xmm1
mulss  -0x8(%rbp),%xmm1
movss  -0x8(%rbp),%xmm3
movss  0xcd0(%rip),%xmm2
mulss  -0x8(%rbp),%xmm2
movd   %xmm2,%eax
xor    $0x80000000,%eax
movd   %eax,%xmm2
mulss  %xmm3,%xmm1
addss  %xmm2,%xmm1
movss  0xcaa(%rip),%xmm2
subss  %xmm2,%xmm1
movss  0xcaa(%rip),%xmm2
mulss  -0x8(%rbp),%xmm2
movss  -0x8(%rbp),%xmm3
mulss  %xmm3,%xmm2
movss  0xc90(%rip),%xmm3
addss  %xmm3,%xmm2
divss  %xmm2,%xmm1
subss  %xmm1,%xmm0
movss  %xmm0,-0xc(%rbp)
mov    -0x10(%rbp),%esi
movss  -0xc(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
lea    0xca5(%rip),%rdi
mov    $0x1,%al
call   1030 <printf@plt>
movss  -0xc(%rbp),%xmm0
mulss  -0xc(%rbp),%xmm0
movss  -0xc(%rbp),%xmm2
movss  0xc4a(%rip),%xmm1
mulss  -0xc(%rbp),%xmm1
movd   %xmm1,%eax
xor    $0x80000000,%eax
movd   %eax,%xmm1
mulss  %xmm2,%xmm0
addss  %xmm1,%xmm0
movss  0xc24(%rip),%xmm1
subss  %xmm1,%xmm0
cvtss2sd %xmm0,%xmm0
lea    0xc75(%rip),%rdi
mov    $0x1,%al
call   1030 <printf@plt>
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
lea    0xc3d(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    1253 <main+0x133>
lea    0xc2a(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movss  -0xc(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
lea    0xc3d(%rip),%rdi
mov    $0x1,%al
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %rbx
sub    $0x20,%rsp
lea    0xee0(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xf31(%rip),%rdi
lea    0xc(%rsp),%rsi
call   1050 <scanf@plt>
mov    $0xa,%edi
call   1030 <putchar@plt>
movss  0xc(%rsp),%xmm2
movaps %xmm2,%xmm0
mulss  %xmm2,%xmm0
movss  0xe89(%rip),%xmm3
movaps %xmm2,%xmm1
mulss  %xmm3,%xmm1
mulss  %xmm2,%xmm0
addss  %xmm1,%xmm0
addss  0xe76(%rip),%xmm0
movss  0xe72(%rip),%xmm1
mulss  %xmm2,%xmm1
mulss  %xmm2,%xmm1
addss  %xmm3,%xmm1
divss  %xmm1,%xmm0
subss  %xmm0,%xmm2
movss  %xmm2,0x4(%rsp)
xorps  %xmm0,%xmm0
cvtss2sd %xmm2,%xmm0
lea    0xe81(%rip),%rdi
mov    $0x1,%esi
movsd  %xmm0,0x18(%rsp)
mov    $0x1,%al
call   1040 <printf@plt>
movss  0x4(%rsp),%xmm2
movaps %xmm2,%xmm1
mulss  %xmm2,%xmm1
movaps %xmm2,%xmm0
mulss  0xe18(%rip),%xmm0
mulss  %xmm2,%xmm1
addss  %xmm0,%xmm1
addss  0xe0c(%rip),%xmm1
movss  %xmm1,0x8(%rsp)
xorps  %xmm0,%xmm0
cvtss2sd %xmm1,%xmm0
movsd  %xmm0,0x10(%rsp)
lea    0xe4c(%rip),%rdi
mov    $0x1,%al
call   1040 <printf@plt>
mov    $0xa,%edi
call   1030 <putchar@plt>
movsd  0x10(%rsp),%xmm1
ucomisd 0xddf(%rip),%xmm1
ja     1245 <main+0x115>
movsd  0xddd(%rip),%xmm0
ucomisd %xmm1,%xmm0
jbe    132c <main+0x1fc>
mov    $0x2,%ebx
lea    0xdee(%rip),%r14
lea    0xe06(%rip),%r15
nopl   0x0(%rax,%rax,1)
movss  0x4(%rsp),%xmm2
movss  %xmm2,0xc(%rsp)
movaps %xmm2,%xmm0
mulss  0xd91(%rip),%xmm0
mulss  %xmm2,%xmm0
movss  0xd7d(%rip),%xmm1
addss  %xmm1,%xmm0
movss  0x8(%rsp),%xmm1
divss  %xmm0,%xmm1
subss  %xmm1,%xmm2
movss  %xmm2,0x4(%rsp)
xorps  %xmm0,%xmm0
cvtss2sd %xmm2,%xmm0
mov    %r14,%rdi
mov    %ebx,%esi
movsd  %xmm0,0x18(%rsp)
mov    $0x1,%al
call   1040 <printf@plt>
movss  0x4(%rsp),%xmm2
movaps %xmm2,%xmm1
mulss  %xmm2,%xmm1
movaps %xmm2,%xmm0
mulss  0xd34(%rip),%xmm0
mulss  %xmm2,%xmm1
addss  %xmm0,%xmm1
addss  0xd28(%rip),%xmm1
movss  %xmm1,0x8(%rsp)
xorps  %xmm0,%xmm0
cvtss2sd %xmm1,%xmm0
movsd  %xmm0,0x10(%rsp)
mov    %r15,%rdi
mov    $0x1,%al
call   1040 <printf@plt>
add    $0x1,%ebx
mov    $0xa,%edi
call   1030 <putchar@plt>
movsd  0x10(%rsp),%xmm1
ucomisd 0xcfc(%rip),%xmm1
ja     1260 <main+0x130>
movsd  0xcf6(%rip),%xmm0
ucomisd %xmm1,%xmm0
ja     1260 <main+0x130>
mov    $0xa,%edi
call   1030 <putchar@plt>
lea    0xd2a(%rip),%rdi
movsd  0x18(%rsp),%xmm0
mov    $0x1,%al
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [31 x i8] c"enter the first approximation:\00"
@.str.1 = [3 x i8] c"%f\00"
@.str.2 = [2 x i8] c"\0A\00"
@.str.3 = [31 x i8] c"%dapproximation of the root:%f\00"
@.str.4 = [9 x i8] c"\09f(x)=%f\00"
@.str.5 = [27 x i8] c"root of the equation is:%f\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca float
%3 = alloca float
%4 = alloca i32
store i32 0, i32* %1
store i32 1, i32* %4
%5 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str, i64 0, i64 0))
%6 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), float* %2)
%7 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
%8 = load float, float* %2
%9 = load float, float* %2
%10 = load float, float* %2
%11 = fmul float %9, %10
%12 = load float, float* %2
%13 = load float, float* %2
%14 = fmul float 4.000000e+00, %13
%15 = fneg float %14
%16 = call float @llvm.fmuladd.f32(float %11, float %12, float %15)
%17 = fsub float %16, 9.000000e+00
%18 = load float, float* %2
%19 = fmul float 3.000000e+00, %18
%20 = load float, float* %2
%21 = call float @llvm.fmuladd.f32(float %19, float %20, float -4.000000e+00)
%22 = fdiv float %17, %21
%23 = fsub float %8, %22
store float %23, float* %3
%24 = load i32, i32* %4
%25 = load float, float* %3
%26 = fpext float %25 to double
%27 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str.3, i64 0, i64 0), i32 %24, double %26)
%28 = load float, float* %3
%29 = load float, float* %3
%30 = fmul float %28, %29
%31 = load float, float* %3
%32 = load float, float* %3
%33 = fmul float 4.000000e+00, %32
%34 = fneg float %33
%35 = call float @llvm.fmuladd.f32(float %30, float %31, float %34)
%36 = fsub float %35, 9.000000e+00
%37 = fpext float %36 to double
%38 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.4, i64 0, i64 0), double %37)
%39 = load i32, i32* %4
%40 = add nsw i32 %39, 1
store i32 %40, i32* %4
%41 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
br label %42
42: ; preds = %68, %0
%43 = load float, float* %3
%44 = load float, float* %3
%45 = fmul float %43, %44
%46 = load float, float* %3
%47 = load float, float* %3
%48 = fmul float 4.000000e+00, %47
%49 = fneg float %48
%50 = call float @llvm.fmuladd.f32(float %45, float %46, float %49)
%51 = fsub float %50, 9.000000e+00
%52 = fpext float %51 to double
%53 = fcmp ogt double %52, 1.000000e-05
br i1 %53, label %66, label %54
54: ; preds = %42
%55 = load float, float* %3
%56 = load float, float* %3
%57 = fmul float %55, %56
%58 = load float, float* %3
%59 = load float, float* %3
%60 = fmul float 4.000000e+00, %59
%61 = fneg float %60
%62 = call float @llvm.fmuladd.f32(float %57, float %58, float %61)
%63 = fsub float %62, 9.000000e+00
%64 = fpext float %63 to double
%65 = fcmp olt double %64, -1.000000e-05
br label %66
66: ; preds = %54, %42
%67 = phi i1 [ true, %42 ], [ %65, %54 ]
br i1 %67, label %68, label %104
68: ; preds = %66
%69 = load float, float* %3
store float %69, float* %2
%70 = load float, float* %2
%71 = load float, float* %2
%72 = load float, float* %2
%73 = fmul float %71, %72
%74 = load float, float* %2
%75 = load float, float* %2
%76 = fmul float 4.000000e+00, %75
%77 = fneg float %76
%78 = call float @llvm.fmuladd.f32(float %73, float %74, float %77)
%79 = fsub float %78, 9.000000e+00
%80 = load float, float* %2
%81 = fmul float 3.000000e+00, %80
%82 = load float, float* %2
%83 = call float @llvm.fmuladd.f32(float %81, float %82, float -4.000000e+00)
%84 = fdiv float %79, %83
%85 = fsub float %70, %84
store float %85, float* %3
%86 = load i32, i32* %4
%87 = load float, float* %3
%88 = fpext float %87 to double
%89 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str.3, i64 0, i64 0), i32 %86, double %88)
%90 = load float, float* %3
%91 = load float, float* %3
%92 = fmul float %90, %91
%93 = load float, float* %3
%94 = load float, float* %3
%95 = fmul float 4.000000e+00, %94
%96 = fneg float %95
%97 = call float @llvm.fmuladd.f32(float %92, float %93, float %96)
%98 = fsub float %97, 9.000000e+00
%99 = fpext float %98 to double
%100 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.4, i64 0, i64 0), double %99)
%101 = load i32, i32* %4
%102 = add nsw i32 %101, 1
store i32 %102, i32* %4
%103 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
br label %42
104: ; preds = %66
%105 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
%106 = load float, float* %3
%107 = fpext float %106 to double
%108 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.5, i64 0, i64 0), double %107)
ret i32 0
}

LLVM IR (-O2):
@.str = [31 x i8] c"enter the first approximation:\00"
@.str.1 = [3 x i8] c"%f\00"
@.str.3 = [31 x i8] c"%dapproximation of the root:%f\00"
@.str.4 = [9 x i8] c"\09f(x)=%f\00"
@.str.5 = [27 x i8] c"root of the equation is:%f\00"
define i32 @main() {
%1 = alloca float
%2 = bitcast float* %1 to i8*
%3 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([31 x i8], [31 x i8]* @.str, i64 0, i64 0))
%4 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), float* %1)
%5 = call i32 @putchar(i32 10)
%6 = load float, float* %1
%7 = fmul float %6, %6
%8 = fmul float %6, -4.000000e+00
%9 = call float @llvm.fmuladd.f32(float %7, float %6, float %8)
%10 = fadd float %9, -9.000000e+00
%11 = fmul float %6, 3.000000e+00
%12 = call float @llvm.fmuladd.f32(float %11, float %6, float -4.000000e+00)
%13 = fdiv float %10, %12
%14 = fsub float %6, %13
%15 = fpext float %14 to double
%16 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([31 x i8], [31 x i8]* @.str.3, i64 0, i64 0), i32 1, double %15)
%17 = fmul float %14, %14
%18 = fmul float %14, -4.000000e+00
%19 = call float @llvm.fmuladd.f32(float %17, float %14, float %18)
%20 = fadd float %19, -9.000000e+00
%21 = fpext float %20 to double
%22 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([9 x i8], [9 x i8]* @.str.4, i64 0, i64 0), double %21)
%23 = call i32 @putchar(i32 10)
%24 = fcmp ogt double %21, 1.000000e-05
%25 = fcmp olt double %21, -1.000000e-05
%26 = or i1 %24, %25
br i1 %26, label %27, label %48
27: ; preds = %0, %27
%28 = phi float [ %40, %27 ], [ %20, %0 ]
%29 = phi i32 [ %43, %27 ], [ 2, %0 ]
%30 = phi float [ %34, %27 ], [ %14, %0 ]
store float %30, float* %1
%31 = fmul float %30, 3.000000e+00
%32 = call float @llvm.fmuladd.f32(float %31, float %30, float -4.000000e+00)
%33 = fdiv float %28, %32
%34 = fsub float %30, %33
%35 = fpext float %34 to double
%36 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([31 x i8], [31 x i8]* @.str.3, i64 0, i64 0), i32 %29, double %35)
%37 = fmul float %34, %34
%38 = fmul float %34, -4.000000e+00
%39 = call float @llvm.fmuladd.f32(float %37, float %34, float %38)
%40 = fadd float %39, -9.000000e+00
%41 = fpext float %40 to double
%42 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([9 x i8], [9 x i8]* @.str.4, i64 0, i64 0), double %41)
%43 = add nuw nsw i32 %29, 1
%44 = call i32 @putchar(i32 10)
%45 = fcmp ogt double %41, 1.000000e-05
%46 = fcmp olt double %41, -1.000000e-05
%47 = or i1 %45, %46
br i1 %47, label %27, label %48
48: ; preds = %27, %0
%49 = phi double [ %15, %0 ], [ %35, %27 ]
%50 = call i32 @putchar(i32 10)
%51 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([27 x i8], [27 x i8]* @.str.5, i64 0, i64 0), double %49)
ret i32 0
}