; LLVM IR from thepowersgang/mrustc :: src/mir/mir_builder.ll (ZN11ScopeHandleD2Ev)

; 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.Span = type { ptr }
%"class.std::function" = type { %"class.std::_Function_base", ptr }
%"class.std::_Function_base" = type { %"union.std::_Any_data", ptr }
%"union.std::_Any_data" = type { %"union.std::_Nocopy_types" }
%"union.std::_Nocopy_types" = type { { i64, i64 } }
%class.anon.593 = type { i8 }
%class.anon.595 = type { ptr }
%class.ScopeHandle = type <{ ptr, i32, [4 x i8] }>
%class.MirBuilder = type { ptr, ptr, ptr, ptr, ptr, ptr, i32, i8, %"class.MIR::RValue", i8, [7 x i8], %class.VarState, %"class.std::vector.26", %"class.std::vector.26", i64, %"class.std::map", %"class.std::vector.42", %"class.std::vector.47", %class.ScopeHandle, %"class.std::vector.52", %"struct.MIR::LValue" }
%"class.MIR::RValue" = type { i32, %"union.MIR::RValue::DataUnion" }
%"union.MIR::RValue::DataUnion" = type { %"struct.MIR::RValue::Data_BinOp" }
%"struct.MIR::RValue::Data_BinOp" = type { %"class.MIR::Param", i32, %"class.MIR::Param" }
%"class.MIR::Param" = type { i32, %"union.MIR::Param::DataUnion" }
%"union.MIR::Param::DataUnion" = type { %"struct.MIR::Param::Data_Borrow" }
%"struct.MIR::Param::Data_Borrow" = type { i32, %"struct.MIR::LValue" }
%class.VarState = type { i32, [4 x i8], %"union.VarState::DataUnion" }
%"union.VarState::DataUnion" = type { i32, [28 x i8] }
%"class.std::vector.26" = type { %"struct.std::_Vector_base.27" }
%"struct.std::_Vector_base.27" = type { %"struct.std::_Vector_base<VarState, std::allocator<VarState>>::_Vector_impl" }
%"struct.std::_Vector_base<VarState, std::allocator<VarState>>::_Vector_impl" = type { %"struct.std::_Vector_base<VarState, std::allocator<VarState>>::_Vector_impl_data" }
%"struct.std::_Vector_base<VarState, std::allocator<VarState>>::_Vector_impl_data" = type { ptr, ptr, ptr }
%"class.std::map" = type { %"class.std::_Rb_tree" }
%"class.std::_Rb_tree" = type { %"struct.std::_Rb_tree<unsigned int, std::pair<const unsigned int, unsigned int>, std::_Select1st<std::pair<const unsigned int, unsigned int>>, std::less<unsigned int>>::_Rb_tree_impl" }
%"struct.std::_Rb_tree<unsigned int, std::pair<const unsigned int, unsigned int>, std::_Select1st<std::pair<const unsigned int, unsigned int>>, std::less<unsigned int>>::_Rb_tree_impl" = type { [8 x i8], %"struct.std::_Rb_tree_header" }
%"struct.std::_Rb_tree_header" = type { %"struct.std::_Rb_tree_node_base", i64 }
%"struct.std::_Rb_tree_node_base" = type { i32, ptr, ptr, ptr }
%"class.std::vector.42" = type { %"struct.std::_Vector_base.43" }
%"struct.std::_Vector_base.43" = type { %"struct.std::_Vector_base<MirBuilder::ScopeDef, std::allocator<MirBuilder::ScopeDef>>::_Vector_impl" }
%"struct.std::_Vector_base<MirBuilder::ScopeDef, std::allocator<MirBuilder::ScopeDef>>::_Vector_impl" = type { %"struct.std::_Vector_base<MirBuilder::ScopeDef, std::allocator<MirBuilder::ScopeDef>>::_Vector_impl_data" }
%"struct.std::_Vector_base<MirBuilder::ScopeDef, std::allocator<MirBuilder::ScopeDef>>::_Vector_impl_data" = type { ptr, ptr, ptr }
%"class.std::vector.47" = type { %"struct.std::_Vector_base.48" }
%"struct.std::_Vector_base.48" = type { %"struct.std::_Vector_base<unsigned int, std::allocator<unsigned int>>::_Vector_impl" }
%"struct.std::_Vector_base<unsigned int, std::allocator<unsigned int>>::_Vector_impl" = type { %"struct.std::_Vector_base<unsigned int, std::allocator<unsigned int>>::_Vector_impl_data" }
%"struct.std::_Vector_base<unsigned int, std::allocator<unsigned int>>::_Vector_impl_data" = type { ptr, ptr, ptr }
%"class.std::vector.52" = type { %"struct.std::_Vector_base.53" }
%"struct.std::_Vector_base.53" = type { %"struct.std::_Vector_base<std::pair<HIR::PatternBinding::Type, MIR::LValue>, std::allocator<std::pair<HIR::PatternBinding::Type, MIR::LValue>>>::_Vector_impl" }
%"struct.std::_Vector_base<std::pair<HIR::PatternBinding::Type, MIR::LValue>, std::allocator<std::pair<HIR::PatternBinding::Type, MIR::LValue>>>::_Vector_impl" = type { %"struct.std::_Vector_base<std::pair<HIR::PatternBinding::Type, MIR::LValue>, std::allocator<std::pair<HIR::PatternBinding::Type, MIR::LValue>>>::_Vector_impl_data" }
%"struct.std::_Vector_base<std::pair<HIR::PatternBinding::Type, MIR::LValue>, std::allocator<std::pair<HIR::PatternBinding::Type, MIR::LValue>>>::_Vector_impl_data" = type { ptr, ptr, ptr }
%"struct.MIR::LValue" = type { %"class.MIR::LValue::Storage", %"class.std::vector" }
%"class.MIR::LValue::Storage" = type { i64 }
%"class.std::vector" = type { %"struct.std::_Vector_base" }
%"struct.std::_Vector_base" = type { %"struct.std::_Vector_base<MIR::LValue::Wrapper, std::allocator<MIR::LValue::Wrapper>>::_Vector_impl" }
%"struct.std::_Vector_base<MIR::LValue::Wrapper, std::allocator<MIR::LValue::Wrapper>>::_Vector_impl" = type { %"struct.std::_Vector_base<MIR::LValue::Wrapper, std::allocator<MIR::LValue::Wrapper>>::_Vector_impl_data" }
%"struct.std::_Vector_base<MIR::LValue::Wrapper, std::allocator<MIR::LValue::Wrapper>>::_Vector_impl_data" = type { ptr, ptr, ptr }
%"struct.MirBuilder::ScopeDef" = type { ptr, i8, %class.ScopeType }
%class.ScopeType = type { i32, %"union.ScopeType::DataUnion" }
%"union.ScopeType::DataUnion" = type { %"struct.ScopeType::Data_Loop" }
%"struct.ScopeType::Data_Loop" = type { %"class.std::map.252", %"class.std::map.252", i8, %struct.SplitEnd, i32, %"class.std::vector.47" }
%"class.std::map.252" = type { %"class.std::_Rb_tree.253" }
%"class.std::_Rb_tree.253" = type { %"struct.std::_Rb_tree<unsigned int, std::pair<const unsigned int, VarState>, std::_Select1st<std::pair<const unsigned int, VarState>>, std::less<unsigned int>>::_Rb_tree_impl" }
%"struct.std::_Rb_tree<unsigned int, std::pair<const unsigned int, VarState>, std::_Select1st<std::pair<const unsigned int, VarState>>, std::less<unsigned int>>::_Rb_tree_impl" = type { [8 x i8], %"struct.std::_Rb_tree_header" }
%struct.SplitEnd = type { %"class.std::map.252", %"class.std::map.252" }

@.str.9 = external hidden unnamed_addr constant [17 x i8], align 1
@_ZTISt13runtime_error = external constant ptr

declare i32 @__gxx_personality_v0(...)

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

declare void @_ZNK4Span3bugESt8functionIFvRSoEE(ptr noundef nonnull align 8 dereferenceable(8), ptr noundef) #2

; Function Attrs: nounwind
declare void @_ZN4SpanD1Ev(ptr noundef nonnull align 8 dereferenceable(8)) unnamed_addr #3

declare ptr @__cxa_allocate_exception(i64)

declare void @_ZNSt13runtime_errorC1EPKc(ptr noundef nonnull align 8 dereferenceable(16), ptr noundef) unnamed_addr #2

declare void @__cxa_free_exception(ptr)

; Function Attrs: nounwind
declare void @_ZNSt13runtime_errorD1Ev(ptr noundef nonnull align 8 dereferenceable(16)) unnamed_addr #3

declare void @__cxa_throw(ptr, ptr, ptr)

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

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

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

; Function Attrs: mustprogress nounwind uwtable
define dso_local void @_ZN11ScopeHandleD2Ev(ptr noundef nonnull align 8 dereferenceable(12) %0) unnamed_addr #1 align 2 personality ptr @__gxx_personality_v0 {
  %2 = alloca ptr, align 8
  %3 = alloca %struct.Span, align 8
  %4 = alloca ptr, align 8
  %5 = alloca i32, align 4
  %6 = alloca %"class.std::function", align 8
  %7 = alloca %class.anon.593, align 1
  %8 = alloca %struct.Span, align 8
  %9 = alloca %"class.std::function", align 8
  %10 = alloca %class.anon.595, align 8
  store ptr %0, ptr %2, align 8, !tbaa !5
  %11 = load ptr, ptr %2, align 8
  %12 = getelementptr inbounds %class.ScopeHandle, ptr %11, i32 0, i32 1
  %13 = load i32, ptr %12, align 8, !tbaa !9
  %14 = icmp ne i32 %13, -1
  br i1 %14, label %15, label %88

15:                                               ; preds = %1
  br label %16

16:                                               ; preds = %15
  %17 = getelementptr inbounds %class.ScopeHandle, ptr %11, i32 0, i32 0
  %18 = load ptr, ptr %17, align 8, !tbaa !12
  %19 = getelementptr inbounds %class.MirBuilder, ptr %18, i32 0, i32 16
  %20 = call noundef i64 @_ZNKSt6vectorIN10MirBuilder8ScopeDefESaIS1_EE4sizeEv(ptr noundef nonnull align 8 dereferenceable(24) %19) #6
  %21 = getelementptr inbounds %class.ScopeHandle, ptr %11, i32 0, i32 1
  %22 = load i32, ptr %21, align 8, !tbaa !9
  %23 = zext i32 %22 to i64
  %24 = icmp ugt i64 %20, %23
  br i1 %24, label %47, label %25

25:                                               ; preds = %16
  call void @llvm.lifetime.start.p0(i64 8, ptr %3) #6
  invoke void @_ZN4SpanC2Ev(ptr noundef nonnull align 8 dereferenceable(8) %3)
          to label %26 unwind label %30

26:                                               ; preds = %25
  call void @llvm.lifetime.start.p0(i64 1, ptr %7) #6
  call void @"_ZNSt8functionIFvRSoEEC2IZN11ScopeHandleD1EvE3$_0vEEOT_"(ptr noundef nonnull align 8 dereferenceable(32) %6, ptr noundef nonnull align 1 dereferenceable(1) %7) #6
  invoke void @_ZNK4Span3bugESt8functionIFvRSoEE(ptr noundef nonnull align 8 dereferenceable(8) %3, ptr noundef %6)
          to label %27 unwind label %34

27:                                               ; preds = %26
  call void @_ZNSt14_Function_baseD2Ev(ptr noundef nonnull align 8 dereferenceable(32) %6) #6
  call void @llvm.lifetime.end.p0(i64 1, ptr %7) #6
  call void @_ZN4SpanD1Ev(ptr noundef nonnull align 8 dereferenceable(8) %3) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr %3) #6
  %28 = call ptr @__cxa_allocate_exception(i64 16) #6
  invoke void @_ZNSt13runtime_errorC1EPKc(ptr noundef nonnull align 8 dereferenceable(16) %28, ptr noundef @.str.9)
          to label %29 unwind label %39

29:                                               ; preds = %27
  invoke void @__cxa_throw(ptr %28, ptr @_ZTISt13runtime_error, ptr @_ZNSt13runtime_errorD1Ev) #7
          to label %89 unwind label %43

30:                                               ; preds = %25
  %31 = landingpad { ptr, i32 }
          catch ptr null
  %32 = extractvalue { ptr, i32 } %31, 0
  store ptr %32, ptr %4, align 8
  %33 = extractvalue { ptr, i32 } %31, 1
  store i32 %33, ptr %5, align 4
  br label %38

34:                                               ; preds = %26
  %35 = landingpad { ptr, i32 }
          catch ptr null
  %36 = extractvalue { ptr, i32 } %35, 0
  store ptr %36, ptr %4, align 8
  %37 = extractvalue { ptr, i32 } %35, 1
  store i32 %37, ptr %5, align 4
  call void @_ZNSt14_Function_baseD2Ev(ptr noundef nonnull align 8 dereferenceable(32) %6) #6
  call void @llvm.lifetime.end.p0(i64 1, ptr %7) #6
  call void @_ZN4SpanD1Ev(ptr noundef nonnull align 8 dereferenceable(8) %3) #6
  br label %38

38:                                               ; preds = %34, %30
  call void @llvm.lifetime.end.p0(i64 8, ptr %3) #6
  br label %81

39:                                               ; preds = %27
  %40 = landingpad { ptr, i32 }
          catch ptr null
  %41 = extractvalue { ptr, i32 } %40, 0
  store ptr %41, ptr %4, align 8
  %42 = extractvalue { ptr, i32 } %40, 1
  store i32 %42, ptr %5, align 4
  call void @__cxa_free_exception(ptr %28) #6
  br label %81

43:                                               ; preds = %67, %50, %29
  %44 = landingpad { ptr, i32 }
          catch ptr null
  %45 = extractvalue { ptr, i32 } %44, 0
  store ptr %45, ptr %4, align 8
  %46 = extractvalue { ptr, i32 } %44, 1
  store i32 %46, ptr %5, align 4
  br label %81

47:                                               ; preds = %16
  br label %48

48:                                               ; preds = %47
  br label %49

49:                                               ; preds = %48
  br label %50

50:                                               ; preds = %49
  %51 = getelementptr inbounds %class.ScopeHandle, ptr %11, i32 0, i32 0
  %52 = load ptr, ptr %51, align 8, !tbaa !12
  %53 = getelementptr inbounds %class.MirBuilder, ptr %52, i32 0, i32 16
  %54 = getelementptr inbounds %class.ScopeHandle, ptr %11, i32 0, i32 1
  %55 = load i32, ptr %54, align 8, !tbaa !9
  %56 = zext i32 %55 to i64
  %57 = invoke noundef nonnull align 8 dereferenceable(256) ptr @_ZNKSt6vectorIN10MirBuilder8ScopeDefESaIS1_EE2atEm(ptr noundef nonnull align 8 dereferenceable(24) %53, i64 noundef %56)
          to label %58 unwind label %43

58:                                               ; preds = %50
  %59 = getelementptr inbounds %"struct.MirBuilder::ScopeDef", ptr %57, i32 0, i32 1
  %60 = load i8, ptr %59, align 8, !tbaa !13, !range !18, !noundef !19
  %61 = trunc i8 %60 to i1
  br i1 %61, label %84, label %62

62:                                               ; preds = %58
  call void @llvm.lifetime.start.p0(i64 8, ptr %8) #6
  invoke void @_ZN4SpanC2Ev(ptr noundef nonnull align 8 dereferenceable(8) %8)
          to label %63 unwind label %68

63:                                               ; preds = %62
  call void @llvm.lifetime.start.p0(i64 8, ptr %10) #6
  %64 = getelementptr inbounds %class.anon.595, ptr %10, i32 0, i32 0
  store ptr %11, ptr %64, align 8, !tbaa !20
  call void @"_ZNSt8functionIFvRSoEEC2IZN11ScopeHandleD1EvE3$_1vEEOT_"(ptr noundef nonnull align 8 dereferenceable(32) %9, ptr noundef nonnull align 8 dereferenceable(8) %10) #6
  invoke void @_ZNK4Span3bugESt8functionIFvRSoEE(ptr noundef nonnull align 8 dereferenceable(8) %8, ptr noundef %9)
          to label %65 unwind label %72

65:                                               ; preds = %63
  call void @_ZNSt14_Function_baseD2Ev(ptr noundef nonnull align 8 dereferenceable(32) %9) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr %10) #6
  call void @_ZN4SpanD1Ev(ptr noundef nonnull align 8 dereferenceable(8) %8) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr %8) #6
  %66 = call ptr @__cxa_allocate_exception(i64 16) #6
  invoke void @_ZNSt13runtime_errorC1EPKc(ptr noundef nonnull align 8 dereferenceable(16) %66, ptr noundef @.str.9)
          to label %67 unwind label %77

67:                                               ; preds = %65
  invoke void @__cxa_throw(ptr %66, ptr @_ZTISt13runtime_error, ptr @_ZNSt13runtime_errorD1Ev) #7
          to label %89 unwind label %43

68:                                               ; preds = %62
  %69 = landingpad { ptr, i32 }
          catch ptr null
  %70 = extractvalue { ptr, i32 } %69, 0
  store ptr %70, ptr %4, align 8
  %71 = extractvalue { ptr, i32 } %69, 1
  store i32 %71, ptr %5, align 4
  br label %76

72:                                               ; preds = %63
  %73 = landingpad { ptr, i32 }
          catch ptr null
  %74 = extractvalue { ptr, i32 } %73, 0
  store ptr %74, ptr %4, align 8
  %75 = extractvalue { ptr, i32 } %73, 1
  store i32 %75, ptr %5, align 4
  call void @_ZNSt14_Function_baseD2Ev(ptr noundef nonnull align 8 dereferenceable(32) %9) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr %10) #6
  call void @_ZN4SpanD1Ev(ptr noundef nonnull align 8 dereferenceable(8) %8) #6
  br label %76

76:                                               ; preds = %72, %68
  call void @llvm.lifetime.end.p0(i64 8, ptr %8) #6
  br label %81

77:                                               ; preds = %65
  %78 = landingpad { ptr, i32 }
          catch ptr null
  %79 = extractvalue { ptr, i32 } %78, 0
  store ptr %79, ptr %4, align 8
  %80 = extractvalue { ptr, i32 } %78, 1
  store i32 %80, ptr %5, align 4
  call void @__cxa_free_exception(ptr %66) #6
  br label %81

81:                                               ; preds = %77, %76, %43, %39, %38
  %82 = load ptr, ptr %4, align 8
  %83 = call ptr @__cxa_begin_catch(ptr %82) #6
  call void @abort() #8
  unreachable

84:                                               ; preds = %58
  br label %85

85:                                               ; preds = %84
  br label %86

86:                                               ; preds = %85
  br label %87

87:                                               ; preds = %86
  br label %88

88:                                               ; preds = %87, %1
  ret void

89:                                               ; preds = %67, %29
  unreachable
}

; Function Attrs: mustprogress nounwind uwtable
declare hidden void @"_ZNSt8functionIFvRSoEEC2IZN11ScopeHandleD1EvE3$_0vEEOT_"(ptr noundef nonnull align 8 dereferenceable(32), ptr noundef nonnull align 1 dereferenceable(1)) unnamed_addr #1 align 2

; Function Attrs: mustprogress nounwind uwtable
declare hidden void @"_ZNSt8functionIFvRSoEEC2IZN11ScopeHandleD1EvE3$_1vEEOT_"(ptr noundef nonnull align 8 dereferenceable(32), ptr noundef nonnull align 8 dereferenceable(8)) unnamed_addr #1 align 2

declare ptr @__cxa_begin_catch(ptr)

; Function Attrs: noreturn nounwind
declare void @abort() #5

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 = { "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 "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 = { 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 #5 = { noreturn nounwind "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 #6 = { nounwind }
attributes #7 = { noreturn }
attributes #8 = { noreturn 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, !11, i64 8}
!10 = !{!"_ZTS11ScopeHandle", !6, i64 0, !11, i64 8}
!11 = !{!"int", !7, i64 0}
!12 = !{!10, !6, i64 0}
!13 = !{!14, !15, i64 8}
!14 = !{!"_ZTSN10MirBuilder8ScopeDefE", !6, i64 0, !15, i64 8, !16, i64 16}
!15 = !{!"bool", !7, i64 0}
!16 = !{!"_ZTS9ScopeType", !17, i64 0, !7, i64 8}
!17 = !{!"_ZTSN9ScopeType3TagE", !7, i64 0}
!18 = !{i8 0, i8 2}
!19 = !{}
!20 = !{!21, !6, i64 0}
!21 = !{!"_ZTSZN11ScopeHandleD1EvE3$_1", !6, 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.Span = type { ptr }
%"class.std::function" = type { %"class.std::_Function_base", ptr }
%"class.std::_Function_base" = type { %"union.std::_Any_data", ptr }
%"union.std::_Any_data" = type { %"union.std::_Nocopy_types" }
%"union.std::_Nocopy_types" = type { { i64, i64 } }
%class.anon.593 = type { i8 }
%class.anon.595 = type { ptr }

@.str.9 = external hidden unnamed_addr constant [17 x i8], align 1
@_ZTISt13runtime_error = external constant ptr

declare i32 @__gxx_personality_v0(...)

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

declare void @_ZNK4Span3bugESt8functionIFvRSoEE(ptr noundef nonnull align 8 dereferenceable(8), ptr noundef) local_unnamed_addr #2

; Function Attrs: nounwind
declare void @_ZN4SpanD1Ev(ptr noundef nonnull align 8 dereferenceable(8)) unnamed_addr #3

declare ptr @__cxa_allocate_exception(i64) local_unnamed_addr

declare void @_ZNSt13runtime_errorC1EPKc(ptr noundef nonnull align 8 dereferenceable(16), ptr noundef) unnamed_addr #2

declare void @__cxa_free_exception(ptr) local_unnamed_addr

; Function Attrs: nounwind
declare void @_ZNSt13runtime_errorD1Ev(ptr noundef nonnull align 8 dereferenceable(16)) unnamed_addr #3

declare void @__cxa_throw(ptr, ptr, ptr) local_unnamed_addr

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

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

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

; Function Attrs: mustprogress nounwind uwtable
define dso_local void @_ZN11ScopeHandleD2Ev(ptr noundef nonnull align 8 dereferenceable(12) %0) unnamed_addr #1 align 2 personality ptr @__gxx_personality_v0 {
  %2 = alloca %struct.Span, align 8
  %3 = alloca %"class.std::function", align 8
  %4 = alloca %class.anon.593, align 1
  %5 = alloca %struct.Span, align 8
  %6 = alloca %"class.std::function", align 8
  %7 = alloca %class.anon.595, align 8
  %8 = getelementptr inbounds i8, ptr %0, i64 8
  %9 = load i32, ptr %8, align 8, !tbaa !5
  %.not = icmp eq i32 %9, -1
  br i1 %.not, label %44, label %10

10:                                               ; preds = %1
  %11 = load ptr, ptr %0, align 8, !tbaa !11
  %12 = getelementptr inbounds i8, ptr %11, i64 320
  %13 = tail call noundef i64 @_ZNKSt6vectorIN10MirBuilder8ScopeDefESaIS1_EE4sizeEv(ptr noundef nonnull align 8 dereferenceable(24) %12) #6
  %14 = load i32, ptr %8, align 8, !tbaa !5
  %15 = zext i32 %14 to i64
  %16 = icmp ugt i64 %13, %15
  br i1 %16, label %26, label %17

17:                                               ; preds = %10
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %2) #6
  call void @_ZN4SpanC2Ev(ptr noundef nonnull align 8 dereferenceable(8) %2)
  call void @llvm.lifetime.start.p0(i64 1, ptr nonnull %4) #6
  call void @"_ZNSt8functionIFvRSoEEC2IZN11ScopeHandleD1EvE3$_0vEEOT_"(ptr noundef nonnull align 8 dereferenceable(32) %3, ptr noundef nonnull align 1 dereferenceable(1) %4) #6
  invoke void @_ZNK4Span3bugESt8functionIFvRSoEE(ptr noundef nonnull align 8 dereferenceable(8) %2, ptr noundef nonnull %3)
          to label %18 unwind label %20

18:                                               ; preds = %17
  call void @_ZNSt14_Function_baseD2Ev(ptr noundef nonnull align 8 dereferenceable(32) %3) #6
  call void @llvm.lifetime.end.p0(i64 1, ptr nonnull %4) #6
  call void @_ZN4SpanD1Ev(ptr noundef nonnull align 8 dereferenceable(8) %2) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %2) #6
  %19 = call ptr @__cxa_allocate_exception(i64 16) #6
  invoke void @_ZNSt13runtime_errorC1EPKc(ptr noundef nonnull align 8 dereferenceable(16) %19, ptr noundef nonnull @.str.9)
          to label %.invoke unwind label %22

20:                                               ; preds = %17
  %21 = landingpad { ptr, i32 }
          catch ptr null
  call void @_ZNSt14_Function_baseD2Ev(ptr noundef nonnull align 8 dereferenceable(32) %3) #6
  call void @llvm.lifetime.end.p0(i64 1, ptr nonnull %4) #6
  call void @_ZN4SpanD1Ev(ptr noundef nonnull align 8 dereferenceable(8) %2) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %2) #6
  br label %42

22:                                               ; preds = %18
  %23 = landingpad { ptr, i32 }
          catch ptr null
  call void @__cxa_free_exception(ptr %19) #6
  br label %42

24:                                               ; preds = %.invoke, %26
  %25 = landingpad { ptr, i32 }
          catch ptr null
  br label %42

26:                                               ; preds = %10
  %27 = load ptr, ptr %0, align 8, !tbaa !11
  %28 = getelementptr inbounds i8, ptr %27, i64 320
  %29 = invoke noundef nonnull align 8 dereferenceable(256) ptr @_ZNKSt6vectorIN10MirBuilder8ScopeDefESaIS1_EE2atEm(ptr noundef nonnull align 8 dereferenceable(24) %28, i64 noundef %15)
          to label %30 unwind label %24

30:                                               ; preds = %26
  %31 = getelementptr inbounds i8, ptr %29, i64 8
  %32 = load i8, ptr %31, align 8, !tbaa !12, !range !17, !noundef !18
  %33 = trunc nuw i8 %32 to i1
  br i1 %33, label %44, label %34

34:                                               ; preds = %30
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %5) #6
  call void @_ZN4SpanC2Ev(ptr noundef nonnull align 8 dereferenceable(8) %5)
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %7) #6
  store ptr %0, ptr %7, align 8, !tbaa !19
  call void @"_ZNSt8functionIFvRSoEEC2IZN11ScopeHandleD1EvE3$_1vEEOT_"(ptr noundef nonnull align 8 dereferenceable(32) %6, ptr noundef nonnull align 8 dereferenceable(8) %7) #6
  invoke void @_ZNK4Span3bugESt8functionIFvRSoEE(ptr noundef nonnull align 8 dereferenceable(8) %5, ptr noundef nonnull %6)
          to label %35 unwind label %38

35:                                               ; preds = %34
  call void @_ZNSt14_Function_baseD2Ev(ptr noundef nonnull align 8 dereferenceable(32) %6) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %7) #6
  call void @_ZN4SpanD1Ev(ptr noundef nonnull align 8 dereferenceable(8) %5) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %5) #6
  %36 = call ptr @__cxa_allocate_exception(i64 16) #6
  invoke void @_ZNSt13runtime_errorC1EPKc(ptr noundef nonnull align 8 dereferenceable(16) %36, ptr noundef nonnull @.str.9)
          to label %.invoke unwind label %40

.invoke:                                          ; preds = %18, %35
  %37 = phi ptr [ %36, %35 ], [ %19, %18 ]
  invoke void @__cxa_throw(ptr nonnull %37, ptr nonnull @_ZTISt13runtime_error, ptr nonnull @_ZNSt13runtime_errorD1Ev) #7
          to label %.cont unwind label %24

.cont:                                            ; preds = %.invoke
  unreachable

38:                                               ; preds = %34
  %39 = landingpad { ptr, i32 }
          catch ptr null
  call void @_ZNSt14_Function_baseD2Ev(ptr noundef nonnull align 8 dereferenceable(32) %6) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %7) #6
  call void @_ZN4SpanD1Ev(ptr noundef nonnull align 8 dereferenceable(8) %5) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %5) #6
  br label %42

40:                                               ; preds = %35
  %41 = landingpad { ptr, i32 }
          catch ptr null
  call void @__cxa_free_exception(ptr %36) #6
  br label %42

42:                                               ; preds = %40, %38, %24, %22, %20
  %.pn = phi { ptr, i32 } [ %25, %24 ], [ %41, %40 ], [ %39, %38 ], [ %23, %22 ], [ %21, %20 ]
  %.0 = extractvalue { ptr, i32 } %.pn, 0
  %43 = call ptr @__cxa_begin_catch(ptr %.0) #6
  call void @abort() #8
  unreachable

44:                                               ; preds = %30, %1
  ret void
}

; Function Attrs: mustprogress nounwind uwtable
declare hidden void @"_ZNSt8functionIFvRSoEEC2IZN11ScopeHandleD1EvE3$_0vEEOT_"(ptr noundef nonnull align 8 dereferenceable(32), ptr noundef nonnull align 1 dereferenceable(1)) unnamed_addr #1 align 2

; Function Attrs: mustprogress nounwind uwtable
declare hidden void @"_ZNSt8functionIFvRSoEEC2IZN11ScopeHandleD1EvE3$_1vEEOT_"(ptr noundef nonnull align 8 dereferenceable(32), ptr noundef nonnull align 8 dereferenceable(8)) unnamed_addr #1 align 2

declare ptr @__cxa_begin_catch(ptr) local_unnamed_addr

; Function Attrs: noreturn nounwind
declare void @abort() local_unnamed_addr #5

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 = { "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 "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 = { 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 #5 = { noreturn nounwind "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 #6 = { nounwind }
attributes #7 = { noreturn }
attributes #8 = { noreturn 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, !10, i64 8}
!6 = !{!"_ZTS11ScopeHandle", !7, i64 0, !10, i64 8}
!7 = !{!"any pointer", !8, i64 0}
!8 = !{!"omnipotent char", !9, i64 0}
!9 = !{!"Simple C++ TBAA"}
!10 = !{!"int", !8, i64 0}
!11 = !{!6, !7, i64 0}
!12 = !{!13, !14, i64 8}
!13 = !{!"_ZTSN10MirBuilder8ScopeDefE", !7, i64 0, !14, i64 8, !15, i64 16}
!14 = !{!"bool", !8, i64 0}
!15 = !{!"_ZTS9ScopeType", !16, i64 0, !8, i64 8}
!16 = !{!"_ZTSN9ScopeType3TagE", !8, i64 0}
!17 = !{i8 0, i8 2}
!18 = !{}
!19 = !{!20, !7, i64 0}
!20 = !{!"_ZTSZN11ScopeHandleD1EvE3$_1", !7, i64 0}


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