; LLVM IR from tangjz/acm-icpc :: lydsy (1296)

; 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
@t = external dso_local global i32, align 4
@s = external dso_local global [52 x i32], align 16
@f = external dso_local global [52 x [52 x i32]], align 16
@g = external dso_local global [2501 x i32], align 16
@str = external dso_local global [52 x i8], align 16
@.str = external hidden unnamed_addr constant [7 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [3 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [4 x i8], align 1

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

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

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_Z3updRii(ptr noundef nonnull align 4 dereferenceable(4), i32 noundef) #0

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

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

16:                                               ; preds = %12
  store i32 2, ptr %3, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %2) #4
  br label %161

17:                                               ; preds = %12
  %18 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef @.str.1, ptr noundef getelementptr inbounds (i8, ptr @str, i64 1))
  call void @llvm.lifetime.start.p0(i64 4, ptr %4) #4
  store i32 1, ptr %4, align 4, !tbaa !5
  br label %19

19:                                               ; preds = %41, %17
  %20 = load i32, ptr %4, align 4, !tbaa !5
  %21 = load i32, ptr @m, align 4, !tbaa !5
  %22 = icmp sle i32 %20, %21
  br i1 %22, label %24, label %23

23:                                               ; preds = %19
  store i32 5, ptr %3, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %4) #4
  br label %44

24:                                               ; preds = %19
  %25 = load i32, ptr %4, align 4, !tbaa !5
  %26 = sub nsw i32 %25, 1
  %27 = sext i32 %26 to i64
  %28 = getelementptr inbounds [52 x i32], ptr @s, i64 0, i64 %27
  %29 = load i32, ptr %28, align 4, !tbaa !5
  %30 = load i32, ptr %4, align 4, !tbaa !5
  %31 = sext i32 %30 to i64
  %32 = getelementptr inbounds [52 x i8], ptr @str, i64 0, i64 %31
  %33 = load i8, ptr %32, align 1, !tbaa !9
  %34 = sext i8 %33 to i32
  %35 = icmp eq i32 %34, 49
  %36 = zext i1 %35 to i32
  %37 = add nsw i32 %29, %36
  %38 = load i32, ptr %4, align 4, !tbaa !5
  %39 = sext i32 %38 to i64
  %40 = getelementptr inbounds [52 x i32], ptr @s, i64 0, i64 %39
  store i32 %37, ptr %40, align 4, !tbaa !5
  br label %41

41:                                               ; preds = %24
  %42 = load i32, ptr %4, align 4, !tbaa !5
  %43 = add nsw i32 %42, 1
  store i32 %43, ptr %4, align 4, !tbaa !5
  br label %19, !llvm.loop !10

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

45:                                               ; preds = %115, %44
  %46 = load i32, ptr %5, align 4, !tbaa !5
  %47 = load i32, ptr @m, align 4, !tbaa !5
  %48 = icmp sle i32 %46, %47
  br i1 %48, label %50, label %49

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

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

51:                                               ; preds = %111, %50
  %52 = load i32, ptr %6, align 4, !tbaa !5
  %53 = load i32, ptr @m, align 4, !tbaa !5
  %54 = icmp sle i32 %52, %53
  br i1 %54, label %56, label %55

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

56:                                               ; preds = %51
  %57 = load i32, ptr %6, align 4, !tbaa !5
  %58 = sext i32 %57 to i64
  %59 = getelementptr inbounds [52 x [52 x i32]], ptr @f, i64 0, i64 %58
  %60 = load i32, ptr %5, align 4, !tbaa !5
  %61 = sext i32 %60 to i64
  %62 = getelementptr inbounds [52 x i32], ptr %59, i64 0, i64 %61
  store i32 0, ptr %62, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %7) #4
  store i32 0, ptr %7, align 4, !tbaa !5
  br label %63

63:                                               ; preds = %107, %56
  %64 = load i32, ptr %7, align 4, !tbaa !5
  %65 = load i32, ptr %6, align 4, !tbaa !5
  %66 = icmp slt i32 %64, %65
  br i1 %66, label %68, label %67

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

68:                                               ; preds = %63
  %69 = load i32, ptr %6, align 4, !tbaa !5
  %70 = sext i32 %69 to i64
  %71 = getelementptr inbounds [52 x [52 x i32]], ptr @f, i64 0, i64 %70
  %72 = load i32, ptr %5, align 4, !tbaa !5
  %73 = sext i32 %72 to i64
  %74 = getelementptr inbounds [52 x i32], ptr %71, i64 0, i64 %73
  %75 = load i32, ptr %7, align 4, !tbaa !5
  %76 = sext i32 %75 to i64
  %77 = getelementptr inbounds [52 x [52 x i32]], ptr @f, i64 0, i64 %76
  %78 = load i32, ptr %5, align 4, !tbaa !5
  %79 = sub nsw i32 %78, 1
  %80 = sext i32 %79 to i64
  %81 = getelementptr inbounds [52 x i32], ptr %77, i64 0, i64 %80
  %82 = load i32, ptr %81, align 4, !tbaa !5
  %83 = load i32, ptr %6, align 4, !tbaa !5
  %84 = sext i32 %83 to i64
  %85 = getelementptr inbounds [52 x i32], ptr @s, i64 0, i64 %84
  %86 = load i32, ptr %85, align 4, !tbaa !5
  %87 = load i32, ptr %7, align 4, !tbaa !5
  %88 = sext i32 %87 to i64
  %89 = getelementptr inbounds [52 x i32], ptr @s, i64 0, i64 %88
  %90 = load i32, ptr %89, align 4, !tbaa !5
  %91 = sub nsw i32 %86, %90
  %92 = load i32, ptr %6, align 4, !tbaa !5
  %93 = load i32, ptr %7, align 4, !tbaa !5
  %94 = sub nsw i32 %92, %93
  %95 = load i32, ptr %6, align 4, !tbaa !5
  %96 = sext i32 %95 to i64
  %97 = getelementptr inbounds [52 x i32], ptr @s, i64 0, i64 %96
  %98 = load i32, ptr %97, align 4, !tbaa !5
  %99 = sub nsw i32 %94, %98
  %100 = load i32, ptr %7, align 4, !tbaa !5
  %101 = sext i32 %100 to i64
  %102 = getelementptr inbounds [52 x i32], ptr @s, i64 0, i64 %101
  %103 = load i32, ptr %102, align 4, !tbaa !5
  %104 = add nsw i32 %99, %103
  %105 = call noundef i32 @_Z3maxii(i32 noundef %91, i32 noundef %104)
  %106 = add nsw i32 %82, %105
  call void @_Z3updRii(ptr noundef nonnull align 4 dereferenceable(4) %74, i32 noundef %106)
  br label %107

107:                                              ; preds = %68
  %108 = load i32, ptr %7, align 4, !tbaa !5
  %109 = add nsw i32 %108, 1
  store i32 %109, ptr %7, align 4, !tbaa !5
  br label %63, !llvm.loop !12

110:                                              ; preds = %67
  br label %111

111:                                              ; preds = %110
  %112 = load i32, ptr %6, align 4, !tbaa !5
  %113 = add nsw i32 %112, 1
  store i32 %113, ptr %6, align 4, !tbaa !5
  br label %51, !llvm.loop !13

114:                                              ; preds = %55
  br label %115

115:                                              ; preds = %114
  %116 = load i32, ptr %5, align 4, !tbaa !5
  %117 = add nsw i32 %116, 1
  store i32 %117, ptr %5, align 4, !tbaa !5
  br label %45, !llvm.loop !14

118:                                              ; preds = %49
  call void @llvm.lifetime.start.p0(i64 4, ptr %8) #4
  %119 = load i32, ptr @t, align 4, !tbaa !5
  store i32 %119, ptr %8, align 4, !tbaa !5
  br label %120

120:                                              ; preds = %154, %118
  %121 = load i32, ptr %8, align 4, !tbaa !5
  %122 = icmp ne i32 %121, 0
  br i1 %122, label %124, label %123

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

124:                                              ; preds = %120
  call void @llvm.lifetime.start.p0(i64 4, ptr %9) #4
  %125 = load i32, ptr %8, align 4, !tbaa !5
  %126 = load i32, ptr @m, align 4, !tbaa !5
  %127 = call noundef i32 @_Z3minii(i32 noundef %125, i32 noundef %126)
  store i32 %127, ptr %9, align 4, !tbaa !5
  br label %128

128:                                              ; preds = %150, %124
  %129 = load i32, ptr %9, align 4, !tbaa !5
  %130 = icmp ne i32 %129, 0
  br i1 %130, label %132, label %131

131:                                              ; preds = %128
  store i32 20, ptr %3, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %9) #4
  br label %153

132:                                              ; preds = %128
  %133 = load i32, ptr %8, align 4, !tbaa !5
  %134 = sext i32 %133 to i64
  %135 = getelementptr inbounds [2501 x i32], ptr @g, i64 0, i64 %134
  %136 = load i32, ptr %8, align 4, !tbaa !5
  %137 = load i32, ptr %9, align 4, !tbaa !5
  %138 = sub nsw i32 %136, %137
  %139 = sext i32 %138 to i64
  %140 = getelementptr inbounds [2501 x i32], ptr @g, i64 0, i64 %139
  %141 = load i32, ptr %140, align 4, !tbaa !5
  %142 = load i32, ptr @m, align 4, !tbaa !5
  %143 = sext i32 %142 to i64
  %144 = getelementptr inbounds [52 x [52 x i32]], ptr @f, i64 0, i64 %143
  %145 = load i32, ptr %9, align 4, !tbaa !5
  %146 = sext i32 %145 to i64
  %147 = getelementptr inbounds [52 x i32], ptr %144, i64 0, i64 %146
  %148 = load i32, ptr %147, align 4, !tbaa !5
  %149 = add nsw i32 %141, %148
  call void @_Z3updRii(ptr noundef nonnull align 4 dereferenceable(4) %135, i32 noundef %149)
  br label %150

150:                                              ; preds = %132
  %151 = load i32, ptr %9, align 4, !tbaa !5
  %152 = add nsw i32 %151, -1
  store i32 %152, ptr %9, align 4, !tbaa !5
  br label %128, !llvm.loop !15

153:                                              ; preds = %131
  br label %154

154:                                              ; preds = %153
  %155 = load i32, ptr %8, align 4, !tbaa !5
  %156 = add nsw i32 %155, -1
  store i32 %156, ptr %8, align 4, !tbaa !5
  br label %120, !llvm.loop !16

157:                                              ; preds = %123
  br label %158

158:                                              ; preds = %157
  %159 = load i32, ptr %2, align 4, !tbaa !5
  %160 = add nsw i32 %159, 1
  store i32 %160, ptr %2, align 4, !tbaa !5
  br label %12, !llvm.loop !17

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

162:                                              ; preds = %172, %161
  %163 = load i32, ptr %10, align 4, !tbaa !5
  %164 = load i32, ptr @t, align 4, !tbaa !5
  %165 = icmp sle i32 %163, %164
  br i1 %165, label %167, label %166

166:                                              ; preds = %162
  store i32 23, ptr %3, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %10) #4
  br label %175

167:                                              ; preds = %162
  %168 = load i32, ptr %10, align 4, !tbaa !5
  %169 = sext i32 %168 to i64
  %170 = getelementptr inbounds [2501 x i32], ptr @g, i64 0, i64 %169
  %171 = load i32, ptr %170, align 4, !tbaa !5
  call void @_Z3updRii(ptr noundef nonnull align 4 dereferenceable(4) @g, i32 noundef %171)
  br label %172

172:                                              ; preds = %167
  %173 = load i32, ptr %10, align 4, !tbaa !5
  %174 = add nsw i32 %173, 1
  store i32 %174, ptr %10, align 4, !tbaa !5
  br label %162, !llvm.loop !18

175:                                              ; preds = %166
  %176 = load i32, ptr @g, align 16, !tbaa !5
  %177 = call i32 (ptr, ...) @printf(ptr noundef @.str.2, i32 noundef %176)
  ret i32 0
}

declare i32 @__isoc99_scanf(ptr noundef, ...) #2

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

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

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

attributes #0 = { 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 #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 = { "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 = { 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 = !{!7, !7, i64 0}
!10 = distinct !{!10, !11}
!11 = !{!"llvm.loop.mustprogress"}
!12 = distinct !{!12, !11}
!13 = distinct !{!13, !11}
!14 = distinct !{!14, !11}
!15 = distinct !{!15, !11}
!16 = distinct !{!16, !11}
!17 = distinct !{!17, !11}
!18 = distinct !{!18, !11}


; 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
@t = external dso_local global i32, align 4
@s = external dso_local local_unnamed_addr global [52 x i32], align 16
@f = external dso_local global [52 x [52 x i32]], align 16
@g = external dso_local global [2501 x i32], align 16
@str = external dso_local global [52 x i8], align 16
@.str = external hidden unnamed_addr constant [7 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [3 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [4 x i8], align 1

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

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

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_Z3updRii(ptr noundef nonnull align 4 dereferenceable(4), i32 noundef) local_unnamed_addr #0

; Function Attrs: mustprogress norecurse nounwind 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, ptr noundef nonnull @t)
  %2 = load i32, ptr @n, align 4, !tbaa !5
  %3 = icmp sgt i32 %2, 0
  br i1 %3, label %.lr.ph74, label %.preheader

.preheader:                                       ; preds = %._crit_edge71, %0
  %4 = load i32, ptr @t, align 4, !tbaa !5
  %.not75 = icmp slt i32 %4, 1
  br i1 %.not75, label %._crit_edge78, label %.lr.ph77

.lr.ph74:                                         ; preds = %0, %._crit_edge71
  %.04472 = phi i32 [ %53, %._crit_edge71 ], [ 0, %0 ]
  %5 = tail call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull getelementptr inbounds (i8, ptr @str, i64 1))
  %6 = load i32, ptr @m, align 4, !tbaa !5
  %.not4553 = icmp slt i32 %6, 1
  br i1 %.not4553, label %._crit_edge61, label %.lr.ph.preheader

.lr.ph.preheader:                                 ; preds = %.lr.ph74
  %.pre = load i32, ptr @s, align 16, !tbaa !5
  %7 = zext nneg i32 %6 to i64
  %xtraiter = and i64 %7, 1
  %8 = icmp eq i32 %6, 1
  br i1 %8, label %.preheader52.unr-lcssa, label %.lr.ph.preheader.new

.lr.ph.preheader.new:                             ; preds = %.lr.ph.preheader
  %unroll_iter = and i64 %7, 2147483646
  br label %.lr.ph

.preheader52.unr-lcssa:                           ; preds = %.lr.ph, %.lr.ph.preheader
  %.unr = phi i32 [ %.pre, %.lr.ph.preheader ], [ %26, %.lr.ph ]
  %indvars.iv.unr = phi i64 [ 1, %.lr.ph.preheader ], [ %indvars.iv.next.1, %.lr.ph ]
  %lcmp.mod.not = icmp eq i64 %xtraiter, 0
  br i1 %lcmp.mod.not, label %.preheader52, label %.lr.ph.epil

.lr.ph.epil:                                      ; preds = %.preheader52.unr-lcssa
  %9 = getelementptr inbounds [52 x i8], ptr @str, i64 0, i64 %indvars.iv.unr
  %10 = load i8, ptr %9, align 1, !tbaa !9
  %11 = icmp eq i8 %10, 49
  %12 = zext i1 %11 to i32
  %13 = add nsw i32 %.unr, %12
  %14 = getelementptr inbounds [52 x i32], ptr @s, i64 0, i64 %indvars.iv.unr
  store i32 %13, ptr %14, align 4, !tbaa !5
  br label %.preheader52

.preheader52:                                     ; preds = %.preheader52.unr-lcssa, %.lr.ph.epil
  br i1 %.not4553, label %._crit_edge61, label %.preheader51

.lr.ph:                                           ; preds = %.lr.ph, %.lr.ph.preheader.new
  %15 = phi i32 [ %.pre, %.lr.ph.preheader.new ], [ %26, %.lr.ph ]
  %indvars.iv = phi i64 [ 1, %.lr.ph.preheader.new ], [ %indvars.iv.next.1, %.lr.ph ]
  %niter = phi i64 [ 0, %.lr.ph.preheader.new ], [ %niter.next.1, %.lr.ph ]
  %16 = getelementptr inbounds [52 x i8], ptr @str, i64 0, i64 %indvars.iv
  %17 = load i8, ptr %16, align 1, !tbaa !9
  %18 = icmp eq i8 %17, 49
  %19 = zext i1 %18 to i32
  %20 = add nsw i32 %15, %19
  %21 = getelementptr inbounds [52 x i32], ptr @s, i64 0, i64 %indvars.iv
  store i32 %20, ptr %21, align 4, !tbaa !5
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  %22 = getelementptr inbounds [52 x i8], ptr @str, i64 0, i64 %indvars.iv.next
  %23 = load i8, ptr %22, align 1, !tbaa !9
  %24 = icmp eq i8 %23, 49
  %25 = zext i1 %24 to i32
  %26 = add nsw i32 %20, %25
  %27 = getelementptr inbounds [52 x i32], ptr @s, i64 0, i64 %indvars.iv.next
  store i32 %26, ptr %27, align 4, !tbaa !5
  %indvars.iv.next.1 = add nuw nsw i64 %indvars.iv, 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 %.preheader52.unr-lcssa, label %.lr.ph, !llvm.loop !10

.preheader51:                                     ; preds = %.preheader52, %._crit_edge
  %28 = phi i32 [ %32, %._crit_edge ], [ %6, %.preheader52 ]
  %indvars.iv89 = phi i64 [ %indvars.iv.next90, %._crit_edge ], [ 1, %.preheader52 ]
  %.not4956 = icmp slt i32 %28, 1
  br i1 %.not4956, label %.preheader51.._crit_edge_crit_edge, label %.lr.ph58

.preheader51.._crit_edge_crit_edge:               ; preds = %.preheader51
  %.pre101 = sext i32 %28 to i64
  br label %._crit_edge

.lr.ph58:                                         ; preds = %.preheader51
  %29 = add nsw i64 %indvars.iv89, -1
  br label %33

._crit_edge61:                                    ; preds = %._crit_edge, %.lr.ph74, %.preheader52
  %30 = load i32, ptr @t, align 4, !tbaa !5
  %.not4767 = icmp eq i32 %30, 0
  br i1 %.not4767, label %._crit_edge71, label %.lr.ph70.preheader

.lr.ph70.preheader:                               ; preds = %._crit_edge61
  %31 = sext i32 %30 to i64
  br label %.lr.ph70

._crit_edge:                                      ; preds = %37, %.preheader51.._crit_edge_crit_edge
  %.pre-phi = phi i64 [ %.pre101, %.preheader51.._crit_edge_crit_edge ], [ %39, %37 ]
  %32 = phi i32 [ %28, %.preheader51.._crit_edge_crit_edge ], [ %38, %37 ]
  %indvars.iv.next90 = add nuw nsw i64 %indvars.iv89, 1
  %.not46.not = icmp slt i64 %indvars.iv89, %.pre-phi
  br i1 %.not46.not, label %.preheader51, label %._crit_edge61, !llvm.loop !12

33:                                               ; preds = %.lr.ph58, %37
  %indvars.iv86 = phi i64 [ 1, %.lr.ph58 ], [ %indvars.iv.next87, %37 ]
  %34 = getelementptr inbounds [52 x [52 x i32]], ptr @f, i64 0, i64 %indvars.iv86, i64 %indvars.iv89
  store i32 0, ptr %34, align 4, !tbaa !5
  %35 = getelementptr inbounds [52 x i32], ptr @s, i64 0, i64 %indvars.iv86
  %36 = trunc nuw nsw i64 %indvars.iv86 to i32
  br label %40

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

40:                                               ; preds = %33, %40
  %indvars.iv81 = phi i64 [ 0, %33 ], [ %indvars.iv.next82, %40 ]
  %41 = getelementptr inbounds [52 x [52 x i32]], ptr @f, i64 0, i64 %indvars.iv81, i64 %29
  %42 = load i32, ptr %41, align 4, !tbaa !5
  %43 = load i32, ptr %35, align 4, !tbaa !5
  %44 = getelementptr inbounds [52 x i32], ptr @s, i64 0, i64 %indvars.iv81
  %45 = load i32, ptr %44, align 4, !tbaa !5
  %46 = sub nsw i32 %43, %45
  %47 = trunc nuw nsw i64 %indvars.iv81 to i32
  %48 = add i32 %43, %47
  %49 = sub i32 %36, %48
  %50 = add nsw i32 %49, %45
  %51 = tail call noundef i32 @_Z3maxii(i32 noundef %46, i32 noundef %50)
  %52 = add nsw i32 %51, %42
  tail call void @_Z3updRii(ptr noundef nonnull align 4 dereferenceable(4) %34, i32 noundef %52)
  %indvars.iv.next82 = add nuw nsw i64 %indvars.iv81, 1
  %exitcond85.not = icmp eq i64 %indvars.iv.next82, %indvars.iv86
  br i1 %exitcond85.not, label %37, label %40, !llvm.loop !15

._crit_edge71:                                    ; preds = %._crit_edge66, %._crit_edge61
  %53 = add nuw nsw i32 %.04472, 1
  %54 = load i32, ptr @n, align 4, !tbaa !5
  %55 = icmp slt i32 %53, %54
  br i1 %55, label %.lr.ph74, label %.preheader, !llvm.loop !16

.lr.ph70:                                         ; preds = %.lr.ph70.preheader, %._crit_edge66
  %indvars.iv95 = phi i64 [ %31, %.lr.ph70.preheader ], [ %indvars.iv.next96, %._crit_edge66 ]
  %56 = load i32, ptr @m, align 4, !tbaa !5
  %57 = trunc nsw i64 %indvars.iv95 to i32
  %58 = tail call noundef i32 @_Z3minii(i32 noundef %57, i32 noundef %56)
  %.not4862 = icmp eq i32 %58, 0
  br i1 %.not4862, label %._crit_edge66, label %.lr.ph65

.lr.ph65:                                         ; preds = %.lr.ph70
  %59 = getelementptr inbounds [2501 x i32], ptr @g, i64 0, i64 %indvars.iv95
  %60 = sext i32 %58 to i64
  br label %61

._crit_edge66:                                    ; preds = %61, %.lr.ph70
  %indvars.iv.next96 = add nsw i64 %indvars.iv95, -1
  %.not47 = icmp eq i64 %indvars.iv.next96, 0
  br i1 %.not47, label %._crit_edge71, label %.lr.ph70, !llvm.loop !17

61:                                               ; preds = %.lr.ph65, %61
  %indvars.iv92 = phi i64 [ %60, %.lr.ph65 ], [ %indvars.iv.next93, %61 ]
  %62 = sub nsw i64 %indvars.iv95, %indvars.iv92
  %63 = getelementptr inbounds [2501 x i32], ptr @g, i64 0, i64 %62
  %64 = load i32, ptr %63, align 4, !tbaa !5
  %65 = load i32, ptr @m, align 4, !tbaa !5
  %66 = sext i32 %65 to i64
  %67 = getelementptr inbounds [52 x [52 x i32]], ptr @f, i64 0, i64 %66, i64 %indvars.iv92
  %68 = load i32, ptr %67, align 4, !tbaa !5
  %69 = add nsw i32 %68, %64
  tail call void @_Z3updRii(ptr noundef nonnull align 4 dereferenceable(4) %59, i32 noundef %69)
  %indvars.iv.next93 = add nsw i64 %indvars.iv92, -1
  %.not48 = icmp eq i64 %indvars.iv.next93, 0
  br i1 %.not48, label %._crit_edge66, label %61, !llvm.loop !18

._crit_edge78:                                    ; preds = %.lr.ph77, %.preheader
  %70 = load i32, ptr @g, align 16, !tbaa !5
  %71 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %70)
  ret i32 0

.lr.ph77:                                         ; preds = %.preheader, %.lr.ph77
  %indvars.iv98 = phi i64 [ %indvars.iv.next99, %.lr.ph77 ], [ 1, %.preheader ]
  %72 = getelementptr inbounds [2501 x i32], ptr @g, i64 0, i64 %indvars.iv98
  %73 = load i32, ptr %72, align 4, !tbaa !5
  tail call void @_Z3updRii(ptr noundef nonnull align 4 dereferenceable(4) @g, i32 noundef %73)
  %indvars.iv.next99 = add nuw nsw i64 %indvars.iv98, 1
  %74 = load i32, ptr @t, align 4, !tbaa !5
  %75 = sext i32 %74 to i64
  %.not.not = icmp slt i64 %indvars.iv98, %75
  br i1 %.not.not, label %.lr.ph77, label %._crit_edge78, !llvm.loop !19
}

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

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

attributes #0 = { 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 #1 = { mustprogress norecurse 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 #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" }

!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 = !{!7, !7, i64 0}
!10 = distinct !{!10, !11}
!11 = !{!"llvm.loop.mustprogress"}
!12 = distinct !{!12, !11, !13}
!13 = !{!"llvm.loop.unswitch.partial.disable"}
!14 = distinct !{!14, !11}
!15 = distinct !{!15, !11}
!16 = distinct !{!16, !11}
!17 = distinct !{!17, !11}
!18 = distinct !{!18, !11}
!19 = distinct !{!19, !11}


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