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

; 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.RulesetRef = type { ptr, ptr, i64, i64 }
%class.TraceLog = type { ptr, %"class.std::function" }
%"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.462 = type { ptr }

@g_debug_indent_level = external global i32, align 4
@.str.17 = external hidden unnamed_addr constant [81 x i8], align 1
@.str.69 = external hidden unnamed_addr constant [25 x i8], align 1
@__PRETTY_FUNCTION__._Z13sort_rulesets10RulesetRefm = external hidden unnamed_addr constant [39 x i8], align 1
@__func__._Z13sort_rulesets10RulesetRefm = external hidden unnamed_addr constant [14 x i8], align 1
@.str.70 = external hidden unnamed_addr constant [3 x i8], align 1
@.str.71 = external hidden unnamed_addr constant [3 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

declare noundef zeroext i1 @_Z13debug_enabledv() #1

declare i32 @__gxx_personality_v0(...)

; Function Attrs: nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #0

; Function Attrs: inlinehint mustprogress uwtable
declare noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc(ptr noundef nonnull align 8 dereferenceable(8), ptr noundef) #2

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

declare noundef nonnull align 8 dereferenceable(8) ptr @_Z12debug_outputiPKc(i32 noundef, ptr noundef) #1

; Function Attrs: mustprogress uwtable
declare noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEPFRSt8ios_baseS0_E(ptr noundef nonnull align 8 dereferenceable(8), ptr noundef) #3 align 2

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

; Function Attrs: mustprogress uwtable
declare noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEPFRSoS_E(ptr noundef nonnull align 8 dereferenceable(8), ptr noundef) #3 align 2

; Function Attrs: inlinehint mustprogress uwtable
declare noundef nonnull align 8 dereferenceable(8) ptr @_ZSt4endlIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_(ptr noundef nonnull align 8 dereferenceable(8)) #2

; Function Attrs: nounwind
declare void @_ZN8TraceLogD1Ev(ptr noundef nonnull align 8 dereferenceable(40)) unnamed_addr #4

; Function Attrs: mustprogress uwtable
declare noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEm(ptr noundef nonnull align 8 dereferenceable(8), i64 noundef) #3 align 2

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

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

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef zeroext i1 @_ZNK11PatternRule6is_AnyEv(ptr noundef nonnull align 8 dereferenceable(120)) #5 align 2

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

; Function Attrs: mustprogress uwtable
define dso_local void @_Z13sort_rulesets10RulesetRefm(ptr noundef byval(%class.RulesetRef) align 8 %0, i64 noundef %1) #3 personality ptr @__gxx_personality_v0 {
  %3 = alloca i64, align 8
  %4 = alloca i8, align 1
  %5 = alloca i64, align 8
  %6 = alloca %class.TraceLog, align 8
  %7 = alloca %"class.std::function", align 8
  %8 = alloca %class.anon.462, align 8
  %9 = alloca ptr, align 8
  %10 = alloca i32, align 4
  %11 = alloca i64, align 8
  %12 = alloca i8, align 1
  %13 = alloca i64, align 8
  %14 = alloca i64, align 8
  %15 = alloca i64, align 8
  %16 = alloca i64, align 8
  %17 = alloca %class.RulesetRef, align 8
  %18 = alloca %class.RulesetRef, align 8
  %19 = alloca i64, align 8
  %20 = alloca i64, align 8
  %21 = alloca %class.RulesetRef, align 8
  %22 = alloca %class.RulesetRef, align 8
  %23 = alloca %class.RulesetRef, align 8
  store i64 %1, ptr %3, align 8, !tbaa !5
  %24 = call noundef i64 @_ZNK10RulesetRef4sizeEv(ptr noundef nonnull align 8 dereferenceable(32) %0)
  %25 = icmp ult i64 %24, 2
  br i1 %25, label %26, label %27

26:                                               ; preds = %2
  br label %336

27:                                               ; preds = %2
  %28 = call noundef nonnull align 8 dereferenceable(24) ptr @_ZNK10RulesetRefixEm(ptr noundef nonnull align 8 dereferenceable(32) %0, i64 noundef 0)
  %29 = call noundef i64 @_ZNKSt6vectorI11PatternRuleSaIS0_EE4sizeEv(ptr noundef nonnull align 8 dereferenceable(24) %28) #8
  %30 = icmp eq i64 %29, 0
  br i1 %30, label %31, label %32

31:                                               ; preds = %27
  br label %336

32:                                               ; preds = %27
  call void @llvm.lifetime.start.p0(i64 1, ptr %4) #8
  store i8 0, ptr %4, align 1, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 8, ptr %5) #8
  store i64 0, ptr %5, align 8, !tbaa !5
  br label %33

33:                                               ; preds = %55, %32
  %34 = load i64, ptr %5, align 8, !tbaa !5
  %35 = call noundef i64 @_ZNK10RulesetRef4sizeEv(ptr noundef nonnull align 8 dereferenceable(32) %0)
  %36 = icmp ult i64 %34, %35
  br i1 %36, label %38, label %37

37:                                               ; preds = %33
  call void @llvm.lifetime.end.p0(i64 8, ptr %5) #8
  br label %58

38:                                               ; preds = %33
  %39 = load i64, ptr %3, align 8, !tbaa !5
  %40 = load i64, ptr %5, align 8, !tbaa !5
  %41 = call noundef nonnull align 8 dereferenceable(24) ptr @_ZNK10RulesetRefixEm(ptr noundef nonnull align 8 dereferenceable(32) %0, i64 noundef %40)
  %42 = call noundef i64 @_ZNKSt6vectorI11PatternRuleSaIS0_EE4sizeEv(ptr noundef nonnull align 8 dereferenceable(24) %41) #8
  %43 = icmp ult i64 %39, %42
  br i1 %43, label %44, label %45

44:                                               ; preds = %38
  br label %47

45:                                               ; preds = %38
  call void @__assert_fail(ptr noundef @.str.69, ptr noundef @.str.17, i32 noundef 2144, ptr noundef @__PRETTY_FUNCTION__._Z13sort_rulesets10RulesetRefm) #9
  unreachable

46:                                               ; No predecessors!
  br label %47

47:                                               ; preds = %46, %44
  %48 = load i64, ptr %5, align 8, !tbaa !5
  %49 = call noundef nonnull align 8 dereferenceable(24) ptr @_ZNK10RulesetRefixEm(ptr noundef nonnull align 8 dereferenceable(32) %0, i64 noundef %48)
  %50 = load i64, ptr %3, align 8, !tbaa !5
  %51 = call noundef nonnull align 8 dereferenceable(120) ptr @_ZNKSt6vectorI11PatternRuleSaIS0_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) %49, i64 noundef %50) #8
  %52 = call noundef zeroext i1 @_ZNK11PatternRule6is_AnyEv(ptr noundef nonnull align 8 dereferenceable(120) %51)
  br i1 %52, label %54, label %53

53:                                               ; preds = %47
  store i8 1, ptr %4, align 1, !tbaa !9
  br label %54

54:                                               ; preds = %53, %47
  br label %55

55:                                               ; preds = %54
  %56 = load i64, ptr %5, align 8, !tbaa !5
  %57 = add i64 %56, 1
  store i64 %57, ptr %5, align 8, !tbaa !5
  br label %33, !llvm.loop !11

58:                                               ; preds = %37
  %59 = load i8, ptr %4, align 1, !tbaa !9, !range !13, !noundef !14
  %60 = trunc i8 %59 to i1
  br i1 %60, label %61, label %325

61:                                               ; preds = %58
  call void @llvm.lifetime.start.p0(i64 40, ptr %6) #8
  %62 = call noundef zeroext i1 @_Z13debug_enabledv()
  %63 = zext i1 %62 to i64
  %64 = select i1 %62, ptr @__func__._Z13sort_rulesets10RulesetRefm, ptr null
  call void @llvm.lifetime.start.p0(i64 8, ptr %8) #8
  %65 = getelementptr inbounds %class.anon.462, ptr %8, i32 0, i32 0
  store ptr %3, ptr %65, align 8, !tbaa !15
  call void @"_ZNSt8functionIFvRSoEEC2IZ13sort_rulesets10RulesetRefmE3$_0vEEOT_"(ptr noundef nonnull align 8 dereferenceable(32) %7, ptr noundef nonnull align 8 dereferenceable(8) %8) #8
  invoke void @_ZN8TraceLogC1EPKcSt8functionIFvRSoEE(ptr noundef nonnull align 8 dereferenceable(40) %6, ptr noundef %64, ptr noundef %7)
          to label %66 unwind label %73

66:                                               ; preds = %61
  call void @_ZNSt14_Function_baseD2Ev(ptr noundef nonnull align 8 dereferenceable(32) %7) #8
  call void @llvm.lifetime.end.p0(i64 8, ptr %8) #8
  call void @llvm.lifetime.start.p0(i64 8, ptr %11) #8
  store i64 0, ptr %11, align 8, !tbaa !5
  br label %67

67:                                               ; preds = %108, %66
  %68 = load i64, ptr %11, align 8, !tbaa !5
  %69 = invoke noundef i64 @_ZNK10RulesetRef4sizeEv(ptr noundef nonnull align 8 dereferenceable(32) %0)
          to label %70 unwind label %77

70:                                               ; preds = %67
  %71 = icmp ult i64 %68, %69
  br i1 %71, label %81, label %72

72:                                               ; preds = %70
  call void @llvm.lifetime.end.p0(i64 8, ptr %11) #8
  br label %111

73:                                               ; preds = %61
  %74 = landingpad { ptr, i32 }
          cleanup
  %75 = extractvalue { ptr, i32 } %74, 0
  store ptr %75, ptr %9, align 8
  %76 = extractvalue { ptr, i32 } %74, 1
  store i32 %76, ptr %10, align 4
  call void @_ZNSt14_Function_baseD2Ev(ptr noundef nonnull align 8 dereferenceable(32) %7) #8
  call void @llvm.lifetime.end.p0(i64 8, ptr %8) #8
  br label %324

77:                                               ; preds = %102, %100, %98, %95, %93, %90, %88, %85, %82, %67
  %78 = landingpad { ptr, i32 }
          cleanup
  %79 = extractvalue { ptr, i32 } %78, 0
  store ptr %79, ptr %9, align 8
  %80 = extractvalue { ptr, i32 } %78, 1
  store i32 %80, ptr %10, align 4
  call void @llvm.lifetime.end.p0(i64 8, ptr %11) #8
  br label %323

81:                                               ; preds = %70
  br label %82

82:                                               ; preds = %81
  %83 = invoke noundef zeroext i1 @_Z13debug_enabledv()
          to label %84 unwind label %77

84:                                               ; preds = %82
  br i1 %83, label %85, label %105

85:                                               ; preds = %84
  %86 = load i32, ptr @g_debug_indent_level, align 4, !tbaa !17
  %87 = invoke noundef nonnull align 8 dereferenceable(8) ptr @_Z12debug_outputiPKc(i32 noundef %86, ptr noundef @__func__._Z13sort_rulesets10RulesetRefm)
          to label %88 unwind label %77

88:                                               ; preds = %85
  %89 = invoke noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc(ptr noundef nonnull align 8 dereferenceable(8) %87, ptr noundef @.str.70)
          to label %90 unwind label %77

90:                                               ; preds = %88
  %91 = load i64, ptr %11, align 8, !tbaa !5
  %92 = invoke noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEm(ptr noundef nonnull align 8 dereferenceable(8) %89, i64 noundef %91)
          to label %93 unwind label %77

93:                                               ; preds = %90
  %94 = invoke noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc(ptr noundef nonnull align 8 dereferenceable(8) %92, ptr noundef @.str.71)
          to label %95 unwind label %77

95:                                               ; preds = %93
  %96 = load i64, ptr %11, align 8, !tbaa !5
  %97 = invoke noundef nonnull align 8 dereferenceable(24) ptr @_ZNK10RulesetRefixEm(ptr noundef nonnull align 8 dereferenceable(32) %0, i64 noundef %96)
          to label %98 unwind label %77

98:                                               ; preds = %95
  %99 = invoke noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsI11PatternRuleERSoS1_RKSt6vectorIT_SaIS3_EE(ptr noundef nonnull align 8 dereferenceable(8) %94, ptr noundef nonnull align 8 dereferenceable(24) %97)
          to label %100 unwind label %77

100:                                              ; preds = %98
  %101 = invoke noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEPFRSt8ios_baseS0_E(ptr noundef nonnull align 8 dereferenceable(8) %99, ptr noundef @_ZSt3decRSt8ios_base)
          to label %102 unwind label %77

102:                                              ; preds = %100
  %103 = invoke noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEPFRSoS_E(ptr noundef nonnull align 8 dereferenceable(8) %101, ptr noundef @_ZSt4endlIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_)
          to label %104 unwind label %77

104:                                              ; preds = %102
  br label %105

105:                                              ; preds = %104, %84
  br label %106

106:                                              ; preds = %105
  br label %107

107:                                              ; preds = %106
  br label %108

108:                                              ; preds = %107
  %109 = load i64, ptr %11, align 8, !tbaa !5
  %110 = add i64 %109, 1
  store i64 %110, ptr %11, align 8, !tbaa !5
  br label %67, !llvm.loop !19

111:                                              ; preds = %72
  call void @llvm.lifetime.start.p0(i64 1, ptr %12) #8
  br label %112

112:                                              ; preds = %166, %111
  store i8 0, ptr %12, align 1, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 8, ptr %13) #8
  store i64 0, ptr %13, align 8, !tbaa !5
  br label %113

113:                                              ; preds = %162, %112
  %114 = load i64, ptr %13, align 8, !tbaa !5
  %115 = invoke noundef i64 @_ZNK10RulesetRef4sizeEv(ptr noundef nonnull align 8 dereferenceable(32) %0)
          to label %116 unwind label %120

116:                                              ; preds = %113
  %117 = sub i64 %115, 1
  %118 = icmp ult i64 %114, %117
  br i1 %118, label %124, label %119

119:                                              ; preds = %116
  call void @llvm.lifetime.end.p0(i64 8, ptr %13) #8
  br label %165

120:                                              ; preds = %154, %148, %142, %139, %133, %127, %124, %113
  %121 = landingpad { ptr, i32 }
          cleanup
  %122 = extractvalue { ptr, i32 } %121, 0
  store ptr %122, ptr %9, align 8
  %123 = extractvalue { ptr, i32 } %121, 1
  store i32 %123, ptr %10, align 4
  call void @llvm.lifetime.end.p0(i64 8, ptr %13) #8
  br label %322

124:                                              ; preds = %116
  %125 = load i64, ptr %13, align 8, !tbaa !5
  %126 = invoke noundef nonnull align 8 dereferenceable(24) ptr @_ZNK10RulesetRefixEm(ptr noundef nonnull align 8 dereferenceable(32) %0, i64 noundef %125)
          to label %127 unwind label %120

127:                                              ; preds = %124
  %128 = load i64, ptr %3, align 8, !tbaa !5
  %129 = call noundef nonnull align 8 dereferenceable(120) ptr @_ZNKSt6vectorI11PatternRuleSaIS0_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) %126, i64 noundef %128) #8
  %130 = load i64, ptr %13, align 8, !tbaa !5
  %131 = add i64 %130, 1
  %132 = invoke noundef nonnull align 8 dereferenceable(24) ptr @_ZNK10RulesetRefixEm(ptr noundef nonnull align 8 dereferenceable(32) %0, i64 noundef %131)
          to label %133 unwind label %120

133:                                              ; preds = %127
  %134 = load i64, ptr %3, align 8, !tbaa !5
  %135 = call noundef nonnull align 8 dereferenceable(120) ptr @_ZNKSt6vectorI11PatternRuleSaIS0_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) %132, i64 noundef %134) #8
  %136 = invoke noundef zeroext i1 @_ZN12_GLOBAL__N_113rules_overlapERK11PatternRuleS2_(ptr noundef nonnull align 8 dereferenceable(120) %129, ptr noundef nonnull align 8 dereferenceable(120) %135)
          to label %137 unwind label %120

137:                                              ; preds = %133
  br i1 %136, label %138, label %139

138:                                              ; preds = %137
  br label %161

139:                                              ; preds = %137
  %140 = load i64, ptr %13, align 8, !tbaa !5
  %141 = invoke noundef nonnull align 8 dereferenceable(24) ptr @_ZNK10RulesetRefixEm(ptr noundef nonnull align 8 dereferenceable(32) %0, i64 noundef %140)
          to label %142 unwind label %120

142:                                              ; preds = %139
  %143 = load i64, ptr %3, align 8, !tbaa !5
  %144 = call noundef nonnull align 8 dereferenceable(120) ptr @_ZNKSt6vectorI11PatternRuleSaIS0_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) %141, i64 noundef %143) #8
  %145 = load i64, ptr %13, align 8, !tbaa !5
  %146 = add i64 %145, 1
  %147 = invoke noundef nonnull align 8 dereferenceable(24) ptr @_ZNK10RulesetRefixEm(ptr noundef nonnull align 8 dereferenceable(32) %0, i64 noundef %146)
          to label %148 unwind label %120

148:                                              ; preds = %142
  %149 = load i64, ptr %3, align 8, !tbaa !5
  %150 = call noundef nonnull align 8 dereferenceable(120) ptr @_ZNKSt6vectorI11PatternRuleSaIS0_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) %147, i64 noundef %149) #8
  %151 = invoke noundef i32 @_ZN12_GLOBAL__N_119ord_rule_compatibleERK11PatternRuleS2_(ptr noundef nonnull align 8 dereferenceable(120) %144, ptr noundef nonnull align 8 dereferenceable(120) %150)
          to label %152 unwind label %120

152:                                              ; preds = %148
  %153 = icmp eq i32 %151, 1
  br i1 %153, label %154, label %159

154:                                              ; preds = %152
  %155 = load i64, ptr %13, align 8, !tbaa !5
  %156 = load i64, ptr %13, align 8, !tbaa !5
  %157 = add i64 %156, 1
  invoke void @_ZN10RulesetRef4swapEmm(ptr noundef nonnull align 8 dereferenceable(32) %0, i64 noundef %155, i64 noundef %157)
          to label %158 unwind label %120

158:                                              ; preds = %154
  store i8 1, ptr %12, align 1, !tbaa !9
  br label %160

159:                                              ; preds = %152
  br label %160

160:                                              ; preds = %159, %158
  br label %161

161:                                              ; preds = %160, %138
  br label %162

162:                                              ; preds = %161
  %163 = load i64, ptr %13, align 8, !tbaa !5
  %164 = add i64 %163, 1
  store i64 %164, ptr %13, align 8, !tbaa !5
  br label %113, !llvm.loop !20

165:                                              ; preds = %119
  br label %166

166:                                              ; preds = %165
  %167 = load i8, ptr %12, align 1, !tbaa !9, !range !13, !noundef !14
  %168 = trunc i8 %167 to i1
  br i1 %168, label %112, label %169, !llvm.loop !21

169:                                              ; preds = %166
  call void @llvm.lifetime.start.p0(i64 8, ptr %14) #8
  store i64 0, ptr %14, align 8, !tbaa !5
  br label %170

170:                                              ; preds = %207, %169
  %171 = load i64, ptr %14, align 8, !tbaa !5
  %172 = invoke noundef i64 @_ZNK10RulesetRef4sizeEv(ptr noundef nonnull align 8 dereferenceable(32) %0)
          to label %173 unwind label %176

173:                                              ; preds = %170
  %174 = icmp ult i64 %171, %172
  br i1 %174, label %180, label %175

175:                                              ; preds = %173
  call void @llvm.lifetime.end.p0(i64 8, ptr %14) #8
  br label %210

176:                                              ; preds = %201, %199, %197, %194, %192, %189, %187, %184, %181, %170
  %177 = landingpad { ptr, i32 }
          cleanup
  %178 = extractvalue { ptr, i32 } %177, 0
  store ptr %178, ptr %9, align 8
  %179 = extractvalue { ptr, i32 } %177, 1
  store i32 %179, ptr %10, align 4
  call void @llvm.lifetime.end.p0(i64 8, ptr %14) #8
  br label %322

180:                                              ; preds = %173
  br label %181

181:                                              ; preds = %180
  %182 = invoke noundef zeroext i1 @_Z13debug_enabledv()
          to label %183 unwind label %176

183:                                              ; preds = %181
  br i1 %182, label %184, label %204

184:                                              ; preds = %183
  %185 = load i32, ptr @g_debug_indent_level, align 4, !tbaa !17
  %186 = invoke noundef nonnull align 8 dereferenceable(8) ptr @_Z12debug_outputiPKc(i32 noundef %185, ptr noundef @__func__._Z13sort_rulesets10RulesetRefm)
          to label %187 unwind label %176

187:                                              ; preds = %184
  %188 = invoke noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc(ptr noundef nonnull align 8 dereferenceable(8) %186, ptr noundef @.str.70)
          to label %189 unwind label %176

189:                                              ; preds = %187
  %190 = load i64, ptr %14, align 8, !tbaa !5
  %191 = invoke noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEm(ptr noundef nonnull align 8 dereferenceable(8) %188, i64 noundef %190)
          to label %192 unwind label %176

192:                                              ; preds = %189
  %193 = invoke noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc(ptr noundef nonnull align 8 dereferenceable(8) %191, ptr noundef @.str.71)
          to label %194 unwind label %176

194:                                              ; preds = %192
  %195 = load i64, ptr %14, align 8, !tbaa !5
  %196 = invoke noundef nonnull align 8 dereferenceable(24) ptr @_ZNK10RulesetRefixEm(ptr noundef nonnull align 8 dereferenceable(32) %0, i64 noundef %195)
          to label %197 unwind label %176

197:                                              ; preds = %194
  %198 = invoke noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsI11PatternRuleERSoS1_RKSt6vectorIT_SaIS3_EE(ptr noundef nonnull align 8 dereferenceable(8) %193, ptr noundef nonnull align 8 dereferenceable(24) %196)
          to label %199 unwind label %176

199:                                              ; preds = %197
  %200 = invoke noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEPFRSt8ios_baseS0_E(ptr noundef nonnull align 8 dereferenceable(8) %198, ptr noundef @_ZSt3decRSt8ios_base)
          to label %201 unwind label %176

201:                                              ; preds = %199
  %202 = invoke noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEPFRSoS_E(ptr noundef nonnull align 8 dereferenceable(8) %200, ptr noundef @_ZSt4endlIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_)
          to label %203 unwind label %176

203:                                              ; preds = %201
  br label %204

204:                                              ; preds = %203, %183
  br label %205

205:                                              ; preds = %204
  br label %206

206:                                              ; preds = %205
  br label %207

207:                                              ; preds = %206
  %208 = load i64, ptr %14, align 8, !tbaa !5
  %209 = add i64 %208, 1
  store i64 %209, ptr %14, align 8, !tbaa !5
  br label %170, !llvm.loop !22

210:                                              ; preds = %175
  call void @llvm.lifetime.start.p0(i64 8, ptr %15) #8
  store i64 0, ptr %15, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %16) #8
  store i64 1, ptr %16, align 8, !tbaa !5
  br label %211

211:                                              ; preds = %245, %210
  %212 = load i64, ptr %16, align 8, !tbaa !5
  %213 = invoke noundef i64 @_ZNK10RulesetRef4sizeEv(ptr noundef nonnull align 8 dereferenceable(32) %0)
          to label %214 unwind label %217

214:                                              ; preds = %211
  %215 = icmp ult i64 %212, %213
  br i1 %215, label %221, label %216

216:                                              ; preds = %214
  call void @llvm.lifetime.end.p0(i64 8, ptr %16) #8
  br label %248

217:                                              ; preds = %240, %235, %229, %224, %221, %211
  %218 = landingpad { ptr, i32 }
          cleanup
  %219 = extractvalue { ptr, i32 } %218, 0
  store ptr %219, ptr %9, align 8
  %220 = extractvalue { ptr, i32 } %218, 1
  store i32 %220, ptr %10, align 4
  call void @llvm.lifetime.end.p0(i64 8, ptr %16) #8
  br label %321

221:                                              ; preds = %214
  %222 = load i64, ptr %16, align 8, !tbaa !5
  %223 = invoke noundef nonnull align 8 dereferenceable(24) ptr @_ZNK10RulesetRefixEm(ptr noundef nonnull align 8 dereferenceable(32) %0, i64 noundef %222)
          to label %224 unwind label %217

224:                                              ; preds = %221
  %225 = load i64, ptr %3, align 8, !tbaa !5
  %226 = call noundef nonnull align 8 dereferenceable(120) ptr @_ZNKSt6vectorI11PatternRuleSaIS0_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) %223, i64 noundef %225) #8
  %227 = load i64, ptr %15, align 8, !tbaa !5
  %228 = invoke noundef nonnull align 8 dereferenceable(24) ptr @_ZNK10RulesetRefixEm(ptr noundef nonnull align 8 dereferenceable(32) %0, i64 noundef %227)
          to label %229 unwind label %217

229:                                              ; preds = %224
  %230 = load i64, ptr %3, align 8, !tbaa !5
  %231 = call noundef nonnull align 8 dereferenceable(120) ptr @_ZNKSt6vectorI11PatternRuleSaIS0_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) %228, i64 noundef %230) #8
  %232 = invoke noundef i32 @_ZN12_GLOBAL__N_119ord_rule_compatibleERK11PatternRuleS2_(ptr noundef nonnull align 8 dereferenceable(120) %226, ptr noundef nonnull align 8 dereferenceable(120) %231)
          to label %233 unwind label %217

233:                                              ; preds = %229
  %234 = icmp ne i32 %232, 0
  br i1 %234, label %235, label %244

235:                                              ; preds = %233
  %236 = load i64, ptr %15, align 8, !tbaa !5
  %237 = load i64, ptr %16, align 8, !tbaa !5
  %238 = load i64, ptr %15, align 8, !tbaa !5
  %239 = sub i64 %237, %238
  invoke void @_ZN10RulesetRef5sliceEmm(ptr dead_on_unwind writable sret(%class.RulesetRef) align 8 %17, ptr noundef nonnull align 8 dereferenceable(32) %0, i64 noundef %236, i64 noundef %239)
          to label %240 unwind label %217

240:                                              ; preds = %235
  %241 = load i64, ptr %3, align 8, !tbaa !5
  invoke void @_Z19sort_rulesets_inner10RulesetRefm(ptr noundef byval(%class.RulesetRef) align 8 %17, i64 noundef %241)
          to label %242 unwind label %217

242:                                              ; preds = %240
  %243 = load i64, ptr %16, align 8, !tbaa !5
  store i64 %243, ptr %15, align 8, !tbaa !5
  br label %244

244:                                              ; preds = %242, %233
  br label %245

245:                                              ; preds = %244
  %246 = load i64, ptr %16, align 8, !tbaa !5
  %247 = add i64 %246, 1
  store i64 %247, ptr %16, align 8, !tbaa !5
  br label %211, !llvm.loop !23

248:                                              ; preds = %216
  %249 = load i64, ptr %15, align 8, !tbaa !5
  %250 = invoke noundef i64 @_ZNK10RulesetRef4sizeEv(ptr noundef nonnull align 8 dereferenceable(32) %0)
          to label %251 unwind label %270

251:                                              ; preds = %248
  %252 = load i64, ptr %15, align 8, !tbaa !5
  %253 = sub i64 %250, %252
  invoke void @_ZN10RulesetRef5sliceEmm(ptr dead_on_unwind writable sret(%class.RulesetRef) align 8 %18, ptr noundef nonnull align 8 dereferenceable(32) %0, i64 noundef %249, i64 noundef %253)
          to label %254 unwind label %270

254:                                              ; preds = %251
  %255 = load i64, ptr %3, align 8, !tbaa !5
  invoke void @_Z19sort_rulesets_inner10RulesetRefm(ptr noundef byval(%class.RulesetRef) align 8 %18, i64 noundef %255)
          to label %256 unwind label %270

256:                                              ; preds = %254
  %257 = load i64, ptr %3, align 8, !tbaa !5
  %258 = add i64 %257, 1
  %259 = invoke noundef nonnull align 8 dereferenceable(24) ptr @_ZNK10RulesetRefixEm(ptr noundef nonnull align 8 dereferenceable(32) %0, i64 noundef 0)
          to label %260 unwind label %270

260:                                              ; preds = %256
  %261 = call noundef i64 @_ZNKSt6vectorI11PatternRuleSaIS0_EE4sizeEv(ptr noundef nonnull align 8 dereferenceable(24) %259) #8
  %262 = icmp ult i64 %258, %261
  br i1 %262, label %263, label %320

263:                                              ; preds = %260
  call void @llvm.lifetime.start.p0(i64 8, ptr %19) #8
  store i64 0, ptr %19, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %20) #8
  store i64 1, ptr %20, align 8, !tbaa !5
  br label %264

264:                                              ; preds = %302, %263
  %265 = load i64, ptr %20, align 8, !tbaa !5
  %266 = invoke noundef i64 @_ZNK10RulesetRef4sizeEv(ptr noundef nonnull align 8 dereferenceable(32) %0)
          to label %267 unwind label %274

267:                                              ; preds = %264
  %268 = icmp ult i64 %265, %266
  br i1 %268, label %278, label %269

269:                                              ; preds = %267
  call void @llvm.lifetime.end.p0(i64 8, ptr %20) #8
  br label %305

270:                                              ; preds = %256, %254, %251, %248
  %271 = landingpad { ptr, i32 }
          cleanup
  %272 = extractvalue { ptr, i32 } %271, 0
  store ptr %272, ptr %9, align 8
  %273 = extractvalue { ptr, i32 } %271, 1
  store i32 %273, ptr %10, align 4
  br label %321

274:                                              ; preds = %296, %291, %286, %281, %278, %264
  %275 = landingpad { ptr, i32 }
          cleanup
  %276 = extractvalue { ptr, i32 } %275, 0
  store ptr %276, ptr %9, align 8
  %277 = extractvalue { ptr, i32 } %275, 1
  store i32 %277, ptr %10, align 4
  call void @llvm.lifetime.end.p0(i64 8, ptr %20) #8
  br label %319

278:                                              ; preds = %267
  %279 = load i64, ptr %20, align 8, !tbaa !5
  %280 = invoke noundef nonnull align 8 dereferenceable(24) ptr @_ZNK10RulesetRefixEm(ptr noundef nonnull align 8 dereferenceable(32) %0, i64 noundef %279)
          to label %281 unwind label %274

281:                                              ; preds = %278
  %282 = load i64, ptr %3, align 8, !tbaa !5
  %283 = call noundef nonnull align 8 dereferenceable(120) ptr @_ZNKSt6vectorI11PatternRuleSaIS0_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) %280, i64 noundef %282) #8
  %284 = load i64, ptr %19, align 8, !tbaa !5
  %285 = invoke noundef nonnull align 8 dereferenceable(24) ptr @_ZNK10RulesetRefixEm(ptr noundef nonnull align 8 dereferenceable(32) %0, i64 noundef %284)
          to label %286 unwind label %274

286:                                              ; preds = %281
  %287 = load i64, ptr %3, align 8, !tbaa !5
  %288 = call noundef nonnull align 8 dereferenceable(120) ptr @_ZNKSt6vectorI11PatternRuleSaIS0_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) %285, i64 noundef %287) #8
  %289 = invoke noundef zeroext i1 @_ZNK11PatternRuleneERKS_(ptr noundef nonnull align 8 dereferenceable(120) %283, ptr noundef nonnull align 8 dereferenceable(120) %288)
          to label %290 unwind label %274

290:                                              ; preds = %286
  br i1 %289, label %291, label %301

291:                                              ; preds = %290
  %292 = load i64, ptr %19, align 8, !tbaa !5
  %293 = load i64, ptr %20, align 8, !tbaa !5
  %294 = load i64, ptr %19, align 8, !tbaa !5
  %295 = sub i64 %293, %294
  invoke void @_ZN10RulesetRef5sliceEmm(ptr dead_on_unwind writable sret(%class.RulesetRef) align 8 %21, ptr noundef nonnull align 8 dereferenceable(32) %0, i64 noundef %292, i64 noundef %295)
          to label %296 unwind label %274

296:                                              ; preds = %291
  %297 = load i64, ptr %3, align 8, !tbaa !5
  %298 = add i64 %297, 1
  invoke void @_Z13sort_rulesets10RulesetRefm(ptr noundef byval(%class.RulesetRef) align 8 %21, i64 noundef %298)
          to label %299 unwind label %274

299:                                              ; preds = %296
  %300 = load i64, ptr %20, align 8, !tbaa !5
  store i64 %300, ptr %19, align 8, !tbaa !5
  br label %301

301:                                              ; preds = %299, %290
  br label %302

302:                                              ; preds = %301
  %303 = load i64, ptr %20, align 8, !tbaa !5
  %304 = add i64 %303, 1
  store i64 %304, ptr %20, align 8, !tbaa !5
  br label %264, !llvm.loop !24

305:                                              ; preds = %269
  %306 = load i64, ptr %19, align 8, !tbaa !5
  %307 = invoke noundef i64 @_ZNK10RulesetRef4sizeEv(ptr noundef nonnull align 8 dereferenceable(32) %0)
          to label %308 unwind label %315

308:                                              ; preds = %305
  %309 = load i64, ptr %19, align 8, !tbaa !5
  %310 = sub i64 %307, %309
  invoke void @_ZN10RulesetRef5sliceEmm(ptr dead_on_unwind writable sret(%class.RulesetRef) align 8 %22, ptr noundef nonnull align 8 dereferenceable(32) %0, i64 noundef %306, i64 noundef %310)
          to label %311 unwind label %315

311:                                              ; preds = %308
  %312 = load i64, ptr %3, align 8, !tbaa !5
  %313 = add i64 %312, 1
  invoke void @_Z13sort_rulesets10RulesetRefm(ptr noundef byval(%class.RulesetRef) align 8 %22, i64 noundef %313)
          to label %314 unwind label %315

314:                                              ; preds = %311
  call void @llvm.lifetime.end.p0(i64 8, ptr %19) #8
  br label %320

315:                                              ; preds = %311, %308, %305
  %316 = landingpad { ptr, i32 }
          cleanup
  %317 = extractvalue { ptr, i32 } %316, 0
  store ptr %317, ptr %9, align 8
  %318 = extractvalue { ptr, i32 } %316, 1
  store i32 %318, ptr %10, align 4
  br label %319

319:                                              ; preds = %315, %274
  call void @llvm.lifetime.end.p0(i64 8, ptr %19) #8
  br label %321

320:                                              ; preds = %314, %260
  call void @llvm.lifetime.end.p0(i64 8, ptr %15) #8
  call void @llvm.lifetime.end.p0(i64 1, ptr %12) #8
  call void @_ZN8TraceLogD1Ev(ptr noundef nonnull align 8 dereferenceable(40) %6) #8
  call void @llvm.lifetime.end.p0(i64 40, ptr %6) #8
  br label %335

321:                                              ; preds = %319, %270, %217
  call void @llvm.lifetime.end.p0(i64 8, ptr %15) #8
  br label %322

322:                                              ; preds = %321, %176, %120
  call void @llvm.lifetime.end.p0(i64 1, ptr %12) #8
  br label %323

323:                                              ; preds = %322, %77
  call void @_ZN8TraceLogD1Ev(ptr noundef nonnull align 8 dereferenceable(40) %6) #8
  br label %324

324:                                              ; preds = %323, %73
  call void @llvm.lifetime.end.p0(i64 40, ptr %6) #8
  call void @llvm.lifetime.end.p0(i64 1, ptr %4) #8
  br label %337

325:                                              ; preds = %58
  %326 = load i64, ptr %3, align 8, !tbaa !5
  %327 = add i64 %326, 1
  %328 = call noundef nonnull align 8 dereferenceable(24) ptr @_ZNK10RulesetRefixEm(ptr noundef nonnull align 8 dereferenceable(32) %0, i64 noundef 0)
  %329 = call noundef i64 @_ZNKSt6vectorI11PatternRuleSaIS0_EE4sizeEv(ptr noundef nonnull align 8 dereferenceable(24) %328) #8
  %330 = icmp ult i64 %327, %329
  br i1 %330, label %331, label %334

331:                                              ; preds = %325
  call void @llvm.memcpy.p0.p0.i64(ptr align 8 %23, ptr align 8 %0, i64 32, i1 false), !tbaa.struct !25
  %332 = load i64, ptr %3, align 8, !tbaa !5
  %333 = add i64 %332, 1
  call void @_Z13sort_rulesets10RulesetRefm(ptr noundef byval(%class.RulesetRef) align 8 %23, i64 noundef %333)
  br label %334

334:                                              ; preds = %331, %325
  br label %335

335:                                              ; preds = %334, %320
  call void @llvm.lifetime.end.p0(i64 1, ptr %4) #8
  br label %336

336:                                              ; preds = %335, %31, %26
  ret void

337:                                              ; preds = %324
  %338 = load ptr, ptr %9, align 8
  %339 = load i32, ptr %10, align 4
  %340 = insertvalue { ptr, i32 } poison, ptr %338, 0
  %341 = insertvalue { ptr, i32 } %340, i32 %339, 1
  resume { ptr, i32 } %341
}

; 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) #7

declare void @_ZN8TraceLogC1EPKcSt8functionIFvRSoEE(ptr noundef nonnull align 8 dereferenceable(40), ptr noundef, ptr noundef) unnamed_addr #1

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

; Function Attrs: mustprogress uwtable
declare dso_local noundef i64 @_ZNK10RulesetRef4sizeEv(ptr noundef nonnull align 8 dereferenceable(32)) #3 align 2

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

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

; Function Attrs: mustprogress uwtable
declare hidden noundef zeroext i1 @_ZN12_GLOBAL__N_113rules_overlapERK11PatternRuleS2_(ptr noundef nonnull align 8 dereferenceable(120), ptr noundef nonnull align 8 dereferenceable(120)) #3

; Function Attrs: mustprogress uwtable
declare hidden noundef i32 @_ZN12_GLOBAL__N_119ord_rule_compatibleERK11PatternRuleS2_(ptr noundef nonnull align 8 dereferenceable(120), ptr noundef nonnull align 8 dereferenceable(120)) #3

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN10RulesetRef4swapEmm(ptr noundef nonnull align 8 dereferenceable(32), i64 noundef, i64 noundef) #3 align 2

; Function Attrs: mustprogress uwtable
declare dso_local void @_Z19sort_rulesets_inner10RulesetRefm(ptr noundef byval(%class.RulesetRef) align 8, i64 noundef) #3

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN10RulesetRef5sliceEmm(ptr dead_on_unwind noalias writable sret(%class.RulesetRef) align 8, ptr noundef nonnull align 8 dereferenceable(32), i64 noundef, i64 noundef) #3 align 2

; Function Attrs: mustprogress uwtable
declare dso_local noundef zeroext i1 @_ZNK11PatternRuleneERKS_(ptr noundef nonnull align 8 dereferenceable(120), ptr noundef nonnull align 8 dereferenceable(120)) #3 align 2

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { "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 = { 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 = { 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 #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 = { 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 #7 = { nocallback nofree nounwind willreturn memory(argmem: readwrite) }
attributes #8 = { nounwind }
attributes #9 = { 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 = !{!"long", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C++ TBAA"}
!9 = !{!10, !10, i64 0}
!10 = !{!"bool", !7, i64 0}
!11 = distinct !{!11, !12}
!12 = !{!"llvm.loop.mustprogress"}
!13 = !{i8 0, i8 2}
!14 = !{}
!15 = !{!16, !16, i64 0}
!16 = !{!"any pointer", !7, i64 0}
!17 = !{!18, !18, i64 0}
!18 = !{!"int", !7, i64 0}
!19 = distinct !{!19, !12}
!20 = distinct !{!20, !12}
!21 = distinct !{!21, !12}
!22 = distinct !{!22, !12}
!23 = distinct !{!23, !12}
!24 = distinct !{!24, !12}
!25 = !{i64 0, i64 8, !15, i64 8, i64 8, !15, i64 16, i64 8, !5, i64 24, i64 8, !5}


; 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.RulesetRef = type { ptr, ptr, i64, i64 }
%class.TraceLog = type { ptr, %"class.std::function" }
%"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.462 = type { ptr }

@g_debug_indent_level = external local_unnamed_addr global i32, align 4
@.str.17 = external hidden unnamed_addr constant [81 x i8], align 1
@.str.69 = external hidden unnamed_addr constant [25 x i8], align 1
@__PRETTY_FUNCTION__._Z13sort_rulesets10RulesetRefm = external hidden unnamed_addr constant [39 x i8], align 1
@__func__._Z13sort_rulesets10RulesetRefm = external hidden unnamed_addr constant [14 x i8], align 1
@.str.70 = external hidden unnamed_addr constant [3 x i8], align 1
@.str.71 = external hidden unnamed_addr constant [3 x i8], align 1

; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.start.p0(i64 immarg, ptr nocapture) #0

declare noundef zeroext i1 @_Z13debug_enabledv() local_unnamed_addr #1

declare i32 @__gxx_personality_v0(...)

; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #0

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

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

declare noundef nonnull align 8 dereferenceable(8) ptr @_Z12debug_outputiPKc(i32 noundef, ptr noundef) local_unnamed_addr #1

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

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

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

; Function Attrs: inlinehint mustprogress uwtable
declare noundef nonnull align 8 dereferenceable(8) ptr @_ZSt4endlIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_(ptr noundef nonnull align 8 dereferenceable(8)) #2

; Function Attrs: nounwind
declare void @_ZN8TraceLogD1Ev(ptr noundef nonnull align 8 dereferenceable(40)) unnamed_addr #4

; Function Attrs: mustprogress uwtable
declare noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEm(ptr noundef nonnull align 8 dereferenceable(8), i64 noundef) local_unnamed_addr #3 align 2

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

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

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef zeroext i1 @_ZNK11PatternRule6is_AnyEv(ptr noundef nonnull align 8 dereferenceable(120)) local_unnamed_addr #5 align 2

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

; Function Attrs: mustprogress uwtable
define dso_local void @_Z13sort_rulesets10RulesetRefm(ptr noundef nonnull byval(%class.RulesetRef) align 8 %0, i64 noundef %1) local_unnamed_addr #3 personality ptr @__gxx_personality_v0 {
  %3 = alloca i64, align 8
  %4 = alloca %class.TraceLog, align 8
  %5 = alloca %"class.std::function", align 8
  %6 = alloca %class.anon.462, align 8
  %7 = alloca %class.RulesetRef, align 8
  %8 = alloca %class.RulesetRef, align 8
  %9 = alloca %class.RulesetRef, align 8
  %10 = alloca %class.RulesetRef, align 8
  store i64 %1, ptr %3, align 8, !tbaa !5
  %11 = call noundef i64 @_ZNK10RulesetRef4sizeEv(ptr noundef nonnull align 8 dereferenceable(32) %0)
  %12 = icmp ult i64 %11, 2
  br i1 %12, label %202, label %13

13:                                               ; preds = %2
  %14 = call noundef nonnull align 8 dereferenceable(24) ptr @_ZNK10RulesetRefixEm(ptr noundef nonnull align 8 dereferenceable(32) %0, i64 noundef 0)
  %15 = call noundef i64 @_ZNKSt6vectorI11PatternRuleSaIS0_EE4sizeEv(ptr noundef nonnull align 8 dereferenceable(24) %14) #7
  %16 = icmp eq i64 %15, 0
  br i1 %16, label %202, label %.preheader73

.preheader73:                                     ; preds = %13
  %17 = call noundef i64 @_ZNK10RulesetRef4sizeEv(ptr noundef nonnull align 8 dereferenceable(32) %0)
  %.not80 = icmp eq i64 %17, 0
  br i1 %.not80, label %.critedge, label %.lr.ph

._crit_edge:                                      ; preds = %23
  br i1 %spec.select, label %31, label %.critedge

.lr.ph:                                           ; preds = %.preheader73, %23
  %.05979 = phi i64 [ %28, %23 ], [ 0, %.preheader73 ]
  %.06078 = phi i1 [ %spec.select, %23 ], [ false, %.preheader73 ]
  %18 = load i64, ptr %3, align 8, !tbaa !5
  %19 = call noundef nonnull align 8 dereferenceable(24) ptr @_ZNK10RulesetRefixEm(ptr noundef nonnull align 8 dereferenceable(32) %0, i64 noundef %.05979)
  %20 = call noundef i64 @_ZNKSt6vectorI11PatternRuleSaIS0_EE4sizeEv(ptr noundef nonnull align 8 dereferenceable(24) %19) #7
  %21 = icmp ult i64 %18, %20
  br i1 %21, label %23, label %22

22:                                               ; preds = %.lr.ph
  call void @__assert_fail(ptr noundef nonnull @.str.69, ptr noundef nonnull @.str.17, i32 noundef 2144, ptr noundef nonnull @__PRETTY_FUNCTION__._Z13sort_rulesets10RulesetRefm) #8
  unreachable

23:                                               ; preds = %.lr.ph
  %24 = call noundef nonnull align 8 dereferenceable(24) ptr @_ZNK10RulesetRefixEm(ptr noundef nonnull align 8 dereferenceable(32) %0, i64 noundef %.05979)
  %25 = load i64, ptr %3, align 8, !tbaa !5
  %26 = call noundef nonnull align 8 dereferenceable(120) ptr @_ZNKSt6vectorI11PatternRuleSaIS0_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) %24, i64 noundef %25) #7
  %27 = call noundef zeroext i1 @_ZNK11PatternRule6is_AnyEv(ptr noundef nonnull align 8 dereferenceable(120) %26)
  %not. = xor i1 %27, true
  %spec.select = select i1 %not., i1 true, i1 %.06078
  %28 = add nuw i64 %.05979, 1
  %29 = call noundef i64 @_ZNK10RulesetRef4sizeEv(ptr noundef nonnull align 8 dereferenceable(32) %0)
  %30 = icmp ult i64 %28, %29
  br i1 %30, label %.lr.ph, label %._crit_edge, !llvm.loop !9

31:                                               ; preds = %._crit_edge
  call void @llvm.lifetime.start.p0(i64 40, ptr nonnull %4) #7
  %32 = call noundef zeroext i1 @_Z13debug_enabledv()
  %33 = select i1 %32, ptr @__func__._Z13sort_rulesets10RulesetRefm, ptr null
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %6) #7
  store ptr %3, ptr %6, align 8, !tbaa !11
  call void @"_ZNSt8functionIFvRSoEEC2IZ13sort_rulesets10RulesetRefmE3$_0vEEOT_"(ptr noundef nonnull align 8 dereferenceable(32) %5, ptr noundef nonnull align 8 dereferenceable(8) %6) #7
  invoke void @_ZN8TraceLogC1EPKcSt8functionIFvRSoEE(ptr noundef nonnull align 8 dereferenceable(40) %4, ptr noundef %33, ptr noundef nonnull %5)
          to label %34 unwind label %39

34:                                               ; preds = %31
  call void @_ZNSt14_Function_baseD2Ev(ptr noundef nonnull align 8 dereferenceable(32) %5) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %6) #7
  br label %35

35:                                               ; preds = %63, %34
  %.051 = phi i64 [ 0, %34 ], [ %64, %63 ]
  %36 = invoke noundef i64 @_ZNK10RulesetRef4sizeEv(ptr noundef nonnull align 8 dereferenceable(32) %0)
          to label %37 unwind label %41

37:                                               ; preds = %35
  %38 = icmp ult i64 %.051, %36
  br i1 %38, label %43, label %.preheader72.outer

39:                                               ; preds = %31
  %40 = landingpad { ptr, i32 }
          cleanup
  call void @_ZNSt14_Function_baseD2Ev(ptr noundef nonnull align 8 dereferenceable(32) %5) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %6) #7
  br label %193

41:                                               ; preds = %61, %59, %57, %55, %53, %51, %49, %46, %43, %35
  %42 = landingpad { ptr, i32 }
          cleanup
  br label %192

43:                                               ; preds = %37
  %44 = invoke noundef zeroext i1 @_Z13debug_enabledv()
          to label %45 unwind label %41

45:                                               ; preds = %43
  br i1 %44, label %46, label %63

46:                                               ; preds = %45
  %47 = load i32, ptr @g_debug_indent_level, align 4, !tbaa !13
  %48 = invoke noundef nonnull align 8 dereferenceable(8) ptr @_Z12debug_outputiPKc(i32 noundef %47, ptr noundef nonnull @__func__._Z13sort_rulesets10RulesetRefm)
          to label %49 unwind label %41

49:                                               ; preds = %46
  %50 = invoke noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc(ptr noundef nonnull align 8 dereferenceable(8) %48, ptr noundef nonnull @.str.70)
          to label %51 unwind label %41

51:                                               ; preds = %49
  %52 = invoke noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEm(ptr noundef nonnull align 8 dereferenceable(8) %50, i64 noundef %.051)
          to label %53 unwind label %41

53:                                               ; preds = %51
  %54 = invoke noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc(ptr noundef nonnull align 8 dereferenceable(8) %52, ptr noundef nonnull @.str.71)
          to label %55 unwind label %41

55:                                               ; preds = %53
  %56 = invoke noundef nonnull align 8 dereferenceable(24) ptr @_ZNK10RulesetRefixEm(ptr noundef nonnull align 8 dereferenceable(32) %0, i64 noundef %.051)
          to label %57 unwind label %41

57:                                               ; preds = %55
  %58 = invoke noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsI11PatternRuleERSoS1_RKSt6vectorIT_SaIS3_EE(ptr noundef nonnull align 8 dereferenceable(8) %54, ptr noundef nonnull align 8 dereferenceable(24) %56)
          to label %59 unwind label %41

59:                                               ; preds = %57
  %60 = invoke noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEPFRSt8ios_baseS0_E(ptr noundef nonnull align 8 dereferenceable(8) %58, ptr noundef nonnull @_ZSt3decRSt8ios_base)
          to label %61 unwind label %41

61:                                               ; preds = %59
  %62 = invoke noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEPFRSoS_E(ptr noundef nonnull align 8 dereferenceable(8) %60, ptr noundef nonnull @_ZSt4endlIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_)
          to label %63 unwind label %41

63:                                               ; preds = %45, %61
  %64 = add nuw i64 %.051, 1
  br label %35, !llvm.loop !15

.preheader72:                                     ; preds = %.preheader72.backedge, %.preheader72.outer
  %.048 = phi i64 [ %.048.ph, %.preheader72.outer ], [ %75, %.preheader72.backedge ]
  %65 = invoke noundef i64 @_ZNK10RulesetRef4sizeEv(ptr noundef nonnull align 8 dereferenceable(32) %0)
          to label %66 unwind label %.loopexit

66:                                               ; preds = %.preheader72
  %67 = add i64 %65, -1
  %68 = icmp ult i64 %.048, %67
  br i1 %68, label %70, label %69

69:                                               ; preds = %66
  br i1 %.049.ph, label %.preheader72.outer.backedge, label %.preheader71

.preheader72.outer.backedge:                      ; preds = %69, %94
  %.048.ph.be = phi i64 [ %75, %94 ], [ 0, %69 ]
  br label %.preheader72.outer, !llvm.loop !16

.preheader72.outer:                               ; preds = %37, %.preheader72.outer.backedge
  %.049.ph = phi i1 [ %68, %.preheader72.outer.backedge ], [ false, %37 ]
  %.048.ph = phi i64 [ %.048.ph.be, %.preheader72.outer.backedge ], [ 0, %37 ]
  br label %.preheader72

.loopexit:                                        ; preds = %.preheader72, %70, %72, %77, %82, %84, %88
  %lpad.loopexit = landingpad { ptr, i32 }
          cleanup
  br label %192

.loopexit.split-lp:                               ; preds = %94
  %lpad.loopexit.split-lp = landingpad { ptr, i32 }
          cleanup
  br label %192

70:                                               ; preds = %66
  %71 = invoke noundef nonnull align 8 dereferenceable(24) ptr @_ZNK10RulesetRefixEm(ptr noundef nonnull align 8 dereferenceable(32) %0, i64 noundef %.048)
          to label %72 unwind label %.loopexit

72:                                               ; preds = %70
  %73 = load i64, ptr %3, align 8, !tbaa !5
  %74 = call noundef nonnull align 8 dereferenceable(120) ptr @_ZNKSt6vectorI11PatternRuleSaIS0_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) %71, i64 noundef %73) #7
  %75 = add nuw i64 %.048, 1
  %76 = invoke noundef nonnull align 8 dereferenceable(24) ptr @_ZNK10RulesetRefixEm(ptr noundef nonnull align 8 dereferenceable(32) %0, i64 noundef %75)
          to label %77 unwind label %.loopexit

77:                                               ; preds = %72
  %78 = load i64, ptr %3, align 8, !tbaa !5
  %79 = call noundef nonnull align 8 dereferenceable(120) ptr @_ZNKSt6vectorI11PatternRuleSaIS0_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) %76, i64 noundef %78) #7
  %80 = invoke noundef zeroext i1 @_ZN12_GLOBAL__N_113rules_overlapERK11PatternRuleS2_(ptr noundef nonnull align 8 dereferenceable(120) %74, ptr noundef nonnull align 8 dereferenceable(120) %79)
          to label %81 unwind label %.loopexit

81:                                               ; preds = %77
  br i1 %80, label %.preheader72.backedge, label %82

.preheader72.backedge:                            ; preds = %81, %92
  br label %.preheader72, !llvm.loop !16

82:                                               ; preds = %81
  %83 = invoke noundef nonnull align 8 dereferenceable(24) ptr @_ZNK10RulesetRefixEm(ptr noundef nonnull align 8 dereferenceable(32) %0, i64 noundef %.048)
          to label %84 unwind label %.loopexit

84:                                               ; preds = %82
  %85 = load i64, ptr %3, align 8, !tbaa !5
  %86 = call noundef nonnull align 8 dereferenceable(120) ptr @_ZNKSt6vectorI11PatternRuleSaIS0_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) %83, i64 noundef %85) #7
  %87 = invoke noundef nonnull align 8 dereferenceable(24) ptr @_ZNK10RulesetRefixEm(ptr noundef nonnull align 8 dereferenceable(32) %0, i64 noundef %75)
          to label %88 unwind label %.loopexit

88:                                               ; preds = %84
  %89 = load i64, ptr %3, align 8, !tbaa !5
  %90 = call noundef nonnull align 8 dereferenceable(120) ptr @_ZNKSt6vectorI11PatternRuleSaIS0_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) %87, i64 noundef %89) #7
  %91 = invoke noundef i32 @_ZN12_GLOBAL__N_119ord_rule_compatibleERK11PatternRuleS2_(ptr noundef nonnull align 8 dereferenceable(120) %86, ptr noundef nonnull align 8 dereferenceable(120) %90)
          to label %92 unwind label %.loopexit

92:                                               ; preds = %88
  %93 = icmp eq i32 %91, 1
  br i1 %93, label %94, label %.preheader72.backedge

94:                                               ; preds = %92
  invoke void @_ZN10RulesetRef4swapEmm(ptr noundef nonnull align 8 dereferenceable(32) %0, i64 noundef %.048, i64 noundef %75)
          to label %.preheader72.outer.backedge unwind label %.loopexit.split-lp

.preheader71:                                     ; preds = %69, %120
  %.047 = phi i64 [ %121, %120 ], [ 0, %69 ]
  %95 = invoke noundef i64 @_ZNK10RulesetRef4sizeEv(ptr noundef nonnull align 8 dereferenceable(32) %0)
          to label %96 unwind label %98

96:                                               ; preds = %.preheader71
  %97 = icmp ult i64 %.047, %95
  br i1 %97, label %100, label %.preheader70

98:                                               ; preds = %118, %116, %114, %112, %110, %108, %106, %103, %100, %.preheader71
  %99 = landingpad { ptr, i32 }
          cleanup
  br label %192

100:                                              ; preds = %96
  %101 = invoke noundef zeroext i1 @_Z13debug_enabledv()
          to label %102 unwind label %98

102:                                              ; preds = %100
  br i1 %101, label %103, label %120

103:                                              ; preds = %102
  %104 = load i32, ptr @g_debug_indent_level, align 4, !tbaa !13
  %105 = invoke noundef nonnull align 8 dereferenceable(8) ptr @_Z12debug_outputiPKc(i32 noundef %104, ptr noundef nonnull @__func__._Z13sort_rulesets10RulesetRefm)
          to label %106 unwind label %98

106:                                              ; preds = %103
  %107 = invoke noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc(ptr noundef nonnull align 8 dereferenceable(8) %105, ptr noundef nonnull @.str.70)
          to label %108 unwind label %98

108:                                              ; preds = %106
  %109 = invoke noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEm(ptr noundef nonnull align 8 dereferenceable(8) %107, i64 noundef %.047)
          to label %110 unwind label %98

110:                                              ; preds = %108
  %111 = invoke noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc(ptr noundef nonnull align 8 dereferenceable(8) %109, ptr noundef nonnull @.str.71)
          to label %112 unwind label %98

112:                                              ; preds = %110
  %113 = invoke noundef nonnull align 8 dereferenceable(24) ptr @_ZNK10RulesetRefixEm(ptr noundef nonnull align 8 dereferenceable(32) %0, i64 noundef %.047)
          to label %114 unwind label %98

114:                                              ; preds = %112
  %115 = invoke noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsI11PatternRuleERSoS1_RKSt6vectorIT_SaIS3_EE(ptr noundef nonnull align 8 dereferenceable(8) %111, ptr noundef nonnull align 8 dereferenceable(24) %113)
          to label %116 unwind label %98

116:                                              ; preds = %114
  %117 = invoke noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEPFRSt8ios_baseS0_E(ptr noundef nonnull align 8 dereferenceable(8) %115, ptr noundef nonnull @_ZSt3decRSt8ios_base)
          to label %118 unwind label %98

118:                                              ; preds = %116
  %119 = invoke noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEPFRSoS_E(ptr noundef nonnull align 8 dereferenceable(8) %117, ptr noundef nonnull @_ZSt4endlIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_)
          to label %120 unwind label %98

120:                                              ; preds = %102, %118
  %121 = add nuw i64 %.047, 1
  br label %.preheader71, !llvm.loop !17

.preheader70:                                     ; preds = %96, %144
  %.045 = phi i64 [ %.146, %144 ], [ 0, %96 ]
  %.044 = phi i64 [ %145, %144 ], [ 1, %96 ]
  %122 = invoke noundef i64 @_ZNK10RulesetRef4sizeEv(ptr noundef nonnull align 8 dereferenceable(32) %0)
          to label %123 unwind label %127

123:                                              ; preds = %.preheader70
  %124 = icmp ult i64 %.044, %122
  br i1 %124, label %129, label %125

125:                                              ; preds = %123
  %126 = invoke noundef i64 @_ZNK10RulesetRef4sizeEv(ptr noundef nonnull align 8 dereferenceable(32) %0)
          to label %146 unwind label %162

127:                                              ; preds = %142, %140, %135, %131, %129, %.preheader70
  %128 = landingpad { ptr, i32 }
          cleanup
  br label %192

129:                                              ; preds = %123
  %130 = invoke noundef nonnull align 8 dereferenceable(24) ptr @_ZNK10RulesetRefixEm(ptr noundef nonnull align 8 dereferenceable(32) %0, i64 noundef %.044)
          to label %131 unwind label %127

131:                                              ; preds = %129
  %132 = load i64, ptr %3, align 8, !tbaa !5
  %133 = call noundef nonnull align 8 dereferenceable(120) ptr @_ZNKSt6vectorI11PatternRuleSaIS0_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) %130, i64 noundef %132) #7
  %134 = invoke noundef nonnull align 8 dereferenceable(24) ptr @_ZNK10RulesetRefixEm(ptr noundef nonnull align 8 dereferenceable(32) %0, i64 noundef %.045)
          to label %135 unwind label %127

135:                                              ; preds = %131
  %136 = load i64, ptr %3, align 8, !tbaa !5
  %137 = call noundef nonnull align 8 dereferenceable(120) ptr @_ZNKSt6vectorI11PatternRuleSaIS0_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) %134, i64 noundef %136) #7
  %138 = invoke noundef i32 @_ZN12_GLOBAL__N_119ord_rule_compatibleERK11PatternRuleS2_(ptr noundef nonnull align 8 dereferenceable(120) %133, ptr noundef nonnull align 8 dereferenceable(120) %137)
          to label %139 unwind label %127

139:                                              ; preds = %135
  %.not = icmp eq i32 %138, 0
  br i1 %.not, label %144, label %140

140:                                              ; preds = %139
  %141 = sub i64 %.044, %.045
  invoke void @_ZN10RulesetRef5sliceEmm(ptr dead_on_unwind nonnull writable sret(%class.RulesetRef) align 8 %7, ptr noundef nonnull align 8 dereferenceable(32) %0, i64 noundef %.045, i64 noundef %141)
          to label %142 unwind label %127

142:                                              ; preds = %140
  %143 = load i64, ptr %3, align 8, !tbaa !5
  invoke void @_Z19sort_rulesets_inner10RulesetRefm(ptr noundef nonnull byval(%class.RulesetRef) align 8 %7, i64 noundef %143)
          to label %144 unwind label %127

144:                                              ; preds = %142, %139
  %.146 = phi i64 [ %.045, %139 ], [ %.044, %142 ]
  %145 = add nuw i64 %.044, 1
  br label %.preheader70, !llvm.loop !18

146:                                              ; preds = %125
  %147 = sub i64 %126, %.045
  invoke void @_ZN10RulesetRef5sliceEmm(ptr dead_on_unwind nonnull writable sret(%class.RulesetRef) align 8 %8, ptr noundef nonnull align 8 dereferenceable(32) %0, i64 noundef %.045, i64 noundef %147)
          to label %148 unwind label %162

148:                                              ; preds = %146
  %149 = load i64, ptr %3, align 8, !tbaa !5
  invoke void @_Z19sort_rulesets_inner10RulesetRefm(ptr noundef nonnull byval(%class.RulesetRef) align 8 %8, i64 noundef %149)
          to label %150 unwind label %162

150:                                              ; preds = %148
  %151 = load i64, ptr %3, align 8, !tbaa !5
  %152 = invoke noundef nonnull align 8 dereferenceable(24) ptr @_ZNK10RulesetRefixEm(ptr noundef nonnull align 8 dereferenceable(32) %0, i64 noundef 0)
          to label %153 unwind label %162

153:                                              ; preds = %150
  %154 = add i64 %151, 1
  %155 = call noundef i64 @_ZNKSt6vectorI11PatternRuleSaIS0_EE4sizeEv(ptr noundef nonnull align 8 dereferenceable(24) %152) #7
  %156 = icmp ult i64 %154, %155
  br i1 %156, label %.preheader, label %191

.preheader:                                       ; preds = %153, %182
  %.043 = phi i64 [ %.1, %182 ], [ 0, %153 ]
  %.0 = phi i64 [ %183, %182 ], [ 1, %153 ]
  %157 = invoke noundef i64 @_ZNK10RulesetRef4sizeEv(ptr noundef nonnull align 8 dereferenceable(32) %0)
          to label %158 unwind label %164

158:                                              ; preds = %.preheader
  %159 = icmp ult i64 %.0, %157
  br i1 %159, label %166, label %160

160:                                              ; preds = %158
  %161 = invoke noundef i64 @_ZNK10RulesetRef4sizeEv(ptr noundef nonnull align 8 dereferenceable(32) %0)
          to label %184 unwind label %189

162:                                              ; preds = %150, %148, %146, %125
  %163 = landingpad { ptr, i32 }
          cleanup
  br label %192

164:                                              ; preds = %179, %177, %172, %168, %166, %.preheader
  %165 = landingpad { ptr, i32 }
          cleanup
  br label %192

166:                                              ; preds = %158
  %167 = invoke noundef nonnull align 8 dereferenceable(24) ptr @_ZNK10RulesetRefixEm(ptr noundef nonnull align 8 dereferenceable(32) %0, i64 noundef %.0)
          to label %168 unwind label %164

168:                                              ; preds = %166
  %169 = load i64, ptr %3, align 8, !tbaa !5
  %170 = call noundef nonnull align 8 dereferenceable(120) ptr @_ZNKSt6vectorI11PatternRuleSaIS0_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) %167, i64 noundef %169) #7
  %171 = invoke noundef nonnull align 8 dereferenceable(24) ptr @_ZNK10RulesetRefixEm(ptr noundef nonnull align 8 dereferenceable(32) %0, i64 noundef %.043)
          to label %172 unwind label %164

172:                                              ; preds = %168
  %173 = load i64, ptr %3, align 8, !tbaa !5
  %174 = call noundef nonnull align 8 dereferenceable(120) ptr @_ZNKSt6vectorI11PatternRuleSaIS0_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) %171, i64 noundef %173) #7
  %175 = invoke noundef zeroext i1 @_ZNK11PatternRuleneERKS_(ptr noundef nonnull align 8 dereferenceable(120) %170, ptr noundef nonnull align 8 dereferenceable(120) %174)
          to label %176 unwind label %164

176:                                              ; preds = %172
  br i1 %175, label %177, label %182

177:                                              ; preds = %176
  %178 = sub i64 %.0, %.043
  invoke void @_ZN10RulesetRef5sliceEmm(ptr dead_on_unwind nonnull writable sret(%class.RulesetRef) align 8 %9, ptr noundef nonnull align 8 dereferenceable(32) %0, i64 noundef %.043, i64 noundef %178)
          to label %179 unwind label %164

179:                                              ; preds = %177
  %180 = load i64, ptr %3, align 8, !tbaa !5
  %181 = add i64 %180, 1
  invoke void @_Z13sort_rulesets10RulesetRefm(ptr noundef nonnull byval(%class.RulesetRef) align 8 %9, i64 noundef %181)
          to label %182 unwind label %164

182:                                              ; preds = %179, %176
  %.1 = phi i64 [ %.043, %176 ], [ %.0, %179 ]
  %183 = add nuw i64 %.0, 1
  br label %.preheader, !llvm.loop !19

184:                                              ; preds = %160
  %185 = sub i64 %161, %.043
  invoke void @_ZN10RulesetRef5sliceEmm(ptr dead_on_unwind nonnull writable sret(%class.RulesetRef) align 8 %10, ptr noundef nonnull align 8 dereferenceable(32) %0, i64 noundef %.043, i64 noundef %185)
          to label %186 unwind label %189

186:                                              ; preds = %184
  %187 = load i64, ptr %3, align 8, !tbaa !5
  %188 = add i64 %187, 1
  invoke void @_Z13sort_rulesets10RulesetRefm(ptr noundef nonnull byval(%class.RulesetRef) align 8 %10, i64 noundef %188)
          to label %191 unwind label %189

189:                                              ; preds = %186, %184, %160
  %190 = landingpad { ptr, i32 }
          cleanup
  br label %192

191:                                              ; preds = %186, %153
  call void @_ZN8TraceLogD1Ev(ptr noundef nonnull align 8 dereferenceable(40) %4) #7
  call void @llvm.lifetime.end.p0(i64 40, ptr nonnull %4) #7
  br label %202

192:                                              ; preds = %.loopexit, %.loopexit.split-lp, %98, %164, %189, %162, %127, %41
  %.pn67 = phi { ptr, i32 } [ %42, %41 ], [ %99, %98 ], [ %128, %127 ], [ %163, %162 ], [ %165, %164 ], [ %190, %189 ], [ %lpad.loopexit, %.loopexit ], [ %lpad.loopexit.split-lp, %.loopexit.split-lp ]
  call void @_ZN8TraceLogD1Ev(ptr noundef nonnull align 8 dereferenceable(40) %4) #7
  br label %193

193:                                              ; preds = %192, %39
  %.pn67.pn = phi { ptr, i32 } [ %.pn67, %192 ], [ %40, %39 ]
  call void @llvm.lifetime.end.p0(i64 40, ptr nonnull %4) #7
  resume { ptr, i32 } %.pn67.pn

.critedge:                                        ; preds = %.preheader73, %._crit_edge
  %194 = load i64, ptr %3, align 8, !tbaa !5
  %195 = add i64 %194, 1
  %196 = call noundef nonnull align 8 dereferenceable(24) ptr @_ZNK10RulesetRefixEm(ptr noundef nonnull align 8 dereferenceable(32) %0, i64 noundef 0)
  %197 = call noundef i64 @_ZNKSt6vectorI11PatternRuleSaIS0_EE4sizeEv(ptr noundef nonnull align 8 dereferenceable(24) %196) #7
  %198 = icmp ult i64 %195, %197
  br i1 %198, label %199, label %202

199:                                              ; preds = %.critedge
  %200 = load i64, ptr %3, align 8, !tbaa !5
  %201 = add i64 %200, 1
  call void @_Z13sort_rulesets10RulesetRefm(ptr noundef nonnull byval(%class.RulesetRef) align 8 %0, i64 noundef %201)
  br label %202

202:                                              ; preds = %191, %199, %.critedge, %13, %2
  ret void
}

declare void @_ZN8TraceLogC1EPKcSt8functionIFvRSoEE(ptr noundef nonnull align 8 dereferenceable(40), ptr noundef, ptr noundef) unnamed_addr #1

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

; Function Attrs: mustprogress uwtable
declare dso_local noundef i64 @_ZNK10RulesetRef4sizeEv(ptr noundef nonnull align 8 dereferenceable(32)) local_unnamed_addr #3 align 2

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

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

; Function Attrs: mustprogress uwtable
declare hidden noundef zeroext i1 @_ZN12_GLOBAL__N_113rules_overlapERK11PatternRuleS2_(ptr noundef nonnull align 8 dereferenceable(120), ptr noundef nonnull align 8 dereferenceable(120)) local_unnamed_addr #3

; Function Attrs: mustprogress uwtable
declare hidden noundef i32 @_ZN12_GLOBAL__N_119ord_rule_compatibleERK11PatternRuleS2_(ptr noundef nonnull align 8 dereferenceable(120), ptr noundef nonnull align 8 dereferenceable(120)) local_unnamed_addr #3

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN10RulesetRef4swapEmm(ptr noundef nonnull align 8 dereferenceable(32), i64 noundef, i64 noundef) local_unnamed_addr #3 align 2

; Function Attrs: mustprogress uwtable
declare dso_local void @_Z19sort_rulesets_inner10RulesetRefm(ptr noundef byval(%class.RulesetRef) align 8, i64 noundef) local_unnamed_addr #3

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN10RulesetRef5sliceEmm(ptr dead_on_unwind noalias writable sret(%class.RulesetRef) align 8, ptr noundef nonnull align 8 dereferenceable(32), i64 noundef, i64 noundef) local_unnamed_addr #3 align 2

; Function Attrs: mustprogress uwtable
declare dso_local noundef zeroext i1 @_ZNK11PatternRuleneERKS_(ptr noundef nonnull align 8 dereferenceable(120), ptr noundef nonnull align 8 dereferenceable(120)) local_unnamed_addr #3 align 2

attributes #0 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { "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 = { 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 = { 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 #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 = { 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 #7 = { nounwind }
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 = !{!"long", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = !{!12, !12, i64 0}
!12 = !{!"any pointer", !7, i64 0}
!13 = !{!14, !14, i64 0}
!14 = !{!"int", !7, i64 0}
!15 = distinct !{!15, !10}
!16 = distinct !{!16, !10}
!17 = distinct !{!17, !10}
!18 = distinct !{!18, !10}
!19 = distinct !{!19, !10}


; Effective O3 passes: AggressiveInstCombinePass,CorrelatedValuePropagationPass,DSEPass,EarlyCSEPass,GVNPass,GlobalOptPass,IPSCCPPass,InferFunctionAttrsPass,InstCombinePass,InstSimplifyPass,LCSSAPass,LoopRotatePass,LoopSimplifyPass,LoopUnrollPass,MemCpyOptPass,PostOrderFunctionAttrsPass,SROAPass,SimplifyCFGPass