#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*/ EXIT_SUCCESS;
int /*<<< orphan*/ exit(int /*<<< orphan*/);
int /*<<< orphan*/ printf(char *, unsigned long long);
int main(int argc, char **argv) {
  unsigned long long sum = 0;
  unsigned long long sum_of_squares = 0;
  unsigned long long square_of_sum = 0;
  unsigned long long difference = 0;
  unsigned long long i;
  for (i = 1; i <= 100; i++) {
    sum += i;
    sum_of_squares += (i * i);
  }
  square_of_sum = sum * sum;
  difference = square_of_sum - sum_of_squares;
  printf("The sum of the squares is %llu.\n", sum_of_squares);
  printf("The square of the sum is %llu.\n", square_of_sum);
  printf("The difference is %llu.\n", difference);
  exit(EXIT_SUCCESS);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movq   $0x0,-0x18(%rbp)
movq   $0x0,-0x20(%rbp)
movq   $0x0,-0x28(%rbp)
movq   $0x0,-0x30(%rbp)
movq   $0x1,-0x38(%rbp)
cmpq   $0x64,-0x38(%rbp)
ja     1197 <main+0x77>
mov    -0x38(%rbp),%rax
add    -0x18(%rbp),%rax
mov    %rax,-0x18(%rbp)
mov    -0x38(%rbp),%rax
imul   -0x38(%rbp),%rax
add    -0x20(%rbp),%rax
mov    %rax,-0x20(%rbp)
mov    -0x38(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x38(%rbp)
jmp    115e <main+0x3e>
mov    -0x18(%rbp),%rax
imul   -0x18(%rbp),%rax
mov    %rax,-0x28(%rbp)
mov    -0x28(%rbp),%rax
sub    -0x20(%rbp),%rax
mov    %rax,-0x30(%rbp)
mov    -0x20(%rbp),%rsi
lea    0xe45(%rip),%rdi
call   1030 <printf@plt>
mov    -0x28(%rbp),%rsi
lea    0xe56(%rip),%rdi
call   1030 <printf@plt>
mov    -0x30(%rbp),%rsi
lea    0xe66(%rip),%rdi
call   1030 <printf@plt>
mov    0x2df9(%rip),%rax
mov    (%rax),%edi
call   1040 <exit@plt>

x86 assembly (clang, -O2):
<main>:
push   %rax
lea    0xed8(%rip),%rdi
mov    $0x529ae,%esi
call   1030 <printf@plt>
lea    0xee8(%rip),%rdi
mov    $0x1852324,%esi
call   1030 <printf@plt>
lea    0xef7(%rip),%rdi
mov    $0x17ff976,%esi
call   1030 <printf@plt>
mov    0x2e85(%rip),%rax
mov    (%rax),%edi
call   1040 <exit@plt>

LLVM IR (-O0):
@.str = [33 x i8] c"The sum of the squares is %llu.\0A\00"
@.str.1 = [32 x i8] c"The square of the sum is %llu.\0A\00"
@.str.2 = [25 x i8] c"The difference is %llu.\0A\00"
@EXIT_SUCCESS = global i32 0
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i64
%7 = alloca i64
%8 = alloca i64
%9 = alloca i64
%10 = alloca i64
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
store i64 0, i64* %6
store i64 0, i64* %7
store i64 0, i64* %8
store i64 0, i64* %9
store i64 1, i64* %10
br label %11
11: ; preds = %23, %2
%12 = load i64, i64* %10
%13 = icmp ule i64 %12, 100
br i1 %13, label %14, label %26
14: ; preds = %11
%15 = load i64, i64* %10
%16 = load i64, i64* %6
%17 = add i64 %16, %15
store i64 %17, i64* %6
%18 = load i64, i64* %10
%19 = load i64, i64* %10
%20 = mul i64 %18, %19
%21 = load i64, i64* %7
%22 = add i64 %21, %20
store i64 %22, i64* %7
br label %23
23: ; preds = %14
%24 = load i64, i64* %10
%25 = add i64 %24, 1
store i64 %25, i64* %10
br label %11
26: ; preds = %11
%27 = load i64, i64* %6
%28 = load i64, i64* %6
%29 = mul i64 %27, %28
store i64 %29, i64* %8
%30 = load i64, i64* %8
%31 = load i64, i64* %7
%32 = sub i64 %30, %31
store i64 %32, i64* %9
%33 = load i64, i64* %7
%34 = call i32 @printf(i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str, i64 0, i64 0), i64 %33)
%35 = load i64, i64* %8
%36 = call i32 @printf(i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str.1, i64 0, i64 0), i64 %35)
%37 = load i64, i64* %9
%38 = call i32 @printf(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.2, i64 0, i64 0), i64 %37)
%39 = load i32, i32* @EXIT_SUCCESS
%40 = call i32 @exit(i32 %39)
unreachable
}

LLVM IR (-O2):
@.str = [33 x i8] c"The sum of the squares is %llu.\0A\00"
@.str.1 = [32 x i8] c"The square of the sum is %llu.\0A\00"
@.str.2 = [25 x i8] c"The difference is %llu.\0A\00"
@EXIT_SUCCESS = global i32 0
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = tail call i32 @printf(i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str, i64 0, i64 0), i64 338350)
%4 = tail call i32 @printf(i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str.1, i64 0, i64 0), i64 25502500)
%5 = tail call i32 @printf(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.2, i64 0, i64 0), i64 25164150)
%6 = load i32, i32* @EXIT_SUCCESS
%7 = tail call i32 @exit(i32 %6)
unreachable
}