; LLVM IR from reyadussalahin/problem-solving :: greedy/basic/codeforces/F1353B (Solution)

; 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"

@a = external dso_local global [32 x i32], align 16
@b = external dso_local global [32 x i32], align 16
@.str = external hidden unnamed_addr constant [3 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [6 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 i32, align 4
  %8 = alloca i32, align 4
  %9 = alloca i32, align 4
  %10 = alloca i32, align 4
  %11 = alloca i32, align 4
  %12 = alloca i32, align 4
  %13 = alloca i64, align 8
  store i32 0, ptr %1, align 4
  call void @llvm.lifetime.start.p0(i64 4, ptr %2) #4
  %14 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef @.str, ptr noundef %2)
  call void @llvm.lifetime.start.p0(i64 4, ptr %3) #4
  store i32 0, ptr %3, align 4, !tbaa !5
  br label %15

15:                                               ; preds = %130, %0
  %16 = load i32, ptr %3, align 4, !tbaa !5
  %17 = load i32, ptr %2, align 4, !tbaa !5
  %18 = icmp slt i32 %16, %17
  br i1 %18, label %20, label %19

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

20:                                               ; preds = %15
  call void @llvm.lifetime.start.p0(i64 4, ptr %5) #4
  call void @llvm.lifetime.start.p0(i64 4, ptr %6) #4
  %21 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef @.str.1, ptr noundef %5, ptr noundef %6)
  call void @llvm.lifetime.start.p0(i64 4, ptr %7) #4
  store i32 0, ptr %7, align 4, !tbaa !5
  br label %22

22:                                               ; preds = %32, %20
  %23 = load i32, ptr %7, align 4, !tbaa !5
  %24 = load i32, ptr %5, align 4, !tbaa !5
  %25 = icmp slt i32 %23, %24
  br i1 %25, label %27, label %26

26:                                               ; preds = %22
  store i32 5, ptr %4, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %7) #4
  br label %35

27:                                               ; preds = %22
  %28 = load i32, ptr %7, align 4, !tbaa !5
  %29 = sext i32 %28 to i64
  %30 = getelementptr inbounds [32 x i32], ptr @a, i64 0, i64 %29
  %31 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef @.str, ptr noundef %30)
  br label %32

32:                                               ; preds = %27
  %33 = load i32, ptr %7, align 4, !tbaa !5
  %34 = add nsw i32 %33, 1
  store i32 %34, ptr %7, align 4, !tbaa !5
  br label %22, !llvm.loop !9

35:                                               ; preds = %26
  call void @llvm.lifetime.start.p0(i64 4, ptr %8) #4
  store i32 0, ptr %8, align 4, !tbaa !5
  br label %36

36:                                               ; preds = %46, %35
  %37 = load i32, ptr %8, align 4, !tbaa !5
  %38 = load i32, ptr %5, align 4, !tbaa !5
  %39 = icmp slt i32 %37, %38
  br i1 %39, label %41, label %40

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

41:                                               ; preds = %36
  %42 = load i32, ptr %8, align 4, !tbaa !5
  %43 = sext i32 %42 to i64
  %44 = getelementptr inbounds [32 x i32], ptr @b, i64 0, i64 %43
  %45 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef @.str, ptr noundef %44)
  br label %46

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

49:                                               ; preds = %40
  %50 = load i32, ptr %5, align 4, !tbaa !5
  %51 = sext i32 %50 to i64
  %52 = getelementptr inbounds i32, ptr @a, i64 %51
  call void @_ZSt4sortIPiEvT_S1_(ptr noundef @a, ptr noundef %52)
  %53 = load i32, ptr %5, align 4, !tbaa !5
  %54 = sext i32 %53 to i64
  %55 = getelementptr inbounds i32, ptr @b, i64 %54
  call void @_ZSt4sortIPiEvT_S1_(ptr noundef @b, ptr noundef %55)
  call void @llvm.lifetime.start.p0(i64 4, ptr %9) #4
  %56 = load i32, ptr %5, align 4, !tbaa !5
  %57 = sub nsw i32 %56, 1
  store i32 %57, ptr %9, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %10) #4
  %58 = load i32, ptr %5, align 4, !tbaa !5
  %59 = sub nsw i32 %58, 1
  store i32 %59, ptr %10, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %11) #4
  store i32 0, ptr %11, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %12) #4
  store i32 0, ptr %12, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %13) #4
  store i64 0, ptr %13, align 8, !tbaa !12
  br label %60

60:                                               ; preds = %102, %49
  %61 = load i32, ptr %12, align 4, !tbaa !5
  %62 = load i32, ptr %5, align 4, !tbaa !5
  %63 = icmp slt i32 %61, %62
  br i1 %63, label %64, label %68

64:                                               ; preds = %60
  %65 = load i32, ptr %11, align 4, !tbaa !5
  %66 = load i32, ptr %6, align 4, !tbaa !5
  %67 = icmp slt i32 %65, %66
  br label %68

68:                                               ; preds = %64, %60
  %69 = phi i1 [ false, %60 ], [ %67, %64 ]
  br i1 %69, label %70, label %105

70:                                               ; preds = %68
  %71 = load i32, ptr %9, align 4, !tbaa !5
  %72 = sext i32 %71 to i64
  %73 = getelementptr inbounds [32 x i32], ptr @a, i64 0, i64 %72
  %74 = load i32, ptr %73, align 4, !tbaa !5
  %75 = load i32, ptr %10, align 4, !tbaa !5
  %76 = sext i32 %75 to i64
  %77 = getelementptr inbounds [32 x i32], ptr @b, i64 0, i64 %76
  %78 = load i32, ptr %77, align 4, !tbaa !5
  %79 = icmp sge i32 %74, %78
  br i1 %79, label %80, label %90

80:                                               ; preds = %70
  %81 = load i64, ptr %13, align 8, !tbaa !12
  %82 = load i32, ptr %9, align 4, !tbaa !5
  %83 = sext i32 %82 to i64
  %84 = getelementptr inbounds [32 x i32], ptr @a, i64 0, i64 %83
  %85 = load i32, ptr %84, align 4, !tbaa !5
  %86 = sext i32 %85 to i64
  %87 = add nsw i64 %81, %86
  store i64 %87, ptr %13, align 8, !tbaa !12
  %88 = load i32, ptr %9, align 4, !tbaa !5
  %89 = add nsw i32 %88, -1
  store i32 %89, ptr %9, align 4, !tbaa !5
  br label %102

90:                                               ; preds = %70
  %91 = load i64, ptr %13, align 8, !tbaa !12
  %92 = load i32, ptr %10, align 4, !tbaa !5
  %93 = sext i32 %92 to i64
  %94 = getelementptr inbounds [32 x i32], ptr @b, i64 0, i64 %93
  %95 = load i32, ptr %94, align 4, !tbaa !5
  %96 = sext i32 %95 to i64
  %97 = add nsw i64 %91, %96
  store i64 %97, ptr %13, align 8, !tbaa !12
  %98 = load i32, ptr %10, align 4, !tbaa !5
  %99 = add nsw i32 %98, -1
  store i32 %99, ptr %10, align 4, !tbaa !5
  %100 = load i32, ptr %11, align 4, !tbaa !5
  %101 = add nsw i32 %100, 1
  store i32 %101, ptr %11, align 4, !tbaa !5
  br label %102

102:                                              ; preds = %90, %80
  %103 = load i32, ptr %12, align 4, !tbaa !5
  %104 = add nsw i32 %103, 1
  store i32 %104, ptr %12, align 4, !tbaa !5
  br label %60, !llvm.loop !14

105:                                              ; preds = %68
  br label %106

106:                                              ; preds = %115, %105
  %107 = load i32, ptr %9, align 4, !tbaa !5
  %108 = icmp sge i32 %107, 0
  br i1 %108, label %109, label %113

109:                                              ; preds = %106
  %110 = load i32, ptr %12, align 4, !tbaa !5
  %111 = load i32, ptr %5, align 4, !tbaa !5
  %112 = icmp slt i32 %110, %111
  br label %113

113:                                              ; preds = %109, %106
  %114 = phi i1 [ false, %106 ], [ %112, %109 ]
  br i1 %114, label %115, label %127

115:                                              ; preds = %113
  %116 = load i64, ptr %13, align 8, !tbaa !12
  %117 = load i32, ptr %9, align 4, !tbaa !5
  %118 = sext i32 %117 to i64
  %119 = getelementptr inbounds [32 x i32], ptr @a, i64 0, i64 %118
  %120 = load i32, ptr %119, align 4, !tbaa !5
  %121 = sext i32 %120 to i64
  %122 = add nsw i64 %116, %121
  store i64 %122, ptr %13, align 8, !tbaa !12
  %123 = load i32, ptr %9, align 4, !tbaa !5
  %124 = add nsw i32 %123, -1
  store i32 %124, ptr %9, align 4, !tbaa !5
  %125 = load i32, ptr %12, align 4, !tbaa !5
  %126 = add nsw i32 %125, 1
  store i32 %126, ptr %12, align 4, !tbaa !5
  br label %106, !llvm.loop !15

127:                                              ; preds = %113
  %128 = load i64, ptr %13, align 8, !tbaa !12
  %129 = call i32 (ptr, ...) @printf(ptr noundef @.str.2, i64 noundef %128)
  call void @llvm.lifetime.end.p0(i64 8, ptr %13) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr %12) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr %11) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr %10) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr %9) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr %6) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr %5) #4
  br label %130

130:                                              ; preds = %127
  %131 = load i32, ptr %3, align 4, !tbaa !5
  %132 = add nsw i32 %131, 1
  store i32 %132, ptr %3, align 4, !tbaa !5
  br label %15, !llvm.loop !16

133:                                              ; preds = %19
  store i32 0, ptr %1, align 4
  store i32 1, ptr %4, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %2) #4
  %134 = load i32, ptr %1, align 4
  ret i32 %134
}

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

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

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

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local void @_ZSt4sortIPiEvT_S1_(ptr noundef, ptr noundef) #3

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

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 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { "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 = { 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 #4 = { 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 = !{!13, !13, i64 0}
!13 = !{!"long long", !7, i64 0}
!14 = distinct !{!14, !10}
!15 = distinct !{!15, !10}
!16 = distinct !{!16, !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"

@a = external dso_local global [32 x i32], align 16
@b = external dso_local global [32 x i32], align 16
@.str = external hidden unnamed_addr constant [3 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [6 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() local_unnamed_addr #0 {
  %1 = alloca i32, align 4
  %2 = alloca i32, align 4
  %3 = alloca i32, align 4
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %1) #5
  %4 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %1)
  %5 = load i32, ptr %1, align 4, !tbaa !5
  %6 = icmp sgt i32 %5, 0
  br i1 %6, label %.lr.ph65, label %._crit_edge66

._crit_edge66:                                    ; preds = %._crit_edge61, %0
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %1) #5
  ret i32 0

.lr.ph65:                                         ; preds = %0, %._crit_edge61
  %.03963 = phi i32 [ %75, %._crit_edge61 ], [ 0, %0 ]
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %2) #5
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %3) #5
  %7 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.1, ptr noundef nonnull %2, ptr noundef nonnull %3)
  %8 = load i32, ptr %2, align 4, !tbaa !5
  %9 = icmp sgt i32 %8, 0
  br i1 %9, label %.lr.ph, label %.preheader43.._crit_edge_crit_edge

.preheader43:                                     ; preds = %.lr.ph
  %10 = icmp sgt i32 %14, 0
  br i1 %10, label %.lr.ph46, label %.preheader43.._crit_edge_crit_edge

.preheader43.._crit_edge_crit_edge:               ; preds = %.lr.ph65, %.preheader43
  %11 = phi i32 [ %14, %.preheader43 ], [ %8, %.lr.ph65 ]
  %.pre = sext i32 %11 to i64
  br label %._crit_edge

.lr.ph:                                           ; preds = %.lr.ph65, %.lr.ph
  %indvars.iv = phi i64 [ %indvars.iv.next, %.lr.ph ], [ 0, %.lr.ph65 ]
  %12 = getelementptr inbounds [32 x i32], ptr @a, i64 0, i64 %indvars.iv
  %13 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %12)
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  %14 = load i32, ptr %2, align 4, !tbaa !5
  %15 = sext i32 %14 to i64
  %16 = icmp slt i64 %indvars.iv.next, %15
  br i1 %16, label %.lr.ph, label %.preheader43, !llvm.loop !9

._crit_edge:                                      ; preds = %.lr.ph46, %.preheader43.._crit_edge_crit_edge
  %.pre-phi = phi i64 [ %.pre, %.preheader43.._crit_edge_crit_edge ], [ %30, %.lr.ph46 ]
  %17 = getelementptr inbounds i32, ptr @a, i64 %.pre-phi
  call void @_ZSt4sortIPiEvT_S1_(ptr noundef nonnull @a, ptr noundef nonnull %17)
  %18 = load i32, ptr %2, align 4, !tbaa !5
  %19 = sext i32 %18 to i64
  %20 = getelementptr inbounds i32, ptr @b, i64 %19
  call void @_ZSt4sortIPiEvT_S1_(ptr noundef nonnull @b, ptr noundef nonnull %20)
  %21 = load i32, ptr %2, align 4
  %22 = add nsw i32 %21, -1
  %23 = load i32, ptr %3, align 4
  %24 = icmp sgt i32 %21, 0
  %25 = icmp sgt i32 %23, 0
  %26 = select i1 %24, i1 %25, i1 false
  br i1 %26, label %.lr.ph53, label %.preheader

.lr.ph46:                                         ; preds = %.preheader43, %.lr.ph46
  %indvars.iv71 = phi i64 [ %indvars.iv.next72, %.lr.ph46 ], [ 0, %.preheader43 ]
  %27 = getelementptr inbounds [32 x i32], ptr @b, i64 0, i64 %indvars.iv71
  %28 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %27)
  %indvars.iv.next72 = add nuw nsw i64 %indvars.iv71, 1
  %29 = load i32, ptr %2, align 4, !tbaa !5
  %30 = sext i32 %29 to i64
  %31 = icmp slt i64 %indvars.iv.next72, %30
  br i1 %31, label %.lr.ph46, label %._crit_edge, !llvm.loop !11

.preheader:                                       ; preds = %61, %._crit_edge
  %.034.lcssa = phi i32 [ %22, %._crit_edge ], [ %.135, %61 ]
  %.028.lcssa = phi i32 [ 0, %._crit_edge ], [ %62, %61 ]
  %.0.lcssa = phi i64 [ 0, %._crit_edge ], [ %.1, %61 ]
  %32 = icmp sgt i32 %.034.lcssa, -1
  %33 = icmp slt i32 %.028.lcssa, %21
  %34 = and i1 %32, %33
  br i1 %34, label %.lr.ph60.preheader, label %._crit_edge61

.lr.ph60.preheader:                               ; preds = %.preheader
  %35 = zext nneg i32 %.034.lcssa to i64
  %36 = xor i32 %.028.lcssa, -1
  %37 = add i32 %21, %36
  %38 = call i32 @llvm.umin.i32(i32 %.034.lcssa, i32 %37)
  %narrow = add nuw i32 %38, 1
  %39 = zext i32 %narrow to i64
  %min.iters.check = icmp ult i32 %38, 3
  br i1 %min.iters.check, label %.lr.ph60.preheader88, label %vector.ph

.lr.ph60.preheader88:                             ; preds = %middle.block, %.lr.ph60.preheader
  %indvars.iv74.ph = phi i64 [ %35, %.lr.ph60.preheader ], [ %ind.end, %middle.block ]
  %.259.ph = phi i64 [ %.0.lcssa, %.lr.ph60.preheader ], [ %49, %middle.block ]
  %.12958.ph = phi i32 [ %.028.lcssa, %.lr.ph60.preheader ], [ %ind.end83, %middle.block ]
  br label %.lr.ph60

vector.ph:                                        ; preds = %.lr.ph60.preheader
  %n.vec = and i64 %39, 4294967292
  %ind.end = sub nsw i64 %35, %n.vec
  %.cast = trunc nuw i64 %n.vec to i32
  %ind.end83 = add i32 %.028.lcssa, %.cast
  %40 = insertelement <2 x i64> <i64 poison, i64 0>, i64 %.0.lcssa, i64 0
  br label %vector.body

vector.body:                                      ; preds = %vector.body, %vector.ph
  %index = phi i64 [ 0, %vector.ph ], [ %index.next, %vector.body ]
  %vec.phi = phi <2 x i64> [ %40, %vector.ph ], [ %46, %vector.body ]
  %vec.phi85 = phi <2 x i64> [ zeroinitializer, %vector.ph ], [ %47, %vector.body ]
  %offset.idx = sub i64 %35, %index
  %41 = getelementptr inbounds [32 x i32], ptr @a, i64 0, i64 %offset.idx
  %42 = getelementptr inbounds i8, ptr %41, i64 -4
  %43 = getelementptr inbounds i8, ptr %41, i64 -12
  %wide.load = load <2 x i32>, ptr %42, align 4, !tbaa !5
  %reverse = shufflevector <2 x i32> %wide.load, <2 x i32> poison, <2 x i32> <i32 1, i32 0>
  %wide.load86 = load <2 x i32>, ptr %43, align 4, !tbaa !5
  %reverse87 = shufflevector <2 x i32> %wide.load86, <2 x i32> poison, <2 x i32> <i32 1, i32 0>
  %44 = sext <2 x i32> %reverse to <2 x i64>
  %45 = sext <2 x i32> %reverse87 to <2 x i64>
  %46 = add <2 x i64> %vec.phi, %44
  %47 = add <2 x i64> %vec.phi85, %45
  %index.next = add nuw i64 %index, 4
  %48 = icmp eq i64 %index.next, %n.vec
  br i1 %48, label %middle.block, label %vector.body, !llvm.loop !12

middle.block:                                     ; preds = %vector.body
  %bin.rdx = add <2 x i64> %47, %46
  %49 = call i64 @llvm.vector.reduce.add.v2i64(<2 x i64> %bin.rdx)
  %cmp.n = icmp eq i64 %n.vec, %39
  br i1 %cmp.n, label %._crit_edge61, label %.lr.ph60.preheader88

.lr.ph53:                                         ; preds = %._crit_edge, %61
  %.051 = phi i64 [ %.1, %61 ], [ 0, %._crit_edge ]
  %.02850 = phi i32 [ %62, %61 ], [ 0, %._crit_edge ]
  %.03049 = phi i32 [ %.131, %61 ], [ 0, %._crit_edge ]
  %.03248 = phi i32 [ %.133, %61 ], [ %22, %._crit_edge ]
  %.03447 = phi i32 [ %.135, %61 ], [ %22, %._crit_edge ]
  %50 = sext i32 %.03447 to i64
  %51 = getelementptr inbounds [32 x i32], ptr @a, i64 0, i64 %50
  %52 = load i32, ptr %51, align 4, !tbaa !5
  %53 = sext i32 %.03248 to i64
  %54 = getelementptr inbounds [32 x i32], ptr @b, i64 0, i64 %53
  %55 = load i32, ptr %54, align 4, !tbaa !5
  %.not = icmp slt i32 %52, %55
  br i1 %.not, label %58, label %56

56:                                               ; preds = %.lr.ph53
  %57 = add nsw i32 %.03447, -1
  br label %61

58:                                               ; preds = %.lr.ph53
  %59 = add nsw i32 %.03248, -1
  %60 = add nsw i32 %.03049, 1
  br label %61

61:                                               ; preds = %58, %56
  %.135 = phi i32 [ %57, %56 ], [ %.03447, %58 ]
  %.133 = phi i32 [ %.03248, %56 ], [ %59, %58 ]
  %.131 = phi i32 [ %.03049, %56 ], [ %60, %58 ]
  %.pn.in = phi i32 [ %52, %56 ], [ %55, %58 ]
  %.pn = sext i32 %.pn.in to i64
  %.1 = add nsw i64 %.051, %.pn
  %62 = add nuw nsw i32 %.02850, 1
  %63 = icmp slt i32 %62, %21
  %64 = icmp slt i32 %.131, %23
  %65 = select i1 %63, i1 %64, i1 false
  br i1 %65, label %.lr.ph53, label %.preheader, !llvm.loop !15

.lr.ph60:                                         ; preds = %.lr.ph60.preheader88, %.lr.ph60
  %indvars.iv74 = phi i64 [ %indvars.iv.next75, %.lr.ph60 ], [ %indvars.iv74.ph, %.lr.ph60.preheader88 ]
  %.259 = phi i64 [ %69, %.lr.ph60 ], [ %.259.ph, %.lr.ph60.preheader88 ]
  %.12958 = phi i32 [ %70, %.lr.ph60 ], [ %.12958.ph, %.lr.ph60.preheader88 ]
  %66 = getelementptr inbounds [32 x i32], ptr @a, i64 0, i64 %indvars.iv74
  %67 = load i32, ptr %66, align 4, !tbaa !5
  %68 = sext i32 %67 to i64
  %69 = add nsw i64 %.259, %68
  %indvars.iv.next75 = add nsw i64 %indvars.iv74, -1
  %70 = add nuw nsw i32 %.12958, 1
  %71 = icmp ne i64 %indvars.iv74, 0
  %72 = icmp slt i32 %70, %21
  %73 = select i1 %71, i1 %72, i1 false
  br i1 %73, label %.lr.ph60, label %._crit_edge61, !llvm.loop !16

._crit_edge61:                                    ; preds = %.lr.ph60, %middle.block, %.preheader
  %.2.lcssa = phi i64 [ %.0.lcssa, %.preheader ], [ %49, %middle.block ], [ %69, %.lr.ph60 ]
  %74 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i64 noundef %.2.lcssa)
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %3) #5
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %2) #5
  %75 = add nuw nsw i32 %.03963, 1
  %76 = load i32, ptr %1, align 4, !tbaa !5
  %77 = icmp slt i32 %75, %76
  br i1 %77, label %.lr.ph65, label %._crit_edge66, !llvm.loop !17
}

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

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

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

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local void @_ZSt4sortIPiEvT_S1_(ptr noundef, ptr noundef) local_unnamed_addr #3

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

; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i64 @llvm.vector.reduce.add.v2i64(<2 x i64>) #4

; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i32 @llvm.umin.i32(i32, i32) #4

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 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { 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 #3 = { 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 #4 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
attributes #5 = { 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, !14}
!13 = !{!"llvm.loop.isvectorized", i32 1}
!14 = !{!"llvm.loop.unroll.runtime.disable"}
!15 = distinct !{!15, !10}
!16 = distinct !{!16, !10, !14, !13}
!17 = distinct !{!17, !10}


; Effective O3 passes: BDCEPass,CorrelatedValuePropagationPass,EarlyCSEPass,GVNPass,GlobalDCEPass,GlobalOptPass,IPSCCPPass,IndVarSimplifyPass,InferFunctionAttrsPass,InstCombinePass,InstSimplifyPass,JumpThreadingPass,LCSSAPass,LICMPass,LoopLoadEliminationPass,LoopRotatePass,LoopSimplifyPass,LoopUnrollPass,LoopVectorizePass,ReassociatePass,SROAPass,SimplifyCFGPass