#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*/ constrctTree(int, int *, int, int *);
int /*<<< orphan*/ scanf(char *, int *);
int main() {
  int _iInOrderArray_size = 0;
  int _iInOrderArray_i;
  scanf("%d\n", &_iInOrderArray_size);
  int _iInOrderArray[_iInOrderArray_size];
  for (_iInOrderArray_i = 0; _iInOrderArray_i < _iInOrderArray_size;
       _iInOrderArray_i++) {
    int _iInOrderArray_item;
    scanf("%d", &_iInOrderArray_item);
    _iInOrderArray[_iInOrderArray_i] = _iInOrderArray_item;
  }
  int _iPreOrderArray_size = 0;
  int _iPreOrderArray_i;
  scanf("%d\n", &_iPreOrderArray_size);
  int _iPreOrderArray[_iPreOrderArray_size];
  for (_iPreOrderArray_i = 0; _iPreOrderArray_i < _iPreOrderArray_size;
       _iPreOrderArray_i++) {
    int _iPreOrderArray_item;
    scanf("%d", &_iPreOrderArray_item);
    _iPreOrderArray[_iPreOrderArray_i] = _iPreOrderArray_item;
  }
  constrctTree(_iInOrderArray_size, _iInOrderArray, _iPreOrderArray_size,
               _iPreOrderArray);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x50,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0x8(%rbp)
lea    0xec3(%rip),%rdi
lea    -0x8(%rbp),%rsi
call   1030 <scanf@plt>
mov    -0x8(%rbp),%eax
mov    %rsp,%rcx
mov    %rcx,-0x18(%rbp)
lea    0xf(,%rax,4),%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    11ac <main+0x8c>
lea    0xe7d(%rip),%rdi
lea    -0x24(%rbp),%rsi
call   1030 <scanf@plt>
mov    -0x48(%rbp),%rax
mov    -0x24(%rbp),%edx
movslq -0xc(%rbp),%rcx
mov    %edx,(%rax,%rcx,4)
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    1174 <main+0x54>
movl   $0x0,-0x28(%rbp)
lea    0xe46(%rip),%rdi
lea    -0x28(%rbp),%rsi
call   1030 <scanf@plt>
mov    -0x28(%rbp),%eax
lea    0xf(,%rax,4),%rdx
and    $0xfffffffffffffff0,%rdx
mov    %rsp,%rcx
sub    %rdx,%rcx
mov    %rcx,-0x50(%rbp)
mov    %rcx,%rsp
mov    %rax,-0x38(%rbp)
movl   $0x0,-0x2c(%rbp)
mov    -0x2c(%rbp),%eax
cmp    -0x28(%rbp),%eax
jge    1222 <main+0x102>
lea    0xe07(%rip),%rdi
lea    -0x3c(%rbp),%rsi
call   1030 <scanf@plt>
mov    -0x50(%rbp),%rax
mov    -0x3c(%rbp),%edx
movslq -0x2c(%rbp),%rcx
mov    %edx,(%rax,%rcx,4)
mov    -0x2c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x2c(%rbp)
jmp    11ea <main+0xca>
mov    -0x50(%rbp),%rcx
mov    -0x48(%rbp),%rsi
mov    -0x8(%rbp),%edi
mov    -0x28(%rbp),%edx
call   1040 <constrctTree@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
sub    $0x18,%rsp
movl   $0x0,-0x30(%rbp)
lea    0xec1(%rip),%rdi
lea    -0x30(%rbp),%rsi
call   1030 <scanf@plt>
mov    %rsp,%r13
mov    -0x30(%rbp),%eax
mov    %rsp,%r14
lea    0xf(,%rax,4),%rax
and    $0xfffffffffffffff0,%rax
sub    %rax,%r14
mov    %r14,%rsp
cmpl   $0x0,-0x30(%rbp)
jle    119f <main+0x7f>
xor    %ebx,%ebx
lea    0xe92(%rip),%r15
lea    -0x2c(%rbp),%r12
cs nopw 0x0(%rax,%rax,1)
mov    %r15,%rdi
mov    %r12,%rsi
call   1030 <scanf@plt>
mov    -0x2c(%rbp),%eax
mov    %eax,(%r14,%rbx,4)
add    $0x1,%rbx
movslq -0x30(%rbp),%rax
cmp    %rax,%rbx
jl     1180 <main+0x60>
movl   $0x0,-0x2c(%rbp)
lea    0xe53(%rip),%rdi
lea    -0x2c(%rbp),%rsi
call   1030 <scanf@plt>
mov    -0x2c(%rbp),%edx
mov    %rsp,%rbx
lea    0xf(,%rdx,4),%rax
and    $0xfffffffffffffff0,%rax
sub    %rax,%rbx
mov    %rbx,%rsp
test   %edx,%edx
jle    1213 <main+0xf3>
mov    %r13,-0x40(%rbp)
xor    %r13d,%r13d
lea    0xe24(%rip),%r15
lea    -0x34(%rbp),%r12
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
mov    %r15,%rdi
mov    %r12,%rsi
call   1030 <scanf@plt>
mov    -0x34(%rbp),%eax
mov    %eax,(%rbx,%r13,4)
add    $0x1,%r13
movslq -0x2c(%rbp),%rdx
cmp    %rdx,%r13
jl     11f0 <main+0xd0>
mov    -0x40(%rbp),%r13
mov    -0x30(%rbp),%edi
mov    %r14,%rsi
mov    %rbx,%rcx
call   1040 <constrctTree@plt>
mov    %r13,%rsp
xor    %eax,%eax
lea    -0x28(%rbp),%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

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

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