; LLVM IR from VastoLorde95/Competitive-Programming :: Codeforces/122 Division 1/Problem A (A)

; 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::__cxx11::basic_string" = type { %"struct.std::__cxx11::basic_string<char>::_Alloc_hider", i64, %union.anon }
%"struct.std::__cxx11::basic_string<char>::_Alloc_hider" = type { ptr }
%union.anon = type { i64, [8 x i8] }
%"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 }

@n = external dso_local global i32, align 4
@m = external dso_local global i32, align 4
@grid = external dso_local global [50 x [50 x i32]], align 16
@v = external dso_local global [50 x [50 x i32]], align 16
@mn = external dso_local global i32, align 4
@p = external dso_local global i32, align 4
@cnt = external dso_local global i32, align 4
@_Z1sB5cxx11 = external dso_local global %"class.std::__cxx11::basic_string", align 8
@.str = external hidden unnamed_addr constant [5 x i8], align 1
@_ZSt3cin = external global %"class.std::basic_istream", align 8
@.str.2 = external hidden unnamed_addr constant [4 x i8], align 1
@.str.3 = external hidden unnamed_addr constant [4 x i8], align 1

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

; Function Attrs: mustprogress uwtable
declare dso_local void @_Z3dfsii(i32 noundef, i32 noundef) #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
  store i32 0, ptr %1, align 4
  %7 = 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 %8

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

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

13:                                               ; preds = %8
  %14 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZStrsIcSt11char_traitsIcESaIcEERSt13basic_istreamIT_T0_ES7_RNSt7__cxx1112basic_stringIS4_S5_T1_EE(ptr noundef nonnull align 8 dereferenceable(16) @_ZSt3cin, ptr noundef nonnull align 8 dereferenceable(32) @_Z1sB5cxx11)
  call void @llvm.lifetime.start.p0(i64 4, ptr %4) #6
  store i32 0, ptr %4, align 4, !tbaa !5
  br label %15

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

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

20:                                               ; preds = %15
  %21 = load i32, ptr %4, align 4, !tbaa !5
  %22 = sext i32 %21 to i64
  %23 = call noundef nonnull align 1 dereferenceable(1) ptr @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEixEm(ptr noundef nonnull align 8 dereferenceable(32) @_Z1sB5cxx11, i64 noundef %22)
  %24 = load i8, ptr %23, align 1, !tbaa !9
  %25 = sext i8 %24 to i32
  %26 = icmp eq i32 %25, 35
  %27 = zext i1 %26 to i32
  %28 = load i32, ptr %2, align 4, !tbaa !5
  %29 = sext i32 %28 to i64
  %30 = getelementptr inbounds [50 x [50 x i32]], ptr @grid, i64 0, i64 %29
  %31 = load i32, ptr %4, align 4, !tbaa !5
  %32 = sext i32 %31 to i64
  %33 = getelementptr inbounds [50 x i32], ptr %30, i64 0, i64 %32
  store i32 %27, ptr %33, align 4, !tbaa !5
  %34 = load i32, ptr %2, align 4, !tbaa !5
  %35 = sext i32 %34 to i64
  %36 = getelementptr inbounds [50 x [50 x i32]], ptr @grid, i64 0, i64 %35
  %37 = load i32, ptr %4, align 4, !tbaa !5
  %38 = sext i32 %37 to i64
  %39 = getelementptr inbounds [50 x i32], ptr %36, i64 0, i64 %38
  %40 = load i32, ptr %39, align 4, !tbaa !5
  %41 = load i32, ptr @p, align 4, !tbaa !5
  %42 = add nsw i32 %41, %40
  store i32 %42, ptr @p, align 4, !tbaa !5
  br label %43

43:                                               ; preds = %20
  %44 = load i32, ptr %4, align 4, !tbaa !5
  %45 = add nsw i32 %44, 1
  store i32 %45, ptr %4, align 4, !tbaa !5
  br label %15, !llvm.loop !10

46:                                               ; preds = %19
  br label %47

47:                                               ; preds = %46
  %48 = load i32, ptr %2, align 4, !tbaa !5
  %49 = add nsw i32 %48, 1
  store i32 %49, ptr %2, align 4, !tbaa !5
  br label %8, !llvm.loop !12

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

51:                                               ; preds = %134, %50
  %52 = load i32, ptr %5, align 4, !tbaa !5
  %53 = load i32, ptr @n, align 4, !tbaa !5
  %54 = icmp slt i32 %52, %53
  br i1 %54, label %56, label %55

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

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

57:                                               ; preds = %130, %56
  %58 = load i32, ptr %6, align 4, !tbaa !5
  %59 = load i32, ptr @m, align 4, !tbaa !5
  %60 = icmp slt i32 %58, %59
  br i1 %60, label %62, label %61

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

62:                                               ; preds = %57
  %63 = load i32, ptr %5, align 4, !tbaa !5
  %64 = sext i32 %63 to i64
  %65 = getelementptr inbounds [50 x [50 x i32]], ptr @grid, i64 0, i64 %64
  %66 = load i32, ptr %6, align 4, !tbaa !5
  %67 = sext i32 %66 to i64
  %68 = getelementptr inbounds [50 x i32], ptr %65, i64 0, i64 %67
  %69 = load i32, ptr %68, align 4, !tbaa !5
  %70 = icmp eq i32 %69, 1
  br i1 %70, label %71, label %129

71:                                               ; preds = %62
  %72 = load i32, ptr %5, align 4, !tbaa !5
  %73 = sext i32 %72 to i64
  %74 = getelementptr inbounds [50 x [50 x i32]], ptr @grid, i64 0, i64 %73
  %75 = load i32, ptr %6, align 4, !tbaa !5
  %76 = sext i32 %75 to i64
  %77 = getelementptr inbounds [50 x i32], ptr %74, i64 0, i64 %76
  store i32 0, ptr %77, align 4, !tbaa !5
  store i32 0, ptr @cnt, align 4, !tbaa !5
  call void @llvm.memset.p0.i64(ptr align 16 @v, i8 0, i64 10000, i1 false)
  %78 = load i32, ptr %5, align 4, !tbaa !5
  %79 = add nsw i32 %78, 1
  %80 = load i32, ptr %6, align 4, !tbaa !5
  %81 = call noundef zeroext i1 @_Z7inrangeii(i32 noundef %79, i32 noundef %80)
  br i1 %81, label %82, label %86

82:                                               ; preds = %71
  %83 = load i32, ptr %5, align 4, !tbaa !5
  %84 = add nsw i32 %83, 1
  %85 = load i32, ptr %6, align 4, !tbaa !5
  call void @_Z3dfsii(i32 noundef %84, i32 noundef %85)
  br label %116

86:                                               ; preds = %71
  %87 = load i32, ptr %5, align 4, !tbaa !5
  %88 = sub nsw i32 %87, 1
  %89 = load i32, ptr %6, align 4, !tbaa !5
  %90 = call noundef zeroext i1 @_Z7inrangeii(i32 noundef %88, i32 noundef %89)
  br i1 %90, label %91, label %95

91:                                               ; preds = %86
  %92 = load i32, ptr %5, align 4, !tbaa !5
  %93 = sub nsw i32 %92, 1
  %94 = load i32, ptr %6, align 4, !tbaa !5
  call void @_Z3dfsii(i32 noundef %93, i32 noundef %94)
  br label %115

95:                                               ; preds = %86
  %96 = load i32, ptr %5, align 4, !tbaa !5
  %97 = load i32, ptr %6, align 4, !tbaa !5
  %98 = add nsw i32 %97, 1
  %99 = call noundef zeroext i1 @_Z7inrangeii(i32 noundef %96, i32 noundef %98)
  br i1 %99, label %100, label %104

100:                                              ; preds = %95
  %101 = load i32, ptr %5, align 4, !tbaa !5
  %102 = load i32, ptr %6, align 4, !tbaa !5
  %103 = add nsw i32 %102, 1
  call void @_Z3dfsii(i32 noundef %101, i32 noundef %103)
  br label %114

104:                                              ; preds = %95
  %105 = load i32, ptr %5, align 4, !tbaa !5
  %106 = load i32, ptr %6, align 4, !tbaa !5
  %107 = sub nsw i32 %106, 1
  %108 = call noundef zeroext i1 @_Z7inrangeii(i32 noundef %105, i32 noundef %107)
  br i1 %108, label %109, label %113

109:                                              ; preds = %104
  %110 = load i32, ptr %5, align 4, !tbaa !5
  %111 = load i32, ptr %6, align 4, !tbaa !5
  %112 = sub nsw i32 %111, 1
  call void @_Z3dfsii(i32 noundef %110, i32 noundef %112)
  br label %113

113:                                              ; preds = %109, %104
  br label %114

114:                                              ; preds = %113, %100
  br label %115

115:                                              ; preds = %114, %91
  br label %116

116:                                              ; preds = %115, %82
  %117 = load i32, ptr @cnt, align 4, !tbaa !5
  %118 = load i32, ptr @p, align 4, !tbaa !5
  %119 = sub nsw i32 %118, 1
  %120 = icmp slt i32 %117, %119
  br i1 %120, label %121, label %122

121:                                              ; preds = %116
  store i32 1, ptr @mn, align 4, !tbaa !5
  br label %122

122:                                              ; preds = %121, %116
  %123 = load i32, ptr %5, align 4, !tbaa !5
  %124 = sext i32 %123 to i64
  %125 = getelementptr inbounds [50 x [50 x i32]], ptr @grid, i64 0, i64 %124
  %126 = load i32, ptr %6, align 4, !tbaa !5
  %127 = sext i32 %126 to i64
  %128 = getelementptr inbounds [50 x i32], ptr %125, i64 0, i64 %127
  store i32 1, ptr %128, align 4, !tbaa !5
  br label %129

129:                                              ; preds = %122, %62
  br label %130

130:                                              ; preds = %129
  %131 = load i32, ptr %6, align 4, !tbaa !5
  %132 = add nsw i32 %131, 1
  store i32 %132, ptr %6, align 4, !tbaa !5
  br label %57, !llvm.loop !13

133:                                              ; preds = %61
  br label %134

134:                                              ; preds = %133
  %135 = load i32, ptr %5, align 4, !tbaa !5
  %136 = add nsw i32 %135, 1
  store i32 %136, ptr %5, align 4, !tbaa !5
  br label %51, !llvm.loop !14

137:                                              ; preds = %55
  %138 = load i32, ptr @p, align 4, !tbaa !5
  %139 = icmp sle i32 %138, 2
  br i1 %139, label %140, label %142

140:                                              ; preds = %137
  %141 = call i32 (ptr, ...) @printf(ptr noundef @.str.2)
  br label %145

142:                                              ; preds = %137
  %143 = load i32, ptr @mn, align 4, !tbaa !5
  %144 = call i32 (ptr, ...) @printf(ptr noundef @.str.3, i32 noundef %143)
  br label %145

145:                                              ; preds = %142, %140
  ret i32 0
}

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

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

declare noundef nonnull align 8 dereferenceable(16) ptr @_ZStrsIcSt11char_traitsIcESaIcEERSt13basic_istreamIT_T0_ES7_RNSt7__cxx1112basic_stringIS4_S5_T1_EE(ptr noundef nonnull align 8 dereferenceable(16), ptr noundef nonnull align 8 dereferenceable(32)) #3

; Function Attrs: mustprogress nounwind uwtable
declare noundef nonnull align 1 dereferenceable(1) ptr @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEixEm(ptr noundef nonnull align 8 dereferenceable(32), i64 noundef) #0 align 2

; Function Attrs: nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #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 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 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 = { 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 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
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 = !{!7, !7, i64 0}
!10 = distinct !{!10, !11}
!11 = !{!"llvm.loop.mustprogress"}
!12 = distinct !{!12, !11}
!13 = distinct !{!13, !11}
!14 = distinct !{!14, !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"

%"class.std::__cxx11::basic_string" = type { %"struct.std::__cxx11::basic_string<char>::_Alloc_hider", i64, %union.anon }
%"struct.std::__cxx11::basic_string<char>::_Alloc_hider" = type { ptr }
%union.anon = type { i64, [8 x i8] }
%"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 }

@n = external dso_local global i32, align 4
@m = external dso_local global i32, align 4
@grid = external dso_local local_unnamed_addr global [50 x [50 x i32]], align 16
@v = external dso_local local_unnamed_addr global [50 x [50 x i32]], align 16
@mn = external dso_local local_unnamed_addr global i32, align 4
@p = external dso_local local_unnamed_addr global i32, align 4
@cnt = external dso_local local_unnamed_addr global i32, align 4
@_Z1sB5cxx11 = external dso_local global %"class.std::__cxx11::basic_string", align 8
@.str = external hidden unnamed_addr constant [5 x i8], align 1
@_ZSt3cin = external global %"class.std::basic_istream", align 8
@.str.2 = external hidden unnamed_addr constant [4 x i8], align 1
@.str.3 = external hidden unnamed_addr constant [4 x i8], align 1

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

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

; Function Attrs: mustprogress norecurse uwtable
define dso_local noundef i32 @main() local_unnamed_addr #2 {
  %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
  br i1 %3, label %.lr.ph42, label %._crit_edge48

.preheader38:                                     ; preds = %._crit_edge
  %4 = icmp sgt i32 %10, 0
  %5 = load i32, ptr @m, align 4
  %6 = icmp sgt i32 %5, 0
  %or.cond = select i1 %4, i1 %6, i1 false
  br i1 %or.cond, label %.preheader, label %._crit_edge48

.lr.ph42:                                         ; preds = %0, %._crit_edge
  %indvars.iv51 = phi i64 [ %indvars.iv.next52, %._crit_edge ], [ 0, %0 ]
  %7 = tail call noundef nonnull align 8 dereferenceable(16) ptr @_ZStrsIcSt11char_traitsIcESaIcEERSt13basic_istreamIT_T0_ES7_RNSt7__cxx1112basic_stringIS4_S5_T1_EE(ptr noundef nonnull align 8 dereferenceable(16) @_ZSt3cin, ptr noundef nonnull align 8 dereferenceable(32) @_Z1sB5cxx11)
  %8 = load i32, ptr @m, align 4, !tbaa !5
  %9 = icmp sgt i32 %8, 0
  br i1 %9, label %.lr.ph, label %._crit_edge

._crit_edge:                                      ; preds = %.lr.ph, %.lr.ph42
  %indvars.iv.next52 = add nuw nsw i64 %indvars.iv51, 1
  %10 = load i32, ptr @n, align 4, !tbaa !5
  %11 = sext i32 %10 to i64
  %12 = icmp slt i64 %indvars.iv.next52, %11
  br i1 %12, label %.lr.ph42, label %.preheader38, !llvm.loop !9

.lr.ph:                                           ; preds = %.lr.ph42, %.lr.ph
  %indvars.iv = phi i64 [ %indvars.iv.next, %.lr.ph ], [ 0, %.lr.ph42 ]
  %13 = tail call noundef nonnull align 1 dereferenceable(1) ptr @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEixEm(ptr noundef nonnull align 8 dereferenceable(32) @_Z1sB5cxx11, i64 noundef %indvars.iv)
  %14 = load i8, ptr %13, align 1, !tbaa !11
  %15 = icmp eq i8 %14, 35
  %16 = zext i1 %15 to i32
  %17 = getelementptr inbounds [50 x [50 x i32]], ptr @grid, i64 0, i64 %indvars.iv51, i64 %indvars.iv
  store i32 %16, ptr %17, align 4, !tbaa !5
  %18 = load i32, ptr @p, align 4, !tbaa !5
  %19 = add nsw i32 %18, %16
  store i32 %19, ptr @p, align 4, !tbaa !5
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  %20 = load i32, ptr @m, align 4, !tbaa !5
  %21 = sext i32 %20 to i64
  %22 = icmp slt i64 %indvars.iv.next, %21
  br i1 %22, label %.lr.ph, label %._crit_edge, !llvm.loop !12

.preheader:                                       ; preds = %.preheader38, %._crit_edge46
  %23 = phi i32 [ %34, %._crit_edge46 ], [ %10, %.preheader38 ]
  %24 = phi i32 [ %35, %._crit_edge46 ], [ %5, %.preheader38 ]
  %25 = phi i32 [ %36, %._crit_edge46 ], [ %5, %.preheader38 ]
  %indvars.iv57 = phi i64 [ %27, %._crit_edge46 ], [ 0, %.preheader38 ]
  %26 = icmp sgt i32 %25, 0
  %27 = add nuw nsw i64 %indvars.iv57, 1
  br i1 %26, label %.lr.ph45, label %._crit_edge46

.lr.ph45:                                         ; preds = %.preheader
  %28 = trunc nuw nsw i64 %27 to i32
  %29 = trunc i64 %indvars.iv57 to i32
  %30 = add i32 %29, -1
  %31 = trunc nuw nsw i64 %indvars.iv57 to i32
  br label %39

._crit_edge48:                                    ; preds = %._crit_edge46, %0, %.preheader38
  %32 = load i32, ptr @p, align 4, !tbaa !5
  %33 = icmp slt i32 %32, 3
  br i1 %33, label %72, label %74

._crit_edge46.loopexit:                           ; preds = %68
  %.pre60 = load i32, ptr @n, align 4, !tbaa !5
  br label %._crit_edge46

._crit_edge46:                                    ; preds = %.preheader, %._crit_edge46.loopexit
  %34 = phi i32 [ %.pre60, %._crit_edge46.loopexit ], [ %23, %.preheader ]
  %35 = phi i32 [ %69, %._crit_edge46.loopexit ], [ %24, %.preheader ]
  %36 = phi i32 [ %69, %._crit_edge46.loopexit ], [ %25, %.preheader ]
  %37 = sext i32 %34 to i64
  %38 = icmp slt i64 %27, %37
  br i1 %38, label %.preheader, label %._crit_edge48, !llvm.loop !13

39:                                               ; preds = %.lr.ph45, %68
  %40 = phi i32 [ %24, %.lr.ph45 ], [ %69, %68 ]
  %indvars.iv54 = phi i64 [ 0, %.lr.ph45 ], [ %indvars.iv.next55, %68 ]
  %41 = getelementptr inbounds [50 x [50 x i32]], ptr @grid, i64 0, i64 %indvars.iv57, i64 %indvars.iv54
  %42 = load i32, ptr %41, align 4, !tbaa !5
  %43 = icmp eq i32 %42, 1
  br i1 %43, label %44, label %68

44:                                               ; preds = %39
  store i32 0, ptr %41, align 4, !tbaa !5
  store i32 0, ptr @cnt, align 4, !tbaa !5
  tail call void @llvm.memset.p0.i64(ptr noundef nonnull align 16 dereferenceable(10000) @v, i8 0, i64 10000, i1 false)
  %45 = trunc nuw nsw i64 %indvars.iv54 to i32
  %46 = tail call noundef zeroext i1 @_Z7inrangeii(i32 noundef %28, i32 noundef %45)
  br i1 %46, label %47, label %48

47:                                               ; preds = %44
  tail call void @_Z3dfsii(i32 noundef %28, i32 noundef %45)
  br label %61

48:                                               ; preds = %44
  %49 = tail call noundef zeroext i1 @_Z7inrangeii(i32 noundef %30, i32 noundef %45)
  br i1 %49, label %50, label %51

50:                                               ; preds = %48
  tail call void @_Z3dfsii(i32 noundef %30, i32 noundef %45)
  br label %61

51:                                               ; preds = %48
  %52 = trunc i64 %indvars.iv54 to i32
  %53 = add i32 %52, 1
  %54 = tail call noundef zeroext i1 @_Z7inrangeii(i32 noundef %31, i32 noundef %53)
  br i1 %54, label %55, label %56

55:                                               ; preds = %51
  tail call void @_Z3dfsii(i32 noundef %31, i32 noundef %53)
  br label %61

56:                                               ; preds = %51
  %57 = trunc i64 %indvars.iv54 to i32
  %58 = add i32 %57, -1
  %59 = tail call noundef zeroext i1 @_Z7inrangeii(i32 noundef %31, i32 noundef %58)
  br i1 %59, label %60, label %61

60:                                               ; preds = %56
  tail call void @_Z3dfsii(i32 noundef %31, i32 noundef %58)
  br label %61

61:                                               ; preds = %50, %56, %60, %55, %47
  %62 = load i32, ptr @cnt, align 4, !tbaa !5
  %63 = load i32, ptr @p, align 4, !tbaa !5
  %64 = add nsw i32 %63, -1
  %65 = icmp slt i32 %62, %64
  br i1 %65, label %66, label %67

66:                                               ; preds = %61
  store i32 1, ptr @mn, align 4, !tbaa !5
  br label %67

67:                                               ; preds = %66, %61
  store i32 1, ptr %41, align 4, !tbaa !5
  %.pre = load i32, ptr @m, align 4, !tbaa !5
  br label %68

68:                                               ; preds = %39, %67
  %69 = phi i32 [ %40, %39 ], [ %.pre, %67 ]
  %indvars.iv.next55 = add nuw nsw i64 %indvars.iv54, 1
  %70 = sext i32 %69 to i64
  %71 = icmp slt i64 %indvars.iv.next55, %70
  br i1 %71, label %39, label %._crit_edge46.loopexit, !llvm.loop !15

72:                                               ; preds = %._crit_edge48
  %73 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2)
  br label %77

74:                                               ; preds = %._crit_edge48
  %75 = load i32, ptr @mn, align 4, !tbaa !5
  %76 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.3, i32 noundef %75)
  br label %77

77:                                               ; preds = %74, %72
  ret i32 0
}

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

declare noundef nonnull align 8 dereferenceable(16) ptr @_ZStrsIcSt11char_traitsIcESaIcEERSt13basic_istreamIT_T0_ES7_RNSt7__cxx1112basic_stringIS4_S5_T1_EE(ptr noundef nonnull align 8 dereferenceable(16), ptr noundef nonnull align 8 dereferenceable(32)) local_unnamed_addr #4

; Function Attrs: mustprogress nounwind uwtable
declare noundef nonnull align 1 dereferenceable(1) ptr @_ZNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEixEm(ptr noundef nonnull align 8 dereferenceable(32), i64 noundef) local_unnamed_addr #0 align 2

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

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

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


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