#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 */
double fabs(double);
double pow(double, double);
double solution() {
  double x;
  double sum_of_naturals_squared = 0;
  double square_of_the_sum;
  square_of_the_sum = pow((double)(100 * (100 + 1)) / 2, (double)2);
  for (x = 1; x < 101; x++) {
    sum_of_naturals_squared += pow(x, (double)2);
  }
  return fabs(sum_of_naturals_squared - square_of_the_sum);
}


x86 assembly (clang, -O0):
<solution>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x10(%rbp)
movsd  0xee0(%rip),%xmm0
movsd  0xee0(%rip),%xmm1
call   1030 <pow@plt>
movsd  %xmm0,-0x18(%rbp)
movsd  0xebe(%rip),%xmm0
movsd  %xmm0,-0x8(%rbp)
movsd  0xec9(%rip),%xmm0
ucomisd -0x8(%rbp),%xmm0
jbe    118d <solution+0x7d>
movsd  -0x8(%rbp),%xmm0
movsd  0xea9(%rip),%xmm1
call   1030 <pow@plt>
addsd  -0x10(%rbp),%xmm0
movsd  %xmm0,-0x10(%rbp)
movsd  0xe82(%rip),%xmm0
addsd  -0x8(%rbp),%xmm0
movsd  %xmm0,-0x8(%rbp)
jmp    1147 <solution+0x37>
movsd  -0x10(%rbp),%xmm0
subsd  -0x18(%rbp),%xmm0
movaps 0xe82(%rip),%xmm1
pand   %xmm1,%xmm0
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<solution>:
xorpd  %xmm0,%xmm0
movsd  0xef4(%rip),%xmm1
mov    $0x5,%eax
movsd  0xeef(%rip),%xmm2
nopl   0x0(%rax)
movapd %xmm1,%xmm3
mulsd  %xmm1,%xmm3
lea    -0x3(%rax),%ecx
xorps  %xmm4,%xmm4
cvtsi2sd %ecx,%xmm4
addsd  %xmm0,%xmm3
mulsd  %xmm4,%xmm4
addsd  %xmm3,%xmm4
lea    -0x2(%rax),%ecx
xorps  %xmm0,%xmm0
cvtsi2sd %ecx,%xmm0
mulsd  %xmm0,%xmm0
addsd  %xmm4,%xmm0
lea    -0x1(%rax),%ecx
xorps  %xmm3,%xmm3
cvtsi2sd %ecx,%xmm3
mulsd  %xmm3,%xmm3
addsd  %xmm0,%xmm3
xorps  %xmm0,%xmm0
cvtsi2sd %eax,%xmm0
mulsd  %xmm0,%xmm0
addsd  %xmm3,%xmm0
addsd  %xmm2,%xmm1
add    $0x5,%eax
cmp    $0x69,%eax
jne    1120 <solution+0x20>
addsd  0xe8b(%rip),%xmm0
andpd  0xe93(%rip),%xmm0
ret

LLVM IR (-O0):
define double @solution() {
%1 = alloca double
%2 = alloca double
%3 = alloca double
store double 0.000000e+00, double* %2
%4 = call double @pow(double 5.050000e+03, double 2.000000e+00)
store double %4, double* %3
store double 1.000000e+00, double* %1
br label %5
5: ; preds = %13, %0
%6 = load double, double* %1
%7 = fcmp olt double %6, 1.010000e+02
br i1 %7, label %8, label %16
8: ; preds = %5
%9 = load double, double* %1
%10 = call double @pow(double %9, double 2.000000e+00)
%11 = load double, double* %2
%12 = fadd double %11, %10
store double %12, double* %2
br label %13
13: ; preds = %8
%14 = load double, double* %1
%15 = fadd double %14, 1.000000e+00
store double %15, double* %1
br label %5
16: ; preds = %5
%17 = load double, double* %2
%18 = load double, double* %3
%19 = fsub double %17, %18
%20 = call double @llvm.fabs.f64(double %19)
ret double %20
}

LLVM IR (-O2):
define double @solution() {
br label %1
1: ; preds = %1, %0
%2 = phi i32 [ 1, %0 ], [ %23, %1 ]
%3 = phi double [ 0.000000e+00, %0 ], [ %22, %1 ]
%4 = sitofp i32 %2 to double
%5 = fmul double %4, %4
%6 = fadd double %3, %5
%7 = add nuw nsw i32 %2, 1
%8 = sitofp i32 %7 to double
%9 = fmul double %8, %8
%10 = fadd double %6, %9
%11 = add nuw nsw i32 %2, 2
%12 = sitofp i32 %11 to double
%13 = fmul double %12, %12
%14 = fadd double %10, %13
%15 = add nuw nsw i32 %2, 3
%16 = sitofp i32 %15 to double
%17 = fmul double %16, %16
%18 = fadd double %14, %17
%19 = add nuw nsw i32 %2, 4
%20 = sitofp i32 %19 to double
%21 = fmul double %20, %20
%22 = fadd double %18, %21
%23 = add nuw nsw i32 %2, 5
%24 = icmp eq i32 %23, 101
br i1 %24, label %25, label %1
25: ; preds = %1
%26 = fadd double %22, -2.550250e+07
%27 = tail call double @llvm.fabs.f64(double %26)
ret double %27
}