; LLVM IR from Hunterdii/GeeksforGeeks-POTD :: August 2024 GFG SOLUTION (August-22)

; 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.std::__cxx11::basic_string" = type { %"struct.std::__cxx11::basic_string<char>::_Alloc_hider", i64, %union.anon }
%"struct.std::__cxx11::basic_string<char>::_Alloc_hider" = type { ptr }
%union.anon = type { i64, [8 x i8] }
%"class.std::basic_istream" = type { ptr, i64, %"class.std::basic_ios" }
%"class.std::basic_ios" = type { %"class.std::ios_base", ptr, i8, i8, ptr, ptr, ptr, ptr }
%"class.std::ios_base" = type { ptr, i64, i64, i32, i32, i32, ptr, %"struct.std::ios_base::_Words", [8 x %"struct.std::ios_base::_Words"], i32, ptr, %"class.std::locale" }
%"struct.std::ios_base::_Words" = type { ptr, i64 }
%"class.std::locale" = type { ptr }
%"class.std::basic_ostream" = type { ptr, %"class.std::basic_ios" }
%class.Solution = type { i8 }

@_Z5orderB5cxx11 = external dso_local global %"class.std::__cxx11::basic_string", align 8
@_ZSt3cin = external global %"class.std::basic_istream", align 8
@.str = external hidden unnamed_addr constant [1 x i8], align 1
@_ZSt4cout = external global %"class.std::basic_ostream", align 8

; Function Attrs: mustprogress nounwind uwtable
declare void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEC2Ev(ptr noundef nonnull align 8 dereferenceable(32)) unnamed_addr #0 align 2

; Function Attrs: mustprogress nounwind uwtable
declare void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEED2Ev(ptr noundef nonnull align 8 dereferenceable(32)) unnamed_addr #0 align 2

; Function Attrs: mustprogress uwtable
declare dso_local noundef zeroext i1 @_Z1fNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEES4_(ptr noundef, ptr noundef) #1

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

; Function Attrs: mustprogress nounwind uwtable
declare noundef i64 @_ZNKSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE4sizeEv(ptr noundef nonnull align 8 dereferenceable(32)) #0 align 2

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

; Function Attrs: mustprogress nounwind uwtable
declare noundef nonnull align 1 dereferenceable(1) ptr @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEixEm(ptr noundef nonnull align 8 dereferenceable(32), i64 noundef) #0 align 2

; Function Attrs: mustprogress norecurse uwtable
define dso_local noundef i32 @main() #3 personality ptr @__gxx_personality_v0 {
  %1 = alloca i32, align 4
  %2 = alloca i32, align 4
  %3 = alloca i32, align 4
  %4 = alloca i32, align 4
  %5 = alloca ptr, align 8
  %6 = alloca i64, align 8
  %7 = alloca i32, align 4
  %8 = alloca ptr, align 8
  %9 = alloca i32, align 4
  %10 = alloca %class.Solution, align 1
  %11 = alloca %"class.std::__cxx11::basic_string", align 8
  %12 = alloca i32, align 4
  %13 = alloca i64, align 8
  %14 = alloca i8, align 1
  %15 = alloca i32, align 4
  store i32 0, ptr %1, align 4
  call void @llvm.lifetime.start.p0(i64 4, ptr %2) #8
  %16 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERi(ptr noundef nonnull align 8 dereferenceable(16) @_ZSt3cin, ptr noundef nonnull align 4 dereferenceable(4) %2)
  br label %17

17:                                               ; preds = %161, %0
  %18 = load i32, ptr %2, align 4, !tbaa !5
  %19 = add nsw i32 %18, -1
  store i32 %19, ptr %2, align 4, !tbaa !5
  %20 = icmp ne i32 %18, 0
  br i1 %20, label %21, label %181

21:                                               ; preds = %17
  call void @llvm.lifetime.start.p0(i64 4, ptr %3) #8
  call void @llvm.lifetime.start.p0(i64 4, ptr %4) #8
  %22 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERi(ptr noundef nonnull align 8 dereferenceable(16) @_ZSt3cin, ptr noundef nonnull align 4 dereferenceable(4) %3)
  %23 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERi(ptr noundef nonnull align 8 dereferenceable(16) %22, ptr noundef nonnull align 4 dereferenceable(4) %4)
  %24 = load i32, ptr %3, align 4, !tbaa !5
  %25 = zext i32 %24 to i64
  %26 = call ptr @llvm.stacksave.p0()
  store ptr %26, ptr %5, align 8
  %27 = alloca %"class.std::__cxx11::basic_string", i64 %25, align 16
  store i64 %25, ptr %6, align 8
  %28 = icmp eq i64 %25, 0
  br i1 %28, label %35, label %29

29:                                               ; preds = %21
  %30 = getelementptr inbounds %"class.std::__cxx11::basic_string", ptr %27, i64 %25
  br label %31

31:                                               ; preds = %31, %29
  %32 = phi ptr [ %27, %29 ], [ %33, %31 ]
  call void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEC2Ev(ptr noundef nonnull align 8 dereferenceable(32) %32) #8
  %33 = getelementptr inbounds %"class.std::__cxx11::basic_string", ptr %32, i64 1
  %34 = icmp eq ptr %33, %30
  br i1 %34, label %35, label %31

35:                                               ; preds = %31, %21
  call void @llvm.lifetime.start.p0(i64 4, ptr %7) #8
  store i32 0, ptr %7, align 4, !tbaa !5
  br label %36

36:                                               ; preds = %47, %35
  %37 = load i32, ptr %7, align 4, !tbaa !5
  %38 = load i32, ptr %3, align 4, !tbaa !5
  %39 = icmp slt i32 %37, %38
  br i1 %39, label %41, label %40

40:                                               ; preds = %36
  call void @llvm.lifetime.end.p0(i64 4, ptr %7) #8
  br label %54

41:                                               ; preds = %36
  %42 = load i32, ptr %7, align 4, !tbaa !5
  %43 = sext i32 %42 to i64
  %44 = getelementptr inbounds %"class.std::__cxx11::basic_string", ptr %27, i64 %43
  %45 = invoke noundef nonnull align 8 dereferenceable(16) ptr @_ZStrsIcSt11char_traitsIcESaIcEERSt13basic_istreamIT_T0_ES7_RNSt7__cxx1112basic_stringIS4_S5_T1_EE(ptr noundef nonnull align 8 dereferenceable(16) @_ZSt3cin, ptr noundef nonnull align 8 dereferenceable(32) %44)
          to label %46 unwind label %50

46:                                               ; preds = %41
  br label %47

47:                                               ; preds = %46
  %48 = load i32, ptr %7, align 4, !tbaa !5
  %49 = add nsw i32 %48, 1
  store i32 %49, ptr %7, align 4, !tbaa !5
  br label %36, !llvm.loop !9

50:                                               ; preds = %41
  %51 = landingpad { ptr, i32 }
          cleanup
  %52 = extractvalue { ptr, i32 } %51, 0
  store ptr %52, ptr %8, align 8
  %53 = extractvalue { ptr, i32 } %51, 1
  store i32 %53, ptr %9, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %7) #8
  br label %173

54:                                               ; preds = %40
  call void @llvm.lifetime.start.p0(i64 1, ptr %10) #8
  call void @llvm.lifetime.start.p0(i64 32, ptr %11) #8
  %55 = load i32, ptr %3, align 4, !tbaa !5
  %56 = load i32, ptr %4, align 4, !tbaa !5
  invoke void @_ZN8Solution9findOrderEPNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEii(ptr dead_on_unwind writable sret(%"class.std::__cxx11::basic_string") align 8 %11, ptr noundef nonnull align 1 dereferenceable(1) %10, ptr noundef %27, i32 noundef %55, i32 noundef %56)
          to label %57 unwind label %66

57:                                               ; preds = %54
  %58 = invoke noundef nonnull align 8 dereferenceable(32) ptr @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEaSEPKc(ptr noundef nonnull align 8 dereferenceable(32) @_Z5orderB5cxx11, ptr noundef @.str)
          to label %59 unwind label %70

59:                                               ; preds = %57
  call void @llvm.lifetime.start.p0(i64 4, ptr %12) #8
  store i32 0, ptr %12, align 4, !tbaa !5
  br label %60

60:                                               ; preds = %82, %59
  %61 = load i32, ptr %12, align 4, !tbaa !5
  %62 = sext i32 %61 to i64
  %63 = call noundef i64 @_ZNKSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE4sizeEv(ptr noundef nonnull align 8 dereferenceable(32) %11) #8
  %64 = icmp ult i64 %62, %63
  br i1 %64, label %74, label %65

65:                                               ; preds = %60
  call void @llvm.lifetime.end.p0(i64 4, ptr %12) #8
  br label %89

66:                                               ; preds = %54
  %67 = landingpad { ptr, i32 }
          cleanup
  %68 = extractvalue { ptr, i32 } %67, 0
  store ptr %68, ptr %8, align 8
  %69 = extractvalue { ptr, i32 } %67, 1
  store i32 %69, ptr %9, align 4
  br label %172

70:                                               ; preds = %57
  %71 = landingpad { ptr, i32 }
          cleanup
  %72 = extractvalue { ptr, i32 } %71, 0
  store ptr %72, ptr %8, align 8
  %73 = extractvalue { ptr, i32 } %71, 1
  store i32 %73, ptr %9, align 4
  br label %171

74:                                               ; preds = %60
  %75 = load i32, ptr %12, align 4, !tbaa !5
  %76 = sext i32 %75 to i64
  %77 = invoke noundef nonnull align 1 dereferenceable(1) ptr @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEixEm(ptr noundef nonnull align 8 dereferenceable(32) %11, i64 noundef %76)
          to label %78 unwind label %85

78:                                               ; preds = %74
  %79 = load i8, ptr %77, align 1, !tbaa !11
  %80 = invoke noundef nonnull align 8 dereferenceable(32) ptr @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEpLEc(ptr noundef nonnull align 8 dereferenceable(32) @_Z5orderB5cxx11, i8 noundef signext %79)
          to label %81 unwind label %85

81:                                               ; preds = %78
  br label %82

82:                                               ; preds = %81
  %83 = load i32, ptr %12, align 4, !tbaa !5
  %84 = add nsw i32 %83, 1
  store i32 %84, ptr %12, align 4, !tbaa !5
  br label %60, !llvm.loop !12

85:                                               ; preds = %78, %74
  %86 = landingpad { ptr, i32 }
          cleanup
  %87 = extractvalue { ptr, i32 } %86, 0
  store ptr %87, ptr %8, align 8
  %88 = extractvalue { ptr, i32 } %86, 1
  store i32 %88, ptr %9, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %12) #8
  br label %171

89:                                               ; preds = %65
  %90 = load i32, ptr %3, align 4, !tbaa !5
  %91 = zext i32 %90 to i64
  %92 = alloca %"class.std::__cxx11::basic_string", i64 %91, align 16
  store i64 %91, ptr %13, align 8
  %93 = icmp eq i64 %91, 0
  br i1 %93, label %100, label %94

94:                                               ; preds = %89
  %95 = getelementptr inbounds %"class.std::__cxx11::basic_string", ptr %92, i64 %91
  br label %96

96:                                               ; preds = %96, %94
  %97 = phi ptr [ %92, %94 ], [ %98, %96 ]
  call void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEC2Ev(ptr noundef nonnull align 8 dereferenceable(32) %97) #8
  %98 = getelementptr inbounds %"class.std::__cxx11::basic_string", ptr %97, i64 1
  %99 = icmp eq ptr %98, %95
  br i1 %99, label %100, label %96

100:                                              ; preds = %96, %89
  %101 = load i32, ptr %3, align 4, !tbaa !5
  %102 = sext i32 %101 to i64
  %103 = getelementptr inbounds %"class.std::__cxx11::basic_string", ptr %27, i64 %102
  %104 = invoke noundef ptr @_ZSt4copyIPNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEES6_ET0_T_S8_S7_(ptr noundef %27, ptr noundef %103, ptr noundef %92)
          to label %105 unwind label %115

105:                                              ; preds = %100
  %106 = load i32, ptr %3, align 4, !tbaa !5
  %107 = sext i32 %106 to i64
  %108 = getelementptr inbounds %"class.std::__cxx11::basic_string", ptr %92, i64 %107
  invoke void @_ZSt4sortIPNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEPFbS5_S5_EEvT_S9_T0_(ptr noundef %92, ptr noundef %108, ptr noundef @_Z1fNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEES4_)
          to label %109 unwind label %115

109:                                              ; preds = %105
  call void @llvm.lifetime.start.p0(i64 1, ptr %14) #8
  store i8 1, ptr %14, align 1, !tbaa !13
  call void @llvm.lifetime.start.p0(i64 4, ptr %15) #8
  store i32 0, ptr %15, align 4, !tbaa !5
  br label %110

110:                                              ; preds = %129, %109
  %111 = load i32, ptr %15, align 4, !tbaa !5
  %112 = load i32, ptr %3, align 4, !tbaa !5
  %113 = icmp slt i32 %111, %112
  br i1 %113, label %119, label %114

114:                                              ; preds = %110
  call void @llvm.lifetime.end.p0(i64 4, ptr %15) #8
  br label %132

115:                                              ; preds = %105, %100
  %116 = landingpad { ptr, i32 }
          cleanup
  %117 = extractvalue { ptr, i32 } %116, 0
  store ptr %117, ptr %8, align 8
  %118 = extractvalue { ptr, i32 } %116, 1
  store i32 %118, ptr %9, align 4
  br label %163

119:                                              ; preds = %110
  %120 = load i32, ptr %15, align 4, !tbaa !5
  %121 = sext i32 %120 to i64
  %122 = getelementptr inbounds %"class.std::__cxx11::basic_string", ptr %27, i64 %121
  %123 = load i32, ptr %15, align 4, !tbaa !5
  %124 = sext i32 %123 to i64
  %125 = getelementptr inbounds %"class.std::__cxx11::basic_string", ptr %92, i64 %124
  %126 = call noundef zeroext i1 @_ZStneIcSt11char_traitsIcESaIcEEbRKNSt7__cxx1112basic_stringIT_T0_T1_EESA_(ptr noundef nonnull align 8 dereferenceable(32) %122, ptr noundef nonnull align 8 dereferenceable(32) %125) #8
  br i1 %126, label %127, label %128

127:                                              ; preds = %119
  store i8 0, ptr %14, align 1, !tbaa !13
  br label %128

128:                                              ; preds = %127, %119
  br label %129

129:                                              ; preds = %128
  %130 = load i32, ptr %15, align 4, !tbaa !5
  %131 = add nsw i32 %130, 1
  store i32 %131, ptr %15, align 4, !tbaa !5
  br label %110, !llvm.loop !15

132:                                              ; preds = %114
  %133 = load i8, ptr %14, align 1, !tbaa !13, !range !16, !noundef !17
  %134 = trunc i8 %133 to i1
  br i1 %134, label %135, label %142

135:                                              ; preds = %132
  %136 = invoke noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEi(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cout, i32 noundef 1)
          to label %137 unwind label %138

137:                                              ; preds = %135
  br label %145

138:                                              ; preds = %145, %142, %135
  %139 = landingpad { ptr, i32 }
          cleanup
  %140 = extractvalue { ptr, i32 } %139, 0
  store ptr %140, ptr %8, align 8
  %141 = extractvalue { ptr, i32 } %139, 1
  store i32 %141, ptr %9, align 4
  call void @llvm.lifetime.end.p0(i64 1, ptr %14) #8
  br label %163

142:                                              ; preds = %132
  %143 = invoke noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEi(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cout, i32 noundef 0)
          to label %144 unwind label %138

144:                                              ; preds = %142
  br label %145

145:                                              ; preds = %144, %137
  %146 = invoke noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEPFRSoS_E(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cout, ptr noundef @_ZSt4endlIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_)
          to label %147 unwind label %138

147:                                              ; preds = %145
  call void @llvm.lifetime.end.p0(i64 1, ptr %14) #8
  %148 = getelementptr inbounds %"class.std::__cxx11::basic_string", ptr %92, i64 %91
  %149 = icmp eq ptr %92, %148
  br i1 %149, label %154, label %150

150:                                              ; preds = %150, %147
  %151 = phi ptr [ %148, %147 ], [ %152, %150 ]
  %152 = getelementptr inbounds %"class.std::__cxx11::basic_string", ptr %151, i64 -1
  call void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEED2Ev(ptr noundef nonnull align 8 dereferenceable(32) %152) #8
  %153 = icmp eq ptr %152, %92
  br i1 %153, label %154, label %150

154:                                              ; preds = %150, %147
  call void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEED2Ev(ptr noundef nonnull align 8 dereferenceable(32) %11) #8
  call void @llvm.lifetime.end.p0(i64 32, ptr %11) #8
  call void @llvm.lifetime.end.p0(i64 1, ptr %10) #8
  %155 = getelementptr inbounds %"class.std::__cxx11::basic_string", ptr %27, i64 %25
  %156 = icmp eq ptr %27, %155
  br i1 %156, label %161, label %157

157:                                              ; preds = %157, %154
  %158 = phi ptr [ %155, %154 ], [ %159, %157 ]
  %159 = getelementptr inbounds %"class.std::__cxx11::basic_string", ptr %158, i64 -1
  call void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEED2Ev(ptr noundef nonnull align 8 dereferenceable(32) %159) #8
  %160 = icmp eq ptr %159, %27
  br i1 %160, label %161, label %157

161:                                              ; preds = %157, %154
  %162 = load ptr, ptr %5, align 8
  call void @llvm.stackrestore.p0(ptr %162)
  call void @llvm.lifetime.end.p0(i64 4, ptr %4) #8
  call void @llvm.lifetime.end.p0(i64 4, ptr %3) #8
  br label %17, !llvm.loop !18

163:                                              ; preds = %138, %115
  %164 = getelementptr inbounds %"class.std::__cxx11::basic_string", ptr %92, i64 %91
  %165 = icmp eq ptr %92, %164
  br i1 %165, label %170, label %166

166:                                              ; preds = %166, %163
  %167 = phi ptr [ %164, %163 ], [ %168, %166 ]
  %168 = getelementptr inbounds %"class.std::__cxx11::basic_string", ptr %167, i64 -1
  call void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEED2Ev(ptr noundef nonnull align 8 dereferenceable(32) %168) #8
  %169 = icmp eq ptr %168, %92
  br i1 %169, label %170, label %166

170:                                              ; preds = %166, %163
  br label %171

171:                                              ; preds = %170, %85, %70
  call void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEED2Ev(ptr noundef nonnull align 8 dereferenceable(32) %11) #8
  br label %172

172:                                              ; preds = %171, %66
  call void @llvm.lifetime.end.p0(i64 32, ptr %11) #8
  call void @llvm.lifetime.end.p0(i64 1, ptr %10) #8
  br label %173

173:                                              ; preds = %172, %50
  %174 = getelementptr inbounds %"class.std::__cxx11::basic_string", ptr %27, i64 %25
  %175 = icmp eq ptr %27, %174
  br i1 %175, label %180, label %176

176:                                              ; preds = %176, %173
  %177 = phi ptr [ %174, %173 ], [ %178, %176 ]
  %178 = getelementptr inbounds %"class.std::__cxx11::basic_string", ptr %177, i64 -1
  call void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEED2Ev(ptr noundef nonnull align 8 dereferenceable(32) %178) #8
  %179 = icmp eq ptr %178, %27
  br i1 %179, label %180, label %176

180:                                              ; preds = %176, %173
  call void @llvm.lifetime.end.p0(i64 4, ptr %4) #8
  call void @llvm.lifetime.end.p0(i64 4, ptr %3) #8
  call void @llvm.lifetime.end.p0(i64 4, ptr %2) #8
  br label %182

181:                                              ; preds = %17
  call void @llvm.lifetime.end.p0(i64 4, ptr %2) #8
  ret i32 0

182:                                              ; preds = %180
  %183 = load ptr, ptr %8, align 8
  %184 = load i32, ptr %9, align 4
  %185 = insertvalue { ptr, i32 } poison, ptr %183, 0
  %186 = insertvalue { ptr, i32 } %185, i32 %184, 1
  resume { ptr, i32 } %186
}

declare noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERi(ptr noundef nonnull align 8 dereferenceable(16), ptr noundef nonnull align 4 dereferenceable(4)) #4

; Function Attrs: nocallback nofree nosync nounwind willreturn
declare ptr @llvm.stacksave.p0() #5

declare noundef nonnull align 8 dereferenceable(16) ptr @_ZStrsIcSt11char_traitsIcESaIcEERSt13basic_istreamIT_T0_ES7_RNSt7__cxx1112basic_stringIS4_S5_T1_EE(ptr noundef nonnull align 8 dereferenceable(16), ptr noundef nonnull align 8 dereferenceable(32)) #4

declare i32 @__gxx_personality_v0(...)

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN8Solution9findOrderEPNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEii(ptr dead_on_unwind noalias writable sret(%"class.std::__cxx11::basic_string") align 8, ptr noundef nonnull align 1 dereferenceable(1), ptr noundef, i32 noundef, i32 noundef) #1 align 2

; Function Attrs: mustprogress uwtable
declare noundef nonnull align 8 dereferenceable(32) ptr @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEaSEPKc(ptr noundef nonnull align 8 dereferenceable(32), ptr noundef) #1 align 2

; Function Attrs: mustprogress uwtable
declare noundef nonnull align 8 dereferenceable(32) ptr @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEpLEc(ptr noundef nonnull align 8 dereferenceable(32), i8 noundef signext) #1 align 2

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local noundef ptr @_ZSt4copyIPNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEES6_ET0_T_S8_S7_(ptr noundef, ptr noundef, ptr noundef) #6

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local void @_ZSt4sortIPNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEPFbS5_S5_EEvT_S9_T0_(ptr noundef, ptr noundef, ptr noundef) #6

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef zeroext i1 @_ZStneIcSt11char_traitsIcESaIcEEbRKNSt7__cxx1112basic_stringIT_T0_T1_EESA_(ptr noundef nonnull align 8 dereferenceable(32), ptr noundef nonnull align 8 dereferenceable(32)) #7

declare noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEi(ptr noundef nonnull align 8 dereferenceable(8), i32 noundef) #4

; Function Attrs: mustprogress uwtable
declare noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEPFRSoS_E(ptr noundef nonnull align 8 dereferenceable(8), ptr noundef) #1 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)) #6

; Function Attrs: nocallback nofree nosync nounwind willreturn
declare void @llvm.stackrestore.p0(ptr) #5

attributes #0 = { 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 #1 = { mustprogress uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #2 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #3 = { mustprogress norecurse 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 = { "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 = { nocallback nofree nosync nounwind willreturn }
attributes #6 = { 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 #7 = { inlinehint mustprogress nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #8 = { 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 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = !{!7, !7, i64 0}
!12 = distinct !{!12, !10}
!13 = !{!14, !14, i64 0}
!14 = !{!"bool", !7, i64 0}
!15 = distinct !{!15, !10}
!16 = !{i8 0, i8 2}
!17 = !{}
!18 = distinct !{!18, !10}


; 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.std::__cxx11::basic_string" = type { %"struct.std::__cxx11::basic_string<char>::_Alloc_hider", i64, %union.anon }
%"struct.std::__cxx11::basic_string<char>::_Alloc_hider" = type { ptr }
%union.anon = type { i64, [8 x i8] }
%"class.std::basic_istream" = type { ptr, i64, %"class.std::basic_ios" }
%"class.std::basic_ios" = type { %"class.std::ios_base", ptr, i8, i8, ptr, ptr, ptr, ptr }
%"class.std::ios_base" = type { ptr, i64, i64, i32, i32, i32, ptr, %"struct.std::ios_base::_Words", [8 x %"struct.std::ios_base::_Words"], i32, ptr, %"class.std::locale" }
%"struct.std::ios_base::_Words" = type { ptr, i64 }
%"class.std::locale" = type { ptr }
%"class.std::basic_ostream" = type { ptr, %"class.std::basic_ios" }
%class.Solution = type { i8 }

@_Z5orderB5cxx11 = external dso_local global %"class.std::__cxx11::basic_string", align 8
@_ZSt3cin = external global %"class.std::basic_istream", align 8
@.str = external hidden unnamed_addr constant [1 x i8], align 1
@_ZSt4cout = external global %"class.std::basic_ostream", align 8

; Function Attrs: mustprogress nounwind uwtable
declare void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEC2Ev(ptr noundef nonnull align 8 dereferenceable(32)) unnamed_addr #0 align 2

; Function Attrs: mustprogress nounwind uwtable
declare void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEED2Ev(ptr noundef nonnull align 8 dereferenceable(32)) unnamed_addr #0 align 2

; Function Attrs: mustprogress uwtable
declare dso_local noundef zeroext i1 @_Z1fNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEES4_(ptr noundef, ptr noundef) #1

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

; Function Attrs: mustprogress nounwind uwtable
declare noundef i64 @_ZNKSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE4sizeEv(ptr noundef nonnull align 8 dereferenceable(32)) local_unnamed_addr #0 align 2

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

; Function Attrs: mustprogress nounwind uwtable
declare noundef nonnull align 1 dereferenceable(1) ptr @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEixEm(ptr noundef nonnull align 8 dereferenceable(32), i64 noundef) local_unnamed_addr #0 align 2

; Function Attrs: mustprogress norecurse uwtable
define dso_local noundef i32 @main() local_unnamed_addr #3 personality ptr @__gxx_personality_v0 {
  %1 = alloca i32, align 4
  %2 = alloca i32, align 4
  %3 = alloca i32, align 4
  %4 = alloca %class.Solution, align 1
  %5 = alloca %"class.std::__cxx11::basic_string", align 8
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %1) #8
  %6 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERi(ptr noundef nonnull align 8 dereferenceable(16) @_ZSt3cin, ptr noundef nonnull align 4 dereferenceable(4) %1)
  %7 = load i32, ptr %1, align 4, !tbaa !5
  %8 = add nsw i32 %7, -1
  store i32 %8, ptr %1, align 4, !tbaa !5
  %.not79 = icmp eq i32 %7, 0
  br i1 %.not79, label %._crit_edge82, label %.lr.ph81

.lr.ph81:                                         ; preds = %0, %.loopexit38
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %2) #8
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %3) #8
  %9 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERi(ptr noundef nonnull align 8 dereferenceable(16) @_ZSt3cin, ptr noundef nonnull align 4 dereferenceable(4) %2)
  %10 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERi(ptr noundef nonnull align 8 dereferenceable(16) %9, ptr noundef nonnull align 4 dereferenceable(4) %3)
  %11 = load i32, ptr %2, align 4, !tbaa !5
  %12 = zext i32 %11 to i64
  %13 = call ptr @llvm.stacksave.p0()
  %14 = alloca %"class.std::__cxx11::basic_string", i64 %12, align 16
  %15 = icmp eq i32 %11, 0
  br i1 %15, label %.loopexit44, label %16

16:                                               ; preds = %.lr.ph81
  %17 = getelementptr inbounds %"class.std::__cxx11::basic_string", ptr %14, i64 %12
  br label %18

18:                                               ; preds = %18, %16
  %19 = phi ptr [ %14, %16 ], [ %20, %18 ]
  call void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEC2Ev(ptr noundef nonnull align 8 dereferenceable(32) %19) #8
  %20 = getelementptr inbounds i8, ptr %19, i64 32
  %21 = icmp eq ptr %20, %17
  br i1 %21, label %.loopexit44, label %18

.loopexit44:                                      ; preds = %18, %.lr.ph81
  %22 = load i32, ptr %2, align 4, !tbaa !5
  %23 = icmp sgt i32 %22, 0
  br i1 %23, label %.lr.ph, label %._crit_edge

._crit_edge:                                      ; preds = %27, %.loopexit44
  %.lcssa = phi i32 [ %22, %.loopexit44 ], [ %28, %27 ]
  call void @llvm.lifetime.start.p0(i64 1, ptr nonnull %4) #8
  call void @llvm.lifetime.start.p0(i64 32, ptr nonnull %5) #8
  %24 = load i32, ptr %3, align 4, !tbaa !5
  invoke void @_ZN8Solution9findOrderEPNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEii(ptr dead_on_unwind nonnull writable sret(%"class.std::__cxx11::basic_string") align 8 %5, ptr noundef nonnull align 1 dereferenceable(1) %4, ptr noundef nonnull %14, i32 noundef %.lcssa, i32 noundef %24)
          to label %33 unwind label %40

.lr.ph:                                           ; preds = %.loopexit44, %27
  %indvars.iv = phi i64 [ %indvars.iv.next, %27 ], [ 0, %.loopexit44 ]
  %25 = getelementptr inbounds %"class.std::__cxx11::basic_string", ptr %14, i64 %indvars.iv
  %26 = invoke noundef nonnull align 8 dereferenceable(16) ptr @_ZStrsIcSt11char_traitsIcESaIcEERSt13basic_istreamIT_T0_ES7_RNSt7__cxx1112basic_stringIS4_S5_T1_EE(ptr noundef nonnull align 8 dereferenceable(16) @_ZSt3cin, ptr noundef nonnull align 8 dereferenceable(32) %25)
          to label %27 unwind label %31

27:                                               ; preds = %.lr.ph
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  %28 = load i32, ptr %2, align 4, !tbaa !5
  %29 = sext i32 %28 to i64
  %30 = icmp slt i64 %indvars.iv.next, %29
  br i1 %30, label %.lr.ph, label %._crit_edge, !llvm.loop !9

31:                                               ; preds = %.lr.ph
  %32 = landingpad { ptr, i32 }
          cleanup
  br label %99

33:                                               ; preds = %._crit_edge
  %34 = invoke noundef nonnull align 8 dereferenceable(32) ptr @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEaSEPKc(ptr noundef nonnull align 8 dereferenceable(32) @_Z5orderB5cxx11, ptr noundef nonnull @.str)
          to label %.preheader43 unwind label %42

.preheader43:                                     ; preds = %33
  %35 = call noundef i64 @_ZNKSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE4sizeEv(ptr noundef nonnull align 8 dereferenceable(32) %5) #8
  %.not83 = icmp eq i64 %35, 0
  br i1 %.not83, label %._crit_edge73, label %.lr.ph72

._crit_edge73:                                    ; preds = %47, %.preheader43
  %36 = load i32, ptr %2, align 4, !tbaa !5
  %37 = zext i32 %36 to i64
  %38 = alloca %"class.std::__cxx11::basic_string", i64 %37, align 16
  %39 = icmp eq i32 %36, 0
  br i1 %39, label %.loopexit42, label %52

40:                                               ; preds = %._crit_edge
  %41 = landingpad { ptr, i32 }
          cleanup
  br label %98

42:                                               ; preds = %33
  %43 = landingpad { ptr, i32 }
          cleanup
  br label %.loopexit36

.lr.ph72:                                         ; preds = %.preheader43, %47
  %indvars.iv116 = phi i64 [ %indvars.iv.next117, %47 ], [ 0, %.preheader43 ]
  %44 = call noundef nonnull align 1 dereferenceable(1) ptr @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEixEm(ptr noundef nonnull align 8 dereferenceable(32) %5, i64 noundef %indvars.iv116)
  %45 = load i8, ptr %44, align 1, !tbaa !11
  %46 = invoke noundef nonnull align 8 dereferenceable(32) ptr @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEpLEc(ptr noundef nonnull align 8 dereferenceable(32) @_Z5orderB5cxx11, i8 noundef signext %45)
          to label %47 unwind label %50

47:                                               ; preds = %.lr.ph72
  %indvars.iv.next117 = add nuw nsw i64 %indvars.iv116, 1
  %48 = call noundef i64 @_ZNKSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEE4sizeEv(ptr noundef nonnull align 8 dereferenceable(32) %5) #8
  %49 = icmp ugt i64 %48, %indvars.iv.next117
  br i1 %49, label %.lr.ph72, label %._crit_edge73, !llvm.loop !12

50:                                               ; preds = %.lr.ph72
  %51 = landingpad { ptr, i32 }
          cleanup
  br label %.loopexit36

52:                                               ; preds = %._crit_edge73
  %53 = getelementptr inbounds %"class.std::__cxx11::basic_string", ptr %38, i64 %37
  br label %54

54:                                               ; preds = %54, %52
  %55 = phi ptr [ %38, %52 ], [ %56, %54 ]
  call void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEC2Ev(ptr noundef nonnull align 8 dereferenceable(32) %55) #8
  %56 = getelementptr inbounds i8, ptr %55, i64 32
  %57 = icmp eq ptr %56, %53
  br i1 %57, label %.loopexit42.loopexit, label %54

.loopexit42.loopexit:                             ; preds = %54
  %.pre = load i32, ptr %2, align 4, !tbaa !5
  br label %.loopexit42

.loopexit42:                                      ; preds = %.loopexit42.loopexit, %._crit_edge73
  %58 = phi i32 [ %.pre, %.loopexit42.loopexit ], [ 0, %._crit_edge73 ]
  %59 = sext i32 %58 to i64
  %60 = getelementptr inbounds %"class.std::__cxx11::basic_string", ptr %14, i64 %59
  %61 = invoke noundef ptr @_ZSt4copyIPNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEES6_ET0_T_S8_S7_(ptr noundef nonnull %14, ptr noundef nonnull %60, ptr noundef nonnull %38)
          to label %62 unwind label %68

62:                                               ; preds = %.loopexit42
  %63 = load i32, ptr %2, align 4, !tbaa !5
  %64 = sext i32 %63 to i64
  %65 = getelementptr inbounds %"class.std::__cxx11::basic_string", ptr %38, i64 %64
  invoke void @_ZSt4sortIPNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEPFbS5_S5_EEvT_S9_T0_(ptr noundef nonnull %38, ptr noundef nonnull %65, ptr noundef nonnull @_Z1fNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEES4_)
          to label %.preheader41 unwind label %68

.preheader41:                                     ; preds = %62
  %66 = load i32, ptr %2, align 4, !tbaa !5
  %67 = icmp sgt i32 %66, 0
  br i1 %67, label %.lr.ph76, label %.critedge

._crit_edge77:                                    ; preds = %.lr.ph76
  br i1 %spec.select, label %.critedge, label %.invoke

68:                                               ; preds = %62, %.loopexit42
  %69 = landingpad { ptr, i32 }
          cleanup
  br label %93

.lr.ph76:                                         ; preds = %.preheader41, %.lr.ph76
  %indvars.iv119 = phi i64 [ %indvars.iv.next120, %.lr.ph76 ], [ 0, %.preheader41 ]
  %.01374 = phi i1 [ %spec.select, %.lr.ph76 ], [ true, %.preheader41 ]
  %70 = getelementptr inbounds %"class.std::__cxx11::basic_string", ptr %14, i64 %indvars.iv119
  %71 = getelementptr inbounds %"class.std::__cxx11::basic_string", ptr %38, i64 %indvars.iv119
  %72 = call noundef zeroext i1 @_ZStneIcSt11char_traitsIcESaIcEEbRKNSt7__cxx1112basic_stringIT_T0_T1_EESA_(ptr noundef nonnull align 8 dereferenceable(32) %70, ptr noundef nonnull align 8 dereferenceable(32) %71) #8
  %not. = xor i1 %72, true
  %spec.select = select i1 %not., i1 %.01374, i1 false
  %indvars.iv.next120 = add nuw nsw i64 %indvars.iv119, 1
  %73 = load i32, ptr %2, align 4, !tbaa !5
  %74 = sext i32 %73 to i64
  %75 = icmp slt i64 %indvars.iv.next120, %74
  br i1 %75, label %.lr.ph76, label %._crit_edge77, !llvm.loop !13

.critedge:                                        ; preds = %.preheader41, %._crit_edge77
  br label %.invoke

76:                                               ; preds = %.invoke, %80
  %77 = landingpad { ptr, i32 }
          cleanup
  br label %93

.invoke:                                          ; preds = %._crit_edge77, %.critedge
  %78 = phi i32 [ 1, %.critedge ], [ 0, %._crit_edge77 ]
  %79 = invoke noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEi(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cout, i32 noundef %78)
          to label %80 unwind label %76

80:                                               ; preds = %.invoke
  %81 = invoke noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEPFRSoS_E(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cout, ptr noundef nonnull @_ZSt4endlIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_)
          to label %82 unwind label %76

82:                                               ; preds = %80
  br i1 %39, label %.loopexit40, label %.preheader39.preheader

.preheader39.preheader:                           ; preds = %82
  %83 = getelementptr inbounds %"class.std::__cxx11::basic_string", ptr %38, i64 %37
  br label %.preheader39

.preheader39:                                     ; preds = %.preheader39.preheader, %.preheader39
  %84 = phi ptr [ %85, %.preheader39 ], [ %83, %.preheader39.preheader ]
  %85 = getelementptr inbounds i8, ptr %84, i64 -32
  call void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEED2Ev(ptr noundef nonnull align 8 dereferenceable(32) %85) #8
  %86 = icmp eq ptr %85, %38
  br i1 %86, label %.loopexit40, label %.preheader39

.loopexit40:                                      ; preds = %.preheader39, %82
  call void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEED2Ev(ptr noundef nonnull align 8 dereferenceable(32) %5) #8
  call void @llvm.lifetime.end.p0(i64 32, ptr nonnull %5) #8
  call void @llvm.lifetime.end.p0(i64 1, ptr nonnull %4) #8
  br i1 %15, label %.loopexit38, label %.preheader37.preheader

.preheader37.preheader:                           ; preds = %.loopexit40
  %87 = getelementptr inbounds %"class.std::__cxx11::basic_string", ptr %14, i64 %12
  br label %.preheader37

.preheader37:                                     ; preds = %.preheader37.preheader, %.preheader37
  %88 = phi ptr [ %89, %.preheader37 ], [ %87, %.preheader37.preheader ]
  %89 = getelementptr inbounds i8, ptr %88, i64 -32
  call void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEED2Ev(ptr noundef nonnull align 8 dereferenceable(32) %89) #8
  %90 = icmp eq ptr %89, %14
  br i1 %90, label %.loopexit38, label %.preheader37

.loopexit38:                                      ; preds = %.preheader37, %.loopexit40
  call void @llvm.stackrestore.p0(ptr %13)
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %3) #8
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %2) #8
  %91 = load i32, ptr %1, align 4, !tbaa !5
  %92 = add nsw i32 %91, -1
  store i32 %92, ptr %1, align 4, !tbaa !5
  %.not = icmp eq i32 %91, 0
  br i1 %.not, label %._crit_edge82, label %.lr.ph81, !llvm.loop !14

93:                                               ; preds = %76, %68
  %.pn = phi { ptr, i32 } [ %77, %76 ], [ %69, %68 ]
  br i1 %39, label %.loopexit36, label %.preheader35.preheader

.preheader35.preheader:                           ; preds = %93
  %94 = getelementptr inbounds %"class.std::__cxx11::basic_string", ptr %38, i64 %37
  br label %.preheader35

.preheader35:                                     ; preds = %.preheader35.preheader, %.preheader35
  %95 = phi ptr [ %96, %.preheader35 ], [ %94, %.preheader35.preheader ]
  %96 = getelementptr inbounds i8, ptr %95, i64 -32
  call void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEED2Ev(ptr noundef nonnull align 8 dereferenceable(32) %96) #8
  %97 = icmp eq ptr %96, %38
  br i1 %97, label %.loopexit36, label %.preheader35

.loopexit36:                                      ; preds = %.preheader35, %93, %50, %42
  %.pn30 = phi { ptr, i32 } [ %51, %50 ], [ %.pn, %93 ], [ %43, %42 ], [ %.pn, %.preheader35 ]
  call void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEED2Ev(ptr noundef nonnull align 8 dereferenceable(32) %5) #8
  br label %98

98:                                               ; preds = %.loopexit36, %40
  %.pn30.pn = phi { ptr, i32 } [ %.pn30, %.loopexit36 ], [ %41, %40 ]
  call void @llvm.lifetime.end.p0(i64 32, ptr nonnull %5) #8
  call void @llvm.lifetime.end.p0(i64 1, ptr nonnull %4) #8
  br label %99

99:                                               ; preds = %98, %31
  %.pn33 = phi { ptr, i32 } [ %32, %31 ], [ %.pn30.pn, %98 ]
  br i1 %15, label %.loopexit, label %.preheader.preheader

.preheader.preheader:                             ; preds = %99
  %100 = getelementptr inbounds %"class.std::__cxx11::basic_string", ptr %14, i64 %12
  br label %.preheader

.preheader:                                       ; preds = %.preheader.preheader, %.preheader
  %101 = phi ptr [ %102, %.preheader ], [ %100, %.preheader.preheader ]
  %102 = getelementptr inbounds i8, ptr %101, i64 -32
  call void @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEED2Ev(ptr noundef nonnull align 8 dereferenceable(32) %102) #8
  %103 = icmp eq ptr %102, %14
  br i1 %103, label %.loopexit, label %.preheader

.loopexit:                                        ; preds = %.preheader, %99
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %3) #8
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %2) #8
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %1) #8
  resume { ptr, i32 } %.pn33

._crit_edge82:                                    ; preds = %.loopexit38, %0
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %1) #8
  ret i32 0
}

declare noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERi(ptr noundef nonnull align 8 dereferenceable(16), ptr noundef nonnull align 4 dereferenceable(4)) local_unnamed_addr #4

; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn
declare ptr @llvm.stacksave.p0() #5

declare noundef nonnull align 8 dereferenceable(16) ptr @_ZStrsIcSt11char_traitsIcESaIcEERSt13basic_istreamIT_T0_ES7_RNSt7__cxx1112basic_stringIS4_S5_T1_EE(ptr noundef nonnull align 8 dereferenceable(16), ptr noundef nonnull align 8 dereferenceable(32)) local_unnamed_addr #4

declare i32 @__gxx_personality_v0(...)

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZN8Solution9findOrderEPNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEii(ptr dead_on_unwind noalias writable sret(%"class.std::__cxx11::basic_string") align 8, ptr noundef nonnull align 1 dereferenceable(1), ptr noundef, i32 noundef, i32 noundef) local_unnamed_addr #1 align 2

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

; Function Attrs: mustprogress uwtable
declare noundef nonnull align 8 dereferenceable(32) ptr @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEpLEc(ptr noundef nonnull align 8 dereferenceable(32), i8 noundef signext) local_unnamed_addr #1 align 2

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local noundef ptr @_ZSt4copyIPNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEES6_ET0_T_S8_S7_(ptr noundef, ptr noundef, ptr noundef) local_unnamed_addr #6

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local void @_ZSt4sortIPNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEPFbS5_S5_EEvT_S9_T0_(ptr noundef, ptr noundef, ptr noundef) local_unnamed_addr #6

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef zeroext i1 @_ZStneIcSt11char_traitsIcESaIcEEbRKNSt7__cxx1112basic_stringIT_T0_T1_EESA_(ptr noundef nonnull align 8 dereferenceable(32), ptr noundef nonnull align 8 dereferenceable(32)) local_unnamed_addr #7

declare noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEi(ptr noundef nonnull align 8 dereferenceable(8), i32 noundef) local_unnamed_addr #4

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

; Function Attrs: mustprogress nocallback nofree nosync nounwind willreturn
declare void @llvm.stackrestore.p0(ptr) #5

attributes #0 = { 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 #1 = { mustprogress uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #2 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #3 = { mustprogress norecurse 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 = { "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 nocallback nofree nosync nounwind willreturn }
attributes #6 = { 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 #7 = { inlinehint mustprogress nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #8 = { 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 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = !{!7, !7, i64 0}
!12 = distinct !{!12, !10}
!13 = distinct !{!13, !10}
!14 = distinct !{!14, !10}


; Effective O3 passes: AggressiveInstCombinePass,EarlyCSEPass,GVNPass,GlobalOptPass,IPSCCPPass,IndVarSimplifyPass,InferFunctionAttrsPass,InstCombinePass,InstSimplifyPass,JumpThreadingPass,LCSSAPass,LoopRotatePass,LoopSimplifyPass,LoopUnrollPass,SROAPass,SimplifyCFGPass