#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 */
scalar_t__ pow(int, int);
int /*<<< orphan*/ printf(char *, int);
int main(int argc, char *argv[]) {
  int sum = 0;
  int powsum = 0;
  int i;
  for (i = 0; i <= 100; i++) {
    sum += i;
    powsum += (int)pow(i, 2);
  }
  sum = (int)pow(sum, 2);
  printf("%d\n", sum - powsum);
  return 0;
}


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)
movl   $0x0,-0x14(%rbp)
movl   $0x0,-0x18(%rbp)
movl   $0x0,-0x1c(%rbp)
cmpl   $0x64,-0x1c(%rbp)
jg     117f <main+0x5f>
mov    -0x1c(%rbp),%eax
add    -0x14(%rbp),%eax
mov    %eax,-0x14(%rbp)
mov    -0x1c(%rbp),%edi
mov    $0x2,%esi
call   1040 <pow@plt>
add    -0x18(%rbp),%eax
mov    %eax,-0x18(%rbp)
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
jmp    114b <main+0x2b>
mov    -0x14(%rbp),%edi
mov    $0x2,%esi
call   1040 <pow@plt>
mov    %eax,-0x14(%rbp)
mov    -0x14(%rbp),%esi
sub    -0x18(%rbp),%esi
lea    0xe64(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %r12
push   %rbx
push   %rax
xor    %r14d,%r14d
xor    %r15d,%r15d
xchg   %ax,%ax
mov    %r14d,%edi
mov    $0x2,%esi
call   1040 <pow@plt>
mov    %rax,%rbx
add    %r15d,%ebx
lea    0x1(%r14),%edi
mov    $0x2,%esi
call   1040 <pow@plt>
mov    %rax,%r15
add    %ebx,%r15d
lea    0x2(%r14),%edi
mov    $0x2,%esi
call   1040 <pow@plt>
mov    %rax,%rbx
add    %r15d,%ebx
lea    0x3(%r14),%edi
mov    $0x2,%esi
call   1040 <pow@plt>
mov    %rax,%r15
add    %ebx,%r15d
lea    0x4(%r14),%edi
mov    $0x2,%esi
call   1040 <pow@plt>
mov    %rax,%rbx
add    %r15d,%ebx
add    $0x5,%r14d
cmp    $0x65,%r14d
je     11dd <main+0xbd>
mov    %r14d,%edi
mov    $0x2,%esi
call   1040 <pow@plt>
add    %eax,%ebx
lea    0x1(%r14),%edi
mov    $0x2,%esi
call   1040 <pow@plt>
mov    %rax,%r12
add    %ebx,%r12d
lea    0x2(%r14),%edi
mov    $0x2,%esi
call   1040 <pow@plt>
mov    %rax,%r15
add    %r12d,%r15d
add    $0x3,%r14d
jmp    1130 <main+0x10>
mov    $0x13ba,%edi
mov    $0x2,%esi
call   1040 <pow@plt>
sub    %ebx,%eax
lea    0xe0b(%rip),%rdi
mov    %eax,%esi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [4 x i8] c"%d\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
store i32 0, i32* %6
store i32 0, i32* %7
store i32 0, i32* %8
br label %9
9: ; preds = %21, %2
%10 = load i32, i32* %8
%11 = icmp sle i32 %10, 100
br i1 %11, label %12, label %24
12: ; preds = %9
%13 = load i32, i32* %8
%14 = load i32, i32* %6
%15 = add nsw i32 %14, %13
store i32 %15, i32* %6
%16 = load i32, i32* %8
%17 = call i64 @pow(i32 %16, i32 2)
%18 = trunc i64 %17 to i32
%19 = load i32, i32* %7
%20 = add nsw i32 %19, %18
store i32 %20, i32* %7
br label %21
21: ; preds = %12
%22 = load i32, i32* %8
%23 = add nsw i32 %22, 1
store i32 %23, i32* %8
br label %9
24: ; preds = %9
%25 = load i32, i32* %6
%26 = call i64 @pow(i32 %25, i32 2)
%27 = trunc i64 %26 to i32
store i32 %27, i32* %6
%28 = load i32, i32* %6
%29 = load i32, i32* %7
%30 = sub nsw i32 %28, %29
%31 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %30)
ret i32 0
}

LLVM IR (-O2):
@.str = [4 x i8] c"%d\0A\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
br label %3
3: ; preds = %27, %2
%4 = phi i32 [ 0, %2 ], [ %39, %27 ]
%5 = phi i32 [ 0, %2 ], [ %38, %27 ]
%6 = tail call i64 @pow(i32 %4, i32 2)
%7 = trunc i64 %6 to i32
%8 = add nsw i32 %5, %7
%9 = or i32 %4, 1
%10 = tail call i64 @pow(i32 %9, i32 2)
%11 = trunc i64 %10 to i32
%12 = add nsw i32 %8, %11
%13 = or i32 %4, 2
%14 = tail call i64 @pow(i32 %13, i32 2)
%15 = trunc i64 %14 to i32
%16 = add nsw i32 %12, %15
%17 = or i32 %4, 3
%18 = tail call i64 @pow(i32 %17, i32 2)
%19 = trunc i64 %18 to i32
%20 = add nsw i32 %16, %19
%21 = or i32 %4, 4
%22 = tail call i64 @pow(i32 %21, i32 2)
%23 = trunc i64 %22 to i32
%24 = add nsw i32 %20, %23
%25 = or i32 %4, 5
%26 = icmp eq i32 %25, 101
br i1 %26, label %40, label %27
27: ; preds = %3
%28 = tail call i64 @pow(i32 %25, i32 2)
%29 = trunc i64 %28 to i32
%30 = add nsw i32 %24, %29
%31 = or i32 %4, 6
%32 = tail call i64 @pow(i32 %31, i32 2)
%33 = trunc i64 %32 to i32
%34 = add nsw i32 %30, %33
%35 = or i32 %4, 7
%36 = tail call i64 @pow(i32 %35, i32 2)
%37 = trunc i64 %36 to i32
%38 = add nsw i32 %34, %37
%39 = add nuw nsw i32 %4, 8
br label %3
40: ; preds = %3
%41 = tail call i64 @pow(i32 5050, i32 2)
%42 = trunc i64 %41 to i32
%43 = sub nsw i32 %42, %24
%44 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %43)
ret i32 0
}