; LLVM IR from reyadussalahin/problem-solving :: ad_hoc/constructive_algorithm/codeforces/F1512D (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 }

@lx = external dso_local global [200020 x i32], align 16
@rx = external dso_local global [200020 x i32], align 16
@b = external dso_local global [200020 x i32], align 16
@_ZSt3cin = external global %"class.std::basic_istream", align 8
@.str = external hidden unnamed_addr constant [10 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [125 x i8], align 1
@__PRETTY_FUNCTION__.main = external hidden unnamed_addr constant [11 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [4 x i8], align 1
@.str.3 = external hidden unnamed_addr constant [3 x i8], align 1
@.str.4 = 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 i64, align 8
  %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
  %15 = alloca i32, align 4
  %16 = alloca i32, align 4
  store i32 0, ptr %1, align 4
  %17 = call noundef zeroext i1 @_ZNSt8ios_base15sync_with_stdioEb(i1 noundef zeroext false)
  %18 = load ptr, ptr @_ZSt3cin, align 8, !tbaa !5
  %19 = getelementptr i8, ptr %18, i64 -24
  %20 = load i64, ptr %19, align 8
  %21 = getelementptr inbounds i8, ptr @_ZSt3cin, i64 %20
  %22 = call noundef ptr @_ZNSt9basic_iosIcSt11char_traitsIcEE3tieEPSo(ptr noundef nonnull align 8 dereferenceable(264) %21, ptr noundef null)
  call void @llvm.lifetime.start.p0(i64 4, ptr %2) #5
  %23 = 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 %24

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

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

29:                                               ; preds = %24
  call void @llvm.lifetime.start.p0(i64 4, ptr %5) #5
  %30 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERi(ptr noundef nonnull align 8 dereferenceable(16) @_ZSt3cin, ptr noundef nonnull align 4 dereferenceable(4) %5)
  call void @llvm.lifetime.start.p0(i64 4, ptr %6) #5
  %31 = load i32, ptr %5, align 4, !tbaa !8
  %32 = add nsw i32 %31, 2
  store i32 %32, ptr %6, align 4, !tbaa !8
  call void @llvm.lifetime.start.p0(i64 4, ptr %7) #5
  store i32 0, ptr %7, align 4, !tbaa !8
  br label %33

33:                                               ; preds = %43, %29
  %34 = load i32, ptr %7, align 4, !tbaa !8
  %35 = load i32, ptr %6, align 4, !tbaa !8
  %36 = icmp slt i32 %34, %35
  br i1 %36, label %38, label %37

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

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

43:                                               ; preds = %38
  %44 = load i32, ptr %7, align 4, !tbaa !8
  %45 = add nsw i32 %44, 1
  store i32 %45, ptr %7, align 4, !tbaa !8
  br label %33, !llvm.loop !11

46:                                               ; preds = %37
  store i32 0, ptr @lx, align 16, !tbaa !8
  %47 = load i32, ptr %6, align 4, !tbaa !8
  %48 = sub nsw i32 %47, 1
  %49 = load i32, ptr %6, align 4, !tbaa !8
  %50 = sub nsw i32 %49, 1
  %51 = sext i32 %50 to i64
  %52 = getelementptr inbounds [200020 x i32], ptr @rx, i64 0, i64 %51
  store i32 %48, ptr %52, align 4, !tbaa !8
  call void @llvm.lifetime.start.p0(i64 8, ptr %8) #5
  %53 = load i32, ptr @b, align 16, !tbaa !8
  %54 = sext i32 %53 to i64
  store i64 %54, ptr %8, align 8, !tbaa !13
  call void @llvm.lifetime.start.p0(i64 4, ptr %9) #5
  store i32 1, ptr %9, align 4, !tbaa !8
  br label %55

55:                                               ; preds = %124, %46
  %56 = load i32, ptr %9, align 4, !tbaa !8
  %57 = load i32, ptr %6, align 4, !tbaa !8
  %58 = icmp slt i32 %56, %57
  br i1 %58, label %60, label %59

59:                                               ; preds = %55
  store i32 8, ptr %4, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %9) #5
  br label %127

60:                                               ; preds = %55
  %61 = load i32, ptr %9, align 4, !tbaa !8
  %62 = sub nsw i32 %61, 1
  %63 = sext i32 %62 to i64
  %64 = getelementptr inbounds [200020 x i32], ptr @lx, i64 0, i64 %63
  %65 = load i32, ptr %64, align 4, !tbaa !8
  %66 = load i32, ptr %9, align 4, !tbaa !8
  %67 = sext i32 %66 to i64
  %68 = getelementptr inbounds [200020 x i32], ptr @lx, i64 0, i64 %67
  store i32 %65, ptr %68, align 4, !tbaa !8
  %69 = load i32, ptr %9, align 4, !tbaa !8
  %70 = sext i32 %69 to i64
  %71 = getelementptr inbounds [200020 x i32], ptr @b, i64 0, i64 %70
  %72 = load i32, ptr %71, align 4, !tbaa !8
  %73 = load i32, ptr %9, align 4, !tbaa !8
  %74 = sext i32 %73 to i64
  %75 = getelementptr inbounds [200020 x i32], ptr @lx, i64 0, i64 %74
  %76 = load i32, ptr %75, align 4, !tbaa !8
  %77 = sext i32 %76 to i64
  %78 = getelementptr inbounds [200020 x i32], ptr @b, i64 0, i64 %77
  %79 = load i32, ptr %78, align 4, !tbaa !8
  %80 = icmp sgt i32 %72, %79
  br i1 %80, label %81, label %86

81:                                               ; preds = %60
  %82 = load i32, ptr %9, align 4, !tbaa !8
  %83 = load i32, ptr %9, align 4, !tbaa !8
  %84 = sext i32 %83 to i64
  %85 = getelementptr inbounds [200020 x i32], ptr @lx, i64 0, i64 %84
  store i32 %82, ptr %85, align 4, !tbaa !8
  br label %86

86:                                               ; preds = %81, %60
  call void @llvm.lifetime.start.p0(i64 4, ptr %10) #5
  %87 = load i32, ptr %6, align 4, !tbaa !8
  %88 = load i32, ptr %9, align 4, !tbaa !8
  %89 = sub nsw i32 %87, %88
  %90 = sub nsw i32 %89, 1
  store i32 %90, ptr %10, align 4, !tbaa !8
  %91 = load i32, ptr %10, align 4, !tbaa !8
  %92 = add nsw i32 %91, 1
  %93 = sext i32 %92 to i64
  %94 = getelementptr inbounds [200020 x i32], ptr @rx, i64 0, i64 %93
  %95 = load i32, ptr %94, align 4, !tbaa !8
  %96 = load i32, ptr %10, align 4, !tbaa !8
  %97 = sext i32 %96 to i64
  %98 = getelementptr inbounds [200020 x i32], ptr @rx, i64 0, i64 %97
  store i32 %95, ptr %98, align 4, !tbaa !8
  %99 = load i32, ptr %10, align 4, !tbaa !8
  %100 = sext i32 %99 to i64
  %101 = getelementptr inbounds [200020 x i32], ptr @b, i64 0, i64 %100
  %102 = load i32, ptr %101, align 4, !tbaa !8
  %103 = load i32, ptr %10, align 4, !tbaa !8
  %104 = sext i32 %103 to i64
  %105 = getelementptr inbounds [200020 x i32], ptr @rx, i64 0, i64 %104
  %106 = load i32, ptr %105, align 4, !tbaa !8
  %107 = sext i32 %106 to i64
  %108 = getelementptr inbounds [200020 x i32], ptr @b, i64 0, i64 %107
  %109 = load i32, ptr %108, align 4, !tbaa !8
  %110 = icmp sgt i32 %102, %109
  br i1 %110, label %111, label %116

111:                                              ; preds = %86
  %112 = load i32, ptr %10, align 4, !tbaa !8
  %113 = load i32, ptr %10, align 4, !tbaa !8
  %114 = sext i32 %113 to i64
  %115 = getelementptr inbounds [200020 x i32], ptr @rx, i64 0, i64 %114
  store i32 %112, ptr %115, align 4, !tbaa !8
  br label %116

116:                                              ; preds = %111, %86
  %117 = load i64, ptr %8, align 8, !tbaa !13
  %118 = load i32, ptr %9, align 4, !tbaa !8
  %119 = sext i32 %118 to i64
  %120 = getelementptr inbounds [200020 x i32], ptr @b, i64 0, i64 %119
  %121 = load i32, ptr %120, align 4, !tbaa !8
  %122 = sext i32 %121 to i64
  %123 = add nsw i64 %117, %122
  store i64 %123, ptr %8, align 8, !tbaa !13
  call void @llvm.lifetime.end.p0(i64 4, ptr %10) #5
  br label %124

124:                                              ; preds = %116
  %125 = load i32, ptr %9, align 4, !tbaa !8
  %126 = add nsw i32 %125, 1
  store i32 %126, ptr %9, align 4, !tbaa !8
  br label %55, !llvm.loop !15

127:                                              ; preds = %59
  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 -1, ptr %12, align 4, !tbaa !8
  call void @llvm.lifetime.start.p0(i64 4, ptr %13) #5
  store i32 -1, ptr %13, align 4, !tbaa !8
  call void @llvm.lifetime.start.p0(i64 4, ptr %14) #5
  store i32 0, ptr %14, align 4, !tbaa !8
  br label %128

128:                                              ; preds = %205, %127
  %129 = load i32, ptr %14, align 4, !tbaa !8
  %130 = load i32, ptr %6, align 4, !tbaa !8
  %131 = icmp slt i32 %129, %130
  br i1 %131, label %133, label %132

132:                                              ; preds = %128
  store i32 11, ptr %4, align 4
  br label %208

133:                                              ; preds = %128
  call void @llvm.lifetime.start.p0(i64 4, ptr %15) #5
  %134 = load i32, ptr %14, align 4, !tbaa !8
  %135 = icmp sgt i32 %134, 0
  br i1 %135, label %136, label %142

136:                                              ; preds = %133
  %137 = load i32, ptr %14, align 4, !tbaa !8
  %138 = sub nsw i32 %137, 1
  %139 = sext i32 %138 to i64
  %140 = getelementptr inbounds [200020 x i32], ptr @lx, i64 0, i64 %139
  %141 = load i32, ptr %140, align 4, !tbaa !8
  br label %143

142:                                              ; preds = %133
  br label %143

143:                                              ; preds = %142, %136
  %144 = phi i32 [ %141, %136 ], [ -1, %142 ]
  store i32 %144, ptr %15, align 4, !tbaa !8
  %145 = load i32, ptr %15, align 4, !tbaa !8
  %146 = icmp eq i32 %145, -1
  br i1 %146, label %166, label %147

147:                                              ; preds = %143
  %148 = load i32, ptr %14, align 4, !tbaa !8
  %149 = load i32, ptr %6, align 4, !tbaa !8
  %150 = sub nsw i32 %149, 1
  %151 = icmp slt i32 %148, %150
  br i1 %151, label %152, label %172

152:                                              ; preds = %147
  %153 = load i32, ptr %14, align 4, !tbaa !8
  %154 = add nsw i32 %153, 1
  %155 = sext i32 %154 to i64
  %156 = getelementptr inbounds [200020 x i32], ptr @rx, i64 0, i64 %155
  %157 = load i32, ptr %156, align 4, !tbaa !8
  %158 = sext i32 %157 to i64
  %159 = getelementptr inbounds [200020 x i32], ptr @b, i64 0, i64 %158
  %160 = load i32, ptr %159, align 4, !tbaa !8
  %161 = load i32, ptr %15, align 4, !tbaa !8
  %162 = sext i32 %161 to i64
  %163 = getelementptr inbounds [200020 x i32], ptr @b, i64 0, i64 %162
  %164 = load i32, ptr %163, align 4, !tbaa !8
  %165 = icmp sgt i32 %160, %164
  br i1 %165, label %166, label %172

166:                                              ; preds = %152, %143
  %167 = load i32, ptr %14, align 4, !tbaa !8
  %168 = add nsw i32 %167, 1
  %169 = sext i32 %168 to i64
  %170 = getelementptr inbounds [200020 x i32], ptr @rx, i64 0, i64 %169
  %171 = load i32, ptr %170, align 4, !tbaa !8
  store i32 %171, ptr %15, align 4, !tbaa !8
  br label %172

172:                                              ; preds = %166, %152, %147
  %173 = load i32, ptr %15, align 4, !tbaa !8
  %174 = icmp ne i32 %173, -1
  br i1 %174, label %175, label %176

175:                                              ; preds = %172
  br label %178

176:                                              ; preds = %172
  call void @__assert_fail(ptr noundef @.str, ptr noundef @.str.1, i32 noundef 56, ptr noundef @__PRETTY_FUNCTION__.main) #6
  unreachable

177:                                              ; No predecessors!
  br label %178

178:                                              ; preds = %177, %175
  %179 = load i32, ptr %15, align 4, !tbaa !8
  %180 = sext i32 %179 to i64
  %181 = getelementptr inbounds [200020 x i32], ptr @b, i64 0, i64 %180
  %182 = load i32, ptr %181, align 4, !tbaa !8
  %183 = sext i32 %182 to i64
  %184 = load i32, ptr %15, align 4, !tbaa !8
  %185 = sext i32 %184 to i64
  %186 = getelementptr inbounds [200020 x i32], ptr @b, i64 0, i64 %185
  %187 = load i32, ptr %186, align 4, !tbaa !8
  %188 = sext i32 %187 to i64
  %189 = add nsw i64 %183, %188
  %190 = load i64, ptr %8, align 8, !tbaa !13
  %191 = load i32, ptr %14, align 4, !tbaa !8
  %192 = sext i32 %191 to i64
  %193 = getelementptr inbounds [200020 x i32], ptr @b, i64 0, i64 %192
  %194 = load i32, ptr %193, align 4, !tbaa !8
  %195 = sext i32 %194 to i64
  %196 = sub nsw i64 %190, %195
  %197 = icmp eq i64 %189, %196
  br i1 %197, label %198, label %201

198:                                              ; preds = %178
  store i32 1, ptr %11, align 4, !tbaa !8
  %199 = load i32, ptr %14, align 4, !tbaa !8
  store i32 %199, ptr %12, align 4, !tbaa !8
  %200 = load i32, ptr %15, align 4, !tbaa !8
  store i32 %200, ptr %13, align 4, !tbaa !8
  store i32 11, ptr %4, align 4
  br label %202

201:                                              ; preds = %178
  store i32 0, ptr %4, align 4
  br label %202

202:                                              ; preds = %201, %198
  call void @llvm.lifetime.end.p0(i64 4, ptr %15) #5
  %203 = load i32, ptr %4, align 4
  switch i32 %203, label %208 [
    i32 0, label %204
  ]

204:                                              ; preds = %202
  br label %205

205:                                              ; preds = %204
  %206 = load i32, ptr %14, align 4, !tbaa !8
  %207 = add nsw i32 %206, 1
  store i32 %207, ptr %14, align 4, !tbaa !8
  br label %128, !llvm.loop !16

208:                                              ; preds = %202, %132
  call void @llvm.lifetime.end.p0(i64 4, ptr %14) #5
  br label %209

209:                                              ; preds = %208
  %210 = load i32, ptr %11, align 4, !tbaa !8
  %211 = icmp ne i32 %210, 0
  br i1 %211, label %212, label %237

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

213:                                              ; preds = %233, %212
  %214 = load i32, ptr %16, align 4, !tbaa !8
  %215 = load i32, ptr %6, align 4, !tbaa !8
  %216 = icmp slt i32 %214, %215
  br i1 %216, label %218, label %217

217:                                              ; preds = %213
  store i32 14, ptr %4, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %16) #5
  br label %236

218:                                              ; preds = %213
  %219 = load i32, ptr %16, align 4, !tbaa !8
  %220 = load i32, ptr %12, align 4, !tbaa !8
  %221 = icmp ne i32 %219, %220
  br i1 %221, label %222, label %232

222:                                              ; preds = %218
  %223 = load i32, ptr %16, align 4, !tbaa !8
  %224 = load i32, ptr %13, align 4, !tbaa !8
  %225 = icmp ne i32 %223, %224
  br i1 %225, label %226, label %232

226:                                              ; preds = %222
  %227 = load i32, ptr %16, align 4, !tbaa !8
  %228 = sext i32 %227 to i64
  %229 = getelementptr inbounds [200020 x i32], ptr @b, i64 0, i64 %228
  %230 = load i32, ptr %229, align 4, !tbaa !8
  %231 = call i32 (ptr, ...) @printf(ptr noundef @.str.2, i32 noundef %230)
  br label %232

232:                                              ; preds = %226, %222, %218
  br label %233

233:                                              ; preds = %232
  %234 = load i32, ptr %16, align 4, !tbaa !8
  %235 = add nsw i32 %234, 1
  store i32 %235, ptr %16, align 4, !tbaa !8
  br label %213, !llvm.loop !17

236:                                              ; preds = %217
  br label %239

237:                                              ; preds = %209
  %238 = call i32 (ptr, ...) @printf(ptr noundef @.str.3)
  br label %239

239:                                              ; preds = %237, %236
  %240 = call i32 (ptr, ...) @printf(ptr noundef @.str.4)
  call void @llvm.lifetime.end.p0(i64 4, ptr %13) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %12) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %11) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %8) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %6) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %5) #5
  br label %241

241:                                              ; preds = %239
  %242 = load i32, ptr %3, align 4, !tbaa !8
  %243 = add nsw i32 %242, 1
  store i32 %243, ptr %3, align 4, !tbaa !8
  br label %24, !llvm.loop !18

244:                                              ; preds = %28
  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
  %245 = load i32, ptr %1, align 4
  ret i32 %245
}

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: noreturn nounwind
declare void @__assert_fail(ptr noundef, ptr noundef, i32 noundef, ptr noundef) #4

declare i32 @printf(ptr 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 = { noreturn nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #5 = { nounwind }
attributes #6 = { noreturn nounwind }

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

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

@lx = external dso_local local_unnamed_addr global [200020 x i32], align 16
@rx = external dso_local local_unnamed_addr global [200020 x i32], align 16
@b = external dso_local global [200020 x i32], align 16
@_ZSt3cin = external global %"class.std::basic_istream", align 8
@.str = external hidden unnamed_addr constant [10 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [125 x i8], align 1
@__PRETTY_FUNCTION__.main = external hidden unnamed_addr constant [11 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [4 x i8], align 1
@.str.3 = external hidden unnamed_addr constant [3 x i8], align 1
@.str.4 = 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 = tail call noundef zeroext i1 @_ZNSt8ios_base15sync_with_stdioEb(i1 noundef zeroext false)
  %4 = load ptr, ptr @_ZSt3cin, align 8, !tbaa !5
  %5 = getelementptr i8, ptr %4, i64 -24
  %6 = load i64, ptr %5, align 8
  %7 = getelementptr inbounds i8, ptr @_ZSt3cin, i64 %6
  %8 = tail call noundef ptr @_ZNSt9basic_iosIcSt11char_traitsIcEE3tieEPSo(ptr noundef nonnull align 8 dereferenceable(264) %7, ptr noundef null)
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %1) #7
  %9 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERi(ptr noundef nonnull align 8 dereferenceable(16) @_ZSt3cin, ptr noundef nonnull align 4 dereferenceable(4) %1)
  %10 = load i32, ptr %1, align 4, !tbaa !8
  %11 = icmp sgt i32 %10, 0
  br i1 %11, label %.lr.ph106, label %._crit_edge107

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

.lr.ph106:                                        ; preds = %0, %.loopexit
  %.068104 = phi i32 [ %98, %.loopexit ], [ 0, %0 ]
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %2) #7
  %12 = 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)
  %13 = load i32, ptr %2, align 4, !tbaa !8
  %14 = add i32 %13, 2
  %15 = icmp sgt i32 %13, -2
  br i1 %15, label %.lr.ph.preheader, label %.preheader84.thread

.preheader84.thread:                              ; preds = %.lr.ph106
  store i32 0, ptr @lx, align 16, !tbaa !8
  %16 = add nuw nsw i32 %13, 1
  %17 = sext i32 %16 to i64
  %18 = getelementptr inbounds [200020 x i32], ptr @rx, i64 0, i64 %17
  store i32 %16, ptr %18, align 4, !tbaa !8
  br label %._crit_edge95.thread

.lr.ph.preheader:                                 ; preds = %.lr.ph106
  %smax = call i32 @llvm.smax.i32(i32 %14, i32 1)
  %wide.trip.count = zext nneg i32 %smax to i64
  br label %.lr.ph

._crit_edge:                                      ; preds = %.lr.ph
  store i32 0, ptr @lx, align 16, !tbaa !8
  %19 = add nsw i32 %13, 1
  %20 = sext i32 %19 to i64
  %21 = getelementptr inbounds [200020 x i32], ptr @rx, i64 0, i64 %20
  store i32 %19, ptr %21, align 4, !tbaa !8
  %22 = load i32, ptr @b, align 16, !tbaa !8
  %23 = sext i32 %22 to i64
  %24 = icmp sgt i32 %13, -1
  br i1 %24, label %.lr.ph90.preheader, label %.preheader84

.lr.ph90.preheader:                               ; preds = %._crit_edge
  %25 = sext i32 %14 to i64
  %smax112 = call i32 @llvm.smax.i32(i32 %14, i32 2)
  %wide.trip.count113 = zext nneg i32 %smax112 to i64
  %26 = shl nsw i64 %25, 2
  %scevgep = getelementptr i8, ptr getelementptr (i8, ptr @rx, i64 -4), i64 %26
  %load_initial = load i32, ptr %scevgep, align 4
  br label %.lr.ph90

.lr.ph:                                           ; preds = %.lr.ph.preheader, %.lr.ph
  %indvars.iv = phi i64 [ 0, %.lr.ph.preheader ], [ %indvars.iv.next, %.lr.ph ]
  %27 = getelementptr inbounds [200020 x i32], ptr @b, i64 0, i64 %indvars.iv
  %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) %27)
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  %exitcond.not = icmp eq i64 %indvars.iv.next, %wide.trip.count
  br i1 %exitcond.not, label %._crit_edge, label %.lr.ph, !llvm.loop !11

.preheader84:                                     ; preds = %.lr.ph90, %._crit_edge
  %.066.lcssa = phi i64 [ %23, %._crit_edge ], [ %59, %.lr.ph90 ]
  br i1 %15, label %.thread.peel, label %._crit_edge95.thread

.thread.peel:                                     ; preds = %.preheader84
  %29 = sext i32 %13 to i64
  %30 = sext i32 %14 to i64
  %smax117 = call i32 @llvm.smax.i32(i32 %14, i32 1)
  %wide.trip.count118 = zext nneg i32 %smax117 to i64
  %31 = load i32, ptr getelementptr inbounds (i8, ptr @rx, i64 4), align 4, !tbaa !8
  %.not73.peel = icmp eq i32 %31, -1
  br i1 %.not73.peel, label %.loopexit121, label %.thread79.peel

.thread79.peel:                                   ; preds = %.thread.peel
  %32 = sext i32 %31 to i64
  %33 = getelementptr inbounds [200020 x i32], ptr @b, i64 0, i64 %32
  %34 = load i32, ptr %33, align 4, !tbaa !8
  %35 = sext i32 %34 to i64
  %36 = shl nsw i64 %35, 1
  %37 = sub nsw i64 %.066.lcssa, %23
  %.not74.peel = icmp eq i64 %36, %37
  br i1 %.not74.peel, label %.lr.ph103.preheader, label %38

38:                                               ; preds = %.thread79.peel
  %exitcond119.peel.not = icmp ugt i32 %13, 2147483645
  br i1 %exitcond119.peel.not, label %._crit_edge95.thread, label %.lr.ph94.peel.next

.lr.ph90:                                         ; preds = %.lr.ph90.preheader, %.lr.ph90
  %store_forwarded = phi i32 [ %load_initial, %.lr.ph90.preheader ], [ %spec.store.select78, %.lr.ph90 ]
  %39 = phi i32 [ 0, %.lr.ph90.preheader ], [ %spec.store.select, %.lr.ph90 ]
  %indvars.iv109 = phi i64 [ 1, %.lr.ph90.preheader ], [ %indvars.iv.next110, %.lr.ph90 ]
  %.06687 = phi i64 [ %23, %.lr.ph90.preheader ], [ %59, %.lr.ph90 ]
  %40 = getelementptr inbounds [200020 x i32], ptr @lx, i64 0, i64 %indvars.iv109
  %41 = getelementptr inbounds [200020 x i32], ptr @b, i64 0, i64 %indvars.iv109
  %42 = load i32, ptr %41, align 4, !tbaa !8
  %43 = sext i32 %39 to i64
  %44 = getelementptr inbounds [200020 x i32], ptr @b, i64 0, i64 %43
  %45 = load i32, ptr %44, align 4, !tbaa !8
  %46 = icmp sgt i32 %42, %45
  %47 = trunc nuw nsw i64 %indvars.iv109 to i32
  %spec.store.select = select i1 %46, i32 %47, i32 %39
  store i32 %spec.store.select, ptr %40, align 4
  %48 = xor i64 %indvars.iv109, -1
  %49 = add i64 %48, %25
  %50 = getelementptr inbounds [200020 x i32], ptr @rx, i64 0, i64 %49
  %51 = getelementptr inbounds [200020 x i32], ptr @b, i64 0, i64 %49
  %52 = load i32, ptr %51, align 4, !tbaa !8
  %53 = sext i32 %store_forwarded to i64
  %54 = getelementptr inbounds [200020 x i32], ptr @b, i64 0, i64 %53
  %55 = load i32, ptr %54, align 4, !tbaa !8
  %56 = icmp sgt i32 %52, %55
  %57 = trunc nsw i64 %49 to i32
  %spec.store.select78 = select i1 %56, i32 %57, i32 %store_forwarded
  store i32 %spec.store.select78, ptr %50, align 4
  %58 = sext i32 %42 to i64
  %59 = add nsw i64 %.06687, %58
  %indvars.iv.next110 = add nuw nsw i64 %indvars.iv109, 1
  %exitcond114.not = icmp eq i64 %indvars.iv.next110, %wide.trip.count113
  br i1 %exitcond114.not, label %.preheader84, label %.lr.ph90, !llvm.loop !13

.lr.ph94.peel.next:                               ; preds = %38, %88
  %indvars.iv115 = phi i64 [ %indvars.iv.next116, %88 ], [ 1, %38 ]
  %.not8393 = phi i1 [ %.not83, %88 ], [ true, %38 ]
  %60 = add nsw i64 %indvars.iv115, -1
  %61 = getelementptr inbounds [200020 x i32], ptr @lx, i64 0, i64 %60
  %62 = load i32, ptr %61, align 4, !tbaa !8
  %63 = icmp eq i32 %62, -1
  br i1 %63, label %.thread, label %64

64:                                               ; preds = %.lr.ph94.peel.next
  %.not72 = icmp sgt i64 %indvars.iv115, %29
  br i1 %.not72, label %.thread79, label %65

65:                                               ; preds = %64
  %66 = add nuw nsw i64 %indvars.iv115, 1
  %67 = getelementptr inbounds [200020 x i32], ptr @rx, i64 0, i64 %66
  %68 = load i32, ptr %67, align 4, !tbaa !8
  %69 = sext i32 %68 to i64
  %70 = getelementptr inbounds [200020 x i32], ptr @b, i64 0, i64 %69
  %71 = load i32, ptr %70, align 4, !tbaa !8
  %72 = sext i32 %62 to i64
  %73 = getelementptr inbounds [200020 x i32], ptr @b, i64 0, i64 %72
  %74 = load i32, ptr %73, align 4, !tbaa !8
  %75 = icmp sgt i32 %71, %74
  br i1 %75, label %.thread, label %.thread79

.thread:                                          ; preds = %.lr.ph94.peel.next, %65
  %76 = add nuw nsw i64 %indvars.iv115, 1
  %77 = getelementptr inbounds [200020 x i32], ptr @rx, i64 0, i64 %76
  %78 = load i32, ptr %77, align 4, !tbaa !8
  %.not73 = icmp eq i32 %78, -1
  br i1 %.not73, label %.loopexit121, label %.thread79

.loopexit121:                                     ; preds = %.thread.peel, %.thread
  call void @__assert_fail(ptr noundef nonnull @.str, ptr noundef nonnull @.str.1, i32 noundef 56, ptr noundef nonnull @__PRETTY_FUNCTION__.main) #8
  unreachable

.thread79:                                        ; preds = %64, %65, %.thread
  %.05682 = phi i32 [ %78, %.thread ], [ %62, %65 ], [ %62, %64 ]
  %79 = sext i32 %.05682 to i64
  %80 = getelementptr inbounds [200020 x i32], ptr @b, i64 0, i64 %79
  %81 = load i32, ptr %80, align 4, !tbaa !8
  %82 = sext i32 %81 to i64
  %83 = shl nsw i64 %82, 1
  %84 = getelementptr inbounds [200020 x i32], ptr @b, i64 0, i64 %indvars.iv115
  %85 = load i32, ptr %84, align 4, !tbaa !8
  %86 = sext i32 %85 to i64
  %87 = sub nsw i64 %.066.lcssa, %86
  %.not74 = icmp eq i64 %83, %87
  br i1 %.not74, label %._crit_edge95, label %88

88:                                               ; preds = %.thread79
  %indvars.iv.next116 = add nuw nsw i64 %indvars.iv115, 1
  %.not83 = icmp slt i64 %indvars.iv.next116, %30
  %exitcond119.not = icmp eq i64 %indvars.iv.next116, %wide.trip.count118
  br i1 %exitcond119.not, label %._crit_edge95, label %.lr.ph94.peel.next, !llvm.loop !14

._crit_edge95:                                    ; preds = %.thread79, %88
  %.not83.lcssa = phi i1 [ %.not83, %88 ], [ %.not8393, %.thread79 ]
  %.261 = phi i64 [ 4294967295, %88 ], [ %indvars.iv115, %.thread79 ]
  %.2 = phi i32 [ -1, %88 ], [ %.05682, %.thread79 ]
  br i1 %.not83.lcssa, label %.preheader, label %._crit_edge95.thread

.preheader:                                       ; preds = %._crit_edge95
  br i1 %15, label %.lr.ph103.preheader, label %.loopexit

.lr.ph103.preheader:                              ; preds = %.thread79.peel, %.preheader
  %.261139144 = phi i64 [ %.261, %.preheader ], [ 0, %.thread79.peel ]
  %.2140143 = phi i32 [ %.2, %.preheader ], [ %31, %.thread79.peel ]
  %89 = zext i32 %.2140143 to i64
  %90 = and i64 %.261139144, 4294967295
  %smax126 = call i32 @llvm.smax.i32(i32 %14, i32 1)
  %wide.trip.count127 = zext nneg i32 %smax126 to i64
  br label %.lr.ph103

.lr.ph103:                                        ; preds = %.lr.ph103.preheader, %95
  %indvars.iv123 = phi i64 [ 0, %.lr.ph103.preheader ], [ %indvars.iv.next124, %95 ]
  %.not76 = icmp eq i64 %indvars.iv123, %90
  %.not77 = icmp eq i64 %indvars.iv123, %89
  %or.cond = or i1 %.not76, %.not77
  br i1 %or.cond, label %95, label %91

91:                                               ; preds = %.lr.ph103
  %92 = getelementptr inbounds [200020 x i32], ptr @b, i64 0, i64 %indvars.iv123
  %93 = load i32, ptr %92, align 4, !tbaa !8
  %94 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %93)
  br label %95

95:                                               ; preds = %.lr.ph103, %91
  %indvars.iv.next124 = add nuw nsw i64 %indvars.iv123, 1
  %exitcond128.not = icmp eq i64 %indvars.iv.next124, %wide.trip.count127
  br i1 %exitcond128.not, label %.loopexit, label %.lr.ph103, !llvm.loop !16

._crit_edge95.thread:                             ; preds = %38, %.preheader84.thread, %.preheader84, %._crit_edge95
  %96 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.3)
  br label %.loopexit

.loopexit:                                        ; preds = %95, %.preheader, %._crit_edge95.thread
  %97 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.4)
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %2) #7
  %98 = add nuw nsw i32 %.068104, 1
  %99 = load i32, ptr %1, align 4, !tbaa !8
  %100 = icmp slt i32 %98, %99
  br i1 %100, label %.lr.ph106, label %._crit_edge107, !llvm.loop !17
}

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: noreturn nounwind
declare void @__assert_fail(ptr noundef, ptr noundef, i32 noundef, ptr noundef) local_unnamed_addr #4

; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #5

; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i32 @llvm.smax.i32(i32, i32) #6

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 = { noreturn nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #5 = { nofree nounwind "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #6 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #7 = { nounwind }
attributes #8 = { noreturn nounwind }

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

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


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