#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 *, unsigned long long);
int main(int argc, char *argv[]) {
  unsigned long long sum = 1;
  unsigned long long tmp = 0;
  for (unsigned i = 3; i <= 100001; i = i + 2) {
    tmp = i * i;
    sum += tmp + (tmp - (i - 1)) + (tmp - 2 * (i - 1)) + (tmp - 3 * (i - 1));
  }
  printf("Sum: %llu\n", sum);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movq   $0x1,-0x18(%rbp)
movq   $0x0,-0x20(%rbp)
movl   $0x3,-0x24(%rbp)
cmpl   $0x186a1,-0x24(%rbp)
ja     11ad <main+0x9d>
mov    -0x24(%rbp),%eax
imul   -0x24(%rbp),%eax
mov    %eax,%eax
mov    %rax,-0x20(%rbp)
mov    -0x20(%rbp),%rax
mov    -0x20(%rbp),%rcx
mov    -0x24(%rbp),%edx
sub    $0x1,%edx
mov    %edx,%edx
sub    %rdx,%rcx
add    %rcx,%rax
mov    -0x20(%rbp),%rcx
mov    -0x24(%rbp),%edx
sub    $0x1,%edx
shl    $0x1,%edx
mov    %edx,%edx
sub    %rdx,%rcx
add    %rcx,%rax
mov    -0x20(%rbp),%rcx
mov    -0x24(%rbp),%edx
sub    $0x1,%edx
imul   $0x3,%edx,%edx
mov    %edx,%edx
sub    %rdx,%rcx
add    %rcx,%rax
add    -0x18(%rbp),%rax
mov    %rax,-0x18(%rbp)
mov    -0x24(%rbp),%eax
add    $0x2,%eax
mov    %eax,-0x24(%rbp)
jmp    113d <main+0x2d>
mov    -0x18(%rbp),%rsi
lea    0xe48(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
mov    $0x1,%edi
mov    $0xffffffffffffffff,%r10
mov    $0xc,%r9d
mov    $0x60,%r11d
mov    $0x20,%r14d
mov    $0x4,%esi
mov    $0xffffffffffffffdc,%r13
mov    $0xe0,%ecx
mov    $0x64,%edx
mov    $0xa0,%ebx
mov    $0x24,%eax
movabs $0x3fffffffc,%r8
mov    $0x4,%r15d
nopl   0x0(%rax)
mov    %rdi,%r12
mov    %rdx,%rbp
and    %r8,%rbp
add    %r13,%rbp
mov    %rax,%rdi
and    %r8,%rdi
add    %rbp,%rdi
add    %r12,%rdi
add    $0x4,%r10
add    $0xffffffffffffffd0,%r9
add    %r11,%r15
sub    $0xffffffffffffff80,%r11
add    %r14,%rsi
sub    $0xffffffffffffff80,%r14
add    $0xffffffffffffffd0,%r13
add    %rcx,%rdx
sub    $0xffffffffffffff80,%rcx
add    %rbx,%rax
sub    $0xffffffffffffff80,%rbx
cmp    $0x1869e,%r10
jb     1170 <main+0x60>
and    %r8,%r15
add    %r15,%r9
and    %r8,%rsi
add    %r9,%rsi
add    %r12,%rsi
lea    0xe31(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

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

LLVM IR (-O2):
@.str = [11 x i8] c"Sum: %llu\0A\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
br label %5
3: ; preds = %5
%4 = tail call i32 @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0), i64 %22)
ret i32 0
5: ; preds = %5, %2
%6 = phi i64 [ 3, %2 ], [ %23, %5 ]
%7 = phi i64 [ 1, %2 ], [ %22, %5 ]
%8 = mul nuw nsw i64 %6, %6
%9 = shl nuw nsw i64 %8, 2
%10 = and i64 %9, 17179869180
%11 = mul nsw i64 %6, -6
%12 = add nuw nsw i64 %11, 6
%13 = add i64 %12, %7
%14 = add i64 %13, %10
%15 = add nuw nsw i64 %6, 2
%16 = mul nuw nsw i64 %15, %15
%17 = shl nuw nsw i64 %16, 2
%18 = and i64 %17, 17179869180
%19 = mul nsw i64 %15, -6
%20 = add nuw nsw i64 %19, 6
%21 = add i64 %20, %14
%22 = add i64 %21, %18
%23 = add nuw nsw i64 %6, 4
%24 = icmp ult i64 %6, 99998
br i1 %24, label %5, label %3
}