; LLVM IR from thepowersgang/mrustc :: src/mir/from_hir_match.ll (ZN21PatternRulesetBuilder14set_impossibleEv)

; 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.PatternRulesetBuilder = type { ptr, ptr, %"class.std::vector.70", i64, i64, %struct.field_path_t }
%"class.std::vector.70" = type { %"struct.std::_Vector_base.71" }
%"struct.std::_Vector_base.71" = type { %"struct.std::_Vector_base<PatternRulesetBuilder::Ruleset, std::allocator<PatternRulesetBuilder::Ruleset>>::_Vector_impl" }
%"struct.std::_Vector_base<PatternRulesetBuilder::Ruleset, std::allocator<PatternRulesetBuilder::Ruleset>>::_Vector_impl" = type { %"struct.std::_Vector_base<PatternRulesetBuilder::Ruleset, std::allocator<PatternRulesetBuilder::Ruleset>>::_Vector_impl_data" }
%"struct.std::_Vector_base<PatternRulesetBuilder::Ruleset, std::allocator<PatternRulesetBuilder::Ruleset>>::_Vector_impl_data" = type { ptr, ptr, ptr }
%struct.field_path_t = type { %"class.std::vector.0" }
%"class.std::vector.0" = type { %"struct.std::_Vector_base.1" }
%"struct.std::_Vector_base.1" = type { %"struct.std::_Vector_base<unsigned char, std::allocator<unsigned char>>::_Vector_impl" }
%"struct.std::_Vector_base<unsigned char, std::allocator<unsigned char>>::_Vector_impl" = type { %"struct.std::_Vector_base<unsigned char, std::allocator<unsigned char>>::_Vector_impl_data" }
%"struct.std::_Vector_base<unsigned char, std::allocator<unsigned char>>::_Vector_impl_data" = type { ptr, ptr, ptr }
%"struct.PatternRulesetBuilder::Ruleset" = type { i8, %"class.std::vector.136", %"class.std::vector.141" }
%"class.std::vector.136" = type { %"struct.std::_Vector_base.137" }
%"struct.std::_Vector_base.137" = type { %"struct.std::_Vector_base<PatternRule, std::allocator<PatternRule>>::_Vector_impl" }
%"struct.std::_Vector_base<PatternRule, std::allocator<PatternRule>>::_Vector_impl" = type { %"struct.std::_Vector_base<PatternRule, std::allocator<PatternRule>>::_Vector_impl_data" }
%"struct.std::_Vector_base<PatternRule, std::allocator<PatternRule>>::_Vector_impl_data" = type { ptr, ptr, ptr }
%"class.std::vector.141" = type { %"struct.std::_Vector_base.142" }
%"struct.std::_Vector_base.142" = type { %"struct.std::_Vector_base<PatternBinding, std::allocator<PatternBinding>>::_Vector_impl" }
%"struct.std::_Vector_base<PatternBinding, std::allocator<PatternBinding>>::_Vector_impl" = type { %"struct.std::_Vector_base<PatternBinding, std::allocator<PatternBinding>>::_Vector_impl_data" }
%"struct.std::_Vector_base<PatternBinding, std::allocator<PatternBinding>>::_Vector_impl_data" = type { ptr, ptr, ptr }

@.str.17 = external hidden unnamed_addr constant [81 x i8], align 1
@.str.39 = external hidden unnamed_addr constant [38 x i8], align 1
@.str.40 = external hidden unnamed_addr constant [38 x i8], align 1
@__PRETTY_FUNCTION__._ZN21PatternRulesetBuilder14set_impossibleEv = external hidden unnamed_addr constant [45 x i8], align 1

; 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: noreturn nounwind
declare void @__assert_fail(ptr noundef, ptr noundef, i32 noundef, ptr noundef) #1

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

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

; Function Attrs: mustprogress nounwind uwtable
define dso_local void @_ZN21PatternRulesetBuilder14set_impossibleEv(ptr noundef nonnull align 8 dereferenceable(80) %0) #2 align 2 {
  %2 = alloca ptr, align 8
  %3 = alloca i64, align 8
  store ptr %0, ptr %2, align 8, !tbaa !5
  %4 = load ptr, ptr %2, align 8
  %5 = getelementptr inbounds %struct.PatternRulesetBuilder, ptr %4, i32 0, i32 3
  %6 = load i64, ptr %5, align 8, !tbaa !9
  %7 = getelementptr inbounds %struct.PatternRulesetBuilder, ptr %4, i32 0, i32 4
  %8 = load i64, ptr %7, align 8, !tbaa !21
  %9 = icmp ult i64 %6, %8
  br i1 %9, label %10, label %11

10:                                               ; preds = %1
  br label %13

11:                                               ; preds = %1
  call void @__assert_fail(ptr noundef @.str.39, ptr noundef @.str.17, i32 noundef 858, ptr noundef @__PRETTY_FUNCTION__._ZN21PatternRulesetBuilder14set_impossibleEv) #3
  unreachable

12:                                               ; No predecessors!
  br label %13

13:                                               ; preds = %12, %10
  %14 = getelementptr inbounds %struct.PatternRulesetBuilder, ptr %4, i32 0, i32 4
  %15 = load i64, ptr %14, align 8, !tbaa !21
  %16 = getelementptr inbounds %struct.PatternRulesetBuilder, ptr %4, i32 0, i32 2
  %17 = call noundef i64 @_ZNKSt6vectorIN21PatternRulesetBuilder7RulesetESaIS1_EE4sizeEv(ptr noundef nonnull align 8 dereferenceable(24) %16) #4
  %18 = icmp ule i64 %15, %17
  br i1 %18, label %19, label %20

19:                                               ; preds = %13
  br label %22

20:                                               ; preds = %13
  call void @__assert_fail(ptr noundef @.str.40, ptr noundef @.str.17, i32 noundef 859, ptr noundef @__PRETTY_FUNCTION__._ZN21PatternRulesetBuilder14set_impossibleEv) #3
  unreachable

21:                                               ; No predecessors!
  br label %22

22:                                               ; preds = %21, %19
  call void @llvm.lifetime.start.p0(i64 8, ptr %3) #4
  %23 = getelementptr inbounds %struct.PatternRulesetBuilder, ptr %4, i32 0, i32 3
  %24 = load i64, ptr %23, align 8, !tbaa !9
  store i64 %24, ptr %3, align 8, !tbaa !22
  br label %25

25:                                               ; preds = %36, %22
  %26 = load i64, ptr %3, align 8, !tbaa !22
  %27 = getelementptr inbounds %struct.PatternRulesetBuilder, ptr %4, i32 0, i32 4
  %28 = load i64, ptr %27, align 8, !tbaa !21
  %29 = icmp ult i64 %26, %28
  br i1 %29, label %31, label %30

30:                                               ; preds = %25
  call void @llvm.lifetime.end.p0(i64 8, ptr %3) #4
  br label %39

31:                                               ; preds = %25
  %32 = getelementptr inbounds %struct.PatternRulesetBuilder, ptr %4, i32 0, i32 2
  %33 = load i64, ptr %3, align 8, !tbaa !22
  %34 = call noundef nonnull align 8 dereferenceable(56) ptr @_ZNSt6vectorIN21PatternRulesetBuilder7RulesetESaIS1_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) %32, i64 noundef %33) #4
  %35 = getelementptr inbounds %"struct.PatternRulesetBuilder::Ruleset", ptr %34, i32 0, i32 0
  store i8 1, ptr %35, align 8, !tbaa !23
  br label %36

36:                                               ; preds = %31
  %37 = load i64, ptr %3, align 8, !tbaa !22
  %38 = add i64 %37, 1
  store i64 %38, ptr %3, align 8, !tbaa !22
  br label %25, !llvm.loop !34

39:                                               ; preds = %30
  ret void
}

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { 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 #2 = { mustprogress nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { noreturn nounwind }
attributes #4 = { 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, !15, i64 40}
!10 = !{!"_ZTS21PatternRulesetBuilder", !6, i64 0, !6, i64 8, !11, i64 16, !15, i64 40, !15, i64 48, !16, i64 56}
!11 = !{!"_ZTSSt6vectorIN21PatternRulesetBuilder7RulesetESaIS1_EE", !12, i64 0}
!12 = !{!"_ZTSSt12_Vector_baseIN21PatternRulesetBuilder7RulesetESaIS1_EE", !13, i64 0}
!13 = !{!"_ZTSNSt12_Vector_baseIN21PatternRulesetBuilder7RulesetESaIS1_EE12_Vector_implE", !14, i64 0}
!14 = !{!"_ZTSNSt12_Vector_baseIN21PatternRulesetBuilder7RulesetESaIS1_EE17_Vector_impl_dataE", !6, i64 0, !6, i64 8, !6, i64 16}
!15 = !{!"long", !7, i64 0}
!16 = !{!"_ZTS12field_path_t", !17, i64 0}
!17 = !{!"_ZTSSt6vectorIhSaIhEE", !18, i64 0}
!18 = !{!"_ZTSSt12_Vector_baseIhSaIhEE", !19, i64 0}
!19 = !{!"_ZTSNSt12_Vector_baseIhSaIhEE12_Vector_implE", !20, i64 0}
!20 = !{!"_ZTSNSt12_Vector_baseIhSaIhEE17_Vector_impl_dataE", !6, i64 0, !6, i64 8, !6, i64 16}
!21 = !{!10, !15, i64 48}
!22 = !{!15, !15, i64 0}
!23 = !{!24, !25, i64 0}
!24 = !{!"_ZTSN21PatternRulesetBuilder7RulesetE", !25, i64 0, !26, i64 8, !30, i64 32}
!25 = !{!"bool", !7, i64 0}
!26 = !{!"_ZTSSt6vectorI11PatternRuleSaIS0_EE", !27, i64 0}
!27 = !{!"_ZTSSt12_Vector_baseI11PatternRuleSaIS0_EE", !28, i64 0}
!28 = !{!"_ZTSNSt12_Vector_baseI11PatternRuleSaIS0_EE12_Vector_implE", !29, i64 0}
!29 = !{!"_ZTSNSt12_Vector_baseI11PatternRuleSaIS0_EE17_Vector_impl_dataE", !6, i64 0, !6, i64 8, !6, i64 16}
!30 = !{!"_ZTSSt6vectorI14PatternBindingSaIS0_EE", !31, i64 0}
!31 = !{!"_ZTSSt12_Vector_baseI14PatternBindingSaIS0_EE", !32, i64 0}
!32 = !{!"_ZTSNSt12_Vector_baseI14PatternBindingSaIS0_EE12_Vector_implE", !33, i64 0}
!33 = !{!"_ZTSNSt12_Vector_baseI14PatternBindingSaIS0_EE17_Vector_impl_dataE", !6, i64 0, !6, i64 8, !6, i64 16}
!34 = distinct !{!34, !35}
!35 = !{!"llvm.loop.mustprogress"}


; 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"

@.str.17 = external hidden unnamed_addr constant [81 x i8], align 1
@.str.39 = external hidden unnamed_addr constant [38 x i8], align 1
@.str.40 = external hidden unnamed_addr constant [38 x i8], align 1
@__PRETTY_FUNCTION__._ZN21PatternRulesetBuilder14set_impossibleEv = external hidden unnamed_addr constant [45 x i8], align 1

; Function Attrs: noreturn nounwind
declare void @__assert_fail(ptr noundef, ptr noundef, i32 noundef, ptr noundef) local_unnamed_addr #0

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

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

; Function Attrs: mustprogress nounwind uwtable
define dso_local void @_ZN21PatternRulesetBuilder14set_impossibleEv(ptr noundef nonnull align 8 dereferenceable(80) %0) local_unnamed_addr #1 align 2 {
  %2 = getelementptr inbounds i8, ptr %0, i64 40
  %3 = load i64, ptr %2, align 8, !tbaa !5
  %4 = getelementptr inbounds i8, ptr %0, i64 48
  %5 = load i64, ptr %4, align 8, !tbaa !20
  %6 = icmp ult i64 %3, %5
  br i1 %6, label %8, label %7

7:                                                ; preds = %1
  tail call void @__assert_fail(ptr noundef nonnull @.str.39, ptr noundef nonnull @.str.17, i32 noundef 858, ptr noundef nonnull @__PRETTY_FUNCTION__._ZN21PatternRulesetBuilder14set_impossibleEv) #2
  unreachable

8:                                                ; preds = %1
  %9 = getelementptr inbounds i8, ptr %0, i64 16
  %10 = tail call noundef i64 @_ZNKSt6vectorIN21PatternRulesetBuilder7RulesetESaIS1_EE4sizeEv(ptr noundef nonnull align 8 dereferenceable(24) %9) #3
  %.not = icmp ugt i64 %5, %10
  br i1 %.not, label %11, label %12

11:                                               ; preds = %8
  tail call void @__assert_fail(ptr noundef nonnull @.str.40, ptr noundef nonnull @.str.17, i32 noundef 859, ptr noundef nonnull @__PRETTY_FUNCTION__._ZN21PatternRulesetBuilder14set_impossibleEv) #2
  unreachable

12:                                               ; preds = %8
  %13 = load i64, ptr %2, align 8, !tbaa !5
  %14 = load i64, ptr %4, align 8, !tbaa !20
  %15 = icmp ult i64 %13, %14
  br i1 %15, label %.lr.ph, label %._crit_edge

._crit_edge:                                      ; preds = %.lr.ph, %12
  ret void

.lr.ph:                                           ; preds = %12, %.lr.ph
  %.04 = phi i64 [ %17, %.lr.ph ], [ %13, %12 ]
  %16 = tail call noundef nonnull align 8 dereferenceable(56) ptr @_ZNSt6vectorIN21PatternRulesetBuilder7RulesetESaIS1_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) %9, i64 noundef %.04) #3
  store i8 1, ptr %16, align 8, !tbaa !21
  %17 = add nuw i64 %.04, 1
  %18 = load i64, ptr %4, align 8, !tbaa !20
  %19 = icmp ult i64 %17, %18
  br i1 %19, label %.lr.ph, label %._crit_edge, !llvm.loop !32
}

attributes #0 = { 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 #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 = { noreturn nounwind }
attributes #3 = { nounwind }

!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}

!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"clang version 19.1.0 (git@github.com:llvm/llvm-project.git a4bf6cd7cfb1a1421ba92bca9d017b49936c55e4)"}
!5 = !{!6, !14, i64 40}
!6 = !{!"_ZTS21PatternRulesetBuilder", !7, i64 0, !7, i64 8, !10, i64 16, !14, i64 40, !14, i64 48, !15, i64 56}
!7 = !{!"any pointer", !8, i64 0}
!8 = !{!"omnipotent char", !9, i64 0}
!9 = !{!"Simple C++ TBAA"}
!10 = !{!"_ZTSSt6vectorIN21PatternRulesetBuilder7RulesetESaIS1_EE", !11, i64 0}
!11 = !{!"_ZTSSt12_Vector_baseIN21PatternRulesetBuilder7RulesetESaIS1_EE", !12, i64 0}
!12 = !{!"_ZTSNSt12_Vector_baseIN21PatternRulesetBuilder7RulesetESaIS1_EE12_Vector_implE", !13, i64 0}
!13 = !{!"_ZTSNSt12_Vector_baseIN21PatternRulesetBuilder7RulesetESaIS1_EE17_Vector_impl_dataE", !7, i64 0, !7, i64 8, !7, i64 16}
!14 = !{!"long", !8, i64 0}
!15 = !{!"_ZTS12field_path_t", !16, i64 0}
!16 = !{!"_ZTSSt6vectorIhSaIhEE", !17, i64 0}
!17 = !{!"_ZTSSt12_Vector_baseIhSaIhEE", !18, i64 0}
!18 = !{!"_ZTSNSt12_Vector_baseIhSaIhEE12_Vector_implE", !19, i64 0}
!19 = !{!"_ZTSNSt12_Vector_baseIhSaIhEE17_Vector_impl_dataE", !7, i64 0, !7, i64 8, !7, i64 16}
!20 = !{!6, !14, i64 48}
!21 = !{!22, !23, i64 0}
!22 = !{!"_ZTSN21PatternRulesetBuilder7RulesetE", !23, i64 0, !24, i64 8, !28, i64 32}
!23 = !{!"bool", !8, i64 0}
!24 = !{!"_ZTSSt6vectorI11PatternRuleSaIS0_EE", !25, i64 0}
!25 = !{!"_ZTSSt12_Vector_baseI11PatternRuleSaIS0_EE", !26, i64 0}
!26 = !{!"_ZTSNSt12_Vector_baseI11PatternRuleSaIS0_EE12_Vector_implE", !27, i64 0}
!27 = !{!"_ZTSNSt12_Vector_baseI11PatternRuleSaIS0_EE17_Vector_impl_dataE", !7, i64 0, !7, i64 8, !7, i64 16}
!28 = !{!"_ZTSSt6vectorI14PatternBindingSaIS0_EE", !29, i64 0}
!29 = !{!"_ZTSSt12_Vector_baseI14PatternBindingSaIS0_EE", !30, i64 0}
!30 = !{!"_ZTSNSt12_Vector_baseI14PatternBindingSaIS0_EE12_Vector_implE", !31, i64 0}
!31 = !{!"_ZTSNSt12_Vector_baseI14PatternBindingSaIS0_EE17_Vector_impl_dataE", !7, i64 0, !7, i64 8, !7, i64 16}
!32 = distinct !{!32, !33}
!33 = !{!"llvm.loop.mustprogress"}


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