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

%"class.OpenMesh::Iterators::GenericIteratorT.65" = type { ptr, %"struct.OpenMesh::FaceHandle", i32 }
%"struct.OpenMesh::FaceHandle" = type { %"class.OpenMesh::BaseHandle" }
%"class.OpenMesh::BaseHandle" = type { i32 }

; 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 { ptr, i64 } @_ZN8OpenMesh16PolyConnectivity11faces_beginEv(ptr noundef nonnull align 8 dereferenceable(416)) #2 align 2

; Function Attrs: mustprogress uwtable
declare dso_local { ptr, i64 } @_ZN8OpenMesh16PolyConnectivity9faces_endEv(ptr noundef nonnull align 8 dereferenceable(416)) #2 align 2

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

; Function Attrs: mustprogress uwtable
define dso_local void @_ZN8OpenMesh16PolyConnectivity11triangulateEv(ptr noundef nonnull align 8 dereferenceable(416) %0) #2 align 2 {
  %2 = alloca ptr, align 8
  %3 = alloca %"class.OpenMesh::Iterators::GenericIteratorT.65", align 8
  %4 = alloca %"class.OpenMesh::Iterators::GenericIteratorT.65", align 8
  %5 = alloca %"struct.OpenMesh::FaceHandle", align 4
  store ptr %0, ptr %2, align 8, !tbaa !5
  %6 = load ptr, ptr %2, align 8
  call void @llvm.lifetime.start.p0(i64 16, ptr %3) #4
  %7 = call { ptr, i64 } @_ZN8OpenMesh16PolyConnectivity11faces_beginEv(ptr noundef nonnull align 8 dereferenceable(416) %6)
  %8 = getelementptr inbounds { ptr, i64 }, ptr %3, i32 0, i32 0
  %9 = extractvalue { ptr, i64 } %7, 0
  store ptr %9, ptr %8, align 8
  %10 = getelementptr inbounds { ptr, i64 }, ptr %3, i32 0, i32 1
  %11 = extractvalue { ptr, i64 } %7, 1
  store i64 %11, ptr %10, align 8
  call void @llvm.lifetime.start.p0(i64 16, ptr %4) #4
  %12 = call { ptr, i64 } @_ZN8OpenMesh16PolyConnectivity9faces_endEv(ptr noundef nonnull align 8 dereferenceable(416) %6)
  %13 = getelementptr inbounds { ptr, i64 }, ptr %4, i32 0, i32 0
  %14 = extractvalue { ptr, i64 } %12, 0
  store ptr %14, ptr %13, align 8
  %15 = getelementptr inbounds { ptr, i64 }, ptr %4, i32 0, i32 1
  %16 = extractvalue { ptr, i64 } %12, 1
  store i64 %16, ptr %15, align 8
  br label %17

17:                                               ; preds = %24, %1
  %18 = call noundef zeroext i1 @_ZNK8OpenMesh9Iterators16GenericIteratorTINS_16PolyConnectivityENS_10FaceHandleENS_11ArrayKernelEXadL_ZNKS4_15has_face_statusEvEEXadL_ZNKS4_7n_facesEvEEEneERKS5_(ptr noundef nonnull align 8 dereferenceable(16) %3, ptr noundef nonnull align 8 dereferenceable(16) %4)
  br i1 %18, label %19, label %26

19:                                               ; preds = %17
  %20 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZNK8OpenMesh9Iterators16GenericIteratorTINS_16PolyConnectivityENS_10FaceHandleENS_11ArrayKernelEXadL_ZNKS4_15has_face_statusEvEEXadL_ZNKS4_7n_facesEvEEEdeEv(ptr noundef nonnull align 8 dereferenceable(16) %3)
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %5, ptr align 4 %20, i64 4, i1 false)
  %21 = getelementptr inbounds %"struct.OpenMesh::FaceHandle", ptr %5, i32 0, i32 0
  %22 = getelementptr inbounds %"class.OpenMesh::BaseHandle", ptr %21, i32 0, i32 0
  %23 = load i32, ptr %22, align 4
  call void @_ZN8OpenMesh16PolyConnectivity11triangulateENS_10FaceHandleE(ptr noundef nonnull align 8 dereferenceable(416) %6, i32 %23)
  br label %24

24:                                               ; preds = %19
  %25 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZN8OpenMesh9Iterators16GenericIteratorTINS_16PolyConnectivityENS_10FaceHandleENS_11ArrayKernelEXadL_ZNKS4_15has_face_statusEvEEXadL_ZNKS4_7n_facesEvEEEppEv(ptr noundef nonnull align 8 dereferenceable(16) %3)
  br label %17, !llvm.loop !9

26:                                               ; preds = %17
  call void @llvm.lifetime.end.p0(i64 16, ptr %4) #4
  call void @llvm.lifetime.end.p0(i64 16, ptr %3) #4
  ret void
}

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

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

; Function Attrs: mustprogress uwtable
declare dso_local noundef nonnull align 8 dereferenceable(16) ptr @_ZN8OpenMesh9Iterators16GenericIteratorTINS_16PolyConnectivityENS_10FaceHandleENS_11ArrayKernelEXadL_ZNKS4_15has_face_statusEvEEXadL_ZNKS4_7n_facesEvEEEppEv(ptr noundef nonnull align 8 dereferenceable(16)) #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 = { 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 = distinct !{!9, !10}
!10 = !{!"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::GenericIteratorT.65" = type { ptr, %"struct.OpenMesh::FaceHandle", i32 }
%"struct.OpenMesh::FaceHandle" = type { %"class.OpenMesh::BaseHandle" }
%"class.OpenMesh::BaseHandle" = type { i32 }

; 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 { ptr, i64 } @_ZN8OpenMesh16PolyConnectivity11faces_beginEv(ptr noundef nonnull align 8 dereferenceable(416)) local_unnamed_addr #1 align 2

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

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN8OpenMesh16PolyConnectivity11triangulateENS_10FaceHandleE(ptr noundef nonnull align 8 dereferenceable(416), i32) local_unnamed_addr #1 align 2

; Function Attrs: mustprogress uwtable
define dso_local void @_ZN8OpenMesh16PolyConnectivity11triangulateEv(ptr noundef nonnull align 8 dereferenceable(416) %0) local_unnamed_addr #1 align 2 {
  %2 = alloca %"class.OpenMesh::Iterators::GenericIteratorT.65", align 8
  %3 = alloca %"class.OpenMesh::Iterators::GenericIteratorT.65", align 8
  call void @llvm.lifetime.start.p0(i64 16, ptr nonnull %2) #3
  %4 = tail call { ptr, i64 } @_ZN8OpenMesh16PolyConnectivity11faces_beginEv(ptr noundef nonnull align 8 dereferenceable(416) %0)
  %5 = extractvalue { ptr, i64 } %4, 0
  store ptr %5, ptr %2, align 8
  %6 = getelementptr inbounds i8, ptr %2, i64 8
  %7 = extractvalue { ptr, i64 } %4, 1
  store i64 %7, ptr %6, align 8
  call void @llvm.lifetime.start.p0(i64 16, ptr nonnull %3) #3
  %8 = tail call { ptr, i64 } @_ZN8OpenMesh16PolyConnectivity9faces_endEv(ptr noundef nonnull align 8 dereferenceable(416) %0)
  %9 = extractvalue { ptr, i64 } %8, 0
  store ptr %9, ptr %3, align 8
  %10 = getelementptr inbounds i8, ptr %3, i64 8
  %11 = extractvalue { ptr, i64 } %8, 1
  store i64 %11, ptr %10, align 8
  %12 = call noundef zeroext i1 @_ZNK8OpenMesh9Iterators16GenericIteratorTINS_16PolyConnectivityENS_10FaceHandleENS_11ArrayKernelEXadL_ZNKS4_15has_face_statusEvEEXadL_ZNKS4_7n_facesEvEEEneERKS5_(ptr noundef nonnull align 8 dereferenceable(16) %2, ptr noundef nonnull align 8 dereferenceable(16) %3)
  br i1 %12, label %.lr.ph, label %._crit_edge

.lr.ph:                                           ; preds = %1, %.lr.ph
  %13 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZNK8OpenMesh9Iterators16GenericIteratorTINS_16PolyConnectivityENS_10FaceHandleENS_11ArrayKernelEXadL_ZNKS4_15has_face_statusEvEEXadL_ZNKS4_7n_facesEvEEEdeEv(ptr noundef nonnull align 8 dereferenceable(16) %2)
  %.sroa.0.0.copyload = load i32, ptr %13, align 4
  call void @_ZN8OpenMesh16PolyConnectivity11triangulateENS_10FaceHandleE(ptr noundef nonnull align 8 dereferenceable(416) %0, i32 %.sroa.0.0.copyload)
  %14 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZN8OpenMesh9Iterators16GenericIteratorTINS_16PolyConnectivityENS_10FaceHandleENS_11ArrayKernelEXadL_ZNKS4_15has_face_statusEvEEXadL_ZNKS4_7n_facesEvEEEppEv(ptr noundef nonnull align 8 dereferenceable(16) %2)
  %15 = call noundef zeroext i1 @_ZNK8OpenMesh9Iterators16GenericIteratorTINS_16PolyConnectivityENS_10FaceHandleENS_11ArrayKernelEXadL_ZNKS4_15has_face_statusEvEEXadL_ZNKS4_7n_facesEvEEEneERKS5_(ptr noundef nonnull align 8 dereferenceable(16) %2, ptr noundef nonnull align 8 dereferenceable(16) %3)
  br i1 %15, label %.lr.ph, label %._crit_edge, !llvm.loop !5

._crit_edge:                                      ; preds = %.lr.ph, %1
  call void @llvm.lifetime.end.p0(i64 16, ptr nonnull %3) #3
  call void @llvm.lifetime.end.p0(i64 16, ptr nonnull %2) #3
  ret void
}

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

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

; Function Attrs: mustprogress uwtable
declare dso_local noundef nonnull align 8 dereferenceable(16) ptr @_ZN8OpenMesh9Iterators16GenericIteratorTINS_16PolyConnectivityENS_10FaceHandleENS_11ArrayKernelEXadL_ZNKS4_15has_face_statusEvEEXadL_ZNKS4_7n_facesEvEEEppEv(ptr noundef nonnull align 8 dereferenceable(16)) 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 = { mustprogress nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { nounwind }

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

!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"clang version 19.1.0 (git@github.com:llvm/llvm-project.git a4bf6cd7cfb1a1421ba92bca9d017b49936c55e4)"}
!5 = distinct !{!5, !6}
!6 = !{!"llvm.loop.mustprogress"}


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