#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 findSquareOfSum_efficient(int);
long findSumOfSquare_efficient(int);
int /*<<< orphan*/ printf(char *, long, ...);
int main(int argc, char *argv[]) {
  printf("Size of an int: %lubytes\nSize of a long: %lubytes\n", sizeof(int),
         sizeof(long));
  long squareOfSum = findSquareOfSum_efficient(100);
  long sumOfSquare = findSumOfSquare_efficient(100);
  printf("The Difference of the sumOfSquare - squareOfSum = %lu\n",
         squareOfSum - sumOfSquare);
  return 1;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
lea    0xeb3(%rip),%rdi
mov    $0x4,%esi
mov    $0x8,%edx
mov    $0x0,%al
call   1050 <printf@plt>
mov    $0x64,%edi
call   1030 <findSquareOfSum_efficient@plt>
mov    %rax,-0x18(%rbp)
mov    $0x64,%edi
call   1040 <findSumOfSquare_efficient@plt>
mov    %rax,-0x20(%rbp)
mov    -0x18(%rbp),%rsi
sub    -0x20(%rbp),%rsi
lea    0xeaa(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
mov    $0x1,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
lea    0xec8(%rip),%rdi
mov    $0x4,%esi
mov    $0x8,%edx
xor    %eax,%eax
call   1050 <printf@plt>
mov    $0x64,%edi
call   1030 <findSquareOfSum_efficient@plt>
mov    %rax,%rbx
mov    $0x64,%edi
call   1040 <findSumOfSquare_efficient@plt>
sub    %rax,%rbx
lea    0xec9(%rip),%rdi
mov    %rbx,%rsi
xor    %eax,%eax
call   1050 <printf@plt>
mov    $0x1,%eax
pop    %rbx
ret

LLVM IR (-O0):
@.str = [51 x i8] c"Size of an int: %lubytes\0ASize of a long: %lubytes\0A\00"
@.str.1 = [55 x i8] c"The Difference of the sumOfSquare - squareOfSum = %lu\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i64
%7 = alloca i64
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%8 = call i32 (i8*, i64, ...) @printf(i8* getelementptr inbounds ([51 x i8], [51 x i8]* @.str, i64 0, i64 0), i64 4, i64 8)
%9 = call i64 @findSquareOfSum_efficient(i32 100)
store i64 %9, i64* %6
%10 = call i64 @findSumOfSquare_efficient(i32 100)
store i64 %10, i64* %7
%11 = load i64, i64* %6
%12 = load i64, i64* %7
%13 = sub nsw i64 %11, %12
%14 = call i32 (i8*, i64, ...) @printf(i8* getelementptr inbounds ([55 x i8], [55 x i8]* @.str.1, i64 0, i64 0), i64 %13)
ret i32 1
}

LLVM IR (-O2):
@.str = [51 x i8] c"Size of an int: %lubytes\0ASize of a long: %lubytes\0A\00"
@.str.1 = [55 x i8] c"The Difference of the sumOfSquare - squareOfSum = %lu\0A\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = tail call i32 (i8*, i64, ...) @printf(i8* getelementptr inbounds ([51 x i8], [51 x i8]* @.str, i64 0, i64 0), i64 4, i64 8)
%4 = tail call i64 @findSquareOfSum_efficient(i32 100)
%5 = tail call i64 @findSumOfSquare_efficient(i32 100)
%6 = sub nsw i64 %4, %5
%7 = tail call i32 (i8*, i64, ...) @printf(i8* getelementptr inbounds ([55 x i8], [55 x i8]* @.str.1, i64 0, i64 0), i64 %6)
ret i32 1
}