#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 *, int);
int main() {
  int i, sum;
  sum = 1;
  for (i = 3; i <= 1001; i += 2) {
    sum += i * i;
    sum += i * i - 1 * (i - 1);
    sum += i * i - 2 * (i - 1);
    sum += i * i - 3 * (i - 1);
  }
  printf("%d\n", sum);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x1,-0xc(%rbp)
movl   $0x3,-0x8(%rbp)
cmpl   $0x3e9,-0x8(%rbp)
jg     119d <main+0x8d>
mov    -0x8(%rbp),%eax
imul   -0x8(%rbp),%eax
add    -0xc(%rbp),%eax
mov    %eax,-0xc(%rbp)
mov    -0x8(%rbp),%eax
imul   -0x8(%rbp),%eax
mov    -0x8(%rbp),%ecx
sub    $0x1,%ecx
shl    $0x0,%ecx
sub    %ecx,%eax
add    -0xc(%rbp),%eax
mov    %eax,-0xc(%rbp)
mov    -0x8(%rbp),%eax
imul   -0x8(%rbp),%eax
mov    -0x8(%rbp),%ecx
sub    $0x1,%ecx
shl    $0x1,%ecx
sub    %ecx,%eax
add    -0xc(%rbp),%eax
mov    %eax,-0xc(%rbp)
mov    -0x8(%rbp),%eax
imul   -0x8(%rbp),%eax
mov    -0x8(%rbp),%ecx
sub    $0x1,%ecx
imul   $0x3,%ecx,%ecx
sub    %ecx,%eax
add    -0xc(%rbp),%eax
mov    %eax,-0xc(%rbp)
mov    -0x8(%rbp),%eax
add    $0x2,%eax
mov    %eax,-0x8(%rbp)
jmp    112d <main+0x1d>
mov    -0xc(%rbp),%esi
lea    0xe59(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
lea    0xee8(%rip),%rdi
mov    $0x27e2bd39,%esi
call   1030 <printf@plt>
xor    %eax,%eax
pop    %rcx
ret

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

LLVM IR (-O2):
@.str = [4 x i8] c"%d\0A\00"
define i32 @main() {
%1 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 669171001)
ret i32 0
}