#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 *, ...);
float sqrt(int);
int main() {
  int a;
  float wynik;
  a = 1;
  printf("--------------\n");
  printf("|  X |sqrt(X)|\n");
  printf("--------------\n");
  for (a = 1; a < 21; a++) {
    wynik = sqrt(a);
    printf("| %2d | %4.2f  |\n", a, wynik);
  }
  printf("--------------\n");
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x1,-0x8(%rbp)
lea    0xec3(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xec5(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xea7(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x1,-0x8(%rbp)
cmpl   $0x15,-0x8(%rbp)
jge    11a6 <main+0x86>
mov    -0x8(%rbp),%edi
call   1040 <sqrt@plt>
movss  %xmm0,-0xc(%rbp)
mov    -0x8(%rbp),%esi
movss  -0xc(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
lea    0xe8f(%rip),%rdi
mov    $0x1,%al
call   1030 <printf@plt>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    1167 <main+0x47>
lea    0xe53(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r14
push   %rbx
push   %rax
lea    0xee6(%rip),%r14
mov    %r14,%rdi
call   1030 <puts@plt>
lea    0xec8(%rip),%rdi
call   1030 <puts@plt>
mov    %r14,%rdi
call   1030 <puts@plt>
mov    $0x1,%edi
call   1050 <sqrt@plt>
cvtss2sd %xmm0,%xmm0
lea    0xe94(%rip),%rbx
mov    %rbx,%rdi
mov    $0x1,%esi
mov    $0x1,%al
call   1040 <printf@plt>
mov    $0x2,%edi
call   1050 <sqrt@plt>
cvtss2sd %xmm0,%xmm0
mov    %rbx,%rdi
mov    $0x2,%esi
mov    $0x1,%al
call   1040 <printf@plt>
mov    $0x3,%edi
call   1050 <sqrt@plt>
cvtss2sd %xmm0,%xmm0
mov    %rbx,%rdi
mov    $0x3,%esi
mov    $0x1,%al
call   1040 <printf@plt>
mov    $0x4,%edi
call   1050 <sqrt@plt>
cvtss2sd %xmm0,%xmm0
mov    %rbx,%rdi
mov    $0x4,%esi
mov    $0x1,%al
call   1040 <printf@plt>
mov    $0x5,%edi
call   1050 <sqrt@plt>
cvtss2sd %xmm0,%xmm0
mov    %rbx,%rdi
mov    $0x5,%esi
mov    $0x1,%al
call   1040 <printf@plt>
mov    $0x6,%edi
call   1050 <sqrt@plt>
cvtss2sd %xmm0,%xmm0
mov    %rbx,%rdi
mov    $0x6,%esi
mov    $0x1,%al
call   1040 <printf@plt>
mov    $0x7,%edi
call   1050 <sqrt@plt>
cvtss2sd %xmm0,%xmm0
mov    %rbx,%rdi
mov    $0x7,%esi
mov    $0x1,%al
call   1040 <printf@plt>
mov    $0x8,%edi
call   1050 <sqrt@plt>
cvtss2sd %xmm0,%xmm0
mov    %rbx,%rdi
mov    $0x8,%esi
mov    $0x1,%al
call   1040 <printf@plt>
mov    $0x9,%edi
call   1050 <sqrt@plt>
cvtss2sd %xmm0,%xmm0
mov    %rbx,%rdi
mov    $0x9,%esi
mov    $0x1,%al
call   1040 <printf@plt>
mov    $0xa,%edi
call   1050 <sqrt@plt>
cvtss2sd %xmm0,%xmm0
mov    %rbx,%rdi
mov    $0xa,%esi
mov    $0x1,%al
call   1040 <printf@plt>
mov    $0xb,%edi
call   1050 <sqrt@plt>
cvtss2sd %xmm0,%xmm0
mov    %rbx,%rdi
mov    $0xb,%esi
mov    $0x1,%al
call   1040 <printf@plt>
mov    $0xc,%edi
call   1050 <sqrt@plt>
cvtss2sd %xmm0,%xmm0
mov    %rbx,%rdi
mov    $0xc,%esi
mov    $0x1,%al
call   1040 <printf@plt>
mov    $0xd,%edi
call   1050 <sqrt@plt>
cvtss2sd %xmm0,%xmm0
mov    %rbx,%rdi
mov    $0xd,%esi
mov    $0x1,%al
call   1040 <printf@plt>
mov    $0xe,%edi
call   1050 <sqrt@plt>
cvtss2sd %xmm0,%xmm0
mov    %rbx,%rdi
mov    $0xe,%esi
mov    $0x1,%al
call   1040 <printf@plt>
mov    $0xf,%edi
call   1050 <sqrt@plt>
cvtss2sd %xmm0,%xmm0
mov    %rbx,%rdi
mov    $0xf,%esi
mov    $0x1,%al
call   1040 <printf@plt>
mov    $0x10,%edi
call   1050 <sqrt@plt>
cvtss2sd %xmm0,%xmm0
mov    %rbx,%rdi
mov    $0x10,%esi
mov    $0x1,%al
call   1040 <printf@plt>
mov    $0x11,%edi
call   1050 <sqrt@plt>
cvtss2sd %xmm0,%xmm0
mov    %rbx,%rdi
mov    $0x11,%esi
mov    $0x1,%al
call   1040 <printf@plt>
mov    $0x12,%edi
call   1050 <sqrt@plt>
cvtss2sd %xmm0,%xmm0
mov    %rbx,%rdi
mov    $0x12,%esi
mov    $0x1,%al
call   1040 <printf@plt>
mov    $0x13,%edi
call   1050 <sqrt@plt>
cvtss2sd %xmm0,%xmm0
mov    %rbx,%rdi
mov    $0x13,%esi
mov    $0x1,%al
call   1040 <printf@plt>
mov    $0x14,%edi
call   1050 <sqrt@plt>
cvtss2sd %xmm0,%xmm0
mov    %rbx,%rdi
mov    $0x14,%esi
mov    $0x1,%al
call   1040 <printf@plt>
mov    %r14,%rdi
call   1030 <puts@plt>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@.str = [16 x i8] c"--------------\0A\00"
@.str.1 = [16 x i8] c"| X |sqrt(X)|\0A\00"
@.str.2 = [18 x i8] c"| %2d | %4.2f |\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca float
store i32 0, i32* %1
store i32 1, i32* %2
%4 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str, i64 0, i64 0))
%5 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.1, i64 0, i64 0))
%6 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str, i64 0, i64 0))
store i32 1, i32* %2
br label %7
7: ; preds = %17, %0
%8 = load i32, i32* %2
%9 = icmp slt i32 %8, 21
br i1 %9, label %10, label %20
10: ; preds = %7
%11 = load i32, i32* %2
%12 = call float @sqrt(i32 %11)
store float %12, float* %3
%13 = load i32, i32* %2
%14 = load float, float* %3
%15 = fpext float %14 to double
%16 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.2, i64 0, i64 0), i32 %13, double %15)
br label %17
17: ; preds = %10
%18 = load i32, i32* %2
%19 = add nsw i32 %18, 1
store i32 %19, i32* %2
br label %7
20: ; preds = %7
%21 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str, i64 0, i64 0))
ret i32 0
}

LLVM IR (-O2):
@.str.2 = [18 x i8] c"| %2d | %4.2f |\0A\00"
@str.3 = [15 x i8] c"| X |sqrt(X)|\00"
@str.5 = [15 x i8] c"--------------\00"
define i32 @main() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([15 x i8], [15 x i8]* @str.5, i64 0, i64 0))
%2 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([15 x i8], [15 x i8]* @str.3, i64 0, i64 0))
%3 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([15 x i8], [15 x i8]* @str.5, i64 0, i64 0))
%4 = tail call float @sqrt(i32 1)
%5 = fpext float %4 to double
%6 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([18 x i8], [18 x i8]* @.str.2, i64 0, i64 0), i32 1, double %5)
%7 = tail call float @sqrt(i32 2)
%8 = fpext float %7 to double
%9 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([18 x i8], [18 x i8]* @.str.2, i64 0, i64 0), i32 2, double %8)
%10 = tail call float @sqrt(i32 3)
%11 = fpext float %10 to double
%12 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([18 x i8], [18 x i8]* @.str.2, i64 0, i64 0), i32 3, double %11)
%13 = tail call float @sqrt(i32 4)
%14 = fpext float %13 to double
%15 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([18 x i8], [18 x i8]* @.str.2, i64 0, i64 0), i32 4, double %14)
%16 = tail call float @sqrt(i32 5)
%17 = fpext float %16 to double
%18 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([18 x i8], [18 x i8]* @.str.2, i64 0, i64 0), i32 5, double %17)
%19 = tail call float @sqrt(i32 6)
%20 = fpext float %19 to double
%21 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([18 x i8], [18 x i8]* @.str.2, i64 0, i64 0), i32 6, double %20)
%22 = tail call float @sqrt(i32 7)
%23 = fpext float %22 to double
%24 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([18 x i8], [18 x i8]* @.str.2, i64 0, i64 0), i32 7, double %23)
%25 = tail call float @sqrt(i32 8)
%26 = fpext float %25 to double
%27 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([18 x i8], [18 x i8]* @.str.2, i64 0, i64 0), i32 8, double %26)
%28 = tail call float @sqrt(i32 9)
%29 = fpext float %28 to double
%30 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([18 x i8], [18 x i8]* @.str.2, i64 0, i64 0), i32 9, double %29)
%31 = tail call float @sqrt(i32 10)
%32 = fpext float %31 to double
%33 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([18 x i8], [18 x i8]* @.str.2, i64 0, i64 0), i32 10, double %32)
%34 = tail call float @sqrt(i32 11)
%35 = fpext float %34 to double
%36 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([18 x i8], [18 x i8]* @.str.2, i64 0, i64 0), i32 11, double %35)
%37 = tail call float @sqrt(i32 12)
%38 = fpext float %37 to double
%39 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([18 x i8], [18 x i8]* @.str.2, i64 0, i64 0), i32 12, double %38)
%40 = tail call float @sqrt(i32 13)
%41 = fpext float %40 to double
%42 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([18 x i8], [18 x i8]* @.str.2, i64 0, i64 0), i32 13, double %41)
%43 = tail call float @sqrt(i32 14)
%44 = fpext float %43 to double
%45 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([18 x i8], [18 x i8]* @.str.2, i64 0, i64 0), i32 14, double %44)
%46 = tail call float @sqrt(i32 15)
%47 = fpext float %46 to double
%48 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([18 x i8], [18 x i8]* @.str.2, i64 0, i64 0), i32 15, double %47)
%49 = tail call float @sqrt(i32 16)
%50 = fpext float %49 to double
%51 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([18 x i8], [18 x i8]* @.str.2, i64 0, i64 0), i32 16, double %50)
%52 = tail call float @sqrt(i32 17)
%53 = fpext float %52 to double
%54 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([18 x i8], [18 x i8]* @.str.2, i64 0, i64 0), i32 17, double %53)
%55 = tail call float @sqrt(i32 18)
%56 = fpext float %55 to double
%57 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([18 x i8], [18 x i8]* @.str.2, i64 0, i64 0), i32 18, double %56)
%58 = tail call float @sqrt(i32 19)
%59 = fpext float %58 to double
%60 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([18 x i8], [18 x i8]* @.str.2, i64 0, i64 0), i32 19, double %59)
%61 = tail call float @sqrt(i32 20)
%62 = fpext float %61 to double
%63 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([18 x i8], [18 x i8]* @.str.2, i64 0, i64 0), i32 20, double %62)
%64 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([15 x i8], [15 x i8]* @str.5, i64 0, i64 0))
ret i32 0
}