#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 fabs(double);
int /*<<< orphan*/ printf(char *, double);
int main() {
  double x1, x0, f, f1;
  x1 = 1.5;
  do {
    x0 = x1;
    f = 2 * x0 * x0 * x0 - 4 * x0 * x0 + 3 * x0 - 6;
    f1 = 6 * x0 * x0 - 8 * x0 + 3;
    x1 = x0 - f / f1;
  } while (fabs(x1 - x0) >= 1e-5);
  printf("the root of equation is %5.2f", x1);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movl   $0x0,-0x4(%rbp)
movsd  0xec9(%rip),%xmm0
movsd  %xmm0,-0x10(%rbp)
movsd  -0x10(%rbp),%xmm0
movsd  %xmm0,-0x18(%rbp)
movsd  0xeda(%rip),%xmm1
mulsd  -0x18(%rbp),%xmm1
mulsd  -0x18(%rbp),%xmm1
movsd  -0x18(%rbp),%xmm2
movsd  0xebb(%rip),%xmm0
mulsd  -0x18(%rbp),%xmm0
mulsd  -0x18(%rbp),%xmm0
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
mulsd  %xmm2,%xmm1
addsd  %xmm0,%xmm1
movsd  -0x18(%rbp),%xmm0
movsd  0xe6d(%rip),%xmm2
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  0xe6d(%rip),%xmm1
subsd  %xmm1,%xmm0
movsd  %xmm0,-0x20(%rbp)
movsd  0xe5c(%rip),%xmm0
mulsd  -0x18(%rbp),%xmm0
movsd  -0x18(%rbp),%xmm2
movsd  0xe42(%rip),%xmm1
mulsd  -0x18(%rbp),%xmm1
movq   %xmm1,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  0xe0e(%rip),%xmm1
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x28(%rbp)
movsd  -0x18(%rbp),%xmm0
movsd  -0x20(%rbp),%xmm1
divsd  -0x28(%rbp),%xmm1
subsd  %xmm1,%xmm0
movsd  %xmm0,-0x10(%rbp)
movsd  -0x10(%rbp),%xmm0
subsd  -0x18(%rbp),%xmm0
call   1040 <fabs@plt>
cvtsi2sd %eax,%xmm0
movsd  0xdfa(%rip),%xmm1
ucomisd %xmm1,%xmm0
jae    113c <main+0x1c>
movsd  -0x10(%rbp),%xmm0
lea    0xdec(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
sub    $0x18,%rsp
movsd  0xed4(%rip),%xmm0
nopl   0x0(%rax)
movapd %xmm0,%xmm1
movapd %xmm0,%xmm4
addsd  %xmm0,%xmm4
mulsd  %xmm0,%xmm4
movapd %xmm0,%xmm2
mulsd  0xebc(%rip),%xmm2
mulsd  %xmm0,%xmm2
mulsd  %xmm0,%xmm4
addsd  %xmm2,%xmm4
movapd %xmm0,%xmm2
mulsd  0xeac(%rip),%xmm2
movapd %xmm0,%xmm3
mulsd  0xea8(%rip),%xmm3
unpcklpd %xmm3,%xmm4
movapd %xmm0,%xmm3
unpcklpd %xmm2,%xmm3
movapd 0xe9c(%rip),%xmm2
unpcklpd %xmm0,%xmm2
mulpd  %xmm3,%xmm2
addpd  %xmm4,%xmm2
addpd  0xe98(%rip),%xmm2
movapd %xmm2,%xmm3
unpckhpd %xmm2,%xmm3
divsd  %xmm3,%xmm2
subsd  %xmm2,%xmm0
movapd %xmm0,(%rsp)
subsd  %xmm1,%xmm0
call   1040 <fabs@plt>
movapd (%rsp),%xmm0
test   %eax,%eax
jg     1130 <main+0x10>
lea    0xe76(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x18,%rsp
ret

LLVM IR (-O0):
@.str = [30 x i8] c"the root of equation is %5.2f\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca double
%3 = alloca double
%4 = alloca double
%5 = alloca double
store i32 0, i32* %1
store double 1.500000e+00, double* %2
br label %6
6: ; preds = %35, %0
%7 = load double, double* %2
store double %7, double* %3
%8 = load double, double* %3
%9 = fmul double 2.000000e+00, %8
%10 = load double, double* %3
%11 = fmul double %9, %10
%12 = load double, double* %3
%13 = load double, double* %3
%14 = fmul double 4.000000e+00, %13
%15 = load double, double* %3
%16 = fmul double %14, %15
%17 = fneg double %16
%18 = call double @llvm.fmuladd.f64(double %11, double %12, double %17)
%19 = load double, double* %3
%20 = call double @llvm.fmuladd.f64(double 3.000000e+00, double %19, double %18)
%21 = fsub double %20, 6.000000e+00
store double %21, double* %4
%22 = load double, double* %3
%23 = fmul double 6.000000e+00, %22
%24 = load double, double* %3
%25 = load double, double* %3
%26 = fmul double 8.000000e+00, %25
%27 = fneg double %26
%28 = call double @llvm.fmuladd.f64(double %23, double %24, double %27)
%29 = fadd double %28, 3.000000e+00
store double %29, double* %5
%30 = load double, double* %3
%31 = load double, double* %4
%32 = load double, double* %5
%33 = fdiv double %31, %32
%34 = fsub double %30, %33
store double %34, double* %2
br label %35
35: ; preds = %6
%36 = load double, double* %2
%37 = load double, double* %3
%38 = fsub double %36, %37
%39 = call i32 @fabs(double %38)
%40 = sitofp i32 %39 to double
%41 = fcmp oge double %40, 1.000000e-05
br i1 %41, label %6, label %42
42: ; preds = %35
%43 = load double, double* %2
%44 = call i32 @printf(i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str, i64 0, i64 0), double %43)
ret i32 0
}

LLVM IR (-O2):
@.str = [30 x i8] c"the root of equation is %5.2f\00"
define i32 @main() {
br label %1
1: ; preds = %1, %0
%2 = phi double [ 1.500000e+00, %0 ], [ %20, %1 ]
%3 = fmul double %2, 2.000000e+00
%4 = fmul double %2, %3
%5 = fmul double %2, -4.000000e+00
%6 = fmul double %2, %5
%7 = tail call double @llvm.fmuladd.f64(double %4, double %2, double %6)
%8 = fmul double %2, 6.000000e+00
%9 = fmul double %2, -8.000000e+00
%10 = insertelement <2 x double> poison, double %2, i64 0
%11 = insertelement <2 x double> %10, double %8, i64 1
%12 = insertelement <2 x double> <double 3.000000e+00, double poison>, double %2, i64 1
%13 = insertelement <2 x double> poison, double %7, i64 0
%14 = insertelement <2 x double> %13, double %9, i64 1
%15 = call <2 x double> @llvm.fmuladd.v2f64(<2 x double> %11, <2 x double> %12, <2 x double> %14)
%16 = fadd <2 x double> %15, <double -6.000000e+00, double 3.000000e+00>
%17 = extractelement <2 x double> %16, i64 0
%18 = extractelement <2 x double> %16, i64 1
%19 = fdiv double %17, %18
%20 = fsub double %2, %19
%21 = fsub double %20, %2
%22 = tail call i32 @fabs(double %21)
%23 = icmp sgt i32 %22, 0
br i1 %23, label %1, label %24
24: ; preds = %1
%25 = tail call i32 @printf(i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str, i64 0, i64 0), double %20)
ret i32 0
}