#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 Node {
  int dummy;
};
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
struct Node *createTree(int, char **, int *);
int /*<<< orphan*/ fclose(int /*<<< orphan*/ *);
int findLargestBST(struct Node *);
int /*<<< orphan*/ *fopen(int /*<<< orphan*/, char *);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/ *, char *, int);
int /*<<< orphan*/ getenv(char *);
scalar_t__ malloc(int);
int /*<<< orphan*/ scanf(char *, ...);
int main() {
  FILE *f = fopen(getenv("OUTPUT_PATH"), "w");
  int res;
  int _strArr_size = 0;
  int _strArr_i;
  scanf("%d\n", &_strArr_size);
  char *_strArr[_strArr_size];
  for (_strArr_i = 0; _strArr_i < _strArr_size; _strArr_i++) {
    char *_strArr_item;
    _strArr_item = (char *)malloc(10240 * sizeof(char));
    scanf("%s", _strArr_item);
    _strArr[_strArr_i] = _strArr_item;
  }
  int res_size = 0;
  struct Node *n = createTree(_strArr_size, _strArr, &res_size);
  res = findLargestBST(n);
  fprintf(f, "%d\n", res);
  fclose(f);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x50,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xe6a(%rip),%rdi
call   1030 <getenv@plt>
mov    %eax,%edi
lea    0xe68(%rip),%rsi
call   10a0 <fopen@plt>
mov    %rax,-0x10(%rbp)
movl   $0x0,-0x18(%rbp)
lea    0xe53(%rip),%rdi
xor    %eax,%eax
lea    -0x18(%rbp),%rsi
call   1080 <scanf@plt>
mov    -0x18(%rbp),%eax
mov    %rsp,%rcx
mov    %rcx,-0x28(%rbp)
lea    0xf(,%rax,8),%rdx
and    $0xfffffffffffffff0,%rdx
mov    %rsp,%rcx
sub    %rdx,%rcx
mov    %rcx,-0x50(%rbp)
mov    %rcx,%rsp
mov    %rax,-0x30(%rbp)
movl   $0x0,-0x1c(%rbp)
mov    -0x1c(%rbp),%eax
cmp    -0x18(%rbp),%eax
jge    123e <main+0xbe>
mov    $0x2800,%edi
call   1070 <malloc@plt>
mov    %rax,-0x38(%rbp)
mov    -0x38(%rbp),%rsi
lea    0xdf9(%rip),%rdi
mov    $0x0,%al
call   1080 <scanf@plt>
mov    -0x50(%rbp),%rax
mov    -0x38(%rbp),%rdx
movslq -0x1c(%rbp),%rcx
mov    %rdx,(%rax,%rcx,8)
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
jmp    11f4 <main+0x74>
mov    -0x50(%rbp),%rsi
movl   $0x0,-0x3c(%rbp)
mov    -0x18(%rbp),%edi
lea    -0x3c(%rbp),%rdx
call   1040 <createTree@plt>
mov    %rax,-0x48(%rbp)
mov    -0x48(%rbp),%rdi
call   1090 <findLargestBST@plt>
mov    %eax,-0x14(%rbp)
mov    -0x10(%rbp),%rdi
mov    -0x14(%rbp),%edx
lea    0xd9b(%rip),%rsi
call   1060 <fprintf@plt>
mov    -0x10(%rbp),%rdi
call   1050 <fclose@plt>
movl   $0x0,-0x4(%rbp)
mov    -0x28(%rbp),%rax
mov    %rax,%rsp
mov    -0x4(%rbp),%eax
mov    %rbp,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
mov    %rsp,%rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x18,%rsp
lea    0xe68(%rip),%rdi
call   1030 <getenv@plt>
lea    0xe68(%rip),%rsi
mov    %eax,%edi
call   10a0 <fopen@plt>
mov    %rax,%r14
movl   $0x0,-0x2c(%rbp)
lea    0xe52(%rip),%rdi
lea    -0x2c(%rbp),%rsi
xor    %eax,%eax
call   1080 <scanf@plt>
mov    %rsp,%rbx
mov    -0x2c(%rbp),%eax
mov    %rsp,%r12
lea    0xf(,%rax,8),%rax
and    $0xfffffffffffffff0,%rax
sub    %rax,%r12
mov    %r12,%rsp
mov    -0x2c(%rbp),%edi
test   %edi,%edi
jle    122f <main+0xaf>
mov    %rbx,-0x38(%rbp)
lea    0xe1e(%rip),%r15
xor    %r13d,%r13d
nopw   0x0(%rax,%rax,1)
mov    $0x2800,%edi
call   1070 <malloc@plt>
mov    %rax,%rbx
mov    %r15,%rdi
mov    %rax,%rsi
xor    %eax,%eax
call   1080 <scanf@plt>
mov    %rbx,(%r12,%r13,8)
add    $0x1,%r13
movslq -0x2c(%rbp),%rdi
cmp    %rdi,%r13
jl     1200 <main+0x80>
mov    -0x38(%rbp),%rbx
movl   $0x0,-0x30(%rbp)
lea    -0x30(%rbp),%rdx
mov    %r12,%rsi
call   1040 <createTree@plt>
mov    %rax,%rdi
call   1090 <findLargestBST@plt>
lea    0xdbd(%rip),%rsi
mov    %r14,%rdi
mov    %eax,%edx
call   1060 <fprintf@plt>
mov    %r14,%rdi
call   1050 <fclose@plt>
mov    %rbx,%rsp
xor    %eax,%eax
lea    -0x28(%rbp),%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
%struct.Node = type { i32 }
@.str = [12 x i8] c"OUTPUT_PATH\00"
@.str.1 = [2 x i8] c"w\00"
@.str.2 = [4 x i8] c"%d\0A\00"
@.str.3 = [3 x i8] c"%s\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32*
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
%6 = alloca i8*
%7 = alloca i64
%8 = alloca i8*
%9 = alloca i32
%10 = alloca %struct.Node*
store i32 0, i32* %1
%11 = call i32 @getenv(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0))
%12 = call i32* @fopen(i32 %11, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
store i32* %12, i32** %2
store i32 0, i32* %4
%13 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0), i32* %4)
%14 = load i32, i32* %4
%15 = zext i32 %14 to i64
%16 = call i8* @llvm.stacksave()
store i8* %16, i8** %6
%17 = alloca i8*, i64 %15
store i64 %15, i64* %7
store i32 0, i32* %5
br label %18
18: ; preds = %31, %0
%19 = load i32, i32* %5
%20 = load i32, i32* %4
%21 = icmp slt i32 %19, %20
br i1 %21, label %22, label %34
22: ; preds = %18
%23 = call i64 @malloc(i32 10240)
%24 = inttoptr i64 %23 to i8*
store i8* %24, i8** %8
%25 = load i8*, i8** %8
%26 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0), i8* %25)
%27 = load i8*, i8** %8
%28 = load i32, i32* %5
%29 = sext i32 %28 to i64
%30 = getelementptr inbounds i8*, i8** %17, i64 %29
store i8* %27, i8** %30
br label %31
31: ; preds = %22
%32 = load i32, i32* %5
%33 = add nsw i32 %32, 1
store i32 %33, i32* %5
br label %18
34: ; preds = %18
store i32 0, i32* %9
%35 = load i32, i32* %4
%36 = call %struct.Node* @createTree(i32 %35, i8** %17, i32* %9)
store %struct.Node* %36, %struct.Node** %10
%37 = load %struct.Node*, %struct.Node** %10
%38 = call i32 @findLargestBST(%struct.Node* %37)
store i32 %38, i32* %3
%39 = load i32*, i32** %2
%40 = load i32, i32* %3
%41 = call i32 @fprintf(i32* %39, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0), i32 %40)
%42 = load i32*, i32** %2
%43 = call i32 @fclose(i32* %42)
store i32 0, i32* %1
%44 = load i8*, i8** %6
%45 = load i32, i32* %1
ret i32 %45
}

LLVM IR (-O2):
%struct.Node = type { i32 }
@.str = [12 x i8] c"OUTPUT_PATH\00"
@.str.1 = [2 x i8] c"w\00"
@.str.2 = [4 x i8] c"%d\0A\00"
@.str.3 = [3 x i8] c"%s\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = tail call i32 @getenv(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0))
%4 = tail call i32* @fopen(i32 %3, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
%5 = bitcast i32* %1 to i8*
store i32 0, i32* %1
%6 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0), i32* %1)
%7 = load i32, i32* %1
%8 = zext i32 %7 to i64
%9 = call i8* @llvm.stacksave()
%10 = alloca i8*, i64 %8
%11 = load i32, i32* %1
%12 = icmp sgt i32 %11, 0
br i1 %12, label %13, label %23
13: ; preds = %0, %13
%14 = phi i64 [ %19, %13 ], [ 0, %0 ]
%15 = call i64 @malloc(i32 10240)
%16 = inttoptr i64 %15 to i8*
%17 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0), i8* %16)
%18 = getelementptr inbounds i8*, i8** %10, i64 %14
store i8* %16, i8** %18
%19 = add nuw nsw i64 %14, 1
%20 = load i32, i32* %1
%21 = sext i32 %20 to i64
%22 = icmp slt i64 %19, %21
br i1 %22, label %13, label %23
23: ; preds = %13, %0
%24 = phi i32 [ %11, %0 ], [ %20, %13 ]
%25 = bitcast i32* %2 to i8*
store i32 0, i32* %2
%26 = call %struct.Node* @createTree(i32 %24, i8** %10, i32* %2)
%27 = call i32 @findLargestBST(%struct.Node* %26)
%28 = call i32 @fprintf(i32* %4, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0), i32 %27)
%29 = call i32 @fclose(i32* %4)
ret i32 0
}