#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 *, long double);
long double sqrt(long double);
int main() {
  int n = 100000;
  long double sum = 0;
  for (int i = 1; i <= n; i++)
    for (int j = 1; j <= n; j++)
      sum += sqrt((long double)i * (long double)j) /
             ((long double)i * (long double)j);
  printf("%Lf\n", sum);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x50,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x186a0,-0x8(%rbp)
fldz
fstpt  -0x20(%rbp)
movl   $0x1,-0x24(%rbp)
mov    -0x24(%rbp),%eax
cmp    -0x8(%rbp),%eax
jg     11be <main+0x9e>
movl   $0x1,-0x28(%rbp)
mov    -0x28(%rbp),%eax
cmp    -0x8(%rbp),%eax
jg     11ab <main+0x8b>
mov    -0x24(%rbp),%eax
mov    %eax,-0x38(%rbp)
fildl  -0x38(%rbp)
mov    -0x28(%rbp),%eax
mov    %eax,-0x34(%rbp)
fildl  -0x34(%rbp)
fmulp  %st,%st(1)
mov    %rsp,%rax
fstpt  (%rax)
call   1040 <sqrt@plt>
mov    -0x24(%rbp),%eax
mov    %eax,-0x2c(%rbp)
fildl  -0x2c(%rbp)
mov    -0x28(%rbp),%eax
mov    %eax,-0x30(%rbp)
fildl  -0x30(%rbp)
fmulp  %st,%st(1)
fdivrp %st,%st(1)
fldt   -0x20(%rbp)
faddp  %st,%st(1)
fstpt  -0x20(%rbp)
mov    -0x28(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x28(%rbp)
jmp    1155 <main+0x35>
jmp    11b0 <main+0x90>
mov    -0x24(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x24(%rbp)
jmp    1142 <main+0x22>
fldt   -0x20(%rbp)
mov    %rsp,%rax
fstpt  (%rax)
lea    0xe33(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x50,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %rbx
sub    $0x68,%rsp
fldz
mov    $0x1,%ebx
fld1
fld    %st(0)
fstpt  0x50(%rsp)
fld    %st(1)
fstpt  0x5c(%rsp)
jmp    1155 <main+0x35>
nopl   (%rax)
fstp   %st(0)
fld1
faddp  %st,%st(1)
add    $0x1,%ebx
cmp    $0x186a1,%ebx
je     122c <main+0x10c>
mov    $0x2,%ebp
fldt   0x50(%rsp)
fld    %st(1)
fstpt  0x38(%rsp)
jmp    1185 <main+0x65>
cs nopw 0x0(%rax,%rax,1)
fdivp  %st,%st(4)
faddp  %st,%st(3)
fadds  0xe86(%rip)
add    $0x2,%ebp
cmp    $0x186a2,%ebp
je     1140 <main+0x20>
fld    %st(1)
fmul   %st(1),%st
fld    %st(0)
fsqrt
fldt   0x5c(%rsp)
fxch   %st(2)
fucomi %st(2),%st
fstp   %st(2)
fld    %st(2)
fstpt  0x44(%rsp)
jae    11d3 <main+0xb3>
fstp   %st(0)
fstp   %st(2)
fstp   %st(0)
fld    %st(0)
fstpt  (%rsp)
fxch   %st(1)
fstpt  0x2c(%rsp)
fstpt  0x20(%rsp)
call   1040 <sqrt@plt>
fldt   0x20(%rsp)
fldt   0x44(%rsp)
fldt   0x2c(%rsp)
fldt   0x38(%rsp)
fxch   %st(1)
fxch   %st(4)
fxch   %st(1)
fxch   %st(3)
fxch   %st(1)
fdivp  %st,%st(1)
mov    %ebp,0x1c(%rsp)
fld    %st(2)
fimull 0x1c(%rsp)
fxch   %st(4)
faddp  %st,%st(1)
fld    %st(3)
fsqrt
fldz
fxch   %st(5)
fucomi %st(5),%st
fstp   %st(5)
jae    1170 <main+0x50>
fstp   %st(0)
fstp   %st(2)
fstp   %st(0)
fld    %st(1)
fstpt  (%rsp)
fstpt  0x2c(%rsp)
fstpt  0x20(%rsp)
call   1040 <sqrt@plt>
fldt   0x20(%rsp)
fldt   0x2c(%rsp)
fldt   0x44(%rsp)
fldt   0x38(%rsp)
fxch   %st(3)
fxch   %st(4)
fxch   %st(1)
fxch   %st(2)
fxch   %st(1)
jmp    1170 <main+0x50>
fstp   %st(0)
fstpt  (%rsp)
lea    0xdcc(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x68,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
@.str = [5 x i8] c"%Lf\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca x86_fp80
%4 = alloca i32
%5 = alloca i32
store i32 0, i32* %1
store i32 100000, i32* %2
store x86_fp80 0xK00000000000000000000, x86_fp80* %3
store i32 1, i32* %4
br label %6
6: ; preds = %34, %0
%7 = load i32, i32* %4
%8 = load i32, i32* %2
%9 = icmp sle i32 %7, %8
br i1 %9, label %10, label %37
10: ; preds = %6
store i32 1, i32* %5
br label %11
11: ; preds = %30, %10
%12 = load i32, i32* %5
%13 = load i32, i32* %2
%14 = icmp sle i32 %12, %13
br i1 %14, label %15, label %33
15: ; preds = %11
%16 = load i32, i32* %4
%17 = sitofp i32 %16 to x86_fp80
%18 = load i32, i32* %5
%19 = sitofp i32 %18 to x86_fp80
%20 = fmul x86_fp80 %17, %19
%21 = call x86_fp80 @sqrt(x86_fp80 %20)
%22 = load i32, i32* %4
%23 = sitofp i32 %22 to x86_fp80
%24 = load i32, i32* %5
%25 = sitofp i32 %24 to x86_fp80
%26 = fmul x86_fp80 %23, %25
%27 = fdiv x86_fp80 %21, %26
%28 = load x86_fp80, x86_fp80* %3
%29 = fadd x86_fp80 %28, %27
store x86_fp80 %29, x86_fp80* %3
br label %30
30: ; preds = %15
%31 = load i32, i32* %5
%32 = add nsw i32 %31, 1
store i32 %32, i32* %5
br label %11
33: ; preds = %11
br label %34
34: ; preds = %33
%35 = load i32, i32* %4
%36 = add nsw i32 %35, 1
store i32 %36, i32* %4
br label %6
37: ; preds = %6
%38 = load x86_fp80, x86_fp80* %3
%39 = call i32 @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), x86_fp80 %38)
ret i32 0
}

LLVM IR (-O2):
@.str = [5 x i8] c"%Lf\0A\00"
define i32 @main() {
br label %1
1: ; preds = %0, %7
%2 = phi i32 [ 1, %0 ], [ %8, %7 ]
%3 = phi x86_fp80 [ 0xK00000000000000000000, %0 ], [ %23, %7 ]
%4 = sitofp i32 %2 to x86_fp80
br label %10
5: ; preds = %7
%6 = tail call i32 @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), x86_fp80 %23)
ret i32 0
7: ; preds = %10
%8 = add nuw nsw i32 %2, 1
%9 = icmp eq i32 %8, 100001
br i1 %9, label %5, label %1
10: ; preds = %10, %1
%11 = phi i32 [ 1, %1 ], [ %24, %10 ]
%12 = phi x86_fp80 [ %3, %1 ], [ %23, %10 ]
%13 = sitofp i32 %11 to x86_fp80
%14 = fmul x86_fp80 %4, %13
%15 = tail call x86_fp80 @sqrt(x86_fp80 %14)
%16 = fdiv x86_fp80 %15, %14
%17 = fadd x86_fp80 %12, %16
%18 = add nuw nsw i32 %11, 1
%19 = sitofp i32 %18 to x86_fp80
%20 = fmul x86_fp80 %4, %19
%21 = tail call x86_fp80 @sqrt(x86_fp80 %20)
%22 = fdiv x86_fp80 %21, %20
%23 = fadd x86_fp80 %17, %22
%24 = add nuw nsw i32 %11, 2
%25 = icmp eq i32 %24, 100001
br i1 %25, label %7, label %10
}