#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*/ assert(int);
int square_of_sum(int);
int square_of_sum_efficient(int);
int sum_of_squares(int);
int sum_of_squares_efficient(int);
int main() {
  assert(2640 == (square_of_sum(10) - sum_of_squares(10)));
  assert(41230 == (square_of_sum(20) - sum_of_squares(20)));
  assert(1582700 == (square_of_sum(50) - sum_of_squares(50)));
  assert(25164150 == (square_of_sum(100) - sum_of_squares(100)));
  assert(2640 == (square_of_sum_efficient(10) - sum_of_squares_efficient(10)));
  assert(41230 == (square_of_sum_efficient(20) - sum_of_squares_efficient(20)));
  assert(1582700 ==
         (square_of_sum_efficient(50) - sum_of_squares_efficient(50)));
  assert(25164150 ==
         (square_of_sum_efficient(100) - sum_of_squares_efficient(100)));
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movl   $0x0,-0x4(%rbp)
mov    $0xa,%edi
call   1030 <square_of_sum@plt>
mov    %eax,-0x24(%rbp)
mov    $0xa,%edi
call   1050 <sum_of_squares@plt>
mov    -0x24(%rbp),%ecx
sub    %eax,%ecx
mov    $0xa50,%eax
cmp    %ecx,%eax
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1040 <assert@plt>
mov    $0x14,%edi
call   1030 <square_of_sum@plt>
mov    %eax,-0x20(%rbp)
mov    $0x14,%edi
call   1050 <sum_of_squares@plt>
mov    -0x20(%rbp),%ecx
sub    %eax,%ecx
mov    $0xa10e,%eax
cmp    %ecx,%eax
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1040 <assert@plt>
mov    $0x32,%edi
call   1030 <square_of_sum@plt>
mov    %eax,-0x1c(%rbp)
mov    $0x32,%edi
call   1050 <sum_of_squares@plt>
mov    -0x1c(%rbp),%ecx
sub    %eax,%ecx
mov    $0x18266c,%eax
cmp    %ecx,%eax
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1040 <assert@plt>
mov    $0x64,%edi
call   1030 <square_of_sum@plt>
mov    %eax,-0x18(%rbp)
mov    $0x64,%edi
call   1050 <sum_of_squares@plt>
mov    -0x18(%rbp),%ecx
sub    %eax,%ecx
mov    $0x17ff976,%eax
cmp    %ecx,%eax
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1040 <assert@plt>
mov    $0xa,%edi
call   1060 <square_of_sum_efficient@plt>
mov    %eax,-0x14(%rbp)
mov    $0xa,%edi
call   1070 <sum_of_squares_efficient@plt>
mov    -0x14(%rbp),%ecx
sub    %eax,%ecx
mov    $0xa50,%eax
cmp    %ecx,%eax
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1040 <assert@plt>
mov    $0x14,%edi
call   1060 <square_of_sum_efficient@plt>
mov    %eax,-0x10(%rbp)
mov    $0x14,%edi
call   1070 <sum_of_squares_efficient@plt>
mov    -0x10(%rbp),%ecx
sub    %eax,%ecx
mov    $0xa10e,%eax
cmp    %ecx,%eax
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1040 <assert@plt>
mov    $0x32,%edi
call   1060 <square_of_sum_efficient@plt>
mov    %eax,-0xc(%rbp)
mov    $0x32,%edi
call   1070 <sum_of_squares_efficient@plt>
mov    -0xc(%rbp),%ecx
sub    %eax,%ecx
mov    $0x18266c,%eax
cmp    %ecx,%eax
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1040 <assert@plt>
mov    $0x64,%edi
call   1060 <square_of_sum_efficient@plt>
mov    %eax,-0x8(%rbp)
mov    $0x64,%edi
call   1070 <sum_of_squares_efficient@plt>
mov    -0x8(%rbp),%ecx
sub    %eax,%ecx
mov    $0x17ff976,%eax
cmp    %ecx,%eax
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1040 <assert@plt>
xor    %eax,%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
mov    $0xa,%edi
call   1030 <square_of_sum@plt>
mov    %eax,%ebx
mov    $0xa,%edi
call   1050 <sum_of_squares@plt>
sub    %eax,%ebx
xor    %edi,%edi
cmp    $0xa50,%ebx
sete   %dil
call   1040 <assert@plt>
mov    $0x14,%edi
call   1030 <square_of_sum@plt>
mov    %eax,%ebx
mov    $0x14,%edi
call   1050 <sum_of_squares@plt>
sub    %eax,%ebx
xor    %edi,%edi
cmp    $0xa10e,%ebx
sete   %dil
call   1040 <assert@plt>
mov    $0x32,%edi
call   1030 <square_of_sum@plt>
mov    %eax,%ebx
mov    $0x32,%edi
call   1050 <sum_of_squares@plt>
sub    %eax,%ebx
xor    %edi,%edi
cmp    $0x18266c,%ebx
sete   %dil
call   1040 <assert@plt>
mov    $0x64,%edi
call   1030 <square_of_sum@plt>
mov    %eax,%ebx
mov    $0x64,%edi
call   1050 <sum_of_squares@plt>
sub    %eax,%ebx
xor    %edi,%edi
cmp    $0x17ff976,%ebx
sete   %dil
call   1040 <assert@plt>
mov    $0xa,%edi
call   1060 <square_of_sum_efficient@plt>
mov    %eax,%ebx
mov    $0xa,%edi
call   1070 <sum_of_squares_efficient@plt>
sub    %eax,%ebx
xor    %edi,%edi
cmp    $0xa50,%ebx
sete   %dil
call   1040 <assert@plt>
mov    $0x14,%edi
call   1060 <square_of_sum_efficient@plt>
mov    %eax,%ebx
mov    $0x14,%edi
call   1070 <sum_of_squares_efficient@plt>
sub    %eax,%ebx
xor    %edi,%edi
cmp    $0xa10e,%ebx
sete   %dil
call   1040 <assert@plt>
mov    $0x32,%edi
call   1060 <square_of_sum_efficient@plt>
mov    %eax,%ebx
mov    $0x32,%edi
call   1070 <sum_of_squares_efficient@plt>
sub    %eax,%ebx
xor    %edi,%edi
cmp    $0x18266c,%ebx
sete   %dil
call   1040 <assert@plt>
mov    $0x64,%edi
call   1060 <square_of_sum_efficient@plt>
mov    %eax,%ebx
mov    $0x64,%edi
call   1070 <sum_of_squares_efficient@plt>
sub    %eax,%ebx
xor    %edi,%edi
cmp    $0x17ff976,%ebx
sete   %dil
call   1040 <assert@plt>
xor    %eax,%eax
pop    %rbx
ret

LLVM IR (-O0):
define i32 @main() {
%1 = alloca i32
store i32 0, i32* %1
%2 = call i32 @square_of_sum(i32 10)
%3 = call i32 @sum_of_squares(i32 10)
%4 = sub nsw i32 %2, %3
%5 = icmp eq i32 2640, %4
%6 = zext i1 %5 to i32
%7 = call i32 @assert(i32 %6)
%8 = call i32 @square_of_sum(i32 20)
%9 = call i32 @sum_of_squares(i32 20)
%10 = sub nsw i32 %8, %9
%11 = icmp eq i32 41230, %10
%12 = zext i1 %11 to i32
%13 = call i32 @assert(i32 %12)
%14 = call i32 @square_of_sum(i32 50)
%15 = call i32 @sum_of_squares(i32 50)
%16 = sub nsw i32 %14, %15
%17 = icmp eq i32 1582700, %16
%18 = zext i1 %17 to i32
%19 = call i32 @assert(i32 %18)
%20 = call i32 @square_of_sum(i32 100)
%21 = call i32 @sum_of_squares(i32 100)
%22 = sub nsw i32 %20, %21
%23 = icmp eq i32 25164150, %22
%24 = zext i1 %23 to i32
%25 = call i32 @assert(i32 %24)
%26 = call i32 @square_of_sum_efficient(i32 10)
%27 = call i32 @sum_of_squares_efficient(i32 10)
%28 = sub nsw i32 %26, %27
%29 = icmp eq i32 2640, %28
%30 = zext i1 %29 to i32
%31 = call i32 @assert(i32 %30)
%32 = call i32 @square_of_sum_efficient(i32 20)
%33 = call i32 @sum_of_squares_efficient(i32 20)
%34 = sub nsw i32 %32, %33
%35 = icmp eq i32 41230, %34
%36 = zext i1 %35 to i32
%37 = call i32 @assert(i32 %36)
%38 = call i32 @square_of_sum_efficient(i32 50)
%39 = call i32 @sum_of_squares_efficient(i32 50)
%40 = sub nsw i32 %38, %39
%41 = icmp eq i32 1582700, %40
%42 = zext i1 %41 to i32
%43 = call i32 @assert(i32 %42)
%44 = call i32 @square_of_sum_efficient(i32 100)
%45 = call i32 @sum_of_squares_efficient(i32 100)
%46 = sub nsw i32 %44, %45
%47 = icmp eq i32 25164150, %46
%48 = zext i1 %47 to i32
%49 = call i32 @assert(i32 %48)
ret i32 0
}

LLVM IR (-O2):
define i32 @main() {
%1 = tail call i32 @square_of_sum(i32 10)
%2 = tail call i32 @sum_of_squares(i32 10)
%3 = sub nsw i32 %1, %2
%4 = icmp eq i32 %3, 2640
%5 = zext i1 %4 to i32
%6 = tail call i32 @assert(i32 %5)
%7 = tail call i32 @square_of_sum(i32 20)
%8 = tail call i32 @sum_of_squares(i32 20)
%9 = sub nsw i32 %7, %8
%10 = icmp eq i32 %9, 41230
%11 = zext i1 %10 to i32
%12 = tail call i32 @assert(i32 %11)
%13 = tail call i32 @square_of_sum(i32 50)
%14 = tail call i32 @sum_of_squares(i32 50)
%15 = sub nsw i32 %13, %14
%16 = icmp eq i32 %15, 1582700
%17 = zext i1 %16 to i32
%18 = tail call i32 @assert(i32 %17)
%19 = tail call i32 @square_of_sum(i32 100)
%20 = tail call i32 @sum_of_squares(i32 100)
%21 = sub nsw i32 %19, %20
%22 = icmp eq i32 %21, 25164150
%23 = zext i1 %22 to i32
%24 = tail call i32 @assert(i32 %23)
%25 = tail call i32 @square_of_sum_efficient(i32 10)
%26 = tail call i32 @sum_of_squares_efficient(i32 10)
%27 = sub nsw i32 %25, %26
%28 = icmp eq i32 %27, 2640
%29 = zext i1 %28 to i32
%30 = tail call i32 @assert(i32 %29)
%31 = tail call i32 @square_of_sum_efficient(i32 20)
%32 = tail call i32 @sum_of_squares_efficient(i32 20)
%33 = sub nsw i32 %31, %32
%34 = icmp eq i32 %33, 41230
%35 = zext i1 %34 to i32
%36 = tail call i32 @assert(i32 %35)
%37 = tail call i32 @square_of_sum_efficient(i32 50)
%38 = tail call i32 @sum_of_squares_efficient(i32 50)
%39 = sub nsw i32 %37, %38
%40 = icmp eq i32 %39, 1582700
%41 = zext i1 %40 to i32
%42 = tail call i32 @assert(i32 %41)
%43 = tail call i32 @square_of_sum_efficient(i32 100)
%44 = tail call i32 @sum_of_squares_efficient(i32 100)
%45 = sub nsw i32 %43, %44
%46 = icmp eq i32 %45, 25164150
%47 = zext i1 %46 to i32
%48 = tail call i32 @assert(i32 %47)
ret i32 0
}