; LLVM IR from Tunghohin/Competitive_Coding :: Codeforces/cf1678_C.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"

%"class.std::basic_istream" = type { ptr, i64, %"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 }
%"class.std::basic_ostream" = type { ptr, %"class.std::basic_ios" }

@a = external dso_local global [5001 x i32], align 16
@f = external dso_local global [5001 x i32], align 16
@pre = external dso_local global [5001 x i32], align 16
@_ZSt3cin = external global %"class.std::basic_istream", align 8
@_ZSt4cout = external global %"class.std::basic_ostream", align 8

; 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 i64, align 8
  %8 = alloca i32, align 4
  %9 = alloca i32, align 4
  %10 = alloca i32, align 4
  call void @llvm.lifetime.start.p0(i64 4, ptr %1) #4
  %11 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERi(ptr noundef nonnull align 8 dereferenceable(16) @_ZSt3cin, ptr noundef nonnull align 4 dereferenceable(4) %1)
  call void @llvm.lifetime.start.p0(i64 4, ptr %2) #4
  store i32 1, ptr %2, align 4, !tbaa !5
  br label %12

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

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

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

21:                                               ; preds = %17
  %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 %12, !llvm.loop !9

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

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

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

30:                                               ; preds = %25
  %31 = load i32, ptr %3, align 4, !tbaa !5
  %32 = sext i32 %31 to i64
  %33 = getelementptr inbounds [5001 x i32], ptr @a, i64 0, i64 %32
  %34 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERi(ptr noundef nonnull align 8 dereferenceable(16) @_ZSt3cin, ptr noundef nonnull align 4 dereferenceable(4) %33)
  br label %35

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

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

39:                                               ; preds = %73, %38
  %40 = load i32, ptr %4, align 4, !tbaa !5
  %41 = load i32, ptr %1, align 4, !tbaa !5
  %42 = icmp sle i32 %40, %41
  br i1 %42, label %44, label %43

43:                                               ; preds = %39
  store i32 8, ptr %5, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %4) #4
  br label %76

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

47:                                               ; preds = %69, %44
  %48 = load i32, ptr %6, align 4, !tbaa !5
  %49 = load i32, ptr %1, align 4, !tbaa !5
  %50 = icmp sle i32 %48, %49
  br i1 %50, label %52, label %51

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

52:                                               ; preds = %47
  %53 = load i32, ptr %6, align 4, !tbaa !5
  %54 = sext i32 %53 to i64
  %55 = getelementptr inbounds [5001 x i32], ptr @a, i64 0, i64 %54
  %56 = load i32, ptr %55, align 4, !tbaa !5
  %57 = load i32, ptr %4, align 4, !tbaa !5
  %58 = sext i32 %57 to i64
  %59 = getelementptr inbounds [5001 x i32], ptr @a, i64 0, i64 %58
  %60 = load i32, ptr %59, align 4, !tbaa !5
  %61 = icmp slt i32 %56, %60
  br i1 %61, label %62, label %68

62:                                               ; preds = %52
  %63 = load i32, ptr %4, align 4, !tbaa !5
  %64 = sext i32 %63 to i64
  %65 = getelementptr inbounds [5001 x i32], ptr @f, i64 0, i64 %64
  %66 = load i32, ptr %65, align 4, !tbaa !5
  %67 = add nsw i32 %66, 1
  store i32 %67, ptr %65, align 4, !tbaa !5
  br label %68

68:                                               ; preds = %62, %52
  br label %69

69:                                               ; preds = %68
  %70 = load i32, ptr %6, align 4, !tbaa !5
  %71 = add nsw i32 %70, 1
  store i32 %71, ptr %6, align 4, !tbaa !5
  br label %47, !llvm.loop !12

72:                                               ; preds = %51
  br label %73

73:                                               ; preds = %72
  %74 = load i32, ptr %4, align 4, !tbaa !5
  %75 = add nsw i32 %74, 1
  store i32 %75, ptr %4, align 4, !tbaa !5
  br label %39, !llvm.loop !13

76:                                               ; preds = %43
  call void @llvm.lifetime.start.p0(i64 8, ptr %7) #4
  store i64 0, ptr %7, align 8, !tbaa !14
  call void @llvm.lifetime.start.p0(i64 4, ptr %8) #4
  store i32 1, ptr %8, align 4, !tbaa !5
  br label %77

77:                                               ; preds = %156, %76
  %78 = load i32, ptr %8, align 4, !tbaa !5
  %79 = load i32, ptr %1, align 4, !tbaa !5
  %80 = icmp sle i32 %78, %79
  br i1 %80, label %82, label %81

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

82:                                               ; preds = %77
  call void @llvm.lifetime.start.p0(i64 4, ptr %9) #4
  store i32 1, ptr %9, align 4, !tbaa !5
  br label %83

83:                                               ; preds = %118, %82
  %84 = load i32, ptr %9, align 4, !tbaa !5
  %85 = load i32, ptr %8, align 4, !tbaa !5
  %86 = icmp slt i32 %84, %85
  br i1 %86, label %88, label %87

87:                                               ; preds = %83
  store i32 17, ptr %5, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %9) #4
  br label %121

88:                                               ; preds = %83
  %89 = load i32, ptr %9, align 4, !tbaa !5
  %90 = sext i32 %89 to i64
  %91 = getelementptr inbounds [5001 x i32], ptr @a, i64 0, i64 %90
  %92 = load i32, ptr %91, align 4, !tbaa !5
  %93 = load i32, ptr %8, align 4, !tbaa !5
  %94 = sext i32 %93 to i64
  %95 = getelementptr inbounds [5001 x i32], ptr @a, i64 0, i64 %94
  %96 = load i32, ptr %95, align 4, !tbaa !5
  %97 = icmp sgt i32 %92, %96
  br i1 %97, label %98, label %104

98:                                               ; preds = %88
  %99 = load i32, ptr %9, align 4, !tbaa !5
  %100 = sext i32 %99 to i64
  %101 = getelementptr inbounds [5001 x i32], ptr @f, i64 0, i64 %100
  %102 = load i32, ptr %101, align 4, !tbaa !5
  %103 = add nsw i32 %102, -1
  store i32 %103, ptr %101, align 4, !tbaa !5
  br label %104

104:                                              ; preds = %98, %88
  %105 = load i32, ptr %9, align 4, !tbaa !5
  %106 = sub nsw i32 %105, 1
  %107 = sext i32 %106 to i64
  %108 = getelementptr inbounds [5001 x i32], ptr @pre, i64 0, i64 %107
  %109 = load i32, ptr %108, align 4, !tbaa !5
  %110 = load i32, ptr %9, align 4, !tbaa !5
  %111 = sext i32 %110 to i64
  %112 = getelementptr inbounds [5001 x i32], ptr @f, i64 0, i64 %111
  %113 = load i32, ptr %112, align 4, !tbaa !5
  %114 = add nsw i32 %109, %113
  %115 = load i32, ptr %9, align 4, !tbaa !5
  %116 = sext i32 %115 to i64
  %117 = getelementptr inbounds [5001 x i32], ptr @pre, i64 0, i64 %116
  store i32 %114, ptr %117, align 4, !tbaa !5
  br label %118

118:                                              ; preds = %104
  %119 = load i32, ptr %9, align 4, !tbaa !5
  %120 = add nsw i32 %119, 1
  store i32 %120, ptr %9, align 4, !tbaa !5
  br label %83, !llvm.loop !16

121:                                              ; preds = %87
  call void @llvm.lifetime.start.p0(i64 4, ptr %10) #4
  store i32 1, ptr %10, align 4, !tbaa !5
  br label %122

122:                                              ; preds = %152, %121
  %123 = load i32, ptr %10, align 4, !tbaa !5
  %124 = load i32, ptr %8, align 4, !tbaa !5
  %125 = icmp slt i32 %123, %124
  br i1 %125, label %127, label %126

126:                                              ; preds = %122
  store i32 20, ptr %5, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %10) #4
  br label %155

127:                                              ; preds = %122
  %128 = load i32, ptr %10, align 4, !tbaa !5
  %129 = sext i32 %128 to i64
  %130 = getelementptr inbounds [5001 x i32], ptr @a, i64 0, i64 %129
  %131 = load i32, ptr %130, align 4, !tbaa !5
  %132 = load i32, ptr %8, align 4, !tbaa !5
  %133 = sext i32 %132 to i64
  %134 = getelementptr inbounds [5001 x i32], ptr @a, i64 0, i64 %133
  %135 = load i32, ptr %134, align 4, !tbaa !5
  %136 = icmp slt i32 %131, %135
  br i1 %136, label %137, label %151

137:                                              ; preds = %127
  %138 = load i32, ptr %8, align 4, !tbaa !5
  %139 = sub nsw i32 %138, 1
  %140 = sext i32 %139 to i64
  %141 = getelementptr inbounds [5001 x i32], ptr @pre, i64 0, i64 %140
  %142 = load i32, ptr %141, align 4, !tbaa !5
  %143 = load i32, ptr %10, align 4, !tbaa !5
  %144 = sext i32 %143 to i64
  %145 = getelementptr inbounds [5001 x i32], ptr @pre, i64 0, i64 %144
  %146 = load i32, ptr %145, align 4, !tbaa !5
  %147 = sub nsw i32 %142, %146
  %148 = sext i32 %147 to i64
  %149 = load i64, ptr %7, align 8, !tbaa !14
  %150 = add nsw i64 %149, %148
  store i64 %150, ptr %7, align 8, !tbaa !14
  br label %151

151:                                              ; preds = %137, %127
  br label %152

152:                                              ; preds = %151
  %153 = load i32, ptr %10, align 4, !tbaa !5
  %154 = add nsw i32 %153, 1
  store i32 %154, ptr %10, align 4, !tbaa !5
  br label %122, !llvm.loop !17

155:                                              ; preds = %126
  br label %156

156:                                              ; preds = %155
  %157 = load i32, ptr %8, align 4, !tbaa !5
  %158 = add nsw i32 %157, 1
  store i32 %158, ptr %8, align 4, !tbaa !5
  br label %77, !llvm.loop !18

159:                                              ; preds = %81
  %160 = load i64, ptr %7, align 8, !tbaa !14
  %161 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEx(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cout, i64 noundef %160)
  %162 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_c(ptr noundef nonnull align 8 dereferenceable(8) %161, i8 noundef signext 10)
  call void @llvm.lifetime.end.p0(i64 8, ptr %7) #4
  call void @llvm.lifetime.end.p0(i64 4, ptr %1) #4
  ret void
}

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

declare noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERi(ptr noundef nonnull align 8 dereferenceable(16), ptr noundef nonnull align 4 dereferenceable(4)) #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 noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_c(ptr noundef nonnull align 8 dereferenceable(8), i8 noundef signext) #3

; Function Attrs: mustprogress uwtable
declare noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEx(ptr noundef nonnull align 8 dereferenceable(8), i64 noundef) #0 align 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 = { 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 = !{!15, !15, i64 0}
!15 = !{!"long long", !7, i64 0}
!16 = distinct !{!16, !10}
!17 = distinct !{!17, !10}
!18 = distinct !{!18, !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_istream" = type { ptr, i64, %"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 }
%"class.std::basic_ostream" = type { ptr, %"class.std::basic_ios" }

@a = external dso_local global [5001 x i32], align 16
@f = external dso_local local_unnamed_addr global [5001 x i32], align 16
@pre = external dso_local local_unnamed_addr global [5001 x i32], align 16
@_ZSt3cin = external global %"class.std::basic_istream", align 8
@_ZSt4cout = external global %"class.std::basic_ostream", align 8

; Function Attrs: mustprogress uwtable
define dso_local void @_Z5solvev() local_unnamed_addr #0 {
  %1 = alloca i32, align 4
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %1) #5
  %2 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERi(ptr noundef nonnull align 8 dereferenceable(16) @_ZSt3cin, ptr noundef nonnull align 4 dereferenceable(4) %1)
  %3 = load i32, ptr %1, align 4, !tbaa !5
  %.not49 = icmp slt i32 %3, 1
  br i1 %.not49, label %._crit_edge69, label %.lr.ph53.preheader

.lr.ph53.preheader:                               ; preds = %0
  %4 = zext nneg i32 %3 to i64
  %5 = shl nuw nsw i64 %4, 2
  call void @llvm.memset.p0.i64(ptr nonnull align 4 getelementptr inbounds (i8, ptr @f, i64 4), i8 0, i64 %5, i1 false), !tbaa !5
  br label %.lr.ph53

.preheader47:                                     ; preds = %.lr.ph53
  %.not4257 = icmp slt i32 %11, 1
  br i1 %.not4257, label %._crit_edge69, label %.lr.ph59.preheader

.lr.ph59.preheader:                               ; preds = %.preheader47
  %6 = add nuw i32 %11, 1
  %7 = zext nneg i32 %11 to i64
  %wide.trip.count = zext i32 %6 to i64
  %8 = add nsw i32 %11, -2
  br label %.lr.ph59

.lr.ph53:                                         ; preds = %.lr.ph53.preheader, %.lr.ph53
  %indvars.iv = phi i64 [ 1, %.lr.ph53.preheader ], [ %indvars.iv.next, %.lr.ph53 ]
  %9 = getelementptr inbounds [5001 x i32], ptr @a, i64 0, i64 %indvars.iv
  %10 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERi(ptr noundef nonnull align 8 dereferenceable(16) @_ZSt3cin, ptr noundef nonnull align 4 dereferenceable(4) %9)
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  %11 = load i32, ptr %1, align 4, !tbaa !5
  %12 = sext i32 %11 to i64
  %.not41.not = icmp slt i64 %indvars.iv, %12
  br i1 %.not41.not, label %.lr.ph53, label %.preheader47, !llvm.loop !9

.loopexit:                                        ; preds = %.prol.loopexit, %39, %.lr.ph59
  %indvars.iv.next75 = add nuw nsw i64 %indvars.iv74, 1
  %exitcond82.not = icmp eq i64 %indvars.iv.next80, %wide.trip.count
  %indvar.next = add i32 %indvar, 1
  br i1 %exitcond82.not, label %.preheader46, label %.lr.ph59, !llvm.loop !11

.preheader46:                                     ; preds = %.loopexit
  br i1 %.not4257, label %._crit_edge69, label %.preheader45.preheader

.preheader45.preheader:                           ; preds = %.preheader46
  %13 = add nuw i32 %11, 1
  %wide.trip.count96 = zext i32 %13 to i64
  br label %.preheader45

.lr.ph59:                                         ; preds = %.lr.ph59.preheader, %.loopexit
  %indvar = phi i32 [ 0, %.lr.ph59.preheader ], [ %indvar.next, %.loopexit ]
  %indvars.iv79 = phi i64 [ 1, %.lr.ph59.preheader ], [ %indvars.iv.next80, %.loopexit ]
  %indvars.iv74 = phi i64 [ 2, %.lr.ph59.preheader ], [ %indvars.iv.next75, %.loopexit ]
  %indvars.iv.next80 = add nuw nsw i64 %indvars.iv79, 1
  %.not4454.not = icmp ult i64 %indvars.iv79, %7
  br i1 %.not4454.not, label %.lr.ph56, label %.loopexit

.lr.ph56:                                         ; preds = %.lr.ph59
  %14 = getelementptr inbounds [5001 x i32], ptr @a, i64 0, i64 %indvars.iv79
  %15 = load i32, ptr %14, align 4, !tbaa !5
  %16 = getelementptr inbounds [5001 x i32], ptr @f, i64 0, i64 %indvars.iv79
  %17 = sub i32 %indvar, %11
  %18 = and i32 %17, 1
  %lcmp.mod.not.not = icmp eq i32 %18, 0
  br i1 %lcmp.mod.not.not, label %.prol.preheader, label %.prol.loopexit

.prol.preheader:                                  ; preds = %.lr.ph56
  %19 = getelementptr inbounds [5001 x i32], ptr @a, i64 0, i64 %indvars.iv74
  %20 = load i32, ptr %19, align 4, !tbaa !5
  %21 = icmp slt i32 %20, %15
  br i1 %21, label %22, label %.prol.loopexit.unr-lcssa

22:                                               ; preds = %.prol.preheader
  %23 = load i32, ptr %16, align 4, !tbaa !5
  %24 = add nsw i32 %23, 1
  store i32 %24, ptr %16, align 4, !tbaa !5
  br label %.prol.loopexit.unr-lcssa

.prol.loopexit.unr-lcssa:                         ; preds = %22, %.prol.preheader
  %indvars.iv.next77.prol = add nuw nsw i64 %indvars.iv74, 1
  br label %.prol.loopexit

.prol.loopexit:                                   ; preds = %.prol.loopexit.unr-lcssa, %.lr.ph56
  %indvars.iv76.unr = phi i64 [ %indvars.iv74, %.lr.ph56 ], [ %indvars.iv.next77.prol, %.prol.loopexit.unr-lcssa ]
  %25 = icmp eq i32 %8, %indvar
  br i1 %25, label %.loopexit, label %.lr.ph56.new

.lr.ph56.new:                                     ; preds = %.prol.loopexit, %39
  %indvars.iv76 = phi i64 [ %indvars.iv.next77.1, %39 ], [ %indvars.iv76.unr, %.prol.loopexit ]
  %26 = getelementptr inbounds [5001 x i32], ptr @a, i64 0, i64 %indvars.iv76
  %27 = load i32, ptr %26, align 4, !tbaa !5
  %28 = icmp slt i32 %27, %15
  br i1 %28, label %29, label %32

29:                                               ; preds = %.lr.ph56.new
  %30 = load i32, ptr %16, align 4, !tbaa !5
  %31 = add nsw i32 %30, 1
  store i32 %31, ptr %16, align 4, !tbaa !5
  br label %32

32:                                               ; preds = %.lr.ph56.new, %29
  %indvars.iv.next77 = add nuw nsw i64 %indvars.iv76, 1
  %33 = getelementptr inbounds [5001 x i32], ptr @a, i64 0, i64 %indvars.iv.next77
  %34 = load i32, ptr %33, align 4, !tbaa !5
  %35 = icmp slt i32 %34, %15
  br i1 %35, label %36, label %39

36:                                               ; preds = %32
  %37 = load i32, ptr %16, align 4, !tbaa !5
  %38 = add nsw i32 %37, 1
  store i32 %38, ptr %16, align 4, !tbaa !5
  br label %39

39:                                               ; preds = %36, %32
  %indvars.iv.next77.1 = add nuw nsw i64 %indvars.iv76, 2
  %lftr.wideiv.1 = trunc i64 %indvars.iv.next77.1 to i32
  %exitcond.not.1 = icmp eq i32 %6, %lftr.wideiv.1
  br i1 %exitcond.not.1, label %.loopexit, label %.lr.ph56.new, !llvm.loop !12

.preheader45:                                     ; preds = %.preheader45.preheader, %._crit_edge
  %indvar106 = phi i64 [ 0, %.preheader45.preheader ], [ %indvar.next107, %._crit_edge ]
  %indvars.iv93 = phi i64 [ 1, %.preheader45.preheader ], [ %indvars.iv.next94, %._crit_edge ]
  %.03667 = phi i64 [ 0, %.preheader45.preheader ], [ %.1.lcssa, %._crit_edge ]
  %40 = icmp ugt i64 %indvars.iv93, 1
  br i1 %40, label %.lr.ph61, label %._crit_edge

.lr.ph61:                                         ; preds = %.preheader45
  %41 = getelementptr inbounds [5001 x i32], ptr @a, i64 0, i64 %indvars.iv93
  %42 = load i32, ptr %41, align 4, !tbaa !5
  br label %50

._crit_edge69:                                    ; preds = %._crit_edge, %.preheader47, %0, %.preheader46
  %.036.lcssa = phi i64 [ 0, %.preheader46 ], [ 0, %0 ], [ 0, %.preheader47 ], [ %.1.lcssa, %._crit_edge ]
  %43 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEx(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cout, i64 noundef %.036.lcssa)
  %44 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_c(ptr noundef nonnull align 8 dereferenceable(8) %43, i8 noundef signext 10)
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %1) #5
  ret void

.preheader:                                       ; preds = %._crit_edge98
  br i1 %40, label %.lr.ph64, label %._crit_edge

.lr.ph64:                                         ; preds = %.preheader
  %45 = getelementptr inbounds [5001 x i32], ptr @a, i64 0, i64 %indvars.iv93
  %46 = load i32, ptr %45, align 4, !tbaa !5
  %47 = add nsw i64 %indvars.iv93, -1
  %48 = getelementptr inbounds [5001 x i32], ptr @pre, i64 0, i64 %47
  %xtraiter108 = and i64 %indvar106, 1
  %49 = icmp eq i64 %indvar106, 1
  br i1 %49, label %._crit_edge.loopexit.unr-lcssa, label %.lr.ph64.new

.lr.ph64.new:                                     ; preds = %.lr.ph64
  %unroll_iter = and i64 %indvar106, -2
  br label %74

50:                                               ; preds = %.lr.ph61, %._crit_edge98
  %indvars.iv83 = phi i64 [ 1, %.lr.ph61 ], [ %indvars.iv.next84, %._crit_edge98 ]
  %51 = getelementptr inbounds [5001 x i32], ptr @a, i64 0, i64 %indvars.iv83
  %52 = load i32, ptr %51, align 4, !tbaa !5
  %53 = icmp sgt i32 %52, %42
  %54 = getelementptr inbounds [5001 x i32], ptr @f, i64 0, i64 %indvars.iv83
  %55 = load i32, ptr %54, align 4, !tbaa !5
  br i1 %53, label %56, label %._crit_edge98

56:                                               ; preds = %50
  %57 = add nsw i32 %55, -1
  store i32 %57, ptr %54, align 4, !tbaa !5
  br label %._crit_edge98

._crit_edge98:                                    ; preds = %50, %56
  %58 = phi i32 [ %57, %56 ], [ %55, %50 ]
  %59 = add nsw i64 %indvars.iv83, -1
  %60 = getelementptr inbounds [5001 x i32], ptr @pre, i64 0, i64 %59
  %61 = load i32, ptr %60, align 4, !tbaa !5
  %62 = add nsw i32 %58, %61
  %63 = getelementptr inbounds [5001 x i32], ptr @pre, i64 0, i64 %indvars.iv83
  store i32 %62, ptr %63, align 4, !tbaa !5
  %indvars.iv.next84 = add nuw nsw i64 %indvars.iv83, 1
  %exitcond87.not = icmp eq i64 %indvars.iv.next84, %indvars.iv93
  br i1 %exitcond87.not, label %.preheader, label %50, !llvm.loop !13

._crit_edge.loopexit.unr-lcssa:                   ; preds = %96, %.lr.ph64
  %.2.lcssa.ph = phi i64 [ poison, %.lr.ph64 ], [ %.2.1, %96 ]
  %indvars.iv88.unr = phi i64 [ 1, %.lr.ph64 ], [ %indvars.iv.next89.1, %96 ]
  %.162.unr = phi i64 [ %.03667, %.lr.ph64 ], [ %.2.1, %96 ]
  %lcmp.mod109.not = icmp eq i64 %xtraiter108, 0
  br i1 %lcmp.mod109.not, label %._crit_edge, label %.epil.preheader

.epil.preheader:                                  ; preds = %._crit_edge.loopexit.unr-lcssa
  %64 = getelementptr inbounds [5001 x i32], ptr @a, i64 0, i64 %indvars.iv88.unr
  %65 = load i32, ptr %64, align 4, !tbaa !5
  %66 = icmp slt i32 %65, %46
  br i1 %66, label %67, label %._crit_edge

67:                                               ; preds = %.epil.preheader
  %68 = load i32, ptr %48, align 4, !tbaa !5
  %69 = getelementptr inbounds [5001 x i32], ptr @pre, i64 0, i64 %indvars.iv88.unr
  %70 = load i32, ptr %69, align 4, !tbaa !5
  %71 = sub nsw i32 %68, %70
  %72 = sext i32 %71 to i64
  %73 = add nsw i64 %.162.unr, %72
  br label %._crit_edge

._crit_edge:                                      ; preds = %._crit_edge.loopexit.unr-lcssa, %67, %.epil.preheader, %.preheader45, %.preheader
  %.1.lcssa = phi i64 [ %.03667, %.preheader ], [ %.03667, %.preheader45 ], [ %.2.lcssa.ph, %._crit_edge.loopexit.unr-lcssa ], [ %73, %67 ], [ %.162.unr, %.epil.preheader ]
  %indvars.iv.next94 = add nuw nsw i64 %indvars.iv93, 1
  %exitcond97.not = icmp eq i64 %indvars.iv.next94, %wide.trip.count96
  %indvar.next107 = add i64 %indvar106, 1
  br i1 %exitcond97.not, label %._crit_edge69, label %.preheader45, !llvm.loop !14

74:                                               ; preds = %96, %.lr.ph64.new
  %indvars.iv88 = phi i64 [ 1, %.lr.ph64.new ], [ %indvars.iv.next89.1, %96 ]
  %.162 = phi i64 [ %.03667, %.lr.ph64.new ], [ %.2.1, %96 ]
  %niter = phi i64 [ 0, %.lr.ph64.new ], [ %niter.next.1, %96 ]
  %75 = getelementptr inbounds [5001 x i32], ptr @a, i64 0, i64 %indvars.iv88
  %76 = load i32, ptr %75, align 4, !tbaa !5
  %77 = icmp slt i32 %76, %46
  br i1 %77, label %78, label %85

78:                                               ; preds = %74
  %79 = load i32, ptr %48, align 4, !tbaa !5
  %80 = getelementptr inbounds [5001 x i32], ptr @pre, i64 0, i64 %indvars.iv88
  %81 = load i32, ptr %80, align 4, !tbaa !5
  %82 = sub nsw i32 %79, %81
  %83 = sext i32 %82 to i64
  %84 = add nsw i64 %.162, %83
  br label %85

85:                                               ; preds = %74, %78
  %.2 = phi i64 [ %84, %78 ], [ %.162, %74 ]
  %indvars.iv.next89 = add nuw nsw i64 %indvars.iv88, 1
  %86 = getelementptr inbounds [5001 x i32], ptr @a, i64 0, i64 %indvars.iv.next89
  %87 = load i32, ptr %86, align 4, !tbaa !5
  %88 = icmp slt i32 %87, %46
  br i1 %88, label %89, label %96

89:                                               ; preds = %85
  %90 = load i32, ptr %48, align 4, !tbaa !5
  %91 = getelementptr inbounds [5001 x i32], ptr @pre, i64 0, i64 %indvars.iv.next89
  %92 = load i32, ptr %91, align 4, !tbaa !5
  %93 = sub nsw i32 %90, %92
  %94 = sext i32 %93 to i64
  %95 = add nsw i64 %.2, %94
  br label %96

96:                                               ; preds = %89, %85
  %.2.1 = phi i64 [ %95, %89 ], [ %.2, %85 ]
  %indvars.iv.next89.1 = add nuw nsw i64 %indvars.iv88, 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_edge.loopexit.unr-lcssa, label %74, !llvm.loop !15
}

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

declare noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERi(ptr noundef nonnull align 8 dereferenceable(16), ptr noundef nonnull align 4 dereferenceable(4)) 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 noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_c(ptr noundef nonnull align 8 dereferenceable(8), i8 noundef signext) local_unnamed_addr #3

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

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

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


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