; LLVM IR from thepowersgang/mrustc :: src/hir/hir.ll (ZNK3HIR24ConstGeneric_Unevaluated9monomorphERK4SpanRK13Monomorphiserb)

; 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.HIR::ConstGeneric_Unevaluated" = type { %"struct.HIR::PathParams", %"struct.HIR::PathParams", %"class.std::shared_ptr.5" }
%"struct.HIR::PathParams" = type { %class.ThinVector.2, %class.ThinVector.3, %class.ThinVector.4 }
%class.ThinVector.2 = type { ptr }
%class.ThinVector.3 = type { ptr }
%class.ThinVector.4 = type { ptr }
%"class.std::shared_ptr.5" = type { %"class.std::__shared_ptr.6" }
%"class.std::__shared_ptr.6" = type { ptr, %"class.std::__shared_count" }
%"class.std::__shared_count" = type { 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

declare i32 @__gxx_personality_v0(...)

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

; Function Attrs: mustprogress uwtable
define dso_local void @_ZNK3HIR24ConstGeneric_Unevaluated9monomorphERK4SpanRK13Monomorphiserb(ptr dead_on_unwind noalias writable sret(%"struct.HIR::ConstGeneric_Unevaluated") align 8 %0, ptr noundef nonnull align 8 dereferenceable(64) %1, ptr noundef nonnull align 8 dereferenceable(8) %2, ptr noundef nonnull align 8 dereferenceable(96) %3, i1 noundef zeroext %4) #2 align 2 personality ptr @__gxx_personality_v0 {
  %6 = alloca ptr, align 8
  %7 = alloca ptr, align 8
  %8 = alloca ptr, align 8
  %9 = alloca ptr, align 8
  %10 = alloca i8, align 1
  %11 = alloca i1, align 1
  %12 = alloca %"struct.HIR::PathParams", align 8
  %13 = alloca ptr, align 8
  %14 = alloca i32, align 4
  %15 = alloca %"struct.HIR::PathParams", align 8
  store ptr %0, ptr %6, align 8
  store ptr %1, ptr %7, align 8, !tbaa !5
  store ptr %2, ptr %8, align 8, !tbaa !5
  store ptr %3, ptr %9, align 8, !tbaa !5
  %16 = zext i1 %4 to i8
  store i8 %16, ptr %10, align 1, !tbaa !9
  %17 = load ptr, ptr %7, align 8
  store i1 false, ptr %11, align 1
  call void @_ZN3HIR24ConstGeneric_UnevaluatedC2Ev(ptr noundef nonnull align 8 dereferenceable(64) %0)
  call void @llvm.lifetime.start.p0(i64 24, ptr %12) #5
  %18 = load ptr, ptr %9, align 8, !tbaa !5
  %19 = load ptr, ptr %8, align 8, !tbaa !5
  %20 = getelementptr inbounds %"struct.HIR::ConstGeneric_Unevaluated", ptr %17, i32 0, i32 0
  %21 = load i8, ptr %10, align 1, !tbaa !9, !range !11, !noundef !12
  %22 = trunc i8 %21 to i1
  invoke void @_ZNK13Monomorphiser21monomorph_path_paramsERK4SpanRKN3HIR10PathParamsEb(ptr dead_on_unwind writable sret(%"struct.HIR::PathParams") align 8 %12, ptr noundef nonnull align 8 dereferenceable(96) %18, ptr noundef nonnull align 8 dereferenceable(8) %19, ptr noundef nonnull align 8 dereferenceable(24) %20, i1 noundef zeroext %22)
          to label %23 unwind label %40

23:                                               ; preds = %5
  %24 = getelementptr inbounds %"struct.HIR::ConstGeneric_Unevaluated", ptr %0, i32 0, i32 0
  %25 = invoke noundef nonnull align 8 dereferenceable(24) ptr @_ZN3HIR10PathParamsaSEOS0_(ptr noundef nonnull align 8 dereferenceable(24) %24, ptr noundef nonnull align 8 dereferenceable(24) %12)
          to label %26 unwind label %44

26:                                               ; preds = %23
  call void @_ZN3HIR10PathParamsD2Ev(ptr noundef nonnull align 8 dereferenceable(24) %12) #5
  call void @llvm.lifetime.end.p0(i64 24, ptr %12) #5
  call void @llvm.lifetime.start.p0(i64 24, ptr %15) #5
  %27 = load ptr, ptr %9, align 8, !tbaa !5
  %28 = load ptr, ptr %8, align 8, !tbaa !5
  %29 = getelementptr inbounds %"struct.HIR::ConstGeneric_Unevaluated", ptr %17, i32 0, i32 1
  %30 = load i8, ptr %10, align 1, !tbaa !9, !range !11, !noundef !12
  %31 = trunc i8 %30 to i1
  invoke void @_ZNK13Monomorphiser21monomorph_path_paramsERK4SpanRKN3HIR10PathParamsEb(ptr dead_on_unwind writable sret(%"struct.HIR::PathParams") align 8 %15, ptr noundef nonnull align 8 dereferenceable(96) %27, ptr noundef nonnull align 8 dereferenceable(8) %28, ptr noundef nonnull align 8 dereferenceable(24) %29, i1 noundef zeroext %31)
          to label %32 unwind label %49

32:                                               ; preds = %26
  %33 = getelementptr inbounds %"struct.HIR::ConstGeneric_Unevaluated", ptr %0, i32 0, i32 1
  %34 = invoke noundef nonnull align 8 dereferenceable(24) ptr @_ZN3HIR10PathParamsaSEOS0_(ptr noundef nonnull align 8 dereferenceable(24) %33, ptr noundef nonnull align 8 dereferenceable(24) %15)
          to label %35 unwind label %53

35:                                               ; preds = %32
  call void @_ZN3HIR10PathParamsD2Ev(ptr noundef nonnull align 8 dereferenceable(24) %15) #5
  call void @llvm.lifetime.end.p0(i64 24, ptr %15) #5
  %36 = getelementptr inbounds %"struct.HIR::ConstGeneric_Unevaluated", ptr %17, i32 0, i32 2
  %37 = getelementptr inbounds %"struct.HIR::ConstGeneric_Unevaluated", ptr %0, i32 0, i32 2
  %38 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSt10shared_ptrIN3HIR7ExprPtrEEaSERKS2_(ptr noundef nonnull align 8 dereferenceable(16) %37, ptr noundef nonnull align 8 dereferenceable(16) %36) #5
  store i1 true, ptr %11, align 1
  %39 = load i1, ptr %11, align 1
  br i1 %39, label %59, label %58

40:                                               ; preds = %5
  %41 = landingpad { ptr, i32 }
          cleanup
  %42 = extractvalue { ptr, i32 } %41, 0
  store ptr %42, ptr %13, align 8
  %43 = extractvalue { ptr, i32 } %41, 1
  store i32 %43, ptr %14, align 4
  br label %48

44:                                               ; preds = %23
  %45 = landingpad { ptr, i32 }
          cleanup
  %46 = extractvalue { ptr, i32 } %45, 0
  store ptr %46, ptr %13, align 8
  %47 = extractvalue { ptr, i32 } %45, 1
  store i32 %47, ptr %14, align 4
  call void @_ZN3HIR10PathParamsD2Ev(ptr noundef nonnull align 8 dereferenceable(24) %12) #5
  br label %48

48:                                               ; preds = %44, %40
  call void @llvm.lifetime.end.p0(i64 24, ptr %12) #5
  br label %60

49:                                               ; preds = %26
  %50 = landingpad { ptr, i32 }
          cleanup
  %51 = extractvalue { ptr, i32 } %50, 0
  store ptr %51, ptr %13, align 8
  %52 = extractvalue { ptr, i32 } %50, 1
  store i32 %52, ptr %14, align 4
  br label %57

53:                                               ; preds = %32
  %54 = landingpad { ptr, i32 }
          cleanup
  %55 = extractvalue { ptr, i32 } %54, 0
  store ptr %55, ptr %13, align 8
  %56 = extractvalue { ptr, i32 } %54, 1
  store i32 %56, ptr %14, align 4
  call void @_ZN3HIR10PathParamsD2Ev(ptr noundef nonnull align 8 dereferenceable(24) %15) #5
  br label %57

57:                                               ; preds = %53, %49
  call void @llvm.lifetime.end.p0(i64 24, ptr %15) #5
  br label %60

58:                                               ; preds = %35
  call void @_ZN3HIR24ConstGeneric_UnevaluatedD2Ev(ptr noundef nonnull align 8 dereferenceable(64) %0) #5
  br label %59

59:                                               ; preds = %58, %35
  ret void

60:                                               ; preds = %57, %48
  call void @_ZN3HIR24ConstGeneric_UnevaluatedD2Ev(ptr noundef nonnull align 8 dereferenceable(64) %0) #5
  br label %61

61:                                               ; preds = %60
  %62 = load ptr, ptr %13, align 8
  %63 = load i32, ptr %14, align 4
  %64 = insertvalue { ptr, i32 } poison, ptr %62, 0
  %65 = insertvalue { ptr, i32 } %64, i32 %63, 1
  resume { ptr, i32 } %65
}

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN3HIR24ConstGeneric_UnevaluatedC2Ev(ptr noundef nonnull align 8 dereferenceable(64)) unnamed_addr #2 align 2

declare void @_ZNK13Monomorphiser21monomorph_path_paramsERK4SpanRKN3HIR10PathParamsEb(ptr dead_on_unwind writable sret(%"struct.HIR::PathParams") align 8, ptr noundef nonnull align 8 dereferenceable(96), ptr noundef nonnull align 8 dereferenceable(8), ptr noundef nonnull align 8 dereferenceable(24), i1 noundef zeroext) #3

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

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

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

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { 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 #2 = { 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 #3 = { "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 nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #5 = { nounwind }

!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 = !{!"bool", !7, i64 0}
!11 = !{i8 0, i8 2}
!12 = !{}


; 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.HIR::ConstGeneric_Unevaluated" = type { %"struct.HIR::PathParams", %"struct.HIR::PathParams", %"class.std::shared_ptr.5" }
%"struct.HIR::PathParams" = type { %class.ThinVector.2, %class.ThinVector.3, %class.ThinVector.4 }
%class.ThinVector.2 = type { ptr }
%class.ThinVector.3 = type { ptr }
%class.ThinVector.4 = type { ptr }
%"class.std::shared_ptr.5" = type { %"class.std::__shared_ptr.6" }
%"class.std::__shared_ptr.6" = type { ptr, %"class.std::__shared_count" }
%"class.std::__shared_count" = 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

declare i32 @__gxx_personality_v0(...)

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

; Function Attrs: mustprogress uwtable
define dso_local void @_ZNK3HIR24ConstGeneric_Unevaluated9monomorphERK4SpanRK13Monomorphiserb(ptr dead_on_unwind noalias nonnull writable sret(%"struct.HIR::ConstGeneric_Unevaluated") align 8 %0, ptr noundef nonnull align 8 dereferenceable(64) %1, ptr noundef nonnull align 8 dereferenceable(8) %2, ptr noundef nonnull align 8 dereferenceable(96) %3, i1 noundef zeroext %4) local_unnamed_addr #2 align 2 personality ptr @__gxx_personality_v0 {
  %6 = alloca %"struct.HIR::PathParams", align 8
  %7 = alloca %"struct.HIR::PathParams", align 8
  tail call void @_ZN3HIR24ConstGeneric_UnevaluatedC2Ev(ptr noundef nonnull align 8 dereferenceable(64) %0)
  call void @llvm.lifetime.start.p0(i64 24, ptr nonnull %6) #5
  invoke void @_ZNK13Monomorphiser21monomorph_path_paramsERK4SpanRKN3HIR10PathParamsEb(ptr dead_on_unwind nonnull writable sret(%"struct.HIR::PathParams") align 8 %6, ptr noundef nonnull align 8 dereferenceable(96) %3, ptr noundef nonnull align 8 dereferenceable(8) %2, ptr noundef nonnull align 8 dereferenceable(24) %1, i1 noundef zeroext %4)
          to label %8 unwind label %19

8:                                                ; preds = %5
  %9 = invoke noundef nonnull align 8 dereferenceable(24) ptr @_ZN3HIR10PathParamsaSEOS0_(ptr noundef nonnull align 8 dereferenceable(24) %0, ptr noundef nonnull align 8 dereferenceable(24) %6)
          to label %10 unwind label %21

10:                                               ; preds = %8
  call void @_ZN3HIR10PathParamsD2Ev(ptr noundef nonnull align 8 dereferenceable(24) %6) #5
  call void @llvm.lifetime.end.p0(i64 24, ptr nonnull %6) #5
  call void @llvm.lifetime.start.p0(i64 24, ptr nonnull %7) #5
  %11 = getelementptr inbounds i8, ptr %1, i64 24
  invoke void @_ZNK13Monomorphiser21monomorph_path_paramsERK4SpanRKN3HIR10PathParamsEb(ptr dead_on_unwind nonnull writable sret(%"struct.HIR::PathParams") align 8 %7, ptr noundef nonnull align 8 dereferenceable(96) %3, ptr noundef nonnull align 8 dereferenceable(8) %2, ptr noundef nonnull align 8 dereferenceable(24) %11, i1 noundef zeroext %4)
          to label %12 unwind label %24

12:                                               ; preds = %10
  %13 = getelementptr inbounds i8, ptr %0, i64 24
  %14 = invoke noundef nonnull align 8 dereferenceable(24) ptr @_ZN3HIR10PathParamsaSEOS0_(ptr noundef nonnull align 8 dereferenceable(24) %13, ptr noundef nonnull align 8 dereferenceable(24) %7)
          to label %15 unwind label %26

15:                                               ; preds = %12
  call void @_ZN3HIR10PathParamsD2Ev(ptr noundef nonnull align 8 dereferenceable(24) %7) #5
  call void @llvm.lifetime.end.p0(i64 24, ptr nonnull %7) #5
  %16 = getelementptr inbounds i8, ptr %1, i64 48
  %17 = getelementptr inbounds i8, ptr %0, i64 48
  %18 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSt10shared_ptrIN3HIR7ExprPtrEEaSERKS2_(ptr noundef nonnull align 8 dereferenceable(16) %17, ptr noundef nonnull align 8 dereferenceable(16) %16) #5
  ret void

19:                                               ; preds = %5
  %20 = landingpad { ptr, i32 }
          cleanup
  br label %23

21:                                               ; preds = %8
  %22 = landingpad { ptr, i32 }
          cleanup
  call void @_ZN3HIR10PathParamsD2Ev(ptr noundef nonnull align 8 dereferenceable(24) %6) #5
  br label %23

23:                                               ; preds = %21, %19
  %.pn = phi { ptr, i32 } [ %22, %21 ], [ %20, %19 ]
  call void @llvm.lifetime.end.p0(i64 24, ptr nonnull %6) #5
  br label %29

24:                                               ; preds = %10
  %25 = landingpad { ptr, i32 }
          cleanup
  br label %28

26:                                               ; preds = %12
  %27 = landingpad { ptr, i32 }
          cleanup
  call void @_ZN3HIR10PathParamsD2Ev(ptr noundef nonnull align 8 dereferenceable(24) %7) #5
  br label %28

28:                                               ; preds = %26, %24
  %.pn13 = phi { ptr, i32 } [ %27, %26 ], [ %25, %24 ]
  call void @llvm.lifetime.end.p0(i64 24, ptr nonnull %7) #5
  br label %29

29:                                               ; preds = %28, %23
  %.pn13.pn = phi { ptr, i32 } [ %.pn13, %28 ], [ %.pn, %23 ]
  call void @_ZN3HIR24ConstGeneric_UnevaluatedD2Ev(ptr noundef nonnull align 8 dereferenceable(64) %0) #5
  resume { ptr, i32 } %.pn13.pn
}

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN3HIR24ConstGeneric_UnevaluatedC2Ev(ptr noundef nonnull align 8 dereferenceable(64)) unnamed_addr #2 align 2

declare void @_ZNK13Monomorphiser21monomorph_path_paramsERK4SpanRKN3HIR10PathParamsEb(ptr dead_on_unwind writable sret(%"struct.HIR::PathParams") align 8, ptr noundef nonnull align 8 dereferenceable(96), ptr noundef nonnull align 8 dereferenceable(8), ptr noundef nonnull align 8 dereferenceable(24), i1 noundef zeroext) local_unnamed_addr #3

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

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

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

attributes #0 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { 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 #2 = { 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 #3 = { "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 nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #5 = { nounwind }

!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)"}


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