; LLVM IR from facebook/redex :: service/remove_redundant_check_casts (CheckCastTransform)

; 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.check_casts::impl::Stats" = type { i64, i64, i64 }
%"class.__gnu_cxx::__normal_iterator" = type { ptr }
%"class.cfg::InstructionIteratorImpl" = type { ptr, %"struct.std::_Rb_tree_const_iterator", %"class.ir_list::InstructionIteratorImpl" }
%"struct.std::_Rb_tree_const_iterator" = type { ptr }
%"class.ir_list::InstructionIteratorImpl" = type { %"class.boost::intrusive::list_iterator", %"class.boost::intrusive::list_iterator" }
%"class.boost::intrusive::list_iterator" = type { %"struct.boost::intrusive::iiterator_members" }
%"struct.boost::intrusive::iiterator_members" = type { ptr }
%"class.boost::optional" = type { %"class.boost::optional_detail::tc_optional_base" }
%"class.boost::optional_detail::tc_optional_base" = type { i8, ptr }
%"class.boost::optional.3" = type { %"class.boost::optional_detail::tc_optional_base.4" }
%"class.boost::optional_detail::tc_optional_base.4" = type { i8, ptr }
%"struct.check_casts::impl::CheckCastReplacementItem" = type { ptr, ptr, %"class.boost::optional", %"class.boost::optional.3" }

; 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
define dso_local void @_ZN11check_casts4impl5applyERN3cfg16ControlFlowGraphERKSt6vectorINS0_24CheckCastReplacementItemESaIS5_EE(ptr dead_on_unwind noalias writable sret(%"struct.check_casts::impl::Stats") align 8 %0, ptr noundef nonnull align 8 dereferenceable(160) %1, ptr noundef nonnull align 8 dereferenceable(24) %2) #1 {
  %4 = alloca ptr, align 8
  %5 = alloca ptr, align 8
  %6 = alloca ptr, align 8
  %7 = alloca %"class.__gnu_cxx::__normal_iterator", align 8
  %8 = alloca %"class.__gnu_cxx::__normal_iterator", align 8
  %9 = alloca ptr, align 8
  %10 = alloca %"class.cfg::InstructionIteratorImpl", align 8
  %11 = alloca %"class.boost::optional", align 8
  %12 = alloca %"class.boost::optional.3", align 8
  store ptr %1, ptr %4, align 8, !tbaa !5
  store ptr %2, ptr %5, align 8, !tbaa !5
  call void @_ZN11check_casts4impl5StatsC2Ev(ptr noundef nonnull align 8 dereferenceable(24) %0) #7
  call void @llvm.lifetime.start.p0(i64 8, ptr %6) #7
  %13 = load ptr, ptr %5, align 8, !tbaa !5
  store ptr %13, ptr %6, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %7) #7
  %14 = load ptr, ptr %6, align 8, !tbaa !5
  %15 = call ptr @_ZNKSt6vectorIN11check_casts4impl24CheckCastReplacementItemESaIS2_EE5beginEv(ptr noundef nonnull align 8 dereferenceable(24) %14) #7
  %16 = getelementptr inbounds %"class.__gnu_cxx::__normal_iterator", ptr %7, i32 0, i32 0
  store ptr %15, ptr %16, align 8
  call void @llvm.lifetime.start.p0(i64 8, ptr %8) #7
  %17 = load ptr, ptr %6, align 8, !tbaa !5
  %18 = call ptr @_ZNKSt6vectorIN11check_casts4impl24CheckCastReplacementItemESaIS2_EE3endEv(ptr noundef nonnull align 8 dereferenceable(24) %17) #7
  %19 = getelementptr inbounds %"class.__gnu_cxx::__normal_iterator", ptr %8, i32 0, i32 0
  store ptr %18, ptr %19, align 8
  br label %20

20:                                               ; preds = %64, %3
  %21 = call noundef zeroext i1 @_ZN9__gnu_cxxneIPKN11check_casts4impl24CheckCastReplacementItemESt6vectorIS3_SaIS3_EEEEbRKNS_17__normal_iteratorIT_T0_EESE_(ptr noundef nonnull align 8 dereferenceable(8) %7, ptr noundef nonnull align 8 dereferenceable(8) %8) #7
  br i1 %21, label %23, label %22

22:                                               ; preds = %20
  call void @llvm.lifetime.end.p0(i64 8, ptr %8) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr %7) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr %6) #7
  br label %66

23:                                               ; preds = %20
  call void @llvm.lifetime.start.p0(i64 8, ptr %9) #7
  %24 = call noundef nonnull align 8 dereferenceable(48) ptr @_ZNK9__gnu_cxx17__normal_iteratorIPKN11check_casts4impl24CheckCastReplacementItemESt6vectorIS3_SaIS3_EEEdeEv(ptr noundef nonnull align 8 dereferenceable(8) %7) #7
  store ptr %24, ptr %9, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 32, ptr %10) #7
  %25 = load ptr, ptr %4, align 8, !tbaa !5
  %26 = load ptr, ptr %9, align 8, !tbaa !5
  %27 = getelementptr inbounds %"struct.check_casts::impl::CheckCastReplacementItem", ptr %26, i32 0, i32 1
  %28 = load ptr, ptr %27, align 8, !tbaa !9
  %29 = load ptr, ptr %9, align 8, !tbaa !5
  %30 = getelementptr inbounds %"struct.check_casts::impl::CheckCastReplacementItem", ptr %29, i32 0, i32 0
  %31 = load ptr, ptr %30, align 8, !tbaa !16
  call void @_ZN3cfg16ControlFlowGraph9find_insnEP13IRInstructionPNS_5BlockE(ptr dead_on_unwind writable sret(%"class.cfg::InstructionIteratorImpl") align 8 %10, ptr noundef nonnull align 8 dereferenceable(160) %25, ptr noundef %28, ptr noundef %31)
  call void @llvm.lifetime.start.p0(i64 16, ptr %11) #7
  %32 = load ptr, ptr %9, align 8, !tbaa !5
  %33 = getelementptr inbounds %"struct.check_casts::impl::CheckCastReplacementItem", ptr %32, i32 0, i32 2
  call void @llvm.memcpy.p0.p0.i64(ptr align 8 %11, ptr align 8 %33, i64 16, i1 false)
  %34 = call noundef zeroext i1 @_ZNK5boost8optionalIP13IRInstructionEcvbEv(ptr noundef nonnull align 8 dereferenceable(16) %11) #7
  br i1 %34, label %35, label %43

35:                                               ; preds = %23
  %36 = load ptr, ptr %4, align 8, !tbaa !5
  %37 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNR5boost8optionalIP13IRInstructionEdeEv(ptr noundef nonnull align 8 dereferenceable(16) %11)
  %38 = load ptr, ptr %37, align 8, !tbaa !5
  %39 = call noundef zeroext i1 @_ZN3cfg16ControlFlowGraph12replace_insnERKNS_23InstructionIteratorImplILb0EEEP13IRInstruction(ptr noundef nonnull align 8 dereferenceable(160) %36, ptr noundef nonnull align 8 dereferenceable(32) %10, ptr noundef %38)
  %40 = getelementptr inbounds %"struct.check_casts::impl::Stats", ptr %0, i32 0, i32 1
  %41 = load i64, ptr %40, align 8, !tbaa !17
  %42 = add i64 %41, 1
  store i64 %42, ptr %40, align 8, !tbaa !17
  br label %63

43:                                               ; preds = %23
  call void @llvm.lifetime.start.p0(i64 16, ptr %12) #7
  %44 = load ptr, ptr %9, align 8, !tbaa !5
  %45 = getelementptr inbounds %"struct.check_casts::impl::CheckCastReplacementItem", ptr %44, i32 0, i32 3
  call void @llvm.memcpy.p0.p0.i64(ptr align 8 %12, ptr align 8 %45, i64 16, i1 false)
  %46 = call noundef zeroext i1 @_ZNK5boost8optionalIP7DexTypeEcvbEv(ptr noundef nonnull align 8 dereferenceable(16) %12) #7
  br i1 %46, label %47, label %57

47:                                               ; preds = %43
  %48 = load ptr, ptr %9, align 8, !tbaa !5
  %49 = getelementptr inbounds %"struct.check_casts::impl::CheckCastReplacementItem", ptr %48, i32 0, i32 1
  %50 = load ptr, ptr %49, align 8, !tbaa !9
  %51 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNR5boost8optionalIP7DexTypeEdeEv(ptr noundef nonnull align 8 dereferenceable(16) %12)
  %52 = load ptr, ptr %51, align 8, !tbaa !5
  %53 = call noundef ptr @_ZN13IRInstruction8set_typeEP7DexType(ptr noundef nonnull align 8 dereferenceable(32) %50, ptr noundef %52)
  %54 = getelementptr inbounds %"struct.check_casts::impl::Stats", ptr %0, i32 0, i32 2
  %55 = load i64, ptr %54, align 8, !tbaa !20
  %56 = add i64 %55, 1
  store i64 %56, ptr %54, align 8, !tbaa !20
  br label %62

57:                                               ; preds = %43
  %58 = load ptr, ptr %4, align 8, !tbaa !5
  call void @_ZN3cfg16ControlFlowGraph11remove_insnERKNS_23InstructionIteratorImplILb0EEE(ptr noundef nonnull align 8 dereferenceable(160) %58, ptr noundef nonnull align 8 dereferenceable(32) %10)
  %59 = getelementptr inbounds %"struct.check_casts::impl::Stats", ptr %0, i32 0, i32 0
  %60 = load i64, ptr %59, align 8, !tbaa !21
  %61 = add i64 %60, 1
  store i64 %61, ptr %59, align 8, !tbaa !21
  br label %62

62:                                               ; preds = %57, %47
  call void @llvm.lifetime.end.p0(i64 16, ptr %12) #7
  br label %63

63:                                               ; preds = %62, %35
  call void @llvm.lifetime.end.p0(i64 16, ptr %11) #7
  call void @llvm.lifetime.end.p0(i64 32, ptr %10) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr %9) #7
  br label %64

64:                                               ; preds = %63
  %65 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZN9__gnu_cxx17__normal_iteratorIPKN11check_casts4impl24CheckCastReplacementItemESt6vectorIS3_SaIS3_EEEppEv(ptr noundef nonnull align 8 dereferenceable(8) %7) #7
  br label %20

66:                                               ; preds = %22
  ret void
}

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

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

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

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef zeroext i1 @_ZN9__gnu_cxxneIPKN11check_casts4impl24CheckCastReplacementItemESt6vectorIS3_SaIS3_EEEEbRKNS_17__normal_iteratorIT_T0_EESE_(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(48) ptr @_ZNK9__gnu_cxx17__normal_iteratorIPKN11check_casts4impl24CheckCastReplacementItemESt6vectorIS3_SaIS3_EEEdeEv(ptr noundef nonnull align 8 dereferenceable(8)) #3 align 2

declare void @_ZN3cfg16ControlFlowGraph9find_insnEP13IRInstructionPNS_5BlockE(ptr dead_on_unwind writable sret(%"class.cfg::InstructionIteratorImpl") align 8, ptr noundef nonnull align 8 dereferenceable(160), ptr noundef, ptr noundef) #4

; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: readwrite)
declare void @llvm.memcpy.p0.p0.i64(ptr noalias nocapture writeonly, ptr noalias nocapture readonly, i64, i1 immarg) #5

; Function Attrs: alwaysinline mustprogress nounwind uwtable
declare dso_local noundef zeroext i1 @_ZNK5boost8optionalIP13IRInstructionEcvbEv(ptr noundef nonnull align 8 dereferenceable(16)) #6 align 2

declare noundef zeroext i1 @_ZN3cfg16ControlFlowGraph12replace_insnERKNS_23InstructionIteratorImplILb0EEEP13IRInstruction(ptr noundef nonnull align 8 dereferenceable(160), ptr noundef nonnull align 8 dereferenceable(32), ptr noundef) #4

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

; Function Attrs: alwaysinline mustprogress nounwind uwtable
declare dso_local noundef zeroext i1 @_ZNK5boost8optionalIP7DexTypeEcvbEv(ptr noundef nonnull align 8 dereferenceable(16)) #6 align 2

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

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

declare void @_ZN3cfg16ControlFlowGraph11remove_insnERKNS_23InstructionIteratorImplILb0EEE(ptr noundef nonnull align 8 dereferenceable(160), ptr noundef nonnull align 8 dereferenceable(32)) #4

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef nonnull align 8 dereferenceable(8) ptr @_ZN9__gnu_cxx17__normal_iteratorIPKN11check_casts4impl24CheckCastReplacementItemESt6vectorIS3_SaIS3_EEEppEv(ptr noundef nonnull align 8 dereferenceable(8)) #3 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 = { 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 #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 = { "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 = { nocallback nofree nounwind willreturn memory(argmem: readwrite) }
attributes #6 = { alwaysinline 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 #7 = { 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 = !{!"_ZTSN11check_casts4impl24CheckCastReplacementItemE", !6, i64 0, !6, i64 8, !11, i64 16, !14, i64 32}
!11 = !{!"_ZTSN5boost8optionalIP13IRInstructionEE", !12, i64 0}
!12 = !{!"_ZTSN5boost15optional_detail16tc_optional_baseIP13IRInstructionEE", !13, i64 0, !6, i64 8}
!13 = !{!"bool", !7, i64 0}
!14 = !{!"_ZTSN5boost8optionalIP7DexTypeEE", !15, i64 0}
!15 = !{!"_ZTSN5boost15optional_detail16tc_optional_baseIP7DexTypeEE", !13, i64 0, !6, i64 8}
!16 = !{!10, !6, i64 0}
!17 = !{!18, !19, i64 8}
!18 = !{!"_ZTSN11check_casts4impl5StatsE", !19, i64 0, !19, i64 8, !19, i64 16}
!19 = !{!"long", !7, i64 0}
!20 = !{!18, !19, i64 16}
!21 = !{!18, !19, 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.check_casts::impl::Stats" = type { i64, i64, i64 }
%"class.__gnu_cxx::__normal_iterator" = type { ptr }
%"class.cfg::InstructionIteratorImpl" = type { ptr, %"struct.std::_Rb_tree_const_iterator", %"class.ir_list::InstructionIteratorImpl" }
%"struct.std::_Rb_tree_const_iterator" = type { ptr }
%"class.ir_list::InstructionIteratorImpl" = type { %"class.boost::intrusive::list_iterator", %"class.boost::intrusive::list_iterator" }
%"class.boost::intrusive::list_iterator" = type { %"struct.boost::intrusive::iiterator_members" }
%"struct.boost::intrusive::iiterator_members" = type { ptr }
%"class.boost::optional" = type { %"class.boost::optional_detail::tc_optional_base" }
%"class.boost::optional_detail::tc_optional_base" = type { i8, ptr }
%"class.boost::optional.3" = type { %"class.boost::optional_detail::tc_optional_base.4" }
%"class.boost::optional_detail::tc_optional_base.4" = type { i8, 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
define dso_local void @_ZN11check_casts4impl5applyERN3cfg16ControlFlowGraphERKSt6vectorINS0_24CheckCastReplacementItemESaIS5_EE(ptr dead_on_unwind noalias nonnull writable sret(%"struct.check_casts::impl::Stats") align 8 %0, ptr noundef nonnull align 8 dereferenceable(160) %1, ptr noundef nonnull align 8 dereferenceable(24) %2) local_unnamed_addr #1 {
  %4 = alloca %"class.__gnu_cxx::__normal_iterator", align 8
  %5 = alloca %"class.__gnu_cxx::__normal_iterator", align 8
  %6 = alloca %"class.cfg::InstructionIteratorImpl", align 8
  %7 = alloca %"class.boost::optional", align 8
  %8 = alloca %"class.boost::optional.3", align 8
  tail call void @_ZN11check_casts4impl5StatsC2Ev(ptr noundef nonnull align 8 dereferenceable(24) %0) #7
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %4) #7
  %9 = tail call ptr @_ZNKSt6vectorIN11check_casts4impl24CheckCastReplacementItemESaIS2_EE5beginEv(ptr noundef nonnull align 8 dereferenceable(24) %2) #7
  store ptr %9, ptr %4, align 8
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %5) #7
  %10 = tail call ptr @_ZNKSt6vectorIN11check_casts4impl24CheckCastReplacementItemESaIS2_EE3endEv(ptr noundef nonnull align 8 dereferenceable(24) %2) #7
  store ptr %10, ptr %5, align 8
  %11 = call noundef zeroext i1 @_ZN9__gnu_cxxneIPKN11check_casts4impl24CheckCastReplacementItemESt6vectorIS3_SaIS3_EEEEbRKNS_17__normal_iteratorIT_T0_EESE_(ptr noundef nonnull align 8 dereferenceable(8) %4, ptr noundef nonnull align 8 dereferenceable(8) %5) #7
  br i1 %11, label %.lr.ph, label %._crit_edge

.lr.ph:                                           ; preds = %3
  %12 = getelementptr inbounds i8, ptr %0, i64 16
  %13 = getelementptr inbounds i8, ptr %0, i64 8
  br label %14

._crit_edge:                                      ; preds = %39, %3
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %5) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %4) #7
  ret void

14:                                               ; preds = %.lr.ph, %39
  %15 = call noundef nonnull align 8 dereferenceable(48) ptr @_ZNK9__gnu_cxx17__normal_iteratorIPKN11check_casts4impl24CheckCastReplacementItemESt6vectorIS3_SaIS3_EEEdeEv(ptr noundef nonnull align 8 dereferenceable(8) %4) #7
  call void @llvm.lifetime.start.p0(i64 32, ptr nonnull %6) #7
  %16 = getelementptr inbounds i8, ptr %15, i64 8
  %17 = load ptr, ptr %16, align 8, !tbaa !5
  %18 = load ptr, ptr %15, align 8, !tbaa !15
  call void @_ZN3cfg16ControlFlowGraph9find_insnEP13IRInstructionPNS_5BlockE(ptr dead_on_unwind nonnull writable sret(%"class.cfg::InstructionIteratorImpl") align 8 %6, ptr noundef nonnull align 8 dereferenceable(160) %1, ptr noundef %17, ptr noundef %18)
  call void @llvm.lifetime.start.p0(i64 16, ptr nonnull %7) #7
  %19 = getelementptr inbounds i8, ptr %15, i64 16
  call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 8 dereferenceable(16) %7, ptr noundef nonnull align 8 dereferenceable(16) %19, i64 16, i1 false)
  %20 = call noundef zeroext i1 @_ZNK5boost8optionalIP13IRInstructionEcvbEv(ptr noundef nonnull align 8 dereferenceable(16) %7) #7
  br i1 %20, label %21, label %27

21:                                               ; preds = %14
  %22 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNR5boost8optionalIP13IRInstructionEdeEv(ptr noundef nonnull align 8 dereferenceable(16) %7)
  %23 = load ptr, ptr %22, align 8, !tbaa !16
  %24 = call noundef zeroext i1 @_ZN3cfg16ControlFlowGraph12replace_insnERKNS_23InstructionIteratorImplILb0EEEP13IRInstruction(ptr noundef nonnull align 8 dereferenceable(160) %1, ptr noundef nonnull align 8 dereferenceable(32) %6, ptr noundef %23)
  %25 = load i64, ptr %13, align 8, !tbaa !17
  %26 = add i64 %25, 1
  store i64 %26, ptr %13, align 8, !tbaa !17
  br label %39

27:                                               ; preds = %14
  call void @llvm.lifetime.start.p0(i64 16, ptr nonnull %8) #7
  %28 = getelementptr inbounds i8, ptr %15, i64 32
  call void @llvm.memcpy.p0.p0.i64(ptr noundef nonnull align 8 dereferenceable(16) %8, ptr noundef nonnull align 8 dereferenceable(16) %28, i64 16, i1 false)
  %29 = call noundef zeroext i1 @_ZNK5boost8optionalIP7DexTypeEcvbEv(ptr noundef nonnull align 8 dereferenceable(16) %8) #7
  br i1 %29, label %30, label %35

30:                                               ; preds = %27
  %31 = load ptr, ptr %16, align 8, !tbaa !5
  %32 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNR5boost8optionalIP7DexTypeEdeEv(ptr noundef nonnull align 8 dereferenceable(16) %8)
  %33 = load ptr, ptr %32, align 8, !tbaa !16
  %34 = call noundef ptr @_ZN13IRInstruction8set_typeEP7DexType(ptr noundef nonnull align 8 dereferenceable(32) %31, ptr noundef %33)
  br label %36

35:                                               ; preds = %27
  call void @_ZN3cfg16ControlFlowGraph11remove_insnERKNS_23InstructionIteratorImplILb0EEE(ptr noundef nonnull align 8 dereferenceable(160) %1, ptr noundef nonnull align 8 dereferenceable(32) %6)
  br label %36

36:                                               ; preds = %35, %30
  %.sink = phi ptr [ %0, %35 ], [ %12, %30 ]
  %37 = load i64, ptr %.sink, align 8, !tbaa !20
  %38 = add i64 %37, 1
  store i64 %38, ptr %.sink, align 8, !tbaa !20
  call void @llvm.lifetime.end.p0(i64 16, ptr nonnull %8) #7
  br label %39

39:                                               ; preds = %36, %21
  call void @llvm.lifetime.end.p0(i64 16, ptr nonnull %7) #7
  call void @llvm.lifetime.end.p0(i64 32, ptr nonnull %6) #7
  %40 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZN9__gnu_cxx17__normal_iteratorIPKN11check_casts4impl24CheckCastReplacementItemESt6vectorIS3_SaIS3_EEEppEv(ptr noundef nonnull align 8 dereferenceable(8) %4) #7
  %41 = call noundef zeroext i1 @_ZN9__gnu_cxxneIPKN11check_casts4impl24CheckCastReplacementItemESt6vectorIS3_SaIS3_EEEEbRKNS_17__normal_iteratorIT_T0_EESE_(ptr noundef nonnull align 8 dereferenceable(8) %4, ptr noundef nonnull align 8 dereferenceable(8) %5) #7
  br i1 %41, label %14, label %._crit_edge
}

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

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

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

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef zeroext i1 @_ZN9__gnu_cxxneIPKN11check_casts4impl24CheckCastReplacementItemESt6vectorIS3_SaIS3_EEEEbRKNS_17__normal_iteratorIT_T0_EESE_(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(48) ptr @_ZNK9__gnu_cxx17__normal_iteratorIPKN11check_casts4impl24CheckCastReplacementItemESt6vectorIS3_SaIS3_EEEdeEv(ptr noundef nonnull align 8 dereferenceable(8)) local_unnamed_addr #3 align 2

declare void @_ZN3cfg16ControlFlowGraph9find_insnEP13IRInstructionPNS_5BlockE(ptr dead_on_unwind writable sret(%"class.cfg::InstructionIteratorImpl") align 8, ptr noundef nonnull align 8 dereferenceable(160), ptr noundef, ptr noundef) local_unnamed_addr #4

; Function Attrs: mustprogress nocallback nofree nounwind willreturn memory(argmem: readwrite)
declare void @llvm.memcpy.p0.p0.i64(ptr noalias nocapture writeonly, ptr noalias nocapture readonly, i64, i1 immarg) #5

; Function Attrs: alwaysinline mustprogress nounwind uwtable
declare dso_local noundef zeroext i1 @_ZNK5boost8optionalIP13IRInstructionEcvbEv(ptr noundef nonnull align 8 dereferenceable(16)) local_unnamed_addr #6 align 2

declare noundef zeroext i1 @_ZN3cfg16ControlFlowGraph12replace_insnERKNS_23InstructionIteratorImplILb0EEEP13IRInstruction(ptr noundef nonnull align 8 dereferenceable(160), ptr noundef nonnull align 8 dereferenceable(32), ptr noundef) local_unnamed_addr #4

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

; Function Attrs: alwaysinline mustprogress nounwind uwtable
declare dso_local noundef zeroext i1 @_ZNK5boost8optionalIP7DexTypeEcvbEv(ptr noundef nonnull align 8 dereferenceable(16)) local_unnamed_addr #6 align 2

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

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

declare void @_ZN3cfg16ControlFlowGraph11remove_insnERKNS_23InstructionIteratorImplILb0EEE(ptr noundef nonnull align 8 dereferenceable(160), ptr noundef nonnull align 8 dereferenceable(32)) local_unnamed_addr #4

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef nonnull align 8 dereferenceable(8) ptr @_ZN9__gnu_cxx17__normal_iteratorIPKN11check_casts4impl24CheckCastReplacementItemESt6vectorIS3_SaIS3_EEEppEv(ptr noundef nonnull align 8 dereferenceable(8)) local_unnamed_addr #3 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 = { 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 #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 = { "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 = { mustprogress nocallback nofree nounwind willreturn memory(argmem: readwrite) }
attributes #6 = { alwaysinline 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 #7 = { 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 = !{!"_ZTSN11check_casts4impl24CheckCastReplacementItemE", !7, i64 0, !7, i64 8, !10, i64 16, !13, i64 32}
!7 = !{!"any pointer", !8, i64 0}
!8 = !{!"omnipotent char", !9, i64 0}
!9 = !{!"Simple C++ TBAA"}
!10 = !{!"_ZTSN5boost8optionalIP13IRInstructionEE", !11, i64 0}
!11 = !{!"_ZTSN5boost15optional_detail16tc_optional_baseIP13IRInstructionEE", !12, i64 0, !7, i64 8}
!12 = !{!"bool", !8, i64 0}
!13 = !{!"_ZTSN5boost8optionalIP7DexTypeEE", !14, i64 0}
!14 = !{!"_ZTSN5boost15optional_detail16tc_optional_baseIP7DexTypeEE", !12, i64 0, !7, i64 8}
!15 = !{!6, !7, i64 0}
!16 = !{!7, !7, i64 0}
!17 = !{!18, !19, i64 8}
!18 = !{!"_ZTSN11check_casts4impl5StatsE", !19, i64 0, !19, i64 8, !19, i64 16}
!19 = !{!"long", !8, i64 0}
!20 = !{!19, !19, i64 0}


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