; LLVM IR from eyangch/competitive-programming :: Codeforces/1675 (g)

; Unoptimized IR (clang -disable-llvm-passes):
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-i128:128-f80:128-n8:16:32:64-S128"
target triple = "x86_64-unknown-linux-gnu"

%"class.std::basic_istream" = type { ptr, i64, %"class.std::basic_ios" }
%"class.std::basic_ios" = type { %"class.std::ios_base", ptr, i8, i8, ptr, ptr, ptr, ptr }
%"class.std::ios_base" = type { ptr, i64, i64, i32, i32, i32, ptr, %"struct.std::ios_base::_Words", [8 x %"struct.std::ios_base::_Words"], i32, ptr, %"class.std::locale" }
%"struct.std::ios_base::_Words" = type { ptr, i64 }
%"class.std::locale" = type { ptr }
%"class.std::basic_ostream" = type { ptr, %"class.std::basic_ios" }

@N = external dso_local global i64, align 8
@M = external dso_local global i64, align 8
@A = external dso_local global [250 x i64], align 16
@dp = external dso_local global [251 x [251 x [251 x i64]]], align 16
@mn = external dso_local global [251 x [251 x [251 x i64]]], align 16
@_ZSt3cin = external global %"class.std::basic_istream", align 8
@_ZSt4cout = external global %"class.std::basic_ostream", align 8

; Function Attrs: mustprogress uwtable
declare dso_local void @_Z7upd_minxx(i64 noundef, i64 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 i64, align 8
  %3 = alloca i64, align 8
  %4 = alloca i32, align 4
  %5 = alloca i64, align 8
  %6 = alloca i64, align 8
  %7 = alloca i64, align 8
  %8 = alloca i64, align 8
  %9 = alloca i64, align 8
  %10 = alloca i64, align 8
  store i32 0, ptr %1, align 4
  %11 = load ptr, ptr @_ZSt3cin, align 8, !tbaa !5
  %12 = getelementptr i8, ptr %11, i64 -24
  %13 = load i64, ptr %12, align 8
  %14 = getelementptr inbounds i8, ptr @_ZSt3cin, i64 %13
  %15 = call noundef ptr @_ZNSt9basic_iosIcSt11char_traitsIcEE3tieEPSo(ptr noundef nonnull align 8 dereferenceable(264) %14, ptr noundef null)
  %16 = call noundef zeroext i1 @_ZNSt8ios_base15sync_with_stdioEb(i1 noundef zeroext false)
  %17 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERx(ptr noundef nonnull align 8 dereferenceable(16) @_ZSt3cin, ptr noundef nonnull align 8 dereferenceable(8) @N)
  %18 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERx(ptr noundef nonnull align 8 dereferenceable(16) %17, ptr noundef nonnull align 8 dereferenceable(8) @M)
  call void @llvm.lifetime.start.p0(i64 8, ptr %2) #7
  store i64 0, ptr %2, align 8, !tbaa !8
  br label %19

19:                                               ; preds = %28, %0
  %20 = load i64, ptr %2, align 8, !tbaa !8
  %21 = load i64, ptr @N, align 8, !tbaa !8
  %22 = icmp slt i64 %20, %21
  br i1 %22, label %24, label %23

23:                                               ; preds = %19
  call void @llvm.lifetime.end.p0(i64 8, ptr %2) #7
  br label %31

24:                                               ; preds = %19
  %25 = load i64, ptr %2, align 8, !tbaa !8
  %26 = getelementptr inbounds [250 x i64], ptr @A, i64 0, i64 %25
  %27 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERx(ptr noundef nonnull align 8 dereferenceable(16) @_ZSt3cin, ptr noundef nonnull align 8 dereferenceable(8) %26)
  br label %28

28:                                               ; preds = %24
  %29 = load i64, ptr %2, align 8, !tbaa !8
  %30 = add nsw i64 %29, 1
  store i64 %30, ptr %2, align 8, !tbaa !8
  br label %19, !llvm.loop !11

31:                                               ; preds = %23
  call void @llvm.lifetime.start.p0(i64 8, ptr %3) #7
  store i64 0, ptr %3, align 8, !tbaa !8
  br label %32

32:                                               ; preds = %70, %31
  %33 = load i64, ptr %3, align 8, !tbaa !8
  %34 = load i64, ptr @N, align 8, !tbaa !8
  %35 = icmp sle i64 %33, %34
  br i1 %35, label %37, label %36

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

37:                                               ; preds = %32
  call void @llvm.lifetime.start.p0(i64 8, ptr %5) #7
  store i64 0, ptr %5, align 8, !tbaa !8
  br label %38

38:                                               ; preds = %66, %37
  %39 = load i64, ptr %5, align 8, !tbaa !8
  %40 = load i64, ptr @M, align 8, !tbaa !8
  %41 = icmp sle i64 %39, %40
  br i1 %41, label %43, label %42

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

43:                                               ; preds = %38
  call void @llvm.lifetime.start.p0(i64 8, ptr %6) #7
  store i64 0, ptr %6, align 8, !tbaa !8
  br label %44

44:                                               ; preds = %62, %43
  %45 = load i64, ptr %6, align 8, !tbaa !8
  %46 = load i64, ptr @M, align 8, !tbaa !8
  %47 = icmp sle i64 %45, %46
  br i1 %47, label %49, label %48

48:                                               ; preds = %44
  store i32 11, ptr %4, align 4
  call void @llvm.lifetime.end.p0(i64 8, ptr %6) #7
  br label %65

49:                                               ; preds = %44
  %50 = load i64, ptr %3, align 8, !tbaa !8
  %51 = getelementptr inbounds [251 x [251 x [251 x i64]]], ptr @dp, i64 0, i64 %50
  %52 = load i64, ptr %5, align 8, !tbaa !8
  %53 = getelementptr inbounds [251 x [251 x i64]], ptr %51, i64 0, i64 %52
  %54 = load i64, ptr %6, align 8, !tbaa !8
  %55 = getelementptr inbounds [251 x i64], ptr %53, i64 0, i64 %54
  store i64 1000000000000000, ptr %55, align 8, !tbaa !8
  %56 = load i64, ptr %3, align 8, !tbaa !8
  %57 = getelementptr inbounds [251 x [251 x [251 x i64]]], ptr @mn, i64 0, i64 %56
  %58 = load i64, ptr %5, align 8, !tbaa !8
  %59 = getelementptr inbounds [251 x [251 x i64]], ptr %57, i64 0, i64 %58
  %60 = load i64, ptr %6, align 8, !tbaa !8
  %61 = getelementptr inbounds [251 x i64], ptr %59, i64 0, i64 %60
  store i64 1000000000000000, ptr %61, align 8, !tbaa !8
  br label %62

62:                                               ; preds = %49
  %63 = load i64, ptr %6, align 8, !tbaa !8
  %64 = add nsw i64 %63, 1
  store i64 %64, ptr %6, align 8, !tbaa !8
  br label %44, !llvm.loop !13

65:                                               ; preds = %48
  br label %66

66:                                               ; preds = %65
  %67 = load i64, ptr %5, align 8, !tbaa !8
  %68 = add nsw i64 %67, 1
  store i64 %68, ptr %5, align 8, !tbaa !8
  br label %38, !llvm.loop !14

69:                                               ; preds = %42
  br label %70

70:                                               ; preds = %69
  %71 = load i64, ptr %3, align 8, !tbaa !8
  %72 = add nsw i64 %71, 1
  store i64 %72, ptr %3, align 8, !tbaa !8
  br label %32, !llvm.loop !15

73:                                               ; preds = %36
  %74 = load i64, ptr @M, align 8, !tbaa !8
  %75 = getelementptr inbounds [251 x i64], ptr @dp, i64 0, i64 %74
  store i64 0, ptr %75, align 8, !tbaa !8
  call void @_Z7upd_minxx(i64 noundef 0, i64 noundef 0)
  call void @llvm.lifetime.start.p0(i64 8, ptr %7) #7
  store i64 0, ptr %7, align 8, !tbaa !8
  call void @llvm.lifetime.start.p0(i64 8, ptr %8) #7
  store i64 1, ptr %8, align 8, !tbaa !8
  br label %76

76:                                               ; preds = %131, %73
  %77 = load i64, ptr %8, align 8, !tbaa !8
  %78 = load i64, ptr @N, align 8, !tbaa !8
  %79 = icmp sle i64 %77, %78
  br i1 %79, label %81, label %80

80:                                               ; preds = %76
  store i32 14, ptr %4, align 4
  call void @llvm.lifetime.end.p0(i64 8, ptr %8) #7
  br label %134

81:                                               ; preds = %76
  %82 = load i64, ptr %8, align 8, !tbaa !8
  %83 = sub nsw i64 %82, 1
  %84 = getelementptr inbounds [250 x i64], ptr @A, i64 0, i64 %83
  %85 = load i64, ptr %84, align 8, !tbaa !8
  %86 = load i64, ptr %7, align 8, !tbaa !8
  %87 = add nsw i64 %86, %85
  store i64 %87, ptr %7, align 8, !tbaa !8
  call void @llvm.lifetime.start.p0(i64 8, ptr %9) #7
  store i64 0, ptr %9, align 8, !tbaa !8
  br label %88

88:                                               ; preds = %127, %81
  %89 = load i64, ptr %9, align 8, !tbaa !8
  %90 = load i64, ptr @M, align 8, !tbaa !8
  %91 = icmp sle i64 %89, %90
  br i1 %91, label %93, label %92

92:                                               ; preds = %88
  store i32 17, ptr %4, align 4
  call void @llvm.lifetime.end.p0(i64 8, ptr %9) #7
  br label %130

93:                                               ; preds = %88
  call void @llvm.lifetime.start.p0(i64 8, ptr %10) #7
  store i64 0, ptr %10, align 8, !tbaa !8
  br label %94

94:                                               ; preds = %121, %93
  %95 = load i64, ptr %10, align 8, !tbaa !8
  %96 = load i64, ptr %9, align 8, !tbaa !8
  %97 = icmp sle i64 %95, %96
  br i1 %97, label %99, label %98

98:                                               ; preds = %94
  store i32 20, ptr %4, align 4
  call void @llvm.lifetime.end.p0(i64 8, ptr %10) #7
  br label %124

99:                                               ; preds = %94
  %100 = load i64, ptr %8, align 8, !tbaa !8
  %101 = sub nsw i64 %100, 1
  %102 = getelementptr inbounds [251 x [251 x [251 x i64]]], ptr @mn, i64 0, i64 %101
  %103 = load i64, ptr %9, align 8, !tbaa !8
  %104 = load i64, ptr %10, align 8, !tbaa !8
  %105 = sub nsw i64 %103, %104
  %106 = getelementptr inbounds [251 x [251 x i64]], ptr %102, i64 0, i64 %105
  %107 = load i64, ptr %10, align 8, !tbaa !8
  %108 = getelementptr inbounds [251 x i64], ptr %106, i64 0, i64 %107
  %109 = load i64, ptr %108, align 8, !tbaa !8
  %110 = load i64, ptr %7, align 8, !tbaa !8
  %111 = load i64, ptr %9, align 8, !tbaa !8
  %112 = sub nsw i64 %110, %111
  %113 = call noundef i64 @_ZSt3absx(i64 noundef %112)
  %114 = add nsw i64 %109, %113
  %115 = load i64, ptr %8, align 8, !tbaa !8
  %116 = getelementptr inbounds [251 x [251 x [251 x i64]]], ptr @dp, i64 0, i64 %115
  %117 = load i64, ptr %9, align 8, !tbaa !8
  %118 = getelementptr inbounds [251 x [251 x i64]], ptr %116, i64 0, i64 %117
  %119 = load i64, ptr %10, align 8, !tbaa !8
  %120 = getelementptr inbounds [251 x i64], ptr %118, i64 0, i64 %119
  store i64 %114, ptr %120, align 8, !tbaa !8
  br label %121

121:                                              ; preds = %99
  %122 = load i64, ptr %10, align 8, !tbaa !8
  %123 = add nsw i64 %122, 1
  store i64 %123, ptr %10, align 8, !tbaa !8
  br label %94, !llvm.loop !16

124:                                              ; preds = %98
  %125 = load i64, ptr %8, align 8, !tbaa !8
  %126 = load i64, ptr %9, align 8, !tbaa !8
  call void @_Z7upd_minxx(i64 noundef %125, i64 noundef %126)
  br label %127

127:                                              ; preds = %124
  %128 = load i64, ptr %9, align 8, !tbaa !8
  %129 = add nsw i64 %128, 1
  store i64 %129, ptr %9, align 8, !tbaa !8
  br label %88, !llvm.loop !17

130:                                              ; preds = %92
  br label %131

131:                                              ; preds = %130
  %132 = load i64, ptr %8, align 8, !tbaa !8
  %133 = add nsw i64 %132, 1
  store i64 %133, ptr %8, align 8, !tbaa !8
  br label %76, !llvm.loop !18

134:                                              ; preds = %80
  %135 = load i64, ptr @N, align 8, !tbaa !8
  %136 = getelementptr inbounds [251 x [251 x [251 x i64]]], ptr @mn, i64 0, i64 %135
  %137 = load i64, ptr @M, align 8, !tbaa !8
  %138 = getelementptr inbounds [251 x [251 x i64]], ptr %136, i64 0, i64 %137
  %139 = getelementptr inbounds [251 x i64], ptr %138, i64 0, i64 0
  %140 = load i64, ptr %139, align 8, !tbaa !8
  %141 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEx(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cout, i64 noundef %140)
  %142 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_c(ptr noundef nonnull align 8 dereferenceable(8) %141, i8 noundef signext 10)
  call void @llvm.lifetime.end.p0(i64 8, ptr %7) #7
  %143 = load i32, ptr %1, align 4
  ret i32 %143
}

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

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

; Function Attrs: mustprogress uwtable
declare noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERx(ptr noundef nonnull align 8 dereferenceable(16), ptr noundef nonnull align 8 dereferenceable(8)) #0 align 2

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef i64 @_ZSt3absx(i64 noundef) #5

; Function Attrs: inlinehint mustprogress uwtable
declare noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_c(ptr noundef nonnull align 8 dereferenceable(8), i8 noundef signext) #6

; Function Attrs: mustprogress uwtable
declare noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEx(ptr noundef nonnull align 8 dereferenceable(8), i64 noundef) #0 align 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 = { 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 = { 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 = { "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 = { 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 #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 = !{!"vtable pointer", !7, i64 0}
!7 = !{!"Simple C++ TBAA"}
!8 = !{!9, !9, i64 0}
!9 = !{!"long long", !10, i64 0}
!10 = !{!"omnipotent char", !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}
!18 = distinct !{!18, !12}


; Optimized IR (opt -passes='default<O3>'):
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-i128:128-f80:128-n8:16:32:64-S128"
target triple = "x86_64-unknown-linux-gnu"

%"class.std::basic_istream" = type { ptr, i64, %"class.std::basic_ios" }
%"class.std::basic_ios" = type { %"class.std::ios_base", ptr, i8, i8, ptr, ptr, ptr, ptr }
%"class.std::ios_base" = type { ptr, i64, i64, i32, i32, i32, ptr, %"struct.std::ios_base::_Words", [8 x %"struct.std::ios_base::_Words"], i32, ptr, %"class.std::locale" }
%"struct.std::ios_base::_Words" = type { ptr, i64 }
%"class.std::locale" = type { ptr }
%"class.std::basic_ostream" = type { ptr, %"class.std::basic_ios" }

@N = external dso_local global i64, align 8
@M = external dso_local global i64, align 8
@A = external dso_local global [250 x i64], align 16
@dp = external dso_local local_unnamed_addr global [251 x [251 x [251 x i64]]], align 16
@mn = external dso_local local_unnamed_addr global [251 x [251 x [251 x i64]]], align 16
@_ZSt3cin = external global %"class.std::basic_istream", align 8
@_ZSt4cout = external global %"class.std::basic_ostream", align 8

; Function Attrs: mustprogress uwtable
declare dso_local void @_Z7upd_minxx(i64 noundef, i64 noundef) local_unnamed_addr #0

; Function Attrs: mustprogress norecurse uwtable
define dso_local noundef i32 @main() local_unnamed_addr #1 {
  %1 = load ptr, ptr @_ZSt3cin, align 8, !tbaa !5
  %2 = getelementptr i8, ptr %1, i64 -24
  %3 = load i64, ptr %2, align 8
  %4 = getelementptr inbounds i8, ptr @_ZSt3cin, i64 %3
  %5 = tail call noundef ptr @_ZNSt9basic_iosIcSt11char_traitsIcEE3tieEPSo(ptr noundef nonnull align 8 dereferenceable(264) %4, ptr noundef null)
  %6 = tail call noundef zeroext i1 @_ZNSt8ios_base15sync_with_stdioEb(i1 noundef zeroext false)
  %7 = tail call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERx(ptr noundef nonnull align 8 dereferenceable(16) @_ZSt3cin, ptr noundef nonnull align 8 dereferenceable(8) @N)
  %8 = tail call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERx(ptr noundef nonnull align 8 dereferenceable(16) %7, ptr noundef nonnull align 8 dereferenceable(8) @M)
  %9 = load i64, ptr @N, align 8, !tbaa !8
  %10 = icmp sgt i64 %9, 0
  br i1 %10, label %.lr.ph, label %.preheader51

.preheader51:                                     ; preds = %.lr.ph, %0
  %.lcssa52 = phi i64 [ %9, %0 ], [ %15, %.lr.ph ]
  %.not60 = icmp slt i64 %.lcssa52, 0
  %.pre = load i64, ptr @M, align 8, !tbaa !8
  %.not4757 = icmp slt i64 %.pre, 0
  %or.cond = select i1 %.not60, i1 true, i1 %.not4757
  br i1 %or.cond, label %._crit_edge62, label %.preheader50.preheader

.preheader50.preheader:                           ; preds = %.preheader51
  %11 = add nuw i64 %.pre, 1
  %min.iters.check = icmp ult i64 %.pre, 3
  %n.vec = and i64 %11, -4
  %cmp.n = icmp eq i64 %11, %n.vec
  br label %.preheader50

.lr.ph:                                           ; preds = %0, %.lr.ph
  %.04253 = phi i64 [ %14, %.lr.ph ], [ 0, %0 ]
  %12 = getelementptr inbounds [250 x i64], ptr @A, i64 0, i64 %.04253
  %13 = tail call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERx(ptr noundef nonnull align 8 dereferenceable(16) @_ZSt3cin, ptr noundef nonnull align 8 dereferenceable(8) %12)
  %14 = add nuw nsw i64 %.04253, 1
  %15 = load i64, ptr @N, align 8, !tbaa !8
  %16 = icmp slt i64 %14, %15
  br i1 %16, label %.lr.ph, label %.preheader51, !llvm.loop !11

.preheader50:                                     ; preds = %.preheader50.preheader, %._crit_edge59.split
  %.04161 = phi i64 [ %25, %._crit_edge59.split ], [ 0, %.preheader50.preheader ]
  br label %.preheader49

._crit_edge62:                                    ; preds = %._crit_edge59.split, %.preheader51
  %17 = getelementptr inbounds [251 x i64], ptr @dp, i64 0, i64 %.pre
  store i64 0, ptr %17, align 8, !tbaa !8
  tail call void @_Z7upd_minxx(i64 noundef 0, i64 noundef 0)
  %18 = load i64, ptr @N, align 8, !tbaa !8
  %.not4467 = icmp slt i64 %18, 1
  %.pre82 = load i64, ptr @M, align 8, !tbaa !8
  %19 = icmp slt i64 %.pre82, 0
  %or.cond87 = select i1 %.not4467, i1 true, i1 %19
  br i1 %or.cond87, label %._crit_edge72, label %.lr.ph71.split

.preheader49:                                     ; preds = %.preheader50, %._crit_edge
  %.04058 = phi i64 [ 0, %.preheader50 ], [ %26, %._crit_edge ]
  br i1 %min.iters.check, label %scalar.ph.preheader, label %vector.body

scalar.ph.preheader:                              ; preds = %middle.block, %.preheader49
  %.03955.ph = phi i64 [ 0, %.preheader49 ], [ %n.vec, %middle.block ]
  br label %scalar.ph

vector.body:                                      ; preds = %.preheader49, %vector.body
  %index = phi i64 [ %index.next, %vector.body ], [ 0, %.preheader49 ]
  %20 = getelementptr inbounds [251 x [251 x [251 x i64]]], ptr @dp, i64 0, i64 %.04161, i64 %.04058, i64 %index
  %21 = getelementptr inbounds i8, ptr %20, i64 16
  store <2 x i64> <i64 1000000000000000, i64 1000000000000000>, ptr %20, align 8, !tbaa !8
  store <2 x i64> <i64 1000000000000000, i64 1000000000000000>, ptr %21, align 8, !tbaa !8
  %22 = getelementptr inbounds [251 x [251 x [251 x i64]]], ptr @mn, i64 0, i64 %.04161, i64 %.04058, i64 %index
  %23 = getelementptr inbounds i8, ptr %22, i64 16
  store <2 x i64> <i64 1000000000000000, i64 1000000000000000>, ptr %22, align 8, !tbaa !8
  store <2 x i64> <i64 1000000000000000, i64 1000000000000000>, ptr %23, align 8, !tbaa !8
  %index.next = add nuw i64 %index, 4
  %24 = icmp eq i64 %index.next, %n.vec
  br i1 %24, label %middle.block, label %vector.body, !llvm.loop !13

middle.block:                                     ; preds = %vector.body
  br i1 %cmp.n, label %._crit_edge, label %scalar.ph.preheader

._crit_edge59.split:                              ; preds = %._crit_edge
  %25 = add nuw i64 %.04161, 1
  %exitcond79.not = icmp eq i64 %.04161, %.lcssa52
  br i1 %exitcond79.not, label %._crit_edge62, label %.preheader50, !llvm.loop !16

._crit_edge:                                      ; preds = %scalar.ph, %middle.block
  %26 = add nuw i64 %.04058, 1
  %exitcond78.not = icmp eq i64 %.04058, %.pre
  br i1 %exitcond78.not, label %._crit_edge59.split, label %.preheader49, !llvm.loop !17

scalar.ph:                                        ; preds = %scalar.ph.preheader, %scalar.ph
  %.03955 = phi i64 [ %29, %scalar.ph ], [ %.03955.ph, %scalar.ph.preheader ]
  %27 = getelementptr inbounds [251 x [251 x [251 x i64]]], ptr @dp, i64 0, i64 %.04161, i64 %.04058, i64 %.03955
  store i64 1000000000000000, ptr %27, align 8, !tbaa !8
  %28 = getelementptr inbounds [251 x [251 x [251 x i64]]], ptr @mn, i64 0, i64 %.04161, i64 %.04058, i64 %.03955
  store i64 1000000000000000, ptr %28, align 8, !tbaa !8
  %29 = add nuw i64 %.03955, 1
  %exitcond.not = icmp eq i64 %.03955, %.pre
  br i1 %exitcond.not, label %._crit_edge, label %scalar.ph, !llvm.loop !18

._crit_edge72:                                    ; preds = %._crit_edge66, %._crit_edge62
  %30 = phi i64 [ %.pre82, %._crit_edge62 ], [ %43, %._crit_edge66 ]
  %.lcssa = phi i64 [ %18, %._crit_edge62 ], [ %42, %._crit_edge66 ]
  %31 = getelementptr inbounds [251 x [251 x [251 x i64]]], ptr @mn, i64 0, i64 %.lcssa, i64 %30
  %32 = load i64, ptr %31, align 8, !tbaa !8
  %33 = tail call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEx(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cout, i64 noundef %32)
  %34 = tail call noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_c(ptr noundef nonnull align 8 dereferenceable(8) %33, i8 noundef signext 10)
  ret i32 0

.lr.ph71.split:                                   ; preds = %._crit_edge62, %._crit_edge66
  %35 = phi i64 [ %42, %._crit_edge66 ], [ %18, %._crit_edge62 ]
  %36 = phi i64 [ %43, %._crit_edge66 ], [ %.pre82, %._crit_edge62 ]
  %.03769 = phi i64 [ %44, %._crit_edge66 ], [ 1, %._crit_edge62 ]
  %.03868 = phi i64 [ %40, %._crit_edge66 ], [ 0, %._crit_edge62 ]
  %37 = add nsw i64 %.03769, -1
  %38 = getelementptr inbounds [250 x i64], ptr @A, i64 0, i64 %37
  %39 = load i64, ptr %38, align 8, !tbaa !8
  %40 = add nsw i64 %39, %.03868
  %.not4564 = icmp slt i64 %36, 0
  br i1 %.not4564, label %._crit_edge66, label %.preheader

.preheader:                                       ; preds = %.lr.ph71.split, %45
  %indvars.iv = phi i64 [ %indvars.iv.next, %45 ], [ 1, %.lr.ph71.split ]
  %.03665 = phi i64 [ %46, %45 ], [ 0, %.lr.ph71.split ]
  %41 = sub nsw i64 %40, %.03665
  br label %48

._crit_edge66.loopexit:                           ; preds = %45
  %.pre81 = load i64, ptr @N, align 8, !tbaa !8
  br label %._crit_edge66

._crit_edge66:                                    ; preds = %._crit_edge66.loopexit, %.lr.ph71.split
  %42 = phi i64 [ %.pre81, %._crit_edge66.loopexit ], [ %35, %.lr.ph71.split ]
  %43 = phi i64 [ %47, %._crit_edge66.loopexit ], [ %36, %.lr.ph71.split ]
  %44 = add nuw nsw i64 %.03769, 1
  %.not44.not = icmp slt i64 %.03769, %42
  br i1 %.not44.not, label %.lr.ph71.split, label %._crit_edge72, !llvm.loop !19

45:                                               ; preds = %48
  tail call void @_Z7upd_minxx(i64 noundef %.03769, i64 noundef %.03665)
  %46 = add nuw nsw i64 %.03665, 1
  %47 = load i64, ptr @M, align 8, !tbaa !8
  %.not45.not = icmp slt i64 %.03665, %47
  %indvars.iv.next = add nuw i64 %indvars.iv, 1
  br i1 %.not45.not, label %.preheader, label %._crit_edge66.loopexit, !llvm.loop !21

48:                                               ; preds = %.preheader, %48
  %.063 = phi i64 [ 0, %.preheader ], [ %55, %48 ]
  %49 = sub nsw i64 %.03665, %.063
  %50 = getelementptr inbounds [251 x [251 x [251 x i64]]], ptr @mn, i64 0, i64 %37, i64 %49, i64 %.063
  %51 = load i64, ptr %50, align 8, !tbaa !8
  %52 = tail call noundef i64 @_ZSt3absx(i64 noundef %41)
  %53 = add nsw i64 %52, %51
  %54 = getelementptr inbounds [251 x [251 x [251 x i64]]], ptr @dp, i64 0, i64 %.03769, i64 %.03665, i64 %.063
  store i64 %53, ptr %54, align 8, !tbaa !8
  %55 = add nuw i64 %.063, 1
  %exitcond80.not = icmp eq i64 %55, %indvars.iv
  br i1 %exitcond80.not, label %45, label %48, !llvm.loop !22
}

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

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

; Function Attrs: mustprogress uwtable
declare noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERx(ptr noundef nonnull align 8 dereferenceable(16), ptr noundef nonnull align 8 dereferenceable(8)) local_unnamed_addr #0 align 2

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef i64 @_ZSt3absx(i64 noundef) local_unnamed_addr #4

; Function Attrs: inlinehint mustprogress uwtable
declare noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_c(ptr noundef nonnull align 8 dereferenceable(8), i8 noundef signext) local_unnamed_addr #5

; Function Attrs: mustprogress uwtable
declare noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEx(ptr noundef nonnull align 8 dereferenceable(8), i64 noundef) local_unnamed_addr #0 align 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 = { mustprogress nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { "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 = { 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" }

!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}

!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"clang version 19.1.0 (git@github.com:llvm/llvm-project.git a4bf6cd7cfb1a1421ba92bca9d017b49936c55e4)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"vtable pointer", !7, i64 0}
!7 = !{!"Simple C++ TBAA"}
!8 = !{!9, !9, i64 0}
!9 = !{!"long long", !10, i64 0}
!10 = !{!"omnipotent char", !7, i64 0}
!11 = distinct !{!11, !12}
!12 = !{!"llvm.loop.mustprogress"}
!13 = distinct !{!13, !12, !14, !15}
!14 = !{!"llvm.loop.isvectorized", i32 1}
!15 = !{!"llvm.loop.unroll.runtime.disable"}
!16 = distinct !{!16, !12}
!17 = distinct !{!17, !12}
!18 = distinct !{!18, !12, !15, !14}
!19 = distinct !{!19, !12, !20}
!20 = !{!"llvm.loop.unswitch.partial.disable"}
!21 = distinct !{!21, !12}
!22 = distinct !{!22, !12}


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