; LLVM IR from eyangch/competitive-programming :: USACOcontests/gold/2018.01 (spainting)

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

@dp = external dso_local global [1000000 x i64], align 16
@pfx = external dso_local global [1000000 x i64], align 16
@mpows = external dso_local global [1000001 x i64], align 16
@_ZSt3cin = external global %"class.std::basic_istream", align 8
@.str = external hidden unnamed_addr constant [13 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 [14 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 i64, align 8
  %3 = alloca i32, align 4
  %4 = alloca i32, align 4
  %5 = alloca i32, align 4
  %6 = alloca i32, align 4
  %7 = alloca i32, align 4
  %8 = alloca i64, align 8
  store i32 0, ptr %1, align 4
  %9 = call noundef zeroext i1 @_ZNSt8ios_base15sync_with_stdioEb(i1 noundef zeroext false)
  %10 = load ptr, ptr @_ZSt3cin, align 8, !tbaa !5
  %11 = getelementptr i8, ptr %10, i64 -24
  %12 = load i64, ptr %11, align 8
  %13 = getelementptr inbounds i8, ptr @_ZSt3cin, i64 %12
  %14 = call noundef ptr @_ZNSt9basic_iosIcSt11char_traitsIcEE3tieEPSo(ptr noundef nonnull align 8 dereferenceable(264) %13, ptr noundef null)
  %15 = load ptr, ptr @stdin, align 8, !tbaa !8
  %16 = call ptr @freopen(ptr noundef @.str, ptr noundef @.str.1, ptr noundef %15)
  %17 = load ptr, ptr @stdout, align 8, !tbaa !8
  %18 = call ptr @freopen(ptr noundef @.str.2, ptr noundef @.str.3, ptr noundef %17)
  call void @llvm.lifetime.start.p0(i64 8, ptr %2) #6
  store i64 1000000007, ptr %2, align 8, !tbaa !11
  call void @llvm.lifetime.start.p0(i64 4, ptr %3) #6
  call void @llvm.lifetime.start.p0(i64 4, ptr %4) #6
  call void @llvm.lifetime.start.p0(i64 4, ptr %5) #6
  %19 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERi(ptr noundef nonnull align 8 dereferenceable(16) @_ZSt3cin, ptr noundef nonnull align 4 dereferenceable(4) %3)
  %20 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERi(ptr noundef nonnull align 8 dereferenceable(16) %19, ptr noundef nonnull align 4 dereferenceable(4) %4)
  %21 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERi(ptr noundef nonnull align 8 dereferenceable(16) %20, ptr noundef nonnull align 4 dereferenceable(4) %5)
  store i64 1, ptr @dp, align 16, !tbaa !11
  %22 = load i64, ptr @dp, align 16, !tbaa !11
  store i64 %22, ptr @pfx, align 16, !tbaa !11
  store i64 1, ptr @mpows, align 16, !tbaa !11
  call void @llvm.lifetime.start.p0(i64 4, ptr %6) #6
  store i32 1, ptr %6, align 4, !tbaa !13
  br label %23

23:                                               ; preds = %45, %0
  %24 = load i32, ptr %6, align 4, !tbaa !13
  %25 = load i32, ptr %3, align 4, !tbaa !13
  %26 = icmp sle i32 %24, %25
  br i1 %26, label %28, label %27

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

28:                                               ; preds = %23
  %29 = load i32, ptr %6, align 4, !tbaa !13
  %30 = sub nsw i32 %29, 1
  %31 = sext i32 %30 to i64
  %32 = getelementptr inbounds [1000001 x i64], ptr @mpows, i64 0, i64 %31
  %33 = load i64, ptr %32, align 8, !tbaa !11
  %34 = load i32, ptr %4, align 4, !tbaa !13
  %35 = sext i32 %34 to i64
  %36 = mul nsw i64 %33, %35
  %37 = load i32, ptr %6, align 4, !tbaa !13
  %38 = sext i32 %37 to i64
  %39 = getelementptr inbounds [1000001 x i64], ptr @mpows, i64 0, i64 %38
  store i64 %36, ptr %39, align 8, !tbaa !11
  %40 = load i32, ptr %6, align 4, !tbaa !13
  %41 = sext i32 %40 to i64
  %42 = getelementptr inbounds [1000001 x i64], ptr @mpows, i64 0, i64 %41
  %43 = load i64, ptr %42, align 8, !tbaa !11
  %44 = srem i64 %43, 1000000007
  store i64 %44, ptr %42, align 8, !tbaa !11
  br label %45

45:                                               ; preds = %28
  %46 = load i32, ptr %6, align 4, !tbaa !13
  %47 = add nsw i32 %46, 1
  store i32 %47, ptr %6, align 4, !tbaa !13
  br label %23, !llvm.loop !15

48:                                               ; preds = %27
  call void @llvm.lifetime.start.p0(i64 4, ptr %7) #6
  store i32 1, ptr %7, align 4, !tbaa !13
  br label %49

49:                                               ; preds = %138, %48
  %50 = load i32, ptr %7, align 4, !tbaa !13
  %51 = load i32, ptr %3, align 4, !tbaa !13
  %52 = icmp slt i32 %50, %51
  br i1 %52, label %54, label %53

53:                                               ; preds = %49
  call void @llvm.lifetime.end.p0(i64 4, ptr %7) #6
  br label %141

54:                                               ; preds = %49
  %55 = load i32, ptr %4, align 4, !tbaa !13
  %56 = sub nsw i32 %55, 1
  %57 = sext i32 %56 to i64
  %58 = load i32, ptr %7, align 4, !tbaa !13
  %59 = sub nsw i32 %58, 1
  %60 = sext i32 %59 to i64
  %61 = getelementptr inbounds [1000000 x i64], ptr @pfx, i64 0, i64 %60
  %62 = load i64, ptr %61, align 8, !tbaa !11
  %63 = mul nsw i64 %57, %62
  %64 = load i32, ptr %7, align 4, !tbaa !13
  %65 = sext i32 %64 to i64
  %66 = getelementptr inbounds [1000000 x i64], ptr @dp, i64 0, i64 %65
  store i64 %63, ptr %66, align 8, !tbaa !11
  %67 = load i32, ptr %7, align 4, !tbaa !13
  %68 = sext i32 %67 to i64
  %69 = getelementptr inbounds [1000000 x i64], ptr @dp, i64 0, i64 %68
  %70 = load i64, ptr %69, align 8, !tbaa !11
  %71 = srem i64 %70, 1000000007
  store i64 %71, ptr %69, align 8, !tbaa !11
  %72 = load i32, ptr %7, align 4, !tbaa !13
  %73 = load i32, ptr %5, align 4, !tbaa !13
  %74 = sub nsw i32 %72, %73
  %75 = icmp sge i32 %74, 0
  br i1 %75, label %76, label %93

76:                                               ; preds = %54
  %77 = load i32, ptr %4, align 4, !tbaa !13
  %78 = sub nsw i32 %77, 1
  %79 = sext i32 %78 to i64
  %80 = load i32, ptr %7, align 4, !tbaa !13
  %81 = load i32, ptr %5, align 4, !tbaa !13
  %82 = sub nsw i32 %80, %81
  %83 = sext i32 %82 to i64
  %84 = getelementptr inbounds [1000000 x i64], ptr @pfx, i64 0, i64 %83
  %85 = load i64, ptr %84, align 8, !tbaa !11
  %86 = mul nsw i64 %79, %85
  %87 = srem i64 %86, 1000000007
  %88 = load i32, ptr %7, align 4, !tbaa !13
  %89 = sext i32 %88 to i64
  %90 = getelementptr inbounds [1000000 x i64], ptr @dp, i64 0, i64 %89
  %91 = load i64, ptr %90, align 8, !tbaa !11
  %92 = sub nsw i64 %91, %87
  store i64 %92, ptr %90, align 8, !tbaa !11
  br label %107

93:                                               ; preds = %54
  %94 = load i32, ptr %7, align 4, !tbaa !13
  %95 = load i32, ptr %5, align 4, !tbaa !13
  %96 = sub nsw i32 %94, %95
  %97 = icmp slt i32 %96, -1
  br i1 %97, label %98, label %106

98:                                               ; preds = %93
  %99 = load i32, ptr %7, align 4, !tbaa !13
  %100 = sext i32 %99 to i64
  %101 = getelementptr inbounds [1000001 x i64], ptr @mpows, i64 0, i64 %100
  %102 = load i64, ptr %101, align 8, !tbaa !11
  %103 = load i32, ptr %7, align 4, !tbaa !13
  %104 = sext i32 %103 to i64
  %105 = getelementptr inbounds [1000000 x i64], ptr @dp, i64 0, i64 %104
  store i64 %102, ptr %105, align 8, !tbaa !11
  br label %106

106:                                              ; preds = %98, %93
  br label %107

107:                                              ; preds = %106, %76
  %108 = load i32, ptr %7, align 4, !tbaa !13
  %109 = sext i32 %108 to i64
  %110 = getelementptr inbounds [1000000 x i64], ptr @dp, i64 0, i64 %109
  %111 = load i64, ptr %110, align 8, !tbaa !11
  %112 = icmp slt i64 %111, 0
  br i1 %112, label %113, label %119

113:                                              ; preds = %107
  %114 = load i32, ptr %7, align 4, !tbaa !13
  %115 = sext i32 %114 to i64
  %116 = getelementptr inbounds [1000000 x i64], ptr @dp, i64 0, i64 %115
  %117 = load i64, ptr %116, align 8, !tbaa !11
  %118 = add nsw i64 %117, 1000000007
  store i64 %118, ptr %116, align 8, !tbaa !11
  br label %119

119:                                              ; preds = %113, %107
  %120 = load i32, ptr %7, align 4, !tbaa !13
  %121 = sub nsw i32 %120, 1
  %122 = sext i32 %121 to i64
  %123 = getelementptr inbounds [1000000 x i64], ptr @pfx, i64 0, i64 %122
  %124 = load i64, ptr %123, align 8, !tbaa !11
  %125 = load i32, ptr %7, align 4, !tbaa !13
  %126 = sext i32 %125 to i64
  %127 = getelementptr inbounds [1000000 x i64], ptr @dp, i64 0, i64 %126
  %128 = load i64, ptr %127, align 8, !tbaa !11
  %129 = add nsw i64 %124, %128
  %130 = load i32, ptr %7, align 4, !tbaa !13
  %131 = sext i32 %130 to i64
  %132 = getelementptr inbounds [1000000 x i64], ptr @pfx, i64 0, i64 %131
  store i64 %129, ptr %132, align 8, !tbaa !11
  %133 = load i32, ptr %7, align 4, !tbaa !13
  %134 = sext i32 %133 to i64
  %135 = getelementptr inbounds [1000000 x i64], ptr @pfx, i64 0, i64 %134
  %136 = load i64, ptr %135, align 8, !tbaa !11
  %137 = srem i64 %136, 1000000007
  store i64 %137, ptr %135, align 8, !tbaa !11
  br label %138

138:                                              ; preds = %119
  %139 = load i32, ptr %7, align 4, !tbaa !13
  %140 = add nsw i32 %139, 1
  store i32 %140, ptr %7, align 4, !tbaa !13
  br label %49, !llvm.loop !17

141:                                              ; preds = %53
  call void @llvm.lifetime.start.p0(i64 8, ptr %8) #6
  %142 = load i32, ptr %3, align 4, !tbaa !13
  %143 = sext i32 %142 to i64
  %144 = getelementptr inbounds [1000001 x i64], ptr @mpows, i64 0, i64 %143
  %145 = load i64, ptr %144, align 8, !tbaa !11
  %146 = load i32, ptr %4, align 4, !tbaa !13
  %147 = sext i32 %146 to i64
  %148 = load i32, ptr %3, align 4, !tbaa !13
  %149 = sub nsw i32 %148, 1
  %150 = sext i32 %149 to i64
  %151 = getelementptr inbounds [1000000 x i64], ptr @dp, i64 0, i64 %150
  %152 = load i64, ptr %151, align 8, !tbaa !11
  %153 = mul nsw i64 %147, %152
  %154 = sub nsw i64 %145, %153
  %155 = srem i64 %154, 1000000007
  store i64 %155, ptr %8, align 8, !tbaa !11
  br label %156

156:                                              ; preds = %159, %141
  %157 = load i64, ptr %8, align 8, !tbaa !11
  %158 = icmp slt i64 %157, 0
  br i1 %158, label %159, label %162

159:                                              ; preds = %156
  %160 = load i64, ptr %8, align 8, !tbaa !11
  %161 = add nsw i64 %160, 1000000007
  store i64 %161, ptr %8, align 8, !tbaa !11
  br label %156, !llvm.loop !18

162:                                              ; preds = %156
  %163 = load i64, ptr %8, align 8, !tbaa !11
  %164 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEx(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cout, i64 noundef %163)
  %165 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEPFRSoS_E(ptr noundef nonnull align 8 dereferenceable(8) %164, ptr noundef @_ZSt4endlIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_)
  call void @llvm.lifetime.end.p0(i64 8, ptr %8) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr %5) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr %4) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr %3) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr %2) #6
  ret i32 0
}

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: nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #3

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

; Function Attrs: mustprogress uwtable
declare noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEPFRSoS_E(ptr noundef nonnull align 8 dereferenceable(8), ptr noundef) #4 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)) #5

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 = { 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 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 = !{!"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 = !{!"long long", !10, i64 0}
!13 = !{!14, !14, i64 0}
!14 = !{!"int", !10, i64 0}
!15 = distinct !{!15, !16}
!16 = !{!"llvm.loop.mustprogress"}
!17 = distinct !{!17, !16}
!18 = distinct !{!18, !16}


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

@dp = external dso_local local_unnamed_addr global [1000000 x i64], align 16
@pfx = external dso_local local_unnamed_addr global [1000000 x i64], align 16
@mpows = external dso_local local_unnamed_addr global [1000001 x i64], align 16
@_ZSt3cin = external global %"class.std::basic_istream", align 8
@.str = external hidden unnamed_addr constant [13 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 [14 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 i32, align 4
  %3 = alloca i32, align 4
  %4 = tail call noundef zeroext i1 @_ZNSt8ios_base15sync_with_stdioEb(i1 noundef zeroext false)
  %5 = load ptr, ptr @_ZSt3cin, align 8, !tbaa !5
  %6 = getelementptr i8, ptr %5, i64 -24
  %7 = load i64, ptr %6, align 8
  %8 = getelementptr inbounds i8, ptr @_ZSt3cin, i64 %7
  %9 = tail call noundef ptr @_ZNSt9basic_iosIcSt11char_traitsIcEE3tieEPSo(ptr noundef nonnull align 8 dereferenceable(264) %8, ptr noundef null)
  %10 = load ptr, ptr @stdin, align 8, !tbaa !8
  %11 = tail call ptr @freopen(ptr noundef nonnull @.str, ptr noundef nonnull @.str.1, ptr noundef %10)
  %12 = load ptr, ptr @stdout, align 8, !tbaa !8
  %13 = tail call ptr @freopen(ptr noundef nonnull @.str.2, ptr noundef nonnull @.str.3, ptr noundef %12)
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %1) #7
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %2) #7
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %3) #7
  %14 = 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)
  %15 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERi(ptr noundef nonnull align 8 dereferenceable(16) %14, ptr noundef nonnull align 4 dereferenceable(4) %2)
  %16 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERi(ptr noundef nonnull align 8 dereferenceable(16) %15, ptr noundef nonnull align 4 dereferenceable(4) %3)
  store i64 1, ptr @dp, align 16, !tbaa !11
  store i64 1, ptr @pfx, align 16, !tbaa !11
  store i64 1, ptr @mpows, align 16, !tbaa !11
  %17 = load i32, ptr %1, align 4, !tbaa !13
  %.not31 = icmp slt i32 %17, 1
  %.pre.pre = load i32, ptr %2, align 4, !tbaa !13
  br i1 %.not31, label %._crit_edge, label %.lr.ph

.lr.ph:                                           ; preds = %0
  %18 = sext i32 %.pre.pre to i64
  %19 = zext nneg i32 %17 to i64
  %xtraiter = and i64 %19, 1
  %20 = icmp eq i32 %17, 1
  br i1 %20, label %.preheader.unr-lcssa, label %.lr.ph.new

.lr.ph.new:                                       ; preds = %.lr.ph
  %unroll_iter = and i64 %19, 2147483646
  br label %28

.preheader.unr-lcssa:                             ; preds = %28, %.lr.ph
  %.unr = phi i64 [ 1, %.lr.ph ], [ %35, %28 ]
  %indvars.iv.unr = phi i64 [ 1, %.lr.ph ], [ %indvars.iv.next.1, %28 ]
  %lcmp.mod.not = icmp eq i64 %xtraiter, 0
  br i1 %lcmp.mod.not, label %.preheader, label %.preheader.epilog-lcssa

.preheader.epilog-lcssa:                          ; preds = %.preheader.unr-lcssa
  %21 = mul nsw i64 %.unr, %18
  %22 = getelementptr inbounds [1000001 x i64], ptr @mpows, i64 0, i64 %indvars.iv.unr
  %23 = srem i64 %21, 1000000007
  store i64 %23, ptr %22, align 8, !tbaa !11
  br label %.preheader

.preheader:                                       ; preds = %.preheader.unr-lcssa, %.preheader.epilog-lcssa
  %.not = icmp eq i32 %17, 1
  br i1 %.not, label %._crit_edge, label %.lr.ph34

.lr.ph34:                                         ; preds = %.preheader
  %24 = add nsw i32 %.pre.pre, -1
  %25 = sext i32 %24 to i64
  %26 = load i32, ptr %3, align 4, !tbaa !13
  %27 = sext i32 %26 to i64
  %wide.trip.count39 = zext nneg i32 %17 to i64
  br label %55

28:                                               ; preds = %28, %.lr.ph.new
  %29 = phi i64 [ 1, %.lr.ph.new ], [ %35, %28 ]
  %indvars.iv = phi i64 [ 1, %.lr.ph.new ], [ %indvars.iv.next.1, %28 ]
  %niter = phi i64 [ 0, %.lr.ph.new ], [ %niter.next.1, %28 ]
  %30 = mul nsw i64 %29, %18
  %31 = getelementptr inbounds [1000001 x i64], ptr @mpows, i64 0, i64 %indvars.iv
  %32 = srem i64 %30, 1000000007
  store i64 %32, ptr %31, align 8, !tbaa !11
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  %33 = mul nsw i64 %32, %18
  %34 = getelementptr inbounds [1000001 x i64], ptr @mpows, i64 0, i64 %indvars.iv.next
  %35 = srem i64 %33, 1000000007
  store i64 %35, ptr %34, align 8, !tbaa !11
  %indvars.iv.next.1 = add nuw nsw i64 %indvars.iv, 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 %.preheader.unr-lcssa, label %28, !llvm.loop !15

._crit_edge:                                      ; preds = %76, %0, %.preheader
  %36 = sext i32 %17 to i64
  %37 = getelementptr inbounds [1000001 x i64], ptr @mpows, i64 0, i64 %36
  %38 = load i64, ptr %37, align 8, !tbaa !11
  %39 = sext i32 %.pre.pre to i64
  %40 = add nsw i32 %17, -1
  %41 = sext i32 %40 to i64
  %42 = getelementptr inbounds [1000000 x i64], ptr @dp, i64 0, i64 %41
  %43 = load i64, ptr %42, align 8, !tbaa !11
  %44 = mul nsw i64 %43, %39
  %45 = sub nsw i64 %38, %44
  %46 = srem i64 %45, 1000000007
  %smax = call i64 @llvm.smax.i64(i64 %46, i64 0)
  %.lobit = lshr i64 %46, 63
  %47 = add nsw i64 %46, %.lobit
  %48 = sub nsw i64 %smax, %47
  %49 = udiv i64 %48, 1000000007
  %50 = add nuw nsw i64 %.lobit, %49
  %51 = mul i64 %50, 1000000007
  %52 = add i64 %46, %51
  %53 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEx(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cout, i64 noundef %52)
  %54 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEPFRSoS_E(ptr noundef nonnull align 8 dereferenceable(8) %53, ptr noundef nonnull @_ZSt4endlIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_)
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %3) #7
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %2) #7
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %1) #7
  ret i32 0

55:                                               ; preds = %.lr.ph34, %76
  %56 = phi i64 [ 1, %.lr.ph34 ], [ %80, %76 ]
  %indvars.iv36 = phi i64 [ 1, %.lr.ph34 ], [ %indvars.iv.next37, %76 ]
  %57 = mul nsw i64 %56, %25
  %58 = getelementptr inbounds [1000000 x i64], ptr @dp, i64 0, i64 %indvars.iv36
  %59 = srem i64 %57, 1000000007
  store i64 %59, ptr %58, align 8, !tbaa !11
  %60 = sub nsw i64 %indvars.iv36, %27
  %61 = icmp sgt i64 %60, -1
  br i1 %61, label %62, label %68

62:                                               ; preds = %55
  %63 = getelementptr inbounds [1000000 x i64], ptr @pfx, i64 0, i64 %60
  %64 = load i64, ptr %63, align 8, !tbaa !11
  %65 = mul nsw i64 %64, %25
  %66 = srem i64 %65, 1000000007
  %67 = sub nsw i64 %59, %66
  br label %thread-pre-split.sink.split

68:                                               ; preds = %55
  %.not30 = icmp eq i64 %60, -1
  br i1 %.not30, label %thread-pre-split, label %69

69:                                               ; preds = %68
  %70 = getelementptr inbounds [1000001 x i64], ptr @mpows, i64 0, i64 %indvars.iv36
  %71 = load i64, ptr %70, align 8, !tbaa !11
  br label %thread-pre-split.sink.split

thread-pre-split.sink.split:                      ; preds = %62, %69
  %.sink = phi i64 [ %71, %69 ], [ %67, %62 ]
  store i64 %.sink, ptr %58, align 8, !tbaa !11
  br label %thread-pre-split

thread-pre-split:                                 ; preds = %thread-pre-split.sink.split, %68
  %72 = phi i64 [ %59, %68 ], [ %.sink, %thread-pre-split.sink.split ]
  %73 = icmp slt i64 %72, 0
  br i1 %73, label %74, label %76

74:                                               ; preds = %thread-pre-split
  %75 = add nsw i64 %72, 1000000007
  store i64 %75, ptr %58, align 8, !tbaa !11
  br label %76

76:                                               ; preds = %74, %thread-pre-split
  %77 = phi i64 [ %75, %74 ], [ %72, %thread-pre-split ]
  %78 = add nsw i64 %77, %56
  %79 = getelementptr inbounds [1000000 x i64], ptr @pfx, i64 0, i64 %indvars.iv36
  %80 = srem i64 %78, 1000000007
  store i64 %80, ptr %79, align 8, !tbaa !11
  %indvars.iv.next37 = add nuw nsw i64 %indvars.iv36, 1
  %exitcond40.not = icmp eq i64 %indvars.iv.next37, %wide.trip.count39
  br i1 %exitcond40.not, label %._crit_edge, label %55, !llvm.loop !17
}

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: mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite)
declare void @llvm.lifetime.end.p0(i64 immarg, ptr nocapture) #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 #4 align 2

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

; Function Attrs: nocallback nofree nosync nounwind speculatable willreturn memory(none)
declare i64 @llvm.smax.i64(i64, i64) #6

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

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

!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"clang version 19.1.0 (git@github.com:llvm/llvm-project.git a4bf6cd7cfb1a1421ba92bca9d017b49936c55e4)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"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 = !{!"long long", !10, i64 0}
!13 = !{!14, !14, i64 0}
!14 = !{!"int", !10, i64 0}
!15 = distinct !{!15, !16}
!16 = !{!"llvm.loop.mustprogress"}
!17 = distinct !{!17, !16}


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