; LLVM IR from kazunetakahashi/atcoder :: 2019/0330_exawizards2019 (D)

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

@inv = external dso_local global [1000010 x i64], align 16
@fact = external dso_local global [1000010 x i64], align 16
@N = external dso_local global i32, align 4
@X = external dso_local global i64, align 8
@S = external dso_local global [210 x i64], align 16
@DP = external dso_local global [100010 x i64], align 16
@_ZSt3cin = external global %"class.std::basic_istream", align 8
@_ZSt4cerr = external global %"class.std::basic_ostream", align 8
@.str = external hidden unnamed_addr constant [3 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [5 x i8], align 1
@_ZSt4cout = external global %"class.std::basic_ostream", align 8

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_Z4initv() #0

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

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

; Function Attrs: mustprogress norecurse uwtable
define dso_local noundef i32 @main() #2 {
  %1 = alloca i32, align 4
  %2 = alloca i32, align 4
  %3 = alloca i32, align 4
  %4 = alloca i32, align 4
  %5 = alloca i64, align 8
  %6 = alloca i32, align 4
  %7 = alloca i32, align 4
  %8 = alloca i64, align 8
  %9 = alloca i64, align 8
  store i32 0, ptr %1, align 4
  call void @_Z4initv()
  %10 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERi(ptr noundef nonnull align 8 dereferenceable(16) @_ZSt3cin, ptr noundef nonnull align 4 dereferenceable(4) @N)
  %11 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERx(ptr noundef nonnull align 8 dereferenceable(16) %10, ptr noundef nonnull align 8 dereferenceable(8) @X)
  call void @llvm.lifetime.start.p0(i64 4, ptr %2) #6
  store i32 0, ptr %2, align 4, !tbaa !5
  br label %12

12:                                               ; preds = %22, %0
  %13 = load i32, ptr %2, align 4, !tbaa !5
  %14 = load i32, ptr @N, align 4, !tbaa !5
  %15 = icmp slt i32 %13, %14
  br i1 %15, label %17, label %16

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

17:                                               ; preds = %12
  %18 = load i32, ptr %2, align 4, !tbaa !5
  %19 = sext i32 %18 to i64
  %20 = getelementptr inbounds [210 x i64], ptr @S, i64 0, i64 %19
  %21 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERx(ptr noundef nonnull align 8 dereferenceable(16) @_ZSt3cin, ptr noundef nonnull align 8 dereferenceable(8) %20)
  br label %22

22:                                               ; preds = %17
  %23 = load i32, ptr %2, align 4, !tbaa !5
  %24 = add nsw i32 %23, 1
  store i32 %24, ptr %2, align 4, !tbaa !5
  br label %12, !llvm.loop !9

25:                                               ; preds = %16
  %26 = load i32, ptr @N, align 4, !tbaa !5
  %27 = sext i32 %26 to i64
  %28 = getelementptr inbounds i64, ptr @S, i64 %27
  call void @_ZSt4sortIPxEvT_S1_(ptr noundef @S, ptr noundef %28)
  call void @llvm.lifetime.start.p0(i64 4, ptr %3) #6
  store i32 0, ptr %3, align 4, !tbaa !5
  call void @_ZSt4fillIPxiEvT_S1_RKT0_(ptr noundef @DP, ptr noundef getelementptr inbounds (i64, ptr @DP, i64 100010), ptr noundef nonnull align 4 dereferenceable(4) %3)
  call void @llvm.lifetime.end.p0(i64 4, ptr %3) #6
  call void @llvm.lifetime.start.p0(i64 4, ptr %4) #6
  %29 = load i32, ptr @N, align 4, !tbaa !5
  store i32 %29, ptr %4, align 4, !tbaa !5
  %30 = load i64, ptr @X, align 8, !tbaa !11
  %31 = getelementptr inbounds [100010 x i64], ptr @DP, i64 0, i64 %30
  store i64 1, ptr %31, align 8, !tbaa !11
  call void @llvm.lifetime.start.p0(i64 8, ptr %5) #6
  %32 = load i64, ptr @X, align 8, !tbaa !11
  store i64 %32, ptr %5, align 8, !tbaa !11
  br label %33

33:                                               ; preds = %112, %25
  %34 = load i64, ptr %5, align 8, !tbaa !11
  %35 = icmp sge i64 %34, 0
  br i1 %35, label %37, label %36

36:                                               ; preds = %33
  store i32 5, ptr %6, align 4
  br label %115

37:                                               ; preds = %33
  %38 = load i64, ptr %5, align 8, !tbaa !11
  %39 = icmp slt i64 %38, 100
  br i1 %39, label %40, label %56

40:                                               ; preds = %37
  %41 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cerr, ptr noundef @.str)
  %42 = load i64, ptr %5, align 8, !tbaa !11
  %43 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEx(ptr noundef nonnull align 8 dereferenceable(8) %41, i64 noundef %42)
  %44 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc(ptr noundef nonnull align 8 dereferenceable(8) %43, ptr noundef @.str.1)
  %45 = load i64, ptr %5, align 8, !tbaa !11
  %46 = getelementptr inbounds [100010 x i64], ptr @DP, i64 0, i64 %45
  %47 = load i64, ptr %46, align 8, !tbaa !11
  %48 = load i32, ptr @N, align 4, !tbaa !5
  %49 = sext i32 %48 to i64
  %50 = getelementptr inbounds [1000010 x i64], ptr @fact, i64 0, i64 %49
  %51 = load i64, ptr %50, align 8, !tbaa !11
  %52 = mul nsw i64 %47, %51
  %53 = srem i64 %52, 1000000007
  %54 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEx(ptr noundef nonnull align 8 dereferenceable(8) %44, i64 noundef %53)
  %55 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEPFRSoS_E(ptr noundef nonnull align 8 dereferenceable(8) %54, ptr noundef @_ZSt4endlIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_)
  br label %56

56:                                               ; preds = %40, %37
  br label %57

57:                                               ; preds = %65, %56
  %58 = load i32, ptr %4, align 4, !tbaa !5
  %59 = sub nsw i32 %58, 1
  %60 = sext i32 %59 to i64
  %61 = getelementptr inbounds [210 x i64], ptr @S, i64 0, i64 %60
  %62 = load i64, ptr %61, align 8, !tbaa !11
  %63 = load i64, ptr %5, align 8, !tbaa !11
  %64 = icmp sgt i64 %62, %63
  br i1 %64, label %65, label %68

65:                                               ; preds = %57
  %66 = load i32, ptr %4, align 4, !tbaa !5
  %67 = add nsw i32 %66, -1
  store i32 %67, ptr %4, align 4, !tbaa !5
  br label %57, !llvm.loop !13

68:                                               ; preds = %57
  %69 = load i32, ptr %4, align 4, !tbaa !5
  %70 = icmp eq i32 %69, 0
  br i1 %70, label %71, label %72

71:                                               ; preds = %68
  store i32 5, ptr %6, align 4
  br label %115

72:                                               ; preds = %68
  call void @llvm.lifetime.start.p0(i64 4, ptr %7) #6
  store i32 0, ptr %7, align 4, !tbaa !5
  br label %73

73:                                               ; preds = %106, %72
  %74 = load i32, ptr %7, align 4, !tbaa !5
  %75 = load i32, ptr %4, align 4, !tbaa !5
  %76 = icmp slt i32 %74, %75
  br i1 %76, label %78, label %77

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

78:                                               ; preds = %73
  %79 = load i64, ptr %5, align 8, !tbaa !11
  %80 = getelementptr inbounds [100010 x i64], ptr @DP, i64 0, i64 %79
  %81 = load i64, ptr %80, align 8, !tbaa !11
  %82 = load i32, ptr %4, align 4, !tbaa !5
  %83 = sext i32 %82 to i64
  %84 = getelementptr inbounds [1000010 x i64], ptr @inv, i64 0, i64 %83
  %85 = load i64, ptr %84, align 8, !tbaa !11
  %86 = mul nsw i64 %81, %85
  %87 = srem i64 %86, 1000000007
  %88 = load i64, ptr %5, align 8, !tbaa !11
  %89 = load i32, ptr %7, align 4, !tbaa !5
  %90 = sext i32 %89 to i64
  %91 = getelementptr inbounds [210 x i64], ptr @S, i64 0, i64 %90
  %92 = load i64, ptr %91, align 8, !tbaa !11
  %93 = srem i64 %88, %92
  %94 = getelementptr inbounds [100010 x i64], ptr @DP, i64 0, i64 %93
  %95 = load i64, ptr %94, align 8, !tbaa !11
  %96 = add nsw i64 %95, %87
  store i64 %96, ptr %94, align 8, !tbaa !11
  %97 = load i64, ptr %5, align 8, !tbaa !11
  %98 = load i32, ptr %7, align 4, !tbaa !5
  %99 = sext i32 %98 to i64
  %100 = getelementptr inbounds [210 x i64], ptr @S, i64 0, i64 %99
  %101 = load i64, ptr %100, align 8, !tbaa !11
  %102 = srem i64 %97, %101
  %103 = getelementptr inbounds [100010 x i64], ptr @DP, i64 0, i64 %102
  %104 = load i64, ptr %103, align 8, !tbaa !11
  %105 = srem i64 %104, 1000000007
  store i64 %105, ptr %103, align 8, !tbaa !11
  br label %106

106:                                              ; preds = %78
  %107 = load i32, ptr %7, align 4, !tbaa !5
  %108 = add nsw i32 %107, 1
  store i32 %108, ptr %7, align 4, !tbaa !5
  br label %73, !llvm.loop !14

109:                                              ; preds = %77
  %110 = load i64, ptr %5, align 8, !tbaa !11
  %111 = getelementptr inbounds [100010 x i64], ptr @DP, i64 0, i64 %110
  store i64 0, ptr %111, align 8, !tbaa !11
  br label %112

112:                                              ; preds = %109
  %113 = load i64, ptr %5, align 8, !tbaa !11
  %114 = add nsw i64 %113, -1
  store i64 %114, ptr %5, align 8, !tbaa !11
  br label %33, !llvm.loop !15

115:                                              ; preds = %71, %36
  call void @llvm.lifetime.end.p0(i64 8, ptr %5) #6
  br label %116

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

117:                                              ; preds = %133, %116
  %118 = load i64, ptr %9, align 8, !tbaa !11
  %119 = load i64, ptr @X, align 8, !tbaa !11
  %120 = icmp sle i64 %118, %119
  br i1 %120, label %122, label %121

121:                                              ; preds = %117
  store i32 13, ptr %6, align 4
  call void @llvm.lifetime.end.p0(i64 8, ptr %9) #6
  br label %136

122:                                              ; preds = %117
  %123 = load i64, ptr %9, align 8, !tbaa !11
  %124 = load i64, ptr %9, align 8, !tbaa !11
  %125 = getelementptr inbounds [100010 x i64], ptr @DP, i64 0, i64 %124
  %126 = load i64, ptr %125, align 8, !tbaa !11
  %127 = mul nsw i64 %123, %126
  %128 = srem i64 %127, 1000000007
  %129 = load i64, ptr %8, align 8, !tbaa !11
  %130 = add nsw i64 %129, %128
  store i64 %130, ptr %8, align 8, !tbaa !11
  %131 = load i64, ptr %8, align 8, !tbaa !11
  %132 = srem i64 %131, 1000000007
  store i64 %132, ptr %8, align 8, !tbaa !11
  br label %133

133:                                              ; preds = %122
  %134 = load i64, ptr %9, align 8, !tbaa !11
  %135 = add nsw i64 %134, 1
  store i64 %135, ptr %9, align 8, !tbaa !11
  br label %117, !llvm.loop !16

136:                                              ; preds = %121
  %137 = load i32, ptr @N, align 4, !tbaa !5
  %138 = sext i32 %137 to i64
  %139 = getelementptr inbounds [1000010 x i64], ptr @fact, i64 0, i64 %138
  %140 = load i64, ptr %139, align 8, !tbaa !11
  %141 = load i64, ptr %8, align 8, !tbaa !11
  %142 = mul nsw i64 %141, %140
  store i64 %142, ptr %8, align 8, !tbaa !11
  %143 = load i64, ptr %8, align 8, !tbaa !11
  %144 = srem i64 %143, 1000000007
  store i64 %144, ptr %8, align 8, !tbaa !11
  %145 = load i64, ptr %8, 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 @_ZNSolsEPFRSoS_E(ptr noundef nonnull align 8 dereferenceable(8) %146, 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 %4) #6
  %148 = load i32, ptr %1, align 4
  ret i32 %148
}

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

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

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local void @_ZSt4sortIPxEvT_S1_(ptr noundef, ptr noundef) #5

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

; 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) #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 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 #1 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { 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 #3 = { "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { mustprogress 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 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C++ TBAA"}
!9 = distinct !{!9, !10}
!10 = !{!"llvm.loop.mustprogress"}
!11 = !{!12, !12, i64 0}
!12 = !{!"long long", !7, i64 0}
!13 = distinct !{!13, !10}
!14 = distinct !{!14, !10}
!15 = distinct !{!15, !10}
!16 = distinct !{!16, !10}


; Optimized IR (opt -passes='default<O3>'):
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-i128:128-f80:128-n8:16:32:64-S128"
target triple = "x86_64-unknown-linux-gnu"

%"class.std::basic_istream" = type { ptr, i64, %"class.std::basic_ios" }
%"class.std::basic_ios" = type { %"class.std::ios_base", ptr, i8, i8, ptr, ptr, ptr, ptr }
%"class.std::ios_base" = type { ptr, i64, i64, i32, i32, i32, ptr, %"struct.std::ios_base::_Words", [8 x %"struct.std::ios_base::_Words"], i32, ptr, %"class.std::locale" }
%"struct.std::ios_base::_Words" = type { ptr, i64 }
%"class.std::locale" = type { ptr }
%"class.std::basic_ostream" = type { ptr, %"class.std::basic_ios" }

@inv = external dso_local local_unnamed_addr global [1000010 x i64], align 16
@fact = external dso_local local_unnamed_addr global [1000010 x i64], align 16
@N = external dso_local global i32, align 4
@X = external dso_local global i64, align 8
@S = external dso_local global [210 x i64], align 16
@DP = external dso_local global [100010 x i64], align 16
@_ZSt3cin = external global %"class.std::basic_istream", align 8
@_ZSt4cerr = external global %"class.std::basic_ostream", align 8
@.str = external hidden unnamed_addr constant [3 x i8], align 1
@.str.1 = external hidden unnamed_addr constant [5 x i8], align 1
@_ZSt4cout = external global %"class.std::basic_ostream", align 8

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_Z4initv() local_unnamed_addr #0

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

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

; Function Attrs: mustprogress norecurse uwtable
define dso_local noundef i32 @main() local_unnamed_addr #2 {
  %1 = alloca i32, align 4
  tail call void @_Z4initv()
  %2 = tail call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERi(ptr noundef nonnull align 8 dereferenceable(16) @_ZSt3cin, ptr noundef nonnull align 4 dereferenceable(4) @N)
  %3 = tail call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERx(ptr noundef nonnull align 8 dereferenceable(16) %2, ptr noundef nonnull align 8 dereferenceable(8) @X)
  %4 = load i32, ptr @N, align 4, !tbaa !5
  %5 = icmp sgt i32 %4, 0
  br i1 %5, label %.lr.ph, label %.._crit_edge_crit_edge

.._crit_edge_crit_edge:                           ; preds = %0
  %.pre67 = sext i32 %4 to i64
  br label %._crit_edge

._crit_edge:                                      ; preds = %.lr.ph, %.._crit_edge_crit_edge
  %.pre-phi = phi i64 [ %.pre67, %.._crit_edge_crit_edge ], [ %14, %.lr.ph ]
  %6 = getelementptr inbounds i64, ptr @S, i64 %.pre-phi
  tail call void @_ZSt4sortIPxEvT_S1_(ptr noundef nonnull @S, ptr noundef nonnull %6)
  call void @llvm.lifetime.start.p0(i64 4, ptr nonnull %1) #6
  store i32 0, ptr %1, align 4, !tbaa !5
  call void @_ZSt4fillIPxiEvT_S1_RKT0_(ptr noundef nonnull @DP, ptr noundef nonnull getelementptr inbounds (i8, ptr @DP, i64 800080), ptr noundef nonnull align 4 dereferenceable(4) %1)
  call void @llvm.lifetime.end.p0(i64 4, ptr nonnull %1) #6
  %7 = load i32, ptr @N, align 4, !tbaa !5
  %8 = load i64, ptr @X, align 8, !tbaa !9
  %9 = getelementptr inbounds [100010 x i64], ptr @DP, i64 0, i64 %8
  store i64 1, ptr %9, align 8, !tbaa !9
  %10 = icmp sgt i64 %8, -1
  br i1 %10, label %.lr.ph45, label %._crit_edge53

.lr.ph:                                           ; preds = %0, %.lr.ph
  %indvars.iv = phi i64 [ %indvars.iv.next, %.lr.ph ], [ 0, %0 ]
  %11 = getelementptr inbounds [210 x i64], ptr @S, i64 0, i64 %indvars.iv
  %12 = 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) %11)
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  %13 = load i32, ptr @N, align 4, !tbaa !5
  %14 = sext i32 %13 to i64
  %15 = icmp slt i64 %indvars.iv.next, %14
  br i1 %15, label %.lr.ph, label %._crit_edge, !llvm.loop !11

.lr.ph45:                                         ; preds = %._crit_edge, %._crit_edge41
  %.03443 = phi i64 [ %46, %._crit_edge41 ], [ %8, %._crit_edge ]
  %.03542 = phi i32 [ %38, %._crit_edge41 ], [ %7, %._crit_edge ]
  %16 = icmp ult i64 %.03443, 100
  br i1 %16, label %17, label %31

17:                                               ; preds = %.lr.ph45
  %18 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cerr, ptr noundef nonnull @.str)
  %19 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEx(ptr noundef nonnull align 8 dereferenceable(8) %18, i64 noundef %.03443)
  %20 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc(ptr noundef nonnull align 8 dereferenceable(8) %19, ptr noundef nonnull @.str.1)
  %21 = getelementptr inbounds [100010 x i64], ptr @DP, i64 0, i64 %.03443
  %22 = load i64, ptr %21, align 8, !tbaa !9
  %23 = load i32, ptr @N, align 4, !tbaa !5
  %24 = sext i32 %23 to i64
  %25 = getelementptr inbounds [1000010 x i64], ptr @fact, i64 0, i64 %24
  %26 = load i64, ptr %25, align 8, !tbaa !9
  %27 = mul nsw i64 %26, %22
  %28 = srem i64 %27, 1000000007
  %29 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEx(ptr noundef nonnull align 8 dereferenceable(8) %20, i64 noundef %28)
  %30 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEPFRSoS_E(ptr noundef nonnull align 8 dereferenceable(8) %29, ptr noundef nonnull @_ZSt4endlIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_)
  br label %31

31:                                               ; preds = %17, %.lr.ph45
  %32 = sext i32 %.03542 to i64
  br label %33

33:                                               ; preds = %33, %31
  %indvars.iv64 = phi i32 [ %indvars.iv.next65, %33 ], [ %.03542, %31 ]
  %indvars.iv58 = phi i64 [ %indvars.iv.next59, %33 ], [ %32, %31 ]
  %indvars.iv.next59 = add nsw i64 %indvars.iv58, -1
  %34 = getelementptr inbounds [210 x i64], ptr @S, i64 0, i64 %indvars.iv.next59
  %35 = load i64, ptr %34, align 8, !tbaa !9
  %36 = icmp sgt i64 %35, %.03443
  %indvars.iv.next65 = add i32 %indvars.iv64, -1
  br i1 %36, label %33, label %37, !llvm.loop !13

37:                                               ; preds = %33
  %38 = trunc nsw i64 %indvars.iv58 to i32
  %39 = icmp eq i64 %indvars.iv58, 0
  br i1 %39, label %._crit_edge46, label %.preheader

.preheader:                                       ; preds = %37
  %40 = icmp sgt i64 %indvars.iv58, 0
  br i1 %40, label %.lr.ph40, label %._crit_edge41

.lr.ph40:                                         ; preds = %.preheader
  %41 = getelementptr inbounds [100010 x i64], ptr @DP, i64 0, i64 %.03443
  %42 = and i64 %indvars.iv58, 4294967295
  %43 = getelementptr inbounds [1000010 x i64], ptr @inv, i64 0, i64 %42
  %44 = load i64, ptr %43, align 8, !tbaa !9
  %wide.trip.count = zext i32 %indvars.iv64 to i64
  br label %48

._crit_edge41:                                    ; preds = %48, %.preheader
  %45 = getelementptr inbounds [100010 x i64], ptr @DP, i64 0, i64 %.03443
  store i64 0, ptr %45, align 8, !tbaa !9
  %46 = add nsw i64 %.03443, -1
  %47 = icmp sgt i64 %.03443, 0
  br i1 %47, label %.lr.ph45, label %._crit_edge46, !llvm.loop !14

48:                                               ; preds = %.lr.ph40, %48
  %indvars.iv61 = phi i64 [ 0, %.lr.ph40 ], [ %indvars.iv.next62, %48 ]
  %49 = load i64, ptr %41, align 8, !tbaa !9
  %50 = mul nsw i64 %44, %49
  %51 = srem i64 %50, 1000000007
  %52 = getelementptr inbounds [210 x i64], ptr @S, i64 0, i64 %indvars.iv61
  %53 = load i64, ptr %52, align 8, !tbaa !9
  %54 = srem i64 %.03443, %53
  %55 = getelementptr inbounds [100010 x i64], ptr @DP, i64 0, i64 %54
  %56 = load i64, ptr %55, align 8, !tbaa !9
  %57 = add nsw i64 %56, %51
  %58 = srem i64 %57, 1000000007
  store i64 %58, ptr %55, align 8, !tbaa !9
  %indvars.iv.next62 = add nuw nsw i64 %indvars.iv61, 1
  %exitcond.not = icmp eq i64 %indvars.iv.next62, %wide.trip.count
  br i1 %exitcond.not, label %._crit_edge41, label %48, !llvm.loop !15

._crit_edge46:                                    ; preds = %._crit_edge41, %37
  %.pre = load i64, ptr @X, align 8, !tbaa !9
  %.not48 = icmp slt i64 %.pre, 0
  br i1 %.not48, label %._crit_edge53, label %.lr.ph52.preheader

.lr.ph52.preheader:                               ; preds = %._crit_edge46
  %59 = icmp eq i64 %.pre, 0
  br i1 %59, label %._crit_edge53.loopexit.unr-lcssa, label %.lr.ph52.preheader.new

.lr.ph52.preheader.new:                           ; preds = %.lr.ph52.preheader
  %60 = add nuw i64 %.pre, 1
  %unroll_iter = and i64 %60, -2
  br label %.lr.ph52

._crit_edge53.loopexit.unr-lcssa:                 ; preds = %.lr.ph52, %.lr.ph52.preheader
  %.lcssa.ph = phi i64 [ poison, %.lr.ph52.preheader ], [ %88, %.lr.ph52 ]
  %.050.unr = phi i64 [ 0, %.lr.ph52.preheader ], [ %89, %.lr.ph52 ]
  %.03249.unr = phi i64 [ 0, %.lr.ph52.preheader ], [ %88, %.lr.ph52 ]
  %61 = and i64 %.pre, 1
  %lcmp.mod.not.not = icmp eq i64 %61, 0
  br i1 %lcmp.mod.not.not, label %.lr.ph52.epil, label %._crit_edge53

.lr.ph52.epil:                                    ; preds = %._crit_edge53.loopexit.unr-lcssa
  %62 = getelementptr inbounds [100010 x i64], ptr @DP, i64 0, i64 %.050.unr
  %63 = load i64, ptr %62, align 8, !tbaa !9
  %64 = mul nsw i64 %63, %.050.unr
  %65 = srem i64 %64, 1000000007
  %66 = add nsw i64 %65, %.03249.unr
  %67 = srem i64 %66, 1000000007
  br label %._crit_edge53

._crit_edge53:                                    ; preds = %.lr.ph52.epil, %._crit_edge53.loopexit.unr-lcssa, %._crit_edge, %._crit_edge46
  %.032.lcssa = phi i64 [ 0, %._crit_edge46 ], [ 0, %._crit_edge ], [ %.lcssa.ph, %._crit_edge53.loopexit.unr-lcssa ], [ %67, %.lr.ph52.epil ]
  %68 = load i32, ptr @N, align 4, !tbaa !5
  %69 = sext i32 %68 to i64
  %70 = getelementptr inbounds [1000010 x i64], ptr @fact, i64 0, i64 %69
  %71 = load i64, ptr %70, align 8, !tbaa !9
  %72 = mul nsw i64 %71, %.032.lcssa
  %73 = srem i64 %72, 1000000007
  %74 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEx(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cout, i64 noundef %73)
  %75 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEPFRSoS_E(ptr noundef nonnull align 8 dereferenceable(8) %74, ptr noundef nonnull @_ZSt4endlIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_)
  ret i32 0

.lr.ph52:                                         ; preds = %.lr.ph52, %.lr.ph52.preheader.new
  %.050 = phi i64 [ 0, %.lr.ph52.preheader.new ], [ %89, %.lr.ph52 ]
  %.03249 = phi i64 [ 0, %.lr.ph52.preheader.new ], [ %88, %.lr.ph52 ]
  %niter = phi i64 [ 0, %.lr.ph52.preheader.new ], [ %niter.next.1, %.lr.ph52 ]
  %76 = getelementptr inbounds [100010 x i64], ptr @DP, i64 0, i64 %.050
  %77 = load i64, ptr %76, align 16, !tbaa !9
  %78 = mul nsw i64 %77, %.050
  %79 = srem i64 %78, 1000000007
  %80 = add nsw i64 %79, %.03249
  %81 = srem i64 %80, 1000000007
  %82 = or disjoint i64 %.050, 1
  %83 = getelementptr inbounds [100010 x i64], ptr @DP, i64 0, i64 %82
  %84 = load i64, ptr %83, align 8, !tbaa !9
  %85 = mul nsw i64 %84, %82
  %86 = srem i64 %85, 1000000007
  %87 = add nsw i64 %86, %81
  %88 = srem i64 %87, 1000000007
  %89 = add nuw i64 %.050, 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_edge53.loopexit.unr-lcssa, label %.lr.ph52, !llvm.loop !16
}

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

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

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local void @_ZSt4sortIPxEvT_S1_(ptr noundef, ptr noundef) local_unnamed_addr #5

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

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

; 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

attributes #0 = { 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 #1 = { mustprogress nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { 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 #3 = { "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { mustprogress 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 = !{!"int", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C++ TBAA"}
!9 = !{!10, !10, i64 0}
!10 = !{!"long long", !7, i64 0}
!11 = distinct !{!11, !12}
!12 = !{!"llvm.loop.mustprogress"}
!13 = distinct !{!13, !12}
!14 = distinct !{!14, !12}
!15 = distinct !{!15, !12}
!16 = distinct !{!16, !12}


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