; LLVM IR from USE-jx/hybridAstar_lbfgsSmooth :: src/hybrid_astar_searcher/src/bucketedqueue.ll (ZN15BucketPrioQueue3popEv)

; 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.IntPoint = type { i32, i32 }
%class.BucketPrioQueue = type { i32, i32, %"class.std::vector.0" }
%"class.std::vector.0" = type { %"struct.std::_Vector_base.1" }
%"struct.std::_Vector_base.1" = type { %"struct.std::_Vector_base<std::queue<IntPoint>, std::allocator<std::queue<IntPoint>>>::_Vector_impl" }
%"struct.std::_Vector_base<std::queue<IntPoint>, std::allocator<std::queue<IntPoint>>>::_Vector_impl" = type { %"struct.std::_Vector_base<std::queue<IntPoint>, std::allocator<std::queue<IntPoint>>>::_Vector_impl_data" }
%"struct.std::_Vector_base<std::queue<IntPoint>, std::allocator<std::queue<IntPoint>>>::_Vector_impl_data" = type { ptr, ptr, ptr }

@.str.1 = external hidden unnamed_addr constant [8 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [112 x i8], align 1
@__PRETTY_FUNCTION__._ZN15BucketPrioQueue3popEv = external hidden unnamed_addr constant [32 x i8], align 1
@.str.3 = external hidden unnamed_addr constant [22 x i8], align 1

; 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: mustprogress nounwind uwtable
declare dso_local noundef nonnull align 8 dereferenceable(80) ptr @_ZNSt6vectorISt5queueI8IntPointSt5dequeIS1_SaIS1_EEESaIS5_EEixEm(ptr noundef nonnull align 8 dereferenceable(24), i64 noundef) #1 align 2

; Function Attrs: mustprogress uwtable
define dso_local i64 @_ZN15BucketPrioQueue3popEv(ptr noundef nonnull align 8 dereferenceable(32) %0) #2 align 2 {
  %2 = alloca %class.IntPoint, align 4
  %3 = alloca ptr, align 8
  %4 = alloca i32, align 4
  store ptr %0, ptr %3, align 8, !tbaa !5
  %5 = load ptr, ptr %3, align 8
  call void @llvm.lifetime.start.p0(i64 4, ptr %4) #5
  %6 = getelementptr inbounds %class.BucketPrioQueue, ptr %5, i32 0, i32 0
  %7 = load i32, ptr %6, align 8, !tbaa !9
  %8 = icmp sgt i32 %7, 0
  br i1 %8, label %9, label %10

9:                                                ; preds = %1
  br label %12

10:                                               ; preds = %1
  call void @__assert_fail(ptr noundef @.str.1, ptr noundef @.str.2, i32 noundef 50, ptr noundef @__PRETTY_FUNCTION__._ZN15BucketPrioQueue3popEv) #6
  unreachable

11:                                               ; No predecessors!
  br label %12

12:                                               ; preds = %11, %9
  %13 = getelementptr inbounds %class.BucketPrioQueue, ptr %5, i32 0, i32 1
  %14 = load i32, ptr %13, align 4, !tbaa !16
  store i32 %14, ptr %4, align 4, !tbaa !17
  br label %15

15:                                               ; preds = %29, %12
  %16 = load i32, ptr %4, align 4, !tbaa !17
  %17 = getelementptr inbounds %class.BucketPrioQueue, ptr %5, i32 0, i32 2
  %18 = call noundef i64 @_ZNKSt6vectorISt5queueI8IntPointSt5dequeIS1_SaIS1_EEESaIS5_EE4sizeEv(ptr noundef nonnull align 8 dereferenceable(24) %17) #5
  %19 = trunc i64 %18 to i32
  %20 = icmp slt i32 %16, %19
  br i1 %20, label %21, label %32

21:                                               ; preds = %15
  %22 = getelementptr inbounds %class.BucketPrioQueue, ptr %5, i32 0, i32 2
  %23 = load i32, ptr %4, align 4, !tbaa !17
  %24 = sext i32 %23 to i64
  %25 = call noundef nonnull align 8 dereferenceable(80) ptr @_ZNSt6vectorISt5queueI8IntPointSt5dequeIS1_SaIS1_EEESaIS5_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) %22, i64 noundef %24) #5
  %26 = call noundef zeroext i1 @_ZNKSt5queueI8IntPointSt5dequeIS0_SaIS0_EEE5emptyEv(ptr noundef nonnull align 8 dereferenceable(80) %25)
  br i1 %26, label %28, label %27

27:                                               ; preds = %21
  br label %32

28:                                               ; preds = %21
  br label %29

29:                                               ; preds = %28
  %30 = load i32, ptr %4, align 4, !tbaa !17
  %31 = add nsw i32 %30, 1
  store i32 %31, ptr %4, align 4, !tbaa !17
  br label %15, !llvm.loop !18

32:                                               ; preds = %27, %15
  %33 = load i32, ptr %4, align 4, !tbaa !17
  %34 = getelementptr inbounds %class.BucketPrioQueue, ptr %5, i32 0, i32 2
  %35 = call noundef i64 @_ZNKSt6vectorISt5queueI8IntPointSt5dequeIS1_SaIS1_EEESaIS5_EE4sizeEv(ptr noundef nonnull align 8 dereferenceable(24) %34) #5
  %36 = trunc i64 %35 to i32
  %37 = icmp slt i32 %33, %36
  br i1 %37, label %38, label %39

38:                                               ; preds = %32
  br label %41

39:                                               ; preds = %32
  call void @__assert_fail(ptr noundef @.str.3, ptr noundef @.str.2, i32 noundef 55, ptr noundef @__PRETTY_FUNCTION__._ZN15BucketPrioQueue3popEv) #6
  unreachable

40:                                               ; No predecessors!
  br label %41

41:                                               ; preds = %40, %38
  %42 = load i32, ptr %4, align 4, !tbaa !17
  %43 = getelementptr inbounds %class.BucketPrioQueue, ptr %5, i32 0, i32 1
  store i32 %42, ptr %43, align 4, !tbaa !16
  %44 = getelementptr inbounds %class.BucketPrioQueue, ptr %5, i32 0, i32 0
  %45 = load i32, ptr %44, align 8, !tbaa !9
  %46 = add nsw i32 %45, -1
  store i32 %46, ptr %44, align 8, !tbaa !9
  %47 = getelementptr inbounds %class.BucketPrioQueue, ptr %5, i32 0, i32 2
  %48 = load i32, ptr %4, align 4, !tbaa !17
  %49 = sext i32 %48 to i64
  %50 = call noundef nonnull align 8 dereferenceable(80) ptr @_ZNSt6vectorISt5queueI8IntPointSt5dequeIS1_SaIS1_EEESaIS5_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) %47, i64 noundef %49) #5
  %51 = call noundef nonnull align 4 dereferenceable(8) ptr @_ZNSt5queueI8IntPointSt5dequeIS0_SaIS0_EEE5frontEv(ptr noundef nonnull align 8 dereferenceable(80) %50)
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %2, ptr align 4 %51, i64 8, i1 false), !tbaa.struct !20
  %52 = getelementptr inbounds %class.BucketPrioQueue, ptr %5, i32 0, i32 2
  %53 = load i32, ptr %4, align 4, !tbaa !17
  %54 = sext i32 %53 to i64
  %55 = call noundef nonnull align 8 dereferenceable(80) ptr @_ZNSt6vectorISt5queueI8IntPointSt5dequeIS1_SaIS1_EEESaIS5_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) %52, i64 noundef %54) #5
  call void @_ZNSt5queueI8IntPointSt5dequeIS0_SaIS0_EEE3popEv(ptr noundef nonnull align 8 dereferenceable(80) %55)
  call void @llvm.lifetime.end.p0(i64 4, ptr %4) #5
  %56 = load i64, ptr %2, align 4
  ret i64 %56
}

; Function Attrs: noreturn nounwind
declare void @__assert_fail(ptr noundef, ptr noundef, i32 noundef, ptr noundef) #3

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

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef zeroext i1 @_ZNKSt5queueI8IntPointSt5dequeIS0_SaIS0_EEE5emptyEv(ptr noundef nonnull align 8 dereferenceable(80)) #1 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef nonnull align 4 dereferenceable(8) ptr @_ZNSt5queueI8IntPointSt5dequeIS0_SaIS0_EEE5frontEv(ptr noundef nonnull align 8 dereferenceable(80)) #1 align 2

; 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) #4

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZNSt5queueI8IntPointSt5dequeIS0_SaIS0_EEE3popEv(ptr noundef nonnull align 8 dereferenceable(80)) #1 align 2

attributes #0 = { 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 = { noreturn 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 #4 = { nocallback nofree nounwind willreturn memory(argmem: readwrite) }
attributes #5 = { nounwind }
attributes #6 = { noreturn 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, !11, i64 0}
!10 = !{!"_ZTS15BucketPrioQueue", !11, i64 0, !11, i64 4, !12, i64 8}
!11 = !{!"int", !7, i64 0}
!12 = !{!"_ZTSSt6vectorISt5queueI8IntPointSt5dequeIS1_SaIS1_EEESaIS5_EE", !13, i64 0}
!13 = !{!"_ZTSSt12_Vector_baseISt5queueI8IntPointSt5dequeIS1_SaIS1_EEESaIS5_EE", !14, i64 0}
!14 = !{!"_ZTSNSt12_Vector_baseISt5queueI8IntPointSt5dequeIS1_SaIS1_EEESaIS5_EE12_Vector_implE", !15, i64 0}
!15 = !{!"_ZTSNSt12_Vector_baseISt5queueI8IntPointSt5dequeIS1_SaIS1_EEESaIS5_EE17_Vector_impl_dataE", !6, i64 0, !6, i64 8, !6, i64 16}
!16 = !{!10, !11, i64 4}
!17 = !{!11, !11, i64 0}
!18 = distinct !{!18, !19}
!19 = !{!"llvm.loop.mustprogress"}
!20 = !{i64 0, i64 4, !17, i64 4, i64 4, !17}


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

@.str.1 = external hidden unnamed_addr constant [8 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [112 x i8], align 1
@__PRETTY_FUNCTION__._ZN15BucketPrioQueue3popEv = external hidden unnamed_addr constant [32 x i8], align 1
@.str.3 = external hidden unnamed_addr constant [22 x i8], align 1

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef nonnull align 8 dereferenceable(80) ptr @_ZNSt6vectorISt5queueI8IntPointSt5dequeIS1_SaIS1_EEESaIS5_EEixEm(ptr noundef nonnull align 8 dereferenceable(24), i64 noundef) local_unnamed_addr #0 align 2

; Function Attrs: mustprogress nounwind uwtable
define dso_local i64 @_ZN15BucketPrioQueue3popEv(ptr noundef nonnull align 8 dereferenceable(32) %0) local_unnamed_addr #0 align 2 {
  %2 = load i32, ptr %0, align 8, !tbaa !5
  %3 = icmp sgt i32 %2, 0
  br i1 %3, label %5, label %4

4:                                                ; preds = %1
  tail call void @__assert_fail(ptr noundef nonnull @.str.1, ptr noundef nonnull @.str.2, i32 noundef 50, ptr noundef nonnull @__PRETTY_FUNCTION__._ZN15BucketPrioQueue3popEv) #2
  unreachable

5:                                                ; preds = %1
  %6 = getelementptr inbounds i8, ptr %0, i64 4
  %7 = load i32, ptr %6, align 4, !tbaa !15
  %8 = getelementptr inbounds i8, ptr %0, i64 8
  %9 = tail call noundef i64 @_ZNKSt6vectorISt5queueI8IntPointSt5dequeIS1_SaIS1_EEESaIS5_EE4sizeEv(ptr noundef nonnull align 8 dereferenceable(24) %8) #3
  %10 = trunc i64 %9 to i32
  %11 = icmp slt i32 %7, %10
  br i1 %11, label %.lr.ph.preheader, label %._crit_edge

.lr.ph.preheader:                                 ; preds = %5
  %12 = sext i32 %7 to i64
  br label %.lr.ph

.lr.ph:                                           ; preds = %.lr.ph.preheader, %15
  %indvars.iv = phi i64 [ %12, %.lr.ph.preheader ], [ %indvars.iv.next, %15 ]
  %13 = tail call noundef nonnull align 8 dereferenceable(80) ptr @_ZNSt6vectorISt5queueI8IntPointSt5dequeIS1_SaIS1_EEESaIS5_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) %8, i64 noundef %indvars.iv) #3
  %14 = tail call noundef zeroext i1 @_ZNKSt5queueI8IntPointSt5dequeIS0_SaIS0_EEE5emptyEv(ptr noundef nonnull align 8 dereferenceable(80) %13)
  br i1 %14, label %15, label %._crit_edge.loopexit

15:                                               ; preds = %.lr.ph
  %indvars.iv.next = add nsw i64 %indvars.iv, 1
  %16 = tail call noundef i64 @_ZNKSt6vectorISt5queueI8IntPointSt5dequeIS1_SaIS1_EEESaIS5_EE4sizeEv(ptr noundef nonnull align 8 dereferenceable(24) %8) #3
  %sext = shl i64 %16, 32
  %17 = ashr exact i64 %sext, 32
  %18 = icmp slt i64 %indvars.iv.next, %17
  br i1 %18, label %.lr.ph, label %._crit_edge.loopexit, !llvm.loop !16

._crit_edge.loopexit:                             ; preds = %.lr.ph, %15
  %.0.lcssa.ph.in = phi i64 [ %indvars.iv.next, %15 ], [ %indvars.iv, %.lr.ph ]
  %.0.lcssa.ph = trunc i64 %.0.lcssa.ph.in to i32
  br label %._crit_edge

._crit_edge:                                      ; preds = %._crit_edge.loopexit, %5
  %.0.lcssa = phi i32 [ %7, %5 ], [ %.0.lcssa.ph, %._crit_edge.loopexit ]
  %19 = tail call noundef i64 @_ZNKSt6vectorISt5queueI8IntPointSt5dequeIS1_SaIS1_EEESaIS5_EE4sizeEv(ptr noundef nonnull align 8 dereferenceable(24) %8) #3
  %20 = trunc i64 %19 to i32
  %21 = icmp slt i32 %.0.lcssa, %20
  br i1 %21, label %23, label %22

22:                                               ; preds = %._crit_edge
  tail call void @__assert_fail(ptr noundef nonnull @.str.3, ptr noundef nonnull @.str.2, i32 noundef 55, ptr noundef nonnull @__PRETTY_FUNCTION__._ZN15BucketPrioQueue3popEv) #2
  unreachable

23:                                               ; preds = %._crit_edge
  store i32 %.0.lcssa, ptr %6, align 4, !tbaa !15
  %24 = load i32, ptr %0, align 8, !tbaa !5
  %25 = add nsw i32 %24, -1
  store i32 %25, ptr %0, align 8, !tbaa !5
  %26 = sext i32 %.0.lcssa to i64
  %27 = tail call noundef nonnull align 8 dereferenceable(80) ptr @_ZNSt6vectorISt5queueI8IntPointSt5dequeIS1_SaIS1_EEESaIS5_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) %8, i64 noundef %26) #3
  %28 = tail call noundef nonnull align 4 dereferenceable(8) ptr @_ZNSt5queueI8IntPointSt5dequeIS0_SaIS0_EEE5frontEv(ptr noundef nonnull align 8 dereferenceable(80) %27)
  %.sroa.0.0.copyload = load i64, ptr %28, align 4
  %29 = tail call noundef nonnull align 8 dereferenceable(80) ptr @_ZNSt6vectorISt5queueI8IntPointSt5dequeIS1_SaIS1_EEESaIS5_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) %8, i64 noundef %26) #3
  tail call void @_ZNSt5queueI8IntPointSt5dequeIS0_SaIS0_EEE3popEv(ptr noundef nonnull align 8 dereferenceable(80) %29)
  ret i64 %.sroa.0.0.copyload
}

; Function Attrs: noreturn nounwind
declare void @__assert_fail(ptr noundef, ptr noundef, i32 noundef, ptr noundef) local_unnamed_addr #1

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef i64 @_ZNKSt6vectorISt5queueI8IntPointSt5dequeIS1_SaIS1_EEESaIS5_EE4sizeEv(ptr noundef nonnull align 8 dereferenceable(24)) local_unnamed_addr #0 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef zeroext i1 @_ZNKSt5queueI8IntPointSt5dequeIS0_SaIS0_EEE5emptyEv(ptr noundef nonnull align 8 dereferenceable(80)) local_unnamed_addr #0 align 2

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

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZNSt5queueI8IntPointSt5dequeIS0_SaIS0_EEE3popEv(ptr noundef nonnull align 8 dereferenceable(80)) local_unnamed_addr #0 align 2

attributes #0 = { 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 #1 = { noreturn 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 #2 = { noreturn nounwind }
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, !7, i64 0}
!6 = !{!"_ZTS15BucketPrioQueue", !7, i64 0, !7, i64 4, !10, i64 8}
!7 = !{!"int", !8, i64 0}
!8 = !{!"omnipotent char", !9, i64 0}
!9 = !{!"Simple C++ TBAA"}
!10 = !{!"_ZTSSt6vectorISt5queueI8IntPointSt5dequeIS1_SaIS1_EEESaIS5_EE", !11, i64 0}
!11 = !{!"_ZTSSt12_Vector_baseISt5queueI8IntPointSt5dequeIS1_SaIS1_EEESaIS5_EE", !12, i64 0}
!12 = !{!"_ZTSNSt12_Vector_baseISt5queueI8IntPointSt5dequeIS1_SaIS1_EEESaIS5_EE12_Vector_implE", !13, i64 0}
!13 = !{!"_ZTSNSt12_Vector_baseISt5queueI8IntPointSt5dequeIS1_SaIS1_EEESaIS5_EE17_Vector_impl_dataE", !14, i64 0, !14, i64 8, !14, i64 16}
!14 = !{!"any pointer", !8, i64 0}
!15 = !{!6, !7, i64 4}
!16 = distinct !{!16, !17}
!17 = !{!"llvm.loop.mustprogress"}


; Effective O3 passes: EarlyCSEPass,GlobalOptPass,IndVarSimplifyPass,InferFunctionAttrsPass,InstCombinePass,LCSSAPass,LICMPass,LoopRotatePass,LoopSimplifyPass,PostOrderFunctionAttrsPass,SROAPass,SimplifyCFGPass,TailCallElimPass