; LLVM IR from tangjz/acm-icpc :: codeforces/gym/100827H.ll (Z5solvev)

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

@_ZZ5solvevE1a = external hidden global [11 x i32], align 16
@_ZZ5solvevE1b = external hidden global [11 x i32], align 16
@_ZZ5solvevE1f = external hidden global [5001 x i32], align 16
@.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 [4 x i8], align 1

; Function Attrs: mustprogress uwtable
define dso_local void @_Z5solvev() #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
  call void @llvm.lifetime.start.p0(i64 4, ptr %1) #6
  call void @llvm.lifetime.start.p0(i64 4, ptr %2) #6
  call void @llvm.lifetime.start.p0(i64 4, ptr %3) #6
  store i32 -1, ptr %3, align 4, !tbaa !5
  %13 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef @.str, ptr noundef %1, ptr noundef %2)
  call void @llvm.lifetime.start.p0(i64 4, ptr %4) #6
  store i32 0, ptr %4, align 4, !tbaa !5
  br label %14

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

18:                                               ; preds = %14
  call void @llvm.lifetime.end.p0(i64 4, ptr %4) #6
  br label %27

19:                                               ; preds = %14
  %20 = load i32, ptr %4, align 4, !tbaa !5
  %21 = sext i32 %20 to i64
  %22 = getelementptr inbounds i32, ptr @_ZZ5solvevE1a, i64 %21
  %23 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef @.str.1, ptr noundef %22)
  br label %24

24:                                               ; preds = %19
  %25 = load i32, ptr %4, align 4, !tbaa !5
  %26 = add nsw i32 %25, 1
  store i32 %26, ptr %4, align 4, !tbaa !5
  br label %14, !llvm.loop !9

27:                                               ; preds = %18
  %28 = load i32, ptr %2, align 4, !tbaa !5
  %29 = sext i32 %28 to i64
  %30 = getelementptr inbounds i32, ptr @_ZZ5solvevE1a, i64 %29
  call void @_ZSt4sortIPiEvT_S1_(ptr noundef @_ZZ5solvevE1a, ptr noundef %30)
  %31 = load i32, ptr %1, align 4, !tbaa !5
  %32 = sext i32 %31 to i64
  %33 = mul i64 %32, 4
  call void @llvm.memset.p0.i64(ptr align 16 @_ZZ5solvevE1f, i8 -1, i64 %33, i1 false)
  %34 = load i32, ptr %1, align 4, !tbaa !5
  %35 = sext i32 %34 to i64
  %36 = getelementptr inbounds [5001 x i32], ptr @_ZZ5solvevE1f, i64 0, i64 %35
  store i32 0, ptr %36, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %5) #6
  store i32 1, ptr %5, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %6) #6
  %37 = load i32, ptr %1, align 4, !tbaa !5
  store i32 %37, ptr %6, align 4, !tbaa !5
  br label %38

38:                                               ; preds = %144, %27
  %39 = load i32, ptr %6, align 4, !tbaa !5
  %40 = icmp sgt i32 %39, 0
  br i1 %40, label %42, label %41

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

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

43:                                               ; preds = %58, %42
  %44 = load i32, ptr %8, align 4, !tbaa !5
  %45 = load i32, ptr %2, align 4, !tbaa !5
  %46 = icmp slt i32 %44, %45
  br i1 %46, label %48, label %47

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

48:                                               ; preds = %43
  %49 = load i32, ptr %8, align 4, !tbaa !5
  %50 = sext i32 %49 to i64
  %51 = getelementptr inbounds [11 x i32], ptr @_ZZ5solvevE1a, i64 0, i64 %50
  %52 = load i32, ptr %51, align 4, !tbaa !5
  %53 = load i32, ptr %5, align 4, !tbaa !5
  %54 = mul nsw i32 %52, %53
  %55 = load i32, ptr %8, align 4, !tbaa !5
  %56 = sext i32 %55 to i64
  %57 = getelementptr inbounds [11 x i32], ptr @_ZZ5solvevE1b, i64 0, i64 %56
  store i32 %54, ptr %57, align 4, !tbaa !5
  br label %58

58:                                               ; preds = %48
  %59 = load i32, ptr %8, align 4, !tbaa !5
  %60 = add nsw i32 %59, 1
  store i32 %60, ptr %8, align 4, !tbaa !5
  br label %43, !llvm.loop !11

61:                                               ; preds = %47
  call void @llvm.lifetime.start.p0(i64 4, ptr %9) #6
  store i32 0, ptr %9, align 4, !tbaa !5
  br label %62

62:                                               ; preds = %122, %61
  %63 = load i32, ptr %9, align 4, !tbaa !5
  %64 = load i32, ptr %6, align 4, !tbaa !5
  %65 = icmp sle i32 %63, %64
  br i1 %65, label %67, label %66

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

67:                                               ; preds = %62
  %68 = load i32, ptr %9, align 4, !tbaa !5
  %69 = sext i32 %68 to i64
  %70 = getelementptr inbounds [5001 x i32], ptr @_ZZ5solvevE1f, i64 0, i64 %69
  store i32 -1, ptr %70, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %10) #6
  store i32 0, ptr %10, align 4, !tbaa !5
  br label %71

71:                                               ; preds = %118, %67
  %72 = load i32, ptr %10, align 4, !tbaa !5
  %73 = load i32, ptr %2, align 4, !tbaa !5
  %74 = icmp slt i32 %72, %73
  br i1 %74, label %75, label %84

75:                                               ; preds = %71
  %76 = load i32, ptr %9, align 4, !tbaa !5
  %77 = load i32, ptr %10, align 4, !tbaa !5
  %78 = sext i32 %77 to i64
  %79 = getelementptr inbounds [11 x i32], ptr @_ZZ5solvevE1b, i64 0, i64 %78
  %80 = load i32, ptr %79, align 4, !tbaa !5
  %81 = add nsw i32 %76, %80
  %82 = load i32, ptr %6, align 4, !tbaa !5
  %83 = icmp sle i32 %81, %82
  br label %84

84:                                               ; preds = %75, %71
  %85 = phi i1 [ false, %71 ], [ %83, %75 ]
  br i1 %85, label %87, label %86

86:                                               ; preds = %84
  store i32 14, ptr %7, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %10) #6
  br label %121

87:                                               ; preds = %84
  call void @llvm.lifetime.start.p0(i64 4, ptr %11) #6
  %88 = load i32, ptr %9, align 4, !tbaa !5
  %89 = load i32, ptr %10, align 4, !tbaa !5
  %90 = sext i32 %89 to i64
  %91 = getelementptr inbounds [11 x i32], ptr @_ZZ5solvevE1b, i64 0, i64 %90
  %92 = load i32, ptr %91, align 4, !tbaa !5
  %93 = add nsw i32 %88, %92
  store i32 %93, ptr %11, align 4, !tbaa !5
  %94 = load i32, ptr %11, align 4, !tbaa !5
  %95 = sext i32 %94 to i64
  %96 = getelementptr inbounds [5001 x i32], ptr @_ZZ5solvevE1f, i64 0, i64 %95
  %97 = load i32, ptr %96, align 4, !tbaa !5
  %98 = icmp ne i32 %97, -1
  br i1 %98, label %99, label %117

99:                                               ; preds = %87
  %100 = load i32, ptr %9, align 4, !tbaa !5
  %101 = sext i32 %100 to i64
  %102 = getelementptr inbounds [5001 x i32], ptr @_ZZ5solvevE1f, i64 0, i64 %101
  call void @llvm.lifetime.start.p0(i64 4, ptr %12) #6
  %103 = load i32, ptr %11, align 4, !tbaa !5
  %104 = sext i32 %103 to i64
  %105 = getelementptr inbounds [5001 x i32], ptr @_ZZ5solvevE1f, i64 0, i64 %104
  %106 = load i32, ptr %105, align 4, !tbaa !5
  %107 = load i32, ptr %10, align 4, !tbaa !5
  %108 = sext i32 %107 to i64
  %109 = getelementptr inbounds [11 x i32], ptr @_ZZ5solvevE1a, i64 0, i64 %108
  %110 = load i32, ptr %109, align 4, !tbaa !5
  %111 = add nsw i32 %106, %110
  store i32 %111, ptr %12, align 4, !tbaa !5
  %112 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZSt3maxIiERKT_S2_S2_(ptr noundef nonnull align 4 dereferenceable(4) %102, ptr noundef nonnull align 4 dereferenceable(4) %12)
  %113 = load i32, ptr %112, align 4, !tbaa !5
  %114 = load i32, ptr %9, align 4, !tbaa !5
  %115 = sext i32 %114 to i64
  %116 = getelementptr inbounds [5001 x i32], ptr @_ZZ5solvevE1f, i64 0, i64 %115
  store i32 %113, ptr %116, align 4, !tbaa !5
  call void @llvm.lifetime.end.p0(i64 4, ptr %12) #6
  br label %117

117:                                              ; preds = %99, %87
  call void @llvm.lifetime.end.p0(i64 4, ptr %11) #6
  br label %118

118:                                              ; preds = %117
  %119 = load i32, ptr %10, align 4, !tbaa !5
  %120 = add nsw i32 %119, 1
  store i32 %120, ptr %10, align 4, !tbaa !5
  br label %71, !llvm.loop !12

121:                                              ; preds = %86
  br label %122

122:                                              ; preds = %121
  %123 = load i32, ptr %9, align 4, !tbaa !5
  %124 = add nsw i32 %123, 1
  store i32 %124, ptr %9, align 4, !tbaa !5
  br label %62, !llvm.loop !13

125:                                              ; preds = %66
  %126 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZSt3maxIiERKT_S2_S2_(ptr noundef nonnull align 4 dereferenceable(4) %3, ptr noundef nonnull align 4 dereferenceable(4) @_ZZ5solvevE1f)
  %127 = load i32, ptr %126, align 4, !tbaa !5
  store i32 %127, ptr %3, align 4, !tbaa !5
  br label %128

128:                                              ; preds = %140, %125
  %129 = load i32, ptr %6, align 4, !tbaa !5
  %130 = icmp sgt i32 %129, 0
  br i1 %130, label %131, label %137

131:                                              ; preds = %128
  %132 = load i32, ptr %6, align 4, !tbaa !5
  %133 = sext i32 %132 to i64
  %134 = getelementptr inbounds [5001 x i32], ptr @_ZZ5solvevE1f, i64 0, i64 %133
  %135 = load i32, ptr %134, align 4, !tbaa !5
  %136 = icmp eq i32 %135, -1
  br label %137

137:                                              ; preds = %131, %128
  %138 = phi i1 [ false, %128 ], [ %136, %131 ]
  br i1 %138, label %139, label %143

139:                                              ; preds = %137
  br label %140

140:                                              ; preds = %139
  %141 = load i32, ptr %6, align 4, !tbaa !5
  %142 = add nsw i32 %141, -1
  store i32 %142, ptr %6, align 4, !tbaa !5
  br label %128, !llvm.loop !14

143:                                              ; preds = %137
  br label %144

144:                                              ; preds = %143
  %145 = load i32, ptr %5, align 4, !tbaa !5
  %146 = add nsw i32 %145, 1
  store i32 %146, ptr %5, align 4, !tbaa !5
  br label %38, !llvm.loop !15

147:                                              ; preds = %41
  %148 = load i32, ptr %3, align 4, !tbaa !5
  %149 = call i32 (ptr, ...) @printf(ptr noundef @.str.2, i32 noundef %148)
  call void @llvm.lifetime.end.p0(i64 4, ptr %3) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr %2) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr %1) #6
  ret void
}

; 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

; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: write)
declare void @llvm.memset.p0.i64(ptr nocapture writeonly, i8, i64, i1 immarg) #4

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

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

attributes #0 = { mustprogress uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { "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 nounwind willreturn memory(argmem: write) }
attributes #5 = { inlinehint mustprogress nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #6 = { 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}
!14 = distinct !{!14, !10}
!15 = distinct !{!15, !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"

@_ZZ5solvevE1a = external hidden global [11 x i32], align 16
@_ZZ5solvevE1b = external hidden local_unnamed_addr global [11 x i32], align 16
@_ZZ5solvevE1f = external hidden global [5001 x i32], align 16
@.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 [4 x i8], align 1

; Function Attrs: mustprogress uwtable
define dso_local void @_Z5solvev() local_unnamed_addr #0 {
  %1 = alloca i32, align 4
  %2 = alloca i32, align 4
  %3 = alloca i32, align 4
  %4 = alloca i32, align 4
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %1) #7
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %2) #7
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %3) #7
  store i32 -1, ptr %3, align 4, !tbaa !5
  %5 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull %1, ptr noundef nonnull %2)
  %6 = load i32, ptr %2, align 4, !tbaa !5
  %7 = icmp sgt i32 %6, 0
  br i1 %7, label %.lr.ph, label %.._crit_edge_crit_edge

.._crit_edge_crit_edge:                           ; preds = %0
  %.pre78 = sext i32 %6 to i64
  br label %._crit_edge

._crit_edge:                                      ; preds = %.lr.ph, %.._crit_edge_crit_edge
  %.pre-phi = phi i64 [ %.pre78, %.._crit_edge_crit_edge ], [ %17, %.lr.ph ]
  %8 = getelementptr inbounds i32, ptr @_ZZ5solvevE1a, i64 %.pre-phi
  call void @_ZSt4sortIPiEvT_S1_(ptr noundef nonnull @_ZZ5solvevE1a, ptr noundef nonnull %8)
  %9 = load i32, ptr %1, align 4, !tbaa !5
  %10 = sext i32 %9 to i64
  %11 = shl nsw i64 %10, 2
  call void @llvm.memset.p0.i64(ptr nonnull align 16 @_ZZ5solvevE1f, i8 -1, i64 %11, i1 false)
  %12 = getelementptr inbounds [5001 x i32], ptr @_ZZ5solvevE1f, i64 0, i64 %10
  store i32 0, ptr %12, align 4, !tbaa !5
  %13 = icmp sgt i32 %9, 0
  br i1 %13, label %.preheader40, label %._crit_edge60

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

.preheader40:                                     ; preds = %._crit_edge, %.critedge2
  %.03459 = phi i32 [ %.1.lcssa.ph, %.critedge2 ], [ %9, %._crit_edge ]
  %.03558 = phi i32 [ %75, %.critedge2 ], [ 1, %._crit_edge ]
  %19 = load i32, ptr %2, align 4, !tbaa !5
  %20 = icmp sgt i32 %19, 0
  br i1 %20, label %.lr.ph43.preheader, label %.critedge.us.preheader

.lr.ph43.preheader:                               ; preds = %.preheader40
  %wide.trip.count = zext nneg i32 %19 to i64
  %min.iters.check = icmp ult i32 %19, 8
  br i1 %min.iters.check, label %.lr.ph43.preheader90, label %vector.ph

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

vector.ph:                                        ; preds = %.lr.ph43.preheader
  %n.vec = and i64 %wide.trip.count, 2147483640
  %broadcast.splatinsert = insertelement <4 x i32> poison, i32 %.03558, i64 0
  %broadcast.splat = shufflevector <4 x i32> %broadcast.splatinsert, <4 x i32> poison, <4 x i32> zeroinitializer
  br label %vector.body

vector.body:                                      ; preds = %vector.body, %vector.ph
  %index = phi i64 [ 0, %vector.ph ], [ %index.next, %vector.body ]
  %21 = getelementptr inbounds [11 x i32], ptr @_ZZ5solvevE1a, i64 0, i64 %index
  %22 = getelementptr inbounds i8, ptr %21, i64 16
  %wide.load = load <4 x i32>, ptr %21, align 16, !tbaa !5
  %wide.load89 = load <4 x i32>, ptr %22, align 16, !tbaa !5
  %23 = mul nsw <4 x i32> %wide.load, %broadcast.splat
  %24 = mul nsw <4 x i32> %wide.load89, %broadcast.splat
  %25 = getelementptr inbounds [11 x i32], ptr @_ZZ5solvevE1b, i64 0, i64 %index
  %26 = getelementptr inbounds i8, ptr %25, i64 16
  store <4 x i32> %23, ptr %25, align 16, !tbaa !5
  store <4 x i32> %24, ptr %26, align 16, !tbaa !5
  %index.next = add nuw i64 %index, 8
  %27 = icmp eq i64 %index.next, %n.vec
  br i1 %27, label %middle.block, label %vector.body, !llvm.loop !11

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

._crit_edge60:                                    ; preds = %.critedge2, %._crit_edge
  %28 = phi i32 [ -1, %._crit_edge ], [ %39, %.critedge2 ]
  %29 = call i32 (ptr, ...) @printf(ptr noundef nonnull dereferenceable(1) @.str.2, i32 noundef %28)
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %3) #7
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %2) #7
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %1) #7
  ret void

.lr.ph50:                                         ; preds = %.lr.ph43, %middle.block
  br i1 %20, label %.lr.ph50.split.preheader, label %.critedge.us.preheader

.critedge.us.preheader:                           ; preds = %.preheader40, %.lr.ph50
  %30 = zext nneg i32 %.03459 to i64
  %31 = shl nuw nsw i64 %30, 2
  %32 = add nuw nsw i64 %31, 4
  call void @llvm.memset.p0.i64(ptr noundef nonnull align 16 dereferenceable(1) @_ZZ5solvevE1f, i8 -1, i64 %32, i1 false), !tbaa !5
  br label %.lr.ph54.preheader

.lr.ph50.split.preheader:                         ; preds = %.lr.ph50
  %33 = add nuw i32 %.03459, 1
  %wide.trip.count76 = zext i32 %33 to i64
  br label %.lr.ph50.split

.lr.ph43:                                         ; preds = %.lr.ph43.preheader90, %.lr.ph43
  %indvars.iv64 = phi i64 [ %indvars.iv.next65, %.lr.ph43 ], [ %indvars.iv64.ph, %.lr.ph43.preheader90 ]
  %34 = getelementptr inbounds [11 x i32], ptr @_ZZ5solvevE1a, i64 0, i64 %indvars.iv64
  %35 = load i32, ptr %34, align 4, !tbaa !5
  %36 = mul nsw i32 %35, %.03558
  %37 = getelementptr inbounds [11 x i32], ptr @_ZZ5solvevE1b, i64 0, i64 %indvars.iv64
  store i32 %36, ptr %37, align 4, !tbaa !5
  %indvars.iv.next65 = add nuw nsw i64 %indvars.iv64, 1
  %exitcond.not = icmp eq i64 %indvars.iv.next65, %wide.trip.count
  br i1 %exitcond.not, label %.lr.ph50, label %.lr.ph43, !llvm.loop !14

.lr.ph54.preheader:                               ; preds = %.critedge, %.critedge.us.preheader
  %38 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZSt3maxIiERKT_S2_S2_(ptr noundef nonnull align 4 dereferenceable(4) %3, ptr noundef nonnull align 4 dereferenceable(4) @_ZZ5solvevE1f)
  %39 = load i32, ptr %38, align 4, !tbaa !5
  store i32 %39, ptr %3, align 4, !tbaa !5
  %smin = call i32 @llvm.smin.i32(i32 %.03459, i32 1)
  %40 = add nsw i32 %smin, -1
  br label %.lr.ph54

.lr.ph50.split:                                   ; preds = %.lr.ph50.split.preheader, %.critedge
  %41 = phi i32 [ %19, %.lr.ph50.split.preheader ], [ %51, %.critedge ]
  %42 = phi i32 [ %19, %.lr.ph50.split.preheader ], [ %52, %.critedge ]
  %indvars.iv73 = phi i64 [ 0, %.lr.ph50.split.preheader ], [ %indvars.iv.next74, %.critedge ]
  %43 = getelementptr inbounds [5001 x i32], ptr @_ZZ5solvevE1f, i64 0, i64 %indvars.iv73
  store i32 -1, ptr %43, align 4, !tbaa !5
  %44 = icmp sgt i32 %42, 0
  br i1 %44, label %.lr.ph46.preheader, label %.critedge

.lr.ph46.preheader:                               ; preds = %.lr.ph50.split
  %45 = trunc nuw nsw i64 %indvars.iv73 to i32
  %46 = load i32, ptr @_ZZ5solvevE1b, align 16, !tbaa !5
  %47 = add nsw i32 %46, %45
  %.not3883 = icmp sgt i32 %47, %.03459
  br i1 %.not3883, label %.critedge, label %.lr.ph85

.lr.ph46:                                         ; preds = %64
  %48 = getelementptr inbounds [11 x i32], ptr @_ZZ5solvevE1b, i64 0, i64 %indvars.iv.next71
  %49 = load i32, ptr %48, align 4, !tbaa !5
  %50 = add nsw i32 %49, %45
  %.not38 = icmp sgt i32 %50, %.03459
  br i1 %.not38, label %.critedge, label %.lr.ph85, !llvm.loop !15

.critedge:                                        ; preds = %64, %.lr.ph46, %.lr.ph46.preheader, %.lr.ph50.split
  %51 = phi i32 [ %41, %.lr.ph50.split ], [ %41, %.lr.ph46.preheader ], [ %65, %.lr.ph46 ], [ %65, %64 ]
  %52 = phi i32 [ %42, %.lr.ph50.split ], [ %42, %.lr.ph46.preheader ], [ %65, %.lr.ph46 ], [ %65, %64 ]
  %indvars.iv.next74 = add nuw nsw i64 %indvars.iv73, 1
  %exitcond77.not = icmp eq i64 %indvars.iv.next74, %wide.trip.count76
  br i1 %exitcond77.not, label %.lr.ph54.preheader, label %.lr.ph50.split, !llvm.loop !16

.lr.ph85:                                         ; preds = %.lr.ph46.preheader, %.lr.ph46
  %53 = phi i32 [ %50, %.lr.ph46 ], [ %47, %.lr.ph46.preheader ]
  %indvars.iv7084 = phi i64 [ %indvars.iv.next71, %.lr.ph46 ], [ 0, %.lr.ph46.preheader ]
  %54 = phi i32 [ %65, %.lr.ph46 ], [ %41, %.lr.ph46.preheader ]
  %55 = sext i32 %53 to i64
  %56 = getelementptr inbounds [5001 x i32], ptr @_ZZ5solvevE1f, i64 0, i64 %55
  %57 = load i32, ptr %56, align 4, !tbaa !5
  %.not39 = icmp eq i32 %57, -1
  br i1 %.not39, label %64, label %58

58:                                               ; preds = %.lr.ph85
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %4) #7
  %59 = getelementptr inbounds [11 x i32], ptr @_ZZ5solvevE1a, i64 0, i64 %indvars.iv7084
  %60 = load i32, ptr %59, align 4, !tbaa !5
  %61 = add nsw i32 %60, %57
  store i32 %61, ptr %4, align 4, !tbaa !5
  %62 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZSt3maxIiERKT_S2_S2_(ptr noundef nonnull align 4 dereferenceable(4) %43, ptr noundef nonnull align 4 dereferenceable(4) %4)
  %63 = load i32, ptr %62, align 4, !tbaa !5
  store i32 %63, ptr %43, align 4, !tbaa !5
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %4) #7
  %.pre = load i32, ptr %2, align 4, !tbaa !5
  br label %64

64:                                               ; preds = %58, %.lr.ph85
  %65 = phi i32 [ %.pre, %58 ], [ %54, %.lr.ph85 ]
  %indvars.iv.next71 = add nuw nsw i64 %indvars.iv7084, 1
  %66 = sext i32 %65 to i64
  %67 = icmp slt i64 %indvars.iv.next71, %66
  br i1 %67, label %.lr.ph46, label %.critedge, !llvm.loop !15

.lr.ph54:                                         ; preds = %.lr.ph54.preheader, %72
  %.152 = phi i32 [ %73, %72 ], [ %.03459, %.lr.ph54.preheader ]
  %68 = zext nneg i32 %.152 to i64
  %69 = getelementptr inbounds [5001 x i32], ptr @_ZZ5solvevE1f, i64 0, i64 %68
  %70 = load i32, ptr %69, align 4, !tbaa !5
  %71 = icmp eq i32 %70, -1
  br i1 %71, label %72, label %.critedge2

72:                                               ; preds = %.lr.ph54
  %73 = add nsw i32 %.152, -1
  %74 = icmp sgt i32 %.152, 1
  br i1 %74, label %.lr.ph54, label %.critedge2, !llvm.loop !18

.critedge2:                                       ; preds = %72, %.lr.ph54
  %.1.lcssa.ph = phi i32 [ %40, %72 ], [ %.152, %.lr.ph54 ]
  %75 = add nuw nsw i32 %.03558, 1
  %76 = icmp sgt i32 %.1.lcssa.ph, 0
  br i1 %76, label %.preheader40, label %._crit_edge60, !llvm.loop !19
}

; 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: mustprogress nocallback nofree nounwind willreturn memory(argmem: write)
declare void @llvm.memset.p0.i64(ptr nocapture writeonly, i8, i64, i1 immarg) #4

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

; 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 i32 @llvm.smin.i32(i32, i32) #6

attributes #0 = { mustprogress uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { mustprogress 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 = { mustprogress nocallback nofree nounwind willreturn memory(argmem: write) }
attributes #5 = { inlinehint mustprogress nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #6 = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
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, !13}
!12 = !{!"llvm.loop.isvectorized", i32 1}
!13 = !{!"llvm.loop.unroll.runtime.disable"}
!14 = distinct !{!14, !10, !13, !12}
!15 = distinct !{!15, !10}
!16 = distinct !{!16, !10, !17}
!17 = !{!"llvm.loop.unswitch.partial.disable"}
!18 = distinct !{!18, !10}
!19 = distinct !{!19, !10}


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