#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;
};

/* Variables and functions */
struct TreeNode *newNode(int, struct TreeNode *, struct TreeNode *);
int /*<<< orphan*/ printTree(struct TreeNode *);
struct TreeNode *pruneTree(struct TreeNode *);
int main() {
  struct TreeNode *n1 = newNode(1, NULL, NULL);
  struct TreeNode *n2 = newNode(0, NULL, NULL);
  struct TreeNode *n3 = newNode(0, n2, n1);
  struct TreeNode *n8 = newNode(0, NULL, NULL);
  struct TreeNode *n5 = newNode(1, n8, NULL);
  struct TreeNode *n6 = newNode(1, NULL, NULL);
  struct TreeNode *n7 = newNode(1, n5, n6);
  struct TreeNode *n4 = newNode(1, n7, n3);
  n4 = pruneTree(n4);
  printTree(n4);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
mov    $0x1,%edi
xor    %eax,%eax
mov    %eax,%edx
mov    %rdx,%rsi
call   1050 <newNode@plt>
mov    %rax,-0x8(%rbp)
xor    %edi,%edi
xor    %eax,%eax
mov    %eax,%edx
mov    %rdx,%rsi
call   1050 <newNode@plt>
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rsi
mov    -0x8(%rbp),%rdx
xor    %edi,%edi
call   1050 <newNode@plt>
mov    %rax,-0x18(%rbp)
xor    %edi,%edi
xor    %eax,%eax
mov    %eax,%edx
mov    %rdx,%rsi
call   1050 <newNode@plt>
mov    %rax,-0x20(%rbp)
mov    -0x20(%rbp),%rsi
mov    $0x1,%edi
xor    %eax,%eax
mov    %eax,%edx
call   1050 <newNode@plt>
mov    %rax,-0x28(%rbp)
mov    $0x1,%edi
xor    %eax,%eax
mov    %eax,%edx
mov    %rdx,%rsi
call   1050 <newNode@plt>
mov    %rax,-0x30(%rbp)
mov    -0x28(%rbp),%rsi
mov    -0x30(%rbp),%rdx
mov    $0x1,%edi
call   1050 <newNode@plt>
mov    %rax,-0x38(%rbp)
mov    -0x38(%rbp),%rsi
mov    -0x18(%rbp),%rdx
mov    $0x1,%edi
call   1050 <newNode@plt>
mov    %rax,-0x40(%rbp)
mov    -0x40(%rbp),%rdi
call   1040 <pruneTree@plt>
mov    %rax,-0x40(%rbp)
mov    -0x40(%rbp),%rdi
call   1030 <printTree@plt>
xor    %eax,%eax
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r14
push   %rbx
push   %rax
mov    $0x1,%edi
xor    %esi,%esi
xor    %edx,%edx
call   1050 <newNode@plt>
mov    %rax,%rbx
xor    %edi,%edi
xor    %esi,%esi
xor    %edx,%edx
call   1050 <newNode@plt>
xor    %edi,%edi
mov    %rax,%rsi
mov    %rbx,%rdx
call   1050 <newNode@plt>
mov    %rax,%r14
xor    %edi,%edi
xor    %esi,%esi
xor    %edx,%edx
call   1050 <newNode@plt>
mov    $0x1,%edi
mov    %rax,%rsi
xor    %edx,%edx
call   1050 <newNode@plt>
mov    %rax,%rbx
mov    $0x1,%edi
xor    %esi,%esi
xor    %edx,%edx
call   1050 <newNode@plt>
mov    $0x1,%edi
mov    %rbx,%rsi
mov    %rax,%rdx
call   1050 <newNode@plt>
mov    $0x1,%edi
mov    %rax,%rsi
mov    %r14,%rdx
call   1050 <newNode@plt>
mov    %rax,%rdi
call   1040 <pruneTree@plt>
mov    %rax,%rdi
call   1030 <printTree@plt>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
%struct.TreeNode = type { i32 }
define i32 @main() {
%1 = alloca %struct.TreeNode*
%2 = alloca %struct.TreeNode*
%3 = alloca %struct.TreeNode*
%4 = alloca %struct.TreeNode*
%5 = alloca %struct.TreeNode*
%6 = alloca %struct.TreeNode*
%7 = alloca %struct.TreeNode*
%8 = alloca %struct.TreeNode*
%9 = call %struct.TreeNode* @newNode(i32 1, %struct.TreeNode* null, %struct.TreeNode* null)
store %struct.TreeNode* %9, %struct.TreeNode** %1
%10 = call %struct.TreeNode* @newNode(i32 0, %struct.TreeNode* null, %struct.TreeNode* null)
store %struct.TreeNode* %10, %struct.TreeNode** %2
%11 = load %struct.TreeNode*, %struct.TreeNode** %2
%12 = load %struct.TreeNode*, %struct.TreeNode** %1
%13 = call %struct.TreeNode* @newNode(i32 0, %struct.TreeNode* %11, %struct.TreeNode* %12)
store %struct.TreeNode* %13, %struct.TreeNode** %3
%14 = call %struct.TreeNode* @newNode(i32 0, %struct.TreeNode* null, %struct.TreeNode* null)
store %struct.TreeNode* %14, %struct.TreeNode** %4
%15 = load %struct.TreeNode*, %struct.TreeNode** %4
%16 = call %struct.TreeNode* @newNode(i32 1, %struct.TreeNode* %15, %struct.TreeNode* null)
store %struct.TreeNode* %16, %struct.TreeNode** %5
%17 = call %struct.TreeNode* @newNode(i32 1, %struct.TreeNode* null, %struct.TreeNode* null)
store %struct.TreeNode* %17, %struct.TreeNode** %6
%18 = load %struct.TreeNode*, %struct.TreeNode** %5
%19 = load %struct.TreeNode*, %struct.TreeNode** %6
%20 = call %struct.TreeNode* @newNode(i32 1, %struct.TreeNode* %18, %struct.TreeNode* %19)
store %struct.TreeNode* %20, %struct.TreeNode** %7
%21 = load %struct.TreeNode*, %struct.TreeNode** %7
%22 = load %struct.TreeNode*, %struct.TreeNode** %3
%23 = call %struct.TreeNode* @newNode(i32 1, %struct.TreeNode* %21, %struct.TreeNode* %22)
store %struct.TreeNode* %23, %struct.TreeNode** %8
%24 = load %struct.TreeNode*, %struct.TreeNode** %8
%25 = call %struct.TreeNode* @pruneTree(%struct.TreeNode* %24)
store %struct.TreeNode* %25, %struct.TreeNode** %8
%26 = load %struct.TreeNode*, %struct.TreeNode** %8
%27 = call i32 @printTree(%struct.TreeNode* %26)
ret i32 0
}

LLVM IR (-O2):
%struct.TreeNode = type { i32 }
define i32 @main() {
%1 = tail call %struct.TreeNode* @newNode(i32 1, %struct.TreeNode* null, %struct.TreeNode* null)
%2 = tail call %struct.TreeNode* @newNode(i32 0, %struct.TreeNode* null, %struct.TreeNode* null)
%3 = tail call %struct.TreeNode* @newNode(i32 0, %struct.TreeNode* %2, %struct.TreeNode* %1)
%4 = tail call %struct.TreeNode* @newNode(i32 0, %struct.TreeNode* null, %struct.TreeNode* null)
%5 = tail call %struct.TreeNode* @newNode(i32 1, %struct.TreeNode* %4, %struct.TreeNode* null)
%6 = tail call %struct.TreeNode* @newNode(i32 1, %struct.TreeNode* null, %struct.TreeNode* null)
%7 = tail call %struct.TreeNode* @newNode(i32 1, %struct.TreeNode* %5, %struct.TreeNode* %6)
%8 = tail call %struct.TreeNode* @newNode(i32 1, %struct.TreeNode* %7, %struct.TreeNode* %3)
%9 = tail call %struct.TreeNode* @pruneTree(%struct.TreeNode* %8)
%10 = tail call i32 @printTree(%struct.TreeNode* %9)
ret i32 0
}