; LLVM IR from bldeng/AASolver :: AndersonOpt/external/OpenMesh/Core/Mesh (PolyConnectivity)

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

%"struct.OpenMesh::VertexHandle" = type { %"class.OpenMesh::BaseHandle" }
%"class.OpenMesh::BaseHandle" = type { i32 }
%"class.OpenMesh::Iterators::GenericCirculatorT_DEPRECATED.48" = type { %"class.OpenMesh::Iterators::GenericCirculatorBaseT.base", %"struct.OpenMesh::VertexHandle" }
%"class.OpenMesh::Iterators::GenericCirculatorBaseT.base" = type <{ ptr, %"struct.OpenMesh::HalfedgeHandle", %"struct.OpenMesh::HalfedgeHandle", i32 }>
%"struct.OpenMesh::HalfedgeHandle" = type { %"class.OpenMesh::BaseHandle" }

; 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 nounwind willreturn memory(argmem: readwrite)
declare void @llvm.memcpy.p0.p0.i64(ptr noalias nocapture writeonly, ptr noalias nocapture readonly, i64, i1 immarg) #1

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

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

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

; Function Attrs: mustprogress uwtable
define dso_local noundef i32 @_ZNK8OpenMesh16PolyConnectivity7valenceENS_12VertexHandleE(ptr noundef nonnull align 8 dereferenceable(416) %0, i32 %1) #2 align 2 {
  %3 = alloca %"struct.OpenMesh::VertexHandle", align 4
  %4 = alloca ptr, align 8
  %5 = alloca i32, align 4
  %6 = alloca %"class.OpenMesh::Iterators::GenericCirculatorT_DEPRECATED.48", align 8
  %7 = alloca %"struct.OpenMesh::VertexHandle", align 4
  %8 = getelementptr inbounds %"struct.OpenMesh::VertexHandle", ptr %3, i32 0, i32 0
  %9 = getelementptr inbounds %"class.OpenMesh::BaseHandle", ptr %8, i32 0, i32 0
  store i32 %1, ptr %9, align 4
  store ptr %0, ptr %4, align 8, !tbaa !5
  %10 = load ptr, ptr %4, align 8
  call void @llvm.lifetime.start.p0(i64 4, ptr %5) #3
  store i32 0, ptr %5, align 4, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 24, ptr %6) #3
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %7, ptr align 4 %3, i64 4, i1 false)
  %11 = getelementptr inbounds %"struct.OpenMesh::VertexHandle", ptr %7, i32 0, i32 0
  %12 = getelementptr inbounds %"class.OpenMesh::BaseHandle", ptr %11, i32 0, i32 0
  %13 = load i32, ptr %12, align 4
  call void @_ZNK8OpenMesh16PolyConnectivity8cvv_iterENS_12VertexHandleE(ptr dead_on_unwind writable sret(%"class.OpenMesh::Iterators::GenericCirculatorT_DEPRECATED.48") align 8 %6, ptr noundef nonnull align 8 dereferenceable(416) %10, i32 %13)
  br label %14

14:                                               ; preds = %20, %2
  %15 = call noundef zeroext i1 @_ZNK8OpenMesh9Iterators29GenericCirculatorT_DEPRECATEDINS_16PolyConnectivityENS_12VertexHandleES3_XadL_ZNKS0_22GenericCirculatorBaseTIS2_E14toVertexHandleEvEEE8is_validEv(ptr noundef nonnull align 8 dereferenceable(24) %6)
  br i1 %15, label %17, label %16

16:                                               ; preds = %14
  call void @llvm.lifetime.end.p0(i64 24, ptr %6) #3
  br label %22

17:                                               ; preds = %14
  %18 = load i32, ptr %5, align 4, !tbaa !9
  %19 = add i32 %18, 1
  store i32 %19, ptr %5, align 4, !tbaa !9
  br label %20

20:                                               ; preds = %17
  %21 = call noundef nonnull align 8 dereferenceable(24) ptr @_ZN8OpenMesh9Iterators29GenericCirculatorT_DEPRECATEDINS_16PolyConnectivityENS_12VertexHandleES3_XadL_ZNKS0_22GenericCirculatorBaseTIS2_E14toVertexHandleEvEEEppEv(ptr noundef nonnull align 8 dereferenceable(24) %6)
  br label %14, !llvm.loop !11

22:                                               ; preds = %16
  %23 = load i32, ptr %5, align 4, !tbaa !9
  call void @llvm.lifetime.end.p0(i64 4, ptr %5) #3
  ret i32 %23
}

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZNK8OpenMesh16PolyConnectivity8cvv_iterENS_12VertexHandleE(ptr dead_on_unwind noalias writable sret(%"class.OpenMesh::Iterators::GenericCirculatorT_DEPRECATED.48") align 8, ptr noundef nonnull align 8 dereferenceable(416), i32) #2 align 2

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { nocallback nofree nounwind willreturn memory(argmem: readwrite) }
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 = { 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 = !{!"int", !7, i64 0}
!11 = distinct !{!11, !12}
!12 = !{!"llvm.loop.mustprogress"}


; 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.OpenMesh::Iterators::GenericCirculatorT_DEPRECATED.48" = type { %"class.OpenMesh::Iterators::GenericCirculatorBaseT.base", %"struct.OpenMesh::VertexHandle" }
%"class.OpenMesh::Iterators::GenericCirculatorBaseT.base" = type <{ ptr, %"struct.OpenMesh::HalfedgeHandle", %"struct.OpenMesh::HalfedgeHandle", i32 }>
%"struct.OpenMesh::HalfedgeHandle" = type { %"class.OpenMesh::BaseHandle" }
%"class.OpenMesh::BaseHandle" = type { i32 }
%"struct.OpenMesh::VertexHandle" = type { %"class.OpenMesh::BaseHandle" }

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

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

; Function Attrs: mustprogress uwtable
declare dso_local noundef zeroext i1 @_ZNK8OpenMesh9Iterators29GenericCirculatorT_DEPRECATEDINS_16PolyConnectivityENS_12VertexHandleES3_XadL_ZNKS0_22GenericCirculatorBaseTIS2_E14toVertexHandleEvEEE8is_validEv(ptr noundef nonnull align 8 dereferenceable(24)) local_unnamed_addr #1 align 2

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

; Function Attrs: mustprogress uwtable
define dso_local noundef i32 @_ZNK8OpenMesh16PolyConnectivity7valenceENS_12VertexHandleE(ptr noundef nonnull align 8 dereferenceable(416) %0, i32 %1) local_unnamed_addr #1 align 2 {
  %3 = alloca %"class.OpenMesh::Iterators::GenericCirculatorT_DEPRECATED.48", align 8
  call void @llvm.lifetime.start.p0(i64 24, ptr nonnull %3) #2
  call void @_ZNK8OpenMesh16PolyConnectivity8cvv_iterENS_12VertexHandleE(ptr dead_on_unwind nonnull writable sret(%"class.OpenMesh::Iterators::GenericCirculatorT_DEPRECATED.48") align 8 %3, ptr noundef nonnull align 8 dereferenceable(416) %0, i32 %1)
  %4 = call noundef zeroext i1 @_ZNK8OpenMesh9Iterators29GenericCirculatorT_DEPRECATEDINS_16PolyConnectivityENS_12VertexHandleES3_XadL_ZNKS0_22GenericCirculatorBaseTIS2_E14toVertexHandleEvEEE8is_validEv(ptr noundef nonnull align 8 dereferenceable(24) %3)
  br i1 %4, label %.lr.ph, label %._crit_edge

._crit_edge:                                      ; preds = %.lr.ph, %2
  %.0.lcssa = phi i32 [ 0, %2 ], [ %5, %.lr.ph ]
  call void @llvm.lifetime.end.p0(i64 24, ptr nonnull %3) #2
  ret i32 %.0.lcssa

.lr.ph:                                           ; preds = %2, %.lr.ph
  %.03 = phi i32 [ %5, %.lr.ph ], [ 0, %2 ]
  %5 = add i32 %.03, 1
  %6 = call noundef nonnull align 8 dereferenceable(24) ptr @_ZN8OpenMesh9Iterators29GenericCirculatorT_DEPRECATEDINS_16PolyConnectivityENS_12VertexHandleES3_XadL_ZNKS0_22GenericCirculatorBaseTIS2_E14toVertexHandleEvEEEppEv(ptr noundef nonnull align 8 dereferenceable(24) %3)
  %7 = call noundef zeroext i1 @_ZNK8OpenMesh9Iterators29GenericCirculatorT_DEPRECATEDINS_16PolyConnectivityENS_12VertexHandleES3_XadL_ZNKS0_22GenericCirculatorBaseTIS2_E14toVertexHandleEvEEE8is_validEv(ptr noundef nonnull align 8 dereferenceable(24) %3)
  br i1 %7, label %.lr.ph, label %._crit_edge, !llvm.loop !5
}

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZNK8OpenMesh16PolyConnectivity8cvv_iterENS_12VertexHandleE(ptr dead_on_unwind noalias writable sret(%"class.OpenMesh::Iterators::GenericCirculatorT_DEPRECATED.48") align 8, ptr noundef nonnull align 8 dereferenceable(416), i32) local_unnamed_addr #1 align 2

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


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