; LLVM IR from tangjz/acm-icpc :: 51nod (1051)

; 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
@x = external dso_local global i32, align 4
@s = external dso_local global [501 x [501 x i64]], align 16
@ans = external dso_local global i64, align 8
@.str = external hidden unnamed_addr constant [5 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [3 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [6 x i8], align 1

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

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

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

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

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

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

22:                                               ; preds = %17
  %23 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef @.str.1, ptr noundef @x)
  %24 = load i32, ptr @x, align 4, !tbaa !5
  %25 = sext i32 %24 to i64
  %26 = load i32, ptr %2, align 4, !tbaa !5
  %27 = sub nsw i32 %26, 1
  %28 = sext i32 %27 to i64
  %29 = getelementptr inbounds [501 x [501 x i64]], ptr @s, i64 0, i64 %28
  %30 = load i32, ptr %4, align 4, !tbaa !5
  %31 = sext i32 %30 to i64
  %32 = getelementptr inbounds [501 x i64], ptr %29, i64 0, i64 %31
  %33 = load i64, ptr %32, align 8, !tbaa !9
  %34 = add nsw i64 %25, %33
  %35 = load i32, ptr %2, align 4, !tbaa !5
  %36 = sext i32 %35 to i64
  %37 = getelementptr inbounds [501 x [501 x i64]], ptr @s, i64 0, i64 %36
  %38 = load i32, ptr %4, align 4, !tbaa !5
  %39 = sub nsw i32 %38, 1
  %40 = sext i32 %39 to i64
  %41 = getelementptr inbounds [501 x i64], ptr %37, i64 0, i64 %40
  %42 = load i64, ptr %41, align 8, !tbaa !9
  %43 = add nsw i64 %34, %42
  %44 = load i32, ptr %2, align 4, !tbaa !5
  %45 = sub nsw i32 %44, 1
  %46 = sext i32 %45 to i64
  %47 = getelementptr inbounds [501 x [501 x i64]], ptr @s, i64 0, i64 %46
  %48 = load i32, ptr %4, align 4, !tbaa !5
  %49 = sub nsw i32 %48, 1
  %50 = sext i32 %49 to i64
  %51 = getelementptr inbounds [501 x i64], ptr %47, i64 0, i64 %50
  %52 = load i64, ptr %51, align 8, !tbaa !9
  %53 = sub nsw i64 %43, %52
  %54 = load i32, ptr %2, align 4, !tbaa !5
  %55 = sext i32 %54 to i64
  %56 = getelementptr inbounds [501 x [501 x i64]], ptr @s, i64 0, i64 %55
  %57 = load i32, ptr %4, align 4, !tbaa !5
  %58 = sext i32 %57 to i64
  %59 = getelementptr inbounds [501 x i64], ptr %56, i64 0, i64 %58
  store i64 %53, ptr %59, align 8, !tbaa !9
  br label %60

60:                                               ; preds = %22
  %61 = load i32, ptr %4, align 4, !tbaa !5
  %62 = add nsw i32 %61, 1
  store i32 %62, ptr %4, align 4, !tbaa !5
  br label %17, !llvm.loop !11

63:                                               ; preds = %21
  br label %64

64:                                               ; preds = %63
  %65 = load i32, ptr %2, align 4, !tbaa !5
  %66 = add nsw i32 %65, 1
  store i32 %66, ptr %2, align 4, !tbaa !5
  br label %11, !llvm.loop !13

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

68:                                               ; preds = %127, %67
  %69 = load i32, ptr %5, align 4, !tbaa !5
  %70 = load i32, ptr @n, align 4, !tbaa !5
  %71 = icmp sle i32 %69, %70
  br i1 %71, label %73, label %72

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

73:                                               ; preds = %68
  call void @llvm.lifetime.start.p0(i64 4, ptr %6) #3
  %74 = load i32, ptr %5, align 4, !tbaa !5
  store i32 %74, ptr %6, align 4, !tbaa !5
  br label %75

75:                                               ; preds = %123, %73
  %76 = load i32, ptr %6, align 4, !tbaa !5
  %77 = load i32, ptr @n, align 4, !tbaa !5
  %78 = icmp sle i32 %76, %77
  br i1 %78, label %80, label %79

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

80:                                               ; preds = %75
  call void @llvm.lifetime.start.p0(i64 8, ptr %7) #3
  store i64 0, ptr %7, align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %8) #3
  store i32 1, ptr %8, align 4, !tbaa !5
  br label %81

81:                                               ; preds = %119, %80
  %82 = load i32, ptr %8, align 4, !tbaa !5
  %83 = load i32, ptr @m, align 4, !tbaa !5
  %84 = icmp sle i32 %82, %83
  br i1 %84, label %86, label %85

85:                                               ; preds = %81
  store i32 14, ptr %3, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %8) #3
  br label %122

86:                                               ; preds = %81
  call void @llvm.lifetime.start.p0(i64 8, ptr %9) #3
  %87 = load i32, ptr %6, align 4, !tbaa !5
  %88 = sext i32 %87 to i64
  %89 = getelementptr inbounds [501 x [501 x i64]], ptr @s, i64 0, i64 %88
  %90 = load i32, ptr %8, align 4, !tbaa !5
  %91 = sext i32 %90 to i64
  %92 = getelementptr inbounds [501 x i64], ptr %89, i64 0, i64 %91
  %93 = load i64, ptr %92, align 8, !tbaa !9
  %94 = load i32, ptr %5, align 4, !tbaa !5
  %95 = sub nsw i32 %94, 1
  %96 = sext i32 %95 to i64
  %97 = getelementptr inbounds [501 x [501 x i64]], ptr @s, i64 0, i64 %96
  %98 = load i32, ptr %8, align 4, !tbaa !5
  %99 = sext i32 %98 to i64
  %100 = getelementptr inbounds [501 x i64], ptr %97, i64 0, i64 %99
  %101 = load i64, ptr %100, align 8, !tbaa !9
  %102 = sub nsw i64 %93, %101
  store i64 %102, ptr %9, align 8, !tbaa !9
  %103 = load i64, ptr @ans, align 8, !tbaa !9
  %104 = load i64, ptr %9, align 8, !tbaa !9
  %105 = load i64, ptr %7, align 8, !tbaa !9
  %106 = sub nsw i64 %104, %105
  %107 = icmp slt i64 %103, %106
  br i1 %107, label %108, label %112

108:                                              ; preds = %86
  %109 = load i64, ptr %9, align 8, !tbaa !9
  %110 = load i64, ptr %7, align 8, !tbaa !9
  %111 = sub nsw i64 %109, %110
  store i64 %111, ptr @ans, align 8, !tbaa !9
  br label %112

112:                                              ; preds = %108, %86
  %113 = load i64, ptr %7, align 8, !tbaa !9
  %114 = load i64, ptr %9, align 8, !tbaa !9
  %115 = icmp sgt i64 %113, %114
  br i1 %115, label %116, label %118

116:                                              ; preds = %112
  %117 = load i64, ptr %9, align 8, !tbaa !9
  store i64 %117, ptr %7, align 8, !tbaa !9
  br label %118

118:                                              ; preds = %116, %112
  call void @llvm.lifetime.end.p0(i64 8, ptr %9) #3
  br label %119

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

122:                                              ; preds = %85
  call void @llvm.lifetime.end.p0(i64 8, ptr %7) #3
  br label %123

123:                                              ; preds = %122
  %124 = load i32, ptr %6, align 4, !tbaa !5
  %125 = add nsw i32 %124, 1
  store i32 %125, ptr %6, align 4, !tbaa !5
  br label %75, !llvm.loop !15

126:                                              ; preds = %79
  br label %127

127:                                              ; preds = %126
  %128 = load i32, ptr %5, align 4, !tbaa !5
  %129 = add nsw i32 %128, 1
  store i32 %129, ptr %5, align 4, !tbaa !5
  br label %68, !llvm.loop !16

130:                                              ; preds = %72
  %131 = load i64, ptr @ans, align 8, !tbaa !9
  %132 = call i32 (ptr, ...) @printf(ptr noundef @.str.2, i64 noundef %131)
  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

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

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 = { nounwind }

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

!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"clang version 19.1.0 (git@github.com:llvm/llvm-project.git a4bf6cd7cfb1a1421ba92bca9d017b49936c55e4)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C++ TBAA"}
!9 = !{!10, !10, i64 0}
!10 = !{!"long long", !7, i64 0}
!11 = distinct !{!11, !12}
!12 = !{!"llvm.loop.mustprogress"}
!13 = distinct !{!13, !12}
!14 = distinct !{!14, !12}
!15 = distinct !{!15, !12}
!16 = distinct !{!16, !12}


; 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
@x = external dso_local global i32, align 4
@s = external dso_local local_unnamed_addr global [501 x [501 x i64]], align 16
@ans = external dso_local local_unnamed_addr global i64, align 8
@.str = external hidden unnamed_addr constant [5 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [3 x i8], align 1
@.str.2 = external hidden unnamed_addr constant [6 x i8], align 1

; Function Attrs: mustprogress nofree norecurse nounwind uwtable
define dso_local noundef i32 @main() local_unnamed_addr #0 {
  %1 = tail call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull @m, ptr noundef nonnull @n)
  %2 = load i32, ptr @n, align 4, !tbaa !5
  %.not46 = icmp slt i32 %2, 1
  br i1 %.not46, label %.preheader42.._crit_edge68_crit_edge, label %.preheader43.lr.ph

.preheader43.lr.ph:                               ; preds = %0
  %3 = load i32, ptr @m, align 4, !tbaa !5
  %4 = icmp slt i32 %3, 1
  br i1 %4, label %.preheader41.lr.ph.thread, label %.preheader43

.preheader41.lr.ph.thread:                        ; preds = %.preheader43.lr.ph
  %ans.promoted97 = load i64, ptr @ans, align 8, !tbaa !9
  br label %._crit_edge68

.preheader43:                                     ; preds = %.preheader43.lr.ph, %._crit_edge
  %5 = phi i32 [ %11, %._crit_edge ], [ %2, %.preheader43.lr.ph ]
  %6 = phi i32 [ %12, %._crit_edge ], [ %3, %.preheader43.lr.ph ]
  %indvars.iv73 = phi i64 [ %indvars.iv.next74, %._crit_edge ], [ 1, %.preheader43.lr.ph ]
  %.not4044 = icmp slt i32 %6, 1
  br i1 %.not4044, label %._crit_edge, label %.lr.ph

.lr.ph:                                           ; preds = %.preheader43
  %7 = add nsw i64 %indvars.iv73, -1
  br label %14

.preheader42:                                     ; preds = %._crit_edge
  %.not3765 = icmp slt i32 %11, 1
  br i1 %.not3765, label %.preheader42.._crit_edge68_crit_edge, label %.preheader41.lr.ph

.preheader42.._crit_edge68_crit_edge:             ; preds = %0, %.preheader42
  %.pre89 = load i64, ptr @ans, align 8, !tbaa !9
  br label %._crit_edge68

.preheader41.lr.ph:                               ; preds = %.preheader42
  %.pr = load i32, ptr @m, align 4, !tbaa !5
  %ans.promoted = load i64, ptr @ans, align 8, !tbaa !9
  %.not3948 = icmp slt i32 %.pr, 1
  br i1 %.not3948, label %._crit_edge68, label %.preheader41.preheader

.preheader41.preheader:                           ; preds = %.preheader41.lr.ph
  %8 = add nuw i32 %11, 1
  %wide.trip.count87 = zext i32 %8 to i64
  %9 = zext nneg i32 %.pr to i64
  %xtraiter = and i64 %9, 1
  %10 = icmp eq i32 %.pr, 1
  %unroll_iter = and i64 %9, 2147483646
  %lcmp.mod.not = icmp eq i64 %xtraiter, 0
  br label %.preheader41

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

._crit_edge:                                      ; preds = %._crit_edge.loopexit, %.preheader43
  %11 = phi i32 [ %.pre, %._crit_edge.loopexit ], [ %5, %.preheader43 ]
  %12 = phi i32 [ %29, %._crit_edge.loopexit ], [ %6, %.preheader43 ]
  %indvars.iv.next74 = add nuw nsw i64 %indvars.iv73, 1
  %13 = sext i32 %11 to i64
  %.not.not = icmp slt i64 %indvars.iv73, %13
  br i1 %.not.not, label %.preheader43, label %.preheader42, !llvm.loop !11

14:                                               ; preds = %.lr.ph, %14
  %indvars.iv = phi i64 [ 1, %.lr.ph ], [ %indvars.iv.next, %14 ]
  %15 = tail call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull @x)
  %16 = load i32, ptr @x, align 4, !tbaa !5
  %17 = sext i32 %16 to i64
  %18 = getelementptr inbounds [501 x [501 x i64]], ptr @s, i64 0, i64 %7, i64 %indvars.iv
  %19 = load i64, ptr %18, align 8, !tbaa !9
  %20 = add nsw i64 %19, %17
  %21 = add nsw i64 %indvars.iv, -1
  %22 = getelementptr inbounds [501 x [501 x i64]], ptr @s, i64 0, i64 %indvars.iv73, i64 %21
  %23 = load i64, ptr %22, align 8, !tbaa !9
  %24 = add nsw i64 %20, %23
  %25 = getelementptr inbounds [501 x [501 x i64]], ptr @s, i64 0, i64 %7, i64 %21
  %26 = load i64, ptr %25, align 8, !tbaa !9
  %27 = sub i64 %24, %26
  %28 = getelementptr inbounds [501 x [501 x i64]], ptr @s, i64 0, i64 %indvars.iv73, i64 %indvars.iv
  store i64 %27, ptr %28, align 8, !tbaa !9
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  %29 = load i32, ptr @m, align 4, !tbaa !5
  %30 = sext i32 %29 to i64
  %.not40.not = icmp slt i64 %indvars.iv, %30
  br i1 %.not40.not, label %14, label %._crit_edge.loopexit, !llvm.loop !14

.preheader41:                                     ; preds = %.preheader41.preheader, %.split
  %indvars.iv79 = phi i64 [ 1, %.preheader41.preheader ], [ %indvars.iv.next80, %.split ]
  %ans.promoted536466 = phi i64 [ %ans.promoted, %.preheader41.preheader ], [ %ans.promoted5361.lcssa, %.split ]
  %31 = add nsw i64 %indvars.iv79, -1
  br label %.preheader

._crit_edge68:                                    ; preds = %.split, %.preheader41.lr.ph, %.preheader41.lr.ph.thread, %.preheader42.._crit_edge68_crit_edge
  %32 = phi i64 [ %.pre89, %.preheader42.._crit_edge68_crit_edge ], [ %ans.promoted97, %.preheader41.lr.ph.thread ], [ %ans.promoted, %.preheader41.lr.ph ], [ %ans.promoted5361.lcssa, %.split ]
  %33 = tail call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i64 noundef %32)
  ret i32 0

.preheader:                                       ; preds = %.preheader41, %._crit_edge52
  %indvars.iv81 = phi i64 [ %indvars.iv79, %.preheader41 ], [ %indvars.iv.next82, %._crit_edge52 ]
  %ans.promoted5363 = phi i64 [ %ans.promoted536466, %.preheader41 ], [ %ans.promoted5361.lcssa, %._crit_edge52 ]
  %ans.promoted5758 = phi i64 [ %ans.promoted536466, %.preheader41 ], [ %ans.promoted54.lcssa, %._crit_edge52 ]
  br i1 %10, label %._crit_edge52.unr-lcssa, label %.preheader.new

.split:                                           ; preds = %._crit_edge52
  %indvars.iv.next80 = add nuw nsw i64 %indvars.iv79, 1
  %exitcond88.not = icmp eq i64 %indvars.iv.next80, %wide.trip.count87
  br i1 %exitcond88.not, label %._crit_edge68, label %.preheader41, !llvm.loop !15

._crit_edge52.unr-lcssa:                          ; preds = %61, %.preheader
  %ans.promoted5361.lcssa.ph = phi i64 [ poison, %.preheader ], [ %ans.promoted5361.1, %61 ]
  %ans.promoted54.lcssa.ph = phi i64 [ poison, %.preheader ], [ %ans.promoted54.1, %61 ]
  %indvars.iv76.unr = phi i64 [ 1, %.preheader ], [ %indvars.iv.next77.1, %61 ]
  %ans.promoted5362.unr = phi i64 [ %ans.promoted5363, %.preheader ], [ %ans.promoted5361.1, %61 ]
  %ans.promoted55.unr = phi i64 [ %ans.promoted5758, %.preheader ], [ %ans.promoted54.1, %61 ]
  %.03149.unr = phi i64 [ 0, %.preheader ], [ %spec.select.1, %61 ]
  %.unr = phi i64 [ %ans.promoted5758, %.preheader ], [ %62, %61 ]
  br i1 %lcmp.mod.not, label %._crit_edge52, label %.epil.preheader

.epil.preheader:                                  ; preds = %._crit_edge52.unr-lcssa
  %34 = getelementptr inbounds [501 x [501 x i64]], ptr @s, i64 0, i64 %indvars.iv81, i64 %indvars.iv76.unr
  %35 = load i64, ptr %34, align 8, !tbaa !9
  %36 = getelementptr inbounds [501 x [501 x i64]], ptr @s, i64 0, i64 %31, i64 %indvars.iv76.unr
  %37 = load i64, ptr %36, align 8, !tbaa !9
  %38 = add i64 %37, %.03149.unr
  %39 = sub i64 %35, %38
  %40 = icmp slt i64 %.unr, %39
  br i1 %40, label %41, label %._crit_edge52

41:                                               ; preds = %.epil.preheader
  store i64 %39, ptr @ans, align 8, !tbaa !9
  br label %._crit_edge52

._crit_edge52:                                    ; preds = %.epil.preheader, %41, %._crit_edge52.unr-lcssa
  %ans.promoted5361.lcssa = phi i64 [ %ans.promoted5361.lcssa.ph, %._crit_edge52.unr-lcssa ], [ %39, %41 ], [ %ans.promoted5362.unr, %.epil.preheader ]
  %ans.promoted54.lcssa = phi i64 [ %ans.promoted54.lcssa.ph, %._crit_edge52.unr-lcssa ], [ %39, %41 ], [ %ans.promoted55.unr, %.epil.preheader ]
  %indvars.iv.next82 = add nuw nsw i64 %indvars.iv81, 1
  %exitcond85.not = icmp eq i64 %indvars.iv.next82, %wide.trip.count87
  br i1 %exitcond85.not, label %.split, label %.preheader, !llvm.loop !16

.preheader.new:                                   ; preds = %.preheader, %61
  %indvars.iv76 = phi i64 [ %indvars.iv.next77.1, %61 ], [ 1, %.preheader ]
  %ans.promoted5362 = phi i64 [ %ans.promoted5361.1, %61 ], [ %ans.promoted5363, %.preheader ]
  %ans.promoted55 = phi i64 [ %ans.promoted54.1, %61 ], [ %ans.promoted5758, %.preheader ]
  %.03149 = phi i64 [ %spec.select.1, %61 ], [ 0, %.preheader ]
  %42 = phi i64 [ %62, %61 ], [ %ans.promoted5758, %.preheader ]
  %niter = phi i64 [ %niter.next.1, %61 ], [ 0, %.preheader ]
  %43 = getelementptr inbounds [501 x [501 x i64]], ptr @s, i64 0, i64 %indvars.iv81, i64 %indvars.iv76
  %44 = load i64, ptr %43, align 8, !tbaa !9
  %45 = getelementptr inbounds [501 x [501 x i64]], ptr @s, i64 0, i64 %31, i64 %indvars.iv76
  %46 = load i64, ptr %45, align 8, !tbaa !9
  %47 = sub nsw i64 %44, %46
  %48 = sub nsw i64 %47, %.03149
  %49 = icmp slt i64 %42, %48
  br i1 %49, label %50, label %51

50:                                               ; preds = %.preheader.new
  store i64 %48, ptr @ans, align 8, !tbaa !9
  br label %51

51:                                               ; preds = %50, %.preheader.new
  %ans.promoted5361 = phi i64 [ %48, %50 ], [ %ans.promoted5362, %.preheader.new ]
  %ans.promoted54 = phi i64 [ %48, %50 ], [ %ans.promoted55, %.preheader.new ]
  %52 = phi i64 [ %48, %50 ], [ %42, %.preheader.new ]
  %spec.select = tail call i64 @llvm.smin.i64(i64 %.03149, i64 %47)
  %indvars.iv.next77 = add nuw nsw i64 %indvars.iv76, 1
  %53 = getelementptr inbounds [501 x [501 x i64]], ptr @s, i64 0, i64 %indvars.iv81, i64 %indvars.iv.next77
  %54 = load i64, ptr %53, align 8, !tbaa !9
  %55 = getelementptr inbounds [501 x [501 x i64]], ptr @s, i64 0, i64 %31, i64 %indvars.iv.next77
  %56 = load i64, ptr %55, align 8, !tbaa !9
  %57 = sub nsw i64 %54, %56
  %58 = sub nsw i64 %57, %spec.select
  %59 = icmp slt i64 %52, %58
  br i1 %59, label %60, label %61

60:                                               ; preds = %51
  store i64 %58, ptr @ans, align 8, !tbaa !9
  br label %61

61:                                               ; preds = %60, %51
  %ans.promoted5361.1 = phi i64 [ %58, %60 ], [ %ans.promoted5361, %51 ]
  %ans.promoted54.1 = phi i64 [ %58, %60 ], [ %ans.promoted54, %51 ]
  %62 = phi i64 [ %58, %60 ], [ %52, %51 ]
  %spec.select.1 = tail call i64 @llvm.smin.i64(i64 %spec.select, i64 %57)
  %indvars.iv.next77.1 = add nuw nsw i64 %indvars.iv76, 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 %._crit_edge52.unr-lcssa, label %.preheader.new, !llvm.loop !17
}

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

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

; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i64 @llvm.smin.i64(i64, i64) #2

attributes #0 = { mustprogress nofree 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 #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 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }

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

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


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