; LLVM IR from TheAlgorithms/C-Plus-Plus :: data_structures/rb_tree.ll (ZN6RBtree3delEv)

; 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.RBtree = type { ptr, ptr }
%struct.node = type { i32, ptr, i8, ptr, ptr }

@_ZSt4cout = external global %"class.std::basic_ostream", align 8
@_ZSt3cin = external global %"class.std::basic_istream", align 8
@.str.1 = external hidden unnamed_addr constant [13 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [43 x i8], align 1
@.str.3 = external hidden unnamed_addr constant [20 x i8], align 1
@.str.4 = external hidden unnamed_addr constant [19 x i8], align 1
@.str.5 = external hidden unnamed_addr constant [10 x i8], align 1
@.str.6 = external hidden unnamed_addr constant [7 x i8], align 1
@.str.7 = external hidden unnamed_addr constant [5 x i8], align 1
@.str.8 = external hidden unnamed_addr constant [10 x i8], align 1
@.str.9 = external hidden unnamed_addr constant [35 x i8], align 1
@.str.10 = external hidden unnamed_addr constant [15 x i8], align 1
@.str.11 = external hidden unnamed_addr constant [40 x i8], align 1
@.str.12 = external hidden unnamed_addr constant [14 x i8], align 1
@.str.13 = external hidden unnamed_addr constant [39 x i8], align 1
@.str.14 = external hidden unnamed_addr constant [15 x i8], align 1

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

; 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) #1

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

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

; Function Attrs: mustprogress uwtable
define dso_local void @_ZN6RBtree3delEv(ptr noundef nonnull align 8 dereferenceable(16) %0) #3 align 2 {
  %2 = alloca ptr, align 8
  %3 = alloca i32, align 4
  %4 = alloca ptr, align 8
  %5 = alloca ptr, align 8
  %6 = alloca ptr, align 8
  %7 = alloca i32, align 4
  %8 = alloca i32, align 4
  store ptr %0, ptr %2, align 8, !tbaa !5
  %9 = load ptr, ptr %2, align 8
  %10 = getelementptr inbounds %class.RBtree, ptr %9, i32 0, i32 0
  %11 = load ptr, ptr %10, align 8, !tbaa !9
  %12 = icmp eq ptr %11, null
  br i1 %12, label %13, label %15

13:                                               ; preds = %1
  %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.1)
  br label %221

15:                                               ; preds = %1
  call void @llvm.lifetime.start.p0(i64 4, ptr %3) #5
  %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.2)
  %17 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERi(ptr noundef nonnull align 8 dereferenceable(16) @_ZSt3cin, ptr noundef nonnull align 4 dereferenceable(4) %3)
  call void @llvm.lifetime.start.p0(i64 8, ptr %4) #5
  %18 = getelementptr inbounds %class.RBtree, ptr %9, i32 0, i32 0
  %19 = load ptr, ptr %18, align 8, !tbaa !9
  store ptr %19, ptr %4, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %5) #5
  store ptr null, ptr %5, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %6) #5
  store ptr null, ptr %6, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %7) #5
  store i32 0, ptr %7, align 4, !tbaa !11
  br label %20

20:                                               ; preds = %53, %15
  %21 = load ptr, ptr %4, align 8, !tbaa !5
  %22 = icmp ne ptr %21, null
  br i1 %22, label %23, label %26

23:                                               ; preds = %20
  %24 = load i32, ptr %7, align 4, !tbaa !11
  %25 = icmp eq i32 %24, 0
  br label %26

26:                                               ; preds = %23, %20
  %27 = phi i1 [ false, %20 ], [ %25, %23 ]
  br i1 %27, label %28, label %54

28:                                               ; preds = %26
  %29 = load ptr, ptr %4, align 8, !tbaa !5
  %30 = getelementptr inbounds %struct.node, ptr %29, i32 0, i32 0
  %31 = load i32, ptr %30, align 8, !tbaa !13
  %32 = load i32, ptr %3, align 4, !tbaa !11
  %33 = icmp eq i32 %31, %32
  br i1 %33, label %34, label %35

34:                                               ; preds = %28
  store i32 1, ptr %7, align 4, !tbaa !11
  br label %35

35:                                               ; preds = %34, %28
  %36 = load i32, ptr %7, align 4, !tbaa !11
  %37 = icmp eq i32 %36, 0
  br i1 %37, label %38, label %53

38:                                               ; preds = %35
  %39 = load ptr, ptr %4, align 8, !tbaa !5
  %40 = getelementptr inbounds %struct.node, ptr %39, i32 0, i32 0
  %41 = load i32, ptr %40, align 8, !tbaa !13
  %42 = load i32, ptr %3, align 4, !tbaa !11
  %43 = icmp slt i32 %41, %42
  br i1 %43, label %44, label %48

44:                                               ; preds = %38
  %45 = load ptr, ptr %4, align 8, !tbaa !5
  %46 = getelementptr inbounds %struct.node, ptr %45, i32 0, i32 4
  %47 = load ptr, ptr %46, align 8, !tbaa !15
  store ptr %47, ptr %4, align 8, !tbaa !5
  br label %52

48:                                               ; preds = %38
  %49 = load ptr, ptr %4, align 8, !tbaa !5
  %50 = getelementptr inbounds %struct.node, ptr %49, i32 0, i32 3
  %51 = load ptr, ptr %50, align 8, !tbaa !16
  store ptr %51, ptr %4, align 8, !tbaa !5
  br label %52

52:                                               ; preds = %48, %44
  br label %53

53:                                               ; preds = %52, %35
  br label %20, !llvm.loop !17

54:                                               ; preds = %26
  %55 = load i32, ptr %7, align 4, !tbaa !11
  %56 = icmp eq i32 %55, 0
  br i1 %56, label %57, label %59

57:                                               ; preds = %54
  %58 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cout, ptr noundef @.str.3)
  store i32 1, ptr %8, align 4
  br label %219

59:                                               ; preds = %54
  %60 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cout, ptr noundef @.str.4)
  %61 = load ptr, ptr %4, align 8, !tbaa !5
  %62 = getelementptr inbounds %struct.node, ptr %61, i32 0, i32 0
  %63 = load i32, ptr %62, align 8, !tbaa !13
  %64 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEi(ptr noundef nonnull align 8 dereferenceable(8) %60, i32 noundef %63)
  %65 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cout, ptr noundef @.str.5)
  %66 = load ptr, ptr %4, align 8, !tbaa !5
  %67 = getelementptr inbounds %struct.node, ptr %66, i32 0, i32 2
  %68 = load i8, ptr %67, align 8, !tbaa !19
  %69 = sext i8 %68 to i32
  %70 = icmp eq i32 %69, 98
  br i1 %70, label %71, label %73

71:                                               ; preds = %59
  %72 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cout, ptr noundef @.str.6)
  br label %75

73:                                               ; preds = %59
  %74 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cout, ptr noundef @.str.7)
  br label %75

75:                                               ; preds = %73, %71
  %76 = load ptr, ptr %4, align 8, !tbaa !5
  %77 = getelementptr inbounds %struct.node, ptr %76, i32 0, i32 1
  %78 = load ptr, ptr %77, align 8, !tbaa !20
  %79 = icmp ne ptr %78, null
  br i1 %79, label %80, label %88

80:                                               ; preds = %75
  %81 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cout, ptr noundef @.str.8)
  %82 = load ptr, ptr %4, align 8, !tbaa !5
  %83 = getelementptr inbounds %struct.node, ptr %82, i32 0, i32 1
  %84 = load ptr, ptr %83, align 8, !tbaa !20
  %85 = getelementptr inbounds %struct.node, ptr %84, i32 0, i32 0
  %86 = load i32, ptr %85, align 8, !tbaa !13
  %87 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEi(ptr noundef nonnull align 8 dereferenceable(8) %81, i32 noundef %86)
  br label %90

88:                                               ; preds = %75
  %89 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cout, ptr noundef @.str.9)
  br label %90

90:                                               ; preds = %88, %80
  %91 = load ptr, ptr %4, align 8, !tbaa !5
  %92 = getelementptr inbounds %struct.node, ptr %91, i32 0, i32 4
  %93 = load ptr, ptr %92, align 8, !tbaa !15
  %94 = icmp ne ptr %93, null
  br i1 %94, label %95, label %103

95:                                               ; preds = %90
  %96 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cout, ptr noundef @.str.10)
  %97 = load ptr, ptr %4, align 8, !tbaa !5
  %98 = getelementptr inbounds %struct.node, ptr %97, i32 0, i32 4
  %99 = load ptr, ptr %98, align 8, !tbaa !15
  %100 = getelementptr inbounds %struct.node, ptr %99, i32 0, i32 0
  %101 = load i32, ptr %100, align 8, !tbaa !13
  %102 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEi(ptr noundef nonnull align 8 dereferenceable(8) %96, i32 noundef %101)
  br label %105

103:                                              ; preds = %90
  %104 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cout, ptr noundef @.str.11)
  br label %105

105:                                              ; preds = %103, %95
  %106 = load ptr, ptr %4, align 8, !tbaa !5
  %107 = getelementptr inbounds %struct.node, ptr %106, i32 0, i32 3
  %108 = load ptr, ptr %107, align 8, !tbaa !16
  %109 = icmp ne ptr %108, null
  br i1 %109, label %110, label %118

110:                                              ; preds = %105
  %111 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cout, ptr noundef @.str.12)
  %112 = load ptr, ptr %4, align 8, !tbaa !5
  %113 = getelementptr inbounds %struct.node, ptr %112, i32 0, i32 3
  %114 = load ptr, ptr %113, align 8, !tbaa !16
  %115 = getelementptr inbounds %struct.node, ptr %114, i32 0, i32 0
  %116 = load i32, ptr %115, align 8, !tbaa !13
  %117 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEi(ptr noundef nonnull align 8 dereferenceable(8) %111, i32 noundef %116)
  br label %120

118:                                              ; preds = %105
  %119 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cout, ptr noundef @.str.13)
  br label %120

120:                                              ; preds = %118, %110
  %121 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cout, ptr noundef @.str.14)
  %122 = load ptr, ptr %4, align 8, !tbaa !5
  %123 = getelementptr inbounds %struct.node, ptr %122, i32 0, i32 3
  %124 = load ptr, ptr %123, align 8, !tbaa !16
  %125 = icmp eq ptr %124, null
  br i1 %125, label %131, label %126

126:                                              ; preds = %120
  %127 = load ptr, ptr %4, align 8, !tbaa !5
  %128 = getelementptr inbounds %struct.node, ptr %127, i32 0, i32 4
  %129 = load ptr, ptr %128, align 8, !tbaa !15
  %130 = icmp eq ptr %129, null
  br i1 %130, label %131, label %133

131:                                              ; preds = %126, %120
  %132 = load ptr, ptr %4, align 8, !tbaa !5
  store ptr %132, ptr %5, align 8, !tbaa !5
  br label %136

133:                                              ; preds = %126
  %134 = load ptr, ptr %4, align 8, !tbaa !5
  %135 = call noundef ptr @_ZN6RBtree9successorEP4node(ptr noundef nonnull align 8 dereferenceable(16) %9, ptr noundef %134)
  store ptr %135, ptr %5, align 8, !tbaa !5
  br label %136

136:                                              ; preds = %133, %131
  %137 = load ptr, ptr %5, align 8, !tbaa !5
  %138 = getelementptr inbounds %struct.node, ptr %137, i32 0, i32 3
  %139 = load ptr, ptr %138, align 8, !tbaa !16
  %140 = icmp ne ptr %139, null
  br i1 %140, label %141, label %145

141:                                              ; preds = %136
  %142 = load ptr, ptr %5, align 8, !tbaa !5
  %143 = getelementptr inbounds %struct.node, ptr %142, i32 0, i32 3
  %144 = load ptr, ptr %143, align 8, !tbaa !16
  store ptr %144, ptr %6, align 8, !tbaa !5
  br label %156

145:                                              ; preds = %136
  %146 = load ptr, ptr %5, align 8, !tbaa !5
  %147 = getelementptr inbounds %struct.node, ptr %146, i32 0, i32 4
  %148 = load ptr, ptr %147, align 8, !tbaa !15
  %149 = icmp ne ptr %148, null
  br i1 %149, label %150, label %154

150:                                              ; preds = %145
  %151 = load ptr, ptr %5, align 8, !tbaa !5
  %152 = getelementptr inbounds %struct.node, ptr %151, i32 0, i32 4
  %153 = load ptr, ptr %152, align 8, !tbaa !15
  store ptr %153, ptr %6, align 8, !tbaa !5
  br label %155

154:                                              ; preds = %145
  store ptr null, ptr %6, align 8, !tbaa !5
  br label %155

155:                                              ; preds = %154, %150
  br label %156

156:                                              ; preds = %155, %141
  %157 = load ptr, ptr %6, align 8, !tbaa !5
  %158 = icmp ne ptr %157, null
  br i1 %158, label %159, label %165

159:                                              ; preds = %156
  %160 = load ptr, ptr %5, align 8, !tbaa !5
  %161 = getelementptr inbounds %struct.node, ptr %160, i32 0, i32 1
  %162 = load ptr, ptr %161, align 8, !tbaa !20
  %163 = load ptr, ptr %6, align 8, !tbaa !5
  %164 = getelementptr inbounds %struct.node, ptr %163, i32 0, i32 1
  store ptr %162, ptr %164, align 8, !tbaa !20
  br label %165

165:                                              ; preds = %159, %156
  %166 = load ptr, ptr %5, align 8, !tbaa !5
  %167 = getelementptr inbounds %struct.node, ptr %166, i32 0, i32 1
  %168 = load ptr, ptr %167, align 8, !tbaa !20
  %169 = icmp eq ptr %168, null
  br i1 %169, label %170, label %173

170:                                              ; preds = %165
  %171 = load ptr, ptr %6, align 8, !tbaa !5
  %172 = getelementptr inbounds %class.RBtree, ptr %9, i32 0, i32 0
  store ptr %171, ptr %172, align 8, !tbaa !9
  br label %194

173:                                              ; preds = %165
  %174 = load ptr, ptr %5, align 8, !tbaa !5
  %175 = load ptr, ptr %5, align 8, !tbaa !5
  %176 = getelementptr inbounds %struct.node, ptr %175, i32 0, i32 1
  %177 = load ptr, ptr %176, align 8, !tbaa !20
  %178 = getelementptr inbounds %struct.node, ptr %177, i32 0, i32 3
  %179 = load ptr, ptr %178, align 8, !tbaa !16
  %180 = icmp eq ptr %174, %179
  br i1 %180, label %181, label %187

181:                                              ; preds = %173
  %182 = load ptr, ptr %6, align 8, !tbaa !5
  %183 = load ptr, ptr %5, align 8, !tbaa !5
  %184 = getelementptr inbounds %struct.node, ptr %183, i32 0, i32 1
  %185 = load ptr, ptr %184, align 8, !tbaa !20
  %186 = getelementptr inbounds %struct.node, ptr %185, i32 0, i32 3
  store ptr %182, ptr %186, align 8, !tbaa !16
  br label %193

187:                                              ; preds = %173
  %188 = load ptr, ptr %6, align 8, !tbaa !5
  %189 = load ptr, ptr %5, align 8, !tbaa !5
  %190 = getelementptr inbounds %struct.node, ptr %189, i32 0, i32 1
  %191 = load ptr, ptr %190, align 8, !tbaa !20
  %192 = getelementptr inbounds %struct.node, ptr %191, i32 0, i32 4
  store ptr %188, ptr %192, align 8, !tbaa !15
  br label %193

193:                                              ; preds = %187, %181
  br label %194

194:                                              ; preds = %193, %170
  %195 = load ptr, ptr %5, align 8, !tbaa !5
  %196 = load ptr, ptr %4, align 8, !tbaa !5
  %197 = icmp ne ptr %195, %196
  br i1 %197, label %198, label %209

198:                                              ; preds = %194
  %199 = load ptr, ptr %5, align 8, !tbaa !5
  %200 = getelementptr inbounds %struct.node, ptr %199, i32 0, i32 2
  %201 = load i8, ptr %200, align 8, !tbaa !19
  %202 = load ptr, ptr %4, align 8, !tbaa !5
  %203 = getelementptr inbounds %struct.node, ptr %202, i32 0, i32 2
  store i8 %201, ptr %203, align 8, !tbaa !19
  %204 = load ptr, ptr %5, align 8, !tbaa !5
  %205 = getelementptr inbounds %struct.node, ptr %204, i32 0, i32 0
  %206 = load i32, ptr %205, align 8, !tbaa !13
  %207 = load ptr, ptr %4, align 8, !tbaa !5
  %208 = getelementptr inbounds %struct.node, ptr %207, i32 0, i32 0
  store i32 %206, ptr %208, align 8, !tbaa !13
  br label %209

209:                                              ; preds = %198, %194
  %210 = load ptr, ptr %5, align 8, !tbaa !5
  %211 = getelementptr inbounds %struct.node, ptr %210, i32 0, i32 2
  %212 = load i8, ptr %211, align 8, !tbaa !19
  %213 = sext i8 %212 to i32
  %214 = icmp eq i32 %213, 98
  br i1 %214, label %215, label %217

215:                                              ; preds = %209
  %216 = load ptr, ptr %6, align 8, !tbaa !5
  call void @_ZN6RBtree6delfixEP4node(ptr noundef nonnull align 8 dereferenceable(16) %9, ptr noundef %216)
  br label %217

217:                                              ; preds = %215, %209
  br label %218

218:                                              ; preds = %217
  store i32 0, ptr %8, align 4
  br label %219

219:                                              ; preds = %218, %57
  call void @llvm.lifetime.end.p0(i64 4, ptr %7) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %6) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %5) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %4) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %3) #5
  %220 = load i32, ptr %8, align 4
  switch i32 %220, label %222 [
    i32 0, label %221
    i32 1, label %221
  ]

221:                                              ; preds = %219, %219, %13
  ret void

222:                                              ; preds = %219
  unreachable
}

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

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef ptr @_ZN6RBtree9successorEP4node(ptr noundef nonnull align 8 dereferenceable(16), ptr noundef) #4 align 2

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN6RBtree6delfixEP4node(ptr noundef nonnull align 8 dereferenceable(16), ptr noundef) #3 align 2

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { 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 #2 = { "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 = { 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 #4 = { 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 #5 = { 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, !6, i64 0}
!10 = !{!"_ZTS6RBtree", !6, i64 0, !6, i64 8}
!11 = !{!12, !12, i64 0}
!12 = !{!"int", !7, i64 0}
!13 = !{!14, !12, i64 0}
!14 = !{!"_ZTS4node", !12, i64 0, !6, i64 8, !7, i64 16, !6, i64 24, !6, i64 32}
!15 = !{!14, !6, i64 32}
!16 = !{!14, !6, i64 24}
!17 = distinct !{!17, !18}
!18 = !{!"llvm.loop.mustprogress"}
!19 = !{!14, !7, i64 16}
!20 = !{!14, !6, i64 8}


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

@_ZSt4cout = external global %"class.std::basic_ostream", align 8
@_ZSt3cin = external global %"class.std::basic_istream", align 8
@.str.1 = external hidden unnamed_addr constant [13 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [43 x i8], align 1
@.str.3 = external hidden unnamed_addr constant [20 x i8], align 1
@.str.4 = external hidden unnamed_addr constant [19 x i8], align 1
@.str.5 = external hidden unnamed_addr constant [10 x i8], align 1
@.str.6 = external hidden unnamed_addr constant [7 x i8], align 1
@.str.7 = external hidden unnamed_addr constant [5 x i8], align 1
@.str.8 = external hidden unnamed_addr constant [10 x i8], align 1
@.str.9 = external hidden unnamed_addr constant [35 x i8], align 1
@.str.10 = external hidden unnamed_addr constant [15 x i8], align 1
@.str.11 = external hidden unnamed_addr constant [40 x i8], align 1
@.str.12 = external hidden unnamed_addr constant [14 x i8], align 1
@.str.13 = external hidden unnamed_addr constant [39 x i8], align 1
@.str.14 = external hidden unnamed_addr constant [15 x i8], align 1

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

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

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 #2

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

; Function Attrs: mustprogress uwtable
define dso_local void @_ZN6RBtree3delEv(ptr noundef nonnull align 8 dereferenceable(16) %0) local_unnamed_addr #3 align 2 {
  %2 = alloca i32, align 4
  %3 = load ptr, ptr %0, align 8, !tbaa !5
  %4 = icmp eq ptr %3, null
  br i1 %4, label %5, label %7

5:                                                ; preds = %1
  %6 = 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.1)
  br label %86

7:                                                ; preds = %1
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %2) #5
  %8 = 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.2)
  %9 = 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)
  %10 = load ptr, ptr %0, align 8, !tbaa !5
  %.not63 = icmp eq ptr %10, null
  br i1 %.not63, label %.loopexit, label %.lr.ph

.lr.ph:                                           ; preds = %7
  %11 = load i32, ptr %2, align 4, !tbaa !10
  br label %12

12:                                               ; preds = %.lr.ph, %14
  %.04561 = phi ptr [ %10, %.lr.ph ], [ %17, %14 ]
  %13 = load i32, ptr %.04561, align 8, !tbaa !12
  %.not56 = icmp ne i32 %13, %11
  br i1 %.not56, label %14, label %._crit_edge

14:                                               ; preds = %12
  %15 = icmp slt i32 %13, %11
  %. = select i1 %15, i64 32, i64 24
  %16 = getelementptr inbounds i8, ptr %.04561, i64 %.
  %17 = load ptr, ptr %16, align 8, !tbaa !14
  %18 = icmp ne ptr %17, null
  %19 = and i1 %18, %.not56
  br i1 %19, label %12, label %.loopexit, !llvm.loop !15

.loopexit:                                        ; preds = %14, %7
  %20 = 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.3)
  br label %85

._crit_edge:                                      ; preds = %12
  %21 = 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.4)
  %22 = load i32, ptr %.04561, align 8, !tbaa !12
  %23 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEi(ptr noundef nonnull align 8 dereferenceable(8) %21, i32 noundef %22)
  %24 = 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.5)
  %25 = getelementptr inbounds i8, ptr %.04561, i64 16
  %26 = load i8, ptr %25, align 8, !tbaa !17
  %27 = icmp eq i8 %26, 98
  %.str.6..str.7 = select i1 %27, ptr @.str.6, ptr @.str.7
  %28 = 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.6..str.7)
  %29 = getelementptr inbounds i8, ptr %.04561, i64 8
  %30 = load ptr, ptr %29, align 8, !tbaa !18
  %.not = icmp eq ptr %30, null
  br i1 %.not, label %36, label %31

31:                                               ; preds = %._crit_edge
  %32 = 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)
  %33 = load ptr, ptr %29, align 8, !tbaa !18
  %34 = load i32, ptr %33, align 8, !tbaa !12
  %35 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEi(ptr noundef nonnull align 8 dereferenceable(8) %32, i32 noundef %34)
  br label %38

36:                                               ; preds = %._crit_edge
  %37 = 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.9)
  br label %38

38:                                               ; preds = %36, %31
  %39 = getelementptr inbounds i8, ptr %.04561, i64 32
  %40 = load ptr, ptr %39, align 8, !tbaa !19
  %.not50 = icmp eq ptr %40, null
  br i1 %.not50, label %46, label %41

41:                                               ; preds = %38
  %42 = 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.10)
  %43 = load ptr, ptr %39, align 8, !tbaa !19
  %44 = load i32, ptr %43, align 8, !tbaa !12
  %45 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEi(ptr noundef nonnull align 8 dereferenceable(8) %42, i32 noundef %44)
  br label %48

46:                                               ; preds = %38
  %47 = 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.11)
  br label %48

48:                                               ; preds = %46, %41
  %49 = getelementptr inbounds i8, ptr %.04561, i64 24
  %50 = load ptr, ptr %49, align 8, !tbaa !20
  %.not51 = icmp eq ptr %50, null
  br i1 %.not51, label %56, label %51

51:                                               ; preds = %48
  %52 = 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.12)
  %53 = load ptr, ptr %49, align 8, !tbaa !20
  %54 = load i32, ptr %53, align 8, !tbaa !12
  %55 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEi(ptr noundef nonnull align 8 dereferenceable(8) %52, i32 noundef %54)
  br label %58

56:                                               ; preds = %48
  %57 = 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.13)
  br label %58

58:                                               ; preds = %56, %51
  %59 = 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.14)
  %60 = load ptr, ptr %49, align 8, !tbaa !20
  %61 = icmp eq ptr %60, null
  br i1 %61, label %.thread75, label %62

62:                                               ; preds = %58
  %63 = load ptr, ptr %39, align 8, !tbaa !19
  %64 = icmp eq ptr %63, null
  br i1 %64, label %.thread, label %65

65:                                               ; preds = %62
  %66 = call noundef ptr @_ZN6RBtree9successorEP4node(ptr noundef nonnull align 8 dereferenceable(16) %0, ptr noundef nonnull %.04561)
  %.phi.trans.insert = getelementptr inbounds i8, ptr %66, i64 24
  %.pre = load ptr, ptr %.phi.trans.insert, align 8, !tbaa !20
  %.not52 = icmp eq ptr %.pre, null
  br i1 %.not52, label %.thread75, label %.thread

.thread75:                                        ; preds = %58, %65
  %.04480 = phi ptr [ %66, %65 ], [ %.04561, %58 ]
  %67 = getelementptr inbounds i8, ptr %.04480, i64 32
  %68 = load ptr, ptr %67, align 8, !tbaa !19
  %.not54 = icmp eq ptr %68, null
  br i1 %.not54, label %._crit_edge64, label %.thread

._crit_edge64:                                    ; preds = %.thread75
  %.phi.trans.insert65 = getelementptr inbounds i8, ptr %.04480, i64 8
  %.pre66 = load ptr, ptr %.phi.trans.insert65, align 8, !tbaa !18
  br label %72

.thread:                                          ; preds = %62, %65, %.thread75
  %.04479 = phi ptr [ %.04480, %.thread75 ], [ %66, %65 ], [ %.04561, %62 ]
  %.04359 = phi ptr [ %68, %.thread75 ], [ %.pre, %65 ], [ %60, %62 ]
  %69 = getelementptr inbounds i8, ptr %.04479, i64 8
  %70 = load ptr, ptr %69, align 8, !tbaa !18
  %71 = getelementptr inbounds i8, ptr %.04359, i64 8
  store ptr %70, ptr %71, align 8, !tbaa !18
  br label %72

72:                                               ; preds = %._crit_edge64, %.thread
  %.04478 = phi ptr [ %.04479, %.thread ], [ %.04480, %._crit_edge64 ]
  %73 = phi ptr [ %70, %.thread ], [ %.pre66, %._crit_edge64 ]
  %.04360 = phi ptr [ %.04359, %.thread ], [ null, %._crit_edge64 ]
  %74 = icmp eq ptr %73, null
  br i1 %74, label %80, label %75

75:                                               ; preds = %72
  %76 = getelementptr inbounds i8, ptr %73, i64 24
  %77 = load ptr, ptr %76, align 8, !tbaa !20
  %78 = icmp eq ptr %.04478, %77
  %79 = getelementptr inbounds i8, ptr %73, i64 32
  %spec.select = select i1 %78, ptr %76, ptr %79
  br label %80

80:                                               ; preds = %75, %72
  %.sink = phi ptr [ %0, %72 ], [ %spec.select, %75 ]
  store ptr %.04360, ptr %.sink, align 8, !tbaa !14
  %.not55 = icmp eq ptr %.04478, %.04561
  %.phi.trans.insert68 = getelementptr inbounds i8, ptr %.04478, i64 16
  %.pre69 = load i8, ptr %.phi.trans.insert68, align 8, !tbaa !17
  br i1 %.not55, label %._crit_edge67, label %81

81:                                               ; preds = %80
  store i8 %.pre69, ptr %25, align 8, !tbaa !17
  %82 = load i32, ptr %.04478, align 8, !tbaa !12
  store i32 %82, ptr %.04561, align 8, !tbaa !12
  br label %._crit_edge67

._crit_edge67:                                    ; preds = %80, %81
  %83 = icmp eq i8 %.pre69, 98
  br i1 %83, label %84, label %85

84:                                               ; preds = %._crit_edge67
  call void @_ZN6RBtree6delfixEP4node(ptr noundef nonnull align 8 dereferenceable(16) %0, ptr noundef %.04360)
  br label %85

85:                                               ; preds = %84, %._crit_edge67, %.loopexit
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %2) #5
  br label %86

86:                                               ; preds = %85, %5
  ret void
}

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

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef ptr @_ZN6RBtree9successorEP4node(ptr noundef nonnull align 8 dereferenceable(16), ptr noundef) local_unnamed_addr #4 align 2

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN6RBtree6delfixEP4node(ptr noundef nonnull align 8 dereferenceable(16), ptr noundef) local_unnamed_addr #3 align 2

attributes #0 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { 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 #2 = { "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 = { 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 #4 = { 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 #5 = { 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, !7, i64 0}
!6 = !{!"_ZTS6RBtree", !7, i64 0, !7, i64 8}
!7 = !{!"any pointer", !8, i64 0}
!8 = !{!"omnipotent char", !9, i64 0}
!9 = !{!"Simple C++ TBAA"}
!10 = !{!11, !11, i64 0}
!11 = !{!"int", !8, i64 0}
!12 = !{!13, !11, i64 0}
!13 = !{!"_ZTS4node", !11, i64 0, !7, i64 8, !8, i64 16, !7, i64 24, !7, i64 32}
!14 = !{!7, !7, i64 0}
!15 = distinct !{!15, !16}
!16 = !{!"llvm.loop.mustprogress"}
!17 = !{!13, !8, i64 16}
!18 = !{!13, !7, i64 8}
!19 = !{!13, !7, i64 32}
!20 = !{!13, !7, i64 24}


; Effective O3 passes: BDCEPass,CorrelatedValuePropagationPass,EarlyCSEPass,GVNPass,GlobalOptPass,IPSCCPPass,InferFunctionAttrsPass,InstCombinePass,InstSimplifyPass,JumpThreadingPass,LCSSAPass,LICMPass,LoopRotatePass,LoopSimplifyPass,LoopUnrollPass,SROAPass,SimplifyCFGPass,TailCallElimPass