#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 */
struct Vertex {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ Answer();
int /*<<< orphan*/ addUEdge(int, int);
int /*<<< orphan*/ childCount();
int /*<<< orphan*/ createGraph(int);
int /*<<< orphan*/ scanf(char *, int *, ...);
int main(void) {
  int N, E, i, v1, v2, w, s, d, Test;
  extern struct Vertex *AdjacencyList;
  extern struct Vertex *AdjacencyList2;
  scanf("%d", &Test);
  while (Test > 0) {
    scanf("%d", &N);
    E = N - 1;
    createGraph(N);
    while (E != 0) {
      scanf("%d%d", &v1, &v2);
      addUEdge(v1 - 1, v2 - 1);
      E--;
    }
    childCount();
    Answer();
    Test--;
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xe9c(%rip),%rdi
lea    -0x28(%rbp),%rsi
mov    $0x0,%al
call   1070 <scanf@plt>
cmpl   $0x0,-0x28(%rbp)
jle    11f9 <main+0xa9>
lea    0xe80(%rip),%rdi
lea    -0x8(%rbp),%rsi
mov    $0x0,%al
call   1070 <scanf@plt>
mov    -0x8(%rbp),%eax
sub    $0x1,%eax
mov    %eax,-0xc(%rbp)
mov    -0x8(%rbp),%edi
call   1060 <createGraph@plt>
cmpl   $0x0,-0xc(%rbp)
je     11dd <main+0x8d>
lea    0xe51(%rip),%rdi
lea    -0x14(%rbp),%rsi
lea    -0x18(%rbp),%rdx
mov    $0x0,%al
call   1070 <scanf@plt>
mov    -0x14(%rbp),%edi
sub    $0x1,%edi
mov    -0x18(%rbp),%esi
sub    $0x1,%esi
call   1050 <addUEdge@plt>
mov    -0xc(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0xc(%rbp)
jmp    119e <main+0x4e>
mov    $0x0,%al
call   1030 <childCount@plt>
mov    $0x0,%al
call   1040 <Answer@plt>
mov    -0x28(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x28(%rbp)
jmp    1171 <main+0x21>
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    0xe9d(%rip),%rdi
lea    0x8(%rsp),%rsi
xor    %eax,%eax
call   1070 <scanf@plt>
cmpl   $0x0,0x8(%rsp)
jle    120a <main+0xba>
lea    0xe7f(%rip),%r14
lea    0x14(%rsp),%r15
lea    0xe71(%rip),%r12
lea    0x10(%rsp),%r13
lea    0xc(%rsp),%rbx
jmp    11be <main+0x6e>
nopl   0x0(%rax,%rax,1)
xor    %eax,%eax
call   1030 <childCount@plt>
xor    %eax,%eax
call   1040 <Answer@plt>
mov    0x8(%rsp),%eax
lea    -0x1(%rax),%ecx
mov    %ecx,0x8(%rsp)
cmp    $0x1,%eax
jle    120a <main+0xba>
mov    %r14,%rdi
mov    %r15,%rsi
xor    %eax,%eax
call   1070 <scanf@plt>
mov    0x14(%rsp),%ebp
mov    %ebp,%edi
call   1060 <createGraph@plt>
add    $0xffffffff,%ebp
je     11a0 <main+0x50>
nopl   0x0(%rax,%rax,1)
mov    %r12,%rdi
mov    %r13,%rsi
mov    %rbx,%rdx
xor    %eax,%eax
call   1070 <scanf@plt>
mov    0x10(%rsp),%edi
add    $0xffffffff,%edi
mov    0xc(%rsp),%esi
add    $0xffffffff,%esi
call   1050 <addUEdge@plt>
add    $0xffffffff,%ebp
jne    11e0 <main+0x90>
jmp    11a0 <main+0x50>
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 = [5 x i8] c"%d%d\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
%10 = alloca i32
store i32 0, i32* %1
%11 = call i32 (i8*, i32*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %10)
br label %12
12: ; preds = %33, %0
%13 = load i32, i32* %10
%14 = icmp sgt i32 %13, 0
br i1 %14, label %15, label %38
15: ; preds = %12
%16 = call i32 (i8*, i32*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %2)
%17 = load i32, i32* %2
%18 = sub nsw i32 %17, 1
store i32 %18, i32* %3
%19 = load i32, i32* %2
%20 = call i32 @createGraph(i32 %19)
br label %21
21: ; preds = %24, %15
%22 = load i32, i32* %3
%23 = icmp ne i32 %22, 0
br i1 %23, label %24, label %33
24: ; preds = %21
%25 = call i32 (i8*, i32*, ...) @scanf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), i32* %5, i32* %6)
%26 = load i32, i32* %5
%27 = sub nsw i32 %26, 1
%28 = load i32, i32* %6
%29 = sub nsw i32 %28, 1
%30 = call i32 @addUEdge(i32 %27, i32 %29)
%31 = load i32, i32* %3
%32 = add nsw i32 %31, -1
store i32 %32, i32* %3
br label %21
33: ; preds = %21
%34 = call i32 (...) @childCount()
%35 = call i32 (...) @Answer()
%36 = load i32, i32* %10
%37 = add nsw i32 %36, -1
store i32 %37, i32* %10
br label %12
38: ; preds = %12
ret i32 0
}

LLVM IR (-O2):
@.str = [3 x i8] c"%d\00"
@.str.1 = [5 x i8] c"%d%d\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
%5 = bitcast i32* %1 to i8*
%6 = bitcast i32* %2 to i8*
%7 = bitcast i32* %3 to i8*
%8 = bitcast i32* %4 to i8*
%9 = call i32 (i8*, i32*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %4)
%10 = load i32, i32* %4
%11 = icmp sgt i32 %10, 0
br i1 %11, label %12, label %34
12: ; preds = %0, %28
%13 = call i32 (i8*, i32*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %1)
%14 = load i32, i32* %1
%15 = call i32 @createGraph(i32 %14)
%16 = add nsw i32 %14, -1
%17 = icmp eq i32 %16, 0
br i1 %17, label %28, label %18
18: ; preds = %12, %18
%19 = phi i32 [ %26, %18 ], [ %16, %12 ]
%20 = call i32 (i8*, i32*, ...) @scanf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), i32* %2, i32* %3)
%21 = load i32, i32* %2
%22 = add nsw i32 %21, -1
%23 = load i32, i32* %3
%24 = add nsw i32 %23, -1
%25 = call i32 @addUEdge(i32 %22, i32 %24)
%26 = add nsw i32 %19, -1
%27 = icmp eq i32 %26, 0
br i1 %27, label %28, label %18
28: ; preds = %18, %12
%29 = call i32 (...) @childCount()
%30 = call i32 (...) @Answer()
%31 = load i32, i32* %4
%32 = add nsw i32 %31, -1
store i32 %32, i32* %4
%33 = icmp sgt i32 %31, 1
br i1 %33, label %12, label %34
34: ; preds = %28, %0
ret i32 0
}