; LLVM IR from HarshCasper/NeoAlgo :: C-Plus-Plus/ds (BinaryTreeUsingStack)

; 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.std::basic_istream" = type { ptr, i64, %"class.std::basic_ios" }
%class.Tree = type { i32, i32, ptr, ptr }
%"class.std::stack" = type { %"class.std::deque" }
%"class.std::deque" = type { %"class.std::_Deque_base" }
%"class.std::_Deque_base" = type { %"struct.std::_Deque_base<Tree *, std::allocator<Tree *>>::_Deque_impl" }
%"struct.std::_Deque_base<Tree *, std::allocator<Tree *>>::_Deque_impl" = type { %"struct.std::_Deque_base<Tree *, std::allocator<Tree *>>::_Deque_impl_data" }
%"struct.std::_Deque_base<Tree *, std::allocator<Tree *>>::_Deque_impl_data" = type { ptr, i64, %"struct.std::_Deque_iterator", %"struct.std::_Deque_iterator" }
%"struct.std::_Deque_iterator" = type { ptr, ptr, ptr, ptr }

@_ZSt4cout = external global %"class.std::basic_ostream", align 8
@.str = external hidden unnamed_addr constant [25 x i8], align 1
@_ZSt3cin = external global %"class.std::basic_istream", align 8
@.str.1 = external hidden unnamed_addr constant [22 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [2 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 i32, align 4
  %3 = alloca ptr, align 8
  %4 = alloca i64, align 8
  %5 = alloca i32, align 4
  %6 = alloca %class.Tree, align 8
  %7 = alloca %"class.std::stack", align 8
  %8 = alloca ptr, align 8
  %9 = alloca ptr, align 8
  %10 = alloca i32, align 4
  %11 = alloca i32, align 4
  %12 = alloca ptr, align 8
  %13 = alloca ptr, align 8
  store i32 0, ptr %1, align 4
  call void @llvm.lifetime.start.p0(i64 4, ptr %2) #10
  %14 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cout, ptr noundef @.str)
  %15 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERi(ptr noundef nonnull align 8 dereferenceable(16) @_ZSt3cin, ptr noundef nonnull align 4 dereferenceable(4) %2)
  %16 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cout, ptr noundef @.str.1)
  %17 = load i32, ptr %2, align 4, !tbaa !5
  %18 = zext i32 %17 to i64
  %19 = call ptr @llvm.stacksave.p0()
  store ptr %19, ptr %3, align 8
  %20 = alloca i32, i64 %18, align 16
  store i64 %18, ptr %4, align 8
  call void @llvm.lifetime.start.p0(i64 4, ptr %5) #10
  store i32 0, ptr %5, align 4, !tbaa !5
  br label %21

21:                                               ; preds = %31, %0
  %22 = load i32, ptr %5, align 4, !tbaa !5
  %23 = load i32, ptr %2, align 4, !tbaa !5
  %24 = icmp slt i32 %22, %23
  br i1 %24, label %26, label %25

25:                                               ; preds = %21
  call void @llvm.lifetime.end.p0(i64 4, ptr %5) #10
  br label %34

26:                                               ; preds = %21
  %27 = load i32, ptr %5, align 4, !tbaa !5
  %28 = sext i32 %27 to i64
  %29 = getelementptr inbounds i32, ptr %20, i64 %28
  %30 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERi(ptr noundef nonnull align 8 dereferenceable(16) @_ZSt3cin, ptr noundef nonnull align 4 dereferenceable(4) %29)
  br label %31

31:                                               ; preds = %26
  %32 = load i32, ptr %5, align 4, !tbaa !5
  %33 = add nsw i32 %32, 1
  store i32 %33, ptr %5, align 4, !tbaa !5
  br label %21, !llvm.loop !9

34:                                               ; preds = %25
  %35 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cout, ptr noundef @.str.2)
  call void @llvm.lifetime.start.p0(i64 24, ptr %6) #10
  call void @_ZN4TreeC2Ev(ptr noundef nonnull align 8 dereferenceable(24) %6)
  call void @llvm.lifetime.start.p0(i64 80, ptr %7) #10
  call void @_ZNSt5stackIP4TreeSt5dequeIS1_SaIS1_EEEC2IS4_vEEv(ptr noundef nonnull align 8 dereferenceable(80) %7)
  call void @llvm.lifetime.start.p0(i64 8, ptr %8) #10
  %36 = invoke noalias noundef nonnull ptr @_Znwm(i64 noundef 24) #11
          to label %37 unwind label %79

37:                                               ; preds = %34
  %38 = getelementptr inbounds i32, ptr %20, i64 0
  %39 = load i32, ptr %38, align 16, !tbaa !5
  invoke void @_ZN4TreeC2Eii(ptr noundef nonnull align 8 dereferenceable(24) %36, i32 noundef %39, i32 noundef 1)
          to label %40 unwind label %83

40:                                               ; preds = %37
  store ptr %36, ptr %8, align 8, !tbaa !11
  invoke void @_ZNSt5stackIP4TreeSt5dequeIS1_SaIS1_EEE4pushERKS1_(ptr noundef nonnull align 8 dereferenceable(80) %7, ptr noundef nonnull align 8 dereferenceable(8) %8)
          to label %41 unwind label %79

41:                                               ; preds = %40
  call void @llvm.lifetime.start.p0(i64 4, ptr %11) #10
  store i32 1, ptr %11, align 4, !tbaa !5
  br label %42

42:                                               ; preds = %185, %41
  %43 = invoke noundef i64 @_ZNKSt5stackIP4TreeSt5dequeIS1_SaIS1_EEE4sizeEv(ptr noundef nonnull align 8 dereferenceable(80) %7)
          to label %44 unwind label %87

44:                                               ; preds = %42
  %45 = icmp ugt i64 %43, 0
  br i1 %45, label %46, label %188

46:                                               ; preds = %44
  %47 = invoke noundef nonnull align 8 dereferenceable(8) ptr @_ZNSt5stackIP4TreeSt5dequeIS1_SaIS1_EEE3topEv(ptr noundef nonnull align 8 dereferenceable(80) %7)
          to label %48 unwind label %87

48:                                               ; preds = %46
  %49 = load ptr, ptr %47, align 8, !tbaa !11
  %50 = getelementptr inbounds %class.Tree, ptr %49, i32 0, i32 1
  %51 = load i32, ptr %50, align 4, !tbaa !13
  %52 = icmp eq i32 %51, 1
  br i1 %52, label %53, label %112

53:                                               ; preds = %48
  %54 = load i32, ptr %11, align 4, !tbaa !5
  %55 = sext i32 %54 to i64
  %56 = getelementptr inbounds i32, ptr %20, i64 %55
  %57 = load i32, ptr %56, align 4, !tbaa !5
  %58 = icmp ne i32 %57, -1
  br i1 %58, label %59, label %100

59:                                               ; preds = %53
  call void @llvm.lifetime.start.p0(i64 8, ptr %12) #10
  %60 = invoke noalias noundef nonnull ptr @_Znwm(i64 noundef 24) #11
          to label %61 unwind label %91

61:                                               ; preds = %59
  %62 = load i32, ptr %11, align 4, !tbaa !5
  %63 = sext i32 %62 to i64
  %64 = getelementptr inbounds i32, ptr %20, i64 %63
  %65 = load i32, ptr %64, align 4, !tbaa !5
  invoke void @_ZN4TreeC2Eii(ptr noundef nonnull align 8 dereferenceable(24) %60, i32 noundef %65, i32 noundef 1)
          to label %66 unwind label %95

66:                                               ; preds = %61
  store ptr %60, ptr %12, align 8, !tbaa !11
  %67 = invoke noundef nonnull align 8 dereferenceable(8) ptr @_ZNSt5stackIP4TreeSt5dequeIS1_SaIS1_EEE3topEv(ptr noundef nonnull align 8 dereferenceable(80) %7)
          to label %68 unwind label %91

68:                                               ; preds = %66
  %69 = load ptr, ptr %67, align 8, !tbaa !11
  %70 = getelementptr inbounds %class.Tree, ptr %69, i32 0, i32 1
  %71 = load i32, ptr %70, align 4, !tbaa !13
  %72 = add nsw i32 %71, 1
  store i32 %72, ptr %70, align 4, !tbaa !13
  %73 = load ptr, ptr %12, align 8, !tbaa !11
  %74 = invoke noundef nonnull align 8 dereferenceable(8) ptr @_ZNSt5stackIP4TreeSt5dequeIS1_SaIS1_EEE3topEv(ptr noundef nonnull align 8 dereferenceable(80) %7)
          to label %75 unwind label %91

75:                                               ; preds = %68
  %76 = load ptr, ptr %74, align 8, !tbaa !11
  %77 = getelementptr inbounds %class.Tree, ptr %76, i32 0, i32 2
  store ptr %73, ptr %77, align 8, !tbaa !15
  invoke void @_ZNSt5stackIP4TreeSt5dequeIS1_SaIS1_EEE4pushERKS1_(ptr noundef nonnull align 8 dereferenceable(80) %7, ptr noundef nonnull align 8 dereferenceable(8) %12)
          to label %78 unwind label %91

78:                                               ; preds = %75
  call void @llvm.lifetime.end.p0(i64 8, ptr %12) #10
  br label %111

79:                                               ; preds = %40, %34
  %80 = landingpad { ptr, i32 }
          cleanup
  %81 = extractvalue { ptr, i32 } %80, 0
  store ptr %81, ptr %9, align 8
  %82 = extractvalue { ptr, i32 } %80, 1
  store i32 %82, ptr %10, align 4
  br label %196

83:                                               ; preds = %37
  %84 = landingpad { ptr, i32 }
          cleanup
  %85 = extractvalue { ptr, i32 } %84, 0
  store ptr %85, ptr %9, align 8
  %86 = extractvalue { ptr, i32 } %84, 1
  store i32 %86, ptr %10, align 4
  call void @_ZdlPvm(ptr noundef %36, i64 noundef 24) #12
  br label %196

87:                                               ; preds = %190, %188, %183, %176, %165, %163, %112, %102, %100, %46, %42
  %88 = landingpad { ptr, i32 }
          cleanup
  %89 = extractvalue { ptr, i32 } %88, 0
  store ptr %89, ptr %9, align 8
  %90 = extractvalue { ptr, i32 } %88, 1
  store i32 %90, ptr %10, align 4
  br label %195

91:                                               ; preds = %75, %68, %66, %59
  %92 = landingpad { ptr, i32 }
          cleanup
  %93 = extractvalue { ptr, i32 } %92, 0
  store ptr %93, ptr %9, align 8
  %94 = extractvalue { ptr, i32 } %92, 1
  store i32 %94, ptr %10, align 4
  br label %99

95:                                               ; preds = %61
  %96 = landingpad { ptr, i32 }
          cleanup
  %97 = extractvalue { ptr, i32 } %96, 0
  store ptr %97, ptr %9, align 8
  %98 = extractvalue { ptr, i32 } %96, 1
  store i32 %98, ptr %10, align 4
  call void @_ZdlPvm(ptr noundef %60, i64 noundef 24) #12
  br label %99

99:                                               ; preds = %95, %91
  call void @llvm.lifetime.end.p0(i64 8, ptr %12) #10
  br label %195

100:                                              ; preds = %53
  %101 = invoke noundef nonnull align 8 dereferenceable(8) ptr @_ZNSt5stackIP4TreeSt5dequeIS1_SaIS1_EEE3topEv(ptr noundef nonnull align 8 dereferenceable(80) %7)
          to label %102 unwind label %87

102:                                              ; preds = %100
  %103 = load ptr, ptr %101, align 8, !tbaa !11
  %104 = getelementptr inbounds %class.Tree, ptr %103, i32 0, i32 2
  store ptr null, ptr %104, align 8, !tbaa !15
  %105 = invoke noundef nonnull align 8 dereferenceable(8) ptr @_ZNSt5stackIP4TreeSt5dequeIS1_SaIS1_EEE3topEv(ptr noundef nonnull align 8 dereferenceable(80) %7)
          to label %106 unwind label %87

106:                                              ; preds = %102
  %107 = load ptr, ptr %105, align 8, !tbaa !11
  %108 = getelementptr inbounds %class.Tree, ptr %107, i32 0, i32 1
  %109 = load i32, ptr %108, align 4, !tbaa !13
  %110 = add nsw i32 %109, 1
  store i32 %110, ptr %108, align 4, !tbaa !13
  br label %111

111:                                              ; preds = %106, %78
  br label %176

112:                                              ; preds = %48
  %113 = invoke noundef nonnull align 8 dereferenceable(8) ptr @_ZNSt5stackIP4TreeSt5dequeIS1_SaIS1_EEE3topEv(ptr noundef nonnull align 8 dereferenceable(80) %7)
          to label %114 unwind label %87

114:                                              ; preds = %112
  %115 = load ptr, ptr %113, align 8, !tbaa !11
  %116 = getelementptr inbounds %class.Tree, ptr %115, i32 0, i32 1
  %117 = load i32, ptr %116, align 4, !tbaa !13
  %118 = icmp eq i32 %117, 2
  br i1 %118, label %119, label %175

119:                                              ; preds = %114
  %120 = load i32, ptr %11, align 4, !tbaa !5
  %121 = sext i32 %120 to i64
  %122 = getelementptr inbounds i32, ptr %20, i64 %121
  %123 = load i32, ptr %122, align 4, !tbaa !5
  %124 = icmp ne i32 %123, -1
  br i1 %124, label %125, label %163

125:                                              ; preds = %119
  call void @llvm.lifetime.start.p0(i64 8, ptr %13) #10
  %126 = invoke noalias noundef nonnull ptr @_Znwm(i64 noundef 24) #11
          to label %127 unwind label %152

127:                                              ; preds = %125
  %128 = load i32, ptr %11, align 4, !tbaa !5
  %129 = sext i32 %128 to i64
  %130 = getelementptr inbounds i32, ptr %20, i64 %129
  %131 = load i32, ptr %130, align 4, !tbaa !5
  invoke void @_ZN4TreeC2Eii(ptr noundef nonnull align 8 dereferenceable(24) %126, i32 noundef %131, i32 noundef 1)
          to label %132 unwind label %156

132:                                              ; preds = %127
  store ptr %126, ptr %13, align 8, !tbaa !11
  %133 = invoke noundef nonnull align 8 dereferenceable(8) ptr @_ZNSt5stackIP4TreeSt5dequeIS1_SaIS1_EEE3topEv(ptr noundef nonnull align 8 dereferenceable(80) %7)
          to label %134 unwind label %152

134:                                              ; preds = %132
  %135 = load ptr, ptr %133, align 8, !tbaa !11
  %136 = getelementptr inbounds %class.Tree, ptr %135, i32 0, i32 1
  %137 = load i32, ptr %136, align 4, !tbaa !13
  %138 = add nsw i32 %137, 1
  store i32 %138, ptr %136, align 4, !tbaa !13
  %139 = load ptr, ptr %13, align 8, !tbaa !11
  %140 = invoke noundef nonnull align 8 dereferenceable(8) ptr @_ZNSt5stackIP4TreeSt5dequeIS1_SaIS1_EEE3topEv(ptr noundef nonnull align 8 dereferenceable(80) %7)
          to label %141 unwind label %152

141:                                              ; preds = %134
  %142 = load ptr, ptr %140, align 8, !tbaa !11
  %143 = getelementptr inbounds %class.Tree, ptr %142, i32 0, i32 3
  store ptr %139, ptr %143, align 8, !tbaa !16
  %144 = invoke noundef nonnull align 8 dereferenceable(8) ptr @_ZNSt5stackIP4TreeSt5dequeIS1_SaIS1_EEE3topEv(ptr noundef nonnull align 8 dereferenceable(80) %7)
          to label %145 unwind label %152

145:                                              ; preds = %141
  %146 = load ptr, ptr %144, align 8, !tbaa !11
  %147 = getelementptr inbounds %class.Tree, ptr %146, i32 0, i32 1
  %148 = load i32, ptr %147, align 4, !tbaa !13
  %149 = icmp eq i32 %148, 3
  br i1 %149, label %150, label %160

150:                                              ; preds = %145
  invoke void @_ZNSt5stackIP4TreeSt5dequeIS1_SaIS1_EEE3popEv(ptr noundef nonnull align 8 dereferenceable(80) %7)
          to label %151 unwind label %152

151:                                              ; preds = %150
  br label %160

152:                                              ; preds = %160, %150, %141, %134, %132, %125
  %153 = landingpad { ptr, i32 }
          cleanup
  %154 = extractvalue { ptr, i32 } %153, 0
  store ptr %154, ptr %9, align 8
  %155 = extractvalue { ptr, i32 } %153, 1
  store i32 %155, ptr %10, align 4
  br label %162

156:                                              ; preds = %127
  %157 = landingpad { ptr, i32 }
          cleanup
  %158 = extractvalue { ptr, i32 } %157, 0
  store ptr %158, ptr %9, align 8
  %159 = extractvalue { ptr, i32 } %157, 1
  store i32 %159, ptr %10, align 4
  call void @_ZdlPvm(ptr noundef %126, i64 noundef 24) #12
  br label %162

160:                                              ; preds = %151, %145
  invoke void @_ZNSt5stackIP4TreeSt5dequeIS1_SaIS1_EEE4pushERKS1_(ptr noundef nonnull align 8 dereferenceable(80) %7, ptr noundef nonnull align 8 dereferenceable(8) %13)
          to label %161 unwind label %152

161:                                              ; preds = %160
  call void @llvm.lifetime.end.p0(i64 8, ptr %13) #10
  br label %174

162:                                              ; preds = %156, %152
  call void @llvm.lifetime.end.p0(i64 8, ptr %13) #10
  br label %195

163:                                              ; preds = %119
  %164 = invoke noundef nonnull align 8 dereferenceable(8) ptr @_ZNSt5stackIP4TreeSt5dequeIS1_SaIS1_EEE3topEv(ptr noundef nonnull align 8 dereferenceable(80) %7)
          to label %165 unwind label %87

165:                                              ; preds = %163
  %166 = load ptr, ptr %164, align 8, !tbaa !11
  %167 = getelementptr inbounds %class.Tree, ptr %166, i32 0, i32 3
  store ptr null, ptr %167, align 8, !tbaa !16
  %168 = invoke noundef nonnull align 8 dereferenceable(8) ptr @_ZNSt5stackIP4TreeSt5dequeIS1_SaIS1_EEE3topEv(ptr noundef nonnull align 8 dereferenceable(80) %7)
          to label %169 unwind label %87

169:                                              ; preds = %165
  %170 = load ptr, ptr %168, align 8, !tbaa !11
  %171 = getelementptr inbounds %class.Tree, ptr %170, i32 0, i32 1
  %172 = load i32, ptr %171, align 4, !tbaa !13
  %173 = add nsw i32 %172, 1
  store i32 %173, ptr %171, align 4, !tbaa !13
  br label %174

174:                                              ; preds = %169, %161
  br label %175

175:                                              ; preds = %174, %114
  br label %176

176:                                              ; preds = %175, %111
  %177 = invoke noundef nonnull align 8 dereferenceable(8) ptr @_ZNSt5stackIP4TreeSt5dequeIS1_SaIS1_EEE3topEv(ptr noundef nonnull align 8 dereferenceable(80) %7)
          to label %178 unwind label %87

178:                                              ; preds = %176
  %179 = load ptr, ptr %177, align 8, !tbaa !11
  %180 = getelementptr inbounds %class.Tree, ptr %179, i32 0, i32 1
  %181 = load i32, ptr %180, align 4, !tbaa !13
  %182 = icmp eq i32 %181, 3
  br i1 %182, label %183, label %185

183:                                              ; preds = %178
  invoke void @_ZNSt5stackIP4TreeSt5dequeIS1_SaIS1_EEE3popEv(ptr noundef nonnull align 8 dereferenceable(80) %7)
          to label %184 unwind label %87

184:                                              ; preds = %183
  br label %185

185:                                              ; preds = %184, %178
  %186 = load i32, ptr %11, align 4, !tbaa !5
  %187 = add nsw i32 %186, 1
  store i32 %187, ptr %11, align 4, !tbaa !5
  br label %42, !llvm.loop !17

188:                                              ; preds = %44
  %189 = load ptr, ptr %8, align 8, !tbaa !11
  invoke void @_ZN4Tree7displayEPS_(ptr noundef nonnull align 8 dereferenceable(24) %6, ptr noundef %189)
          to label %190 unwind label %87

190:                                              ; preds = %188
  %191 = 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 %192 unwind label %87

192:                                              ; preds = %190
  call void @llvm.lifetime.end.p0(i64 4, ptr %11) #10
  call void @llvm.lifetime.end.p0(i64 8, ptr %8) #10
  call void @_ZNSt5stackIP4TreeSt5dequeIS1_SaIS1_EEED2Ev(ptr noundef nonnull align 8 dereferenceable(80) %7) #10
  call void @llvm.lifetime.end.p0(i64 80, ptr %7) #10
  call void @llvm.lifetime.end.p0(i64 24, ptr %6) #10
  %193 = load ptr, ptr %3, align 8
  call void @llvm.stackrestore.p0(ptr %193)
  call void @llvm.lifetime.end.p0(i64 4, ptr %2) #10
  %194 = load i32, ptr %1, align 4
  ret i32 %194

195:                                              ; preds = %162, %99, %87
  call void @llvm.lifetime.end.p0(i64 4, ptr %11) #10
  br label %196

196:                                              ; preds = %195, %83, %79
  call void @llvm.lifetime.end.p0(i64 8, ptr %8) #10
  call void @_ZNSt5stackIP4TreeSt5dequeIS1_SaIS1_EEED2Ev(ptr noundef nonnull align 8 dereferenceable(80) %7) #10
  call void @llvm.lifetime.end.p0(i64 80, ptr %7) #10
  call void @llvm.lifetime.end.p0(i64 24, ptr %6) #10
  call void @llvm.lifetime.end.p0(i64 4, ptr %2) #10
  br label %197

197:                                              ; preds = %196
  %198 = load ptr, ptr %9, align 8
  %199 = load i32, ptr %10, align 4
  %200 = insertvalue { ptr, i32 } poison, ptr %198, 0
  %201 = insertvalue { ptr, i32 } %200, i32 %199, 1
  resume { ptr, i32 } %201
}

; Function Attrs: nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.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) #2

declare noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERi(ptr noundef nonnull align 8 dereferenceable(16), ptr noundef nonnull align 4 dereferenceable(4)) #3

; Function Attrs: nocallback nofree nosync nounwind willreturn
declare ptr @llvm.stacksave.p0() #4

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

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

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

; Function Attrs: nobuiltin allocsize(0)
declare noundef nonnull ptr @_Znwm(i64 noundef) #7

declare i32 @__gxx_personality_v0(...)

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZN4TreeC2Eii(ptr noundef nonnull align 8 dereferenceable(24), i32 noundef, i32 noundef) unnamed_addr #5 align 2

; Function Attrs: nobuiltin nounwind
declare void @_ZdlPvm(ptr noundef, i64 noundef) #8

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZNSt5stackIP4TreeSt5dequeIS1_SaIS1_EEE4pushERKS1_(ptr noundef nonnull align 8 dereferenceable(80), ptr noundef nonnull align 8 dereferenceable(8)) #6 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef i64 @_ZNKSt5stackIP4TreeSt5dequeIS1_SaIS1_EEE4sizeEv(ptr noundef nonnull align 8 dereferenceable(80)) #5 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef nonnull align 8 dereferenceable(8) ptr @_ZNSt5stackIP4TreeSt5dequeIS1_SaIS1_EEE3topEv(ptr noundef nonnull align 8 dereferenceable(80)) #5 align 2

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

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN4Tree7displayEPS_(ptr noundef nonnull align 8 dereferenceable(24), ptr noundef) #6 align 2

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

; Function Attrs: nocallback nofree nosync nounwind willreturn
declare void @llvm.stackrestore.p0(ptr) #4

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 = { 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 #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 = { nocallback nofree nosync nounwind willreturn }
attributes #5 = { 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 #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 = { nobuiltin allocsize(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 #8 = { nobuiltin nounwind "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 #9 = { inlinehint 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 #10 = { nounwind }
attributes #11 = { builtin allocsize(0) }
attributes #12 = { builtin 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 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = !{!12, !12, i64 0}
!12 = !{!"any pointer", !7, i64 0}
!13 = !{!14, !6, i64 4}
!14 = !{!"_ZTS4Tree", !6, i64 0, !6, i64 4, !12, i64 8, !12, i64 16}
!15 = !{!14, !12, i64 8}
!16 = !{!14, !12, i64 16}
!17 = distinct !{!17, !10}


; 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.std::basic_istream" = type { ptr, i64, %"class.std::basic_ios" }
%class.Tree = type { i32, i32, ptr, ptr }
%"class.std::stack" = type { %"class.std::deque" }
%"class.std::deque" = type { %"class.std::_Deque_base" }
%"class.std::_Deque_base" = type { %"struct.std::_Deque_base<Tree *, std::allocator<Tree *>>::_Deque_impl" }
%"struct.std::_Deque_base<Tree *, std::allocator<Tree *>>::_Deque_impl" = type { %"struct.std::_Deque_base<Tree *, std::allocator<Tree *>>::_Deque_impl_data" }
%"struct.std::_Deque_base<Tree *, std::allocator<Tree *>>::_Deque_impl_data" = type { ptr, i64, %"struct.std::_Deque_iterator", %"struct.std::_Deque_iterator" }
%"struct.std::_Deque_iterator" = type { ptr, ptr, ptr, ptr }

@_ZSt4cout = external global %"class.std::basic_ostream", align 8
@.str = external hidden unnamed_addr constant [25 x i8], align 1
@_ZSt3cin = external global %"class.std::basic_istream", align 8
@.str.1 = external hidden unnamed_addr constant [22 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [2 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 i32, align 4
  %2 = alloca %class.Tree, align 8
  %3 = alloca %"class.std::stack", align 8
  %4 = alloca ptr, align 8
  %5 = alloca ptr, align 8
  %6 = alloca ptr, align 8
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %1) #9
  %7 = tail call 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 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERi(ptr noundef nonnull align 8 dereferenceable(16) @_ZSt3cin, ptr noundef nonnull align 4 dereferenceable(4) %1)
  %9 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cout, ptr noundef nonnull @.str.1)
  %10 = load i32, ptr %1, align 4, !tbaa !5
  %11 = zext i32 %10 to i64
  %12 = call ptr @llvm.stacksave.p0()
  %13 = alloca i32, i64 %11, align 16
  %14 = load i32, ptr %1, align 4, !tbaa !5
  %15 = icmp sgt i32 %14, 0
  br i1 %15, label %.lr.ph, label %._crit_edge

._crit_edge:                                      ; preds = %.lr.ph, %0
  %16 = call 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)
  call void @llvm.lifetime.start.p0(i64 24, ptr nonnull %2) #9
  call void @_ZN4TreeC2Ev(ptr noundef nonnull align 8 dereferenceable(24) %2)
  call void @llvm.lifetime.start.p0(i64 80, ptr nonnull %3) #9
  call void @_ZNSt5stackIP4TreeSt5dequeIS1_SaIS1_EEEC2IS4_vEEv(ptr noundef nonnull align 8 dereferenceable(80) %3)
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %4) #9
  %17 = invoke noalias noundef nonnull dereferenceable(24) ptr @_Znwm(i64 noundef 24) #10
          to label %23 unwind label %47

.lr.ph:                                           ; preds = %0, %.lr.ph
  %indvars.iv = phi i64 [ %indvars.iv.next, %.lr.ph ], [ 0, %0 ]
  %18 = getelementptr inbounds i32, ptr %13, i64 %indvars.iv
  %19 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERi(ptr noundef nonnull align 8 dereferenceable(16) @_ZSt3cin, ptr noundef nonnull align 4 dereferenceable(4) %18)
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  %20 = load i32, ptr %1, align 4, !tbaa !5
  %21 = sext i32 %20 to i64
  %22 = icmp slt i64 %indvars.iv.next, %21
  br i1 %22, label %.lr.ph, label %._crit_edge, !llvm.loop !9

23:                                               ; preds = %._crit_edge
  %24 = load i32, ptr %13, align 16, !tbaa !5
  call void @_ZN4TreeC2Eii(ptr noundef nonnull align 8 dereferenceable(24) %17, i32 noundef %24, i32 noundef 1)
  store ptr %17, ptr %4, align 8, !tbaa !11
  invoke void @_ZNSt5stackIP4TreeSt5dequeIS1_SaIS1_EEE4pushERKS1_(ptr noundef nonnull align 8 dereferenceable(80) %3, ptr noundef nonnull align 8 dereferenceable(8) %4)
          to label %.preheader unwind label %47

.preheader:                                       ; preds = %23
  %25 = call noundef i64 @_ZNKSt5stackIP4TreeSt5dequeIS1_SaIS1_EEE4sizeEv(ptr noundef nonnull align 8 dereferenceable(80) %3)
  %.not20 = icmp eq i64 %25, 0
  br i1 %.not20, label %._crit_edge23, label %.lr.ph22

.lr.ph22:                                         ; preds = %.preheader, %109
  %indvars.iv25 = phi i64 [ %indvars.iv.next26, %109 ], [ 1, %.preheader ]
  %26 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSt5stackIP4TreeSt5dequeIS1_SaIS1_EEE3topEv(ptr noundef nonnull align 8 dereferenceable(80) %3)
  %27 = load ptr, ptr %26, align 8, !tbaa !11
  %28 = getelementptr inbounds i8, ptr %27, i64 4
  %29 = load i32, ptr %28, align 4, !tbaa !13
  %30 = icmp eq i32 %29, 1
  br i1 %30, label %31, label %62

31:                                               ; preds = %.lr.ph22
  %32 = getelementptr inbounds i32, ptr %13, i64 %indvars.iv25
  %33 = load i32, ptr %32, align 4, !tbaa !5
  %.not16 = icmp eq i32 %33, -1
  br i1 %.not16, label %53, label %34

34:                                               ; preds = %31
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %5) #9
  %35 = invoke noalias noundef nonnull dereferenceable(24) ptr @_Znwm(i64 noundef 24) #10
          to label %36 unwind label %51

36:                                               ; preds = %34
  call void @_ZN4TreeC2Eii(ptr noundef nonnull align 8 dereferenceable(24) %35, i32 noundef %33, i32 noundef 1)
  store ptr %35, ptr %5, align 8, !tbaa !11
  %37 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSt5stackIP4TreeSt5dequeIS1_SaIS1_EEE3topEv(ptr noundef nonnull align 8 dereferenceable(80) %3)
  %38 = load ptr, ptr %37, align 8, !tbaa !11
  %39 = getelementptr inbounds i8, ptr %38, i64 4
  %40 = load i32, ptr %39, align 4, !tbaa !13
  %41 = add nsw i32 %40, 1
  store i32 %41, ptr %39, align 4, !tbaa !13
  %42 = load ptr, ptr %5, align 8, !tbaa !11
  %43 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSt5stackIP4TreeSt5dequeIS1_SaIS1_EEE3topEv(ptr noundef nonnull align 8 dereferenceable(80) %3)
  %44 = load ptr, ptr %43, align 8, !tbaa !11
  %45 = getelementptr inbounds i8, ptr %44, i64 8
  store ptr %42, ptr %45, align 8, !tbaa !15
  invoke void @_ZNSt5stackIP4TreeSt5dequeIS1_SaIS1_EEE4pushERKS1_(ptr noundef nonnull align 8 dereferenceable(80) %3, ptr noundef nonnull align 8 dereferenceable(8) %5)
          to label %46 unwind label %51

46:                                               ; preds = %36
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %5) #9
  br label %102

47:                                               ; preds = %23, %._crit_edge
  %48 = landingpad { ptr, i32 }
          cleanup
  br label %115

49:                                               ; preds = %112, %._crit_edge23
  %50 = landingpad { ptr, i32 }
          cleanup
  br label %115

51:                                               ; preds = %36, %34
  %52 = landingpad { ptr, i32 }
          cleanup
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %5) #9
  br label %115

53:                                               ; preds = %31
  %54 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSt5stackIP4TreeSt5dequeIS1_SaIS1_EEE3topEv(ptr noundef nonnull align 8 dereferenceable(80) %3)
  %55 = load ptr, ptr %54, align 8, !tbaa !11
  %56 = getelementptr inbounds i8, ptr %55, i64 8
  store ptr null, ptr %56, align 8, !tbaa !15
  %57 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSt5stackIP4TreeSt5dequeIS1_SaIS1_EEE3topEv(ptr noundef nonnull align 8 dereferenceable(80) %3)
  %58 = load ptr, ptr %57, align 8, !tbaa !11
  %59 = getelementptr inbounds i8, ptr %58, i64 4
  %60 = load i32, ptr %59, align 4, !tbaa !13
  %61 = add nsw i32 %60, 1
  store i32 %61, ptr %59, align 4, !tbaa !13
  br label %102

62:                                               ; preds = %.lr.ph22
  %63 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSt5stackIP4TreeSt5dequeIS1_SaIS1_EEE3topEv(ptr noundef nonnull align 8 dereferenceable(80) %3)
  %64 = load ptr, ptr %63, align 8, !tbaa !11
  %65 = getelementptr inbounds i8, ptr %64, i64 4
  %66 = load i32, ptr %65, align 4, !tbaa !13
  %67 = icmp eq i32 %66, 2
  br i1 %67, label %68, label %102

68:                                               ; preds = %62
  %69 = getelementptr inbounds i32, ptr %13, i64 %indvars.iv25
  %70 = load i32, ptr %69, align 4, !tbaa !5
  %.not15 = icmp eq i32 %70, -1
  br i1 %.not15, label %93, label %71

71:                                               ; preds = %68
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %6) #9
  %72 = invoke noalias noundef nonnull dereferenceable(24) ptr @_Znwm(i64 noundef 24) #10
          to label %73 unwind label %89

73:                                               ; preds = %71
  call void @_ZN4TreeC2Eii(ptr noundef nonnull align 8 dereferenceable(24) %72, i32 noundef %70, i32 noundef 1)
  store ptr %72, ptr %6, align 8, !tbaa !11
  %74 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSt5stackIP4TreeSt5dequeIS1_SaIS1_EEE3topEv(ptr noundef nonnull align 8 dereferenceable(80) %3)
  %75 = load ptr, ptr %74, align 8, !tbaa !11
  %76 = getelementptr inbounds i8, ptr %75, i64 4
  %77 = load i32, ptr %76, align 4, !tbaa !13
  %78 = add nsw i32 %77, 1
  store i32 %78, ptr %76, align 4, !tbaa !13
  %79 = load ptr, ptr %6, align 8, !tbaa !11
  %80 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSt5stackIP4TreeSt5dequeIS1_SaIS1_EEE3topEv(ptr noundef nonnull align 8 dereferenceable(80) %3)
  %81 = load ptr, ptr %80, align 8, !tbaa !11
  %82 = getelementptr inbounds i8, ptr %81, i64 16
  store ptr %79, ptr %82, align 8, !tbaa !16
  %83 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSt5stackIP4TreeSt5dequeIS1_SaIS1_EEE3topEv(ptr noundef nonnull align 8 dereferenceable(80) %3)
  %84 = load ptr, ptr %83, align 8, !tbaa !11
  %85 = getelementptr inbounds i8, ptr %84, i64 4
  %86 = load i32, ptr %85, align 4, !tbaa !13
  %87 = icmp eq i32 %86, 3
  br i1 %87, label %88, label %91

88:                                               ; preds = %73
  call void @_ZNSt5stackIP4TreeSt5dequeIS1_SaIS1_EEE3popEv(ptr noundef nonnull align 8 dereferenceable(80) %3)
  br label %91

89:                                               ; preds = %91, %71
  %90 = landingpad { ptr, i32 }
          cleanup
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %6) #9
  br label %115

91:                                               ; preds = %88, %73
  invoke void @_ZNSt5stackIP4TreeSt5dequeIS1_SaIS1_EEE4pushERKS1_(ptr noundef nonnull align 8 dereferenceable(80) %3, ptr noundef nonnull align 8 dereferenceable(8) %6)
          to label %92 unwind label %89

92:                                               ; preds = %91
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %6) #9
  br label %102

93:                                               ; preds = %68
  %94 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSt5stackIP4TreeSt5dequeIS1_SaIS1_EEE3topEv(ptr noundef nonnull align 8 dereferenceable(80) %3)
  %95 = load ptr, ptr %94, align 8, !tbaa !11
  %96 = getelementptr inbounds i8, ptr %95, i64 16
  store ptr null, ptr %96, align 8, !tbaa !16
  %97 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSt5stackIP4TreeSt5dequeIS1_SaIS1_EEE3topEv(ptr noundef nonnull align 8 dereferenceable(80) %3)
  %98 = load ptr, ptr %97, align 8, !tbaa !11
  %99 = getelementptr inbounds i8, ptr %98, i64 4
  %100 = load i32, ptr %99, align 4, !tbaa !13
  %101 = add nsw i32 %100, 1
  store i32 %101, ptr %99, align 4, !tbaa !13
  br label %102

102:                                              ; preds = %62, %93, %92, %46, %53
  %103 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSt5stackIP4TreeSt5dequeIS1_SaIS1_EEE3topEv(ptr noundef nonnull align 8 dereferenceable(80) %3)
  %104 = load ptr, ptr %103, align 8, !tbaa !11
  %105 = getelementptr inbounds i8, ptr %104, i64 4
  %106 = load i32, ptr %105, align 4, !tbaa !13
  %107 = icmp eq i32 %106, 3
  br i1 %107, label %108, label %109

108:                                              ; preds = %102
  call void @_ZNSt5stackIP4TreeSt5dequeIS1_SaIS1_EEE3popEv(ptr noundef nonnull align 8 dereferenceable(80) %3)
  br label %109

109:                                              ; preds = %108, %102
  %indvars.iv.next26 = add nuw nsw i64 %indvars.iv25, 1
  %110 = call noundef i64 @_ZNKSt5stackIP4TreeSt5dequeIS1_SaIS1_EEE4sizeEv(ptr noundef nonnull align 8 dereferenceable(80) %3)
  %.not = icmp eq i64 %110, 0
  br i1 %.not, label %._crit_edge23, label %.lr.ph22, !llvm.loop !17

._crit_edge23:                                    ; preds = %109, %.preheader
  %111 = load ptr, ptr %4, align 8, !tbaa !11
  invoke void @_ZN4Tree7displayEPS_(ptr noundef nonnull align 8 dereferenceable(24) %2, ptr noundef %111)
          to label %112 unwind label %49

112:                                              ; preds = %._crit_edge23
  %113 = 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 %114 unwind label %49

114:                                              ; preds = %112
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %4) #9
  call void @_ZNSt5stackIP4TreeSt5dequeIS1_SaIS1_EEED2Ev(ptr noundef nonnull align 8 dereferenceable(80) %3) #9
  call void @llvm.lifetime.end.p0(i64 80, ptr nonnull %3) #9
  call void @llvm.lifetime.end.p0(i64 24, ptr nonnull %2) #9
  call void @llvm.stackrestore.p0(ptr %12)
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %1) #9
  ret i32 0

115:                                              ; preds = %49, %51, %89, %47
  %.pn.pn = phi { ptr, i32 } [ %48, %47 ], [ %52, %51 ], [ %90, %89 ], [ %50, %49 ]
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %4) #9
  call void @_ZNSt5stackIP4TreeSt5dequeIS1_SaIS1_EEED2Ev(ptr noundef nonnull align 8 dereferenceable(80) %3) #9
  call void @llvm.lifetime.end.p0(i64 80, ptr nonnull %3) #9
  call void @llvm.lifetime.end.p0(i64 24, ptr nonnull %2) #9
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %1) #9
  resume { ptr, i32 } %.pn.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: 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 #2

declare noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERi(ptr noundef nonnull align 8 dereferenceable(16), ptr noundef nonnull align 4 dereferenceable(4)) local_unnamed_addr #3

; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn
declare ptr @llvm.stacksave.p0() #4

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

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

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

; Function Attrs: nobuiltin allocsize(0)
declare noundef nonnull ptr @_Znwm(i64 noundef) local_unnamed_addr #7

declare i32 @__gxx_personality_v0(...)

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZN4TreeC2Eii(ptr noundef nonnull align 8 dereferenceable(24), i32 noundef, i32 noundef) unnamed_addr #5 align 2

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZNSt5stackIP4TreeSt5dequeIS1_SaIS1_EEE4pushERKS1_(ptr noundef nonnull align 8 dereferenceable(80), ptr noundef nonnull align 8 dereferenceable(8)) local_unnamed_addr #6 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef i64 @_ZNKSt5stackIP4TreeSt5dequeIS1_SaIS1_EEE4sizeEv(ptr noundef nonnull align 8 dereferenceable(80)) local_unnamed_addr #5 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef nonnull align 8 dereferenceable(8) ptr @_ZNSt5stackIP4TreeSt5dequeIS1_SaIS1_EEE3topEv(ptr noundef nonnull align 8 dereferenceable(80)) local_unnamed_addr #5 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZNSt5stackIP4TreeSt5dequeIS1_SaIS1_EEE3popEv(ptr noundef nonnull align 8 dereferenceable(80)) local_unnamed_addr #5 align 2

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN4Tree7displayEPS_(ptr noundef nonnull align 8 dereferenceable(24), ptr noundef) local_unnamed_addr #6 align 2

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

; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn
declare void @llvm.stackrestore.p0(ptr) #4

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 = { 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 #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 = { mustprogress nocallback nofree nosync nounwind willreturn }
attributes #5 = { 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 #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 = { nobuiltin allocsize(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 #8 = { inlinehint 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 #9 = { nounwind }
attributes #10 = { builtin allocsize(0) }

!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 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = !{!12, !12, i64 0}
!12 = !{!"any pointer", !7, i64 0}
!13 = !{!14, !6, i64 4}
!14 = !{!"_ZTS4Tree", !6, i64 0, !6, i64 4, !12, i64 8, !12, i64 16}
!15 = !{!14, !12, i64 8}
!16 = !{!14, !12, i64 16}
!17 = distinct !{!17, !10}


; Effective O3 passes: EarlyCSEPass,GlobalOptPass,IndVarSimplifyPass,InferFunctionAttrsPass,InstCombinePass,JumpThreadingPass,LoopRotatePass,LoopSimplifyPass,LoopUnrollPass,SROAPass,SimplifyCFGPass,TailCallElimPass