; LLVM IR from opset/openset :: src/customers.ll (ZN7openset2db9Customers14createCustomerEl)

; 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::Customers" = type <{ %"class.robin_hood::detail::unordered_map", %"class.std::vector", %"class.std::vector.0", i32, [4 x i8] }>
%"class.robin_hood::detail::unordered_map" = type { ptr, ptr, i64, i64, i64, i32, i32 }
%"class.std::vector" = type { %"struct.std::_Vector_base" }
%"struct.std::_Vector_base" = 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.0" = type { %"struct.std::_Vector_base.1" }
%"struct.std::_Vector_base.1" = 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 }
%"struct.openset::db::PersonData_s" = type <{ i64, i32, i32, i32, i16, ptr, [1 x i8] }>

; 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
declare dso_local noundef nonnull align 8 dereferenceable(48) ptr @_ZN7PoolMem7getPoolEv() #1 align 2

; Function Attrs: mustprogress uwtable
declare dso_local noundef ptr @_ZN7openset2db9Customers15getCustomerByIDEl(ptr noundef nonnull align 8 dereferenceable(100), i64 noundef) #1 align 2

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

; Function Attrs: mustprogress uwtable
define dso_local noundef ptr @_ZN7openset2db9Customers14createCustomerEl(ptr noundef nonnull align 8 dereferenceable(100) %0, i64 noundef %1) #1 align 2 {
  %3 = alloca ptr, align 8
  %4 = alloca ptr, align 8
  %5 = alloca i64, align 8
  %6 = alloca ptr, align 8
  %7 = alloca i8, align 1
  %8 = alloca i32, align 4
  %9 = alloca ptr, align 8
  %10 = alloca i32, align 4
  store ptr %0, ptr %4, align 8, !tbaa !5
  store i64 %1, ptr %5, align 8, !tbaa !9
  %11 = load ptr, ptr %4, align 8
  call void @llvm.lifetime.start.p0(i64 8, ptr %6) #4
  %12 = load i64, ptr %5, align 8, !tbaa !9
  %13 = call noundef ptr @_ZN7openset2db9Customers15getCustomerByIDEl(ptr noundef nonnull align 8 dereferenceable(100) %11, i64 noundef %12)
  store ptr %13, ptr %6, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 1, ptr %7) #4
  store i8 0, ptr %7, align 1, !tbaa !11
  call void @llvm.lifetime.start.p0(i64 4, ptr %8) #4
  %14 = getelementptr inbounds %"class.openset::db::Customers", ptr %11, i32 0, i32 1
  %15 = call noundef i64 @_ZNKSt6vectorIPN7openset2db12PersonData_sESaIS3_EE4sizeEv(ptr noundef nonnull align 8 dereferenceable(24) %14) #4
  %16 = trunc i64 %15 to i32
  store i32 %16, ptr %8, align 4, !tbaa !13
  %17 = load ptr, ptr %6, align 8, !tbaa !5
  %18 = icmp ne ptr %17, null
  br i1 %18, label %27, label %19

19:                                               ; preds = %2
  %20 = getelementptr inbounds %"class.openset::db::Customers", ptr %11, i32 0, i32 2
  %21 = call noundef zeroext i1 @_ZNKSt6vectorIiSaIiEE5emptyEv(ptr noundef nonnull align 8 dereferenceable(24) %20) #4
  br i1 %21, label %27, label %22

22:                                               ; preds = %19
  %23 = getelementptr inbounds %"class.openset::db::Customers", ptr %11, i32 0, i32 2
  %24 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZNSt6vectorIiSaIiEE4backEv(ptr noundef nonnull align 8 dereferenceable(24) %23) #4
  %25 = load i32, ptr %24, align 4, !tbaa !13
  store i32 %25, ptr %8, align 4, !tbaa !13
  %26 = getelementptr inbounds %"class.openset::db::Customers", ptr %11, i32 0, i32 2
  call void @_ZNSt6vectorIiSaIiEE8pop_backEv(ptr noundef nonnull align 8 dereferenceable(24) %26) #4
  store i8 1, ptr %7, align 1, !tbaa !11
  br label %27

27:                                               ; preds = %22, %19, %2
  %28 = load ptr, ptr %6, align 8, !tbaa !5
  %29 = icmp ne ptr %28, null
  br i1 %29, label %58, label %30

30:                                               ; preds = %27
  call void @llvm.lifetime.start.p0(i64 8, ptr %9) #4
  %31 = call noundef nonnull align 8 dereferenceable(48) ptr @_ZN7PoolMem7getPoolEv()
  %32 = call noundef ptr @_ZN7PoolMem6getPtrEl(ptr noundef nonnull align 8 dereferenceable(48) %31, i64 noundef 31)
  store ptr %32, ptr %9, align 8, !tbaa !5
  %33 = load i64, ptr %5, align 8, !tbaa !9
  %34 = load ptr, ptr %9, align 8, !tbaa !5
  %35 = getelementptr inbounds %"struct.openset::db::PersonData_s", ptr %34, i32 0, i32 0
  store i64 %33, ptr %35, align 1, !tbaa !15
  %36 = load i32, ptr %8, align 4, !tbaa !13
  %37 = load ptr, ptr %9, align 8, !tbaa !5
  %38 = getelementptr inbounds %"struct.openset::db::PersonData_s", ptr %37, i32 0, i32 1
  store i32 %36, ptr %38, align 1, !tbaa !18
  %39 = load ptr, ptr %9, align 8, !tbaa !5
  %40 = getelementptr inbounds %"struct.openset::db::PersonData_s", ptr %39, i32 0, i32 4
  store i16 0, ptr %40, align 1, !tbaa !19
  %41 = load ptr, ptr %9, align 8, !tbaa !5
  %42 = getelementptr inbounds %"struct.openset::db::PersonData_s", ptr %41, i32 0, i32 2
  store i32 0, ptr %42, align 1, !tbaa !20
  %43 = load ptr, ptr %9, align 8, !tbaa !5
  %44 = getelementptr inbounds %"struct.openset::db::PersonData_s", ptr %43, i32 0, i32 3
  store i32 0, ptr %44, align 1, !tbaa !21
  %45 = load ptr, ptr %9, align 8, !tbaa !5
  %46 = getelementptr inbounds %"struct.openset::db::PersonData_s", ptr %45, i32 0, i32 5
  store ptr null, ptr %46, align 1, !tbaa !22
  %47 = load i8, ptr %7, align 1, !tbaa !11, !range !23, !noundef !24
  %48 = trunc i8 %47 to i1
  br i1 %48, label %51, label %49

49:                                               ; preds = %30
  %50 = getelementptr inbounds %"class.openset::db::Customers", ptr %11, i32 0, i32 1
  call void @_ZNSt6vectorIPN7openset2db12PersonData_sESaIS3_EE9push_backERKS3_(ptr noundef nonnull align 8 dereferenceable(24) %50, ptr noundef nonnull align 8 dereferenceable(8) %9)
  br label %51

51:                                               ; preds = %49, %30
  %52 = load ptr, ptr %9, align 8, !tbaa !5
  %53 = getelementptr inbounds %"struct.openset::db::PersonData_s", ptr %52, i32 0, i32 1
  %54 = load i32, ptr %53, align 1, !tbaa !18
  %55 = getelementptr inbounds %"class.openset::db::Customers", ptr %11, i32 0, i32 0
  %56 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZN10robin_hood6detail13unordered_mapILb1ELm80EliNS_4hashIlEESt8equal_toIlEEixERKl(ptr noundef nonnull align 8 dereferenceable(48) %55, ptr noundef nonnull align 8 dereferenceable(8) %5)
  store i32 %54, ptr %56, align 4, !tbaa !13
  %57 = load ptr, ptr %9, align 8, !tbaa !5
  store ptr %57, ptr %3, align 8
  store i32 1, ptr %10, align 4
  call void @llvm.lifetime.end.p0(i64 8, ptr %9) #4
  br label %60

58:                                               ; preds = %27
  %59 = load ptr, ptr %6, align 8, !tbaa !5
  store ptr %59, ptr %3, align 8
  store i32 1, ptr %10, align 4
  br label %60

60:                                               ; preds = %58, %51
  call void @llvm.lifetime.end.p0(i64 4, ptr %8) #4
  call void @llvm.lifetime.end.p0(i64 1, ptr %7) #4
  call void @llvm.lifetime.end.p0(i64 8, ptr %6) #4
  %61 = load ptr, ptr %3, align 8
  ret ptr %61
}

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

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

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

declare noundef ptr @_ZN7PoolMem6getPtrEl(ptr noundef nonnull align 8 dereferenceable(48), i64 noundef) #3

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

; Function Attrs: mustprogress uwtable
declare dso_local noundef nonnull align 4 dereferenceable(4) ptr @_ZN10robin_hood6detail13unordered_mapILb1ELm80EliNS_4hashIlEESt8equal_toIlEEixERKl(ptr noundef nonnull align 8 dereferenceable(48), ptr noundef nonnull align 8 dereferenceable(8)) #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 = { 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 = { "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 = { 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 = !{!"long", !7, i64 0}
!11 = !{!12, !12, i64 0}
!12 = !{!"bool", !7, i64 0}
!13 = !{!14, !14, i64 0}
!14 = !{!"int", !7, i64 0}
!15 = !{!16, !10, i64 0}
!16 = !{!"_ZTSN7openset2db12PersonData_sE", !10, i64 0, !14, i64 8, !14, i64 12, !14, i64 16, !17, i64 20, !6, i64 22, !7, i64 30}
!17 = !{!"short", !7, i64 0}
!18 = !{!16, !14, i64 8}
!19 = !{!16, !17, i64 20}
!20 = !{!16, !14, i64 12}
!21 = !{!16, !14, i64 16}
!22 = !{!16, !6, i64 22}
!23 = !{i8 0, i8 2}
!24 = !{}


; 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 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 uwtable
declare dso_local noundef nonnull align 8 dereferenceable(48) ptr @_ZN7PoolMem7getPoolEv() local_unnamed_addr #1 align 2

; Function Attrs: mustprogress uwtable
declare dso_local noundef ptr @_ZN7openset2db9Customers15getCustomerByIDEl(ptr noundef nonnull align 8 dereferenceable(100), i64 noundef) local_unnamed_addr #1 align 2

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

; Function Attrs: mustprogress uwtable
define dso_local noundef ptr @_ZN7openset2db9Customers14createCustomerEl(ptr noundef nonnull align 8 dereferenceable(100) %0, i64 noundef %1) local_unnamed_addr #1 align 2 {
  %3 = alloca i64, align 8
  %4 = alloca ptr, align 8
  store i64 %1, ptr %3, align 8, !tbaa !5
  %5 = tail call noundef ptr @_ZN7openset2db9Customers15getCustomerByIDEl(ptr noundef nonnull align 8 dereferenceable(100) %0, i64 noundef %1)
  %6 = getelementptr inbounds i8, ptr %0, i64 48
  %7 = tail call noundef i64 @_ZNKSt6vectorIPN7openset2db12PersonData_sESaIS3_EE4sizeEv(ptr noundef nonnull align 8 dereferenceable(24) %6) #5
  %.not = icmp eq ptr %5, null
  br i1 %.not, label %8, label %25

8:                                                ; preds = %2
  %9 = trunc i64 %7 to i32
  %10 = getelementptr inbounds i8, ptr %0, i64 72
  %11 = tail call noundef zeroext i1 @_ZNKSt6vectorIiSaIiEE5emptyEv(ptr noundef nonnull align 8 dereferenceable(24) %10) #5
  br i1 %11, label %15, label %12

12:                                               ; preds = %8
  %13 = tail call noundef nonnull align 4 dereferenceable(4) ptr @_ZNSt6vectorIiSaIiEE4backEv(ptr noundef nonnull align 8 dereferenceable(24) %10) #5
  %14 = load i32, ptr %13, align 4, !tbaa !9
  tail call void @_ZNSt6vectorIiSaIiEE8pop_backEv(ptr noundef nonnull align 8 dereferenceable(24) %10) #5
  br label %15

15:                                               ; preds = %12, %8
  %.0.ph = phi i32 [ %14, %12 ], [ %9, %8 ]
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %4) #5
  %16 = tail call noundef nonnull align 8 dereferenceable(48) ptr @_ZN7PoolMem7getPoolEv()
  %17 = tail call noundef ptr @_ZN7PoolMem6getPtrEl(ptr noundef nonnull align 8 dereferenceable(48) %16, i64 noundef 31)
  store ptr %17, ptr %4, align 8, !tbaa !11
  store i64 %1, ptr %17, align 1, !tbaa !13
  %18 = getelementptr inbounds i8, ptr %17, i64 8
  store i32 %.0.ph, ptr %18, align 1, !tbaa !16
  %19 = getelementptr inbounds i8, ptr %17, i64 12
  tail call void @llvm.memset.p0.i64(ptr noundef nonnull align 1 dereferenceable(18) %19, i8 0, i64 18, i1 false)
  br i1 %11, label %20, label %21

20:                                               ; preds = %15
  call void @_ZNSt6vectorIPN7openset2db12PersonData_sESaIS3_EE9push_backERKS3_(ptr noundef nonnull align 8 dereferenceable(24) %6, ptr noundef nonnull align 8 dereferenceable(8) %4)
  %.pre = load ptr, ptr %4, align 8, !tbaa !11
  %.phi.trans.insert = getelementptr inbounds i8, ptr %.pre, i64 8
  %.pre13 = load i32, ptr %.phi.trans.insert, align 1, !tbaa !16
  br label %21

21:                                               ; preds = %20, %15
  %22 = phi i32 [ %.pre13, %20 ], [ %.0.ph, %15 ]
  %23 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZN10robin_hood6detail13unordered_mapILb1ELm80EliNS_4hashIlEESt8equal_toIlEEixERKl(ptr noundef nonnull align 8 dereferenceable(48) %0, ptr noundef nonnull align 8 dereferenceable(8) %3)
  store i32 %22, ptr %23, align 4, !tbaa !9
  %24 = load ptr, ptr %4, align 8, !tbaa !11
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %4) #5
  br label %25

25:                                               ; preds = %2, %21
  %.07 = phi ptr [ %24, %21 ], [ %5, %2 ]
  ret ptr %.07
}

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

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

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

declare noundef ptr @_ZN7PoolMem6getPtrEl(ptr noundef nonnull align 8 dereferenceable(48), i64 noundef) local_unnamed_addr #3

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZNSt6vectorIPN7openset2db12PersonData_sESaIS3_EE9push_backERKS3_(ptr noundef nonnull align 8 dereferenceable(24), ptr noundef nonnull align 8 dereferenceable(8)) local_unnamed_addr #1 align 2

; Function Attrs: mustprogress uwtable
declare dso_local noundef nonnull align 4 dereferenceable(4) ptr @_ZN10robin_hood6detail13unordered_mapILb1ELm80EliNS_4hashIlEESt8equal_toIlEEixERKl(ptr noundef nonnull align 8 dereferenceable(48), ptr noundef nonnull align 8 dereferenceable(8)) local_unnamed_addr #1 align 2

; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: write)
declare void @llvm.memset.p0.i64(ptr nocapture writeonly, i8, i64, i1 immarg) #4

attributes #0 = { mustprogress 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 = { "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: write) }
attributes #5 = { 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 = !{!"long", !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, !12, i64 0}
!12 = !{!"any pointer", !7, i64 0}
!13 = !{!14, !6, i64 0}
!14 = !{!"_ZTSN7openset2db12PersonData_sE", !6, i64 0, !10, i64 8, !10, i64 12, !10, i64 16, !15, i64 20, !12, i64 22, !7, i64 30}
!15 = !{!"short", !7, i64 0}
!16 = !{!14, !10, i64 8}


; Effective O3 passes: BDCEPass,EarlyCSEPass,GVNPass,GlobalOptPass,IPSCCPPass,InferFunctionAttrsPass,InstCombinePass,JumpThreadingPass,MemCpyOptPass,SROAPass,SimplifyCFGPass,TailCallElimPass