; LLVM IR from VastoLorde95/Competitive-Programming :: Codeforces/291 Division 2/Problem D (D)

; 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::stack" = type { %"class.std::deque" }
%"class.std::deque" = type { %"class.std::_Deque_base" }
%"class.std::_Deque_base" = type { %"struct.std::_Deque_base<std::pair<int, int>, std::allocator<std::pair<int, int>>>::_Deque_impl" }
%"struct.std::_Deque_base<std::pair<int, int>, std::allocator<std::pair<int, int>>>::_Deque_impl" = type { %"struct.std::_Deque_base<std::pair<int, int>, std::allocator<std::pair<int, int>>>::_Deque_impl_data" }
%"struct.std::_Deque_base<std::pair<int, int>, std::allocator<std::pair<int, int>>>::_Deque_impl_data" = type { ptr, i64, %"struct.std::_Deque_iterator", %"struct.std::_Deque_iterator" }
%"struct.std::_Deque_iterator" = type { ptr, ptr, ptr, ptr }
%"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" }
%"struct.std::pair" = type { i32, i32 }

@n = external dso_local global i32, align 4
@m = external dso_local global i32, align 4
@k = external dso_local global i32, align 4
@sum = external dso_local global i32, align 4
@START = external dso_local global i32, align 4
@END = external dso_local global i32, align 4
@mx = external dso_local global i32, align 4
@d = external dso_local global i32, align 4
@best = external dso_local global [5 x i32], align 16
@in = external dso_local global [5 x %"class.std::stack"], align 16
@out = external dso_local global [5 x %"class.std::stack"], align 16
@_ZSt3cin = external global %"class.std::basic_istream", align 8
@_ZSt4cout = external global %"class.std::basic_ostream", align 8
@.str = external hidden unnamed_addr constant [2 x i8], align 1

; Function Attrs: mustprogress uwtable
declare dso_local void @_Z8fill_outv() #0

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

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

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

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

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZNSt5stackISt4pairIiiESt5dequeIS1_SaIS1_EEE4pushEOS1_(ptr noundef nonnull align 8 dereferenceable(80), ptr noundef nonnull align 4 dereferenceable(8)) #0 align 2

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

; Function Attrs: mustprogress uwtable
declare dso_local i64 @_ZSt9make_pairIRKiRiESt4pairINSt25__strip_reference_wrapperINSt5decayIT_E4typeEE6__typeENS4_INS5_IT0_E4typeEE6__typeEEOS6_OSB_(ptr noundef nonnull align 4 dereferenceable(4), ptr noundef nonnull align 4 dereferenceable(4)) #0

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef nonnull align 4 dereferenceable(4) ptr @_ZSt3maxIiERKT_S2_S2_(ptr noundef nonnull align 4 dereferenceable(4), ptr noundef nonnull align 4 dereferenceable(4)) #3

; Function Attrs: mustprogress norecurse uwtable
define dso_local noundef i32 @main() #4 {
  %1 = alloca i32, align 4
  %2 = alloca i32, align 4
  %3 = alloca i32, align 4
  %4 = alloca i32, align 4
  %5 = alloca %"struct.std::pair", align 4
  %6 = alloca i32, align 4
  %7 = alloca i32, align 4
  %8 = alloca i32, align 4
  %9 = alloca i32, align 4
  %10 = alloca i32, align 4
  %11 = alloca i32, align 4
  %12 = alloca i32, align 4
  %13 = alloca i32, align 4
  %14 = alloca i32, align 4
  store i32 0, ptr %1, align 4
  %15 = call noundef zeroext i1 @_ZNSt8ios_base15sync_with_stdioEb(i1 noundef zeroext false)
  %16 = load ptr, ptr @_ZSt3cin, align 8, !tbaa !5
  %17 = getelementptr i8, ptr %16, i64 -24
  %18 = load i64, ptr %17, align 8
  %19 = getelementptr inbounds i8, ptr @_ZSt3cin, i64 %18
  %20 = call noundef ptr @_ZNSt9basic_iosIcSt11char_traitsIcEE3tieEPSo(ptr noundef nonnull align 8 dereferenceable(264) %19, ptr noundef null)
  %21 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERi(ptr noundef nonnull align 8 dereferenceable(16) @_ZSt3cin, ptr noundef nonnull align 4 dereferenceable(4) @n)
  %22 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERi(ptr noundef nonnull align 8 dereferenceable(16) %21, ptr noundef nonnull align 4 dereferenceable(4) @m)
  %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) @k)
  call void @llvm.lifetime.start.p0(i64 4, ptr %2) #7
  store i32 0, ptr %2, align 4, !tbaa !8
  br label %24

24:                                               ; preds = %215, %0
  %25 = load i32, ptr %2, align 4, !tbaa !8
  %26 = load i32, ptr @n, align 4, !tbaa !8
  %27 = icmp slt i32 %25, %26
  br i1 %27, label %29, label %28

28:                                               ; preds = %24
  store i32 2, ptr %3, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %2) #7
  br label %218

29:                                               ; preds = %24
  store i32 0, ptr @sum, align 4, !tbaa !8
  call void @llvm.lifetime.start.p0(i64 4, ptr %4) #7
  store i32 0, ptr %4, align 4, !tbaa !8
  br label %30

30:                                               ; preds = %56, %29
  %31 = load i32, ptr %4, align 4, !tbaa !8
  %32 = load i32, ptr @m, align 4, !tbaa !8
  %33 = icmp slt i32 %31, %32
  br i1 %33, label %35, label %34

34:                                               ; preds = %30
  store i32 5, ptr %3, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %4) #7
  br label %59

35:                                               ; preds = %30
  %36 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERi(ptr noundef nonnull align 8 dereferenceable(16) @_ZSt3cin, ptr noundef nonnull align 4 dereferenceable(4) @d)
  %37 = load i32, ptr %4, align 4, !tbaa !8
  %38 = sext i32 %37 to i64
  %39 = getelementptr inbounds [5 x %"class.std::stack"], ptr @in, i64 0, i64 %38
  call void @llvm.lifetime.start.p0(i64 8, ptr %5) #7
  call void @llvm.lifetime.start.p0(i64 4, ptr %6) #7
  %40 = load i32, ptr %4, align 4, !tbaa !8
  %41 = sext i32 %40 to i64
  %42 = getelementptr inbounds [5 x %"class.std::stack"], ptr @in, i64 0, i64 %41
  %43 = call noundef zeroext i1 @_ZNKSt5stackISt4pairIiiESt5dequeIS1_SaIS1_EEE5emptyEv(ptr noundef nonnull align 8 dereferenceable(80) %42)
  br i1 %43, label %51, label %44

44:                                               ; preds = %35
  %45 = load i32, ptr %4, align 4, !tbaa !8
  %46 = sext i32 %45 to i64
  %47 = getelementptr inbounds [5 x %"class.std::stack"], ptr @in, i64 0, i64 %46
  %48 = call noundef nonnull align 4 dereferenceable(8) ptr @_ZNSt5stackISt4pairIiiESt5dequeIS1_SaIS1_EEE3topEv(ptr noundef nonnull align 8 dereferenceable(80) %47)
  %49 = getelementptr inbounds %"struct.std::pair", ptr %48, i32 0, i32 0
  %50 = load i32, ptr %49, align 4, !tbaa !11
  br label %52

51:                                               ; preds = %35
  br label %52

52:                                               ; preds = %51, %44
  %53 = phi i32 [ %50, %44 ], [ 0, %51 ]
  store i32 %53, ptr %6, align 4, !tbaa !8
  %54 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZSt3maxIiERKT_S2_S2_(ptr noundef nonnull align 4 dereferenceable(4) %6, ptr noundef nonnull align 4 dereferenceable(4) @d)
  %55 = call i64 @_ZSt9make_pairIRKiRiESt4pairINSt25__strip_reference_wrapperINSt5decayIT_E4typeEE6__typeENS4_INS5_IT0_E4typeEE6__typeEEOS6_OSB_(ptr noundef nonnull align 4 dereferenceable(4) %54, ptr noundef nonnull align 4 dereferenceable(4) @d)
  store i64 %55, ptr %5, align 4
  call void @_ZNSt5stackISt4pairIiiESt5dequeIS1_SaIS1_EEE4pushEOS1_(ptr noundef nonnull align 8 dereferenceable(80) %39, ptr noundef nonnull align 4 dereferenceable(8) %5)
  call void @llvm.lifetime.end.p0(i64 4, ptr %6) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr %5) #7
  br label %56

56:                                               ; preds = %52
  %57 = load i32, ptr %4, align 4, !tbaa !8
  %58 = add nsw i32 %57, 1
  store i32 %58, ptr %4, align 4, !tbaa !8
  br label %30, !llvm.loop !13

59:                                               ; preds = %34
  %60 = load i32, ptr @END, align 4, !tbaa !8
  %61 = add nsw i32 %60, 1
  store i32 %61, ptr @END, align 4, !tbaa !8
  call void @llvm.lifetime.start.p0(i64 4, ptr %7) #7
  store i32 0, ptr %7, align 4, !tbaa !8
  br label %62

62:                                               ; preds = %91, %59
  %63 = load i32, ptr %7, align 4, !tbaa !8
  %64 = load i32, ptr @m, align 4, !tbaa !8
  %65 = icmp slt i32 %63, %64
  br i1 %65, label %67, label %66

66:                                               ; preds = %62
  store i32 8, ptr %3, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %7) #7
  br label %94

67:                                               ; preds = %62
  %68 = load i32, ptr %7, align 4, !tbaa !8
  %69 = sext i32 %68 to i64
  %70 = getelementptr inbounds [5 x %"class.std::stack"], ptr @in, i64 0, i64 %69
  %71 = call noundef nonnull align 4 dereferenceable(8) ptr @_ZNSt5stackISt4pairIiiESt5dequeIS1_SaIS1_EEE3topEv(ptr noundef nonnull align 8 dereferenceable(80) %70)
  %72 = getelementptr inbounds %"struct.std::pair", ptr %71, i32 0, i32 0
  call void @llvm.lifetime.start.p0(i64 4, ptr %8) #7
  %73 = load i32, ptr %7, align 4, !tbaa !8
  %74 = sext i32 %73 to i64
  %75 = getelementptr inbounds [5 x %"class.std::stack"], ptr @out, i64 0, i64 %74
  %76 = call noundef zeroext i1 @_ZNKSt5stackISt4pairIiiESt5dequeIS1_SaIS1_EEE5emptyEv(ptr noundef nonnull align 8 dereferenceable(80) %75)
  br i1 %76, label %84, label %77

77:                                               ; preds = %67
  %78 = load i32, ptr %7, align 4, !tbaa !8
  %79 = sext i32 %78 to i64
  %80 = getelementptr inbounds [5 x %"class.std::stack"], ptr @out, i64 0, i64 %79
  %81 = call noundef nonnull align 4 dereferenceable(8) ptr @_ZNSt5stackISt4pairIiiESt5dequeIS1_SaIS1_EEE3topEv(ptr noundef nonnull align 8 dereferenceable(80) %80)
  %82 = getelementptr inbounds %"struct.std::pair", ptr %81, i32 0, i32 0
  %83 = load i32, ptr %82, align 4, !tbaa !11
  br label %85

84:                                               ; preds = %67
  br label %85

85:                                               ; preds = %84, %77
  %86 = phi i32 [ %83, %77 ], [ 0, %84 ]
  store i32 %86, ptr %8, align 4, !tbaa !8
  %87 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZSt3maxIiERKT_S2_S2_(ptr noundef nonnull align 4 dereferenceable(4) %72, ptr noundef nonnull align 4 dereferenceable(4) %8)
  %88 = load i32, ptr %87, align 4, !tbaa !8
  %89 = load i32, ptr @sum, align 4, !tbaa !8
  %90 = add nsw i32 %89, %88
  store i32 %90, ptr @sum, align 4, !tbaa !8
  call void @llvm.lifetime.end.p0(i64 4, ptr %8) #7
  br label %91

91:                                               ; preds = %85
  %92 = load i32, ptr %7, align 4, !tbaa !8
  %93 = add nsw i32 %92, 1
  store i32 %93, ptr %7, align 4, !tbaa !8
  br label %62, !llvm.loop !15

94:                                               ; preds = %66
  %95 = load i32, ptr @sum, align 4, !tbaa !8
  %96 = load i32, ptr @k, align 4, !tbaa !8
  %97 = icmp sle i32 %95, %96
  br i1 %97, label %98, label %145

98:                                               ; preds = %94
  %99 = load i32, ptr @END, align 4, !tbaa !8
  %100 = load i32, ptr @START, align 4, !tbaa !8
  %101 = sub nsw i32 %99, %100
  %102 = add nsw i32 %101, 1
  %103 = load i32, ptr @mx, align 4, !tbaa !8
  %104 = icmp sgt i32 %102, %103
  br i1 %104, label %105, label %144

105:                                              ; preds = %98
  %106 = load i32, ptr @END, align 4, !tbaa !8
  %107 = load i32, ptr @START, align 4, !tbaa !8
  %108 = sub nsw i32 %106, %107
  %109 = add nsw i32 %108, 1
  store i32 %109, ptr @mx, align 4, !tbaa !8
  call void @llvm.lifetime.start.p0(i64 4, ptr %9) #7
  store i32 0, ptr %9, align 4, !tbaa !8
  br label %110

110:                                              ; preds = %140, %105
  %111 = load i32, ptr %9, align 4, !tbaa !8
  %112 = load i32, ptr @m, align 4, !tbaa !8
  %113 = icmp slt i32 %111, %112
  br i1 %113, label %115, label %114

114:                                              ; preds = %110
  store i32 11, ptr %3, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %9) #7
  br label %143

115:                                              ; preds = %110
  %116 = load i32, ptr %9, align 4, !tbaa !8
  %117 = sext i32 %116 to i64
  %118 = getelementptr inbounds [5 x %"class.std::stack"], ptr @in, i64 0, i64 %117
  %119 = call noundef nonnull align 4 dereferenceable(8) ptr @_ZNSt5stackISt4pairIiiESt5dequeIS1_SaIS1_EEE3topEv(ptr noundef nonnull align 8 dereferenceable(80) %118)
  %120 = getelementptr inbounds %"struct.std::pair", ptr %119, i32 0, i32 0
  call void @llvm.lifetime.start.p0(i64 4, ptr %10) #7
  %121 = load i32, ptr %9, align 4, !tbaa !8
  %122 = sext i32 %121 to i64
  %123 = getelementptr inbounds [5 x %"class.std::stack"], ptr @out, i64 0, i64 %122
  %124 = call noundef zeroext i1 @_ZNKSt5stackISt4pairIiiESt5dequeIS1_SaIS1_EEE5emptyEv(ptr noundef nonnull align 8 dereferenceable(80) %123)
  br i1 %124, label %132, label %125

125:                                              ; preds = %115
  %126 = load i32, ptr %9, align 4, !tbaa !8
  %127 = sext i32 %126 to i64
  %128 = getelementptr inbounds [5 x %"class.std::stack"], ptr @out, i64 0, i64 %127
  %129 = call noundef nonnull align 4 dereferenceable(8) ptr @_ZNSt5stackISt4pairIiiESt5dequeIS1_SaIS1_EEE3topEv(ptr noundef nonnull align 8 dereferenceable(80) %128)
  %130 = getelementptr inbounds %"struct.std::pair", ptr %129, i32 0, i32 0
  %131 = load i32, ptr %130, align 4, !tbaa !11
  br label %133

132:                                              ; preds = %115
  br label %133

133:                                              ; preds = %132, %125
  %134 = phi i32 [ %131, %125 ], [ 0, %132 ]
  store i32 %134, ptr %10, align 4, !tbaa !8
  %135 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZSt3maxIiERKT_S2_S2_(ptr noundef nonnull align 4 dereferenceable(4) %120, ptr noundef nonnull align 4 dereferenceable(4) %10)
  %136 = load i32, ptr %135, align 4, !tbaa !8
  %137 = load i32, ptr %9, align 4, !tbaa !8
  %138 = sext i32 %137 to i64
  %139 = getelementptr inbounds [5 x i32], ptr @best, i64 0, i64 %138
  store i32 %136, ptr %139, align 4, !tbaa !8
  call void @llvm.lifetime.end.p0(i64 4, ptr %10) #7
  br label %140

140:                                              ; preds = %133
  %141 = load i32, ptr %9, align 4, !tbaa !8
  %142 = add nsw i32 %141, 1
  store i32 %142, ptr %9, align 4, !tbaa !8
  br label %110, !llvm.loop !16

143:                                              ; preds = %114
  br label %144

144:                                              ; preds = %143, %98
  br label %214

145:                                              ; preds = %94
  br label %146

146:                                              ; preds = %212, %145
  %147 = load i32, ptr @sum, align 4, !tbaa !8
  %148 = load i32, ptr @k, align 4, !tbaa !8
  %149 = icmp sgt i32 %147, %148
  br i1 %149, label %150, label %154

150:                                              ; preds = %146
  %151 = load i32, ptr @START, align 4, !tbaa !8
  %152 = load i32, ptr @END, align 4, !tbaa !8
  %153 = icmp sle i32 %151, %152
  br label %154

154:                                              ; preds = %150, %146
  %155 = phi i1 [ false, %146 ], [ %153, %150 ]
  br i1 %155, label %156, label %213

156:                                              ; preds = %154
  %157 = call noundef zeroext i1 @_ZNKSt5stackISt4pairIiiESt5dequeIS1_SaIS1_EEE5emptyEv(ptr noundef nonnull align 8 dereferenceable(80) @out)
  br i1 %157, label %158, label %159

158:                                              ; preds = %156
  call void @_Z8fill_outv()
  br label %159

159:                                              ; preds = %158, %156
  store i32 0, ptr @sum, align 4, !tbaa !8
  %160 = load i32, ptr @START, align 4, !tbaa !8
  %161 = add nsw i32 %160, 1
  store i32 %161, ptr @START, align 4, !tbaa !8
  call void @llvm.lifetime.start.p0(i64 4, ptr %11) #7
  store i32 0, ptr %11, align 4, !tbaa !8
  br label %162

162:                                              ; preds = %209, %159
  %163 = load i32, ptr %11, align 4, !tbaa !8
  %164 = load i32, ptr @m, align 4, !tbaa !8
  %165 = icmp slt i32 %163, %164
  br i1 %165, label %167, label %166

166:                                              ; preds = %162
  store i32 16, ptr %3, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %11) #7
  br label %212

167:                                              ; preds = %162
  %168 = load i32, ptr %11, align 4, !tbaa !8
  %169 = sext i32 %168 to i64
  %170 = getelementptr inbounds [5 x %"class.std::stack"], ptr @out, i64 0, i64 %169
  %171 = call noundef zeroext i1 @_ZNKSt5stackISt4pairIiiESt5dequeIS1_SaIS1_EEE5emptyEv(ptr noundef nonnull align 8 dereferenceable(80) %170)
  br i1 %171, label %208, label %172

172:                                              ; preds = %167
  %173 = load i32, ptr %11, align 4, !tbaa !8
  %174 = sext i32 %173 to i64
  %175 = getelementptr inbounds [5 x %"class.std::stack"], ptr @out, i64 0, i64 %174
  call void @_ZNSt5stackISt4pairIiiESt5dequeIS1_SaIS1_EEE3popEv(ptr noundef nonnull align 8 dereferenceable(80) %175)
  call void @llvm.lifetime.start.p0(i64 4, ptr %12) #7
  %176 = load i32, ptr %11, align 4, !tbaa !8
  %177 = sext i32 %176 to i64
  %178 = getelementptr inbounds [5 x %"class.std::stack"], ptr @out, i64 0, i64 %177
  %179 = call noundef zeroext i1 @_ZNKSt5stackISt4pairIiiESt5dequeIS1_SaIS1_EEE5emptyEv(ptr noundef nonnull align 8 dereferenceable(80) %178)
  br i1 %179, label %180, label %181

180:                                              ; preds = %172
  br label %188

181:                                              ; preds = %172
  %182 = load i32, ptr %11, align 4, !tbaa !8
  %183 = sext i32 %182 to i64
  %184 = getelementptr inbounds [5 x %"class.std::stack"], ptr @out, i64 0, i64 %183
  %185 = call noundef nonnull align 4 dereferenceable(8) ptr @_ZNSt5stackISt4pairIiiESt5dequeIS1_SaIS1_EEE3topEv(ptr noundef nonnull align 8 dereferenceable(80) %184)
  %186 = getelementptr inbounds %"struct.std::pair", ptr %185, i32 0, i32 0
  %187 = load i32, ptr %186, align 4, !tbaa !11
  br label %188

188:                                              ; preds = %181, %180
  %189 = phi i32 [ 0, %180 ], [ %187, %181 ]
  store i32 %189, ptr %12, align 4, !tbaa !8
  call void @llvm.lifetime.start.p0(i64 4, ptr %13) #7
  %190 = load i32, ptr %11, align 4, !tbaa !8
  %191 = sext i32 %190 to i64
  %192 = getelementptr inbounds [5 x %"class.std::stack"], ptr @in, i64 0, i64 %191
  %193 = call noundef zeroext i1 @_ZNKSt5stackISt4pairIiiESt5dequeIS1_SaIS1_EEE5emptyEv(ptr noundef nonnull align 8 dereferenceable(80) %192)
  br i1 %193, label %194, label %195

194:                                              ; preds = %188
  br label %202

195:                                              ; preds = %188
  %196 = load i32, ptr %11, align 4, !tbaa !8
  %197 = sext i32 %196 to i64
  %198 = getelementptr inbounds [5 x %"class.std::stack"], ptr @in, i64 0, i64 %197
  %199 = call noundef nonnull align 4 dereferenceable(8) ptr @_ZNSt5stackISt4pairIiiESt5dequeIS1_SaIS1_EEE3topEv(ptr noundef nonnull align 8 dereferenceable(80) %198)
  %200 = getelementptr inbounds %"struct.std::pair", ptr %199, i32 0, i32 0
  %201 = load i32, ptr %200, align 4, !tbaa !11
  br label %202

202:                                              ; preds = %195, %194
  %203 = phi i32 [ 0, %194 ], [ %201, %195 ]
  store i32 %203, ptr %13, align 4, !tbaa !8
  %204 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZSt3maxIiERKT_S2_S2_(ptr noundef nonnull align 4 dereferenceable(4) %12, ptr noundef nonnull align 4 dereferenceable(4) %13)
  %205 = load i32, ptr %204, align 4, !tbaa !8
  %206 = load i32, ptr @sum, align 4, !tbaa !8
  %207 = add nsw i32 %206, %205
  store i32 %207, ptr @sum, align 4, !tbaa !8
  call void @llvm.lifetime.end.p0(i64 4, ptr %13) #7
  call void @llvm.lifetime.end.p0(i64 4, ptr %12) #7
  br label %208

208:                                              ; preds = %202, %167
  br label %209

209:                                              ; preds = %208
  %210 = load i32, ptr %11, align 4, !tbaa !8
  %211 = add nsw i32 %210, 1
  store i32 %211, ptr %11, align 4, !tbaa !8
  br label %162, !llvm.loop !17

212:                                              ; preds = %166
  br label %146, !llvm.loop !18

213:                                              ; preds = %154
  br label %214

214:                                              ; preds = %213, %144
  br label %215

215:                                              ; preds = %214
  %216 = load i32, ptr %2, align 4, !tbaa !8
  %217 = add nsw i32 %216, 1
  store i32 %217, ptr %2, align 4, !tbaa !8
  br label %24, !llvm.loop !19

218:                                              ; preds = %28
  call void @llvm.lifetime.start.p0(i64 4, ptr %14) #7
  store i32 0, ptr %14, align 4, !tbaa !8
  br label %219

219:                                              ; preds = %231, %218
  %220 = load i32, ptr %14, align 4, !tbaa !8
  %221 = load i32, ptr @m, align 4, !tbaa !8
  %222 = icmp slt i32 %220, %221
  br i1 %222, label %224, label %223

223:                                              ; preds = %219
  store i32 19, ptr %3, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %14) #7
  br label %234

224:                                              ; preds = %219
  %225 = load i32, ptr %14, align 4, !tbaa !8
  %226 = sext i32 %225 to i64
  %227 = getelementptr inbounds [5 x i32], ptr @best, i64 0, i64 %226
  %228 = load i32, ptr %227, align 4, !tbaa !8
  %229 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEi(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cout, i32 noundef %228)
  %230 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc(ptr noundef nonnull align 8 dereferenceable(8) %229, ptr noundef @.str)
  br label %231

231:                                              ; preds = %224
  %232 = load i32, ptr %14, align 4, !tbaa !8
  %233 = add nsw i32 %232, 1
  store i32 %233, ptr %14, align 4, !tbaa !8
  br label %219, !llvm.loop !20

234:                                              ; preds = %223
  %235 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEPFRSoS_E(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cout, ptr noundef @_ZSt4endlIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_)
  ret i32 0
}

declare noundef zeroext i1 @_ZNSt8ios_base15sync_with_stdioEb(i1 noundef zeroext) #5

; Function Attrs: mustprogress nounwind uwtable
declare noundef ptr @_ZNSt9basic_iosIcSt11char_traitsIcEE3tieEPSo(ptr noundef nonnull align 8 dereferenceable(264), ptr noundef) #2 align 2

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

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

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

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

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


; 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::stack" = type { %"class.std::deque" }
%"class.std::deque" = type { %"class.std::_Deque_base" }
%"class.std::_Deque_base" = type { %"struct.std::_Deque_base<std::pair<int, int>, std::allocator<std::pair<int, int>>>::_Deque_impl" }
%"struct.std::_Deque_base<std::pair<int, int>, std::allocator<std::pair<int, int>>>::_Deque_impl" = type { %"struct.std::_Deque_base<std::pair<int, int>, std::allocator<std::pair<int, int>>>::_Deque_impl_data" }
%"struct.std::_Deque_base<std::pair<int, int>, std::allocator<std::pair<int, int>>>::_Deque_impl_data" = type { ptr, i64, %"struct.std::_Deque_iterator", %"struct.std::_Deque_iterator" }
%"struct.std::_Deque_iterator" = type { ptr, ptr, ptr, ptr }
%"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" }
%"struct.std::pair" = type { i32, i32 }

@n = external dso_local global i32, align 4
@m = external dso_local global i32, align 4
@k = external dso_local global i32, align 4
@sum = external dso_local local_unnamed_addr global i32, align 4
@START = external dso_local local_unnamed_addr global i32, align 4
@END = external dso_local local_unnamed_addr global i32, align 4
@mx = external dso_local local_unnamed_addr global i32, align 4
@d = external dso_local global i32, align 4
@best = external dso_local local_unnamed_addr global [5 x i32], align 16
@in = external dso_local global [5 x %"class.std::stack"], align 16
@out = external dso_local global [5 x %"class.std::stack"], align 16
@_ZSt3cin = external global %"class.std::basic_istream", align 8
@_ZSt4cout = external global %"class.std::basic_ostream", align 8
@.str = external hidden unnamed_addr constant [2 x i8], align 1

; Function Attrs: mustprogress uwtable
declare dso_local void @_Z8fill_outv() local_unnamed_addr #0

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

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

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

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZNSt5stackISt4pairIiiESt5dequeIS1_SaIS1_EEE3popEv(ptr noundef nonnull align 8 dereferenceable(80)) local_unnamed_addr #2 align 2

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZNSt5stackISt4pairIiiESt5dequeIS1_SaIS1_EEE4pushEOS1_(ptr noundef nonnull align 8 dereferenceable(80), ptr noundef nonnull align 4 dereferenceable(8)) 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) #1

; Function Attrs: mustprogress uwtable
declare dso_local i64 @_ZSt9make_pairIRKiRiESt4pairINSt25__strip_reference_wrapperINSt5decayIT_E4typeEE6__typeENS4_INS5_IT0_E4typeEE6__typeEEOS6_OSB_(ptr noundef nonnull align 4 dereferenceable(4), ptr noundef nonnull align 4 dereferenceable(4)) local_unnamed_addr #0

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef nonnull align 4 dereferenceable(4) ptr @_ZSt3maxIiERKT_S2_S2_(ptr noundef nonnull align 4 dereferenceable(4), ptr noundef nonnull align 4 dereferenceable(4)) local_unnamed_addr #3

; Function Attrs: mustprogress norecurse uwtable
define dso_local noundef i32 @main() local_unnamed_addr #4 {
  %1 = alloca %"struct.std::pair", align 8
  %2 = alloca i32, align 4
  %3 = alloca i32, align 4
  %4 = alloca i32, align 4
  %5 = alloca i32, align 4
  %6 = alloca i32, align 4
  %7 = tail call noundef zeroext i1 @_ZNSt8ios_base15sync_with_stdioEb(i1 noundef zeroext false)
  %8 = load ptr, ptr @_ZSt3cin, align 8, !tbaa !5
  %9 = getelementptr i8, ptr %8, i64 -24
  %10 = load i64, ptr %9, align 8
  %11 = getelementptr inbounds i8, ptr @_ZSt3cin, i64 %10
  %12 = tail call noundef ptr @_ZNSt9basic_iosIcSt11char_traitsIcEE3tieEPSo(ptr noundef nonnull align 8 dereferenceable(264) %11, ptr noundef null)
  %13 = tail call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERi(ptr noundef nonnull align 8 dereferenceable(16) @_ZSt3cin, ptr noundef nonnull align 4 dereferenceable(4) @n)
  %14 = tail call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERi(ptr noundef nonnull align 8 dereferenceable(16) %13, ptr noundef nonnull align 4 dereferenceable(4) @m)
  %15 = tail call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERi(ptr noundef nonnull align 8 dereferenceable(16) %14, ptr noundef nonnull align 4 dereferenceable(4) @k)
  %16 = load i32, ptr @n, align 4, !tbaa !8
  %17 = icmp sgt i32 %16, 0
  %.pre74 = load i32, ptr @m, align 4, !tbaa !8
  br i1 %17, label %.lr.ph53, label %.preheader

.preheader:                                       ; preds = %.loopexit37, %0
  %18 = phi i32 [ %.pre74, %0 ], [ %127, %.loopexit37 ]
  %19 = icmp sgt i32 %18, 0
  br i1 %19, label %.lr.ph55, label %._crit_edge56

.lr.ph53:                                         ; preds = %0, %.loopexit37
  %20 = phi i32 [ %127, %.loopexit37 ], [ %.pre74, %0 ]
  %21 = phi i32 [ %128, %.loopexit37 ], [ %.pre74, %0 ]
  %.03351 = phi i32 [ %129, %.loopexit37 ], [ 0, %0 ]
  store i32 0, ptr @sum, align 4, !tbaa !8
  %22 = icmp sgt i32 %21, 0
  br i1 %22, label %.lr.ph, label %._crit_edge.thread

._crit_edge.thread:                               ; preds = %.lr.ph53
  %23 = load i32, ptr @END, align 4, !tbaa !8
  %24 = add nsw i32 %23, 1
  store i32 %24, ptr @END, align 4, !tbaa !8
  br label %._crit_edge.._crit_edge43_crit_edge

._crit_edge:                                      ; preds = %36
  %25 = load i32, ptr @END, align 4, !tbaa !8
  %26 = add nsw i32 %25, 1
  store i32 %26, ptr @END, align 4, !tbaa !8
  %27 = icmp sgt i32 %40, 0
  br i1 %27, label %.lr.ph42, label %._crit_edge.._crit_edge43_crit_edge

._crit_edge.._crit_edge43_crit_edge:              ; preds = %._crit_edge.thread, %._crit_edge
  %28 = phi i32 [ %21, %._crit_edge.thread ], [ %40, %._crit_edge ]
  %29 = phi i32 [ %20, %._crit_edge.thread ], [ %40, %._crit_edge ]
  %.pre71 = load i32, ptr @sum, align 4, !tbaa !8
  br label %._crit_edge43

.lr.ph:                                           ; preds = %.lr.ph53, %36
  %indvars.iv = phi i64 [ %indvars.iv.next, %36 ], [ 0, %.lr.ph53 ]
  %30 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERi(ptr noundef nonnull align 8 dereferenceable(16) @_ZSt3cin, ptr noundef nonnull align 4 dereferenceable(4) @d)
  %31 = getelementptr inbounds [5 x %"class.std::stack"], ptr @in, i64 0, i64 %indvars.iv
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %1) #7
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %2) #7
  %32 = call noundef zeroext i1 @_ZNKSt5stackISt4pairIiiESt5dequeIS1_SaIS1_EEE5emptyEv(ptr noundef nonnull align 8 dereferenceable(80) %31)
  br i1 %32, label %36, label %33

33:                                               ; preds = %.lr.ph
  %34 = call noundef nonnull align 4 dereferenceable(8) ptr @_ZNSt5stackISt4pairIiiESt5dequeIS1_SaIS1_EEE3topEv(ptr noundef nonnull align 8 dereferenceable(80) %31)
  %35 = load i32, ptr %34, align 4, !tbaa !11
  br label %36

36:                                               ; preds = %.lr.ph, %33
  %37 = phi i32 [ %35, %33 ], [ 0, %.lr.ph ]
  store i32 %37, ptr %2, align 4, !tbaa !8
  %38 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZSt3maxIiERKT_S2_S2_(ptr noundef nonnull align 4 dereferenceable(4) %2, ptr noundef nonnull align 4 dereferenceable(4) @d)
  %39 = call i64 @_ZSt9make_pairIRKiRiESt4pairINSt25__strip_reference_wrapperINSt5decayIT_E4typeEE6__typeENS4_INS5_IT0_E4typeEE6__typeEEOS6_OSB_(ptr noundef nonnull align 4 dereferenceable(4) %38, ptr noundef nonnull align 4 dereferenceable(4) @d)
  store i64 %39, ptr %1, align 8
  call void @_ZNSt5stackISt4pairIiiESt5dequeIS1_SaIS1_EEE4pushEOS1_(ptr noundef nonnull align 8 dereferenceable(80) %31, ptr noundef nonnull align 4 dereferenceable(8) %1)
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %2) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %1) #7
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  %40 = load i32, ptr @m, align 4, !tbaa !8
  %41 = sext i32 %40 to i64
  %42 = icmp slt i64 %indvars.iv.next, %41
  br i1 %42, label %.lr.ph, label %._crit_edge, !llvm.loop !13

._crit_edge43:                                    ; preds = %56, %._crit_edge.._crit_edge43_crit_edge
  %43 = phi i32 [ %29, %._crit_edge.._crit_edge43_crit_edge ], [ %62, %56 ]
  %44 = phi i32 [ %.pre71, %._crit_edge.._crit_edge43_crit_edge ], [ %61, %56 ]
  %45 = phi i32 [ %28, %._crit_edge.._crit_edge43_crit_edge ], [ %62, %56 ]
  %46 = load i32, ptr @k, align 4, !tbaa !8
  %.not = icmp sgt i32 %44, %46
  br i1 %.not, label %.preheader36, label %65

.preheader36:                                     ; preds = %._crit_edge43
  %47 = load i32, ptr @START, align 4
  %48 = load i32, ptr @END, align 4
  %.not75 = icmp sgt i32 %47, %48
  br i1 %.not75, label %.loopexit37, label %.lr.ph50

.lr.ph42:                                         ; preds = %._crit_edge, %56
  %indvars.iv59 = phi i64 [ %indvars.iv.next60, %56 ], [ 0, %._crit_edge ]
  %49 = getelementptr inbounds [5 x %"class.std::stack"], ptr @in, i64 0, i64 %indvars.iv59
  %50 = call noundef nonnull align 4 dereferenceable(8) ptr @_ZNSt5stackISt4pairIiiESt5dequeIS1_SaIS1_EEE3topEv(ptr noundef nonnull align 8 dereferenceable(80) %49)
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %3) #7
  %51 = getelementptr inbounds [5 x %"class.std::stack"], ptr @out, i64 0, i64 %indvars.iv59
  %52 = call noundef zeroext i1 @_ZNKSt5stackISt4pairIiiESt5dequeIS1_SaIS1_EEE5emptyEv(ptr noundef nonnull align 8 dereferenceable(80) %51)
  br i1 %52, label %56, label %53

53:                                               ; preds = %.lr.ph42
  %54 = call noundef nonnull align 4 dereferenceable(8) ptr @_ZNSt5stackISt4pairIiiESt5dequeIS1_SaIS1_EEE3topEv(ptr noundef nonnull align 8 dereferenceable(80) %51)
  %55 = load i32, ptr %54, align 4, !tbaa !11
  br label %56

56:                                               ; preds = %.lr.ph42, %53
  %57 = phi i32 [ %55, %53 ], [ 0, %.lr.ph42 ]
  store i32 %57, ptr %3, align 4, !tbaa !8
  %58 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZSt3maxIiERKT_S2_S2_(ptr noundef nonnull align 4 dereferenceable(4) %50, ptr noundef nonnull align 4 dereferenceable(4) %3)
  %59 = load i32, ptr %58, align 4, !tbaa !8
  %60 = load i32, ptr @sum, align 4, !tbaa !8
  %61 = add nsw i32 %60, %59
  store i32 %61, ptr @sum, align 4, !tbaa !8
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %3) #7
  %indvars.iv.next60 = add nuw nsw i64 %indvars.iv59, 1
  %62 = load i32, ptr @m, align 4, !tbaa !8
  %63 = sext i32 %62 to i64
  %64 = icmp slt i64 %indvars.iv.next60, %63
  br i1 %64, label %.lr.ph42, label %._crit_edge43, !llvm.loop !15

65:                                               ; preds = %._crit_edge43
  %66 = load i32, ptr @END, align 4, !tbaa !8
  %67 = load i32, ptr @START, align 4, !tbaa !8
  %68 = sub nsw i32 %66, %67
  %69 = load i32, ptr @mx, align 4, !tbaa !8
  %.not35 = icmp slt i32 %68, %69
  br i1 %.not35, label %.loopexit37, label %70

70:                                               ; preds = %65
  %71 = add nsw i32 %68, 1
  store i32 %71, ptr @mx, align 4, !tbaa !8
  %72 = icmp sgt i32 %43, 0
  br i1 %72, label %.lr.ph46, label %.loopexit37

.lr.ph46:                                         ; preds = %70, %80
  %indvars.iv62 = phi i64 [ %indvars.iv.next63, %80 ], [ 0, %70 ]
  %73 = getelementptr inbounds [5 x %"class.std::stack"], ptr @in, i64 0, i64 %indvars.iv62
  %74 = call noundef nonnull align 4 dereferenceable(8) ptr @_ZNSt5stackISt4pairIiiESt5dequeIS1_SaIS1_EEE3topEv(ptr noundef nonnull align 8 dereferenceable(80) %73)
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %4) #7
  %75 = getelementptr inbounds [5 x %"class.std::stack"], ptr @out, i64 0, i64 %indvars.iv62
  %76 = call noundef zeroext i1 @_ZNKSt5stackISt4pairIiiESt5dequeIS1_SaIS1_EEE5emptyEv(ptr noundef nonnull align 8 dereferenceable(80) %75)
  br i1 %76, label %80, label %77

77:                                               ; preds = %.lr.ph46
  %78 = call noundef nonnull align 4 dereferenceable(8) ptr @_ZNSt5stackISt4pairIiiESt5dequeIS1_SaIS1_EEE3topEv(ptr noundef nonnull align 8 dereferenceable(80) %75)
  %79 = load i32, ptr %78, align 4, !tbaa !11
  br label %80

80:                                               ; preds = %.lr.ph46, %77
  %81 = phi i32 [ %79, %77 ], [ 0, %.lr.ph46 ]
  store i32 %81, ptr %4, align 4, !tbaa !8
  %82 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZSt3maxIiERKT_S2_S2_(ptr noundef nonnull align 4 dereferenceable(4) %74, ptr noundef nonnull align 4 dereferenceable(4) %4)
  %83 = load i32, ptr %82, align 4, !tbaa !8
  %84 = getelementptr inbounds [5 x i32], ptr @best, i64 0, i64 %indvars.iv62
  store i32 %83, ptr %84, align 4, !tbaa !8
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %4) #7
  %indvars.iv.next63 = add nuw nsw i64 %indvars.iv62, 1
  %85 = load i32, ptr @m, align 4, !tbaa !8
  %86 = sext i32 %85 to i64
  %87 = icmp slt i64 %indvars.iv.next63, %86
  br i1 %87, label %.lr.ph46, label %.loopexit37, !llvm.loop !16

.loopexit.loopexit:                               ; preds = %123
  %.pre72 = load i32, ptr @sum, align 4, !tbaa !8
  %.pre73 = load i32, ptr @START, align 4
  br label %.loopexit

.loopexit:                                        ; preds = %.loopexit.loopexit, %98
  %88 = phi i32 [ %.pre73, %.loopexit.loopexit ], [ %100, %98 ]
  %89 = phi i32 [ %.pre72, %.loopexit.loopexit ], [ 0, %98 ]
  %90 = phi i32 [ %124, %.loopexit.loopexit ], [ %101, %98 ]
  %91 = load i32, ptr @k, align 4, !tbaa !8
  %92 = icmp sgt i32 %89, %91
  %93 = load i32, ptr @END, align 4
  %94 = icmp sle i32 %88, %93
  %95 = select i1 %92, i1 %94, i1 false
  br i1 %95, label %.lr.ph50, label %.loopexit37, !llvm.loop !17

.lr.ph50:                                         ; preds = %.preheader36, %.loopexit
  %96 = call noundef zeroext i1 @_ZNKSt5stackISt4pairIiiESt5dequeIS1_SaIS1_EEE5emptyEv(ptr noundef nonnull align 8 dereferenceable(80) @out)
  br i1 %96, label %97, label %98

97:                                               ; preds = %.lr.ph50
  call void @_Z8fill_outv()
  br label %98

98:                                               ; preds = %97, %.lr.ph50
  store i32 0, ptr @sum, align 4, !tbaa !8
  %99 = load i32, ptr @START, align 4, !tbaa !8
  %100 = add nsw i32 %99, 1
  store i32 %100, ptr @START, align 4, !tbaa !8
  %101 = load i32, ptr @m, align 4, !tbaa !8
  %102 = icmp sgt i32 %101, 0
  br i1 %102, label %.lr.ph49, label %.loopexit

.lr.ph49:                                         ; preds = %98, %123
  %indvars.iv65 = phi i64 [ %indvars.iv.next66, %123 ], [ 0, %98 ]
  %103 = getelementptr inbounds [5 x %"class.std::stack"], ptr @out, i64 0, i64 %indvars.iv65
  %104 = call noundef zeroext i1 @_ZNKSt5stackISt4pairIiiESt5dequeIS1_SaIS1_EEE5emptyEv(ptr noundef nonnull align 8 dereferenceable(80) %103)
  br i1 %104, label %123, label %105

105:                                              ; preds = %.lr.ph49
  call void @_ZNSt5stackISt4pairIiiESt5dequeIS1_SaIS1_EEE3popEv(ptr noundef nonnull align 8 dereferenceable(80) %103)
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %5) #7
  %106 = call noundef zeroext i1 @_ZNKSt5stackISt4pairIiiESt5dequeIS1_SaIS1_EEE5emptyEv(ptr noundef nonnull align 8 dereferenceable(80) %103)
  br i1 %106, label %110, label %107

107:                                              ; preds = %105
  %108 = call noundef nonnull align 4 dereferenceable(8) ptr @_ZNSt5stackISt4pairIiiESt5dequeIS1_SaIS1_EEE3topEv(ptr noundef nonnull align 8 dereferenceable(80) %103)
  %109 = load i32, ptr %108, align 4, !tbaa !11
  br label %110

110:                                              ; preds = %105, %107
  %111 = phi i32 [ %109, %107 ], [ 0, %105 ]
  store i32 %111, ptr %5, align 4, !tbaa !8
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %6) #7
  %112 = getelementptr inbounds [5 x %"class.std::stack"], ptr @in, i64 0, i64 %indvars.iv65
  %113 = call noundef zeroext i1 @_ZNKSt5stackISt4pairIiiESt5dequeIS1_SaIS1_EEE5emptyEv(ptr noundef nonnull align 8 dereferenceable(80) %112)
  br i1 %113, label %117, label %114

114:                                              ; preds = %110
  %115 = call noundef nonnull align 4 dereferenceable(8) ptr @_ZNSt5stackISt4pairIiiESt5dequeIS1_SaIS1_EEE3topEv(ptr noundef nonnull align 8 dereferenceable(80) %112)
  %116 = load i32, ptr %115, align 4, !tbaa !11
  br label %117

117:                                              ; preds = %110, %114
  %118 = phi i32 [ %116, %114 ], [ 0, %110 ]
  store i32 %118, ptr %6, align 4, !tbaa !8
  %119 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZSt3maxIiERKT_S2_S2_(ptr noundef nonnull align 4 dereferenceable(4) %5, ptr noundef nonnull align 4 dereferenceable(4) %6)
  %120 = load i32, ptr %119, align 4, !tbaa !8
  %121 = load i32, ptr @sum, align 4, !tbaa !8
  %122 = add nsw i32 %121, %120
  store i32 %122, ptr @sum, align 4, !tbaa !8
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %6) #7
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %5) #7
  br label %123

123:                                              ; preds = %.lr.ph49, %117
  %indvars.iv.next66 = add nuw nsw i64 %indvars.iv65, 1
  %124 = load i32, ptr @m, align 4, !tbaa !8
  %125 = sext i32 %124 to i64
  %126 = icmp slt i64 %indvars.iv.next66, %125
  br i1 %126, label %.lr.ph49, label %.loopexit.loopexit, !llvm.loop !18

.loopexit37:                                      ; preds = %80, %.loopexit, %70, %.preheader36, %65
  %127 = phi i32 [ %43, %70 ], [ %43, %.preheader36 ], [ %43, %65 ], [ %90, %.loopexit ], [ %85, %80 ]
  %128 = phi i32 [ %43, %70 ], [ %45, %.preheader36 ], [ %45, %65 ], [ %90, %.loopexit ], [ %85, %80 ]
  %129 = add nuw nsw i32 %.03351, 1
  %130 = load i32, ptr @n, align 4, !tbaa !8
  %131 = icmp slt i32 %129, %130
  br i1 %131, label %.lr.ph53, label %.preheader, !llvm.loop !19

._crit_edge56:                                    ; preds = %.lr.ph55, %.preheader
  %132 = call 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_)
  ret i32 0

.lr.ph55:                                         ; preds = %.preheader, %.lr.ph55
  %indvars.iv68 = phi i64 [ %indvars.iv.next69, %.lr.ph55 ], [ 0, %.preheader ]
  %133 = getelementptr inbounds [5 x i32], ptr @best, i64 0, i64 %indvars.iv68
  %134 = load i32, ptr %133, align 4, !tbaa !8
  %135 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEi(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cout, i32 noundef %134)
  %136 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc(ptr noundef nonnull align 8 dereferenceable(8) %135, ptr noundef nonnull @.str)
  %indvars.iv.next69 = add nuw nsw i64 %indvars.iv68, 1
  %137 = load i32, ptr @m, align 4, !tbaa !8
  %138 = sext i32 %137 to i64
  %139 = icmp slt i64 %indvars.iv.next69, %138
  br i1 %139, label %.lr.ph55, label %._crit_edge56, !llvm.loop !20
}

declare noundef zeroext i1 @_ZNSt8ios_base15sync_with_stdioEb(i1 noundef zeroext) local_unnamed_addr #5

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

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 #5

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

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

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

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


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