; LLVM IR from facebook/redex :: service/switch-partitioning (SwitchEquivFinder)

; 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.std::_Rb_tree_const_iterator.400" = type { ptr }
%"struct.std::pair.401" = type { %"class.boost::variant", ptr }
%"class.boost::variant" = type { i32, [4 x i8], %"class.boost::aligned_storage" }
%"class.boost::aligned_storage" = type { %"struct.boost::detail::aligned_storage::aligned_storage_imp" }
%"struct.boost::detail::aligned_storage::aligned_storage_imp" = type { %"union.boost::detail::aligned_storage::aligned_storage_imp<8, 8>::data_t" }
%"union.boost::detail::aligned_storage::aligned_storage_imp<8, 8>::data_t" = type { [8 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 i64 @_ZN17SwitchEquivEditor30copy_extra_loads_to_leaf_blockERK12UnorderedMapIPN3cfg5BlockESt3mapIjP13IRInstructionSt4lessIjESaISt4pairIKjS6_EEESt4hashIS3_ESt8equal_toIS3_EEPNS1_16ControlFlowGraphES3_(ptr noundef nonnull align 8 dereferenceable(56), ptr noundef, ptr noundef) #1 align 2

; Function Attrs: mustprogress uwtable
define dso_local noundef i64 @_ZN17SwitchEquivEditor31copy_extra_loads_to_leaf_blocksERK17SwitchEquivFinderPN3cfg16ControlFlowGraphE(ptr noundef nonnull align 8 dereferenceable(233) %0, ptr 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 ptr, align 8
  %8 = alloca %"struct.std::_Rb_tree_const_iterator.400", align 8
  %9 = alloca %"struct.std::_Rb_tree_const_iterator.400", align 8
  %10 = alloca ptr, align 8
  store ptr %0, ptr %3, align 8, !tbaa !5
  store ptr %1, ptr %4, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %5) #3
  store i64 0, ptr %5, align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 8, ptr %6) #3
  %11 = load ptr, ptr %3, align 8, !tbaa !5
  %12 = call noundef nonnull align 8 dereferenceable(56) ptr @_ZNK17SwitchEquivFinder11extra_loadsEv(ptr noundef nonnull align 8 dereferenceable(233) %11)
  store ptr %12, ptr %6, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %7) #3
  %13 = load ptr, ptr %3, align 8, !tbaa !5
  %14 = call noundef nonnull align 8 dereferenceable(48) ptr @_ZNK17SwitchEquivFinder11key_to_caseEv(ptr noundef nonnull align 8 dereferenceable(233) %13)
  store ptr %14, ptr %7, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %8) #3
  %15 = load ptr, ptr %7, align 8, !tbaa !5
  %16 = call ptr @_ZNKSt3mapIN5boost7variantIN17SwitchEquivFinder11DefaultCaseEJiPK7DexTypeEEEPN3cfg5BlockENS2_14key_comparatorESaISt4pairIKS7_SA_EEE5beginEv(ptr noundef nonnull align 8 dereferenceable(48) %15) #3
  %17 = getelementptr inbounds %"struct.std::_Rb_tree_const_iterator.400", ptr %8, i32 0, i32 0
  store ptr %16, ptr %17, align 8
  call void @llvm.lifetime.start.p0(i64 8, ptr %9) #3
  %18 = load ptr, ptr %7, align 8, !tbaa !5
  %19 = call ptr @_ZNKSt3mapIN5boost7variantIN17SwitchEquivFinder11DefaultCaseEJiPK7DexTypeEEEPN3cfg5BlockENS2_14key_comparatorESaISt4pairIKS7_SA_EEE3endEv(ptr noundef nonnull align 8 dereferenceable(48) %18) #3
  %20 = getelementptr inbounds %"struct.std::_Rb_tree_const_iterator.400", ptr %9, i32 0, i32 0
  store ptr %19, ptr %20, align 8
  br label %21

21:                                               ; preds = %34, %2
  %22 = call noundef zeroext i1 @_ZStneRKSt23_Rb_tree_const_iteratorISt4pairIKN5boost7variantIN17SwitchEquivFinder11DefaultCaseEJiPK7DexTypeEEEPN3cfg5BlockEEESG_(ptr noundef nonnull align 8 dereferenceable(8) %8, ptr noundef nonnull align 8 dereferenceable(8) %9) #3
  br i1 %22, label %24, label %23

23:                                               ; preds = %21
  call void @llvm.lifetime.end.p0(i64 8, ptr %9) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr %8) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr %7) #3
  br label %36

24:                                               ; preds = %21
  call void @llvm.lifetime.start.p0(i64 8, ptr %10) #3
  %25 = call noundef nonnull align 8 dereferenceable(24) ptr @_ZNKSt23_Rb_tree_const_iteratorISt4pairIKN5boost7variantIN17SwitchEquivFinder11DefaultCaseEJiPK7DexTypeEEEPN3cfg5BlockEEEdeEv(ptr noundef nonnull align 8 dereferenceable(8) %8) #3
  store ptr %25, ptr %10, align 8, !tbaa !5
  %26 = load ptr, ptr %6, align 8, !tbaa !5
  %27 = load ptr, ptr %4, align 8, !tbaa !5
  %28 = load ptr, ptr %10, align 8, !tbaa !5
  %29 = getelementptr inbounds %"struct.std::pair.401", ptr %28, i32 0, i32 1
  %30 = load ptr, ptr %29, align 8, !tbaa !11
  %31 = call noundef i64 @_ZN17SwitchEquivEditor30copy_extra_loads_to_leaf_blockERK12UnorderedMapIPN3cfg5BlockESt3mapIjP13IRInstructionSt4lessIjESaISt4pairIKjS6_EEESt4hashIS3_ESt8equal_toIS3_EEPNS1_16ControlFlowGraphES3_(ptr noundef nonnull align 8 dereferenceable(56) %26, ptr noundef %27, ptr noundef %30)
  %32 = load i64, ptr %5, align 8, !tbaa !9
  %33 = add i64 %32, %31
  store i64 %33, ptr %5, align 8, !tbaa !9
  call void @llvm.lifetime.end.p0(i64 8, ptr %10) #3
  br label %34

34:                                               ; preds = %24
  %35 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSt23_Rb_tree_const_iteratorISt4pairIKN5boost7variantIN17SwitchEquivFinder11DefaultCaseEJiPK7DexTypeEEEPN3cfg5BlockEEEppEv(ptr noundef nonnull align 8 dereferenceable(8) %8) #3
  br label %21

36:                                               ; preds = %23
  %37 = load i64, ptr %5, align 8, !tbaa !9
  call void @llvm.lifetime.end.p0(i64 8, ptr %6) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr %5) #3
  ret i64 %37
}

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef nonnull align 8 dereferenceable(56) ptr @_ZNK17SwitchEquivFinder11extra_loadsEv(ptr noundef nonnull align 8 dereferenceable(233)) #2 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef nonnull align 8 dereferenceable(48) ptr @_ZNK17SwitchEquivFinder11key_to_caseEv(ptr noundef nonnull align 8 dereferenceable(233)) #2 align 2

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

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

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

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

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef nonnull align 8 dereferenceable(8) ptr @_ZNSt23_Rb_tree_const_iteratorISt4pairIKN5boost7variantIN17SwitchEquivFinder11DefaultCaseEJiPK7DexTypeEEEPN3cfg5BlockEEEppEv(ptr noundef nonnull align 8 dereferenceable(8)) #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, !10, i64 0}
!10 = !{!"long", !7, i64 0}
!11 = !{!12, !6, i64 16}
!12 = !{!"_ZTSSt4pairIKN5boost7variantIN17SwitchEquivFinder11DefaultCaseEJiPK7DexTypeEEEPN3cfg5BlockEE", !13, i64 0, !6, i64 16}
!13 = !{!"_ZTSN5boost7variantIN17SwitchEquivFinder11DefaultCaseEJiPK7DexTypeEEE", !14, i64 0, !15, i64 8}
!14 = !{!"int", !7, i64 0}
!15 = !{!"_ZTSN5boost15aligned_storageILm8ELm8EEE", !16, i64 0}
!16 = !{!"_ZTSN5boost6detail15aligned_storage19aligned_storage_impILm8ELm8EEE", !7, i64 0}


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

%"struct.std::_Rb_tree_const_iterator.400" = type { ptr }

; 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 i64 @_ZN17SwitchEquivEditor30copy_extra_loads_to_leaf_blockERK12UnorderedMapIPN3cfg5BlockESt3mapIjP13IRInstructionSt4lessIjESaISt4pairIKjS6_EEESt4hashIS3_ESt8equal_toIS3_EEPNS1_16ControlFlowGraphES3_(ptr noundef nonnull align 8 dereferenceable(56), ptr noundef, ptr noundef) local_unnamed_addr #1 align 2

; Function Attrs: mustprogress uwtable
define dso_local noundef i64 @_ZN17SwitchEquivEditor31copy_extra_loads_to_leaf_blocksERK17SwitchEquivFinderPN3cfg16ControlFlowGraphE(ptr noundef nonnull align 8 dereferenceable(233) %0, ptr noundef %1) local_unnamed_addr #1 align 2 {
  %3 = alloca %"struct.std::_Rb_tree_const_iterator.400", align 8
  %4 = alloca %"struct.std::_Rb_tree_const_iterator.400", align 8
  %5 = tail call noundef nonnull align 8 dereferenceable(56) ptr @_ZNK17SwitchEquivFinder11extra_loadsEv(ptr noundef nonnull align 8 dereferenceable(233) %0)
  %6 = tail call noundef nonnull align 8 dereferenceable(48) ptr @_ZNK17SwitchEquivFinder11key_to_caseEv(ptr noundef nonnull align 8 dereferenceable(233) %0)
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %3) #3
  %7 = tail call ptr @_ZNKSt3mapIN5boost7variantIN17SwitchEquivFinder11DefaultCaseEJiPK7DexTypeEEEPN3cfg5BlockENS2_14key_comparatorESaISt4pairIKS7_SA_EEE5beginEv(ptr noundef nonnull align 8 dereferenceable(48) %6) #3
  store ptr %7, ptr %3, align 8
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %4) #3
  %8 = tail call ptr @_ZNKSt3mapIN5boost7variantIN17SwitchEquivFinder11DefaultCaseEJiPK7DexTypeEEEPN3cfg5BlockENS2_14key_comparatorESaISt4pairIKS7_SA_EEE3endEv(ptr noundef nonnull align 8 dereferenceable(48) %6) #3
  store ptr %8, ptr %4, align 8
  %9 = call noundef zeroext i1 @_ZStneRKSt23_Rb_tree_const_iteratorISt4pairIKN5boost7variantIN17SwitchEquivFinder11DefaultCaseEJiPK7DexTypeEEEPN3cfg5BlockEEESG_(ptr noundef nonnull align 8 dereferenceable(8) %3, ptr noundef nonnull align 8 dereferenceable(8) %4) #3
  br i1 %9, label %.lr.ph, label %._crit_edge

._crit_edge:                                      ; preds = %.lr.ph, %2
  %.0.lcssa = phi i64 [ 0, %2 ], [ %14, %.lr.ph ]
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %4) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %3) #3
  ret i64 %.0.lcssa

.lr.ph:                                           ; preds = %2, %.lr.ph
  %.08 = phi i64 [ %14, %.lr.ph ], [ 0, %2 ]
  %10 = call noundef nonnull align 8 dereferenceable(24) ptr @_ZNKSt23_Rb_tree_const_iteratorISt4pairIKN5boost7variantIN17SwitchEquivFinder11DefaultCaseEJiPK7DexTypeEEEPN3cfg5BlockEEEdeEv(ptr noundef nonnull align 8 dereferenceable(8) %3) #3
  %11 = getelementptr inbounds i8, ptr %10, i64 16
  %12 = load ptr, ptr %11, align 8, !tbaa !5
  %13 = call noundef i64 @_ZN17SwitchEquivEditor30copy_extra_loads_to_leaf_blockERK12UnorderedMapIPN3cfg5BlockESt3mapIjP13IRInstructionSt4lessIjESaISt4pairIKjS6_EEESt4hashIS3_ESt8equal_toIS3_EEPNS1_16ControlFlowGraphES3_(ptr noundef nonnull align 8 dereferenceable(56) %5, ptr noundef %1, ptr noundef %12)
  %14 = add i64 %13, %.08
  %15 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSt23_Rb_tree_const_iteratorISt4pairIKN5boost7variantIN17SwitchEquivFinder11DefaultCaseEJiPK7DexTypeEEEPN3cfg5BlockEEEppEv(ptr noundef nonnull align 8 dereferenceable(8) %3) #3
  %16 = call noundef zeroext i1 @_ZStneRKSt23_Rb_tree_const_iteratorISt4pairIKN5boost7variantIN17SwitchEquivFinder11DefaultCaseEJiPK7DexTypeEEEPN3cfg5BlockEEESG_(ptr noundef nonnull align 8 dereferenceable(8) %3, ptr noundef nonnull align 8 dereferenceable(8) %4) #3
  br i1 %16, label %.lr.ph, label %._crit_edge
}

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef nonnull align 8 dereferenceable(56) ptr @_ZNK17SwitchEquivFinder11extra_loadsEv(ptr noundef nonnull align 8 dereferenceable(233)) local_unnamed_addr #2 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef nonnull align 8 dereferenceable(48) ptr @_ZNK17SwitchEquivFinder11key_to_caseEv(ptr noundef nonnull align 8 dereferenceable(233)) local_unnamed_addr #2 align 2

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

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

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

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

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

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 = { 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, !13, i64 16}
!6 = !{!"_ZTSSt4pairIKN5boost7variantIN17SwitchEquivFinder11DefaultCaseEJiPK7DexTypeEEEPN3cfg5BlockEE", !7, i64 0, !13, i64 16}
!7 = !{!"_ZTSN5boost7variantIN17SwitchEquivFinder11DefaultCaseEJiPK7DexTypeEEE", !8, i64 0, !11, i64 8}
!8 = !{!"int", !9, i64 0}
!9 = !{!"omnipotent char", !10, i64 0}
!10 = !{!"Simple C++ TBAA"}
!11 = !{!"_ZTSN5boost15aligned_storageILm8ELm8EEE", !12, i64 0}
!12 = !{!"_ZTSN5boost6detail15aligned_storage19aligned_storage_impILm8ELm8EEE", !9, i64 0}
!13 = !{!"any pointer", !9, i64 0}


; Effective O3 passes: EarlyCSEPass,GVNPass,GlobalOptPass,InferFunctionAttrsPass,InstCombinePass,InstSimplifyPass,JumpThreadingPass,LCSSAPass,LoopRotatePass,LoopSimplifyPass,LoopUnrollPass,ReassociatePass,SROAPass,SimplifyCFGPass,TailCallElimPass