#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 - 4) * x0 + 3) * x0 - 6;
    f1 = (6 * x0 - 8) * x0 + 3;
    x1 = x0 - f / f1;
  } while (fabs(x1 - x0) >= 1e-5);
  printf("The root of equation is %5.2f\n", 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  -0x18(%rbp),%xmm0
addsd  %xmm0,%xmm0
movsd  0xed1(%rip),%xmm1
addsd  %xmm1,%xmm0
movsd  -0x18(%rbp),%xmm1
mulsd  %xmm1,%xmm0
movsd  0xe9c(%rip),%xmm1
addsd  %xmm1,%xmm0
movsd  -0x18(%rbp),%xmm1
mulsd  %xmm1,%xmm0
movsd  0xe9f(%rip),%xmm1
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x20(%rbp)
movsd  -0x18(%rbp),%xmm0
movsd  0xe79(%rip),%xmm1
mulsd  %xmm1,%xmm0
movsd  0xe75(%rip),%xmm1
addsd  %xmm1,%xmm0
movsd  -0x18(%rbp),%xmm1
mulsd  %xmm1,%xmm0
movsd  0xe50(%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  0xe3c(%rip),%xmm1
ucomisd %xmm1,%xmm0
jae    113c <main+0x1c>
movsd  -0x10(%rbp),%xmm0
lea    0xe2e(%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,%xmm3
addsd  %xmm0,%xmm3
addsd  0xec4(%rip),%xmm3
unpcklpd %xmm0,%xmm3
movapd 0xec0(%rip),%xmm2
movsd  %xmm0,%xmm2
mulpd  %xmm3,%xmm2
addpd  0xec0(%rip),%xmm2
movapd %xmm0,%xmm3
unpcklpd %xmm0,%xmm3
mulpd  %xmm2,%xmm3
addpd  0xebc(%rip),%xmm3
movapd %xmm3,%xmm2
unpckhpd %xmm3,%xmm2
divsd  %xmm2,%xmm3
subsd  %xmm3,%xmm0
movapd %xmm0,(%rsp)
subsd  %xmm1,%xmm0
call   1040 <fabs@plt>
movapd (%rsp),%xmm0
test   %eax,%eax
jg     1130 <main+0x10>
lea    0xe9e(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x18,%rsp
ret

LLVM IR (-O0):
@.str = [31 x i8] c"The root of equation is %5.2f\0A\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 = %23, %0
%7 = load double, double* %2
store double %7, double* %3
%8 = load double, double* %3
%9 = call double @llvm.fmuladd.f64(double 2.000000e+00, double %8, double -4.000000e+00)
%10 = load double, double* %3
%11 = call double @llvm.fmuladd.f64(double %9, double %10, double 3.000000e+00)
%12 = load double, double* %3
%13 = call double @llvm.fmuladd.f64(double %11, double %12, double -6.000000e+00)
store double %13, double* %4
%14 = load double, double* %3
%15 = call double @llvm.fmuladd.f64(double 6.000000e+00, double %14, double -8.000000e+00)
%16 = load double, double* %3
%17 = call double @llvm.fmuladd.f64(double %15, double %16, double 3.000000e+00)
store double %17, double* %5
%18 = load double, double* %3
%19 = load double, double* %4
%20 = load double, double* %5
%21 = fdiv double %19, %20
%22 = fsub double %18, %21
store double %22, double* %2
br label %23
23: ; preds = %6
%24 = load double, double* %2
%25 = load double, double* %3
%26 = fsub double %24, %25
%27 = call i32 @fabs(double %26)
%28 = sitofp i32 %27 to double
%29 = fcmp oge double %28, 1.000000e-05
br i1 %29, label %6, label %30
30: ; preds = %23
%31 = load double, double* %2
%32 = call i32 @printf(i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str, i64 0, i64 0), double %31)
ret i32 0
}

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