#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 */
scalar_t__ pow(long double, int);
int /*<<< orphan*/ printf(char *, double);
double sqrt(long double);
int main(int argc, char *argv[]) {
  double answer;
  long double sum = 0.0;
  for (int i = 1; i <= 100; i++) {
    sum += pow((long double)i, -2);
  }
  answer = sqrt((long double)6.0 * sum);
  printf("The sum of the first 100 terms is %f\n", answer);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x60,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
fldz
fstpt  -0x30(%rbp)
movl   $0x1,-0x34(%rbp)
cmpl   $0x64,-0x34(%rbp)
jg     1191 <main+0x61>
mov    -0x34(%rbp),%eax
mov    %eax,-0x44(%rbp)
fildl  -0x44(%rbp)
mov    %rsp,%rax
fstpt  (%rax)
mov    $0xfffffffe,%edi
call   1040 <pow@plt>
mov    %rax,-0x40(%rbp)
fildll -0x40(%rbp)
fldt   -0x30(%rbp)
faddp  %st,%st(1)
fstpt  -0x30(%rbp)
mov    -0x34(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x34(%rbp)
jmp    1152 <main+0x22>
fldt   -0x30(%rbp)
flds   0xe66(%rip)
fmulp  %st,%st(1)
mov    %rsp,%rax
fstpt  (%rax)
call   1050 <sqrt@plt>
movsd  %xmm0,-0x18(%rbp)
movsd  -0x18(%rbp),%xmm0
lea    0xe4d(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x60,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x70,%rsp
fldz
fld1
mov    $0x5,%ebx
xchg   %ax,%ax
fxch   %st(1)
fstpt  0x1c(%rsp)
fld    %st(0)
fstpt  0x64(%rsp)
fstpt  (%rsp)
mov    $0xfffffffe,%edi
call   1040 <pow@plt>
mov    %rax,0x38(%rsp)
fildll 0x38(%rsp)
fldt   0x1c(%rsp)
faddp  %st,%st(1)
fstpt  0x1c(%rsp)
lea    -0x3(%rbx),%eax
mov    %eax,0x34(%rsp)
fildl  0x34(%rsp)
fstpt  (%rsp)
mov    $0xfffffffe,%edi
call   1040 <pow@plt>
mov    %rax,0x40(%rsp)
fildll 0x40(%rsp)
fldt   0x1c(%rsp)
faddp  %st,%st(1)
fstpt  0x1c(%rsp)
lea    -0x2(%rbx),%eax
mov    %eax,0x30(%rsp)
fildl  0x30(%rsp)
fstpt  (%rsp)
mov    $0xfffffffe,%edi
call   1040 <pow@plt>
mov    %rax,0x48(%rsp)
fildll 0x48(%rsp)
fldt   0x1c(%rsp)
faddp  %st,%st(1)
fstpt  0x1c(%rsp)
lea    -0x1(%rbx),%eax
mov    %eax,0x2c(%rsp)
fildl  0x2c(%rsp)
fstpt  (%rsp)
mov    $0xfffffffe,%edi
call   1040 <pow@plt>
mov    %rax,0x50(%rsp)
fildll 0x50(%rsp)
fldt   0x1c(%rsp)
faddp  %st,%st(1)
fstpt  0x1c(%rsp)
mov    %ebx,0x28(%rsp)
fildl  0x28(%rsp)
fstpt  (%rsp)
mov    $0xfffffffe,%edi
call   1040 <pow@plt>
mov    %rax,0x58(%rsp)
fildll 0x58(%rsp)
fldt   0x1c(%rsp)
faddp  %st,%st(1)
fldt   0x64(%rsp)
fadds  0xde5(%rip)
add    $0x5,%ebx
cmp    $0x69,%ebx
jne    1140 <main+0x10>
fstp   %st(0)
fmuls  0xdd5(%rip)
fstpt  (%rsp)
call   1050 <sqrt@plt>
lea    0xdca(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x70,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@.str = [38 x i8] c"The sum of the first 100 terms is %f\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca double
%7 = alloca x86_fp80
%8 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
store x86_fp80 0xK00000000000000000000, x86_fp80* %7
store i32 1, i32* %8
br label %9
9: ; preds = %19, %2
%10 = load i32, i32* %8
%11 = icmp sle i32 %10, 100
br i1 %11, label %12, label %22
12: ; preds = %9
%13 = load i32, i32* %8
%14 = sitofp i32 %13 to x86_fp80
%15 = call i64 @pow(x86_fp80 %14, i32 -2)
%16 = sitofp i64 %15 to x86_fp80
%17 = load x86_fp80, x86_fp80* %7
%18 = fadd x86_fp80 %17, %16
store x86_fp80 %18, x86_fp80* %7
br label %19
19: ; preds = %12
%20 = load i32, i32* %8
%21 = add nsw i32 %20, 1
store i32 %21, i32* %8
br label %9
22: ; preds = %9
%23 = load x86_fp80, x86_fp80* %7
%24 = fmul x86_fp80 0xK4001C000000000000000, %23
%25 = call double @sqrt(x86_fp80 %24)
store double %25, double* %6
%26 = load double, double* %6
%27 = call i32 @printf(i8* getelementptr inbounds ([38 x i8], [38 x i8]* @.str, i64 0, i64 0), double %26)
ret i32 0
}

LLVM IR (-O2):
@.str = [38 x i8] c"The sum of the first 100 terms is %f\0A\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
br label %7
3: ; preds = %7
%4 = fmul x86_fp80 %33, 0xK4001C000000000000000
%5 = tail call double @sqrt(x86_fp80 %4)
%6 = tail call i32 @printf(i8* getelementptr inbounds ([38 x i8], [38 x i8]* @.str, i64 0, i64 0), double %5)
ret i32 0
7: ; preds = %7, %2
%8 = phi i32 [ 1, %2 ], [ %34, %7 ]
%9 = phi x86_fp80 [ 0xK00000000000000000000, %2 ], [ %33, %7 ]
%10 = sitofp i32 %8 to x86_fp80
%11 = tail call i64 @pow(x86_fp80 %10, i32 -2)
%12 = sitofp i64 %11 to x86_fp80
%13 = fadd x86_fp80 %9, %12
%14 = add nuw nsw i32 %8, 1
%15 = sitofp i32 %14 to x86_fp80
%16 = tail call i64 @pow(x86_fp80 %15, i32 -2)
%17 = sitofp i64 %16 to x86_fp80
%18 = fadd x86_fp80 %13, %17
%19 = add nuw nsw i32 %8, 2
%20 = sitofp i32 %19 to x86_fp80
%21 = tail call i64 @pow(x86_fp80 %20, i32 -2)
%22 = sitofp i64 %21 to x86_fp80
%23 = fadd x86_fp80 %18, %22
%24 = add nuw nsw i32 %8, 3
%25 = sitofp i32 %24 to x86_fp80
%26 = tail call i64 @pow(x86_fp80 %25, i32 -2)
%27 = sitofp i64 %26 to x86_fp80
%28 = fadd x86_fp80 %23, %27
%29 = add nuw nsw i32 %8, 4
%30 = sitofp i32 %29 to x86_fp80
%31 = tail call i64 @pow(x86_fp80 %30, i32 -2)
%32 = sitofp i64 %31 to x86_fp80
%33 = fadd x86_fp80 %28, %32
%34 = add nuw nsw i32 %8, 5
%35 = icmp eq i32 %34, 101
br i1 %35, label %3, label %7
}