#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 *, double);
int /*<<< orphan*/ scanf(char *, ...);
int main() {
  unsigned int t, i, j;
  double n;
  scanf("%d", &t);
  double arr[t];
  for (j = 0; j < t; j++) {
    scanf("%lf", &n);
    arr[j] = n * (n * n + 6 * n - 1) / 6;
  }
  for (i = 0; i < t; i++)
    printf("%.0lf\n", arr[i]);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeda(%rip),%rdi
xor    %eax,%eax
lea    -0x8(%rbp),%rsi
call   1040 <scanf@plt>
mov    -0x8(%rbp),%eax
mov    %rsp,%rcx
mov    %rcx,-0x20(%rbp)
lea    0xf(,%rax,8),%rdx
and    $0xfffffffffffffff0,%rdx
mov    %rsp,%rcx
sub    %rdx,%rcx
mov    %rcx,-0x30(%rbp)
mov    %rcx,%rsp
mov    %rax,-0x28(%rbp)
movl   $0x0,-0x10(%rbp)
mov    -0x10(%rbp),%eax
cmp    -0x8(%rbp),%eax
jae    11e7 <main+0xc7>
lea    0xe91(%rip),%rdi
lea    -0x18(%rbp),%rsi
mov    $0x0,%al
call   1040 <scanf@plt>
mov    -0x30(%rbp),%rax
movsd  -0x18(%rbp),%xmm0
movsd  -0x18(%rbp),%xmm1
movsd  -0x18(%rbp),%xmm3
movsd  0xe58(%rip),%xmm2
mulsd  -0x18(%rbp),%xmm2
mulsd  %xmm3,%xmm1
addsd  %xmm2,%xmm1
movsd  0xe4b(%rip),%xmm2
subsd  %xmm2,%xmm1
mulsd  %xmm1,%xmm0
movsd  0xe33(%rip),%xmm1
divsd  %xmm1,%xmm0
mov    -0x10(%rbp),%ecx
movsd  %xmm0,(%rax,%rcx,8)
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    116f <main+0x4f>
movl   $0x0,-0xc(%rbp)
mov    -0xc(%rbp),%eax
cmp    -0x8(%rbp),%eax
jae    1220 <main+0x100>
mov    -0x30(%rbp),%rax
mov    -0xc(%rbp),%ecx
movsd  (%rax,%rcx,8),%xmm0
lea    0xe0a(%rip),%rdi
call   1030 <printf@plt>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    11ee <main+0xce>
movl   $0x0,-0x4(%rbp)
mov    -0x20(%rbp),%rax
mov    %rax,%rsp
mov    -0x4(%rbp),%eax
mov    %rbp,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
mov    %rsp,%rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x18,%rsp
lea    0xed8(%rip),%rdi
lea    -0x2c(%rbp),%rsi
xor    %eax,%eax
call   1040 <scanf@plt>
mov    %rsp,%r15
mov    -0x2c(%rbp),%eax
mov    %rsp,%r13
lea    0xf(,%rax,8),%rax
and    $0xfffffffffffffff0,%rax
sub    %rax,%r13
mov    %r13,%rsp
cmpl   $0x0,-0x2c(%rbp)
je     11fb <main+0xdb>
lea    0xea4(%rip),%r14
lea    -0x38(%rbp),%r12
xor    %ebx,%ebx
cs nopw 0x0(%rax,%rax,1)
nop
mov    %r14,%rdi
mov    %r12,%rsi
xor    %eax,%eax
call   1040 <scanf@plt>
movsd  -0x38(%rbp),%xmm0
movapd %xmm0,%xmm1
movsd  0xe62(%rip),%xmm3
mulsd  %xmm3,%xmm1
movapd %xmm0,%xmm2
mulsd  %xmm0,%xmm2
addsd  %xmm1,%xmm2
addsd  0xe52(%rip),%xmm2
mulsd  %xmm0,%xmm2
divsd  %xmm3,%xmm2
movsd  %xmm2,0x0(%r13,%rbx,8)
add    $0x1,%rbx
mov    -0x2c(%rbp),%eax
cmp    %rax,%rbx
jb     1180 <main+0x60>
test   %eax,%eax
je     11fb <main+0xdb>
xor    %ebx,%ebx
lea    0xe39(%rip),%r14
xchg   %ax,%ax
movsd  0x0(%r13,%rbx,8),%xmm0
mov    %r14,%rdi
call   1030 <printf@plt>
add    $0x1,%rbx
mov    -0x2c(%rbp),%eax
cmp    %rax,%rbx
jb     11e0 <main+0xc0>
mov    %r15,%rsp
xor    %eax,%eax
lea    -0x28(%rbp),%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [3 x i8] c"%d\00"
@.str.1 = [4 x i8] c"%lf\00"
@.str.2 = [7 x i8] c"%.0lf\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
%5 = alloca double
%6 = alloca i8*
%7 = alloca i64
store i32 0, i32* %1
%8 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %2)
%9 = load i32, i32* %2
%10 = zext i32 %9 to i64
%11 = call i8* @llvm.stacksave()
store i8* %11, i8** %6
%12 = alloca double, i64 %10
store i64 %10, i64* %7
store i32 0, i32* %4
br label %13
13: ; preds = %31, %0
%14 = load i32, i32* %4
%15 = load i32, i32* %2
%16 = icmp ult i32 %14, %15
br i1 %16, label %17, label %34
17: ; preds = %13
%18 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), double* %5)
%19 = load double, double* %5
%20 = load double, double* %5
%21 = load double, double* %5
%22 = load double, double* %5
%23 = fmul double 6.000000e+00, %22
%24 = call double @llvm.fmuladd.f64(double %20, double %21, double %23)
%25 = fsub double %24, 1.000000e+00
%26 = fmul double %19, %25
%27 = fdiv double %26, 6.000000e+00
%28 = load i32, i32* %4
%29 = zext i32 %28 to i64
%30 = getelementptr inbounds double, double* %12, i64 %29
store double %27, double* %30
br label %31
31: ; preds = %17
%32 = load i32, i32* %4
%33 = add i32 %32, 1
store i32 %33, i32* %4
br label %13
34: ; preds = %13
store i32 0, i32* %3
br label %35
35: ; preds = %45, %34
%36 = load i32, i32* %3
%37 = load i32, i32* %2
%38 = icmp ult i32 %36, %37
br i1 %38, label %39, label %48
39: ; preds = %35
%40 = load i32, i32* %3
%41 = zext i32 %40 to i64
%42 = getelementptr inbounds double, double* %12, i64 %41
%43 = load double, double* %42
%44 = call i32 @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.2, i64 0, i64 0), double %43)
br label %45
45: ; preds = %39
%46 = load i32, i32* %3
%47 = add i32 %46, 1
store i32 %47, i32* %3
br label %35
48: ; preds = %35
store i32 0, i32* %1
%49 = load i8*, i8** %6
%50 = load i32, i32* %1
ret i32 %50
}

LLVM IR (-O2):
@.str = [3 x i8] c"%d\00"
@.str.1 = [4 x i8] c"%lf\00"
@.str.2 = [7 x i8] c"%.0lf\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca double
%3 = bitcast i32* %1 to i8*
%4 = bitcast double* %2 to i8*
%5 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %1)
%6 = load i32, i32* %1
%7 = zext i32 %6 to i64
%8 = call i8* @llvm.stacksave()
%9 = alloca double, i64 %7
%10 = load i32, i32* %1
%11 = icmp eq i32 %10, 0
br i1 %11, label %37, label %14
12: ; preds = %14
%13 = icmp eq i32 %25, 0
br i1 %13, label %37, label %28
14: ; preds = %0, %14
%15 = phi i64 [ %24, %14 ], [ 0, %0 ]
%16 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), double* %2)
%17 = load double, double* %2
%18 = fmul double %17, 6.000000e+00
%19 = call double @llvm.fmuladd.f64(double %17, double %17, double %18)
%20 = fadd double %19, -1.000000e+00
%21 = fmul double %17, %20
%22 = fdiv double %21, 6.000000e+00
%23 = getelementptr inbounds double, double* %9, i64 %15
store double %22, double* %23
%24 = add nuw nsw i64 %15, 1
%25 = load i32, i32* %1
%26 = zext i32 %25 to i64
%27 = icmp ult i64 %24, %26
br i1 %27, label %14, label %12
28: ; preds = %12, %28
%29 = phi i64 [ %33, %28 ], [ 0, %12 ]
%30 = getelementptr inbounds double, double* %9, i64 %29
%31 = load double, double* %30
%32 = call i32 @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.2, i64 0, i64 0), double %31)
%33 = add nuw nsw i64 %29, 1
%34 = load i32, i32* %1
%35 = zext i32 %34 to i64
%36 = icmp ult i64 %33, %35
br i1 %36, label %28, label %37
37: ; preds = %28, %0, %12
ret i32 0
}