#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 *);
scalar_t__ malloc(int);
struct Node *mergeTrees(struct Node *, struct Node *);
int /*<<< orphan*/ printInorder(struct Node *);
int /*<<< orphan*/ scanf(char *, ...);
int main() {
  int _str_size1 = 0;
  int _str_i;
  scanf("%d\n", &_str_size1);
  char *_str1[_str_size1];
  for (_str_i = 0; _str_i < _str_size1; _str_i++) {
    char *_str_item;
    _str_item = (char *)malloc(10240 * sizeof(char));
    scanf("%s", _str_item);
    _str1[_str_i] = _str_item;
  }
  int res_size = 0;
  struct Node *n1 = createTree(_str_size1, _str1, &res_size);
  int _str_size2 = 0;
  scanf("%d\n", &_str_size2);
  char *_str2[_str_size2];
  for (_str_i = 0; _str_i < _str_size2; _str_i++) {
    char *_str_item;
    _str_item = (char *)malloc(10240 * sizeof(char));
    scanf("%s", _str_item);
    _str2[_str_i] = _str_item;
  }
  int res_size2 = 0;
  struct Node *n2 = createTree(_str_size2, _str2, &res_size2);
  struct Node *res = mergeTrees(n1, n2);
  printInorder(res);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x80,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0x8(%rbp)
lea    0xe90(%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,-0x70(%rbp)
mov    %rcx,%rsp
mov    %rax,-0x20(%rbp)
movl   $0x0,-0xc(%rbp)
mov    -0xc(%rbp),%eax
cmp    -0x8(%rbp),%eax
jge    11f3 <main+0xa3>
mov    $0x2800,%edi
call   1060 <malloc@plt>
mov    %rax,-0x28(%rbp)
mov    -0x28(%rbp),%rsi
lea    0xe36(%rip),%rdi
mov    $0x0,%al
call   1070 <scanf@plt>
mov    -0x70(%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    11a9 <main+0x59>
mov    -0x70(%rbp),%rsi
movl   $0x0,-0x2c(%rbp)
mov    -0x8(%rbp),%edi
lea    -0x2c(%rbp),%rdx
call   1030 <createTree@plt>
mov    %rax,-0x38(%rbp)
movl   $0x0,-0x3c(%rbp)
lea    0xde4(%rip),%rdi
xor    %eax,%eax
lea    -0x3c(%rbp),%rsi
call   1070 <scanf@plt>
mov    -0x3c(%rbp),%eax
lea    0xf(,%rax,8),%rdx
and    $0xfffffffffffffff0,%rdx
mov    %rsp,%rcx
sub    %rdx,%rcx
mov    %rcx,-0x78(%rbp)
mov    %rcx,%rsp
mov    %rax,-0x48(%rbp)
movl   $0x0,-0xc(%rbp)
mov    -0xc(%rbp),%eax
cmp    -0x3c(%rbp),%eax
jge    1298 <main+0x148>
mov    $0x2800,%edi
call   1060 <malloc@plt>
mov    %rax,-0x50(%rbp)
mov    -0x50(%rbp),%rsi
lea    0xd91(%rip),%rdi
mov    $0x0,%al
call   1070 <scanf@plt>
mov    -0x78(%rbp),%rax
mov    -0x50(%rbp),%rdx
movslq -0xc(%rbp),%rcx
mov    %rdx,(%rax,%rcx,8)
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    124e <main+0xfe>
mov    -0x78(%rbp),%rsi
movl   $0x0,-0x54(%rbp)
mov    -0x3c(%rbp),%edi
lea    -0x54(%rbp),%rdx
call   1030 <createTree@plt>
mov    %rax,-0x60(%rbp)
mov    -0x38(%rbp),%rdi
mov    -0x60(%rbp),%rsi
call   1040 <mergeTrees@plt>
mov    %rax,-0x68(%rbp)
mov    -0x68(%rbp),%rdi
call   1050 <printInorder@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,-0x2c(%rbp)
lea    0xe91(%rip),%rdi
lea    -0x2c(%rbp),%rsi
xor    %eax,%eax
call   1070 <scanf@plt>
mov    %rsp,%r13
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    0xe61(%rip),%r14
xor    %ebx,%ebx
cs nopw 0x0(%rax,%rax,1)
nop
mov    $0x2800,%edi
call   1060 <malloc@plt>
mov    %rax,%r12
mov    %r14,%rdi
mov    %rax,%rsi
xor    %eax,%eax
call   1070 <scanf@plt>
mov    %r12,(%r15,%rbx,8)
add    $0x1,%rbx
movslq -0x2c(%rbp),%rdi
cmp    %rdi,%rbx
jl     11b0 <main+0x60>
movl   $0x0,-0x38(%rbp)
lea    -0x38(%rbp),%rdx
mov    %r15,%rsi
call   1030 <createTree@plt>
mov    %rax,%rbx
movl   $0x0,-0x30(%rbp)
lea    0xe01(%rip),%rdi
lea    -0x30(%rbp),%rsi
xor    %eax,%eax
call   1070 <scanf@plt>
mov    -0x30(%rbp),%edi
mov    %rsp,%r12
lea    0xf(,%rdi,8),%rax
and    $0xfffffffffffffff0,%rax
sub    %rax,%r12
mov    %r12,%rsp
test   %edi,%edi
jle    1272 <main+0x122>
mov    %rbx,-0x40(%rbp)
mov    %r13,%r14
lea    0xdd0(%rip),%r15
xor    %r13d,%r13d
nopw   0x0(%rax,%rax,1)
mov    $0x2800,%edi
call   1060 <malloc@plt>
mov    %rax,%rbx
mov    %r15,%rdi
mov    %rax,%rsi
xor    %eax,%eax
call   1070 <scanf@plt>
mov    %rbx,(%r12,%r13,8)
add    $0x1,%r13
movslq -0x30(%rbp),%rdi
cmp    %rdi,%r13
jl     1240 <main+0xf0>
mov    %r14,%r13
mov    -0x40(%rbp),%rbx
movl   $0x0,-0x34(%rbp)
lea    -0x34(%rbp),%rdx
mov    %r12,%rsi
call   1030 <createTree@plt>
mov    %rbx,%rdi
mov    %rax,%rsi
call   1040 <mergeTrees@plt>
mov    %rax,%rdi
call   1050 <printInorder@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):
%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
%10 = alloca i64
%11 = alloca i8*
%12 = alloca i32
%13 = alloca %struct.Node*
%14 = alloca %struct.Node*
store i32 0, i32* %1
store i32 0, i32* %2
%15 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32* %2)
%16 = load i32, i32* %2
%17 = zext i32 %16 to i64
%18 = call i8* @llvm.stacksave()
store i8* %18, i8** %4
%19 = alloca i8*, i64 %17
store i64 %17, i64* %5
store i32 0, i32* %3
br label %20
20: ; preds = %33, %0
%21 = load i32, i32* %3
%22 = load i32, i32* %2
%23 = icmp slt i32 %21, %22
br i1 %23, label %24, label %36
24: ; preds = %20
%25 = call i64 @malloc(i32 10240)
%26 = inttoptr i64 %25 to i8*
store i8* %26, i8** %6
%27 = load i8*, i8** %6
%28 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i8* %27)
%29 = load i8*, i8** %6
%30 = load i32, i32* %3
%31 = sext i32 %30 to i64
%32 = getelementptr inbounds i8*, i8** %19, i64 %31
store i8* %29, i8** %32
br label %33
33: ; preds = %24
%34 = load i32, i32* %3
%35 = add nsw i32 %34, 1
store i32 %35, i32* %3
br label %20
36: ; preds = %20
store i32 0, i32* %7
%37 = load i32, i32* %2
%38 = call %struct.Node* @createTree(i32 %37, i8** %19, i32* %7)
store %struct.Node* %38, %struct.Node** %8
store i32 0, i32* %9
%39 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32* %9)
%40 = load i32, i32* %9
%41 = zext i32 %40 to i64
%42 = alloca i8*, i64 %41
store i64 %41, i64* %10
store i32 0, i32* %3
br label %43
43: ; preds = %56, %36
%44 = load i32, i32* %3
%45 = load i32, i32* %9
%46 = icmp slt i32 %44, %45
br i1 %46, label %47, label %59
47: ; preds = %43
%48 = call i64 @malloc(i32 10240)
%49 = inttoptr i64 %48 to i8*
store i8* %49, i8** %11
%50 = load i8*, i8** %11
%51 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i8* %50)
%52 = load i8*, i8** %11
%53 = load i32, i32* %3
%54 = sext i32 %53 to i64
%55 = getelementptr inbounds i8*, i8** %42, i64 %54
store i8* %52, i8** %55
br label %56
56: ; preds = %47
%57 = load i32, i32* %3
%58 = add nsw i32 %57, 1
store i32 %58, i32* %3
br label %43
59: ; preds = %43
store i32 0, i32* %12
%60 = load i32, i32* %9
%61 = call %struct.Node* @createTree(i32 %60, i8** %42, i32* %12)
store %struct.Node* %61, %struct.Node** %13
%62 = load %struct.Node*, %struct.Node** %8
%63 = load %struct.Node*, %struct.Node** %13
%64 = call %struct.Node* @mergeTrees(%struct.Node* %62, %struct.Node* %63)
store %struct.Node* %64, %struct.Node** %14
%65 = load %struct.Node*, %struct.Node** %14
%66 = call i32 @printInorder(%struct.Node* %65)
store i32 0, i32* %1
%67 = load i8*, i8** %4
%68 = load i32, i32* %1
ret i32 %68
}

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 = alloca i32
%4 = alloca i32
%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, 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.1, 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 = bitcast i32* %3 to i8*
store i32 0, i32* %3
%28 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32* %3)
%29 = load i32, i32* %3
%30 = zext i32 %29 to i64
%31 = alloca i8*, i64 %30
%32 = icmp sgt i32 %29, 0
br i1 %32, label %33, label %43
33: ; preds = %23, %33
%34 = phi i64 [ %39, %33 ], [ 0, %23 ]
%35 = call i64 @malloc(i32 10240)
%36 = inttoptr i64 %35 to i8*
%37 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i8* %36)
%38 = getelementptr inbounds i8*, i8** %31, i64 %34
store i8* %36, i8** %38
%39 = add nuw nsw i64 %34, 1
%40 = load i32, i32* %3
%41 = sext i32 %40 to i64
%42 = icmp slt i64 %39, %41
br i1 %42, label %33, label %43
43: ; preds = %33, %23
%44 = phi i32 [ %29, %23 ], [ %40, %33 ]
%45 = bitcast i32* %4 to i8*
store i32 0, i32* %4
%46 = call %struct.Node* @createTree(i32 %44, i8** %31, i32* %4)
%47 = call %struct.Node* @mergeTrees(%struct.Node* %26, %struct.Node* %46)
%48 = call i32 @printInorder(%struct.Node* %47)
ret i32 0
}