#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(void) {
  int n = 100;
  int r = n * (n + 1) * (n - 1) * (3 * n + 2) / 12;
  printf("100's is %d\n", r);
  n = 10;
  r = n * (n + 1) * (n - 1) * (3 * n + 2) / 12;
  printf("10's is %d\n", r);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x64,-0x8(%rbp)
mov    -0x8(%rbp),%eax
mov    -0x8(%rbp),%ecx
add    $0x1,%ecx
imul   %ecx,%eax
mov    -0x8(%rbp),%ecx
sub    $0x1,%ecx
imul   %ecx,%eax
imul   $0x3,-0x8(%rbp),%ecx
add    $0x2,%ecx
imul   %ecx,%eax
mov    $0xc,%ecx
cltd
idiv   %ecx
mov    %eax,-0xc(%rbp)
mov    -0xc(%rbp),%esi
lea    0xea6(%rip),%rdi
call   1030 <printf@plt>
movl   $0xa,-0x8(%rbp)
mov    -0x8(%rbp),%eax
mov    -0x8(%rbp),%ecx
add    $0x1,%ecx
imul   %ecx,%eax
mov    -0x8(%rbp),%ecx
sub    $0x1,%ecx
imul   %ecx,%eax
imul   $0x3,-0x8(%rbp),%ecx
add    $0x2,%ecx
imul   %ecx,%eax
mov    $0xc,%ecx
cltd
idiv   %ecx
mov    %eax,-0xc(%rbp)
mov    -0xc(%rbp),%esi
lea    0xe73(%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    $0x17ff976,%esi
call   1030 <printf@plt>
lea    0xee4(%rip),%rdi
mov    $0xa50,%esi
call   1030 <printf@plt>
xor    %eax,%eax
pop    %rcx
ret

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

LLVM IR (-O2):
@.str = [13 x i8] c"100's is %d\0A\00"
@.str.1 = [12 x i8] c"10's is %d\0A\00"
define i32 @main() {
%1 = tail call i32 @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0), i32 25164150)
%2 = tail call i32 @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.1, i64 0, i64 0), i32 2640)
ret i32 0
}