#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 pow(int, int);
int problem_6(void) {
  int i, sum_of_squares = 0, sum;
  for (i = 1; i <= 100; i++) {
    sum_of_squares += pow(i, 2);
  }
  sum = 100 * (100 + 1) / 2;
  return pow(sum, 2) - sum_of_squares;
}


x86 assembly (clang, -O0):
<problem_6>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x8(%rbp)
movl   $0x1,-0x4(%rbp)
cmpl   $0x64,-0x4(%rbp)
jg     1151 <problem_6+0x41>
mov    -0x4(%rbp),%edi
mov    $0x2,%esi
call   1030 <pow@plt>
add    -0x8(%rbp),%eax
mov    %eax,-0x8(%rbp)
mov    -0x4(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x4(%rbp)
jmp    1126 <problem_6+0x16>
movl   $0x13ba,-0xc(%rbp)
mov    -0xc(%rbp),%edi
mov    $0x2,%esi
call   1030 <pow@plt>
sub    -0x8(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<problem_6>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
xor    %ebp,%ebp
mov    $0x1,%ebx
xchg   %ax,%ax
mov    %ebx,%edi
mov    $0x2,%esi
call   1030 <pow@plt>
mov    %eax,%r14d
add    %ebp,%r14d
lea    0x1(%rbx),%edi
mov    $0x2,%esi
call   1030 <pow@plt>
mov    %eax,%ebp
add    %r14d,%ebp
lea    0x2(%rbx),%edi
mov    $0x2,%esi
call   1030 <pow@plt>
mov    %eax,%r14d
add    %ebp,%r14d
lea    0x3(%rbx),%edi
mov    $0x2,%esi
call   1030 <pow@plt>
mov    %eax,%r15d
add    %r14d,%r15d
lea    0x4(%rbx),%edi
mov    $0x2,%esi
call   1030 <pow@plt>
mov    %eax,%ebp
add    %r15d,%ebp
add    $0x5,%ebx
cmp    $0x65,%ebx
jne    1120 <problem_6+0x10>
mov    $0x13ba,%edi
mov    $0x2,%esi
call   1030 <pow@plt>
sub    %ebp,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
define i32 @problem_6() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
store i32 0, i32* %2
store i32 1, i32* %1
br label %4
4: ; preds = %12, %0
%5 = load i32, i32* %1
%6 = icmp sle i32 %5, 100
br i1 %6, label %7, label %15
7: ; preds = %4
%8 = load i32, i32* %1
%9 = call i32 @pow(i32 %8, i32 2)
%10 = load i32, i32* %2
%11 = add nsw i32 %10, %9
store i32 %11, i32* %2
br label %12
12: ; preds = %7
%13 = load i32, i32* %1
%14 = add nsw i32 %13, 1
store i32 %14, i32* %1
br label %4
15: ; preds = %4
store i32 5050, i32* %3
%16 = load i32, i32* %3
%17 = call i32 @pow(i32 %16, i32 2)
%18 = load i32, i32* %2
%19 = sub nsw i32 %17, %18
ret i32 %19
}

LLVM IR (-O2):
define i32 @problem_6() {
br label %1
1: ; preds = %1, %0
%2 = phi i32 [ 1, %0 ], [ %18, %1 ]
%3 = phi i32 [ 0, %0 ], [ %17, %1 ]
%4 = tail call i32 @pow(i32 %2, i32 2)
%5 = add nsw i32 %4, %3
%6 = add nuw nsw i32 %2, 1
%7 = tail call i32 @pow(i32 %6, i32 2)
%8 = add nsw i32 %7, %5
%9 = add nuw nsw i32 %2, 2
%10 = tail call i32 @pow(i32 %9, i32 2)
%11 = add nsw i32 %10, %8
%12 = add nuw nsw i32 %2, 3
%13 = tail call i32 @pow(i32 %12, i32 2)
%14 = add nsw i32 %13, %11
%15 = add nuw nsw i32 %2, 4
%16 = tail call i32 @pow(i32 %15, i32 2)
%17 = add nsw i32 %16, %14
%18 = add nuw nsw i32 %2, 5
%19 = icmp eq i32 %18, 101
br i1 %19, label %20, label %1
20: ; preds = %1
%21 = tail call i32 @pow(i32 5050, i32 2)
%22 = sub nsw i32 %21, %17
ret i32 %22
}