#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*/ printf(char *, long);
int main() {
  int a;
  long sumofsquare = 0, squareofsum = 0, difference;
  for (a = 1; a <= 100; a++) {
    sumofsquare = sumofsquare + a * a;
  }
  for (a = 1; a <= 100; a++) {
    squareofsum = squareofsum + a;
  }
  squareofsum = squareofsum * squareofsum;
  difference = squareofsum - sumofsquare;
  printf("%ld\n", difference);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
movq   $0x0,-0x10(%rbp)
movq   $0x0,-0x18(%rbp)
movl   $0x1,-0x8(%rbp)
cmpl   $0x64,-0x8(%rbp)
jg     1163 <main+0x53>
mov    -0x10(%rbp),%rax
mov    -0x8(%rbp),%ecx
imul   -0x8(%rbp),%ecx
movslq %ecx,%rcx
add    %rcx,%rax
mov    %rax,-0x10(%rbp)
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    1136 <main+0x26>
movl   $0x1,-0x8(%rbp)
cmpl   $0x64,-0x8(%rbp)
jg     1191 <main+0x81>
mov    -0x18(%rbp),%rax
movslq -0x8(%rbp),%rcx
add    %rcx,%rax
mov    %rax,-0x18(%rbp)
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    116a <main+0x5a>
mov    -0x18(%rbp),%rax
imul   -0x18(%rbp),%rax
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rax
sub    -0x10(%rbp),%rax
mov    %rax,-0x20(%rbp)
mov    -0x20(%rbp),%rsi
lea    0xe4b(%rip),%rdi
call   1030 <printf@plt>
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
lea    0xee8(%rip),%rdi
mov    $0x17ff976,%esi
call   1030 <printf@plt>
xor    %eax,%eax
pop    %rcx
ret

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

LLVM IR (-O2):
@.str = [5 x i8] c"%ld\0A\00"
define i32 @main() {
%1 = tail call i32 @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i64 25164150)
ret i32 0
}