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


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0x8(%rbp)
lea    0xec3(%rip),%rdi
lea    -0x8(%rbp),%rsi
call   1040 <scanf@plt>
movl   $0x0,-0xc(%rbp)
mov    -0x8(%rbp),%eax
mov    %eax,%ecx
add    $0xffffffff,%ecx
mov    %ecx,-0x8(%rbp)
cmp    $0x0,%eax
je     11f2 <main+0xd2>
movl   $0x0,-0x10(%rbp)
movl   $0x0,-0x14(%rbp)
movl   $0x0,-0x18(%rbp)
lea    0xe83(%rip),%rdi
lea    -0x18(%rbp),%rsi
call   1040 <scanf@plt>
mov    -0x18(%rbp),%eax
mov    %eax,%ecx
add    $0xffffffff,%ecx
mov    %ecx,-0x18(%rbp)
cmp    $0x0,%eax
je     11b8 <main+0x98>
lea    0xe5f(%rip),%rdi
lea    -0x14(%rbp),%rsi
call   1040 <scanf@plt>
mov    -0x14(%rbp),%eax
add    -0x10(%rbp),%eax
mov    %eax,-0x10(%rbp)
jmp    1186 <main+0x66>
cmpl   $0x0,-0xc(%rbp)
je     11d5 <main+0xb5>
lea    0xe3c(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    11dc <main+0xbc>
movl   $0x1,-0xc(%rbp)
mov    -0x10(%rbp),%esi
lea    0xe1d(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    114d <main+0x2d>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x18,%rsp
movl   $0x0,0x10(%rsp)
lea    0xeb3(%rip),%rdi
lea    0x10(%rsp),%rsi
call   1050 <scanf@plt>
subl   $0x1,0x10(%rsp)
jae    116f <main+0x3f>
xor    %eax,%eax
add    $0x18,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
mov    $0x1,%r13b
lea    0xe87(%rip),%rbx
lea    0xc(%rsp),%r14
lea    0xe7e(%rip),%r15
lea    0x14(%rsp),%r12
jmp    11a6 <main+0x76>
nopl   0x0(%rax)
xor    %r13d,%r13d
mov    %r15,%rdi
mov    %ebp,%esi
xor    %eax,%eax
call   1040 <printf@plt>
subl   $0x1,0x10(%rsp)
jb     115e <main+0x2e>
movl   $0x0,0x14(%rsp)
movl   $0x0,0xc(%rsp)
mov    %rbx,%rdi
mov    %r14,%rsi
call   1050 <scanf@plt>
xor    %ebp,%ebp
subl   $0x1,0xc(%rsp)
jb     11e6 <main+0xb6>
xor    %ebp,%ebp
nopl   0x0(%rax)
mov    %rbx,%rdi
mov    %r12,%rsi
call   1050 <scanf@plt>
add    0x14(%rsp),%ebp
subl   $0x1,0xc(%rsp)
jae    11d0 <main+0xa0>
test   $0x1,%r13b
jne    1190 <main+0x60>
mov    $0xa,%edi
call   1030 <putchar@plt>
jmp    1190 <main+0x60>

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

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