; LLVM IR from facebook/redex :: opt/outliner (ClosureAggregator)

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

%"struct.method_splitting_impl::ClosureAggregator::ClosureInfo" = type { %class.UnorderedSet, i32, i32, i32, %"struct.std::array" }
%class.UnorderedSet = type { %"class.std::unordered_set" }
%"class.std::unordered_set" = type { %"class.std::_Hashtable" }
%"class.std::_Hashtable" = 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 }
%"struct.std::array" = type { [11 x i32] }

@.str.4 = external hidden unnamed_addr constant [83 x i8], align 1
@.str.5 = external hidden unnamed_addr constant [2 x i8], align 1
@.str.7 = external hidden unnamed_addr constant [18 x i8], align 1
@__PRETTY_FUNCTION__._ZNK21method_splitting_impl17ClosureAggregator11ClosureInfo12get_priorityEv = external hidden unnamed_addr constant [85 x i8], align 1

; Function Attrs: mustprogress uwtable
declare dso_local noundef i64 @_ZNK21method_splitting_impl17ClosureAggregator11ClosureInfo32get_primary_priority_denominatorEv(ptr noundef nonnull align 8 dereferenceable(112)) #0 align 2

; Function Attrs: noreturn
declare void @_Z11assert_failPKcS0_jS0_10RedexErrorS0_z(ptr noundef, ptr noundef, i32 noundef, ptr noundef, i32 noundef, ptr noundef, ...) #1

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

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef nonnull align 4 dereferenceable(4) ptr @_ZNKSt5arrayIjLm11EEixEm(ptr noundef nonnull align 4 dereferenceable(44), i64 noundef) #3 align 2

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

; Function Attrs: mustprogress uwtable
define dso_local noundef i64 @_ZNK21method_splitting_impl17ClosureAggregator11ClosureInfo12get_priorityEv(ptr noundef nonnull align 8 dereferenceable(112) %0) #0 align 2 {
  %2 = alloca ptr, align 8
  %3 = alloca i64, align 8
  %4 = alloca i64, align 8
  %5 = alloca i64, align 8
  %6 = alloca i64, align 8
  %7 = alloca i32, align 4
  store ptr %0, ptr %2, align 8, !tbaa !5
  %8 = load ptr, ptr %2, align 8
  call void @llvm.lifetime.start.p0(i64 8, ptr %3) #5
  %9 = getelementptr inbounds %"struct.method_splitting_impl::ClosureAggregator::ClosureInfo", ptr %8, i32 0, i32 3
  %10 = load i32, ptr %9, align 8, !tbaa !9
  %11 = getelementptr inbounds %"struct.method_splitting_impl::ClosureAggregator::ClosureInfo", ptr %8, i32 0, i32 4
  %12 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZNKSt5arrayIjLm11EEixEm(ptr noundef nonnull align 4 dereferenceable(44) %11, i64 noundef 0) #5
  %13 = load i32, ptr %12, align 4, !tbaa !20
  %14 = add i32 %10, %13
  %15 = zext i32 %14 to i64
  store i64 %15, ptr %3, align 8, !tbaa !21
  call void @llvm.lifetime.start.p0(i64 8, ptr %4) #5
  %16 = call noundef i64 @_ZNK21method_splitting_impl17ClosureAggregator11ClosureInfo32get_primary_priority_denominatorEv(ptr noundef nonnull align 8 dereferenceable(112) %8)
  store i64 %16, ptr %4, align 8, !tbaa !21
  call void @llvm.lifetime.start.p0(i64 8, ptr %5) #5
  %17 = load i64, ptr %3, align 8, !tbaa !21
  %18 = shl i64 %17, 20
  %19 = load i64, ptr %4, align 8, !tbaa !21
  %20 = udiv i64 %18, %19
  store i64 %20, ptr %5, align 8, !tbaa !21
  call void @llvm.lifetime.start.p0(i64 8, ptr %6) #5
  store i64 1099511627775, ptr %6, align 8, !tbaa !21
  %21 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZSt3minImERKT_S2_S2_(ptr noundef nonnull align 8 dereferenceable(8) %5, ptr noundef nonnull align 8 dereferenceable(8) %6)
  %22 = load i64, ptr %21, align 8, !tbaa !21
  store i64 %22, ptr %5, align 8, !tbaa !21
  call void @llvm.lifetime.end.p0(i64 8, ptr %6) #5
  %23 = getelementptr inbounds %"struct.method_splitting_impl::ClosureAggregator::ClosureInfo", ptr %8, i32 0, i32 1
  %24 = load i32, ptr %23, align 8, !tbaa !22
  %25 = icmp ult i32 %24, 16777216
  br i1 %25, label %26, label %27

26:                                               ; preds = %1
  br label %29

27:                                               ; preds = %1
  call void (ptr, ptr, i32, ptr, i32, ptr, ...) @_Z11assert_failPKcS0_jS0_10RedexErrorS0_z(ptr noundef @.str.7, ptr noundef @.str.4, i32 noundef 39, ptr noundef @__PRETTY_FUNCTION__._ZNK21method_splitting_impl17ClosureAggregator11ClosureInfo12get_priorityEv, i32 noundef 2, ptr noundef @.str.5) #6
  unreachable

28:                                               ; No predecessors!
  br label %29

29:                                               ; preds = %28, %26
  call void @llvm.lifetime.start.p0(i64 4, ptr %7) #5
  %30 = getelementptr inbounds %"struct.method_splitting_impl::ClosureAggregator::ClosureInfo", ptr %8, i32 0, i32 1
  %31 = load i32, ptr %30, align 8, !tbaa !22
  %32 = sub i32 16777215, %31
  store i32 %32, ptr %7, align 4, !tbaa !20
  %33 = load i64, ptr %5, align 8, !tbaa !21
  %34 = shl i64 %33, 24
  %35 = load i32, ptr %7, align 4, !tbaa !20
  %36 = zext i32 %35 to i64
  %37 = or i64 %34, %36
  call void @llvm.lifetime.end.p0(i64 4, ptr %7) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %5) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %4) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %3) #5
  ret i64 %37
}

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef nonnull align 8 dereferenceable(8) ptr @_ZSt3minImERKT_S2_S2_(ptr noundef nonnull align 8 dereferenceable(8), ptr noundef nonnull align 8 dereferenceable(8)) #4

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 = { noreturn "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 willreturn memory(argmem: readwrite) }
attributes #3 = { 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 = { 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 #5 = { nounwind }
attributes #6 = { noreturn }

!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, !18, i64 64}
!10 = !{!"_ZTSN21method_splitting_impl17ClosureAggregator11ClosureInfoE", !11, i64 0, !18, i64 56, !18, i64 60, !18, i64 64, !19, i64 68}
!11 = !{!"_ZTS12UnorderedSetIPKN21method_splitting_impl12ReducedBlockESt4hashIS3_ESt8equal_toIS3_EE", !12, i64 0}
!12 = !{!"_ZTSSt13unordered_setIPKN21method_splitting_impl12ReducedBlockESt4hashIS3_ESt8equal_toIS3_ESaIS3_EE", !13, i64 0}
!13 = !{!"_ZTSSt10_HashtableIPKN21method_splitting_impl12ReducedBlockES3_SaIS3_ENSt8__detail9_IdentityESt8equal_toIS3_ESt4hashIS3_ENS5_18_Mod_range_hashingENS5_20_Default_ranged_hashENS5_20_Prime_rehash_policyENS5_17_Hashtable_traitsILb0ELb1ELb1EEEE", !6, i64 0, !14, i64 8, !15, i64 16, !14, i64 24, !16, i64 32, !6, i64 48}
!14 = !{!"long", !7, i64 0}
!15 = !{!"_ZTSNSt8__detail15_Hash_node_baseE", !6, i64 0}
!16 = !{!"_ZTSNSt8__detail20_Prime_rehash_policyE", !17, i64 0, !14, i64 8}
!17 = !{!"float", !7, i64 0}
!18 = !{!"int", !7, i64 0}
!19 = !{!"_ZTSSt5arrayIjLm11EE", !7, i64 0}
!20 = !{!18, !18, i64 0}
!21 = !{!14, !14, i64 0}
!22 = !{!10, !18, i64 56}


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

@.str.4 = external hidden unnamed_addr constant [83 x i8], align 1
@.str.5 = external hidden unnamed_addr constant [2 x i8], align 1
@.str.7 = external hidden unnamed_addr constant [18 x i8], align 1
@__PRETTY_FUNCTION__._ZNK21method_splitting_impl17ClosureAggregator11ClosureInfo12get_priorityEv = external hidden unnamed_addr constant [85 x i8], align 1

; Function Attrs: mustprogress uwtable
declare dso_local noundef i64 @_ZNK21method_splitting_impl17ClosureAggregator11ClosureInfo32get_primary_priority_denominatorEv(ptr noundef nonnull align 8 dereferenceable(112)) local_unnamed_addr #0 align 2

; Function Attrs: noreturn
declare void @_Z11assert_failPKcS0_jS0_10RedexErrorS0_z(ptr noundef, ptr noundef, i32 noundef, ptr noundef, i32 noundef, ptr noundef, ...) local_unnamed_addr #1

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

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef nonnull align 4 dereferenceable(4) ptr @_ZNKSt5arrayIjLm11EEixEm(ptr noundef nonnull align 4 dereferenceable(44), i64 noundef) local_unnamed_addr #3 align 2

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

; Function Attrs: mustprogress uwtable
define dso_local noundef i64 @_ZNK21method_splitting_impl17ClosureAggregator11ClosureInfo12get_priorityEv(ptr noundef nonnull align 8 dereferenceable(112) %0) local_unnamed_addr #0 align 2 {
  %2 = alloca i64, align 8
  %3 = alloca i64, align 8
  %4 = getelementptr inbounds i8, ptr %0, i64 64
  %5 = load i32, ptr %4, align 8, !tbaa !5
  %6 = getelementptr inbounds i8, ptr %0, i64 68
  %7 = tail call noundef nonnull align 4 dereferenceable(4) ptr @_ZNKSt5arrayIjLm11EEixEm(ptr noundef nonnull align 4 dereferenceable(44) %6, i64 noundef 0) #5
  %8 = load i32, ptr %7, align 4, !tbaa !19
  %9 = add i32 %8, %5
  %10 = zext i32 %9 to i64
  %11 = tail call noundef i64 @_ZNK21method_splitting_impl17ClosureAggregator11ClosureInfo32get_primary_priority_denominatorEv(ptr noundef nonnull align 8 dereferenceable(112) %0)
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %2) #5
  %12 = shl nuw nsw i64 %10, 20
  %13 = udiv i64 %12, %11
  store i64 %13, ptr %2, align 8, !tbaa !20
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %3) #5
  store i64 1099511627775, ptr %3, align 8, !tbaa !20
  %14 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZSt3minImERKT_S2_S2_(ptr noundef nonnull align 8 dereferenceable(8) %2, ptr noundef nonnull align 8 dereferenceable(8) %3)
  %15 = load i64, ptr %14, align 8, !tbaa !20
  store i64 %15, ptr %2, align 8, !tbaa !20
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %3) #5
  %16 = getelementptr inbounds i8, ptr %0, i64 56
  %17 = load i32, ptr %16, align 8, !tbaa !21
  %18 = icmp ult i32 %17, 16777216
  br i1 %18, label %20, label %19

19:                                               ; preds = %1
  call void (ptr, ptr, i32, ptr, i32, ptr, ...) @_Z11assert_failPKcS0_jS0_10RedexErrorS0_z(ptr noundef nonnull @.str.7, ptr noundef nonnull @.str.4, i32 noundef 39, ptr noundef nonnull @__PRETTY_FUNCTION__._ZNK21method_splitting_impl17ClosureAggregator11ClosureInfo12get_priorityEv, i32 noundef 2, ptr noundef nonnull @.str.5) #6
  unreachable

20:                                               ; preds = %1
  %21 = sub nuw nsw i32 16777215, %17
  %22 = shl i64 %15, 24
  %23 = zext nneg i32 %21 to i64
  %24 = or disjoint i64 %22, %23
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %2) #5
  ret i64 %24
}

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef nonnull align 8 dereferenceable(8) ptr @_ZSt3minImERKT_S2_S2_(ptr noundef nonnull align 8 dereferenceable(8), ptr noundef nonnull align 8 dereferenceable(8)) local_unnamed_addr #4

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 = { noreturn "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 nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #3 = { 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 = { 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 #5 = { nounwind }
attributes #6 = { noreturn }

!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, !17, i64 64}
!6 = !{!"_ZTSN21method_splitting_impl17ClosureAggregator11ClosureInfoE", !7, i64 0, !17, i64 56, !17, i64 60, !17, i64 64, !18, i64 68}
!7 = !{!"_ZTS12UnorderedSetIPKN21method_splitting_impl12ReducedBlockESt4hashIS3_ESt8equal_toIS3_EE", !8, i64 0}
!8 = !{!"_ZTSSt13unordered_setIPKN21method_splitting_impl12ReducedBlockESt4hashIS3_ESt8equal_toIS3_ESaIS3_EE", !9, i64 0}
!9 = !{!"_ZTSSt10_HashtableIPKN21method_splitting_impl12ReducedBlockES3_SaIS3_ENSt8__detail9_IdentityESt8equal_toIS3_ESt4hashIS3_ENS5_18_Mod_range_hashingENS5_20_Default_ranged_hashENS5_20_Prime_rehash_policyENS5_17_Hashtable_traitsILb0ELb1ELb1EEEE", !10, i64 0, !13, i64 8, !14, i64 16, !13, i64 24, !15, i64 32, !10, i64 48}
!10 = !{!"any pointer", !11, i64 0}
!11 = !{!"omnipotent char", !12, i64 0}
!12 = !{!"Simple C++ TBAA"}
!13 = !{!"long", !11, i64 0}
!14 = !{!"_ZTSNSt8__detail15_Hash_node_baseE", !10, i64 0}
!15 = !{!"_ZTSNSt8__detail20_Prime_rehash_policyE", !16, i64 0, !13, i64 8}
!16 = !{!"float", !11, i64 0}
!17 = !{!"int", !11, i64 0}
!18 = !{!"_ZTSSt5arrayIjLm11EE", !11, i64 0}
!19 = !{!17, !17, i64 0}
!20 = !{!13, !13, i64 0}
!21 = !{!6, !17, i64 56}


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