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

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

declare i32 @__gxx_personality_v0(...)

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

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

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

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

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

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

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

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

; 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 #3 align 2

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

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

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

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

; Function Attrs: mustprogress uwtable
define dso_local void @_ZN6R3Mesh18SubdivideLongEdgesEd(ptr noundef nonnull align 8 dereferenceable(272) %0, double noundef %1) #2 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 i32, align 4
  %14 = alloca ptr, align 8
  %15 = alloca double, align 8
  store ptr %0, ptr %3, align 8, !tbaa !5
  store double %1, ptr %4, align 8, !tbaa !9
  %16 = load ptr, ptr %3, align 8
  call void @llvm.lifetime.start.p0(i64 56, ptr %5) #4
  call void @_ZN6RNHeapIP10R3MeshEdgeEC2EPFdS1_PvEPFPPS1_S1_S3_ES3_i(ptr noundef nonnull align 8 dereferenceable(52) %5, ptr noundef @_ZL18EdgeLengthCallbackP10R3MeshEdgePv, ptr noundef null, ptr noundef %16, i32 noundef 0)
  call void @llvm.lifetime.start.p0(i64 4, ptr %6) #4
  store i32 0, ptr %6, align 4, !tbaa !11
  br label %17

17:                                               ; preds = %49, %2
  %18 = load i32, ptr %6, align 4, !tbaa !11
  %19 = invoke noundef i32 @_ZNK6R3Mesh6NEdgesEv(ptr noundef nonnull align 8 dereferenceable(272) %16)
          to label %20 unwind label %23

20:                                               ; preds = %17
  %21 = icmp slt i32 %18, %19
  br i1 %21, label %27, label %22

22:                                               ; preds = %20
  call void @llvm.lifetime.end.p0(i64 4, ptr %6) #4
  br label %54

23:                                               ; preds = %17
  %24 = landingpad { ptr, i32 }
          cleanup
  %25 = extractvalue { ptr, i32 } %24, 0
  store ptr %25, ptr %7, align 8
  %26 = extractvalue { ptr, i32 } %24, 1
  store i32 %26, ptr %8, align 4
  br label %53

27:                                               ; preds = %20
  call void @llvm.lifetime.start.p0(i64 8, ptr %9) #4
  %28 = load i32, ptr %6, align 4, !tbaa !11
  %29 = invoke noundef ptr @_ZNK6R3Mesh4EdgeEi(ptr noundef nonnull align 8 dereferenceable(272) %16, i32 noundef %28)
          to label %30 unwind label %40

30:                                               ; preds = %27
  store ptr %29, ptr %9, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %10) #4
  %31 = load ptr, ptr %9, align 8, !tbaa !5
  %32 = invoke noundef double @_ZNK6R3Mesh10EdgeLengthEPK10R3MeshEdge(ptr noundef nonnull align 8 dereferenceable(272) %16, ptr noundef %31)
          to label %33 unwind label %44

33:                                               ; preds = %30
  store double %32, ptr %10, align 8, !tbaa !9
  %34 = load double, ptr %10, align 8, !tbaa !9
  %35 = load double, ptr %4, align 8, !tbaa !9
  %36 = fcmp ogt double %34, %35
  br i1 %36, label %37, label %48

37:                                               ; preds = %33
  %38 = load ptr, ptr %9, align 8, !tbaa !5
  invoke void @_ZN6RNHeapIP10R3MeshEdgeE4PushES1_(ptr noundef nonnull align 8 dereferenceable(52) %5, ptr noundef %38)
          to label %39 unwind label %44

39:                                               ; preds = %37
  br label %48

40:                                               ; preds = %27
  %41 = landingpad { ptr, i32 }
          cleanup
  %42 = extractvalue { ptr, i32 } %41, 0
  store ptr %42, ptr %7, align 8
  %43 = extractvalue { ptr, i32 } %41, 1
  store i32 %43, ptr %8, align 4
  br label %52

44:                                               ; preds = %37, %30
  %45 = landingpad { ptr, i32 }
          cleanup
  %46 = extractvalue { ptr, i32 } %45, 0
  store ptr %46, ptr %7, align 8
  %47 = extractvalue { ptr, i32 } %45, 1
  store i32 %47, ptr %8, align 4
  call void @llvm.lifetime.end.p0(i64 8, ptr %10) #4
  br label %52

48:                                               ; preds = %39, %33
  call void @llvm.lifetime.end.p0(i64 8, ptr %10) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %9) #4
  br label %49

49:                                               ; preds = %48
  %50 = load i32, ptr %6, align 4, !tbaa !11
  %51 = add nsw i32 %50, 1
  store i32 %51, ptr %6, align 4, !tbaa !11
  br label %17, !llvm.loop !13

52:                                               ; preds = %44, %40
  call void @llvm.lifetime.end.p0(i64 8, ptr %9) #4
  br label %53

53:                                               ; preds = %52, %23
  call void @llvm.lifetime.end.p0(i64 4, ptr %6) #4
  br label %124

54:                                               ; preds = %22
  br label %55

55:                                               ; preds = %120, %54
  %56 = invoke noundef i32 @_ZNK6RNHeapIP10R3MeshEdgeE7IsEmptyEv(ptr noundef nonnull align 8 dereferenceable(52) %5)
          to label %57 unwind label %76

57:                                               ; preds = %55
  %58 = icmp ne i32 %56, 0
  %59 = xor i1 %58, true
  br i1 %59, label %60, label %123

60:                                               ; preds = %57
  call void @llvm.lifetime.start.p0(i64 8, ptr %11) #4
  %61 = invoke noundef ptr @_ZN6RNHeapIP10R3MeshEdgeE3PopEv(ptr noundef nonnull align 8 dereferenceable(52) %5)
          to label %62 unwind label %80

62:                                               ; preds = %60
  store ptr %61, ptr %11, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %12) #4
  %63 = load ptr, ptr %11, align 8, !tbaa !5
  %64 = load ptr, ptr %16, align 8, !tbaa !15
  %65 = getelementptr inbounds ptr, ptr %64, i64 25
  %66 = load ptr, ptr %65, align 8
  %67 = invoke noundef ptr %66(ptr noundef nonnull align 8 dereferenceable(272) %16, ptr noundef %63)
          to label %68 unwind label %84

68:                                               ; preds = %62
  store ptr %67, ptr %12, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %13) #4
  store i32 0, ptr %13, align 4, !tbaa !11
  br label %69

69:                                               ; preds = %115, %68
  %70 = load i32, ptr %13, align 4, !tbaa !11
  %71 = load ptr, ptr %12, align 8, !tbaa !5
  %72 = invoke noundef i32 @_ZNK6R3Mesh13VertexValenceEPK12R3MeshVertex(ptr noundef nonnull align 8 dereferenceable(272) %16, ptr noundef %71)
          to label %73 unwind label %88

73:                                               ; preds = %69
  %74 = icmp slt i32 %70, %72
  br i1 %74, label %92, label %75

75:                                               ; preds = %73
  call void @llvm.lifetime.end.p0(i64 4, ptr %13) #4
  br label %120

76:                                               ; preds = %55
  %77 = landingpad { ptr, i32 }
          cleanup
  %78 = extractvalue { ptr, i32 } %77, 0
  store ptr %78, ptr %7, align 8
  %79 = extractvalue { ptr, i32 } %77, 1
  store i32 %79, ptr %8, align 4
  br label %124

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

84:                                               ; preds = %62
  %85 = landingpad { ptr, i32 }
          cleanup
  %86 = extractvalue { ptr, i32 } %85, 0
  store ptr %86, ptr %7, align 8
  %87 = extractvalue { ptr, i32 } %85, 1
  store i32 %87, ptr %8, align 4
  br label %121

88:                                               ; preds = %69
  %89 = landingpad { ptr, i32 }
          cleanup
  %90 = extractvalue { ptr, i32 } %89, 0
  store ptr %90, ptr %7, align 8
  %91 = extractvalue { ptr, i32 } %89, 1
  store i32 %91, ptr %8, align 4
  br label %119

92:                                               ; preds = %73
  call void @llvm.lifetime.start.p0(i64 8, ptr %14) #4
  %93 = load ptr, ptr %12, align 8, !tbaa !5
  %94 = load i32, ptr %13, align 4, !tbaa !11
  %95 = invoke noundef ptr @_ZNK6R3Mesh12EdgeOnVertexEPK12R3MeshVertexi(ptr noundef nonnull align 8 dereferenceable(272) %16, ptr noundef %93, i32 noundef %94)
          to label %96 unwind label %106

96:                                               ; preds = %92
  store ptr %95, ptr %14, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %15) #4
  %97 = load ptr, ptr %14, align 8, !tbaa !5
  %98 = invoke noundef double @_ZNK6R3Mesh10EdgeLengthEPK10R3MeshEdge(ptr noundef nonnull align 8 dereferenceable(272) %16, ptr noundef %97)
          to label %99 unwind label %110

99:                                               ; preds = %96
  store double %98, ptr %15, align 8, !tbaa !9
  %100 = load double, ptr %15, align 8, !tbaa !9
  %101 = load double, ptr %4, align 8, !tbaa !9
  %102 = fcmp ogt double %100, %101
  br i1 %102, label %103, label %114

103:                                              ; preds = %99
  %104 = load ptr, ptr %14, align 8, !tbaa !5
  invoke void @_ZN6RNHeapIP10R3MeshEdgeE4PushES1_(ptr noundef nonnull align 8 dereferenceable(52) %5, ptr noundef %104)
          to label %105 unwind label %110

105:                                              ; preds = %103
  br label %114

106:                                              ; preds = %92
  %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 %118

110:                                              ; preds = %103, %96
  %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
  call void @llvm.lifetime.end.p0(i64 8, ptr %15) #4
  br label %118

114:                                              ; preds = %105, %99
  call void @llvm.lifetime.end.p0(i64 8, ptr %15) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %14) #4
  br label %115

115:                                              ; preds = %114
  %116 = load i32, ptr %13, align 4, !tbaa !11
  %117 = add nsw i32 %116, 1
  store i32 %117, ptr %13, align 4, !tbaa !11
  br label %69, !llvm.loop !17

118:                                              ; preds = %110, %106
  call void @llvm.lifetime.end.p0(i64 8, ptr %14) #4
  br label %119

119:                                              ; preds = %118, %88
  call void @llvm.lifetime.end.p0(i64 4, ptr %13) #4
  br label %121

120:                                              ; preds = %75
  call void @llvm.lifetime.end.p0(i64 8, ptr %12) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %11) #4
  br label %55, !llvm.loop !18

121:                                              ; preds = %119, %84
  call void @llvm.lifetime.end.p0(i64 8, ptr %12) #4
  br label %122

122:                                              ; preds = %121, %80
  call void @llvm.lifetime.end.p0(i64 8, ptr %11) #4
  br label %124

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

124:                                              ; preds = %122, %76, %53
  call void @_ZN6RNHeapIP10R3MeshEdgeED2Ev(ptr noundef nonnull align 8 dereferenceable(52) %5) #4
  call void @llvm.lifetime.end.p0(i64 56, ptr %5) #4
  br label %125

125:                                              ; preds = %124
  %126 = load ptr, ptr %7, align 8
  %127 = load i32, ptr %8, align 4
  %128 = insertvalue { ptr, i32 } poison, ptr %126, 0
  %129 = insertvalue { ptr, i32 } %128, i32 %127, 1
  resume { ptr, i32 } %129
}

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

declare i32 @__gxx_personality_v0(...)

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

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

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

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

; 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 #3 align 2

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

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

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

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

; Function Attrs: mustprogress uwtable
define dso_local void @_ZN6R3Mesh18SubdivideLongEdgesEd(ptr noundef nonnull align 8 dereferenceable(272) %0, double noundef %1) local_unnamed_addr #2 align 2 personality ptr @__gxx_personality_v0 {
  %3 = alloca %class.RNHeap, align 8
  call void @llvm.lifetime.start.p0(i64 56, ptr nonnull %3) #4
  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 0)
  br label %4

4:                                                ; preds = %22, %2
  %.0 = phi i32 [ 0, %2 ], [ %23, %22 ]
  %5 = invoke noundef i32 @_ZNK6R3Mesh6NEdgesEv(ptr noundef nonnull align 8 dereferenceable(272) %0)
          to label %6 unwind label %9

6:                                                ; preds = %4
  %7 = icmp slt i32 %.0, %5
  br i1 %7, label %11, label %.preheader36

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

9:                                                ; preds = %4
  %10 = landingpad { ptr, i32 }
          cleanup
  br label %53

11:                                               ; preds = %6
  %12 = invoke noundef ptr @_ZNK6R3Mesh4EdgeEi(ptr noundef nonnull align 8 dereferenceable(272) %0, i32 noundef %.0)
          to label %13 unwind label %18

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

15:                                               ; preds = %13
  %16 = fcmp ogt double %14, %1
  br i1 %16, label %17, label %22

17:                                               ; preds = %15
  invoke void @_ZN6RNHeapIP10R3MeshEdgeE4PushES1_(ptr noundef nonnull align 8 dereferenceable(52) %3, ptr noundef %12)
          to label %22 unwind label %20

18:                                               ; preds = %11
  %19 = landingpad { ptr, i32 }
          cleanup
  br label %53

20:                                               ; preds = %17, %13
  %21 = landingpad { ptr, i32 }
          cleanup
  br label %53

22:                                               ; preds = %17, %15
  %23 = add nuw nsw i32 %.0, 1
  br label %4, !llvm.loop !5

.loopexit:                                        ; preds = %32
  %24 = call noundef i32 @_ZNK6RNHeapIP10R3MeshEdgeE7IsEmptyEv(ptr noundef nonnull align 8 dereferenceable(52) %3)
  %.not = icmp eq i32 %24, 0
  br i1 %.not, label %.lr.ph, label %._crit_edge, !llvm.loop !7

.lr.ph:                                           ; preds = %.preheader36, %.loopexit
  %25 = invoke noundef ptr @_ZN6RNHeapIP10R3MeshEdgeE3PopEv(ptr noundef nonnull align 8 dereferenceable(52) %3)
          to label %26 unwind label %34

26:                                               ; preds = %.lr.ph
  %27 = load ptr, ptr %0, align 8, !tbaa !8
  %28 = getelementptr inbounds i8, ptr %27, i64 200
  %29 = load ptr, ptr %28, align 8
  %30 = invoke noundef ptr %29(ptr noundef nonnull align 8 dereferenceable(272) %0, ptr noundef %25)
          to label %.preheader unwind label %36

.preheader:                                       ; preds = %26, %51
  %.020 = phi i32 [ %52, %51 ], [ 0, %26 ]
  %31 = invoke noundef i32 @_ZNK6R3Mesh13VertexValenceEPK12R3MeshVertex(ptr noundef nonnull align 8 dereferenceable(272) %0, ptr noundef %30)
          to label %32 unwind label %38

32:                                               ; preds = %.preheader
  %33 = icmp slt i32 %.020, %31
  br i1 %33, label %40, label %.loopexit

34:                                               ; preds = %.lr.ph
  %35 = landingpad { ptr, i32 }
          cleanup
  br label %53

36:                                               ; preds = %26
  %37 = landingpad { ptr, i32 }
          cleanup
  br label %53

38:                                               ; preds = %.preheader
  %39 = landingpad { ptr, i32 }
          cleanup
  br label %53

40:                                               ; preds = %32
  %41 = invoke noundef ptr @_ZNK6R3Mesh12EdgeOnVertexEPK12R3MeshVertexi(ptr noundef nonnull align 8 dereferenceable(272) %0, ptr noundef %30, i32 noundef %.020)
          to label %42 unwind label %47

42:                                               ; preds = %40
  %43 = invoke noundef double @_ZNK6R3Mesh10EdgeLengthEPK10R3MeshEdge(ptr noundef nonnull align 8 dereferenceable(272) %0, ptr noundef %41)
          to label %44 unwind label %49

44:                                               ; preds = %42
  %45 = fcmp ogt double %43, %1
  br i1 %45, label %46, label %51

46:                                               ; preds = %44
  invoke void @_ZN6RNHeapIP10R3MeshEdgeE4PushES1_(ptr noundef nonnull align 8 dereferenceable(52) %3, ptr noundef %41)
          to label %51 unwind label %49

47:                                               ; preds = %40
  %48 = landingpad { ptr, i32 }
          cleanup
  br label %53

49:                                               ; preds = %46, %42
  %50 = landingpad { ptr, i32 }
          cleanup
  br label %53

51:                                               ; preds = %46, %44
  %52 = add nuw nsw i32 %.020, 1
  br label %.preheader, !llvm.loop !11

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

53:                                               ; preds = %34, %38, %49, %47, %36, %9, %20, %18
  %.pn32.pn.pn = phi { ptr, i32 } [ %10, %9 ], [ %21, %20 ], [ %19, %18 ], [ %35, %34 ], [ %37, %36 ], [ %39, %38 ], [ %50, %49 ], [ %48, %47 ]
  call void @_ZN6RNHeapIP10R3MeshEdgeED2Ev(ptr noundef nonnull align 8 dereferenceable(52) %3) #4
  call void @llvm.lifetime.end.p0(i64 56, ptr nonnull %3) #4
  resume { ptr, i32 } %.pn32.pn.pn
}

attributes #0 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { inlinehint mustprogress uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #2 = { 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 = { 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 = { 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 = distinct !{!5, !6}
!6 = !{!"llvm.loop.mustprogress"}
!7 = distinct !{!7, !6}
!8 = !{!9, !9, i64 0}
!9 = !{!"vtable pointer", !10, i64 0}
!10 = !{!"Simple C++ TBAA"}
!11 = distinct !{!11, !6}


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