; LLVM IR from upupming/algorithm :: acwing/算法基础课/第五讲 动态规划/线性DP/902. 最短编辑距离 (main)

; 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_ostream" = type { ptr, %"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
@f = external dso_local global [1010 x [1010 x i32]], align 16
@a = external dso_local global [1010 x i8], align 16
@b = external dso_local global [1010 x i8], align 16
@.str = external hidden unnamed_addr constant [9 x i8], align 1
@_ZSt4cout = external global %"class.std::basic_ostream", align 8

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

11:                                               ; preds = %21, %0
  %12 = load i32, ptr %2, align 4, !tbaa !5
  %13 = load i32, ptr @m, align 4, !tbaa !5
  %14 = icmp sle i32 %12, %13
  br i1 %14, label %16, label %15

15:                                               ; preds = %11
  call void @llvm.lifetime.end.p0(i64 4, ptr %2) #6
  br label %24

16:                                               ; preds = %11
  %17 = load i32, ptr %2, align 4, !tbaa !5
  %18 = load i32, ptr %2, align 4, !tbaa !5
  %19 = sext i32 %18 to i64
  %20 = getelementptr inbounds [1010 x i32], ptr @f, i64 0, i64 %19
  store i32 %17, ptr %20, align 4, !tbaa !5
  br label %21

21:                                               ; preds = %16
  %22 = load i32, ptr %2, align 4, !tbaa !5
  %23 = add nsw i32 %22, 1
  store i32 %23, ptr %2, align 4, !tbaa !5
  br label %11, !llvm.loop !9

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

25:                                               ; preds = %36, %24
  %26 = load i32, ptr %3, align 4, !tbaa !5
  %27 = load i32, ptr @n, align 4, !tbaa !5
  %28 = icmp sle i32 %26, %27
  br i1 %28, label %30, label %29

29:                                               ; preds = %25
  call void @llvm.lifetime.end.p0(i64 4, ptr %3) #6
  br label %39

30:                                               ; preds = %25
  %31 = load i32, ptr %3, align 4, !tbaa !5
  %32 = load i32, ptr %3, align 4, !tbaa !5
  %33 = sext i32 %32 to i64
  %34 = getelementptr inbounds [1010 x [1010 x i32]], ptr @f, i64 0, i64 %33
  %35 = getelementptr inbounds [1010 x i32], ptr %34, i64 0, i64 0
  store i32 %31, ptr %35, align 8, !tbaa !5
  br label %36

36:                                               ; preds = %30
  %37 = load i32, ptr %3, align 4, !tbaa !5
  %38 = add nsw i32 %37, 1
  store i32 %38, ptr %3, align 4, !tbaa !5
  br label %25, !llvm.loop !11

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

40:                                               ; preds = %119, %39
  %41 = load i32, ptr %4, align 4, !tbaa !5
  %42 = load i32, ptr @n, align 4, !tbaa !5
  %43 = icmp sle i32 %41, %42
  br i1 %43, label %45, label %44

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

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

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

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

51:                                               ; preds = %46
  call void @llvm.lifetime.start.p0(i64 4, ptr %7) #6
  %52 = load i32, ptr %4, align 4, !tbaa !5
  %53 = sub nsw i32 %52, 1
  %54 = sext i32 %53 to i64
  %55 = getelementptr inbounds [1010 x [1010 x i32]], ptr @f, i64 0, i64 %54
  %56 = load i32, ptr %6, align 4, !tbaa !5
  %57 = sext i32 %56 to i64
  %58 = getelementptr inbounds [1010 x i32], ptr %55, i64 0, i64 %57
  %59 = load i32, ptr %58, align 4, !tbaa !5
  %60 = add nsw i32 %59, 1
  store i32 %60, ptr %7, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %8) #6
  %61 = load i32, ptr %4, align 4, !tbaa !5
  %62 = sext i32 %61 to i64
  %63 = getelementptr inbounds [1010 x [1010 x i32]], ptr @f, i64 0, i64 %62
  %64 = load i32, ptr %6, align 4, !tbaa !5
  %65 = sub nsw i32 %64, 1
  %66 = sext i32 %65 to i64
  %67 = getelementptr inbounds [1010 x i32], ptr %63, i64 0, i64 %66
  %68 = load i32, ptr %67, align 4, !tbaa !5
  %69 = add nsw i32 %68, 1
  store i32 %69, ptr %8, align 4, !tbaa !5
  %70 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZSt3minIiERKT_S2_S2_(ptr noundef nonnull align 4 dereferenceable(4) %7, ptr noundef nonnull align 4 dereferenceable(4) %8)
  %71 = load i32, ptr %70, align 4, !tbaa !5
  %72 = load i32, ptr %4, align 4, !tbaa !5
  %73 = sext i32 %72 to i64
  %74 = getelementptr inbounds [1010 x [1010 x i32]], ptr @f, i64 0, i64 %73
  %75 = load i32, ptr %6, align 4, !tbaa !5
  %76 = sext i32 %75 to i64
  %77 = getelementptr inbounds [1010 x i32], ptr %74, i64 0, i64 %76
  store i32 %71, ptr %77, align 4, !tbaa !5
  call void @llvm.lifetime.end.p0(i64 4, ptr %8) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr %7) #6
  %78 = load i32, ptr %4, align 4, !tbaa !5
  %79 = sext i32 %78 to i64
  %80 = getelementptr inbounds [1010 x [1010 x i32]], ptr @f, i64 0, i64 %79
  %81 = load i32, ptr %6, align 4, !tbaa !5
  %82 = sext i32 %81 to i64
  %83 = getelementptr inbounds [1010 x i32], ptr %80, i64 0, i64 %82
  call void @llvm.lifetime.start.p0(i64 4, ptr %9) #6
  %84 = load i32, ptr %4, align 4, !tbaa !5
  %85 = sub nsw i32 %84, 1
  %86 = sext i32 %85 to i64
  %87 = getelementptr inbounds [1010 x [1010 x i32]], ptr @f, i64 0, i64 %86
  %88 = load i32, ptr %6, align 4, !tbaa !5
  %89 = sub nsw i32 %88, 1
  %90 = sext i32 %89 to i64
  %91 = getelementptr inbounds [1010 x i32], ptr %87, i64 0, i64 %90
  %92 = load i32, ptr %91, align 4, !tbaa !5
  %93 = load i32, ptr %4, align 4, !tbaa !5
  %94 = sext i32 %93 to i64
  %95 = getelementptr inbounds [1010 x i8], ptr @a, i64 0, i64 %94
  %96 = load i8, ptr %95, align 1, !tbaa !12
  %97 = sext i8 %96 to i32
  %98 = load i32, ptr %6, align 4, !tbaa !5
  %99 = sext i32 %98 to i64
  %100 = getelementptr inbounds [1010 x i8], ptr @b, i64 0, i64 %99
  %101 = load i8, ptr %100, align 1, !tbaa !12
  %102 = sext i8 %101 to i32
  %103 = icmp eq i32 %97, %102
  %104 = zext i1 %103 to i64
  %105 = select i1 %103, i32 0, i32 1
  %106 = add nsw i32 %92, %105
  store i32 %106, ptr %9, align 4, !tbaa !5
  %107 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZSt3minIiERKT_S2_S2_(ptr noundef nonnull align 4 dereferenceable(4) %83, ptr noundef nonnull align 4 dereferenceable(4) %9)
  %108 = load i32, ptr %107, align 4, !tbaa !5
  %109 = load i32, ptr %4, align 4, !tbaa !5
  %110 = sext i32 %109 to i64
  %111 = getelementptr inbounds [1010 x [1010 x i32]], ptr @f, i64 0, i64 %110
  %112 = load i32, ptr %6, align 4, !tbaa !5
  %113 = sext i32 %112 to i64
  %114 = getelementptr inbounds [1010 x i32], ptr %111, i64 0, i64 %113
  store i32 %108, ptr %114, align 4, !tbaa !5
  call void @llvm.lifetime.end.p0(i64 4, ptr %9) #6
  br label %115

115:                                              ; preds = %51
  %116 = load i32, ptr %6, align 4, !tbaa !5
  %117 = add nsw i32 %116, 1
  store i32 %117, ptr %6, align 4, !tbaa !5
  br label %46, !llvm.loop !13

118:                                              ; preds = %50
  br label %119

119:                                              ; preds = %118
  %120 = load i32, ptr %4, align 4, !tbaa !5
  %121 = add nsw i32 %120, 1
  store i32 %121, ptr %4, align 4, !tbaa !5
  br label %40, !llvm.loop !14

122:                                              ; preds = %44
  %123 = load i32, ptr @n, align 4, !tbaa !5
  %124 = sext i32 %123 to i64
  %125 = getelementptr inbounds [1010 x [1010 x i32]], ptr @f, i64 0, i64 %124
  %126 = load i32, ptr @m, align 4, !tbaa !5
  %127 = sext i32 %126 to i64
  %128 = getelementptr inbounds [1010 x i32], ptr %125, i64 0, i64 %127
  %129 = load i32, ptr %128, align 4, !tbaa !5
  %130 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEi(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cout, i32 noundef %129)
  %131 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEPFRSoS_E(ptr noundef nonnull align 8 dereferenceable(8) %130, ptr noundef @_ZSt4endlIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_)
  ret i32 0
}

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

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

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

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

declare noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEi(ptr noundef nonnull align 8 dereferenceable(8), i32 noundef) #1

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

; Function Attrs: inlinehint mustprogress uwtable
declare noundef nonnull align 8 dereferenceable(8) ptr @_ZSt4endlIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_(ptr noundef nonnull align 8 dereferenceable(8)) #5

attributes #0 = { 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 #1 = { "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 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
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 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" }
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 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = distinct !{!11, !10}
!12 = !{!7, !7, i64 0}
!13 = distinct !{!13, !10}
!14 = distinct !{!14, !10}


; 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_ostream" = type { ptr, %"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
@f = external dso_local global [1010 x [1010 x i32]], align 16
@a = external dso_local global [1010 x i8], align 16
@b = external dso_local global [1010 x i8], align 16
@.str = external hidden unnamed_addr constant [9 x i8], align 1
@_ZSt4cout = external global %"class.std::basic_ostream", align 8

; Function Attrs: mustprogress norecurse uwtable
define dso_local noundef i32 @main() local_unnamed_addr #0 {
  %1 = alloca i32, align 4
  %2 = alloca i32, align 4
  %3 = alloca i32, align 4
  %4 = tail call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull @n, ptr noundef nonnull getelementptr inbounds (i8, ptr @a, i64 1), ptr noundef nonnull @m, ptr noundef nonnull getelementptr inbounds (i8, ptr @b, i64 1))
  %5 = load i32, ptr @m, align 4, !tbaa !5
  %.not35 = icmp slt i32 %5, 0
  br i1 %.not35, label %.preheader34, label %.lr.ph.preheader

.lr.ph.preheader:                                 ; preds = %0
  %6 = add nuw i32 %5, 1
  %wide.trip.count = zext i32 %6 to i64
  %min.iters.check = icmp ult i32 %5, 7
  br i1 %min.iters.check, label %.lr.ph.preheader72, label %vector.ph

.lr.ph.preheader72:                               ; preds = %middle.block, %.lr.ph.preheader
  %indvars.iv.ph = phi i64 [ 0, %.lr.ph.preheader ], [ %n.vec, %middle.block ]
  br label %.lr.ph

vector.ph:                                        ; preds = %.lr.ph.preheader
  %n.vec = and i64 %wide.trip.count, 4294967288
  br label %vector.body

vector.body:                                      ; preds = %vector.body, %vector.ph
  %index = phi i64 [ 0, %vector.ph ], [ %index.next, %vector.body ]
  %vec.ind = phi <4 x i32> [ <i32 0, i32 1, i32 2, i32 3>, %vector.ph ], [ %vec.ind.next, %vector.body ]
  %step.add = add <4 x i32> %vec.ind, <i32 4, i32 4, i32 4, i32 4>
  %7 = getelementptr inbounds [1010 x i32], ptr @f, i64 0, i64 %index
  %8 = getelementptr inbounds i8, ptr %7, i64 16
  store <4 x i32> %vec.ind, ptr %7, align 16, !tbaa !5
  store <4 x i32> %step.add, ptr %8, align 16, !tbaa !5
  %index.next = add nuw i64 %index, 8
  %vec.ind.next = add <4 x i32> %vec.ind, <i32 8, i32 8, i32 8, i32 8>
  %9 = icmp eq i64 %index.next, %n.vec
  br i1 %9, label %middle.block, label %vector.body, !llvm.loop !9

middle.block:                                     ; preds = %vector.body
  %cmp.n = icmp eq i64 %n.vec, %wide.trip.count
  br i1 %cmp.n, label %.preheader34, label %.lr.ph.preheader72

.preheader34:                                     ; preds = %.lr.ph, %middle.block, %0
  %10 = load i32, ptr @n, align 4, !tbaa !5
  %.not3037 = icmp slt i32 %10, 0
  br i1 %.not3037, label %._crit_edge45, label %.lr.ph39.preheader

.lr.ph39.preheader:                               ; preds = %.preheader34
  %11 = add nuw i32 %10, 1
  %wide.trip.count52 = zext i32 %11 to i64
  %xtraiter = and i64 %wide.trip.count52, 3
  %12 = icmp ult i32 %10, 3
  br i1 %12, label %.preheader33.unr-lcssa, label %.lr.ph39.preheader.new

.lr.ph39.preheader.new:                           ; preds = %.lr.ph39.preheader
  %unroll_iter = and i64 %wide.trip.count52, 4294967292
  br label %.lr.ph39

.lr.ph:                                           ; preds = %.lr.ph.preheader72, %.lr.ph
  %indvars.iv = phi i64 [ %indvars.iv.next, %.lr.ph ], [ %indvars.iv.ph, %.lr.ph.preheader72 ]
  %13 = getelementptr inbounds [1010 x i32], ptr @f, i64 0, i64 %indvars.iv
  %14 = trunc nuw nsw i64 %indvars.iv to i32
  store i32 %14, ptr %13, align 4, !tbaa !5
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  %exitcond.not = icmp eq i64 %indvars.iv.next, %wide.trip.count
  br i1 %exitcond.not, label %.preheader34, label %.lr.ph, !llvm.loop !13

.preheader33.unr-lcssa:                           ; preds = %.lr.ph39, %.lr.ph39.preheader
  %indvars.iv49.unr = phi i64 [ 0, %.lr.ph39.preheader ], [ %indvars.iv.next50.3, %.lr.ph39 ]
  %lcmp.mod.not = icmp eq i64 %xtraiter, 0
  br i1 %lcmp.mod.not, label %.preheader33, label %.lr.ph39.epil

.lr.ph39.epil:                                    ; preds = %.preheader33.unr-lcssa, %.lr.ph39.epil
  %indvars.iv49.epil = phi i64 [ %indvars.iv.next50.epil, %.lr.ph39.epil ], [ %indvars.iv49.unr, %.preheader33.unr-lcssa ]
  %epil.iter = phi i64 [ %epil.iter.next, %.lr.ph39.epil ], [ 0, %.preheader33.unr-lcssa ]
  %15 = getelementptr inbounds [1010 x [1010 x i32]], ptr @f, i64 0, i64 %indvars.iv49.epil
  %16 = trunc nuw nsw i64 %indvars.iv49.epil to i32
  store i32 %16, ptr %15, align 8, !tbaa !5
  %indvars.iv.next50.epil = add nuw nsw i64 %indvars.iv49.epil, 1
  %epil.iter.next = add i64 %epil.iter, 1
  %epil.iter.cmp.not = icmp eq i64 %epil.iter.next, %xtraiter
  br i1 %epil.iter.cmp.not, label %.preheader33, label %.lr.ph39.epil, !llvm.loop !14

.preheader33:                                     ; preds = %.lr.ph39.epil, %.preheader33.unr-lcssa
  %.not3143 = icmp eq i32 %10, 0
  %17 = icmp slt i32 %5, 1
  %or.cond = or i1 %.not3143, %17
  br i1 %or.cond, label %._crit_edge45, label %.preheader

.lr.ph39:                                         ; preds = %.lr.ph39, %.lr.ph39.preheader.new
  %indvars.iv49 = phi i64 [ 0, %.lr.ph39.preheader.new ], [ %indvars.iv.next50.3, %.lr.ph39 ]
  %niter = phi i64 [ 0, %.lr.ph39.preheader.new ], [ %niter.next.3, %.lr.ph39 ]
  %18 = getelementptr inbounds [1010 x [1010 x i32]], ptr @f, i64 0, i64 %indvars.iv49
  %19 = trunc nuw nsw i64 %indvars.iv49 to i32
  store i32 %19, ptr %18, align 16, !tbaa !5
  %indvars.iv.next50 = or disjoint i64 %indvars.iv49, 1
  %20 = getelementptr inbounds [1010 x [1010 x i32]], ptr @f, i64 0, i64 %indvars.iv.next50
  %21 = trunc nuw nsw i64 %indvars.iv.next50 to i32
  store i32 %21, ptr %20, align 8, !tbaa !5
  %indvars.iv.next50.1 = or disjoint i64 %indvars.iv49, 2
  %22 = getelementptr inbounds [1010 x [1010 x i32]], ptr @f, i64 0, i64 %indvars.iv.next50.1
  %23 = trunc nuw nsw i64 %indvars.iv.next50.1 to i32
  store i32 %23, ptr %22, align 16, !tbaa !5
  %indvars.iv.next50.2 = or disjoint i64 %indvars.iv49, 3
  %24 = getelementptr inbounds [1010 x [1010 x i32]], ptr @f, i64 0, i64 %indvars.iv.next50.2
  %25 = trunc nuw nsw i64 %indvars.iv.next50.2 to i32
  store i32 %25, ptr %24, align 8, !tbaa !5
  %indvars.iv.next50.3 = add nuw nsw i64 %indvars.iv49, 4
  %niter.next.3 = add i64 %niter, 4
  %niter.ncmp.3 = icmp eq i64 %niter.next.3, %unroll_iter
  br i1 %niter.ncmp.3, label %.preheader33.unr-lcssa, label %.lr.ph39, !llvm.loop !16

.preheader:                                       ; preds = %.preheader33, %._crit_edge
  %26 = phi i32 [ %37, %._crit_edge ], [ %10, %.preheader33 ]
  %27 = phi i32 [ %38, %._crit_edge ], [ %5, %.preheader33 ]
  %indvars.iv57 = phi i64 [ %indvars.iv.next58, %._crit_edge ], [ 1, %.preheader33 ]
  %.not3240 = icmp slt i32 %27, 1
  br i1 %.not3240, label %._crit_edge, label %.lr.ph42

.lr.ph42:                                         ; preds = %.preheader
  %28 = add nsw i64 %indvars.iv57, -1
  %29 = getelementptr inbounds [1010 x i8], ptr @a, i64 0, i64 %indvars.iv57
  %.phi.trans.insert = getelementptr inbounds [1010 x [1010 x i32]], ptr @f, i64 0, i64 %indvars.iv57, i64 0
  %.pre = load i32, ptr %.phi.trans.insert, align 8, !tbaa !5
  br label %40

._crit_edge45:                                    ; preds = %._crit_edge, %.preheader34, %.preheader33
  %30 = phi i32 [ %5, %.preheader33 ], [ %5, %.preheader34 ], [ %38, %._crit_edge ]
  %.lcssa = phi i32 [ %10, %.preheader33 ], [ %10, %.preheader34 ], [ %37, %._crit_edge ]
  %31 = sext i32 %.lcssa to i64
  %32 = sext i32 %30 to i64
  %33 = getelementptr inbounds [1010 x [1010 x i32]], ptr @f, i64 0, i64 %31, i64 %32
  %34 = load i32, ptr %33, align 4, !tbaa !5
  %35 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEi(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cout, i32 noundef %34)
  %36 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEPFRSoS_E(ptr noundef nonnull align 8 dereferenceable(8) %35, ptr noundef nonnull @_ZSt4endlIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_)
  ret i32 0

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

._crit_edge:                                      ; preds = %._crit_edge.loopexit, %.preheader
  %37 = phi i32 [ %.pre60, %._crit_edge.loopexit ], [ %26, %.preheader ]
  %38 = phi i32 [ %60, %._crit_edge.loopexit ], [ %27, %.preheader ]
  %indvars.iv.next58 = add nuw nsw i64 %indvars.iv57, 1
  %39 = sext i32 %37 to i64
  %.not31.not = icmp slt i64 %indvars.iv57, %39
  br i1 %.not31.not, label %.preheader, label %._crit_edge45, !llvm.loop !17

40:                                               ; preds = %.lr.ph42, %40
  %41 = phi i32 [ %.pre, %.lr.ph42 ], [ %59, %40 ]
  %indvars.iv54 = phi i64 [ 1, %.lr.ph42 ], [ %indvars.iv.next55, %40 ]
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %1) #7
  %42 = getelementptr inbounds [1010 x [1010 x i32]], ptr @f, i64 0, i64 %28, i64 %indvars.iv54
  %43 = load i32, ptr %42, align 4, !tbaa !5
  %44 = add nsw i32 %43, 1
  store i32 %44, ptr %1, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %2) #7
  %45 = add nsw i64 %indvars.iv54, -1
  %46 = add nsw i32 %41, 1
  store i32 %46, ptr %2, align 4, !tbaa !5
  %47 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZSt3minIiERKT_S2_S2_(ptr noundef nonnull align 4 dereferenceable(4) %1, ptr noundef nonnull align 4 dereferenceable(4) %2)
  %48 = load i32, ptr %47, align 4, !tbaa !5
  %49 = getelementptr inbounds [1010 x [1010 x i32]], ptr @f, i64 0, i64 %indvars.iv57, i64 %indvars.iv54
  store i32 %48, ptr %49, align 4, !tbaa !5
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %2) #7
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %1) #7
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %3) #7
  %50 = getelementptr inbounds [1010 x [1010 x i32]], ptr @f, i64 0, i64 %28, i64 %45
  %51 = load i32, ptr %50, align 4, !tbaa !5
  %52 = load i8, ptr %29, align 1, !tbaa !19
  %53 = getelementptr inbounds [1010 x i8], ptr @b, i64 0, i64 %indvars.iv54
  %54 = load i8, ptr %53, align 1, !tbaa !19
  %55 = icmp ne i8 %52, %54
  %56 = zext i1 %55 to i32
  %57 = add nsw i32 %51, %56
  store i32 %57, ptr %3, align 4, !tbaa !5
  %58 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZSt3minIiERKT_S2_S2_(ptr noundef nonnull align 4 dereferenceable(4) %49, ptr noundef nonnull align 4 dereferenceable(4) %3)
  %59 = load i32, ptr %58, align 4, !tbaa !5
  store i32 %59, ptr %49, align 4, !tbaa !5
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %3) #7
  %indvars.iv.next55 = add nuw nsw i64 %indvars.iv54, 1
  %60 = load i32, ptr @m, align 4, !tbaa !5
  %61 = sext i32 %60 to i64
  %.not32.not = icmp slt i64 %indvars.iv54, %61
  br i1 %.not32.not, label %40, label %._crit_edge.loopexit, !llvm.loop !20
}

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

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

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

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef nonnull align 4 dereferenceable(4) ptr @_ZSt3minIiERKT_S2_S2_(ptr noundef nonnull align 4 dereferenceable(4), ptr noundef nonnull align 4 dereferenceable(4)) local_unnamed_addr #3

declare noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEi(ptr noundef nonnull align 8 dereferenceable(8), i32 noundef) local_unnamed_addr #4

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

; Function Attrs: inlinehint mustprogress uwtable
declare noundef nonnull align 8 dereferenceable(8) ptr @_ZSt4endlIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_(ptr noundef nonnull align 8 dereferenceable(8)) #6

attributes #0 = { 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 #1 = { 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 #2 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
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 = { "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 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 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C++ TBAA"}
!9 = distinct !{!9, !10, !11, !12}
!10 = !{!"llvm.loop.mustprogress"}
!11 = !{!"llvm.loop.isvectorized", i32 1}
!12 = !{!"llvm.loop.unroll.runtime.disable"}
!13 = distinct !{!13, !10, !12, !11}
!14 = distinct !{!14, !15}
!15 = !{!"llvm.loop.unroll.disable"}
!16 = distinct !{!16, !10}
!17 = distinct !{!17, !10, !18}
!18 = !{!"llvm.loop.unswitch.partial.disable"}
!19 = !{!7, !7, i64 0}
!20 = distinct !{!20, !10}


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