#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);
int /*<<< orphan*/ scanf(char *, int *);
int main() {
  int t, wall, i, k, n, a, high, low;
  scanf("%d", &t);
  for (i = 1; i <= t; i++) {
    high = 0;
    low = 0;
    scanf("%d", &wall);
    scanf("%d", &n);
    a = n;
    for (k = 1; k < wall; k++) {
      scanf("%d", &n);
      if (a < n) {
        high += 1;
      }
      if (a > n) {
        low += 1;
      }
      a = n;
    }
    printf("Case %d: %d %d\n", i, high, low);
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeca(%rip),%rdi
lea    -0x8(%rbp),%rsi
call   1040 <scanf@plt>
movl   $0x1,-0x10(%rbp)
mov    -0x10(%rbp),%eax
cmp    -0x8(%rbp),%eax
jg     120a <main+0xea>
movl   $0x0,-0x20(%rbp)
movl   $0x0,-0x24(%rbp)
lea    0xe99(%rip),%rdi
lea    -0xc(%rbp),%rsi
call   1040 <scanf@plt>
lea    0xe89(%rip),%rdi
lea    -0x18(%rbp),%rsi
call   1040 <scanf@plt>
mov    -0x18(%rbp),%eax
mov    %eax,-0x1c(%rbp)
movl   $0x1,-0x14(%rbp)
mov    -0x14(%rbp),%eax
cmp    -0xc(%rbp),%eax
jge    11e7 <main+0xc7>
lea    0xe60(%rip),%rdi
lea    -0x18(%rbp),%rsi
call   1040 <scanf@plt>
mov    -0x1c(%rbp),%eax
cmp    -0x18(%rbp),%eax
jge    11be <main+0x9e>
mov    -0x20(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x20(%rbp)
mov    -0x1c(%rbp),%eax
cmp    -0x18(%rbp),%eax
jle    11d3 <main+0xb3>
mov    -0x24(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x24(%rbp)
mov    -0x18(%rbp),%eax
mov    %eax,-0x1c(%rbp)
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    118d <main+0x6d>
mov    -0x10(%rbp),%esi
mov    -0x20(%rbp),%edx
mov    -0x24(%rbp),%ecx
lea    0xe0c(%rip),%rdi
call   1030 <printf@plt>
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    1146 <main+0x26>
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    0xc(%rsp),%rsi
call   1040 <scanf@plt>
cmpl   $0x0,0xc(%rsp)
jle    11f4 <main+0xd4>
mov    $0x1,%eax
lea    0xeaa(%rip),%rbx
lea    0x4(%rsp),%r12
jmp    1184 <main+0x64>
nopl   (%rax)
lea    0xe9c(%rip),%rdi
mov    0x10(%rsp),%r14
mov    %r14d,%esi
mov    %r15d,%edx
mov    %ebp,%ecx
call   1030 <printf@plt>
lea    0x1(%r14),%eax
cmp    0xc(%rsp),%r14d
jge    11f4 <main+0xd4>
mov    %rax,0x10(%rsp)
mov    %rbx,%rdi
lea    0x8(%rsp),%rsi
call   1040 <scanf@plt>
mov    %rbx,%rdi
mov    %r12,%rsi
call   1040 <scanf@plt>
xor    %r15d,%r15d
cmpl   $0x2,0x8(%rsp)
mov    $0x0,%ebp
jl     1160 <main+0x40>
mov    $0x1,%r13d
xor    %ebp,%ebp
mov    0x4(%rsp),%r14d
xor    %r15d,%r15d
mov    %rbx,%rdi
mov    %r12,%rsi
call   1040 <scanf@plt>
mov    0x4(%rsp),%eax
xor    %ecx,%ecx
xor    %edx,%edx
cmp    %eax,%r14d
setl   %cl
setg   %dl
add    %ecx,%r15d
add    %edx,%ebp
add    $0x1,%r13d
mov    %eax,%r14d
cmp    0x8(%rsp),%r13d
jl     11c0 <main+0xa0>
jmp    1160 <main+0x40>
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 = [16 x i8] c"Case %d: %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
%10 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %2)
store i32 1, i32* %4
br label %11
11: ; preds = %48, %0
%12 = load i32, i32* %4
%13 = load i32, i32* %2
%14 = icmp sle i32 %12, %13
br i1 %14, label %15, label %51
15: ; preds = %11
store i32 0, i32* %8
store i32 0, i32* %9
%16 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %3)
%17 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %6)
%18 = load i32, i32* %6
store i32 %18, i32* %7
store i32 1, i32* %5
br label %19
19: ; preds = %40, %15
%20 = load i32, i32* %5
%21 = load i32, i32* %3
%22 = icmp slt i32 %20, %21
br i1 %22, label %23, label %43
23: ; preds = %19
%24 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %6)
%25 = load i32, i32* %7
%26 = load i32, i32* %6
%27 = icmp slt i32 %25, %26
br i1 %27, label %28, label %31
28: ; preds = %23
%29 = load i32, i32* %8
%30 = add nsw i32 %29, 1
store i32 %30, i32* %8
br label %31
31: ; preds = %28, %23
%32 = load i32, i32* %7
%33 = load i32, i32* %6
%34 = icmp sgt i32 %32, %33
br i1 %34, label %35, label %38
35: ; preds = %31
%36 = load i32, i32* %9
%37 = add nsw i32 %36, 1
store i32 %37, i32* %9
br label %38
38: ; preds = %35, %31
%39 = load i32, i32* %6
store i32 %39, i32* %7
br label %40
40: ; preds = %38
%41 = load i32, i32* %5
%42 = add nsw i32 %41, 1
store i32 %42, i32* %5
br label %19
43: ; preds = %19
%44 = load i32, i32* %4
%45 = load i32, i32* %8
%46 = load i32, i32* %9
%47 = call i32 @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.1, i64 0, i64 0), i32 %44, i32 %45, i32 %46)
br label %48
48: ; preds = %43
%49 = load i32, i32* %4
%50 = add nsw i32 %49, 1
store i32 %50, i32* %4
br label %11
51: ; preds = %11
ret i32 0
}

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