#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 /*<<< orphan*/ scanf(char *, int *);
int main() {
  int a, b, sum, n, i, T;
  scanf("%d", &T);
  while (T--) {
    scanf("%d", &n);
    sum = 0;
    for (i = 1; i <= n; i++) {
      scanf("%d", &a);
      sum = sum + a;
    }
    printf("%d", sum);
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeca(%rip),%rdi
lea    -0x1c(%rbp),%rsi
call   1040 <scanf@plt>
mov    -0x1c(%rbp),%eax
mov    %eax,%ecx
add    $0xffffffff,%ecx
mov    %ecx,-0x1c(%rbp)
cmp    $0x0,%eax
je     11b8 <main+0x98>
lea    0xea6(%rip),%rdi
lea    -0x14(%rbp),%rsi
call   1040 <scanf@plt>
movl   $0x0,-0x10(%rbp)
movl   $0x1,-0x18(%rbp)
mov    -0x18(%rbp),%eax
cmp    -0x14(%rbp),%eax
jg     11a4 <main+0x84>
lea    0xe7c(%rip),%rdi
lea    -0x8(%rbp),%rsi
call   1040 <scanf@plt>
mov    -0x10(%rbp),%eax
add    -0x8(%rbp),%eax
mov    %eax,-0x10(%rbp)
mov    -0x18(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x18(%rbp)
jmp    1171 <main+0x51>
mov    -0x10(%rbp),%esi
lea    0xe52(%rip),%rdi
call   1030 <printf@plt>
jmp    113f <main+0x1f>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
sub    $0x10,%rsp
lea    0xecd(%rip),%rdi
lea    0x4(%rsp),%rsi
call   1040 <scanf@plt>
subl   $0x1,0x4(%rsp)
jae    1153 <main+0x33>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
ret
lea    0xea6(%rip),%r12
lea    0x8(%rsp),%r14
lea    0xc(%rsp),%r15
jmp    1183 <main+0x63>
cs nopw 0x0(%rax,%rax,1)
xor    %ebp,%ebp
mov    %r12,%rdi
mov    %ebp,%esi
call   1030 <printf@plt>
subl   $0x1,0x4(%rsp)
jb     1144 <main+0x24>
mov    %r12,%rdi
mov    %r14,%rsi
call   1040 <scanf@plt>
cmpl   $0x0,0x8(%rsp)
jle    1170 <main+0x50>
xor    %ebx,%ebx
xor    %ebp,%ebp
nopl   0x0(%rax)
mov    %r12,%rdi
mov    %r15,%rsi
call   1040 <scanf@plt>
add    0xc(%rsp),%ebp
add    $0x1,%ebx
cmp    0x8(%rsp),%ebx
jl     11a0 <main+0x80>
jmp    1172 <main+0x52>

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

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