#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 *, unsigned long);
int main(void) {
  unsigned long sum_square = 0, square_sum = 0, ans;
  unsigned short int MAX = 100, i;
  for (i = 1; i <= MAX; i++) {
    sum_square += (i * i);
    square_sum += i;
  }
  square_sum *= square_sum;
  printf("Sum of squares ( <= 10): %i\n", sum_square);
  printf("Square of sums ( <= 10): %i\n", square_sum);
  ans = square_sum - sum_square;
  printf(
      "\nThe difference bewteen the square of sums and sum of squares is: %i",
      ans);
  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)
movw   $0x64,-0x22(%rbp)
movw   $0x1,-0x24(%rbp)
movzwl -0x24(%rbp),%eax
movzwl -0x22(%rbp),%ecx
cmp    %ecx,%eax
jg     117d <main+0x6d>
movzwl -0x24(%rbp),%eax
movzwl -0x24(%rbp),%ecx
imul   %ecx,%eax
cltq
add    -0x10(%rbp),%rax
mov    %rax,-0x10(%rbp)
movzwl -0x24(%rbp),%eax
add    -0x18(%rbp),%rax
mov    %rax,-0x18(%rbp)
mov    -0x24(%rbp),%ax
add    $0x1,%ax
mov    %ax,-0x24(%rbp)
jmp    113b <main+0x2b>
mov    -0x18(%rbp),%rax
imul   -0x18(%rbp),%rax
mov    %rax,-0x18(%rbp)
mov    -0x10(%rbp),%rsi
lea    0xe6b(%rip),%rdi
call   1030 <printf@plt>
mov    -0x18(%rbp),%rsi
lea    0xe78(%rip),%rdi
call   1030 <printf@plt>
mov    -0x18(%rbp),%rax
sub    -0x10(%rbp),%rax
mov    %rax,-0x20(%rbp)
mov    -0x20(%rbp),%rsi
lea    0xe79(%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    $0x529ae,%esi
call   1030 <printf@plt>
lea    0xef4(%rip),%rdi
mov    $0x1852324,%esi
call   1030 <printf@plt>
lea    0xf00(%rip),%rdi
mov    $0x17ff976,%esi
call   1030 <printf@plt>
xor    %eax,%eax
pop    %rcx
ret

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

LLVM IR (-O2):
@.str = [29 x i8] c"Sum of squares ( <= 10): %i\0A\00"
@.str.1 = [29 x i8] c"Square of sums ( <= 10): %i\0A\00"
@.str.2 = [69 x i8] c"\0AThe difference bewteen the square of sums and sum of squares is: %i\00"
define i32 @main() {
%1 = tail call i32 @printf(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str, i64 0, i64 0), i64 338350)
%2 = tail call i32 @printf(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.1, i64 0, i64 0), i64 25502500)
%3 = tail call i32 @printf(i8* getelementptr inbounds ([69 x i8], [69 x i8]* @.str.2, i64 0, i64 0), i64 25164150)
ret i32 0
}