#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 */

/* Variables and functions */
scalar_t__ __VERIFIER_nondet_int();
int /*<<< orphan*/ free(struct TreeNode *);
void *malloc(int);
int main() {
  struct TreeNode {
    struct TreeNode *left;
    struct TreeNode *right;
  };
  struct TreeNode *root = malloc(sizeof(*root)), *n;
  root->left = NULL;
  root->right = NULL;
  while (__VERIFIER_nondet_int()) {
    n = root;
    while (n->left && n->right) {
      if (__VERIFIER_nondet_int())
        n = n->left;
      else
        n = n->right;
    }
    if (!n->left && __VERIFIER_nondet_int()) {
      n->left = malloc(sizeof(*n));
      n->left->left = NULL;
      n->left->right = NULL;
    }
    if (!n->right && __VERIFIER_nondet_int()) {
      n->right = malloc(sizeof(*n));
      n->right->left = NULL;
      n->right->right = NULL;
    }
  }
  n = NULL;
  struct TreeNode *pred;
  while (root) {
    pred = NULL;
    n = root;
    while (n->left || n->right) {
      pred = n;
      if (n->left)
        n = n->left;
      else
        n = n->right;
    }
    if (pred) {
      if (n == pred->left)
        pred->left = NULL;
      else
        pred->right = NULL;
    } else
      root = NULL;
    free(n);
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movl   $0x0,-0x4(%rbp)
mov    $0x10,%edi
call   1050 <malloc@plt>
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rax
movq   $0x0,(%rax)
mov    -0x10(%rbp),%rax
movq   $0x0,0x8(%rax)
mov    $0x0,%al
call   1040 <__VERIFIER_nondet_int@plt>
cmp    $0x0,%rax
je     128a <main+0x15a>
mov    -0x10(%rbp),%rax
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rcx
xor    %eax,%eax
cmpq   $0x0,(%rcx)
mov    %al,-0x21(%rbp)
je     119f <main+0x6f>
mov    -0x18(%rbp),%rax
cmpq   $0x0,0x8(%rax)
setne  %al
mov    %al,-0x21(%rbp)
mov    -0x21(%rbp),%al
test   $0x1,%al
jne    11af <main+0x7f>
jmp    11e1 <main+0xb1>
mov    $0x0,%al
call   1040 <__VERIFIER_nondet_int@plt>
cmp    $0x0,%rax
je     11d0 <main+0xa0>
mov    -0x18(%rbp),%rax
mov    (%rax),%rax
mov    %rax,-0x18(%rbp)
jmp    11dc <main+0xac>
mov    -0x18(%rbp),%rax
mov    0x8(%rax),%rax
mov    %rax,-0x18(%rbp)
jmp    117d <main+0x4d>
mov    -0x18(%rbp),%rax
cmpq   $0x0,(%rax)
jne    1231 <main+0x101>
mov    $0x0,%al
call   1040 <__VERIFIER_nondet_int@plt>
cmp    $0x0,%rax
je     1231 <main+0x101>
mov    $0x10,%edi
call   1050 <malloc@plt>
mov    %rax,%rcx
mov    -0x18(%rbp),%rax
mov    %rcx,(%rax)
mov    -0x18(%rbp),%rax
mov    (%rax),%rax
movq   $0x0,(%rax)
mov    -0x18(%rbp),%rax
mov    (%rax),%rax
movq   $0x0,0x8(%rax)
mov    -0x18(%rbp),%rax
cmpq   $0x0,0x8(%rax)
jne    1285 <main+0x155>
mov    $0x0,%al
call   1040 <__VERIFIER_nondet_int@plt>
cmp    $0x0,%rax
je     1285 <main+0x155>
mov    $0x10,%edi
call   1050 <malloc@plt>
mov    %rax,%rcx
mov    -0x18(%rbp),%rax
mov    %rcx,0x8(%rax)
mov    -0x18(%rbp),%rax
mov    0x8(%rax),%rax
movq   $0x0,(%rax)
mov    -0x18(%rbp),%rax
mov    0x8(%rax),%rax
movq   $0x0,0x8(%rax)
jmp    1164 <main+0x34>
movq   $0x0,-0x18(%rbp)
cmpq   $0x0,-0x10(%rbp)
je     1369 <main+0x239>
movq   $0x0,-0x20(%rbp)
mov    -0x10(%rbp),%rax
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rcx
mov    $0x1,%al
cmpq   $0x0,(%rcx)
mov    %al,-0x22(%rbp)
jne    12cf <main+0x19f>
mov    -0x18(%rbp),%rax
cmpq   $0x0,0x8(%rax)
setne  %al
mov    %al,-0x22(%rbp)
mov    -0x22(%rbp),%al
test   $0x1,%al
jne    12df <main+0x1af>
jmp    1316 <main+0x1e6>
mov    -0x18(%rbp),%rax
mov    %rax,-0x20(%rbp)
mov    -0x18(%rbp),%rax
cmpq   $0x0,(%rax)
je     1305 <main+0x1d5>
mov    -0x18(%rbp),%rax
mov    (%rax),%rax
mov    %rax,-0x18(%rbp)
jmp    1311 <main+0x1e1>
mov    -0x18(%rbp),%rax
mov    0x8(%rax),%rax
mov    %rax,-0x18(%rbp)
jmp    12ad <main+0x17d>
cmpq   $0x0,-0x20(%rbp)
je     1353 <main+0x223>
mov    -0x18(%rbp),%rax
mov    -0x20(%rbp),%rcx
cmp    (%rcx),%rax
jne    1342 <main+0x212>
mov    -0x20(%rbp),%rax
movq   $0x0,(%rax)
jmp    134e <main+0x21e>
mov    -0x20(%rbp),%rax
movq   $0x0,0x8(%rax)
jmp    135b <main+0x22b>
movq   $0x0,-0x10(%rbp)
mov    -0x18(%rbp),%rdi
call   1030 <free@plt>
jmp    1292 <main+0x162>
xor    %eax,%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %rbx
mov    $0x10,%edi
call   1050 <malloc@plt>
mov    %rax,%r14
xorps  %xmm0,%xmm0
movups %xmm0,(%rax)
xor    %eax,%eax
call   1040 <__VERIFIER_nondet_int@plt>
test   %rax,%rax
je     1213 <main+0xe3>
xor    %eax,%eax
nopw   0x0(%rax,%rax,1)
mov    %r14,%r15
test   %rax,%rax
je     1195 <main+0x65>
mov    %r14,%rbx
nopl   0x0(%rax,%rax,1)
cmpq   $0x0,0x8(%rbx)
je     11d0 <main+0xa0>
add    $0x8,%rbx
xor    %eax,%eax
call   1040 <__VERIFIER_nondet_int@plt>
test   %rax,%rax
cmove  %rbx,%r15
mov    (%r15),%r15
cmpq   $0x0,(%r15)
mov    %r15,%rbx
jne    1170 <main+0x40>
xor    %eax,%eax
call   1040 <__VERIFIER_nondet_int@plt>
test   %rax,%rax
je     11c0 <main+0x90>
mov    $0x10,%edi
call   1050 <malloc@plt>
mov    %rax,(%r15)
movq   $0x0,(%rax)
mov    (%r15),%rax
movq   $0x0,0x8(%rax)
cmpq   $0x0,0x8(%r15)
jne    11fa <main+0xca>
jmp    11da <main+0xaa>
nopl   0x0(%rax)
mov    %rbx,%r15
cmpq   $0x0,0x8(%r15)
jne    11fa <main+0xca>
xor    %eax,%eax
call   1040 <__VERIFIER_nondet_int@plt>
test   %rax,%rax
je     11fa <main+0xca>
mov    $0x10,%edi
call   1050 <malloc@plt>
mov    %rax,0x8(%r15)
xorps  %xmm0,%xmm0
movups %xmm0,(%rax)
xor    %eax,%eax
call   1040 <__VERIFIER_nondet_int@plt>
test   %rax,%rax
je     120e <main+0xde>
mov    (%r14),%rax
jmp    1160 <main+0x30>
test   %r14,%r14
je     1265 <main+0x135>
xor    %edi,%edi
mov    %r14,%rcx
nopl   0x0(%rax,%rax,1)
mov    %rdi,%rax
mov    %rcx,%rdi
mov    (%rcx),%rcx
test   %rcx,%rcx
jne    1220 <main+0xf0>
mov    0x8(%rdi),%rcx
test   %rcx,%rcx
jne    1220 <main+0xf0>
test   %rax,%rax
je     1260 <main+0x130>
xor    %ecx,%ecx
cmp    (%rax),%rdi
setne  %cl
movq   $0x0,(%rax,%rcx,8)
call   1030 <free@plt>
mov    %r14,%rcx
mov    $0x0,%edi
test   %r14,%r14
jne    1220 <main+0xf0>
jmp    1265 <main+0x135>
call   1030 <free@plt>
xor    %eax,%eax
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
%struct.TreeNode = type { %struct.TreeNode*, %struct.TreeNode* }
%struct.TreeNode.0 = type opaque
define i32 @main() {
%1 = alloca i32
%2 = alloca %struct.TreeNode*
%3 = alloca %struct.TreeNode*
%4 = alloca %struct.TreeNode*
store i32 0, i32* %1
%5 = call i8* @malloc(i32 16)
%6 = bitcast i8* %5 to %struct.TreeNode*
store %struct.TreeNode* %6, %struct.TreeNode** %2
%7 = load %struct.TreeNode*, %struct.TreeNode** %2
%8 = getelementptr inbounds %struct.TreeNode, %struct.TreeNode* %7, i32 0, i32 0
store %struct.TreeNode* null, %struct.TreeNode** %8
%9 = load %struct.TreeNode*, %struct.TreeNode** %2
%10 = getelementptr inbounds %struct.TreeNode, %struct.TreeNode* %9, i32 0, i32 1
store %struct.TreeNode* null, %struct.TreeNode** %10
br label %11
11: ; preds = %82, %0
%12 = call i64 (...) @__VERIFIER_nondet_int()
%13 = icmp ne i64 %12, 0
br i1 %13, label %14, label %83
14: ; preds = %11
%15 = load %struct.TreeNode*, %struct.TreeNode** %2
store %struct.TreeNode* %15, %struct.TreeNode** %3
br label %16
16: ; preds = %39, %14
%17 = load %struct.TreeNode*, %struct.TreeNode** %3
%18 = getelementptr inbounds %struct.TreeNode, %struct.TreeNode* %17, i32 0, i32 0
%19 = load %struct.TreeNode*, %struct.TreeNode** %18
%20 = icmp ne %struct.TreeNode* %19, null
br i1 %20, label %21, label %26
21: ; preds = %16
%22 = load %struct.TreeNode*, %struct.TreeNode** %3
%23 = getelementptr inbounds %struct.TreeNode, %struct.TreeNode* %22, i32 0, i32 1
%24 = load %struct.TreeNode*, %struct.TreeNode** %23
%25 = icmp ne %struct.TreeNode* %24, null
br label %26
26: ; preds = %21, %16
%27 = phi i1 [ false, %16 ], [ %25, %21 ]
br i1 %27, label %28, label %40
28: ; preds = %26
%29 = call i64 (...) @__VERIFIER_nondet_int()
%30 = icmp ne i64 %29, 0
br i1 %30, label %31, label %35
31: ; preds = %28
%32 = load %struct.TreeNode*, %struct.TreeNode** %3
%33 = getelementptr inbounds %struct.TreeNode, %struct.TreeNode* %32, i32 0, i32 0
%34 = load %struct.TreeNode*, %struct.TreeNode** %33
store %struct.TreeNode* %34, %struct.TreeNode** %3
br label %39
35: ; preds = %28
%36 = load %struct.TreeNode*, %struct.TreeNode** %3
%37 = getelementptr inbounds %struct.TreeNode, %struct.TreeNode* %36, i32 0, i32 1
%38 = load %struct.TreeNode*, %struct.TreeNode** %37
store %struct.TreeNode* %38, %struct.TreeNode** %3
br label %39
39: ; preds = %35, %31
br label %16
40: ; preds = %26
%41 = load %struct.TreeNode*, %struct.TreeNode** %3
%42 = getelementptr inbounds %struct.TreeNode, %struct.TreeNode* %41, i32 0, i32 0
%43 = load %struct.TreeNode*, %struct.TreeNode** %42
%44 = icmp ne %struct.TreeNode* %43, null
br i1 %44, label %61, label %45
45: ; preds = %40
%46 = call i64 (...) @__VERIFIER_nondet_int()
%47 = icmp ne i64 %46, 0
br i1 %47, label %48, label %61
48: ; preds = %45
%49 = call i8* @malloc(i32 16)
%50 = bitcast i8* %49 to %struct.TreeNode*
%51 = load %struct.TreeNode*, %struct.TreeNode** %3
%52 = getelementptr inbounds %struct.TreeNode, %struct.TreeNode* %51, i32 0, i32 0
store %struct.TreeNode* %50, %struct.TreeNode** %52
%53 = load %struct.TreeNode*, %struct.TreeNode** %3
%54 = getelementptr inbounds %struct.TreeNode, %struct.TreeNode* %53, i32 0, i32 0
%55 = load %struct.TreeNode*, %struct.TreeNode** %54
%56 = getelementptr inbounds %struct.TreeNode, %struct.TreeNode* %55, i32 0, i32 0
store %struct.TreeNode* null, %struct.TreeNode** %56
%57 = load %struct.TreeNode*, %struct.TreeNode** %3
%58 = getelementptr inbounds %struct.TreeNode, %struct.TreeNode* %57, i32 0, i32 0
%59 = load %struct.TreeNode*, %struct.TreeNode** %58
%60 = getelementptr inbounds %struct.TreeNode, %struct.TreeNode* %59, i32 0, i32 1
store %struct.TreeNode* null, %struct.TreeNode** %60
br label %61
61: ; preds = %48, %45, %40
%62 = load %struct.TreeNode*, %struct.TreeNode** %3
%63 = getelementptr inbounds %struct.TreeNode, %struct.TreeNode* %62, i32 0, i32 1
%64 = load %struct.TreeNode*, %struct.TreeNode** %63
%65 = icmp ne %struct.TreeNode* %64, null
br i1 %65, label %82, label %66
66: ; preds = %61
%67 = call i64 (...) @__VERIFIER_nondet_int()
%68 = icmp ne i64 %67, 0
br i1 %68, label %69, label %82
69: ; preds = %66
%70 = call i8* @malloc(i32 16)
%71 = bitcast i8* %70 to %struct.TreeNode*
%72 = load %struct.TreeNode*, %struct.TreeNode** %3
%73 = getelementptr inbounds %struct.TreeNode, %struct.TreeNode* %72, i32 0, i32 1
store %struct.TreeNode* %71, %struct.TreeNode** %73
%74 = load %struct.TreeNode*, %struct.TreeNode** %3
%75 = getelementptr inbounds %struct.TreeNode, %struct.TreeNode* %74, i32 0, i32 1
%76 = load %struct.TreeNode*, %struct.TreeNode** %75
%77 = getelementptr inbounds %struct.TreeNode, %struct.TreeNode* %76, i32 0, i32 0
store %struct.TreeNode* null, %struct.TreeNode** %77
%78 = load %struct.TreeNode*, %struct.TreeNode** %3
%79 = getelementptr inbounds %struct.TreeNode, %struct.TreeNode* %78, i32 0, i32 1
%80 = load %struct.TreeNode*, %struct.TreeNode** %79
%81 = getelementptr inbounds %struct.TreeNode, %struct.TreeNode* %80, i32 0, i32 1
store %struct.TreeNode* null, %struct.TreeNode** %81
br label %82
82: ; preds = %69, %66, %61
br label %11
83: ; preds = %11
store %struct.TreeNode* null, %struct.TreeNode** %3
br label %84
84: ; preds = %133, %83
%85 = load %struct.TreeNode*, %struct.TreeNode** %2
%86 = icmp ne %struct.TreeNode* %85, null
br i1 %86, label %87, label %137
87: ; preds = %84
store %struct.TreeNode* null, %struct.TreeNode** %4
%88 = load %struct.TreeNode*, %struct.TreeNode** %2
store %struct.TreeNode* %88, %struct.TreeNode** %3
br label %89
89: ; preds = %115, %87
%90 = load %struct.TreeNode*, %struct.TreeNode** %3
%91 = getelementptr inbounds %struct.TreeNode, %struct.TreeNode* %90, i32 0, i32 0
%92 = load %struct.TreeNode*, %struct.TreeNode** %91
%93 = icmp ne %struct.TreeNode* %92, null
br i1 %93, label %99, label %94
94: ; preds = %89
%95 = load %struct.TreeNode*, %struct.TreeNode** %3
%96 = getelementptr inbounds %struct.TreeNode, %struct.TreeNode* %95, i32 0, i32 1
%97 = load %struct.TreeNode*, %struct.TreeNode** %96
%98 = icmp ne %struct.TreeNode* %97, null
br label %99
99: ; preds = %94, %89
%100 = phi i1 [ true, %89 ], [ %98, %94 ]
br i1 %100, label %101, label %116
101: ; preds = %99
%102 = load %struct.TreeNode*, %struct.TreeNode** %3
store %struct.TreeNode* %102, %struct.TreeNode** %4
%103 = load %struct.TreeNode*, %struct.TreeNode** %3
%104 = getelementptr inbounds %struct.TreeNode, %struct.TreeNode* %103, i32 0, i32 0
%105 = load %struct.TreeNode*, %struct.TreeNode** %104
%106 = icmp ne %struct.TreeNode* %105, null
br i1 %106, label %107, label %111
107: ; preds = %101
%108 = load %struct.TreeNode*, %struct.TreeNode** %3
%109 = getelementptr inbounds %struct.TreeNode, %struct.TreeNode* %108, i32 0, i32 0
%110 = load %struct.TreeNode*, %struct.TreeNode** %109
store %struct.TreeNode* %110, %struct.TreeNode** %3
br label %115
111: ; preds = %101
%112 = load %struct.TreeNode*, %struct.TreeNode** %3
%113 = getelementptr inbounds %struct.TreeNode, %struct.TreeNode* %112, i32 0, i32 1
%114 = load %struct.TreeNode*, %struct.TreeNode** %113
store %struct.TreeNode* %114, %struct.TreeNode** %3
br label %115
115: ; preds = %111, %107
br label %89
116: ; preds = %99
%117 = load %struct.TreeNode*, %struct.TreeNode** %4
%118 = icmp ne %struct.TreeNode* %117, null
br i1 %118, label %119, label %132
119: ; preds = %116
%120 = load %struct.TreeNode*, %struct.TreeNode** %3
%121 = load %struct.TreeNode*, %struct.TreeNode** %4
%122 = getelementptr inbounds %struct.TreeNode, %struct.TreeNode* %121, i32 0, i32 0
%123 = load %struct.TreeNode*, %struct.TreeNode** %122
%124 = icmp eq %struct.TreeNode* %120, %123
br i1 %124, label %125, label %128
125: ; preds = %119
%126 = load %struct.TreeNode*, %struct.TreeNode** %4
%127 = getelementptr inbounds %struct.TreeNode, %struct.TreeNode* %126, i32 0, i32 0
store %struct.TreeNode* null, %struct.TreeNode** %127
br label %131
128: ; preds = %119
%129 = load %struct.TreeNode*, %struct.TreeNode** %4
%130 = getelementptr inbounds %struct.TreeNode, %struct.TreeNode* %129, i32 0, i32 1
store %struct.TreeNode* null, %struct.TreeNode** %130
br label %131
131: ; preds = %128, %125
br label %133
132: ; preds = %116
store %struct.TreeNode* null, %struct.TreeNode** %2
br label %133
133: ; preds = %132, %131
%134 = load %struct.TreeNode*, %struct.TreeNode** %3
%135 = bitcast %struct.TreeNode* %134 to %struct.TreeNode.0*
%136 = call i32 @free(%struct.TreeNode.0* %135)
br label %84
137: ; preds = %84
ret i32 0
}

LLVM IR (-O2):
%struct.TreeNode = type { %struct.TreeNode*, %struct.TreeNode* }
%struct.TreeNode.0 = type opaque
define i32 @main() {
%1 = tail call dereferenceable_or_null(16) i8* @malloc(i32 16)
%2 = bitcast i8* %1 to %struct.TreeNode*
%3 = getelementptr inbounds %struct.TreeNode, %struct.TreeNode* %2, i64 0, i32 0
%4 = tail call i64 (...) @__VERIFIER_nondet_int()
%5 = icmp eq i64 %4, 0
br i1 %5, label %11, label %6
6: ; preds = %0, %53
%7 = phi %struct.TreeNode* [ %54, %53 ], [ null, %0 ]
%8 = icmp eq %struct.TreeNode* %7, null
br i1 %8, label %27, label %13
9: ; preds = %50
%10 = icmp eq i8* %1, null
br i1 %10, label %81, label %11
11: ; preds = %0, %9
%12 = icmp eq i8* %1, null
br label %55
13: ; preds = %6, %19
%14 = phi %struct.TreeNode** [ %24, %19 ], [ %3, %6 ]
%15 = phi %struct.TreeNode* [ %23, %19 ], [ %2, %6 ]
%16 = getelementptr inbounds %struct.TreeNode, %struct.TreeNode* %15, i64 0, i32 1
%17 = load %struct.TreeNode*, %struct.TreeNode** %16
%18 = icmp eq %struct.TreeNode* %17, null
br i1 %18, label %39, label %19
19: ; preds = %13
%20 = tail call i64 (...) @__VERIFIER_nondet_int()
%21 = icmp eq i64 %20, 0
%22 = select i1 %21, %struct.TreeNode** %16, %struct.TreeNode** %14
%23 = load %struct.TreeNode*, %struct.TreeNode** %22
%24 = getelementptr inbounds %struct.TreeNode, %struct.TreeNode* %23, i64 0, i32 0
%25 = load %struct.TreeNode*, %struct.TreeNode** %24
%26 = icmp eq %struct.TreeNode* %25, null
br i1 %26, label %27, label %13
27: ; preds = %19, %6
%28 = phi %struct.TreeNode* [ %2, %6 ], [ %23, %19 ]
%29 = phi %struct.TreeNode** [ %3, %6 ], [ %24, %19 ]
%30 = tail call i64 (...) @__VERIFIER_nondet_int()
%31 = icmp eq i64 %30, 0
br i1 %31, label %39, label %32
32: ; preds = %27
%33 = tail call dereferenceable_or_null(16) i8* @malloc(i32 16)
%34 = bitcast i8* %33 to %struct.TreeNode*
%35 = bitcast %struct.TreeNode* %28 to i8**
store i8* %33, i8** %35
%36 = getelementptr inbounds %struct.TreeNode, %struct.TreeNode* %34, i64 0, i32 0
store %struct.TreeNode* null, %struct.TreeNode** %36
%37 = load %struct.TreeNode*, %struct.TreeNode** %29
%38 = getelementptr inbounds %struct.TreeNode, %struct.TreeNode* %37, i64 0, i32 1
store %struct.TreeNode* null, %struct.TreeNode** %38
br label %39
39: ; preds = %13, %32, %27
%40 = phi %struct.TreeNode* [ %28, %32 ], [ %28, %27 ], [ %15, %13 ]
%41 = getelementptr inbounds %struct.TreeNode, %struct.TreeNode* %40, i64 0, i32 1
%42 = load %struct.TreeNode*, %struct.TreeNode** %41
%43 = icmp eq %struct.TreeNode* %42, null
br i1 %43, label %44, label %50
44: ; preds = %39
%45 = tail call i64 (...) @__VERIFIER_nondet_int()
%46 = icmp eq i64 %45, 0
br i1 %46, label %50, label %47
47: ; preds = %44
%48 = tail call dereferenceable_or_null(16) i8* @malloc(i32 16)
%49 = bitcast %struct.TreeNode** %41 to i8**
store i8* %48, i8** %49
br label %50
50: ; preds = %47, %44, %39
%51 = tail call i64 (...) @__VERIFIER_nondet_int()
%52 = icmp eq i64 %51, 0
br i1 %52, label %9, label %53
53: ; preds = %50
%54 = load %struct.TreeNode*, %struct.TreeNode** %3
br label %6
55: ; preds = %78, %11
%56 = phi %struct.TreeNode* [ %2, %11 ], [ %79, %78 ]
%57 = phi %struct.TreeNode* [ null, %11 ], [ %80, %78 ]
%58 = getelementptr inbounds %struct.TreeNode, %struct.TreeNode* %56, i64 0, i32 0
%59 = load %struct.TreeNode*, %struct.TreeNode** %58
%60 = icmp eq %struct.TreeNode* %59, null
br i1 %60, label %61, label %78
61: ; preds = %55
%62 = getelementptr inbounds %struct.TreeNode, %struct.TreeNode* %56, i64 0, i32 1
%63 = load %struct.TreeNode*, %struct.TreeNode** %62
%64 = icmp eq %struct.TreeNode* %63, null
br i1 %64, label %65, label %78
65: ; preds = %61
%66 = icmp eq %struct.TreeNode* %57, null
br i1 %66, label %67, label %70
67: ; preds = %65
%68 = bitcast %struct.TreeNode* %56 to %struct.TreeNode.0*
%69 = tail call i32 @free(%struct.TreeNode.0* %68)
br label %81
70: ; preds = %65
%71 = getelementptr inbounds %struct.TreeNode, %struct.TreeNode* %57, i64 0, i32 0
%72 = load %struct.TreeNode*, %struct.TreeNode** %71
%73 = icmp eq %struct.TreeNode* %56, %72
%74 = getelementptr inbounds %struct.TreeNode, %struct.TreeNode* %57, i64 0, i32 1
%75 = select i1 %73, %struct.TreeNode** %71, %struct.TreeNode** %74
store %struct.TreeNode* null, %struct.TreeNode** %75
%76 = bitcast %struct.TreeNode* %56 to %struct.TreeNode.0*
%77 = tail call i32 @free(%struct.TreeNode.0* %76)
br i1 %12, label %81, label %78
78: ; preds = %70, %61, %55
%79 = phi %struct.TreeNode* [ %2, %70 ], [ %59, %55 ], [ %63, %61 ]
%80 = phi %struct.TreeNode* [ null, %70 ], [ %56, %55 ], [ %56, %61 ]
br label %55
81: ; preds = %70, %67, %9
ret i32 0
}