; LLVM IR from facebook/redex :: service/cse (CommonSubexpressionElimination)

; 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.UnorderedMap<const DexMethodRef *, const DexMethodRef *>::ConstUnorderedIterable" = type { ptr }
%"struct.std::__detail::_Node_const_iterator.257" = type { %"struct.std::__detail::_Node_iterator_base.152" }
%"struct.std::__detail::_Node_iterator_base.152" = type { ptr }
%"struct.std::pair.258" = type { 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
declare dso_local noundef ptr @_ZNK13IRInstruction10get_methodEv(ptr noundef nonnull align 8 dereferenceable(32)) #1 align 2

; Function Attrs: mustprogress uwtable
define dso_local noundef zeroext i1 @_ZNK8cse_impl11SharedState29has_potential_unboxing_methodEPK13IRInstruction(ptr noundef nonnull align 8 dereferenceable(520) %0, ptr noundef %1) #1 align 2 {
  %3 = alloca i1, align 1
  %4 = alloca ptr, align 8
  %5 = alloca ptr, align 8
  %6 = alloca ptr, align 8
  %7 = alloca ptr, align 8
  %8 = alloca %"class.UnorderedMap<const DexMethodRef *, const DexMethodRef *>::ConstUnorderedIterable", align 8
  %9 = alloca %"struct.std::__detail::_Node_const_iterator.257", align 8
  %10 = alloca %"struct.std::__detail::_Node_const_iterator.257", align 8
  %11 = alloca i32, align 4
  %12 = alloca ptr, align 8
  %13 = alloca ptr, align 8
  store ptr %0, ptr %4, align 8, !tbaa !5
  store ptr %1, ptr %5, align 8, !tbaa !5
  %14 = load ptr, ptr %4, align 8
  call void @llvm.lifetime.start.p0(i64 8, ptr %6) #3
  %15 = load ptr, ptr %5, align 8, !tbaa !5
  %16 = call noundef ptr @_ZNK13IRInstruction10get_methodEv(ptr noundef nonnull align 8 dereferenceable(32) %15)
  store ptr %16, ptr %6, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %7) #3
  call void @llvm.lifetime.start.p0(i64 8, ptr %8) #3
  %17 = call noundef nonnull align 8 dereferenceable(56) ptr @_ZNK8cse_impl11SharedState16get_abstract_mapEv(ptr noundef nonnull align 8 dereferenceable(520) %14)
  %18 = call ptr @_Z17UnorderedIterableI12UnorderedMapIPK12DexMethodRefS3_St4hashIS3_ESt8equal_toIS3_EETnNSt9enable_ifIXsr3stdE12is_base_of_vI13UnorderedBaseIT_ESB_EEbE4typeELb1EEDaRKSB_(ptr noundef nonnull align 8 dereferenceable(56) %17)
  %19 = getelementptr inbounds %"class.UnorderedMap<const DexMethodRef *, const DexMethodRef *>::ConstUnorderedIterable", ptr %8, i32 0, i32 0
  store ptr %18, ptr %19, align 8
  store ptr %8, ptr %7, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %9) #3
  %20 = load ptr, ptr %7, align 8, !tbaa !5
  %21 = call ptr @_ZNK12UnorderedMapIPK12DexMethodRefS2_St4hashIS2_ESt8equal_toIS2_EE22ConstUnorderedIterable5beginEv(ptr noundef nonnull align 8 dereferenceable(8) %20)
  %22 = getelementptr inbounds %"struct.std::__detail::_Node_const_iterator.257", ptr %9, i32 0, i32 0
  %23 = getelementptr inbounds %"struct.std::__detail::_Node_iterator_base.152", ptr %22, i32 0, i32 0
  store ptr %21, ptr %23, align 8
  call void @llvm.lifetime.start.p0(i64 8, ptr %10) #3
  %24 = load ptr, ptr %7, align 8, !tbaa !5
  %25 = call ptr @_ZNK12UnorderedMapIPK12DexMethodRefS2_St4hashIS2_ESt8equal_toIS2_EE22ConstUnorderedIterable3endEv(ptr noundef nonnull align 8 dereferenceable(8) %24)
  %26 = getelementptr inbounds %"struct.std::__detail::_Node_const_iterator.257", ptr %10, i32 0, i32 0
  %27 = getelementptr inbounds %"struct.std::__detail::_Node_iterator_base.152", ptr %26, i32 0, i32 0
  store ptr %25, ptr %27, align 8
  br label %28

28:                                               ; preds = %47, %2
  %29 = call noundef zeroext i1 @_ZNSt8__detailneERKNS_19_Node_iterator_baseISt4pairIKPK12DexMethodRefS4_ELb0EEES9_(ptr noundef nonnull align 8 dereferenceable(8) %9, ptr noundef nonnull align 8 dereferenceable(8) %10) #3
  br i1 %29, label %31, label %30

30:                                               ; preds = %28
  store i32 2, ptr %11, align 4
  br label %49

31:                                               ; preds = %28
  call void @llvm.lifetime.start.p0(i64 8, ptr %12) #3
  %32 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNKSt8__detail20_Node_const_iteratorISt4pairIKPK12DexMethodRefS4_ELb0ELb0EEdeEv(ptr noundef nonnull align 8 dereferenceable(8) %9) #3
  store ptr %32, ptr %12, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %13) #3
  %33 = load ptr, ptr %12, align 8, !tbaa !5
  %34 = getelementptr inbounds %"struct.std::pair.258", ptr %33, i32 0, i32 1
  %35 = load ptr, ptr %34, align 8, !tbaa !9
  store ptr %35, ptr %13, align 8, !tbaa !5
  %36 = load ptr, ptr %6, align 8, !tbaa !5
  %37 = load ptr, ptr %13, align 8, !tbaa !5
  %38 = icmp eq ptr %36, %37
  br i1 %38, label %39, label %40

39:                                               ; preds = %31
  store i1 true, ptr %3, align 1
  store i32 1, ptr %11, align 4
  br label %41

40:                                               ; preds = %31
  store i32 0, ptr %11, align 4
  br label %41

41:                                               ; preds = %40, %39
  call void @llvm.lifetime.end.p0(i64 8, ptr %13) #3
  %42 = load i32, ptr %11, align 4
  switch i32 %42, label %44 [
    i32 0, label %43
  ]

43:                                               ; preds = %41
  store i32 0, ptr %11, align 4
  br label %44

44:                                               ; preds = %43, %41
  call void @llvm.lifetime.end.p0(i64 8, ptr %12) #3
  %45 = load i32, ptr %11, align 4
  switch i32 %45, label %49 [
    i32 0, label %46
  ]

46:                                               ; preds = %44
  br label %47

47:                                               ; preds = %46
  %48 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSt8__detail20_Node_const_iteratorISt4pairIKPK12DexMethodRefS4_ELb0ELb0EEppEv(ptr noundef nonnull align 8 dereferenceable(8) %9) #3
  br label %28

49:                                               ; preds = %44, %30
  call void @llvm.lifetime.end.p0(i64 8, ptr %10) #3
  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
  %50 = load i32, ptr %11, align 4
  switch i32 %50, label %52 [
    i32 2, label %51
  ]

51:                                               ; preds = %49
  store i1 false, ptr %3, align 1
  store i32 1, ptr %11, align 4
  br label %52

52:                                               ; preds = %51, %49
  call void @llvm.lifetime.end.p0(i64 8, ptr %6) #3
  %53 = load i1, ptr %3, align 1
  ret i1 %53
}

; Function Attrs: mustprogress uwtable
declare dso_local ptr @_Z17UnorderedIterableI12UnorderedMapIPK12DexMethodRefS3_St4hashIS3_ESt8equal_toIS3_EETnNSt9enable_ifIXsr3stdE12is_base_of_vI13UnorderedBaseIT_ESB_EEbE4typeELb1EEDaRKSB_(ptr noundef nonnull align 8 dereferenceable(56)) #1

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

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

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

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef zeroext i1 @_ZNSt8__detailneERKNS_19_Node_iterator_baseISt4pairIKPK12DexMethodRefS4_ELb0EEES9_(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(16) ptr @_ZNKSt8__detail20_Node_const_iteratorISt4pairIKPK12DexMethodRefS4_ELb0ELb0EEdeEv(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 @_ZNSt8__detail20_Node_const_iteratorISt4pairIKPK12DexMethodRefS4_ELb0ELb0EEppEv(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, !6, i64 8}
!10 = !{!"_ZTSSt4pairIKPK12DexMethodRefS2_E", !6, i64 0, !6, i64 8}


; 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.UnorderedMap<const DexMethodRef *, const DexMethodRef *>::ConstUnorderedIterable" = type { ptr }
%"struct.std::__detail::_Node_const_iterator.257" = type { %"struct.std::__detail::_Node_iterator_base.152" }
%"struct.std::__detail::_Node_iterator_base.152" = 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 ptr @_ZNK13IRInstruction10get_methodEv(ptr noundef nonnull align 8 dereferenceable(32)) local_unnamed_addr #1 align 2

; Function Attrs: mustprogress uwtable
define dso_local noundef zeroext i1 @_ZNK8cse_impl11SharedState29has_potential_unboxing_methodEPK13IRInstruction(ptr noundef nonnull align 8 dereferenceable(520) %0, ptr noundef nonnull %1) local_unnamed_addr #1 align 2 {
  %3 = alloca %"class.UnorderedMap<const DexMethodRef *, const DexMethodRef *>::ConstUnorderedIterable", align 8
  %4 = alloca %"struct.std::__detail::_Node_const_iterator.257", align 8
  %5 = alloca %"struct.std::__detail::_Node_const_iterator.257", align 8
  %6 = tail call noundef ptr @_ZNK13IRInstruction10get_methodEv(ptr noundef nonnull align 8 dereferenceable(32) %1)
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %3) #3
  %7 = tail call noundef nonnull align 8 dereferenceable(56) ptr @_ZNK8cse_impl11SharedState16get_abstract_mapEv(ptr noundef nonnull align 8 dereferenceable(520) %0)
  %8 = tail call ptr @_Z17UnorderedIterableI12UnorderedMapIPK12DexMethodRefS3_St4hashIS3_ESt8equal_toIS3_EETnNSt9enable_ifIXsr3stdE12is_base_of_vI13UnorderedBaseIT_ESB_EEbE4typeELb1EEDaRKSB_(ptr noundef nonnull align 8 dereferenceable(56) %7)
  store ptr %8, ptr %3, align 8
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %4) #3
  %9 = call ptr @_ZNK12UnorderedMapIPK12DexMethodRefS2_St4hashIS2_ESt8equal_toIS2_EE22ConstUnorderedIterable5beginEv(ptr noundef nonnull align 8 dereferenceable(8) %3)
  store ptr %9, ptr %4, align 8
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %5) #3
  %10 = call ptr @_ZNK12UnorderedMapIPK12DexMethodRefS2_St4hashIS2_ESt8equal_toIS2_EE22ConstUnorderedIterable3endEv(ptr noundef nonnull align 8 dereferenceable(8) %3)
  store ptr %10, ptr %5, align 8
  %11 = call noundef zeroext i1 @_ZNSt8__detailneERKNS_19_Node_iterator_baseISt4pairIKPK12DexMethodRefS4_ELb0EEES9_(ptr noundef nonnull align 8 dereferenceable(8) %4, ptr noundef nonnull align 8 dereferenceable(8) %5) #3
  br i1 %11, label %.lr.ph, label %.critedge

.lr.ph:                                           ; preds = %2, %15
  %12 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNKSt8__detail20_Node_const_iteratorISt4pairIKPK12DexMethodRefS4_ELb0ELb0EEdeEv(ptr noundef nonnull align 8 dereferenceable(8) %4) #3
  %13 = getelementptr inbounds i8, ptr %12, i64 8
  %14 = load ptr, ptr %13, align 8, !tbaa !5
  %.not = icmp eq ptr %6, %14
  br i1 %.not, label %18, label %15

15:                                               ; preds = %.lr.ph
  %16 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSt8__detail20_Node_const_iteratorISt4pairIKPK12DexMethodRefS4_ELb0ELb0EEppEv(ptr noundef nonnull align 8 dereferenceable(8) %4) #3
  %17 = call noundef zeroext i1 @_ZNSt8__detailneERKNS_19_Node_iterator_baseISt4pairIKPK12DexMethodRefS4_ELb0EEES9_(ptr noundef nonnull align 8 dereferenceable(8) %4, ptr noundef nonnull align 8 dereferenceable(8) %5) #3
  br i1 %17, label %.lr.ph, label %.critedge

18:                                               ; preds = %.lr.ph
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %5) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %4) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %3) #3
  br label %19

.critedge:                                        ; preds = %15, %2
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %5) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %4) #3
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %3) #3
  br label %19

19:                                               ; preds = %18, %.critedge
  %20 = phi i1 [ true, %18 ], [ false, %.critedge ]
  ret i1 %20
}

; Function Attrs: mustprogress uwtable
declare dso_local ptr @_Z17UnorderedIterableI12UnorderedMapIPK12DexMethodRefS3_St4hashIS3_ESt8equal_toIS3_EETnNSt9enable_ifIXsr3stdE12is_base_of_vI13UnorderedBaseIT_ESB_EEbE4typeELb1EEDaRKSB_(ptr noundef nonnull align 8 dereferenceable(56)) local_unnamed_addr #1

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

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

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

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef zeroext i1 @_ZNSt8__detailneERKNS_19_Node_iterator_baseISt4pairIKPK12DexMethodRefS4_ELb0EEES9_(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(16) ptr @_ZNKSt8__detail20_Node_const_iteratorISt4pairIKPK12DexMethodRefS4_ELb0ELb0EEdeEv(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 @_ZNSt8__detail20_Node_const_iteratorISt4pairIKPK12DexMethodRefS4_ELb0ELb0EEppEv(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, !7, i64 8}
!6 = !{!"_ZTSSt4pairIKPK12DexMethodRefS2_E", !7, i64 0, !7, i64 8}
!7 = !{!"any pointer", !8, i64 0}
!8 = !{!"omnipotent char", !9, i64 0}
!9 = !{!"Simple C++ TBAA"}


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