#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*/ fflush(int /*<<< orphan*/);
int /*<<< orphan*/ fgets(char *, int, int /*<<< orphan*/);
int /*<<< orphan*/ initialize_tree(int *);
int /*<<< orphan*/ memset(char *, int /*<<< orphan*/, int /*<<< orphan*/);
int /*<<< orphan*/ scanf(char *, int *);
int split_string(char *, int *);
int /*<<< orphan*/ stdin;
int /*<<< orphan*/ strlen(char *);
int /*<<< orphan*/ verify_AVL(int *, int);
int main(void) {
  int tree[250];
  char buffer[600];
  int number_of_tests;
  int i;
  scanf("%i", &number_of_tests);
  fgets(buffer, 5, stdin);
  for (i = 0; i < number_of_tests; i++) {
    memset(buffer, 0, strlen(buffer));
    fgets(buffer, 600, stdin);
    fflush(stdin);
    char *p = buffer;
    p += 2;
    initialize_tree(tree);
    int size_of_tree = split_string(p, tree);
    verify_AVL(tree, size_of_tree);
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x670,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xe67(%rip),%rdi
lea    -0x654(%rbp),%rsi
call   10a0 <scanf@plt>
lea    -0x650(%rbp),%rdi
mov    0x2e35(%rip),%rax
mov    (%rax),%edx
mov    $0x5,%esi
call   1080 <fgets@plt>
movl   $0x0,-0x658(%rbp)
mov    -0x658(%rbp),%eax
cmp    -0x654(%rbp),%eax
jge    1298 <main+0x118>
lea    -0x650(%rbp),%rax
mov    %rax,-0x670(%rbp)
lea    -0x650(%rbp),%rdi
call   1040 <strlen@plt>
mov    -0x670(%rbp),%rdi
mov    %eax,%edx
xor    %esi,%esi
call   1070 <memset@plt>
lea    -0x650(%rbp),%rdi
mov    0x2dd5(%rip),%rax
mov    (%rax),%edx
mov    $0x258,%esi
call   1080 <fgets@plt>
mov    0x2dc2(%rip),%rax
mov    (%rax),%edi
call   1090 <fflush@plt>
lea    -0x650(%rbp),%rax
mov    %rax,-0x660(%rbp)
mov    -0x660(%rbp),%rax
add    $0x2,%rax
mov    %rax,-0x660(%rbp)
lea    -0x3f0(%rbp),%rdi
call   1030 <initialize_tree@plt>
mov    -0x660(%rbp),%rdi
lea    -0x3f0(%rbp),%rsi
call   1050 <split_string@plt>
mov    %eax,-0x664(%rbp)
lea    -0x3f0(%rbp),%rdi
mov    -0x664(%rbp),%esi
call   1060 <verify_AVL@plt>
mov    -0x658(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x658(%rbp)
jmp    11c9 <main+0x49>
xor    %eax,%eax
add    $0x670,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
sub    $0x660,%rsp
lea    0xe6a(%rip),%rdi
lea    0xc(%rsp),%rsi
call   10a0 <scanf@plt>
mov    0x2e41(%rip),%r12
mov    (%r12),%edx
lea    0x10(%rsp),%rdi
mov    $0x5,%esi
call   1080 <fgets@plt>
cmpl   $0x0,0xc(%rsp)
jle    1234 <main+0xb4>
xor    %ebp,%ebp
lea    0x12(%rsp),%r14
lea    0x10(%rsp),%r15
lea    0x270(%rsp),%rbx
cs nopw 0x0(%rax,%rax,1)
nop
mov    %r15,%rdi
call   1040 <strlen@plt>
mov    %r15,%rdi
xor    %esi,%esi
mov    %eax,%edx
call   1070 <memset@plt>
mov    (%r12),%edx
mov    %r15,%rdi
mov    $0x258,%esi
call   1080 <fgets@plt>
mov    (%r12),%edi
call   1090 <fflush@plt>
mov    %rbx,%rdi
call   1030 <initialize_tree@plt>
mov    %r14,%rdi
mov    %rbx,%rsi
call   1050 <split_string@plt>
mov    %rbx,%rdi
mov    %eax,%esi
call   1060 <verify_AVL@plt>
add    $0x1,%ebp
cmp    0xc(%rsp),%ebp
jl     11e0 <main+0x60>
xor    %eax,%eax
add    $0x660,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [3 x i8] c"%i\00"
@stdin = global i32 0
define i32 @main() {
%1 = alloca i32
%2 = alloca [250 x i32]
%3 = alloca [600 x i8]
%4 = alloca i32
%5 = alloca i32
%6 = alloca i8*
%7 = alloca i32
store i32 0, i32* %1
%8 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %4)
%9 = getelementptr inbounds [600 x i8], [600 x i8]* %3, i64 0, i64 0
%10 = load i32, i32* @stdin
%11 = call i32 @fgets(i8* %9, i32 5, i32 %10)
store i32 0, i32* %5
br label %12
12: ; preds = %37, %0
%13 = load i32, i32* %5
%14 = load i32, i32* %4
%15 = icmp slt i32 %13, %14
br i1 %15, label %16, label %40
16: ; preds = %12
%17 = getelementptr inbounds [600 x i8], [600 x i8]* %3, i64 0, i64 0
%18 = getelementptr inbounds [600 x i8], [600 x i8]* %3, i64 0, i64 0
%19 = call i32 @strlen(i8* %18)
%20 = call i32 @memset(i8* %17, i32 0, i32 %19)
%21 = getelementptr inbounds [600 x i8], [600 x i8]* %3, i64 0, i64 0
%22 = load i32, i32* @stdin
%23 = call i32 @fgets(i8* %21, i32 600, i32 %22)
%24 = load i32, i32* @stdin
%25 = call i32 @fflush(i32 %24)
%26 = getelementptr inbounds [600 x i8], [600 x i8]* %3, i64 0, i64 0
store i8* %26, i8** %6
%27 = load i8*, i8** %6
%28 = getelementptr inbounds i8, i8* %27, i64 2
store i8* %28, i8** %6
%29 = getelementptr inbounds [250 x i32], [250 x i32]* %2, i64 0, i64 0
%30 = call i32 @initialize_tree(i32* %29)
%31 = load i8*, i8** %6
%32 = getelementptr inbounds [250 x i32], [250 x i32]* %2, i64 0, i64 0
%33 = call i32 @split_string(i8* %31, i32* %32)
store i32 %33, i32* %7
%34 = getelementptr inbounds [250 x i32], [250 x i32]* %2, i64 0, i64 0
%35 = load i32, i32* %7
%36 = call i32 @verify_AVL(i32* %34, i32 %35)
br label %37
37: ; preds = %16
%38 = load i32, i32* %5
%39 = add nsw i32 %38, 1
store i32 %39, i32* %5
br label %12
40: ; preds = %12
ret i32 0
}

LLVM IR (-O2):
@.str = [3 x i8] c"%i\00"
@stdin = global i32 0
define i32 @main() {
%1 = alloca [250 x i32]
%2 = alloca [600 x i8]
%3 = alloca i32
%4 = bitcast [250 x i32]* %1 to i8*
%5 = getelementptr inbounds [600 x i8], [600 x i8]* %2, i64 0, i64 0
%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* %3)
%8 = load i32, i32* @stdin
%9 = call i32 @fgets(i8* %5, i32 5, i32 %8)
%10 = load i32, i32* %3
%11 = icmp sgt i32 %10, 0
br i1 %11, label %12, label %29
12: ; preds = %0
%13 = getelementptr inbounds [600 x i8], [600 x i8]* %2, i64 0, i64 2
%14 = getelementptr inbounds [250 x i32], [250 x i32]* %1, i64 0, i64 0
br label %15
15: ; preds = %12, %15
%16 = phi i32 [ 0, %12 ], [ %26, %15 ]
%17 = call i32 @strlen(i8* %5)
%18 = call i32 @memset(i8* %5, i32 0, i32 %17)
%19 = load i32, i32* @stdin
%20 = call i32 @fgets(i8* %5, i32 600, i32 %19)
%21 = load i32, i32* @stdin
%22 = call i32 @fflush(i32 %21)
%23 = call i32 @initialize_tree(i32* %14)
%24 = call i32 @split_string(i8* %13, i32* %14)
%25 = call i32 @verify_AVL(i32* %14, i32 %24)
%26 = add nuw nsw i32 %16, 1
%27 = load i32, i32* %3
%28 = icmp slt i32 %26, %27
br i1 %28, label %15, label %29
29: ; preds = %15, %0
ret i32 0
}