#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 *, double);
double sqrt(int);
int main() {
  double s[100];
  int n, m;
  for (n = 0; n <= 99; n++) {
    s[n] = sqrt(n);
  }
  for (n = 0; n <= 9; n++) {
    printf("%7d", n);
  }
  for (n = 0; n <= 99; n++) {
    if (m != n / 10) {
      m = n / 10;
      printf("\n%d", m);
    }
    printf("%7.3f", s[n]);
  }
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x340,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0x334(%rbp)
cmpl   $0x63,-0x334(%rbp)
jg     1178 <main+0x58>
mov    -0x334(%rbp),%edi
call   1040 <sqrt@plt>
movslq -0x334(%rbp),%rax
movsd  %xmm0,-0x330(%rbp,%rax,8)
ff ff
mov    -0x334(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x334(%rbp)
jmp    113c <main+0x1c>
movl   $0x0,-0x334(%rbp)
cmpl   $0x9,-0x334(%rbp)
jg     11b7 <main+0x97>
cvtsi2sdl -0x334(%rbp),%xmm0
ff
lea    0xe62(%rip),%rdi
call   1030 <printf@plt>
mov    -0x334(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x334(%rbp)
jmp    1182 <main+0x62>
movl   $0x0,-0x334(%rbp)
cmpl   $0x63,-0x334(%rbp)
jg     1250 <main+0x130>
mov    -0x338(%rbp),%eax
mov    %eax,-0x33c(%rbp)
mov    -0x334(%rbp),%eax
mov    $0xa,%ecx
cltd
idiv   %ecx
mov    %eax,%ecx
mov    -0x33c(%rbp),%eax
cmp    %ecx,%eax
je     1220 <main+0x100>
mov    -0x334(%rbp),%eax
mov    $0xa,%ecx
cltd
idiv   %ecx
mov    %eax,-0x338(%rbp)
cvtsi2sdl -0x338(%rbp),%xmm0
ff
lea    0xde9(%rip),%rdi
call   1030 <printf@plt>
movslq -0x334(%rbp),%rax
movsd  -0x330(%rbp,%rax,8),%xmm0
ff ff
lea    0xdd1(%rip),%rdi
call   1030 <printf@plt>
mov    -0x334(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x334(%rbp)
jmp    11c1 <main+0xa1>
mov    -0x4(%rbp),%eax
add    $0x340,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
sub    $0x320,%rsp
xor    %ebx,%ebx
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
mov    %ebx,%edi
call   1040 <sqrt@plt>
movsd  %xmm0,(%rsp,%rbx,8)
lea    0x1(%rbx),%edi
call   1040 <sqrt@plt>
movsd  %xmm0,0x8(%rsp,%rbx,8)
lea    0x2(%rbx),%edi
call   1040 <sqrt@plt>
movsd  %xmm0,0x10(%rsp,%rbx,8)
lea    0x3(%rbx),%edi
call   1040 <sqrt@plt>
movsd  %xmm0,0x18(%rsp,%rbx,8)
lea    0x4(%rbx),%edi
call   1040 <sqrt@plt>
movsd  %xmm0,0x20(%rsp,%rbx,8)
add    $0x5,%rbx
cmp    $0x64,%rbx
jne    1140 <main+0x20>
lea    0xeb3(%rip),%rbx
xorps  %xmm0,%xmm0
mov    %rbx,%rdi
call   1030 <printf@plt>
movsd  0xe58(%rip),%xmm0
mov    %rbx,%rdi
call   1030 <printf@plt>
movsd  0xe50(%rip),%xmm0
mov    %rbx,%rdi
call   1030 <printf@plt>
movsd  0xe48(%rip),%xmm0
mov    %rbx,%rdi
call   1030 <printf@plt>
movsd  0xe40(%rip),%xmm0
mov    %rbx,%rdi
call   1030 <printf@plt>
movsd  0xe38(%rip),%xmm0
mov    %rbx,%rdi
call   1030 <printf@plt>
movsd  0xe30(%rip),%xmm0
mov    %rbx,%rdi
call   1030 <printf@plt>
movsd  0xe28(%rip),%xmm0
mov    %rbx,%rdi
call   1030 <printf@plt>
movsd  0xe20(%rip),%xmm0
mov    %rbx,%rdi
call   1030 <printf@plt>
movsd  0xe18(%rip),%xmm0
mov    %rbx,%rdi
call   1030 <printf@plt>
xor    %ebx,%ebx
lea    0xe17(%rip),%r15
lea    0xe0c(%rip),%r14
jmp    1267 <main+0x147>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
movsd  (%rsp,%rbx,8),%xmm0
mov    %r15,%rdi
call   1030 <printf@plt>
add    $0x1,%rbx
cmp    $0x64,%rbx
je     128c <main+0x16c>
movzbl %bl,%eax
imul   $0xcd,%eax,%ebp
shr    $0xb,%ebp
cmp    %ebp,%r12d
je     1250 <main+0x130>
xorps  %xmm0,%xmm0
cvtsi2sd %ebp,%xmm0
mov    %r14,%rdi
call   1030 <printf@plt>
mov    %ebp,%r12d
jmp    1250 <main+0x130>
xor    %eax,%eax
add    $0x320,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [4 x i8] c"%7d\00"
@.str.1 = [4 x i8] c"\0A%d\00"
@.str.2 = [6 x i8] c"%7.3f\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [100 x double]
%3 = alloca i32
%4 = alloca i32
store i32 0, i32* %1
store i32 0, i32* %3
br label %5
5: ; preds = %14, %0
%6 = load i32, i32* %3
%7 = icmp sle i32 %6, 99
br i1 %7, label %8, label %17
8: ; preds = %5
%9 = load i32, i32* %3
%10 = call double @sqrt(i32 %9)
%11 = load i32, i32* %3
%12 = sext i32 %11 to i64
%13 = getelementptr inbounds [100 x double], [100 x double]* %2, i64 0, i64 %12
store double %10, double* %13
br label %14
14: ; preds = %8
%15 = load i32, i32* %3
%16 = add nsw i32 %15, 1
store i32 %16, i32* %3
br label %5
17: ; preds = %5
store i32 0, i32* %3
br label %18
18: ; preds = %25, %17
%19 = load i32, i32* %3
%20 = icmp sle i32 %19, 9
br i1 %20, label %21, label %28
21: ; preds = %18
%22 = load i32, i32* %3
%23 = sitofp i32 %22 to double
%24 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), double %23)
br label %25
25: ; preds = %21
%26 = load i32, i32* %3
%27 = add nsw i32 %26, 1
store i32 %27, i32* %3
br label %18
28: ; preds = %18
store i32 0, i32* %3
br label %29
29: ; preds = %49, %28
%30 = load i32, i32* %3
%31 = icmp sle i32 %30, 99
br i1 %31, label %32, label %52
32: ; preds = %29
%33 = load i32, i32* %4
%34 = load i32, i32* %3
%35 = sdiv i32 %34, 10
%36 = icmp ne i32 %33, %35
br i1 %36, label %37, label %43
37: ; preds = %32
%38 = load i32, i32* %3
%39 = sdiv i32 %38, 10
store i32 %39, i32* %4
%40 = load i32, i32* %4
%41 = sitofp i32 %40 to double
%42 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), double %41)
br label %43
43: ; preds = %37, %32
%44 = load i32, i32* %3
%45 = sext i32 %44 to i64
%46 = getelementptr inbounds [100 x double], [100 x double]* %2, i64 0, i64 %45
%47 = load double, double* %46
%48 = call i32 @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.2, i64 0, i64 0), double %47)
br label %49
49: ; preds = %43
%50 = load i32, i32* %3
%51 = add nsw i32 %50, 1
store i32 %51, i32* %3
br label %29
52: ; preds = %29
%53 = load i32, i32* %1
ret i32 %53
}

LLVM IR (-O2):
@.str = [4 x i8] c"%7d\00"
@.str.1 = [4 x i8] c"\0A%d\00"
@.str.2 = [6 x i8] c"%7.3f\00"
define i32 @main() {
%1 = alloca [100 x double]
%2 = bitcast [100 x double]* %1 to i8*
br label %3
3: ; preds = %3, %0
%4 = phi i64 [ 0, %0 ], [ %24, %3 ]
%5 = trunc i64 %4 to i32
%6 = tail call double @sqrt(i32 %5)
%7 = getelementptr inbounds [100 x double], [100 x double]* %1, i64 0, i64 %4
store double %6, double* %7
%8 = add nuw nsw i64 %4, 1
%9 = trunc i64 %8 to i32
%10 = tail call double @sqrt(i32 %9)
%11 = getelementptr inbounds [100 x double], [100 x double]* %1, i64 0, i64 %8
store double %10, double* %11
%12 = add nuw nsw i64 %4, 2
%13 = trunc i64 %12 to i32
%14 = tail call double @sqrt(i32 %13)
%15 = getelementptr inbounds [100 x double], [100 x double]* %1, i64 0, i64 %12
store double %14, double* %15
%16 = add nuw nsw i64 %4, 3
%17 = trunc i64 %16 to i32
%18 = tail call double @sqrt(i32 %17)
%19 = getelementptr inbounds [100 x double], [100 x double]* %1, i64 0, i64 %16
store double %18, double* %19
%20 = add nuw nsw i64 %4, 4
%21 = trunc i64 %20 to i32
%22 = tail call double @sqrt(i32 %21)
%23 = getelementptr inbounds [100 x double], [100 x double]* %1, i64 0, i64 %20
store double %22, double* %23
%24 = add nuw nsw i64 %4, 5
%25 = icmp eq i64 %24, 100
br i1 %25, label %26, label %3
26: ; preds = %3
%27 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), double 0.000000e+00)
%28 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), double 1.000000e+00)
%29 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), double 2.000000e+00)
%30 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), double 3.000000e+00)
%31 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), double 4.000000e+00)
%32 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), double 5.000000e+00)
%33 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), double 6.000000e+00)
%34 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), double 7.000000e+00)
%35 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), double 8.000000e+00)
%36 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), double 9.000000e+00)
br label %37
37: ; preds = %26, %47
%38 = phi i64 [ 0, %26 ], [ %52, %47 ]
%39 = phi i32 [ undef, %26 ], [ %48, %47 ]
%40 = trunc i64 %38 to i8
%41 = udiv i8 %40, 10
%42 = zext i8 %41 to i32
%43 = icmp eq i32 %39, %42
br i1 %43, label %47, label %44
44: ; preds = %37
%45 = uitofp i8 %41 to double
%46 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), double %45)
br label %47
47: ; preds = %44, %37
%48 = phi i32 [ %42, %44 ], [ %39, %37 ]
%49 = getelementptr inbounds [100 x double], [100 x double]* %1, i64 0, i64 %38
%50 = load double, double* %49
%51 = tail call i32 @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.2, i64 0, i64 0), double %50)
%52 = add nuw nsw i64 %38, 1
%53 = icmp eq i64 %52, 100
br i1 %53, label %54, label %37
54: ; preds = %47
ret i32 0
}