; LLVM IR from eyangch/competitive-programming :: USACOcontests/gold/2020.03 (exercise)

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

@MOD = external dso_local global i64, align 8
@N = external dso_local global i64, align 8
@dp = external dso_local global [2 x [10001 x i64]], align 16
@sv = external dso_local global [10001 x i8], align 16
@.str = external hidden unnamed_addr constant [12 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 [13 x i8], align 1
@.str.3 = external hidden unnamed_addr constant [2 x i8], align 1
@stdout = external global ptr, align 8
@_ZSt3cin = external global %"class.std::basic_istream", align 8
@_ZSt4cout = external global %"class.std::basic_ostream", align 8
@.str.4 = external hidden unnamed_addr constant [2 x i8], align 1

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

24:                                               ; preds = %122, %0
  %25 = load i64, ptr %5, align 8, !tbaa !11
  %26 = load i64, ptr @N, align 8, !tbaa !11
  %27 = icmp sle i64 %25, %26
  br i1 %27, label %29, label %28

28:                                               ; preds = %24
  store i32 2, ptr %6, align 4
  call void @llvm.lifetime.end.p0(i64 8, ptr %5) #6
  br label %125

29:                                               ; preds = %24
  %30 = load i64, ptr %5, align 8, !tbaa !11
  %31 = getelementptr inbounds [10001 x i8], ptr @sv, i64 0, i64 %30
  %32 = load i8, ptr %31, align 1, !tbaa !13, !range !15, !noundef !16
  %33 = trunc i8 %32 to i1
  br i1 %33, label %34, label %35

34:                                               ; preds = %29
  br label %122

35:                                               ; preds = %29
  call void @llvm.lifetime.start.p0(i64 8, ptr %7) #6
  %36 = load i64, ptr %5, align 8, !tbaa !11
  %37 = mul nsw i64 %36, 2
  store i64 %37, ptr %7, align 8, !tbaa !11
  br label %38

38:                                               ; preds = %46, %35
  %39 = load i64, ptr %7, align 8, !tbaa !11
  %40 = load i64, ptr @N, align 8, !tbaa !11
  %41 = icmp sle i64 %39, %40
  br i1 %41, label %43, label %42

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

43:                                               ; preds = %38
  %44 = load i64, ptr %7, align 8, !tbaa !11
  %45 = getelementptr inbounds [10001 x i8], ptr @sv, i64 0, i64 %44
  store i8 1, ptr %45, align 1, !tbaa !13
  br label %46

46:                                               ; preds = %43
  %47 = load i64, ptr %5, align 8, !tbaa !11
  %48 = load i64, ptr %7, align 8, !tbaa !11
  %49 = add nsw i64 %48, %47
  store i64 %49, ptr %7, align 8, !tbaa !11
  br label %38, !llvm.loop !17

50:                                               ; preds = %42
  call void @llvm.lifetime.start.p0(i64 8, ptr %8) #6
  store i64 0, ptr %8, align 8, !tbaa !11
  br label %51

51:                                               ; preds = %66, %50
  %52 = load i64, ptr %8, align 8, !tbaa !11
  %53 = load i64, ptr @N, align 8, !tbaa !11
  %54 = icmp sle i64 %52, %53
  br i1 %54, label %56, label %55

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

56:                                               ; preds = %51
  %57 = load i64, ptr %3, align 8, !tbaa !11
  %58 = getelementptr inbounds [2 x [10001 x i64]], ptr @dp, i64 0, i64 %57
  %59 = load i64, ptr %8, align 8, !tbaa !11
  %60 = getelementptr inbounds [10001 x i64], ptr %58, i64 0, i64 %59
  %61 = load i64, ptr %60, align 8, !tbaa !11
  %62 = load i64, ptr %2, align 8, !tbaa !11
  %63 = getelementptr inbounds [2 x [10001 x i64]], ptr @dp, i64 0, i64 %62
  %64 = load i64, ptr %8, align 8, !tbaa !11
  %65 = getelementptr inbounds [10001 x i64], ptr %63, i64 0, i64 %64
  store i64 %61, ptr %65, align 8, !tbaa !11
  br label %66

66:                                               ; preds = %56
  %67 = load i64, ptr %8, align 8, !tbaa !11
  %68 = add nsw i64 %67, 1
  store i64 %68, ptr %8, align 8, !tbaa !11
  br label %51, !llvm.loop !19

69:                                               ; preds = %55
  call void @llvm.lifetime.start.p0(i64 8, ptr %9) #6
  %70 = load i64, ptr %5, align 8, !tbaa !11
  store i64 %70, ptr %9, align 8, !tbaa !11
  br label %71

71:                                               ; preds = %109, %69
  %72 = load i64, ptr %9, align 8, !tbaa !11
  %73 = load i64, ptr @N, align 8, !tbaa !11
  %74 = icmp sle i64 %72, %73
  br i1 %74, label %76, label %75

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

76:                                               ; preds = %71
  call void @llvm.lifetime.start.p0(i64 8, ptr %10) #6
  %77 = load i64, ptr %9, align 8, !tbaa !11
  store i64 %77, ptr %10, align 8, !tbaa !11
  br label %78

78:                                               ; preds = %105, %76
  %79 = load i64, ptr %10, align 8, !tbaa !11
  %80 = load i64, ptr @N, align 8, !tbaa !11
  %81 = icmp sle i64 %79, %80
  br i1 %81, label %83, label %82

82:                                               ; preds = %78
  store i32 14, ptr %6, align 4
  call void @llvm.lifetime.end.p0(i64 8, ptr %10) #6
  br label %108

83:                                               ; preds = %78
  %84 = load i64, ptr %2, align 8, !tbaa !11
  %85 = getelementptr inbounds [2 x [10001 x i64]], ptr @dp, i64 0, i64 %84
  %86 = load i64, ptr %10, align 8, !tbaa !11
  %87 = getelementptr inbounds [10001 x i64], ptr %85, i64 0, i64 %86
  %88 = load i64, ptr %87, align 8, !tbaa !11
  %89 = load i64, ptr %3, align 8, !tbaa !11
  %90 = getelementptr inbounds [2 x [10001 x i64]], ptr @dp, i64 0, i64 %89
  %91 = load i64, ptr %10, align 8, !tbaa !11
  %92 = load i64, ptr %9, align 8, !tbaa !11
  %93 = sub nsw i64 %91, %92
  %94 = getelementptr inbounds [10001 x i64], ptr %90, i64 0, i64 %93
  %95 = load i64, ptr %94, align 8, !tbaa !11
  %96 = load i64, ptr %9, align 8, !tbaa !11
  %97 = mul nsw i64 %95, %96
  %98 = add nsw i64 %88, %97
  %99 = load i64, ptr @MOD, align 8, !tbaa !11
  %100 = srem i64 %98, %99
  %101 = load i64, ptr %2, align 8, !tbaa !11
  %102 = getelementptr inbounds [2 x [10001 x i64]], ptr @dp, i64 0, i64 %101
  %103 = load i64, ptr %10, align 8, !tbaa !11
  %104 = getelementptr inbounds [10001 x i64], ptr %102, i64 0, i64 %103
  store i64 %100, ptr %104, align 8, !tbaa !11
  br label %105

105:                                              ; preds = %83
  %106 = load i64, ptr %10, align 8, !tbaa !11
  %107 = add nsw i64 %106, 1
  store i64 %107, ptr %10, align 8, !tbaa !11
  br label %78, !llvm.loop !20

108:                                              ; preds = %82
  br label %109

109:                                              ; preds = %108
  %110 = load i64, ptr %5, align 8, !tbaa !11
  %111 = load i64, ptr %9, align 8, !tbaa !11
  %112 = mul nsw i64 %111, %110
  store i64 %112, ptr %9, align 8, !tbaa !11
  br label %71, !llvm.loop !21

113:                                              ; preds = %75
  %114 = load i64, ptr %2, align 8, !tbaa !11
  %115 = icmp ne i64 %114, 0
  %116 = xor i1 %115, true
  %117 = zext i1 %116 to i64
  store i64 %117, ptr %2, align 8, !tbaa !11
  %118 = load i64, ptr %3, align 8, !tbaa !11
  %119 = icmp ne i64 %118, 0
  %120 = xor i1 %119, true
  %121 = zext i1 %120 to i64
  store i64 %121, ptr %3, align 8, !tbaa !11
  br label %122

122:                                              ; preds = %113, %34
  %123 = load i64, ptr %5, align 8, !tbaa !11
  %124 = add nsw i64 %123, 1
  store i64 %124, ptr %5, align 8, !tbaa !11
  br label %24, !llvm.loop !22

125:                                              ; preds = %28
  call void @llvm.lifetime.start.p0(i64 8, ptr %11) #6
  store i64 0, ptr %11, align 8, !tbaa !11
  br label %126

126:                                              ; preds = %141, %125
  %127 = load i64, ptr %11, align 8, !tbaa !11
  %128 = load i64, ptr @N, align 8, !tbaa !11
  %129 = icmp sle i64 %127, %128
  br i1 %129, label %131, label %130

130:                                              ; preds = %126
  store i32 17, ptr %6, align 4
  call void @llvm.lifetime.end.p0(i64 8, ptr %11) #6
  br label %144

131:                                              ; preds = %126
  %132 = load i64, ptr %4, align 8, !tbaa !11
  %133 = load i64, ptr %3, align 8, !tbaa !11
  %134 = getelementptr inbounds [2 x [10001 x i64]], ptr @dp, i64 0, i64 %133
  %135 = load i64, ptr %11, align 8, !tbaa !11
  %136 = getelementptr inbounds [10001 x i64], ptr %134, i64 0, i64 %135
  %137 = load i64, ptr %136, align 8, !tbaa !11
  %138 = add nsw i64 %132, %137
  %139 = load i64, ptr @MOD, align 8, !tbaa !11
  %140 = srem i64 %138, %139
  store i64 %140, ptr %4, align 8, !tbaa !11
  br label %141

141:                                              ; preds = %131
  %142 = load i64, ptr %11, align 8, !tbaa !11
  %143 = add nsw i64 %142, 1
  store i64 %143, ptr %11, align 8, !tbaa !11
  br label %126, !llvm.loop !23

144:                                              ; preds = %130
  %145 = load i64, ptr %4, align 8, !tbaa !11
  %146 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEx(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cout, i64 noundef %145)
  %147 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc(ptr noundef nonnull align 8 dereferenceable(8) %146, ptr noundef @.str.4)
  store i32 0, ptr %1, align 4
  store i32 1, ptr %6, align 4
  call void @llvm.lifetime.end.p0(i64 8, ptr %4) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr %3) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr %2) #6
  %148 = load i32, ptr %1, align 4
  ret i32 %148
}

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

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

; Function Attrs: mustprogress uwtable
declare noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERx(ptr noundef nonnull align 8 dereferenceable(16), ptr noundef nonnull align 8 dereferenceable(8)) #3 align 2

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

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

; Function Attrs: inlinehint mustprogress uwtable
declare noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc(ptr noundef nonnull align 8 dereferenceable(8), ptr noundef) #5

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

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

!llvm.module.flags = !{!0, !1, !2, !3}
!llvm.ident = !{!4}

!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"clang version 19.1.0 (git@github.com:llvm/llvm-project.git a4bf6cd7cfb1a1421ba92bca9d017b49936c55e4)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"any pointer", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C++ TBAA"}
!9 = !{!10, !10, i64 0}
!10 = !{!"vtable pointer", !8, i64 0}
!11 = !{!12, !12, i64 0}
!12 = !{!"long long", !7, i64 0}
!13 = !{!14, !14, i64 0}
!14 = !{!"bool", !7, i64 0}
!15 = !{i8 0, i8 2}
!16 = !{}
!17 = distinct !{!17, !18}
!18 = !{!"llvm.loop.mustprogress"}
!19 = distinct !{!19, !18}
!20 = distinct !{!20, !18}
!21 = distinct !{!21, !18}
!22 = distinct !{!22, !18}
!23 = distinct !{!23, !18}


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

@MOD = external dso_local global i64, align 8
@N = external dso_local global i64, align 8
@dp = external dso_local local_unnamed_addr global [2 x [10001 x i64]], align 16
@sv = external dso_local local_unnamed_addr global [10001 x i8], align 16
@.str = external hidden unnamed_addr constant [12 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 [13 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
@_ZSt3cin = external global %"class.std::basic_istream", align 8
@_ZSt4cout = external global %"class.std::basic_ostream", align 8
@.str.4 = external hidden unnamed_addr constant [2 x i8], align 1

; Function Attrs: mustprogress norecurse uwtable
define dso_local noundef i32 @main() local_unnamed_addr #0 {
  %1 = load ptr, ptr @stdin, align 8, !tbaa !5
  %2 = tail call ptr @freopen(ptr noundef nonnull @.str, ptr noundef nonnull @.str.1, ptr noundef %1)
  %3 = load ptr, ptr @stdout, align 8, !tbaa !5
  %4 = tail call ptr @freopen(ptr noundef nonnull @.str.2, ptr noundef nonnull @.str.3, ptr noundef %3)
  %5 = tail call noundef zeroext i1 @_ZNSt8ios_base15sync_with_stdioEb(i1 noundef zeroext false)
  %6 = load ptr, ptr @_ZSt3cin, align 8, !tbaa !9
  %7 = getelementptr i8, ptr %6, i64 -24
  %8 = load i64, ptr %7, align 8
  %9 = getelementptr inbounds i8, ptr @_ZSt3cin, i64 %8
  %10 = tail call noundef ptr @_ZNSt9basic_iosIcSt11char_traitsIcEE3tieEPSo(ptr noundef nonnull align 8 dereferenceable(264) %9, ptr noundef null)
  %11 = tail call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERx(ptr noundef nonnull align 8 dereferenceable(16) @_ZSt3cin, ptr noundef nonnull align 8 dereferenceable(8) @N)
  %12 = tail call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERx(ptr noundef nonnull align 8 dereferenceable(16) %11, ptr noundef nonnull align 8 dereferenceable(8) @MOD)
  store i64 1, ptr getelementptr inbounds (i8, ptr @dp, i64 80008), align 8, !tbaa !11
  %13 = load i64, ptr @N, align 8, !tbaa !11
  %.not65 = icmp slt i64 %13, 2
  br i1 %.not65, label %.preheader, label %.lr.ph71.split.preheader

.lr.ph71.split.preheader:                         ; preds = %0
  %14 = load i64, ptr @MOD, align 8
  %15 = add nuw i64 %13, 1
  %16 = add nuw i64 %13, 1
  %min.iters.check = icmp ult i64 %13, 7
  %n.vec = and i64 %15, -4
  %cmp.n = icmp eq i64 %15, %n.vec
  %xtraiter = and i64 %16, 3
  %lcmp.mod.not = icmp eq i64 %xtraiter, 0
  br label %.lr.ph71.split

.preheader:                                       ; preds = %70, %0
  %.044.lcssa = phi i64 [ 1, %0 ], [ %.1, %70 ]
  %.not4774 = icmp slt i64 %13, 0
  br i1 %.not4774, label %._crit_edge78, label %.lr.ph77

.lr.ph77:                                         ; preds = %.preheader
  %17 = load i64, ptr @MOD, align 8, !tbaa !11
  %18 = icmp eq i64 %13, 0
  br i1 %18, label %._crit_edge78.loopexit.unr-lcssa, label %.lr.ph77.new

.lr.ph77.new:                                     ; preds = %.lr.ph77
  %19 = add nuw i64 %13, 1
  %unroll_iter = and i64 %19, -2
  br label %79

.lr.ph71.split:                                   ; preds = %.lr.ph71.split.preheader, %70
  %.04268 = phi i64 [ %71, %70 ], [ 2, %.lr.ph71.split.preheader ]
  %.04467 = phi i64 [ %.1, %70 ], [ 1, %.lr.ph71.split.preheader ]
  %.04566 = phi i64 [ %.146, %70 ], [ 0, %.lr.ph71.split.preheader ]
  %20 = getelementptr inbounds [10001 x i8], ptr @sv, i64 0, i64 %.04268
  %21 = load i8, ptr %20, align 1, !tbaa !13, !range !15, !noundef !16
  %22 = trunc nuw i8 %21 to i1
  br i1 %22, label %70, label %23

23:                                               ; preds = %.lr.ph71.split
  %24 = shl nuw nsw i64 %.04268, 1
  %.not4857 = icmp sgt i64 %24, %13
  br i1 %.not4857, label %.preheader56, label %.lr.ph

.preheader56:                                     ; preds = %.lr.ph, %23
  br i1 %min.iters.check, label %scalar.ph.preheader, label %vector.memcheck

scalar.ph.preheader:                              ; preds = %middle.block, %vector.memcheck, %.preheader56
  %.04060.ph = phi i64 [ 0, %vector.memcheck ], [ 0, %.preheader56 ], [ %n.vec, %middle.block ]
  %25 = sub i64 %13, %.04060.ph
  br i1 %lcmp.mod.not, label %scalar.ph.prol.loopexit, label %scalar.ph.prol

scalar.ph.prol:                                   ; preds = %scalar.ph.preheader, %scalar.ph.prol
  %.04060.prol = phi i64 [ %29, %scalar.ph.prol ], [ %.04060.ph, %scalar.ph.preheader ]
  %prol.iter = phi i64 [ %prol.iter.next, %scalar.ph.prol ], [ 0, %scalar.ph.preheader ]
  %26 = getelementptr inbounds [2 x [10001 x i64]], ptr @dp, i64 0, i64 %.04467, i64 %.04060.prol
  %27 = load i64, ptr %26, align 8, !tbaa !11
  %28 = getelementptr inbounds [2 x [10001 x i64]], ptr @dp, i64 0, i64 %.04566, i64 %.04060.prol
  store i64 %27, ptr %28, align 8, !tbaa !11
  %29 = add nuw i64 %.04060.prol, 1
  %prol.iter.next = add i64 %prol.iter, 1
  %prol.iter.cmp.not = icmp eq i64 %prol.iter.next, %xtraiter
  br i1 %prol.iter.cmp.not, label %scalar.ph.prol.loopexit, label %scalar.ph.prol, !llvm.loop !17

scalar.ph.prol.loopexit:                          ; preds = %scalar.ph.prol, %scalar.ph.preheader
  %.04060.unr = phi i64 [ %.04060.ph, %scalar.ph.preheader ], [ %29, %scalar.ph.prol ]
  %30 = icmp ult i64 %25, 3
  br i1 %30, label %.preheader54.preheader, label %scalar.ph

vector.memcheck:                                  ; preds = %.preheader56
  %31 = mul nsw i64 %.04566, 80008
  %.neg = mul i64 %.04467, -80008
  %32 = add i64 %.neg, %31
  %diff.check = icmp ult i64 %32, 32
  br i1 %diff.check, label %scalar.ph.preheader, label %vector.body

vector.body:                                      ; preds = %vector.memcheck, %vector.body
  %index = phi i64 [ %index.next, %vector.body ], [ 0, %vector.memcheck ]
  %33 = getelementptr inbounds [2 x [10001 x i64]], ptr @dp, i64 0, i64 %.04467, i64 %index
  %34 = getelementptr inbounds i8, ptr %33, i64 16
  %wide.load = load <2 x i64>, ptr %33, align 8, !tbaa !11
  %wide.load84 = load <2 x i64>, ptr %34, align 8, !tbaa !11
  %35 = getelementptr inbounds [2 x [10001 x i64]], ptr @dp, i64 0, i64 %.04566, i64 %index
  %36 = getelementptr inbounds i8, ptr %35, i64 16
  store <2 x i64> %wide.load, ptr %35, align 8, !tbaa !11
  store <2 x i64> %wide.load84, ptr %36, align 8, !tbaa !11
  %index.next = add nuw i64 %index, 4
  %37 = icmp eq i64 %index.next, %n.vec
  br i1 %37, label %middle.block, label %vector.body, !llvm.loop !19

middle.block:                                     ; preds = %vector.body
  br i1 %cmp.n, label %.preheader54.preheader, label %scalar.ph.preheader

.lr.ph:                                           ; preds = %23, %.lr.ph
  %.04158 = phi i64 [ %39, %.lr.ph ], [ %24, %23 ]
  %38 = getelementptr inbounds [10001 x i8], ptr @sv, i64 0, i64 %.04158
  store i8 1, ptr %38, align 1, !tbaa !13
  %39 = add nuw nsw i64 %.04158, %.04268
  %.not48 = icmp sgt i64 %39, %13
  br i1 %.not48, label %.preheader56, label %.lr.ph, !llvm.loop !23

scalar.ph:                                        ; preds = %scalar.ph.prol.loopexit, %scalar.ph
  %.04060 = phi i64 [ %55, %scalar.ph ], [ %.04060.unr, %scalar.ph.prol.loopexit ]
  %40 = getelementptr inbounds [2 x [10001 x i64]], ptr @dp, i64 0, i64 %.04467, i64 %.04060
  %41 = load i64, ptr %40, align 8, !tbaa !11
  %42 = getelementptr inbounds [2 x [10001 x i64]], ptr @dp, i64 0, i64 %.04566, i64 %.04060
  store i64 %41, ptr %42, align 8, !tbaa !11
  %43 = add nuw i64 %.04060, 1
  %44 = getelementptr inbounds [2 x [10001 x i64]], ptr @dp, i64 0, i64 %.04467, i64 %43
  %45 = load i64, ptr %44, align 8, !tbaa !11
  %46 = getelementptr inbounds [2 x [10001 x i64]], ptr @dp, i64 0, i64 %.04566, i64 %43
  store i64 %45, ptr %46, align 8, !tbaa !11
  %47 = add nuw i64 %.04060, 2
  %48 = getelementptr inbounds [2 x [10001 x i64]], ptr @dp, i64 0, i64 %.04467, i64 %47
  %49 = load i64, ptr %48, align 8, !tbaa !11
  %50 = getelementptr inbounds [2 x [10001 x i64]], ptr @dp, i64 0, i64 %.04566, i64 %47
  store i64 %49, ptr %50, align 8, !tbaa !11
  %51 = add nuw i64 %.04060, 3
  %52 = getelementptr inbounds [2 x [10001 x i64]], ptr @dp, i64 0, i64 %.04467, i64 %51
  %53 = load i64, ptr %52, align 8, !tbaa !11
  %54 = getelementptr inbounds [2 x [10001 x i64]], ptr @dp, i64 0, i64 %.04566, i64 %51
  store i64 %53, ptr %54, align 8, !tbaa !11
  %55 = add nuw i64 %.04060, 4
  %exitcond.not.3 = icmp eq i64 %51, %13
  br i1 %exitcond.not.3, label %.preheader54.preheader, label %scalar.ph, !llvm.loop !24

.preheader54.preheader:                           ; preds = %scalar.ph.prol.loopexit, %scalar.ph, %middle.block
  br label %.preheader54

.preheader54:                                     ; preds = %.preheader54.preheader, %58
  %.03964 = phi i64 [ %59, %58 ], [ %.04268, %.preheader54.preheader ]
  br label %60

._crit_edge:                                      ; preds = %58
  %.not51 = icmp eq i64 %.04566, 0
  %56 = zext i1 %.not51 to i64
  %.not52 = icmp eq i64 %.04467, 0
  %57 = zext i1 %.not52 to i64
  br label %70

58:                                               ; preds = %60
  %59 = mul nuw nsw i64 %.03964, %.04268
  %.not50 = icmp sgt i64 %59, %13
  br i1 %.not50, label %._crit_edge, label %.preheader54, !llvm.loop !25

60:                                               ; preds = %.preheader54, %60
  %.03862 = phi i64 [ %.03964, %.preheader54 ], [ %69, %60 ]
  %61 = getelementptr inbounds [2 x [10001 x i64]], ptr @dp, i64 0, i64 %.04566, i64 %.03862
  %62 = load i64, ptr %61, align 8, !tbaa !11
  %63 = sub nuw nsw i64 %.03862, %.03964
  %64 = getelementptr inbounds [2 x [10001 x i64]], ptr @dp, i64 0, i64 %.04467, i64 %63
  %65 = load i64, ptr %64, align 8, !tbaa !11
  %66 = mul nsw i64 %65, %.03964
  %67 = add nsw i64 %66, %62
  %68 = srem i64 %67, %14
  store i64 %68, ptr %61, align 8, !tbaa !11
  %69 = add nuw nsw i64 %.03862, 1
  %.not53.not = icmp slt i64 %.03862, %13
  br i1 %.not53.not, label %60, label %58, !llvm.loop !26

70:                                               ; preds = %.lr.ph71.split, %._crit_edge
  %.146 = phi i64 [ %.04566, %.lr.ph71.split ], [ %56, %._crit_edge ]
  %.1 = phi i64 [ %.04467, %.lr.ph71.split ], [ %57, %._crit_edge ]
  %71 = add nuw i64 %.04268, 1
  %exitcond82.not = icmp eq i64 %.04268, %13
  br i1 %exitcond82.not, label %.preheader, label %.lr.ph71.split, !llvm.loop !27

._crit_edge78.loopexit.unr-lcssa:                 ; preds = %79, %.lr.ph77
  %.lcssa.ph = phi i64 [ poison, %.lr.ph77 ], [ %88, %79 ]
  %.076.unr = phi i64 [ 0, %.lr.ph77 ], [ %89, %79 ]
  %.04375.unr = phi i64 [ 0, %.lr.ph77 ], [ %88, %79 ]
  %72 = and i64 %13, 1
  %lcmp.mod86.not.not = icmp eq i64 %72, 0
  br i1 %lcmp.mod86.not.not, label %._crit_edge78.loopexit.epilog-lcssa, label %._crit_edge78

._crit_edge78.loopexit.epilog-lcssa:              ; preds = %._crit_edge78.loopexit.unr-lcssa
  %73 = getelementptr inbounds [2 x [10001 x i64]], ptr @dp, i64 0, i64 %.044.lcssa, i64 %.076.unr
  %74 = load i64, ptr %73, align 8, !tbaa !11
  %75 = add nsw i64 %74, %.04375.unr
  %76 = srem i64 %75, %17
  br label %._crit_edge78

._crit_edge78:                                    ; preds = %._crit_edge78.loopexit.epilog-lcssa, %._crit_edge78.loopexit.unr-lcssa, %.preheader
  %.043.lcssa = phi i64 [ 0, %.preheader ], [ %.lcssa.ph, %._crit_edge78.loopexit.unr-lcssa ], [ %76, %._crit_edge78.loopexit.epilog-lcssa ]
  %77 = tail call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEx(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cout, i64 noundef %.043.lcssa)
  %78 = tail call noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc(ptr noundef nonnull align 8 dereferenceable(8) %77, ptr noundef nonnull @.str.4)
  ret i32 0

79:                                               ; preds = %79, %.lr.ph77.new
  %.076 = phi i64 [ 0, %.lr.ph77.new ], [ %89, %79 ]
  %.04375 = phi i64 [ 0, %.lr.ph77.new ], [ %88, %79 ]
  %niter = phi i64 [ 0, %.lr.ph77.new ], [ %niter.next.1, %79 ]
  %80 = getelementptr inbounds [2 x [10001 x i64]], ptr @dp, i64 0, i64 %.044.lcssa, i64 %.076
  %81 = load i64, ptr %80, align 8, !tbaa !11
  %82 = add nsw i64 %81, %.04375
  %83 = srem i64 %82, %17
  %84 = or disjoint i64 %.076, 1
  %85 = getelementptr inbounds [2 x [10001 x i64]], ptr @dp, i64 0, i64 %.044.lcssa, i64 %84
  %86 = load i64, ptr %85, align 8, !tbaa !11
  %87 = add nsw i64 %86, %83
  %88 = srem i64 %87, %17
  %89 = add nuw i64 %.076, 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_edge78.loopexit.unr-lcssa, label %79, !llvm.loop !28
}

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

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

; Function Attrs: mustprogress uwtable
declare noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERx(ptr noundef nonnull align 8 dereferenceable(16), ptr noundef nonnull align 8 dereferenceable(8)) local_unnamed_addr #3 align 2

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

; 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 #3 align 2

attributes #0 = { mustprogress norecurse uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { "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 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 = { 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" }

!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 = !{!"any pointer", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C++ TBAA"}
!9 = !{!10, !10, i64 0}
!10 = !{!"vtable pointer", !8, i64 0}
!11 = !{!12, !12, i64 0}
!12 = !{!"long long", !7, i64 0}
!13 = !{!14, !14, i64 0}
!14 = !{!"bool", !7, i64 0}
!15 = !{i8 0, i8 2}
!16 = !{}
!17 = distinct !{!17, !18}
!18 = !{!"llvm.loop.unroll.disable"}
!19 = distinct !{!19, !20, !21, !22}
!20 = !{!"llvm.loop.mustprogress"}
!21 = !{!"llvm.loop.isvectorized", i32 1}
!22 = !{!"llvm.loop.unroll.runtime.disable"}
!23 = distinct !{!23, !20}
!24 = distinct !{!24, !20, !21}
!25 = distinct !{!25, !20}
!26 = distinct !{!26, !20}
!27 = distinct !{!27, !20}
!28 = distinct !{!28, !20}


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