; LLVM IR from priyankchheda/algorithms :: _other_languages/cpp/BinarySearchTree (inorderSuccessor)

; Unoptimized IR (clang -disable-llvm-passes):
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-i128:128-f80:128-n8:16:32:64-S128"
target triple = "x86_64-unknown-linux-gnu"

%"class.std::basic_ostream" = type { ptr, %"class.std::basic_ios" }
%"class.std::basic_ios" = type { %"class.std::ios_base", ptr, i8, i8, ptr, ptr, ptr, ptr }
%"class.std::ios_base" = type { ptr, i64, i64, i32, i32, i32, ptr, %"struct.std::ios_base::_Words", [8 x %"struct.std::ios_base::_Words"], i32, ptr, %"class.std::locale" }
%"struct.std::ios_base::_Words" = type { ptr, i64 }
%"class.std::locale" = type { ptr }
%class.BST = type { ptr }
%struct.Node = type { i32, ptr, ptr }

@__const.main.original = external hidden unnamed_addr constant [8 x i32], align 16
@_ZSt4cout = external global %"class.std::basic_ostream", align 8
@.str = external hidden unnamed_addr constant [25 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [2 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [25 x i8], align 1
@.str.3 = external hidden unnamed_addr constant [9 x i8], align 1
@.str.4 = external hidden unnamed_addr constant [13 x i8], align 1
@.str.5 = external hidden unnamed_addr constant [25 x i8], align 1
@.str.6 = external hidden unnamed_addr constant [25 x i8], align 1
@.str.7 = external hidden unnamed_addr constant [25 x i8], align 1
@.str.8 = external hidden unnamed_addr constant [25 x i8], align 1
@.str.9 = external hidden unnamed_addr constant [25 x i8], align 1
@.str.10 = external hidden unnamed_addr constant [25 x i8], align 1
@.str.11 = external hidden unnamed_addr constant [25 x i8], align 1
@.str.12 = external hidden unnamed_addr constant [26 x i8], align 1

; Function Attrs: mustprogress norecurse uwtable
define dso_local noundef i32 @main() #0 personality ptr @__gxx_personality_v0 {
  %1 = alloca i32, align 4
  %2 = alloca %class.BST, align 8
  %3 = alloca [8 x i32], align 16
  %4 = alloca ptr, align 8
  %5 = alloca ptr, align 8
  %6 = alloca ptr, align 8
  %7 = alloca i32, align 4
  %8 = alloca ptr, align 8
  %9 = alloca i32, align 4
  store i32 0, ptr %1, align 4
  call void @llvm.lifetime.start.p0(i64 8, ptr %2) #7
  call void @_ZN3BSTC2Ev(ptr noundef nonnull align 8 dereferenceable(8) %2)
  call void @llvm.lifetime.start.p0(i64 32, ptr %3) #7
  call void @llvm.memcpy.p0.p0.i64(ptr align 16 %3, ptr align 16 @__const.main.original, i64 32, i1 false)
  call void @llvm.lifetime.start.p0(i64 8, ptr %4) #7
  store ptr %3, ptr %4, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %5) #7
  %10 = load ptr, ptr %4, align 8, !tbaa !5
  %11 = getelementptr inbounds [8 x i32], ptr %10, i64 0, i64 0
  store ptr %11, ptr %5, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %6) #7
  %12 = load ptr, ptr %4, align 8, !tbaa !5
  %13 = getelementptr inbounds [8 x i32], ptr %12, i64 0, i64 0
  %14 = getelementptr inbounds i32, ptr %13, i64 8
  store ptr %14, ptr %6, align 8, !tbaa !5
  br label %15

15:                                               ; preds = %25, %0
  %16 = load ptr, ptr %5, align 8, !tbaa !5
  %17 = load ptr, ptr %6, align 8, !tbaa !5
  %18 = icmp ne ptr %16, %17
  br i1 %18, label %20, label %19

19:                                               ; preds = %15
  call void @llvm.lifetime.end.p0(i64 8, ptr %6) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr %5) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr %4) #7
  br label %32

20:                                               ; preds = %15
  call void @llvm.lifetime.start.p0(i64 4, ptr %7) #7
  %21 = load ptr, ptr %5, align 8, !tbaa !5
  %22 = load i32, ptr %21, align 4, !tbaa !9
  store i32 %22, ptr %7, align 4, !tbaa !9
  %23 = load i32, ptr %7, align 4, !tbaa !9
  invoke void @_ZN3BST6insertEi(ptr noundef nonnull align 8 dereferenceable(8) %2, i32 noundef %23)
          to label %24 unwind label %28

24:                                               ; preds = %20
  call void @llvm.lifetime.end.p0(i64 4, ptr %7) #7
  br label %25

25:                                               ; preds = %24
  %26 = load ptr, ptr %5, align 8, !tbaa !5
  %27 = getelementptr inbounds i32, ptr %26, i32 1
  store ptr %27, ptr %5, align 8, !tbaa !5
  br label %15

28:                                               ; preds = %20
  %29 = landingpad { ptr, i32 }
          cleanup
  %30 = extractvalue { ptr, i32 } %29, 0
  store ptr %30, ptr %8, align 8
  %31 = extractvalue { ptr, i32 } %29, 1
  store i32 %31, ptr %9, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %7) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr %6) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr %5) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr %4) #7
  br label %144

32:                                               ; preds = %19
  %33 = invoke noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cout, ptr noundef @.str)
          to label %34 unwind label %51

34:                                               ; preds = %32
  %35 = invoke noundef ptr @_Z16inorderSuccessorR3BSTi(ptr noundef nonnull align 8 dereferenceable(8) %2, i32 noundef 1)
          to label %36 unwind label %51

36:                                               ; preds = %34
  %37 = getelementptr inbounds %struct.Node, ptr %35, i32 0, i32 0
  %38 = load i32, ptr %37, align 8, !tbaa !11
  %39 = invoke noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEi(ptr noundef nonnull align 8 dereferenceable(8) %33, i32 noundef %38)
          to label %40 unwind label %51

40:                                               ; preds = %36
  %41 = invoke noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc(ptr noundef nonnull align 8 dereferenceable(8) %39, ptr noundef @.str.1)
          to label %42 unwind label %51

42:                                               ; preds = %40
  %43 = invoke noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cout, ptr noundef @.str.2)
          to label %44 unwind label %51

44:                                               ; preds = %42
  %45 = invoke noundef ptr @_Z16inorderSuccessorR3BSTi(ptr noundef nonnull align 8 dereferenceable(8) %2, i32 noundef 2)
          to label %46 unwind label %51

46:                                               ; preds = %44
  %47 = icmp eq ptr %45, null
  br i1 %47, label %48, label %55

48:                                               ; preds = %46
  %49 = invoke noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cout, ptr noundef @.str.3)
          to label %50 unwind label %51

50:                                               ; preds = %48
  br label %58

51:                                               ; preds = %139, %136, %132, %130, %128, %124, %122, %120, %117, %114, %110, %108, %106, %102, %100, %98, %96, %92, %90, %88, %86, %82, %80, %78, %76, %72, %70, %68, %66, %62, %60, %58, %55, %48, %44, %42, %40, %36, %34, %32
  %52 = landingpad { ptr, i32 }
          cleanup
  %53 = extractvalue { ptr, i32 } %52, 0
  store ptr %53, ptr %8, align 8
  %54 = extractvalue { ptr, i32 } %52, 1
  store i32 %54, ptr %9, align 4
  br label %144

55:                                               ; preds = %46
  %56 = invoke noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cout, ptr noundef @.str.4)
          to label %57 unwind label %51

57:                                               ; preds = %55
  br label %58

58:                                               ; preds = %57, %50
  %59 = invoke noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cout, ptr noundef @.str.5)
          to label %60 unwind label %51

60:                                               ; preds = %58
  %61 = invoke noundef ptr @_Z16inorderSuccessorR3BSTi(ptr noundef nonnull align 8 dereferenceable(8) %2, i32 noundef 3)
          to label %62 unwind label %51

62:                                               ; preds = %60
  %63 = getelementptr inbounds %struct.Node, ptr %61, i32 0, i32 0
  %64 = load i32, ptr %63, align 8, !tbaa !11
  %65 = invoke noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEi(ptr noundef nonnull align 8 dereferenceable(8) %59, i32 noundef %64)
          to label %66 unwind label %51

66:                                               ; preds = %62
  %67 = invoke noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc(ptr noundef nonnull align 8 dereferenceable(8) %65, ptr noundef @.str.1)
          to label %68 unwind label %51

68:                                               ; preds = %66
  %69 = invoke noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cout, ptr noundef @.str.6)
          to label %70 unwind label %51

70:                                               ; preds = %68
  %71 = invoke noundef ptr @_Z16inorderSuccessorR3BSTi(ptr noundef nonnull align 8 dereferenceable(8) %2, i32 noundef 4)
          to label %72 unwind label %51

72:                                               ; preds = %70
  %73 = getelementptr inbounds %struct.Node, ptr %71, i32 0, i32 0
  %74 = load i32, ptr %73, align 8, !tbaa !11
  %75 = invoke noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEi(ptr noundef nonnull align 8 dereferenceable(8) %69, i32 noundef %74)
          to label %76 unwind label %51

76:                                               ; preds = %72
  %77 = invoke noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc(ptr noundef nonnull align 8 dereferenceable(8) %75, ptr noundef @.str.1)
          to label %78 unwind label %51

78:                                               ; preds = %76
  %79 = invoke noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cout, ptr noundef @.str.7)
          to label %80 unwind label %51

80:                                               ; preds = %78
  %81 = invoke noundef ptr @_Z16inorderSuccessorR3BSTi(ptr noundef nonnull align 8 dereferenceable(8) %2, i32 noundef 5)
          to label %82 unwind label %51

82:                                               ; preds = %80
  %83 = getelementptr inbounds %struct.Node, ptr %81, i32 0, i32 0
  %84 = load i32, ptr %83, align 8, !tbaa !11
  %85 = invoke noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEi(ptr noundef nonnull align 8 dereferenceable(8) %79, i32 noundef %84)
          to label %86 unwind label %51

86:                                               ; preds = %82
  %87 = invoke noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc(ptr noundef nonnull align 8 dereferenceable(8) %85, ptr noundef @.str.1)
          to label %88 unwind label %51

88:                                               ; preds = %86
  %89 = invoke noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cout, ptr noundef @.str.8)
          to label %90 unwind label %51

90:                                               ; preds = %88
  %91 = invoke noundef ptr @_Z16inorderSuccessorR3BSTi(ptr noundef nonnull align 8 dereferenceable(8) %2, i32 noundef 6)
          to label %92 unwind label %51

92:                                               ; preds = %90
  %93 = getelementptr inbounds %struct.Node, ptr %91, i32 0, i32 0
  %94 = load i32, ptr %93, align 8, !tbaa !11
  %95 = invoke noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEi(ptr noundef nonnull align 8 dereferenceable(8) %89, i32 noundef %94)
          to label %96 unwind label %51

96:                                               ; preds = %92
  %97 = invoke noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc(ptr noundef nonnull align 8 dereferenceable(8) %95, ptr noundef @.str.1)
          to label %98 unwind label %51

98:                                               ; preds = %96
  %99 = invoke noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cout, ptr noundef @.str.9)
          to label %100 unwind label %51

100:                                              ; preds = %98
  %101 = invoke noundef ptr @_Z16inorderSuccessorR3BSTi(ptr noundef nonnull align 8 dereferenceable(8) %2, i32 noundef 7)
          to label %102 unwind label %51

102:                                              ; preds = %100
  %103 = getelementptr inbounds %struct.Node, ptr %101, i32 0, i32 0
  %104 = load i32, ptr %103, align 8, !tbaa !11
  %105 = invoke noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEi(ptr noundef nonnull align 8 dereferenceable(8) %99, i32 noundef %104)
          to label %106 unwind label %51

106:                                              ; preds = %102
  %107 = invoke noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc(ptr noundef nonnull align 8 dereferenceable(8) %105, ptr noundef @.str.1)
          to label %108 unwind label %51

108:                                              ; preds = %106
  %109 = invoke noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cout, ptr noundef @.str.10)
          to label %110 unwind label %51

110:                                              ; preds = %108
  %111 = invoke noundef ptr @_Z16inorderSuccessorR3BSTi(ptr noundef nonnull align 8 dereferenceable(8) %2, i32 noundef 8)
          to label %112 unwind label %51

112:                                              ; preds = %110
  %113 = icmp eq ptr %111, null
  br i1 %113, label %114, label %117

114:                                              ; preds = %112
  %115 = invoke noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cout, ptr noundef @.str.3)
          to label %116 unwind label %51

116:                                              ; preds = %114
  br label %120

117:                                              ; preds = %112
  %118 = invoke noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cout, ptr noundef @.str.4)
          to label %119 unwind label %51

119:                                              ; preds = %117
  br label %120

120:                                              ; preds = %119, %116
  %121 = invoke noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cout, ptr noundef @.str.11)
          to label %122 unwind label %51

122:                                              ; preds = %120
  %123 = invoke noundef ptr @_Z16inorderSuccessorR3BSTi(ptr noundef nonnull align 8 dereferenceable(8) %2, i32 noundef 9)
          to label %124 unwind label %51

124:                                              ; preds = %122
  %125 = getelementptr inbounds %struct.Node, ptr %123, i32 0, i32 0
  %126 = load i32, ptr %125, align 8, !tbaa !11
  %127 = invoke noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEi(ptr noundef nonnull align 8 dereferenceable(8) %121, i32 noundef %126)
          to label %128 unwind label %51

128:                                              ; preds = %124
  %129 = invoke noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc(ptr noundef nonnull align 8 dereferenceable(8) %127, ptr noundef @.str.1)
          to label %130 unwind label %51

130:                                              ; preds = %128
  %131 = invoke noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cout, ptr noundef @.str.12)
          to label %132 unwind label %51

132:                                              ; preds = %130
  %133 = invoke noundef ptr @_Z16inorderSuccessorR3BSTi(ptr noundef nonnull align 8 dereferenceable(8) %2, i32 noundef 10)
          to label %134 unwind label %51

134:                                              ; preds = %132
  %135 = icmp eq ptr %133, null
  br i1 %135, label %136, label %139

136:                                              ; preds = %134
  %137 = invoke noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cout, ptr noundef @.str.3)
          to label %138 unwind label %51

138:                                              ; preds = %136
  br label %142

139:                                              ; preds = %134
  %140 = invoke noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cout, ptr noundef @.str.4)
          to label %141 unwind label %51

141:                                              ; preds = %139
  br label %142

142:                                              ; preds = %141, %138
  store i32 0, ptr %1, align 4
  call void @llvm.lifetime.end.p0(i64 32, ptr %3) #7
  call void @_ZN3BSTD2Ev(ptr noundef nonnull align 8 dereferenceable(8) %2) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr %2) #7
  %143 = load i32, ptr %1, align 4
  ret i32 %143

144:                                              ; preds = %51, %28
  call void @llvm.lifetime.end.p0(i64 32, ptr %3) #7
  call void @_ZN3BSTD2Ev(ptr noundef nonnull align 8 dereferenceable(8) %2) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr %2) #7
  br label %145

145:                                              ; preds = %144
  %146 = load ptr, ptr %8, align 8
  %147 = load i32, ptr %9, align 4
  %148 = insertvalue { ptr, i32 } poison, ptr %146, 0
  %149 = insertvalue { ptr, i32 } %148, i32 %147, 1
  resume { ptr, i32 } %149
}

; Function Attrs: nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZN3BSTC2Ev(ptr noundef nonnull align 8 dereferenceable(8)) unnamed_addr #2 align 2

; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: readwrite)
declare void @llvm.memcpy.p0.p0.i64(ptr noalias nocapture writeonly, ptr noalias nocapture readonly, i64, i1 immarg) #3

declare void @_ZN3BST6insertEi(ptr noundef nonnull align 8 dereferenceable(8), i32 noundef) #4

declare i32 @__gxx_personality_v0(...)

; Function Attrs: nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1

; Function Attrs: inlinehint mustprogress uwtable
declare noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc(ptr noundef nonnull align 8 dereferenceable(8), ptr noundef) #5

declare noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEi(ptr noundef nonnull align 8 dereferenceable(8), i32 noundef) #4

; Function Attrs: mustprogress uwtable
declare dso_local noundef ptr @_Z16inorderSuccessorR3BSTi(ptr noundef nonnull align 8 dereferenceable(8), i32 noundef) #6

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZN3BSTD2Ev(ptr noundef nonnull align 8 dereferenceable(8)) unnamed_addr #2 align 2

attributes #0 = { mustprogress norecurse uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { mustprogress nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nocallback nofree nounwind willreturn memory(argmem: readwrite) }
attributes #4 = { "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #5 = { inlinehint mustprogress uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #6 = { mustprogress uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #7 = { nounwind }

!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}

!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"clang version 19.1.0 (git@github.com:llvm/llvm-project.git a4bf6cd7cfb1a1421ba92bca9d017b49936c55e4)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"any pointer", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C++ TBAA"}
!9 = !{!10, !10, i64 0}
!10 = !{!"int", !7, i64 0}
!11 = !{!12, !10, i64 0}
!12 = !{!"_ZTS4Node", !10, i64 0, !6, i64 8, !6, i64 16}


; Optimized IR (opt -passes='default<O3>'):
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-i128:128-f80:128-n8:16:32:64-S128"
target triple = "x86_64-unknown-linux-gnu"

%"class.std::basic_ostream" = type { ptr, %"class.std::basic_ios" }
%"class.std::basic_ios" = type { %"class.std::ios_base", ptr, i8, i8, ptr, ptr, ptr, ptr }
%"class.std::ios_base" = type { ptr, i64, i64, i32, i32, i32, ptr, %"struct.std::ios_base::_Words", [8 x %"struct.std::ios_base::_Words"], i32, ptr, %"class.std::locale" }
%"struct.std::ios_base::_Words" = type { ptr, i64 }
%"class.std::locale" = type { ptr }
%class.BST = type { ptr }

@__const.main.original = external hidden unnamed_addr constant [8 x i32], align 16
@_ZSt4cout = external global %"class.std::basic_ostream", align 8
@.str = external hidden unnamed_addr constant [25 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [2 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [25 x i8], align 1
@.str.3 = external hidden unnamed_addr constant [9 x i8], align 1
@.str.4 = external hidden unnamed_addr constant [13 x i8], align 1
@.str.5 = external hidden unnamed_addr constant [25 x i8], align 1
@.str.6 = external hidden unnamed_addr constant [25 x i8], align 1
@.str.7 = external hidden unnamed_addr constant [25 x i8], align 1
@.str.8 = external hidden unnamed_addr constant [25 x i8], align 1
@.str.9 = external hidden unnamed_addr constant [25 x i8], align 1
@.str.10 = external hidden unnamed_addr constant [25 x i8], align 1
@.str.11 = external hidden unnamed_addr constant [25 x i8], align 1
@.str.12 = external hidden unnamed_addr constant [26 x i8], align 1

; Function Attrs: mustprogress norecurse uwtable
define dso_local noundef i32 @main() local_unnamed_addr #0 personality ptr @__gxx_personality_v0 {
  %1 = alloca %class.BST, align 8
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %1) #6
  call void @_ZN3BSTC2Ev(ptr noundef nonnull align 8 dereferenceable(8) %1)
  %2 = load i32, ptr @__const.main.original, align 16, !tbaa !5
  invoke void @_ZN3BST6insertEi(ptr noundef nonnull align 8 dereferenceable(8) %1, i32 noundef %2)
          to label %3 unwind label %19

3:                                                ; preds = %0
  %4 = load i32, ptr getelementptr inbounds (i8, ptr @__const.main.original, i64 4), align 4, !tbaa !5
  invoke void @_ZN3BST6insertEi(ptr noundef nonnull align 8 dereferenceable(8) %1, i32 noundef %4)
          to label %5 unwind label %19

5:                                                ; preds = %3
  %6 = load i32, ptr getelementptr inbounds (i8, ptr @__const.main.original, i64 8), align 8, !tbaa !5
  invoke void @_ZN3BST6insertEi(ptr noundef nonnull align 8 dereferenceable(8) %1, i32 noundef %6)
          to label %7 unwind label %19

7:                                                ; preds = %5
  %8 = load i32, ptr getelementptr inbounds (i8, ptr @__const.main.original, i64 12), align 4, !tbaa !5
  invoke void @_ZN3BST6insertEi(ptr noundef nonnull align 8 dereferenceable(8) %1, i32 noundef %8)
          to label %9 unwind label %19

9:                                                ; preds = %7
  %10 = load i32, ptr getelementptr inbounds (i8, ptr @__const.main.original, i64 16), align 16, !tbaa !5
  invoke void @_ZN3BST6insertEi(ptr noundef nonnull align 8 dereferenceable(8) %1, i32 noundef %10)
          to label %11 unwind label %19

11:                                               ; preds = %9
  %12 = load i32, ptr getelementptr inbounds (i8, ptr @__const.main.original, i64 20), align 4, !tbaa !5
  invoke void @_ZN3BST6insertEi(ptr noundef nonnull align 8 dereferenceable(8) %1, i32 noundef %12)
          to label %13 unwind label %19

13:                                               ; preds = %11
  %14 = load i32, ptr getelementptr inbounds (i8, ptr @__const.main.original, i64 24), align 8, !tbaa !5
  invoke void @_ZN3BST6insertEi(ptr noundef nonnull align 8 dereferenceable(8) %1, i32 noundef %14)
          to label %15 unwind label %19

15:                                               ; preds = %13
  %16 = load i32, ptr getelementptr inbounds (i8, ptr @__const.main.original, i64 28), align 4, !tbaa !5
  invoke void @_ZN3BST6insertEi(ptr noundef nonnull align 8 dereferenceable(8) %1, i32 noundef %16)
          to label %17 unwind label %19

17:                                               ; preds = %15
  %18 = invoke noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cout, ptr noundef nonnull @.str)
          to label %21 unwind label %35

19:                                               ; preds = %15, %13, %11, %9, %7, %5, %3, %0
  %20 = landingpad { ptr, i32 }
          cleanup
  br label %104

21:                                               ; preds = %17
  %22 = invoke noundef ptr @_Z16inorderSuccessorR3BSTi(ptr noundef nonnull align 8 dereferenceable(8) %1, i32 noundef 1)
          to label %23 unwind label %35

23:                                               ; preds = %21
  %24 = load i32, ptr %22, align 8, !tbaa !9
  %25 = invoke noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEi(ptr noundef nonnull align 8 dereferenceable(8) %18, i32 noundef %24)
          to label %26 unwind label %35

26:                                               ; preds = %23
  %27 = invoke noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc(ptr noundef nonnull align 8 dereferenceable(8) %25, ptr noundef nonnull @.str.1)
          to label %28 unwind label %35

28:                                               ; preds = %26
  %29 = invoke noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cout, ptr noundef nonnull @.str.2)
          to label %30 unwind label %35

30:                                               ; preds = %28
  %31 = invoke noundef ptr @_Z16inorderSuccessorR3BSTi(ptr noundef nonnull align 8 dereferenceable(8) %1, i32 noundef 2)
          to label %.invoke14 unwind label %35

.invoke14:                                        ; preds = %30
  %32 = icmp eq ptr %31, null
  %33 = select i1 %32, ptr @.str.3, ptr @.str.4
  %34 = invoke noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cout, ptr noundef nonnull %33)
          to label %37 unwind label %35

35:                                               ; preds = %.invoke14, %.invoke13, %.invoke, %99, %97, %95, %92, %90, %88, %84, %82, %80, %77, %75, %73, %71, %68, %66, %64, %62, %59, %57, %55, %53, %50, %48, %46, %44, %41, %39, %37, %30, %28, %26, %23, %21, %17
  %36 = landingpad { ptr, i32 }
          cleanup
  br label %104

37:                                               ; preds = %.invoke14
  %38 = invoke noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cout, ptr noundef nonnull @.str.5)
          to label %39 unwind label %35

39:                                               ; preds = %37
  %40 = invoke noundef ptr @_Z16inorderSuccessorR3BSTi(ptr noundef nonnull align 8 dereferenceable(8) %1, i32 noundef 3)
          to label %41 unwind label %35

41:                                               ; preds = %39
  %42 = load i32, ptr %40, align 8, !tbaa !9
  %43 = invoke noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEi(ptr noundef nonnull align 8 dereferenceable(8) %38, i32 noundef %42)
          to label %44 unwind label %35

44:                                               ; preds = %41
  %45 = invoke noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc(ptr noundef nonnull align 8 dereferenceable(8) %43, ptr noundef nonnull @.str.1)
          to label %46 unwind label %35

46:                                               ; preds = %44
  %47 = invoke noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cout, ptr noundef nonnull @.str.6)
          to label %48 unwind label %35

48:                                               ; preds = %46
  %49 = invoke noundef ptr @_Z16inorderSuccessorR3BSTi(ptr noundef nonnull align 8 dereferenceable(8) %1, i32 noundef 4)
          to label %50 unwind label %35

50:                                               ; preds = %48
  %51 = load i32, ptr %49, align 8, !tbaa !9
  %52 = invoke noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEi(ptr noundef nonnull align 8 dereferenceable(8) %47, i32 noundef %51)
          to label %53 unwind label %35

53:                                               ; preds = %50
  %54 = invoke noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc(ptr noundef nonnull align 8 dereferenceable(8) %52, ptr noundef nonnull @.str.1)
          to label %55 unwind label %35

55:                                               ; preds = %53
  %56 = invoke noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cout, ptr noundef nonnull @.str.7)
          to label %57 unwind label %35

57:                                               ; preds = %55
  %58 = invoke noundef ptr @_Z16inorderSuccessorR3BSTi(ptr noundef nonnull align 8 dereferenceable(8) %1, i32 noundef 5)
          to label %59 unwind label %35

59:                                               ; preds = %57
  %60 = load i32, ptr %58, align 8, !tbaa !9
  %61 = invoke noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEi(ptr noundef nonnull align 8 dereferenceable(8) %56, i32 noundef %60)
          to label %62 unwind label %35

62:                                               ; preds = %59
  %63 = invoke noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc(ptr noundef nonnull align 8 dereferenceable(8) %61, ptr noundef nonnull @.str.1)
          to label %64 unwind label %35

64:                                               ; preds = %62
  %65 = invoke noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cout, ptr noundef nonnull @.str.8)
          to label %66 unwind label %35

66:                                               ; preds = %64
  %67 = invoke noundef ptr @_Z16inorderSuccessorR3BSTi(ptr noundef nonnull align 8 dereferenceable(8) %1, i32 noundef 6)
          to label %68 unwind label %35

68:                                               ; preds = %66
  %69 = load i32, ptr %67, align 8, !tbaa !9
  %70 = invoke noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEi(ptr noundef nonnull align 8 dereferenceable(8) %65, i32 noundef %69)
          to label %71 unwind label %35

71:                                               ; preds = %68
  %72 = invoke noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc(ptr noundef nonnull align 8 dereferenceable(8) %70, ptr noundef nonnull @.str.1)
          to label %73 unwind label %35

73:                                               ; preds = %71
  %74 = invoke noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cout, ptr noundef nonnull @.str.9)
          to label %75 unwind label %35

75:                                               ; preds = %73
  %76 = invoke noundef ptr @_Z16inorderSuccessorR3BSTi(ptr noundef nonnull align 8 dereferenceable(8) %1, i32 noundef 7)
          to label %77 unwind label %35

77:                                               ; preds = %75
  %78 = load i32, ptr %76, align 8, !tbaa !9
  %79 = invoke noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEi(ptr noundef nonnull align 8 dereferenceable(8) %74, i32 noundef %78)
          to label %80 unwind label %35

80:                                               ; preds = %77
  %81 = invoke noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc(ptr noundef nonnull align 8 dereferenceable(8) %79, ptr noundef nonnull @.str.1)
          to label %82 unwind label %35

82:                                               ; preds = %80
  %83 = invoke noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cout, ptr noundef nonnull @.str.10)
          to label %84 unwind label %35

84:                                               ; preds = %82
  %85 = invoke noundef ptr @_Z16inorderSuccessorR3BSTi(ptr noundef nonnull align 8 dereferenceable(8) %1, i32 noundef 8)
          to label %.invoke13 unwind label %35

.invoke13:                                        ; preds = %84
  %86 = icmp eq ptr %85, null
  %.str.3..str.4 = select i1 %86, ptr @.str.3, ptr @.str.4
  %87 = invoke noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cout, ptr noundef nonnull %.str.3..str.4)
          to label %88 unwind label %35

88:                                               ; preds = %.invoke13
  %89 = invoke noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cout, ptr noundef nonnull @.str.11)
          to label %90 unwind label %35

90:                                               ; preds = %88
  %91 = invoke noundef ptr @_Z16inorderSuccessorR3BSTi(ptr noundef nonnull align 8 dereferenceable(8) %1, i32 noundef 9)
          to label %92 unwind label %35

92:                                               ; preds = %90
  %93 = load i32, ptr %91, align 8, !tbaa !9
  %94 = invoke noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEi(ptr noundef nonnull align 8 dereferenceable(8) %89, i32 noundef %93)
          to label %95 unwind label %35

95:                                               ; preds = %92
  %96 = invoke noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc(ptr noundef nonnull align 8 dereferenceable(8) %94, ptr noundef nonnull @.str.1)
          to label %97 unwind label %35

97:                                               ; preds = %95
  %98 = invoke noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cout, ptr noundef nonnull @.str.12)
          to label %99 unwind label %35

99:                                               ; preds = %97
  %100 = invoke noundef ptr @_Z16inorderSuccessorR3BSTi(ptr noundef nonnull align 8 dereferenceable(8) %1, i32 noundef 10)
          to label %.invoke unwind label %35

.invoke:                                          ; preds = %99
  %101 = icmp eq ptr %100, null
  %.str.3..str.415 = select i1 %101, ptr @.str.3, ptr @.str.4
  %102 = invoke noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cout, ptr noundef nonnull %.str.3..str.415)
          to label %103 unwind label %35

103:                                              ; preds = %.invoke
  call void @_ZN3BSTD2Ev(ptr noundef nonnull align 8 dereferenceable(8) %1) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %1) #6
  ret i32 0

104:                                              ; preds = %35, %19
  %.pn = phi { ptr, i32 } [ %20, %19 ], [ %36, %35 ]
  call void @_ZN3BSTD2Ev(ptr noundef nonnull align 8 dereferenceable(8) %1) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %1) #6
  resume { ptr, i32 } %.pn
}

; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #1

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZN3BSTC2Ev(ptr noundef nonnull align 8 dereferenceable(8)) unnamed_addr #2 align 2

declare void @_ZN3BST6insertEi(ptr noundef nonnull align 8 dereferenceable(8), i32 noundef) local_unnamed_addr #3

declare i32 @__gxx_personality_v0(...)

; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #1

; Function Attrs: inlinehint mustprogress uwtable
declare noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc(ptr noundef nonnull align 8 dereferenceable(8), ptr noundef) local_unnamed_addr #4

declare noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEi(ptr noundef nonnull align 8 dereferenceable(8), i32 noundef) local_unnamed_addr #3

; Function Attrs: mustprogress uwtable
declare dso_local noundef ptr @_Z16inorderSuccessorR3BSTi(ptr noundef nonnull align 8 dereferenceable(8), i32 noundef) local_unnamed_addr #5

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZN3BSTD2Ev(ptr noundef nonnull align 8 dereferenceable(8)) unnamed_addr #2 align 2

attributes #0 = { mustprogress norecurse uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { mustprogress nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { inlinehint mustprogress uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #5 = { mustprogress uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #6 = { nounwind }

!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}

!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"clang version 19.1.0 (git@github.com:llvm/llvm-project.git a4bf6cd7cfb1a1421ba92bca9d017b49936c55e4)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C++ TBAA"}
!9 = !{!10, !6, i64 0}
!10 = !{!"_ZTS4Node", !6, i64 0, !11, i64 8, !11, i64 16}
!11 = !{!"any pointer", !7, i64 0}


; Effective O3 passes: EarlyCSEPass,GVNPass,GlobalOptPass,InferAlignmentPass,InferFunctionAttrsPass,InstCombinePass,LoopRotatePass,SROAPass,SimplifyCFGPass