; 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::EdgeHandle" = type { %"class.OpenMesh::BaseHandle" }
%"class.OpenMesh::BaseHandle" = type { i32 }
%"struct.OpenMesh::HalfedgeHandle" = type { %"class.OpenMesh::BaseHandle" }
%"struct.OpenMesh::FaceHandle" = 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: mustprogress nounwind uwtable
declare dso_local noundef zeroext i1 @_ZNK8OpenMesh10BaseHandleeqERKS0_(ptr noundef nonnull align 4 dereferenceable(4), ptr noundef nonnull align 4 dereferenceable(4)) #2 align 2

; 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 i32 @_ZNK8OpenMesh11ArrayKernel20next_halfedge_handleENS_14HalfedgeHandleE(ptr noundef nonnull align 8 dereferenceable(368), i32) #3 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef zeroext i1 @_ZNK8OpenMesh10BaseHandleneERKS0_(ptr noundef nonnull align 4 dereferenceable(4), ptr noundef nonnull align 4 dereferenceable(4)) #2 align 2

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

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

; Function Attrs: mustprogress uwtable
define dso_local noundef zeroext i1 @_ZNK8OpenMesh16PolyConnectivity14is_simple_linkENS_10EdgeHandleE(ptr noundef nonnull align 8 dereferenceable(416) %0, i32 %1) #3 align 2 {
  %3 = alloca i1, align 1
  %4 = alloca %"struct.OpenMesh::EdgeHandle", align 4
  %5 = alloca ptr, align 8
  %6 = alloca %"struct.OpenMesh::HalfedgeHandle", align 4
  %7 = alloca %"struct.OpenMesh::EdgeHandle", align 4
  %8 = alloca %"struct.OpenMesh::HalfedgeHandle", align 4
  %9 = alloca %"struct.OpenMesh::EdgeHandle", align 4
  %10 = alloca %"struct.OpenMesh::FaceHandle", align 4
  %11 = alloca %"struct.OpenMesh::HalfedgeHandle", align 4
  %12 = alloca %"struct.OpenMesh::HalfedgeHandle", align 4
  %13 = alloca %"struct.OpenMesh::HalfedgeHandle", align 4
  %14 = alloca %"struct.OpenMesh::FaceHandle", align 4
  %15 = alloca %"struct.OpenMesh::HalfedgeHandle", align 4
  %16 = alloca i32, align 4
  %17 = alloca %"struct.OpenMesh::HalfedgeHandle", align 4
  %18 = alloca %"struct.OpenMesh::HalfedgeHandle", align 4
  %19 = getelementptr inbounds %"struct.OpenMesh::EdgeHandle", ptr %4, i32 0, i32 0
  %20 = getelementptr inbounds %"class.OpenMesh::BaseHandle", ptr %19, i32 0, i32 0
  store i32 %1, ptr %20, align 4
  store ptr %0, ptr %5, align 8, !tbaa !5
  %21 = load ptr, ptr %5, align 8
  call void @llvm.lifetime.start.p0(i64 4, ptr %6) #5
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %7, ptr align 4 %4, i64 4, i1 false)
  %22 = getelementptr inbounds %"struct.OpenMesh::EdgeHandle", ptr %7, i32 0, i32 0
  %23 = getelementptr inbounds %"class.OpenMesh::BaseHandle", ptr %22, i32 0, i32 0
  %24 = load i32, ptr %23, align 4
  %25 = call i32 @_ZNK8OpenMesh11ArrayKernel15halfedge_handleENS_10EdgeHandleEj(ptr noundef nonnull align 8 dereferenceable(368) %21, i32 %24, i32 noundef 0)
  %26 = getelementptr inbounds %"struct.OpenMesh::HalfedgeHandle", ptr %6, i32 0, i32 0
  %27 = getelementptr inbounds %"class.OpenMesh::BaseHandle", ptr %26, i32 0, i32 0
  store i32 %25, ptr %27, align 4
  call void @llvm.lifetime.start.p0(i64 4, ptr %8) #5
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %9, ptr align 4 %4, i64 4, i1 false)
  %28 = getelementptr inbounds %"struct.OpenMesh::EdgeHandle", ptr %9, i32 0, i32 0
  %29 = getelementptr inbounds %"class.OpenMesh::BaseHandle", ptr %28, i32 0, i32 0
  %30 = load i32, ptr %29, align 4
  %31 = call i32 @_ZNK8OpenMesh11ArrayKernel15halfedge_handleENS_10EdgeHandleEj(ptr noundef nonnull align 8 dereferenceable(368) %21, i32 %30, i32 noundef 1)
  %32 = getelementptr inbounds %"struct.OpenMesh::HalfedgeHandle", ptr %8, i32 0, i32 0
  %33 = getelementptr inbounds %"class.OpenMesh::BaseHandle", ptr %32, i32 0, i32 0
  store i32 %31, ptr %33, align 4
  call void @llvm.lifetime.start.p0(i64 4, ptr %10) #5
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %11, ptr align 4 %8, i64 4, i1 false)
  %34 = getelementptr inbounds %"struct.OpenMesh::HalfedgeHandle", ptr %11, i32 0, i32 0
  %35 = getelementptr inbounds %"class.OpenMesh::BaseHandle", ptr %34, i32 0, i32 0
  %36 = load i32, ptr %35, align 4
  %37 = call i32 @_ZNK8OpenMesh11ArrayKernel11face_handleENS_14HalfedgeHandleE(ptr noundef nonnull align 8 dereferenceable(368) %21, i32 %36)
  %38 = getelementptr inbounds %"struct.OpenMesh::FaceHandle", ptr %10, i32 0, i32 0
  %39 = getelementptr inbounds %"class.OpenMesh::BaseHandle", ptr %38, i32 0, i32 0
  store i32 %37, ptr %39, align 4
  call void @llvm.lifetime.start.p0(i64 4, ptr %12) #5
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %13, ptr align 4 %6, i64 4, i1 false)
  %40 = getelementptr inbounds %"struct.OpenMesh::HalfedgeHandle", ptr %13, i32 0, i32 0
  %41 = getelementptr inbounds %"class.OpenMesh::BaseHandle", ptr %40, i32 0, i32 0
  %42 = load i32, ptr %41, align 4
  %43 = call i32 @_ZNK8OpenMesh11ArrayKernel20next_halfedge_handleENS_14HalfedgeHandleE(ptr noundef nonnull align 8 dereferenceable(368) %21, i32 %42)
  %44 = getelementptr inbounds %"struct.OpenMesh::HalfedgeHandle", ptr %12, i32 0, i32 0
  %45 = getelementptr inbounds %"class.OpenMesh::BaseHandle", ptr %44, i32 0, i32 0
  store i32 %43, ptr %45, align 4
  br label %46

46:                                               ; preds = %57, %2
  %47 = call noundef zeroext i1 @_ZNK8OpenMesh10BaseHandleneERKS0_(ptr noundef nonnull align 4 dereferenceable(4) %12, ptr noundef nonnull align 4 dereferenceable(4) %6)
  br i1 %47, label %48, label %64

48:                                               ; preds = %46
  call void @llvm.lifetime.start.p0(i64 4, ptr %14) #5
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %15, ptr align 4 %12, i64 4, i1 false)
  %49 = getelementptr inbounds %"struct.OpenMesh::HalfedgeHandle", ptr %15, i32 0, i32 0
  %50 = getelementptr inbounds %"class.OpenMesh::BaseHandle", ptr %49, i32 0, i32 0
  %51 = load i32, ptr %50, align 4
  %52 = call i32 @_ZNK8OpenMesh16PolyConnectivity20opposite_face_handleENS_14HalfedgeHandleE(ptr noundef nonnull align 8 dereferenceable(416) %21, i32 %51)
  %53 = getelementptr inbounds %"struct.OpenMesh::FaceHandle", ptr %14, i32 0, i32 0
  %54 = getelementptr inbounds %"class.OpenMesh::BaseHandle", ptr %53, i32 0, i32 0
  store i32 %52, ptr %54, align 4
  %55 = call noundef zeroext i1 @_ZNK8OpenMesh10BaseHandleeqERKS0_(ptr noundef nonnull align 4 dereferenceable(4) %14, ptr noundef nonnull align 4 dereferenceable(4) %10)
  call void @llvm.lifetime.end.p0(i64 4, ptr %14) #5
  br i1 %55, label %56, label %57

56:                                               ; preds = %48
  store i1 false, ptr %3, align 1
  store i32 1, ptr %16, align 4
  br label %65

57:                                               ; preds = %48
  call void @llvm.lifetime.start.p0(i64 4, ptr %17) #5
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %18, ptr align 4 %12, i64 4, i1 false)
  %58 = getelementptr inbounds %"struct.OpenMesh::HalfedgeHandle", ptr %18, i32 0, i32 0
  %59 = getelementptr inbounds %"class.OpenMesh::BaseHandle", ptr %58, i32 0, i32 0
  %60 = load i32, ptr %59, align 4
  %61 = call i32 @_ZNK8OpenMesh11ArrayKernel20next_halfedge_handleENS_14HalfedgeHandleE(ptr noundef nonnull align 8 dereferenceable(368) %21, i32 %60)
  %62 = getelementptr inbounds %"struct.OpenMesh::HalfedgeHandle", ptr %17, i32 0, i32 0
  %63 = getelementptr inbounds %"class.OpenMesh::BaseHandle", ptr %62, i32 0, i32 0
  store i32 %61, ptr %63, align 4
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %12, ptr align 4 %17, i64 4, i1 false)
  call void @llvm.lifetime.end.p0(i64 4, ptr %17) #5
  br label %46, !llvm.loop !9

64:                                               ; preds = %46
  store i1 true, ptr %3, align 1
  store i32 1, ptr %16, align 4
  br label %65

65:                                               ; preds = %64, %56
  call void @llvm.lifetime.end.p0(i64 4, ptr %12) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %10) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %8) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %6) #5
  %66 = load i1, ptr %3, align 1
  ret i1 %66
}

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

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { nocallback nofree nounwind willreturn memory(argmem: readwrite) }
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 = { 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 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 = { 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"

%"struct.OpenMesh::HalfedgeHandle" = type { %"class.OpenMesh::BaseHandle" }
%"class.OpenMesh::BaseHandle" = type { i32 }
%"struct.OpenMesh::FaceHandle" = 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 nounwind uwtable
declare dso_local noundef zeroext i1 @_ZNK8OpenMesh10BaseHandleeqERKS0_(ptr noundef nonnull align 4 dereferenceable(4), ptr noundef nonnull align 4 dereferenceable(4)) local_unnamed_addr #1 align 2

; 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 i32 @_ZNK8OpenMesh11ArrayKernel20next_halfedge_handleENS_14HalfedgeHandleE(ptr noundef nonnull align 8 dereferenceable(368), i32) local_unnamed_addr #2 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef zeroext i1 @_ZNK8OpenMesh10BaseHandleneERKS0_(ptr noundef nonnull align 4 dereferenceable(4), ptr noundef nonnull align 4 dereferenceable(4)) local_unnamed_addr #1 align 2

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

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

; Function Attrs: mustprogress uwtable
define dso_local noundef zeroext i1 @_ZNK8OpenMesh16PolyConnectivity14is_simple_linkENS_10EdgeHandleE(ptr noundef nonnull align 8 dereferenceable(416) %0, i32 %1) local_unnamed_addr #2 align 2 {
  %3 = alloca %"struct.OpenMesh::HalfedgeHandle", align 4
  %4 = alloca %"struct.OpenMesh::FaceHandle", align 4
  %5 = alloca %"struct.OpenMesh::HalfedgeHandle", align 4
  %6 = alloca %"struct.OpenMesh::FaceHandle", align 4
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %3) #4
  %7 = tail call i32 @_ZNK8OpenMesh11ArrayKernel15halfedge_handleENS_10EdgeHandleEj(ptr noundef nonnull align 8 dereferenceable(368) %0, i32 %1, i32 noundef 0)
  store i32 %7, ptr %3, align 4
  %8 = tail call i32 @_ZNK8OpenMesh11ArrayKernel15halfedge_handleENS_10EdgeHandleEj(ptr noundef nonnull align 8 dereferenceable(368) %0, i32 %1, i32 noundef 1)
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %4) #4
  %9 = tail call i32 @_ZNK8OpenMesh11ArrayKernel11face_handleENS_14HalfedgeHandleE(ptr noundef nonnull align 8 dereferenceable(368) %0, i32 %8)
  store i32 %9, ptr %4, align 4
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %5) #4
  %10 = tail call i32 @_ZNK8OpenMesh11ArrayKernel20next_halfedge_handleENS_14HalfedgeHandleE(ptr noundef nonnull align 8 dereferenceable(368) %0, i32 %7)
  store i32 %10, ptr %5, align 4
  %11 = call noundef zeroext i1 @_ZNK8OpenMesh10BaseHandleneERKS0_(ptr noundef nonnull align 4 dereferenceable(4) %5, ptr noundef nonnull align 4 dereferenceable(4) %3)
  br i1 %11, label %.lr.ph, label %._crit_edge

.lr.ph:                                           ; preds = %2, %14
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %6) #4
  %.sroa.02.0.copyload = load i32, ptr %5, align 4
  %12 = call i32 @_ZNK8OpenMesh16PolyConnectivity20opposite_face_handleENS_14HalfedgeHandleE(ptr noundef nonnull align 8 dereferenceable(416) %0, i32 %.sroa.02.0.copyload)
  store i32 %12, ptr %6, align 4
  %13 = call noundef zeroext i1 @_ZNK8OpenMesh10BaseHandleeqERKS0_(ptr noundef nonnull align 4 dereferenceable(4) %6, ptr noundef nonnull align 4 dereferenceable(4) %4)
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %6) #4
  br i1 %13, label %._crit_edge.loopexit, label %14

14:                                               ; preds = %.lr.ph
  %.sroa.0.0.copyload = load i32, ptr %5, align 4
  %15 = call i32 @_ZNK8OpenMesh11ArrayKernel20next_halfedge_handleENS_14HalfedgeHandleE(ptr noundef nonnull align 8 dereferenceable(368) %0, i32 %.sroa.0.0.copyload)
  store i32 %15, ptr %5, align 4
  %16 = call noundef zeroext i1 @_ZNK8OpenMesh10BaseHandleneERKS0_(ptr noundef nonnull align 4 dereferenceable(4) %5, ptr noundef nonnull align 4 dereferenceable(4) %3)
  br i1 %16, label %.lr.ph, label %._crit_edge.loopexit, !llvm.loop !5

._crit_edge.loopexit:                             ; preds = %14, %.lr.ph
  %17 = xor i1 %13, true
  br label %._crit_edge

._crit_edge:                                      ; preds = %._crit_edge.loopexit, %2
  %.lcssa = phi i1 [ true, %2 ], [ %17, %._crit_edge.loopexit ]
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %5) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %4) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %3) #4
  ret i1 %.lcssa
}

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

attributes #0 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { 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 #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 = { 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 = { 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,GVNPass,GlobalOptPass,InferFunctionAttrsPass,InstCombinePass,InstSimplifyPass,LCSSAPass,LoopRotatePass,LoopSimplifyPass,LoopUnrollPass,SROAPass,SimplifyCFGPass,TailCallElimPass