; LLVM IR from Aryansh-S/USACO :: algo_ds/DP/CSES (gridpath)

; 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::chrono::time_point" = type { %"class.std::chrono::duration" }
%"class.std::chrono::duration" = type { i64 }
%"struct.aryansh::math_macros::mi" = type { i32 }
%"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 }

@CLK = external dso_local global %"class.std::chrono::time_point", align 8
@n = external dso_local global i32, align 4
@dp = external dso_local global [2000 x [2000 x %"struct.aryansh::math_macros::mi"]], align 16
@gr = external dso_local global [2000 x [2000 x i8]], align 16
@.str = external hidden unnamed_addr constant [4 x i8], align 1
@.str.5 = external hidden unnamed_addr constant [2 x i8], align 1
@stdin = external global ptr, align 8
@.str.6 = external hidden unnamed_addr constant [5 x i8], align 1
@.str.7 = external hidden unnamed_addr constant [2 x i8], align 1
@stdout = external global ptr, align 8
@_ZSt3cin = external global %"class.std::basic_istream", align 8

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

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

; Function Attrs: nounwind
declare i64 @_ZNSt6chrono3_V212steady_clock3nowEv() #1

; Function Attrs: mustprogress norecurse uwtable
define dso_local noundef i32 @main() #2 {
  %1 = alloca i32, align 4
  %2 = alloca %"class.std::chrono::time_point", align 8
  %3 = alloca i32, align 4
  %4 = alloca i32, align 4
  %5 = alloca i32, align 4
  %6 = alloca i8, align 1
  %7 = alloca %"struct.aryansh::math_macros::mi", align 4
  %8 = alloca i32, align 4
  %9 = alloca i32, align 4
  %10 = alloca %"struct.aryansh::math_macros::mi", align 4
  %11 = alloca %"struct.aryansh::math_macros::mi", align 4
  %12 = alloca %"struct.aryansh::math_macros::mi", align 4
  store i32 0, ptr %1, align 4
  %13 = call noalias ptr @fopen(ptr noundef @.str, ptr noundef @.str.5)
  %14 = icmp ne ptr %13, null
  br i1 %14, label %15, label %20

15:                                               ; preds = %0
  %16 = load ptr, ptr @stdin, align 8, !tbaa !5
  %17 = call ptr @freopen(ptr noundef @.str, ptr noundef @.str.5, ptr noundef %16)
  %18 = load ptr, ptr @stdout, align 8, !tbaa !5
  %19 = call ptr @freopen(ptr noundef @.str.6, ptr noundef @.str.7, ptr noundef %18)
  br label %20

20:                                               ; preds = %15, %0
  %21 = load ptr, ptr @_ZSt3cin, align 8, !tbaa !9
  %22 = getelementptr i8, ptr %21, i64 -24
  %23 = load i64, ptr %22, align 8
  %24 = getelementptr inbounds i8, ptr @_ZSt3cin, i64 %23
  %25 = call noundef ptr @_ZNSt9basic_iosIcSt11char_traitsIcEE3tieEPSo(ptr noundef nonnull align 8 dereferenceable(264) %24, ptr noundef null)
  %26 = call noundef zeroext i1 @_ZNSt8ios_base15sync_with_stdioEb(i1 noundef zeroext false)
  call void @llvm.lifetime.start.p0(i64 8, ptr %2) #7
  %27 = call i64 @_ZNSt6chrono3_V212steady_clock3nowEv() #7
  %28 = getelementptr inbounds %"class.std::chrono::time_point", ptr %2, i32 0, i32 0
  %29 = getelementptr inbounds %"class.std::chrono::duration", ptr %28, i32 0, i32 0
  store i64 %27, ptr %29, align 8
  call void @llvm.memcpy.p0.p0.i64(ptr align 8 @CLK, ptr align 8 %2, i64 8, i1 false), !tbaa.struct !11
  call void @llvm.lifetime.end.p0(i64 8, ptr %2) #7
  call void @_ZN7aryansh9io_macros2inIivEEvRT_(ptr noundef nonnull align 4 dereferenceable(4) @n)
  call void @llvm.lifetime.start.p0(i64 4, ptr %3) #7
  %30 = load i32, ptr @n, align 4, !tbaa !14
  %31 = icmp sgt i32 0, %30
  %32 = zext i1 %31 to i32
  %33 = sub nsw i32 0, %32
  store i32 %33, ptr %3, align 4, !tbaa !14
  br label %34

34:                                               ; preds = %89, %20
  %35 = load i32, ptr %3, align 4, !tbaa !14
  %36 = load i32, ptr @n, align 4, !tbaa !14
  %37 = load i32, ptr @n, align 4, !tbaa !14
  %38 = icmp sgt i32 0, %37
  %39 = zext i1 %38 to i32
  %40 = sub nsw i32 %36, %39
  %41 = icmp ne i32 %35, %40
  br i1 %41, label %43, label %42

42:                                               ; preds = %34
  store i32 2, ptr %4, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %3) #7
  br label %91

43:                                               ; preds = %34
  call void @llvm.lifetime.start.p0(i64 4, ptr %5) #7
  %44 = load i32, ptr @n, align 4, !tbaa !14
  %45 = icmp sgt i32 0, %44
  %46 = zext i1 %45 to i32
  %47 = sub nsw i32 0, %46
  store i32 %47, ptr %5, align 4, !tbaa !14
  br label %48

48:                                               ; preds = %77, %43
  %49 = load i32, ptr %5, align 4, !tbaa !14
  %50 = load i32, ptr @n, align 4, !tbaa !14
  %51 = load i32, ptr @n, align 4, !tbaa !14
  %52 = icmp sgt i32 0, %51
  %53 = zext i1 %52 to i32
  %54 = sub nsw i32 %50, %53
  %55 = icmp ne i32 %49, %54
  br i1 %55, label %57, label %56

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

57:                                               ; preds = %48
  call void @llvm.lifetime.start.p0(i64 1, ptr %6) #7
  call void @_ZN7aryansh9io_macros2inIcvEEvRT_(ptr noundef nonnull align 1 dereferenceable(1) %6)
  %58 = load i8, ptr %6, align 1, !tbaa !16
  %59 = sext i8 %58 to i32
  %60 = icmp eq i32 %59, 46
  %61 = load i32, ptr %3, align 4, !tbaa !14
  %62 = sext i32 %61 to i64
  %63 = getelementptr inbounds [2000 x [2000 x i8]], ptr @gr, i64 0, i64 %62
  %64 = load i32, ptr %5, align 4, !tbaa !14
  %65 = sext i32 %64 to i64
  %66 = getelementptr inbounds [2000 x i8], ptr %63, i64 0, i64 %65
  %67 = zext i1 %60 to i8
  store i8 %67, ptr %66, align 1, !tbaa !17
  call void @llvm.lifetime.end.p0(i64 1, ptr %6) #7
  br label %68

68:                                               ; preds = %57
  %69 = load i32, ptr @n, align 4, !tbaa !14
  %70 = icmp sgt i32 0, %69
  br i1 %70, label %71, label %74

71:                                               ; preds = %68
  %72 = load i32, ptr %5, align 4, !tbaa !14
  %73 = add nsw i32 %72, -1
  store i32 %73, ptr %5, align 4, !tbaa !14
  br label %77

74:                                               ; preds = %68
  %75 = load i32, ptr %5, align 4, !tbaa !14
  %76 = add nsw i32 %75, 1
  store i32 %76, ptr %5, align 4, !tbaa !14
  br label %77

77:                                               ; preds = %74, %71
  %78 = phi ptr [ %5, %71 ], [ %5, %74 ]
  br label %48, !llvm.loop !19

79:                                               ; preds = %56
  br label %80

80:                                               ; preds = %79
  %81 = load i32, ptr @n, align 4, !tbaa !14
  %82 = icmp sgt i32 0, %81
  br i1 %82, label %83, label %86

83:                                               ; preds = %80
  %84 = load i32, ptr %3, align 4, !tbaa !14
  %85 = add nsw i32 %84, -1
  store i32 %85, ptr %3, align 4, !tbaa !14
  br label %89

86:                                               ; preds = %80
  %87 = load i32, ptr %3, align 4, !tbaa !14
  %88 = add nsw i32 %87, 1
  store i32 %88, ptr %3, align 4, !tbaa !14
  br label %89

89:                                               ; preds = %86, %83
  %90 = phi ptr [ %3, %83 ], [ %3, %86 ]
  br label %34, !llvm.loop !21

91:                                               ; preds = %42
  %92 = load i8, ptr @gr, align 16, !tbaa !17, !range !22, !noundef !23
  %93 = trunc i8 %92 to i1
  br i1 %93, label %95, label %94

94:                                               ; preds = %91
  call void @_ZN7aryansh9io_macros3outIiJEEEvT_DpT0_(i32 noundef 0)
  store i32 0, ptr %1, align 4
  br label %210

95:                                               ; preds = %91
  call void @llvm.lifetime.start.p0(i64 4, ptr %7) #7
  call void @_ZN7aryansh11math_macros2miC2Ex(ptr noundef nonnull align 4 dereferenceable(4) %7, i64 noundef 1)
  call void @llvm.memcpy.p0.p0.i64(ptr align 16 @dp, ptr align 4 %7, i64 4, i1 false), !tbaa.struct !24
  call void @llvm.lifetime.end.p0(i64 4, ptr %7) #7
  call void @llvm.lifetime.start.p0(i64 4, ptr %8) #7
  %96 = load i32, ptr @n, align 4, !tbaa !14
  %97 = icmp sgt i32 0, %96
  %98 = zext i1 %97 to i32
  %99 = sub nsw i32 0, %98
  store i32 %99, ptr %8, align 4, !tbaa !14
  br label %100

100:                                              ; preds = %197, %95
  %101 = load i32, ptr %8, align 4, !tbaa !14
  %102 = load i32, ptr @n, align 4, !tbaa !14
  %103 = load i32, ptr @n, align 4, !tbaa !14
  %104 = icmp sgt i32 0, %103
  %105 = zext i1 %104 to i32
  %106 = sub nsw i32 %102, %105
  %107 = icmp ne i32 %101, %106
  br i1 %107, label %109, label %108

108:                                              ; preds = %100
  store i32 8, ptr %4, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %8) #7
  br label %199

109:                                              ; preds = %100
  call void @llvm.lifetime.start.p0(i64 4, ptr %9) #7
  %110 = load i32, ptr @n, align 4, !tbaa !14
  %111 = icmp sgt i32 0, %110
  %112 = zext i1 %111 to i32
  %113 = sub nsw i32 0, %112
  store i32 %113, ptr %9, align 4, !tbaa !14
  br label %114

114:                                              ; preds = %185, %109
  %115 = load i32, ptr %9, align 4, !tbaa !14
  %116 = load i32, ptr @n, align 4, !tbaa !14
  %117 = load i32, ptr @n, align 4, !tbaa !14
  %118 = icmp sgt i32 0, %117
  %119 = zext i1 %118 to i32
  %120 = sub nsw i32 %116, %119
  %121 = icmp ne i32 %115, %120
  br i1 %121, label %123, label %122

122:                                              ; preds = %114
  store i32 11, ptr %4, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %9) #7
  br label %187

123:                                              ; preds = %114
  call void @llvm.lifetime.start.p0(i64 4, ptr %10) #7
  %124 = load i32, ptr %8, align 4, !tbaa !14
  %125 = add nsw i32 %124, 1
  %126 = sext i32 %125 to i64
  %127 = getelementptr inbounds [2000 x [2000 x i8]], ptr @gr, i64 0, i64 %126
  %128 = load i32, ptr %9, align 4, !tbaa !14
  %129 = sext i32 %128 to i64
  %130 = getelementptr inbounds [2000 x i8], ptr %127, i64 0, i64 %129
  %131 = load i8, ptr %130, align 1, !tbaa !17, !range !22, !noundef !23
  %132 = trunc i8 %131 to i1
  br i1 %132, label %133, label %140

133:                                              ; preds = %123
  %134 = load i32, ptr %8, align 4, !tbaa !14
  %135 = sext i32 %134 to i64
  %136 = getelementptr inbounds [2000 x [2000 x %"struct.aryansh::math_macros::mi"]], ptr @dp, i64 0, i64 %135
  %137 = load i32, ptr %9, align 4, !tbaa !14
  %138 = sext i32 %137 to i64
  %139 = getelementptr inbounds [2000 x %"struct.aryansh::math_macros::mi"], ptr %136, i64 0, i64 %138
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %10, ptr align 4 %139, i64 4, i1 false), !tbaa.struct !24
  br label %141

140:                                              ; preds = %123
  call void @_ZN7aryansh11math_macros2miC2Ex(ptr noundef nonnull align 4 dereferenceable(4) %10, i64 noundef 0)
  br label %141

141:                                              ; preds = %140, %133
  %142 = load i32, ptr %8, align 4, !tbaa !14
  %143 = add nsw i32 %142, 1
  %144 = sext i32 %143 to i64
  %145 = getelementptr inbounds [2000 x [2000 x %"struct.aryansh::math_macros::mi"]], ptr @dp, i64 0, i64 %144
  %146 = load i32, ptr %9, align 4, !tbaa !14
  %147 = sext i32 %146 to i64
  %148 = getelementptr inbounds [2000 x %"struct.aryansh::math_macros::mi"], ptr %145, i64 0, i64 %147
  %149 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZN7aryansh11math_macros2mipLERKS1_(ptr noundef nonnull align 4 dereferenceable(4) %148, ptr noundef nonnull align 4 dereferenceable(4) %10)
  call void @llvm.lifetime.start.p0(i64 4, ptr %11) #7
  %150 = load i32, ptr %8, align 4, !tbaa !14
  %151 = sext i32 %150 to i64
  %152 = getelementptr inbounds [2000 x [2000 x i8]], ptr @gr, i64 0, i64 %151
  %153 = load i32, ptr %9, align 4, !tbaa !14
  %154 = add nsw i32 %153, 1
  %155 = sext i32 %154 to i64
  %156 = getelementptr inbounds [2000 x i8], ptr %152, i64 0, i64 %155
  %157 = load i8, ptr %156, align 1, !tbaa !17, !range !22, !noundef !23
  %158 = trunc i8 %157 to i1
  br i1 %158, label %159, label %166

159:                                              ; preds = %141
  %160 = load i32, ptr %8, align 4, !tbaa !14
  %161 = sext i32 %160 to i64
  %162 = getelementptr inbounds [2000 x [2000 x %"struct.aryansh::math_macros::mi"]], ptr @dp, i64 0, i64 %161
  %163 = load i32, ptr %9, align 4, !tbaa !14
  %164 = sext i32 %163 to i64
  %165 = getelementptr inbounds [2000 x %"struct.aryansh::math_macros::mi"], ptr %162, i64 0, i64 %164
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %11, ptr align 4 %165, i64 4, i1 false), !tbaa.struct !24
  br label %167

166:                                              ; preds = %141
  call void @_ZN7aryansh11math_macros2miC2Ex(ptr noundef nonnull align 4 dereferenceable(4) %11, i64 noundef 0)
  br label %167

167:                                              ; preds = %166, %159
  %168 = load i32, ptr %8, align 4, !tbaa !14
  %169 = sext i32 %168 to i64
  %170 = getelementptr inbounds [2000 x [2000 x %"struct.aryansh::math_macros::mi"]], ptr @dp, i64 0, i64 %169
  %171 = load i32, ptr %9, align 4, !tbaa !14
  %172 = add nsw i32 %171, 1
  %173 = sext i32 %172 to i64
  %174 = getelementptr inbounds [2000 x %"struct.aryansh::math_macros::mi"], ptr %170, i64 0, i64 %173
  %175 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZN7aryansh11math_macros2mipLERKS1_(ptr noundef nonnull align 4 dereferenceable(4) %174, ptr noundef nonnull align 4 dereferenceable(4) %11)
  call void @llvm.lifetime.end.p0(i64 4, ptr %11) #7
  call void @llvm.lifetime.end.p0(i64 4, ptr %10) #7
  br label %176

176:                                              ; preds = %167
  %177 = load i32, ptr @n, align 4, !tbaa !14
  %178 = icmp sgt i32 0, %177
  br i1 %178, label %179, label %182

179:                                              ; preds = %176
  %180 = load i32, ptr %9, align 4, !tbaa !14
  %181 = add nsw i32 %180, -1
  store i32 %181, ptr %9, align 4, !tbaa !14
  br label %185

182:                                              ; preds = %176
  %183 = load i32, ptr %9, align 4, !tbaa !14
  %184 = add nsw i32 %183, 1
  store i32 %184, ptr %9, align 4, !tbaa !14
  br label %185

185:                                              ; preds = %182, %179
  %186 = phi ptr [ %9, %179 ], [ %9, %182 ]
  br label %114, !llvm.loop !25

187:                                              ; preds = %122
  br label %188

188:                                              ; preds = %187
  %189 = load i32, ptr @n, align 4, !tbaa !14
  %190 = icmp sgt i32 0, %189
  br i1 %190, label %191, label %194

191:                                              ; preds = %188
  %192 = load i32, ptr %8, align 4, !tbaa !14
  %193 = add nsw i32 %192, -1
  store i32 %193, ptr %8, align 4, !tbaa !14
  br label %197

194:                                              ; preds = %188
  %195 = load i32, ptr %8, align 4, !tbaa !14
  %196 = add nsw i32 %195, 1
  store i32 %196, ptr %8, align 4, !tbaa !14
  br label %197

197:                                              ; preds = %194, %191
  %198 = phi ptr [ %8, %191 ], [ %8, %194 ]
  br label %100, !llvm.loop !26

199:                                              ; preds = %108
  %200 = load i32, ptr @n, align 4, !tbaa !14
  %201 = sub nsw i32 %200, 1
  %202 = sext i32 %201 to i64
  %203 = getelementptr inbounds [2000 x [2000 x %"struct.aryansh::math_macros::mi"]], ptr @dp, i64 0, i64 %202
  %204 = load i32, ptr @n, align 4, !tbaa !14
  %205 = sub nsw i32 %204, 1
  %206 = sext i32 %205 to i64
  %207 = getelementptr inbounds [2000 x %"struct.aryansh::math_macros::mi"], ptr %203, i64 0, i64 %206
  call void @llvm.memcpy.p0.p0.i64(ptr align 4 %12, ptr align 4 %207, i64 4, i1 false), !tbaa.struct !24
  %208 = getelementptr inbounds %"struct.aryansh::math_macros::mi", ptr %12, i32 0, i32 0
  %209 = load i32, ptr %208, align 4
  call void @_ZN7aryansh9io_macros3outINS_11math_macros2miEJEEEvT_DpT0_(i32 %209)
  br label %210

210:                                              ; preds = %199, %94
  %211 = load i32, ptr %1, align 4
  ret i32 %211
}

declare noalias ptr @fopen(ptr noundef, ptr noundef) #3

declare ptr @freopen(ptr noundef, ptr noundef, ptr noundef) #3

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

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

; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: readwrite)
declare void @llvm.memcpy.p0.p0.i64(ptr noalias nocapture writeonly, ptr noalias nocapture readonly, i64, i1 immarg) #5

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local void @_ZN7aryansh9io_macros2inIivEEvRT_(ptr noundef nonnull align 4 dereferenceable(4)) #6

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local void @_ZN7aryansh9io_macros2inIcvEEvRT_(ptr noundef nonnull align 1 dereferenceable(1)) #6

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local void @_ZN7aryansh9io_macros3outIiJEEEvT_DpT0_(i32 noundef) #6

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZN7aryansh11math_macros2miC2Ex(ptr noundef nonnull align 4 dereferenceable(4), i64 noundef) unnamed_addr #4 align 2

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

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local void @_ZN7aryansh9io_macros3outINS_11math_macros2miEJEEEvT_DpT0_(i32) #6

attributes #0 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { 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 #2 = { 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 #3 = { "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 nounwind willreturn memory(argmem: readwrite) }
attributes #6 = { 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 #7 = { 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 = !{!"any pointer", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C++ TBAA"}
!9 = !{!10, !10, i64 0}
!10 = !{!"vtable pointer", !8, i64 0}
!11 = !{i64 0, i64 8, !12}
!12 = !{!13, !13, i64 0}
!13 = !{!"long", !7, i64 0}
!14 = !{!15, !15, i64 0}
!15 = !{!"int", !7, i64 0}
!16 = !{!7, !7, i64 0}
!17 = !{!18, !18, i64 0}
!18 = !{!"bool", !7, i64 0}
!19 = distinct !{!19, !20}
!20 = !{!"llvm.loop.mustprogress"}
!21 = distinct !{!21, !20}
!22 = !{i8 0, i8 2}
!23 = !{}
!24 = !{i64 0, i64 4, !14}
!25 = distinct !{!25, !20}
!26 = distinct !{!26, !20}


; 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::chrono::time_point" = type { %"class.std::chrono::duration" }
%"class.std::chrono::duration" = type { i64 }
%"struct.aryansh::math_macros::mi" = type { i32 }
%"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 }

@CLK = external dso_local local_unnamed_addr global %"class.std::chrono::time_point", align 8
@n = external dso_local global i32, align 4
@dp = external dso_local global [2000 x [2000 x %"struct.aryansh::math_macros::mi"]], align 16
@gr = external dso_local local_unnamed_addr global [2000 x [2000 x i8]], align 16
@.str = external hidden unnamed_addr constant [4 x i8], align 1
@.str.5 = external hidden unnamed_addr constant [2 x i8], align 1
@stdin = external local_unnamed_addr global ptr, align 8
@.str.6 = external hidden unnamed_addr constant [5 x i8], align 1
@.str.7 = external hidden unnamed_addr constant [2 x i8], align 1
@stdout = external local_unnamed_addr global ptr, align 8
@_ZSt3cin = external global %"class.std::basic_istream", align 8

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

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

; Function Attrs: nounwind
declare i64 @_ZNSt6chrono3_V212steady_clock3nowEv() local_unnamed_addr #1

; Function Attrs: mustprogress norecurse uwtable
define dso_local noundef i32 @main() local_unnamed_addr #2 {
  %1 = alloca i8, align 1
  %2 = alloca %"struct.aryansh::math_macros::mi", align 4
  %3 = alloca %"struct.aryansh::math_macros::mi", align 4
  %4 = alloca %"struct.aryansh::math_macros::mi", align 4
  %5 = tail call noalias ptr @fopen(ptr noundef nonnull @.str, ptr noundef nonnull @.str.5)
  %.not = icmp eq ptr %5, null
  br i1 %.not, label %11, label %6

6:                                                ; preds = %0
  %7 = load ptr, ptr @stdin, align 8, !tbaa !5
  %8 = tail call ptr @freopen(ptr noundef nonnull @.str, ptr noundef nonnull @.str.5, ptr noundef %7)
  %9 = load ptr, ptr @stdout, align 8, !tbaa !5
  %10 = tail call ptr @freopen(ptr noundef nonnull @.str.6, ptr noundef nonnull @.str.7, ptr noundef %9)
  br label %11

11:                                               ; preds = %6, %0
  %12 = load ptr, ptr @_ZSt3cin, align 8, !tbaa !9
  %13 = getelementptr i8, ptr %12, i64 -24
  %14 = load i64, ptr %13, align 8
  %15 = getelementptr inbounds i8, ptr @_ZSt3cin, i64 %14
  %16 = tail call noundef ptr @_ZNSt9basic_iosIcSt11char_traitsIcEE3tieEPSo(ptr noundef nonnull align 8 dereferenceable(264) %15, ptr noundef null)
  %17 = tail call noundef zeroext i1 @_ZNSt8ios_base15sync_with_stdioEb(i1 noundef zeroext false)
  %18 = tail call i64 @_ZNSt6chrono3_V212steady_clock3nowEv() #7
  store i64 %18, ptr @CLK, align 8, !tbaa !11
  tail call void @_ZN7aryansh9io_macros2inIivEEvRT_(ptr noundef nonnull align 4 dereferenceable(4) @n)
  %19 = load i32, ptr @n, align 4, !tbaa !13
  %.not3555 = icmp eq i32 %19, 0
  br i1 %.not3555, label %._crit_edge58, label %.preheader48.preheader

.preheader48.preheader:                           ; preds = %11
  %.lobit.neg = ashr i32 %19, 31
  br label %.preheader48

.preheader48:                                     ; preds = %.preheader48.preheader, %._crit_edge
  %20 = phi i32 [ %25, %._crit_edge ], [ %19, %.preheader48.preheader ]
  %.lobit.neg4357 = phi i32 [ %.lobit.neg43.pre-phi, %._crit_edge ], [ %.lobit.neg, %.preheader48.preheader ]
  %.03356 = phi i32 [ %.134, %._crit_edge ], [ %.lobit.neg, %.preheader48.preheader ]
  %.lobit.neg4451 = ashr i32 %20, 31
  %21 = add i32 %.lobit.neg4451, %20
  %.not4552 = icmp eq i32 %.lobit.neg4357, %21
  br i1 %.not4552, label %._crit_edge, label %.lr.ph

.lr.ph:                                           ; preds = %.preheader48
  %22 = sext i32 %.03356 to i64
  br label %26

._crit_edge58:                                    ; preds = %._crit_edge, %11
  %23 = load i8, ptr @gr, align 16, !tbaa !15, !range !17, !noundef !18
  %24 = trunc nuw i8 %23 to i1
  br i1 %24, label %35, label %34

._crit_edge:                                      ; preds = %26, %.preheader48
  %.pre-phi74 = phi i32 [ %21, %.preheader48 ], [ %33, %26 ]
  %.lobit.neg43.pre-phi = phi i32 [ %.lobit.neg4451, %.preheader48 ], [ %.lobit.neg44, %26 ]
  %25 = phi i32 [ %20, %.preheader48 ], [ %32, %26 ]
  %.inv46 = icmp sgt i32 %25, -1
  %.134.v = select i1 %.inv46, i32 1, i32 -1
  %.134 = add nsw i32 %.134.v, %.03356
  %.not35 = icmp eq i32 %.134, %.pre-phi74
  br i1 %.not35, label %._crit_edge58, label %.preheader48, !llvm.loop !19

26:                                               ; preds = %.lr.ph, %26
  %.03153 = phi i32 [ %.lobit.neg4357, %.lr.ph ], [ %.132, %26 ]
  call void @llvm.lifetime.start.p0(i64 1, ptr nonnull %1) #7
  call void @_ZN7aryansh9io_macros2inIcvEEvRT_(ptr noundef nonnull align 1 dereferenceable(1) %1)
  %27 = load i8, ptr %1, align 1, !tbaa !21
  %28 = icmp eq i8 %27, 46
  %29 = sext i32 %.03153 to i64
  %30 = getelementptr inbounds [2000 x [2000 x i8]], ptr @gr, i64 0, i64 %22, i64 %29
  %31 = zext i1 %28 to i8
  store i8 %31, ptr %30, align 1, !tbaa !15
  call void @llvm.lifetime.end.p0(i64 1, ptr nonnull %1) #7
  %32 = load i32, ptr @n, align 4, !tbaa !13
  %.inv = icmp sgt i32 %32, -1
  %.132.v = select i1 %.inv, i32 1, i32 -1
  %.132 = add nsw i32 %.132.v, %.03153
  %.lobit.neg44 = ashr i32 %32, 31
  %33 = add i32 %.lobit.neg44, %32
  %.not45 = icmp eq i32 %.132, %33
  br i1 %.not45, label %._crit_edge, label %26, !llvm.loop !22

34:                                               ; preds = %._crit_edge58
  call void @_ZN7aryansh9io_macros3outIiJEEEvT_DpT0_(i32 noundef 0)
  br label %75

35:                                               ; preds = %._crit_edge58
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %2) #7
  call void @_ZN7aryansh11math_macros2miC2Ex(ptr noundef nonnull align 4 dereferenceable(4) %2, i64 noundef 1)
  %36 = load i32, ptr %2, align 4, !tbaa !13
  store i32 %36, ptr @dp, align 16, !tbaa !13
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %2) #7
  %37 = load i32, ptr @n, align 4, !tbaa !13
  %.not3866 = icmp eq i32 %37, 0
  br i1 %.not3866, label %._crit_edge69, label %.preheader.preheader

.preheader.preheader:                             ; preds = %35
  %.lobit36.neg = ashr i32 %37, 31
  br label %.preheader

.preheader:                                       ; preds = %.preheader.preheader, %._crit_edge63
  %38 = phi i32 [ %46, %._crit_edge63 ], [ %37, %.preheader.preheader ]
  %.lobit37.neg3968 = phi i32 [ %.lobit37.neg39.pre-phi, %._crit_edge63 ], [ %.lobit36.neg, %.preheader.preheader ]
  %.02967 = phi i32 [ %.130, %._crit_edge63 ], [ %.lobit36.neg, %.preheader.preheader ]
  %.lobit40.neg59 = ashr i32 %38, 31
  %39 = add i32 %.lobit40.neg59, %38
  %.not4160 = icmp eq i32 %.lobit37.neg3968, %39
  br i1 %.not4160, label %._crit_edge63, label %.lr.ph62

.lr.ph62:                                         ; preds = %.preheader
  %40 = add nsw i32 %.02967, 1
  %41 = sext i32 %40 to i64
  %42 = sext i32 %.02967 to i64
  br label %47

._crit_edge69.loopexit:                           ; preds = %._crit_edge63
  %43 = add nsw i32 %46, -1
  %44 = sext i32 %43 to i64
  br label %._crit_edge69

._crit_edge69:                                    ; preds = %._crit_edge69.loopexit, %35
  %.lcssa49 = phi i64 [ -1, %35 ], [ %44, %._crit_edge69.loopexit ]
  %45 = getelementptr inbounds [2000 x [2000 x %"struct.aryansh::math_macros::mi"]], ptr @dp, i64 0, i64 %.lcssa49, i64 %.lcssa49
  %.sroa.0.0.copyload = load i32, ptr %45, align 4, !tbaa !13
  call void @_ZN7aryansh9io_macros3outINS_11math_macros2miEJEEEvT_DpT0_(i32 %.sroa.0.0.copyload)
  br label %75

._crit_edge63:                                    ; preds = %68, %.preheader
  %.pre-phi = phi i32 [ %39, %.preheader ], [ %74, %68 ]
  %.lobit37.neg39.pre-phi = phi i32 [ %.lobit40.neg59, %.preheader ], [ %.lobit40.neg, %68 ]
  %46 = phi i32 [ %38, %.preheader ], [ %71, %68 ]
  %.inv47 = icmp sgt i32 %46, -1
  %.130.v = select i1 %.inv47, i32 1, i32 -1
  %.130 = add nsw i32 %.130.v, %.02967
  %.not38 = icmp eq i32 %.130, %.pre-phi
  br i1 %.not38, label %._crit_edge69.loopexit, label %.preheader, !llvm.loop !23

47:                                               ; preds = %.lr.ph62, %68
  %.02861 = phi i32 [ %.lobit37.neg3968, %.lr.ph62 ], [ %.1, %68 ]
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %3) #7
  %48 = sext i32 %.02861 to i64
  %49 = getelementptr inbounds [2000 x [2000 x i8]], ptr @gr, i64 0, i64 %41, i64 %48
  %50 = load i8, ptr %49, align 1, !tbaa !15, !range !17, !noundef !18
  %51 = trunc nuw i8 %50 to i1
  br i1 %51, label %52, label %55

52:                                               ; preds = %47
  %53 = getelementptr inbounds [2000 x [2000 x %"struct.aryansh::math_macros::mi"]], ptr @dp, i64 0, i64 %42, i64 %48
  %54 = load i32, ptr %53, align 4, !tbaa !13
  store i32 %54, ptr %3, align 4, !tbaa !13
  br label %56

55:                                               ; preds = %47
  call void @_ZN7aryansh11math_macros2miC2Ex(ptr noundef nonnull align 4 dereferenceable(4) %3, i64 noundef 0)
  br label %56

56:                                               ; preds = %55, %52
  %57 = getelementptr inbounds [2000 x [2000 x %"struct.aryansh::math_macros::mi"]], ptr @dp, i64 0, i64 %41, i64 %48
  %58 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZN7aryansh11math_macros2mipLERKS1_(ptr noundef nonnull align 4 dereferenceable(4) %57, ptr noundef nonnull align 4 dereferenceable(4) %3)
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %4) #7
  %59 = add nsw i32 %.02861, 1
  %60 = sext i32 %59 to i64
  %61 = getelementptr inbounds [2000 x [2000 x i8]], ptr @gr, i64 0, i64 %42, i64 %60
  %62 = load i8, ptr %61, align 1, !tbaa !15, !range !17, !noundef !18
  %63 = trunc nuw i8 %62 to i1
  br i1 %63, label %64, label %67

64:                                               ; preds = %56
  %65 = getelementptr inbounds [2000 x [2000 x %"struct.aryansh::math_macros::mi"]], ptr @dp, i64 0, i64 %42, i64 %48
  %66 = load i32, ptr %65, align 4, !tbaa !13
  store i32 %66, ptr %4, align 4, !tbaa !13
  br label %68

67:                                               ; preds = %56
  call void @_ZN7aryansh11math_macros2miC2Ex(ptr noundef nonnull align 4 dereferenceable(4) %4, i64 noundef 0)
  br label %68

68:                                               ; preds = %67, %64
  %69 = getelementptr inbounds [2000 x [2000 x %"struct.aryansh::math_macros::mi"]], ptr @dp, i64 0, i64 %42, i64 %60
  %70 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZN7aryansh11math_macros2mipLERKS1_(ptr noundef nonnull align 4 dereferenceable(4) %69, ptr noundef nonnull align 4 dereferenceable(4) %4)
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %4) #7
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %3) #7
  %71 = load i32, ptr @n, align 4, !tbaa !13
  %72 = icmp slt i32 %71, 0
  %73 = add nsw i32 %.02861, -1
  %.1 = select i1 %72, i32 %73, i32 %59
  %.lobit40.neg = ashr i32 %71, 31
  %74 = add i32 %.lobit40.neg, %71
  %.not41 = icmp eq i32 %.1, %74
  br i1 %.not41, label %._crit_edge63, label %47, !llvm.loop !24

75:                                               ; preds = %._crit_edge69, %34
  ret i32 0
}

; Function Attrs: nofree nounwind
declare noalias noundef ptr @fopen(ptr nocapture noundef readonly, ptr nocapture noundef readonly) local_unnamed_addr #3

declare ptr @freopen(ptr noundef, ptr noundef, ptr noundef) local_unnamed_addr #4

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

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

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local void @_ZN7aryansh9io_macros2inIivEEvRT_(ptr noundef nonnull align 4 dereferenceable(4)) local_unnamed_addr #6

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local void @_ZN7aryansh9io_macros2inIcvEEvRT_(ptr noundef nonnull align 1 dereferenceable(1)) local_unnamed_addr #6

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local void @_ZN7aryansh9io_macros3outIiJEEEvT_DpT0_(i32 noundef) local_unnamed_addr #6

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZN7aryansh11math_macros2miC2Ex(ptr noundef nonnull align 4 dereferenceable(4), i64 noundef) unnamed_addr #5 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef nonnull align 4 dereferenceable(4) ptr @_ZN7aryansh11math_macros2mipLERKS1_(ptr noundef nonnull align 4 dereferenceable(4), ptr noundef nonnull align 4 dereferenceable(4)) local_unnamed_addr #5 align 2

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local void @_ZN7aryansh9io_macros3outINS_11math_macros2miEJEEEvT_DpT0_(i32) local_unnamed_addr #6

attributes #0 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #1 = { 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 #2 = { 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 #3 = { 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 #4 = { "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #5 = { mustprogress nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #6 = { 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 #7 = { 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 = !{!"any pointer", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C++ TBAA"}
!9 = !{!10, !10, i64 0}
!10 = !{!"vtable pointer", !8, i64 0}
!11 = !{!12, !12, i64 0}
!12 = !{!"long", !7, i64 0}
!13 = !{!14, !14, i64 0}
!14 = !{!"int", !7, i64 0}
!15 = !{!16, !16, i64 0}
!16 = !{!"bool", !7, i64 0}
!17 = !{i8 0, i8 2}
!18 = !{}
!19 = distinct !{!19, !20}
!20 = !{!"llvm.loop.mustprogress"}
!21 = !{!7, !7, i64 0}
!22 = distinct !{!22, !20}
!23 = distinct !{!23, !20}
!24 = distinct !{!24, !20}


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