#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, long, long);
int main(void) {
  long sumOfSquare, squareOfSum;
  long count1, count2, count3;
  sumOfSquare = 0;
  squareOfSum = 0;
  for (count1 = 1; count1 <= 100; count1++)
    sumOfSquare = sumOfSquare + count1 * count1;
  for (count2 = 1; count2 <= 100; count2++)
    for (count3 = 1; count3 <= 100; count3++)
      squareOfSum = squareOfSum + count2 * count3;
  printf("Answer: %li - %li = %li\n", squareOfSum, sumOfSquare,
         squareOfSum - sumOfSquare);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movl   $0x0,-0x4(%rbp)
movq   $0x0,-0x10(%rbp)
movq   $0x0,-0x18(%rbp)
movq   $0x1,-0x20(%rbp)
cmpq   $0x64,-0x20(%rbp)
jg     1167 <main+0x57>
mov    -0x10(%rbp),%rax
mov    -0x20(%rbp),%rcx
imul   -0x20(%rbp),%rcx
add    %rcx,%rax
mov    %rax,-0x10(%rbp)
mov    -0x20(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x20(%rbp)
jmp    1137 <main+0x27>
movq   $0x1,-0x28(%rbp)
cmpq   $0x64,-0x28(%rbp)
jg     11c8 <main+0xb8>
movq   $0x1,-0x30(%rbp)
cmpq   $0x64,-0x30(%rbp)
jg     11b2 <main+0xa2>
mov    -0x18(%rbp),%rax
mov    -0x28(%rbp),%rcx
imul   -0x30(%rbp),%rcx
add    %rcx,%rax
mov    %rax,-0x18(%rbp)
mov    -0x30(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x30(%rbp)
jmp    1182 <main+0x72>
jmp    11b7 <main+0xa7>
mov    -0x28(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x28(%rbp)
jmp    116f <main+0x5f>
mov    -0x18(%rbp),%rsi
mov    -0x10(%rbp),%rdx
mov    -0x18(%rbp),%rcx
sub    -0x10(%rbp),%rcx
lea    0xe21(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x30,%rsp
pop    %rbp
ret

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

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

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