#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 /*<<< orphan*/ scanf(char *, double *);
void main() {
  double x0, x1, a;
  scanf("%lf", &a);
  x0 = 2;
  x1 = (x0 + a / x0) / 2;
  while (fabs(x1 - x0) >= 1e-10) {
    x0 = x1;
    x1 = (x0 + a / x0) / 2;
  }
  printf("%.10f\n", x1);
  scanf("%lf", &a);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
lea    0xed1(%rip),%rdi
lea    -0x18(%rbp),%rsi
call   1050 <scanf@plt>
movsd  0xeb0(%rip),%xmm0
movsd  %xmm0,-0x8(%rbp)
movsd  -0x8(%rbp),%xmm0
movsd  -0x18(%rbp),%xmm1
divsd  -0x8(%rbp),%xmm1
addsd  %xmm1,%xmm0
movsd  0xe90(%rip),%xmm1
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x10(%rbp)
movsd  -0x10(%rbp),%xmm0
subsd  -0x8(%rbp),%xmm0
call   1040 <fabs@plt>
cvtsi2sd %eax,%xmm0
movsd  0xe74(%rip),%xmm1
ucomisd %xmm1,%xmm0
jb     11d1 <main+0xa1>
movsd  -0x10(%rbp),%xmm0
movsd  %xmm0,-0x8(%rbp)
movsd  -0x8(%rbp),%xmm0
movsd  -0x18(%rbp),%xmm1
divsd  -0x8(%rbp),%xmm1
addsd  %xmm1,%xmm0
movsd  0xe3d(%rip),%xmm1
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x10(%rbp)
jmp    1179 <main+0x49>
movsd  -0x10(%rbp),%xmm0
lea    0xe37(%rip),%rdi
call   1030 <printf@plt>
lea    0xe27(%rip),%rdi
lea    -0x18(%rbp),%rsi
call   1050 <scanf@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
sub    $0x18,%rsp
lea    0xedd(%rip),%rdi
lea    0x10(%rsp),%rsi
call   1050 <scanf@plt>
movsd  0xeb3(%rip),%xmm0
movsd  0x10(%rsp),%xmm1
mulsd  %xmm0,%xmm1
addsd  0xea9(%rip),%xmm1
mulsd  %xmm0,%xmm1
movsd  0xea5(%rip),%xmm0
movsd  %xmm1,0x8(%rsp)
addsd  %xmm1,%xmm0
call   1040 <fabs@plt>
test   %eax,%eax
jle    11c5 <main+0x95>
movsd  0x8(%rsp),%xmm1
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
movsd  0x10(%rsp),%xmm0
divsd  %xmm1,%xmm0
addsd  %xmm1,%xmm0
mulsd  0xe5a(%rip),%xmm0
movsd  %xmm0,0x8(%rsp)
subsd  %xmm1,%xmm0
call   1040 <fabs@plt>
movsd  0x8(%rsp),%xmm0
movapd %xmm0,%xmm1
test   %eax,%eax
jg     1190 <main+0x60>
jmp    11cb <main+0x9b>
movsd  0x8(%rsp),%xmm0
lea    0xe4a(%rip),%rdi
call   1030 <printf@plt>
lea    0xe3a(%rip),%rdi
lea    0x10(%rsp),%rsi
call   1050 <scanf@plt>
add    $0x18,%rsp
ret

LLVM IR (-O0):
@.str = [4 x i8] c"%lf\00"
@.str.1 = [7 x i8] c"%.10f\0A\00"
define void @main() {
%1 = alloca double
%2 = alloca double
%3 = alloca double
%4 = call i32 @scanf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), double* %3)
store double 2.000000e+00, double* %1
%5 = load double, double* %1
%6 = load double, double* %3
%7 = load double, double* %1
%8 = fdiv double %6, %7
%9 = fadd double %5, %8
%10 = fdiv double %9, 2.000000e+00
store double %10, double* %2
br label %11
11: ; preds = %18, %0
%12 = load double, double* %2
%13 = load double, double* %1
%14 = fsub double %12, %13
%15 = call i32 @fabs(double %14)
%16 = sitofp i32 %15 to double
%17 = fcmp oge double %16, 1.000000e-10
br i1 %17, label %18, label %26
18: ; preds = %11
%19 = load double, double* %2
store double %19, double* %1
%20 = load double, double* %1
%21 = load double, double* %3
%22 = load double, double* %1
%23 = fdiv double %21, %22
%24 = fadd double %20, %23
%25 = fdiv double %24, 2.000000e+00
store double %25, double* %2
br label %11
26: ; preds = %11
%27 = load double, double* %2
%28 = call i32 @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i64 0, i64 0), double %27)
%29 = call i32 @scanf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), double* %3)
ret void
}

LLVM IR (-O2):
@.str = [4 x i8] c"%lf\00"
@.str.1 = [7 x i8] c"%.10f\0A\00"
define void @main() {
%1 = alloca double
%2 = bitcast double* %1 to i8*
%3 = call i32 @scanf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), double* %1)
%4 = load double, double* %1
%5 = fmul double %4, 5.000000e-01
%6 = fadd double %5, 2.000000e+00
%7 = fmul double %6, 5.000000e-01
%8 = fadd double %7, -2.000000e+00
%9 = call i32 @fabs(double %8)
%10 = icmp sgt i32 %9, 0
br i1 %10, label %11, label %20
11: ; preds = %0, %11
%12 = phi double [ %16, %11 ], [ %7, %0 ]
%13 = load double, double* %1
%14 = fdiv double %13, %12
%15 = fadd double %12, %14
%16 = fmul double %15, 5.000000e-01
%17 = fsub double %16, %12
%18 = call i32 @fabs(double %17)
%19 = icmp sgt i32 %18, 0
br i1 %19, label %11, label %20
20: ; preds = %11, %0
%21 = phi double [ %7, %0 ], [ %16, %11 ]
%22 = call i32 @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i64 0, i64 0), double %21)
%23 = call i32 @scanf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), double* %1)
ret void
}