#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 */
double cos(double);
int /*<<< orphan*/ printf(char *, double, double, double);
double sqrt(double);
int main(void) {
  double w = -2.0 / 3.0;
  double Qx, Qz, Q2, Qa2;
  double theta = 0.0;
  double b, c;
  double x;
  for (Qx = -3.14; Qx <= 3.14; Qx = Qx + 0.1)
    for (Qz = -2.14; Qz <= 2.14; Qz = Qz + 0.1) {
      Qa2 = Qz * Qz * cos(theta) * cos(theta);
      Q2 = Qx * Qx + Qz * Qz;
      b = Qa2 + (1 + 2 * w) * ((Qx * Qx) / Q2 + 1) * w;
      c = 2 * Qa2 * ((Qx * Qx) / Q2 + 1) * w + Qa2 * Qa2;
      x = -b + sqrt(b * b - c);
      printf("%g %g %g\n", Qx, Qz, x);
    }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x70,%rsp
movl   $0x0,-0x4(%rbp)
movsd  0xec1(%rip),%xmm0
movsd  %xmm0,-0x10(%rbp)
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x38(%rbp)
movsd  0xea4(%rip),%xmm0
movsd  %xmm0,-0x18(%rbp)
movsd  0xea7(%rip),%xmm0
ucomisd -0x18(%rbp),%xmm0
jb     1340 <main+0x210>
movsd  0xe9c(%rip),%xmm0
movsd  %xmm0,-0x20(%rbp)
movsd  0xe97(%rip),%xmm0
ucomisd -0x20(%rbp),%xmm0
jb     1324 <main+0x1f4>
movsd  -0x20(%rbp),%xmm0
mulsd  -0x20(%rbp),%xmm0
movsd  %xmm0,-0x68(%rbp)
movsd  -0x38(%rbp),%xmm0
call   1040 <cos@plt>
movaps %xmm0,%xmm1
movsd  -0x68(%rbp),%xmm0
mulsd  %xmm1,%xmm0
movsd  %xmm0,-0x60(%rbp)
movsd  -0x38(%rbp),%xmm0
call   1040 <cos@plt>
movaps %xmm0,%xmm1
movsd  -0x60(%rbp),%xmm0
mulsd  %xmm1,%xmm0
movsd  %xmm0,-0x30(%rbp)
movsd  -0x18(%rbp),%xmm0
movsd  -0x18(%rbp),%xmm2
movsd  -0x20(%rbp),%xmm1
mulsd  -0x20(%rbp),%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x28(%rbp)
movsd  -0x30(%rbp),%xmm1
movsd  -0x10(%rbp),%xmm0
addsd  %xmm0,%xmm0
movsd  0xe20(%rip),%xmm2
addsd  %xmm2,%xmm0
movsd  -0x18(%rbp),%xmm2
mulsd  -0x18(%rbp),%xmm2
divsd  -0x28(%rbp),%xmm2
movsd  0xe05(%rip),%xmm3
addsd  %xmm3,%xmm2
mulsd  %xmm2,%xmm0
movsd  -0x10(%rbp),%xmm2
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x40(%rbp)
movsd  0xdeb(%rip),%xmm0
mulsd  -0x30(%rbp),%xmm0
movsd  -0x18(%rbp),%xmm1
mulsd  -0x18(%rbp),%xmm1
divsd  -0x28(%rbp),%xmm1
movsd  0xdc7(%rip),%xmm2
addsd  %xmm2,%xmm1
mulsd  %xmm1,%xmm0
movsd  -0x10(%rbp),%xmm2
movsd  -0x30(%rbp),%xmm1
mulsd  -0x30(%rbp),%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x48(%rbp)
movsd  -0x40(%rbp),%xmm0
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
movsd  %xmm0,-0x58(%rbp)
movsd  -0x40(%rbp),%xmm0
movsd  -0x40(%rbp),%xmm2
movsd  -0x48(%rbp),%xmm1
movq   %xmm1,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
call   1050 <sqrt@plt>
movaps %xmm0,%xmm1
movsd  -0x58(%rbp),%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x50(%rbp)
movsd  -0x18(%rbp),%xmm0
movsd  -0x20(%rbp),%xmm1
movsd  -0x50(%rbp),%xmm2
lea    0xd38(%rip),%rdi
call   1030 <printf@plt>
movsd  0xd13(%rip),%xmm0
addsd  -0x20(%rbp),%xmm0
movsd  %xmm0,-0x20(%rbp)
jmp    1181 <main+0x51>
jmp    1329 <main+0x1f9>
movsd  0xcf7(%rip),%xmm0
addsd  -0x18(%rbp),%xmm0
movsd  %xmm0,-0x18(%rbp)
jmp    1161 <main+0x31>
xor    %eax,%eax
add    $0x70,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x20,%rsp
movsd  0xed3(%rip),%xmm0
lea    0xf14(%rip),%rbx
jmp    115f <main+0x3f>
cs nopw 0x0(%rax,%rax,1)
movsd  (%rsp),%xmm0
addsd  0xedb(%rip),%xmm0
movsd  0xee3(%rip),%xmm1
ucomisd %xmm0,%xmm1
jb     124e <main+0x12e>
movsd  %xmm0,(%rsp)
mulsd  %xmm0,%xmm0
movsd  %xmm0,0x18(%rsp)
movsd  0xe92(%rip),%xmm1
jmp    11cc <main+0xac>
nopl   0x0(%rax,%rax,1)
movsd  %xmm4,0x10(%rsp)
call   1040 <sqrt@plt>
movsd  0x10(%rsp),%xmm4
movsd  0x8(%rsp),%xmm1
movapd %xmm0,%xmm2
movsd  (%rsp),%xmm0
subsd  %xmm4,%xmm2
mov    %rbx,%rdi
call   1030 <printf@plt>
movsd  0x8(%rsp),%xmm1
addsd  0xe6e(%rip),%xmm1
movsd  0xe6e(%rip),%xmm0
ucomisd %xmm1,%xmm0
jb     1140 <main+0x20>
movapd %xmm1,%xmm0
mulsd  %xmm1,%xmm0
movsd  0x18(%rsp),%xmm2
movapd %xmm2,%xmm3
addsd  %xmm0,%xmm3
divsd  %xmm3,%xmm2
addsd  0xe22(%rip),%xmm2
movapd %xmm0,%xmm3
addsd  %xmm0,%xmm3
mulsd  %xmm2,%xmm3
movapd %xmm2,%xmm4
mulsd  0xe12(%rip),%xmm4
movsd  0xe12(%rip),%xmm2
mulsd  %xmm2,%xmm4
addsd  %xmm0,%xmm4
mulsd  %xmm0,%xmm0
mulsd  %xmm2,%xmm3
addsd  %xmm0,%xmm3
movapd %xmm4,%xmm0
mulsd  %xmm4,%xmm0
subsd  %xmm3,%xmm0
ucomisd 0xe0a(%rip),%xmm0
movsd  %xmm1,0x8(%rsp)
jb     1180 <main+0x60>
xorps  %xmm2,%xmm2
sqrtsd %xmm0,%xmm2
jmp    119b <main+0x7b>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@.str = [10 x i8] c"%g %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
%7 = alloca double
%8 = alloca double
%9 = alloca double
%10 = alloca double
store i32 0, i32* %1
store double 0xBFE5555555555555, double* %2
store double 0.000000e+00, double* %7
store double -3.140000e+00, double* %3
br label %11
11: ; preds = %77, %0
%12 = load double, double* %3
%13 = fcmp ole double %12, 3.140000e+00
br i1 %13, label %14, label %80
14: ; preds = %11
store double -2.140000e+00, double* %4
br label %15
15: ; preds = %73, %14
%16 = load double, double* %4
%17 = fcmp ole double %16, 2.140000e+00
br i1 %17, label %18, label %76
18: ; preds = %15
%19 = load double, double* %4
%20 = load double, double* %4
%21 = fmul double %19, %20
%22 = load double, double* %7
%23 = call double @cos(double %22)
%24 = fmul double %21, %23
%25 = load double, double* %7
%26 = call double @cos(double %25)
%27 = fmul double %24, %26
store double %27, double* %6
%28 = load double, double* %3
%29 = load double, double* %3
%30 = load double, double* %4
%31 = load double, double* %4
%32 = fmul double %30, %31
%33 = call double @llvm.fmuladd.f64(double %28, double %29, double %32)
store double %33, double* %5
%34 = load double, double* %6
%35 = load double, double* %2
%36 = call double @llvm.fmuladd.f64(double 2.000000e+00, double %35, double 1.000000e+00)
%37 = load double, double* %3
%38 = load double, double* %3
%39 = fmul double %37, %38
%40 = load double, double* %5
%41 = fdiv double %39, %40
%42 = fadd double %41, 1.000000e+00
%43 = fmul double %36, %42
%44 = load double, double* %2
%45 = call double @llvm.fmuladd.f64(double %43, double %44, double %34)
store double %45, double* %8
%46 = load double, double* %6
%47 = fmul double 2.000000e+00, %46
%48 = load double, double* %3
%49 = load double, double* %3
%50 = fmul double %48, %49
%51 = load double, double* %5
%52 = fdiv double %50, %51
%53 = fadd double %52, 1.000000e+00
%54 = fmul double %47, %53
%55 = load double, double* %2
%56 = load double, double* %6
%57 = load double, double* %6
%58 = fmul double %56, %57
%59 = call double @llvm.fmuladd.f64(double %54, double %55, double %58)
store double %59, double* %9
%60 = load double, double* %8
%61 = fneg double %60
%62 = load double, double* %8
%63 = load double, double* %8
%64 = load double, double* %9
%65 = fneg double %64
%66 = call double @llvm.fmuladd.f64(double %62, double %63, double %65)
%67 = call double @sqrt(double %66)
%68 = fadd double %61, %67
store double %68, double* %10
%69 = load double, double* %3
%70 = load double, double* %4
%71 = load double, double* %10
%72 = call i32 @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0), double %69, double %70, double %71)
br label %73
73: ; preds = %18
%74 = load double, double* %4
%75 = fadd double %74, 1.000000e-01
store double %75, double* %4
br label %15
76: ; preds = %15
br label %77
77: ; preds = %76
%78 = load double, double* %3
%79 = fadd double %78, 1.000000e-01
store double %79, double* %3
br label %11
80: ; preds = %11
ret i32 0
}

LLVM IR (-O2):
@.str = [10 x i8] c"%g %g %g\0A\00"
define i32 @main() {
br label %1
1: ; preds = %0, %23
%2 = phi double [ -3.140000e+00, %0 ], [ %24, %23 ]
%3 = fmul double %2, %2
br label %4
4: ; preds = %1, %4
%5 = phi double [ -2.140000e+00, %1 ], [ %21, %4 ]
%6 = fmul double %5, %5
%7 = tail call double @llvm.fmuladd.f64(double %2, double %2, double %6)
%8 = fdiv double %3, %7
%9 = fadd double %8, 1.000000e+00
%10 = fmul double %9, 0xBFD5555555555554
%11 = tail call double @llvm.fmuladd.f64(double %10, double 0xBFE5555555555555, double %6)
%12 = fmul double %6, 2.000000e+00
%13 = fmul double %12, %9
%14 = fmul double %6, %6
%15 = tail call double @llvm.fmuladd.f64(double %13, double 0xBFE5555555555555, double %14)
%16 = fneg double %15
%17 = tail call double @llvm.fmuladd.f64(double %11, double %11, double %16)
%18 = tail call double @sqrt(double %17)
%19 = fsub double %18, %11
%20 = tail call i32 @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0), double %2, double %5, double %19)
%21 = fadd double %5, 1.000000e-01
%22 = fcmp ugt double %21, 2.140000e+00
br i1 %22, label %23, label %4
23: ; preds = %4
%24 = fadd double %2, 1.000000e-01
%25 = fcmp ugt double %24, 3.140000e+00
br i1 %25, label %26, label %1
26: ; preds = %23
ret i32 0
}