#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);
int /*<<< orphan*/ scanf(char *, int *);
int main() {
  int i, testcases, n, j, sil_old;
  int sil = 0, snil = 0, np;
  scanf("%d", &testcases);
  j = 1;
  while (testcases--) {
    scanf("%d", &n);
    for (i = 0; i < n; i++) {
      scanf("%d", &np);
      sil_old = sil;
      if (snil + np > sil_old)
        sil = snil + np;
      if (sil_old > snil)
        snil = sil_old;
    }
    if (sil > snil)
      snil = sil;
    printf("Case %d: %d\n", j, snil);
    snil = 0;
    sil = 0;
    j++;
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0x1c(%rbp)
movl   $0x0,-0x20(%rbp)
lea    0xebc(%rip),%rdi
lea    -0xc(%rbp),%rsi
call   1040 <scanf@plt>
movl   $0x1,-0x14(%rbp)
mov    -0xc(%rbp),%eax
mov    %eax,%ecx
add    $0xffffffff,%ecx
mov    %ecx,-0xc(%rbp)
cmp    $0x0,%eax
je     121e <main+0xfe>
lea    0xe91(%rip),%rdi
lea    -0x10(%rbp),%rsi
call   1040 <scanf@plt>
movl   $0x0,-0x8(%rbp)
mov    -0x8(%rbp),%eax
cmp    -0x10(%rbp),%eax
jge    11de <main+0xbe>
lea    0xe6e(%rip),%rdi
lea    -0x24(%rbp),%rsi
call   1040 <scanf@plt>
mov    -0x1c(%rbp),%eax
mov    %eax,-0x18(%rbp)
mov    -0x20(%rbp),%eax
add    -0x24(%rbp),%eax
cmp    -0x18(%rbp),%eax
jle    11b9 <main+0x99>
mov    -0x20(%rbp),%eax
add    -0x24(%rbp),%eax
mov    %eax,-0x1c(%rbp)
mov    -0x18(%rbp),%eax
cmp    -0x20(%rbp),%eax
jle    11cb <main+0xab>
mov    -0x18(%rbp),%eax
mov    %eax,-0x20(%rbp)
jmp    11d0 <main+0xb0>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    117f <main+0x5f>
mov    -0x1c(%rbp),%eax
cmp    -0x20(%rbp),%eax
jle    11f0 <main+0xd0>
mov    -0x1c(%rbp),%eax
mov    %eax,-0x20(%rbp)
mov    -0x14(%rbp),%esi
mov    -0x20(%rbp),%edx
lea    0xe06(%rip),%rdi
call   1030 <printf@plt>
movl   $0x0,-0x20(%rbp)
movl   $0x0,-0x1c(%rbp)
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    1154 <main+0x34>
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
sub    $0x18,%rsp
lea    0xecb(%rip),%rdi
lea    0x10(%rsp),%rsi
call   1040 <scanf@plt>
subl   $0x1,0x10(%rsp)
jae    1157 <main+0x37>
xor    %eax,%eax
add    $0x18,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
mov    $0x1,%r15d
lea    0xe9c(%rip),%rbx
lea    0x14(%rsp),%r13
jmp    1195 <main+0x75>
nopl   0x0(%rax,%rax,1)
xor    %eax,%eax
xor    %ebp,%ebp
cmp    %ebp,%eax
cmovg  %eax,%ebp
lea    0xe83(%rip),%rdi
mov    %r15d,%esi
mov    %ebp,%edx
call   1030 <printf@plt>
add    $0x1,%r15d
subl   $0x1,0x10(%rsp)
jb     1146 <main+0x26>
mov    %rbx,%rdi
lea    0xc(%rsp),%rsi
call   1040 <scanf@plt>
cmpl   $0x0,0xc(%rsp)
jle    1170 <main+0x50>
xor    %ebp,%ebp
xor    %r12d,%r12d
xor    %r14d,%r14d
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
mov    %rbx,%rdi
mov    %r13,%rsi
call   1040 <scanf@plt>
mov    0x14(%rsp),%eax
add    %ebp,%eax
cmp    %r12d,%eax
cmovle %r12d,%eax
cmp    %ebp,%r12d
cmovg  %r12d,%ebp
add    $0x1,%r14d
mov    %eax,%r12d
cmp    0xc(%rsp),%r14d
jl     11c0 <main+0xa0>
jmp    1174 <main+0x54>

LLVM IR (-O0):
@.str = [3 x i8] c"%d\00"
@.str.1 = [13 x i8] c"Case %d: %d\0A\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
%8 = alloca i32
%9 = alloca i32
store i32 0, i32* %1
store i32 0, i32* %7
store i32 0, i32* %8
%10 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %3)
store i32 1, i32* %5
br label %11
11: ; preds = %49, %0
%12 = load i32, i32* %3
%13 = add nsw i32 %12, -1
store i32 %13, i32* %3
%14 = icmp ne i32 %12, 0
br i1 %14, label %15, label %55
15: ; preds = %11
%16 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %4)
store i32 0, i32* %2
br label %17
17: ; preds = %40, %15
%18 = load i32, i32* %2
%19 = load i32, i32* %4
%20 = icmp slt i32 %18, %19
br i1 %20, label %21, label %43
21: ; preds = %17
%22 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %9)
%23 = load i32, i32* %7
store i32 %23, i32* %6
%24 = load i32, i32* %8
%25 = load i32, i32* %9
%26 = add nsw i32 %24, %25
%27 = load i32, i32* %6
%28 = icmp sgt i32 %26, %27
br i1 %28, label %29, label %33
29: ; preds = %21
%30 = load i32, i32* %8
%31 = load i32, i32* %9
%32 = add nsw i32 %30, %31
store i32 %32, i32* %7
br label %33
33: ; preds = %29, %21
%34 = load i32, i32* %6
%35 = load i32, i32* %8
%36 = icmp sgt i32 %34, %35
br i1 %36, label %37, label %39
37: ; preds = %33
%38 = load i32, i32* %6
store i32 %38, i32* %8
br label %39
39: ; preds = %37, %33
br label %40
40: ; preds = %39
%41 = load i32, i32* %2
%42 = add nsw i32 %41, 1
store i32 %42, i32* %2
br label %17
43: ; preds = %17
%44 = load i32, i32* %7
%45 = load i32, i32* %8
%46 = icmp sgt i32 %44, %45
br i1 %46, label %47, label %49
47: ; preds = %43
%48 = load i32, i32* %7
store i32 %48, i32* %8
br label %49
49: ; preds = %47, %43
%50 = load i32, i32* %5
%51 = load i32, i32* %8
%52 = call i32 @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.1, i64 0, i64 0), i32 %50, i32 %51)
store i32 0, i32* %8
store i32 0, i32* %7
%53 = load i32, i32* %5
%54 = add nsw i32 %53, 1
store i32 %54, i32* %5
br label %11
55: ; preds = %11
ret i32 0
}

LLVM IR (-O2):
@.str = [3 x i8] c"%d\00"
@.str.1 = [13 x i8] c"Case %d: %d\0A\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* %1)
%8 = load i32, i32* %1
%9 = add nsw i32 %8, -1
store i32 %9, i32* %1
%10 = icmp eq i32 %8, 0
br i1 %10, label %40, label %11
11: ; preds = %0, %30
%12 = phi i32 [ %36, %30 ], [ 1, %0 ]
%13 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %2)
%14 = load i32, i32* %2
%15 = icmp sgt i32 %14, 0
br i1 %15, label %16, label %30
16: ; preds = %11, %16
%17 = phi i32 [ %26, %16 ], [ 0, %11 ]
%18 = phi i32 [ %24, %16 ], [ 0, %11 ]
%19 = phi i32 [ %27, %16 ], [ 0, %11 ]
%20 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %3)
%21 = load i32, i32* %3
%22 = add nsw i32 %21, %17
%23 = icmp sgt i32 %22, %18
%24 = select i1 %23, i32 %22, i32 %18
%25 = icmp sgt i32 %18, %17
%26 = select i1 %25, i32 %18, i32 %17
%27 = add nuw nsw i32 %19, 1
%28 = load i32, i32* %2
%29 = icmp slt i32 %27, %28
br i1 %29, label %16, label %30
30: ; preds = %16, %11
%31 = phi i32 [ 0, %11 ], [ %24, %16 ]
%32 = phi i32 [ 0, %11 ], [ %26, %16 ]
%33 = icmp sgt i32 %31, %32
%34 = select i1 %33, i32 %31, i32 %32
%35 = call i32 @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.1, i64 0, i64 0), i32 %12, i32 %34)
%36 = add nuw nsw i32 %12, 1
%37 = load i32, i32* %1
%38 = add nsw i32 %37, -1
store i32 %38, i32* %1
%39 = icmp eq i32 %37, 0
br i1 %39, label %40, label %11
40: ; preds = %30, %0
ret i32 0
}