#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;
};

/* Variables and functions */
struct Node *createTree(int, char **, int *);
int isBST(struct Node *);
scalar_t__ malloc(int);
int /*<<< orphan*/ printf(char *, int);
int /*<<< orphan*/ scanf(char *, ...);
int main() {
  int _str_size = 0;
  int _str_i;
  scanf("%d\n", &_str_size);
  char *_str[_str_size];
  for (_str_i = 0; _str_i < _str_size; _str_i++) {
    char *_str_item;
    _str_item = (char *)malloc(10240 * sizeof(char));
    scanf("%s", _str_item);
    _str[_str_i] = _str_item;
  }
  int res_size = 0;
  struct Node *n = createTree(_str_size, _str, &res_size);
  bool res = isBST(n);
  printf("%d\n", res);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x50,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0x8(%rbp)
lea    0xe93(%rip),%rdi
xor    %eax,%eax
lea    -0x8(%rbp),%rsi
call   1070 <scanf@plt>
mov    -0x8(%rbp),%eax
mov    %rsp,%rcx
mov    %rcx,-0x18(%rbp)
lea    0xf(,%rax,8),%rdx
and    $0xfffffffffffffff0,%rdx
mov    %rsp,%rcx
sub    %rdx,%rcx
mov    %rcx,-0x48(%rbp)
mov    %rcx,%rsp
mov    %rax,-0x20(%rbp)
movl   $0x0,-0xc(%rbp)
mov    -0xc(%rbp),%eax
cmp    -0x8(%rbp),%eax
jge    11f0 <main+0xa0>
mov    $0x2800,%edi
call   1060 <malloc@plt>
mov    %rax,-0x28(%rbp)
mov    -0x28(%rbp),%rsi
lea    0xe39(%rip),%rdi
mov    $0x0,%al
call   1070 <scanf@plt>
mov    -0x48(%rbp),%rax
mov    -0x28(%rbp),%rdx
movslq -0xc(%rbp),%rcx
mov    %rdx,(%rax,%rcx,8)
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    11a6 <main+0x56>
mov    -0x48(%rbp),%rsi
movl   $0x0,-0x2c(%rbp)
mov    -0x8(%rbp),%edi
lea    -0x2c(%rbp),%rdx
call   1030 <createTree@plt>
mov    %rax,-0x38(%rbp)
mov    -0x38(%rbp),%rdi
call   1050 <isBST@plt>
mov    %eax,-0x3c(%rbp)
mov    -0x3c(%rbp),%esi
lea    0xddf(%rip),%rdi
call   1040 <printf@plt>
movl   $0x0,-0x4(%rbp)
mov    -0x18(%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
push   %rax
movl   $0x0,-0x2c(%rbp)
lea    0xe94(%rip),%rdi
lea    -0x2c(%rbp),%rsi
xor    %eax,%eax
call   1070 <scanf@plt>
mov    %rsp,%r12
mov    -0x2c(%rbp),%eax
mov    %rsp,%r15
lea    0xf(,%rax,8),%rax
and    $0xfffffffffffffff0,%rax
sub    %rax,%r15
mov    %r15,%rsp
mov    -0x2c(%rbp),%edi
test   %edi,%edi
jle    11db <main+0x8b>
lea    0xe64(%rip),%r14
xor    %ebx,%ebx
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
mov    $0x2800,%edi
call   1060 <malloc@plt>
mov    %rax,%r13
mov    %r14,%rdi
mov    %rax,%rsi
xor    %eax,%eax
call   1070 <scanf@plt>
mov    %r13,(%r15,%rbx,8)
add    $0x1,%rbx
movslq -0x2c(%rbp),%rdi
cmp    %rdi,%rbx
jl     11b0 <main+0x60>
movl   $0x0,-0x30(%rbp)
lea    -0x30(%rbp),%rdx
mov    %r15,%rsi
call   1030 <createTree@plt>
mov    %rax,%rdi
call   1050 <isBST@plt>
lea    0xe03(%rip),%rdi
mov    %eax,%esi
call   1040 <printf@plt>
mov    %r12,%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 = [4 x i8] c"%d\0A\00"
@.str.1 = [3 x i8] c"%s\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i8*
%5 = alloca i64
%6 = alloca i8*
%7 = alloca i32
%8 = alloca %struct.Node*
%9 = alloca i32
store i32 0, i32* %1
store i32 0, i32* %2
%10 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32* %2)
%11 = load i32, i32* %2
%12 = zext i32 %11 to i64
%13 = call i8* @llvm.stacksave()
store i8* %13, i8** %4
%14 = alloca i8*, i64 %12
store i64 %12, i64* %5
store i32 0, i32* %3
br label %15
15: ; preds = %28, %0
%16 = load i32, i32* %3
%17 = load i32, i32* %2
%18 = icmp slt i32 %16, %17
br i1 %18, label %19, label %31
19: ; preds = %15
%20 = call i64 @malloc(i32 10240)
%21 = inttoptr i64 %20 to i8*
store i8* %21, i8** %6
%22 = load i8*, i8** %6
%23 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i8* %22)
%24 = load i8*, i8** %6
%25 = load i32, i32* %3
%26 = sext i32 %25 to i64
%27 = getelementptr inbounds i8*, i8** %14, i64 %26
store i8* %24, i8** %27
br label %28
28: ; preds = %19
%29 = load i32, i32* %3
%30 = add nsw i32 %29, 1
store i32 %30, i32* %3
br label %15
31: ; preds = %15
store i32 0, i32* %7
%32 = load i32, i32* %2
%33 = call %struct.Node* @createTree(i32 %32, i8** %14, i32* %7)
store %struct.Node* %33, %struct.Node** %8
%34 = load %struct.Node*, %struct.Node** %8
%35 = call i32 @isBST(%struct.Node* %34)
store i32 %35, i32* %9
%36 = load i32, i32* %9
%37 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %36)
store i32 0, i32* %1
%38 = load i8*, i8** %4
%39 = load i32, i32* %1
ret i32 %39
}

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