; LLVM IR from Tunghohin/Competitive_Coding :: Luogu (p1006)

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

@mp = external dso_local global [52 x [52 x i32]], align 16
@dp = external dso_local global [104 x [52 x [52 x i32]]], align 16
@_ZSt3cin = external global %"class.std::basic_istream", align 8
@_ZSt4cout = external global %"class.std::basic_ostream", align 8

; 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 ptr, align 8
  %14 = alloca i32, align 4
  %15 = alloca i32, align 4
  %16 = alloca i32, align 4
  %17 = alloca i32, align 4
  store i32 0, ptr %1, align 4
  %18 = call noundef zeroext i1 @_ZNSt8ios_base15sync_with_stdioEb(i1 noundef zeroext false)
  %19 = load ptr, ptr @_ZSt3cin, align 8, !tbaa !5
  %20 = getelementptr i8, ptr %19, i64 -24
  %21 = load i64, ptr %20, align 8
  %22 = getelementptr inbounds i8, ptr @_ZSt3cin, i64 %21
  %23 = call noundef ptr @_ZNSt9basic_iosIcSt11char_traitsIcEE3tieEPSo(ptr noundef nonnull align 8 dereferenceable(264) %22, ptr noundef null)
  %24 = load ptr, ptr @_ZSt4cout, align 8, !tbaa !5
  %25 = getelementptr i8, ptr %24, i64 -24
  %26 = load i64, ptr %25, align 8
  %27 = getelementptr inbounds i8, ptr @_ZSt4cout, i64 %26
  %28 = call noundef ptr @_ZNSt9basic_iosIcSt11char_traitsIcEE3tieEPSo(ptr noundef nonnull align 8 dereferenceable(264) %27, ptr noundef null)
  call void @llvm.lifetime.start.p0(i64 4, ptr %2) #5
  call void @llvm.lifetime.start.p0(i64 4, ptr %3) #5
  %29 = 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)
  %30 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERi(ptr noundef nonnull align 8 dereferenceable(16) %29, ptr noundef nonnull align 4 dereferenceable(4) %3)
  call void @llvm.lifetime.start.p0(i64 4, ptr %4) #5
  store i32 1, ptr %4, align 4, !tbaa !8
  br label %31

31:                                               ; preds = %54, %0
  %32 = load i32, ptr %4, align 4, !tbaa !8
  %33 = load i32, ptr %2, align 4, !tbaa !8
  %34 = icmp sle i32 %32, %33
  br i1 %34, label %36, label %35

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

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

37:                                               ; preds = %50, %36
  %38 = load i32, ptr %6, align 4, !tbaa !8
  %39 = load i32, ptr %3, align 4, !tbaa !8
  %40 = icmp sle i32 %38, %39
  br i1 %40, label %42, label %41

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

42:                                               ; preds = %37
  %43 = load i32, ptr %4, align 4, !tbaa !8
  %44 = sext i32 %43 to i64
  %45 = getelementptr inbounds [52 x [52 x i32]], ptr @mp, i64 0, i64 %44
  %46 = load i32, ptr %6, align 4, !tbaa !8
  %47 = sext i32 %46 to i64
  %48 = getelementptr inbounds [52 x i32], ptr %45, i64 0, i64 %47
  %49 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERi(ptr noundef nonnull align 8 dereferenceable(16) @_ZSt3cin, ptr noundef nonnull align 4 dereferenceable(4) %48)
  br label %50

50:                                               ; preds = %42
  %51 = load i32, ptr %6, align 4, !tbaa !8
  %52 = add nsw i32 %51, 1
  store i32 %52, ptr %6, align 4, !tbaa !8
  br label %37, !llvm.loop !11

53:                                               ; preds = %41
  br label %54

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

57:                                               ; preds = %35
  call void @llvm.lifetime.start.p0(i64 4, ptr %7) #5
  store i32 2, ptr %7, align 4, !tbaa !8
  br label %58

58:                                               ; preds = %209, %57
  %59 = load i32, ptr %7, align 4, !tbaa !8
  %60 = load i32, ptr %3, align 4, !tbaa !8
  %61 = load i32, ptr %2, align 4, !tbaa !8
  %62 = add nsw i32 %60, %61
  %63 = icmp sle i32 %59, %62
  br i1 %63, label %65, label %64

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

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

66:                                               ; preds = %205, %65
  %67 = load i32, ptr %8, align 4, !tbaa !8
  %68 = load i32, ptr %2, align 4, !tbaa !8
  %69 = icmp sle i32 %67, %68
  br i1 %69, label %71, label %70

70:                                               ; preds = %66
  store i32 11, ptr %5, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %8) #5
  br label %208

71:                                               ; preds = %66
  call void @llvm.lifetime.start.p0(i64 4, ptr %9) #5
  store i32 1, ptr %9, align 4, !tbaa !8
  br label %72

72:                                               ; preds = %201, %71
  %73 = load i32, ptr %9, align 4, !tbaa !8
  %74 = load i32, ptr %2, align 4, !tbaa !8
  %75 = icmp sle i32 %73, %74
  br i1 %75, label %77, label %76

76:                                               ; preds = %72
  store i32 14, ptr %5, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %9) #5
  br label %204

77:                                               ; preds = %72
  call void @llvm.lifetime.start.p0(i64 4, ptr %10) #5
  %78 = load i32, ptr %7, align 4, !tbaa !8
  %79 = load i32, ptr %8, align 4, !tbaa !8
  %80 = sub nsw i32 %78, %79
  store i32 %80, ptr %10, align 4, !tbaa !8
  call void @llvm.lifetime.start.p0(i64 4, ptr %11) #5
  %81 = load i32, ptr %7, align 4, !tbaa !8
  %82 = load i32, ptr %9, align 4, !tbaa !8
  %83 = sub nsw i32 %81, %82
  store i32 %83, ptr %11, align 4, !tbaa !8
  %84 = load i32, ptr %10, align 4, !tbaa !8
  %85 = icmp sge i32 %84, 1
  br i1 %85, label %86, label %200

86:                                               ; preds = %77
  %87 = load i32, ptr %10, align 4, !tbaa !8
  %88 = load i32, ptr %3, align 4, !tbaa !8
  %89 = icmp sle i32 %87, %88
  br i1 %89, label %90, label %200

90:                                               ; preds = %86
  %91 = load i32, ptr %11, align 4, !tbaa !8
  %92 = icmp sge i32 %91, 1
  br i1 %92, label %93, label %200

93:                                               ; preds = %90
  %94 = load i32, ptr %11, align 4, !tbaa !8
  %95 = load i32, ptr %3, align 4, !tbaa !8
  %96 = icmp sle i32 %94, %95
  br i1 %96, label %97, label %200

97:                                               ; preds = %93
  call void @llvm.lifetime.start.p0(i64 4, ptr %12) #5
  %98 = load i32, ptr %8, align 4, !tbaa !8
  %99 = sext i32 %98 to i64
  %100 = getelementptr inbounds [52 x [52 x i32]], ptr @mp, i64 0, i64 %99
  %101 = load i32, ptr %10, align 4, !tbaa !8
  %102 = sext i32 %101 to i64
  %103 = getelementptr inbounds [52 x i32], ptr %100, i64 0, i64 %102
  %104 = load i32, ptr %103, align 4, !tbaa !8
  store i32 %104, ptr %12, align 4, !tbaa !8
  %105 = load i32, ptr %8, align 4, !tbaa !8
  %106 = load i32, ptr %9, align 4, !tbaa !8
  %107 = icmp ne i32 %105, %106
  br i1 %107, label %108, label %118

108:                                              ; preds = %97
  %109 = load i32, ptr %9, align 4, !tbaa !8
  %110 = sext i32 %109 to i64
  %111 = getelementptr inbounds [52 x [52 x i32]], ptr @mp, i64 0, i64 %110
  %112 = load i32, ptr %11, align 4, !tbaa !8
  %113 = sext i32 %112 to i64
  %114 = getelementptr inbounds [52 x i32], ptr %111, i64 0, i64 %113
  %115 = load i32, ptr %114, align 4, !tbaa !8
  %116 = load i32, ptr %12, align 4, !tbaa !8
  %117 = add nsw i32 %116, %115
  store i32 %117, ptr %12, align 4, !tbaa !8
  br label %118

118:                                              ; preds = %108, %97
  call void @llvm.lifetime.start.p0(i64 8, ptr %13) #5
  %119 = load i32, ptr %7, align 4, !tbaa !8
  %120 = sext i32 %119 to i64
  %121 = getelementptr inbounds [104 x [52 x [52 x i32]]], ptr @dp, i64 0, i64 %120
  %122 = load i32, ptr %8, align 4, !tbaa !8
  %123 = sext i32 %122 to i64
  %124 = getelementptr inbounds [52 x [52 x i32]], ptr %121, i64 0, i64 %123
  %125 = load i32, ptr %9, align 4, !tbaa !8
  %126 = sext i32 %125 to i64
  %127 = getelementptr inbounds [52 x i32], ptr %124, i64 0, i64 %126
  store ptr %127, ptr %13, align 8, !tbaa !14
  %128 = load ptr, ptr %13, align 8, !tbaa !14
  call void @llvm.lifetime.start.p0(i64 4, ptr %14) #5
  %129 = load i32, ptr %7, align 4, !tbaa !8
  %130 = sub nsw i32 %129, 1
  %131 = sext i32 %130 to i64
  %132 = getelementptr inbounds [104 x [52 x [52 x i32]]], ptr @dp, i64 0, i64 %131
  %133 = load i32, ptr %8, align 4, !tbaa !8
  %134 = sub nsw i32 %133, 1
  %135 = sext i32 %134 to i64
  %136 = getelementptr inbounds [52 x [52 x i32]], ptr %132, i64 0, i64 %135
  %137 = load i32, ptr %9, align 4, !tbaa !8
  %138 = sext i32 %137 to i64
  %139 = getelementptr inbounds [52 x i32], ptr %136, i64 0, i64 %138
  %140 = load i32, ptr %139, align 4, !tbaa !8
  %141 = load i32, ptr %12, align 4, !tbaa !8
  %142 = add nsw i32 %140, %141
  store i32 %142, ptr %14, align 4, !tbaa !8
  %143 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZSt3maxIiERKT_S2_S2_(ptr noundef nonnull align 4 dereferenceable(4) %128, ptr noundef nonnull align 4 dereferenceable(4) %14)
  %144 = load i32, ptr %143, align 4, !tbaa !8
  %145 = load ptr, ptr %13, align 8, !tbaa !14
  store i32 %144, ptr %145, align 4, !tbaa !8
  call void @llvm.lifetime.end.p0(i64 4, ptr %14) #5
  %146 = load ptr, ptr %13, align 8, !tbaa !14
  call void @llvm.lifetime.start.p0(i64 4, ptr %15) #5
  %147 = load i32, ptr %7, align 4, !tbaa !8
  %148 = sub nsw i32 %147, 1
  %149 = sext i32 %148 to i64
  %150 = getelementptr inbounds [104 x [52 x [52 x i32]]], ptr @dp, i64 0, i64 %149
  %151 = load i32, ptr %8, align 4, !tbaa !8
  %152 = sub nsw i32 %151, 1
  %153 = sext i32 %152 to i64
  %154 = getelementptr inbounds [52 x [52 x i32]], ptr %150, i64 0, i64 %153
  %155 = load i32, ptr %9, align 4, !tbaa !8
  %156 = sub nsw i32 %155, 1
  %157 = sext i32 %156 to i64
  %158 = getelementptr inbounds [52 x i32], ptr %154, i64 0, i64 %157
  %159 = load i32, ptr %158, align 4, !tbaa !8
  %160 = load i32, ptr %12, align 4, !tbaa !8
  %161 = add nsw i32 %159, %160
  store i32 %161, ptr %15, align 4, !tbaa !8
  %162 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZSt3maxIiERKT_S2_S2_(ptr noundef nonnull align 4 dereferenceable(4) %146, ptr noundef nonnull align 4 dereferenceable(4) %15)
  %163 = load i32, ptr %162, align 4, !tbaa !8
  %164 = load ptr, ptr %13, align 8, !tbaa !14
  store i32 %163, ptr %164, align 4, !tbaa !8
  call void @llvm.lifetime.end.p0(i64 4, ptr %15) #5
  %165 = load ptr, ptr %13, align 8, !tbaa !14
  call void @llvm.lifetime.start.p0(i64 4, ptr %16) #5
  %166 = load i32, ptr %7, align 4, !tbaa !8
  %167 = sub nsw i32 %166, 1
  %168 = sext i32 %167 to i64
  %169 = getelementptr inbounds [104 x [52 x [52 x i32]]], ptr @dp, i64 0, i64 %168
  %170 = load i32, ptr %8, align 4, !tbaa !8
  %171 = sext i32 %170 to i64
  %172 = getelementptr inbounds [52 x [52 x i32]], ptr %169, i64 0, i64 %171
  %173 = load i32, ptr %9, align 4, !tbaa !8
  %174 = sub nsw i32 %173, 1
  %175 = sext i32 %174 to i64
  %176 = getelementptr inbounds [52 x i32], ptr %172, i64 0, i64 %175
  %177 = load i32, ptr %176, align 4, !tbaa !8
  %178 = load i32, ptr %12, align 4, !tbaa !8
  %179 = add nsw i32 %177, %178
  store i32 %179, ptr %16, align 4, !tbaa !8
  %180 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZSt3maxIiERKT_S2_S2_(ptr noundef nonnull align 4 dereferenceable(4) %165, ptr noundef nonnull align 4 dereferenceable(4) %16)
  %181 = load i32, ptr %180, align 4, !tbaa !8
  %182 = load ptr, ptr %13, align 8, !tbaa !14
  store i32 %181, ptr %182, align 4, !tbaa !8
  call void @llvm.lifetime.end.p0(i64 4, ptr %16) #5
  %183 = load ptr, ptr %13, align 8, !tbaa !14
  call void @llvm.lifetime.start.p0(i64 4, ptr %17) #5
  %184 = load i32, ptr %7, align 4, !tbaa !8
  %185 = sub nsw i32 %184, 1
  %186 = sext i32 %185 to i64
  %187 = getelementptr inbounds [104 x [52 x [52 x i32]]], ptr @dp, i64 0, i64 %186
  %188 = load i32, ptr %8, align 4, !tbaa !8
  %189 = sext i32 %188 to i64
  %190 = getelementptr inbounds [52 x [52 x i32]], ptr %187, i64 0, i64 %189
  %191 = load i32, ptr %9, align 4, !tbaa !8
  %192 = sext i32 %191 to i64
  %193 = getelementptr inbounds [52 x i32], ptr %190, i64 0, i64 %192
  %194 = load i32, ptr %193, align 4, !tbaa !8
  %195 = load i32, ptr %12, align 4, !tbaa !8
  %196 = add nsw i32 %194, %195
  store i32 %196, ptr %17, align 4, !tbaa !8
  %197 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZSt3maxIiERKT_S2_S2_(ptr noundef nonnull align 4 dereferenceable(4) %183, ptr noundef nonnull align 4 dereferenceable(4) %17)
  %198 = load i32, ptr %197, align 4, !tbaa !8
  %199 = load ptr, ptr %13, align 8, !tbaa !14
  store i32 %198, ptr %199, align 4, !tbaa !8
  call void @llvm.lifetime.end.p0(i64 4, ptr %17) #5
  call void @llvm.lifetime.end.p0(i64 8, ptr %13) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %12) #5
  br label %200

200:                                              ; preds = %118, %93, %90, %86, %77
  call void @llvm.lifetime.end.p0(i64 4, ptr %11) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %10) #5
  br label %201

201:                                              ; preds = %200
  %202 = load i32, ptr %9, align 4, !tbaa !8
  %203 = add nsw i32 %202, 1
  store i32 %203, ptr %9, align 4, !tbaa !8
  br label %72, !llvm.loop !16

204:                                              ; preds = %76
  br label %205

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

208:                                              ; preds = %70
  br label %209

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

212:                                              ; preds = %64
  %213 = load i32, ptr %2, align 4, !tbaa !8
  %214 = load i32, ptr %3, align 4, !tbaa !8
  %215 = add nsw i32 %213, %214
  %216 = sext i32 %215 to i64
  %217 = getelementptr inbounds [104 x [52 x [52 x i32]]], ptr @dp, i64 0, i64 %216
  %218 = load i32, ptr %2, align 4, !tbaa !8
  %219 = sext i32 %218 to i64
  %220 = getelementptr inbounds [52 x [52 x i32]], ptr %217, i64 0, i64 %219
  %221 = load i32, ptr %2, align 4, !tbaa !8
  %222 = sext i32 %221 to i64
  %223 = getelementptr inbounds [52 x i32], ptr %220, i64 0, i64 %222
  %224 = load i32, ptr %223, align 4, !tbaa !8
  %225 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEi(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cout, i32 noundef %224)
  store i32 0, ptr %1, align 4
  store i32 1, ptr %5, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %3) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr %2) #5
  %226 = load i32, ptr %1, align 4
  ret i32 %226
}

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 nounwind uwtable
declare dso_local noundef nonnull align 4 dereferenceable(4) ptr @_ZSt3maxIiERKT_S2_S2_(ptr noundef nonnull align 4 dereferenceable(4), ptr noundef nonnull align 4 dereferenceable(4)) #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 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 = { 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 = !{!"any pointer", !10, i64 0}
!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 }
%"class.std::basic_ostream" = type { ptr, %"class.std::basic_ios" }

@mp = external dso_local global [52 x [52 x i32]], align 16
@dp = external dso_local global [104 x [52 x [52 x i32]]], align 16
@_ZSt3cin = external global %"class.std::basic_istream", align 8
@_ZSt4cout = external global %"class.std::basic_ostream", align 8

; 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 = alloca i32, align 4
  %5 = alloca i32, align 4
  %6 = alloca i32, align 4
  %7 = tail call noundef zeroext i1 @_ZNSt8ios_base15sync_with_stdioEb(i1 noundef zeroext false)
  %8 = load ptr, ptr @_ZSt3cin, align 8, !tbaa !5
  %9 = getelementptr i8, ptr %8, i64 -24
  %10 = load i64, ptr %9, align 8
  %11 = getelementptr inbounds i8, ptr @_ZSt3cin, i64 %10
  %12 = tail call noundef ptr @_ZNSt9basic_iosIcSt11char_traitsIcEE3tieEPSo(ptr noundef nonnull align 8 dereferenceable(264) %11, ptr noundef null)
  %13 = load ptr, ptr @_ZSt4cout, align 8, !tbaa !5
  %14 = getelementptr i8, ptr %13, i64 -24
  %15 = load i64, ptr %14, align 8
  %16 = getelementptr inbounds i8, ptr @_ZSt4cout, i64 %15
  %17 = tail call noundef ptr @_ZNSt9basic_iosIcSt11char_traitsIcEE3tieEPSo(ptr noundef nonnull align 8 dereferenceable(264) %16, ptr noundef null)
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %1) #5
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %2) #5
  %18 = 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)
  %19 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERi(ptr noundef nonnull align 8 dereferenceable(16) %18, ptr noundef nonnull align 4 dereferenceable(4) %2)
  %20 = load i32, ptr %1, align 4, !tbaa !8
  %.not80 = icmp slt i32 %20, 1
  %.pre115 = load i32, ptr %2, align 4, !tbaa !8
  %21 = icmp slt i32 %.pre115, 1
  %or.cond = select i1 %.not80, i1 true, i1 %21
  br i1 %or.cond, label %.preheader75, label %.preheader76

.preheader76:                                     ; preds = %0, %._crit_edge
  %22 = phi i32 [ %28, %._crit_edge ], [ %20, %0 ]
  %23 = phi i32 [ %29, %._crit_edge ], [ %.pre115, %0 ]
  %indvars.iv103 = phi i64 [ %indvars.iv.next104, %._crit_edge ], [ 1, %0 ]
  %.not6978 = icmp slt i32 %23, 1
  br i1 %.not6978, label %._crit_edge, label %.lr.ph

.preheader75:                                     ; preds = %._crit_edge, %0
  %24 = phi i32 [ %20, %0 ], [ %28, %._crit_edge ]
  %25 = phi i32 [ %.pre115, %0 ], [ %29, %._crit_edge ]
  %26 = add nsw i32 %24, %25
  %.not6490 = icmp slt i32 %26, 2
  %27 = icmp slt i32 %24, 1
  %or.cond126 = or i1 %.not6490, %27
  br i1 %or.cond126, label %._crit_edge93, label %.preheader74

._crit_edge.loopexit:                             ; preds = %.lr.ph
  %.pre = load i32, ptr %1, align 4, !tbaa !8
  br label %._crit_edge

._crit_edge:                                      ; preds = %._crit_edge.loopexit, %.preheader76
  %28 = phi i32 [ %.pre, %._crit_edge.loopexit ], [ %22, %.preheader76 ]
  %29 = phi i32 [ %33, %._crit_edge.loopexit ], [ %23, %.preheader76 ]
  %indvars.iv.next104 = add nuw nsw i64 %indvars.iv103, 1
  %30 = sext i32 %28 to i64
  %.not.not = icmp slt i64 %indvars.iv103, %30
  br i1 %.not.not, label %.preheader76, label %.preheader75, !llvm.loop !11

.lr.ph:                                           ; preds = %.preheader76, %.lr.ph
  %indvars.iv = phi i64 [ %indvars.iv.next, %.lr.ph ], [ 1, %.preheader76 ]
  %31 = getelementptr inbounds [52 x [52 x i32]], ptr @mp, i64 0, i64 %indvars.iv103, i64 %indvars.iv
  %32 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERi(ptr noundef nonnull align 8 dereferenceable(16) @_ZSt3cin, ptr noundef nonnull align 4 dereferenceable(4) %31)
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  %33 = load i32, ptr %2, align 4, !tbaa !8
  %34 = sext i32 %33 to i64
  %.not69.not = icmp slt i64 %indvars.iv, %34
  br i1 %.not69.not, label %.lr.ph, label %._crit_edge.loopexit, !llvm.loop !14

.preheader74:                                     ; preds = %.preheader75, %._crit_edge89
  %35 = phi i32 [ %92, %._crit_edge89 ], [ %24, %.preheader75 ]
  %36 = phi i32 [ %93, %._crit_edge89 ], [ %25, %.preheader75 ]
  %indvars.iv112 = phi i64 [ %indvars.iv.next113, %._crit_edge89 ], [ 2, %.preheader75 ]
  %.not6586 = icmp slt i32 %35, 1
  br i1 %.not6586, label %._crit_edge89, label %.preheader.preheader

.preheader.preheader:                             ; preds = %.preheader74
  %37 = add nsw i64 %indvars.iv112, -1
  br label %.preheader

._crit_edge93:                                    ; preds = %._crit_edge89, %.preheader75
  %.lcssa77 = phi i32 [ %24, %.preheader75 ], [ %92, %._crit_edge89 ]
  %.lcssa = phi i32 [ %26, %.preheader75 ], [ %94, %._crit_edge89 ]
  %38 = sext i32 %.lcssa to i64
  %39 = sext i32 %.lcssa77 to i64
  %40 = getelementptr inbounds [104 x [52 x [52 x i32]]], ptr @dp, i64 0, i64 %38, i64 %39, i64 %39
  %41 = load i32, ptr %40, align 4, !tbaa !8
  %42 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEi(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cout, i32 noundef %41)
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %2) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %1) #5
  ret i32 0

.preheader:                                       ; preds = %.preheader.preheader, %._crit_edge85
  %43 = phi i32 [ %35, %.preheader.preheader ], [ %96, %._crit_edge85 ]
  %44 = phi i32 [ %35, %.preheader.preheader ], [ %97, %._crit_edge85 ]
  %indvars.iv109 = phi i64 [ 1, %.preheader.preheader ], [ %indvars.iv.next110, %._crit_edge85 ]
  %.not6682 = icmp slt i32 %44, 1
  br i1 %.not6682, label %._crit_edge85, label %.lr.ph84

.lr.ph84:                                         ; preds = %.preheader
  %45 = sub nsw i64 %indvars.iv112, %indvars.iv109
  %46 = icmp sgt i64 %45, 0
  %47 = getelementptr inbounds [52 x [52 x i32]], ptr @mp, i64 0, i64 %indvars.iv109, i64 %45
  %48 = add nsw i64 %indvars.iv109, -1
  br i1 %46, label %.lr.ph84.split.us, label %._crit_edge85

.lr.ph84.split.us:                                ; preds = %.lr.ph84, %87
  %49 = phi i32 [ %88, %87 ], [ %43, %.lr.ph84 ]
  %50 = phi i32 [ %89, %87 ], [ %44, %.lr.ph84 ]
  %51 = phi i32 [ %90, %87 ], [ %44, %.lr.ph84 ]
  %indvars.iv106 = phi i64 [ %indvars.iv.next107, %87 ], [ 1, %.lr.ph84 ]
  %52 = sub nsw i64 %indvars.iv112, %indvars.iv106
  %53 = load i32, ptr %2, align 4, !tbaa !8
  %54 = sext i32 %53 to i64
  %55 = icmp sgt i64 %45, %54
  %56 = icmp slt i64 %52, 1
  %.not67.us = icmp sgt i64 %52, %54
  %57 = or i1 %56, %.not67.us
  %or.cond70.us = select i1 %55, i1 true, i1 %57
  br i1 %or.cond70.us, label %87, label %58

58:                                               ; preds = %.lr.ph84.split.us
  %59 = load i32, ptr %47, align 4, !tbaa !8
  %.not68.us = icmp eq i64 %indvars.iv109, %indvars.iv106
  br i1 %.not68.us, label %64, label %60

60:                                               ; preds = %58
  %61 = getelementptr inbounds [52 x [52 x i32]], ptr @mp, i64 0, i64 %indvars.iv106, i64 %52
  %62 = load i32, ptr %61, align 4, !tbaa !8
  %63 = add nsw i32 %62, %59
  br label %64

64:                                               ; preds = %60, %58
  %.0.us = phi i32 [ %63, %60 ], [ %59, %58 ]
  %65 = getelementptr inbounds [104 x [52 x [52 x i32]]], ptr @dp, i64 0, i64 %indvars.iv112, i64 %indvars.iv109, i64 %indvars.iv106
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %3) #5
  %66 = getelementptr inbounds [104 x [52 x [52 x i32]]], ptr @dp, i64 0, i64 %37, i64 %48, i64 %indvars.iv106
  %67 = load i32, ptr %66, align 4, !tbaa !8
  %68 = add nsw i32 %67, %.0.us
  store i32 %68, ptr %3, align 4, !tbaa !8
  %69 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZSt3maxIiERKT_S2_S2_(ptr noundef nonnull align 4 dereferenceable(4) %65, ptr noundef nonnull align 4 dereferenceable(4) %3)
  %70 = load i32, ptr %69, align 4, !tbaa !8
  store i32 %70, ptr %65, align 4, !tbaa !8
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %3) #5
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %4) #5
  %71 = add nsw i64 %indvars.iv106, -1
  %72 = getelementptr inbounds [104 x [52 x [52 x i32]]], ptr @dp, i64 0, i64 %37, i64 %48, i64 %71
  %73 = load i32, ptr %72, align 4, !tbaa !8
  %74 = add nsw i32 %73, %.0.us
  store i32 %74, ptr %4, align 4, !tbaa !8
  %75 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZSt3maxIiERKT_S2_S2_(ptr noundef nonnull align 4 dereferenceable(4) %65, ptr noundef nonnull align 4 dereferenceable(4) %4)
  %76 = load i32, ptr %75, align 4, !tbaa !8
  store i32 %76, ptr %65, align 4, !tbaa !8
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %4) #5
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %5) #5
  %77 = getelementptr inbounds [104 x [52 x [52 x i32]]], ptr @dp, i64 0, i64 %37, i64 %indvars.iv109, i64 %71
  %78 = load i32, ptr %77, align 4, !tbaa !8
  %79 = add nsw i32 %78, %.0.us
  store i32 %79, ptr %5, align 4, !tbaa !8
  %80 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZSt3maxIiERKT_S2_S2_(ptr noundef nonnull align 4 dereferenceable(4) %65, ptr noundef nonnull align 4 dereferenceable(4) %5)
  %81 = load i32, ptr %80, align 4, !tbaa !8
  store i32 %81, ptr %65, align 4, !tbaa !8
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %5) #5
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %6) #5
  %82 = getelementptr inbounds [104 x [52 x [52 x i32]]], ptr @dp, i64 0, i64 %37, i64 %indvars.iv109, i64 %indvars.iv106
  %83 = load i32, ptr %82, align 4, !tbaa !8
  %84 = add nsw i32 %83, %.0.us
  store i32 %84, ptr %6, align 4, !tbaa !8
  %85 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZSt3maxIiERKT_S2_S2_(ptr noundef nonnull align 4 dereferenceable(4) %65, ptr noundef nonnull align 4 dereferenceable(4) %6)
  %86 = load i32, ptr %85, align 4, !tbaa !8
  store i32 %86, ptr %65, align 4, !tbaa !8
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %6) #5
  %.pre116 = load i32, ptr %1, align 4, !tbaa !8
  br label %87

87:                                               ; preds = %64, %.lr.ph84.split.us
  %88 = phi i32 [ %.pre116, %64 ], [ %49, %.lr.ph84.split.us ]
  %89 = phi i32 [ %.pre116, %64 ], [ %50, %.lr.ph84.split.us ]
  %90 = phi i32 [ %.pre116, %64 ], [ %51, %.lr.ph84.split.us ]
  %indvars.iv.next107 = add nuw nsw i64 %indvars.iv106, 1
  %91 = sext i32 %90 to i64
  %.not66.us.not = icmp slt i64 %indvars.iv106, %91
  br i1 %.not66.us.not, label %.lr.ph84.split.us, label %._crit_edge85, !llvm.loop !15

._crit_edge89.loopexit97:                         ; preds = %._crit_edge85
  %.pre117 = load i32, ptr %2, align 4, !tbaa !8
  br label %._crit_edge89

._crit_edge89:                                    ; preds = %._crit_edge89.loopexit97, %.preheader74
  %92 = phi i32 [ %96, %._crit_edge89.loopexit97 ], [ %35, %.preheader74 ]
  %93 = phi i32 [ %.pre117, %._crit_edge89.loopexit97 ], [ %36, %.preheader74 ]
  %indvars.iv.next113 = add nuw nsw i64 %indvars.iv112, 1
  %94 = add nsw i32 %92, %93
  %95 = sext i32 %94 to i64
  %.not64.not = icmp slt i64 %indvars.iv112, %95
  br i1 %.not64.not, label %.preheader74, label %._crit_edge93, !llvm.loop !16

._crit_edge85:                                    ; preds = %87, %.lr.ph84, %.preheader
  %96 = phi i32 [ %43, %.preheader ], [ %43, %.lr.ph84 ], [ %88, %87 ]
  %97 = phi i32 [ %44, %.preheader ], [ %44, %.lr.ph84 ], [ %89, %87 ]
  %indvars.iv.next110 = add nuw nsw i64 %indvars.iv109, 1
  %98 = sext i32 %97 to i64
  %.not65.not = icmp slt i64 %indvars.iv109, %98
  br i1 %.not65.not, label %.preheader, label %._crit_edge89.loopexit97, !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: inlinehint mustprogress nounwind uwtable
declare dso_local noundef nonnull align 4 dereferenceable(4) ptr @_ZSt3maxIiERKT_S2_S2_(ptr noundef nonnull align 4 dereferenceable(4), ptr noundef nonnull align 4 dereferenceable(4)) local_unnamed_addr #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 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 = { 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, !13}
!12 = !{!"llvm.loop.mustprogress"}
!13 = !{!"llvm.loop.unswitch.partial.disable"}
!14 = distinct !{!14, !12}
!15 = distinct !{!15, !12}
!16 = distinct !{!16, !12, !13}
!17 = distinct !{!17, !12, !13}


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