int main() {
  char data[] = "1,2,3,N,N,4,5,N,N,6,7,N,N,N,N,";
  char *rslt;
  struct TreeNode *root;
  root = deserialize(data);
  printf("\nIn order traversal ...\n");
  inOrder(root);
  rslt = serialize(root);
  printf("Old: %s \n", data);
  printf("New: %s \n", rslt);
  printf("Comparison: %d\n", strcmp(data, rslt));
  root = deserialize("");
  rslt = serialize(root);
  printf("New: %s \n", rslt);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    0xea1(%rip),%rax
mov    %rax,-0x20(%rbp)
mov    0xe9e(%rip),%rax
mov    %rax,-0x18(%rbp)
mov    0xe9b(%rip),%rax
mov    %rax,-0x10(%rbp)
mov    0xe99(%rip),%eax
mov    %eax,-0x8(%rbp)
mov    0xe93(%rip),%ax
mov    %ax,-0x4(%rbp)
mov    0xe8b(%rip),%al
mov    %al,-0x2(%rbp)
lea    -0x20(%rbp),%rdi
mov    $0x0,%al
call   1050 <deserialize@plt>
cltq
mov    %rax,-0x30(%rbp)
lea    0xe71(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x30(%rbp),%rdi
mov    $0x0,%al
call   1070 <inOrder@plt>
mov    -0x30(%rbp),%rdi
mov    $0x0,%al
call   1060 <serialize@plt>
cltq
mov    %rax,-0x28(%rbp)
lea    -0x20(%rbp),%rsi
lea    0xe5c(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x28(%rbp),%rsi
lea    0xe54(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    -0x20(%rbp),%rdi
mov    -0x28(%rbp),%rsi
call   1040 <strcmp@plt>
mov    %eax,%esi
lea    0xe41(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xe28(%rip),%rdi
mov    $0x0,%al
call   1050 <deserialize@plt>
cltq
mov    %rax,-0x30(%rbp)
mov    -0x30(%rbp),%rdi
mov    $0x0,%al
call   1060 <serialize@plt>
cltq
mov    %rax,-0x28(%rbp)
mov    -0x28(%rbp),%rsi
lea    0xe00(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %rbx
sub    $0x20,%rsp
movups 0xe9f(%rip),%xmm0
movups %xmm0,0xf(%rsp)
movaps 0xe84(%rip),%xmm0
movaps %xmm0,(%rsp)
mov    %rsp,%r15
mov    %r15,%rdi
xor    %eax,%eax
call   1060 <deserialize@plt>
movslq %eax,%rbx
lea    0xeac(%rip),%rdi
call   1030 <puts@plt>
mov    %rbx,%rdi
xor    %eax,%eax
call   1080 <inOrder@plt>
mov    %rbx,%rdi
xor    %eax,%eax
call   1070 <serialize@plt>
movslq %eax,%rbx
lea    0xe65(%rip),%rdi
mov    %r15,%rsi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xe5e(%rip),%r14
mov    %r14,%rdi
mov    %rbx,%rsi
xor    %eax,%eax
call   1040 <printf@plt>
mov    %r15,%rdi
mov    %rbx,%rsi
call   1050 <strcmp@plt>
lea    0xe49(%rip),%rdi
mov    %eax,%esi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xe2e(%rip),%rdi
xor    %eax,%eax
call   1060 <deserialize@plt>
movslq %eax,%rdi
xor    %eax,%eax
call   1070 <serialize@plt>
movslq %eax,%rsi
mov    %r14,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
%struct.TreeNode = type opaque
@__const.main.data = [31 x i8] c"1,2,3,N,N,4,5,N,N,6,7,N,N,N,N,\00"
@.str = [25 x i8] c"\0AIn order traversal ...\0A\00"
@.str.1 = [10 x i8] c"Old: %s \0A\00"
@.str.2 = [10 x i8] c"New: %s \0A\00"
@.str.3 = [16 x i8] c"Comparison: %d\0A\00"
@.str.4 = [1 x i8] zeroinitializer
define i32 @main() {
%1 = alloca [31 x i8]
%2 = alloca i8*
%3 = alloca %struct.TreeNode*
%4 = bitcast [31 x i8]* %1 to i8*
%5 = getelementptr inbounds [31 x i8], [31 x i8]* %1, i64 0, i64 0
%6 = call i32 (i8*, ...) bitcast (i32 (...)* @deserialize to i32 (i8*, ...)*)(i8* %5)
%7 = sext i32 %6 to i64
%8 = inttoptr i64 %7 to %struct.TreeNode*
store %struct.TreeNode* %8, %struct.TreeNode** %3
%9 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str, i64 0, i64 0))
%10 = load %struct.TreeNode*, %struct.TreeNode** %3
%11 = call i32 (%struct.TreeNode*, ...) bitcast (i32 (...)* @inOrder to i32 (%struct.TreeNode*, ...)*)(%struct.TreeNode* %10)
%12 = load %struct.TreeNode*, %struct.TreeNode** %3
%13 = call i32 (%struct.TreeNode*, ...) bitcast (i32 (...)* @serialize to i32 (%struct.TreeNode*, ...)*)(%struct.TreeNode* %12)
%14 = sext i32 %13 to i64
%15 = inttoptr i64 %14 to i8*
store i8* %15, i8** %2
%16 = getelementptr inbounds [31 x i8], [31 x i8]* %1, i64 0, i64 0
%17 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.1, i64 0, i64 0), i8* %16)
%18 = load i8*, i8** %2
%19 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.2, i64 0, i64 0), i8* %18)
%20 = getelementptr inbounds [31 x i8], [31 x i8]* %1, i64 0, i64 0
%21 = load i8*, i8** %2
%22 = call i32 @strcmp(i8* %20, i8* %21)
%23 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.3, i64 0, i64 0), i32 %22)
%24 = call i32 (i8*, ...) bitcast (i32 (...)* @deserialize to i32 (i8*, ...)*)(i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.4, i64 0, i64 0))
%25 = sext i32 %24 to i64
%26 = inttoptr i64 %25 to %struct.TreeNode*
store %struct.TreeNode* %26, %struct.TreeNode** %3
%27 = load %struct.TreeNode*, %struct.TreeNode** %3
%28 = call i32 (%struct.TreeNode*, ...) bitcast (i32 (...)* @serialize to i32 (%struct.TreeNode*, ...)*)(%struct.TreeNode* %27)
%29 = sext i32 %28 to i64
%30 = inttoptr i64 %29 to i8*
store i8* %30, i8** %2
%31 = load i8*, i8** %2
%32 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.2, i64 0, i64 0), i8* %31)
ret i32 0
}

LLVM IR (-O2):
%struct.TreeNode = type opaque
@__const.main.data = [31 x i8] c"1,2,3,N,N,4,5,N,N,6,7,N,N,N,N,\00"
@.str.1 = [10 x i8] c"Old: %s \0A\00"
@.str.2 = [10 x i8] c"New: %s \0A\00"
@.str.3 = [16 x i8] c"Comparison: %d\0A\00"
@.str.4 = [1 x i8] zeroinitializer
@str = [24 x i8] c"\0AIn order traversal ...\00"
define i32 @main() {
%1 = alloca [31 x i8]
%2 = getelementptr inbounds [31 x i8], [31 x i8]* %1, i64 0, i64 0
%3 = call i32 (i8*, ...) bitcast (i32 (...)* @deserialize to i32 (i8*, ...)*)(i8* %2)
%4 = sext i32 %3 to i64
%5 = inttoptr i64 %4 to %struct.TreeNode*
%6 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([24 x i8], [24 x i8]* @str, i64 0, i64 0))
%7 = call i32 (%struct.TreeNode*, ...) bitcast (i32 (...)* @inOrder to i32 (%struct.TreeNode*, ...)*)(%struct.TreeNode* %5)
%8 = call i32 (%struct.TreeNode*, ...) bitcast (i32 (...)* @serialize to i32 (%struct.TreeNode*, ...)*)(%struct.TreeNode* %5)
%9 = sext i32 %8 to i64
%10 = inttoptr i64 %9 to i8*
%11 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([10 x i8], [10 x i8]* @.str.1, i64 0, i64 0), i8* %2)
%12 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([10 x i8], [10 x i8]* @.str.2, i64 0, i64 0), i8* %10)
%13 = call i32 @strcmp(i8* %2, i8* dereferenceable(1) %10)
%14 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([16 x i8], [16 x i8]* @.str.3, i64 0, i64 0), i32 %13)
%15 = call i32 (i8*, ...) bitcast (i32 (...)* @deserialize to i32 (i8*, ...)*)(i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.4, i64 0, i64 0))
%16 = sext i32 %15 to i64
%17 = inttoptr i64 %16 to %struct.TreeNode*
%18 = call i32 (%struct.TreeNode*, ...) bitcast (i32 (...)* @serialize to i32 (%struct.TreeNode*, ...)*)(%struct.TreeNode* %17)
%19 = sext i32 %18 to i64
%20 = inttoptr i64 %19 to i8*
%21 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([10 x i8], [10 x i8]* @.str.2, i64 0, i64 0), i8* %20)
ret i32 0
}