; LLVM IR from doyubkim/fluid-engine-dev :: src/jet (point_hash_grid_searcher2)

; 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.jet::Point" = type { i64, i64 }
%"class.jet::Vector" = type { double, double }
%"class.jet::PointHashGridSearcher2" = type { %"class.jet::PointNeighborSearcher2", double, %"class.jet::Point", %"class.std::vector", %"class.std::vector.0" }
%"class.jet::PointNeighborSearcher2" = type { %"class.jet::Serializable" }
%"class.jet::Serializable" = type { ptr }
%"class.std::vector" = type { %"struct.std::_Vector_base" }
%"struct.std::_Vector_base" = type { %"struct.std::_Vector_base<jet::Vector<double, 2>, std::allocator<jet::Vector<double, 2>>>::_Vector_impl" }
%"struct.std::_Vector_base<jet::Vector<double, 2>, std::allocator<jet::Vector<double, 2>>>::_Vector_impl" = type { %"struct.std::_Vector_base<jet::Vector<double, 2>, std::allocator<jet::Vector<double, 2>>>::_Vector_impl_data" }
%"struct.std::_Vector_base<jet::Vector<double, 2>, std::allocator<jet::Vector<double, 2>>>::_Vector_impl_data" = type { ptr, ptr, ptr }
%"class.std::vector.0" = type { %"struct.std::_Vector_base.1" }
%"struct.std::_Vector_base.1" = type { %"struct.std::_Vector_base<std::vector<unsigned long>, std::allocator<std::vector<unsigned long>>>::_Vector_impl" }
%"struct.std::_Vector_base<std::vector<unsigned long>, std::allocator<std::vector<unsigned long>>>::_Vector_impl" = type { %"struct.std::_Vector_base<std::vector<unsigned long>, std::allocator<std::vector<unsigned long>>>::_Vector_impl_data" }
%"struct.std::_Vector_base<std::vector<unsigned long>, std::allocator<std::vector<unsigned long>>>::_Vector_impl_data" = type { ptr, ptr, ptr }

; Function Attrs: mustprogress uwtable
define dso_local void @_ZNK3jet22PointHashGridSearcher214getBucketIndexERKNS_6VectorIdLm2EEE(ptr dead_on_unwind noalias writable sret(%"class.jet::Point") align 8 %0, ptr noundef nonnull align 8 dereferenceable(80) %1, ptr noundef nonnull align 8 dereferenceable(16) %2) #0 align 2 {
  %4 = alloca ptr, align 8
  %5 = alloca ptr, align 8
  %6 = alloca ptr, align 8
  store ptr %0, ptr %4, align 8
  store ptr %1, ptr %5, align 8, !tbaa !5
  store ptr %2, ptr %6, align 8, !tbaa !5
  %7 = load ptr, ptr %5, align 8
  call void @_ZN3jet5PointIlLm2EEC2Ev(ptr noundef nonnull align 8 dereferenceable(16) %0)
  %8 = load ptr, ptr %6, align 8, !tbaa !5
  %9 = getelementptr inbounds %"class.jet::Vector", ptr %8, i32 0, i32 0
  %10 = load double, ptr %9, align 8, !tbaa !9
  %11 = getelementptr inbounds %"class.jet::PointHashGridSearcher2", ptr %7, i32 0, i32 1
  %12 = load double, ptr %11, align 8, !tbaa !12
  %13 = fdiv double %10, %12
  %14 = call double @llvm.floor.f64(double %13)
  %15 = fptosi double %14 to i64
  %16 = getelementptr inbounds %"class.jet::Point", ptr %0, i32 0, i32 0
  store i64 %15, ptr %16, align 8, !tbaa !26
  %17 = load ptr, ptr %6, align 8, !tbaa !5
  %18 = getelementptr inbounds %"class.jet::Vector", ptr %17, i32 0, i32 1
  %19 = load double, ptr %18, align 8, !tbaa !27
  %20 = getelementptr inbounds %"class.jet::PointHashGridSearcher2", ptr %7, i32 0, i32 1
  %21 = load double, ptr %20, align 8, !tbaa !12
  %22 = fdiv double %19, %21
  %23 = call double @llvm.floor.f64(double %22)
  %24 = fptosi double %23 to i64
  %25 = getelementptr inbounds %"class.jet::Point", ptr %0, i32 0, i32 1
  store i64 %24, ptr %25, align 8, !tbaa !28
  ret void
}

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

; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare double @llvm.floor.f64(double) #2

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 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 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }

!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 = !{!"_ZTSN3jet6VectorIdLm2EEE", !11, i64 0, !11, i64 8}
!11 = !{!"double", !7, i64 0}
!12 = !{!13, !11, i64 8}
!13 = !{!"_ZTSN3jet22PointHashGridSearcher2E", !14, i64 0, !11, i64 8, !16, i64 16, !18, i64 32, !22, i64 56}
!14 = !{!"_ZTSN3jet22PointNeighborSearcher2E", !15, i64 0}
!15 = !{!"_ZTSN3jet12SerializableE"}
!16 = !{!"_ZTSN3jet5PointIlLm2EEE", !17, i64 0, !17, i64 8}
!17 = !{!"long", !7, i64 0}
!18 = !{!"_ZTSSt6vectorIN3jet6VectorIdLm2EEESaIS2_EE", !19, i64 0}
!19 = !{!"_ZTSSt12_Vector_baseIN3jet6VectorIdLm2EEESaIS2_EE", !20, i64 0}
!20 = !{!"_ZTSNSt12_Vector_baseIN3jet6VectorIdLm2EEESaIS2_EE12_Vector_implE", !21, i64 0}
!21 = !{!"_ZTSNSt12_Vector_baseIN3jet6VectorIdLm2EEESaIS2_EE17_Vector_impl_dataE", !6, i64 0, !6, i64 8, !6, i64 16}
!22 = !{!"_ZTSSt6vectorIS_ImSaImEESaIS1_EE", !23, i64 0}
!23 = !{!"_ZTSSt12_Vector_baseISt6vectorImSaImEESaIS2_EE", !24, i64 0}
!24 = !{!"_ZTSNSt12_Vector_baseISt6vectorImSaImEESaIS2_EE12_Vector_implE", !25, i64 0}
!25 = !{!"_ZTSNSt12_Vector_baseISt6vectorImSaImEESaIS2_EE17_Vector_impl_dataE", !6, i64 0, !6, i64 8, !6, i64 16}
!26 = !{!16, !17, i64 0}
!27 = !{!10, !11, i64 8}
!28 = !{!16, !17, i64 8}


; 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.jet::Point" = type { i64, i64 }

; Function Attrs: mustprogress nounwind uwtable
define dso_local void @_ZNK3jet22PointHashGridSearcher214getBucketIndexERKNS_6VectorIdLm2EEE(ptr dead_on_unwind noalias nonnull writable sret(%"class.jet::Point") align 8 %0, ptr nocapture noundef nonnull readonly align 8 dereferenceable(80) %1, ptr nocapture noundef nonnull readonly align 8 dereferenceable(16) %2) local_unnamed_addr #0 align 2 {
  tail call void @_ZN3jet5PointIlLm2EEC2Ev(ptr noundef nonnull align 8 dereferenceable(16) %0)
  %4 = load double, ptr %2, align 8, !tbaa !5
  %5 = getelementptr inbounds i8, ptr %1, i64 8
  %6 = load double, ptr %5, align 8, !tbaa !10
  %7 = fdiv double %4, %6
  %8 = tail call double @llvm.floor.f64(double %7)
  %9 = fptosi double %8 to i64
  store i64 %9, ptr %0, align 8, !tbaa !25
  %10 = getelementptr inbounds i8, ptr %2, i64 8
  %11 = load double, ptr %10, align 8, !tbaa !26
  %12 = fdiv double %11, %6
  %13 = tail call double @llvm.floor.f64(double %12)
  %14 = fptosi double %13 to i64
  %15 = getelementptr inbounds i8, ptr %0, i64 8
  store i64 %14, ptr %15, align 8, !tbaa !27
  ret void
}

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZN3jet5PointIlLm2EEC2Ev(ptr noundef nonnull align 8 dereferenceable(16)) unnamed_addr #0 align 2

; Function Attrs: mustprogress nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare double @llvm.floor.f64(double) #1

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 = { mustprogress nocallback nofree nosync nounwind speculatable willreturn memory(none) }

!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 = !{!"_ZTSN3jet6VectorIdLm2EEE", !7, i64 0, !7, i64 8}
!7 = !{!"double", !8, i64 0}
!8 = !{!"omnipotent char", !9, i64 0}
!9 = !{!"Simple C++ TBAA"}
!10 = !{!11, !7, i64 8}
!11 = !{!"_ZTSN3jet22PointHashGridSearcher2E", !12, i64 0, !7, i64 8, !14, i64 16, !16, i64 32, !21, i64 56}
!12 = !{!"_ZTSN3jet22PointNeighborSearcher2E", !13, i64 0}
!13 = !{!"_ZTSN3jet12SerializableE"}
!14 = !{!"_ZTSN3jet5PointIlLm2EEE", !15, i64 0, !15, i64 8}
!15 = !{!"long", !8, i64 0}
!16 = !{!"_ZTSSt6vectorIN3jet6VectorIdLm2EEESaIS2_EE", !17, i64 0}
!17 = !{!"_ZTSSt12_Vector_baseIN3jet6VectorIdLm2EEESaIS2_EE", !18, i64 0}
!18 = !{!"_ZTSNSt12_Vector_baseIN3jet6VectorIdLm2EEESaIS2_EE12_Vector_implE", !19, i64 0}
!19 = !{!"_ZTSNSt12_Vector_baseIN3jet6VectorIdLm2EEESaIS2_EE17_Vector_impl_dataE", !20, i64 0, !20, i64 8, !20, i64 16}
!20 = !{!"any pointer", !8, i64 0}
!21 = !{!"_ZTSSt6vectorIS_ImSaImEESaIS1_EE", !22, i64 0}
!22 = !{!"_ZTSSt12_Vector_baseISt6vectorImSaImEESaIS2_EE", !23, i64 0}
!23 = !{!"_ZTSNSt12_Vector_baseISt6vectorImSaImEESaIS2_EE12_Vector_implE", !24, i64 0}
!24 = !{!"_ZTSNSt12_Vector_baseISt6vectorImSaImEESaIS2_EE17_Vector_impl_dataE", !20, i64 0, !20, i64 8, !20, i64 16}
!25 = !{!14, !15, i64 0}
!26 = !{!6, !7, i64 8}
!27 = !{!14, !15, i64 8}


; Effective O3 passes: EarlyCSEPass,GlobalOptPass,InferFunctionAttrsPass,InstCombinePass,PostOrderFunctionAttrsPass,SROAPass,TailCallElimPass