; LLVM IR from eyangch/competitive-programming :: USACOtraining/3.2 (fact4)

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

@_ZSt3cin = external global %"class.std::basic_istream", align 8
@.str = external hidden unnamed_addr constant [9 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [2 x i8], align 1
@stdin = external global ptr, align 8
@.str.2 = external hidden unnamed_addr constant [10 x i8], align 1
@.str.3 = external hidden unnamed_addr constant [2 x i8], align 1
@stdout = external global ptr, align 8
@_ZSt4cout = external global %"class.std::basic_ostream", align 8

; Function Attrs: mustprogress norecurse uwtable
define dso_local noundef i32 @main() #0 {
  %1 = alloca i32, align 4
  %2 = alloca i32, align 4
  %3 = alloca [4220 x i32], align 16
  %4 = alloca i32, align 4
  %5 = alloca i32, align 4
  %6 = alloca i32, align 4
  %7 = alloca i32, align 4
  %8 = alloca [4220 x i32], align 16
  %9 = alloca i32, align 4
  %10 = alloca i32, align 4
  %11 = alloca i32, align 4
  %12 = alloca i32, align 4
  %13 = alloca i32, align 4
  %14 = alloca i32, align 4
  %15 = alloca i32, align 4
  %16 = alloca i32, align 4
  store i32 0, ptr %1, align 4
  %17 = call noundef zeroext i1 @_ZNSt8ios_base15sync_with_stdioEb(i1 noundef zeroext false)
  %18 = load ptr, ptr @_ZSt3cin, align 8, !tbaa !5
  %19 = getelementptr i8, ptr %18, i64 -24
  %20 = load i64, ptr %19, align 8
  %21 = getelementptr inbounds i8, ptr @_ZSt3cin, i64 %20
  %22 = call noundef ptr @_ZNSt9basic_iosIcSt11char_traitsIcEE3tieEPSo(ptr noundef nonnull align 8 dereferenceable(264) %21, ptr noundef null)
  %23 = load ptr, ptr @stdin, align 8, !tbaa !8
  %24 = call ptr @freopen(ptr noundef @.str, ptr noundef @.str.1, ptr noundef %23)
  %25 = load ptr, ptr @stdout, align 8, !tbaa !8
  %26 = call ptr @freopen(ptr noundef @.str.2, ptr noundef @.str.3, ptr noundef %25)
  call void @llvm.lifetime.start.p0(i64 4, ptr %2) #7
  %27 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERi(ptr noundef nonnull align 8 dereferenceable(16) @_ZSt3cin, ptr noundef nonnull align 4 dereferenceable(4) %2)
  call void @llvm.lifetime.start.p0(i64 16880, ptr %3) #7
  %28 = getelementptr inbounds [4220 x i32], ptr %3, i64 0, i64 0
  %29 = getelementptr inbounds [4220 x i32], ptr %3, i64 0, i64 0
  %30 = getelementptr inbounds i32, ptr %29, i64 4220
  call void @llvm.lifetime.start.p0(i64 4, ptr %4) #7
  store i32 -1, ptr %4, align 4, !tbaa !11
  call void @_ZSt4fillIPiiEvT_S1_RKT0_(ptr noundef %28, ptr noundef %30, ptr noundef nonnull align 4 dereferenceable(4) %4)
  call void @llvm.lifetime.end.p0(i64 4, ptr %4) #7
  call void @llvm.lifetime.start.p0(i64 4, ptr %5) #7
  store i32 2, ptr %5, align 4, !tbaa !11
  br label %31

31:                                               ; preds = %59, %0
  %32 = load i32, ptr %5, align 4, !tbaa !11
  %33 = icmp slt i32 %32, 4220
  br i1 %33, label %35, label %34

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

35:                                               ; preds = %31
  %36 = load i32, ptr %5, align 4, !tbaa !11
  %37 = sext i32 %36 to i64
  %38 = getelementptr inbounds [4220 x i32], ptr %3, i64 0, i64 %37
  %39 = load i32, ptr %38, align 4, !tbaa !11
  %40 = icmp eq i32 %39, -1
  br i1 %40, label %41, label %58

41:                                               ; preds = %35
  call void @llvm.lifetime.start.p0(i64 4, ptr %7) #7
  %42 = load i32, ptr %5, align 4, !tbaa !11
  %43 = mul nsw i32 2, %42
  store i32 %43, ptr %7, align 4, !tbaa !11
  br label %44

44:                                               ; preds = %53, %41
  %45 = load i32, ptr %7, align 4, !tbaa !11
  %46 = icmp slt i32 %45, 4220
  br i1 %46, label %48, label %47

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

48:                                               ; preds = %44
  %49 = load i32, ptr %5, align 4, !tbaa !11
  %50 = load i32, ptr %7, align 4, !tbaa !11
  %51 = sext i32 %50 to i64
  %52 = getelementptr inbounds [4220 x i32], ptr %3, i64 0, i64 %51
  store i32 %49, ptr %52, align 4, !tbaa !11
  br label %53

53:                                               ; preds = %48
  %54 = load i32, ptr %5, align 4, !tbaa !11
  %55 = load i32, ptr %7, align 4, !tbaa !11
  %56 = add nsw i32 %55, %54
  store i32 %56, ptr %7, align 4, !tbaa !11
  br label %44, !llvm.loop !13

57:                                               ; preds = %47
  br label %58

58:                                               ; preds = %57, %35
  br label %59

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

62:                                               ; preds = %34
  call void @llvm.lifetime.start.p0(i64 16880, ptr %8) #7
  %63 = getelementptr inbounds [4220 x i32], ptr %8, i64 0, i64 0
  %64 = getelementptr inbounds [4220 x i32], ptr %8, i64 0, i64 0
  %65 = getelementptr inbounds i32, ptr %64, i64 4220
  call void @llvm.lifetime.start.p0(i64 4, ptr %9) #7
  store i32 0, ptr %9, align 4, !tbaa !11
  call void @_ZSt4fillIPiiEvT_S1_RKT0_(ptr noundef %63, ptr noundef %65, ptr noundef nonnull align 4 dereferenceable(4) %9)
  call void @llvm.lifetime.end.p0(i64 4, ptr %9) #7
  call void @llvm.lifetime.start.p0(i64 4, ptr %10) #7
  store i32 2, ptr %10, align 4, !tbaa !11
  br label %66

66:                                               ; preds = %106, %62
  %67 = load i32, ptr %10, align 4, !tbaa !11
  %68 = load i32, ptr %2, align 4, !tbaa !11
  %69 = icmp sle i32 %67, %68
  br i1 %69, label %71, label %70

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

71:                                               ; preds = %66
  call void @llvm.lifetime.start.p0(i64 4, ptr %11) #7
  %72 = load i32, ptr %10, align 4, !tbaa !11
  store i32 %72, ptr %11, align 4, !tbaa !11
  call void @llvm.lifetime.start.p0(i64 4, ptr %12) #7
  store i32 2, ptr %12, align 4, !tbaa !11
  br label %73

73:                                               ; preds = %102, %71
  %74 = load i32, ptr %12, align 4, !tbaa !11
  %75 = load i32, ptr %2, align 4, !tbaa !11
  %76 = icmp sle i32 %74, %75
  br i1 %76, label %78, label %77

77:                                               ; preds = %73
  store i32 11, ptr %6, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %12) #7
  br label %105

78:                                               ; preds = %73
  br label %79

79:                                               ; preds = %92, %78
  %80 = load i32, ptr %12, align 4, !tbaa !11
  %81 = sext i32 %80 to i64
  %82 = getelementptr inbounds [4220 x i32], ptr %3, i64 0, i64 %81
  %83 = load i32, ptr %82, align 4, !tbaa !11
  %84 = icmp eq i32 %83, -1
  br i1 %84, label %85, label %90

85:                                               ; preds = %79
  %86 = load i32, ptr %11, align 4, !tbaa !11
  %87 = load i32, ptr %12, align 4, !tbaa !11
  %88 = srem i32 %86, %87
  %89 = icmp eq i32 %88, 0
  br label %90

90:                                               ; preds = %85, %79
  %91 = phi i1 [ false, %79 ], [ %89, %85 ]
  br i1 %91, label %92, label %101

92:                                               ; preds = %90
  %93 = load i32, ptr %12, align 4, !tbaa !11
  %94 = sext i32 %93 to i64
  %95 = getelementptr inbounds [4220 x i32], ptr %8, i64 0, i64 %94
  %96 = load i32, ptr %95, align 4, !tbaa !11
  %97 = add nsw i32 %96, 1
  store i32 %97, ptr %95, align 4, !tbaa !11
  %98 = load i32, ptr %12, align 4, !tbaa !11
  %99 = load i32, ptr %11, align 4, !tbaa !11
  %100 = sdiv i32 %99, %98
  store i32 %100, ptr %11, align 4, !tbaa !11
  br label %79, !llvm.loop !16

101:                                              ; preds = %90
  br label %102

102:                                              ; preds = %101
  %103 = load i32, ptr %12, align 4, !tbaa !11
  %104 = add nsw i32 %103, 1
  store i32 %104, ptr %12, align 4, !tbaa !11
  br label %73, !llvm.loop !17

105:                                              ; preds = %77
  call void @llvm.lifetime.end.p0(i64 4, ptr %11) #7
  br label %106

106:                                              ; preds = %105
  %107 = load i32, ptr %10, align 4, !tbaa !11
  %108 = add nsw i32 %107, 1
  store i32 %108, ptr %10, align 4, !tbaa !11
  br label %66, !llvm.loop !18

109:                                              ; preds = %70
  call void @llvm.lifetime.start.p0(i64 4, ptr %13) #7
  store i32 1, ptr %13, align 4, !tbaa !11
  call void @llvm.lifetime.start.p0(i64 4, ptr %14) #7
  store i32 2, ptr %14, align 4, !tbaa !11
  br label %110

110:                                              ; preds = %147, %109
  %111 = load i32, ptr %14, align 4, !tbaa !11
  %112 = icmp slt i32 %111, 4220
  br i1 %112, label %114, label %113

113:                                              ; preds = %110
  store i32 16, ptr %6, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %14) #7
  br label %150

114:                                              ; preds = %110
  call void @llvm.lifetime.start.p0(i64 4, ptr %15) #7
  %115 = load i32, ptr %14, align 4, !tbaa !11
  %116 = sext i32 %115 to i64
  %117 = getelementptr inbounds [4220 x i32], ptr %8, i64 0, i64 %116
  %118 = load i32, ptr %117, align 4, !tbaa !11
  store i32 %118, ptr %15, align 4, !tbaa !11
  %119 = load i32, ptr %14, align 4, !tbaa !11
  %120 = icmp eq i32 %119, 2
  br i1 %120, label %124, label %121

121:                                              ; preds = %114
  %122 = load i32, ptr %14, align 4, !tbaa !11
  %123 = icmp eq i32 %122, 5
  br i1 %123, label %124, label %131

124:                                              ; preds = %121, %114
  %125 = getelementptr inbounds [4220 x i32], ptr %8, i64 0, i64 2
  %126 = getelementptr inbounds [4220 x i32], ptr %8, i64 0, i64 5
  %127 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZSt3minIiERKT_S2_S2_(ptr noundef nonnull align 4 dereferenceable(4) %125, ptr noundef nonnull align 4 dereferenceable(4) %126)
  %128 = load i32, ptr %127, align 4, !tbaa !11
  %129 = load i32, ptr %15, align 4, !tbaa !11
  %130 = sub nsw i32 %129, %128
  store i32 %130, ptr %15, align 4, !tbaa !11
  br label %131

131:                                              ; preds = %124, %121
  call void @llvm.lifetime.start.p0(i64 4, ptr %16) #7
  store i32 0, ptr %16, align 4, !tbaa !11
  br label %132

132:                                              ; preds = %143, %131
  %133 = load i32, ptr %16, align 4, !tbaa !11
  %134 = load i32, ptr %15, align 4, !tbaa !11
  %135 = icmp slt i32 %133, %134
  br i1 %135, label %137, label %136

136:                                              ; preds = %132
  store i32 19, ptr %6, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %16) #7
  br label %146

137:                                              ; preds = %132
  %138 = load i32, ptr %14, align 4, !tbaa !11
  %139 = load i32, ptr %13, align 4, !tbaa !11
  %140 = mul nsw i32 %139, %138
  store i32 %140, ptr %13, align 4, !tbaa !11
  %141 = load i32, ptr %13, align 4, !tbaa !11
  %142 = srem i32 %141, 10
  store i32 %142, ptr %13, align 4, !tbaa !11
  br label %143

143:                                              ; preds = %137
  %144 = load i32, ptr %16, align 4, !tbaa !11
  %145 = add nsw i32 %144, 1
  store i32 %145, ptr %16, align 4, !tbaa !11
  br label %132, !llvm.loop !19

146:                                              ; preds = %136
  call void @llvm.lifetime.end.p0(i64 4, ptr %15) #7
  br label %147

147:                                              ; preds = %146
  %148 = load i32, ptr %14, align 4, !tbaa !11
  %149 = add nsw i32 %148, 1
  store i32 %149, ptr %14, align 4, !tbaa !11
  br label %110, !llvm.loop !20

150:                                              ; preds = %113
  %151 = load i32, ptr %13, align 4, !tbaa !11
  %152 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEi(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cout, i32 noundef %151)
  %153 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEPFRSoS_E(ptr noundef nonnull align 8 dereferenceable(8) %152, ptr noundef @_ZSt4endlIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_)
  store i32 0, ptr %1, align 4
  store i32 1, ptr %6, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %13) #7
  call void @llvm.lifetime.end.p0(i64 16880, ptr %8) #7
  call void @llvm.lifetime.end.p0(i64 16880, ptr %3) #7
  call void @llvm.lifetime.end.p0(i64 4, ptr %2) #7
  %154 = load i32, ptr %1, align 4
  ret i32 %154
}

declare noundef zeroext i1 @_ZNSt8ios_base15sync_with_stdioEb(i1 noundef zeroext) #1

; Function Attrs: mustprogress nounwind uwtable
declare noundef ptr @_ZNSt9basic_iosIcSt11char_traitsIcEE3tieEPSo(ptr noundef nonnull align 8 dereferenceable(264), ptr noundef) #2 align 2

declare ptr @freopen(ptr noundef, ptr noundef, ptr noundef) #1

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

declare noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERi(ptr noundef nonnull align 8 dereferenceable(16), ptr noundef nonnull align 4 dereferenceable(4)) #1

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

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

; 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)) #5

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) #6 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)) #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 = { "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 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 #3 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #4 = { 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 #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 = { 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 = !{!"vtable pointer", !7, i64 0}
!7 = !{!"Simple C++ TBAA"}
!8 = !{!9, !9, i64 0}
!9 = !{!"any pointer", !10, i64 0}
!10 = !{!"omnipotent char", !7, i64 0}
!11 = !{!12, !12, i64 0}
!12 = !{!"int", !10, i64 0}
!13 = distinct !{!13, !14}
!14 = !{!"llvm.loop.mustprogress"}
!15 = distinct !{!15, !14}
!16 = distinct !{!16, !14}
!17 = distinct !{!17, !14}
!18 = distinct !{!18, !14}
!19 = distinct !{!19, !14}
!20 = distinct !{!20, !14}


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

@_ZSt3cin = external global %"class.std::basic_istream", align 8
@.str = external hidden unnamed_addr constant [9 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [2 x i8], align 1
@stdin = external local_unnamed_addr global ptr, align 8
@.str.2 = external hidden unnamed_addr constant [10 x i8], align 1
@.str.3 = external hidden unnamed_addr constant [2 x i8], align 1
@stdout = external local_unnamed_addr global ptr, align 8
@_ZSt4cout = external global %"class.std::basic_ostream", align 8

; Function Attrs: mustprogress norecurse uwtable
define dso_local noundef i32 @main() local_unnamed_addr #0 {
  %1 = alloca i32, align 4
  %2 = alloca [4220 x i32], align 16
  %3 = alloca i32, align 4
  %4 = alloca [4220 x i32], align 16
  %5 = alloca i32, align 4
  %6 = tail call noundef zeroext i1 @_ZNSt8ios_base15sync_with_stdioEb(i1 noundef zeroext false)
  %7 = load ptr, ptr @_ZSt3cin, align 8, !tbaa !5
  %8 = getelementptr i8, ptr %7, i64 -24
  %9 = load i64, ptr %8, align 8
  %10 = getelementptr inbounds i8, ptr @_ZSt3cin, i64 %9
  %11 = tail call noundef ptr @_ZNSt9basic_iosIcSt11char_traitsIcEE3tieEPSo(ptr noundef nonnull align 8 dereferenceable(264) %10, ptr noundef null)
  %12 = load ptr, ptr @stdin, align 8, !tbaa !8
  %13 = tail call ptr @freopen(ptr noundef nonnull @.str, ptr noundef nonnull @.str.1, ptr noundef %12)
  %14 = load ptr, ptr @stdout, align 8, !tbaa !8
  %15 = tail call ptr @freopen(ptr noundef nonnull @.str.2, ptr noundef nonnull @.str.3, ptr noundef %14)
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %1) #7
  %16 = 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 16880, ptr nonnull %2) #7
  %17 = getelementptr inbounds i8, ptr %2, i64 16880
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %3) #7
  store i32 -1, ptr %3, align 4, !tbaa !11
  call void @_ZSt4fillIPiiEvT_S1_RKT0_(ptr noundef nonnull %2, ptr noundef nonnull %17, ptr noundef nonnull align 4 dereferenceable(4) %3)
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %3) #7
  br label %22

18:                                               ; preds = %.loopexit
  call void @llvm.lifetime.start.p0(i64 16880, ptr nonnull %4) #7
  %19 = getelementptr inbounds i8, ptr %4, i64 16880
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %5) #7
  store i32 0, ptr %5, align 4, !tbaa !11
  call void @_ZSt4fillIPiiEvT_S1_RKT0_(ptr noundef nonnull %4, ptr noundef nonnull %19, ptr noundef nonnull align 4 dereferenceable(4) %5)
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %5) #7
  %20 = load i32, ptr %1, align 4, !tbaa !11
  %.not62 = icmp slt i32 %20, 2
  br i1 %.not62, label %.preheader, label %.preheader46.preheader

.preheader46.preheader:                           ; preds = %18
  %21 = add nuw i32 %20, 1
  %wide.trip.count = zext i32 %21 to i64
  br label %.preheader46

22:                                               ; preds = %0, %.loopexit
  %indvars.iv74 = phi i64 [ 2, %0 ], [ %indvars.iv.next75, %.loopexit ]
  %indvars.iv = phi i64 [ 4, %0 ], [ %indvars.iv.next, %.loopexit ]
  %23 = getelementptr inbounds [4220 x i32], ptr %2, i64 0, i64 %indvars.iv74
  %24 = load i32, ptr %23, align 4, !tbaa !11
  %25 = icmp eq i32 %24, -1
  %26 = icmp ult i64 %indvars.iv74, 2110
  %or.cond = and i1 %25, %26
  br i1 %or.cond, label %.lr.ph.preheader, label %.loopexit

.lr.ph.preheader:                                 ; preds = %22
  %27 = trunc nuw nsw i64 %indvars.iv74 to i32
  br label %.lr.ph

.lr.ph:                                           ; preds = %.lr.ph.preheader, %.lr.ph
  %indvars.iv76 = phi i64 [ %indvars.iv, %.lr.ph.preheader ], [ %indvars.iv.next77, %.lr.ph ]
  %28 = getelementptr inbounds [4220 x i32], ptr %2, i64 0, i64 %indvars.iv76
  store i32 %27, ptr %28, align 4, !tbaa !11
  %indvars.iv.next77 = add nuw nsw i64 %indvars.iv76, %indvars.iv74
  %29 = icmp ult i64 %indvars.iv.next77, 4220
  br i1 %29, label %.lr.ph, label %.loopexit, !llvm.loop !13

.loopexit:                                        ; preds = %.lr.ph, %22
  %indvars.iv.next75 = add nuw nsw i64 %indvars.iv74, 1
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 2
  %exitcond.not = icmp eq i64 %indvars.iv.next75, 4220
  br i1 %exitcond.not, label %18, label %22, !llvm.loop !15

.preheader46:                                     ; preds = %.preheader46.preheader, %._crit_edge
  %.04163 = phi i32 [ %45, %._crit_edge ], [ 2, %.preheader46.preheader ]
  br label %.preheader45

.preheader:                                       ; preds = %._crit_edge, %18
  %30 = getelementptr inbounds i8, ptr %4, i64 8
  %31 = getelementptr inbounds i8, ptr %4, i64 20
  br label %49

.preheader45:                                     ; preds = %.preheader46, %.critedge
  %indvars.iv80 = phi i64 [ 2, %.preheader46 ], [ %indvars.iv.next81, %.critedge ]
  %.03958 = phi i32 [ %.04163, %.preheader46 ], [ %.140.lcssa, %.critedge ]
  %32 = getelementptr inbounds [4220 x i32], ptr %2, i64 0, i64 %indvars.iv80
  %33 = load i32, ptr %32, align 4, !tbaa !11
  %34 = icmp eq i32 %33, -1
  br i1 %34, label %.lr.ph51, label %.critedge

.lr.ph51:                                         ; preds = %.preheader45
  %35 = getelementptr inbounds [4220 x i32], ptr %4, i64 0, i64 %indvars.iv80
  %36 = trunc nuw nsw i64 %indvars.iv80 to i32
  %37 = srem i32 %.03958, %36
  %38 = icmp eq i32 %37, 0
  br i1 %38, label %.lr.ph55, label %.critedge

.lr.ph55:                                         ; preds = %.lr.ph51
  %.promoted = load i32, ptr %35, align 4, !tbaa !11
  br label %39

39:                                               ; preds = %.lr.ph55, %39
  %40 = phi i32 [ %.promoted, %.lr.ph55 ], [ %41, %39 ]
  %.14050.us54 = phi i32 [ %.03958, %.lr.ph55 ], [ %42, %39 ]
  %41 = add nsw i32 %40, 1
  %42 = sdiv i32 %.14050.us54, %36
  %43 = srem i32 %42, %36
  %44 = icmp eq i32 %43, 0
  br i1 %44, label %39, label %...critedge_crit_edge.split.us_crit_edge

...critedge_crit_edge.split.us_crit_edge:         ; preds = %39
  store i32 %41, ptr %35, align 4, !tbaa !11
  br label %.critedge

._crit_edge:                                      ; preds = %.critedge
  %45 = add nuw i32 %.04163, 1
  %exitcond84.not = icmp eq i32 %.04163, %20
  br i1 %exitcond84.not, label %.preheader, label %.preheader46, !llvm.loop !16

.critedge:                                        ; preds = %...critedge_crit_edge.split.us_crit_edge, %.lr.ph51, %.preheader45
  %.140.lcssa = phi i32 [ %.03958, %.preheader45 ], [ %42, %...critedge_crit_edge.split.us_crit_edge ], [ %.03958, %.lr.ph51 ]
  %indvars.iv.next81 = add nuw nsw i64 %indvars.iv80, 1
  %exitcond83.not = icmp eq i64 %indvars.iv.next81, %wide.trip.count
  br i1 %exitcond83.not, label %._crit_edge, label %.preheader45, !llvm.loop !17

46:                                               ; preds = %._crit_edge68
  %47 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEi(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cout, i32 noundef %.1.lcssa)
  %48 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEPFRSoS_E(ptr noundef nonnull align 8 dereferenceable(8) %47, ptr noundef nonnull @_ZSt4endlIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_)
  call void @llvm.lifetime.end.p0(i64 16880, ptr nonnull %4) #7
  call void @llvm.lifetime.end.p0(i64 16880, ptr nonnull %2) #7
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %1) #7
  ret i32 0

49:                                               ; preds = %.preheader, %._crit_edge68
  %indvars.iv86 = phi i64 [ 2, %.preheader ], [ %indvars.iv.next87, %._crit_edge68 ]
  %.03769 = phi i32 [ 1, %.preheader ], [ %.1.lcssa, %._crit_edge68 ]
  %50 = getelementptr inbounds [4220 x i32], ptr %4, i64 0, i64 %indvars.iv86
  %51 = load i32, ptr %50, align 4, !tbaa !11
  %52 = trunc nuw nsw i64 %indvars.iv86 to i32
  switch i32 %52, label %57 [
    i32 5, label %53
    i32 2, label %53
  ]

53:                                               ; preds = %49, %49
  %54 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZSt3minIiERKT_S2_S2_(ptr noundef nonnull align 4 dereferenceable(4) %30, ptr noundef nonnull align 4 dereferenceable(4) %31)
  %55 = load i32, ptr %54, align 4, !tbaa !11
  %56 = sub nsw i32 %51, %55
  br label %57

57:                                               ; preds = %49, %53
  %.035 = phi i32 [ %56, %53 ], [ %51, %49 ]
  %58 = icmp sgt i32 %.035, 0
  br i1 %58, label %.lr.ph67.preheader, label %._crit_edge68

.lr.ph67.preheader:                               ; preds = %57
  %xtraiter = and i32 %.035, 3
  %59 = icmp ult i32 %.035, 4
  br i1 %59, label %._crit_edge68.loopexit.unr-lcssa, label %.lr.ph67.preheader.new

.lr.ph67.preheader.new:                           ; preds = %.lr.ph67.preheader
  %unroll_iter = and i32 %.035, 2147483644
  br label %.lr.ph67

._crit_edge68.loopexit.unr-lcssa:                 ; preds = %.lr.ph67, %.lr.ph67.preheader
  %.lcssa.ph = phi i32 [ poison, %.lr.ph67.preheader ], [ %69, %.lr.ph67 ]
  %.164.unr = phi i32 [ %.03769, %.lr.ph67.preheader ], [ %69, %.lr.ph67 ]
  %lcmp.mod.not = icmp eq i32 %xtraiter, 0
  br i1 %lcmp.mod.not, label %._crit_edge68, label %.lr.ph67.epil

.lr.ph67.epil:                                    ; preds = %._crit_edge68.loopexit.unr-lcssa, %.lr.ph67.epil
  %.164.epil = phi i32 [ %61, %.lr.ph67.epil ], [ %.164.unr, %._crit_edge68.loopexit.unr-lcssa ]
  %epil.iter = phi i32 [ %epil.iter.next, %.lr.ph67.epil ], [ 0, %._crit_edge68.loopexit.unr-lcssa ]
  %60 = mul nsw i32 %.164.epil, %52
  %61 = srem i32 %60, 10
  %epil.iter.next = add i32 %epil.iter, 1
  %epil.iter.cmp.not = icmp eq i32 %epil.iter.next, %xtraiter
  br i1 %epil.iter.cmp.not, label %._crit_edge68, label %.lr.ph67.epil, !llvm.loop !18

._crit_edge68:                                    ; preds = %._crit_edge68.loopexit.unr-lcssa, %.lr.ph67.epil, %57
  %.1.lcssa = phi i32 [ %.03769, %57 ], [ %.lcssa.ph, %._crit_edge68.loopexit.unr-lcssa ], [ %61, %.lr.ph67.epil ]
  %indvars.iv.next87 = add nuw nsw i64 %indvars.iv86, 1
  %exitcond89.not = icmp eq i64 %indvars.iv.next87, 4220
  br i1 %exitcond89.not, label %46, label %49, !llvm.loop !20

.lr.ph67:                                         ; preds = %.lr.ph67, %.lr.ph67.preheader.new
  %.164 = phi i32 [ %.03769, %.lr.ph67.preheader.new ], [ %69, %.lr.ph67 ]
  %niter = phi i32 [ 0, %.lr.ph67.preheader.new ], [ %niter.next.3, %.lr.ph67 ]
  %62 = mul nsw i32 %.164, %52
  %63 = srem i32 %62, 10
  %64 = mul nsw i32 %63, %52
  %65 = srem i32 %64, 10
  %66 = mul nsw i32 %65, %52
  %67 = srem i32 %66, 10
  %68 = mul nsw i32 %67, %52
  %69 = srem i32 %68, 10
  %niter.next.3 = add i32 %niter, 4
  %niter.ncmp.3 = icmp eq i32 %niter.next.3, %unroll_iter
  br i1 %niter.ncmp.3, label %._crit_edge68.loopexit.unr-lcssa, label %.lr.ph67, !llvm.loop !21
}

declare noundef zeroext i1 @_ZNSt8ios_base15sync_with_stdioEb(i1 noundef zeroext) local_unnamed_addr #1

; Function Attrs: mustprogress nounwind uwtable
declare noundef ptr @_ZNSt9basic_iosIcSt11char_traitsIcEE3tieEPSo(ptr noundef nonnull align 8 dereferenceable(264), ptr noundef) local_unnamed_addr #2 align 2

declare ptr @freopen(ptr noundef, ptr noundef, ptr noundef) 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) #3

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 #1

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

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

; 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 #5

declare noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEi(ptr noundef nonnull align 8 dereferenceable(8), i32 noundef) local_unnamed_addr #1

; 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 #6 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)) #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 = { "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 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 #3 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #4 = { 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 #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 = { 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 = !{!"vtable pointer", !7, i64 0}
!7 = !{!"Simple C++ TBAA"}
!8 = !{!9, !9, i64 0}
!9 = !{!"any pointer", !10, i64 0}
!10 = !{!"omnipotent char", !7, i64 0}
!11 = !{!12, !12, i64 0}
!12 = !{!"int", !10, i64 0}
!13 = distinct !{!13, !14}
!14 = !{!"llvm.loop.mustprogress"}
!15 = distinct !{!15, !14}
!16 = distinct !{!16, !14}
!17 = distinct !{!17, !14}
!18 = distinct !{!18, !19}
!19 = !{!"llvm.loop.unroll.disable"}
!20 = distinct !{!20, !14}
!21 = distinct !{!21, !14}


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