; LLVM IR from thepowersgang/mrustc :: src/hir_conv (constant_evaluation)

; 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.MIR::eval::StaticRefPtr" = type { %"class.MIR::eval::RefCountPtr.25" }
%"class.MIR::eval::RefCountPtr.25" = type { ptr }
%"class.HIR::Path" = type { %"class.HIR::Path::Data" }
%"class.HIR::Path::Data" = type { i32, %"union.HIR::Path::Data::DataUnion" }
%"union.HIR::Path::Data::DataUnion" = type { %"struct.HIR::Path::Data::Data_UfcsKnown" }
%"struct.HIR::Path::Data::Data_UfcsKnown" = type { %"class.HIR::TypeRef", %"class.HIR::GenericPath", %class.RcString, %"struct.HIR::PathParams", %"class.std::unique_ptr" }
%"class.HIR::TypeRef" = type { ptr }
%"class.HIR::GenericPath" = type { %"struct.HIR::SimplePath", %"struct.HIR::PathParams" }
%"struct.HIR::SimplePath" = type { %class.ThinVector }
%class.ThinVector = type { ptr }
%class.RcString = type { ptr }
%"struct.HIR::PathParams" = type { %class.ThinVector.20, %class.ThinVector.21, %class.ThinVector.22 }
%class.ThinVector.20 = type { ptr }
%class.ThinVector.21 = type { ptr }
%class.ThinVector.22 = type { ptr }
%"class.std::unique_ptr" = type { %"struct.std::__uniq_ptr_data" }
%"struct.std::__uniq_ptr_data" = type { %"class.std::__uniq_ptr_impl" }
%"class.std::__uniq_ptr_impl" = type { %"class.std::tuple" }
%"class.std::tuple" = type { %"struct.std::_Tuple_impl" }
%"struct.std::_Tuple_impl" = type { %"struct.std::_Head_base.24" }
%"struct.std::_Head_base.24" = type { ptr }

declare i32 @__gxx_personality_v0(...)

; Function Attrs: nobuiltin nounwind
declare void @_ZdlPvm(ptr noundef, i64 noundef) #0

; Function Attrs: nobuiltin allocsize(0)
declare noundef nonnull ptr @_Znwm(i64 noundef) #1

; Function Attrs: mustprogress uwtable
define dso_local void @_ZN3MIR4eval12StaticRefPtr8allocateEN3HIR4PathEPK14EncodedLiteral(ptr dead_on_unwind noalias writable sret(%"class.MIR::eval::StaticRefPtr") align 8 %0, ptr noundef %1, ptr noundef %2) #2 align 2 personality ptr @__gxx_personality_v0 {
  %4 = alloca ptr, align 8
  %5 = alloca ptr, align 8
  %6 = alloca ptr, align 8
  %7 = alloca i1, align 1
  %8 = alloca ptr, align 8
  %9 = alloca i32, align 4
  %10 = alloca %"class.HIR::Path", align 8
  %11 = alloca i1, align 1
  store ptr %0, ptr %4, align 8
  store ptr %1, ptr %5, align 8, !tbaa !5
  store ptr %2, ptr %6, align 8, !tbaa !5
  store i1 false, ptr %7, align 1
  call void @_ZN3MIR4eval12StaticRefPtrC2Ev(ptr noundef nonnull align 8 dereferenceable(8) %0)
  %12 = invoke noalias noundef nonnull ptr @_Znwm(i64 noundef 112) #6
          to label %13 unwind label %18

13:                                               ; preds = %3
  store i1 true, ptr %11, align 1
  call void @_ZN3HIR4PathC2EOS0_(ptr noundef nonnull align 8 dereferenceable(88) %10, ptr noundef nonnull align 8 dereferenceable(88) %1) #7
  %14 = load ptr, ptr %6, align 8, !tbaa !5
  invoke void @_ZN3MIR4eval9StaticRefC2EN3HIR4PathEPK14EncodedLiteral(ptr noundef nonnull align 8 dereferenceable(112) %12, ptr noundef %10, ptr noundef %14)
          to label %15 unwind label %22

15:                                               ; preds = %13
  store i1 false, ptr %11, align 1
  %16 = getelementptr inbounds %"class.MIR::eval::RefCountPtr.25", ptr %0, i32 0, i32 0
  store ptr %12, ptr %16, align 8, !tbaa !9
  call void @_ZN3HIR4PathD2Ev(ptr noundef nonnull align 8 dereferenceable(88) %10) #7
  store i1 true, ptr %7, align 1
  %17 = load i1, ptr %7, align 1
  br i1 %17, label %30, label %29

18:                                               ; preds = %3
  %19 = landingpad { ptr, i32 }
          cleanup
  %20 = extractvalue { ptr, i32 } %19, 0
  store ptr %20, ptr %8, align 8
  %21 = extractvalue { ptr, i32 } %19, 1
  store i32 %21, ptr %9, align 4
  br label %31

22:                                               ; preds = %13
  %23 = landingpad { ptr, i32 }
          cleanup
  %24 = extractvalue { ptr, i32 } %23, 0
  store ptr %24, ptr %8, align 8
  %25 = extractvalue { ptr, i32 } %23, 1
  store i32 %25, ptr %9, align 4
  call void @_ZN3HIR4PathD2Ev(ptr noundef nonnull align 8 dereferenceable(88) %10) #7
  %26 = load i1, ptr %11, align 1
  br i1 %26, label %27, label %28

27:                                               ; preds = %22
  call void @_ZdlPvm(ptr noundef %12, i64 noundef 112) #8
  br label %28

28:                                               ; preds = %27, %22
  br label %31

29:                                               ; preds = %15
  call void @_ZN3MIR4eval11RefCountPtrINS0_9StaticRefEED2Ev(ptr noundef nonnull align 8 dereferenceable(8) %0) #7
  br label %30

30:                                               ; preds = %29, %15
  ret void

31:                                               ; preds = %28, %18
  call void @_ZN3MIR4eval11RefCountPtrINS0_9StaticRefEED2Ev(ptr noundef nonnull align 8 dereferenceable(8) %0) #7
  br label %32

32:                                               ; preds = %31
  %33 = load ptr, ptr %8, align 8
  %34 = load i32, ptr %9, align 4
  %35 = insertvalue { ptr, i32 } poison, ptr %33, 0
  %36 = insertvalue { ptr, i32 } %35, i32 %34, 1
  resume { ptr, i32 } %36
}

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

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local void @_ZN3HIR4PathC2EOS0_(ptr noundef nonnull align 8 dereferenceable(88), ptr noundef nonnull align 8 dereferenceable(88)) unnamed_addr #4 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZN3MIR4eval9StaticRefC2EN3HIR4PathEPK14EncodedLiteral(ptr noundef nonnull align 8 dereferenceable(112), ptr noundef, ptr noundef) unnamed_addr #5 align 2

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

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

attributes #0 = { nobuiltin 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 #1 = { nobuiltin allocsize(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 = { inlinehint 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 #4 = { 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 #5 = { 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 #6 = { builtin allocsize(0) }
attributes #7 = { nounwind }
attributes #8 = { builtin 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 0}
!10 = !{!"_ZTSN3MIR4eval11RefCountPtrINS0_9StaticRefEEE", !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"

%"class.MIR::eval::StaticRefPtr" = type { %"class.MIR::eval::RefCountPtr.25" }
%"class.MIR::eval::RefCountPtr.25" = type { ptr }
%"class.HIR::Path" = type { %"class.HIR::Path::Data" }
%"class.HIR::Path::Data" = type { i32, %"union.HIR::Path::Data::DataUnion" }
%"union.HIR::Path::Data::DataUnion" = type { %"struct.HIR::Path::Data::Data_UfcsKnown" }
%"struct.HIR::Path::Data::Data_UfcsKnown" = type { %"class.HIR::TypeRef", %"class.HIR::GenericPath", %class.RcString, %"struct.HIR::PathParams", %"class.std::unique_ptr" }
%"class.HIR::TypeRef" = type { ptr }
%"class.HIR::GenericPath" = type { %"struct.HIR::SimplePath", %"struct.HIR::PathParams" }
%"struct.HIR::SimplePath" = type { %class.ThinVector }
%class.ThinVector = type { ptr }
%class.RcString = type { ptr }
%"struct.HIR::PathParams" = type { %class.ThinVector.20, %class.ThinVector.21, %class.ThinVector.22 }
%class.ThinVector.20 = type { ptr }
%class.ThinVector.21 = type { ptr }
%class.ThinVector.22 = type { ptr }
%"class.std::unique_ptr" = type { %"struct.std::__uniq_ptr_data" }
%"struct.std::__uniq_ptr_data" = type { %"class.std::__uniq_ptr_impl" }
%"class.std::__uniq_ptr_impl" = type { %"class.std::tuple" }
%"class.std::tuple" = type { %"struct.std::_Tuple_impl" }
%"struct.std::_Tuple_impl" = type { %"struct.std::_Head_base.24" }
%"struct.std::_Head_base.24" = type { ptr }

declare i32 @__gxx_personality_v0(...)

; Function Attrs: nobuiltin allocsize(0)
declare noundef nonnull ptr @_Znwm(i64 noundef) local_unnamed_addr #0

; Function Attrs: mustprogress uwtable
define dso_local void @_ZN3MIR4eval12StaticRefPtr8allocateEN3HIR4PathEPK14EncodedLiteral(ptr dead_on_unwind noalias nonnull writable sret(%"class.MIR::eval::StaticRefPtr") align 8 %0, ptr noundef %1, ptr noundef %2) local_unnamed_addr #1 align 2 personality ptr @__gxx_personality_v0 {
  %4 = alloca %"class.HIR::Path", align 8
  tail call void @_ZN3MIR4eval12StaticRefPtrC2Ev(ptr noundef nonnull align 8 dereferenceable(8) %0)
  %5 = invoke noalias noundef nonnull dereferenceable(112) ptr @_Znwm(i64 noundef 112) #5
          to label %6 unwind label %7

6:                                                ; preds = %3
  call void @_ZN3HIR4PathC2EOS0_(ptr noundef nonnull align 8 dereferenceable(88) %4, ptr noundef nonnull align 8 dereferenceable(88) %1) #6
  call void @_ZN3MIR4eval9StaticRefC2EN3HIR4PathEPK14EncodedLiteral(ptr noundef nonnull align 8 dereferenceable(112) %5, ptr noundef nonnull %4, ptr noundef %2)
  store ptr %5, ptr %0, align 8, !tbaa !5
  call void @_ZN3HIR4PathD2Ev(ptr noundef nonnull align 8 dereferenceable(88) %4) #6
  ret void

7:                                                ; preds = %3
  %8 = landingpad { ptr, i32 }
          cleanup
  tail call void @_ZN3MIR4eval11RefCountPtrINS0_9StaticRefEED2Ev(ptr noundef nonnull align 8 dereferenceable(8) %0) #6
  resume { ptr, i32 } %8
}

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

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local void @_ZN3HIR4PathC2EOS0_(ptr noundef nonnull align 8 dereferenceable(88), ptr noundef nonnull align 8 dereferenceable(88)) unnamed_addr #3 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZN3MIR4eval9StaticRefC2EN3HIR4PathEPK14EncodedLiteral(ptr noundef nonnull align 8 dereferenceable(112), ptr noundef, ptr noundef) unnamed_addr #4 align 2

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

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

attributes #0 = { nobuiltin allocsize(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 #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 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 = { 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 #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 = { builtin allocsize(0) }
attributes #6 = { 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 0}
!6 = !{!"_ZTSN3MIR4eval11RefCountPtrINS0_9StaticRefEEE", !7, i64 0}
!7 = !{!"any pointer", !8, i64 0}
!8 = !{!"omnipotent char", !9, i64 0}
!9 = !{!"Simple C++ TBAA"}


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