#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 a, b, c, d = 1, sum;
  scanf("%d", &a);
  while (a > 0) {
    sum = 0;
    scanf("%d", &b);
    while (b > 0) {
      scanf("%d", &c);
      if (c < 0) {
        c = 0;
      }
      sum = sum + c;
      b--;
    }
    printf("Case %d: %d\n", d, sum);
    d++;
    a--;
  }
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x1,-0x14(%rbp)
lea    0xec3(%rip),%rdi
lea    -0x8(%rbp),%rsi
call   1040 <scanf@plt>
cmpl   $0x0,-0x8(%rbp)
jle    11d2 <main+0xb2>
movl   $0x0,-0x18(%rbp)
lea    0xea2(%rip),%rdi
lea    -0xc(%rbp),%rsi
call   1040 <scanf@plt>
cmpl   $0x0,-0xc(%rbp)
jle    11a9 <main+0x89>
lea    0xe88(%rip),%rdi
lea    -0x10(%rbp),%rsi
call   1040 <scanf@plt>
cmpl   $0x0,-0x10(%rbp)
jge    1192 <main+0x72>
movl   $0x0,-0x10(%rbp)
mov    -0x18(%rbp),%eax
add    -0x10(%rbp),%eax
mov    %eax,-0x18(%rbp)
mov    -0xc(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0xc(%rbp)
jmp    1167 <main+0x47>
mov    -0x14(%rbp),%esi
mov    -0x18(%rbp),%edx
lea    0xe4d(%rip),%rdi
call   1030 <printf@plt>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
mov    -0x8(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x8(%rbp)
jmp    1146 <main+0x26>
mov    -0x4(%rbp),%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
lea    0xecb(%rip),%rdi
lea    0x10(%rsp),%rsi
call   1040 <scanf@plt>
cmpl   $0x0,0x10(%rsp)
jle    11e1 <main+0xc1>
mov    $0x1,%r15d
lea    0xea9(%rip),%rbx
lea    0xc(%rsp),%r14
lea    0x14(%rsp),%r13
lea    0xe9b(%rip),%r12
jmp    1193 <main+0x73>
nopw   0x0(%rax,%rax,1)
xor    %ebp,%ebp
mov    %r12,%rdi
mov    %r15d,%esi
mov    %ebp,%edx
call   1030 <printf@plt>
add    $0x1,%r15d
mov    0x10(%rsp),%eax
lea    -0x1(%rax),%ecx
mov    %ecx,0x10(%rsp)
cmp    $0x1,%eax
jle    11e1 <main+0xc1>
mov    %rbx,%rdi
mov    %r14,%rsi
call   1040 <scanf@plt>
cmpl   $0x0,0xc(%rsp)
jle    1170 <main+0x50>
xor    %ebp,%ebp
jmp    11c2 <main+0xa2>
nopl   0x0(%rax)
add    %eax,%ebp
mov    0xc(%rsp),%eax
lea    -0x1(%rax),%ecx
mov    %ecx,0xc(%rsp)
cmp    $0x1,%eax
jle    1172 <main+0x52>
mov    %rbx,%rdi
mov    %r13,%rsi
call   1040 <scanf@plt>
mov    0x14(%rsp),%eax
test   %eax,%eax
jns    11b0 <main+0x90>
movl   $0x0,0x14(%rsp)
xor    %eax,%eax
jmp    11b0 <main+0x90>
xor    %eax,%eax
add    $0x18,%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 = [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
store i32 0, i32* %1
store i32 1, i32* %5
%7 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %2)
br label %8
8: ; preds = %27, %0
%9 = load i32, i32* %2
%10 = icmp sgt i32 %9, 0
br i1 %10, label %11, label %35
11: ; preds = %8
store i32 0, i32* %6
%12 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %3)
br label %13
13: ; preds = %21, %11
%14 = load i32, i32* %3
%15 = icmp sgt i32 %14, 0
br i1 %15, label %16, label %27
16: ; preds = %13
%17 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %4)
%18 = load i32, i32* %4
%19 = icmp slt i32 %18, 0
br i1 %19, label %20, label %21
20: ; preds = %16
store i32 0, i32* %4
br label %21
21: ; preds = %20, %16
%22 = load i32, i32* %6
%23 = load i32, i32* %4
%24 = add nsw i32 %22, %23
store i32 %24, i32* %6
%25 = load i32, i32* %3
%26 = add nsw i32 %25, -1
store i32 %26, i32* %3
br label %13
27: ; preds = %13
%28 = load i32, i32* %5
%29 = load i32, i32* %6
%30 = call i32 @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.1, i64 0, i64 0), i32 %28, i32 %29)
%31 = load i32, i32* %5
%32 = add nsw i32 %31, 1
store i32 %32, i32* %5
%33 = load i32, i32* %2
%34 = add nsw i32 %33, -1
store i32 %34, i32* %2
br label %8
35: ; preds = %8
%36 = load i32, i32* %1
ret i32 %36
}

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 = icmp sgt i32 %8, 0
br i1 %9, label %10, label %34
10: ; preds = %0, %27
%11 = phi i32 [ %30, %27 ], [ 1, %0 ]
%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 sgt i32 %13, 0
br i1 %14, label %15, label %27
15: ; preds = %10, %21
%16 = phi i32 [ %23, %21 ], [ 0, %10 ]
%17 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %3)
%18 = load i32, i32* %3
%19 = icmp slt i32 %18, 0
br i1 %19, label %20, label %21
20: ; preds = %15
store i32 0, i32* %3
br label %21
21: ; preds = %20, %15
%22 = phi i32 [ 0, %20 ], [ %18, %15 ]
%23 = add nsw i32 %22, %16
%24 = load i32, i32* %2
%25 = add nsw i32 %24, -1
store i32 %25, i32* %2
%26 = icmp sgt i32 %24, 1
br i1 %26, label %15, label %27
27: ; preds = %21, %10
%28 = phi i32 [ 0, %10 ], [ %23, %21 ]
%29 = call i32 @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.1, i64 0, i64 0), i32 %11, i32 %28)
%30 = add nuw nsw i32 %11, 1
%31 = load i32, i32* %1
%32 = add nsw i32 %31, -1
store i32 %32, i32* %1
%33 = icmp sgt i32 %31, 1
br i1 %33, label %10, label %34
34: ; preds = %27, %0
ret i32 0
}