#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 *, double, double);
double sqrt(double);
int main(void) {
  double b, c, q, x;
  double w = -2.0 / 3.0;
  for (q = -1.2; q <= 1.2; q = q + 0.01) {
    b = q * q + (1 + 2 * w) * w;
    c = (q * q + 2 * w) * q * q;
    x = -b + sqrt(b * b - c);
    printf("%g %g\n", q, x);
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
movl   $0x0,-0x4(%rbp)
movsd  0xed1(%rip),%xmm0
movsd  %xmm0,-0x30(%rbp)
movsd  0xebc(%rip),%xmm0
movsd  %xmm0,-0x20(%rbp)
movsd  0xebf(%rip),%xmm0
ucomisd -0x20(%rbp),%xmm0
jb     124d <main+0x12d>
movsd  -0x20(%rbp),%xmm0
movsd  -0x20(%rbp),%xmm2
movsd  -0x30(%rbp),%xmm1
addsd  %xmm1,%xmm1
movsd  0xea9(%rip),%xmm3
addsd  %xmm3,%xmm1
mulsd  -0x30(%rbp),%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x10(%rbp)
movsd  -0x20(%rbp),%xmm0
movsd  -0x20(%rbp),%xmm2
movsd  0xe79(%rip),%xmm1
mulsd  -0x30(%rbp),%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
mulsd  -0x20(%rbp),%xmm0
mulsd  -0x20(%rbp),%xmm0
movsd  %xmm0,-0x18(%rbp)
movsd  -0x10(%rbp),%xmm0
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
movsd  %xmm0,-0x38(%rbp)
movsd  -0x10(%rbp),%xmm0
movsd  -0x10(%rbp),%xmm2
movsd  -0x18(%rbp),%xmm1
movq   %xmm1,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
call   1040 <sqrt@plt>
movaps %xmm0,%xmm1
movsd  -0x38(%rbp),%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x28(%rbp)
movsd  -0x20(%rbp),%xmm0
movsd  -0x28(%rbp),%xmm1
lea    0xdff(%rip),%rdi
call   1030 <printf@plt>
movsd  0xdea(%rip),%xmm0
addsd  -0x20(%rbp),%xmm0
movsd  %xmm0,-0x20(%rbp)
jmp    1149 <main+0x29>
xor    %eax,%eax
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x10,%rsp
movsd  0xed3(%rip),%xmm2
lea    0xefc(%rip),%rbx
jmp    1185 <main+0x65>
cs nopw 0x0(%rax,%rax,1)
movsd  %xmm3,0x8(%rsp)
call   1040 <sqrt@plt>
movsd  0x8(%rsp),%xmm3
movsd  (%rsp),%xmm2
movapd %xmm0,%xmm1
subsd  %xmm3,%xmm1
mov    %rbx,%rdi
movapd %xmm2,%xmm0
call   1030 <printf@plt>
movsd  (%rsp),%xmm2
addsd  0xea1(%rip),%xmm2
movsd  0xea1(%rip),%xmm0
ucomisd %xmm2,%xmm0
jb     11d1 <main+0xb1>
movapd %xmm2,%xmm1
mulsd  %xmm2,%xmm1
movapd %xmm1,%xmm3
addsd  0xe6f(%rip),%xmm3
addsd  0xe6f(%rip),%xmm1
mulsd  %xmm2,%xmm1
mulsd  %xmm2,%xmm1
movapd %xmm3,%xmm0
mulsd  %xmm3,%xmm0
subsd  %xmm1,%xmm0
ucomisd 0xe6b(%rip),%xmm0
movsd  %xmm2,(%rsp)
jb     1140 <main+0x20>
xorps  %xmm1,%xmm1
sqrtsd %xmm0,%xmm1
jmp    115a <main+0x3a>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@.str = [7 x i8] c"%g %g\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca double
%3 = alloca double
%4 = alloca double
%5 = alloca double
%6 = alloca double
store i32 0, i32* %1
store double 0xBFE5555555555555, double* %6
store double -1.200000e+00, double* %4
br label %7
7: ; preds = %39, %0
%8 = load double, double* %4
%9 = fcmp ole double %8, 1.200000e+00
br i1 %9, label %10, label %42
10: ; preds = %7
%11 = load double, double* %4
%12 = load double, double* %4
%13 = load double, double* %6
%14 = call double @llvm.fmuladd.f64(double 2.000000e+00, double %13, double 1.000000e+00)
%15 = load double, double* %6
%16 = fmul double %14, %15
%17 = call double @llvm.fmuladd.f64(double %11, double %12, double %16)
store double %17, double* %2
%18 = load double, double* %4
%19 = load double, double* %4
%20 = load double, double* %6
%21 = fmul double 2.000000e+00, %20
%22 = call double @llvm.fmuladd.f64(double %18, double %19, double %21)
%23 = load double, double* %4
%24 = fmul double %22, %23
%25 = load double, double* %4
%26 = fmul double %24, %25
store double %26, double* %3
%27 = load double, double* %2
%28 = fneg double %27
%29 = load double, double* %2
%30 = load double, double* %2
%31 = load double, double* %3
%32 = fneg double %31
%33 = call double @llvm.fmuladd.f64(double %29, double %30, double %32)
%34 = call double @sqrt(double %33)
%35 = fadd double %28, %34
store double %35, double* %5
%36 = load double, double* %4
%37 = load double, double* %5
%38 = call i32 @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0), double %36, double %37)
br label %39
39: ; preds = %10
%40 = load double, double* %4
%41 = fadd double %40, 1.000000e-02
store double %41, double* %4
br label %7
42: ; preds = %7
ret i32 0
}

LLVM IR (-O2):
@.str = [7 x i8] c"%g %g\0A\00"
define i32 @main() {
br label %1
1: ; preds = %0, %1
%2 = phi double [ -1.200000e+00, %0 ], [ %12, %1 ]
%3 = tail call double @llvm.fmuladd.f64(double %2, double %2, double 0x3FCC71C71C71C71A)
%4 = tail call double @llvm.fmuladd.f64(double %2, double %2, double 0xBFF5555555555555)
%5 = fneg double %4
%6 = fmul double %2, %5
%7 = fmul double %2, %6
%8 = tail call double @llvm.fmuladd.f64(double %3, double %3, double %7)
%9 = tail call double @sqrt(double %8)
%10 = fsub double %9, %3
%11 = tail call i32 @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0), double %2, double %10)
%12 = fadd double %2, 1.000000e-02
%13 = fcmp ugt double %12, 1.200000e+00
br i1 %13, label %14, label %1
14: ; preds = %1
ret i32 0
}