#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 */
scalar_t__ malloc(int);
int /*<<< orphan*/ maxSubarray(unsigned long long *, unsigned long long,
                               unsigned long long, unsigned long long *);
int /*<<< orphan*/ scanf(char *, unsigned long long *);
int main() {
  unsigned long long test = 0, i = 0, count = 0;
  ;
  unsigned long long *array, n, k;
  scanf("%llu", &test);
  while (test != 0) {
    scanf("%llu", &n);
    scanf("%llu", &k);
    array = (unsigned long long *)malloc(sizeof(long) * n);
    for (i = 0; i < n; i++) {
      scanf("%llu", (array + i));
      if (*(array + i) > k)
        ++count;
    }
    maxSubarray(array, n - 1, k, &count);
    --test;
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
movl   $0x0,-0x4(%rbp)
movq   $0x0,-0x10(%rbp)
movq   $0x0,-0x18(%rbp)
movq   $0x0,-0x20(%rbp)
lea    0xea2(%rip),%rdi
lea    -0x10(%rbp),%rsi
call   1050 <scanf@plt>
cmpq   $0x0,-0x10(%rbp)
je     1238 <main+0x108>
lea    0xe87(%rip),%rdi
lea    -0x30(%rbp),%rsi
call   1050 <scanf@plt>
lea    0xe77(%rip),%rdi
lea    -0x38(%rbp),%rsi
call   1050 <scanf@plt>
mov    -0x30(%rbp),%rax
shl    $0x3,%rax
mov    %eax,%edi
call   1040 <malloc@plt>
mov    %rax,-0x28(%rbp)
movq   $0x0,-0x18(%rbp)
mov    -0x18(%rbp),%rax
cmp    -0x30(%rbp),%rax
jae    120e <main+0xde>
mov    -0x28(%rbp),%rsi
mov    -0x18(%rbp),%rax
shl    $0x3,%rax
add    %rax,%rsi
lea    0xe2f(%rip),%rdi
call   1050 <scanf@plt>
mov    -0x28(%rbp),%rax
mov    -0x18(%rbp),%rcx
mov    (%rax,%rcx,8),%rax
cmp    -0x38(%rbp),%rax
jbe    11f8 <main+0xc8>
mov    -0x20(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x20(%rbp)
jmp    11fd <main+0xcd>
mov    -0x18(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x18(%rbp)
jmp    11ad <main+0x7d>
mov    -0x28(%rbp),%rdi
mov    -0x30(%rbp),%rsi
sub    $0x1,%rsi
mov    -0x38(%rbp),%rdx
lea    -0x20(%rbp),%rcx
call   1030 <maxSubarray@plt>
mov    -0x10(%rbp),%rax
add    $0xffffffffffffffff,%rax
mov    %rax,-0x10(%rbp)
jmp    1167 <main+0x37>
xor    %eax,%eax
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x28,%rsp
movq   $0x0,0x10(%rsp)
movq   $0x0,0x20(%rsp)
lea    0xea9(%rip),%rdi
lea    0x10(%rsp),%rsi
call   1050 <scanf@plt>
cmpq   $0x0,0x10(%rsp)
je     1211 <main+0xe1>
lea    0xe8c(%rip),%r13
lea    0x18(%rsp),%r15
lea    0x20(%rsp),%r12
jmp    119e <main+0x6e>
mov    0x18(%rsp),%rdx
xor    %esi,%esi
add    $0xffffffffffffffff,%rsi
mov    %rbx,%rdi
mov    %r12,%rcx
call   1030 <maxSubarray@plt>
addq   $0xffffffffffffffff,0x10(%rsp)
je     1211 <main+0xe1>
mov    %r13,%rdi
lea    0x8(%rsp),%rsi
call   1050 <scanf@plt>
mov    %r13,%rdi
mov    %r15,%rsi
call   1050 <scanf@plt>
mov    0x8(%rsp),%edi
shl    $0x3,%edi
call   1040 <malloc@plt>
mov    %rax,%rbx
cmpq   $0x0,0x8(%rsp)
je     1180 <main+0x50>
xor    %ebp,%ebp
xor    %r14d,%r14d
jmp    11f2 <main+0xc2>
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
add    $0x1,%r14
mov    0x8(%rsp),%rsi
add    $0x8,%rbp
cmp    %rsi,%r14
jae    1187 <main+0x57>
lea    (%rbx,%rbp,1),%rsi
mov    %r13,%rdi
call   1050 <scanf@plt>
mov    0x18(%rsp),%rdx
cmp    %rdx,(%rbx,%r14,8)
jbe    11e0 <main+0xb0>
addq   $0x1,0x20(%rsp)
jmp    11e0 <main+0xb0>
xor    %eax,%eax
add    $0x28,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [5 x i8] c"%llu\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i64
%3 = alloca i64
%4 = alloca i64
%5 = alloca i64*
%6 = alloca i64
%7 = alloca i64
store i32 0, i32* %1
store i64 0, i64* %2
store i64 0, i64* %3
store i64 0, i64* %4
%8 = call i32 @scanf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i64* %2)
br label %9
9: ; preds = %42, %0
%10 = load i64, i64* %2
%11 = icmp ne i64 %10, 0
br i1 %11, label %12, label %50
12: ; preds = %9
%13 = call i32 @scanf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i64* %6)
%14 = call i32 @scanf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i64* %7)
%15 = load i64, i64* %6
%16 = mul i64 8, %15
%17 = trunc i64 %16 to i32
%18 = call i64 @malloc(i32 %17)
%19 = inttoptr i64 %18 to i64*
store i64* %19, i64** %5
store i64 0, i64* %3
br label %20
20: ; preds = %39, %12
%21 = load i64, i64* %3
%22 = load i64, i64* %6
%23 = icmp ult i64 %21, %22
br i1 %23, label %24, label %42
24: ; preds = %20
%25 = load i64*, i64** %5
%26 = load i64, i64* %3
%27 = getelementptr inbounds i64, i64* %25, i64 %26
%28 = call i32 @scanf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i64* %27)
%29 = load i64*, i64** %5
%30 = load i64, i64* %3
%31 = getelementptr inbounds i64, i64* %29, i64 %30
%32 = load i64, i64* %31
%33 = load i64, i64* %7
%34 = icmp ugt i64 %32, %33
br i1 %34, label %35, label %38
35: ; preds = %24
%36 = load i64, i64* %4
%37 = add i64 %36, 1
store i64 %37, i64* %4
br label %38
38: ; preds = %35, %24
br label %39
39: ; preds = %38
%40 = load i64, i64* %3
%41 = add i64 %40, 1
store i64 %41, i64* %3
br label %20
42: ; preds = %20
%43 = load i64*, i64** %5
%44 = load i64, i64* %6
%45 = sub i64 %44, 1
%46 = load i64, i64* %7
%47 = call i32 @maxSubarray(i64* %43, i64 %45, i64 %46, i64* %4)
%48 = load i64, i64* %2
%49 = add i64 %48, -1
store i64 %49, i64* %2
br label %9
50: ; preds = %9
ret i32 0
}

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