int main() {
  int **edges;
  int ansSize, *ans, i;
  edges = (int **)malloc(3 * sizeof(int *));
  for (i = 0; i < 3; i++) {
    edges[i] = (int *)malloc(2 * sizeof(int));
  }
  edges[0][0] = 1;
  edges[0][1] = 0;
  edges[1][0] = 1;
  edges[1][1] = 2;
  edges[2][0] = 1;
  edges[2][1] = 3;
  ans = findMinHeightTrees(4, edges, 3, 2, &ansSize);
  for (i = 0; i < ansSize; i++) {
    printf("Ans %d\n", *(ans + i));
  }
  for (i = 0; i < 3; i++) {
    free(edges[i]);
  }
  free(edges);
  free(ans);
  edges = (int **)malloc(5 * sizeof(int *));
  for (i = 0; i < 5; i++) {
    edges[i] = (int *)malloc(2 * sizeof(int));
  }
  edges[0][0] = 0;
  edges[0][1] = 3;
  edges[1][0] = 1;
  edges[1][1] = 3;
  edges[2][0] = 2;
  edges[2][1] = 3;
  edges[3][0] = 4;
  edges[3][1] = 3;
  edges[4][0] = 5;
  edges[4][1] = 4;
  ans = findMinHeightTrees(6, edges, 5, 2, &ansSize);
  for (i = 0; i < ansSize; i++) {
    printf("Ans %d\n", *(ans + i));
  }
  for (i = 0; i < 5; i++) {
    free(edges[i]);
  }
  free(edges);
  free(ans);
  edges = (int **)malloc(5 * sizeof(int *));
  assert(edges);
  for (i = 0; i < 5; i++) {
    edges[i] = (int *)malloc(2 * sizeof(int));
    assert(edges[i]);
  }
  edges[0][0] = 3;
  edges[0][1] = 0;
  edges[1][0] = 3;
  edges[1][1] = 1;
  edges[2][0] = 3;
  edges[2][1] = 2;
  edges[3][0] = 3;
  edges[3][1] = 4;
  edges[4][0] = 5;
  edges[4][1] = 4;
  ans = findMinHeightTrees(6, edges, 5, 2, &ansSize);
  for (i = 0; i < ansSize; i++) {
    printf("Ans %d\n", *(ans + i));
  }
  for (i = 0; i < 5; i++) {
    free(edges[i]);
  }
  free(edges);
  free(ans);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movl   $0x0,-0x4(%rbp)
mov    $0x18,%edi
call   1060 <malloc@plt>
mov    %rax,-0x10(%rbp)
movl   $0x0,-0x24(%rbp)
cmpl   $0x3,-0x24(%rbp)
jge    11a5 <main+0x55>
mov    $0x8,%edi
call   1060 <malloc@plt>
mov    %rax,%rdx
mov    -0x10(%rbp),%rax
movslq -0x24(%rbp),%rcx
mov    %rdx,(%rax,%rcx,8)
mov    -0x24(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x24(%rbp)
jmp    1174 <main+0x24>
mov    -0x10(%rbp),%rax
mov    (%rax),%rax
movl   $0x1,(%rax)
mov    -0x10(%rbp),%rax
mov    (%rax),%rax
movl   $0x0,0x4(%rax)
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rax
movl   $0x1,(%rax)
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rax
movl   $0x2,0x4(%rax)
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rax
movl   $0x1,(%rax)
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rax
movl   $0x3,0x4(%rax)
mov    -0x10(%rbp),%rsi
mov    $0x4,%edi
mov    $0x3,%edx
mov    $0x2,%ecx
lea    -0x14(%rbp),%r8
mov    $0x0,%al
call   1070 <findMinHeightTrees@plt>
cltq
mov    %rax,-0x20(%rbp)
movl   $0x0,-0x24(%rbp)
mov    -0x24(%rbp),%eax
cmp    -0x14(%rbp),%eax
jge    1258 <main+0x108>
mov    -0x20(%rbp),%rax
movslq -0x24(%rbp),%rcx
mov    (%rax,%rcx,4),%esi
lea    0xdbd(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x24(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x24(%rbp)
jmp    1225 <main+0xd5>
movl   $0x0,-0x24(%rbp)
cmpl   $0x3,-0x24(%rbp)
jge    1288 <main+0x138>
mov    -0x10(%rbp),%rax
movslq -0x24(%rbp),%rcx
mov    (%rax,%rcx,8),%rdi
call   1030 <free@plt>
mov    -0x24(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x24(%rbp)
jmp    125f <main+0x10f>
mov    -0x10(%rbp),%rdi
call   1030 <free@plt>
mov    -0x20(%rbp),%rdi
call   1030 <free@plt>
mov    $0x28,%edi
call   1060 <malloc@plt>
mov    %rax,-0x10(%rbp)
movl   $0x0,-0x24(%rbp)
cmpl   $0x5,-0x24(%rbp)
jge    12e0 <main+0x190>
mov    $0x8,%edi
call   1060 <malloc@plt>
mov    %rax,%rdx
mov    -0x10(%rbp),%rax
movslq -0x24(%rbp),%rcx
mov    %rdx,(%rax,%rcx,8)
mov    -0x24(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x24(%rbp)
jmp    12af <main+0x15f>
mov    -0x10(%rbp),%rax
mov    (%rax),%rax
movl   $0x0,(%rax)
mov    -0x10(%rbp),%rax
mov    (%rax),%rax
movl   $0x3,0x4(%rax)
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rax
movl   $0x1,(%rax)
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rax
movl   $0x3,0x4(%rax)
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rax
movl   $0x2,(%rax)
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rax
movl   $0x3,0x4(%rax)
mov    -0x10(%rbp),%rax
mov    0x18(%rax),%rax
movl   $0x4,(%rax)
mov    -0x10(%rbp),%rax
mov    0x18(%rax),%rax
movl   $0x3,0x4(%rax)
mov    -0x10(%rbp),%rax
mov    0x20(%rax),%rax
movl   $0x5,(%rax)
mov    -0x10(%rbp),%rax
mov    0x20(%rax),%rax
movl   $0x4,0x4(%rax)
mov    -0x10(%rbp),%rsi
mov    $0x6,%edi
mov    $0x5,%edx
mov    $0x2,%ecx
lea    -0x14(%rbp),%r8
mov    $0x0,%al
call   1070 <findMinHeightTrees@plt>
cltq
mov    %rax,-0x20(%rbp)
movl   $0x0,-0x24(%rbp)
mov    -0x24(%rbp),%eax
cmp    -0x14(%rbp),%eax
jge    13cd <main+0x27d>
mov    -0x20(%rbp),%rax
movslq -0x24(%rbp),%rcx
mov    (%rax,%rcx,4),%esi
lea    0xc48(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x24(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x24(%rbp)
jmp    139a <main+0x24a>
movl   $0x0,-0x24(%rbp)
cmpl   $0x5,-0x24(%rbp)
jge    13fd <main+0x2ad>
mov    -0x10(%rbp),%rax
movslq -0x24(%rbp),%rcx
mov    (%rax,%rcx,8),%rdi
call   1030 <free@plt>
mov    -0x24(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x24(%rbp)
jmp    13d4 <main+0x284>
mov    -0x10(%rbp),%rdi
call   1030 <free@plt>
mov    -0x20(%rbp),%rdi
call   1030 <free@plt>
mov    $0x28,%edi
call   1060 <malloc@plt>
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
mov    $0x0,%al
call   1050 <assert@plt>
movl   $0x0,-0x24(%rbp)
cmpl   $0x5,-0x24(%rbp)
jge    1473 <main+0x323>
mov    $0x8,%edi
call   1060 <malloc@plt>
mov    %rax,%rdx
mov    -0x10(%rbp),%rax
movslq -0x24(%rbp),%rcx
mov    %rdx,(%rax,%rcx,8)
mov    -0x10(%rbp),%rax
movslq -0x24(%rbp),%rcx
mov    (%rax,%rcx,8),%rdi
mov    $0x0,%al
call   1050 <assert@plt>
mov    -0x24(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x24(%rbp)
jmp    142f <main+0x2df>
mov    -0x10(%rbp),%rax
mov    (%rax),%rax
movl   $0x3,(%rax)
mov    -0x10(%rbp),%rax
mov    (%rax),%rax
movl   $0x0,0x4(%rax)
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rax
movl   $0x3,(%rax)
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rax
movl   $0x1,0x4(%rax)
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rax
movl   $0x3,(%rax)
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rax
movl   $0x2,0x4(%rax)
mov    -0x10(%rbp),%rax
mov    0x18(%rax),%rax
movl   $0x3,(%rax)
mov    -0x10(%rbp),%rax
mov    0x18(%rax),%rax
movl   $0x4,0x4(%rax)
mov    -0x10(%rbp),%rax
mov    0x20(%rax),%rax
movl   $0x5,(%rax)
mov    -0x10(%rbp),%rax
mov    0x20(%rax),%rax
movl   $0x4,0x4(%rax)
mov    -0x10(%rbp),%rsi
mov    $0x6,%edi
mov    $0x5,%edx
mov    $0x2,%ecx
lea    -0x14(%rbp),%r8
mov    $0x0,%al
call   1070 <findMinHeightTrees@plt>
cltq
mov    %rax,-0x20(%rbp)
movl   $0x0,-0x24(%rbp)
mov    -0x24(%rbp),%eax
cmp    -0x14(%rbp),%eax
jge    1560 <main+0x410>
mov    -0x20(%rbp),%rax
movslq -0x24(%rbp),%rcx
mov    (%rax,%rcx,4),%esi
lea    0xab5(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x24(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x24(%rbp)
jmp    152d <main+0x3dd>
movl   $0x0,-0x24(%rbp)
cmpl   $0x5,-0x24(%rbp)
jge    1590 <main+0x440>
mov    -0x10(%rbp),%rax
movslq -0x24(%rbp),%rcx
mov    (%rax,%rcx,8),%rdi
call   1030 <free@plt>
mov    -0x24(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x24(%rbp)
jmp    1567 <main+0x417>
mov    -0x10(%rbp),%rdi
call   1030 <free@plt>
mov    -0x20(%rbp),%rdi
call   1030 <free@plt>
mov    -0x4(%rbp),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
mov    $0x18,%edi
call   1060 <malloc@plt>
mov    %rax,%r14
mov    $0x8,%edi
call   1060 <malloc@plt>
mov    %rax,%r15
mov    %rax,(%r14)
mov    $0x8,%edi
call   1060 <malloc@plt>
mov    %rax,%rbx
mov    %rax,0x8(%r14)
mov    $0x8,%edi
call   1060 <malloc@plt>
mov    %rax,0x10(%r14)
movq   $0x1,(%r15)
movabs $0x200000001,%rcx
mov    %rcx,(%rbx)
movabs $0x300000001,%rcx
mov    %rcx,(%rax)
lea    0x4(%rsp),%r8
mov    $0x4,%edi
mov    %r14,%rsi
mov    $0x3,%edx
mov    $0x2,%ecx
xor    %eax,%eax
call   1070 <findMinHeightTrees@plt>
movslq %eax,%rbx
cmpl   $0x0,0x4(%rsp)
jle    120b <main+0xbb>
lea    0xe19(%rip),%r15
xor    %ebp,%ebp
nopl   0x0(%rax)
mov    (%rbx,%rbp,4),%esi
mov    %r15,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
add    $0x1,%rbp
movslq 0x4(%rsp),%rax
cmp    %rax,%rbp
jl     11f0 <main+0xa0>
mov    (%r14),%rdi
call   1030 <free@plt>
mov    0x8(%r14),%rdi
call   1030 <free@plt>
mov    0x10(%r14),%rdi
call   1030 <free@plt>
mov    %r14,%rdi
call   1030 <free@plt>
mov    %rbx,%rdi
call   1030 <free@plt>
mov    $0x28,%edi
call   1060 <malloc@plt>
mov    %rax,%r14
mov    $0x8,%edi
call   1060 <malloc@plt>
mov    %rax,%r15
mov    %rax,(%r14)
mov    $0x8,%edi
call   1060 <malloc@plt>
mov    %rax,%r12
mov    %rax,0x8(%r14)
mov    $0x8,%edi
call   1060 <malloc@plt>
mov    %rax,%r13
mov    %rax,0x10(%r14)
mov    $0x8,%edi
call   1060 <malloc@plt>
mov    %rax,%rbx
mov    %rax,0x18(%r14)
mov    $0x8,%edi
call   1060 <malloc@plt>
mov    %rax,0x20(%r14)
movabs $0x300000000,%rcx
mov    %rcx,(%r15)
movabs $0x300000001,%rcx
mov    %rcx,(%r12)
movabs $0x300000002,%rcx
mov    %rcx,0x0(%r13)
movabs $0x300000004,%rcx
mov    %rcx,(%rbx)
movabs $0x400000005,%r12
mov    %r12,(%rax)
lea    0x4(%rsp),%r8
mov    $0x6,%edi
mov    %r14,%rsi
mov    $0x5,%edx
mov    $0x2,%ecx
xor    %eax,%eax
call   1070 <findMinHeightTrees@plt>
movslq %eax,%rbx
cmpl   $0x0,0x4(%rsp)
jle    132b <main+0x1db>
lea    0xcfb(%rip),%r15
xor    %ebp,%ebp
nopw   0x0(%rax,%rax,1)
mov    (%rbx,%rbp,4),%esi
mov    %r15,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
add    $0x1,%rbp
movslq 0x4(%rsp),%rax
cmp    %rax,%rbp
jl     1310 <main+0x1c0>
mov    (%r14),%rdi
call   1030 <free@plt>
mov    0x8(%r14),%rdi
call   1030 <free@plt>
mov    0x10(%r14),%rdi
call   1030 <free@plt>
mov    0x18(%r14),%rdi
call   1030 <free@plt>
mov    0x20(%r14),%rdi
call   1030 <free@plt>
mov    %r14,%rdi
call   1030 <free@plt>
mov    %rbx,%rdi
call   1030 <free@plt>
mov    $0x28,%edi
call   1060 <malloc@plt>
mov    %rax,%r14
mov    %rax,%rdi
xor    %eax,%eax
call   1050 <assert@plt>
mov    $0x8,%edi
call   1060 <malloc@plt>
mov    %rax,(%r14)
mov    %rax,%rdi
xor    %eax,%eax
call   1050 <assert@plt>
mov    $0x8,%edi
call   1060 <malloc@plt>
mov    %rax,0x8(%r14)
mov    %rax,%rdi
xor    %eax,%eax
call   1050 <assert@plt>
mov    $0x8,%edi
call   1060 <malloc@plt>
mov    %rax,0x10(%r14)
mov    %rax,%rdi
xor    %eax,%eax
call   1050 <assert@plt>
mov    $0x8,%edi
call   1060 <malloc@plt>
mov    %rax,0x18(%r14)
mov    %rax,%rdi
xor    %eax,%eax
call   1050 <assert@plt>
mov    $0x8,%edi
call   1060 <malloc@plt>
mov    %rax,0x20(%r14)
mov    %rax,%rdi
xor    %eax,%eax
call   1050 <assert@plt>
mov    (%r14),%rax
movq   $0x3,(%rax)
mov    0x8(%r14),%rax
movabs $0x100000003,%rcx
mov    %rcx,(%rax)
mov    0x10(%r14),%rax
movabs $0x200000003,%rcx
mov    %rcx,(%rax)
mov    0x18(%r14),%rax
movabs $0x400000003,%rcx
mov    %rcx,(%rax)
mov    0x20(%r14),%rax
mov    %r12,(%rax)
lea    0x4(%rsp),%r8
mov    $0x6,%edi
mov    %r14,%rsi
mov    $0x5,%edx
mov    $0x2,%ecx
xor    %eax,%eax
call   1070 <findMinHeightTrees@plt>
movslq %eax,%rbx
cmpl   $0x0,0x4(%rsp)
jle    148b <main+0x33b>
lea    0xb98(%rip),%r15
xor    %ebp,%ebp
nopw   0x0(%rax,%rax,1)
mov    (%rbx,%rbp,4),%esi
mov    %r15,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
add    $0x1,%rbp
movslq 0x4(%rsp),%rax
cmp    %rax,%rbp
jl     1470 <main+0x320>
mov    (%r14),%rdi
call   1030 <free@plt>
mov    0x8(%r14),%rdi
call   1030 <free@plt>
mov    0x10(%r14),%rdi
call   1030 <free@plt>
mov    0x18(%r14),%rdi
call   1030 <free@plt>
mov    0x20(%r14),%rdi
call   1030 <free@plt>
mov    %r14,%rdi
call   1030 <free@plt>
mov    %rbx,%rdi
call   1030 <free@plt>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [8 x i8] c"Ans %d\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32**
%3 = alloca i32
%4 = alloca i32*
%5 = alloca i32
store i32 0, i32* %1
%6 = call i8* @malloc(i64 24)
%7 = bitcast i8* %6 to i32**
store i32** %7, i32*** %2
store i32 0, i32* %5
br label %8
8: ; preds = %18, %0
%9 = load i32, i32* %5
%10 = icmp slt i32 %9, 3
br i1 %10, label %11, label %21
11: ; preds = %8
%12 = call i8* @malloc(i64 8)
%13 = bitcast i8* %12 to i32*
%14 = load i32**, i32*** %2
%15 = load i32, i32* %5
%16 = sext i32 %15 to i64
%17 = getelementptr inbounds i32*, i32** %14, i64 %16
store i32* %13, i32** %17
br label %18
18: ; preds = %11
%19 = load i32, i32* %5
%20 = add nsw i32 %19, 1
store i32 %20, i32* %5
br label %8
21: ; preds = %8
%22 = load i32**, i32*** %2
%23 = getelementptr inbounds i32*, i32** %22, i64 0
%24 = load i32*, i32** %23
%25 = getelementptr inbounds i32, i32* %24, i64 0
store i32 1, i32* %25
%26 = load i32**, i32*** %2
%27 = getelementptr inbounds i32*, i32** %26, i64 0
%28 = load i32*, i32** %27
%29 = getelementptr inbounds i32, i32* %28, i64 1
store i32 0, i32* %29
%30 = load i32**, i32*** %2
%31 = getelementptr inbounds i32*, i32** %30, i64 1
%32 = load i32*, i32** %31
%33 = getelementptr inbounds i32, i32* %32, i64 0
store i32 1, i32* %33
%34 = load i32**, i32*** %2
%35 = getelementptr inbounds i32*, i32** %34, i64 1
%36 = load i32*, i32** %35
%37 = getelementptr inbounds i32, i32* %36, i64 1
store i32 2, i32* %37
%38 = load i32**, i32*** %2
%39 = getelementptr inbounds i32*, i32** %38, i64 2
%40 = load i32*, i32** %39
%41 = getelementptr inbounds i32, i32* %40, i64 0
store i32 1, i32* %41
%42 = load i32**, i32*** %2
%43 = getelementptr inbounds i32*, i32** %42, i64 2
%44 = load i32*, i32** %43
%45 = getelementptr inbounds i32, i32* %44, i64 1
store i32 3, i32* %45
%46 = load i32**, i32*** %2
%47 = call i32 (i32, i32**, i32, i32, i32*, ...) bitcast (i32 (...)* @findMinHeightTrees to i32 (i32, i32**, i32, i32, i32*, ...)*)(i32 4, i32** %46, i32 3, i32 2, i32* %3)
%48 = sext i32 %47 to i64
%49 = inttoptr i64 %48 to i32*
store i32* %49, i32** %4
store i32 0, i32* %5
br label %50
50: ; preds = %61, %21
%51 = load i32, i32* %5
%52 = load i32, i32* %3
%53 = icmp slt i32 %51, %52
br i1 %53, label %54, label %64
54: ; preds = %50
%55 = load i32*, i32** %4
%56 = load i32, i32* %5
%57 = sext i32 %56 to i64
%58 = getelementptr inbounds i32, i32* %55, i64 %57
%59 = load i32, i32* %58
%60 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0), i32 %59)
br label %61
61: ; preds = %54
%62 = load i32, i32* %5
%63 = add nsw i32 %62, 1
store i32 %63, i32* %5
br label %50
64: ; preds = %50
store i32 0, i32* %5
br label %65
65: ; preds = %75, %64
%66 = load i32, i32* %5
%67 = icmp slt i32 %66, 3
br i1 %67, label %68, label %78
68: ; preds = %65
%69 = load i32**, i32*** %2
%70 = load i32, i32* %5
%71 = sext i32 %70 to i64
%72 = getelementptr inbounds i32*, i32** %69, i64 %71
%73 = load i32*, i32** %72
%74 = bitcast i32* %73 to i8*
br label %75
75: ; preds = %68
%76 = load i32, i32* %5
%77 = add nsw i32 %76, 1
store i32 %77, i32* %5
br label %65
78: ; preds = %65
%79 = load i32**, i32*** %2
%80 = bitcast i32** %79 to i8*
%81 = load i32*, i32** %4
%82 = bitcast i32* %81 to i8*
%83 = call i8* @malloc(i64 40)
%84 = bitcast i8* %83 to i32**
store i32** %84, i32*** %2
store i32 0, i32* %5
br label %85
85: ; preds = %95, %78
%86 = load i32, i32* %5
%87 = icmp slt i32 %86, 5
br i1 %87, label %88, label %98
88: ; preds = %85
%89 = call i8* @malloc(i64 8)
%90 = bitcast i8* %89 to i32*
%91 = load i32**, i32*** %2
%92 = load i32, i32* %5
%93 = sext i32 %92 to i64
%94 = getelementptr inbounds i32*, i32** %91, i64 %93
store i32* %90, i32** %94
br label %95
95: ; preds = %88
%96 = load i32, i32* %5
%97 = add nsw i32 %96, 1
store i32 %97, i32* %5
br label %85
98: ; preds = %85
%99 = load i32**, i32*** %2
%100 = getelementptr inbounds i32*, i32** %99, i64 0
%101 = load i32*, i32** %100
%102 = getelementptr inbounds i32, i32* %101, i64 0
store i32 0, i32* %102
%103 = load i32**, i32*** %2
%104 = getelementptr inbounds i32*, i32** %103, i64 0
%105 = load i32*, i32** %104
%106 = getelementptr inbounds i32, i32* %105, i64 1
store i32 3, i32* %106
%107 = load i32**, i32*** %2
%108 = getelementptr inbounds i32*, i32** %107, i64 1
%109 = load i32*, i32** %108
%110 = getelementptr inbounds i32, i32* %109, i64 0
store i32 1, i32* %110
%111 = load i32**, i32*** %2
%112 = getelementptr inbounds i32*, i32** %111, i64 1
%113 = load i32*, i32** %112
%114 = getelementptr inbounds i32, i32* %113, i64 1
store i32 3, i32* %114
%115 = load i32**, i32*** %2
%116 = getelementptr inbounds i32*, i32** %115, i64 2
%117 = load i32*, i32** %116
%118 = getelementptr inbounds i32, i32* %117, i64 0
store i32 2, i32* %118
%119 = load i32**, i32*** %2
%120 = getelementptr inbounds i32*, i32** %119, i64 2
%121 = load i32*, i32** %120
%122 = getelementptr inbounds i32, i32* %121, i64 1
store i32 3, i32* %122
%123 = load i32**, i32*** %2
%124 = getelementptr inbounds i32*, i32** %123, i64 3
%125 = load i32*, i32** %124
%126 = getelementptr inbounds i32, i32* %125, i64 0
store i32 4, i32* %126
%127 = load i32**, i32*** %2
%128 = getelementptr inbounds i32*, i32** %127, i64 3
%129 = load i32*, i32** %128
%130 = getelementptr inbounds i32, i32* %129, i64 1
store i32 3, i32* %130
%131 = load i32**, i32*** %2
%132 = getelementptr inbounds i32*, i32** %131, i64 4
%133 = load i32*, i32** %132
%134 = getelementptr inbounds i32, i32* %133, i64 0
store i32 5, i32* %134
%135 = load i32**, i32*** %2
%136 = getelementptr inbounds i32*, i32** %135, i64 4
%137 = load i32*, i32** %136
%138 = getelementptr inbounds i32, i32* %137, i64 1
store i32 4, i32* %138
%139 = load i32**, i32*** %2
%140 = call i32 (i32, i32**, i32, i32, i32*, ...) bitcast (i32 (...)* @findMinHeightTrees to i32 (i32, i32**, i32, i32, i32*, ...)*)(i32 6, i32** %139, i32 5, i32 2, i32* %3)
%141 = sext i32 %140 to i64
%142 = inttoptr i64 %141 to i32*
store i32* %142, i32** %4
store i32 0, i32* %5
br label %143
143: ; preds = %154, %98
%144 = load i32, i32* %5
%145 = load i32, i32* %3
%146 = icmp slt i32 %144, %145
br i1 %146, label %147, label %157
147: ; preds = %143
%148 = load i32*, i32** %4
%149 = load i32, i32* %5
%150 = sext i32 %149 to i64
%151 = getelementptr inbounds i32, i32* %148, i64 %150
%152 = load i32, i32* %151
%153 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0), i32 %152)
br label %154
154: ; preds = %147
%155 = load i32, i32* %5
%156 = add nsw i32 %155, 1
store i32 %156, i32* %5
br label %143
157: ; preds = %143
store i32 0, i32* %5
br label %158
158: ; preds = %168, %157
%159 = load i32, i32* %5
%160 = icmp slt i32 %159, 5
br i1 %160, label %161, label %171
161: ; preds = %158
%162 = load i32**, i32*** %2
%163 = load i32, i32* %5
%164 = sext i32 %163 to i64
%165 = getelementptr inbounds i32*, i32** %162, i64 %164
%166 = load i32*, i32** %165
%167 = bitcast i32* %166 to i8*
br label %168
168: ; preds = %161
%169 = load i32, i32* %5
%170 = add nsw i32 %169, 1
store i32 %170, i32* %5
br label %158
171: ; preds = %158
%172 = load i32**, i32*** %2
%173 = bitcast i32** %172 to i8*
%174 = load i32*, i32** %4
%175 = bitcast i32* %174 to i8*
%176 = call i8* @malloc(i64 40)
%177 = bitcast i8* %176 to i32**
store i32** %177, i32*** %2
%178 = load i32**, i32*** %2
%179 = call i32 (i32**, ...) bitcast (i32 (...)* @assert to i32 (i32**, ...)*)(i32** %178)
store i32 0, i32* %5
br label %180
180: ; preds = %196, %171
%181 = load i32, i32* %5
%182 = icmp slt i32 %181, 5
br i1 %182, label %183, label %199
183: ; preds = %180
%184 = call i8* @malloc(i64 8)
%185 = bitcast i8* %184 to i32*
%186 = load i32**, i32*** %2
%187 = load i32, i32* %5
%188 = sext i32 %187 to i64
%189 = getelementptr inbounds i32*, i32** %186, i64 %188
store i32* %185, i32** %189
%190 = load i32**, i32*** %2
%191 = load i32, i32* %5
%192 = sext i32 %191 to i64
%193 = getelementptr inbounds i32*, i32** %190, i64 %192
%194 = load i32*, i32** %193
%195 = call i32 (i32*, ...) bitcast (i32 (...)* @assert to i32 (i32*, ...)*)(i32* %194)
br label %196
196: ; preds = %183
%197 = load i32, i32* %5
%198 = add nsw i32 %197, 1
store i32 %198, i32* %5
br label %180
199: ; preds = %180
%200 = load i32**, i32*** %2
%201 = getelementptr inbounds i32*, i32** %200, i64 0
%202 = load i32*, i32** %201
%203 = getelementptr inbounds i32, i32* %202, i64 0
store i32 3, i32* %203
%204 = load i32**, i32*** %2
%205 = getelementptr inbounds i32*, i32** %204, i64 0
%206 = load i32*, i32** %205
%207 = getelementptr inbounds i32, i32* %206, i64 1
store i32 0, i32* %207
%208 = load i32**, i32*** %2
%209 = getelementptr inbounds i32*, i32** %208, i64 1
%210 = load i32*, i32** %209
%211 = getelementptr inbounds i32, i32* %210, i64 0
store i32 3, i32* %211
%212 = load i32**, i32*** %2
%213 = getelementptr inbounds i32*, i32** %212, i64 1
%214 = load i32*, i32** %213
%215 = getelementptr inbounds i32, i32* %214, i64 1
store i32 1, i32* %215
%216 = load i32**, i32*** %2
%217 = getelementptr inbounds i32*, i32** %216, i64 2
%218 = load i32*, i32** %217
%219 = getelementptr inbounds i32, i32* %218, i64 0
store i32 3, i32* %219
%220 = load i32**, i32*** %2
%221 = getelementptr inbounds i32*, i32** %220, i64 2
%222 = load i32*, i32** %221
%223 = getelementptr inbounds i32, i32* %222, i64 1
store i32 2, i32* %223
%224 = load i32**, i32*** %2
%225 = getelementptr inbounds i32*, i32** %224, i64 3
%226 = load i32*, i32** %225
%227 = getelementptr inbounds i32, i32* %226, i64 0
store i32 3, i32* %227
%228 = load i32**, i32*** %2
%229 = getelementptr inbounds i32*, i32** %228, i64 3
%230 = load i32*, i32** %229
%231 = getelementptr inbounds i32, i32* %230, i64 1
store i32 4, i32* %231
%232 = load i32**, i32*** %2
%233 = getelementptr inbounds i32*, i32** %232, i64 4
%234 = load i32*, i32** %233
%235 = getelementptr inbounds i32, i32* %234, i64 0
store i32 5, i32* %235
%236 = load i32**, i32*** %2
%237 = getelementptr inbounds i32*, i32** %236, i64 4
%238 = load i32*, i32** %237
%239 = getelementptr inbounds i32, i32* %238, i64 1
store i32 4, i32* %239
%240 = load i32**, i32*** %2
%241 = call i32 (i32, i32**, i32, i32, i32*, ...) bitcast (i32 (...)* @findMinHeightTrees to i32 (i32, i32**, i32, i32, i32*, ...)*)(i32 6, i32** %240, i32 5, i32 2, i32* %3)
%242 = sext i32 %241 to i64
%243 = inttoptr i64 %242 to i32*
store i32* %243, i32** %4
store i32 0, i32* %5
br label %244
244: ; preds = %255, %199
%245 = load i32, i32* %5
%246 = load i32, i32* %3
%247 = icmp slt i32 %245, %246
br i1 %247, label %248, label %258
248: ; preds = %244
%249 = load i32*, i32** %4
%250 = load i32, i32* %5
%251 = sext i32 %250 to i64
%252 = getelementptr inbounds i32, i32* %249, i64 %251
%253 = load i32, i32* %252
%254 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0), i32 %253)
br label %255
255: ; preds = %248
%256 = load i32, i32* %5
%257 = add nsw i32 %256, 1
store i32 %257, i32* %5
br label %244
258: ; preds = %244
store i32 0, i32* %5
br label %259
259: ; preds = %269, %258
%260 = load i32, i32* %5
%261 = icmp slt i32 %260, 5
br i1 %261, label %262, label %272
262: ; preds = %259
%263 = load i32**, i32*** %2
%264 = load i32, i32* %5
%265 = sext i32 %264 to i64
%266 = getelementptr inbounds i32*, i32** %263, i64 %265
%267 = load i32*, i32** %266
%268 = bitcast i32* %267 to i8*
br label %269
269: ; preds = %262
%270 = load i32, i32* %5
%271 = add nsw i32 %270, 1
store i32 %271, i32* %5
br label %259
272: ; preds = %259
%273 = load i32**, i32*** %2
%274 = bitcast i32** %273 to i8*
%275 = load i32*, i32** %4
%276 = bitcast i32* %275 to i8*
%277 = load i32, i32* %1
ret i32 %277
}

LLVM IR (-O2):
@.str = [8 x i8] c"Ans %d\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = bitcast i32* %1 to i8*
%3 = tail call dereferenceable_or_null(24) i8* @malloc(i64 24)
%4 = bitcast i8* %3 to i32**
%5 = tail call dereferenceable_or_null(8) i8* @malloc(i64 8)
%6 = bitcast i8* %3 to i8**
store i8* %5, i8** %6
%7 = tail call dereferenceable_or_null(8) i8* @malloc(i64 8)
%8 = getelementptr inbounds i32*, i32** %4, i64 1
%9 = bitcast i32** %8 to i8**
store i8* %7, i8** %9
%10 = tail call dereferenceable_or_null(8) i8* @malloc(i64 8)
%11 = getelementptr inbounds i32*, i32** %4, i64 2
%12 = bitcast i32** %11 to i8**
store i8* %10, i8** %12
%13 = bitcast i8* %5 to i32*
store i32 1, i32* %13
%14 = getelementptr inbounds i32, i32* %13, i64 1
store i32 0, i32* %14
%15 = bitcast i8* %7 to i32*
store i32 1, i32* %15
%16 = getelementptr inbounds i32, i32* %15, i64 1
store i32 2, i32* %16
%17 = bitcast i8* %10 to i32*
store i32 1, i32* %17
%18 = getelementptr inbounds i32, i32* %17, i64 1
store i32 3, i32* %18
%19 = call i32 (i32, i32**, i32, i32, i32*, ...) bitcast (i32 (...)* @findMinHeightTrees to i32 (i32, i32**, i32, i32, i32*, ...)*)(i32 4, i32** %4, i32 3, i32 2, i32* %1)
%20 = sext i32 %19 to i64
%21 = inttoptr i64 %20 to i32*
%22 = load i32, i32* %1
%23 = icmp sgt i32 %22, 0
br i1 %23, label %60, label %24
24: ; preds = %60, %0
%25 = load i8*, i8** %6
%26 = load i8*, i8** %9
%27 = load i8*, i8** %12
%28 = inttoptr i64 %20 to i8*
%29 = call dereferenceable_or_null(40) i8* @malloc(i64 40)
%30 = bitcast i8* %29 to i32**
%31 = call dereferenceable_or_null(8) i8* @malloc(i64 8)
%32 = bitcast i8* %29 to i8**
store i8* %31, i8** %32
%33 = call dereferenceable_or_null(8) i8* @malloc(i64 8)
%34 = getelementptr inbounds i32*, i32** %30, i64 1
%35 = bitcast i32** %34 to i8**
store i8* %33, i8** %35
%36 = call dereferenceable_or_null(8) i8* @malloc(i64 8)
%37 = getelementptr inbounds i32*, i32** %30, i64 2
%38 = bitcast i32** %37 to i8**
store i8* %36, i8** %38
%39 = call dereferenceable_or_null(8) i8* @malloc(i64 8)
%40 = getelementptr inbounds i32*, i32** %30, i64 3
%41 = bitcast i32** %40 to i8**
store i8* %39, i8** %41
%42 = call dereferenceable_or_null(8) i8* @malloc(i64 8)
%43 = getelementptr inbounds i32*, i32** %30, i64 4
%44 = bitcast i32** %43 to i8**
store i8* %42, i8** %44
%45 = bitcast i8* %31 to i32*
store i32 0, i32* %45
%46 = getelementptr inbounds i32, i32* %45, i64 1
store i32 3, i32* %46
%47 = bitcast i8* %33 to i32*
store i32 1, i32* %47
%48 = getelementptr inbounds i32, i32* %47, i64 1
store i32 3, i32* %48
%49 = bitcast i8* %36 to i32*
store i32 2, i32* %49
%50 = getelementptr inbounds i32, i32* %49, i64 1
store i32 3, i32* %50
%51 = bitcast i8* %39 to i32*
store i32 4, i32* %51
%52 = getelementptr inbounds i32, i32* %51, i64 1
store i32 3, i32* %52
%53 = bitcast i8* %42 to i32*
store i32 5, i32* %53
%54 = getelementptr inbounds i32, i32* %53, i64 1
store i32 4, i32* %54
%55 = call i32 (i32, i32**, i32, i32, i32*, ...) bitcast (i32 (...)* @findMinHeightTrees to i32 (i32, i32**, i32, i32, i32*, ...)*)(i32 6, i32** %30, i32 5, i32 2, i32* %1)
%56 = sext i32 %55 to i64
%57 = inttoptr i64 %56 to i32*
%58 = load i32, i32* %1
%59 = icmp sgt i32 %58, 0
br i1 %59, label %118, label %69
60: ; preds = %0, %60
%61 = phi i64 [ %65, %60 ], [ 0, %0 ]
%62 = getelementptr inbounds i32, i32* %21, i64 %61
%63 = load i32, i32* %62
%64 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0), i32 %63)
%65 = add nuw nsw i64 %61, 1
%66 = load i32, i32* %1
%67 = sext i32 %66 to i64
%68 = icmp slt i64 %65, %67
br i1 %68, label %60, label %24
69: ; preds = %118, %24
%70 = load i8*, i8** %32
%71 = load i8*, i8** %35
%72 = load i8*, i8** %38
%73 = load i8*, i8** %41
%74 = load i8*, i8** %44
%75 = inttoptr i64 %56 to i8*
%76 = call dereferenceable_or_null(40) i8* @malloc(i64 40)
%77 = bitcast i8* %76 to i32**
%78 = call i32 (i32**, ...) bitcast (i32 (...)* @assert to i32 (i32**, ...)*)(i32** %77)
%79 = call dereferenceable_or_null(8) i8* @malloc(i64 8)
%80 = bitcast i8* %79 to i32*
%81 = bitcast i8* %76 to i8**
store i8* %79, i8** %81
%82 = call i32 (i32*, ...) bitcast (i32 (...)* @assert to i32 (i32*, ...)*)(i32* %80)
%83 = call dereferenceable_or_null(8) i8* @malloc(i64 8)
%84 = bitcast i8* %83 to i32*
%85 = getelementptr inbounds i32*, i32** %77, i64 1
%86 = bitcast i32** %85 to i8**
store i8* %83, i8** %86
%87 = call i32 (i32*, ...) bitcast (i32 (...)* @assert to i32 (i32*, ...)*)(i32* %84)
%88 = call dereferenceable_or_null(8) i8* @malloc(i64 8)
%89 = bitcast i8* %88 to i32*
%90 = getelementptr inbounds i32*, i32** %77, i64 2
%91 = bitcast i32** %90 to i8**
store i8* %88, i8** %91
%92 = call i32 (i32*, ...) bitcast (i32 (...)* @assert to i32 (i32*, ...)*)(i32* %89)
%93 = call dereferenceable_or_null(8) i8* @malloc(i64 8)
%94 = bitcast i8* %93 to i32*
%95 = getelementptr inbounds i32*, i32** %77, i64 3
%96 = bitcast i32** %95 to i8**
store i8* %93, i8** %96
%97 = call i32 (i32*, ...) bitcast (i32 (...)* @assert to i32 (i32*, ...)*)(i32* %94)
%98 = call dereferenceable_or_null(8) i8* @malloc(i64 8)
%99 = bitcast i8* %98 to i32*
%100 = getelementptr inbounds i32*, i32** %77, i64 4
%101 = bitcast i32** %100 to i8**
store i8* %98, i8** %101
%102 = call i32 (i32*, ...) bitcast (i32 (...)* @assert to i32 (i32*, ...)*)(i32* %99)
%103 = load i32*, i32** %77
store i32 3, i32* %103
%104 = getelementptr inbounds i32, i32* %103, i64 1
store i32 0, i32* %104
%105 = load i32*, i32** %85
store i32 3, i32* %105
%106 = getelementptr inbounds i32, i32* %105, i64 1
store i32 1, i32* %106
%107 = load i32*, i32** %90
store i32 3, i32* %107
%108 = getelementptr inbounds i32, i32* %107, i64 1
store i32 2, i32* %108
%109 = load i32*, i32** %95
store i32 3, i32* %109
%110 = getelementptr inbounds i32, i32* %109, i64 1
store i32 4, i32* %110
%111 = load i32*, i32** %100
store i32 5, i32* %111
%112 = getelementptr inbounds i32, i32* %111, i64 1
store i32 4, i32* %112
%113 = call i32 (i32, i32**, i32, i32, i32*, ...) bitcast (i32 (...)* @findMinHeightTrees to i32 (i32, i32**, i32, i32, i32*, ...)*)(i32 6, i32** %77, i32 5, i32 2, i32* %1)
%114 = sext i32 %113 to i64
%115 = inttoptr i64 %114 to i32*
%116 = load i32, i32* %1
%117 = icmp sgt i32 %116, 0
br i1 %117, label %134, label %127
118: ; preds = %24, %118
%119 = phi i64 [ %123, %118 ], [ 0, %24 ]
%120 = getelementptr inbounds i32, i32* %57, i64 %119
%121 = load i32, i32* %120
%122 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0), i32 %121)
%123 = add nuw nsw i64 %119, 1
%124 = load i32, i32* %1
%125 = sext i32 %124 to i64
%126 = icmp slt i64 %123, %125
br i1 %126, label %118, label %69
127: ; preds = %134, %69
%128 = load i8*, i8** %81
%129 = load i8*, i8** %86
%130 = load i8*, i8** %91
%131 = load i8*, i8** %96
%132 = load i8*, i8** %101
%133 = inttoptr i64 %114 to i8*
ret i32 0
134: ; preds = %69, %134
%135 = phi i64 [ %139, %134 ], [ 0, %69 ]
%136 = getelementptr inbounds i32, i32* %115, i64 %135
%137 = load i32, i32* %136
%138 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0), i32 %137)
%139 = add nuw nsw i64 %135, 1
%140 = load i32, i32* %1
%141 = sext i32 %140 to i64
%142 = icmp slt i64 %139, %141
br i1 %142, label %134, label %127
}