; LLVM IR from bqi343/cp-notebook :: Contests/USACO Solutions/2016-17/Jan 2017/Gold (17 Jan G2)

; 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::vector" = type { %"struct.std::_Vector_base" }
%"struct.std::_Vector_base" = type { %"struct.std::_Vector_base<char, std::allocator<char>>::_Vector_impl" }
%"struct.std::_Vector_base<char, std::allocator<char>>::_Vector_impl" = type { %"struct.std::_Vector_base<char, std::allocator<char>>::_Vector_impl_data" }
%"struct.std::_Vector_base<char, std::allocator<char>>::_Vector_impl_data" = type { ptr, ptr, ptr }
%"class.std::basic_ifstream" = type { %"class.std::basic_istream.base", %"class.std::basic_filebuf", %"class.std::basic_ios" }
%"class.std::basic_istream.base" = type { ptr, i64 }
%"class.std::basic_filebuf" = type { %"class.std::basic_streambuf", %union.pthread_mutex_t, %"class.std::__basic_file", i32, %struct.__mbstate_t, %struct.__mbstate_t, %struct.__mbstate_t, ptr, i64, i8, i8, i8, i8, ptr, ptr, i8, ptr, ptr, i64, ptr, ptr }
%"class.std::basic_streambuf" = type { ptr, ptr, ptr, ptr, ptr, ptr, ptr, %"class.std::locale" }
%"class.std::locale" = type { ptr }
%union.pthread_mutex_t = type { %struct.__pthread_mutex_s }
%struct.__pthread_mutex_s = type { i32, i32, i32, i32, i32, i16, i16, %struct.__pthread_internal_list }
%struct.__pthread_internal_list = type { ptr, ptr }
%"class.std::__basic_file" = type <{ ptr, i8, [7 x i8] }>
%struct.__mbstate_t = type { i32, %union.anon }
%union.anon = type { i32 }
%"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::basic_ofstream" = type { %"class.std::basic_ostream.base", %"class.std::basic_filebuf", %"class.std::basic_ios" }
%"class.std::basic_ostream.base" = type { ptr }

@b1 = external dso_local global [3 x [21 x [100000 x i32]]], align 16
@n = external dso_local global i32, align 4
@k = external dso_local global i32, align 4
@ans = external dso_local global i32, align 4
@x = external dso_local global %"class.std::vector", align 8
@.str = external hidden unnamed_addr constant [7 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [8 x i8], align 1

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef zeroext i1 @_Z4beatic(i32 noundef, i8 noundef signext) #0

; Function Attrs: mustprogress norecurse uwtable
define dso_local noundef i32 @main() #1 personality ptr @__gxx_personality_v0 {
  %1 = alloca i32, align 4
  %2 = alloca %"class.std::basic_ifstream", align 8
  %3 = alloca %"class.std::basic_ofstream", align 8
  %4 = alloca ptr, align 8
  %5 = alloca i32, align 4
  %6 = alloca i32, align 4
  %7 = alloca i32, align 4
  %8 = alloca i32, align 4
  %9 = alloca i32, align 4
  store i32 0, ptr %1, align 4
  call void @llvm.lifetime.start.p0(i64 520, ptr %2) #6
  call void @_ZNSt14basic_ifstreamIcSt11char_traitsIcEEC1EPKcSt13_Ios_Openmode(ptr noundef nonnull align 8 dereferenceable(256) %2, ptr noundef @.str, i32 noundef 8)
  call void @llvm.lifetime.start.p0(i64 512, ptr %3) #6
  invoke void @_ZNSt14basic_ofstreamIcSt11char_traitsIcEEC1EPKcSt13_Ios_Openmode(ptr noundef nonnull align 8 dereferenceable(248) %3, ptr noundef @.str.2, i32 noundef 16)
          to label %10 unwind label %23

10:                                               ; preds = %0
  %11 = invoke noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERi(ptr noundef nonnull align 8 dereferenceable(16) %2, ptr noundef nonnull align 4 dereferenceable(4) @n)
          to label %12 unwind label %27

12:                                               ; preds = %10
  %13 = invoke noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERi(ptr noundef nonnull align 8 dereferenceable(16) %11, ptr noundef nonnull align 4 dereferenceable(4) @k)
          to label %14 unwind label %27

14:                                               ; preds = %12
  %15 = load i32, ptr @n, align 4, !tbaa !5
  %16 = sext i32 %15 to i64
  invoke void @_ZNSt6vectorIcSaIcEE6resizeEm(ptr noundef nonnull align 8 dereferenceable(24) @x, i64 noundef %16)
          to label %17 unwind label %27

17:                                               ; preds = %14
  call void @llvm.lifetime.start.p0(i64 4, ptr %6) #6
  store i32 0, ptr %6, align 4, !tbaa !5
  br label %18

18:                                               ; preds = %37, %17
  %19 = load i32, ptr %6, align 4, !tbaa !5
  %20 = load i32, ptr @n, align 4, !tbaa !5
  %21 = icmp slt i32 %19, %20
  br i1 %21, label %31, label %22

22:                                               ; preds = %18
  call void @llvm.lifetime.end.p0(i64 4, ptr %6) #6
  br label %44

23:                                               ; preds = %0
  %24 = landingpad { ptr, i32 }
          cleanup
  %25 = extractvalue { ptr, i32 } %24, 0
  store ptr %25, ptr %4, align 8
  %26 = extractvalue { ptr, i32 } %24, 1
  store i32 %26, ptr %5, align 4
  br label %370

27:                                               ; preds = %364, %14, %12, %10
  %28 = landingpad { ptr, i32 }
          cleanup
  %29 = extractvalue { ptr, i32 } %28, 0
  store ptr %29, ptr %4, align 8
  %30 = extractvalue { ptr, i32 } %28, 1
  store i32 %30, ptr %5, align 4
  br label %369

31:                                               ; preds = %18
  %32 = load i32, ptr %6, align 4, !tbaa !5
  %33 = sext i32 %32 to i64
  %34 = call noundef nonnull align 1 dereferenceable(1) ptr @_ZNSt6vectorIcSaIcEEixEm(ptr noundef nonnull align 8 dereferenceable(24) @x, i64 noundef %33) #6
  %35 = invoke noundef nonnull align 8 dereferenceable(16) ptr @_ZStrsIcSt11char_traitsIcEERSt13basic_istreamIT_T0_ES6_RS3_(ptr noundef nonnull align 8 dereferenceable(16) %2, ptr noundef nonnull align 1 dereferenceable(1) %34)
          to label %36 unwind label %40

36:                                               ; preds = %31
  br label %37

37:                                               ; preds = %36
  %38 = load i32, ptr %6, align 4, !tbaa !5
  %39 = add nsw i32 %38, 1
  store i32 %39, ptr %6, align 4, !tbaa !5
  br label %18, !llvm.loop !9

40:                                               ; preds = %31
  %41 = landingpad { ptr, i32 }
          cleanup
  %42 = extractvalue { ptr, i32 } %41, 0
  store ptr %42, ptr %4, align 8
  %43 = extractvalue { ptr, i32 } %41, 1
  store i32 %43, ptr %5, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %6) #6
  br label %369

44:                                               ; preds = %22
  call void @llvm.lifetime.start.p0(i64 4, ptr %7) #6
  store i32 0, ptr %7, align 4, !tbaa !5
  br label %45

45:                                               ; preds = %361, %44
  %46 = load i32, ptr %7, align 4, !tbaa !5
  %47 = load i32, ptr @k, align 4, !tbaa !5
  %48 = add nsw i32 %47, 1
  %49 = icmp slt i32 %46, %48
  br i1 %49, label %51, label %50

50:                                               ; preds = %45
  store i32 5, ptr %8, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %7) #6
  br label %364

51:                                               ; preds = %45
  call void @llvm.lifetime.start.p0(i64 4, ptr %9) #6
  store i32 0, ptr %9, align 4, !tbaa !5
  br label %52

52:                                               ; preds = %357, %51
  %53 = load i32, ptr %9, align 4, !tbaa !5
  %54 = load i32, ptr @n, align 4, !tbaa !5
  %55 = icmp slt i32 %53, %54
  br i1 %55, label %57, label %56

56:                                               ; preds = %52
  store i32 8, ptr %8, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %9) #6
  br label %360

57:                                               ; preds = %52
  %58 = load i32, ptr %9, align 4, !tbaa !5
  %59 = icmp ne i32 %58, 0
  br i1 %59, label %60, label %137

60:                                               ; preds = %57
  %61 = load i32, ptr %7, align 4, !tbaa !5
  %62 = sext i32 %61 to i64
  %63 = getelementptr inbounds [21 x [100000 x i32]], ptr @b1, i64 0, i64 %62
  %64 = load i32, ptr %9, align 4, !tbaa !5
  %65 = sext i32 %64 to i64
  %66 = getelementptr inbounds [100000 x i32], ptr %63, i64 0, i64 %65
  %67 = load i32, ptr %7, align 4, !tbaa !5
  %68 = sext i32 %67 to i64
  %69 = getelementptr inbounds [21 x [100000 x i32]], ptr @b1, i64 0, i64 %68
  %70 = load i32, ptr %9, align 4, !tbaa !5
  %71 = sub nsw i32 %70, 1
  %72 = sext i32 %71 to i64
  %73 = getelementptr inbounds [100000 x i32], ptr %69, i64 0, i64 %72
  %74 = invoke noundef nonnull align 4 dereferenceable(4) ptr @_ZSt3maxIiERKT_S2_S2_(ptr noundef nonnull align 4 dereferenceable(4) %66, ptr noundef nonnull align 4 dereferenceable(4) %73)
          to label %75 unwind label %132

75:                                               ; preds = %60
  %76 = load i32, ptr %74, align 4, !tbaa !5
  %77 = load i32, ptr %7, align 4, !tbaa !5
  %78 = sext i32 %77 to i64
  %79 = getelementptr inbounds [21 x [100000 x i32]], ptr @b1, i64 0, i64 %78
  %80 = load i32, ptr %9, align 4, !tbaa !5
  %81 = sext i32 %80 to i64
  %82 = getelementptr inbounds [100000 x i32], ptr %79, i64 0, i64 %81
  store i32 %76, ptr %82, align 4, !tbaa !5
  %83 = load i32, ptr %7, align 4, !tbaa !5
  %84 = icmp ne i32 %83, 0
  br i1 %84, label %85, label %136

85:                                               ; preds = %75
  %86 = load i32, ptr %7, align 4, !tbaa !5
  %87 = sext i32 %86 to i64
  %88 = getelementptr inbounds [21 x [100000 x i32]], ptr @b1, i64 0, i64 %87
  %89 = load i32, ptr %9, align 4, !tbaa !5
  %90 = sext i32 %89 to i64
  %91 = getelementptr inbounds [100000 x i32], ptr %88, i64 0, i64 %90
  %92 = load i32, ptr %7, align 4, !tbaa !5
  %93 = sub nsw i32 %92, 1
  %94 = sext i32 %93 to i64
  %95 = getelementptr inbounds [21 x [100000 x i32]], ptr getelementptr inbounds ([3 x [21 x [100000 x i32]]], ptr @b1, i64 0, i64 1), i64 0, i64 %94
  %96 = load i32, ptr %9, align 4, !tbaa !5
  %97 = sub nsw i32 %96, 1
  %98 = sext i32 %97 to i64
  %99 = getelementptr inbounds [100000 x i32], ptr %95, i64 0, i64 %98
  %100 = invoke noundef nonnull align 4 dereferenceable(4) ptr @_ZSt3maxIiERKT_S2_S2_(ptr noundef nonnull align 4 dereferenceable(4) %91, ptr noundef nonnull align 4 dereferenceable(4) %99)
          to label %101 unwind label %132

101:                                              ; preds = %85
  %102 = load i32, ptr %100, align 4, !tbaa !5
  %103 = load i32, ptr %7, align 4, !tbaa !5
  %104 = sext i32 %103 to i64
  %105 = getelementptr inbounds [21 x [100000 x i32]], ptr @b1, i64 0, i64 %104
  %106 = load i32, ptr %9, align 4, !tbaa !5
  %107 = sext i32 %106 to i64
  %108 = getelementptr inbounds [100000 x i32], ptr %105, i64 0, i64 %107
  store i32 %102, ptr %108, align 4, !tbaa !5
  %109 = load i32, ptr %7, align 4, !tbaa !5
  %110 = sext i32 %109 to i64
  %111 = getelementptr inbounds [21 x [100000 x i32]], ptr @b1, i64 0, i64 %110
  %112 = load i32, ptr %9, align 4, !tbaa !5
  %113 = sext i32 %112 to i64
  %114 = getelementptr inbounds [100000 x i32], ptr %111, i64 0, i64 %113
  %115 = load i32, ptr %7, align 4, !tbaa !5
  %116 = sub nsw i32 %115, 1
  %117 = sext i32 %116 to i64
  %118 = getelementptr inbounds [21 x [100000 x i32]], ptr getelementptr inbounds ([3 x [21 x [100000 x i32]]], ptr @b1, i64 0, i64 2), i64 0, i64 %117
  %119 = load i32, ptr %9, align 4, !tbaa !5
  %120 = sub nsw i32 %119, 1
  %121 = sext i32 %120 to i64
  %122 = getelementptr inbounds [100000 x i32], ptr %118, i64 0, i64 %121
  %123 = invoke noundef nonnull align 4 dereferenceable(4) ptr @_ZSt3maxIiERKT_S2_S2_(ptr noundef nonnull align 4 dereferenceable(4) %114, ptr noundef nonnull align 4 dereferenceable(4) %122)
          to label %124 unwind label %132

124:                                              ; preds = %101
  %125 = load i32, ptr %123, align 4, !tbaa !5
  %126 = load i32, ptr %7, align 4, !tbaa !5
  %127 = sext i32 %126 to i64
  %128 = getelementptr inbounds [21 x [100000 x i32]], ptr @b1, i64 0, i64 %127
  %129 = load i32, ptr %9, align 4, !tbaa !5
  %130 = sext i32 %129 to i64
  %131 = getelementptr inbounds [100000 x i32], ptr %128, i64 0, i64 %130
  store i32 %125, ptr %131, align 4, !tbaa !5
  br label %136

132:                                              ; preds = %353, %345, %317, %285, %269, %244, %195, %179, %154, %101, %85, %60
  %133 = landingpad { ptr, i32 }
          cleanup
  %134 = extractvalue { ptr, i32 } %133, 0
  store ptr %134, ptr %4, align 8
  %135 = extractvalue { ptr, i32 } %133, 1
  store i32 %135, ptr %5, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %9) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr %7) #6
  br label %369

136:                                              ; preds = %124, %75
  br label %137

137:                                              ; preds = %136, %57
  %138 = load i32, ptr %9, align 4, !tbaa !5
  %139 = sext i32 %138 to i64
  %140 = call noundef nonnull align 1 dereferenceable(1) ptr @_ZNSt6vectorIcSaIcEEixEm(ptr noundef nonnull align 8 dereferenceable(24) @x, i64 noundef %139) #6
  %141 = load i8, ptr %140, align 1, !tbaa !11
  %142 = call noundef zeroext i1 @_Z4beatic(i32 noundef 0, i8 noundef signext %141)
  %143 = zext i1 %142 to i32
  %144 = load i32, ptr %7, align 4, !tbaa !5
  %145 = sext i32 %144 to i64
  %146 = getelementptr inbounds [21 x [100000 x i32]], ptr @b1, i64 0, i64 %145
  %147 = load i32, ptr %9, align 4, !tbaa !5
  %148 = sext i32 %147 to i64
  %149 = getelementptr inbounds [100000 x i32], ptr %146, i64 0, i64 %148
  %150 = load i32, ptr %149, align 4, !tbaa !5
  %151 = add nsw i32 %150, %143
  store i32 %151, ptr %149, align 4, !tbaa !5
  %152 = load i32, ptr %9, align 4, !tbaa !5
  %153 = icmp ne i32 %152, 0
  br i1 %153, label %154, label %227

154:                                              ; preds = %137
  %155 = load i32, ptr %7, align 4, !tbaa !5
  %156 = sext i32 %155 to i64
  %157 = getelementptr inbounds [21 x [100000 x i32]], ptr getelementptr inbounds ([3 x [21 x [100000 x i32]]], ptr @b1, i64 0, i64 1), i64 0, i64 %156
  %158 = load i32, ptr %9, align 4, !tbaa !5
  %159 = sext i32 %158 to i64
  %160 = getelementptr inbounds [100000 x i32], ptr %157, i64 0, i64 %159
  %161 = load i32, ptr %7, align 4, !tbaa !5
  %162 = sext i32 %161 to i64
  %163 = getelementptr inbounds [21 x [100000 x i32]], ptr getelementptr inbounds ([3 x [21 x [100000 x i32]]], ptr @b1, i64 0, i64 1), i64 0, i64 %162
  %164 = load i32, ptr %9, align 4, !tbaa !5
  %165 = sub nsw i32 %164, 1
  %166 = sext i32 %165 to i64
  %167 = getelementptr inbounds [100000 x i32], ptr %163, i64 0, i64 %166
  %168 = invoke noundef nonnull align 4 dereferenceable(4) ptr @_ZSt3maxIiERKT_S2_S2_(ptr noundef nonnull align 4 dereferenceable(4) %160, ptr noundef nonnull align 4 dereferenceable(4) %167)
          to label %169 unwind label %132

169:                                              ; preds = %154
  %170 = load i32, ptr %168, align 4, !tbaa !5
  %171 = load i32, ptr %7, align 4, !tbaa !5
  %172 = sext i32 %171 to i64
  %173 = getelementptr inbounds [21 x [100000 x i32]], ptr getelementptr inbounds ([3 x [21 x [100000 x i32]]], ptr @b1, i64 0, i64 1), i64 0, i64 %172
  %174 = load i32, ptr %9, align 4, !tbaa !5
  %175 = sext i32 %174 to i64
  %176 = getelementptr inbounds [100000 x i32], ptr %173, i64 0, i64 %175
  store i32 %170, ptr %176, align 4, !tbaa !5
  %177 = load i32, ptr %7, align 4, !tbaa !5
  %178 = icmp ne i32 %177, 0
  br i1 %178, label %179, label %226

179:                                              ; preds = %169
  %180 = load i32, ptr %7, align 4, !tbaa !5
  %181 = sext i32 %180 to i64
  %182 = getelementptr inbounds [21 x [100000 x i32]], ptr getelementptr inbounds ([3 x [21 x [100000 x i32]]], ptr @b1, i64 0, i64 1), i64 0, i64 %181
  %183 = load i32, ptr %9, align 4, !tbaa !5
  %184 = sext i32 %183 to i64
  %185 = getelementptr inbounds [100000 x i32], ptr %182, i64 0, i64 %184
  %186 = load i32, ptr %7, align 4, !tbaa !5
  %187 = sub nsw i32 %186, 1
  %188 = sext i32 %187 to i64
  %189 = getelementptr inbounds [21 x [100000 x i32]], ptr @b1, i64 0, i64 %188
  %190 = load i32, ptr %9, align 4, !tbaa !5
  %191 = sub nsw i32 %190, 1
  %192 = sext i32 %191 to i64
  %193 = getelementptr inbounds [100000 x i32], ptr %189, i64 0, i64 %192
  %194 = invoke noundef nonnull align 4 dereferenceable(4) ptr @_ZSt3maxIiERKT_S2_S2_(ptr noundef nonnull align 4 dereferenceable(4) %185, ptr noundef nonnull align 4 dereferenceable(4) %193)
          to label %195 unwind label %132

195:                                              ; preds = %179
  %196 = load i32, ptr %194, align 4, !tbaa !5
  %197 = load i32, ptr %7, align 4, !tbaa !5
  %198 = sext i32 %197 to i64
  %199 = getelementptr inbounds [21 x [100000 x i32]], ptr getelementptr inbounds ([3 x [21 x [100000 x i32]]], ptr @b1, i64 0, i64 1), i64 0, i64 %198
  %200 = load i32, ptr %9, align 4, !tbaa !5
  %201 = sext i32 %200 to i64
  %202 = getelementptr inbounds [100000 x i32], ptr %199, i64 0, i64 %201
  store i32 %196, ptr %202, align 4, !tbaa !5
  %203 = load i32, ptr %7, align 4, !tbaa !5
  %204 = sext i32 %203 to i64
  %205 = getelementptr inbounds [21 x [100000 x i32]], ptr getelementptr inbounds ([3 x [21 x [100000 x i32]]], ptr @b1, i64 0, i64 1), i64 0, i64 %204
  %206 = load i32, ptr %9, align 4, !tbaa !5
  %207 = sext i32 %206 to i64
  %208 = getelementptr inbounds [100000 x i32], ptr %205, i64 0, i64 %207
  %209 = load i32, ptr %7, align 4, !tbaa !5
  %210 = sub nsw i32 %209, 1
  %211 = sext i32 %210 to i64
  %212 = getelementptr inbounds [21 x [100000 x i32]], ptr getelementptr inbounds ([3 x [21 x [100000 x i32]]], ptr @b1, i64 0, i64 2), i64 0, i64 %211
  %213 = load i32, ptr %9, align 4, !tbaa !5
  %214 = sub nsw i32 %213, 1
  %215 = sext i32 %214 to i64
  %216 = getelementptr inbounds [100000 x i32], ptr %212, i64 0, i64 %215
  %217 = invoke noundef nonnull align 4 dereferenceable(4) ptr @_ZSt3maxIiERKT_S2_S2_(ptr noundef nonnull align 4 dereferenceable(4) %208, ptr noundef nonnull align 4 dereferenceable(4) %216)
          to label %218 unwind label %132

218:                                              ; preds = %195
  %219 = load i32, ptr %217, align 4, !tbaa !5
  %220 = load i32, ptr %7, align 4, !tbaa !5
  %221 = sext i32 %220 to i64
  %222 = getelementptr inbounds [21 x [100000 x i32]], ptr getelementptr inbounds ([3 x [21 x [100000 x i32]]], ptr @b1, i64 0, i64 1), i64 0, i64 %221
  %223 = load i32, ptr %9, align 4, !tbaa !5
  %224 = sext i32 %223 to i64
  %225 = getelementptr inbounds [100000 x i32], ptr %222, i64 0, i64 %224
  store i32 %219, ptr %225, align 4, !tbaa !5
  br label %226

226:                                              ; preds = %218, %169
  br label %227

227:                                              ; preds = %226, %137
  %228 = load i32, ptr %9, align 4, !tbaa !5
  %229 = sext i32 %228 to i64
  %230 = call noundef nonnull align 1 dereferenceable(1) ptr @_ZNSt6vectorIcSaIcEEixEm(ptr noundef nonnull align 8 dereferenceable(24) @x, i64 noundef %229) #6
  %231 = load i8, ptr %230, align 1, !tbaa !11
  %232 = call noundef zeroext i1 @_Z4beatic(i32 noundef 1, i8 noundef signext %231)
  %233 = zext i1 %232 to i32
  %234 = load i32, ptr %7, align 4, !tbaa !5
  %235 = sext i32 %234 to i64
  %236 = getelementptr inbounds [21 x [100000 x i32]], ptr getelementptr inbounds ([3 x [21 x [100000 x i32]]], ptr @b1, i64 0, i64 1), i64 0, i64 %235
  %237 = load i32, ptr %9, align 4, !tbaa !5
  %238 = sext i32 %237 to i64
  %239 = getelementptr inbounds [100000 x i32], ptr %236, i64 0, i64 %238
  %240 = load i32, ptr %239, align 4, !tbaa !5
  %241 = add nsw i32 %240, %233
  store i32 %241, ptr %239, align 4, !tbaa !5
  %242 = load i32, ptr %9, align 4, !tbaa !5
  %243 = icmp ne i32 %242, 0
  br i1 %243, label %244, label %317

244:                                              ; preds = %227
  %245 = load i32, ptr %7, align 4, !tbaa !5
  %246 = sext i32 %245 to i64
  %247 = getelementptr inbounds [21 x [100000 x i32]], ptr getelementptr inbounds ([3 x [21 x [100000 x i32]]], ptr @b1, i64 0, i64 2), i64 0, i64 %246
  %248 = load i32, ptr %9, align 4, !tbaa !5
  %249 = sext i32 %248 to i64
  %250 = getelementptr inbounds [100000 x i32], ptr %247, i64 0, i64 %249
  %251 = load i32, ptr %7, align 4, !tbaa !5
  %252 = sext i32 %251 to i64
  %253 = getelementptr inbounds [21 x [100000 x i32]], ptr getelementptr inbounds ([3 x [21 x [100000 x i32]]], ptr @b1, i64 0, i64 2), i64 0, i64 %252
  %254 = load i32, ptr %9, align 4, !tbaa !5
  %255 = sub nsw i32 %254, 1
  %256 = sext i32 %255 to i64
  %257 = getelementptr inbounds [100000 x i32], ptr %253, i64 0, i64 %256
  %258 = invoke noundef nonnull align 4 dereferenceable(4) ptr @_ZSt3maxIiERKT_S2_S2_(ptr noundef nonnull align 4 dereferenceable(4) %250, ptr noundef nonnull align 4 dereferenceable(4) %257)
          to label %259 unwind label %132

259:                                              ; preds = %244
  %260 = load i32, ptr %258, align 4, !tbaa !5
  %261 = load i32, ptr %7, align 4, !tbaa !5
  %262 = sext i32 %261 to i64
  %263 = getelementptr inbounds [21 x [100000 x i32]], ptr getelementptr inbounds ([3 x [21 x [100000 x i32]]], ptr @b1, i64 0, i64 2), i64 0, i64 %262
  %264 = load i32, ptr %9, align 4, !tbaa !5
  %265 = sext i32 %264 to i64
  %266 = getelementptr inbounds [100000 x i32], ptr %263, i64 0, i64 %265
  store i32 %260, ptr %266, align 4, !tbaa !5
  %267 = load i32, ptr %7, align 4, !tbaa !5
  %268 = icmp ne i32 %267, 0
  br i1 %268, label %269, label %316

269:                                              ; preds = %259
  %270 = load i32, ptr %7, align 4, !tbaa !5
  %271 = sext i32 %270 to i64
  %272 = getelementptr inbounds [21 x [100000 x i32]], ptr getelementptr inbounds ([3 x [21 x [100000 x i32]]], ptr @b1, i64 0, i64 2), i64 0, i64 %271
  %273 = load i32, ptr %9, align 4, !tbaa !5
  %274 = sext i32 %273 to i64
  %275 = getelementptr inbounds [100000 x i32], ptr %272, i64 0, i64 %274
  %276 = load i32, ptr %7, align 4, !tbaa !5
  %277 = sub nsw i32 %276, 1
  %278 = sext i32 %277 to i64
  %279 = getelementptr inbounds [21 x [100000 x i32]], ptr @b1, i64 0, i64 %278
  %280 = load i32, ptr %9, align 4, !tbaa !5
  %281 = sub nsw i32 %280, 1
  %282 = sext i32 %281 to i64
  %283 = getelementptr inbounds [100000 x i32], ptr %279, i64 0, i64 %282
  %284 = invoke noundef nonnull align 4 dereferenceable(4) ptr @_ZSt3maxIiERKT_S2_S2_(ptr noundef nonnull align 4 dereferenceable(4) %275, ptr noundef nonnull align 4 dereferenceable(4) %283)
          to label %285 unwind label %132

285:                                              ; preds = %269
  %286 = load i32, ptr %284, align 4, !tbaa !5
  %287 = load i32, ptr %7, align 4, !tbaa !5
  %288 = sext i32 %287 to i64
  %289 = getelementptr inbounds [21 x [100000 x i32]], ptr getelementptr inbounds ([3 x [21 x [100000 x i32]]], ptr @b1, i64 0, i64 2), i64 0, i64 %288
  %290 = load i32, ptr %9, align 4, !tbaa !5
  %291 = sext i32 %290 to i64
  %292 = getelementptr inbounds [100000 x i32], ptr %289, i64 0, i64 %291
  store i32 %286, ptr %292, align 4, !tbaa !5
  %293 = load i32, ptr %7, align 4, !tbaa !5
  %294 = sext i32 %293 to i64
  %295 = getelementptr inbounds [21 x [100000 x i32]], ptr getelementptr inbounds ([3 x [21 x [100000 x i32]]], ptr @b1, i64 0, i64 2), i64 0, i64 %294
  %296 = load i32, ptr %9, align 4, !tbaa !5
  %297 = sext i32 %296 to i64
  %298 = getelementptr inbounds [100000 x i32], ptr %295, i64 0, i64 %297
  %299 = load i32, ptr %7, align 4, !tbaa !5
  %300 = sub nsw i32 %299, 1
  %301 = sext i32 %300 to i64
  %302 = getelementptr inbounds [21 x [100000 x i32]], ptr getelementptr inbounds ([3 x [21 x [100000 x i32]]], ptr @b1, i64 0, i64 1), i64 0, i64 %301
  %303 = load i32, ptr %9, align 4, !tbaa !5
  %304 = sub nsw i32 %303, 1
  %305 = sext i32 %304 to i64
  %306 = getelementptr inbounds [100000 x i32], ptr %302, i64 0, i64 %305
  %307 = invoke noundef nonnull align 4 dereferenceable(4) ptr @_ZSt3maxIiERKT_S2_S2_(ptr noundef nonnull align 4 dereferenceable(4) %298, ptr noundef nonnull align 4 dereferenceable(4) %306)
          to label %308 unwind label %132

308:                                              ; preds = %285
  %309 = load i32, ptr %307, align 4, !tbaa !5
  %310 = load i32, ptr %7, align 4, !tbaa !5
  %311 = sext i32 %310 to i64
  %312 = getelementptr inbounds [21 x [100000 x i32]], ptr getelementptr inbounds ([3 x [21 x [100000 x i32]]], ptr @b1, i64 0, i64 2), i64 0, i64 %311
  %313 = load i32, ptr %9, align 4, !tbaa !5
  %314 = sext i32 %313 to i64
  %315 = getelementptr inbounds [100000 x i32], ptr %312, i64 0, i64 %314
  store i32 %309, ptr %315, align 4, !tbaa !5
  br label %316

316:                                              ; preds = %308, %259
  br label %317

317:                                              ; preds = %316, %227
  %318 = load i32, ptr %9, align 4, !tbaa !5
  %319 = sext i32 %318 to i64
  %320 = call noundef nonnull align 1 dereferenceable(1) ptr @_ZNSt6vectorIcSaIcEEixEm(ptr noundef nonnull align 8 dereferenceable(24) @x, i64 noundef %319) #6
  %321 = load i8, ptr %320, align 1, !tbaa !11
  %322 = call noundef zeroext i1 @_Z4beatic(i32 noundef 2, i8 noundef signext %321)
  %323 = zext i1 %322 to i32
  %324 = load i32, ptr %7, align 4, !tbaa !5
  %325 = sext i32 %324 to i64
  %326 = getelementptr inbounds [21 x [100000 x i32]], ptr getelementptr inbounds ([3 x [21 x [100000 x i32]]], ptr @b1, i64 0, i64 2), i64 0, i64 %325
  %327 = load i32, ptr %9, align 4, !tbaa !5
  %328 = sext i32 %327 to i64
  %329 = getelementptr inbounds [100000 x i32], ptr %326, i64 0, i64 %328
  %330 = load i32, ptr %329, align 4, !tbaa !5
  %331 = add nsw i32 %330, %323
  store i32 %331, ptr %329, align 4, !tbaa !5
  %332 = load i32, ptr %7, align 4, !tbaa !5
  %333 = sext i32 %332 to i64
  %334 = getelementptr inbounds [21 x [100000 x i32]], ptr getelementptr inbounds ([3 x [21 x [100000 x i32]]], ptr @b1, i64 0, i64 1), i64 0, i64 %333
  %335 = load i32, ptr %9, align 4, !tbaa !5
  %336 = sext i32 %335 to i64
  %337 = getelementptr inbounds [100000 x i32], ptr %334, i64 0, i64 %336
  %338 = load i32, ptr %7, align 4, !tbaa !5
  %339 = sext i32 %338 to i64
  %340 = getelementptr inbounds [21 x [100000 x i32]], ptr getelementptr inbounds ([3 x [21 x [100000 x i32]]], ptr @b1, i64 0, i64 2), i64 0, i64 %339
  %341 = load i32, ptr %9, align 4, !tbaa !5
  %342 = sext i32 %341 to i64
  %343 = getelementptr inbounds [100000 x i32], ptr %340, i64 0, i64 %342
  %344 = invoke noundef nonnull align 4 dereferenceable(4) ptr @_ZSt3maxIiERKT_S2_S2_(ptr noundef nonnull align 4 dereferenceable(4) %337, ptr noundef nonnull align 4 dereferenceable(4) %343)
          to label %345 unwind label %132

345:                                              ; preds = %317
  %346 = load i32, ptr %7, align 4, !tbaa !5
  %347 = sext i32 %346 to i64
  %348 = getelementptr inbounds [21 x [100000 x i32]], ptr @b1, i64 0, i64 %347
  %349 = load i32, ptr %9, align 4, !tbaa !5
  %350 = sext i32 %349 to i64
  %351 = getelementptr inbounds [100000 x i32], ptr %348, i64 0, i64 %350
  %352 = invoke noundef nonnull align 4 dereferenceable(4) ptr @_ZSt3maxIiERKT_S2_S2_(ptr noundef nonnull align 4 dereferenceable(4) %344, ptr noundef nonnull align 4 dereferenceable(4) %351)
          to label %353 unwind label %132

353:                                              ; preds = %345
  %354 = invoke noundef nonnull align 4 dereferenceable(4) ptr @_ZSt3maxIiERKT_S2_S2_(ptr noundef nonnull align 4 dereferenceable(4) @ans, ptr noundef nonnull align 4 dereferenceable(4) %352)
          to label %355 unwind label %132

355:                                              ; preds = %353
  %356 = load i32, ptr %354, align 4, !tbaa !5
  store i32 %356, ptr @ans, align 4, !tbaa !5
  br label %357

357:                                              ; preds = %355
  %358 = load i32, ptr %9, align 4, !tbaa !5
  %359 = add nsw i32 %358, 1
  store i32 %359, ptr %9, align 4, !tbaa !5
  br label %52, !llvm.loop !12

360:                                              ; preds = %56
  br label %361

361:                                              ; preds = %360
  %362 = load i32, ptr %7, align 4, !tbaa !5
  %363 = add nsw i32 %362, 1
  store i32 %363, ptr %7, align 4, !tbaa !5
  br label %45, !llvm.loop !13

364:                                              ; preds = %50
  %365 = load i32, ptr @ans, align 4, !tbaa !5
  %366 = invoke noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEi(ptr noundef nonnull align 8 dereferenceable(8) %3, i32 noundef %365)
          to label %367 unwind label %27

367:                                              ; preds = %364
  call void @_ZNSt14basic_ofstreamIcSt11char_traitsIcEED1Ev(ptr noundef nonnull align 8 dereferenceable(248) %3) #6
  call void @llvm.lifetime.end.p0(i64 512, ptr %3) #6
  call void @_ZNSt14basic_ifstreamIcSt11char_traitsIcEED1Ev(ptr noundef nonnull align 8 dereferenceable(256) %2) #6
  call void @llvm.lifetime.end.p0(i64 520, ptr %2) #6
  %368 = load i32, ptr %1, align 4
  ret i32 %368

369:                                              ; preds = %132, %40, %27
  call void @_ZNSt14basic_ofstreamIcSt11char_traitsIcEED1Ev(ptr noundef nonnull align 8 dereferenceable(248) %3) #6
  br label %370

370:                                              ; preds = %369, %23
  call void @llvm.lifetime.end.p0(i64 512, ptr %3) #6
  call void @_ZNSt14basic_ifstreamIcSt11char_traitsIcEED1Ev(ptr noundef nonnull align 8 dereferenceable(256) %2) #6
  call void @llvm.lifetime.end.p0(i64 520, ptr %2) #6
  br label %371

371:                                              ; preds = %370
  %372 = load ptr, ptr %4, align 8
  %373 = load i32, ptr %5, align 4
  %374 = insertvalue { ptr, i32 } poison, ptr %372, 0
  %375 = insertvalue { ptr, i32 } %374, i32 %373, 1
  resume { ptr, i32 } %375
}

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

; Function Attrs: mustprogress uwtable
declare void @_ZNSt14basic_ifstreamIcSt11char_traitsIcEEC1EPKcSt13_Ios_Openmode(ptr noundef nonnull align 8 dereferenceable(256), ptr noundef, i32 noundef) unnamed_addr #3 align 2

; Function Attrs: mustprogress uwtable
declare void @_ZNSt14basic_ofstreamIcSt11char_traitsIcEEC1EPKcSt13_Ios_Openmode(ptr noundef nonnull align 8 dereferenceable(248), ptr noundef, i32 noundef) unnamed_addr #3 align 2

declare i32 @__gxx_personality_v0(...)

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: mustprogress uwtable
declare dso_local void @_ZNSt6vectorIcSaIcEE6resizeEm(ptr noundef nonnull align 8 dereferenceable(24), i64 noundef) #3 align 2

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

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef nonnull align 1 dereferenceable(1) ptr @_ZNSt6vectorIcSaIcEEixEm(ptr noundef nonnull align 8 dereferenceable(24), i64 noundef) #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: 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)) #5

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

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

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

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 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 #2 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #3 = { mustprogress uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { "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 = { 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 #6 = { nounwind }

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

!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"clang version 19.1.0 (git@github.com:llvm/llvm-project.git a4bf6cd7cfb1a1421ba92bca9d017b49936c55e4)"}
!5 = !{!6, !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}


; 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::vector" = type { %"struct.std::_Vector_base" }
%"struct.std::_Vector_base" = type { %"struct.std::_Vector_base<char, std::allocator<char>>::_Vector_impl" }
%"struct.std::_Vector_base<char, std::allocator<char>>::_Vector_impl" = type { %"struct.std::_Vector_base<char, std::allocator<char>>::_Vector_impl_data" }
%"struct.std::_Vector_base<char, std::allocator<char>>::_Vector_impl_data" = type { ptr, ptr, ptr }
%"class.std::basic_ifstream" = type { %"class.std::basic_istream.base", %"class.std::basic_filebuf", %"class.std::basic_ios" }
%"class.std::basic_istream.base" = type { ptr, i64 }
%"class.std::basic_filebuf" = type { %"class.std::basic_streambuf", %union.pthread_mutex_t, %"class.std::__basic_file", i32, %struct.__mbstate_t, %struct.__mbstate_t, %struct.__mbstate_t, ptr, i64, i8, i8, i8, i8, ptr, ptr, i8, ptr, ptr, i64, ptr, ptr }
%"class.std::basic_streambuf" = type { ptr, ptr, ptr, ptr, ptr, ptr, ptr, %"class.std::locale" }
%"class.std::locale" = type { ptr }
%union.pthread_mutex_t = type { %struct.__pthread_mutex_s }
%struct.__pthread_mutex_s = type { i32, i32, i32, i32, i32, i16, i16, %struct.__pthread_internal_list }
%struct.__pthread_internal_list = type { ptr, ptr }
%"class.std::__basic_file" = type <{ ptr, i8, [7 x i8] }>
%struct.__mbstate_t = type { i32, %union.anon }
%union.anon = type { i32 }
%"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::basic_ofstream" = type { %"class.std::basic_ostream.base", %"class.std::basic_filebuf", %"class.std::basic_ios" }
%"class.std::basic_ostream.base" = type { ptr }

@b1 = external dso_local global [3 x [21 x [100000 x i32]]], align 16
@n = external dso_local global i32, align 4
@k = external dso_local global i32, align 4
@ans = external dso_local global i32, align 4
@x = external dso_local global %"class.std::vector", align 8
@.str = external hidden unnamed_addr constant [7 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [8 x i8], align 1

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef zeroext i1 @_Z4beatic(i32 noundef, i8 noundef signext) local_unnamed_addr #0

; Function Attrs: mustprogress norecurse uwtable
define dso_local noundef i32 @main() local_unnamed_addr #1 personality ptr @__gxx_personality_v0 {
  %1 = alloca %"class.std::basic_ifstream", align 8
  %2 = alloca %"class.std::basic_ofstream", align 8
  call void @llvm.lifetime.start.p0(i64 520, ptr nonnull %1) #6
  call void @_ZNSt14basic_ifstreamIcSt11char_traitsIcEEC1EPKcSt13_Ios_Openmode(ptr noundef nonnull align 8 dereferenceable(256) %1, ptr noundef nonnull @.str, i32 noundef 8)
  call void @llvm.lifetime.start.p0(i64 512, ptr nonnull %2) #6
  invoke void @_ZNSt14basic_ofstreamIcSt11char_traitsIcEEC1EPKcSt13_Ios_Openmode(ptr noundef nonnull align 8 dereferenceable(248) %2, ptr noundef nonnull @.str.2, i32 noundef 16)
          to label %3 unwind label %15

3:                                                ; preds = %0
  %4 = invoke noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERi(ptr noundef nonnull align 8 dereferenceable(16) %1, ptr noundef nonnull align 4 dereferenceable(4) @n)
          to label %5 unwind label %17

5:                                                ; preds = %3
  %6 = invoke noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERi(ptr noundef nonnull align 8 dereferenceable(16) %4, ptr noundef nonnull align 4 dereferenceable(4) @k)
          to label %7 unwind label %17

7:                                                ; preds = %5
  %8 = load i32, ptr @n, align 4, !tbaa !5
  %9 = sext i32 %8 to i64
  invoke void @_ZNSt6vectorIcSaIcEE6resizeEm(ptr noundef nonnull align 8 dereferenceable(24) @x, i64 noundef %9)
          to label %.preheader96 unwind label %17

.preheader96:                                     ; preds = %7
  %10 = load i32, ptr @n, align 4, !tbaa !5
  %11 = icmp sgt i32 %10, 0
  br i1 %11, label %.lr.ph, label %.preheader95

.preheader95:                                     ; preds = %21, %.preheader96
  %12 = phi i32 [ %10, %.preheader96 ], [ %22, %21 ]
  %13 = load i32, ptr @k, align 4, !tbaa !5
  %.not100 = icmp sgt i32 %13, -1
  %14 = icmp sgt i32 %12, 0
  %or.cond = and i1 %.not100, %14
  br i1 %or.cond, label %.preheader, label %._crit_edge102

15:                                               ; preds = %0
  %16 = landingpad { ptr, i32 }
          cleanup
  br label %134

17:                                               ; preds = %._crit_edge102, %7, %5, %3
  %18 = landingpad { ptr, i32 }
          cleanup
  br label %133

.lr.ph:                                           ; preds = %.preheader96, %21
  %indvars.iv = phi i64 [ %indvars.iv.next, %21 ], [ 0, %.preheader96 ]
  %19 = call noundef nonnull align 1 dereferenceable(1) ptr @_ZNSt6vectorIcSaIcEEixEm(ptr noundef nonnull align 8 dereferenceable(24) @x, i64 noundef %indvars.iv) #6
  %20 = invoke noundef nonnull align 8 dereferenceable(16) ptr @_ZStrsIcSt11char_traitsIcEERSt13basic_istreamIT_T0_ES6_RS3_(ptr noundef nonnull align 8 dereferenceable(16) %1, ptr noundef nonnull align 1 dereferenceable(1) %19)
          to label %21 unwind label %25

21:                                               ; preds = %.lr.ph
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  %22 = load i32, ptr @n, align 4, !tbaa !5
  %23 = sext i32 %22 to i64
  %24 = icmp slt i64 %indvars.iv.next, %23
  br i1 %24, label %.lr.ph, label %.preheader95, !llvm.loop !9

25:                                               ; preds = %.lr.ph
  %26 = landingpad { ptr, i32 }
          cleanup
  br label %133

.preheader:                                       ; preds = %.preheader95, %._crit_edge
  %27 = phi i32 [ %62, %._crit_edge ], [ %13, %.preheader95 ]
  %28 = phi i32 [ %63, %._crit_edge ], [ %12, %.preheader95 ]
  %indvars.iv109 = phi i64 [ %indvars.iv.next110, %._crit_edge ], [ 0, %.preheader95 ]
  %29 = icmp sgt i32 %28, 0
  br i1 %29, label %30, label %._crit_edge

30:                                               ; preds = %.preheader
  %.not90 = icmp eq i64 %indvars.iv109, 0
  %31 = add nsw i64 %indvars.iv109, -1
  %32 = call noundef nonnull align 1 dereferenceable(1) ptr @_ZNSt6vectorIcSaIcEEixEm(ptr noundef nonnull align 8 dereferenceable(24) @x, i64 noundef 0) #6
  %33 = load i8, ptr %32, align 1, !tbaa !11
  %34 = call noundef zeroext i1 @_Z4beatic(i32 noundef 0, i8 noundef signext %33)
  %35 = zext i1 %34 to i32
  %36 = getelementptr inbounds [21 x [100000 x i32]], ptr @b1, i64 0, i64 %indvars.iv109, i64 0
  %37 = load i32, ptr %36, align 16, !tbaa !5
  %38 = add nsw i32 %37, %35
  store i32 %38, ptr %36, align 16, !tbaa !5
  %39 = call noundef nonnull align 1 dereferenceable(1) ptr @_ZNSt6vectorIcSaIcEEixEm(ptr noundef nonnull align 8 dereferenceable(24) @x, i64 noundef 0) #6
  %40 = load i8, ptr %39, align 1, !tbaa !11
  %41 = call noundef zeroext i1 @_Z4beatic(i32 noundef 1, i8 noundef signext %40)
  %42 = zext i1 %41 to i32
  %43 = getelementptr inbounds [21 x [100000 x i32]], ptr getelementptr inbounds (i8, ptr @b1, i64 8400000), i64 0, i64 %indvars.iv109, i64 0
  %44 = load i32, ptr %43, align 16, !tbaa !5
  %45 = add nsw i32 %44, %42
  store i32 %45, ptr %43, align 16, !tbaa !5
  %46 = call noundef nonnull align 1 dereferenceable(1) ptr @_ZNSt6vectorIcSaIcEEixEm(ptr noundef nonnull align 8 dereferenceable(24) @x, i64 noundef 0) #6
  %47 = load i8, ptr %46, align 1, !tbaa !11
  %48 = call noundef zeroext i1 @_Z4beatic(i32 noundef 2, i8 noundef signext %47)
  %49 = zext i1 %48 to i32
  %50 = getelementptr inbounds [21 x [100000 x i32]], ptr getelementptr inbounds (i8, ptr @b1, i64 16800000), i64 0, i64 %indvars.iv109, i64 0
  %51 = load i32, ptr %50, align 16, !tbaa !5
  %52 = add nsw i32 %51, %49
  store i32 %52, ptr %50, align 16, !tbaa !5
  %53 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZSt3maxIiERKT_S2_S2_(ptr noundef nonnull align 4 dereferenceable(4) %43, ptr noundef nonnull align 4 dereferenceable(4) %50)
  %54 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZSt3maxIiERKT_S2_S2_(ptr noundef nonnull align 4 dereferenceable(4) %53, ptr noundef nonnull align 4 dereferenceable(4) %36)
  %55 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZSt3maxIiERKT_S2_S2_(ptr noundef nonnull align 4 dereferenceable(4) @ans, ptr noundef nonnull align 4 dereferenceable(4) %54)
  %56 = load i32, ptr %55, align 4, !tbaa !5
  store i32 %56, ptr @ans, align 4, !tbaa !5
  %57 = load i32, ptr @n, align 4, !tbaa !5
  %58 = icmp sgt i32 %57, 1
  br i1 %58, label %.peel.next, label %._crit_edge.loopexit

._crit_edge102:                                   ; preds = %._crit_edge, %.preheader95
  %59 = load i32, ptr @ans, align 4, !tbaa !5
  %60 = invoke noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEi(ptr noundef nonnull align 8 dereferenceable(8) %2, i32 noundef %59)
          to label %132 unwind label %17

._crit_edge.loopexit:                             ; preds = %117, %30
  %61 = phi i32 [ %57, %30 ], [ %129, %117 ]
  %.pre = load i32, ptr @k, align 4, !tbaa !5
  br label %._crit_edge

._crit_edge:                                      ; preds = %._crit_edge.loopexit, %.preheader
  %62 = phi i32 [ %.pre, %._crit_edge.loopexit ], [ %27, %.preheader ]
  %63 = phi i32 [ %61, %._crit_edge.loopexit ], [ %28, %.preheader ]
  %indvars.iv.next110 = add nuw nsw i64 %indvars.iv109, 1
  %64 = sext i32 %62 to i64
  %.not.not = icmp slt i64 %indvars.iv109, %64
  br i1 %.not.not, label %.preheader, label %._crit_edge102, !llvm.loop !12

.peel.next:                                       ; preds = %30, %117
  %indvars.iv105 = phi i64 [ %indvars.iv.next106, %117 ], [ 1, %30 ]
  %65 = getelementptr inbounds [21 x [100000 x i32]], ptr @b1, i64 0, i64 %indvars.iv109, i64 %indvars.iv105
  %66 = add nsw i64 %indvars.iv105, -1
  %67 = getelementptr inbounds [21 x [100000 x i32]], ptr @b1, i64 0, i64 %indvars.iv109, i64 %66
  %68 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZSt3maxIiERKT_S2_S2_(ptr noundef nonnull align 4 dereferenceable(4) %65, ptr noundef nonnull align 4 dereferenceable(4) %67)
  %69 = load i32, ptr %68, align 4, !tbaa !5
  store i32 %69, ptr %65, align 4, !tbaa !5
  br i1 %.not90, label %77, label %70

70:                                               ; preds = %.peel.next
  %71 = getelementptr inbounds [21 x [100000 x i32]], ptr getelementptr inbounds (i8, ptr @b1, i64 8400000), i64 0, i64 %31, i64 %66
  %72 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZSt3maxIiERKT_S2_S2_(ptr noundef nonnull align 4 dereferenceable(4) %65, ptr noundef nonnull align 4 dereferenceable(4) %71)
  %73 = load i32, ptr %72, align 4, !tbaa !5
  store i32 %73, ptr %65, align 4, !tbaa !5
  %74 = getelementptr inbounds [21 x [100000 x i32]], ptr getelementptr inbounds (i8, ptr @b1, i64 16800000), i64 0, i64 %31, i64 %66
  %75 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZSt3maxIiERKT_S2_S2_(ptr noundef nonnull align 4 dereferenceable(4) %65, ptr noundef nonnull align 4 dereferenceable(4) %74)
  %76 = load i32, ptr %75, align 4, !tbaa !5
  store i32 %76, ptr %65, align 4, !tbaa !5
  br label %77

77:                                               ; preds = %70, %.peel.next
  %78 = call noundef nonnull align 1 dereferenceable(1) ptr @_ZNSt6vectorIcSaIcEEixEm(ptr noundef nonnull align 8 dereferenceable(24) @x, i64 noundef %indvars.iv105) #6
  %79 = load i8, ptr %78, align 1, !tbaa !11
  %80 = call noundef zeroext i1 @_Z4beatic(i32 noundef 0, i8 noundef signext %79)
  %81 = zext i1 %80 to i32
  %82 = getelementptr inbounds [21 x [100000 x i32]], ptr @b1, i64 0, i64 %indvars.iv109, i64 %indvars.iv105
  %83 = load i32, ptr %82, align 4, !tbaa !5
  %84 = add nsw i32 %83, %81
  store i32 %84, ptr %82, align 4, !tbaa !5
  %85 = getelementptr inbounds [21 x [100000 x i32]], ptr getelementptr inbounds (i8, ptr @b1, i64 8400000), i64 0, i64 %indvars.iv109, i64 %indvars.iv105
  %86 = add nsw i64 %indvars.iv105, -1
  %87 = getelementptr inbounds [21 x [100000 x i32]], ptr getelementptr inbounds (i8, ptr @b1, i64 8400000), i64 0, i64 %indvars.iv109, i64 %86
  %88 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZSt3maxIiERKT_S2_S2_(ptr noundef nonnull align 4 dereferenceable(4) %85, ptr noundef nonnull align 4 dereferenceable(4) %87)
  %89 = load i32, ptr %88, align 4, !tbaa !5
  store i32 %89, ptr %85, align 4, !tbaa !5
  br i1 %.not90, label %97, label %90

90:                                               ; preds = %77
  %91 = getelementptr inbounds [21 x [100000 x i32]], ptr @b1, i64 0, i64 %31, i64 %86
  %92 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZSt3maxIiERKT_S2_S2_(ptr noundef nonnull align 4 dereferenceable(4) %85, ptr noundef nonnull align 4 dereferenceable(4) %91)
  %93 = load i32, ptr %92, align 4, !tbaa !5
  store i32 %93, ptr %85, align 4, !tbaa !5
  %94 = getelementptr inbounds [21 x [100000 x i32]], ptr getelementptr inbounds (i8, ptr @b1, i64 16800000), i64 0, i64 %31, i64 %86
  %95 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZSt3maxIiERKT_S2_S2_(ptr noundef nonnull align 4 dereferenceable(4) %85, ptr noundef nonnull align 4 dereferenceable(4) %94)
  %96 = load i32, ptr %95, align 4, !tbaa !5
  store i32 %96, ptr %85, align 4, !tbaa !5
  br label %97

97:                                               ; preds = %90, %77
  %98 = call noundef nonnull align 1 dereferenceable(1) ptr @_ZNSt6vectorIcSaIcEEixEm(ptr noundef nonnull align 8 dereferenceable(24) @x, i64 noundef %indvars.iv105) #6
  %99 = load i8, ptr %98, align 1, !tbaa !11
  %100 = call noundef zeroext i1 @_Z4beatic(i32 noundef 1, i8 noundef signext %99)
  %101 = zext i1 %100 to i32
  %102 = getelementptr inbounds [21 x [100000 x i32]], ptr getelementptr inbounds (i8, ptr @b1, i64 8400000), i64 0, i64 %indvars.iv109, i64 %indvars.iv105
  %103 = load i32, ptr %102, align 4, !tbaa !5
  %104 = add nsw i32 %103, %101
  store i32 %104, ptr %102, align 4, !tbaa !5
  %105 = getelementptr inbounds [21 x [100000 x i32]], ptr getelementptr inbounds (i8, ptr @b1, i64 16800000), i64 0, i64 %indvars.iv109, i64 %indvars.iv105
  %106 = add nsw i64 %indvars.iv105, -1
  %107 = getelementptr inbounds [21 x [100000 x i32]], ptr getelementptr inbounds (i8, ptr @b1, i64 16800000), i64 0, i64 %indvars.iv109, i64 %106
  %108 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZSt3maxIiERKT_S2_S2_(ptr noundef nonnull align 4 dereferenceable(4) %105, ptr noundef nonnull align 4 dereferenceable(4) %107)
  %109 = load i32, ptr %108, align 4, !tbaa !5
  store i32 %109, ptr %105, align 4, !tbaa !5
  br i1 %.not90, label %117, label %110

110:                                              ; preds = %97
  %111 = getelementptr inbounds [21 x [100000 x i32]], ptr @b1, i64 0, i64 %31, i64 %106
  %112 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZSt3maxIiERKT_S2_S2_(ptr noundef nonnull align 4 dereferenceable(4) %105, ptr noundef nonnull align 4 dereferenceable(4) %111)
  %113 = load i32, ptr %112, align 4, !tbaa !5
  store i32 %113, ptr %105, align 4, !tbaa !5
  %114 = getelementptr inbounds [21 x [100000 x i32]], ptr getelementptr inbounds (i8, ptr @b1, i64 8400000), i64 0, i64 %31, i64 %106
  %115 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZSt3maxIiERKT_S2_S2_(ptr noundef nonnull align 4 dereferenceable(4) %105, ptr noundef nonnull align 4 dereferenceable(4) %114)
  %116 = load i32, ptr %115, align 4, !tbaa !5
  store i32 %116, ptr %105, align 4, !tbaa !5
  br label %117

117:                                              ; preds = %97, %110
  %118 = call noundef nonnull align 1 dereferenceable(1) ptr @_ZNSt6vectorIcSaIcEEixEm(ptr noundef nonnull align 8 dereferenceable(24) @x, i64 noundef %indvars.iv105) #6
  %119 = load i8, ptr %118, align 1, !tbaa !11
  %120 = call noundef zeroext i1 @_Z4beatic(i32 noundef 2, i8 noundef signext %119)
  %121 = zext i1 %120 to i32
  %122 = getelementptr inbounds [21 x [100000 x i32]], ptr getelementptr inbounds (i8, ptr @b1, i64 16800000), i64 0, i64 %indvars.iv109, i64 %indvars.iv105
  %123 = load i32, ptr %122, align 4, !tbaa !5
  %124 = add nsw i32 %123, %121
  store i32 %124, ptr %122, align 4, !tbaa !5
  %125 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZSt3maxIiERKT_S2_S2_(ptr noundef nonnull align 4 dereferenceable(4) %102, ptr noundef nonnull align 4 dereferenceable(4) %122)
  %126 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZSt3maxIiERKT_S2_S2_(ptr noundef nonnull align 4 dereferenceable(4) %125, ptr noundef nonnull align 4 dereferenceable(4) %82)
  %127 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZSt3maxIiERKT_S2_S2_(ptr noundef nonnull align 4 dereferenceable(4) @ans, ptr noundef nonnull align 4 dereferenceable(4) %126)
  %128 = load i32, ptr %127, align 4, !tbaa !5
  store i32 %128, ptr @ans, align 4, !tbaa !5
  %indvars.iv.next106 = add nuw nsw i64 %indvars.iv105, 1
  %129 = load i32, ptr @n, align 4, !tbaa !5
  %130 = sext i32 %129 to i64
  %131 = icmp slt i64 %indvars.iv.next106, %130
  br i1 %131, label %.peel.next, label %._crit_edge.loopexit, !llvm.loop !14

132:                                              ; preds = %._crit_edge102
  call void @_ZNSt14basic_ofstreamIcSt11char_traitsIcEED1Ev(ptr noundef nonnull align 8 dereferenceable(248) %2) #6
  call void @llvm.lifetime.end.p0(i64 512, ptr nonnull %2) #6
  call void @_ZNSt14basic_ifstreamIcSt11char_traitsIcEED1Ev(ptr noundef nonnull align 8 dereferenceable(256) %1) #6
  call void @llvm.lifetime.end.p0(i64 520, ptr nonnull %1) #6
  ret i32 0

133:                                              ; preds = %25, %17
  %.pn = phi { ptr, i32 } [ %26, %25 ], [ %18, %17 ]
  call void @_ZNSt14basic_ofstreamIcSt11char_traitsIcEED1Ev(ptr noundef nonnull align 8 dereferenceable(248) %2) #6
  br label %134

134:                                              ; preds = %133, %15
  %.pn.pn = phi { ptr, i32 } [ %.pn, %133 ], [ %16, %15 ]
  call void @llvm.lifetime.end.p0(i64 512, ptr nonnull %2) #6
  call void @_ZNSt14basic_ifstreamIcSt11char_traitsIcEED1Ev(ptr noundef nonnull align 8 dereferenceable(256) %1) #6
  call void @llvm.lifetime.end.p0(i64 520, ptr nonnull %1) #6
  resume { ptr, i32 } %.pn.pn
}

; 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 uwtable
declare void @_ZNSt14basic_ifstreamIcSt11char_traitsIcEEC1EPKcSt13_Ios_Openmode(ptr noundef nonnull align 8 dereferenceable(256), ptr noundef, i32 noundef) unnamed_addr #3 align 2

; Function Attrs: mustprogress uwtable
declare void @_ZNSt14basic_ofstreamIcSt11char_traitsIcEEC1EPKcSt13_Ios_Openmode(ptr noundef nonnull align 8 dereferenceable(248), ptr noundef, i32 noundef) unnamed_addr #3 align 2

declare i32 @__gxx_personality_v0(...)

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 uwtable
declare dso_local void @_ZNSt6vectorIcSaIcEE6resizeEm(ptr noundef nonnull align 8 dereferenceable(24), i64 noundef) local_unnamed_addr #3 align 2

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

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef nonnull align 1 dereferenceable(1) ptr @_ZNSt6vectorIcSaIcEEixEm(ptr noundef nonnull align 8 dereferenceable(24), i64 noundef) 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: 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 #5

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 nounwind uwtable
declare void @_ZNSt14basic_ofstreamIcSt11char_traitsIcEED1Ev(ptr noundef nonnull align 8 dereferenceable(248)) unnamed_addr #0 align 2

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

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 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 #2 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #3 = { mustprogress uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { "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 = { 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 #6 = { nounwind }

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

!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"clang version 19.1.0 (git@github.com:llvm/llvm-project.git a4bf6cd7cfb1a1421ba92bca9d017b49936c55e4)"}
!5 = !{!6, !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}
!13 = !{!"llvm.loop.unswitch.partial.disable"}
!14 = distinct !{!14, !10, !15}
!15 = !{!"llvm.loop.peeled.count", i32 1}


; Effective O3 passes: EarlyCSEPass,GVNPass,GlobalOptPass,IPSCCPPass,IndVarSimplifyPass,InferAlignmentPass,InferFunctionAttrsPass,InstCombinePass,InstSimplifyPass,JumpThreadingPass,LCSSAPass,LICMPass,LoopFullUnrollPass,LoopRotatePass,LoopSimplifyCFGPass,LoopSimplifyPass,LoopUnrollPass,SCCPPass,SROAPass,SimpleLoopUnswitchPass,SimplifyCFGPass