; LLVM IR from VastoLorde95/Competitive-Programming :: Codeforces/236 Division 2/Problem B (B)

; 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
@k = external dso_local global i32, align 4
@a = external dso_local global [1000 x i32], align 16
@mn = external dso_local global i32, align 4
@cnt = external dso_local global i32, align 4
@res = external dso_local global i32, align 4
@.str = external hidden unnamed_addr constant [5 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [3 x i8], align 1
@_ZSt4cout = external global %"class.std::basic_ostream", align 8
@.str.2 = external hidden unnamed_addr constant [9 x i8], align 1
@.str.3 = external hidden unnamed_addr constant [9 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 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 @k)
  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 @n, align 4, !tbaa !5
  %14 = icmp slt 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 = sext i32 %17 to i64
  %19 = getelementptr inbounds [1000 x i32], ptr @a, i64 0, i64 %18
  %20 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef @.str.1, ptr noundef %19)
  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
  %25 = load i32, ptr @n, align 4, !tbaa !5
  store i32 %25, ptr @mn, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %3) #6
  store i32 0, ptr %3, align 4, !tbaa !5
  br label %26

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

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

31:                                               ; preds = %26
  call void @llvm.lifetime.start.p0(i64 4, ptr %5) #6
  %32 = load i32, ptr %3, align 4, !tbaa !5
  %33 = sext i32 %32 to i64
  %34 = getelementptr inbounds [1000 x i32], ptr @a, i64 0, i64 %33
  %35 = load i32, ptr %34, align 4, !tbaa !5
  %36 = load i32, ptr %3, align 4, !tbaa !5
  %37 = load i32, ptr @k, align 4, !tbaa !5
  %38 = mul nsw i32 %36, %37
  %39 = sub nsw i32 %35, %38
  store i32 %39, ptr %5, align 4, !tbaa !5
  %40 = load i32, ptr %5, align 4, !tbaa !5
  %41 = icmp sle i32 %40, 0
  br i1 %41, label %42, label %43

42:                                               ; preds = %31
  store i32 7, ptr %4, align 4
  br label %81

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

44:                                               ; preds = %64, %43
  %45 = load i32, ptr %6, align 4, !tbaa !5
  %46 = load i32, ptr @n, align 4, !tbaa !5
  %47 = icmp slt i32 %45, %46
  br i1 %47, label %49, label %48

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

49:                                               ; preds = %44
  %50 = load i32, ptr %6, align 4, !tbaa !5
  %51 = sext i32 %50 to i64
  %52 = getelementptr inbounds [1000 x i32], ptr @a, i64 0, i64 %51
  %53 = load i32, ptr %52, align 4, !tbaa !5
  %54 = load i32, ptr %5, align 4, !tbaa !5
  %55 = load i32, ptr %6, align 4, !tbaa !5
  %56 = load i32, ptr @k, align 4, !tbaa !5
  %57 = mul nsw i32 %55, %56
  %58 = add nsw i32 %54, %57
  %59 = icmp eq i32 %53, %58
  br i1 %59, label %60, label %63

60:                                               ; preds = %49
  %61 = load i32, ptr @cnt, align 4, !tbaa !5
  %62 = add nsw i32 %61, 1
  store i32 %62, ptr @cnt, align 4, !tbaa !5
  br label %63

63:                                               ; preds = %60, %49
  br label %64

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

67:                                               ; preds = %48
  %68 = load i32, ptr @n, align 4, !tbaa !5
  %69 = load i32, ptr @cnt, align 4, !tbaa !5
  %70 = sub nsw i32 %68, %69
  %71 = load i32, ptr @mn, align 4, !tbaa !5
  %72 = icmp slt i32 %70, %71
  br i1 %72, label %73, label %80

73:                                               ; preds = %67
  call void @llvm.lifetime.start.p0(i64 4, ptr %7) #6
  %74 = load i32, ptr @n, align 4, !tbaa !5
  %75 = load i32, ptr @cnt, align 4, !tbaa !5
  %76 = sub nsw i32 %74, %75
  store i32 %76, ptr %7, align 4, !tbaa !5
  %77 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZSt3minIiERKT_S2_S2_(ptr noundef nonnull align 4 dereferenceable(4) @mn, ptr noundef nonnull align 4 dereferenceable(4) %7)
  %78 = load i32, ptr %77, align 4, !tbaa !5
  store i32 %78, ptr @mn, align 4, !tbaa !5
  call void @llvm.lifetime.end.p0(i64 4, ptr %7) #6
  %79 = load i32, ptr %5, align 4, !tbaa !5
  store i32 %79, ptr @res, align 4, !tbaa !5
  br label %80

80:                                               ; preds = %73, %67
  store i32 0, ptr %4, align 4
  br label %81

81:                                               ; preds = %80, %42
  call void @llvm.lifetime.end.p0(i64 4, ptr %5) #6
  %82 = load i32, ptr %4, align 4
  switch i32 %82, label %155 [
    i32 0, label %83
    i32 7, label %84
  ]

83:                                               ; preds = %81
  br label %84

84:                                               ; preds = %83, %81
  %85 = load i32, ptr %3, align 4, !tbaa !5
  %86 = add nsw i32 %85, 1
  store i32 %86, ptr %3, align 4, !tbaa !5
  br label %26, !llvm.loop !12

87:                                               ; preds = %30
  %88 = load i32, ptr @mn, align 4, !tbaa !5
  %89 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEi(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cout, i32 noundef %88)
  %90 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEPFRSoS_E(ptr noundef nonnull align 8 dereferenceable(8) %89, ptr noundef @_ZSt4endlIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_)
  call void @llvm.lifetime.start.p0(i64 4, ptr %8) #6
  %91 = load i32, ptr @res, align 4, !tbaa !5
  store i32 %91, ptr %8, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %9) #6
  store i32 0, ptr %9, align 4, !tbaa !5
  br label %92

92:                                               ; preds = %150, %87
  %93 = load i32, ptr %9, align 4, !tbaa !5
  %94 = load i32, ptr @n, align 4, !tbaa !5
  %95 = icmp slt i32 %93, %94
  br i1 %95, label %97, label %96

96:                                               ; preds = %92
  store i32 11, ptr %4, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %9) #6
  br label %153

97:                                               ; preds = %92
  %98 = load i32, ptr %9, align 4, !tbaa !5
  %99 = sext i32 %98 to i64
  %100 = getelementptr inbounds [1000 x i32], ptr @a, i64 0, i64 %99
  %101 = load i32, ptr %100, align 4, !tbaa !5
  %102 = load i32, ptr %8, align 4, !tbaa !5
  %103 = load i32, ptr %9, align 4, !tbaa !5
  %104 = load i32, ptr @k, align 4, !tbaa !5
  %105 = mul nsw i32 %103, %104
  %106 = add nsw i32 %102, %105
  %107 = icmp slt i32 %101, %106
  br i1 %107, label %108, label %122

108:                                              ; preds = %97
  %109 = load i32, ptr %9, align 4, !tbaa !5
  %110 = add nsw i32 %109, 1
  %111 = load i32, ptr %8, align 4, !tbaa !5
  %112 = load i32, ptr %9, align 4, !tbaa !5
  %113 = load i32, ptr @k, align 4, !tbaa !5
  %114 = mul nsw i32 %112, %113
  %115 = add nsw i32 %111, %114
  %116 = load i32, ptr %9, align 4, !tbaa !5
  %117 = sext i32 %116 to i64
  %118 = getelementptr inbounds [1000 x i32], ptr @a, i64 0, i64 %117
  %119 = load i32, ptr %118, align 4, !tbaa !5
  %120 = sub nsw i32 %115, %119
  %121 = call i32 (ptr, ...) @printf(ptr noundef @.str.2, i32 noundef %110, i32 noundef %120)
  br label %149

122:                                              ; preds = %97
  %123 = load i32, ptr %9, align 4, !tbaa !5
  %124 = sext i32 %123 to i64
  %125 = getelementptr inbounds [1000 x i32], ptr @a, i64 0, i64 %124
  %126 = load i32, ptr %125, align 4, !tbaa !5
  %127 = load i32, ptr %8, align 4, !tbaa !5
  %128 = load i32, ptr %9, align 4, !tbaa !5
  %129 = load i32, ptr @k, align 4, !tbaa !5
  %130 = mul nsw i32 %128, %129
  %131 = add nsw i32 %127, %130
  %132 = icmp sgt i32 %126, %131
  br i1 %132, label %133, label %148

133:                                              ; preds = %122
  %134 = load i32, ptr %9, align 4, !tbaa !5
  %135 = add nsw i32 %134, 1
  %136 = load i32, ptr %8, align 4, !tbaa !5
  %137 = load i32, ptr %9, align 4, !tbaa !5
  %138 = load i32, ptr @k, align 4, !tbaa !5
  %139 = mul nsw i32 %137, %138
  %140 = add nsw i32 %136, %139
  %141 = sub nsw i32 0, %140
  %142 = load i32, ptr %9, align 4, !tbaa !5
  %143 = sext i32 %142 to i64
  %144 = getelementptr inbounds [1000 x i32], ptr @a, i64 0, i64 %143
  %145 = load i32, ptr %144, align 4, !tbaa !5
  %146 = add nsw i32 %141, %145
  %147 = call i32 (ptr, ...) @printf(ptr noundef @.str.3, i32 noundef %135, i32 noundef %146)
  br label %148

148:                                              ; preds = %133, %122
  br label %149

149:                                              ; preds = %148, %108
  br label %150

150:                                              ; preds = %149
  %151 = load i32, ptr %9, align 4, !tbaa !5
  %152 = add nsw i32 %151, 1
  store i32 %152, ptr %9, align 4, !tbaa !5
  br label %92, !llvm.loop !13

153:                                              ; preds = %96
  store i32 0, ptr %1, align 4
  store i32 1, ptr %4, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %8) #6
  %154 = load i32, ptr %1, align 4
  ret i32 %154

155:                                              ; preds = %81
  unreachable
}

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

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 = { 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 = distinct !{!12, !10}
!13 = distinct !{!13, !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
@k = external dso_local global i32, align 4
@a = external dso_local global [1000 x i32], align 16
@mn = external dso_local global i32, align 4
@cnt = external dso_local local_unnamed_addr global i32, align 4
@res = external dso_local local_unnamed_addr global i32, align 4
@.str = external hidden unnamed_addr constant [5 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [3 x i8], align 1
@_ZSt4cout = external global %"class.std::basic_ostream", align 8
@.str.2 = external hidden unnamed_addr constant [9 x i8], align 1
@.str.3 = external hidden unnamed_addr constant [9 x i8], align 1

; Function Attrs: mustprogress norecurse uwtable
define dso_local noundef i32 @main() local_unnamed_addr #0 {
  %1 = alloca i32, align 4
  %2 = tail call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull @n, ptr noundef nonnull @k)
  %3 = load i32, ptr @n, align 4, !tbaa !5
  %4 = icmp sgt i32 %3, 0
  br i1 %4, label %.lr.ph, label %._crit_edge.thread

._crit_edge.thread:                               ; preds = %0
  store i32 %3, ptr @mn, align 4, !tbaa !5
  br label %._crit_edge48

._crit_edge:                                      ; preds = %.lr.ph
  store i32 %8, ptr @mn, align 4, !tbaa !5
  %5 = icmp sgt i32 %8, 0
  br i1 %5, label %.lr.ph47.preheader, label %._crit_edge48

.lr.ph47.preheader:                               ; preds = %._crit_edge
  %.pre64 = load i32, ptr @k, align 4, !tbaa !5
  br label %.lr.ph47

.lr.ph:                                           ; preds = %0, %.lr.ph
  %indvars.iv = phi i64 [ %indvars.iv.next, %.lr.ph ], [ 0, %0 ]
  %6 = getelementptr inbounds [1000 x i32], ptr @a, i64 0, i64 %indvars.iv
  %7 = tail call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %6)
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  %8 = load i32, ptr @n, align 4, !tbaa !5
  %9 = sext i32 %8 to i64
  %10 = icmp slt i64 %indvars.iv.next, %9
  br i1 %10, label %.lr.ph, label %._crit_edge, !llvm.loop !9

._crit_edge48:                                    ; preds = %60, %._crit_edge.thread, %._crit_edge
  %11 = phi i32 [ %8, %._crit_edge ], [ %3, %._crit_edge.thread ], [ %62, %60 ]
  %12 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEi(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cout, i32 noundef %11)
  %13 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEPFRSoS_E(ptr noundef nonnull align 8 dereferenceable(8) %12, ptr noundef nonnull @_ZSt4endlIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_)
  %14 = load i32, ptr @res, align 4, !tbaa !5
  %15 = load i32, ptr @n, align 4, !tbaa !5
  %16 = icmp sgt i32 %15, 0
  br i1 %16, label %.lr.ph51, label %._crit_edge52

.lr.ph47:                                         ; preds = %.lr.ph47.preheader, %60
  %17 = phi i32 [ %8, %.lr.ph47.preheader ], [ %61, %60 ]
  %18 = phi i32 [ %8, %.lr.ph47.preheader ], [ %62, %60 ]
  %19 = phi i32 [ %.pre64, %.lr.ph47.preheader ], [ %63, %60 ]
  %indvars.iv58 = phi i64 [ 0, %.lr.ph47.preheader ], [ %indvars.iv.next59, %60 ]
  %20 = getelementptr inbounds [1000 x i32], ptr @a, i64 0, i64 %indvars.iv58
  %21 = load i32, ptr %20, align 4, !tbaa !5
  %22 = trunc nuw nsw i64 %indvars.iv58 to i32
  %23 = mul nsw i32 %19, %22
  %24 = sub nsw i32 %21, %23
  %25 = icmp slt i32 %24, 1
  br i1 %25, label %60, label %26

26:                                               ; preds = %.lr.ph47
  store i32 0, ptr @cnt, align 4, !tbaa !5
  %27 = icmp sgt i32 %17, 0
  br i1 %27, label %.lr.ph43.preheader, label %._crit_edge44

.lr.ph43.preheader:                               ; preds = %26
  %wide.trip.count = zext nneg i32 %17 to i64
  %xtraiter = and i64 %wide.trip.count, 1
  %28 = icmp eq i32 %17, 1
  br i1 %28, label %._crit_edge44.loopexit.unr-lcssa, label %.lr.ph43.preheader.new

.lr.ph43.preheader.new:                           ; preds = %.lr.ph43.preheader
  %unroll_iter = and i64 %wide.trip.count, 2147483646
  br label %.lr.ph43

._crit_edge44.loopexit.unr-lcssa:                 ; preds = %55, %.lr.ph43.preheader
  %.lcssa.ph = phi i32 [ poison, %.lr.ph43.preheader ], [ %56, %55 ]
  %indvars.iv55.unr = phi i64 [ 0, %.lr.ph43.preheader ], [ %indvars.iv.next56.1, %55 ]
  %.unr = phi i32 [ 0, %.lr.ph43.preheader ], [ %56, %55 ]
  %lcmp.mod.not = icmp eq i64 %xtraiter, 0
  br i1 %lcmp.mod.not, label %._crit_edge44, label %.lr.ph43.epil

.lr.ph43.epil:                                    ; preds = %._crit_edge44.loopexit.unr-lcssa
  %indvars57.epil = trunc i64 %indvars.iv55.unr to i32
  %29 = getelementptr inbounds [1000 x i32], ptr @a, i64 0, i64 %indvars.iv55.unr
  %30 = load i32, ptr %29, align 4, !tbaa !5
  %31 = mul nsw i32 %19, %indvars57.epil
  %32 = add nsw i32 %31, %24
  %33 = icmp eq i32 %30, %32
  br i1 %33, label %34, label %._crit_edge44

34:                                               ; preds = %.lr.ph43.epil
  %35 = add nsw i32 %.unr, 1
  store i32 %35, ptr @cnt, align 4, !tbaa !5
  br label %._crit_edge44

._crit_edge44:                                    ; preds = %._crit_edge44.loopexit.unr-lcssa, %34, %.lr.ph43.epil, %26
  %36 = phi i32 [ 0, %26 ], [ %.lcssa.ph, %._crit_edge44.loopexit.unr-lcssa ], [ %.unr, %.lr.ph43.epil ], [ %35, %34 ]
  %37 = sub nsw i32 %17, %36
  %38 = icmp slt i32 %37, %18
  br i1 %38, label %57, label %60

.lr.ph43:                                         ; preds = %55, %.lr.ph43.preheader.new
  %indvars.iv55 = phi i64 [ 0, %.lr.ph43.preheader.new ], [ %indvars.iv.next56.1, %55 ]
  %39 = phi i32 [ 0, %.lr.ph43.preheader.new ], [ %56, %55 ]
  %niter = phi i64 [ 0, %.lr.ph43.preheader.new ], [ %niter.next.1, %55 ]
  %indvars57 = trunc i64 %indvars.iv55 to i32
  %40 = getelementptr inbounds [1000 x i32], ptr @a, i64 0, i64 %indvars.iv55
  %41 = load i32, ptr %40, align 8, !tbaa !5
  %42 = mul nsw i32 %19, %indvars57
  %43 = add nsw i32 %42, %24
  %44 = icmp eq i32 %41, %43
  br i1 %44, label %45, label %.lr.ph43.1

45:                                               ; preds = %.lr.ph43
  %46 = add nsw i32 %39, 1
  store i32 %46, ptr @cnt, align 4, !tbaa !5
  br label %.lr.ph43.1

.lr.ph43.1:                                       ; preds = %.lr.ph43, %45
  %47 = phi i32 [ %39, %.lr.ph43 ], [ %46, %45 ]
  %indvars.iv.next56 = or disjoint i64 %indvars.iv55, 1
  %indvars57.1 = trunc i64 %indvars.iv.next56 to i32
  %48 = getelementptr inbounds [1000 x i32], ptr @a, i64 0, i64 %indvars.iv.next56
  %49 = load i32, ptr %48, align 4, !tbaa !5
  %50 = mul nsw i32 %19, %indvars57.1
  %51 = add nsw i32 %50, %24
  %52 = icmp eq i32 %49, %51
  br i1 %52, label %53, label %55

53:                                               ; preds = %.lr.ph43.1
  %54 = add nsw i32 %47, 1
  store i32 %54, ptr @cnt, align 4, !tbaa !5
  br label %55

55:                                               ; preds = %53, %.lr.ph43.1
  %56 = phi i32 [ %47, %.lr.ph43.1 ], [ %54, %53 ]
  %indvars.iv.next56.1 = add nuw nsw i64 %indvars.iv55, 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_edge44.loopexit.unr-lcssa, label %.lr.ph43, !llvm.loop !11

57:                                               ; preds = %._crit_edge44
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %1) #7
  store i32 %37, ptr %1, align 4, !tbaa !5
  %58 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZSt3minIiERKT_S2_S2_(ptr noundef nonnull align 4 dereferenceable(4) @mn, ptr noundef nonnull align 4 dereferenceable(4) %1)
  %59 = load i32, ptr %58, align 4, !tbaa !5
  store i32 %59, ptr @mn, align 4, !tbaa !5
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %1) #7
  store i32 %24, ptr @res, align 4, !tbaa !5
  %.pre = load i32, ptr @k, align 4, !tbaa !5
  %.pre65 = load i32, ptr @n, align 4, !tbaa !5
  br label %60

60:                                               ; preds = %._crit_edge44, %57, %.lr.ph47
  %61 = phi i32 [ %17, %._crit_edge44 ], [ %.pre65, %57 ], [ %17, %.lr.ph47 ]
  %62 = phi i32 [ %18, %._crit_edge44 ], [ %59, %57 ], [ %18, %.lr.ph47 ]
  %63 = phi i32 [ %19, %._crit_edge44 ], [ %.pre, %57 ], [ %19, %.lr.ph47 ]
  %indvars.iv.next59 = add nuw nsw i64 %indvars.iv58, 1
  %64 = sext i32 %61 to i64
  %65 = icmp slt i64 %indvars.iv.next59, %64
  br i1 %65, label %.lr.ph47, label %._crit_edge48, !llvm.loop !12

._crit_edge52:                                    ; preds = %._crit_edge66, %._crit_edge48
  ret i32 0

.lr.ph51:                                         ; preds = %._crit_edge48, %._crit_edge66
  %indvars.iv61 = phi i64 [ %indvars.iv.next62.pre-phi, %._crit_edge66 ], [ 0, %._crit_edge48 ]
  %66 = getelementptr inbounds [1000 x i32], ptr @a, i64 0, i64 %indvars.iv61
  %67 = load i32, ptr %66, align 4, !tbaa !5
  %68 = load i32, ptr @k, align 4, !tbaa !5
  %69 = trunc nuw nsw i64 %indvars.iv61 to i32
  %70 = mul nsw i32 %68, %69
  %71 = add nsw i32 %70, %14
  %72 = icmp slt i32 %67, %71
  br i1 %72, label %73, label %78

73:                                               ; preds = %.lr.ph51
  %74 = add nuw nsw i64 %indvars.iv61, 1
  %75 = sub nsw i32 %71, %67
  %76 = trunc nuw nsw i64 %74 to i32
  %77 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %76, i32 noundef %75)
  br label %._crit_edge66

78:                                               ; preds = %.lr.ph51
  %79 = icmp sgt i32 %67, %71
  %80 = add nuw nsw i64 %indvars.iv61, 1
  br i1 %79, label %81, label %._crit_edge66

81:                                               ; preds = %78
  %82 = sub i32 %67, %71
  %83 = trunc nuw nsw i64 %80 to i32
  %84 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.3, i32 noundef %83, i32 noundef %82)
  br label %._crit_edge66

._crit_edge66:                                    ; preds = %78, %73, %81
  %indvars.iv.next62.pre-phi = phi i64 [ %74, %73 ], [ %80, %81 ], [ %80, %78 ]
  %85 = load i32, ptr @n, align 4, !tbaa !5
  %86 = sext i32 %85 to i64
  %87 = icmp slt i64 %indvars.iv.next62.pre-phi, %86
  br i1 %87, label %.lr.ph51, label %._crit_edge52, !llvm.loop !13
}

; 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

; Function Attrs: nofree nounwind
declare noundef i32 @printf(ptr nocapture noundef readonly, ...) local_unnamed_addr #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 = { 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}
!10 = !{!"llvm.loop.mustprogress"}
!11 = distinct !{!11, !10}
!12 = distinct !{!12, !10}
!13 = distinct !{!13, !10}


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