#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 main(void) {
  double a = 3.9 + 0.1;
  int x = 0;
  double b = 0;
  for (x = 0; x < 1000; x++) {
    b = b + 0.1;
    printf("%f", b);
    if ((b * b) == a) {
      printf("%f", b);
      printf("\n");
    }
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
movsd  0xed9(%rip),%xmm0
movsd  %xmm0,-0x10(%rbp)
movl   $0x0,-0x14(%rbp)
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x20(%rbp)
movl   $0x0,-0x14(%rbp)
cmpl   $0x3e8,-0x14(%rbp)
jge    11c3 <main+0xb3>
movsd  0xeb1(%rip),%xmm0
addsd  -0x20(%rbp),%xmm0
movsd  %xmm0,-0x20(%rbp)
movsd  -0x20(%rbp),%xmm0
lea    0xea3(%rip),%rdi
mov    $0x1,%al
call   1030 <printf@plt>
movsd  -0x20(%rbp),%xmm0
mulsd  -0x20(%rbp),%xmm0
ucomisd -0x10(%rbp),%xmm0
jne    11b0 <main+0xa0>
jp     11b0 <main+0xa0>
movsd  -0x20(%rbp),%xmm0
lea    0xe75(%rip),%rdi
mov    $0x1,%al
call   1030 <printf@plt>
lea    0xe6a(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    11b5 <main+0xa5>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    1142 <main+0x32>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %rbx
push   %rax
xorpd  %xmm0,%xmm0
mov    $0x3e8,%ebp
lea    0xedd(%rip),%rbx
jmp    1145 <main+0x25>
cs nopw 0x0(%rax,%rax,1)
nop
add    $0xffffffff,%ebp
je     1190 <main+0x70>
addsd  0xeb3(%rip),%xmm0
movsd  %xmm0,(%rsp)
mov    %rbx,%rdi
mov    $0x1,%al
call   1040 <printf@plt>
movsd  (%rsp),%xmm0
movapd %xmm0,%xmm1
mulsd  %xmm0,%xmm1
ucomisd 0xe97(%rip),%xmm1
jne    1140 <main+0x20>
jp     1140 <main+0x20>
mov    %rbx,%rdi
mov    $0x1,%al
call   1040 <printf@plt>
mov    $0xa,%edi
call   1030 <putchar@plt>
movsd  (%rsp),%xmm0
jmp    1140 <main+0x20>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
@.str = [3 x i8] c"%f\00"
@.str.1 = [2 x i8] c"\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca double
%3 = alloca i32
%4 = alloca double
store i32 0, i32* %1
store double 4.000000e+00, double* %2
store i32 0, i32* %3
store double 0.000000e+00, double* %4
store i32 0, i32* %3
br label %5
5: ; preds = %23, %0
%6 = load i32, i32* %3
%7 = icmp slt i32 %6, 1000
br i1 %7, label %8, label %26
8: ; preds = %5
%9 = load double, double* %4
%10 = fadd double %9, 1.000000e-01
store double %10, double* %4
%11 = load double, double* %4
%12 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), double %11)
%13 = load double, double* %4
%14 = load double, double* %4
%15 = fmul double %13, %14
%16 = load double, double* %2
%17 = fcmp oeq double %15, %16
br i1 %17, label %18, label %22
18: ; preds = %8
%19 = load double, double* %4
%20 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), double %19)
%21 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
br label %22
22: ; preds = %18, %8
br label %23
23: ; preds = %22
%24 = load i32, i32* %3
%25 = add nsw i32 %24, 1
store i32 %25, i32* %3
br label %5
26: ; preds = %5
ret i32 0
}

LLVM IR (-O2):
@.str = [3 x i8] c"%f\00"
define i32 @main() {
br label %1
1: ; preds = %0, %11
%2 = phi double [ 0.000000e+00, %0 ], [ %4, %11 ]
%3 = phi i32 [ 0, %0 ], [ %12, %11 ]
%4 = fadd double %2, 1.000000e-01
%5 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), double %4)
%6 = fmul double %4, %4
%7 = fcmp oeq double %6, 4.000000e+00
br i1 %7, label %8, label %11
8: ; preds = %1
%9 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), double %4)
%10 = tail call i32 @putchar(i32 10)
br label %11
11: ; preds = %1, %8
%12 = add nuw nsw i32 %3, 1
%13 = icmp eq i32 %12, 1000
br i1 %13, label %14, label %1
14: ; preds = %11
ret i32 0
}