; LLVM IR from tangjz/acm-icpc :: codeforces/gym (101471C)

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

@n = external dso_local global i32, align 4
@m = external dso_local global i32, align 4
@a = external dso_local global [101 x [101 x i32]], align 16
@r = external dso_local global [101 x i32], align 16
@c = external dso_local global [101 x i32], align 16
@ans = external dso_local global i64, align 8
@e = external dso_local global [101 x [101 x i32]], align 16
@match = external dso_local global [101 x i32], align 16
@vis = external dso_local global [101 x i8], align 16
@.str = external hidden unnamed_addr constant [5 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [3 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [6 x i8], align 1

; Function Attrs: mustprogress uwtable
declare dso_local noundef zeroext i1 @_Z4pathi(i32 noundef) #0

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

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

; Function Attrs: mustprogress norecurse uwtable
define dso_local noundef i32 @main() #2 {
  %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
  store i32 0, ptr %1, align 4
  %9 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef @.str, ptr noundef @n, ptr noundef @m)
  call void @llvm.lifetime.start.p0(i64 4, ptr %2) #6
  store i32 0, ptr %2, align 4, !tbaa !5
  br label %10

10:                                               ; preds = %83, %0
  %11 = load i32, ptr %2, align 4, !tbaa !5
  %12 = load i32, ptr @n, align 4, !tbaa !5
  %13 = icmp slt i32 %11, %12
  br i1 %13, label %15, label %14

14:                                               ; preds = %10
  store i32 2, ptr %3, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %2) #6
  br label %86

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

16:                                               ; preds = %79, %15
  %17 = load i32, ptr %4, align 4, !tbaa !5
  %18 = load i32, ptr @m, align 4, !tbaa !5
  %19 = icmp slt i32 %17, %18
  br i1 %19, label %21, label %20

20:                                               ; preds = %16
  store i32 5, ptr %3, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %4) #6
  br label %82

21:                                               ; preds = %16
  %22 = load i32, ptr %2, align 4, !tbaa !5
  %23 = sext i32 %22 to i64
  %24 = getelementptr inbounds [101 x [101 x i32]], ptr @a, i64 0, i64 %23
  %25 = getelementptr inbounds [101 x i32], ptr %24, i64 0, i64 0
  %26 = load i32, ptr %4, align 4, !tbaa !5
  %27 = sext i32 %26 to i64
  %28 = getelementptr inbounds i32, ptr %25, i64 %27
  %29 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef @.str.1, ptr noundef %28)
  %30 = load i32, ptr %2, align 4, !tbaa !5
  %31 = sext i32 %30 to i64
  %32 = getelementptr inbounds [101 x [101 x i32]], ptr @a, i64 0, i64 %31
  %33 = load i32, ptr %4, align 4, !tbaa !5
  %34 = sext i32 %33 to i64
  %35 = getelementptr inbounds [101 x i32], ptr %32, i64 0, i64 %34
  %36 = load i32, ptr %35, align 4, !tbaa !5
  %37 = icmp ne i32 %36, 0
  br i1 %37, label %39, label %38

38:                                               ; preds = %21
  br label %79

39:                                               ; preds = %21
  %40 = load i32, ptr %2, align 4, !tbaa !5
  %41 = sext i32 %40 to i64
  %42 = getelementptr inbounds [101 x i32], ptr @r, i64 0, i64 %41
  %43 = load i32, ptr %2, align 4, !tbaa !5
  %44 = sext i32 %43 to i64
  %45 = getelementptr inbounds [101 x [101 x i32]], ptr @a, i64 0, i64 %44
  %46 = load i32, ptr %4, align 4, !tbaa !5
  %47 = sext i32 %46 to i64
  %48 = getelementptr inbounds [101 x i32], ptr %45, i64 0, i64 %47
  %49 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZSt3maxIiERKT_S2_S2_(ptr noundef nonnull align 4 dereferenceable(4) %42, ptr noundef nonnull align 4 dereferenceable(4) %48)
  %50 = load i32, ptr %49, align 4, !tbaa !5
  %51 = load i32, ptr %2, align 4, !tbaa !5
  %52 = sext i32 %51 to i64
  %53 = getelementptr inbounds [101 x i32], ptr @r, i64 0, i64 %52
  store i32 %50, ptr %53, align 4, !tbaa !5
  %54 = load i32, ptr %4, align 4, !tbaa !5
  %55 = sext i32 %54 to i64
  %56 = getelementptr inbounds [101 x i32], ptr @c, i64 0, i64 %55
  %57 = load i32, ptr %2, align 4, !tbaa !5
  %58 = sext i32 %57 to i64
  %59 = getelementptr inbounds [101 x [101 x i32]], ptr @a, i64 0, i64 %58
  %60 = load i32, ptr %4, align 4, !tbaa !5
  %61 = sext i32 %60 to i64
  %62 = getelementptr inbounds [101 x i32], ptr %59, i64 0, i64 %61
  %63 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZSt3maxIiERKT_S2_S2_(ptr noundef nonnull align 4 dereferenceable(4) %56, ptr noundef nonnull align 4 dereferenceable(4) %62)
  %64 = load i32, ptr %63, align 4, !tbaa !5
  %65 = load i32, ptr %4, align 4, !tbaa !5
  %66 = sext i32 %65 to i64
  %67 = getelementptr inbounds [101 x i32], ptr @c, i64 0, i64 %66
  store i32 %64, ptr %67, align 4, !tbaa !5
  %68 = load i32, ptr %2, align 4, !tbaa !5
  %69 = sext i32 %68 to i64
  %70 = getelementptr inbounds [101 x [101 x i32]], ptr @a, i64 0, i64 %69
  %71 = load i32, ptr %4, align 4, !tbaa !5
  %72 = sext i32 %71 to i64
  %73 = getelementptr inbounds [101 x i32], ptr %70, i64 0, i64 %72
  %74 = load i32, ptr %73, align 4, !tbaa !5
  %75 = sub nsw i32 %74, 1
  %76 = sext i32 %75 to i64
  %77 = load i64, ptr @ans, align 8, !tbaa !9
  %78 = add nsw i64 %77, %76
  store i64 %78, ptr @ans, align 8, !tbaa !9
  br label %79

79:                                               ; preds = %39, %38
  %80 = load i32, ptr %4, align 4, !tbaa !5
  %81 = add nsw i32 %80, 1
  store i32 %81, ptr %4, align 4, !tbaa !5
  br label %16, !llvm.loop !11

82:                                               ; preds = %20
  br label %83

83:                                               ; preds = %82
  %84 = load i32, ptr %2, align 4, !tbaa !5
  %85 = add nsw i32 %84, 1
  store i32 %85, ptr %2, align 4, !tbaa !5
  br label %10, !llvm.loop !13

86:                                               ; preds = %14
  %87 = load i32, ptr @m, align 4, !tbaa !5
  %88 = sext i32 %87 to i64
  %89 = mul i64 %88, 4
  call void @llvm.memset.p0.i64(ptr align 16 @match, i8 -1, i64 %89, i1 false)
  call void @llvm.lifetime.start.p0(i64 4, ptr %5) #6
  store i32 0, ptr %5, align 4, !tbaa !5
  br label %90

90:                                               ; preds = %160, %86
  %91 = load i32, ptr %5, align 4, !tbaa !5
  %92 = load i32, ptr @n, align 4, !tbaa !5
  %93 = icmp slt i32 %91, %92
  br i1 %93, label %95, label %94

94:                                               ; preds = %90
  store i32 8, ptr %3, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %5) #6
  br label %163

95:                                               ; preds = %90
  %96 = load i32, ptr %5, align 4, !tbaa !5
  %97 = sext i32 %96 to i64
  %98 = getelementptr inbounds [101 x i32], ptr @r, i64 0, i64 %97
  %99 = load i32, ptr %98, align 4, !tbaa !5
  %100 = icmp ne i32 %99, 0
  br i1 %100, label %102, label %101

101:                                              ; preds = %95
  br label %160

102:                                              ; preds = %95
  call void @llvm.lifetime.start.p0(i64 4, ptr %6) #6
  store i32 0, ptr %6, align 4, !tbaa !5
  br label %103

103:                                              ; preds = %141, %102
  %104 = load i32, ptr %6, align 4, !tbaa !5
  %105 = load i32, ptr @m, align 4, !tbaa !5
  %106 = icmp slt i32 %104, %105
  br i1 %106, label %108, label %107

107:                                              ; preds = %103
  store i32 11, ptr %3, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %6) #6
  br label %144

108:                                              ; preds = %103
  %109 = load i32, ptr %5, align 4, !tbaa !5
  %110 = sext i32 %109 to i64
  %111 = getelementptr inbounds [101 x [101 x i32]], ptr @a, i64 0, i64 %110
  %112 = load i32, ptr %6, align 4, !tbaa !5
  %113 = sext i32 %112 to i64
  %114 = getelementptr inbounds [101 x i32], ptr %111, i64 0, i64 %113
  %115 = load i32, ptr %114, align 4, !tbaa !5
  %116 = icmp ne i32 %115, 0
  br i1 %116, label %117, label %127

117:                                              ; preds = %108
  %118 = load i32, ptr %5, align 4, !tbaa !5
  %119 = sext i32 %118 to i64
  %120 = getelementptr inbounds [101 x i32], ptr @r, i64 0, i64 %119
  %121 = load i32, ptr %120, align 4, !tbaa !5
  %122 = load i32, ptr %6, align 4, !tbaa !5
  %123 = sext i32 %122 to i64
  %124 = getelementptr inbounds [101 x i32], ptr @c, i64 0, i64 %123
  %125 = load i32, ptr %124, align 4, !tbaa !5
  %126 = icmp ne i32 %121, %125
  br i1 %126, label %127, label %128

127:                                              ; preds = %117, %108
  br label %141

128:                                              ; preds = %117
  %129 = load i32, ptr %6, align 4, !tbaa !5
  %130 = load i32, ptr %5, align 4, !tbaa !5
  %131 = sext i32 %130 to i64
  %132 = getelementptr inbounds [101 x [101 x i32]], ptr @e, i64 0, i64 %131
  %133 = load i32, ptr %5, align 4, !tbaa !5
  %134 = sext i32 %133 to i64
  %135 = getelementptr inbounds [101 x [101 x i32]], ptr @e, i64 0, i64 %134
  %136 = getelementptr inbounds [101 x i32], ptr %135, i64 0, i64 0
  %137 = load i32, ptr %136, align 4, !tbaa !5
  %138 = add nsw i32 %137, 1
  store i32 %138, ptr %136, align 4, !tbaa !5
  %139 = sext i32 %138 to i64
  %140 = getelementptr inbounds [101 x i32], ptr %132, i64 0, i64 %139
  store i32 %129, ptr %140, align 4, !tbaa !5
  br label %141

141:                                              ; preds = %128, %127
  %142 = load i32, ptr %6, align 4, !tbaa !5
  %143 = add nsw i32 %142, 1
  store i32 %143, ptr %6, align 4, !tbaa !5
  br label %103, !llvm.loop !14

144:                                              ; preds = %107
  %145 = load i32, ptr @m, align 4, !tbaa !5
  %146 = sext i32 %145 to i64
  %147 = mul i64 %146, 1
  call void @llvm.memset.p0.i64(ptr align 16 @vis, i8 0, i64 %147, i1 false)
  %148 = load i32, ptr %5, align 4, !tbaa !5
  %149 = call noundef zeroext i1 @_Z4pathi(i32 noundef %148)
  br i1 %149, label %150, label %159

150:                                              ; preds = %144
  %151 = load i32, ptr %5, align 4, !tbaa !5
  %152 = sext i32 %151 to i64
  %153 = getelementptr inbounds [101 x i32], ptr @r, i64 0, i64 %152
  %154 = load i32, ptr %153, align 4, !tbaa !5
  %155 = sub nsw i32 %154, 1
  %156 = sext i32 %155 to i64
  %157 = load i64, ptr @ans, align 8, !tbaa !9
  %158 = add nsw i64 %157, %156
  store i64 %158, ptr @ans, align 8, !tbaa !9
  br label %159

159:                                              ; preds = %150, %144
  br label %160

160:                                              ; preds = %159, %101
  %161 = load i32, ptr %5, align 4, !tbaa !5
  %162 = add nsw i32 %161, 1
  store i32 %162, ptr %5, align 4, !tbaa !5
  br label %90, !llvm.loop !15

163:                                              ; preds = %94
  call void @llvm.lifetime.start.p0(i64 4, ptr %7) #6
  store i32 0, ptr %7, align 4, !tbaa !5
  br label %164

164:                                              ; preds = %185, %163
  %165 = load i32, ptr %7, align 4, !tbaa !5
  %166 = load i32, ptr @n, align 4, !tbaa !5
  %167 = icmp slt i32 %165, %166
  br i1 %167, label %169, label %168

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

169:                                              ; preds = %164
  %170 = load i32, ptr %7, align 4, !tbaa !5
  %171 = sext i32 %170 to i64
  %172 = getelementptr inbounds [101 x i32], ptr @r, i64 0, i64 %171
  %173 = load i32, ptr %172, align 4, !tbaa !5
  %174 = icmp ne i32 %173, 0
  br i1 %174, label %175, label %184

175:                                              ; preds = %169
  %176 = load i32, ptr %7, align 4, !tbaa !5
  %177 = sext i32 %176 to i64
  %178 = getelementptr inbounds [101 x i32], ptr @r, i64 0, i64 %177
  %179 = load i32, ptr %178, align 4, !tbaa !5
  %180 = sub nsw i32 %179, 1
  %181 = sext i32 %180 to i64
  %182 = load i64, ptr @ans, align 8, !tbaa !9
  %183 = sub nsw i64 %182, %181
  store i64 %183, ptr @ans, align 8, !tbaa !9
  br label %184

184:                                              ; preds = %175, %169
  br label %185

185:                                              ; preds = %184
  %186 = load i32, ptr %7, align 4, !tbaa !5
  %187 = add nsw i32 %186, 1
  store i32 %187, ptr %7, align 4, !tbaa !5
  br label %164, !llvm.loop !16

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

189:                                              ; preds = %210, %188
  %190 = load i32, ptr %8, align 4, !tbaa !5
  %191 = load i32, ptr @m, align 4, !tbaa !5
  %192 = icmp slt i32 %190, %191
  br i1 %192, label %194, label %193

193:                                              ; preds = %189
  store i32 17, ptr %3, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %8) #6
  br label %213

194:                                              ; preds = %189
  %195 = load i32, ptr %8, align 4, !tbaa !5
  %196 = sext i32 %195 to i64
  %197 = getelementptr inbounds [101 x i32], ptr @c, i64 0, i64 %196
  %198 = load i32, ptr %197, align 4, !tbaa !5
  %199 = icmp ne i32 %198, 0
  br i1 %199, label %200, label %209

200:                                              ; preds = %194
  %201 = load i32, ptr %8, align 4, !tbaa !5
  %202 = sext i32 %201 to i64
  %203 = getelementptr inbounds [101 x i32], ptr @c, i64 0, i64 %202
  %204 = load i32, ptr %203, align 4, !tbaa !5
  %205 = sub nsw i32 %204, 1
  %206 = sext i32 %205 to i64
  %207 = load i64, ptr @ans, align 8, !tbaa !9
  %208 = sub nsw i64 %207, %206
  store i64 %208, ptr @ans, align 8, !tbaa !9
  br label %209

209:                                              ; preds = %200, %194
  br label %210

210:                                              ; preds = %209
  %211 = load i32, ptr %8, align 4, !tbaa !5
  %212 = add nsw i32 %211, 1
  store i32 %212, ptr %8, align 4, !tbaa !5
  br label %189, !llvm.loop !17

213:                                              ; preds = %193
  %214 = load i64, ptr @ans, align 8, !tbaa !9
  %215 = call i32 (ptr, ...) @printf(ptr noundef @.str.2, i64 noundef %214)
  ret i32 0
}

declare i32 @__isoc99_scanf(ptr noundef, ...) #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

; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: write)
declare void @llvm.memset.p0.i64(ptr nocapture writeonly, i8, i64, i1 immarg) #5

declare i32 @printf(ptr noundef, ...) #3

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 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
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 = { 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 = { nocallback nofree nounwind willreturn memory(argmem: write) }
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 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C++ TBAA"}
!9 = !{!10, !10, i64 0}
!10 = !{!"long long", !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"

@n = external dso_local global i32, align 4
@m = external dso_local global i32, align 4
@a = external dso_local global [101 x [101 x i32]], align 16
@r = external dso_local global [101 x i32], align 16
@c = external dso_local global [101 x i32], align 16
@ans = external dso_local local_unnamed_addr global i64, align 8
@e = external dso_local local_unnamed_addr global [101 x [101 x i32]], align 16
@match = external dso_local local_unnamed_addr global [101 x i32], align 16
@vis = external dso_local local_unnamed_addr global [101 x i8], align 16
@.str = external hidden unnamed_addr constant [5 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [3 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [6 x i8], align 1

; Function Attrs: mustprogress uwtable
declare dso_local noundef zeroext i1 @_Z4pathi(i32 noundef) local_unnamed_addr #0

; Function Attrs: mustprogress norecurse uwtable
define dso_local noundef i32 @main() local_unnamed_addr #1 {
  %1 = tail call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull @n, ptr noundef nonnull @m)
  %2 = load i32, ptr @n, align 4, !tbaa !5
  %3 = icmp sgt i32 %2, 0
  %.pre93 = load i32, ptr @m, align 4, !tbaa !5
  br i1 %3, label %.preheader55.lr.ph, label %._crit_edge59.thread95

._crit_edge59.thread95:                           ; preds = %0
  %4 = sext i32 %.pre93 to i64
  %5 = shl nsw i64 %4, 2
  tail call void @llvm.memset.p0.i64(ptr nonnull align 16 @match, i8 -1, i64 %5, i1 false)
  br label %.preheader53.thread

.preheader55.lr.ph:                               ; preds = %0
  %6 = icmp sgt i32 %.pre93, 0
  br i1 %6, label %.preheader55, label %._crit_edge59.thread

._crit_edge59.thread:                             ; preds = %.preheader55.lr.ph
  %7 = sext i32 %.pre93 to i64
  %8 = shl nsw i64 %7, 2
  tail call void @llvm.memset.p0.i64(ptr nonnull align 16 @match, i8 -1, i64 %8, i1 false)
  br label %.lr.ph65.preheader

.preheader55:                                     ; preds = %.preheader55.lr.ph, %._crit_edge
  %9 = phi i32 [ %17, %._crit_edge ], [ %2, %.preheader55.lr.ph ]
  %10 = phi i32 [ %18, %._crit_edge ], [ %.pre93, %.preheader55.lr.ph ]
  %indvars.iv74 = phi i64 [ %indvars.iv.next75, %._crit_edge ], [ 0, %.preheader55.lr.ph ]
  %11 = icmp sgt i32 %10, 0
  br i1 %11, label %.lr.ph, label %._crit_edge

.lr.ph:                                           ; preds = %.preheader55
  %12 = getelementptr inbounds [101 x [101 x i32]], ptr @a, i64 0, i64 %indvars.iv74
  %13 = getelementptr inbounds [101 x i32], ptr @r, i64 0, i64 %indvars.iv74
  br label %21

._crit_edge59:                                    ; preds = %._crit_edge
  %14 = sext i32 %18 to i64
  %15 = shl nsw i64 %14, 2
  tail call void @llvm.memset.p0.i64(ptr nonnull align 16 @match, i8 -1, i64 %15, i1 false)
  %16 = icmp sgt i32 %17, 0
  br i1 %16, label %.lr.ph65.preheader, label %.preheader53.thread

.lr.ph65.preheader:                               ; preds = %._crit_edge59.thread, %._crit_edge59
  br label %.lr.ph65

._crit_edge.loopexit:                             ; preds = %37
  %.pre = load i32, ptr @n, align 4, !tbaa !5
  br label %._crit_edge

._crit_edge:                                      ; preds = %._crit_edge.loopexit, %.preheader55
  %17 = phi i32 [ %.pre, %._crit_edge.loopexit ], [ %9, %.preheader55 ]
  %18 = phi i32 [ %38, %._crit_edge.loopexit ], [ %10, %.preheader55 ]
  %indvars.iv.next75 = add nuw nsw i64 %indvars.iv74, 1
  %19 = sext i32 %17 to i64
  %20 = icmp slt i64 %indvars.iv.next75, %19
  br i1 %20, label %.preheader55, label %._crit_edge59, !llvm.loop !9

21:                                               ; preds = %.lr.ph, %37
  %indvars.iv = phi i64 [ 0, %.lr.ph ], [ %indvars.iv.next, %37 ]
  %22 = getelementptr inbounds i32, ptr %12, i64 %indvars.iv
  %23 = tail call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %22)
  %24 = getelementptr inbounds [101 x [101 x i32]], ptr @a, i64 0, i64 %indvars.iv74, i64 %indvars.iv
  %25 = load i32, ptr %24, align 4, !tbaa !5
  %.not52 = icmp eq i32 %25, 0
  br i1 %.not52, label %37, label %26

26:                                               ; preds = %21
  %27 = tail call noundef nonnull align 4 dereferenceable(4) ptr @_ZSt3maxIiERKT_S2_S2_(ptr noundef nonnull align 4 dereferenceable(4) %13, ptr noundef nonnull align 4 dereferenceable(4) %24)
  %28 = load i32, ptr %27, align 4, !tbaa !5
  store i32 %28, ptr %13, align 4, !tbaa !5
  %29 = getelementptr inbounds [101 x i32], ptr @c, i64 0, i64 %indvars.iv
  %30 = tail call noundef nonnull align 4 dereferenceable(4) ptr @_ZSt3maxIiERKT_S2_S2_(ptr noundef nonnull align 4 dereferenceable(4) %29, ptr noundef nonnull align 4 dereferenceable(4) %24)
  %31 = load i32, ptr %30, align 4, !tbaa !5
  store i32 %31, ptr %29, align 4, !tbaa !5
  %32 = load i32, ptr %24, align 4, !tbaa !5
  %33 = add nsw i32 %32, -1
  %34 = sext i32 %33 to i64
  %35 = load i64, ptr @ans, align 8, !tbaa !12
  %36 = add nsw i64 %35, %34
  store i64 %36, ptr @ans, align 8, !tbaa !12
  br label %37

37:                                               ; preds = %21, %26
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  %38 = load i32, ptr @m, align 4, !tbaa !5
  %39 = sext i32 %38 to i64
  %40 = icmp slt i64 %indvars.iv.next, %39
  br i1 %40, label %21, label %._crit_edge.loopexit, !llvm.loop !14

.preheader53.thread:                              ; preds = %._crit_edge59, %._crit_edge59.thread95
  %ans.promoted97 = load i64, ptr @ans, align 8, !tbaa !12
  br label %.preheader

.preheader53:                                     ; preds = %70
  %ans.promoted = load i64, ptr @ans, align 8, !tbaa !12
  %41 = icmp sgt i32 %71, 0
  br i1 %41, label %.lr.ph67.preheader, label %.preheader

.lr.ph67.preheader:                               ; preds = %.preheader53
  %wide.trip.count86 = zext nneg i32 %71 to i64
  %xtraiter = and i64 %wide.trip.count86, 1
  %42 = icmp eq i32 %71, 1
  br i1 %42, label %.preheader.loopexit.unr-lcssa, label %.lr.ph67.preheader.new

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

.lr.ph65:                                         ; preds = %.lr.ph65.preheader, %70
  %indvars.iv80 = phi i64 [ %indvars.iv.next81, %70 ], [ 0, %.lr.ph65.preheader ]
  %43 = getelementptr inbounds [101 x i32], ptr @r, i64 0, i64 %indvars.iv80
  %44 = load i32, ptr %43, align 4, !tbaa !5
  %.not49 = icmp eq i32 %44, 0
  br i1 %.not49, label %70, label %.preheader54

.preheader54:                                     ; preds = %.lr.ph65
  %45 = load i32, ptr @m, align 4, !tbaa !5
  %46 = icmp sgt i32 %45, 0
  br i1 %46, label %.lr.ph61, label %._crit_edge62

.lr.ph61:                                         ; preds = %.preheader54
  %47 = getelementptr inbounds [101 x [101 x i32]], ptr @e, i64 0, i64 %indvars.iv80
  %wide.trip.count = zext nneg i32 %45 to i64
  br label %51

._crit_edge62:                                    ; preds = %63, %.preheader54
  %48 = sext i32 %45 to i64
  tail call void @llvm.memset.p0.i64(ptr nonnull align 16 @vis, i8 0, i64 %48, i1 false)
  %49 = trunc nuw nsw i64 %indvars.iv80 to i32
  %50 = tail call noundef zeroext i1 @_Z4pathi(i32 noundef %49)
  br i1 %50, label %64, label %70

51:                                               ; preds = %.lr.ph61, %63
  %indvars.iv77 = phi i64 [ 0, %.lr.ph61 ], [ %indvars.iv.next78, %63 ]
  %52 = getelementptr inbounds [101 x [101 x i32]], ptr @a, i64 0, i64 %indvars.iv80, i64 %indvars.iv77
  %53 = load i32, ptr %52, align 4, !tbaa !5
  %.not50 = icmp eq i32 %53, 0
  br i1 %.not50, label %63, label %54

54:                                               ; preds = %51
  %55 = getelementptr inbounds [101 x i32], ptr @c, i64 0, i64 %indvars.iv77
  %56 = load i32, ptr %55, align 4, !tbaa !5
  %.not51 = icmp eq i32 %44, %56
  br i1 %.not51, label %57, label %63

57:                                               ; preds = %54
  %58 = load i32, ptr %47, align 4, !tbaa !5
  %59 = add nsw i32 %58, 1
  store i32 %59, ptr %47, align 4, !tbaa !5
  %60 = sext i32 %59 to i64
  %61 = getelementptr inbounds [101 x [101 x i32]], ptr @e, i64 0, i64 %indvars.iv80, i64 %60
  %62 = trunc nuw nsw i64 %indvars.iv77 to i32
  store i32 %62, ptr %61, align 4, !tbaa !5
  br label %63

63:                                               ; preds = %51, %54, %57
  %indvars.iv.next78 = add nuw nsw i64 %indvars.iv77, 1
  %exitcond.not = icmp eq i64 %indvars.iv.next78, %wide.trip.count
  br i1 %exitcond.not, label %._crit_edge62, label %51, !llvm.loop !15

64:                                               ; preds = %._crit_edge62
  %65 = load i32, ptr %43, align 4, !tbaa !5
  %66 = add nsw i32 %65, -1
  %67 = sext i32 %66 to i64
  %68 = load i64, ptr @ans, align 8, !tbaa !12
  %69 = add nsw i64 %68, %67
  store i64 %69, ptr @ans, align 8, !tbaa !12
  br label %70

70:                                               ; preds = %._crit_edge62, %64, %.lr.ph65
  %indvars.iv.next81 = add nuw nsw i64 %indvars.iv80, 1
  %71 = load i32, ptr @n, align 4, !tbaa !5
  %72 = sext i32 %71 to i64
  %73 = icmp slt i64 %indvars.iv.next81, %72
  br i1 %73, label %.lr.ph65, label %.preheader53, !llvm.loop !16

.preheader.loopexit.unr-lcssa:                    ; preds = %97, %.lr.ph67.preheader
  %.lcssa108.ph = phi i64 [ poison, %.lr.ph67.preheader ], [ %98, %97 ]
  %indvars.iv83.unr = phi i64 [ 0, %.lr.ph67.preheader ], [ %indvars.iv.next84.1, %97 ]
  %.unr = phi i64 [ %ans.promoted, %.lr.ph67.preheader ], [ %98, %97 ]
  %lcmp.mod.not = icmp eq i64 %xtraiter, 0
  br i1 %lcmp.mod.not, label %.preheader, label %.lr.ph67.epil

.lr.ph67.epil:                                    ; preds = %.preheader.loopexit.unr-lcssa
  %74 = getelementptr inbounds [101 x i32], ptr @r, i64 0, i64 %indvars.iv83.unr
  %75 = load i32, ptr %74, align 4, !tbaa !5
  %.not48.epil = icmp eq i32 %75, 0
  br i1 %.not48.epil, label %.preheader, label %76

76:                                               ; preds = %.lr.ph67.epil
  %77 = add nsw i32 %75, -1
  %78 = sext i32 %77 to i64
  %79 = sub nsw i64 %.unr, %78
  store i64 %79, ptr @ans, align 8, !tbaa !12
  br label %.preheader

.preheader:                                       ; preds = %.preheader.loopexit.unr-lcssa, %76, %.lr.ph67.epil, %.preheader53.thread, %.preheader53
  %ans.promoted68 = phi i64 [ %ans.promoted, %.preheader53 ], [ %ans.promoted97, %.preheader53.thread ], [ %.lcssa108.ph, %.preheader.loopexit.unr-lcssa ], [ %.unr, %.lr.ph67.epil ], [ %79, %76 ]
  %80 = load i32, ptr @m, align 4, !tbaa !5
  %81 = icmp sgt i32 %80, 0
  br i1 %81, label %.lr.ph70.preheader, label %._crit_edge71

.lr.ph70.preheader:                               ; preds = %.preheader
  %wide.trip.count91 = zext nneg i32 %80 to i64
  %xtraiter114 = and i64 %wide.trip.count91, 1
  %82 = icmp eq i32 %80, 1
  br i1 %82, label %._crit_edge71.loopexit.unr-lcssa, label %.lr.ph70.preheader.new

.lr.ph70.preheader.new:                           ; preds = %.lr.ph70.preheader
  %unroll_iter118 = and i64 %wide.trip.count91, 2147483646
  br label %.lr.ph70

.lr.ph67:                                         ; preds = %97, %.lr.ph67.preheader.new
  %indvars.iv83 = phi i64 [ 0, %.lr.ph67.preheader.new ], [ %indvars.iv.next84.1, %97 ]
  %83 = phi i64 [ %ans.promoted, %.lr.ph67.preheader.new ], [ %98, %97 ]
  %niter = phi i64 [ 0, %.lr.ph67.preheader.new ], [ %niter.next.1, %97 ]
  %84 = getelementptr inbounds [101 x i32], ptr @r, i64 0, i64 %indvars.iv83
  %85 = load i32, ptr %84, align 8, !tbaa !5
  %.not48 = icmp eq i32 %85, 0
  br i1 %.not48, label %.lr.ph67.1, label %86

86:                                               ; preds = %.lr.ph67
  %87 = add nsw i32 %85, -1
  %88 = sext i32 %87 to i64
  %89 = sub nsw i64 %83, %88
  store i64 %89, ptr @ans, align 8, !tbaa !12
  br label %.lr.ph67.1

.lr.ph67.1:                                       ; preds = %.lr.ph67, %86
  %90 = phi i64 [ %83, %.lr.ph67 ], [ %89, %86 ]
  %indvars.iv.next84 = or disjoint i64 %indvars.iv83, 1
  %91 = getelementptr inbounds [101 x i32], ptr @r, i64 0, i64 %indvars.iv.next84
  %92 = load i32, ptr %91, align 4, !tbaa !5
  %.not48.1 = icmp eq i32 %92, 0
  br i1 %.not48.1, label %97, label %93

93:                                               ; preds = %.lr.ph67.1
  %94 = add nsw i32 %92, -1
  %95 = sext i32 %94 to i64
  %96 = sub nsw i64 %90, %95
  store i64 %96, ptr @ans, align 8, !tbaa !12
  br label %97

97:                                               ; preds = %93, %.lr.ph67.1
  %98 = phi i64 [ %90, %.lr.ph67.1 ], [ %96, %93 ]
  %indvars.iv.next84.1 = add nuw nsw i64 %indvars.iv83, 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 %.preheader.loopexit.unr-lcssa, label %.lr.ph67, !llvm.loop !17

._crit_edge71.loopexit.unr-lcssa:                 ; preds = %121, %.lr.ph70.preheader
  %.lcssa.ph = phi i64 [ poison, %.lr.ph70.preheader ], [ %122, %121 ]
  %indvars.iv88.unr = phi i64 [ 0, %.lr.ph70.preheader ], [ %indvars.iv.next89.1, %121 ]
  %.unr115 = phi i64 [ %ans.promoted68, %.lr.ph70.preheader ], [ %122, %121 ]
  %lcmp.mod116.not = icmp eq i64 %xtraiter114, 0
  br i1 %lcmp.mod116.not, label %._crit_edge71, label %.lr.ph70.epil

.lr.ph70.epil:                                    ; preds = %._crit_edge71.loopexit.unr-lcssa
  %99 = getelementptr inbounds [101 x i32], ptr @c, i64 0, i64 %indvars.iv88.unr
  %100 = load i32, ptr %99, align 4, !tbaa !5
  %.not.epil = icmp eq i32 %100, 0
  br i1 %.not.epil, label %._crit_edge71, label %101

101:                                              ; preds = %.lr.ph70.epil
  %102 = add nsw i32 %100, -1
  %103 = sext i32 %102 to i64
  %104 = sub nsw i64 %.unr115, %103
  store i64 %104, ptr @ans, align 8, !tbaa !12
  br label %._crit_edge71

._crit_edge71:                                    ; preds = %._crit_edge71.loopexit.unr-lcssa, %101, %.lr.ph70.epil, %.preheader
  %105 = phi i64 [ %ans.promoted68, %.preheader ], [ %.lcssa.ph, %._crit_edge71.loopexit.unr-lcssa ], [ %.unr115, %.lr.ph70.epil ], [ %104, %101 ]
  %106 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i64 noundef %105)
  ret i32 0

.lr.ph70:                                         ; preds = %121, %.lr.ph70.preheader.new
  %indvars.iv88 = phi i64 [ 0, %.lr.ph70.preheader.new ], [ %indvars.iv.next89.1, %121 ]
  %107 = phi i64 [ %ans.promoted68, %.lr.ph70.preheader.new ], [ %122, %121 ]
  %niter119 = phi i64 [ 0, %.lr.ph70.preheader.new ], [ %niter119.next.1, %121 ]
  %108 = getelementptr inbounds [101 x i32], ptr @c, i64 0, i64 %indvars.iv88
  %109 = load i32, ptr %108, align 8, !tbaa !5
  %.not = icmp eq i32 %109, 0
  br i1 %.not, label %.lr.ph70.1, label %110

110:                                              ; preds = %.lr.ph70
  %111 = add nsw i32 %109, -1
  %112 = sext i32 %111 to i64
  %113 = sub nsw i64 %107, %112
  store i64 %113, ptr @ans, align 8, !tbaa !12
  br label %.lr.ph70.1

.lr.ph70.1:                                       ; preds = %.lr.ph70, %110
  %114 = phi i64 [ %107, %.lr.ph70 ], [ %113, %110 ]
  %indvars.iv.next89 = or disjoint i64 %indvars.iv88, 1
  %115 = getelementptr inbounds [101 x i32], ptr @c, i64 0, i64 %indvars.iv.next89
  %116 = load i32, ptr %115, align 4, !tbaa !5
  %.not.1 = icmp eq i32 %116, 0
  br i1 %.not.1, label %121, label %117

117:                                              ; preds = %.lr.ph70.1
  %118 = add nsw i32 %116, -1
  %119 = sext i32 %118 to i64
  %120 = sub nsw i64 %114, %119
  store i64 %120, ptr @ans, align 8, !tbaa !12
  br label %121

121:                                              ; preds = %117, %.lr.ph70.1
  %122 = phi i64 [ %114, %.lr.ph70.1 ], [ %120, %117 ]
  %indvars.iv.next89.1 = add nuw nsw i64 %indvars.iv88, 2
  %niter119.next.1 = add i64 %niter119, 2
  %niter119.ncmp.1 = icmp eq i64 %niter119.next.1, %unroll_iter118
  br i1 %niter119.ncmp.1, label %._crit_edge71.loopexit.unr-lcssa, label %.lr.ph70, !llvm.loop !18
}

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

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

; Function Attrs: mustprogress nocallback nofree nounwind willreturn memory(argmem: write)
declare void @llvm.memset.p0.i64(ptr nocapture writeonly, i8, i64, i1 immarg) #4

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

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 = { 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 #2 = { 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 #3 = { 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 #4 = { mustprogress nocallback nofree nounwind willreturn memory(argmem: write) }

!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 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C++ TBAA"}
!9 = distinct !{!9, !10, !11}
!10 = !{!"llvm.loop.mustprogress"}
!11 = !{!"llvm.loop.unswitch.partial.disable"}
!12 = !{!13, !13, i64 0}
!13 = !{!"long long", !7, i64 0}
!14 = distinct !{!14, !10}
!15 = distinct !{!15, !10}
!16 = distinct !{!16, !10}
!17 = distinct !{!17, !10}
!18 = distinct !{!18, !10}


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