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

; 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, i64 }
%"class.jet::PointHashGridSearcher3" = type { %"class.jet::PointNeighborSearcher3", double, %"class.jet::Point", %"class.std::vector", %"class.std::vector.0" }
%"class.jet::PointNeighborSearcher3" = 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, 3>, std::allocator<jet::Vector<double, 3>>>::_Vector_impl" }
%"struct.std::_Vector_base<jet::Vector<double, 3>, std::allocator<jet::Vector<double, 3>>>::_Vector_impl" = type { %"struct.std::_Vector_base<jet::Vector<double, 3>, std::allocator<jet::Vector<double, 3>>>::_Vector_impl_data" }
%"struct.std::_Vector_base<jet::Vector<double, 3>, std::allocator<jet::Vector<double, 3>>>::_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: 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 uwtable
define dso_local noundef i64 @_ZNK3jet22PointHashGridSearcher325getHashKeyFromBucketIndexERKNS_5PointIlLm3EEE(ptr noundef nonnull align 8 dereferenceable(88) %0, ptr noundef nonnull align 8 dereferenceable(24) %1) #1 align 2 {
  %3 = alloca ptr, align 8
  %4 = alloca ptr, align 8
  %5 = alloca %"class.jet::Point", align 8
  store ptr %0, ptr %3, align 8, !tbaa !5
  store ptr %1, ptr %4, align 8, !tbaa !5
  %6 = load ptr, ptr %3, align 8
  call void @llvm.lifetime.start.p0(i64 24, ptr %5) #3
  %7 = load ptr, ptr %4, align 8, !tbaa !5
  call void @_ZN3jet5PointIlLm3EEC2ERKS1_(ptr noundef nonnull align 8 dereferenceable(24) %5, ptr noundef nonnull align 8 dereferenceable(24) %7)
  %8 = load ptr, ptr %4, align 8, !tbaa !5
  %9 = getelementptr inbounds %"class.jet::Point", ptr %8, i32 0, i32 0
  %10 = load i64, ptr %9, align 8, !tbaa !9
  %11 = getelementptr inbounds %"class.jet::PointHashGridSearcher3", ptr %6, i32 0, i32 2
  %12 = getelementptr inbounds %"class.jet::Point", ptr %11, i32 0, i32 0
  %13 = load i64, ptr %12, align 8, !tbaa !12
  %14 = srem i64 %10, %13
  %15 = getelementptr inbounds %"class.jet::Point", ptr %5, i32 0, i32 0
  store i64 %14, ptr %15, align 8, !tbaa !9
  %16 = load ptr, ptr %4, align 8, !tbaa !5
  %17 = getelementptr inbounds %"class.jet::Point", ptr %16, i32 0, i32 1
  %18 = load i64, ptr %17, align 8, !tbaa !25
  %19 = getelementptr inbounds %"class.jet::PointHashGridSearcher3", ptr %6, i32 0, i32 2
  %20 = getelementptr inbounds %"class.jet::Point", ptr %19, i32 0, i32 1
  %21 = load i64, ptr %20, align 8, !tbaa !26
  %22 = srem i64 %18, %21
  %23 = getelementptr inbounds %"class.jet::Point", ptr %5, i32 0, i32 1
  store i64 %22, ptr %23, align 8, !tbaa !25
  %24 = load ptr, ptr %4, align 8, !tbaa !5
  %25 = getelementptr inbounds %"class.jet::Point", ptr %24, i32 0, i32 2
  %26 = load i64, ptr %25, align 8, !tbaa !27
  %27 = getelementptr inbounds %"class.jet::PointHashGridSearcher3", ptr %6, i32 0, i32 2
  %28 = getelementptr inbounds %"class.jet::Point", ptr %27, i32 0, i32 2
  %29 = load i64, ptr %28, align 8, !tbaa !28
  %30 = srem i64 %26, %29
  %31 = getelementptr inbounds %"class.jet::Point", ptr %5, i32 0, i32 2
  store i64 %30, ptr %31, align 8, !tbaa !27
  %32 = getelementptr inbounds %"class.jet::Point", ptr %5, i32 0, i32 0
  %33 = load i64, ptr %32, align 8, !tbaa !9
  %34 = icmp slt i64 %33, 0
  br i1 %34, label %35, label %42

35:                                               ; preds = %2
  %36 = getelementptr inbounds %"class.jet::PointHashGridSearcher3", ptr %6, i32 0, i32 2
  %37 = getelementptr inbounds %"class.jet::Point", ptr %36, i32 0, i32 0
  %38 = load i64, ptr %37, align 8, !tbaa !12
  %39 = getelementptr inbounds %"class.jet::Point", ptr %5, i32 0, i32 0
  %40 = load i64, ptr %39, align 8, !tbaa !9
  %41 = add nsw i64 %40, %38
  store i64 %41, ptr %39, align 8, !tbaa !9
  br label %42

42:                                               ; preds = %35, %2
  %43 = getelementptr inbounds %"class.jet::Point", ptr %5, i32 0, i32 1
  %44 = load i64, ptr %43, align 8, !tbaa !25
  %45 = icmp slt i64 %44, 0
  br i1 %45, label %46, label %53

46:                                               ; preds = %42
  %47 = getelementptr inbounds %"class.jet::PointHashGridSearcher3", ptr %6, i32 0, i32 2
  %48 = getelementptr inbounds %"class.jet::Point", ptr %47, i32 0, i32 1
  %49 = load i64, ptr %48, align 8, !tbaa !26
  %50 = getelementptr inbounds %"class.jet::Point", ptr %5, i32 0, i32 1
  %51 = load i64, ptr %50, align 8, !tbaa !25
  %52 = add nsw i64 %51, %49
  store i64 %52, ptr %50, align 8, !tbaa !25
  br label %53

53:                                               ; preds = %46, %42
  %54 = getelementptr inbounds %"class.jet::Point", ptr %5, i32 0, i32 2
  %55 = load i64, ptr %54, align 8, !tbaa !27
  %56 = icmp slt i64 %55, 0
  br i1 %56, label %57, label %64

57:                                               ; preds = %53
  %58 = getelementptr inbounds %"class.jet::PointHashGridSearcher3", ptr %6, i32 0, i32 2
  %59 = getelementptr inbounds %"class.jet::Point", ptr %58, i32 0, i32 2
  %60 = load i64, ptr %59, align 8, !tbaa !28
  %61 = getelementptr inbounds %"class.jet::Point", ptr %5, i32 0, i32 2
  %62 = load i64, ptr %61, align 8, !tbaa !27
  %63 = add nsw i64 %62, %60
  store i64 %63, ptr %61, align 8, !tbaa !27
  br label %64

64:                                               ; preds = %57, %53
  %65 = getelementptr inbounds %"class.jet::Point", ptr %5, i32 0, i32 2
  %66 = load i64, ptr %65, align 8, !tbaa !27
  %67 = getelementptr inbounds %"class.jet::PointHashGridSearcher3", ptr %6, i32 0, i32 2
  %68 = getelementptr inbounds %"class.jet::Point", ptr %67, i32 0, i32 1
  %69 = load i64, ptr %68, align 8, !tbaa !26
  %70 = mul nsw i64 %66, %69
  %71 = getelementptr inbounds %"class.jet::Point", ptr %5, i32 0, i32 1
  %72 = load i64, ptr %71, align 8, !tbaa !25
  %73 = add nsw i64 %70, %72
  %74 = getelementptr inbounds %"class.jet::PointHashGridSearcher3", ptr %6, i32 0, i32 2
  %75 = getelementptr inbounds %"class.jet::Point", ptr %74, i32 0, i32 0
  %76 = load i64, ptr %75, align 8, !tbaa !12
  %77 = mul nsw i64 %73, %76
  %78 = getelementptr inbounds %"class.jet::Point", ptr %5, i32 0, i32 0
  %79 = load i64, ptr %78, align 8, !tbaa !9
  %80 = add nsw i64 %77, %79
  call void @llvm.lifetime.end.p0(i64 24, ptr %5) #3
  ret i64 %80
}

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZN3jet5PointIlLm3EEC2ERKS1_(ptr noundef nonnull align 8 dereferenceable(24), ptr noundef nonnull align 8 dereferenceable(24)) unnamed_addr #2 align 2

attributes #0 = { 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 = !{!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 = !{!"_ZTSN3jet5PointIlLm3EEE", !11, i64 0, !11, i64 8, !11, i64 16}
!11 = !{!"long", !7, i64 0}
!12 = !{!13, !11, i64 16}
!13 = !{!"_ZTSN3jet22PointHashGridSearcher3E", !14, i64 0, !16, i64 8, !10, i64 16, !17, i64 40, !21, i64 64}
!14 = !{!"_ZTSN3jet22PointNeighborSearcher3E", !15, i64 0}
!15 = !{!"_ZTSN3jet12SerializableE"}
!16 = !{!"double", !7, i64 0}
!17 = !{!"_ZTSSt6vectorIN3jet6VectorIdLm3EEESaIS2_EE", !18, i64 0}
!18 = !{!"_ZTSSt12_Vector_baseIN3jet6VectorIdLm3EEESaIS2_EE", !19, i64 0}
!19 = !{!"_ZTSNSt12_Vector_baseIN3jet6VectorIdLm3EEESaIS2_EE12_Vector_implE", !20, i64 0}
!20 = !{!"_ZTSNSt12_Vector_baseIN3jet6VectorIdLm3EEESaIS2_EE17_Vector_impl_dataE", !6, i64 0, !6, i64 8, !6, i64 16}
!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", !6, i64 0, !6, i64 8, !6, i64 16}
!25 = !{!10, !11, i64 8}
!26 = !{!13, !11, i64 24}
!27 = !{!10, !11, i64 16}
!28 = !{!13, !11, i64 32}


; 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, i64 }

; 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 nounwind uwtable
define dso_local noundef i64 @_ZNK3jet22PointHashGridSearcher325getHashKeyFromBucketIndexERKNS_5PointIlLm3EEE(ptr nocapture noundef nonnull readonly align 8 dereferenceable(88) %0, ptr noundef nonnull align 8 dereferenceable(24) %1) local_unnamed_addr #1 align 2 {
  %3 = alloca %"class.jet::Point", align 8
  call void @llvm.lifetime.start.p0(i64 24, ptr nonnull %3) #2
  call void @_ZN3jet5PointIlLm3EEC2ERKS1_(ptr noundef nonnull align 8 dereferenceable(24) %3, ptr noundef nonnull align 8 dereferenceable(24) %1)
  %4 = load i64, ptr %1, align 8, !tbaa !5
  %5 = getelementptr inbounds i8, ptr %0, i64 16
  %6 = load i64, ptr %5, align 8, !tbaa !10
  %7 = srem i64 %4, %6
  %8 = getelementptr inbounds i8, ptr %1, i64 8
  %9 = load i64, ptr %8, align 8, !tbaa !24
  %10 = getelementptr inbounds i8, ptr %0, i64 24
  %11 = load i64, ptr %10, align 8, !tbaa !25
  %12 = srem i64 %9, %11
  %13 = getelementptr inbounds i8, ptr %1, i64 16
  %14 = load i64, ptr %13, align 8, !tbaa !26
  %15 = getelementptr inbounds i8, ptr %0, i64 32
  %16 = load i64, ptr %15, align 8, !tbaa !27
  %17 = srem i64 %14, %16
  %18 = icmp slt i64 %7, 0
  %19 = select i1 %18, i64 %6, i64 0
  %spec.select = add nsw i64 %7, %19
  %20 = icmp slt i64 %12, 0
  %21 = select i1 %20, i64 %11, i64 0
  %22 = add nsw i64 %12, %21
  %23 = icmp slt i64 %17, 0
  %24 = select i1 %23, i64 %16, i64 0
  %25 = add nsw i64 %17, %24
  %26 = mul nsw i64 %25, %11
  %27 = add nsw i64 %26, %22
  %28 = mul nsw i64 %27, %6
  %29 = add nsw i64 %28, %spec.select
  call void @llvm.lifetime.end.p0(i64 24, ptr nonnull %3) #2
  ret i64 %29
}

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZN3jet5PointIlLm3EEC2ERKS1_(ptr noundef nonnull align 8 dereferenceable(24), ptr noundef nonnull align 8 dereferenceable(24)) unnamed_addr #1 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 = { 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 = !{!"_ZTSN3jet5PointIlLm3EEE", !7, i64 0, !7, i64 8, !7, i64 16}
!7 = !{!"long", !8, i64 0}
!8 = !{!"omnipotent char", !9, i64 0}
!9 = !{!"Simple C++ TBAA"}
!10 = !{!11, !7, i64 16}
!11 = !{!"_ZTSN3jet22PointHashGridSearcher3E", !12, i64 0, !14, i64 8, !6, i64 16, !15, i64 40, !20, i64 64}
!12 = !{!"_ZTSN3jet22PointNeighborSearcher3E", !13, i64 0}
!13 = !{!"_ZTSN3jet12SerializableE"}
!14 = !{!"double", !8, i64 0}
!15 = !{!"_ZTSSt6vectorIN3jet6VectorIdLm3EEESaIS2_EE", !16, i64 0}
!16 = !{!"_ZTSSt12_Vector_baseIN3jet6VectorIdLm3EEESaIS2_EE", !17, i64 0}
!17 = !{!"_ZTSNSt12_Vector_baseIN3jet6VectorIdLm3EEESaIS2_EE12_Vector_implE", !18, i64 0}
!18 = !{!"_ZTSNSt12_Vector_baseIN3jet6VectorIdLm3EEESaIS2_EE17_Vector_impl_dataE", !19, i64 0, !19, i64 8, !19, i64 16}
!19 = !{!"any pointer", !8, i64 0}
!20 = !{!"_ZTSSt6vectorIS_ImSaImEESaIS1_EE", !21, i64 0}
!21 = !{!"_ZTSSt12_Vector_baseISt6vectorImSaImEESaIS2_EE", !22, i64 0}
!22 = !{!"_ZTSNSt12_Vector_baseISt6vectorImSaImEESaIS2_EE12_Vector_implE", !23, i64 0}
!23 = !{!"_ZTSNSt12_Vector_baseISt6vectorImSaImEESaIS2_EE17_Vector_impl_dataE", !19, i64 0, !19, i64 8, !19, i64 16}
!24 = !{!6, !7, i64 8}
!25 = !{!11, !7, i64 24}
!26 = !{!6, !7, i64 16}
!27 = !{!11, !7, i64 32}


; Effective O3 passes: DSEPass,EarlyCSEPass,GVNPass,GlobalOptPass,InferFunctionAttrsPass,InstCombinePass,PostOrderFunctionAttrsPass,SROAPass,SimplifyCFGPass