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

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

declare i32 @__gxx_personality_v0(...)

; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare { i64, i1 } @llvm.umul.with.overflow.i64(i64, i64) #0

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

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

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

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

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

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef i32 @_ZNK6R3Mesh6EdgeIDEPK10R3MeshEdge(ptr noundef nonnull align 8 dereferenceable(272), ptr noundef) #4 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) #4 align 2

; Function Attrs: nobuiltin nounwind
declare void @_ZdaPv(ptr noundef) #5

; Function Attrs: mustprogress uwtable
define dso_local void @_ZN6R3Mesh9SwapEdgesEd(ptr noundef nonnull align 8 dereferenceable(272) %0, double noundef %1) #6 align 2 personality ptr @__gxx_personality_v0 {
  %3 = alloca ptr, align 8
  %4 = alloca double, align 8
  %5 = alloca %class.RNHeap.2, align 8
  %6 = alloca ptr, align 8
  %7 = alloca ptr, align 8
  %8 = alloca i32, align 4
  %9 = alloca i32, align 4
  %10 = alloca i32, align 4
  %11 = alloca ptr, align 8
  %12 = alloca ptr, align 8
  %13 = alloca i32, align 4
  %14 = alloca ptr, align 8
  %15 = alloca double, align 8
  %16 = alloca i32, align 4
  %17 = alloca i32, align 4
  %18 = alloca ptr, align 8
  %19 = alloca ptr, align 8
  %20 = alloca i32, align 4
  %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) #8
  call void @_ZN6RNHeapIPdEC2Eiii(ptr noundef nonnull align 8 dereferenceable(52) %5, i32 noundef 0, i32 noundef -1, i32 noundef 0)
  call void @llvm.lifetime.start.p0(i64 8, ptr %6) #8
  %23 = invoke noundef i32 @_ZNK6R3Mesh6NEdgesEv(ptr noundef nonnull align 8 dereferenceable(272) %22)
          to label %24 unwind label %38

24:                                               ; preds = %2
  %25 = sext i32 %23 to i64
  %26 = call { i64, i1 } @llvm.umul.with.overflow.i64(i64 %25, i64 8)
  %27 = extractvalue { i64, i1 } %26, 1
  %28 = extractvalue { i64, i1 } %26, 0
  %29 = select i1 %27, i64 -1, i64 %28
  %30 = invoke noalias noundef nonnull ptr @_Znam(i64 noundef %29) #9
          to label %31 unwind label %38

31:                                               ; preds = %24
  store ptr %30, ptr %6, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %9) #8
  store i32 0, ptr %9, align 4, !tbaa !11
  br label %32

32:                                               ; preds = %78, %31
  %33 = load i32, ptr %9, align 4, !tbaa !11
  %34 = invoke noundef i32 @_ZNK6R3Mesh6NEdgesEv(ptr noundef nonnull align 8 dereferenceable(272) %22)
          to label %35 unwind label %42

35:                                               ; preds = %32
  %36 = icmp slt i32 %33, %34
  br i1 %36, label %46, label %37

37:                                               ; preds = %35
  store i32 2, ptr %10, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %9) #8
  br label %82

38:                                               ; preds = %83, %24, %2
  %39 = landingpad { ptr, i32 }
          cleanup
  %40 = extractvalue { ptr, i32 } %39, 0
  store ptr %40, ptr %7, align 8
  %41 = extractvalue { ptr, i32 } %39, 1
  store i32 %41, ptr %8, align 4
  br label %281

42:                                               ; preds = %32
  %43 = landingpad { ptr, i32 }
          cleanup
  %44 = extractvalue { ptr, i32 } %43, 0
  store ptr %44, ptr %7, align 8
  %45 = extractvalue { ptr, i32 } %43, 1
  store i32 %45, ptr %8, align 4
  br label %81

46:                                               ; preds = %35
  call void @llvm.lifetime.start.p0(i64 8, ptr %11) #8
  %47 = load i32, ptr %9, align 4, !tbaa !11
  %48 = invoke noundef ptr @_ZNK6R3Mesh4EdgeEi(ptr noundef nonnull align 8 dereferenceable(272) %22, i32 noundef %47)
          to label %49 unwind label %65

49:                                               ; preds = %46
  store ptr %48, ptr %11, align 8, !tbaa !5
  %50 = load ptr, ptr %11, align 8, !tbaa !5
  %51 = invoke noundef double @_ZL19R3MeshEdgeSwapValueP6R3MeshP10R3MeshEdge(ptr noundef %22, ptr noundef %50)
          to label %52 unwind label %65

52:                                               ; preds = %49
  %53 = load ptr, ptr %6, align 8, !tbaa !5
  %54 = load i32, ptr %9, align 4, !tbaa !11
  %55 = sext i32 %54 to i64
  %56 = getelementptr inbounds double, ptr %53, i64 %55
  store double %51, ptr %56, align 8, !tbaa !9
  %57 = load ptr, ptr %6, align 8, !tbaa !5
  %58 = load i32, ptr %9, align 4, !tbaa !11
  %59 = sext i32 %58 to i64
  %60 = getelementptr inbounds double, ptr %57, i64 %59
  %61 = load double, ptr %60, align 8, !tbaa !9
  %62 = load double, ptr %4, align 8, !tbaa !9
  %63 = fcmp olt double %61, %62
  br i1 %63, label %64, label %69

64:                                               ; preds = %52
  store i32 4, ptr %10, align 4
  br label %75

65:                                               ; preds = %69, %49, %46
  %66 = landingpad { ptr, i32 }
          cleanup
  %67 = extractvalue { ptr, i32 } %66, 0
  store ptr %67, ptr %7, align 8
  %68 = extractvalue { ptr, i32 } %66, 1
  store i32 %68, ptr %8, align 4
  call void @llvm.lifetime.end.p0(i64 8, ptr %11) #8
  br label %81

69:                                               ; preds = %52
  %70 = load ptr, ptr %6, align 8, !tbaa !5
  %71 = load i32, ptr %9, align 4, !tbaa !11
  %72 = sext i32 %71 to i64
  %73 = getelementptr inbounds double, ptr %70, i64 %72
  invoke void @_ZN6RNHeapIPdE4PushES0_(ptr noundef nonnull align 8 dereferenceable(52) %5, ptr noundef %73)
          to label %74 unwind label %65

74:                                               ; preds = %69
  store i32 0, ptr %10, align 4
  br label %75

75:                                               ; preds = %74, %64
  call void @llvm.lifetime.end.p0(i64 8, ptr %11) #8
  %76 = load i32, ptr %10, align 4
  switch i32 %76, label %287 [
    i32 0, label %77
    i32 4, label %78
  ]

77:                                               ; preds = %75
  br label %78

78:                                               ; preds = %77, %75
  %79 = load i32, ptr %9, align 4, !tbaa !11
  %80 = add nsw i32 %79, 1
  store i32 %80, ptr %9, align 4, !tbaa !11
  br label %32, !llvm.loop !13

81:                                               ; preds = %65, %42
  call void @llvm.lifetime.end.p0(i64 4, ptr %9) #8
  br label %281

82:                                               ; preds = %37
  br label %83

83:                                               ; preds = %272, %270, %82
  %84 = invoke noundef i32 @_ZNK6RNHeapIPdE7IsEmptyEv(ptr noundef nonnull align 8 dereferenceable(52) %5)
          to label %85 unwind label %38

85:                                               ; preds = %83
  %86 = icmp ne i32 %84, 0
  %87 = xor i1 %86, true
  br i1 %87, label %88, label %276

88:                                               ; preds = %85
  call void @llvm.lifetime.start.p0(i64 8, ptr %12) #8
  %89 = invoke noundef ptr @_ZN6RNHeapIPdE3PopEv(ptr noundef nonnull align 8 dereferenceable(52) %5)
          to label %90 unwind label %106

90:                                               ; preds = %88
  store ptr %89, ptr %12, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %13) #8
  %91 = load ptr, ptr %12, align 8, !tbaa !5
  %92 = load ptr, ptr %6, align 8, !tbaa !5
  %93 = ptrtoint ptr %91 to i64
  %94 = ptrtoint ptr %92 to i64
  %95 = sub i64 %93, %94
  %96 = sdiv exact i64 %95, 8
  %97 = trunc i64 %96 to i32
  store i32 %97, ptr %13, align 4, !tbaa !11
  call void @llvm.lifetime.start.p0(i64 8, ptr %14) #8
  %98 = load i32, ptr %13, align 4, !tbaa !11
  %99 = invoke noundef ptr @_ZNK6R3Mesh4EdgeEi(ptr noundef nonnull align 8 dereferenceable(272) %22, i32 noundef %98)
          to label %100 unwind label %110

100:                                              ; preds = %90
  store ptr %99, ptr %14, align 8, !tbaa !5
  %101 = load ptr, ptr %12, align 8, !tbaa !5
  %102 = load double, ptr %101, align 8, !tbaa !9
  %103 = load double, ptr %4, align 8, !tbaa !9
  %104 = fcmp olt double %102, %103
  br i1 %104, label %105, label %114

105:                                              ; preds = %100
  store i32 6, ptr %10, align 4
  br label %270

106:                                              ; preds = %88
  %107 = landingpad { ptr, i32 }
          cleanup
  %108 = extractvalue { ptr, i32 } %107, 0
  store ptr %108, ptr %7, align 8
  %109 = extractvalue { ptr, i32 } %107, 1
  store i32 %109, ptr %8, align 4
  br label %275

110:                                              ; preds = %90
  %111 = landingpad { ptr, i32 }
          cleanup
  %112 = extractvalue { ptr, i32 } %111, 0
  store ptr %112, ptr %7, align 8
  %113 = extractvalue { ptr, i32 } %111, 1
  store i32 %113, ptr %8, align 4
  br label %274

114:                                              ; preds = %100
  call void @llvm.lifetime.start.p0(i64 8, ptr %15) #8
  %115 = load ptr, ptr %14, align 8, !tbaa !5
  %116 = invoke noundef double @_ZL19R3MeshEdgeSwapValueP6R3MeshP10R3MeshEdge(ptr noundef %22, ptr noundef %115)
          to label %117 unwind label %140

117:                                              ; preds = %114
  store double %116, ptr %15, align 8, !tbaa !9
  %118 = load double, ptr %15, align 8, !tbaa !9
  %119 = load ptr, ptr %6, align 8, !tbaa !5
  %120 = load i32, ptr %13, align 4, !tbaa !11
  %121 = sext i32 %120 to i64
  %122 = getelementptr inbounds double, ptr %119, i64 %121
  %123 = load double, ptr %122, align 8, !tbaa !9
  %124 = fcmp une double %118, %123
  br i1 %124, label %125, label %145

125:                                              ; preds = %117
  %126 = load double, ptr %15, align 8, !tbaa !9
  %127 = load ptr, ptr %6, align 8, !tbaa !5
  %128 = load i32, ptr %13, align 4, !tbaa !11
  %129 = sext i32 %128 to i64
  %130 = getelementptr inbounds double, ptr %127, i64 %129
  store double %126, ptr %130, align 8, !tbaa !9
  %131 = load double, ptr %15, align 8, !tbaa !9
  %132 = load double, ptr %4, align 8, !tbaa !9
  %133 = fcmp oge double %131, %132
  br i1 %133, label %134, label %144

134:                                              ; preds = %125
  %135 = load ptr, ptr %6, align 8, !tbaa !5
  %136 = load i32, ptr %13, align 4, !tbaa !11
  %137 = sext i32 %136 to i64
  %138 = getelementptr inbounds double, ptr %135, i64 %137
  invoke void @_ZN6RNHeapIPdE4PushES0_(ptr noundef nonnull align 8 dereferenceable(52) %5, ptr noundef %138)
          to label %139 unwind label %140

139:                                              ; preds = %134
  br label %144

140:                                              ; preds = %145, %134, %114
  %141 = landingpad { ptr, i32 }
          cleanup
  %142 = extractvalue { ptr, i32 } %141, 0
  store ptr %142, ptr %7, align 8
  %143 = extractvalue { ptr, i32 } %141, 1
  store i32 %143, ptr %8, align 4
  br label %273

144:                                              ; preds = %139, %125
  store i32 5, ptr %10, align 4
  br label %269, !llvm.loop !15

145:                                              ; preds = %117
  %146 = load ptr, ptr %14, align 8, !tbaa !5
  %147 = load ptr, ptr %22, align 8, !tbaa !16
  %148 = getelementptr inbounds ptr, ptr %147, i64 26
  %149 = load ptr, ptr %148, align 8
  %150 = invoke noundef i32 %149(ptr noundef nonnull align 8 dereferenceable(272) %22, ptr noundef %146)
          to label %151 unwind label %140

151:                                              ; preds = %145
  %152 = icmp ne i32 %150, 0
  br i1 %152, label %154, label %153

153:                                              ; preds = %151
  store i32 5, ptr %10, align 4
  br label %269, !llvm.loop !15

154:                                              ; preds = %151
  %155 = load double, ptr %15, align 8, !tbaa !9
  %156 = fneg double %155
  %157 = load ptr, ptr %6, align 8, !tbaa !5
  %158 = load i32, ptr %13, align 4, !tbaa !11
  %159 = sext i32 %158 to i64
  %160 = getelementptr inbounds double, ptr %157, i64 %159
  store double %156, ptr %160, align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %16) #8
  store i32 0, ptr %16, align 4, !tbaa !11
  br label %161

161:                                              ; preds = %265, %154
  %162 = load i32, ptr %16, align 4, !tbaa !11
  %163 = icmp slt i32 %162, 2
  br i1 %163, label %165, label %164

164:                                              ; preds = %161
  store i32 7, ptr %10, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %16) #8
  br label %268

165:                                              ; preds = %161
  call void @llvm.lifetime.start.p0(i64 4, ptr %17) #8
  store i32 0, ptr %17, align 4, !tbaa !11
  br label %166

166:                                              ; preds = %258, %165
  %167 = load i32, ptr %17, align 4, !tbaa !11
  %168 = icmp slt i32 %167, 2
  br i1 %168, label %170, label %169

169:                                              ; preds = %166
  store i32 10, ptr %10, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %17) #8
  br label %264

170:                                              ; preds = %166
  call void @llvm.lifetime.start.p0(i64 8, ptr %18) #8
  %171 = load ptr, ptr %14, align 8, !tbaa !5
  %172 = load i32, ptr %16, align 4, !tbaa !11
  %173 = invoke noundef ptr @_ZNK6R3Mesh10FaceOnEdgeEPK10R3MeshEdgei(ptr noundef nonnull align 8 dereferenceable(272) %22, ptr noundef %171, i32 noundef %172)
          to label %174 unwind label %178

174:                                              ; preds = %170
  store ptr %173, ptr %18, align 8, !tbaa !5
  %175 = load ptr, ptr %18, align 8, !tbaa !5
  %176 = icmp ne ptr %175, null
  br i1 %176, label %182, label %177

177:                                              ; preds = %174
  store i32 12, ptr %10, align 4
  br label %255

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

182:                                              ; preds = %174
  call void @llvm.lifetime.start.p0(i64 8, ptr %19) #8
  %183 = load ptr, ptr %18, align 8, !tbaa !5
  %184 = load ptr, ptr %14, align 8, !tbaa !5
  %185 = load i32, ptr %17, align 4, !tbaa !11
  %186 = invoke noundef ptr @_ZNK6R3Mesh10EdgeOnFaceEPK10R3MeshFacePK10R3MeshEdgei(ptr noundef nonnull align 8 dereferenceable(272) %22, ptr noundef %183, ptr noundef %184, i32 noundef %185)
          to label %187 unwind label %220

187:                                              ; preds = %182
  store ptr %186, ptr %19, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %20) #8
  %188 = load ptr, ptr %19, align 8, !tbaa !5
  %189 = invoke noundef i32 @_ZNK6R3Mesh6EdgeIDEPK10R3MeshEdge(ptr noundef nonnull align 8 dereferenceable(272) %22, ptr noundef %188)
          to label %190 unwind label %224

190:                                              ; preds = %187
  store i32 %189, ptr %20, align 4, !tbaa !11
  call void @llvm.lifetime.start.p0(i64 8, ptr %21) #8
  %191 = load ptr, ptr %6, align 8, !tbaa !5
  %192 = load i32, ptr %20, align 4, !tbaa !11
  %193 = sext i32 %192 to i64
  %194 = getelementptr inbounds double, ptr %191, i64 %193
  %195 = load double, ptr %194, align 8, !tbaa !9
  store double %195, ptr %21, align 8, !tbaa !9
  %196 = load ptr, ptr %19, align 8, !tbaa !5
  %197 = invoke noundef double @_ZL19R3MeshEdgeSwapValueP6R3MeshP10R3MeshEdge(ptr noundef %22, ptr noundef %196)
          to label %198 unwind label %228

198:                                              ; preds = %190
  %199 = load ptr, ptr %6, align 8, !tbaa !5
  %200 = load i32, ptr %20, align 4, !tbaa !11
  %201 = sext i32 %200 to i64
  %202 = getelementptr inbounds double, ptr %199, i64 %201
  store double %197, ptr %202, align 8, !tbaa !9
  %203 = load double, ptr %21, align 8, !tbaa !9
  %204 = load double, ptr %4, align 8, !tbaa !9
  %205 = fcmp oge double %203, %204
  br i1 %205, label %206, label %239

206:                                              ; preds = %198
  %207 = load ptr, ptr %6, align 8, !tbaa !5
  %208 = load i32, ptr %20, align 4, !tbaa !11
  %209 = sext i32 %208 to i64
  %210 = getelementptr inbounds double, ptr %207, i64 %209
  %211 = load double, ptr %210, align 8, !tbaa !9
  %212 = load double, ptr %4, align 8, !tbaa !9
  %213 = fcmp oge double %211, %212
  br i1 %213, label %214, label %232

214:                                              ; preds = %206
  %215 = load ptr, ptr %6, align 8, !tbaa !5
  %216 = load i32, ptr %20, align 4, !tbaa !11
  %217 = sext i32 %216 to i64
  %218 = getelementptr inbounds double, ptr %215, i64 %217
  invoke void @_ZN6RNHeapIPdE6UpdateES0_(ptr noundef nonnull align 8 dereferenceable(52) %5, ptr noundef %218)
          to label %219 unwind label %228

219:                                              ; preds = %214
  br label %238

220:                                              ; preds = %182
  %221 = landingpad { ptr, i32 }
          cleanup
  %222 = extractvalue { ptr, i32 } %221, 0
  store ptr %222, ptr %7, align 8
  %223 = extractvalue { ptr, i32 } %221, 1
  store i32 %223, ptr %8, align 4
  br label %262

224:                                              ; preds = %187
  %225 = landingpad { ptr, i32 }
          cleanup
  %226 = extractvalue { ptr, i32 } %225, 0
  store ptr %226, ptr %7, align 8
  %227 = extractvalue { ptr, i32 } %225, 1
  store i32 %227, ptr %8, align 4
  br label %261

228:                                              ; preds = %247, %232, %214, %190
  %229 = landingpad { ptr, i32 }
          cleanup
  %230 = extractvalue { ptr, i32 } %229, 0
  store ptr %230, ptr %7, align 8
  %231 = extractvalue { ptr, i32 } %229, 1
  store i32 %231, ptr %8, align 4
  call void @llvm.lifetime.end.p0(i64 8, ptr %21) #8
  br label %261

232:                                              ; preds = %206
  %233 = load ptr, ptr %6, align 8, !tbaa !5
  %234 = load i32, ptr %20, align 4, !tbaa !11
  %235 = sext i32 %234 to i64
  %236 = getelementptr inbounds double, ptr %233, i64 %235
  invoke void @_ZN6RNHeapIPdE6RemoveES0_(ptr noundef nonnull align 8 dereferenceable(52) %5, ptr noundef %236)
          to label %237 unwind label %228

237:                                              ; preds = %232
  br label %238

238:                                              ; preds = %237, %219
  br label %254

239:                                              ; preds = %198
  %240 = load ptr, ptr %6, align 8, !tbaa !5
  %241 = load i32, ptr %20, align 4, !tbaa !11
  %242 = sext i32 %241 to i64
  %243 = getelementptr inbounds double, ptr %240, i64 %242
  %244 = load double, ptr %243, align 8, !tbaa !9
  %245 = load double, ptr %4, align 8, !tbaa !9
  %246 = fcmp oge double %244, %245
  br i1 %246, label %247, label %253

247:                                              ; preds = %239
  %248 = load ptr, ptr %6, align 8, !tbaa !5
  %249 = load i32, ptr %20, align 4, !tbaa !11
  %250 = sext i32 %249 to i64
  %251 = getelementptr inbounds double, ptr %248, i64 %250
  invoke void @_ZN6RNHeapIPdE4PushES0_(ptr noundef nonnull align 8 dereferenceable(52) %5, ptr noundef %251)
          to label %252 unwind label %228

252:                                              ; preds = %247
  br label %253

253:                                              ; preds = %252, %239
  br label %254

254:                                              ; preds = %253, %238
  call void @llvm.lifetime.end.p0(i64 8, ptr %21) #8
  call void @llvm.lifetime.end.p0(i64 4, ptr %20) #8
  call void @llvm.lifetime.end.p0(i64 8, ptr %19) #8
  store i32 0, ptr %10, align 4
  br label %255

255:                                              ; preds = %254, %177
  call void @llvm.lifetime.end.p0(i64 8, ptr %18) #8
  %256 = load i32, ptr %10, align 4
  switch i32 %256, label %287 [
    i32 0, label %257
    i32 12, label %258
  ]

257:                                              ; preds = %255
  br label %258

258:                                              ; preds = %257, %255
  %259 = load i32, ptr %17, align 4, !tbaa !11
  %260 = add nsw i32 %259, 1
  store i32 %260, ptr %17, align 4, !tbaa !11
  br label %166, !llvm.loop !18

261:                                              ; preds = %228, %224
  call void @llvm.lifetime.end.p0(i64 4, ptr %20) #8
  br label %262

262:                                              ; preds = %261, %220
  call void @llvm.lifetime.end.p0(i64 8, ptr %19) #8
  br label %263

263:                                              ; preds = %262, %178
  call void @llvm.lifetime.end.p0(i64 8, ptr %18) #8
  call void @llvm.lifetime.end.p0(i64 4, ptr %17) #8
  call void @llvm.lifetime.end.p0(i64 4, ptr %16) #8
  br label %273

264:                                              ; preds = %169
  br label %265

265:                                              ; preds = %264
  %266 = load i32, ptr %16, align 4, !tbaa !11
  %267 = add nsw i32 %266, 1
  store i32 %267, ptr %16, align 4, !tbaa !11
  br label %161, !llvm.loop !19

268:                                              ; preds = %164
  store i32 0, ptr %10, align 4
  br label %269

269:                                              ; preds = %268, %153, %144
  call void @llvm.lifetime.end.p0(i64 8, ptr %15) #8
  br label %270

270:                                              ; preds = %269, %105
  call void @llvm.lifetime.end.p0(i64 8, ptr %14) #8
  call void @llvm.lifetime.end.p0(i64 4, ptr %13) #8
  call void @llvm.lifetime.end.p0(i64 8, ptr %12) #8
  %271 = load i32, ptr %10, align 4
  switch i32 %271, label %287 [
    i32 0, label %272
    i32 6, label %276
    i32 5, label %83
  ]

272:                                              ; preds = %270
  br label %83, !llvm.loop !15

273:                                              ; preds = %263, %140
  call void @llvm.lifetime.end.p0(i64 8, ptr %15) #8
  br label %274

274:                                              ; preds = %273, %110
  call void @llvm.lifetime.end.p0(i64 8, ptr %14) #8
  call void @llvm.lifetime.end.p0(i64 4, ptr %13) #8
  br label %275

275:                                              ; preds = %274, %106
  call void @llvm.lifetime.end.p0(i64 8, ptr %12) #8
  br label %281

276:                                              ; preds = %270, %85
  %277 = load ptr, ptr %6, align 8, !tbaa !5
  %278 = icmp eq ptr %277, null
  br i1 %278, label %280, label %279

279:                                              ; preds = %276
  call void @_ZdaPv(ptr noundef %277) #10
  br label %280

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

281:                                              ; preds = %275, %81, %38
  call void @llvm.lifetime.end.p0(i64 8, ptr %6) #8
  call void @_ZN6RNHeapIPdED2Ev(ptr noundef nonnull align 8 dereferenceable(52) %5) #8
  call void @llvm.lifetime.end.p0(i64 56, ptr %5) #8
  br label %282

282:                                              ; preds = %281
  %283 = load ptr, ptr %7, align 8
  %284 = load i32, ptr %8, align 4
  %285 = insertvalue { ptr, i32 } poison, ptr %283, 0
  %286 = insertvalue { ptr, i32 } %285, i32 %284, 1
  resume { ptr, i32 } %286

287:                                              ; preds = %270, %255, %75
  unreachable
}

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

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

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

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

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

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

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

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

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

attributes #0 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #1 = { nobuiltin allocsize(0) "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #2 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #3 = { 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 #4 = { 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 #5 = { nobuiltin nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #6 = { mustprogress uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #7 = { 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 #8 = { nounwind }
attributes #9 = { builtin allocsize(0) }
attributes #10 = { builtin nounwind }

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

!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"clang version 19.1.0 (git@github.com:llvm/llvm-project.git a4bf6cd7cfb1a1421ba92bca9d017b49936c55e4)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"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 = distinct !{!15, !14}
!16 = !{!17, !17, i64 0}
!17 = !{!"vtable pointer", !8, i64 0}
!18 = distinct !{!18, !14}
!19 = distinct !{!19, !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.2 = type <{ ptr, i32, i32, i32, i32, ptr, ptr, ptr, i32, [4 x i8] }>

declare i32 @__gxx_personality_v0(...)

; Function Attrs: nobuiltin allocsize(0)
declare noundef nonnull ptr @_Znam(i64 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 nounwind uwtable
declare dso_local noundef i32 @_ZNK6R3Mesh6EdgeIDEPK10R3MeshEdge(ptr noundef nonnull align 8 dereferenceable(272), ptr noundef) local_unnamed_addr #3 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: nobuiltin nounwind
declare void @_ZdaPv(ptr noundef) local_unnamed_addr #4

; Function Attrs: mustprogress uwtable
define dso_local void @_ZN6R3Mesh9SwapEdgesEd(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.2, align 8
  call void @llvm.lifetime.start.p0(i64 56, ptr nonnull %3) #7
  call void @_ZN6RNHeapIPdEC2Eiii(ptr noundef nonnull align 8 dereferenceable(52) %3, i32 noundef 0, i32 noundef -1, i32 noundef 0)
  %4 = invoke noundef i32 @_ZNK6R3Mesh6NEdgesEv(ptr noundef nonnull align 8 dereferenceable(272) %0)
          to label %5 unwind label %17

5:                                                ; preds = %2
  %6 = zext nneg i32 %4 to i64
  %7 = icmp slt i32 %4, 0
  %8 = shl nuw nsw i64 %6, 3
  %9 = select i1 %7, i64 -1, i64 %8
  %10 = invoke noalias noundef nonnull ptr @_Znam(i64 noundef %9) #8
          to label %.preheader91 unwind label %17

.preheader91:                                     ; preds = %5, %32
  %indvars.iv = phi i64 [ %indvars.iv.next, %32 ], [ 0, %5 ]
  %11 = invoke noundef i32 @_ZNK6R3Mesh6NEdgesEv(ptr noundef nonnull align 8 dereferenceable(272) %0)
          to label %12 unwind label %19

12:                                               ; preds = %.preheader91
  %13 = sext i32 %11 to i64
  %14 = icmp slt i64 %indvars.iv, %13
  br i1 %14, label %21, label %.preheader90

.preheader90:                                     ; preds = %12
  %15 = call noundef i32 @_ZNK6RNHeapIPdE7IsEmptyEv(ptr noundef nonnull align 8 dereferenceable(52) %3)
  %.not94 = icmp eq i32 %15, 0
  br i1 %.not94, label %.lr.ph, label %.thread

.lr.ph:                                           ; preds = %.preheader90
  %16 = ptrtoint ptr %10 to i64
  br label %33

17:                                               ; preds = %5, %2
  %18 = landingpad { ptr, i32 }
          cleanup
  br label %136

19:                                               ; preds = %.preheader91
  %20 = landingpad { ptr, i32 }
          cleanup
  br label %136

21:                                               ; preds = %12
  %22 = trunc nuw nsw i64 %indvars.iv to i32
  %23 = invoke noundef ptr @_ZNK6R3Mesh4EdgeEi(ptr noundef nonnull align 8 dereferenceable(272) %0, i32 noundef %22)
          to label %24 unwind label %29

24:                                               ; preds = %21
  %25 = invoke noundef double @_ZL19R3MeshEdgeSwapValueP6R3MeshP10R3MeshEdge(ptr noundef nonnull %0, ptr noundef %23)
          to label %26 unwind label %29

26:                                               ; preds = %24
  %27 = getelementptr inbounds double, ptr %10, i64 %indvars.iv
  store double %25, ptr %27, align 8, !tbaa !5
  %28 = fcmp olt double %25, %1
  br i1 %28, label %32, label %31

29:                                               ; preds = %31, %24, %21
  %30 = landingpad { ptr, i32 }
          cleanup
  br label %136

31:                                               ; preds = %26
  invoke void @_ZN6RNHeapIPdE4PushES0_(ptr noundef nonnull align 8 dereferenceable(52) %3, ptr noundef nonnull %27)
          to label %32 unwind label %29

32:                                               ; preds = %31, %26
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  br label %.preheader91, !llvm.loop !9

33:                                               ; preds = %.lr.ph, %.loopexit
  %34 = invoke noundef ptr @_ZN6RNHeapIPdE3PopEv(ptr noundef nonnull align 8 dereferenceable(52) %3)
          to label %35 unwind label %44

35:                                               ; preds = %33
  %36 = ptrtoint ptr %34 to i64
  %37 = sub i64 %36, %16
  %38 = lshr exact i64 %37, 3
  %39 = trunc i64 %38 to i32
  %40 = invoke noundef ptr @_ZNK6R3Mesh4EdgeEi(ptr noundef nonnull align 8 dereferenceable(272) %0, i32 noundef %39)
          to label %41 unwind label %46

41:                                               ; preds = %35
  %42 = load double, ptr %34, align 8, !tbaa !5
  %43 = fcmp olt double %42, %1
  br i1 %43, label %.thread, label %48

44:                                               ; preds = %33
  %45 = landingpad { ptr, i32 }
          cleanup
  br label %136

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

48:                                               ; preds = %41
  %49 = invoke noundef double @_ZL19R3MeshEdgeSwapValueP6R3MeshP10R3MeshEdge(ptr noundef nonnull %0, ptr noundef %40)
          to label %50 unwind label %58

50:                                               ; preds = %48
  %sext = shl i64 %37, 29
  %51 = ashr i64 %sext, 32
  %52 = getelementptr inbounds double, ptr %10, i64 %51
  %53 = load double, ptr %52, align 8, !tbaa !5
  %54 = fcmp une double %49, %53
  br i1 %54, label %55, label %60

55:                                               ; preds = %50
  store double %49, ptr %52, align 8, !tbaa !5
  %56 = fcmp ult double %49, %1
  br i1 %56, label %.loopexit, label %57, !llvm.loop !11

57:                                               ; preds = %55
  invoke void @_ZN6RNHeapIPdE4PushES0_(ptr noundef nonnull align 8 dereferenceable(52) %3, ptr noundef nonnull %52)
          to label %.loopexit unwind label %58, !llvm.loop !11

58:                                               ; preds = %60, %57, %48
  %59 = landingpad { ptr, i32 }
          cleanup
  br label %136

60:                                               ; preds = %50
  %61 = load ptr, ptr %0, align 8, !tbaa !12
  %62 = getelementptr inbounds i8, ptr %61, i64 208
  %63 = load ptr, ptr %62, align 8
  %64 = invoke noundef i32 %63(ptr noundef nonnull align 8 dereferenceable(272) %0, ptr noundef %40)
          to label %65 unwind label %58

65:                                               ; preds = %60
  %.not79 = icmp eq i32 %64, 0
  br i1 %.not79, label %.loopexit, label %.preheader, !llvm.loop !11

.preheader:                                       ; preds = %65
  %66 = fneg double %49
  store double %66, ptr %52, align 8, !tbaa !5
  %67 = call noundef ptr @_ZNK6R3Mesh10FaceOnEdgeEPK10R3MeshEdgei(ptr noundef nonnull align 8 dereferenceable(272) %0, ptr noundef %40, i32 noundef 0)
  %.not80 = icmp eq ptr %67, null
  br i1 %.not80, label %85, label %68

68:                                               ; preds = %.preheader
  %69 = call noundef ptr @_ZNK6R3Mesh10EdgeOnFaceEPK10R3MeshFacePK10R3MeshEdgei(ptr noundef nonnull align 8 dereferenceable(272) %0, ptr noundef nonnull %67, ptr noundef %40, i32 noundef 0)
  %70 = call noundef i32 @_ZNK6R3Mesh6EdgeIDEPK10R3MeshEdge(ptr noundef nonnull align 8 dereferenceable(272) %0, ptr noundef %69)
  %71 = sext i32 %70 to i64
  %72 = getelementptr inbounds double, ptr %10, i64 %71
  %73 = load double, ptr %72, align 8, !tbaa !5
  %74 = invoke noundef double @_ZL19R3MeshEdgeSwapValueP6R3MeshP10R3MeshEdge(ptr noundef nonnull %0, ptr noundef %69)
          to label %75 unwind label %80

75:                                               ; preds = %68
  store double %74, ptr %72, align 8, !tbaa !5
  %76 = fcmp ult double %73, %1
  %77 = fcmp ult double %74, %1
  br i1 %76, label %83, label %78

78:                                               ; preds = %75
  br i1 %77, label %82, label %79

79:                                               ; preds = %78
  invoke void @_ZN6RNHeapIPdE6UpdateES0_(ptr noundef nonnull align 8 dereferenceable(52) %3, ptr noundef nonnull %72)
          to label %85 unwind label %80

80:                                               ; preds = %134, %132, %131, %120, %117, %115, %114, %103, %101, %99, %98, %87, %84, %82, %79, %68
  %81 = landingpad { ptr, i32 }
          cleanup
  br label %136

82:                                               ; preds = %78
  invoke void @_ZN6RNHeapIPdE6RemoveES0_(ptr noundef nonnull align 8 dereferenceable(52) %3, ptr noundef nonnull %72)
          to label %85 unwind label %80

83:                                               ; preds = %75
  br i1 %77, label %85, label %84

84:                                               ; preds = %83
  invoke void @_ZN6RNHeapIPdE4PushES0_(ptr noundef nonnull align 8 dereferenceable(52) %3, ptr noundef nonnull %72)
          to label %85 unwind label %80

85:                                               ; preds = %82, %79, %84, %83, %.preheader
  %86 = call noundef ptr @_ZNK6R3Mesh10FaceOnEdgeEPK10R3MeshEdgei(ptr noundef nonnull align 8 dereferenceable(272) %0, ptr noundef %40, i32 noundef 0)
  %.not80.1 = icmp eq ptr %86, null
  br i1 %.not80.1, label %.preheader.1, label %87

87:                                               ; preds = %85
  %88 = call noundef ptr @_ZNK6R3Mesh10EdgeOnFaceEPK10R3MeshFacePK10R3MeshEdgei(ptr noundef nonnull align 8 dereferenceable(272) %0, ptr noundef nonnull %86, ptr noundef %40, i32 noundef 1)
  %89 = call noundef i32 @_ZNK6R3Mesh6EdgeIDEPK10R3MeshEdge(ptr noundef nonnull align 8 dereferenceable(272) %0, ptr noundef %88)
  %90 = sext i32 %89 to i64
  %91 = getelementptr inbounds double, ptr %10, i64 %90
  %92 = load double, ptr %91, align 8, !tbaa !5
  %93 = invoke noundef double @_ZL19R3MeshEdgeSwapValueP6R3MeshP10R3MeshEdge(ptr noundef nonnull %0, ptr noundef %88)
          to label %94 unwind label %80

94:                                               ; preds = %87
  store double %93, ptr %91, align 8, !tbaa !5
  %95 = fcmp ult double %92, %1
  %96 = fcmp ult double %93, %1
  br i1 %95, label %100, label %97

97:                                               ; preds = %94
  br i1 %96, label %99, label %98

98:                                               ; preds = %97
  invoke void @_ZN6RNHeapIPdE6UpdateES0_(ptr noundef nonnull align 8 dereferenceable(52) %3, ptr noundef nonnull %91)
          to label %.preheader.1 unwind label %80

99:                                               ; preds = %97
  invoke void @_ZN6RNHeapIPdE6RemoveES0_(ptr noundef nonnull align 8 dereferenceable(52) %3, ptr noundef nonnull %91)
          to label %.preheader.1 unwind label %80

100:                                              ; preds = %94
  br i1 %96, label %.preheader.1, label %101

101:                                              ; preds = %100
  invoke void @_ZN6RNHeapIPdE4PushES0_(ptr noundef nonnull align 8 dereferenceable(52) %3, ptr noundef nonnull %91)
          to label %.preheader.1 unwind label %80

.preheader.1:                                     ; preds = %101, %100, %99, %98, %85
  %102 = call noundef ptr @_ZNK6R3Mesh10FaceOnEdgeEPK10R3MeshEdgei(ptr noundef nonnull align 8 dereferenceable(272) %0, ptr noundef %40, i32 noundef 1)
  %.not80.197 = icmp eq ptr %102, null
  br i1 %.not80.197, label %118, label %103

103:                                              ; preds = %.preheader.1
  %104 = call noundef ptr @_ZNK6R3Mesh10EdgeOnFaceEPK10R3MeshFacePK10R3MeshEdgei(ptr noundef nonnull align 8 dereferenceable(272) %0, ptr noundef nonnull %102, ptr noundef %40, i32 noundef 0)
  %105 = call noundef i32 @_ZNK6R3Mesh6EdgeIDEPK10R3MeshEdge(ptr noundef nonnull align 8 dereferenceable(272) %0, ptr noundef %104)
  %106 = sext i32 %105 to i64
  %107 = getelementptr inbounds double, ptr %10, i64 %106
  %108 = load double, ptr %107, align 8, !tbaa !5
  %109 = invoke noundef double @_ZL19R3MeshEdgeSwapValueP6R3MeshP10R3MeshEdge(ptr noundef nonnull %0, ptr noundef %104)
          to label %110 unwind label %80

110:                                              ; preds = %103
  store double %109, ptr %107, align 8, !tbaa !5
  %111 = fcmp ult double %108, %1
  %112 = fcmp ult double %109, %1
  br i1 %111, label %116, label %113

113:                                              ; preds = %110
  br i1 %112, label %115, label %114

114:                                              ; preds = %113
  invoke void @_ZN6RNHeapIPdE6UpdateES0_(ptr noundef nonnull align 8 dereferenceable(52) %3, ptr noundef nonnull %107)
          to label %118 unwind label %80

115:                                              ; preds = %113
  invoke void @_ZN6RNHeapIPdE6RemoveES0_(ptr noundef nonnull align 8 dereferenceable(52) %3, ptr noundef nonnull %107)
          to label %118 unwind label %80

116:                                              ; preds = %110
  br i1 %112, label %118, label %117

117:                                              ; preds = %116
  invoke void @_ZN6RNHeapIPdE4PushES0_(ptr noundef nonnull align 8 dereferenceable(52) %3, ptr noundef nonnull %107)
          to label %118 unwind label %80

118:                                              ; preds = %117, %116, %115, %114, %.preheader.1
  %119 = call noundef ptr @_ZNK6R3Mesh10FaceOnEdgeEPK10R3MeshEdgei(ptr noundef nonnull align 8 dereferenceable(272) %0, ptr noundef %40, i32 noundef 1)
  %.not80.1.1 = icmp eq ptr %119, null
  br i1 %.not80.1.1, label %.loopexit, label %120

120:                                              ; preds = %118
  %121 = call noundef ptr @_ZNK6R3Mesh10EdgeOnFaceEPK10R3MeshFacePK10R3MeshEdgei(ptr noundef nonnull align 8 dereferenceable(272) %0, ptr noundef nonnull %119, ptr noundef %40, i32 noundef 1)
  %122 = call noundef i32 @_ZNK6R3Mesh6EdgeIDEPK10R3MeshEdge(ptr noundef nonnull align 8 dereferenceable(272) %0, ptr noundef %121)
  %123 = sext i32 %122 to i64
  %124 = getelementptr inbounds double, ptr %10, i64 %123
  %125 = load double, ptr %124, align 8, !tbaa !5
  %126 = invoke noundef double @_ZL19R3MeshEdgeSwapValueP6R3MeshP10R3MeshEdge(ptr noundef nonnull %0, ptr noundef %121)
          to label %127 unwind label %80

127:                                              ; preds = %120
  store double %126, ptr %124, align 8, !tbaa !5
  %128 = fcmp ult double %125, %1
  %129 = fcmp ult double %126, %1
  br i1 %128, label %133, label %130

130:                                              ; preds = %127
  br i1 %129, label %132, label %131

131:                                              ; preds = %130
  invoke void @_ZN6RNHeapIPdE6UpdateES0_(ptr noundef nonnull align 8 dereferenceable(52) %3, ptr noundef nonnull %124)
          to label %.loopexit unwind label %80

132:                                              ; preds = %130
  invoke void @_ZN6RNHeapIPdE6RemoveES0_(ptr noundef nonnull align 8 dereferenceable(52) %3, ptr noundef nonnull %124)
          to label %.loopexit unwind label %80

133:                                              ; preds = %127
  br i1 %129, label %.loopexit, label %134

134:                                              ; preds = %133
  invoke void @_ZN6RNHeapIPdE4PushES0_(ptr noundef nonnull align 8 dereferenceable(52) %3, ptr noundef nonnull %124)
          to label %.loopexit unwind label %80

.loopexit:                                        ; preds = %118, %131, %132, %133, %134, %57, %55, %65
  %135 = call noundef i32 @_ZNK6RNHeapIPdE7IsEmptyEv(ptr noundef nonnull align 8 dereferenceable(52) %3)
  %.not = icmp eq i32 %135, 0
  br i1 %.not, label %33, label %.thread

.thread:                                          ; preds = %.loopexit, %41, %.preheader90
  call void @_ZdaPv(ptr noundef nonnull %10) #9
  call void @_ZN6RNHeapIPdED2Ev(ptr noundef nonnull align 8 dereferenceable(52) %3) #7
  call void @llvm.lifetime.end.p0(i64 56, ptr nonnull %3) #7
  ret void

136:                                              ; preds = %44, %58, %80, %46, %19, %29, %17
  %.pn84.pn = phi { ptr, i32 } [ %18, %17 ], [ %30, %29 ], [ %20, %19 ], [ %45, %44 ], [ %47, %46 ], [ %59, %58 ], [ %81, %80 ]
  call void @_ZN6RNHeapIPdED2Ev(ptr noundef nonnull align 8 dereferenceable(52) %3) #7
  call void @llvm.lifetime.end.p0(i64 56, ptr nonnull %3) #7
  resume { ptr, i32 } %.pn84.pn
}

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

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

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN6RNHeapIPdE4PushES0_(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 @_ZNK6RNHeapIPdE7IsEmptyEv(ptr noundef nonnull align 8 dereferenceable(52)) local_unnamed_addr #6 align 2

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

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

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

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

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

attributes #0 = { nobuiltin allocsize(0) "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #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 = { nobuiltin nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #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 = { 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 #7 = { nounwind }
attributes #8 = { builtin allocsize(0) }
attributes #9 = { builtin nounwind }

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

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


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