; LLVM IR from laurimi/ase_exploration :: src/ExplorationPlanner/grid (PlanarGridOccupancyMap)

; 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.boost::unordered::iterator_detail::c_iterator" = type { ptr }
%"struct.std::pair" = type { %class.PlanarGridIndex, %class.PlanarCellObservation }
%class.PlanarGridIndex = type { i32, i32 }
%class.PlanarCellObservation = type { i8, double }

; Function Attrs: mustprogress uwtable
define dso_local void @_ZN22PlanarGridOccupancyMap6updateERK17PlanarObservation(ptr noundef nonnull align 8 dereferenceable(10) %0, ptr noundef nonnull align 8 dereferenceable(8) %1) #0 align 2 {
  %3 = alloca ptr, align 8
  %4 = alloca ptr, align 8
  %5 = alloca %"struct.boost::unordered::iterator_detail::c_iterator", align 8
  %6 = alloca %"struct.boost::unordered::iterator_detail::c_iterator", align 8
  store ptr %0, ptr %3, align 8, !tbaa !5
  store ptr %1, ptr %4, align 8, !tbaa !5
  %7 = load ptr, ptr %3, align 8
  call void @llvm.lifetime.start.p0(i64 8, ptr %5) #3
  %8 = load ptr, ptr %4, align 8, !tbaa !5
  %9 = load ptr, ptr %8, align 8, !tbaa !9
  %10 = getelementptr i8, ptr %9, i64 -24
  %11 = load i64, ptr %10, align 8
  %12 = getelementptr inbounds i8, ptr %8, i64 %11
  %13 = call ptr @_ZNK19PlanarGridContainerI21PlanarCellObservationE5beginEv(ptr noundef nonnull align 8 dereferenceable(48) %12)
  %14 = getelementptr inbounds %"struct.boost::unordered::iterator_detail::c_iterator", ptr %5, i32 0, i32 0
  store ptr %13, ptr %14, align 8
  call void @llvm.lifetime.start.p0(i64 8, ptr %6) #3
  %15 = load ptr, ptr %4, align 8, !tbaa !5
  %16 = load ptr, ptr %15, align 8, !tbaa !9
  %17 = getelementptr i8, ptr %16, i64 -24
  %18 = load i64, ptr %17, align 8
  %19 = getelementptr inbounds i8, ptr %15, i64 %18
  %20 = call ptr @_ZNK19PlanarGridContainerI21PlanarCellObservationE3endEv(ptr noundef nonnull align 8 dereferenceable(48) %19)
  %21 = getelementptr inbounds %"struct.boost::unordered::iterator_detail::c_iterator", ptr %6, i32 0, i32 0
  store ptr %20, ptr %21, align 8
  br label %22

22:                                               ; preds = %30, %2
  %23 = call noundef zeroext i1 @_ZN5boost9unordered15iterator_detailneERKNS1_10c_iteratorINS0_6detail8ptr_nodeISt4pairIK15PlanarGridIndex21PlanarCellObservationEEEEESD_(ptr noundef nonnull align 8 dereferenceable(8) %5, ptr noundef nonnull align 8 dereferenceable(8) %6) #3
  br i1 %23, label %25, label %24

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

25:                                               ; preds = %22
  %26 = call noundef ptr @_ZNK5boost9unordered15iterator_detail10c_iteratorINS0_6detail8ptr_nodeISt4pairIK15PlanarGridIndex21PlanarCellObservationEEEEptEv(ptr noundef nonnull align 8 dereferenceable(8) %5)
  %27 = getelementptr inbounds %"struct.std::pair", ptr %26, i32 0, i32 0
  %28 = call noundef ptr @_ZNK5boost9unordered15iterator_detail10c_iteratorINS0_6detail8ptr_nodeISt4pairIK15PlanarGridIndex21PlanarCellObservationEEEEptEv(ptr noundef nonnull align 8 dereferenceable(8) %5)
  %29 = getelementptr inbounds %"struct.std::pair", ptr %28, i32 0, i32 1
  call void @_ZN22PlanarGridOccupancyMap10updateCellERK15PlanarGridIndexRK21PlanarCellObservation(ptr noundef nonnull align 8 dereferenceable(10) %7, ptr noundef nonnull align 4 dereferenceable(8) %27, ptr noundef nonnull align 8 dereferenceable(16) %29)
  br label %30

30:                                               ; preds = %25
  %31 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZN5boost9unordered15iterator_detail10c_iteratorINS0_6detail8ptr_nodeISt4pairIK15PlanarGridIndex21PlanarCellObservationEEEEppEv(ptr noundef nonnull align 8 dereferenceable(8) %5)
  br label %22, !llvm.loop !11

32:                                               ; preds = %24
  ret void
}

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

; Function Attrs: mustprogress nounwind uwtable
declare dso_local ptr @_ZNK19PlanarGridContainerI21PlanarCellObservationE5beginEv(ptr noundef nonnull align 8 dereferenceable(48)) #2 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local ptr @_ZNK19PlanarGridContainerI21PlanarCellObservationE3endEv(ptr noundef nonnull align 8 dereferenceable(48)) #2 align 2

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

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN22PlanarGridOccupancyMap10updateCellERK15PlanarGridIndexRK21PlanarCellObservation(ptr noundef nonnull align 8 dereferenceable(10), ptr noundef nonnull align 4 dereferenceable(8), ptr noundef nonnull align 8 dereferenceable(16)) #0 align 2

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

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

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

attributes #0 = { 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 #1 = { nocallback nofree nosync 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 = { 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 = !{!"vtable pointer", !8, 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"

%"struct.boost::unordered::iterator_detail::c_iterator" = type { ptr }

; Function Attrs: mustprogress uwtable
define dso_local void @_ZN22PlanarGridOccupancyMap6updateERK17PlanarObservation(ptr noundef nonnull align 8 dereferenceable(10) %0, ptr noundef nonnull align 8 dereferenceable(8) %1) local_unnamed_addr #0 align 2 {
  %3 = alloca %"struct.boost::unordered::iterator_detail::c_iterator", align 8
  %4 = alloca %"struct.boost::unordered::iterator_detail::c_iterator", align 8
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %3) #3
  %5 = load ptr, ptr %1, align 8, !tbaa !5
  %6 = getelementptr i8, ptr %5, i64 -24
  %7 = load i64, ptr %6, align 8
  %8 = getelementptr inbounds i8, ptr %1, i64 %7
  %9 = tail call ptr @_ZNK19PlanarGridContainerI21PlanarCellObservationE5beginEv(ptr noundef nonnull align 8 dereferenceable(48) %8)
  store ptr %9, ptr %3, align 8
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %4) #3
  %10 = load ptr, ptr %1, align 8, !tbaa !5
  %11 = getelementptr i8, ptr %10, i64 -24
  %12 = load i64, ptr %11, align 8
  %13 = getelementptr inbounds i8, ptr %1, i64 %12
  %14 = tail call ptr @_ZNK19PlanarGridContainerI21PlanarCellObservationE3endEv(ptr noundef nonnull align 8 dereferenceable(48) %13)
  store ptr %14, ptr %4, align 8
  %15 = call noundef zeroext i1 @_ZN5boost9unordered15iterator_detailneERKNS1_10c_iteratorINS0_6detail8ptr_nodeISt4pairIK15PlanarGridIndex21PlanarCellObservationEEEEESD_(ptr noundef nonnull align 8 dereferenceable(8) %3, ptr noundef nonnull align 8 dereferenceable(8) %4) #3
  br i1 %15, label %.lr.ph, label %._crit_edge

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

.lr.ph:                                           ; preds = %2, %.lr.ph
  %16 = call noundef ptr @_ZNK5boost9unordered15iterator_detail10c_iteratorINS0_6detail8ptr_nodeISt4pairIK15PlanarGridIndex21PlanarCellObservationEEEEptEv(ptr noundef nonnull align 8 dereferenceable(8) %3)
  %17 = call noundef ptr @_ZNK5boost9unordered15iterator_detail10c_iteratorINS0_6detail8ptr_nodeISt4pairIK15PlanarGridIndex21PlanarCellObservationEEEEptEv(ptr noundef nonnull align 8 dereferenceable(8) %3)
  %18 = getelementptr inbounds i8, ptr %17, i64 8
  call void @_ZN22PlanarGridOccupancyMap10updateCellERK15PlanarGridIndexRK21PlanarCellObservation(ptr noundef nonnull align 8 dereferenceable(10) %0, ptr noundef nonnull align 4 dereferenceable(8) %16, ptr noundef nonnull align 8 dereferenceable(16) %18)
  %19 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZN5boost9unordered15iterator_detail10c_iteratorINS0_6detail8ptr_nodeISt4pairIK15PlanarGridIndex21PlanarCellObservationEEEEppEv(ptr noundef nonnull align 8 dereferenceable(8) %3)
  %20 = call noundef zeroext i1 @_ZN5boost9unordered15iterator_detailneERKNS1_10c_iteratorINS0_6detail8ptr_nodeISt4pairIK15PlanarGridIndex21PlanarCellObservationEEEEESD_(ptr noundef nonnull align 8 dereferenceable(8) %3, ptr noundef nonnull align 8 dereferenceable(8) %4) #3
  br i1 %20, label %.lr.ph, label %._crit_edge, !llvm.loop !8
}

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

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

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

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

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN22PlanarGridOccupancyMap10updateCellERK15PlanarGridIndexRK21PlanarCellObservation(ptr noundef nonnull align 8 dereferenceable(10), ptr noundef nonnull align 4 dereferenceable(8), ptr noundef nonnull align 8 dereferenceable(16)) local_unnamed_addr #0 align 2

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

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

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

attributes #0 = { 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 #1 = { mustprogress nocallback nofree nosync 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 = { 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 = !{!"vtable pointer", !7, i64 0}
!7 = !{!"Simple C++ TBAA"}
!8 = distinct !{!8, !9}
!9 = !{!"llvm.loop.mustprogress"}


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