#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 check(int, int, double);
double pow(double, double);
int main(int argc, char **argv) {
  double x, sum = 0, square = 0;
  for (x = 0; x <= 100; x++) {
    sum += pow(x, 2.0);
    square += x;
  }
  square = pow(square, 2.0);
  double result = square - sum;
  return check(6, 25164150, result);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x20(%rbp)
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x28(%rbp)
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x18(%rbp)
movsd  0xeaa(%rip),%xmm0
ucomisd -0x18(%rbp),%xmm0
jb     11a3 <main+0x83>
movsd  -0x18(%rbp),%xmm0
movsd  0xe9a(%rip),%xmm1
call   1030 <pow@plt>
addsd  -0x20(%rbp),%xmm0
movsd  %xmm0,-0x20(%rbp)
movsd  -0x18(%rbp),%xmm0
addsd  -0x28(%rbp),%xmm0
movsd  %xmm0,-0x28(%rbp)
movsd  0xe7c(%rip),%xmm0
addsd  -0x18(%rbp),%xmm0
movsd  %xmm0,-0x18(%rbp)
jmp    114e <main+0x2e>
movsd  -0x28(%rbp),%xmm0
movsd  0xe58(%rip),%xmm1
call   1030 <pow@plt>
movsd  %xmm0,-0x28(%rbp)
movsd  -0x28(%rbp),%xmm0
subsd  -0x20(%rbp),%xmm0
movsd  %xmm0,-0x30(%rbp)
movsd  -0x30(%rbp),%xmm0
mov    $0x6,%edi
mov    $0x17ff976,%esi
call   1040 <check@plt>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
xorpd  %xmm1,%xmm1
mov    $0x3,%eax
movsd  0xedf(%rip),%xmm2
xorpd  %xmm0,%xmm0
xorpd  %xmm4,%xmm4
nopl   0x0(%rax)
movapd %xmm1,%xmm3
mulsd  %xmm1,%xmm3
addsd  %xmm4,%xmm3
addsd  %xmm1,%xmm0
cmp    $0x67,%eax
je     118d <main+0x7d>
lea    -0x2(%rax),%ecx
xorps  %xmm4,%xmm4
cvtsi2sd %ecx,%xmm4
addsd  %xmm4,%xmm0
mulsd  %xmm4,%xmm4
addsd  %xmm4,%xmm3
lea    -0x1(%rax),%ecx
xorps  %xmm5,%xmm5
cvtsi2sd %ecx,%xmm5
addsd  %xmm5,%xmm0
mulsd  %xmm5,%xmm5
addsd  %xmm3,%xmm5
xorps  %xmm4,%xmm4
cvtsi2sd %eax,%xmm4
addsd  %xmm4,%xmm0
mulsd  %xmm4,%xmm4
addsd  %xmm5,%xmm4
addsd  %xmm2,%xmm1
add    $0x4,%eax
jmp    1130 <main+0x20>
mulsd  %xmm0,%xmm0
subsd  %xmm3,%xmm0
mov    $0x6,%edi
mov    $0x17ff976,%esi
jmp    1030 <check@plt>

LLVM IR (-O0):
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca double
%7 = alloca double
%8 = alloca double
%9 = alloca double
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
store double 0.000000e+00, double* %7
store double 0.000000e+00, double* %8
store double 0.000000e+00, double* %6
br label %10
10: ; preds = %21, %2
%11 = load double, double* %6
%12 = fcmp ole double %11, 1.000000e+02
br i1 %12, label %13, label %24
13: ; preds = %10
%14 = load double, double* %6
%15 = call double @pow(double %14, double 2.000000e+00)
%16 = load double, double* %7
%17 = fadd double %16, %15
store double %17, double* %7
%18 = load double, double* %6
%19 = load double, double* %8
%20 = fadd double %19, %18
store double %20, double* %8
br label %21
21: ; preds = %13
%22 = load double, double* %6
%23 = fadd double %22, 1.000000e+00
store double %23, double* %6
br label %10
24: ; preds = %10
%25 = load double, double* %8
%26 = call double @pow(double %25, double 2.000000e+00)
store double %26, double* %8
%27 = load double, double* %8
%28 = load double, double* %7
%29 = fsub double %27, %28
store double %29, double* %9
%30 = load double, double* %9
%31 = call i32 @check(i32 6, i32 25164150, double %30)
ret i32 %31
}

LLVM IR (-O2):
define i32 @main(i32 %0, i8** nocapture readnone %1) {
br label %3
3: ; preds = %13, %2
%4 = phi i32 [ 0, %2 ], [ %28, %13 ]
%5 = phi double [ 0.000000e+00, %2 ], [ %27, %13 ]
%6 = phi double [ 0.000000e+00, %2 ], [ %26, %13 ]
%7 = sitofp i32 %4 to double
%8 = fmul double %7, %7
%9 = fadd double %6, %8
%10 = fadd double %5, %7
%11 = or i32 %4, 1
%12 = icmp eq i32 %11, 101
br i1 %12, label %29, label %13
13: ; preds = %3
%14 = sitofp i32 %11 to double
%15 = fmul double %14, %14
%16 = fadd double %9, %15
%17 = fadd double %10, %14
%18 = or i32 %4, 2
%19 = sitofp i32 %18 to double
%20 = fmul double %19, %19
%21 = fadd double %16, %20
%22 = fadd double %17, %19
%23 = or i32 %4, 3
%24 = sitofp i32 %23 to double
%25 = fmul double %24, %24
%26 = fadd double %21, %25
%27 = fadd double %22, %24
%28 = add nuw nsw i32 %4, 4
br label %3
29: ; preds = %3
%30 = fmul double %10, %10
%31 = fsub double %30, %9
%32 = tail call i32 @check(i32 6, i32 25164150, double %31)
ret i32 %32
}