; LLVM IR from niessner/Matterport :: code/gaps/pkgs/R3Shapes/R3Mesh.ll (ZN6R3Mesh18CollapseShortEdgesEd)

; 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.RNHeap = type <{ ptr, i32, i32, i32, i32, ptr, ptr, ptr, i32, [4 x i8] }>

@R3mesh_mark = external dso_local global i32, align 4
@.str = external hidden unnamed_addr constant [41 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [88 x i8], align 1
@.str.34 = external hidden unnamed_addr constant [30 x i8], align 1
@.str.35 = external hidden unnamed_addr constant [19 x i8], align 1

declare i32 @__gxx_personality_v0(...)

declare void @_Z7RNAbortPKcz(ptr noundef, ...) #0

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

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

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local noundef i32 @_ZNK6R3Mesh6NEdgesEv(ptr noundef nonnull align 8 dereferenceable(272)) #2 align 2

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

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

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local noundef double @_ZNK6R3Mesh10EdgeLengthEPK10R3MeshEdge(ptr noundef nonnull align 8 dereferenceable(272), ptr noundef) #2 align 2

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

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

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

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

; Function Attrs: mustprogress uwtable
define dso_local void @_ZN6R3Mesh18CollapseShortEdgesEd(ptr noundef nonnull align 8 dereferenceable(272) %0, double noundef %1) #5 align 2 personality ptr @__gxx_personality_v0 {
  %3 = alloca ptr, align 8
  %4 = alloca double, align 8
  %5 = alloca %class.RNHeap, align 8
  %6 = alloca i32, align 4
  %7 = alloca ptr, align 8
  %8 = alloca i32, align 4
  %9 = alloca ptr, align 8
  %10 = alloca double, align 8
  %11 = alloca ptr, align 8
  %12 = alloca ptr, align 8
  %13 = alloca ptr, align 8
  %14 = alloca ptr, align 8
  %15 = alloca ptr, align 8
  %16 = alloca ptr, align 8
  %17 = alloca ptr, align 8
  %18 = alloca i32, align 4
  %19 = alloca i32, align 4
  %20 = alloca ptr, align 8
  %21 = alloca double, align 8
  store ptr %0, ptr %3, align 8, !tbaa !5
  store double %1, ptr %4, align 8, !tbaa !9
  %22 = load ptr, ptr %3, align 8
  call void @llvm.lifetime.start.p0(i64 56, ptr %5) #6
  call void @_ZN6RNHeapIP10R3MeshEdgeEC2EPFdS1_PvEPFPPS1_S1_S3_ES3_i(ptr noundef nonnull align 8 dereferenceable(52) %5, ptr noundef @_ZL18EdgeLengthCallbackP10R3MeshEdgePv, ptr noundef null, ptr noundef %22, i32 noundef 1)
  %23 = load i32, ptr @R3mesh_mark, align 4, !tbaa !11
  %24 = add nsw i32 %23, 1
  store i32 %24, ptr @R3mesh_mark, align 4, !tbaa !11
  call void @llvm.lifetime.start.p0(i64 4, ptr %6) #6
  store i32 0, ptr %6, align 4, !tbaa !11
  br label %25

25:                                               ; preds = %60, %2
  %26 = load i32, ptr %6, align 4, !tbaa !11
  %27 = invoke noundef i32 @_ZNK6R3Mesh6NEdgesEv(ptr noundef nonnull align 8 dereferenceable(272) %22)
          to label %28 unwind label %31

28:                                               ; preds = %25
  %29 = icmp slt i32 %26, %27
  br i1 %29, label %35, label %30

30:                                               ; preds = %28
  call void @llvm.lifetime.end.p0(i64 4, ptr %6) #6
  br label %65

31:                                               ; preds = %25
  %32 = landingpad { ptr, i32 }
          cleanup
  %33 = extractvalue { ptr, i32 } %32, 0
  store ptr %33, ptr %7, align 8
  %34 = extractvalue { ptr, i32 } %32, 1
  store i32 %34, ptr %8, align 4
  br label %64

35:                                               ; preds = %28
  call void @llvm.lifetime.start.p0(i64 8, ptr %9) #6
  %36 = load i32, ptr %6, align 4, !tbaa !11
  %37 = invoke noundef ptr @_ZNK6R3Mesh4EdgeEi(ptr noundef nonnull align 8 dereferenceable(272) %22, i32 noundef %36)
          to label %38 unwind label %51

38:                                               ; preds = %35
  store ptr %37, ptr %9, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %10) #6
  %39 = load ptr, ptr %9, align 8, !tbaa !5
  %40 = invoke noundef double @_ZNK6R3Mesh10EdgeLengthEPK10R3MeshEdge(ptr noundef nonnull align 8 dereferenceable(272) %22, ptr noundef %39)
          to label %41 unwind label %55

41:                                               ; preds = %38
  store double %40, ptr %10, align 8, !tbaa !9
  %42 = load double, ptr %10, align 8, !tbaa !9
  %43 = load double, ptr %4, align 8, !tbaa !9
  %44 = fcmp olt double %42, %43
  br i1 %44, label %45, label %59

45:                                               ; preds = %41
  %46 = load ptr, ptr %9, align 8, !tbaa !5
  %47 = load i32, ptr @R3mesh_mark, align 4, !tbaa !11
  invoke void @_ZN6R3Mesh11SetEdgeMarkEP10R3MeshEdgei(ptr noundef nonnull align 8 dereferenceable(272) %22, ptr noundef %46, i32 noundef %47)
          to label %48 unwind label %55

48:                                               ; preds = %45
  %49 = load ptr, ptr %9, align 8, !tbaa !5
  invoke void @_ZN6RNHeapIP10R3MeshEdgeE4PushES1_(ptr noundef nonnull align 8 dereferenceable(52) %5, ptr noundef %49)
          to label %50 unwind label %55

50:                                               ; preds = %48
  br label %59

51:                                               ; preds = %35
  %52 = landingpad { ptr, i32 }
          cleanup
  %53 = extractvalue { ptr, i32 } %52, 0
  store ptr %53, ptr %7, align 8
  %54 = extractvalue { ptr, i32 } %52, 1
  store i32 %54, ptr %8, align 4
  br label %63

55:                                               ; preds = %48, %45, %38
  %56 = landingpad { ptr, i32 }
          cleanup
  %57 = extractvalue { ptr, i32 } %56, 0
  store ptr %57, ptr %7, align 8
  %58 = extractvalue { ptr, i32 } %56, 1
  store i32 %58, ptr %8, align 4
  call void @llvm.lifetime.end.p0(i64 8, ptr %10) #6
  br label %63

59:                                               ; preds = %50, %41
  call void @llvm.lifetime.end.p0(i64 8, ptr %10) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr %9) #6
  br label %60

60:                                               ; preds = %59
  %61 = load i32, ptr %6, align 4, !tbaa !11
  %62 = add nsw i32 %61, 1
  store i32 %62, ptr %6, align 4, !tbaa !11
  br label %25, !llvm.loop !13

63:                                               ; preds = %55, %51
  call void @llvm.lifetime.end.p0(i64 8, ptr %9) #6
  br label %64

64:                                               ; preds = %63, %31
  call void @llvm.lifetime.end.p0(i64 4, ptr %6) #6
  br label %247

65:                                               ; preds = %30
  br label %66

66:                                               ; preds = %239, %237, %65
  %67 = invoke noundef i32 @_ZNK6RNHeapIP10R3MeshEdgeE7IsEmptyEv(ptr noundef nonnull align 8 dereferenceable(52) %5)
          to label %68 unwind label %81

68:                                               ; preds = %66
  %69 = icmp ne i32 %67, 0
  %70 = xor i1 %69, true
  br i1 %70, label %71, label %246

71:                                               ; preds = %68
  call void @llvm.lifetime.start.p0(i64 8, ptr %11) #6
  %72 = invoke noundef ptr @_ZN6RNHeapIP10R3MeshEdgeE3PopEv(ptr noundef nonnull align 8 dereferenceable(52) %5)
          to label %73 unwind label %85

73:                                               ; preds = %71
  store ptr %72, ptr %11, align 8, !tbaa !5
  %74 = load ptr, ptr %11, align 8, !tbaa !5
  %75 = invoke noundef i32 @_ZNK6R3Mesh8EdgeMarkEPK10R3MeshEdge(ptr noundef nonnull align 8 dereferenceable(272) %22, ptr noundef %74)
          to label %76 unwind label %85

76:                                               ; preds = %73
  %77 = load i32, ptr @R3mesh_mark, align 4, !tbaa !11
  %78 = icmp eq i32 %75, %77
  br i1 %78, label %89, label %79

79:                                               ; preds = %76
  invoke void (ptr, ...) @_Z7RNAbortPKcz(ptr noundef @.str, ptr noundef @.str.34, i32 noundef 2256, ptr noundef @.str.2)
          to label %80 unwind label %85

80:                                               ; preds = %79
  br label %89

81:                                               ; preds = %66
  %82 = landingpad { ptr, i32 }
          cleanup
  %83 = extractvalue { ptr, i32 } %82, 0
  store ptr %83, ptr %7, align 8
  %84 = extractvalue { ptr, i32 } %82, 1
  store i32 %84, ptr %8, align 4
  br label %247

85:                                               ; preds = %94, %89, %79, %73, %71
  %86 = landingpad { ptr, i32 }
          cleanup
  %87 = extractvalue { ptr, i32 } %86, 0
  store ptr %87, ptr %7, align 8
  %88 = extractvalue { ptr, i32 } %86, 1
  store i32 %88, ptr %8, align 4
  br label %245

89:                                               ; preds = %80, %76
  %90 = load ptr, ptr %11, align 8, !tbaa !5
  %91 = invoke noundef i32 @_ZNK6R3Mesh12IsEdgeOnMeshEPK10R3MeshEdge(ptr noundef nonnull align 8 dereferenceable(272) %22, ptr noundef %90)
          to label %92 unwind label %85

92:                                               ; preds = %89
  %93 = icmp ne i32 %91, 0
  br i1 %93, label %96, label %94

94:                                               ; preds = %92
  invoke void (ptr, ...) @_Z7RNAbortPKcz(ptr noundef @.str, ptr noundef @.str.35, i32 noundef 2257, ptr noundef @.str.2)
          to label %95 unwind label %85

95:                                               ; preds = %94
  br label %96

96:                                               ; preds = %95, %92
  call void @llvm.lifetime.start.p0(i64 8, ptr %12) #6
  %97 = load ptr, ptr %11, align 8, !tbaa !5
  %98 = invoke noundef ptr @_ZNK6R3Mesh12VertexOnEdgeEPK10R3MeshEdgei(ptr noundef nonnull align 8 dereferenceable(272) %22, ptr noundef %97, i32 noundef 1)
          to label %99 unwind label %139

99:                                               ; preds = %96
  store ptr %98, ptr %12, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %13) #6
  %100 = load ptr, ptr %11, align 8, !tbaa !5
  %101 = invoke noundef ptr @_ZNK6R3Mesh10FaceOnEdgeEPK10R3MeshEdgei(ptr noundef nonnull align 8 dereferenceable(272) %22, ptr noundef %100, i32 noundef 0)
          to label %102 unwind label %143

102:                                              ; preds = %99
  store ptr %101, ptr %13, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %14) #6
  %103 = load ptr, ptr %11, align 8, !tbaa !5
  %104 = invoke noundef ptr @_ZNK6R3Mesh10FaceOnEdgeEPK10R3MeshEdgei(ptr noundef nonnull align 8 dereferenceable(272) %22, ptr noundef %103, i32 noundef 1)
          to label %105 unwind label %147

105:                                              ; preds = %102
  store ptr %104, ptr %14, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %15) #6
  %106 = load ptr, ptr %13, align 8, !tbaa !5
  %107 = icmp ne ptr %106, null
  br i1 %107, label %108, label %113

108:                                              ; preds = %105
  %109 = load ptr, ptr %12, align 8, !tbaa !5
  %110 = load ptr, ptr %11, align 8, !tbaa !5
  %111 = load ptr, ptr %13, align 8, !tbaa !5
  %112 = call noundef ptr @_ZNK6R3Mesh16EdgeAcrossVertexEPK12R3MeshVertexPK10R3MeshEdgePK10R3MeshFace(ptr noundef nonnull align 8 dereferenceable(272) %22, ptr noundef %109, ptr noundef %110, ptr noundef %111)
  br label %114

113:                                              ; preds = %105
  br label %114

114:                                              ; preds = %113, %108
  %115 = phi ptr [ %112, %108 ], [ null, %113 ]
  store ptr %115, ptr %15, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %16) #6
  %116 = load ptr, ptr %14, align 8, !tbaa !5
  %117 = icmp ne ptr %116, null
  br i1 %117, label %118, label %123

118:                                              ; preds = %114
  %119 = load ptr, ptr %12, align 8, !tbaa !5
  %120 = load ptr, ptr %11, align 8, !tbaa !5
  %121 = load ptr, ptr %14, align 8, !tbaa !5
  %122 = call noundef ptr @_ZNK6R3Mesh16EdgeAcrossVertexEPK12R3MeshVertexPK10R3MeshEdgePK10R3MeshFace(ptr noundef nonnull align 8 dereferenceable(272) %22, ptr noundef %119, ptr noundef %120, ptr noundef %121)
  br label %124

123:                                              ; preds = %114
  br label %124

124:                                              ; preds = %123, %118
  %125 = phi ptr [ %122, %118 ], [ null, %123 ]
  store ptr %125, ptr %16, align 8, !tbaa !5
  %126 = load ptr, ptr %15, align 8, !tbaa !5
  %127 = icmp ne ptr %126, null
  br i1 %127, label %128, label %155

128:                                              ; preds = %124
  %129 = load ptr, ptr %15, align 8, !tbaa !5
  %130 = invoke noundef i32 @_ZNK6R3Mesh8EdgeMarkEPK10R3MeshEdge(ptr noundef nonnull align 8 dereferenceable(272) %22, ptr noundef %129)
          to label %131 unwind label %151

131:                                              ; preds = %128
  %132 = load i32, ptr @R3mesh_mark, align 4, !tbaa !11
  %133 = icmp eq i32 %130, %132
  br i1 %133, label %134, label %155

134:                                              ; preds = %131
  %135 = load ptr, ptr %15, align 8, !tbaa !5
  invoke void @_ZN6RNHeapIP10R3MeshEdgeE6RemoveES1_(ptr noundef nonnull align 8 dereferenceable(52) %5, ptr noundef %135)
          to label %136 unwind label %151

136:                                              ; preds = %134
  %137 = load ptr, ptr %15, align 8, !tbaa !5
  invoke void @_ZN6R3Mesh11SetEdgeMarkEP10R3MeshEdgei(ptr noundef nonnull align 8 dereferenceable(272) %22, ptr noundef %137, i32 noundef 0)
          to label %138 unwind label %151

138:                                              ; preds = %136
  br label %155

139:                                              ; preds = %96
  %140 = landingpad { ptr, i32 }
          cleanup
  %141 = extractvalue { ptr, i32 } %140, 0
  store ptr %141, ptr %7, align 8
  %142 = extractvalue { ptr, i32 } %140, 1
  store i32 %142, ptr %8, align 4
  br label %244

143:                                              ; preds = %99
  %144 = landingpad { ptr, i32 }
          cleanup
  %145 = extractvalue { ptr, i32 } %144, 0
  store ptr %145, ptr %7, align 8
  %146 = extractvalue { ptr, i32 } %144, 1
  store i32 %146, ptr %8, align 4
  br label %243

147:                                              ; preds = %102
  %148 = landingpad { ptr, i32 }
          cleanup
  %149 = extractvalue { ptr, i32 } %148, 0
  store ptr %149, ptr %7, align 8
  %150 = extractvalue { ptr, i32 } %148, 1
  store i32 %150, ptr %8, align 4
  br label %242

151:                                              ; preds = %166, %164, %158, %136, %134, %128
  %152 = landingpad { ptr, i32 }
          cleanup
  %153 = extractvalue { ptr, i32 } %152, 0
  store ptr %153, ptr %7, align 8
  %154 = extractvalue { ptr, i32 } %152, 1
  store i32 %154, ptr %8, align 4
  br label %241

155:                                              ; preds = %138, %131, %124
  %156 = load ptr, ptr %16, align 8, !tbaa !5
  %157 = icmp ne ptr %156, null
  br i1 %157, label %158, label %169

158:                                              ; preds = %155
  %159 = load ptr, ptr %16, align 8, !tbaa !5
  %160 = invoke noundef i32 @_ZNK6R3Mesh8EdgeMarkEPK10R3MeshEdge(ptr noundef nonnull align 8 dereferenceable(272) %22, ptr noundef %159)
          to label %161 unwind label %151

161:                                              ; preds = %158
  %162 = load i32, ptr @R3mesh_mark, align 4, !tbaa !11
  %163 = icmp eq i32 %160, %162
  br i1 %163, label %164, label %169

164:                                              ; preds = %161
  %165 = load ptr, ptr %16, align 8, !tbaa !5
  invoke void @_ZN6RNHeapIP10R3MeshEdgeE6RemoveES1_(ptr noundef nonnull align 8 dereferenceable(52) %5, ptr noundef %165)
          to label %166 unwind label %151

166:                                              ; preds = %164
  %167 = load ptr, ptr %16, align 8, !tbaa !5
  invoke void @_ZN6R3Mesh11SetEdgeMarkEP10R3MeshEdgei(ptr noundef nonnull align 8 dereferenceable(272) %22, ptr noundef %167, i32 noundef 0)
          to label %168 unwind label %151

168:                                              ; preds = %166
  br label %169

169:                                              ; preds = %168, %161, %155
  call void @llvm.lifetime.start.p0(i64 8, ptr %17) #6
  %170 = load ptr, ptr %11, align 8, !tbaa !5
  %171 = load ptr, ptr %22, align 8, !tbaa !15
  %172 = getelementptr inbounds ptr, ptr %171, i64 21
  %173 = load ptr, ptr %172, align 8
  %174 = invoke noundef ptr %173(ptr noundef nonnull align 8 dereferenceable(272) %22, ptr noundef %170)
          to label %175 unwind label %179

175:                                              ; preds = %169
  store ptr %174, ptr %17, align 8, !tbaa !5
  %176 = load ptr, ptr %17, align 8, !tbaa !5
  %177 = icmp ne ptr %176, null
  br i1 %177, label %183, label %178

178:                                              ; preds = %175
  store i32 5, ptr %18, align 4
  br label %237, !llvm.loop !17

179:                                              ; preds = %169
  %180 = landingpad { ptr, i32 }
          cleanup
  %181 = extractvalue { ptr, i32 } %180, 0
  store ptr %181, ptr %7, align 8
  %182 = extractvalue { ptr, i32 } %180, 1
  store i32 %182, ptr %8, align 4
  br label %240

183:                                              ; preds = %175
  call void @llvm.lifetime.start.p0(i64 4, ptr %19) #6
  store i32 0, ptr %19, align 4, !tbaa !11
  br label %184

184:                                              ; preds = %231, %183
  %185 = load i32, ptr %19, align 4, !tbaa !11
  %186 = load ptr, ptr %17, align 8, !tbaa !5
  %187 = invoke noundef i32 @_ZNK6R3Mesh13VertexValenceEPK12R3MeshVertex(ptr noundef nonnull align 8 dereferenceable(272) %22, ptr noundef %186)
          to label %188 unwind label %191

188:                                              ; preds = %184
  %189 = icmp slt i32 %185, %187
  br i1 %189, label %195, label %190

190:                                              ; preds = %188
  store i32 7, ptr %18, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %19) #6
  br label %236

191:                                              ; preds = %184
  %192 = landingpad { ptr, i32 }
          cleanup
  %193 = extractvalue { ptr, i32 } %192, 0
  store ptr %193, ptr %7, align 8
  %194 = extractvalue { ptr, i32 } %192, 1
  store i32 %194, ptr %8, align 4
  br label %235

195:                                              ; preds = %188
  call void @llvm.lifetime.start.p0(i64 8, ptr %20) #6
  %196 = load ptr, ptr %17, align 8, !tbaa !5
  %197 = load i32, ptr %19, align 4, !tbaa !11
  %198 = invoke noundef ptr @_ZNK6R3Mesh12EdgeOnVertexEPK12R3MeshVertexi(ptr noundef nonnull align 8 dereferenceable(272) %22, ptr noundef %196, i32 noundef %197)
          to label %199 unwind label %208

199:                                              ; preds = %195
  store ptr %198, ptr %20, align 8, !tbaa !5
  %200 = load ptr, ptr %20, align 8, !tbaa !5
  %201 = invoke noundef i32 @_ZNK6R3Mesh8EdgeMarkEPK10R3MeshEdge(ptr noundef nonnull align 8 dereferenceable(272) %22, ptr noundef %200)
          to label %202 unwind label %208

202:                                              ; preds = %199
  %203 = load i32, ptr @R3mesh_mark, align 4, !tbaa !11
  %204 = icmp eq i32 %201, %203
  br i1 %204, label %205, label %212

205:                                              ; preds = %202
  %206 = load ptr, ptr %20, align 8, !tbaa !5
  invoke void @_ZN6RNHeapIP10R3MeshEdgeE6UpdateES1_(ptr noundef nonnull align 8 dereferenceable(52) %5, ptr noundef %206)
          to label %207 unwind label %208

207:                                              ; preds = %205
  br label %230

208:                                              ; preds = %205, %199, %195
  %209 = landingpad { ptr, i32 }
          cleanup
  %210 = extractvalue { ptr, i32 } %209, 0
  store ptr %210, ptr %7, align 8
  %211 = extractvalue { ptr, i32 } %209, 1
  store i32 %211, ptr %8, align 4
  br label %234

212:                                              ; preds = %202
  call void @llvm.lifetime.start.p0(i64 8, ptr %21) #6
  %213 = load ptr, ptr %20, align 8, !tbaa !5
  %214 = invoke noundef double @_ZNK6R3Mesh10EdgeLengthEPK10R3MeshEdge(ptr noundef nonnull align 8 dereferenceable(272) %22, ptr noundef %213)
          to label %215 unwind label %225

215:                                              ; preds = %212
  store double %214, ptr %21, align 8, !tbaa !9
  %216 = load double, ptr %21, align 8, !tbaa !9
  %217 = load double, ptr %4, align 8, !tbaa !9
  %218 = fcmp olt double %216, %217
  br i1 %218, label %219, label %229

219:                                              ; preds = %215
  %220 = load ptr, ptr %20, align 8, !tbaa !5
  %221 = load i32, ptr @R3mesh_mark, align 4, !tbaa !11
  invoke void @_ZN6R3Mesh11SetEdgeMarkEP10R3MeshEdgei(ptr noundef nonnull align 8 dereferenceable(272) %22, ptr noundef %220, i32 noundef %221)
          to label %222 unwind label %225

222:                                              ; preds = %219
  %223 = load ptr, ptr %20, align 8, !tbaa !5
  invoke void @_ZN6RNHeapIP10R3MeshEdgeE4PushES1_(ptr noundef nonnull align 8 dereferenceable(52) %5, ptr noundef %223)
          to label %224 unwind label %225

224:                                              ; preds = %222
  br label %229

225:                                              ; preds = %222, %219, %212
  %226 = landingpad { ptr, i32 }
          cleanup
  %227 = extractvalue { ptr, i32 } %226, 0
  store ptr %227, ptr %7, align 8
  %228 = extractvalue { ptr, i32 } %226, 1
  store i32 %228, ptr %8, align 4
  call void @llvm.lifetime.end.p0(i64 8, ptr %21) #6
  br label %234

229:                                              ; preds = %224, %215
  call void @llvm.lifetime.end.p0(i64 8, ptr %21) #6
  br label %230

230:                                              ; preds = %229, %207
  call void @llvm.lifetime.end.p0(i64 8, ptr %20) #6
  br label %231

231:                                              ; preds = %230
  %232 = load i32, ptr %19, align 4, !tbaa !11
  %233 = add nsw i32 %232, 1
  store i32 %233, ptr %19, align 4, !tbaa !11
  br label %184, !llvm.loop !18

234:                                              ; preds = %225, %208
  call void @llvm.lifetime.end.p0(i64 8, ptr %20) #6
  br label %235

235:                                              ; preds = %234, %191
  call void @llvm.lifetime.end.p0(i64 4, ptr %19) #6
  br label %240

236:                                              ; preds = %190
  store i32 0, ptr %18, align 4
  br label %237

237:                                              ; preds = %236, %178
  call void @llvm.lifetime.end.p0(i64 8, ptr %17) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr %16) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr %15) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr %14) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr %13) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr %12) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr %11) #6
  %238 = load i32, ptr %18, align 4
  switch i32 %238, label %253 [
    i32 0, label %239
    i32 5, label %66
  ]

239:                                              ; preds = %237
  br label %66, !llvm.loop !17

240:                                              ; preds = %235, %179
  call void @llvm.lifetime.end.p0(i64 8, ptr %17) #6
  br label %241

241:                                              ; preds = %240, %151
  call void @llvm.lifetime.end.p0(i64 8, ptr %16) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr %15) #6
  br label %242

242:                                              ; preds = %241, %147
  call void @llvm.lifetime.end.p0(i64 8, ptr %14) #6
  br label %243

243:                                              ; preds = %242, %143
  call void @llvm.lifetime.end.p0(i64 8, ptr %13) #6
  br label %244

244:                                              ; preds = %243, %139
  call void @llvm.lifetime.end.p0(i64 8, ptr %12) #6
  br label %245

245:                                              ; preds = %244, %85
  call void @llvm.lifetime.end.p0(i64 8, ptr %11) #6
  br label %247

246:                                              ; preds = %68
  call void @_ZN6RNHeapIP10R3MeshEdgeED2Ev(ptr noundef nonnull align 8 dereferenceable(52) %5) #6
  call void @llvm.lifetime.end.p0(i64 56, ptr %5) #6
  ret void

247:                                              ; preds = %245, %81, %64
  call void @_ZN6RNHeapIP10R3MeshEdgeED2Ev(ptr noundef nonnull align 8 dereferenceable(52) %5) #6
  call void @llvm.lifetime.end.p0(i64 56, ptr %5) #6
  br label %248

248:                                              ; preds = %247
  %249 = load ptr, ptr %7, align 8
  %250 = load i32, ptr %8, align 4
  %251 = insertvalue { ptr, i32 } poison, ptr %249, 0
  %252 = insertvalue { ptr, i32 } %251, i32 %250, 1
  resume { ptr, i32 } %252

253:                                              ; preds = %237
  unreachable
}

; Function Attrs: mustprogress uwtable
declare hidden noundef double @_ZL18EdgeLengthCallbackP10R3MeshEdgePv(ptr noundef, ptr noundef) #5

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

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local void @_ZN6R3Mesh11SetEdgeMarkEP10R3MeshEdgei(ptr noundef nonnull align 8 dereferenceable(272), ptr noundef, i32 noundef) #3 align 2

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN6RNHeapIP10R3MeshEdgeE4PushES1_(ptr noundef nonnull align 8 dereferenceable(52), ptr noundef) #5 align 2

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

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

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

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

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN6RNHeapIP10R3MeshEdgeE6RemoveES1_(ptr noundef nonnull align 8 dereferenceable(52), ptr noundef) #5 align 2

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN6RNHeapIP10R3MeshEdgeE6UpdateES1_(ptr noundef nonnull align 8 dereferenceable(52), ptr noundef) #5 align 2

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

attributes #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 = { 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 #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 = { mustprogress uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #6 = { nounwind }

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

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


; 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.RNHeap = type <{ ptr, i32, i32, i32, i32, ptr, ptr, ptr, i32, [4 x i8] }>

@R3mesh_mark = external dso_local local_unnamed_addr global i32, align 4
@.str = external hidden unnamed_addr constant [41 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [88 x i8], align 1
@.str.34 = external hidden unnamed_addr constant [30 x i8], align 1
@.str.35 = external hidden unnamed_addr constant [19 x i8], align 1

declare i32 @__gxx_personality_v0(...)

declare void @_Z7RNAbortPKcz(ptr noundef, ...) local_unnamed_addr #0

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

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

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local noundef i32 @_ZNK6R3Mesh6NEdgesEv(ptr noundef nonnull align 8 dereferenceable(272)) local_unnamed_addr #2 align 2

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

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

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local noundef double @_ZNK6R3Mesh10EdgeLengthEPK10R3MeshEdge(ptr noundef nonnull align 8 dereferenceable(272), ptr noundef) local_unnamed_addr #2 align 2

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

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

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

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

; Function Attrs: mustprogress uwtable
define dso_local void @_ZN6R3Mesh18CollapseShortEdgesEd(ptr noundef nonnull align 8 dereferenceable(272) %0, double noundef %1) local_unnamed_addr #5 align 2 personality ptr @__gxx_personality_v0 {
  %3 = alloca %class.RNHeap, align 8
  call void @llvm.lifetime.start.p0(i64 56, ptr nonnull %3) #6
  call void @_ZN6RNHeapIP10R3MeshEdgeEC2EPFdS1_PvEPFPPS1_S1_S3_ES3_i(ptr noundef nonnull align 8 dereferenceable(52) %3, ptr noundef nonnull @_ZL18EdgeLengthCallbackP10R3MeshEdgePv, ptr noundef null, ptr noundef nonnull %0, i32 noundef 1)
  %4 = load i32, ptr @R3mesh_mark, align 4, !tbaa !5
  %5 = add nsw i32 %4, 1
  store i32 %5, ptr @R3mesh_mark, align 4, !tbaa !5
  br label %6

6:                                                ; preds = %25, %2
  %.0 = phi i32 [ 0, %2 ], [ %26, %25 ]
  %7 = invoke noundef i32 @_ZNK6R3Mesh6NEdgesEv(ptr noundef nonnull align 8 dereferenceable(272) %0)
          to label %8 unwind label %11

8:                                                ; preds = %6
  %9 = icmp slt i32 %.0, %7
  br i1 %9, label %13, label %.preheader77

.preheader77:                                     ; preds = %8
  %10 = call noundef i32 @_ZNK6RNHeapIP10R3MeshEdgeE7IsEmptyEv(ptr noundef nonnull align 8 dereferenceable(52) %3)
  %.not78 = icmp eq i32 %10, 0
  br i1 %.not78, label %.lr.ph, label %._crit_edge

11:                                               ; preds = %6
  %12 = landingpad { ptr, i32 }
          cleanup
  br label %102

13:                                               ; preds = %8
  %14 = invoke noundef ptr @_ZNK6R3Mesh4EdgeEi(ptr noundef nonnull align 8 dereferenceable(272) %0, i32 noundef %.0)
          to label %15 unwind label %21

15:                                               ; preds = %13
  %16 = invoke noundef double @_ZNK6R3Mesh10EdgeLengthEPK10R3MeshEdge(ptr noundef nonnull align 8 dereferenceable(272) %0, ptr noundef %14)
          to label %17 unwind label %23

17:                                               ; preds = %15
  %18 = fcmp olt double %16, %1
  br i1 %18, label %19, label %25

19:                                               ; preds = %17
  %20 = load i32, ptr @R3mesh_mark, align 4, !tbaa !5
  call void @_ZN6R3Mesh11SetEdgeMarkEP10R3MeshEdgei(ptr noundef nonnull align 8 dereferenceable(272) %0, ptr noundef %14, i32 noundef %20)
  invoke void @_ZN6RNHeapIP10R3MeshEdgeE4PushES1_(ptr noundef nonnull align 8 dereferenceable(52) %3, ptr noundef %14)
          to label %25 unwind label %23

21:                                               ; preds = %13
  %22 = landingpad { ptr, i32 }
          cleanup
  br label %102

23:                                               ; preds = %19, %15
  %24 = landingpad { ptr, i32 }
          cleanup
  br label %102

25:                                               ; preds = %19, %17
  %26 = add nuw nsw i32 %.0, 1
  br label %6, !llvm.loop !9

.lr.ph:                                           ; preds = %.preheader77, %.loopexit
  %27 = invoke noundef ptr @_ZN6RNHeapIP10R3MeshEdgeE3PopEv(ptr noundef nonnull align 8 dereferenceable(52) %3)
          to label %28 unwind label %33

28:                                               ; preds = %.lr.ph
  %29 = call noundef i32 @_ZNK6R3Mesh8EdgeMarkEPK10R3MeshEdge(ptr noundef nonnull align 8 dereferenceable(272) %0, ptr noundef %27)
  %30 = load i32, ptr @R3mesh_mark, align 4, !tbaa !5
  %31 = icmp eq i32 %29, %30
  br i1 %31, label %35, label %32

32:                                               ; preds = %28
  invoke void (ptr, ...) @_Z7RNAbortPKcz(ptr noundef nonnull @.str, ptr noundef nonnull @.str.34, i32 noundef 2256, ptr noundef nonnull @.str.2)
          to label %35 unwind label %33

33:                                               ; preds = %38, %35, %32, %.lr.ph
  %34 = landingpad { ptr, i32 }
          cleanup
  br label %102

35:                                               ; preds = %32, %28
  %36 = invoke noundef i32 @_ZNK6R3Mesh12IsEdgeOnMeshEPK10R3MeshEdge(ptr noundef nonnull align 8 dereferenceable(272) %0, ptr noundef %27)
          to label %37 unwind label %33

37:                                               ; preds = %35
  %.not61 = icmp eq i32 %36, 0
  br i1 %.not61, label %38, label %39

38:                                               ; preds = %37
  invoke void (ptr, ...) @_Z7RNAbortPKcz(ptr noundef nonnull @.str, ptr noundef nonnull @.str.35, i32 noundef 2257, ptr noundef nonnull @.str.2)
          to label %39 unwind label %33

39:                                               ; preds = %38, %37
  %40 = invoke noundef ptr @_ZNK6R3Mesh12VertexOnEdgeEPK10R3MeshEdgei(ptr noundef nonnull align 8 dereferenceable(272) %0, ptr noundef %27, i32 noundef 1)
          to label %41 unwind label %58

41:                                               ; preds = %39
  %42 = call noundef ptr @_ZNK6R3Mesh10FaceOnEdgeEPK10R3MeshEdgei(ptr noundef nonnull align 8 dereferenceable(272) %0, ptr noundef %27, i32 noundef 0)
  %43 = call noundef ptr @_ZNK6R3Mesh10FaceOnEdgeEPK10R3MeshEdgei(ptr noundef nonnull align 8 dereferenceable(272) %0, ptr noundef %27, i32 noundef 1)
  %.not62 = icmp eq ptr %42, null
  br i1 %.not62, label %46, label %44

44:                                               ; preds = %41
  %45 = call noundef ptr @_ZNK6R3Mesh16EdgeAcrossVertexEPK12R3MeshVertexPK10R3MeshEdgePK10R3MeshFace(ptr noundef nonnull align 8 dereferenceable(272) %0, ptr noundef %40, ptr noundef %27, ptr noundef nonnull %42)
  br label %46

46:                                               ; preds = %41, %44
  %47 = phi ptr [ %45, %44 ], [ null, %41 ]
  %.not63 = icmp eq ptr %43, null
  br i1 %.not63, label %50, label %48

48:                                               ; preds = %46
  %49 = call noundef ptr @_ZNK6R3Mesh16EdgeAcrossVertexEPK12R3MeshVertexPK10R3MeshEdgePK10R3MeshFace(ptr noundef nonnull align 8 dereferenceable(272) %0, ptr noundef %40, ptr noundef %27, ptr noundef nonnull %43)
  br label %50

50:                                               ; preds = %46, %48
  %51 = phi ptr [ %49, %48 ], [ null, %46 ]
  %.not64 = icmp eq ptr %47, null
  br i1 %.not64, label %62, label %52

52:                                               ; preds = %50
  %53 = call noundef i32 @_ZNK6R3Mesh8EdgeMarkEPK10R3MeshEdge(ptr noundef nonnull align 8 dereferenceable(272) %0, ptr noundef nonnull %47)
  %54 = load i32, ptr @R3mesh_mark, align 4, !tbaa !5
  %55 = icmp eq i32 %53, %54
  br i1 %55, label %56, label %62

56:                                               ; preds = %52
  invoke void @_ZN6RNHeapIP10R3MeshEdgeE6RemoveES1_(ptr noundef nonnull align 8 dereferenceable(52) %3, ptr noundef nonnull %47)
          to label %57 unwind label %60

57:                                               ; preds = %56
  call void @_ZN6R3Mesh11SetEdgeMarkEP10R3MeshEdgei(ptr noundef nonnull align 8 dereferenceable(272) %0, ptr noundef nonnull %47, i32 noundef 0)
  br label %62

58:                                               ; preds = %39
  %59 = landingpad { ptr, i32 }
          cleanup
  br label %102

60:                                               ; preds = %67, %56
  %61 = landingpad { ptr, i32 }
          cleanup
  br label %102

62:                                               ; preds = %57, %52, %50
  %.not65 = icmp eq ptr %51, null
  br i1 %.not65, label %69, label %63

63:                                               ; preds = %62
  %64 = call noundef i32 @_ZNK6R3Mesh8EdgeMarkEPK10R3MeshEdge(ptr noundef nonnull align 8 dereferenceable(272) %0, ptr noundef nonnull %51)
  %65 = load i32, ptr @R3mesh_mark, align 4, !tbaa !5
  %66 = icmp eq i32 %64, %65
  br i1 %66, label %67, label %69

67:                                               ; preds = %63
  invoke void @_ZN6RNHeapIP10R3MeshEdgeE6RemoveES1_(ptr noundef nonnull align 8 dereferenceable(52) %3, ptr noundef nonnull %51)
          to label %68 unwind label %60

68:                                               ; preds = %67
  call void @_ZN6R3Mesh11SetEdgeMarkEP10R3MeshEdgei(ptr noundef nonnull align 8 dereferenceable(272) %0, ptr noundef nonnull %51, i32 noundef 0)
  br label %69

69:                                               ; preds = %68, %63, %62
  %70 = load ptr, ptr %0, align 8, !tbaa !11
  %71 = getelementptr inbounds i8, ptr %70, i64 168
  %72 = load ptr, ptr %71, align 8
  %73 = invoke noundef ptr %72(ptr noundef nonnull align 8 dereferenceable(272) %0, ptr noundef %27)
          to label %74 unwind label %75

74:                                               ; preds = %69
  %.not66 = icmp eq ptr %73, null
  br i1 %.not66, label %.loopexit, label %.preheader, !llvm.loop !13

75:                                               ; preds = %69
  %76 = landingpad { ptr, i32 }
          cleanup
  br label %102

.preheader:                                       ; preds = %74, %99
  %.046 = phi i32 [ %100, %99 ], [ 0, %74 ]
  %77 = invoke noundef i32 @_ZNK6R3Mesh13VertexValenceEPK12R3MeshVertex(ptr noundef nonnull align 8 dereferenceable(272) %0, ptr noundef nonnull %73)
          to label %78 unwind label %80

78:                                               ; preds = %.preheader
  %79 = icmp slt i32 %.046, %77
  br i1 %79, label %82, label %.loopexit

80:                                               ; preds = %.preheader
  %81 = landingpad { ptr, i32 }
          cleanup
  br label %102

82:                                               ; preds = %78
  %83 = invoke noundef ptr @_ZNK6R3Mesh12EdgeOnVertexEPK12R3MeshVertexi(ptr noundef nonnull align 8 dereferenceable(272) %0, ptr noundef nonnull %73, i32 noundef %.046)
          to label %84 unwind label %89

84:                                               ; preds = %82
  %85 = call noundef i32 @_ZNK6R3Mesh8EdgeMarkEPK10R3MeshEdge(ptr noundef nonnull align 8 dereferenceable(272) %0, ptr noundef %83)
  %86 = load i32, ptr @R3mesh_mark, align 4, !tbaa !5
  %87 = icmp eq i32 %85, %86
  br i1 %87, label %88, label %91

88:                                               ; preds = %84
  invoke void @_ZN6RNHeapIP10R3MeshEdgeE6UpdateES1_(ptr noundef nonnull align 8 dereferenceable(52) %3, ptr noundef %83)
          to label %99 unwind label %89

89:                                               ; preds = %88, %82
  %90 = landingpad { ptr, i32 }
          cleanup
  br label %102

91:                                               ; preds = %84
  %92 = invoke noundef double @_ZNK6R3Mesh10EdgeLengthEPK10R3MeshEdge(ptr noundef nonnull align 8 dereferenceable(272) %0, ptr noundef %83)
          to label %93 unwind label %97

93:                                               ; preds = %91
  %94 = fcmp olt double %92, %1
  br i1 %94, label %95, label %99

95:                                               ; preds = %93
  %96 = load i32, ptr @R3mesh_mark, align 4, !tbaa !5
  call void @_ZN6R3Mesh11SetEdgeMarkEP10R3MeshEdgei(ptr noundef nonnull align 8 dereferenceable(272) %0, ptr noundef %83, i32 noundef %96)
  invoke void @_ZN6RNHeapIP10R3MeshEdgeE4PushES1_(ptr noundef nonnull align 8 dereferenceable(52) %3, ptr noundef %83)
          to label %99 unwind label %97

97:                                               ; preds = %95, %91
  %98 = landingpad { ptr, i32 }
          cleanup
  br label %102

99:                                               ; preds = %93, %95, %88
  %100 = add nuw nsw i32 %.046, 1
  br label %.preheader, !llvm.loop !14

.loopexit:                                        ; preds = %78, %74
  %101 = call noundef i32 @_ZNK6RNHeapIP10R3MeshEdgeE7IsEmptyEv(ptr noundef nonnull align 8 dereferenceable(52) %3)
  %.not = icmp eq i32 %101, 0
  br i1 %.not, label %.lr.ph, label %._crit_edge

._crit_edge:                                      ; preds = %.loopexit, %.preheader77
  call void @_ZN6RNHeapIP10R3MeshEdgeED2Ev(ptr noundef nonnull align 8 dereferenceable(52) %3) #6
  call void @llvm.lifetime.end.p0(i64 56, ptr nonnull %3) #6
  ret void

102:                                              ; preds = %33, %60, %80, %97, %89, %75, %58, %11, %23, %21
  %.pn73.pn.pn = phi { ptr, i32 } [ %12, %11 ], [ %24, %23 ], [ %22, %21 ], [ %34, %33 ], [ %59, %58 ], [ %61, %60 ], [ %76, %75 ], [ %81, %80 ], [ %90, %89 ], [ %98, %97 ]
  call void @_ZN6RNHeapIP10R3MeshEdgeED2Ev(ptr noundef nonnull align 8 dereferenceable(52) %3) #6
  call void @llvm.lifetime.end.p0(i64 56, ptr nonnull %3) #6
  resume { ptr, i32 } %.pn73.pn.pn
}

; Function Attrs: mustprogress uwtable
declare hidden noundef double @_ZL18EdgeLengthCallbackP10R3MeshEdgePv(ptr noundef, ptr noundef) #5

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

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local void @_ZN6R3Mesh11SetEdgeMarkEP10R3MeshEdgei(ptr noundef nonnull align 8 dereferenceable(272), ptr noundef, i32 noundef) local_unnamed_addr #3 align 2

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN6RNHeapIP10R3MeshEdgeE4PushES1_(ptr noundef nonnull align 8 dereferenceable(52), ptr noundef) local_unnamed_addr #5 align 2

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

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

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

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

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN6RNHeapIP10R3MeshEdgeE6RemoveES1_(ptr noundef nonnull align 8 dereferenceable(52), ptr noundef) local_unnamed_addr #5 align 2

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN6RNHeapIP10R3MeshEdgeE6UpdateES1_(ptr noundef nonnull align 8 dereferenceable(52), ptr noundef) local_unnamed_addr #5 align 2

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

attributes #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 = { 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 #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 = { mustprogress uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #6 = { nounwind }

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

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


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