#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__ powl(unsigned long, int);
int /*<<< orphan*/ printf(char *, unsigned long, unsigned long, unsigned long);
int main(int argc, const char *argv[]) {
  int i;
  unsigned long int sumofsquares = 0;
  unsigned long int squareofsum = 0;
  for (i = 1; i <= 100; i++) {
    sumofsquares += (unsigned long int)powl(i, 2);
    squareofsum += i;
  }
  squareofsum = (unsigned long int)powl(squareofsum, 2);
  printf("%ld - %ld = %ld\n", squareofsum, sumofsquares,
         squareofsum - sumofsquares);
  return 0;
}


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)
movq   $0x0,-0x20(%rbp)
movq   $0x0,-0x28(%rbp)
movl   $0x1,-0x14(%rbp)
cmpl   $0x64,-0x14(%rbp)
jg     1187 <main+0x67>
movslq -0x14(%rbp),%rdi
mov    $0x2,%esi
call   1030 <powl@plt>
add    -0x20(%rbp),%rax
mov    %rax,-0x20(%rbp)
movslq -0x14(%rbp),%rax
add    -0x28(%rbp),%rax
mov    %rax,-0x28(%rbp)
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    114d <main+0x2d>
mov    -0x28(%rbp),%rdi
mov    $0x2,%esi
call   1030 <powl@plt>
mov    %rax,-0x28(%rbp)
mov    -0x28(%rbp),%rsi
mov    -0x20(%rbp),%rdx
mov    -0x28(%rbp),%rcx
sub    -0x20(%rbp),%rcx
lea    0xe50(%rip),%rdi
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %r12
push   %rbx
push   %rax
mov    $0x1,%r14d
xor    %ebx,%ebx
mov    %r14,%rdi
mov    $0x2,%esi
call   1030 <powl@plt>
mov    %rax,%r15
add    %rbx,%r15
lea    0x1(%r14),%rdi
mov    $0x2,%esi
call   1030 <powl@plt>
mov    %rax,%rbx
add    %r15,%rbx
lea    0x2(%r14),%rdi
mov    $0x2,%esi
call   1030 <powl@plt>
mov    %rax,%r15
add    %rbx,%r15
lea    0x3(%r14),%rdi
mov    $0x2,%esi
call   1030 <powl@plt>
mov    %rax,%r12
add    %r15,%r12
lea    0x4(%r14),%rdi
mov    $0x2,%esi
call   1030 <powl@plt>
mov    %rax,%rbx
add    %r12,%rbx
add    $0x5,%r14
cmp    $0x65,%r14
jne    1130 <main+0x10>
mov    $0x13ba,%edi
mov    $0x2,%esi
call   1030 <powl@plt>
mov    %rax,%rcx
sub    %rbx,%rcx
lea    0xe47(%rip),%rdi
mov    %rax,%rsi
mov    %rbx,%rdx
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
ret

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

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