; LLVM IR from Yinxiaoli/iros2015_folding :: src/folding_planner_cmake/project/2dregistration_v2 (mesh2d)

; 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::set" = type { %"class.std::_Rb_tree.22" }
%"class.std::_Rb_tree.22" = type { %"struct.std::_Rb_tree<const SVertex *, const SVertex *, std::_Identity<const SVertex *>, std::less<const SVertex *>>::_Rb_tree_impl" }
%"struct.std::_Rb_tree<const SVertex *, const SVertex *, std::_Identity<const SVertex *>, std::less<const SVertex *>>::_Rb_tree_impl" = type { [8 x i8], %"struct.std::_Rb_tree_header" }
%"struct.std::_Rb_tree_header" = type { %"struct.std::_Rb_tree_node_base", i64 }
%"struct.std::_Rb_tree_node_base" = type { i32, ptr, ptr, ptr }
%"struct.std::pair.27" = type <{ %"struct.std::_Rb_tree_const_iterator", i8, [7 x i8] }>
%"struct.std::_Rb_tree_const_iterator" = type { ptr }
%struct.SHalfEdge = type { ptr, ptr, ptr, ptr, ptr, i32, i32, i8, i8 }
%struct.SVertex = type { ptr, i8, i32, i8, i8 }

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

; 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 noundef zeroext i1 @_Z30testEdgeCollapseRetainManifoldPK9SHalfEdge(ptr noundef %0) #1 personality ptr @__gxx_personality_v0 {
  %2 = alloca i1, align 1
  %3 = alloca ptr, align 8
  %4 = alloca ptr, align 8
  %5 = alloca ptr, align 8
  %6 = alloca %"class.std::set", align 8
  %7 = alloca %"class.std::set", align 8
  %8 = alloca ptr, align 8
  %9 = alloca ptr, align 8
  %10 = alloca ptr, align 8
  %11 = alloca i32, align 4
  %12 = alloca %"struct.std::pair.27", align 8
  %13 = alloca ptr, align 8
  %14 = alloca %"struct.std::pair.27", align 8
  %15 = alloca i32, align 4
  %16 = alloca %"struct.std::pair.27", align 8
  %17 = alloca ptr, align 8
  %18 = alloca %"struct.std::pair.27", align 8
  %19 = alloca ptr, align 8
  %20 = alloca ptr, align 8
  %21 = alloca %"struct.std::_Rb_tree_const_iterator", align 8
  %22 = alloca %"struct.std::_Rb_tree_const_iterator", align 8
  %23 = alloca %"struct.std::_Rb_tree_const_iterator", align 8
  %24 = alloca %"struct.std::_Rb_tree_const_iterator", align 8
  %25 = alloca %"struct.std::_Rb_tree_const_iterator", align 8
  store ptr %0, ptr %3, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %4) #3
  %26 = load ptr, ptr %3, align 8, !tbaa !5
  %27 = getelementptr inbounds %struct.SHalfEdge, ptr %26, i32 0, i32 2
  %28 = load ptr, ptr %27, align 8, !tbaa !9
  %29 = getelementptr inbounds %struct.SHalfEdge, ptr %28, i32 0, i32 1
  %30 = load ptr, ptr %29, align 8, !tbaa !13
  store ptr %30, ptr %4, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %5) #3
  %31 = load ptr, ptr %3, align 8, !tbaa !5
  %32 = getelementptr inbounds %struct.SHalfEdge, ptr %31, i32 0, i32 1
  %33 = load ptr, ptr %32, align 8, !tbaa !13
  store ptr %33, ptr %5, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 48, ptr %6) #3
  call void @_ZNSt3setIPK7SVertexSt4lessIS2_ESaIS2_EEC2Ev(ptr noundef nonnull align 8 dereferenceable(48) %6) #3
  call void @llvm.lifetime.start.p0(i64 48, ptr %7) #3
  call void @_ZNSt3setIPK7SVertexSt4lessIS2_ESaIS2_EEC2Ev(ptr noundef nonnull align 8 dereferenceable(48) %7) #3
  call void @llvm.lifetime.start.p0(i64 8, ptr %8) #3
  %34 = load ptr, ptr %4, align 8, !tbaa !5
  %35 = getelementptr inbounds %struct.SVertex, ptr %34, i32 0, i32 0
  %36 = load ptr, ptr %35, align 8, !tbaa !14
  store ptr %36, ptr %8, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %9) #3
  %37 = load ptr, ptr %8, align 8, !tbaa !5
  store ptr %37, ptr %9, align 8, !tbaa !5
  br label %38

38:                                               ; preds = %83, %1
  br label %39

39:                                               ; preds = %38
  %40 = load ptr, ptr %9, align 8, !tbaa !5
  %41 = getelementptr inbounds %struct.SHalfEdge, ptr %40, i32 0, i32 1
  %42 = invoke { ptr, i8 } @_ZNSt3setIPK7SVertexSt4lessIS2_ESaIS2_EE6insertERKS2_(ptr noundef nonnull align 8 dereferenceable(48) %6, ptr noundef nonnull align 8 dereferenceable(8) %41)
          to label %43 unwind label %67

43:                                               ; preds = %39
  %44 = getelementptr inbounds { ptr, i8 }, ptr %12, i32 0, i32 0
  %45 = extractvalue { ptr, i8 } %42, 0
  store ptr %45, ptr %44, align 8
  %46 = getelementptr inbounds { ptr, i8 }, ptr %12, i32 0, i32 1
  %47 = extractvalue { ptr, i8 } %42, 1
  store i8 %47, ptr %46, align 8
  call void @llvm.lifetime.start.p0(i64 8, ptr %13) #3
  %48 = load ptr, ptr %9, align 8, !tbaa !5
  %49 = getelementptr inbounds %struct.SHalfEdge, ptr %48, i32 0, i32 2
  %50 = load ptr, ptr %49, align 8, !tbaa !9
  store ptr %50, ptr %13, align 8, !tbaa !5
  %51 = load ptr, ptr %13, align 8, !tbaa !5
  %52 = getelementptr inbounds %struct.SHalfEdge, ptr %51, i32 0, i32 0
  %53 = load ptr, ptr %52, align 8, !tbaa !16
  store ptr %53, ptr %9, align 8, !tbaa !5
  %54 = load ptr, ptr %9, align 8, !tbaa !5
  %55 = icmp eq ptr %54, null
  br i1 %55, label %56, label %75

56:                                               ; preds = %43
  %57 = load ptr, ptr %13, align 8, !tbaa !5
  %58 = getelementptr inbounds %struct.SHalfEdge, ptr %57, i32 0, i32 2
  %59 = load ptr, ptr %58, align 8, !tbaa !9
  %60 = getelementptr inbounds %struct.SHalfEdge, ptr %59, i32 0, i32 1
  %61 = invoke { ptr, i8 } @_ZNSt3setIPK7SVertexSt4lessIS2_ESaIS2_EE6insertERKS2_(ptr noundef nonnull align 8 dereferenceable(48) %6, ptr noundef nonnull align 8 dereferenceable(8) %60)
          to label %62 unwind label %71

62:                                               ; preds = %56
  %63 = getelementptr inbounds { ptr, i8 }, ptr %14, i32 0, i32 0
  %64 = extractvalue { ptr, i8 } %61, 0
  store ptr %64, ptr %63, align 8
  %65 = getelementptr inbounds { ptr, i8 }, ptr %14, i32 0, i32 1
  %66 = extractvalue { ptr, i8 } %61, 1
  store i8 %66, ptr %65, align 8
  store i32 3, ptr %15, align 4
  br label %81

67:                                               ; preds = %90, %39
  %68 = landingpad { ptr, i32 }
          cleanup
  %69 = extractvalue { ptr, i32 } %68, 0
  store ptr %69, ptr %10, align 8
  %70 = extractvalue { ptr, i32 } %68, 1
  store i32 %70, ptr %11, align 4
  br label %190

71:                                               ; preds = %56
  %72 = landingpad { ptr, i32 }
          cleanup
  %73 = extractvalue { ptr, i32 } %72, 0
  store ptr %73, ptr %10, align 8
  %74 = extractvalue { ptr, i32 } %72, 1
  store i32 %74, ptr %11, align 4
  call void @llvm.lifetime.end.p0(i64 8, ptr %13) #3
  br label %190

75:                                               ; preds = %43
  %76 = load ptr, ptr %9, align 8, !tbaa !5
  %77 = load ptr, ptr %8, align 8, !tbaa !5
  %78 = icmp eq ptr %76, %77
  br i1 %78, label %79, label %80

79:                                               ; preds = %75
  store i32 3, ptr %15, align 4
  br label %81

80:                                               ; preds = %75
  store i32 0, ptr %15, align 4
  br label %81

81:                                               ; preds = %80, %79, %62
  call void @llvm.lifetime.end.p0(i64 8, ptr %13) #3
  %82 = load i32, ptr %15, align 4
  switch i32 %82, label %196 [
    i32 0, label %83
    i32 3, label %84
  ]

83:                                               ; preds = %81
  br label %38, !llvm.loop !17

84:                                               ; preds = %81
  %85 = load ptr, ptr %5, align 8, !tbaa !5
  %86 = getelementptr inbounds %struct.SVertex, ptr %85, i32 0, i32 0
  %87 = load ptr, ptr %86, align 8, !tbaa !14
  store ptr %87, ptr %8, align 8, !tbaa !5
  %88 = load ptr, ptr %8, align 8, !tbaa !5
  store ptr %88, ptr %9, align 8, !tbaa !5
  br label %89

89:                                               ; preds = %130, %84
  br label %90

90:                                               ; preds = %89
  %91 = load ptr, ptr %9, align 8, !tbaa !5
  %92 = getelementptr inbounds %struct.SHalfEdge, ptr %91, i32 0, i32 1
  %93 = invoke { ptr, i8 } @_ZNSt3setIPK7SVertexSt4lessIS2_ESaIS2_EE6insertERKS2_(ptr noundef nonnull align 8 dereferenceable(48) %7, ptr noundef nonnull align 8 dereferenceable(8) %92)
          to label %94 unwind label %67

94:                                               ; preds = %90
  %95 = getelementptr inbounds { ptr, i8 }, ptr %16, i32 0, i32 0
  %96 = extractvalue { ptr, i8 } %93, 0
  store ptr %96, ptr %95, align 8
  %97 = getelementptr inbounds { ptr, i8 }, ptr %16, i32 0, i32 1
  %98 = extractvalue { ptr, i8 } %93, 1
  store i8 %98, ptr %97, align 8
  call void @llvm.lifetime.start.p0(i64 8, ptr %17) #3
  %99 = load ptr, ptr %9, align 8, !tbaa !5
  %100 = getelementptr inbounds %struct.SHalfEdge, ptr %99, i32 0, i32 2
  %101 = load ptr, ptr %100, align 8, !tbaa !9
  store ptr %101, ptr %17, align 8, !tbaa !5
  %102 = load ptr, ptr %17, align 8, !tbaa !5
  %103 = getelementptr inbounds %struct.SHalfEdge, ptr %102, i32 0, i32 0
  %104 = load ptr, ptr %103, align 8, !tbaa !16
  store ptr %104, ptr %9, align 8, !tbaa !5
  %105 = load ptr, ptr %9, align 8, !tbaa !5
  %106 = icmp eq ptr %105, null
  br i1 %106, label %107, label %122

107:                                              ; preds = %94
  %108 = load ptr, ptr %17, align 8, !tbaa !5
  %109 = getelementptr inbounds %struct.SHalfEdge, ptr %108, i32 0, i32 2
  %110 = load ptr, ptr %109, align 8, !tbaa !9
  %111 = getelementptr inbounds %struct.SHalfEdge, ptr %110, i32 0, i32 1
  %112 = invoke { ptr, i8 } @_ZNSt3setIPK7SVertexSt4lessIS2_ESaIS2_EE6insertERKS2_(ptr noundef nonnull align 8 dereferenceable(48) %7, ptr noundef nonnull align 8 dereferenceable(8) %111)
          to label %113 unwind label %118

113:                                              ; preds = %107
  %114 = getelementptr inbounds { ptr, i8 }, ptr %18, i32 0, i32 0
  %115 = extractvalue { ptr, i8 } %112, 0
  store ptr %115, ptr %114, align 8
  %116 = getelementptr inbounds { ptr, i8 }, ptr %18, i32 0, i32 1
  %117 = extractvalue { ptr, i8 } %112, 1
  store i8 %117, ptr %116, align 8
  store i32 5, ptr %15, align 4
  br label %128

118:                                              ; preds = %107
  %119 = landingpad { ptr, i32 }
          cleanup
  %120 = extractvalue { ptr, i32 } %119, 0
  store ptr %120, ptr %10, align 8
  %121 = extractvalue { ptr, i32 } %119, 1
  store i32 %121, ptr %11, align 4
  call void @llvm.lifetime.end.p0(i64 8, ptr %17) #3
  br label %190

122:                                              ; preds = %94
  %123 = load ptr, ptr %9, align 8, !tbaa !5
  %124 = load ptr, ptr %8, align 8, !tbaa !5
  %125 = icmp eq ptr %123, %124
  br i1 %125, label %126, label %127

126:                                              ; preds = %122
  store i32 5, ptr %15, align 4
  br label %128

127:                                              ; preds = %122
  store i32 0, ptr %15, align 4
  br label %128

128:                                              ; preds = %127, %126, %113
  call void @llvm.lifetime.end.p0(i64 8, ptr %17) #3
  %129 = load i32, ptr %15, align 4
  switch i32 %129, label %196 [
    i32 0, label %130
    i32 5, label %131
  ]

130:                                              ; preds = %128
  br label %89, !llvm.loop !19

131:                                              ; preds = %128
  call void @llvm.lifetime.start.p0(i64 8, ptr %19) #3
  %132 = load ptr, ptr %3, align 8, !tbaa !5
  %133 = getelementptr inbounds %struct.SHalfEdge, ptr %132, i32 0, i32 3
  %134 = load ptr, ptr %133, align 8, !tbaa !20
  %135 = getelementptr inbounds %struct.SHalfEdge, ptr %134, i32 0, i32 1
  %136 = load ptr, ptr %135, align 8, !tbaa !13
  store ptr %136, ptr %19, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %20) #3
  store ptr null, ptr %20, align 8, !tbaa !5
  %137 = load ptr, ptr %3, align 8, !tbaa !5
  %138 = getelementptr inbounds %struct.SHalfEdge, ptr %137, i32 0, i32 0
  %139 = load ptr, ptr %138, align 8, !tbaa !16
  %140 = icmp ne ptr %139, null
  br i1 %140, label %141, label %149

141:                                              ; preds = %131
  %142 = load ptr, ptr %3, align 8, !tbaa !5
  %143 = getelementptr inbounds %struct.SHalfEdge, ptr %142, i32 0, i32 0
  %144 = load ptr, ptr %143, align 8, !tbaa !16
  %145 = getelementptr inbounds %struct.SHalfEdge, ptr %144, i32 0, i32 3
  %146 = load ptr, ptr %145, align 8, !tbaa !20
  %147 = getelementptr inbounds %struct.SHalfEdge, ptr %146, i32 0, i32 1
  %148 = load ptr, ptr %147, align 8, !tbaa !13
  store ptr %148, ptr %20, align 8, !tbaa !5
  br label %149

149:                                              ; preds = %141, %131
  call void @llvm.lifetime.start.p0(i64 8, ptr %21) #3
  %150 = call ptr @_ZNKSt3setIPK7SVertexSt4lessIS2_ESaIS2_EE5beginEv(ptr noundef nonnull align 8 dereferenceable(48) %6) #3
  %151 = getelementptr inbounds %"struct.std::_Rb_tree_const_iterator", ptr %21, i32 0, i32 0
  store ptr %150, ptr %151, align 8
  br label %152

152:                                              ; preds = %184, %149
  call void @llvm.lifetime.start.p0(i64 8, ptr %22) #3
  %153 = call ptr @_ZNKSt3setIPK7SVertexSt4lessIS2_ESaIS2_EE3endEv(ptr noundef nonnull align 8 dereferenceable(48) %6) #3
  %154 = getelementptr inbounds %"struct.std::_Rb_tree_const_iterator", ptr %22, i32 0, i32 0
  store ptr %153, ptr %154, align 8
  %155 = call noundef zeroext i1 @_ZStneRKSt23_Rb_tree_const_iteratorIPK7SVertexES5_(ptr noundef nonnull align 8 dereferenceable(8) %21, ptr noundef nonnull align 8 dereferenceable(8) %22) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr %22) #3
  br i1 %155, label %156, label %187

156:                                              ; preds = %152
  call void @llvm.lifetime.start.p0(i64 8, ptr %23) #3
  %157 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNKSt23_Rb_tree_const_iteratorIPK7SVertexEdeEv(ptr noundef nonnull align 8 dereferenceable(8) %21) #3
  %158 = invoke ptr @_ZNSt3setIPK7SVertexSt4lessIS2_ESaIS2_EE4findERKS2_(ptr noundef nonnull align 8 dereferenceable(48) %7, ptr noundef nonnull align 8 dereferenceable(8) %157)
          to label %159 unwind label %175

159:                                              ; preds = %156
  %160 = getelementptr inbounds %"struct.std::_Rb_tree_const_iterator", ptr %23, i32 0, i32 0
  store ptr %158, ptr %160, align 8
  call void @llvm.lifetime.start.p0(i64 8, ptr %24) #3
  %161 = call ptr @_ZNKSt3setIPK7SVertexSt4lessIS2_ESaIS2_EE3endEv(ptr noundef nonnull align 8 dereferenceable(48) %7) #3
  %162 = getelementptr inbounds %"struct.std::_Rb_tree_const_iterator", ptr %24, i32 0, i32 0
  store ptr %161, ptr %162, align 8
  %163 = call noundef zeroext i1 @_ZStneRKSt23_Rb_tree_const_iteratorIPK7SVertexES5_(ptr noundef nonnull align 8 dereferenceable(8) %23, ptr noundef nonnull align 8 dereferenceable(8) %24) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr %24) #3
  br i1 %163, label %164, label %180

164:                                              ; preds = %159
  %165 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNKSt23_Rb_tree_const_iteratorIPK7SVertexEdeEv(ptr noundef nonnull align 8 dereferenceable(8) %23) #3
  %166 = load ptr, ptr %165, align 8, !tbaa !5
  %167 = load ptr, ptr %19, align 8, !tbaa !5
  %168 = icmp ne ptr %166, %167
  br i1 %168, label %169, label %179

169:                                              ; preds = %164
  %170 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNKSt23_Rb_tree_const_iteratorIPK7SVertexEdeEv(ptr noundef nonnull align 8 dereferenceable(8) %23) #3
  %171 = load ptr, ptr %170, align 8, !tbaa !5
  %172 = load ptr, ptr %20, align 8, !tbaa !5
  %173 = icmp ne ptr %171, %172
  br i1 %173, label %174, label %179

174:                                              ; preds = %169
  store i1 false, ptr %2, align 1
  store i32 1, ptr %15, align 4
  br label %181

175:                                              ; preds = %156
  %176 = landingpad { ptr, i32 }
          cleanup
  %177 = extractvalue { ptr, i32 } %176, 0
  store ptr %177, ptr %10, align 8
  %178 = extractvalue { ptr, i32 } %176, 1
  store i32 %178, ptr %11, align 4
  call void @llvm.lifetime.end.p0(i64 8, ptr %23) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr %21) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr %20) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr %19) #3
  br label %190

179:                                              ; preds = %169, %164
  br label %180

180:                                              ; preds = %179, %159
  store i32 0, ptr %15, align 4
  br label %181

181:                                              ; preds = %180, %174
  call void @llvm.lifetime.end.p0(i64 8, ptr %23) #3
  %182 = load i32, ptr %15, align 4
  switch i32 %182, label %188 [
    i32 0, label %183
  ]

183:                                              ; preds = %181
  br label %184

184:                                              ; preds = %183
  %185 = call ptr @_ZNSt23_Rb_tree_const_iteratorIPK7SVertexEppEi(ptr noundef nonnull align 8 dereferenceable(8) %21, i32 noundef 0) #3
  %186 = getelementptr inbounds %"struct.std::_Rb_tree_const_iterator", ptr %25, i32 0, i32 0
  store ptr %185, ptr %186, align 8
  br label %152, !llvm.loop !21

187:                                              ; preds = %152
  store i1 true, ptr %2, align 1
  store i32 1, ptr %15, align 4
  br label %188

188:                                              ; preds = %187, %181
  call void @llvm.lifetime.end.p0(i64 8, ptr %21) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr %20) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr %19) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr %9) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr %8) #3
  call void @_ZNSt3setIPK7SVertexSt4lessIS2_ESaIS2_EED2Ev(ptr noundef nonnull align 8 dereferenceable(48) %7) #3
  call void @llvm.lifetime.end.p0(i64 48, ptr %7) #3
  call void @_ZNSt3setIPK7SVertexSt4lessIS2_ESaIS2_EED2Ev(ptr noundef nonnull align 8 dereferenceable(48) %6) #3
  call void @llvm.lifetime.end.p0(i64 48, ptr %6) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr %5) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr %4) #3
  %189 = load i1, ptr %2, align 1
  ret i1 %189

190:                                              ; preds = %175, %118, %71, %67
  call void @llvm.lifetime.end.p0(i64 8, ptr %9) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr %8) #3
  call void @_ZNSt3setIPK7SVertexSt4lessIS2_ESaIS2_EED2Ev(ptr noundef nonnull align 8 dereferenceable(48) %7) #3
  call void @llvm.lifetime.end.p0(i64 48, ptr %7) #3
  call void @_ZNSt3setIPK7SVertexSt4lessIS2_ESaIS2_EED2Ev(ptr noundef nonnull align 8 dereferenceable(48) %6) #3
  call void @llvm.lifetime.end.p0(i64 48, ptr %6) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr %5) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr %4) #3
  br label %191

191:                                              ; preds = %190
  %192 = load ptr, ptr %10, align 8
  %193 = load i32, ptr %11, align 4
  %194 = insertvalue { ptr, i32 } poison, ptr %192, 0
  %195 = insertvalue { ptr, i32 } %194, i32 %193, 1
  resume { ptr, i32 } %195

196:                                              ; preds = %128, %81
  unreachable
}

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

; Function Attrs: mustprogress uwtable
declare dso_local { ptr, i8 } @_ZNSt3setIPK7SVertexSt4lessIS2_ESaIS2_EE6insertERKS2_(ptr noundef nonnull align 8 dereferenceable(48), ptr noundef nonnull align 8 dereferenceable(8)) #1 align 2

declare i32 @__gxx_personality_v0(...)

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

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef zeroext i1 @_ZStneRKSt23_Rb_tree_const_iteratorIPK7SVertexES5_(ptr noundef nonnull align 8 dereferenceable(8), ptr noundef nonnull align 8 dereferenceable(8)) #2

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

; Function Attrs: mustprogress uwtable
declare dso_local ptr @_ZNSt3setIPK7SVertexSt4lessIS2_ESaIS2_EE4findERKS2_(ptr noundef nonnull align 8 dereferenceable(48), ptr noundef nonnull align 8 dereferenceable(8)) #1 align 2

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

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

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

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { 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 = { 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 = { 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 16}
!10 = !{!"_ZTS9SHalfEdge", !6, i64 0, !6, i64 8, !6, i64 16, !6, i64 24, !6, i64 32, !11, i64 40, !11, i64 44, !12, i64 48, !12, i64 49}
!11 = !{!"int", !7, i64 0}
!12 = !{!"bool", !7, i64 0}
!13 = !{!10, !6, i64 8}
!14 = !{!15, !6, i64 0}
!15 = !{!"_ZTS7SVertex", !6, i64 0, !12, i64 8, !11, i64 12, !12, i64 16, !12, i64 17}
!16 = !{!10, !6, i64 0}
!17 = distinct !{!17, !18}
!18 = !{!"llvm.loop.mustprogress"}
!19 = distinct !{!19, !18}
!20 = !{!10, !6, i64 24}
!21 = distinct !{!21, !18}


; 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::set" = type { %"class.std::_Rb_tree.22" }
%"class.std::_Rb_tree.22" = type { %"struct.std::_Rb_tree<const SVertex *, const SVertex *, std::_Identity<const SVertex *>, std::less<const SVertex *>>::_Rb_tree_impl" }
%"struct.std::_Rb_tree<const SVertex *, const SVertex *, std::_Identity<const SVertex *>, std::less<const SVertex *>>::_Rb_tree_impl" = type { [8 x i8], %"struct.std::_Rb_tree_header" }
%"struct.std::_Rb_tree_header" = type { %"struct.std::_Rb_tree_node_base", i64 }
%"struct.std::_Rb_tree_node_base" = type { i32, ptr, ptr, ptr }
%"struct.std::_Rb_tree_const_iterator" = type { ptr }

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

; 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 noundef zeroext i1 @_Z30testEdgeCollapseRetainManifoldPK9SHalfEdge(ptr nocapture noundef readonly %0) local_unnamed_addr #1 personality ptr @__gxx_personality_v0 {
  %2 = alloca %"class.std::set", align 8
  %3 = alloca %"class.std::set", align 8
  %4 = alloca %"struct.std::_Rb_tree_const_iterator", align 8
  %5 = alloca %"struct.std::_Rb_tree_const_iterator", align 8
  %6 = alloca %"struct.std::_Rb_tree_const_iterator", align 8
  %7 = alloca %"struct.std::_Rb_tree_const_iterator", align 8
  %8 = getelementptr inbounds i8, ptr %0, i64 16
  %9 = load ptr, ptr %8, align 8, !tbaa !5
  %10 = getelementptr inbounds i8, ptr %9, i64 8
  %11 = load ptr, ptr %10, align 8, !tbaa !12
  %12 = getelementptr inbounds i8, ptr %0, i64 8
  %13 = load ptr, ptr %12, align 8, !tbaa !12
  call void @llvm.lifetime.start.p0(i64 48, ptr nonnull %2) #3
  call void @_ZNSt3setIPK7SVertexSt4lessIS2_ESaIS2_EEC2Ev(ptr noundef nonnull align 8 dereferenceable(48) %2) #3
  call void @llvm.lifetime.start.p0(i64 48, ptr nonnull %3) #3
  call void @_ZNSt3setIPK7SVertexSt4lessIS2_ESaIS2_EEC2Ev(ptr noundef nonnull align 8 dereferenceable(48) %3) #3
  %14 = load ptr, ptr %11, align 8, !tbaa !13
  br label %15

15:                                               ; preds = %30, %1
  %.038 = phi ptr [ %14, %1 ], [ %21, %30 ]
  %16 = getelementptr inbounds i8, ptr %.038, i64 8
  %17 = invoke { ptr, i8 } @_ZNSt3setIPK7SVertexSt4lessIS2_ESaIS2_EE6insertERKS2_(ptr noundef nonnull align 8 dereferenceable(48) %2, ptr noundef nonnull align 8 dereferenceable(8) %16)
          to label %18 unwind label %.loopexit.split-lp

18:                                               ; preds = %15
  %19 = getelementptr inbounds i8, ptr %.038, i64 16
  %20 = load ptr, ptr %19, align 8, !tbaa !5
  %21 = load ptr, ptr %20, align 8, !tbaa !15
  %22 = icmp eq ptr %21, null
  br i1 %22, label %23, label %30

23:                                               ; preds = %18
  %24 = getelementptr inbounds i8, ptr %20, i64 16
  %25 = load ptr, ptr %24, align 8, !tbaa !5
  %26 = getelementptr inbounds i8, ptr %25, i64 8
  %27 = invoke { ptr, i8 } @_ZNSt3setIPK7SVertexSt4lessIS2_ESaIS2_EE6insertERKS2_(ptr noundef nonnull align 8 dereferenceable(48) %2, ptr noundef nonnull align 8 dereferenceable(8) %26)
          to label %select.unfold unwind label %28

.loopexit61:                                      ; preds = %33
  %lpad.loopexit = landingpad { ptr, i32 }
          cleanup
  br label %81

.loopexit.split-lp:                               ; preds = %15
  %lpad.loopexit.split-lp = landingpad { ptr, i32 }
          cleanup
  br label %81

28:                                               ; preds = %23
  %29 = landingpad { ptr, i32 }
          cleanup
  br label %81

30:                                               ; preds = %18
  %31 = icmp eq ptr %21, %14
  br i1 %31, label %select.unfold, label %15

select.unfold:                                    ; preds = %30, %23
  %32 = load ptr, ptr %13, align 8, !tbaa !13
  br label %33

33:                                               ; preds = %48, %select.unfold
  %.139 = phi ptr [ %32, %select.unfold ], [ %39, %48 ]
  %34 = getelementptr inbounds i8, ptr %.139, i64 8
  %35 = invoke { ptr, i8 } @_ZNSt3setIPK7SVertexSt4lessIS2_ESaIS2_EE6insertERKS2_(ptr noundef nonnull align 8 dereferenceable(48) %3, ptr noundef nonnull align 8 dereferenceable(8) %34)
          to label %36 unwind label %.loopexit61

36:                                               ; preds = %33
  %37 = getelementptr inbounds i8, ptr %.139, i64 16
  %38 = load ptr, ptr %37, align 8, !tbaa !5
  %39 = load ptr, ptr %38, align 8, !tbaa !15
  %40 = icmp eq ptr %39, null
  br i1 %40, label %41, label %48

41:                                               ; preds = %36
  %42 = getelementptr inbounds i8, ptr %38, i64 16
  %43 = load ptr, ptr %42, align 8, !tbaa !5
  %44 = getelementptr inbounds i8, ptr %43, i64 8
  %45 = invoke { ptr, i8 } @_ZNSt3setIPK7SVertexSt4lessIS2_ESaIS2_EE6insertERKS2_(ptr noundef nonnull align 8 dereferenceable(48) %3, ptr noundef nonnull align 8 dereferenceable(8) %44)
          to label %select.unfold56 unwind label %46

46:                                               ; preds = %41
  %47 = landingpad { ptr, i32 }
          cleanup
  br label %81

48:                                               ; preds = %36
  %49 = icmp eq ptr %39, %32
  br i1 %49, label %select.unfold56, label %33

select.unfold56:                                  ; preds = %48, %41
  %50 = getelementptr inbounds i8, ptr %0, i64 24
  %51 = load ptr, ptr %50, align 8, !tbaa !16
  %52 = getelementptr inbounds i8, ptr %51, i64 8
  %53 = load ptr, ptr %52, align 8, !tbaa !12
  %54 = load ptr, ptr %0, align 8, !tbaa !15
  %.not = icmp eq ptr %54, null
  br i1 %.not, label %60, label %55

55:                                               ; preds = %select.unfold56
  %56 = getelementptr inbounds i8, ptr %54, i64 24
  %57 = load ptr, ptr %56, align 8, !tbaa !16
  %58 = getelementptr inbounds i8, ptr %57, i64 8
  %59 = load ptr, ptr %58, align 8, !tbaa !12
  br label %60

60:                                               ; preds = %55, %select.unfold56
  %.037 = phi ptr [ %59, %55 ], [ null, %select.unfold56 ]
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %4) #3
  %61 = call ptr @_ZNKSt3setIPK7SVertexSt4lessIS2_ESaIS2_EE5beginEv(ptr noundef nonnull align 8 dereferenceable(48) %2) #3
  store ptr %61, ptr %4, align 8
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %5) #3
  %62 = call ptr @_ZNKSt3setIPK7SVertexSt4lessIS2_ESaIS2_EE3endEv(ptr noundef nonnull align 8 dereferenceable(48) %2) #3
  store ptr %62, ptr %5, align 8
  %63 = call noundef zeroext i1 @_ZStneRKSt23_Rb_tree_const_iteratorIPK7SVertexES5_(ptr noundef nonnull align 8 dereferenceable(8) %4, ptr noundef nonnull align 8 dereferenceable(8) %5) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %5) #3
  br i1 %63, label %.lr.ph, label %.loopexit

.lr.ph:                                           ; preds = %60, %.critedge
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %6) #3
  %64 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNKSt23_Rb_tree_const_iteratorIPK7SVertexEdeEv(ptr noundef nonnull align 8 dereferenceable(8) %4) #3
  %65 = invoke ptr @_ZNSt3setIPK7SVertexSt4lessIS2_ESaIS2_EE4findERKS2_(ptr noundef nonnull align 8 dereferenceable(48) %3, ptr noundef nonnull align 8 dereferenceable(8) %64)
          to label %66 unwind label %75

66:                                               ; preds = %.lr.ph
  store ptr %65, ptr %6, align 8
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %7) #3
  %67 = call ptr @_ZNKSt3setIPK7SVertexSt4lessIS2_ESaIS2_EE3endEv(ptr noundef nonnull align 8 dereferenceable(48) %3) #3
  store ptr %67, ptr %7, align 8
  %68 = call noundef zeroext i1 @_ZStneRKSt23_Rb_tree_const_iteratorIPK7SVertexES5_(ptr noundef nonnull align 8 dereferenceable(8) %6, ptr noundef nonnull align 8 dereferenceable(8) %7) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %7) #3
  br i1 %68, label %69, label %.critedge

69:                                               ; preds = %66
  %70 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNKSt23_Rb_tree_const_iteratorIPK7SVertexEdeEv(ptr noundef nonnull align 8 dereferenceable(8) %6) #3
  %71 = load ptr, ptr %70, align 8, !tbaa !17
  %.not49 = icmp eq ptr %71, %53
  br i1 %.not49, label %.critedge, label %72

72:                                               ; preds = %69
  %73 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNKSt23_Rb_tree_const_iteratorIPK7SVertexEdeEv(ptr noundef nonnull align 8 dereferenceable(8) %6) #3
  %74 = load ptr, ptr %73, align 8, !tbaa !17
  %.not50 = icmp eq ptr %74, %.037
  br i1 %.not50, label %.critedge, label %80

75:                                               ; preds = %.lr.ph
  %76 = landingpad { ptr, i32 }
          cleanup
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %6) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %4) #3
  br label %81

.critedge:                                        ; preds = %69, %72, %66
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %6) #3
  %77 = call ptr @_ZNSt23_Rb_tree_const_iteratorIPK7SVertexEppEi(ptr noundef nonnull align 8 dereferenceable(8) %4, i32 noundef 0) #3
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %5) #3
  %78 = call ptr @_ZNKSt3setIPK7SVertexSt4lessIS2_ESaIS2_EE3endEv(ptr noundef nonnull align 8 dereferenceable(48) %2) #3
  store ptr %78, ptr %5, align 8
  %79 = call noundef zeroext i1 @_ZStneRKSt23_Rb_tree_const_iteratorIPK7SVertexES5_(ptr noundef nonnull align 8 dereferenceable(8) %4, ptr noundef nonnull align 8 dereferenceable(8) %5) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %5) #3
  br i1 %79, label %.lr.ph, label %.loopexit, !llvm.loop !18

80:                                               ; preds = %72
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %6) #3
  br label %.loopexit

.loopexit:                                        ; preds = %.critedge, %60, %80
  %.2 = phi i1 [ false, %80 ], [ true, %60 ], [ true, %.critedge ]
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %4) #3
  call void @_ZNSt3setIPK7SVertexSt4lessIS2_ESaIS2_EED2Ev(ptr noundef nonnull align 8 dereferenceable(48) %3) #3
  call void @llvm.lifetime.end.p0(i64 48, ptr nonnull %3) #3
  call void @_ZNSt3setIPK7SVertexSt4lessIS2_ESaIS2_EED2Ev(ptr noundef nonnull align 8 dereferenceable(48) %2) #3
  call void @llvm.lifetime.end.p0(i64 48, ptr nonnull %2) #3
  ret i1 %.2

81:                                               ; preds = %.loopexit61, %.loopexit.split-lp, %75, %46, %28
  %.pn = phi { ptr, i32 } [ %76, %75 ], [ %47, %46 ], [ %29, %28 ], [ %lpad.loopexit, %.loopexit61 ], [ %lpad.loopexit.split-lp, %.loopexit.split-lp ]
  call void @_ZNSt3setIPK7SVertexSt4lessIS2_ESaIS2_EED2Ev(ptr noundef nonnull align 8 dereferenceable(48) %3) #3
  call void @llvm.lifetime.end.p0(i64 48, ptr nonnull %3) #3
  call void @_ZNSt3setIPK7SVertexSt4lessIS2_ESaIS2_EED2Ev(ptr noundef nonnull align 8 dereferenceable(48) %2) #3
  call void @llvm.lifetime.end.p0(i64 48, ptr nonnull %2) #3
  resume { ptr, i32 } %.pn
}

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

; Function Attrs: mustprogress uwtable
declare dso_local { ptr, i8 } @_ZNSt3setIPK7SVertexSt4lessIS2_ESaIS2_EE6insertERKS2_(ptr noundef nonnull align 8 dereferenceable(48), ptr noundef nonnull align 8 dereferenceable(8)) local_unnamed_addr #1 align 2

declare i32 @__gxx_personality_v0(...)

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

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef zeroext i1 @_ZStneRKSt23_Rb_tree_const_iteratorIPK7SVertexES5_(ptr noundef nonnull align 8 dereferenceable(8), ptr noundef nonnull align 8 dereferenceable(8)) local_unnamed_addr #2

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

; Function Attrs: mustprogress uwtable
declare dso_local ptr @_ZNSt3setIPK7SVertexSt4lessIS2_ESaIS2_EE4findERKS2_(ptr noundef nonnull align 8 dereferenceable(48), ptr noundef nonnull align 8 dereferenceable(8)) local_unnamed_addr #1 align 2

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

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

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

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


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