; LLVM IR from Tunghohin/Competitive_Coding :: Codeforces (cf10_D)

; Unoptimized IR (clang -disable-llvm-passes):
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-i128:128-f80:128-n8:16:32:64-S128"
target triple = "x86_64-unknown-linux-gnu"

%"class.std::basic_ostream" = type { ptr, %"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_istream" = type { ptr, i64, %"class.std::basic_ios" }

@a = external dso_local global [510 x i32], align 16
@b = external dso_local global [510 x i32], align 16
@LCIS = external dso_local global [510 x [510 x i32]], align 16
@Path = external dso_local global [510 x [510 x i32]], align 16
@_ZSt4cout = external global %"class.std::basic_ostream", align 8
@_ZSt3cin = external global %"class.std::basic_istream", align 8

; Function Attrs: mustprogress uwtable
declare dso_local void @_Z6Outputii(i32 noundef, i32 noundef) #0

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

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

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

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

28:                                               ; preds = %24
  call void @llvm.lifetime.end.p0(i64 4, ptr %4) #6
  br label %37

29:                                               ; preds = %24
  %30 = load i32, ptr %4, align 4, !tbaa !8
  %31 = sext i32 %30 to i64
  %32 = getelementptr inbounds [510 x i32], ptr @a, i64 0, i64 %31
  %33 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERi(ptr noundef nonnull align 8 dereferenceable(16) @_ZSt3cin, ptr noundef nonnull align 4 dereferenceable(4) %32)
  br label %34

34:                                               ; preds = %29
  %35 = load i32, ptr %4, align 4, !tbaa !8
  %36 = add nsw i32 %35, 1
  store i32 %36, ptr %4, align 4, !tbaa !8
  br label %24, !llvm.loop !11

37:                                               ; preds = %28
  %38 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERi(ptr noundef nonnull align 8 dereferenceable(16) @_ZSt3cin, ptr noundef nonnull align 4 dereferenceable(4) %3)
  call void @llvm.lifetime.start.p0(i64 4, ptr %5) #6
  store i32 1, ptr %5, align 4, !tbaa !8
  br label %39

39:                                               ; preds = %49, %37
  %40 = load i32, ptr %5, align 4, !tbaa !8
  %41 = load i32, ptr %3, align 4, !tbaa !8
  %42 = icmp sle i32 %40, %41
  br i1 %42, label %44, label %43

43:                                               ; preds = %39
  call void @llvm.lifetime.end.p0(i64 4, ptr %5) #6
  br label %52

44:                                               ; preds = %39
  %45 = load i32, ptr %5, align 4, !tbaa !8
  %46 = sext i32 %45 to i64
  %47 = getelementptr inbounds [510 x i32], ptr @b, i64 0, i64 %46
  %48 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERi(ptr noundef nonnull align 8 dereferenceable(16) @_ZSt3cin, ptr noundef nonnull align 4 dereferenceable(4) %47)
  br label %49

49:                                               ; preds = %44
  %50 = load i32, ptr %5, align 4, !tbaa !8
  %51 = add nsw i32 %50, 1
  store i32 %51, ptr %5, align 4, !tbaa !8
  br label %39, !llvm.loop !13

52:                                               ; preds = %43
  call void @llvm.lifetime.start.p0(i64 4, ptr %6) #6
  store i32 1, ptr %6, align 4, !tbaa !8
  br label %53

53:                                               ; preds = %174, %52
  %54 = load i32, ptr %6, align 4, !tbaa !8
  %55 = load i32, ptr %2, align 4, !tbaa !8
  %56 = icmp sle i32 %54, %55
  br i1 %56, label %58, label %57

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

58:                                               ; preds = %53
  call void @llvm.lifetime.start.p0(i64 4, ptr %8) #6
  store i32 1, ptr %8, align 4, !tbaa !8
  br label %59

59:                                               ; preds = %170, %58
  %60 = load i32, ptr %8, align 4, !tbaa !8
  %61 = load i32, ptr %3, align 4, !tbaa !8
  %62 = icmp sle i32 %60, %61
  br i1 %62, label %64, label %63

63:                                               ; preds = %59
  store i32 11, ptr %7, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %8) #6
  br label %173

64:                                               ; preds = %59
  %65 = load i32, ptr %6, align 4, !tbaa !8
  %66 = sub nsw i32 %65, 1
  %67 = sext i32 %66 to i64
  %68 = getelementptr inbounds [510 x [510 x i32]], ptr @LCIS, i64 0, i64 %67
  %69 = load i32, ptr %8, align 4, !tbaa !8
  %70 = sext i32 %69 to i64
  %71 = getelementptr inbounds [510 x i32], ptr %68, i64 0, i64 %70
  %72 = load i32, ptr %71, align 4, !tbaa !8
  %73 = load i32, ptr %6, align 4, !tbaa !8
  %74 = sext i32 %73 to i64
  %75 = getelementptr inbounds [510 x [510 x i32]], ptr @LCIS, i64 0, i64 %74
  %76 = load i32, ptr %8, align 4, !tbaa !8
  %77 = sext i32 %76 to i64
  %78 = getelementptr inbounds [510 x i32], ptr %75, i64 0, i64 %77
  store i32 %72, ptr %78, align 4, !tbaa !8
  %79 = load i32, ptr %8, align 4, !tbaa !8
  %80 = load i32, ptr %6, align 4, !tbaa !8
  %81 = sext i32 %80 to i64
  %82 = getelementptr inbounds [510 x [510 x i32]], ptr @Path, i64 0, i64 %81
  %83 = load i32, ptr %8, align 4, !tbaa !8
  %84 = sext i32 %83 to i64
  %85 = getelementptr inbounds [510 x i32], ptr %82, i64 0, i64 %84
  store i32 %79, ptr %85, align 4, !tbaa !8
  %86 = load i32, ptr %6, align 4, !tbaa !8
  %87 = sext i32 %86 to i64
  %88 = getelementptr inbounds [510 x i32], ptr @a, i64 0, i64 %87
  %89 = load i32, ptr %88, align 4, !tbaa !8
  %90 = load i32, ptr %8, align 4, !tbaa !8
  %91 = sext i32 %90 to i64
  %92 = getelementptr inbounds [510 x i32], ptr @b, i64 0, i64 %91
  %93 = load i32, ptr %92, align 4, !tbaa !8
  %94 = icmp eq i32 %89, %93
  br i1 %94, label %95, label %169

95:                                               ; preds = %64
  %96 = load i32, ptr %6, align 4, !tbaa !8
  %97 = sext i32 %96 to i64
  %98 = getelementptr inbounds [510 x [510 x i32]], ptr @LCIS, i64 0, i64 %97
  %99 = load i32, ptr %8, align 4, !tbaa !8
  %100 = sext i32 %99 to i64
  %101 = getelementptr inbounds [510 x i32], ptr %98, i64 0, i64 %100
  store i32 1, ptr %101, align 4, !tbaa !8
  %102 = load i32, ptr %6, align 4, !tbaa !8
  %103 = sext i32 %102 to i64
  %104 = getelementptr inbounds [510 x [510 x i32]], ptr @Path, i64 0, i64 %103
  %105 = load i32, ptr %8, align 4, !tbaa !8
  %106 = sext i32 %105 to i64
  %107 = getelementptr inbounds [510 x i32], ptr %104, i64 0, i64 %106
  store i32 0, ptr %107, align 4, !tbaa !8
  call void @llvm.lifetime.start.p0(i64 4, ptr %9) #6
  store i32 1, ptr %9, align 4, !tbaa !8
  br label %108

108:                                              ; preds = %165, %95
  %109 = load i32, ptr %9, align 4, !tbaa !8
  %110 = load i32, ptr %8, align 4, !tbaa !8
  %111 = icmp slt i32 %109, %110
  br i1 %111, label %113, label %112

112:                                              ; preds = %108
  store i32 14, ptr %7, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %9) #6
  br label %168

113:                                              ; preds = %108
  %114 = load i32, ptr %9, align 4, !tbaa !8
  %115 = sext i32 %114 to i64
  %116 = getelementptr inbounds [510 x i32], ptr @b, i64 0, i64 %115
  %117 = load i32, ptr %116, align 4, !tbaa !8
  %118 = load i32, ptr %8, align 4, !tbaa !8
  %119 = sext i32 %118 to i64
  %120 = getelementptr inbounds [510 x i32], ptr @b, i64 0, i64 %119
  %121 = load i32, ptr %120, align 4, !tbaa !8
  %122 = icmp slt i32 %117, %121
  br i1 %122, label %123, label %164

123:                                              ; preds = %113
  %124 = load i32, ptr %6, align 4, !tbaa !8
  %125 = sub nsw i32 %124, 1
  %126 = sext i32 %125 to i64
  %127 = getelementptr inbounds [510 x [510 x i32]], ptr @LCIS, i64 0, i64 %126
  %128 = load i32, ptr %9, align 4, !tbaa !8
  %129 = sext i32 %128 to i64
  %130 = getelementptr inbounds [510 x i32], ptr %127, i64 0, i64 %129
  %131 = load i32, ptr %130, align 4, !tbaa !8
  %132 = add nsw i32 %131, 1
  %133 = load i32, ptr %6, align 4, !tbaa !8
  %134 = sext i32 %133 to i64
  %135 = getelementptr inbounds [510 x [510 x i32]], ptr @LCIS, i64 0, i64 %134
  %136 = load i32, ptr %8, align 4, !tbaa !8
  %137 = sext i32 %136 to i64
  %138 = getelementptr inbounds [510 x i32], ptr %135, i64 0, i64 %137
  %139 = load i32, ptr %138, align 4, !tbaa !8
  %140 = icmp sgt i32 %132, %139
  br i1 %140, label %141, label %164

141:                                              ; preds = %123
  %142 = load i32, ptr %6, align 4, !tbaa !8
  %143 = sub nsw i32 %142, 1
  %144 = sext i32 %143 to i64
  %145 = getelementptr inbounds [510 x [510 x i32]], ptr @LCIS, i64 0, i64 %144
  %146 = load i32, ptr %9, align 4, !tbaa !8
  %147 = sext i32 %146 to i64
  %148 = getelementptr inbounds [510 x i32], ptr %145, i64 0, i64 %147
  %149 = load i32, ptr %148, align 4, !tbaa !8
  %150 = add nsw i32 %149, 1
  %151 = load i32, ptr %6, align 4, !tbaa !8
  %152 = sext i32 %151 to i64
  %153 = getelementptr inbounds [510 x [510 x i32]], ptr @LCIS, i64 0, i64 %152
  %154 = load i32, ptr %8, align 4, !tbaa !8
  %155 = sext i32 %154 to i64
  %156 = getelementptr inbounds [510 x i32], ptr %153, i64 0, i64 %155
  store i32 %150, ptr %156, align 4, !tbaa !8
  %157 = load i32, ptr %9, align 4, !tbaa !8
  %158 = load i32, ptr %6, align 4, !tbaa !8
  %159 = sext i32 %158 to i64
  %160 = getelementptr inbounds [510 x [510 x i32]], ptr @Path, i64 0, i64 %159
  %161 = load i32, ptr %8, align 4, !tbaa !8
  %162 = sext i32 %161 to i64
  %163 = getelementptr inbounds [510 x i32], ptr %160, i64 0, i64 %162
  store i32 %157, ptr %163, align 4, !tbaa !8
  br label %164

164:                                              ; preds = %141, %123, %113
  br label %165

165:                                              ; preds = %164
  %166 = load i32, ptr %9, align 4, !tbaa !8
  %167 = add nsw i32 %166, 1
  store i32 %167, ptr %9, align 4, !tbaa !8
  br label %108, !llvm.loop !14

168:                                              ; preds = %112
  br label %169

169:                                              ; preds = %168, %64
  br label %170

170:                                              ; preds = %169
  %171 = load i32, ptr %8, align 4, !tbaa !8
  %172 = add nsw i32 %171, 1
  store i32 %172, ptr %8, align 4, !tbaa !8
  br label %59, !llvm.loop !15

173:                                              ; preds = %63
  br label %174

174:                                              ; preds = %173
  %175 = load i32, ptr %6, align 4, !tbaa !8
  %176 = add nsw i32 %175, 1
  store i32 %176, ptr %6, align 4, !tbaa !8
  br label %53, !llvm.loop !16

177:                                              ; preds = %57
  call void @llvm.lifetime.start.p0(i64 4, ptr %10) #6
  store i32 0, ptr %10, align 4, !tbaa !8
  call void @llvm.lifetime.start.p0(i64 4, ptr %11) #6
  store i32 1, ptr %11, align 4, !tbaa !8
  br label %178

178:                                              ; preds = %202, %177
  %179 = load i32, ptr %11, align 4, !tbaa !8
  %180 = load i32, ptr %3, align 4, !tbaa !8
  %181 = icmp sle i32 %179, %180
  br i1 %181, label %183, label %182

182:                                              ; preds = %178
  store i32 17, ptr %7, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %11) #6
  br label %205

183:                                              ; preds = %178
  %184 = load i32, ptr %2, align 4, !tbaa !8
  %185 = sext i32 %184 to i64
  %186 = getelementptr inbounds [510 x [510 x i32]], ptr @LCIS, i64 0, i64 %185
  %187 = load i32, ptr %10, align 4, !tbaa !8
  %188 = sext i32 %187 to i64
  %189 = getelementptr inbounds [510 x i32], ptr %186, i64 0, i64 %188
  %190 = load i32, ptr %189, align 4, !tbaa !8
  %191 = load i32, ptr %2, align 4, !tbaa !8
  %192 = sext i32 %191 to i64
  %193 = getelementptr inbounds [510 x [510 x i32]], ptr @LCIS, i64 0, i64 %192
  %194 = load i32, ptr %11, align 4, !tbaa !8
  %195 = sext i32 %194 to i64
  %196 = getelementptr inbounds [510 x i32], ptr %193, i64 0, i64 %195
  %197 = load i32, ptr %196, align 4, !tbaa !8
  %198 = icmp slt i32 %190, %197
  br i1 %198, label %199, label %201

199:                                              ; preds = %183
  %200 = load i32, ptr %11, align 4, !tbaa !8
  store i32 %200, ptr %10, align 4, !tbaa !8
  br label %201

201:                                              ; preds = %199, %183
  br label %202

202:                                              ; preds = %201
  %203 = load i32, ptr %11, align 4, !tbaa !8
  %204 = add nsw i32 %203, 1
  store i32 %204, ptr %11, align 4, !tbaa !8
  br label %178, !llvm.loop !17

205:                                              ; preds = %182
  %206 = load i32, ptr %2, align 4, !tbaa !8
  %207 = sext i32 %206 to i64
  %208 = getelementptr inbounds [510 x [510 x i32]], ptr @LCIS, i64 0, i64 %207
  %209 = load i32, ptr %10, align 4, !tbaa !8
  %210 = sext i32 %209 to i64
  %211 = getelementptr inbounds [510 x i32], ptr %208, i64 0, i64 %210
  %212 = load i32, ptr %211, align 4, !tbaa !8
  %213 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEi(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cout, i32 noundef %212)
  %214 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_c(ptr noundef nonnull align 8 dereferenceable(8) %213, i8 noundef signext 10)
  %215 = load i32, ptr %2, align 4, !tbaa !8
  %216 = sext i32 %215 to i64
  %217 = getelementptr inbounds [510 x [510 x i32]], ptr @LCIS, i64 0, i64 %216
  %218 = load i32, ptr %10, align 4, !tbaa !8
  %219 = sext i32 %218 to i64
  %220 = getelementptr inbounds [510 x i32], ptr %217, i64 0, i64 %219
  %221 = load i32, ptr %220, align 4, !tbaa !8
  %222 = icmp ne i32 %221, 0
  br i1 %222, label %223, label %226

223:                                              ; preds = %205
  %224 = load i32, ptr %2, align 4, !tbaa !8
  %225 = load i32, ptr %10, align 4, !tbaa !8
  call void @_Z6Outputii(i32 noundef %224, i32 noundef %225)
  br label %226

226:                                              ; preds = %223, %205
  store i32 0, ptr %1, align 4
  store i32 1, ptr %7, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %10) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr %3) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr %2) #6
  %227 = load i32, ptr %1, align 4
  ret i32 %227
}

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

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

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

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

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

attributes #0 = { mustprogress uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { 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 #2 = { "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 norecurse uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { 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 #5 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
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 = !{!"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 = distinct !{!15, !12}
!16 = distinct !{!16, !12}
!17 = distinct !{!17, !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_ostream" = type { ptr, %"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_istream" = type { ptr, i64, %"class.std::basic_ios" }

@a = external dso_local global [510 x i32], align 16
@b = external dso_local global [510 x i32], align 16
@LCIS = external dso_local local_unnamed_addr global [510 x [510 x i32]], align 16
@Path = external dso_local local_unnamed_addr global [510 x [510 x i32]], align 16
@_ZSt4cout = external global %"class.std::basic_ostream", align 8
@_ZSt3cin = external global %"class.std::basic_istream", align 8

; Function Attrs: mustprogress uwtable
declare dso_local void @_Z6Outputii(i32 noundef, i32 noundef) local_unnamed_addr #0

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

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

; Function Attrs: mustprogress norecurse uwtable
define dso_local noundef i32 @main() local_unnamed_addr #3 {
  %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)
  %9 = load ptr, ptr @_ZSt4cout, align 8, !tbaa !5
  %10 = getelementptr i8, ptr %9, i64 -24
  %11 = load i64, ptr %10, align 8
  %12 = getelementptr inbounds i8, ptr @_ZSt4cout, i64 %11
  %13 = tail call noundef ptr @_ZNSt9basic_iosIcSt11char_traitsIcEE3tieEPSo(ptr noundef nonnull align 8 dereferenceable(264) %12, ptr noundef null)
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %1) #6
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %2) #6
  %14 = 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)
  %15 = load i32, ptr %1, align 4, !tbaa !8
  %.not64 = icmp slt i32 %15, 1
  br i1 %.not64, label %._crit_edge, label %.lr.ph

._crit_edge:                                      ; preds = %.lr.ph, %0
  %16 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERi(ptr noundef nonnull align 8 dereferenceable(16) @_ZSt3cin, ptr noundef nonnull align 4 dereferenceable(4) %2)
  %17 = load i32, ptr %2, align 4, !tbaa !8
  %.not5566 = icmp slt i32 %17, 1
  br i1 %.not5566, label %.preheader62, label %.lr.ph69

.lr.ph:                                           ; preds = %0, %.lr.ph
  %indvars.iv = phi i64 [ %indvars.iv.next, %.lr.ph ], [ 1, %0 ]
  %18 = getelementptr inbounds [510 x i32], ptr @a, 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 %1, align 4, !tbaa !8
  %21 = sext i32 %20 to i64
  %.not.not = icmp slt i64 %indvars.iv, %21
  br i1 %.not.not, label %.lr.ph, label %._crit_edge, !llvm.loop !11

.preheader62:                                     ; preds = %.lr.ph69, %._crit_edge
  %.lcssa63 = phi i32 [ %17, %._crit_edge ], [ %27, %.lr.ph69 ]
  %22 = load i32, ptr %1, align 4, !tbaa !8
  %.not5678 = icmp slt i32 %22, 1
  br i1 %.not5678, label %.preheader, label %.preheader61.lr.ph

.preheader61.lr.ph:                               ; preds = %.preheader62
  %.not5973 = icmp slt i32 %.lcssa63, 1
  br i1 %.not5973, label %.preheader.._crit_edge85_crit_edge, label %.preheader61.preheader

.preheader61.preheader:                           ; preds = %.preheader61.lr.ph
  %23 = add nuw i32 %.lcssa63, 1
  %24 = add nuw i32 %22, 1
  %wide.trip.count = zext i32 %24 to i64
  %wide.trip.count98 = zext i32 %23 to i64
  br label %.preheader61

.lr.ph69:                                         ; preds = %._crit_edge, %.lr.ph69
  %indvars.iv89 = phi i64 [ %indvars.iv.next90, %.lr.ph69 ], [ 1, %._crit_edge ]
  %25 = getelementptr inbounds [510 x i32], ptr @b, i64 0, i64 %indvars.iv89
  %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.next90 = add nuw nsw i64 %indvars.iv89, 1
  %27 = load i32, ptr %2, align 4, !tbaa !8
  %28 = sext i32 %27 to i64
  %.not55.not = icmp slt i64 %indvars.iv89, %28
  br i1 %.not55.not, label %.lr.ph69, label %.preheader62, !llvm.loop !13

.preheader61:                                     ; preds = %.preheader61.preheader, %._crit_edge77
  %indvars.iv100 = phi i64 [ 1, %.preheader61.preheader ], [ %indvars.iv.next101, %._crit_edge77 ]
  %29 = add nsw i64 %indvars.iv100, -1
  %30 = getelementptr inbounds [510 x i32], ptr @a, i64 0, i64 %indvars.iv100
  %31 = load i32, ptr %30, align 4, !tbaa !8
  br label %35

.preheader:                                       ; preds = %._crit_edge77, %.preheader62
  %.not5781 = icmp slt i32 %.lcssa63, 1
  br i1 %.not5781, label %.preheader.._crit_edge85_crit_edge, label %.lr.ph84

.preheader.._crit_edge85_crit_edge:               ; preds = %.preheader61.lr.ph, %.preheader
  %.pre = sext i32 %22 to i64
  br label %._crit_edge85

.lr.ph84:                                         ; preds = %.preheader
  %32 = sext i32 %22 to i64
  %33 = zext nneg i32 %.lcssa63 to i64
  %xtraiter = and i64 %33, 1
  %34 = icmp eq i32 %.lcssa63, 1
  br i1 %34, label %._crit_edge85.loopexit.unr-lcssa, label %.lr.ph84.new

.lr.ph84.new:                                     ; preds = %.lr.ph84
  %unroll_iter = and i64 %33, 2147483646
  br label %74

._crit_edge77:                                    ; preds = %.loopexit
  %indvars.iv.next101 = add nuw nsw i64 %indvars.iv100, 1
  %exitcond103.not = icmp eq i64 %indvars.iv.next101, %wide.trip.count
  br i1 %exitcond103.not, label %.preheader, label %.preheader61, !llvm.loop !14

35:                                               ; preds = %.preheader61, %.loopexit
  %indvars.iv95 = phi i64 [ 1, %.preheader61 ], [ %indvars.iv.next96, %.loopexit ]
  %36 = getelementptr inbounds [510 x [510 x i32]], ptr @LCIS, i64 0, i64 %29, i64 %indvars.iv95
  %37 = load i32, ptr %36, align 4, !tbaa !8
  %38 = getelementptr inbounds [510 x [510 x i32]], ptr @LCIS, i64 0, i64 %indvars.iv100, i64 %indvars.iv95
  store i32 %37, ptr %38, align 4, !tbaa !8
  %39 = getelementptr inbounds [510 x [510 x i32]], ptr @Path, i64 0, i64 %indvars.iv100, i64 %indvars.iv95
  %40 = trunc nuw nsw i64 %indvars.iv95 to i32
  store i32 %40, ptr %39, align 4, !tbaa !8
  %41 = getelementptr inbounds [510 x i32], ptr @b, i64 0, i64 %indvars.iv95
  %42 = load i32, ptr %41, align 4, !tbaa !8
  %43 = icmp eq i32 %31, %42
  br i1 %43, label %44, label %.loopexit

44:                                               ; preds = %35
  store i32 1, ptr %38, align 4, !tbaa !8
  store i32 0, ptr %39, align 4, !tbaa !8
  %45 = icmp ugt i64 %indvars.iv95, 1
  br i1 %45, label %.lr.ph72, label %.loopexit

.lr.ph72:                                         ; preds = %44, %56
  %46 = phi i32 [ %57, %56 ], [ 1, %44 ]
  %indvars.iv92 = phi i64 [ %indvars.iv.next93, %56 ], [ 1, %44 ]
  %47 = getelementptr inbounds [510 x i32], ptr @b, i64 0, i64 %indvars.iv92
  %48 = load i32, ptr %47, align 4, !tbaa !8
  %49 = icmp slt i32 %48, %31
  br i1 %49, label %50, label %56

50:                                               ; preds = %.lr.ph72
  %51 = getelementptr inbounds [510 x [510 x i32]], ptr @LCIS, i64 0, i64 %29, i64 %indvars.iv92
  %52 = load i32, ptr %51, align 4, !tbaa !8
  %.not60 = icmp slt i32 %52, %46
  br i1 %.not60, label %56, label %53

53:                                               ; preds = %50
  %54 = add nsw i32 %52, 1
  store i32 %54, ptr %38, align 4, !tbaa !8
  %55 = trunc nuw nsw i64 %indvars.iv92 to i32
  store i32 %55, ptr %39, align 4, !tbaa !8
  br label %56

56:                                               ; preds = %.lr.ph72, %50, %53
  %57 = phi i32 [ %46, %.lr.ph72 ], [ %46, %50 ], [ %54, %53 ]
  %indvars.iv.next93 = add nuw nsw i64 %indvars.iv92, 1
  %exitcond.not = icmp eq i64 %indvars.iv.next93, %indvars.iv95
  br i1 %exitcond.not, label %.loopexit, label %.lr.ph72, !llvm.loop !15

.loopexit:                                        ; preds = %56, %44, %35
  %indvars.iv.next96 = add nuw nsw i64 %indvars.iv95, 1
  %exitcond99.not = icmp eq i64 %indvars.iv.next96, %wide.trip.count98
  br i1 %exitcond99.not, label %._crit_edge77, label %35, !llvm.loop !16

._crit_edge85.loopexit.unr-lcssa:                 ; preds = %74, %.lr.ph84
  %spec.select.lcssa.ph = phi i32 [ poison, %.lr.ph84 ], [ %spec.select.1, %74 ]
  %indvars.iv104.unr = phi i64 [ 1, %.lr.ph84 ], [ %indvars.iv.next105.1, %74 ]
  %.04882.unr = phi i32 [ 0, %.lr.ph84 ], [ %spec.select.1, %74 ]
  %lcmp.mod.not = icmp eq i64 %xtraiter, 0
  br i1 %lcmp.mod.not, label %._crit_edge85, label %._crit_edge85.loopexit.epilog-lcssa

._crit_edge85.loopexit.epilog-lcssa:              ; preds = %._crit_edge85.loopexit.unr-lcssa
  %58 = sext i32 %.04882.unr to i64
  %59 = getelementptr inbounds [510 x [510 x i32]], ptr @LCIS, i64 0, i64 %32, i64 %58
  %60 = load i32, ptr %59, align 4, !tbaa !8
  %61 = getelementptr inbounds [510 x [510 x i32]], ptr @LCIS, i64 0, i64 %32, i64 %indvars.iv104.unr
  %62 = load i32, ptr %61, align 4, !tbaa !8
  %63 = icmp slt i32 %60, %62
  %64 = trunc nuw nsw i64 %indvars.iv104.unr to i32
  %spec.select.epil = select i1 %63, i32 %64, i32 %.04882.unr
  br label %._crit_edge85

._crit_edge85:                                    ; preds = %._crit_edge85.loopexit.epilog-lcssa, %._crit_edge85.loopexit.unr-lcssa, %.preheader.._crit_edge85_crit_edge
  %.pre-phi = phi i64 [ %.pre, %.preheader.._crit_edge85_crit_edge ], [ %32, %._crit_edge85.loopexit.unr-lcssa ], [ %32, %._crit_edge85.loopexit.epilog-lcssa ]
  %.048.lcssa = phi i32 [ 0, %.preheader.._crit_edge85_crit_edge ], [ %spec.select.lcssa.ph, %._crit_edge85.loopexit.unr-lcssa ], [ %spec.select.epil, %._crit_edge85.loopexit.epilog-lcssa ]
  %65 = sext i32 %.048.lcssa to i64
  %66 = getelementptr inbounds [510 x [510 x i32]], ptr @LCIS, i64 0, i64 %.pre-phi, i64 %65
  %67 = load i32, ptr %66, align 4, !tbaa !8
  %68 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEi(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cout, i32 noundef %67)
  %69 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_c(ptr noundef nonnull align 8 dereferenceable(8) %68, i8 noundef signext 10)
  %70 = load i32, ptr %1, align 4, !tbaa !8
  %71 = sext i32 %70 to i64
  %72 = getelementptr inbounds [510 x [510 x i32]], ptr @LCIS, i64 0, i64 %71, i64 %65
  %73 = load i32, ptr %72, align 4, !tbaa !8
  %.not58 = icmp eq i32 %73, 0
  br i1 %.not58, label %90, label %89

74:                                               ; preds = %74, %.lr.ph84.new
  %indvars.iv104 = phi i64 [ 1, %.lr.ph84.new ], [ %indvars.iv.next105.1, %74 ]
  %.04882 = phi i32 [ 0, %.lr.ph84.new ], [ %spec.select.1, %74 ]
  %niter = phi i64 [ 0, %.lr.ph84.new ], [ %niter.next.1, %74 ]
  %75 = sext i32 %.04882 to i64
  %76 = getelementptr inbounds [510 x [510 x i32]], ptr @LCIS, i64 0, i64 %32, i64 %75
  %77 = load i32, ptr %76, align 4, !tbaa !8
  %78 = getelementptr inbounds [510 x [510 x i32]], ptr @LCIS, i64 0, i64 %32, i64 %indvars.iv104
  %79 = load i32, ptr %78, align 4, !tbaa !8
  %80 = icmp slt i32 %77, %79
  %81 = trunc nuw nsw i64 %indvars.iv104 to i32
  %spec.select = select i1 %80, i32 %81, i32 %.04882
  %indvars.iv.next105 = add nuw nsw i64 %indvars.iv104, 1
  %82 = sext i32 %spec.select to i64
  %83 = getelementptr inbounds [510 x [510 x i32]], ptr @LCIS, i64 0, i64 %32, i64 %82
  %84 = load i32, ptr %83, align 4, !tbaa !8
  %85 = getelementptr inbounds [510 x [510 x i32]], ptr @LCIS, i64 0, i64 %32, i64 %indvars.iv.next105
  %86 = load i32, ptr %85, align 4, !tbaa !8
  %87 = icmp slt i32 %84, %86
  %88 = trunc nuw nsw i64 %indvars.iv.next105 to i32
  %spec.select.1 = select i1 %87, i32 %88, i32 %spec.select
  %indvars.iv.next105.1 = add nuw nsw i64 %indvars.iv104, 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_edge85.loopexit.unr-lcssa, label %74, !llvm.loop !17

89:                                               ; preds = %._crit_edge85
  call void @_Z6Outputii(i32 noundef %70, i32 noundef %.048.lcssa)
  br label %90

90:                                               ; preds = %89, %._crit_edge85
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %2) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %1) #6
  ret i32 0
}

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

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

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

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

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

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


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