#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 */
int /*<<< orphan*/ P(struct TreeNode *);
struct TreeNode *buildTree(int *, int, int *, int);
int /*<<< orphan*/ putchar(char);
int main() {
  int preorder[] = {7, 4, 2, 1, 3, 6, 5, 9, 8, 10};
  int inorder[] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10};
  struct TreeNode *root = buildTree(preorder, sizeof(preorder) / sizeof(int),
                                    inorder, sizeof(inorder) / sizeof(int));
  P(root);
  putchar('\n');
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x70,%rsp
movl   $0x0,-0x4(%rbp)
lea    -0x30(%rbp),%rdi
lea    0xea6(%rip),%rsi
mov    $0x28,%edx
call   1060 <memcpy@plt>
lea    -0x60(%rbp),%rdi
lea    0xec1(%rip),%rsi
mov    $0x28,%edx
call   1060 <memcpy@plt>
lea    -0x30(%rbp),%rdi
lea    -0x60(%rbp),%rdx
mov    $0xa,%ecx
mov    %ecx,%esi
call   1050 <buildTree@plt>
mov    %rax,-0x68(%rbp)
mov    -0x68(%rbp),%rdi
call   1040 <P@plt>
mov    $0xa,%edi
call   1030 <putchar@plt>
xor    %eax,%eax
add    $0x70,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
sub    $0x58,%rsp
mov    0xee5(%rip),%rax
mov    %rax,0x50(%rsp)
movaps 0xec9(%rip),%xmm0
movaps %xmm0,0x40(%rsp)
movaps 0xead(%rip),%xmm0
movaps %xmm0,0x30(%rsp)
mov    0xef1(%rip),%rax
mov    %rax,0x20(%rsp)
movaps 0xed5(%rip),%xmm0
movaps %xmm0,0x10(%rsp)
movaps 0xeb9(%rip),%xmm0
movaps %xmm0,(%rsp)
lea    0x30(%rsp),%rdi
mov    %rsp,%rdx
mov    $0xa,%esi
mov    $0xa,%ecx
call   1050 <buildTree@plt>
mov    %rax,%rdi
call   1040 <P@plt>
mov    $0xa,%edi
call   1030 <putchar@plt>
xor    %eax,%eax
add    $0x58,%rsp
ret

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

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