#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, double);
double sqrt(double);
void pierwiastek(double x) {
  ++x;
  while (--x) {
    printf("%d\t%0.5f\n", (int)x, sqrt(x));
  }
}


x86 assembly (clang, -O0):
<pierwiastek>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movsd  %xmm0,-0x8(%rbp)
movsd  0xecb(%rip),%xmm0
addsd  -0x8(%rbp),%xmm0
movsd  %xmm0,-0x8(%rbp)
movsd  0xec1(%rip),%xmm0
addsd  -0x8(%rbp),%xmm0
movsd  %xmm0,-0x8(%rbp)
xorps  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
jne    1169 <pierwiastek+0x49>
jp     1169 <pierwiastek+0x49>
jmp    118f <pierwiastek+0x6f>
cvttsd2si -0x8(%rbp),%eax
mov    %eax,-0xc(%rbp)
movsd  -0x8(%rbp),%xmm0
call   1040 <sqrt@plt>
mov    -0xc(%rbp),%esi
lea    0xe8b(%rip),%rdi
call   1030 <printf@plt>
jmp    113f <pierwiastek+0x1f>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<pierwiastek>:
push   %rbx
sub    $0x10,%rsp
addsd  0xed3(%rip),%xmm0
addsd  0xed3(%rip),%xmm0
xorpd  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
jne    1141 <pierwiastek+0x21>
jnp    118f <pierwiastek+0x6f>
lea    0xec8(%rip),%rbx
jmp    117d <pierwiastek+0x5d>
nopw   0x0(%rax,%rax,1)
call   1040 <sqrt@plt>
cvttsd2si 0x8(%rsp),%esi
mov    %rbx,%rdi
call   1030 <printf@plt>
movsd  0x8(%rsp),%xmm0
addsd  0xe97(%rip),%xmm0
xorpd  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
jne    117d <pierwiastek+0x5d>
jnp    118f <pierwiastek+0x6f>
ucomisd %xmm1,%xmm0
movsd  %xmm0,0x8(%rsp)
jb     1150 <pierwiastek+0x30>
sqrtsd %xmm0,%xmm0
jmp    1155 <pierwiastek+0x35>
add    $0x10,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@.str = [10 x i8] c"%d\09%0.5f\0A\00"
define void @pierwiastek(double %0) {
%2 = alloca double
store double %0, double* %2
%3 = load double, double* %2
%4 = fadd double %3, 1.000000e+00
store double %4, double* %2
br label %5
5: ; preds = %9, %1
%6 = load double, double* %2
%7 = fadd double %6, -1.000000e+00
store double %7, double* %2
%8 = fcmp une double %7, 0.000000e+00
br i1 %8, label %9, label %15
9: ; preds = %5
%10 = load double, double* %2
%11 = fptosi double %10 to i32
%12 = load double, double* %2
%13 = call double @sqrt(double %12)
%14 = call i32 @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0), i32 %11, double %13)
br label %5
15: ; preds = %5
ret void
}

LLVM IR (-O2):
@.str = [10 x i8] c"%d\09%0.5f\0A\00"
define void @pierwiastek(double %0) {
%2 = fadd double %0, 1.000000e+00
%3 = fadd double %2, -1.000000e+00
%4 = fcmp une double %3, 0.000000e+00
br i1 %4, label %5, label %12
5: ; preds = %1, %5
%6 = phi double [ %10, %5 ], [ %3, %1 ]
%7 = fptosi double %6 to i32
%8 = tail call double @sqrt(double %6)
%9 = tail call i32 @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0), i32 %7, double %8)
%10 = fadd double %6, -1.000000e+00
%11 = fcmp une double %10, 0.000000e+00
br i1 %11, label %5, label %12
12: ; preds = %5, %1
ret void
}