; LLVM IR from opset/openset :: src/customer.ll (ZN7openset2db8Customer8mapTableEPNS0_5TableEi)

; 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.openset::db::Customer" = type <{ %"class.openset::db::Grid", ptr, ptr, ptr, ptr, i32, [4 x i8] }>
%"class.openset::db::Grid" = type { ptr, %class.HeapStack, %"class.std::vector", ptr, %"class.std::vector.292", ptr, i64, ptr, ptr, ptr, i8, %"class.openset::db::IndexDiffing", i64, %class.HeapStack }
%"class.std::vector" = type { %"struct.std::_Vector_base" }
%"struct.std::_Vector_base" = type { %"struct.std::_Vector_base<openset::db::Col_s *, std::allocator<openset::db::Col_s *>>::_Vector_impl" }
%"struct.std::_Vector_base<openset::db::Col_s *, std::allocator<openset::db::Col_s *>>::_Vector_impl" = type { %"struct.std::_Vector_base<openset::db::Col_s *, std::allocator<openset::db::Col_s *>>::_Vector_impl_data" }
%"struct.std::_Vector_base<openset::db::Col_s *, std::allocator<openset::db::Col_s *>>::_Vector_impl_data" = type { ptr, ptr, ptr }
%"class.std::vector.292" = type { %"struct.std::_Vector_base.293" }
%"struct.std::_Vector_base.293" = type { %"struct.std::_Vector_base<long, std::allocator<long>>::_Vector_impl" }
%"struct.std::_Vector_base<long, std::allocator<long>>::_Vector_impl" = type { %"struct.std::_Vector_base<long, std::allocator<long>>::_Vector_impl_data" }
%"struct.std::_Vector_base<long, std::allocator<long>>::_Vector_impl_data" = type { ptr, ptr, ptr }
%"class.openset::db::IndexDiffing" = type { %"class.robin_hood::detail::unordered_map", %"class.robin_hood::detail::unordered_map" }
%"class.robin_hood::detail::unordered_map" = type { ptr, ptr, i64, i64, i64, i32, i32 }
%class.HeapStack = type { i64, i64, i64, i64, i64, ptr, ptr }
%"class.openset::db::TablePartitioned" = type <{ ptr, i32, [4 x i8], %"class.openset::db::Attributes", ptr, %"class.openset::db::Customers", ptr, %"class.std::unordered_map.55", %"class.std::unordered_map.55", %"class.std::unordered_map.452", %"class.std::unordered_map.466", %"class.std::vector.480", %class.CriticalSection, [3 x i8], %"struct.std::atomic.485", %"class.std::vector.487", i64, i32, [4 x i8] }>
%"class.openset::db::Attributes" = type <{ %"class.robin_hood::detail::unordered_map.436", %"class.robin_hood::detail::unordered_map.438", ptr, ptr, ptr, i32, [4 x i8] }>
%"class.robin_hood::detail::unordered_map.436" = type { ptr, ptr, i64, i64, i64, i32, i32 }
%"class.robin_hood::detail::unordered_map.438" = type { ptr, ptr, i64, i64, i64, i32, i32 }
%"class.openset::db::Customers" = type <{ %"class.robin_hood::detail::unordered_map.440", %"class.std::vector.442", %"class.std::vector.447", i32, [4 x i8] }>
%"class.robin_hood::detail::unordered_map.440" = type { ptr, ptr, i64, i64, i64, i32, i32 }
%"class.std::vector.442" = type { %"struct.std::_Vector_base.443" }
%"struct.std::_Vector_base.443" = type { %"struct.std::_Vector_base<openset::db::PersonData_s *, std::allocator<openset::db::PersonData_s *>>::_Vector_impl" }
%"struct.std::_Vector_base<openset::db::PersonData_s *, std::allocator<openset::db::PersonData_s *>>::_Vector_impl" = type { %"struct.std::_Vector_base<openset::db::PersonData_s *, std::allocator<openset::db::PersonData_s *>>::_Vector_impl_data" }
%"struct.std::_Vector_base<openset::db::PersonData_s *, std::allocator<openset::db::PersonData_s *>>::_Vector_impl_data" = type { ptr, ptr, ptr }
%"class.std::vector.447" = type { %"struct.std::_Vector_base.448" }
%"struct.std::_Vector_base.448" = type { %"struct.std::_Vector_base<int, std::allocator<int>>::_Vector_impl" }
%"struct.std::_Vector_base<int, std::allocator<int>>::_Vector_impl" = type { %"struct.std::_Vector_base<int, std::allocator<int>>::_Vector_impl_data" }
%"struct.std::_Vector_base<int, std::allocator<int>>::_Vector_impl_data" = type { ptr, ptr, ptr }
%"class.std::unordered_map.55" = type { %"class.std::_Hashtable.56" }
%"class.std::_Hashtable.56" = type { ptr, i64, %"struct.std::__detail::_Hash_node_base", i64, %"struct.std::__detail::_Prime_rehash_policy", ptr }
%"struct.std::__detail::_Hash_node_base" = type { ptr }
%"struct.std::__detail::_Prime_rehash_policy" = type { float, i64 }
%"class.std::unordered_map.452" = type { %"class.std::_Hashtable.453" }
%"class.std::_Hashtable.453" = type { ptr, i64, %"struct.std::__detail::_Hash_node_base", i64, %"struct.std::__detail::_Prime_rehash_policy", ptr }
%"class.std::unordered_map.466" = type { %"class.std::_Hashtable.467" }
%"class.std::_Hashtable.467" = type { ptr, i64, %"struct.std::__detail::_Hash_node_base", i64, %"struct.std::__detail::_Prime_rehash_policy", ptr }
%"class.std::vector.480" = type { %"struct.std::_Vector_base.481" }
%"struct.std::_Vector_base.481" = type { %"struct.std::_Vector_base<openset::db::SegmentPartitioned_s *, std::allocator<openset::db::SegmentPartitioned_s *>>::_Vector_impl" }
%"struct.std::_Vector_base<openset::db::SegmentPartitioned_s *, std::allocator<openset::db::SegmentPartitioned_s *>>::_Vector_impl" = type { %"struct.std::_Vector_base<openset::db::SegmentPartitioned_s *, std::allocator<openset::db::SegmentPartitioned_s *>>::_Vector_impl_data" }
%"struct.std::_Vector_base<openset::db::SegmentPartitioned_s *, std::allocator<openset::db::SegmentPartitioned_s *>>::_Vector_impl_data" = type { ptr, ptr, ptr }
%class.CriticalSection = type { %"struct.std::atomic" }
%"struct.std::atomic" = type { %"struct.std::__atomic_base" }
%"struct.std::__atomic_base" = type { i8 }
%"struct.std::atomic.485" = type { %"struct.std::__atomic_base.486" }
%"struct.std::__atomic_base.486" = type { i32 }
%"class.std::vector.487" = type { %"struct.std::_Vector_base.488" }
%"struct.std::_Vector_base.488" = type { %"struct.std::_Vector_base<char *, std::allocator<char *>>::_Vector_impl" }
%"struct.std::_Vector_base<char *, std::allocator<char *>>::_Vector_impl" = type { %"struct.std::_Vector_base<char *, std::allocator<char *>>::_Vector_impl_data" }
%"struct.std::_Vector_base<char *, std::allocator<char *>>::_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 zeroext i1 @_ZN7openset2db8Customer8mapTableEPNS0_5TableEi(ptr noundef nonnull align 8 dereferenceable(364) %0, ptr noundef %1, i32 noundef %2) #1 align 2 {
  %4 = alloca i1, align 1
  %5 = alloca ptr, align 8
  %6 = alloca ptr, align 8
  %7 = alloca i32, align 4
  %8 = alloca ptr, align 8
  %9 = alloca i32, align 4
  store ptr %0, ptr %5, align 8, !tbaa !5
  store ptr %1, ptr %6, align 8, !tbaa !5
  store i32 %2, ptr %7, align 4, !tbaa !9
  %10 = load ptr, ptr %5, align 8
  %11 = getelementptr inbounds %"class.openset::db::Customer", ptr %10, i32 0, i32 1
  %12 = load ptr, ptr %11, align 8, !tbaa !11
  %13 = icmp ne ptr %12, null
  br i1 %13, label %14, label %23

14:                                               ; preds = %3
  %15 = load ptr, ptr %6, align 8, !tbaa !5
  %16 = icmp ne ptr %15, null
  br i1 %16, label %17, label %23

17:                                               ; preds = %14
  %18 = getelementptr inbounds %"class.openset::db::Customer", ptr %10, i32 0, i32 1
  %19 = load ptr, ptr %18, align 8, !tbaa !11
  %20 = load ptr, ptr %6, align 8, !tbaa !5
  %21 = icmp eq ptr %19, %20
  br i1 %21, label %22, label %23

22:                                               ; preds = %17
  store i1 false, ptr %4, align 1
  br label %49

23:                                               ; preds = %17, %14, %3
  %24 = load ptr, ptr %6, align 8, !tbaa !5
  %25 = getelementptr inbounds %"class.openset::db::Customer", ptr %10, i32 0, i32 1
  store ptr %24, ptr %25, align 8, !tbaa !11
  %26 = load i32, ptr %7, align 4, !tbaa !9
  %27 = getelementptr inbounds %"class.openset::db::Customer", ptr %10, i32 0, i32 5
  store i32 %26, ptr %27, align 8, !tbaa !27
  call void @llvm.lifetime.start.p0(i64 8, ptr %8) #3
  %28 = getelementptr inbounds %"class.openset::db::Customer", ptr %10, i32 0, i32 1
  %29 = load ptr, ptr %28, align 8, !tbaa !11
  %30 = getelementptr inbounds %"class.openset::db::Customer", ptr %10, i32 0, i32 5
  %31 = load i32, ptr %30, align 8, !tbaa !27
  %32 = call noundef ptr @_ZN7openset2db5Table19getPartitionObjectsEib(ptr noundef nonnull align 8 dereferenceable(197600) %29, i32 noundef %31, i1 noundef zeroext false)
  store ptr %32, ptr %8, align 8, !tbaa !5
  %33 = load ptr, ptr %8, align 8, !tbaa !5
  %34 = icmp ne ptr %33, null
  br i1 %34, label %36, label %35

35:                                               ; preds = %23
  store i1 false, ptr %4, align 1
  store i32 1, ptr %9, align 4
  br label %48

36:                                               ; preds = %23
  %37 = load ptr, ptr %8, align 8, !tbaa !5
  %38 = getelementptr inbounds %"class.openset::db::TablePartitioned", ptr %37, i32 0, i32 3
  %39 = getelementptr inbounds %"class.openset::db::Customer", ptr %10, i32 0, i32 2
  store ptr %38, ptr %39, align 8, !tbaa !28
  %40 = load ptr, ptr %8, align 8, !tbaa !5
  %41 = getelementptr inbounds %"class.openset::db::TablePartitioned", ptr %40, i32 0, i32 5
  %42 = getelementptr inbounds %"class.openset::db::Customer", ptr %10, i32 0, i32 4
  store ptr %41, ptr %42, align 8, !tbaa !29
  %43 = getelementptr inbounds %"class.openset::db::Customer", ptr %10, i32 0, i32 2
  %44 = load ptr, ptr %43, align 8, !tbaa !28
  %45 = call noundef ptr @_ZNK7openset2db10Attributes7getBlobEv(ptr noundef nonnull align 8 dereferenceable(124) %44)
  %46 = getelementptr inbounds %"class.openset::db::Customer", ptr %10, i32 0, i32 3
  store ptr %45, ptr %46, align 8, !tbaa !30
  %47 = call noundef zeroext i1 @_ZN7openset2db8Customer12mapSchemaAllEv(ptr noundef nonnull align 8 dereferenceable(364) %10)
  store i1 true, ptr %4, align 1
  store i32 1, ptr %9, align 4
  br label %48

48:                                               ; preds = %36, %35
  call void @llvm.lifetime.end.p0(i64 8, ptr %8) #3
  br label %49

49:                                               ; preds = %48, %22
  %50 = load i1, ptr %4, align 1
  ret i1 %50
}

declare noundef ptr @_ZN7openset2db5Table19getPartitionObjectsEib(ptr noundef nonnull align 8 dereferenceable(197600), i32 noundef, i1 noundef zeroext) #2

declare noundef ptr @_ZNK7openset2db10Attributes7getBlobEv(ptr noundef nonnull align 8 dereferenceable(124)) #2

; Function Attrs: mustprogress uwtable
declare dso_local noundef zeroext i1 @_ZN7openset2db8Customer12mapSchemaAllEv(ptr noundef nonnull align 8 dereferenceable(364)) #1 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 = { "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 = !{!"int", !7, i64 0}
!11 = !{!12, !6, i64 328}
!12 = !{!"_ZTSN7openset2db8CustomerE", !13, i64 0, !6, i64 328, !6, i64 336, !6, i64 344, !6, i64 352, !10, i64 360}
!13 = !{!"_ZTSN7openset2db4GridE", !6, i64 0, !14, i64 8, !16, i64 64, !6, i64 88, !20, i64 96, !6, i64 120, !15, i64 128, !6, i64 136, !6, i64 144, !6, i64 152, !24, i64 160, !25, i64 168, !15, i64 264, !14, i64 272}
!14 = !{!"_ZTS9HeapStack", !15, i64 0, !15, i64 8, !15, i64 16, !15, i64 24, !15, i64 32, !6, i64 40, !6, i64 48}
!15 = !{!"long", !7, i64 0}
!16 = !{!"_ZTSSt6vectorIPN7openset2db5Col_sESaIS3_EE", !17, i64 0}
!17 = !{!"_ZTSSt12_Vector_baseIPN7openset2db5Col_sESaIS3_EE", !18, i64 0}
!18 = !{!"_ZTSNSt12_Vector_baseIPN7openset2db5Col_sESaIS3_EE12_Vector_implE", !19, i64 0}
!19 = !{!"_ZTSNSt12_Vector_baseIPN7openset2db5Col_sESaIS3_EE17_Vector_impl_dataE", !6, i64 0, !6, i64 8, !6, i64 16}
!20 = !{!"_ZTSSt6vectorIlSaIlEE", !21, i64 0}
!21 = !{!"_ZTSSt12_Vector_baseIlSaIlEE", !22, i64 0}
!22 = !{!"_ZTSNSt12_Vector_baseIlSaIlEE12_Vector_implE", !23, i64 0}
!23 = !{!"_ZTSNSt12_Vector_baseIlSaIlEE17_Vector_impl_dataE", !6, i64 0, !6, i64 8, !6, i64 16}
!24 = !{!"bool", !7, i64 0}
!25 = !{!"_ZTSN7openset2db12IndexDiffingE", !26, i64 0, !26, i64 48}
!26 = !{!"_ZTSN10robin_hood6detail13unordered_mapILb1ELm80ESt4pairIilEiNS_4hashIS3_EESt8equal_toIS3_EEE", !6, i64 0, !6, i64 8, !15, i64 16, !15, i64 24, !15, i64 32, !10, i64 40, !10, i64 44}
!27 = !{!12, !10, i64 360}
!28 = !{!12, !6, i64 336}
!29 = !{!12, !6, i64 352}
!30 = !{!12, !6, i64 344}


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

; Function Attrs: mustprogress uwtable
define dso_local noundef zeroext i1 @_ZN7openset2db8Customer8mapTableEPNS0_5TableEi(ptr noundef nonnull align 8 dereferenceable(364) %0, ptr noundef %1, i32 noundef %2) local_unnamed_addr #0 align 2 {
  %4 = getelementptr inbounds i8, ptr %0, i64 328
  %5 = load ptr, ptr %4, align 8, !tbaa !5
  %6 = icmp ne ptr %5, null
  %7 = icmp ne ptr %1, null
  %or.cond = and i1 %7, %6
  %8 = icmp eq ptr %5, %1
  %or.cond12 = and i1 %8, %or.cond
  br i1 %or.cond12, label %20, label %9

9:                                                ; preds = %3
  store ptr %1, ptr %4, align 8, !tbaa !5
  %10 = getelementptr inbounds i8, ptr %0, i64 360
  store i32 %2, ptr %10, align 8, !tbaa !25
  %11 = tail call noundef ptr @_ZN7openset2db5Table19getPartitionObjectsEib(ptr noundef nonnull align 8 dereferenceable(197600) %1, i32 noundef %2, i1 noundef zeroext false)
  %.not.not = icmp eq ptr %11, null
  br i1 %.not.not, label %20, label %12

12:                                               ; preds = %9
  %13 = getelementptr inbounds i8, ptr %11, i64 16
  %14 = getelementptr inbounds i8, ptr %0, i64 336
  store ptr %13, ptr %14, align 8, !tbaa !26
  %15 = getelementptr inbounds i8, ptr %11, i64 152
  %16 = getelementptr inbounds i8, ptr %0, i64 352
  store ptr %15, ptr %16, align 8, !tbaa !27
  %17 = tail call noundef ptr @_ZNK7openset2db10Attributes7getBlobEv(ptr noundef nonnull align 8 dereferenceable(124) %13)
  %18 = getelementptr inbounds i8, ptr %0, i64 344
  store ptr %17, ptr %18, align 8, !tbaa !28
  %19 = tail call noundef zeroext i1 @_ZN7openset2db8Customer12mapSchemaAllEv(ptr noundef nonnull align 8 dereferenceable(364) %0)
  br label %20

20:                                               ; preds = %12, %9, %3
  %.1 = phi i1 [ false, %3 ], [ false, %9 ], [ true, %12 ]
  ret i1 %.1
}

declare noundef ptr @_ZN7openset2db5Table19getPartitionObjectsEib(ptr noundef nonnull align 8 dereferenceable(197600), i32 noundef, i1 noundef zeroext) local_unnamed_addr #1

declare noundef ptr @_ZNK7openset2db10Attributes7getBlobEv(ptr noundef nonnull align 8 dereferenceable(124)) local_unnamed_addr #1

; Function Attrs: mustprogress uwtable
declare dso_local noundef zeroext i1 @_ZN7openset2db8Customer12mapSchemaAllEv(ptr noundef nonnull align 8 dereferenceable(364)) local_unnamed_addr #0 align 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 = { "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" }

!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, !8, i64 328}
!6 = !{!"_ZTSN7openset2db8CustomerE", !7, i64 0, !8, i64 328, !8, i64 336, !8, i64 344, !8, i64 352, !24, i64 360}
!7 = !{!"_ZTSN7openset2db4GridE", !8, i64 0, !11, i64 8, !13, i64 64, !8, i64 88, !17, i64 96, !8, i64 120, !12, i64 128, !8, i64 136, !8, i64 144, !8, i64 152, !21, i64 160, !22, i64 168, !12, i64 264, !11, i64 272}
!8 = !{!"any pointer", !9, i64 0}
!9 = !{!"omnipotent char", !10, i64 0}
!10 = !{!"Simple C++ TBAA"}
!11 = !{!"_ZTS9HeapStack", !12, i64 0, !12, i64 8, !12, i64 16, !12, i64 24, !12, i64 32, !8, i64 40, !8, i64 48}
!12 = !{!"long", !9, i64 0}
!13 = !{!"_ZTSSt6vectorIPN7openset2db5Col_sESaIS3_EE", !14, i64 0}
!14 = !{!"_ZTSSt12_Vector_baseIPN7openset2db5Col_sESaIS3_EE", !15, i64 0}
!15 = !{!"_ZTSNSt12_Vector_baseIPN7openset2db5Col_sESaIS3_EE12_Vector_implE", !16, i64 0}
!16 = !{!"_ZTSNSt12_Vector_baseIPN7openset2db5Col_sESaIS3_EE17_Vector_impl_dataE", !8, i64 0, !8, i64 8, !8, i64 16}
!17 = !{!"_ZTSSt6vectorIlSaIlEE", !18, i64 0}
!18 = !{!"_ZTSSt12_Vector_baseIlSaIlEE", !19, i64 0}
!19 = !{!"_ZTSNSt12_Vector_baseIlSaIlEE12_Vector_implE", !20, i64 0}
!20 = !{!"_ZTSNSt12_Vector_baseIlSaIlEE17_Vector_impl_dataE", !8, i64 0, !8, i64 8, !8, i64 16}
!21 = !{!"bool", !9, i64 0}
!22 = !{!"_ZTSN7openset2db12IndexDiffingE", !23, i64 0, !23, i64 48}
!23 = !{!"_ZTSN10robin_hood6detail13unordered_mapILb1ELm80ESt4pairIilEiNS_4hashIS3_EESt8equal_toIS3_EEE", !8, i64 0, !8, i64 8, !12, i64 16, !12, i64 24, !12, i64 32, !24, i64 40, !24, i64 44}
!24 = !{!"int", !9, i64 0}
!25 = !{!6, !24, i64 360}
!26 = !{!6, !8, i64 336}
!27 = !{!6, !8, i64 352}
!28 = !{!6, !8, i64 344}


; Effective O3 passes: CorrelatedValuePropagationPass,EarlyCSEPass,GlobalOptPass,InferFunctionAttrsPass,InstCombinePass,ReassociatePass,SROAPass,SimplifyCFGPass,TailCallElimPass