#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 get_max_subarray(int *, int, int *, int *);
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ scanf(char *, int *);
int main() {
  int line_count, line_index = 1;
  scanf("%d", &line_count);
  int sequence_length, sequence_index, sequence_data[100000];
  while (line_index <= line_count) {
    scanf("%d", &sequence_length);
    sequence_index = 0;
    while (sequence_index < sequence_length) {
      scanf("%d", sequence_data + sequence_index);
      sequence_index++;
    }
    printf("Case %d:\n", line_index);
    int sum, index_begin, index_end;
    sum = get_max_subarray(sequence_data, sequence_length, &index_begin,
                           &index_end);
    printf("%d %d %d\n", sum, index_begin, index_end);
    if (line_index < line_count)
      printf("\n");
    line_index++;
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x61ab0,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x1,-0xc(%rbp)
lea    0xeb0(%rip),%rdi
lea    -0x8(%rbp),%rsi
call   1050 <scanf@plt>
mov    -0xc(%rbp),%eax
cmp    -0x8(%rbp),%eax
jg     1230 <main+0x100>
lea    0xe94(%rip),%rdi
lea    -0x10(%rbp),%rsi
call   1050 <scanf@plt>
movl   $0x0,-0x14(%rbp)
mov    -0x14(%rbp),%eax
cmp    -0x10(%rbp),%eax
jge    11b4 <main+0x84>
lea    -0x61aa0(%rbp),%rsi
movslq -0x14(%rbp),%rax
shl    $0x2,%rax
add    %rax,%rsi
lea    0xe5f(%rip),%rdi
call   1050 <scanf@plt>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    117c <main+0x4c>
mov    -0xc(%rbp),%esi
lea    0xe45(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    -0x61aa0(%rbp),%rdi
mov    -0x10(%rbp),%esi
lea    -0x61aa8(%rbp),%rdx
lea    -0x61aac(%rbp),%rcx
call   1030 <get_max_subarray@plt>
mov    %eax,-0x61aa4(%rbp)
mov    -0x61aa4(%rbp),%esi
mov    -0x61aa8(%rbp),%edx
mov    -0x61aac(%rbp),%ecx
lea    0xe0c(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0xc(%rbp),%eax
cmp    -0x8(%rbp),%eax
jge    1222 <main+0xf2>
lea    0xdf0(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    1159 <main+0x29>
xor    %eax,%eax
add    $0x61ab0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x61a98,%rsp
lea    0xea8(%rip),%rdi
lea    0x4(%rsp),%rsi
call   1060 <scanf@plt>
cmpl   $0x0,0x4(%rsp)
jle    1236 <main+0xf6>
mov    $0x1,%r14d
lea    0xe86(%rip),%rbx
lea    0x10(%rsp),%rbp
lea    0xe87(%rip),%r13
jmp    11a0 <main+0x60>
nopl   0x0(%rax,%rax,1)
lea    0x1(%r14),%ecx
cmp    %eax,%r14d
mov    %ecx,%r14d
jge    1236 <main+0xf6>
mov    %rbx,%rdi
mov    %rsp,%rsi
call   1060 <scanf@plt>
cmpl   $0x0,(%rsp)
jle    11dc <main+0x9c>
mov    %rbp,%r12
xor    %r15d,%r15d
nopw   0x0(%rax,%rax,1)
mov    %rbx,%rdi
mov    %r12,%rsi
call   1060 <scanf@plt>
add    $0x1,%r15
movslq (%rsp),%rax
add    $0x4,%r12
cmp    %rax,%r15
jl     11c0 <main+0x80>
lea    0xe20(%rip),%rdi
mov    %r14d,%esi
xor    %eax,%eax
call   1050 <printf@plt>
mov    (%rsp),%esi
mov    %rbp,%rdi
lea    0xc(%rsp),%rdx
lea    0x8(%rsp),%rcx
call   1030 <get_max_subarray@plt>
mov    0xc(%rsp),%edx
mov    0x8(%rsp),%ecx
mov    %r13,%rdi
mov    %eax,%esi
xor    %eax,%eax
call   1050 <printf@plt>
mov    0x4(%rsp),%eax
cmp    %eax,%r14d
jge    1190 <main+0x50>
mov    $0xa,%edi
call   1040 <putchar@plt>
mov    0x4(%rsp),%eax
jmp    1190 <main+0x50>
xor    %eax,%eax
add    $0x61a98,%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 = [10 x i8] c"Case %d:\0A\00"
@.str.2 = [10 x i8] c"%d %d %d\0A\00"
@.str.3 = [2 x i8] c"\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
%6 = alloca [100000 x i32]
%7 = alloca i32
%8 = alloca i32
%9 = alloca i32
store i32 0, i32* %1
store i32 1, i32* %3
%10 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %2)
br label %11
11: ; preds = %44, %0
%12 = load i32, i32* %3
%13 = load i32, i32* %2
%14 = icmp sle i32 %12, %13
br i1 %14, label %15, label %47
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* %5
br label %17
17: ; preds = %21, %15
%18 = load i32, i32* %5
%19 = load i32, i32* %4
%20 = icmp slt i32 %18, %19
br i1 %20, label %21, label %29
21: ; preds = %17
%22 = getelementptr inbounds [100000 x i32], [100000 x i32]* %6, i64 0, i64 0
%23 = load i32, i32* %5
%24 = sext i32 %23 to i64
%25 = getelementptr inbounds i32, i32* %22, i64 %24
%26 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %25)
%27 = load i32, i32* %5
%28 = add nsw i32 %27, 1
store i32 %28, i32* %5
br label %17
29: ; preds = %17
%30 = load i32, i32* %3
%31 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.1, i64 0, i64 0), i32 %30)
%32 = getelementptr inbounds [100000 x i32], [100000 x i32]* %6, i64 0, i64 0
%33 = load i32, i32* %4
%34 = call i32 @get_max_subarray(i32* %32, i32 %33, i32* %8, i32* %9)
store i32 %34, i32* %7
%35 = load i32, i32* %7
%36 = load i32, i32* %8
%37 = load i32, i32* %9
%38 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.2, i64 0, i64 0), i32 %35, i32 %36, i32 %37)
%39 = load i32, i32* %3
%40 = load i32, i32* %2
%41 = icmp slt i32 %39, %40
br i1 %41, label %42, label %44
42: ; preds = %29
%43 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i64 0, i64 0))
br label %44
44: ; preds = %42, %29
%45 = load i32, i32* %3
%46 = add nsw i32 %45, 1
store i32 %46, i32* %3
br label %11
47: ; preds = %11
ret i32 0
}

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