; LLVM IR from PaddlePaddle/Paddle :: paddle/fluid/distributed/ps/table/graph (graph_weighted_sampler)

; 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.std::vector" = type { %"struct.std::_Vector_base" }
%"struct.std::_Vector_base" = 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.15" = type { %"class.std::_Hashtable.16" }
%"class.std::_Hashtable.16" = 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.35" = type { %"class.std::_Hashtable.36" }
%"class.std::_Hashtable.36" = type { ptr, i64, %"struct.std::__detail::_Hash_node_base", i64, %"struct.std::__detail::_Prime_rehash_policy", ptr }
%"class.std::uniform_real_distribution" = type { %"struct.std::uniform_real_distribution<float>::param_type" }
%"struct.std::uniform_real_distribution<float>::param_type" = type { float, float }
%"class.paddle::distributed::WeightedSampler" = type { %"class.paddle::distributed::Sampler", ptr, ptr, float, i32, i32, ptr }
%"class.paddle::distributed::Sampler" = type { ptr }

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

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

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

declare i32 @__gxx_personality_v0(...)

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

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

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

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

; Function Attrs: mustprogress uwtable
define dso_local void @_ZN6paddle11distributed15WeightedSampler8sample_kEiSt10shared_ptrISt23mersenne_twister_engineImLm64ELm312ELm156ELm31ELm13043109905998158313ELm29ELm6148914691236517205ELm17ELm8202884508482404352ELm37ELm18444473444759240704ELm43ELm6364136223846793005EEE(ptr dead_on_unwind noalias writable sret(%"class.std::vector") align 8 %0, ptr noundef nonnull align 8 dereferenceable(48) %1, i32 noundef %2, ptr noundef %3) unnamed_addr #2 align 2 personality ptr @__gxx_personality_v0 {
  %5 = alloca ptr, align 8
  %6 = alloca ptr, align 8
  %7 = alloca i32, align 4
  %8 = alloca ptr, align 8
  %9 = alloca i1, align 1
  %10 = alloca ptr, align 8
  %11 = alloca i32, align 4
  %12 = alloca i32, align 4
  %13 = alloca i1, align 1
  %14 = alloca float, align 4
  %15 = alloca %"class.std::unordered_map.15", align 8
  %16 = alloca %"class.std::unordered_map.35", align 8
  %17 = alloca %"class.std::uniform_real_distribution", align 4
  %18 = alloca float, align 4
  %19 = alloca ptr, align 8
  %20 = alloca i32, align 4
  store ptr %0, ptr %5, align 8
  store ptr %1, ptr %6, align 8, !tbaa !5
  store i32 %2, ptr %7, align 4, !tbaa !9
  store ptr %3, ptr %8, align 8, !tbaa !5
  %21 = load ptr, ptr %6, align 8
  %22 = load i32, ptr %7, align 4, !tbaa !9
  %23 = getelementptr inbounds %"class.paddle::distributed::WeightedSampler", ptr %21, i32 0, i32 4
  %24 = load i32, ptr %23, align 4, !tbaa !11
  %25 = icmp sge i32 %22, %24
  br i1 %25, label %26, label %55

26:                                               ; preds = %4
  %27 = getelementptr inbounds %"class.paddle::distributed::WeightedSampler", ptr %21, i32 0, i32 4
  %28 = load i32, ptr %27, align 4, !tbaa !11
  store i32 %28, ptr %7, align 4, !tbaa !9
  store i1 false, ptr %9, align 1
  call void @_ZNSt6vectorIiSaIiEEC2Ev(ptr noundef nonnull align 8 dereferenceable(24) %0) #4
  %29 = load i32, ptr %7, align 4, !tbaa !9
  %30 = sext i32 %29 to i64
  invoke void @_ZNSt6vectorIiSaIiEE7reserveEm(ptr noundef nonnull align 8 dereferenceable(24) %0, i64 noundef %30)
          to label %31 unwind label %37

31:                                               ; preds = %26
  call void @llvm.lifetime.start.p0(i64 4, ptr %12) #4
  store i32 0, ptr %12, align 4, !tbaa !9
  br label %32

32:                                               ; preds = %43, %31
  %33 = load i32, ptr %12, align 4, !tbaa !9
  %34 = load i32, ptr %7, align 4, !tbaa !9
  %35 = icmp slt i32 %33, %34
  br i1 %35, label %41, label %36

36:                                               ; preds = %32
  call void @llvm.lifetime.end.p0(i64 4, ptr %12) #4
  br label %50

37:                                               ; preds = %26
  %38 = landingpad { ptr, i32 }
          cleanup
  %39 = extractvalue { ptr, i32 } %38, 0
  store ptr %39, ptr %10, align 8
  %40 = extractvalue { ptr, i32 } %38, 1
  store i32 %40, ptr %11, align 4
  br label %54

41:                                               ; preds = %32
  invoke void @_ZNSt6vectorIiSaIiEE9push_backERKi(ptr noundef nonnull align 8 dereferenceable(24) %0, ptr noundef nonnull align 4 dereferenceable(4) %12)
          to label %42 unwind label %46

42:                                               ; preds = %41
  br label %43

43:                                               ; preds = %42
  %44 = load i32, ptr %12, align 4, !tbaa !9
  %45 = add nsw i32 %44, 1
  store i32 %45, ptr %12, align 4, !tbaa !9
  br label %32, !llvm.loop !15

46:                                               ; preds = %41
  %47 = landingpad { ptr, i32 }
          cleanup
  %48 = extractvalue { ptr, i32 } %47, 0
  store ptr %48, ptr %10, align 8
  %49 = extractvalue { ptr, i32 } %47, 1
  store i32 %49, ptr %11, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %12) #4
  br label %54

50:                                               ; preds = %36
  store i1 true, ptr %9, align 1
  %51 = load i1, ptr %9, align 1
  br i1 %51, label %53, label %52

52:                                               ; preds = %50
  call void @_ZNSt6vectorIiSaIiEED2Ev(ptr noundef nonnull align 8 dereferenceable(24) %0) #4
  br label %53

53:                                               ; preds = %52, %50
  br label %99

54:                                               ; preds = %46, %37
  call void @_ZNSt6vectorIiSaIiEED2Ev(ptr noundef nonnull align 8 dereferenceable(24) %0) #4
  br label %100

55:                                               ; preds = %4
  store i1 false, ptr %13, align 1
  call void @_ZNSt6vectorIiSaIiEEC2Ev(ptr noundef nonnull align 8 dereferenceable(24) %0) #4
  call void @llvm.lifetime.start.p0(i64 4, ptr %14) #4
  call void @llvm.lifetime.start.p0(i64 56, ptr %15) #4
  call void @_ZNSt13unordered_mapIPN6paddle11distributed15WeightedSamplerEfSt4hashIS3_ESt8equal_toIS3_ESaISt4pairIKS3_fEEEC2Ev(ptr noundef nonnull align 8 dereferenceable(56) %15) #4
  call void @llvm.lifetime.start.p0(i64 56, ptr %16) #4
  call void @_ZNSt13unordered_mapIPN6paddle11distributed15WeightedSamplerEiSt4hashIS3_ESt8equal_toIS3_ESaISt4pairIKS3_iEEEC2Ev(ptr noundef nonnull align 8 dereferenceable(56) %16) #4
  call void @llvm.lifetime.start.p0(i64 8, ptr %17) #4
  invoke void @_ZNSt25uniform_real_distributionIfEC2Eff(ptr noundef nonnull align 4 dereferenceable(8) %17, float noundef 0.000000e+00, float noundef 1.000000e+00)
          to label %56 unwind label %77

56:                                               ; preds = %55
  br label %57

57:                                               ; preds = %76, %56
  %58 = load i32, ptr %7, align 4, !tbaa !9
  %59 = add nsw i32 %58, -1
  store i32 %59, ptr %7, align 4, !tbaa !9
  %60 = icmp ne i32 %58, 0
  br i1 %60, label %61, label %94

61:                                               ; preds = %57
  call void @llvm.lifetime.start.p0(i64 4, ptr %18) #4
  %62 = call noundef nonnull align 8 dereferenceable(2504) ptr @_ZNKSt19__shared_ptr_accessISt23mersenne_twister_engineImLm64ELm312ELm156ELm31ELm13043109905998158313ELm29ELm6148914691236517205ELm17ELm8202884508482404352ELm37ELm18444473444759240704ELm43ELm6364136223846793005EELN9__gnu_cxx12_Lock_policyE2ELb0ELb0EEdeEv(ptr noundef nonnull align 1 dereferenceable(1) %3) #4
  %63 = invoke noundef float @_ZNSt25uniform_real_distributionIfEclISt23mersenne_twister_engineImLm64ELm312ELm156ELm31ELm13043109905998158313ELm29ELm6148914691236517205ELm17ELm8202884508482404352ELm37ELm18444473444759240704ELm43ELm6364136223846793005EEEEfRT_(ptr noundef nonnull align 4 dereferenceable(8) %17, ptr noundef nonnull align 8 dereferenceable(2504) %62)
          to label %64 unwind label %81

64:                                               ; preds = %61
  store float %63, ptr %18, align 4, !tbaa !17
  %65 = getelementptr inbounds %"class.paddle::distributed::WeightedSampler", ptr %21, i32 0, i32 3
  %66 = load float, ptr %65, align 8, !tbaa !18
  call void @llvm.lifetime.start.p0(i64 8, ptr %19) #4
  store ptr %21, ptr %19, align 8, !tbaa !5
  %67 = invoke noundef nonnull align 4 dereferenceable(4) ptr @_ZNSt13unordered_mapIPN6paddle11distributed15WeightedSamplerEfSt4hashIS3_ESt8equal_toIS3_ESaISt4pairIKS3_fEEEixEOS3_(ptr noundef nonnull align 8 dereferenceable(56) %15, ptr noundef nonnull align 8 dereferenceable(8) %19)
          to label %68 unwind label %85

68:                                               ; preds = %64
  %69 = load float, ptr %67, align 4, !tbaa !17
  %70 = fsub float %66, %69
  %71 = load float, ptr %18, align 4, !tbaa !17
  %72 = fmul float %71, %70
  store float %72, ptr %18, align 4, !tbaa !17
  call void @llvm.lifetime.end.p0(i64 8, ptr %19) #4
  call void @llvm.lifetime.start.p0(i64 4, ptr %20) #4
  %73 = load float, ptr %18, align 4, !tbaa !17
  %74 = invoke noundef i32 @_ZN6paddle11distributed15WeightedSampler6sampleEfRSt13unordered_mapIPS1_fSt4hashIS3_ESt8equal_toIS3_ESaISt4pairIKS3_fEEERS2_IS3_iS5_S7_SaIS8_IS9_iEEERf(ptr noundef nonnull align 8 dereferenceable(48) %21, float noundef %73, ptr noundef nonnull align 8 dereferenceable(56) %15, ptr noundef nonnull align 8 dereferenceable(56) %16, ptr noundef nonnull align 4 dereferenceable(4) %14)
          to label %75 unwind label %89

75:                                               ; preds = %68
  store i32 %74, ptr %20, align 4, !tbaa !9
  invoke void @_ZNSt6vectorIiSaIiEE9push_backEOi(ptr noundef nonnull align 8 dereferenceable(24) %0, ptr noundef nonnull align 4 dereferenceable(4) %20)
          to label %76 unwind label %89

76:                                               ; preds = %75
  call void @llvm.lifetime.end.p0(i64 4, ptr %20) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr %18) #4
  br label %57, !llvm.loop !19

77:                                               ; preds = %55
  %78 = landingpad { ptr, i32 }
          cleanup
  %79 = extractvalue { ptr, i32 } %78, 0
  store ptr %79, ptr %10, align 8
  %80 = extractvalue { ptr, i32 } %78, 1
  store i32 %80, ptr %11, align 4
  br label %96

81:                                               ; preds = %61
  %82 = landingpad { ptr, i32 }
          cleanup
  %83 = extractvalue { ptr, i32 } %82, 0
  store ptr %83, ptr %10, align 8
  %84 = extractvalue { ptr, i32 } %82, 1
  store i32 %84, ptr %11, align 4
  br label %93

85:                                               ; preds = %64
  %86 = landingpad { ptr, i32 }
          cleanup
  %87 = extractvalue { ptr, i32 } %86, 0
  store ptr %87, ptr %10, align 8
  %88 = extractvalue { ptr, i32 } %86, 1
  store i32 %88, ptr %11, align 4
  call void @llvm.lifetime.end.p0(i64 8, ptr %19) #4
  br label %93

89:                                               ; preds = %75, %68
  %90 = landingpad { ptr, i32 }
          cleanup
  %91 = extractvalue { ptr, i32 } %90, 0
  store ptr %91, ptr %10, align 8
  %92 = extractvalue { ptr, i32 } %90, 1
  store i32 %92, ptr %11, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %20) #4
  br label %93

93:                                               ; preds = %89, %85, %81
  call void @llvm.lifetime.end.p0(i64 4, ptr %18) #4
  br label %96

94:                                               ; preds = %57
  store i1 true, ptr %13, align 1
  call void @llvm.lifetime.end.p0(i64 8, ptr %17) #4
  call void @_ZNSt13unordered_mapIPN6paddle11distributed15WeightedSamplerEiSt4hashIS3_ESt8equal_toIS3_ESaISt4pairIKS3_iEEED2Ev(ptr noundef nonnull align 8 dereferenceable(56) %16) #4
  call void @llvm.lifetime.end.p0(i64 56, ptr %16) #4
  call void @_ZNSt13unordered_mapIPN6paddle11distributed15WeightedSamplerEfSt4hashIS3_ESt8equal_toIS3_ESaISt4pairIKS3_fEEED2Ev(ptr noundef nonnull align 8 dereferenceable(56) %15) #4
  call void @llvm.lifetime.end.p0(i64 56, ptr %15) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr %14) #4
  %95 = load i1, ptr %13, align 1
  br i1 %95, label %98, label %97

96:                                               ; preds = %93, %77
  call void @llvm.lifetime.end.p0(i64 8, ptr %17) #4
  call void @_ZNSt13unordered_mapIPN6paddle11distributed15WeightedSamplerEiSt4hashIS3_ESt8equal_toIS3_ESaISt4pairIKS3_iEEED2Ev(ptr noundef nonnull align 8 dereferenceable(56) %16) #4
  call void @llvm.lifetime.end.p0(i64 56, ptr %16) #4
  call void @_ZNSt13unordered_mapIPN6paddle11distributed15WeightedSamplerEfSt4hashIS3_ESt8equal_toIS3_ESaISt4pairIKS3_fEEED2Ev(ptr noundef nonnull align 8 dereferenceable(56) %15) #4
  call void @llvm.lifetime.end.p0(i64 56, ptr %15) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr %14) #4
  call void @_ZNSt6vectorIiSaIiEED2Ev(ptr noundef nonnull align 8 dereferenceable(24) %0) #4
  br label %100

97:                                               ; preds = %94
  call void @_ZNSt6vectorIiSaIiEED2Ev(ptr noundef nonnull align 8 dereferenceable(24) %0) #4
  br label %98

98:                                               ; preds = %97, %94
  br label %99

99:                                               ; preds = %98, %53
  ret void

100:                                              ; preds = %96, %54
  %101 = load ptr, ptr %10, align 8
  %102 = load i32, ptr %11, align 4
  %103 = insertvalue { ptr, i32 } poison, ptr %101, 0
  %104 = insertvalue { ptr, i32 } %103, i32 %102, 1
  resume { ptr, i32 } %104
}

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

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

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZNSt25uniform_real_distributionIfEC2Eff(ptr noundef nonnull align 4 dereferenceable(8), float noundef, float noundef) unnamed_addr #2 align 2

; Function Attrs: mustprogress uwtable
declare dso_local noundef float @_ZNSt25uniform_real_distributionIfEclISt23mersenne_twister_engineImLm64ELm312ELm156ELm31ELm13043109905998158313ELm29ELm6148914691236517205ELm17ELm8202884508482404352ELm37ELm18444473444759240704ELm43ELm6364136223846793005EEEEfRT_(ptr noundef nonnull align 4 dereferenceable(8), ptr noundef nonnull align 8 dereferenceable(2504)) #2 align 2

; Function Attrs: mustprogress uwtable
declare dso_local noundef nonnull align 4 dereferenceable(4) ptr @_ZNSt13unordered_mapIPN6paddle11distributed15WeightedSamplerEfSt4hashIS3_ESt8equal_toIS3_ESaISt4pairIKS3_fEEEixEOS3_(ptr noundef nonnull align 8 dereferenceable(56), ptr noundef nonnull align 8 dereferenceable(8)) #2 align 2

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

; Function Attrs: mustprogress uwtable
declare dso_local noundef i32 @_ZN6paddle11distributed15WeightedSampler6sampleEfRSt13unordered_mapIPS1_fSt4hashIS3_ESt8equal_toIS3_ESaISt4pairIKS3_fEEERS2_IS3_iS5_S7_SaIS8_IS9_iEEERf(ptr noundef nonnull align 8 dereferenceable(48), float noundef, ptr noundef nonnull align 8 dereferenceable(56), ptr noundef nonnull align 8 dereferenceable(56), ptr noundef nonnull align 4 dereferenceable(4)) #2 align 2

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local void @_ZNSt13unordered_mapIPN6paddle11distributed15WeightedSamplerEiSt4hashIS3_ESt8equal_toIS3_ESaISt4pairIKS3_iEEED2Ev(ptr noundef nonnull align 8 dereferenceable(56)) unnamed_addr #3 align 2

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local void @_ZNSt13unordered_mapIPN6paddle11distributed15WeightedSamplerEfSt4hashIS3_ESt8equal_toIS3_ESaISt4pairIKS3_fEEED2Ev(ptr noundef nonnull align 8 dereferenceable(56)) unnamed_addr #3 align 2

attributes #0 = { 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 = { 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 #3 = { inlinehint 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 #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 = !{!"int", !7, i64 0}
!11 = !{!12, !10, i64 28}
!12 = !{!"_ZTSN6paddle11distributed15WeightedSamplerE", !13, i64 0, !6, i64 8, !6, i64 16, !14, i64 24, !10, i64 28, !10, i64 32, !6, i64 40}
!13 = !{!"_ZTSN6paddle11distributed7SamplerE"}
!14 = !{!"float", !7, i64 0}
!15 = distinct !{!15, !16}
!16 = !{!"llvm.loop.mustprogress"}
!17 = !{!14, !14, i64 0}
!18 = !{!12, !14, i64 24}
!19 = distinct !{!19, !16}


; 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.std::vector" = type { %"struct.std::_Vector_base" }
%"struct.std::_Vector_base" = 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.15" = type { %"class.std::_Hashtable.16" }
%"class.std::_Hashtable.16" = 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.35" = type { %"class.std::_Hashtable.36" }
%"class.std::_Hashtable.36" = type { ptr, i64, %"struct.std::__detail::_Hash_node_base", i64, %"struct.std::__detail::_Prime_rehash_policy", ptr }
%"class.std::uniform_real_distribution" = type { %"struct.std::uniform_real_distribution<float>::param_type" }
%"struct.std::uniform_real_distribution<float>::param_type" = type { float, float }

; 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 nounwind uwtable
declare dso_local void @_ZNSt6vectorIiSaIiEEC2Ev(ptr noundef nonnull align 8 dereferenceable(24)) unnamed_addr #1 align 2

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

declare i32 @__gxx_personality_v0(...)

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZNSt6vectorIiSaIiEE9push_backERKi(ptr noundef nonnull align 8 dereferenceable(24), ptr noundef nonnull align 4 dereferenceable(4)) 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) #0

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

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

; Function Attrs: mustprogress uwtable
define dso_local void @_ZN6paddle11distributed15WeightedSampler8sample_kEiSt10shared_ptrISt23mersenne_twister_engineImLm64ELm312ELm156ELm31ELm13043109905998158313ELm29ELm6148914691236517205ELm17ELm8202884508482404352ELm37ELm18444473444759240704ELm43ELm6364136223846793005EEE(ptr dead_on_unwind noalias nonnull writable sret(%"class.std::vector") align 8 %0, ptr noundef nonnull align 8 dereferenceable(48) %1, i32 noundef %2, ptr noundef %3) unnamed_addr #2 align 2 personality ptr @__gxx_personality_v0 {
  %5 = alloca i32, align 4
  %6 = alloca float, align 4
  %7 = alloca %"class.std::unordered_map.15", align 8
  %8 = alloca %"class.std::unordered_map.35", align 8
  %9 = alloca %"class.std::uniform_real_distribution", align 4
  %10 = alloca ptr, align 8
  %11 = alloca i32, align 4
  %12 = getelementptr inbounds i8, ptr %1, i64 28
  %13 = load i32, ptr %12, align 4, !tbaa !5
  %.not = icmp sgt i32 %13, %2
  tail call void @_ZNSt6vectorIiSaIiEEC2Ev(ptr noundef nonnull align 8 dereferenceable(24) %0) #4
  br i1 %.not, label %26, label %14

14:                                               ; preds = %4
  %15 = sext i32 %13 to i64
  invoke void @_ZNSt6vectorIiSaIiEE7reserveEm(ptr noundef nonnull align 8 dereferenceable(24) %0, i64 noundef %15)
          to label %16 unwind label %18

16:                                               ; preds = %14
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %5) #4
  store i32 0, ptr %5, align 4, !tbaa !13
  %17 = icmp sgt i32 %13, 0
  br i1 %17, label %.lr.ph, label %._crit_edge

._crit_edge:                                      ; preds = %20, %16
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %5) #4
  br label %51

18:                                               ; preds = %14
  %19 = landingpad { ptr, i32 }
          cleanup
  br label %52

.lr.ph:                                           ; preds = %16, %20
  invoke void @_ZNSt6vectorIiSaIiEE9push_backERKi(ptr noundef nonnull align 8 dereferenceable(24) %0, ptr noundef nonnull align 4 dereferenceable(4) %5)
          to label %20 unwind label %24

20:                                               ; preds = %.lr.ph
  %21 = load i32, ptr %5, align 4, !tbaa !13
  %22 = add nsw i32 %21, 1
  store i32 %22, ptr %5, align 4, !tbaa !13
  %23 = icmp slt i32 %22, %13
  br i1 %23, label %.lr.ph, label %._crit_edge, !llvm.loop !14

24:                                               ; preds = %.lr.ph
  %25 = landingpad { ptr, i32 }
          cleanup
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %5) #4
  br label %52

26:                                               ; preds = %4
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %6) #4
  call void @llvm.lifetime.start.p0(i64 56, ptr nonnull %7) #4
  call void @_ZNSt13unordered_mapIPN6paddle11distributed15WeightedSamplerEfSt4hashIS3_ESt8equal_toIS3_ESaISt4pairIKS3_fEEEC2Ev(ptr noundef nonnull align 8 dereferenceable(56) %7) #4
  call void @llvm.lifetime.start.p0(i64 56, ptr nonnull %8) #4
  call void @_ZNSt13unordered_mapIPN6paddle11distributed15WeightedSamplerEiSt4hashIS3_ESt8equal_toIS3_ESaISt4pairIKS3_iEEEC2Ev(ptr noundef nonnull align 8 dereferenceable(56) %8) #4
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %9) #4
  invoke void @_ZNSt25uniform_real_distributionIfEC2Eff(ptr noundef nonnull align 4 dereferenceable(8) %9, float noundef 0.000000e+00, float noundef 1.000000e+00)
          to label %.preheader unwind label %42

.preheader:                                       ; preds = %26
  %.not1723 = icmp eq i32 %2, 0
  br i1 %.not1723, label %._crit_edge25, label %.lr.ph24

.lr.ph24:                                         ; preds = %.preheader
  %27 = getelementptr inbounds i8, ptr %1, i64 24
  br label %28

28:                                               ; preds = %.lr.ph24, %41
  %.in = phi i32 [ %2, %.lr.ph24 ], [ %29, %41 ]
  %29 = add nsw i32 %.in, -1
  %30 = call noundef nonnull align 8 dereferenceable(2504) ptr @_ZNKSt19__shared_ptr_accessISt23mersenne_twister_engineImLm64ELm312ELm156ELm31ELm13043109905998158313ELm29ELm6148914691236517205ELm17ELm8202884508482404352ELm37ELm18444473444759240704ELm43ELm6364136223846793005EELN9__gnu_cxx12_Lock_policyE2ELb0ELb0EEdeEv(ptr noundef nonnull align 1 dereferenceable(1) %3) #4
  %31 = invoke noundef float @_ZNSt25uniform_real_distributionIfEclISt23mersenne_twister_engineImLm64ELm312ELm156ELm31ELm13043109905998158313ELm29ELm6148914691236517205ELm17ELm8202884508482404352ELm37ELm18444473444759240704ELm43ELm6364136223846793005EEEEfRT_(ptr noundef nonnull align 4 dereferenceable(8) %9, ptr noundef nonnull align 8 dereferenceable(2504) %30)
          to label %32 unwind label %44

32:                                               ; preds = %28
  %33 = load float, ptr %27, align 8, !tbaa !16
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %10) #4
  store ptr %1, ptr %10, align 8, !tbaa !17
  %34 = invoke noundef nonnull align 4 dereferenceable(4) ptr @_ZNSt13unordered_mapIPN6paddle11distributed15WeightedSamplerEfSt4hashIS3_ESt8equal_toIS3_ESaISt4pairIKS3_fEEEixEOS3_(ptr noundef nonnull align 8 dereferenceable(56) %7, ptr noundef nonnull align 8 dereferenceable(8) %10)
          to label %35 unwind label %46

35:                                               ; preds = %32
  %36 = load float, ptr %34, align 4, !tbaa !18
  %37 = fsub float %33, %36
  %38 = fmul float %31, %37
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %10) #4
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %11) #4
  %39 = invoke noundef i32 @_ZN6paddle11distributed15WeightedSampler6sampleEfRSt13unordered_mapIPS1_fSt4hashIS3_ESt8equal_toIS3_ESaISt4pairIKS3_fEEERS2_IS3_iS5_S7_SaIS8_IS9_iEEERf(ptr noundef nonnull align 8 dereferenceable(48) %1, float noundef %38, ptr noundef nonnull align 8 dereferenceable(56) %7, ptr noundef nonnull align 8 dereferenceable(56) %8, ptr noundef nonnull align 4 dereferenceable(4) %6)
          to label %40 unwind label %48

40:                                               ; preds = %35
  store i32 %39, ptr %11, align 4, !tbaa !13
  invoke void @_ZNSt6vectorIiSaIiEE9push_backEOi(ptr noundef nonnull align 8 dereferenceable(24) %0, ptr noundef nonnull align 4 dereferenceable(4) %11)
          to label %41 unwind label %48

41:                                               ; preds = %40
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %11) #4
  %.not17 = icmp eq i32 %29, 0
  br i1 %.not17, label %._crit_edge25, label %28, !llvm.loop !19

42:                                               ; preds = %26
  %43 = landingpad { ptr, i32 }
          cleanup
  br label %50

44:                                               ; preds = %28
  %45 = landingpad { ptr, i32 }
          cleanup
  br label %50

46:                                               ; preds = %32
  %47 = landingpad { ptr, i32 }
          cleanup
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %10) #4
  br label %50

48:                                               ; preds = %40, %35
  %49 = landingpad { ptr, i32 }
          cleanup
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %11) #4
  br label %50

._crit_edge25:                                    ; preds = %41, %.preheader
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %9) #4
  call void @_ZNSt13unordered_mapIPN6paddle11distributed15WeightedSamplerEiSt4hashIS3_ESt8equal_toIS3_ESaISt4pairIKS3_iEEED2Ev(ptr noundef nonnull align 8 dereferenceable(56) %8) #4
  call void @llvm.lifetime.end.p0(i64 56, ptr nonnull %8) #4
  call void @_ZNSt13unordered_mapIPN6paddle11distributed15WeightedSamplerEfSt4hashIS3_ESt8equal_toIS3_ESaISt4pairIKS3_fEEED2Ev(ptr noundef nonnull align 8 dereferenceable(56) %7) #4
  call void @llvm.lifetime.end.p0(i64 56, ptr nonnull %7) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %6) #4
  br label %51

50:                                               ; preds = %44, %46, %48, %42
  %.pn.pn = phi { ptr, i32 } [ %43, %42 ], [ %49, %48 ], [ %47, %46 ], [ %45, %44 ]
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %9) #4
  call void @_ZNSt13unordered_mapIPN6paddle11distributed15WeightedSamplerEiSt4hashIS3_ESt8equal_toIS3_ESaISt4pairIKS3_iEEED2Ev(ptr noundef nonnull align 8 dereferenceable(56) %8) #4
  call void @llvm.lifetime.end.p0(i64 56, ptr nonnull %8) #4
  call void @_ZNSt13unordered_mapIPN6paddle11distributed15WeightedSamplerEfSt4hashIS3_ESt8equal_toIS3_ESaISt4pairIKS3_fEEED2Ev(ptr noundef nonnull align 8 dereferenceable(56) %7) #4
  call void @llvm.lifetime.end.p0(i64 56, ptr nonnull %7) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %6) #4
  br label %52

51:                                               ; preds = %._crit_edge25, %._crit_edge
  ret void

52:                                               ; preds = %18, %24, %50
  %.pn20.pn = phi { ptr, i32 } [ %.pn.pn, %50 ], [ %25, %24 ], [ %19, %18 ]
  call void @_ZNSt6vectorIiSaIiEED2Ev(ptr noundef nonnull align 8 dereferenceable(24) %0) #4
  resume { ptr, i32 } %.pn20.pn
}

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

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

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZNSt25uniform_real_distributionIfEC2Eff(ptr noundef nonnull align 4 dereferenceable(8), float noundef, float noundef) unnamed_addr #2 align 2

; Function Attrs: mustprogress uwtable
declare dso_local noundef float @_ZNSt25uniform_real_distributionIfEclISt23mersenne_twister_engineImLm64ELm312ELm156ELm31ELm13043109905998158313ELm29ELm6148914691236517205ELm17ELm8202884508482404352ELm37ELm18444473444759240704ELm43ELm6364136223846793005EEEEfRT_(ptr noundef nonnull align 4 dereferenceable(8), ptr noundef nonnull align 8 dereferenceable(2504)) local_unnamed_addr #2 align 2

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

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

; Function Attrs: mustprogress uwtable
declare dso_local noundef i32 @_ZN6paddle11distributed15WeightedSampler6sampleEfRSt13unordered_mapIPS1_fSt4hashIS3_ESt8equal_toIS3_ESaISt4pairIKS3_fEEERS2_IS3_iS5_S7_SaIS8_IS9_iEEERf(ptr noundef nonnull align 8 dereferenceable(48), float noundef, ptr noundef nonnull align 8 dereferenceable(56), ptr noundef nonnull align 8 dereferenceable(56), ptr noundef nonnull align 4 dereferenceable(4)) local_unnamed_addr #2 align 2

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local void @_ZNSt13unordered_mapIPN6paddle11distributed15WeightedSamplerEiSt4hashIS3_ESt8equal_toIS3_ESaISt4pairIKS3_iEEED2Ev(ptr noundef nonnull align 8 dereferenceable(56)) unnamed_addr #3 align 2

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local void @_ZNSt13unordered_mapIPN6paddle11distributed15WeightedSamplerEfSt4hashIS3_ESt8equal_toIS3_ESaISt4pairIKS3_fEEED2Ev(ptr noundef nonnull align 8 dereferenceable(56)) unnamed_addr #3 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 = { 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 #3 = { inlinehint 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 #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, !12, i64 28}
!6 = !{!"_ZTSN6paddle11distributed15WeightedSamplerE", !7, i64 0, !8, i64 8, !8, i64 16, !11, i64 24, !12, i64 28, !12, i64 32, !8, i64 40}
!7 = !{!"_ZTSN6paddle11distributed7SamplerE"}
!8 = !{!"any pointer", !9, i64 0}
!9 = !{!"omnipotent char", !10, i64 0}
!10 = !{!"Simple C++ TBAA"}
!11 = !{!"float", !9, i64 0}
!12 = !{!"int", !9, i64 0}
!13 = !{!12, !12, i64 0}
!14 = distinct !{!14, !15}
!15 = !{!"llvm.loop.mustprogress"}
!16 = !{!6, !11, i64 24}
!17 = !{!8, !8, i64 0}
!18 = !{!11, !11, i64 0}
!19 = distinct !{!19, !15}


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