#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 */
long pow(long, int);
int /*<<< orphan*/ printf(char *, long);
int main() {
  long sum_of_squares = 0;
  long square_of_sum = 0;
  int i;
  for (i = 1; i <= 100; i++) {
    sum_of_squares += pow(i, 2);
    square_of_sum += i;
  }
  square_of_sum = pow(square_of_sum, 2);
  printf("%ld\n", square_of_sum - sum_of_squares);
}


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,-0x1c(%rbp)
cmpl   $0x64,-0x1c(%rbp)
jg     1180 <main+0x60>
movslq -0x1c(%rbp),%rdi
mov    $0x2,%esi
call   1040 <pow@plt>
add    -0x10(%rbp),%rax
mov    %rax,-0x10(%rbp)
movslq -0x1c(%rbp),%rax
add    -0x18(%rbp),%rax
mov    %rax,-0x18(%rbp)
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
jmp    1146 <main+0x26>
mov    -0x18(%rbp),%rdi
mov    $0x2,%esi
call   1040 <pow@plt>
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rsi
sub    -0x10(%rbp),%rsi
lea    0xe5f(%rip),%rdi
call   1030 <printf@plt>
mov    -0x4(%rbp),%eax
add    $0x20,%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   1040 <pow@plt>
mov    %rax,%r15
add    %rbx,%r15
lea    0x1(%r14),%rdi
mov    $0x2,%esi
call   1040 <pow@plt>
mov    %rax,%rbx
add    %r15,%rbx
lea    0x2(%r14),%rdi
mov    $0x2,%esi
call   1040 <pow@plt>
mov    %rax,%r15
add    %rbx,%r15
lea    0x3(%r14),%rdi
mov    $0x2,%esi
call   1040 <pow@plt>
mov    %rax,%r12
add    %r15,%r12
lea    0x4(%r14),%rdi
mov    $0x2,%esi
call   1040 <pow@plt>
mov    %rax,%rbx
add    %r12,%rbx
add    $0x5,%r14
cmp    $0x65,%r14
jne    1130 <main+0x10>
mov    $0x13ba,%edi
mov    $0x2,%esi
call   1040 <pow@plt>
sub    %rbx,%rax
lea    0xe4a(%rip),%rdi
mov    %rax,%rsi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
ret

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

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