#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 TreeNode {
  int dummy;
};
typedef int /*<<< orphan*/ preorder;
typedef int /*<<< orphan*/ inorder;

/* Variables and functions */
struct TreeNode *buildTree(int *, int, int *, int);
int /*<<< orphan*/ dump(struct TreeNode *);
int /*<<< orphan*/ printf(char *);
int main(void) {
  int preorder[] = {7, -10, -4, 3, -1, 2, -8, 11};
  int inorder[] = {-4, -10, 3, -1, 7, 11, -8, 2};
  int pre_size = sizeof(preorder) / sizeof(*preorder);
  int in_size = sizeof(inorder) / sizeof(*inorder);
  struct TreeNode *root = buildTree(preorder, pre_size, inorder, in_size);
  dump(root);
  printf("\n");
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x60,%rsp
movl   $0x0,-0x4(%rbp)
mov    0xeba(%rip),%rax
mov    %rax,-0x30(%rbp)
mov    0xeb7(%rip),%rax
mov    %rax,-0x28(%rbp)
mov    0xeb4(%rip),%rax
mov    %rax,-0x20(%rbp)
mov    0xeb1(%rip),%rax
mov    %rax,-0x18(%rbp)
mov    0xeae(%rip),%rax
mov    %rax,-0x50(%rbp)
mov    0xeab(%rip),%rax
mov    %rax,-0x48(%rbp)
mov    0xea8(%rip),%rax
mov    %rax,-0x40(%rbp)
mov    0xea5(%rip),%rax
mov    %rax,-0x38(%rbp)
movl   $0x8,-0x54(%rbp)
movl   $0x8,-0x58(%rbp)
lea    -0x30(%rbp),%rdi
mov    -0x54(%rbp),%esi
lea    -0x50(%rbp),%rdx
mov    -0x58(%rbp),%ecx
call   1050 <buildTree@plt>
mov    %rax,-0x60(%rbp)
mov    -0x60(%rbp),%rdi
call   1040 <dump@plt>
lea    0xe74(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x60,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
sub    $0x48,%rsp
movaps 0xed5(%rip),%xmm0
movaps %xmm0,0x30(%rsp)
movaps 0xeb9(%rip),%xmm0
movaps %xmm0,0x20(%rsp)
movaps 0xedd(%rip),%xmm0
movaps %xmm0,0x10(%rsp)
movaps 0xec1(%rip),%xmm0
movaps %xmm0,(%rsp)
lea    0x20(%rsp),%rdi
mov    %rsp,%rdx
mov    $0x8,%esi
mov    $0x8,%ecx
call   1050 <buildTree@plt>
mov    %rax,%rdi
call   1040 <dump@plt>
mov    $0xa,%edi
call   1030 <putchar@plt>
xor    %eax,%eax
add    $0x48,%rsp
ret

LLVM IR (-O0):
%struct.TreeNode = type { i32 }
@__const.main.preorder = [8 x i32] [i32 7, i32 -10, i32 -4, i32 3, i32 -1, i32 2, i32 -8, i32 11]
@__const.main.inorder = [8 x i32] [i32 -4, i32 -10, i32 3, i32 -1, i32 7, i32 11, i32 -8, i32 2]
@.str = [2 x i8] c"\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [8 x i32]
%3 = alloca [8 x i32]
%4 = alloca i32
%5 = alloca i32
%6 = alloca %struct.TreeNode*
store i32 0, i32* %1
%7 = bitcast [8 x i32]* %2 to i8*
%8 = bitcast [8 x i32]* %3 to i8*
store i32 8, i32* %4
store i32 8, i32* %5
%9 = getelementptr inbounds [8 x i32], [8 x i32]* %2, i64 0, i64 0
%10 = load i32, i32* %4
%11 = getelementptr inbounds [8 x i32], [8 x i32]* %3, i64 0, i64 0
%12 = load i32, i32* %5
%13 = call %struct.TreeNode* @buildTree(i32* %9, i32 %10, i32* %11, i32 %12)
store %struct.TreeNode* %13, %struct.TreeNode** %6
%14 = load %struct.TreeNode*, %struct.TreeNode** %6
%15 = call i32 @dump(%struct.TreeNode* %14)
%16 = call i32 @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
ret i32 0
}

LLVM IR (-O2):
%struct.TreeNode = type { i32 }
@__const.main.preorder = [8 x i32] [i32 7, i32 -10, i32 -4, i32 3, i32 -1, i32 2, i32 -8, i32 11]
@__const.main.inorder = [8 x i32] [i32 -4, i32 -10, i32 3, i32 -1, i32 7, i32 11, i32 -8, i32 2]
define i32 @main() {
%1 = alloca [8 x i32]
%2 = alloca [8 x i32]
%3 = bitcast [8 x i32]* %1 to i8*
%4 = bitcast [8 x i32]* %2 to i8*
%5 = getelementptr inbounds [8 x i32], [8 x i32]* %1, i64 0, i64 0
%6 = getelementptr inbounds [8 x i32], [8 x i32]* %2, i64 0, i64 0
%7 = call %struct.TreeNode* @buildTree(i32* %5, i32 8, i32* %6, i32 8)
%8 = call i32 @dump(%struct.TreeNode* %7)
%9 = call i32 @putchar(i32 10)
ret i32 0
}