; LLVM IR from reyadussalahin/problem-solving :: dynamic_programming/non_classical/codeforces/F1475D (Solution)

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

@mem = external dso_local global [200020 x i32], align 16
@cost = external dso_local global [200020 x i32], align 16
@mem1 = external dso_local global [200020 x i32], align 16
@mem2 = external dso_local global [200020 x i32], align 16
@p1 = external dso_local global [800080 x i32], align 16
@p2 = external dso_local global [800080 x i32], align 16
@dp = external dso_local global [800080 x i64], 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 norecurse uwtable
define dso_local noundef i32 @main() #0 {
  %1 = alloca i32, align 4
  %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 = 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)
  call void @llvm.lifetime.start.p0(i64 4, ptr %2) #5
  %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) %2)
  call void @llvm.lifetime.start.p0(i64 4, ptr %3) #5
  store i32 0, ptr %3, align 4, !tbaa !8
  br label %22

22:                                               ; preds = %287, %0
  %23 = load i32, ptr %3, align 4, !tbaa !8
  %24 = load i32, ptr %2, align 4, !tbaa !8
  %25 = icmp slt i32 %23, %24
  br i1 %25, label %27, label %26

26:                                               ; preds = %22
  store i32 2, ptr %4, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %3) #5
  br label %290

27:                                               ; preds = %22
  call void @llvm.lifetime.start.p0(i64 4, ptr %5) #5
  call void @llvm.lifetime.start.p0(i64 4, ptr %6) #5
  %28 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERi(ptr noundef nonnull align 8 dereferenceable(16) @_ZSt3cin, ptr noundef nonnull align 4 dereferenceable(4) %5)
  %29 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERi(ptr noundef nonnull align 8 dereferenceable(16) %28, ptr noundef nonnull align 4 dereferenceable(4) %6)
  call void @llvm.lifetime.start.p0(i64 4, ptr %7) #5
  store i32 0, ptr %7, align 4, !tbaa !8
  br label %30

30:                                               ; preds = %40, %27
  %31 = load i32, ptr %7, align 4, !tbaa !8
  %32 = load i32, ptr %5, align 4, !tbaa !8
  %33 = icmp slt i32 %31, %32
  br i1 %33, label %35, label %34

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

35:                                               ; preds = %30
  %36 = load i32, ptr %7, align 4, !tbaa !8
  %37 = sext i32 %36 to i64
  %38 = getelementptr inbounds [200020 x i32], ptr @mem, i64 0, i64 %37
  %39 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERi(ptr noundef nonnull align 8 dereferenceable(16) @_ZSt3cin, ptr noundef nonnull align 4 dereferenceable(4) %38)
  br label %40

40:                                               ; preds = %35
  %41 = load i32, ptr %7, align 4, !tbaa !8
  %42 = add nsw i32 %41, 1
  store i32 %42, ptr %7, align 4, !tbaa !8
  br label %30, !llvm.loop !11

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

44:                                               ; preds = %54, %43
  %45 = load i32, ptr %8, align 4, !tbaa !8
  %46 = load i32, ptr %5, align 4, !tbaa !8
  %47 = icmp slt i32 %45, %46
  br i1 %47, label %49, label %48

48:                                               ; preds = %44
  store i32 8, ptr %4, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %8) #5
  br label %57

49:                                               ; preds = %44
  %50 = load i32, ptr %8, align 4, !tbaa !8
  %51 = sext i32 %50 to i64
  %52 = getelementptr inbounds [200020 x i32], ptr @cost, i64 0, i64 %51
  %53 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERi(ptr noundef nonnull align 8 dereferenceable(16) @_ZSt3cin, ptr noundef nonnull align 4 dereferenceable(4) %52)
  br label %54

54:                                               ; preds = %49
  %55 = load i32, ptr %8, align 4, !tbaa !8
  %56 = add nsw i32 %55, 1
  store i32 %56, ptr %8, align 4, !tbaa !8
  br label %44, !llvm.loop !13

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

58:                                               ; preds = %94, %57
  %59 = load i32, ptr %12, align 4, !tbaa !8
  %60 = load i32, ptr %5, align 4, !tbaa !8
  %61 = icmp slt i32 %59, %60
  br i1 %61, label %63, label %62

62:                                               ; preds = %58
  store i32 11, ptr %4, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %12) #5
  br label %97

63:                                               ; preds = %58
  %64 = load i32, ptr %12, align 4, !tbaa !8
  %65 = sext i32 %64 to i64
  %66 = getelementptr inbounds [200020 x i32], ptr @cost, i64 0, i64 %65
  %67 = load i32, ptr %66, align 4, !tbaa !8
  %68 = icmp eq i32 %67, 1
  br i1 %68, label %69, label %78

69:                                               ; preds = %63
  %70 = load i32, ptr %12, align 4, !tbaa !8
  %71 = sext i32 %70 to i64
  %72 = getelementptr inbounds [200020 x i32], ptr @mem, i64 0, i64 %71
  %73 = load i32, ptr %72, align 4, !tbaa !8
  %74 = load i32, ptr %9, align 4, !tbaa !8
  %75 = add nsw i32 %74, 1
  store i32 %75, ptr %9, align 4, !tbaa !8
  %76 = sext i32 %74 to i64
  %77 = getelementptr inbounds [200020 x i32], ptr @mem1, i64 0, i64 %76
  store i32 %73, ptr %77, align 4, !tbaa !8
  br label %87

78:                                               ; preds = %63
  %79 = load i32, ptr %12, align 4, !tbaa !8
  %80 = sext i32 %79 to i64
  %81 = getelementptr inbounds [200020 x i32], ptr @mem, i64 0, i64 %80
  %82 = load i32, ptr %81, align 4, !tbaa !8
  %83 = load i32, ptr %10, align 4, !tbaa !8
  %84 = add nsw i32 %83, 1
  store i32 %84, ptr %10, align 4, !tbaa !8
  %85 = sext i32 %83 to i64
  %86 = getelementptr inbounds [200020 x i32], ptr @mem2, i64 0, i64 %85
  store i32 %82, ptr %86, align 4, !tbaa !8
  br label %87

87:                                               ; preds = %78, %69
  %88 = load i32, ptr %12, align 4, !tbaa !8
  %89 = sext i32 %88 to i64
  %90 = getelementptr inbounds [200020 x i32], ptr @cost, i64 0, i64 %89
  %91 = load i32, ptr %90, align 4, !tbaa !8
  %92 = load i32, ptr %11, align 4, !tbaa !8
  %93 = add nsw i32 %92, %91
  store i32 %93, ptr %11, align 4, !tbaa !8
  br label %94

94:                                               ; preds = %87
  %95 = load i32, ptr %12, align 4, !tbaa !8
  %96 = add nsw i32 %95, 1
  store i32 %96, ptr %12, align 4, !tbaa !8
  br label %58, !llvm.loop !14

97:                                               ; preds = %62
  %98 = load i32, ptr %9, align 4, !tbaa !8
  %99 = sext i32 %98 to i64
  %100 = getelementptr inbounds i32, ptr @mem1, i64 %99
  call void @_ZSt4sortIPiEvT_S1_(ptr noundef @mem1, ptr noundef %100)
  %101 = load i32, ptr %10, align 4, !tbaa !8
  %102 = sext i32 %101 to i64
  %103 = getelementptr inbounds i32, ptr @mem2, i64 %102
  call void @_ZSt4sortIPiEvT_S1_(ptr noundef @mem2, ptr noundef %103)
  %104 = load i32, ptr %9, align 4, !tbaa !8
  %105 = sub nsw i32 %104, 1
  store i32 %105, ptr @p1, align 16, !tbaa !8
  %106 = load i32, ptr %10, align 4, !tbaa !8
  %107 = sub nsw i32 %106, 1
  store i32 %107, ptr @p2, align 16, !tbaa !8
  store i64 0, ptr @dp, align 16, !tbaa !15
  %108 = load i32, ptr @p1, align 16, !tbaa !8
  %109 = sext i32 %108 to i64
  %110 = getelementptr inbounds [200020 x i32], ptr @mem1, i64 0, i64 %109
  %111 = load i32, ptr %110, align 4, !tbaa !8
  %112 = sext i32 %111 to i64
  store i64 %112, ptr getelementptr inbounds ([800080 x i64], ptr @dp, i64 0, i64 1), align 8, !tbaa !15
  %113 = load i32, ptr @p1, align 16, !tbaa !8
  %114 = sub nsw i32 %113, 1
  store i32 %114, ptr getelementptr inbounds ([800080 x i32], ptr @p1, i64 0, i64 1), align 4, !tbaa !8
  %115 = load i32, ptr @p2, align 16, !tbaa !8
  store i32 %115, ptr getelementptr inbounds ([800080 x i32], ptr @p2, i64 0, i64 1), align 4, !tbaa !8
  call void @llvm.lifetime.start.p0(i64 4, ptr %13) #5
  %116 = load i64, ptr getelementptr inbounds ([800080 x i64], ptr @dp, i64 0, i64 1), align 8, !tbaa !15
  %117 = load i32, ptr %6, align 4, !tbaa !8
  %118 = sext i32 %117 to i64
  %119 = icmp sge i64 %116, %118
  %120 = zext i1 %119 to i64
  %121 = select i1 %119, i32 1, i32 -1
  store i32 %121, ptr %13, align 4, !tbaa !8
  %122 = load i32, ptr %13, align 4, !tbaa !8
  %123 = icmp ne i32 %122, -1
  br i1 %123, label %124, label %128

124:                                              ; preds = %97
  %125 = load i32, ptr %13, align 4, !tbaa !8
  %126 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEi(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cout, i32 noundef %125)
  %127 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc(ptr noundef nonnull align 8 dereferenceable(8) %126, ptr noundef @.str)
  store i32 4, ptr %4, align 4
  br label %284

128:                                              ; preds = %97
  call void @llvm.lifetime.start.p0(i64 4, ptr %14) #5
  store i32 2, ptr %14, align 4, !tbaa !8
  br label %129

129:                                              ; preds = %276, %128
  %130 = load i32, ptr %14, align 4, !tbaa !8
  %131 = load i32, ptr %11, align 4, !tbaa !8
  %132 = icmp sle i32 %130, %131
  br i1 %132, label %134, label %133

133:                                              ; preds = %129
  store i32 14, ptr %4, align 4
  br label %279

134:                                              ; preds = %129
  %135 = load i32, ptr %14, align 4, !tbaa !8
  %136 = sext i32 %135 to i64
  %137 = getelementptr inbounds [800080 x i64], ptr @dp, i64 0, i64 %136
  store i64 -1, ptr %137, align 8, !tbaa !15
  %138 = load i32, ptr %14, align 4, !tbaa !8
  %139 = sub nsw i32 %138, 1
  %140 = sext i32 %139 to i64
  %141 = getelementptr inbounds [800080 x i32], ptr @p1, i64 0, i64 %140
  %142 = load i32, ptr %141, align 4, !tbaa !8
  %143 = icmp sge i32 %142, 0
  br i1 %143, label %144, label %201

144:                                              ; preds = %134
  %145 = load i32, ptr %14, align 4, !tbaa !8
  %146 = sub nsw i32 %145, 1
  %147 = sext i32 %146 to i64
  %148 = getelementptr inbounds [800080 x i64], ptr @dp, i64 0, i64 %147
  %149 = load i64, ptr %148, align 8, !tbaa !15
  %150 = load i32, ptr %14, align 4, !tbaa !8
  %151 = sub nsw i32 %150, 1
  %152 = sext i32 %151 to i64
  %153 = getelementptr inbounds [800080 x i32], ptr @p1, i64 0, i64 %152
  %154 = load i32, ptr %153, align 4, !tbaa !8
  %155 = sext i32 %154 to i64
  %156 = getelementptr inbounds [200020 x i32], ptr @mem1, i64 0, i64 %155
  %157 = load i32, ptr %156, align 4, !tbaa !8
  %158 = sext i32 %157 to i64
  %159 = add nsw i64 %149, %158
  %160 = load i32, ptr %14, align 4, !tbaa !8
  %161 = sext i32 %160 to i64
  %162 = getelementptr inbounds [800080 x i64], ptr @dp, i64 0, i64 %161
  %163 = load i64, ptr %162, align 8, !tbaa !15
  %164 = icmp sgt i64 %159, %163
  br i1 %164, label %165, label %201

165:                                              ; preds = %144
  %166 = load i32, ptr %14, align 4, !tbaa !8
  %167 = sub nsw i32 %166, 1
  %168 = sext i32 %167 to i64
  %169 = getelementptr inbounds [800080 x i64], ptr @dp, i64 0, i64 %168
  %170 = load i64, ptr %169, align 8, !tbaa !15
  %171 = load i32, ptr %14, align 4, !tbaa !8
  %172 = sub nsw i32 %171, 1
  %173 = sext i32 %172 to i64
  %174 = getelementptr inbounds [800080 x i32], ptr @p1, i64 0, i64 %173
  %175 = load i32, ptr %174, align 4, !tbaa !8
  %176 = sext i32 %175 to i64
  %177 = getelementptr inbounds [200020 x i32], ptr @mem1, i64 0, i64 %176
  %178 = load i32, ptr %177, align 4, !tbaa !8
  %179 = sext i32 %178 to i64
  %180 = add nsw i64 %170, %179
  %181 = load i32, ptr %14, align 4, !tbaa !8
  %182 = sext i32 %181 to i64
  %183 = getelementptr inbounds [800080 x i64], ptr @dp, i64 0, i64 %182
  store i64 %180, ptr %183, align 8, !tbaa !15
  %184 = load i32, ptr %14, align 4, !tbaa !8
  %185 = sub nsw i32 %184, 1
  %186 = sext i32 %185 to i64
  %187 = getelementptr inbounds [800080 x i32], ptr @p1, i64 0, i64 %186
  %188 = load i32, ptr %187, align 4, !tbaa !8
  %189 = sub nsw i32 %188, 1
  %190 = load i32, ptr %14, align 4, !tbaa !8
  %191 = sext i32 %190 to i64
  %192 = getelementptr inbounds [800080 x i32], ptr @p1, i64 0, i64 %191
  store i32 %189, ptr %192, align 4, !tbaa !8
  %193 = load i32, ptr %14, align 4, !tbaa !8
  %194 = sub nsw i32 %193, 1
  %195 = sext i32 %194 to i64
  %196 = getelementptr inbounds [800080 x i32], ptr @p2, i64 0, i64 %195
  %197 = load i32, ptr %196, align 4, !tbaa !8
  %198 = load i32, ptr %14, align 4, !tbaa !8
  %199 = sext i32 %198 to i64
  %200 = getelementptr inbounds [800080 x i32], ptr @p2, i64 0, i64 %199
  store i32 %197, ptr %200, align 4, !tbaa !8
  br label %201

201:                                              ; preds = %165, %144, %134
  %202 = load i32, ptr %14, align 4, !tbaa !8
  %203 = sub nsw i32 %202, 2
  %204 = sext i32 %203 to i64
  %205 = getelementptr inbounds [800080 x i32], ptr @p2, i64 0, i64 %204
  %206 = load i32, ptr %205, align 4, !tbaa !8
  %207 = icmp sge i32 %206, 0
  br i1 %207, label %208, label %265

208:                                              ; preds = %201
  %209 = load i32, ptr %14, align 4, !tbaa !8
  %210 = sub nsw i32 %209, 2
  %211 = sext i32 %210 to i64
  %212 = getelementptr inbounds [800080 x i64], ptr @dp, i64 0, i64 %211
  %213 = load i64, ptr %212, align 8, !tbaa !15
  %214 = load i32, ptr %14, align 4, !tbaa !8
  %215 = sub nsw i32 %214, 2
  %216 = sext i32 %215 to i64
  %217 = getelementptr inbounds [800080 x i32], ptr @p2, i64 0, i64 %216
  %218 = load i32, ptr %217, align 4, !tbaa !8
  %219 = sext i32 %218 to i64
  %220 = getelementptr inbounds [200020 x i32], ptr @mem2, i64 0, i64 %219
  %221 = load i32, ptr %220, align 4, !tbaa !8
  %222 = sext i32 %221 to i64
  %223 = add nsw i64 %213, %222
  %224 = load i32, ptr %14, align 4, !tbaa !8
  %225 = sext i32 %224 to i64
  %226 = getelementptr inbounds [800080 x i64], ptr @dp, i64 0, i64 %225
  %227 = load i64, ptr %226, align 8, !tbaa !15
  %228 = icmp sgt i64 %223, %227
  br i1 %228, label %229, label %265

229:                                              ; preds = %208
  %230 = load i32, ptr %14, align 4, !tbaa !8
  %231 = sub nsw i32 %230, 2
  %232 = sext i32 %231 to i64
  %233 = getelementptr inbounds [800080 x i64], ptr @dp, i64 0, i64 %232
  %234 = load i64, ptr %233, align 8, !tbaa !15
  %235 = load i32, ptr %14, align 4, !tbaa !8
  %236 = sub nsw i32 %235, 2
  %237 = sext i32 %236 to i64
  %238 = getelementptr inbounds [800080 x i32], ptr @p2, i64 0, i64 %237
  %239 = load i32, ptr %238, align 4, !tbaa !8
  %240 = sext i32 %239 to i64
  %241 = getelementptr inbounds [200020 x i32], ptr @mem2, i64 0, i64 %240
  %242 = load i32, ptr %241, align 4, !tbaa !8
  %243 = sext i32 %242 to i64
  %244 = add nsw i64 %234, %243
  %245 = load i32, ptr %14, align 4, !tbaa !8
  %246 = sext i32 %245 to i64
  %247 = getelementptr inbounds [800080 x i64], ptr @dp, i64 0, i64 %246
  store i64 %244, ptr %247, align 8, !tbaa !15
  %248 = load i32, ptr %14, align 4, !tbaa !8
  %249 = sub nsw i32 %248, 2
  %250 = sext i32 %249 to i64
  %251 = getelementptr inbounds [800080 x i32], ptr @p1, i64 0, i64 %250
  %252 = load i32, ptr %251, align 4, !tbaa !8
  %253 = load i32, ptr %14, align 4, !tbaa !8
  %254 = sext i32 %253 to i64
  %255 = getelementptr inbounds [800080 x i32], ptr @p1, i64 0, i64 %254
  store i32 %252, ptr %255, align 4, !tbaa !8
  %256 = load i32, ptr %14, align 4, !tbaa !8
  %257 = sub nsw i32 %256, 2
  %258 = sext i32 %257 to i64
  %259 = getelementptr inbounds [800080 x i32], ptr @p2, i64 0, i64 %258
  %260 = load i32, ptr %259, align 4, !tbaa !8
  %261 = sub nsw i32 %260, 1
  %262 = load i32, ptr %14, align 4, !tbaa !8
  %263 = sext i32 %262 to i64
  %264 = getelementptr inbounds [800080 x i32], ptr @p2, i64 0, i64 %263
  store i32 %261, ptr %264, align 4, !tbaa !8
  br label %265

265:                                              ; preds = %229, %208, %201
  %266 = load i32, ptr %14, align 4, !tbaa !8
  %267 = sext i32 %266 to i64
  %268 = getelementptr inbounds [800080 x i64], ptr @dp, i64 0, i64 %267
  %269 = load i64, ptr %268, align 8, !tbaa !15
  %270 = load i32, ptr %6, align 4, !tbaa !8
  %271 = sext i32 %270 to i64
  %272 = icmp sge i64 %269, %271
  br i1 %272, label %273, label %275

273:                                              ; preds = %265
  %274 = load i32, ptr %14, align 4, !tbaa !8
  store i32 %274, ptr %13, align 4, !tbaa !8
  store i32 14, ptr %4, align 4
  br label %279

275:                                              ; preds = %265
  br label %276

276:                                              ; preds = %275
  %277 = load i32, ptr %14, align 4, !tbaa !8
  %278 = add nsw i32 %277, 1
  store i32 %278, ptr %14, align 4, !tbaa !8
  br label %129, !llvm.loop !17

279:                                              ; preds = %273, %133
  call void @llvm.lifetime.end.p0(i64 4, ptr %14) #5
  br label %280

280:                                              ; preds = %279
  %281 = load i32, ptr %13, align 4, !tbaa !8
  %282 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEi(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cout, i32 noundef %281)
  %283 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc(ptr noundef nonnull align 8 dereferenceable(8) %282, ptr noundef @.str)
  store i32 0, ptr %4, align 4
  br label %284

284:                                              ; preds = %280, %124
  call void @llvm.lifetime.end.p0(i64 4, ptr %13) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %11) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %10) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %9) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %6) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %5) #5
  %285 = load i32, ptr %4, align 4
  switch i32 %285, label %292 [
    i32 0, label %286
    i32 4, label %287
  ]

286:                                              ; preds = %284
  br label %287

287:                                              ; preds = %286, %284
  %288 = load i32, ptr %3, align 4, !tbaa !8
  %289 = add nsw i32 %288, 1
  store i32 %289, ptr %3, align 4, !tbaa !8
  br label %22, !llvm.loop !18

290:                                              ; preds = %26
  store i32 0, ptr %1, align 4
  store i32 1, ptr %4, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %2) #5
  %291 = load i32, ptr %1, align 4
  ret i32 %291

292:                                              ; preds = %284
  unreachable
}

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

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

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

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

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

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

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

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

attributes #0 = { 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 #1 = { "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #2 = { 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 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #4 = { 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 #5 = { 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 = distinct !{!11, !12}
!12 = !{!"llvm.loop.mustprogress"}
!13 = distinct !{!13, !12}
!14 = distinct !{!14, !12}
!15 = !{!16, !16, i64 0}
!16 = !{!"long long", !10, i64 0}
!17 = distinct !{!17, !12}
!18 = distinct !{!18, !12}


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

@mem = external dso_local global [200020 x i32], align 16
@cost = external dso_local global [200020 x i32], align 16
@mem1 = external dso_local global [200020 x i32], align 16
@mem2 = external dso_local global [200020 x i32], align 16
@p1 = external dso_local local_unnamed_addr global [800080 x i32], align 16
@p2 = external dso_local local_unnamed_addr global [800080 x i32], align 16
@dp = external dso_local local_unnamed_addr global [800080 x i64], 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 norecurse uwtable
define dso_local noundef i32 @main() local_unnamed_addr #0 {
  %1 = alloca i32, align 4
  %2 = alloca i32, align 4
  %3 = alloca i32, align 4
  %4 = tail call noundef zeroext i1 @_ZNSt8ios_base15sync_with_stdioEb(i1 noundef zeroext false)
  %5 = load ptr, ptr @_ZSt3cin, align 8, !tbaa !5
  %6 = getelementptr i8, ptr %5, i64 -24
  %7 = load i64, ptr %6, align 8
  %8 = getelementptr inbounds i8, ptr @_ZSt3cin, i64 %7
  %9 = tail call noundef ptr @_ZNSt9basic_iosIcSt11char_traitsIcEE3tieEPSo(ptr noundef nonnull align 8 dereferenceable(264) %8, ptr noundef null)
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %1) #5
  %10 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERi(ptr noundef nonnull align 8 dereferenceable(16) @_ZSt3cin, ptr noundef nonnull align 4 dereferenceable(4) %1)
  %11 = load i32, ptr %1, align 4, !tbaa !8
  %12 = icmp sgt i32 %11, 0
  br i1 %12, label %.lr.ph90, label %._crit_edge91

._crit_edge91:                                    ; preds = %._crit_edge84, %0
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %1) #5
  ret i32 0

.lr.ph90:                                         ; preds = %0, %._crit_edge84
  %.06188 = phi i32 [ %129, %._crit_edge84 ], [ 0, %0 ]
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %2) #5
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %3) #5
  %13 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERi(ptr noundef nonnull align 8 dereferenceable(16) @_ZSt3cin, ptr noundef nonnull align 4 dereferenceable(4) %2)
  %14 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERi(ptr noundef nonnull align 8 dereferenceable(16) %13, ptr noundef nonnull align 4 dereferenceable(4) %3)
  %15 = load i32, ptr %2, align 4, !tbaa !8
  %16 = icmp sgt i32 %15, 0
  br i1 %16, label %.lr.ph, label %._crit_edge

.preheader69:                                     ; preds = %.lr.ph
  %17 = icmp sgt i32 %20, 0
  br i1 %17, label %.lr.ph72, label %._crit_edge

.lr.ph:                                           ; preds = %.lr.ph90, %.lr.ph
  %indvars.iv = phi i64 [ %indvars.iv.next, %.lr.ph ], [ 0, %.lr.ph90 ]
  %18 = getelementptr inbounds [200020 x i32], ptr @mem, i64 0, i64 %indvars.iv
  %19 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERi(ptr noundef nonnull align 8 dereferenceable(16) @_ZSt3cin, ptr noundef nonnull align 4 dereferenceable(4) %18)
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  %20 = load i32, ptr %2, align 4, !tbaa !8
  %21 = sext i32 %20 to i64
  %22 = icmp slt i64 %indvars.iv.next, %21
  br i1 %22, label %.lr.ph, label %.preheader69, !llvm.loop !11

.preheader68:                                     ; preds = %.lr.ph72
  %23 = icmp sgt i32 %27, 0
  br i1 %23, label %.lr.ph77.preheader, label %._crit_edge

.lr.ph77.preheader:                               ; preds = %.preheader68
  %wide.trip.count = zext nneg i32 %27 to i64
  %xtraiter = and i64 %wide.trip.count, 1
  %24 = icmp eq i32 %27, 1
  br i1 %24, label %._crit_edge.loopexit.unr-lcssa, label %.lr.ph77.preheader.new

.lr.ph77.preheader.new:                           ; preds = %.lr.ph77.preheader
  %unroll_iter = and i64 %wide.trip.count, 2147483646
  br label %.lr.ph77

.lr.ph72:                                         ; preds = %.preheader69, %.lr.ph72
  %indvars.iv95 = phi i64 [ %indvars.iv.next96, %.lr.ph72 ], [ 0, %.preheader69 ]
  %25 = getelementptr inbounds [200020 x i32], ptr @cost, i64 0, i64 %indvars.iv95
  %26 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERi(ptr noundef nonnull align 8 dereferenceable(16) @_ZSt3cin, ptr noundef nonnull align 4 dereferenceable(4) %25)
  %indvars.iv.next96 = add nuw nsw i64 %indvars.iv95, 1
  %27 = load i32, ptr %2, align 4, !tbaa !8
  %28 = sext i32 %27 to i64
  %29 = icmp slt i64 %indvars.iv.next96, %28
  br i1 %29, label %.lr.ph72, label %.preheader68, !llvm.loop !13

._crit_edge.loopexit.unr-lcssa:                   ; preds = %78, %.lr.ph77.preheader
  %.158.lcssa.ph = phi i32 [ poison, %.lr.ph77.preheader ], [ %.158.1, %78 ]
  %.1.lcssa.ph = phi i32 [ poison, %.lr.ph77.preheader ], [ %.1.1, %78 ]
  %.lcssa116.ph = phi i32 [ poison, %.lr.ph77.preheader ], [ %81, %78 ]
  %indvars.iv98.unr = phi i64 [ 0, %.lr.ph77.preheader ], [ %indvars.iv.next99.1, %78 ]
  %.05575.unr = phi i32 [ 0, %.lr.ph77.preheader ], [ %81, %78 ]
  %.05674.unr = phi i32 [ 0, %.lr.ph77.preheader ], [ %.1.1, %78 ]
  %.05773.unr = phi i32 [ 0, %.lr.ph77.preheader ], [ %.158.1, %78 ]
  %lcmp.mod.not = icmp eq i64 %xtraiter, 0
  br i1 %lcmp.mod.not, label %._crit_edge, label %.lr.ph77.epil

.lr.ph77.epil:                                    ; preds = %._crit_edge.loopexit.unr-lcssa
  %30 = getelementptr inbounds [200020 x i32], ptr @cost, i64 0, i64 %indvars.iv98.unr
  %31 = load i32, ptr %30, align 4, !tbaa !8
  %32 = icmp eq i32 %31, 1
  %33 = getelementptr inbounds [200020 x i32], ptr @mem, i64 0, i64 %indvars.iv98.unr
  %34 = load i32, ptr %33, align 4, !tbaa !8
  br i1 %32, label %37, label %35

35:                                               ; preds = %.lr.ph77.epil
  %36 = add nsw i32 %.05674.unr, 1
  br label %._crit_edge.loopexit.epilog-lcssa

37:                                               ; preds = %.lr.ph77.epil
  %38 = add nsw i32 %.05773.unr, 1
  br label %._crit_edge.loopexit.epilog-lcssa

._crit_edge.loopexit.epilog-lcssa:                ; preds = %37, %35
  %.05674.sink.epil = phi i32 [ %.05674.unr, %35 ], [ %.05773.unr, %37 ]
  %mem2.sink.epil = phi ptr [ @mem2, %35 ], [ @mem1, %37 ]
  %.158.epil = phi i32 [ %.05773.unr, %35 ], [ %38, %37 ]
  %.1.epil = phi i32 [ %36, %35 ], [ %.05674.unr, %37 ]
  %39 = sext i32 %.05674.sink.epil to i64
  %40 = getelementptr inbounds [200020 x i32], ptr %mem2.sink.epil, i64 0, i64 %39
  store i32 %34, ptr %40, align 4, !tbaa !8
  %41 = add nsw i32 %31, %.05575.unr
  br label %._crit_edge

._crit_edge:                                      ; preds = %._crit_edge.loopexit.epilog-lcssa, %._crit_edge.loopexit.unr-lcssa, %.lr.ph90, %.preheader69, %.preheader68
  %.057.lcssa = phi i32 [ 0, %.preheader68 ], [ 0, %.preheader69 ], [ 0, %.lr.ph90 ], [ %.158.lcssa.ph, %._crit_edge.loopexit.unr-lcssa ], [ %.158.epil, %._crit_edge.loopexit.epilog-lcssa ]
  %.056.lcssa = phi i32 [ 0, %.preheader68 ], [ 0, %.preheader69 ], [ 0, %.lr.ph90 ], [ %.1.lcssa.ph, %._crit_edge.loopexit.unr-lcssa ], [ %.1.epil, %._crit_edge.loopexit.epilog-lcssa ]
  %.055.lcssa = phi i32 [ 0, %.preheader68 ], [ 0, %.preheader69 ], [ 0, %.lr.ph90 ], [ %.lcssa116.ph, %._crit_edge.loopexit.unr-lcssa ], [ %41, %._crit_edge.loopexit.epilog-lcssa ]
  %42 = sext i32 %.057.lcssa to i64
  %43 = getelementptr inbounds i32, ptr @mem1, i64 %42
  call void @_ZSt4sortIPiEvT_S1_(ptr noundef nonnull @mem1, ptr noundef nonnull %43)
  %44 = sext i32 %.056.lcssa to i64
  %45 = getelementptr inbounds i32, ptr @mem2, i64 %44
  call void @_ZSt4sortIPiEvT_S1_(ptr noundef nonnull @mem2, ptr noundef nonnull %45)
  %46 = add nsw i32 %.057.lcssa, -1
  store i32 %46, ptr @p1, align 16, !tbaa !8
  %47 = add nsw i32 %.056.lcssa, -1
  store i32 %47, ptr @p2, align 16, !tbaa !8
  store i64 0, ptr @dp, align 16, !tbaa !14
  %48 = sext i32 %46 to i64
  %49 = getelementptr inbounds [200020 x i32], ptr @mem1, i64 0, i64 %48
  %50 = load i32, ptr %49, align 4, !tbaa !8
  %51 = sext i32 %50 to i64
  store i64 %51, ptr getelementptr inbounds (i8, ptr @dp, i64 8), align 8, !tbaa !14
  %52 = add nsw i32 %.057.lcssa, -2
  store i32 %52, ptr getelementptr inbounds (i8, ptr @p1, i64 4), align 4, !tbaa !8
  store i32 %47, ptr getelementptr inbounds (i8, ptr @p2, i64 4), align 4, !tbaa !8
  %53 = load i32, ptr %3, align 4, !tbaa !8
  %.not = icmp slt i32 %50, %53
  %54 = select i1 %.not, i32 -1, i32 1
  br i1 %.not, label %.preheader, label %._crit_edge84

.preheader:                                       ; preds = %._crit_edge
  %.not6681 = icmp slt i32 %.055.lcssa, 2
  br i1 %.not6681, label %._crit_edge84, label %.lr.ph83

.lr.ph83:                                         ; preds = %.preheader
  %55 = sext i32 %53 to i64
  %56 = add nuw i32 %.055.lcssa, 1
  %wide.trip.count104 = zext i32 %56 to i64
  br label %82

.lr.ph77:                                         ; preds = %78, %.lr.ph77.preheader.new
  %indvars.iv98 = phi i64 [ 0, %.lr.ph77.preheader.new ], [ %indvars.iv.next99.1, %78 ]
  %.05575 = phi i32 [ 0, %.lr.ph77.preheader.new ], [ %81, %78 ]
  %.05674 = phi i32 [ 0, %.lr.ph77.preheader.new ], [ %.1.1, %78 ]
  %.05773 = phi i32 [ 0, %.lr.ph77.preheader.new ], [ %.158.1, %78 ]
  %niter = phi i64 [ 0, %.lr.ph77.preheader.new ], [ %niter.next.1, %78 ]
  %57 = getelementptr inbounds [200020 x i32], ptr @cost, i64 0, i64 %indvars.iv98
  %58 = load i32, ptr %57, align 8, !tbaa !8
  %59 = icmp eq i32 %58, 1
  %60 = getelementptr inbounds [200020 x i32], ptr @mem, i64 0, i64 %indvars.iv98
  %61 = load i32, ptr %60, align 8, !tbaa !8
  br i1 %59, label %62, label %64

62:                                               ; preds = %.lr.ph77
  %63 = add nsw i32 %.05773, 1
  br label %.lr.ph77.1

64:                                               ; preds = %.lr.ph77
  %65 = add nsw i32 %.05674, 1
  br label %.lr.ph77.1

.lr.ph77.1:                                       ; preds = %64, %62
  %.05674.sink = phi i32 [ %.05674, %64 ], [ %.05773, %62 ]
  %mem2.sink = phi ptr [ @mem2, %64 ], [ @mem1, %62 ]
  %.158 = phi i32 [ %.05773, %64 ], [ %63, %62 ]
  %.1 = phi i32 [ %65, %64 ], [ %.05674, %62 ]
  %66 = sext i32 %.05674.sink to i64
  %67 = getelementptr inbounds [200020 x i32], ptr %mem2.sink, i64 0, i64 %66
  store i32 %61, ptr %67, align 4, !tbaa !8
  %68 = add nsw i32 %58, %.05575
  %indvars.iv.next99 = or disjoint i64 %indvars.iv98, 1
  %69 = getelementptr inbounds [200020 x i32], ptr @cost, i64 0, i64 %indvars.iv.next99
  %70 = load i32, ptr %69, align 4, !tbaa !8
  %71 = icmp eq i32 %70, 1
  %72 = getelementptr inbounds [200020 x i32], ptr @mem, i64 0, i64 %indvars.iv.next99
  %73 = load i32, ptr %72, align 4, !tbaa !8
  br i1 %71, label %76, label %74

74:                                               ; preds = %.lr.ph77.1
  %75 = add nsw i32 %.1, 1
  br label %78

76:                                               ; preds = %.lr.ph77.1
  %77 = add nsw i32 %.158, 1
  br label %78

78:                                               ; preds = %76, %74
  %.05674.sink.1 = phi i32 [ %.1, %74 ], [ %.158, %76 ]
  %mem2.sink.1 = phi ptr [ @mem2, %74 ], [ @mem1, %76 ]
  %.158.1 = phi i32 [ %.158, %74 ], [ %77, %76 ]
  %.1.1 = phi i32 [ %75, %74 ], [ %.1, %76 ]
  %79 = sext i32 %.05674.sink.1 to i64
  %80 = getelementptr inbounds [200020 x i32], ptr %mem2.sink.1, i64 0, i64 %79
  store i32 %73, ptr %80, align 4, !tbaa !8
  %81 = add nsw i32 %70, %68
  %indvars.iv.next99.1 = add nuw nsw i64 %indvars.iv98, 2
  %niter.next.1 = add i64 %niter, 2
  %niter.ncmp.1 = icmp eq i64 %niter.next.1, %unroll_iter
  br i1 %niter.ncmp.1, label %._crit_edge.loopexit.unr-lcssa, label %.lr.ph77, !llvm.loop !16

82:                                               ; preds = %.lr.ph83, %125
  %83 = phi i64 [ %51, %.lr.ph83 ], [ %124, %125 ]
  %indvars.iv101 = phi i64 [ 2, %.lr.ph83 ], [ %indvars.iv.next102, %125 ]
  %84 = getelementptr inbounds [800080 x i64], ptr @dp, i64 0, i64 %indvars.iv101
  store i64 -1, ptr %84, align 8, !tbaa !14
  %85 = add nsw i64 %indvars.iv101, -1
  %86 = getelementptr inbounds [800080 x i32], ptr @p1, i64 0, i64 %85
  %87 = load i32, ptr %86, align 4, !tbaa !8
  %88 = icmp sgt i32 %87, -1
  br i1 %88, label %89, label %102

89:                                               ; preds = %82
  %90 = zext nneg i32 %87 to i64
  %91 = getelementptr inbounds [200020 x i32], ptr @mem1, i64 0, i64 %90
  %92 = load i32, ptr %91, align 4, !tbaa !8
  %93 = sext i32 %92 to i64
  %94 = add nsw i64 %83, %93
  %95 = icmp sgt i64 %94, -1
  br i1 %95, label %96, label %102

96:                                               ; preds = %89
  store i64 %94, ptr %84, align 8, !tbaa !14
  %97 = add nsw i32 %87, -1
  %98 = getelementptr inbounds [800080 x i32], ptr @p1, i64 0, i64 %indvars.iv101
  store i32 %97, ptr %98, align 4, !tbaa !8
  %99 = getelementptr inbounds [800080 x i32], ptr @p2, i64 0, i64 %85
  %100 = load i32, ptr %99, align 4, !tbaa !8
  %101 = getelementptr inbounds [800080 x i32], ptr @p2, i64 0, i64 %indvars.iv101
  store i32 %100, ptr %101, align 4, !tbaa !8
  br label %102

102:                                              ; preds = %96, %89, %82
  %103 = phi i64 [ %94, %96 ], [ -1, %89 ], [ -1, %82 ]
  %104 = add nsw i64 %indvars.iv101, -2
  %105 = getelementptr inbounds [800080 x i32], ptr @p2, i64 0, i64 %104
  %106 = load i32, ptr %105, align 4, !tbaa !8
  %107 = icmp sgt i32 %106, -1
  br i1 %107, label %108, label %123

108:                                              ; preds = %102
  %109 = getelementptr inbounds [800080 x i64], ptr @dp, i64 0, i64 %104
  %110 = load i64, ptr %109, align 8, !tbaa !14
  %111 = zext nneg i32 %106 to i64
  %112 = getelementptr inbounds [200020 x i32], ptr @mem2, i64 0, i64 %111
  %113 = load i32, ptr %112, align 4, !tbaa !8
  %114 = sext i32 %113 to i64
  %115 = add nsw i64 %110, %114
  %116 = icmp sgt i64 %115, %103
  br i1 %116, label %117, label %123

117:                                              ; preds = %108
  store i64 %115, ptr %84, align 8, !tbaa !14
  %118 = getelementptr inbounds [800080 x i32], ptr @p1, i64 0, i64 %104
  %119 = load i32, ptr %118, align 4, !tbaa !8
  %120 = getelementptr inbounds [800080 x i32], ptr @p1, i64 0, i64 %indvars.iv101
  store i32 %119, ptr %120, align 4, !tbaa !8
  %121 = add nsw i32 %106, -1
  %122 = getelementptr inbounds [800080 x i32], ptr @p2, i64 0, i64 %indvars.iv101
  store i32 %121, ptr %122, align 4, !tbaa !8
  br label %123

123:                                              ; preds = %117, %108, %102
  %124 = phi i64 [ %115, %117 ], [ %103, %108 ], [ %103, %102 ]
  %.not67 = icmp slt i64 %124, %55
  br i1 %.not67, label %125, label %._crit_edge84.loopexit.split.loop.exit

125:                                              ; preds = %123
  %indvars.iv.next102 = add nuw nsw i64 %indvars.iv101, 1
  %exitcond105.not = icmp eq i64 %indvars.iv.next102, %wide.trip.count104
  br i1 %exitcond105.not, label %._crit_edge84, label %82, !llvm.loop !17

._crit_edge84.loopexit.split.loop.exit:           ; preds = %123
  %126 = trunc nuw nsw i64 %indvars.iv101 to i32
  br label %._crit_edge84

._crit_edge84:                                    ; preds = %125, %.preheader, %._crit_edge84.loopexit.split.loop.exit, %._crit_edge
  %.053.sink = phi i32 [ 1, %._crit_edge ], [ -1, %.preheader ], [ %126, %._crit_edge84.loopexit.split.loop.exit ], [ %54, %125 ]
  %127 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEi(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cout, i32 noundef %.053.sink)
  %128 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc(ptr noundef nonnull align 8 dereferenceable(8) %127, ptr noundef nonnull @.str)
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %3) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %2) #5
  %129 = add nuw nsw i32 %.06188, 1
  %130 = load i32, ptr %1, align 4, !tbaa !8
  %131 = icmp slt i32 %129, %130
  br i1 %131, label %.lr.ph90, label %._crit_edge91, !llvm.loop !18
}

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

; 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

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

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

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

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

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

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

attributes #0 = { 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 #1 = { "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #2 = { 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 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #4 = { 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 #5 = { 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 = distinct !{!11, !12}
!12 = !{!"llvm.loop.mustprogress"}
!13 = distinct !{!13, !12}
!14 = !{!15, !15, i64 0}
!15 = !{!"long long", !10, i64 0}
!16 = distinct !{!16, !12}
!17 = distinct !{!17, !12}
!18 = distinct !{!18, !12}


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