; LLVM IR from eyangch/competitive-programming :: USACOcontests/platinum/2019.02 (mooriokart)

; 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::vector" = type { %"struct.std::_Vector_base" }
%"struct.std::_Vector_base" = type { %"struct.std::_Vector_base<std::pair<long long, long long>, std::allocator<std::pair<long long, long long>>>::_Vector_impl" }
%"struct.std::_Vector_base<std::pair<long long, long long>, std::allocator<std::pair<long long, long long>>>::_Vector_impl" = type { %"struct.std::_Vector_base<std::pair<long long, long long>, std::allocator<std::pair<long long, long long>>>::_Vector_impl_data" }
%"struct.std::_Vector_base<std::pair<long long, long long>, std::allocator<std::pair<long long, long long>>>::_Vector_impl_data" = type { ptr, ptr, ptr }
%"class.std::vector.0" = type { %"struct.std::_Vector_base.1" }
%"struct.std::_Vector_base.1" = type { %"struct.std::_Vector_base<std::vector<long long>, std::allocator<std::vector<long long>>>::_Vector_impl" }
%"struct.std::_Vector_base<std::vector<long long>, std::allocator<std::vector<long long>>>::_Vector_impl" = type { %"struct.std::_Vector_base<std::vector<long long>, std::allocator<std::vector<long long>>>::_Vector_impl_data" }
%"struct.std::_Vector_base<std::vector<long long>, std::allocator<std::vector<long long>>>::_Vector_impl_data" = type { ptr, ptr, ptr }
%"class.std::vector.5" = type { %"struct.std::_Vector_base.6" }
%"struct.std::_Vector_base.6" = type { %"struct.std::_Vector_base<long long, std::allocator<long long>>::_Vector_impl" }
%"struct.std::_Vector_base<long long, std::allocator<long long>>::_Vector_impl" = type { %"struct.std::_Vector_base<long long, std::allocator<long long>>::_Vector_impl_data" }
%"struct.std::_Vector_base<long long, std::allocator<long long>>::_Vector_impl_data" = type { ptr, ptr, ptr }
%"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" }
%"struct.std::pair" = type { i64, i64 }
%"class.__gnu_cxx::__normal_iterator.10" = type { ptr }

@MOD = external dso_local global i64, align 8
@N = external dso_local global i64, align 8
@M = external dso_local global i64, align 8
@X = external dso_local global i64, align 8
@Y = external dso_local global i64, align 8
@K = external dso_local global i64, align 8
@graph = external dso_local global [1500 x %"class.std::vector"], align 16
@len = external dso_local global %"class.std::vector.0", align 8
@curr = external dso_local global %"class.std::vector.5", align 8
@vis = external dso_local global [1500 x i8], align 16
@starting = external dso_local global %"class.std::vector.5", align 8
@all_paths = external dso_local global i64, align 8
@dp = external dso_local global [2 x [2501 x i64]], align 16
@.str = external hidden unnamed_addr constant [14 x i8], align 1
@.str.5 = external hidden unnamed_addr constant [2 x i8], align 1
@stdin = external global ptr, align 8
@.str.6 = external hidden unnamed_addr constant [15 x i8], align 1
@.str.7 = 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.8 = external hidden unnamed_addr constant [2 x i8], align 1

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef i64 @_Z4fexpxx(i64 noundef, i64 noundef) #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 uwtable
declare dso_local void @_Z7dfsfindx(i64 noundef) #2

; Function Attrs: mustprogress uwtable
declare dso_local void @_Z3dfsxxxx(i64 noundef, i64 noundef, i64 noundef, i64 noundef) #2

; Function Attrs: mustprogress norecurse uwtable
define dso_local noundef i32 @main() #3 {
  %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 %"struct.std::pair", align 8
  %7 = alloca i64, align 8
  %8 = alloca %"struct.std::pair", align 8
  %9 = alloca i64, align 8
  %10 = alloca i64, align 8
  %11 = alloca i32, align 4
  %12 = alloca ptr, align 8
  %13 = alloca %"class.__gnu_cxx::__normal_iterator.10", align 8
  %14 = alloca %"class.__gnu_cxx::__normal_iterator.10", align 8
  %15 = alloca i64, align 8
  %16 = alloca %"class.__gnu_cxx::__normal_iterator.10", align 8
  %17 = alloca %"class.__gnu_cxx::__normal_iterator.10", align 8
  %18 = alloca i64, align 8
  %19 = alloca i64, align 8
  %20 = alloca i64, align 8
  %21 = alloca i64, align 8
  %22 = alloca ptr, align 8
  %23 = alloca %"class.__gnu_cxx::__normal_iterator.10", align 8
  %24 = alloca %"class.__gnu_cxx::__normal_iterator.10", align 8
  %25 = alloca i64, align 8
  %26 = alloca i64, align 8
  %27 = alloca i64, align 8
  %28 = alloca i64, align 8
  %29 = alloca i64, align 8
  %30 = alloca ptr, align 8
  %31 = alloca %"class.__gnu_cxx::__normal_iterator.10", align 8
  %32 = alloca %"class.__gnu_cxx::__normal_iterator.10", align 8
  %33 = alloca i64, align 8
  %34 = alloca i64, align 8
  %35 = alloca i64, align 8
  %36 = alloca i64, align 8
  %37 = alloca i64, align 8
  store i32 0, ptr %1, align 4
  %38 = load ptr, ptr @stdin, align 8, !tbaa !5
  %39 = call ptr @freopen(ptr noundef @.str, ptr noundef @.str.5, ptr noundef %38)
  %40 = load ptr, ptr @stdout, align 8, !tbaa !5
  %41 = call ptr @freopen(ptr noundef @.str.6, ptr noundef @.str.7, ptr noundef %40)
  %42 = call noundef zeroext i1 @_ZNSt8ios_base15sync_with_stdioEb(i1 noundef zeroext false)
  %43 = load ptr, ptr @_ZSt3cin, align 8, !tbaa !9
  %44 = getelementptr i8, ptr %43, i64 -24
  %45 = load i64, ptr %44, align 8
  %46 = getelementptr inbounds i8, ptr @_ZSt3cin, i64 %45
  %47 = call noundef ptr @_ZNSt9basic_iosIcSt11char_traitsIcEE3tieEPSo(ptr noundef nonnull align 8 dereferenceable(264) %46, ptr noundef null)
  %48 = 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)
  %49 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERx(ptr noundef nonnull align 8 dereferenceable(16) %48, ptr noundef nonnull align 8 dereferenceable(8) @M)
  %50 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERx(ptr noundef nonnull align 8 dereferenceable(16) %49, ptr noundef nonnull align 8 dereferenceable(8) @X)
  %51 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERx(ptr noundef nonnull align 8 dereferenceable(16) %50, ptr noundef nonnull align 8 dereferenceable(8) @Y)
  call void @llvm.lifetime.start.p0(i64 8, ptr %2) #7
  store i64 0, ptr %2, align 8, !tbaa !11
  br label %52

52:                                               ; preds = %71, %0
  %53 = load i64, ptr %2, align 8, !tbaa !11
  %54 = load i64, ptr @M, align 8, !tbaa !11
  %55 = icmp slt i64 %53, %54
  br i1 %55, label %57, label %56

56:                                               ; preds = %52
  call void @llvm.lifetime.end.p0(i64 8, ptr %2) #7
  br label %74

57:                                               ; preds = %52
  call void @llvm.lifetime.start.p0(i64 8, ptr %3) #7
  call void @llvm.lifetime.start.p0(i64 8, ptr %4) #7
  call void @llvm.lifetime.start.p0(i64 8, ptr %5) #7
  %58 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERx(ptr noundef nonnull align 8 dereferenceable(16) @_ZSt3cin, ptr noundef nonnull align 8 dereferenceable(8) %3)
  %59 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERx(ptr noundef nonnull align 8 dereferenceable(16) %58, ptr noundef nonnull align 8 dereferenceable(8) %4)
  %60 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERx(ptr noundef nonnull align 8 dereferenceable(16) %59, ptr noundef nonnull align 8 dereferenceable(8) %5)
  %61 = load i64, ptr %3, align 8, !tbaa !11
  %62 = sub nsw i64 %61, 1
  %63 = getelementptr inbounds [1500 x %"class.std::vector"], ptr @graph, i64 0, i64 %62
  call void @llvm.lifetime.start.p0(i64 16, ptr %6) #7
  call void @llvm.lifetime.start.p0(i64 8, ptr %7) #7
  %64 = load i64, ptr %4, align 8, !tbaa !11
  %65 = sub nsw i64 %64, 1
  store i64 %65, ptr %7, align 8, !tbaa !11
  call void @_ZNSt4pairIxxEC2IxRxTnNSt9enable_ifIXaaclsr5_PCCPE22_MoveConstructiblePairIT_T0_EEclsr5_PCCPE30_ImplicitlyMoveConvertiblePairIS4_S5_EEEbE4typeELb1EEEOS4_OS5_(ptr noundef nonnull align 8 dereferenceable(16) %6, ptr noundef nonnull align 8 dereferenceable(8) %7, ptr noundef nonnull align 8 dereferenceable(8) %5)
  call void @_ZNSt6vectorISt4pairIxxESaIS1_EE9push_backEOS1_(ptr noundef nonnull align 8 dereferenceable(24) %63, ptr noundef nonnull align 8 dereferenceable(16) %6)
  call void @llvm.lifetime.end.p0(i64 8, ptr %7) #7
  call void @llvm.lifetime.end.p0(i64 16, ptr %6) #7
  %66 = load i64, ptr %4, align 8, !tbaa !11
  %67 = sub nsw i64 %66, 1
  %68 = getelementptr inbounds [1500 x %"class.std::vector"], ptr @graph, i64 0, i64 %67
  call void @llvm.lifetime.start.p0(i64 16, ptr %8) #7
  call void @llvm.lifetime.start.p0(i64 8, ptr %9) #7
  %69 = load i64, ptr %3, align 8, !tbaa !11
  %70 = sub nsw i64 %69, 1
  store i64 %70, ptr %9, align 8, !tbaa !11
  call void @_ZNSt4pairIxxEC2IxRxTnNSt9enable_ifIXaaclsr5_PCCPE22_MoveConstructiblePairIT_T0_EEclsr5_PCCPE30_ImplicitlyMoveConvertiblePairIS4_S5_EEEbE4typeELb1EEEOS4_OS5_(ptr noundef nonnull align 8 dereferenceable(16) %8, ptr noundef nonnull align 8 dereferenceable(8) %9, ptr noundef nonnull align 8 dereferenceable(8) %5)
  call void @_ZNSt6vectorISt4pairIxxESaIS1_EE9push_backEOS1_(ptr noundef nonnull align 8 dereferenceable(24) %68, ptr noundef nonnull align 8 dereferenceable(16) %8)
  call void @llvm.lifetime.end.p0(i64 8, ptr %9) #7
  call void @llvm.lifetime.end.p0(i64 16, ptr %8) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr %5) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr %4) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr %3) #7
  br label %71

71:                                               ; preds = %57
  %72 = load i64, ptr %2, align 8, !tbaa !11
  %73 = add nsw i64 %72, 1
  store i64 %73, ptr %2, align 8, !tbaa !11
  br label %52, !llvm.loop !13

74:                                               ; preds = %56
  call void @llvm.lifetime.start.p0(i64 8, ptr %10) #7
  store i64 0, ptr %10, align 8, !tbaa !11
  br label %75

75:                                               ; preds = %111, %74
  %76 = load i64, ptr %10, align 8, !tbaa !11
  %77 = load i64, ptr @N, align 8, !tbaa !11
  %78 = icmp slt i64 %76, %77
  br i1 %78, label %80, label %79

79:                                               ; preds = %75
  store i32 5, ptr %11, align 4
  call void @llvm.lifetime.end.p0(i64 8, ptr %10) #7
  br label %114

80:                                               ; preds = %75
  %81 = load i64, ptr %10, align 8, !tbaa !11
  %82 = getelementptr inbounds [1500 x i8], ptr @vis, i64 0, i64 %81
  %83 = load i8, ptr %82, align 1, !tbaa !15, !range !17, !noundef !18
  %84 = trunc i8 %83 to i1
  br i1 %84, label %85, label %86

85:                                               ; preds = %80
  br label %111

86:                                               ; preds = %80
  call void @_ZNSt6vectorIxSaIxEE5clearEv(ptr noundef nonnull align 8 dereferenceable(24) @starting) #7
  call void @_ZNSt6vectorIxSaIxEE5clearEv(ptr noundef nonnull align 8 dereferenceable(24) @curr) #7
  %87 = load i64, ptr %10, align 8, !tbaa !11
  call void @_Z7dfsfindx(i64 noundef %87)
  call void @llvm.lifetime.start.p0(i64 8, ptr %12) #7
  store ptr @starting, ptr %12, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %13) #7
  %88 = call ptr @_ZNSt6vectorIxSaIxEE5beginEv(ptr noundef nonnull align 8 dereferenceable(24) @starting) #7
  %89 = getelementptr inbounds %"class.__gnu_cxx::__normal_iterator.10", ptr %13, i32 0, i32 0
  store ptr %88, ptr %89, align 8
  call void @llvm.lifetime.start.p0(i64 8, ptr %14) #7
  %90 = call ptr @_ZNSt6vectorIxSaIxEE3endEv(ptr noundef nonnull align 8 dereferenceable(24) @starting) #7
  %91 = getelementptr inbounds %"class.__gnu_cxx::__normal_iterator.10", ptr %14, i32 0, i32 0
  store ptr %90, ptr %91, align 8
  br label %92

92:                                               ; preds = %100, %86
  %93 = call noundef zeroext i1 @_ZN9__gnu_cxxneIPxSt6vectorIxSaIxEEEEbRKNS_17__normal_iteratorIT_T0_EESA_(ptr noundef nonnull align 8 dereferenceable(8) %13, ptr noundef nonnull align 8 dereferenceable(8) %14) #7
  br i1 %93, label %95, label %94

94:                                               ; preds = %92
  store i32 8, ptr %11, align 4
  call void @llvm.lifetime.end.p0(i64 8, ptr %14) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr %13) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr %12) #7
  br label %102

95:                                               ; preds = %92
  call void @llvm.lifetime.start.p0(i64 8, ptr %15) #7
  %96 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNK9__gnu_cxx17__normal_iteratorIPxSt6vectorIxSaIxEEEdeEv(ptr noundef nonnull align 8 dereferenceable(8) %13) #7
  %97 = load i64, ptr %96, align 8, !tbaa !11
  store i64 %97, ptr %15, align 8, !tbaa !11
  %98 = load i64, ptr %15, align 8, !tbaa !11
  %99 = load i64, ptr %15, align 8, !tbaa !11
  call void @_Z3dfsxxxx(i64 noundef %98, i64 noundef %99, i64 noundef -1, i64 noundef 0)
  call void @llvm.lifetime.end.p0(i64 8, ptr %15) #7
  br label %100

100:                                              ; preds = %95
  %101 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZN9__gnu_cxx17__normal_iteratorIPxSt6vectorIxSaIxEEEppEv(ptr noundef nonnull align 8 dereferenceable(8) %13) #7
  br label %92

102:                                              ; preds = %94
  %103 = call ptr @_ZNSt6vectorIxSaIxEE5beginEv(ptr noundef nonnull align 8 dereferenceable(24) @curr) #7
  %104 = getelementptr inbounds %"class.__gnu_cxx::__normal_iterator.10", ptr %16, i32 0, i32 0
  store ptr %103, ptr %104, align 8
  %105 = call ptr @_ZNSt6vectorIxSaIxEE3endEv(ptr noundef nonnull align 8 dereferenceable(24) @curr) #7
  %106 = getelementptr inbounds %"class.__gnu_cxx::__normal_iterator.10", ptr %17, i32 0, i32 0
  store ptr %105, ptr %106, align 8
  %107 = getelementptr inbounds %"class.__gnu_cxx::__normal_iterator.10", ptr %16, i32 0, i32 0
  %108 = load ptr, ptr %107, align 8
  %109 = getelementptr inbounds %"class.__gnu_cxx::__normal_iterator.10", ptr %17, i32 0, i32 0
  %110 = load ptr, ptr %109, align 8
  call void @_ZSt4sortIN9__gnu_cxx17__normal_iteratorIPxSt6vectorIxSaIxEEEEEvT_S7_(ptr %108, ptr %110)
  call void @_ZNSt6vectorIS_IxSaIxEESaIS1_EE9push_backERKS1_(ptr noundef nonnull align 8 dereferenceable(24) @len, ptr noundef nonnull align 8 dereferenceable(24) @curr)
  br label %111

111:                                              ; preds = %102, %85
  %112 = load i64, ptr %10, align 8, !tbaa !11
  %113 = add nsw i64 %112, 1
  store i64 %113, ptr %10, align 8, !tbaa !11
  br label %75, !llvm.loop !19

114:                                              ; preds = %79
  %115 = call noundef i64 @_ZNKSt6vectorIS_IxSaIxEESaIS1_EE4sizeEv(ptr noundef nonnull align 8 dereferenceable(24) @len) #7
  store i64 %115, ptr @K, align 8, !tbaa !11
  call void @llvm.lifetime.start.p0(i64 8, ptr %18) #7
  store i64 1, ptr %18, align 8, !tbaa !11
  call void @llvm.lifetime.start.p0(i64 8, ptr %19) #7
  store i64 0, ptr %19, align 8, !tbaa !11
  br label %116

116:                                              ; preds = %129, %114
  %117 = load i64, ptr %19, align 8, !tbaa !11
  %118 = load i64, ptr @K, align 8, !tbaa !11
  %119 = icmp slt i64 %117, %118
  br i1 %119, label %121, label %120

120:                                              ; preds = %116
  store i32 10, ptr %11, align 4
  call void @llvm.lifetime.end.p0(i64 8, ptr %19) #7
  br label %132

121:                                              ; preds = %116
  %122 = load i64, ptr %18, align 8, !tbaa !11
  %123 = load i64, ptr %19, align 8, !tbaa !11
  %124 = call noundef nonnull align 8 dereferenceable(24) ptr @_ZNSt6vectorIS_IxSaIxEESaIS1_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) @len, i64 noundef %123) #7
  %125 = call noundef i64 @_ZNKSt6vectorIxSaIxEE4sizeEv(ptr noundef nonnull align 8 dereferenceable(24) %124) #7
  %126 = mul i64 %122, %125
  %127 = load i64, ptr @MOD, align 8, !tbaa !11
  %128 = urem i64 %126, %127
  store i64 %128, ptr %18, align 8, !tbaa !11
  br label %129

129:                                              ; preds = %121
  %130 = load i64, ptr %19, align 8, !tbaa !11
  %131 = add nsw i64 %130, 1
  store i64 %131, ptr %19, align 8, !tbaa !11
  br label %116, !llvm.loop !20

132:                                              ; preds = %120
  %133 = load i64, ptr @X, align 8, !tbaa !11
  %134 = load i64, ptr %18, align 8, !tbaa !11
  %135 = mul nsw i64 %133, %134
  %136 = load i64, ptr @MOD, align 8, !tbaa !11
  %137 = srem i64 %135, %136
  %138 = load i64, ptr @K, align 8, !tbaa !11
  %139 = mul nsw i64 %137, %138
  %140 = load i64, ptr @MOD, align 8, !tbaa !11
  %141 = srem i64 %139, %140
  store i64 %141, ptr @all_paths, align 8, !tbaa !11
  call void @llvm.lifetime.start.p0(i64 8, ptr %20) #7
  store i64 0, ptr %20, align 8, !tbaa !11
  br label %142

142:                                              ; preds = %182, %132
  %143 = load i64, ptr %20, align 8, !tbaa !11
  %144 = load i64, ptr @K, align 8, !tbaa !11
  %145 = icmp slt i64 %143, %144
  br i1 %145, label %147, label %146

146:                                              ; preds = %142
  store i32 13, ptr %11, align 4
  call void @llvm.lifetime.end.p0(i64 8, ptr %20) #7
  br label %185

147:                                              ; preds = %142
  call void @llvm.lifetime.start.p0(i64 8, ptr %21) #7
  %148 = load i64, ptr %18, align 8, !tbaa !11
  %149 = load i64, ptr %20, align 8, !tbaa !11
  %150 = call noundef nonnull align 8 dereferenceable(24) ptr @_ZNSt6vectorIS_IxSaIxEESaIS1_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) @len, i64 noundef %149) #7
  %151 = call noundef i64 @_ZNKSt6vectorIxSaIxEE4sizeEv(ptr noundef nonnull align 8 dereferenceable(24) %150) #7
  %152 = load i64, ptr @MOD, align 8, !tbaa !11
  %153 = sub nsw i64 %152, 2
  %154 = call noundef i64 @_Z4fexpxx(i64 noundef %151, i64 noundef %153)
  %155 = mul nsw i64 %148, %154
  %156 = load i64, ptr @MOD, align 8, !tbaa !11
  %157 = srem i64 %155, %156
  store i64 %157, ptr %21, align 8, !tbaa !11
  call void @llvm.lifetime.start.p0(i64 8, ptr %22) #7
  %158 = load i64, ptr %20, align 8, !tbaa !11
  %159 = call noundef nonnull align 8 dereferenceable(24) ptr @_ZNSt6vectorIS_IxSaIxEESaIS1_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) @len, i64 noundef %158) #7
  store ptr %159, ptr %22, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %23) #7
  %160 = load ptr, ptr %22, align 8, !tbaa !5
  %161 = call ptr @_ZNSt6vectorIxSaIxEE5beginEv(ptr noundef nonnull align 8 dereferenceable(24) %160) #7
  %162 = getelementptr inbounds %"class.__gnu_cxx::__normal_iterator.10", ptr %23, i32 0, i32 0
  store ptr %161, ptr %162, align 8
  call void @llvm.lifetime.start.p0(i64 8, ptr %24) #7
  %163 = load ptr, ptr %22, align 8, !tbaa !5
  %164 = call ptr @_ZNSt6vectorIxSaIxEE3endEv(ptr noundef nonnull align 8 dereferenceable(24) %163) #7
  %165 = getelementptr inbounds %"class.__gnu_cxx::__normal_iterator.10", ptr %24, i32 0, i32 0
  store ptr %164, ptr %165, align 8
  br label %166

166:                                              ; preds = %179, %147
  %167 = call noundef zeroext i1 @_ZN9__gnu_cxxneIPxSt6vectorIxSaIxEEEEbRKNS_17__normal_iteratorIT_T0_EESA_(ptr noundef nonnull align 8 dereferenceable(8) %23, ptr noundef nonnull align 8 dereferenceable(8) %24) #7
  br i1 %167, label %169, label %168

168:                                              ; preds = %166
  store i32 16, ptr %11, align 4
  call void @llvm.lifetime.end.p0(i64 8, ptr %24) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr %23) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr %22) #7
  br label %181

169:                                              ; preds = %166
  call void @llvm.lifetime.start.p0(i64 8, ptr %25) #7
  %170 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNK9__gnu_cxx17__normal_iteratorIPxSt6vectorIxSaIxEEEdeEv(ptr noundef nonnull align 8 dereferenceable(8) %23) #7
  %171 = load i64, ptr %170, align 8, !tbaa !11
  store i64 %171, ptr %25, align 8, !tbaa !11
  %172 = load i64, ptr @all_paths, align 8, !tbaa !11
  %173 = load i64, ptr %21, align 8, !tbaa !11
  %174 = load i64, ptr %25, align 8, !tbaa !11
  %175 = mul nsw i64 %173, %174
  %176 = add nsw i64 %172, %175
  %177 = load i64, ptr @MOD, align 8, !tbaa !11
  %178 = srem i64 %176, %177
  store i64 %178, ptr @all_paths, align 8, !tbaa !11
  call void @llvm.lifetime.end.p0(i64 8, ptr %25) #7
  br label %179

179:                                              ; preds = %169
  %180 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZN9__gnu_cxx17__normal_iteratorIPxSt6vectorIxSaIxEEEppEv(ptr noundef nonnull align 8 dereferenceable(8) %23) #7
  br label %166

181:                                              ; preds = %168
  call void @llvm.lifetime.end.p0(i64 8, ptr %21) #7
  br label %182

182:                                              ; preds = %181
  %183 = load i64, ptr %20, align 8, !tbaa !11
  %184 = add nsw i64 %183, 1
  store i64 %184, ptr %20, align 8, !tbaa !11
  br label %142, !llvm.loop !21

185:                                              ; preds = %146
  store i64 1, ptr getelementptr inbounds ([2 x [2501 x i64]], ptr @dp, i64 0, i64 1), align 8, !tbaa !11
  call void @llvm.lifetime.start.p0(i64 8, ptr %26) #7
  store i64 0, ptr %26, align 8, !tbaa !11
  br label %186

186:                                              ; preds = %263, %185
  %187 = load i64, ptr %26, align 8, !tbaa !11
  %188 = load i64, ptr @K, align 8, !tbaa !11
  %189 = icmp slt i64 %187, %188
  br i1 %189, label %191, label %190

190:                                              ; preds = %186
  store i32 18, ptr %11, align 4
  call void @llvm.lifetime.end.p0(i64 8, ptr %26) #7
  br label %266

191:                                              ; preds = %186
  call void @llvm.lifetime.start.p0(i64 8, ptr %27) #7
  %192 = load i64, ptr %26, align 8, !tbaa !11
  %193 = srem i64 %192, 2
  store i64 %193, ptr %27, align 8, !tbaa !11
  call void @llvm.lifetime.start.p0(i64 8, ptr %28) #7
  %194 = load i64, ptr %27, align 8, !tbaa !11
  %195 = icmp ne i64 %194, 0
  %196 = xor i1 %195, true
  %197 = zext i1 %196 to i64
  store i64 %197, ptr %28, align 8, !tbaa !11
  call void @llvm.lifetime.start.p0(i64 8, ptr %29) #7
  %198 = load i64, ptr @Y, align 8, !tbaa !11
  %199 = sub nsw i64 %198, 1
  store i64 %199, ptr %29, align 8, !tbaa !11
  br label %200

200:                                              ; preds = %259, %191
  %201 = load i64, ptr %29, align 8, !tbaa !11
  %202 = icmp sge i64 %201, 0
  br i1 %202, label %204, label %203

203:                                              ; preds = %200
  store i32 21, ptr %11, align 4
  call void @llvm.lifetime.end.p0(i64 8, ptr %29) #7
  br label %262

204:                                              ; preds = %200
  %205 = load i64, ptr %27, align 8, !tbaa !11
  %206 = getelementptr inbounds [2 x [2501 x i64]], ptr @dp, i64 0, i64 %205
  %207 = load i64, ptr %29, align 8, !tbaa !11
  %208 = getelementptr inbounds [2501 x i64], ptr %206, i64 0, i64 %207
  store i64 0, ptr %208, align 8, !tbaa !11
  call void @llvm.lifetime.start.p0(i64 8, ptr %30) #7
  %209 = load i64, ptr %26, align 8, !tbaa !11
  %210 = call noundef nonnull align 8 dereferenceable(24) ptr @_ZNSt6vectorIS_IxSaIxEESaIS1_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) @len, i64 noundef %209) #7
  store ptr %210, ptr %30, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %31) #7
  %211 = load ptr, ptr %30, align 8, !tbaa !5
  %212 = call ptr @_ZNSt6vectorIxSaIxEE5beginEv(ptr noundef nonnull align 8 dereferenceable(24) %211) #7
  %213 = getelementptr inbounds %"class.__gnu_cxx::__normal_iterator.10", ptr %31, i32 0, i32 0
  store ptr %212, ptr %213, align 8
  call void @llvm.lifetime.start.p0(i64 8, ptr %32) #7
  %214 = load ptr, ptr %30, align 8, !tbaa !5
  %215 = call ptr @_ZNSt6vectorIxSaIxEE3endEv(ptr noundef nonnull align 8 dereferenceable(24) %214) #7
  %216 = getelementptr inbounds %"class.__gnu_cxx::__normal_iterator.10", ptr %32, i32 0, i32 0
  store ptr %215, ptr %216, align 8
  br label %217

217:                                              ; preds = %255, %204
  %218 = call noundef zeroext i1 @_ZN9__gnu_cxxneIPxSt6vectorIxSaIxEEEEbRKNS_17__normal_iteratorIT_T0_EESA_(ptr noundef nonnull align 8 dereferenceable(8) %31, ptr noundef nonnull align 8 dereferenceable(8) %32) #7
  br i1 %218, label %220, label %219

219:                                              ; preds = %217
  store i32 24, ptr %11, align 4
  br label %257

220:                                              ; preds = %217
  call void @llvm.lifetime.start.p0(i64 8, ptr %33) #7
  %221 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNK9__gnu_cxx17__normal_iteratorIPxSt6vectorIxSaIxEEEdeEv(ptr noundef nonnull align 8 dereferenceable(8) %31) #7
  %222 = load i64, ptr %221, align 8, !tbaa !11
  store i64 %222, ptr %33, align 8, !tbaa !11
  %223 = load i64, ptr %29, align 8, !tbaa !11
  %224 = load i64, ptr %33, align 8, !tbaa !11
  %225 = sub nsw i64 %223, %224
  %226 = load i64, ptr @X, align 8, !tbaa !11
  %227 = sub nsw i64 %225, %226
  %228 = icmp slt i64 %227, 0
  br i1 %228, label %229, label %230

229:                                              ; preds = %220
  store i32 24, ptr %11, align 4
  br label %252

230:                                              ; preds = %220
  %231 = load i64, ptr %27, align 8, !tbaa !11
  %232 = getelementptr inbounds [2 x [2501 x i64]], ptr @dp, i64 0, i64 %231
  %233 = load i64, ptr %29, align 8, !tbaa !11
  %234 = getelementptr inbounds [2501 x i64], ptr %232, i64 0, i64 %233
  %235 = load i64, ptr %234, align 8, !tbaa !11
  %236 = load i64, ptr %28, align 8, !tbaa !11
  %237 = getelementptr inbounds [2 x [2501 x i64]], ptr @dp, i64 0, i64 %236
  %238 = load i64, ptr %29, align 8, !tbaa !11
  %239 = load i64, ptr %33, align 8, !tbaa !11
  %240 = sub nsw i64 %238, %239
  %241 = load i64, ptr @X, align 8, !tbaa !11
  %242 = sub nsw i64 %240, %241
  %243 = getelementptr inbounds [2501 x i64], ptr %237, i64 0, i64 %242
  %244 = load i64, ptr %243, align 8, !tbaa !11
  %245 = add nsw i64 %235, %244
  %246 = load i64, ptr @MOD, align 8, !tbaa !11
  %247 = srem i64 %245, %246
  %248 = load i64, ptr %27, align 8, !tbaa !11
  %249 = getelementptr inbounds [2 x [2501 x i64]], ptr @dp, i64 0, i64 %248
  %250 = load i64, ptr %29, align 8, !tbaa !11
  %251 = getelementptr inbounds [2501 x i64], ptr %249, i64 0, i64 %250
  store i64 %247, ptr %251, align 8, !tbaa !11
  store i32 0, ptr %11, align 4
  br label %252

252:                                              ; preds = %230, %229
  call void @llvm.lifetime.end.p0(i64 8, ptr %33) #7
  %253 = load i32, ptr %11, align 4
  switch i32 %253, label %257 [
    i32 0, label %254
  ]

254:                                              ; preds = %252
  br label %255

255:                                              ; preds = %254
  %256 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZN9__gnu_cxx17__normal_iteratorIPxSt6vectorIxSaIxEEEppEv(ptr noundef nonnull align 8 dereferenceable(8) %31) #7
  br label %217

257:                                              ; preds = %252, %219
  call void @llvm.lifetime.end.p0(i64 8, ptr %32) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr %31) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr %30) #7
  br label %258

258:                                              ; preds = %257
  br label %259

259:                                              ; preds = %258
  %260 = load i64, ptr %29, align 8, !tbaa !11
  %261 = add nsw i64 %260, -1
  store i64 %261, ptr %29, align 8, !tbaa !11
  br label %200, !llvm.loop !22

262:                                              ; preds = %203
  call void @llvm.lifetime.end.p0(i64 8, ptr %28) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr %27) #7
  br label %263

263:                                              ; preds = %262
  %264 = load i64, ptr %26, align 8, !tbaa !11
  %265 = add nsw i64 %264, 1
  store i64 %265, ptr %26, align 8, !tbaa !11
  br label %186, !llvm.loop !23

266:                                              ; preds = %190
  call void @llvm.lifetime.start.p0(i64 8, ptr %34) #7
  %267 = load i64, ptr @all_paths, align 8, !tbaa !11
  store i64 %267, ptr %34, align 8, !tbaa !11
  call void @llvm.lifetime.start.p0(i64 8, ptr %35) #7
  store i64 0, ptr %35, align 8, !tbaa !11
  br label %268

268:                                              ; preds = %291, %266
  %269 = load i64, ptr %35, align 8, !tbaa !11
  %270 = load i64, ptr @Y, align 8, !tbaa !11
  %271 = icmp slt i64 %269, %270
  br i1 %271, label %273, label %272

272:                                              ; preds = %268
  store i32 26, ptr %11, align 4
  call void @llvm.lifetime.end.p0(i64 8, ptr %35) #7
  br label %294

273:                                              ; preds = %268
  %274 = load i64, ptr %34, align 8, !tbaa !11
  %275 = load i64, ptr %35, align 8, !tbaa !11
  %276 = load i64, ptr @K, align 8, !tbaa !11
  %277 = sub nsw i64 %276, 1
  %278 = srem i64 %277, 2
  %279 = getelementptr inbounds [2 x [2501 x i64]], ptr @dp, i64 0, i64 %278
  %280 = load i64, ptr %35, align 8, !tbaa !11
  %281 = getelementptr inbounds [2501 x i64], ptr %279, i64 0, i64 %280
  %282 = load i64, ptr %281, align 8, !tbaa !11
  %283 = mul nsw i64 %275, %282
  %284 = load i64, ptr @MOD, align 8, !tbaa !11
  %285 = srem i64 %283, %284
  %286 = sub nsw i64 %274, %285
  %287 = load i64, ptr @MOD, align 8, !tbaa !11
  %288 = add nsw i64 %286, %287
  %289 = load i64, ptr @MOD, align 8, !tbaa !11
  %290 = srem i64 %288, %289
  store i64 %290, ptr %34, align 8, !tbaa !11
  br label %291

291:                                              ; preds = %273
  %292 = load i64, ptr %35, align 8, !tbaa !11
  %293 = add nsw i64 %292, 1
  store i64 %293, ptr %35, align 8, !tbaa !11
  br label %268, !llvm.loop !24

294:                                              ; preds = %272
  call void @llvm.lifetime.start.p0(i64 8, ptr %36) #7
  store i64 1, ptr %36, align 8, !tbaa !11
  call void @llvm.lifetime.start.p0(i64 8, ptr %37) #7
  store i64 1, ptr %37, align 8, !tbaa !11
  br label %295

295:                                              ; preds = %306, %294
  %296 = load i64, ptr %37, align 8, !tbaa !11
  %297 = load i64, ptr @K, align 8, !tbaa !11
  %298 = icmp slt i64 %296, %297
  br i1 %298, label %300, label %299

299:                                              ; preds = %295
  store i32 29, ptr %11, align 4
  call void @llvm.lifetime.end.p0(i64 8, ptr %37) #7
  br label %309

300:                                              ; preds = %295
  %301 = load i64, ptr %36, align 8, !tbaa !11
  %302 = load i64, ptr %37, align 8, !tbaa !11
  %303 = mul nsw i64 %301, %302
  %304 = load i64, ptr @MOD, align 8, !tbaa !11
  %305 = srem i64 %303, %304
  store i64 %305, ptr %36, align 8, !tbaa !11
  br label %306

306:                                              ; preds = %300
  %307 = load i64, ptr %37, align 8, !tbaa !11
  %308 = add nsw i64 %307, 1
  store i64 %308, ptr %37, align 8, !tbaa !11
  br label %295, !llvm.loop !25

309:                                              ; preds = %299
  %310 = load i64, ptr %34, align 8, !tbaa !11
  %311 = load i64, ptr %36, align 8, !tbaa !11
  %312 = mul nsw i64 %310, %311
  %313 = load i64, ptr @MOD, align 8, !tbaa !11
  %314 = srem i64 %312, %313
  %315 = load i64, ptr @MOD, align 8, !tbaa !11
  %316 = sub nsw i64 %315, 2
  %317 = call noundef i64 @_Z4fexpxx(i64 noundef 2, i64 noundef %316)
  %318 = mul nsw i64 %314, %317
  %319 = load i64, ptr @MOD, align 8, !tbaa !11
  %320 = srem i64 %318, %319
  %321 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEx(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cout, i64 noundef %320)
  %322 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc(ptr noundef nonnull align 8 dereferenceable(8) %321, ptr noundef @.str.8)
  store i32 0, ptr %1, align 4
  store i32 1, ptr %11, align 4
  call void @llvm.lifetime.end.p0(i64 8, ptr %36) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr %34) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr %18) #7
  %323 = load i32, ptr %1, align 4
  ret i32 %323
}

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

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

; Function Attrs: mustprogress nounwind uwtable
declare noundef ptr @_ZNSt9basic_iosIcSt11char_traitsIcEE3tieEPSo(ptr noundef nonnull align 8 dereferenceable(264), ptr noundef) #0 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)) #2 align 2

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZNSt6vectorISt4pairIxxESaIS1_EE9push_backEOS1_(ptr noundef nonnull align 8 dereferenceable(24), ptr noundef nonnull align 8 dereferenceable(16)) #2 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZNSt4pairIxxEC2IxRxTnNSt9enable_ifIXaaclsr5_PCCPE22_MoveConstructiblePairIT_T0_EEclsr5_PCCPE30_ImplicitlyMoveConvertiblePairIS4_S5_EEEbE4typeELb1EEEOS4_OS5_(ptr noundef nonnull align 8 dereferenceable(16), ptr noundef nonnull align 8 dereferenceable(8), ptr noundef nonnull align 8 dereferenceable(8)) unnamed_addr #0 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZNSt6vectorIxSaIxEE5clearEv(ptr noundef nonnull align 8 dereferenceable(24)) #0 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local ptr @_ZNSt6vectorIxSaIxEE5beginEv(ptr noundef nonnull align 8 dereferenceable(24)) #0 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local ptr @_ZNSt6vectorIxSaIxEE3endEv(ptr noundef nonnull align 8 dereferenceable(24)) #0 align 2

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef zeroext i1 @_ZN9__gnu_cxxneIPxSt6vectorIxSaIxEEEEbRKNS_17__normal_iteratorIT_T0_EESA_(ptr noundef nonnull align 8 dereferenceable(8), ptr noundef nonnull align 8 dereferenceable(8)) #5

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef nonnull align 8 dereferenceable(8) ptr @_ZNK9__gnu_cxx17__normal_iteratorIPxSt6vectorIxSaIxEEEdeEv(ptr noundef nonnull align 8 dereferenceable(8)) #0 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef nonnull align 8 dereferenceable(8) ptr @_ZN9__gnu_cxx17__normal_iteratorIPxSt6vectorIxSaIxEEEppEv(ptr noundef nonnull align 8 dereferenceable(8)) #0 align 2

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local void @_ZSt4sortIN9__gnu_cxx17__normal_iteratorIPxSt6vectorIxSaIxEEEEEvT_S7_(ptr, ptr) #6

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZNSt6vectorIS_IxSaIxEESaIS1_EE9push_backERKS1_(ptr noundef nonnull align 8 dereferenceable(24), ptr noundef nonnull align 8 dereferenceable(24)) #2 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef i64 @_ZNKSt6vectorIS_IxSaIxEESaIS1_EE4sizeEv(ptr noundef nonnull align 8 dereferenceable(24)) #0 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef nonnull align 8 dereferenceable(24) ptr @_ZNSt6vectorIS_IxSaIxEESaIS1_EEixEm(ptr noundef nonnull align 8 dereferenceable(24), i64 noundef) #0 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef i64 @_ZNKSt6vectorIxSaIxEE4sizeEv(ptr noundef nonnull align 8 dereferenceable(24)) #0 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) #6

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

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 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 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 #4 = { "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #5 = { inlinehint mustprogress nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #6 = { 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 #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 = !{!"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 = distinct !{!13, !14}
!14 = !{!"llvm.loop.mustprogress"}
!15 = !{!16, !16, i64 0}
!16 = !{!"bool", !7, i64 0}
!17 = !{i8 0, i8 2}
!18 = !{}
!19 = distinct !{!19, !14}
!20 = distinct !{!20, !14}
!21 = distinct !{!21, !14}
!22 = distinct !{!22, !14}
!23 = distinct !{!23, !14}
!24 = distinct !{!24, !14}
!25 = distinct !{!25, !14}


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

%"class.std::vector" = type { %"struct.std::_Vector_base" }
%"struct.std::_Vector_base" = type { %"struct.std::_Vector_base<std::pair<long long, long long>, std::allocator<std::pair<long long, long long>>>::_Vector_impl" }
%"struct.std::_Vector_base<std::pair<long long, long long>, std::allocator<std::pair<long long, long long>>>::_Vector_impl" = type { %"struct.std::_Vector_base<std::pair<long long, long long>, std::allocator<std::pair<long long, long long>>>::_Vector_impl_data" }
%"struct.std::_Vector_base<std::pair<long long, long long>, std::allocator<std::pair<long long, long long>>>::_Vector_impl_data" = type { ptr, ptr, ptr }
%"class.std::vector.0" = type { %"struct.std::_Vector_base.1" }
%"struct.std::_Vector_base.1" = type { %"struct.std::_Vector_base<std::vector<long long>, std::allocator<std::vector<long long>>>::_Vector_impl" }
%"struct.std::_Vector_base<std::vector<long long>, std::allocator<std::vector<long long>>>::_Vector_impl" = type { %"struct.std::_Vector_base<std::vector<long long>, std::allocator<std::vector<long long>>>::_Vector_impl_data" }
%"struct.std::_Vector_base<std::vector<long long>, std::allocator<std::vector<long long>>>::_Vector_impl_data" = type { ptr, ptr, ptr }
%"class.std::vector.5" = type { %"struct.std::_Vector_base.6" }
%"struct.std::_Vector_base.6" = type { %"struct.std::_Vector_base<long long, std::allocator<long long>>::_Vector_impl" }
%"struct.std::_Vector_base<long long, std::allocator<long long>>::_Vector_impl" = type { %"struct.std::_Vector_base<long long, std::allocator<long long>>::_Vector_impl_data" }
%"struct.std::_Vector_base<long long, std::allocator<long long>>::_Vector_impl_data" = type { ptr, ptr, ptr }
%"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" }
%"struct.std::pair" = type { i64, i64 }
%"class.__gnu_cxx::__normal_iterator.10" = type { ptr }

@MOD = external dso_local local_unnamed_addr global i64, align 8
@N = external dso_local global i64, align 8
@M = external dso_local global i64, align 8
@X = external dso_local global i64, align 8
@Y = external dso_local global i64, align 8
@K = external dso_local local_unnamed_addr global i64, align 8
@graph = external dso_local global [1500 x %"class.std::vector"], align 16
@len = external dso_local global %"class.std::vector.0", align 8
@curr = external dso_local global %"class.std::vector.5", align 8
@vis = external dso_local local_unnamed_addr global [1500 x i8], align 16
@starting = external dso_local global %"class.std::vector.5", align 8
@all_paths = external dso_local local_unnamed_addr global i64, align 8
@dp = external dso_local local_unnamed_addr global [2 x [2501 x i64]], align 16
@.str = external hidden unnamed_addr constant [14 x i8], align 1
@.str.5 = external hidden unnamed_addr constant [2 x i8], align 1
@stdin = external local_unnamed_addr global ptr, align 8
@.str.6 = external hidden unnamed_addr constant [15 x i8], align 1
@.str.7 = 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.8 = external hidden unnamed_addr constant [2 x i8], align 1

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef i64 @_Z4fexpxx(i64 noundef, i64 noundef) 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 uwtable
declare dso_local void @_Z7dfsfindx(i64 noundef) local_unnamed_addr #2

; Function Attrs: mustprogress uwtable
declare dso_local void @_Z3dfsxxxx(i64 noundef, i64 noundef, i64 noundef, i64 noundef) local_unnamed_addr #2

; Function Attrs: mustprogress norecurse uwtable
define dso_local noundef i32 @main() local_unnamed_addr #3 {
  %1 = alloca i64, align 8
  %2 = alloca i64, align 8
  %3 = alloca i64, align 8
  %4 = alloca %"struct.std::pair", align 8
  %5 = alloca i64, align 8
  %6 = alloca %"struct.std::pair", align 8
  %7 = alloca i64, align 8
  %8 = alloca %"class.__gnu_cxx::__normal_iterator.10", align 8
  %9 = alloca %"class.__gnu_cxx::__normal_iterator.10", align 8
  %10 = alloca %"class.__gnu_cxx::__normal_iterator.10", align 8
  %11 = alloca %"class.__gnu_cxx::__normal_iterator.10", align 8
  %12 = alloca %"class.__gnu_cxx::__normal_iterator.10", align 8
  %13 = alloca %"class.__gnu_cxx::__normal_iterator.10", align 8
  %14 = load ptr, ptr @stdin, align 8, !tbaa !5
  %15 = tail call ptr @freopen(ptr noundef nonnull @.str, ptr noundef nonnull @.str.5, ptr noundef %14)
  %16 = load ptr, ptr @stdout, align 8, !tbaa !5
  %17 = tail call ptr @freopen(ptr noundef nonnull @.str.6, ptr noundef nonnull @.str.7, ptr noundef %16)
  %18 = tail call noundef zeroext i1 @_ZNSt8ios_base15sync_with_stdioEb(i1 noundef zeroext false)
  %19 = load ptr, ptr @_ZSt3cin, align 8, !tbaa !9
  %20 = getelementptr i8, ptr %19, i64 -24
  %21 = load i64, ptr %20, align 8
  %22 = getelementptr inbounds i8, ptr @_ZSt3cin, i64 %21
  %23 = tail call noundef ptr @_ZNSt9basic_iosIcSt11char_traitsIcEE3tieEPSo(ptr noundef nonnull align 8 dereferenceable(264) %22, ptr noundef null)
  %24 = 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)
  %25 = tail call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERx(ptr noundef nonnull align 8 dereferenceable(16) %24, ptr noundef nonnull align 8 dereferenceable(8) @M)
  %26 = tail call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERx(ptr noundef nonnull align 8 dereferenceable(16) %25, ptr noundef nonnull align 8 dereferenceable(8) @X)
  %27 = tail call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERx(ptr noundef nonnull align 8 dereferenceable(16) %26, ptr noundef nonnull align 8 dereferenceable(8) @Y)
  %28 = load i64, ptr @M, align 8, !tbaa !11
  %29 = icmp sgt i64 %28, 0
  br i1 %29, label %.lr.ph, label %.preheader71

.preheader71:                                     ; preds = %.lr.ph, %0
  %30 = load i64, ptr @N, align 8, !tbaa !11
  %31 = icmp sgt i64 %30, 0
  br i1 %31, label %.lr.ph76, label %._crit_edge77

.lr.ph:                                           ; preds = %0, %.lr.ph
  %.05873 = phi i64 [ %45, %.lr.ph ], [ 0, %0 ]
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %1) #7
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %2) #7
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %3) #7
  %32 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERx(ptr noundef nonnull align 8 dereferenceable(16) @_ZSt3cin, ptr noundef nonnull align 8 dereferenceable(8) %1)
  %33 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERx(ptr noundef nonnull align 8 dereferenceable(16) %32, ptr noundef nonnull align 8 dereferenceable(8) %2)
  %34 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERx(ptr noundef nonnull align 8 dereferenceable(16) %33, ptr noundef nonnull align 8 dereferenceable(8) %3)
  %35 = load i64, ptr %1, align 8, !tbaa !11
  %36 = add nsw i64 %35, -1
  %37 = getelementptr inbounds [1500 x %"class.std::vector"], ptr @graph, i64 0, i64 %36
  call void @llvm.lifetime.start.p0(i64 16, ptr nonnull %4) #7
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %5) #7
  %38 = load i64, ptr %2, align 8, !tbaa !11
  %39 = add nsw i64 %38, -1
  store i64 %39, ptr %5, align 8, !tbaa !11
  call void @_ZNSt4pairIxxEC2IxRxTnNSt9enable_ifIXaaclsr5_PCCPE22_MoveConstructiblePairIT_T0_EEclsr5_PCCPE30_ImplicitlyMoveConvertiblePairIS4_S5_EEEbE4typeELb1EEEOS4_OS5_(ptr noundef nonnull align 8 dereferenceable(16) %4, ptr noundef nonnull align 8 dereferenceable(8) %5, ptr noundef nonnull align 8 dereferenceable(8) %3)
  call void @_ZNSt6vectorISt4pairIxxESaIS1_EE9push_backEOS1_(ptr noundef nonnull align 8 dereferenceable(24) %37, ptr noundef nonnull align 8 dereferenceable(16) %4)
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %5) #7
  call void @llvm.lifetime.end.p0(i64 16, ptr nonnull %4) #7
  %40 = load i64, ptr %2, align 8, !tbaa !11
  %41 = add nsw i64 %40, -1
  %42 = getelementptr inbounds [1500 x %"class.std::vector"], ptr @graph, i64 0, i64 %41
  call void @llvm.lifetime.start.p0(i64 16, ptr nonnull %6) #7
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %7) #7
  %43 = load i64, ptr %1, align 8, !tbaa !11
  %44 = add nsw i64 %43, -1
  store i64 %44, ptr %7, align 8, !tbaa !11
  call void @_ZNSt4pairIxxEC2IxRxTnNSt9enable_ifIXaaclsr5_PCCPE22_MoveConstructiblePairIT_T0_EEclsr5_PCCPE30_ImplicitlyMoveConvertiblePairIS4_S5_EEEbE4typeELb1EEEOS4_OS5_(ptr noundef nonnull align 8 dereferenceable(16) %6, ptr noundef nonnull align 8 dereferenceable(8) %7, ptr noundef nonnull align 8 dereferenceable(8) %3)
  call void @_ZNSt6vectorISt4pairIxxESaIS1_EE9push_backEOS1_(ptr noundef nonnull align 8 dereferenceable(24) %42, ptr noundef nonnull align 8 dereferenceable(16) %6)
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %7) #7
  call void @llvm.lifetime.end.p0(i64 16, ptr nonnull %6) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %3) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %2) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %1) #7
  %45 = add nuw nsw i64 %.05873, 1
  %46 = load i64, ptr @M, align 8, !tbaa !11
  %47 = icmp slt i64 %45, %46
  br i1 %47, label %.lr.ph, label %.preheader71, !llvm.loop !13

._crit_edge77:                                    ; preds = %64, %.preheader71
  %48 = call noundef i64 @_ZNKSt6vectorIS_IxSaIxEESaIS1_EE4sizeEv(ptr noundef nonnull align 8 dereferenceable(24) @len) #7
  store i64 %48, ptr @K, align 8, !tbaa !11
  %49 = icmp sgt i64 %48, 0
  br i1 %49, label %.lr.ph81, label %._crit_edge77.._crit_edge82_crit_edge

._crit_edge77.._crit_edge82_crit_edge:            ; preds = %._crit_edge77
  %.pre121 = load i64, ptr @MOD, align 8, !tbaa !11
  br label %._crit_edge82

.lr.ph76:                                         ; preds = %.preheader71, %64
  %50 = phi i64 [ %65, %64 ], [ %30, %.preheader71 ]
  %.06075 = phi i64 [ %66, %64 ], [ 0, %.preheader71 ]
  %51 = getelementptr inbounds [1500 x i8], ptr @vis, i64 0, i64 %.06075
  %52 = load i8, ptr %51, align 1, !tbaa !15, !range !17, !noundef !18
  %53 = trunc nuw i8 %52 to i1
  br i1 %53, label %64, label %54

54:                                               ; preds = %.lr.ph76
  call void @_ZNSt6vectorIxSaIxEE5clearEv(ptr noundef nonnull align 8 dereferenceable(24) @starting) #7
  call void @_ZNSt6vectorIxSaIxEE5clearEv(ptr noundef nonnull align 8 dereferenceable(24) @curr) #7
  call void @_Z7dfsfindx(i64 noundef %.06075)
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %8) #7
  %55 = call ptr @_ZNSt6vectorIxSaIxEE5beginEv(ptr noundef nonnull align 8 dereferenceable(24) @starting) #7
  store ptr %55, ptr %8, align 8
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %9) #7
  %56 = call ptr @_ZNSt6vectorIxSaIxEE3endEv(ptr noundef nonnull align 8 dereferenceable(24) @starting) #7
  store ptr %56, ptr %9, align 8
  %57 = call noundef zeroext i1 @_ZN9__gnu_cxxneIPxSt6vectorIxSaIxEEEEbRKNS_17__normal_iteratorIT_T0_EESA_(ptr noundef nonnull align 8 dereferenceable(8) %8, ptr noundef nonnull align 8 dereferenceable(8) %9) #7
  br i1 %57, label %.lr.ph74, label %._crit_edge

._crit_edge:                                      ; preds = %.lr.ph74, %54
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %9) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %8) #7
  %58 = call ptr @_ZNSt6vectorIxSaIxEE5beginEv(ptr noundef nonnull align 8 dereferenceable(24) @curr) #7
  %59 = call ptr @_ZNSt6vectorIxSaIxEE3endEv(ptr noundef nonnull align 8 dereferenceable(24) @curr) #7
  call void @_ZSt4sortIN9__gnu_cxx17__normal_iteratorIPxSt6vectorIxSaIxEEEEEvT_S7_(ptr %58, ptr %59)
  call void @_ZNSt6vectorIS_IxSaIxEESaIS1_EE9push_backERKS1_(ptr noundef nonnull align 8 dereferenceable(24) @len, ptr noundef nonnull align 8 dereferenceable(24) @curr)
  %.pre = load i64, ptr @N, align 8, !tbaa !11
  br label %64

.lr.ph74:                                         ; preds = %54, %.lr.ph74
  %60 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNK9__gnu_cxx17__normal_iteratorIPxSt6vectorIxSaIxEEEdeEv(ptr noundef nonnull align 8 dereferenceable(8) %8) #7
  %61 = load i64, ptr %60, align 8, !tbaa !11
  call void @_Z3dfsxxxx(i64 noundef %61, i64 noundef %61, i64 noundef -1, i64 noundef 0)
  %62 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZN9__gnu_cxx17__normal_iteratorIPxSt6vectorIxSaIxEEEppEv(ptr noundef nonnull align 8 dereferenceable(8) %8) #7
  %63 = call noundef zeroext i1 @_ZN9__gnu_cxxneIPxSt6vectorIxSaIxEEEEbRKNS_17__normal_iteratorIT_T0_EESA_(ptr noundef nonnull align 8 dereferenceable(8) %8, ptr noundef nonnull align 8 dereferenceable(8) %9) #7
  br i1 %63, label %.lr.ph74, label %._crit_edge

64:                                               ; preds = %.lr.ph76, %._crit_edge
  %65 = phi i64 [ %50, %.lr.ph76 ], [ %.pre, %._crit_edge ]
  %66 = add nuw nsw i64 %.06075, 1
  %67 = icmp slt i64 %66, %65
  br i1 %67, label %.lr.ph76, label %._crit_edge77, !llvm.loop !19

._crit_edge82:                                    ; preds = %.lr.ph81, %._crit_edge77.._crit_edge82_crit_edge
  %68 = phi i64 [ %.pre121, %._crit_edge77.._crit_edge82_crit_edge ], [ %79, %.lr.ph81 ]
  %.063.lcssa = phi i64 [ 1, %._crit_edge77.._crit_edge82_crit_edge ], [ %80, %.lr.ph81 ]
  %69 = phi i64 [ %48, %._crit_edge77.._crit_edge82_crit_edge ], [ %82, %.lr.ph81 ]
  %70 = load i64, ptr @X, align 8, !tbaa !11
  %71 = mul nsw i64 %70, %.063.lcssa
  %72 = srem i64 %71, %68
  %73 = mul nsw i64 %72, %69
  %74 = srem i64 %73, %68
  store i64 %74, ptr @all_paths, align 8, !tbaa !11
  %75 = icmp sgt i64 %69, 0
  br i1 %75, label %.lr.ph89, label %._crit_edge90.thread

._crit_edge90.thread:                             ; preds = %._crit_edge82
  store i64 1, ptr getelementptr inbounds (i8, ptr @dp, i64 20008), align 8, !tbaa !11
  %.pre124126 = load i64, ptr @Y, align 8, !tbaa !11
  br label %._crit_edge102

.lr.ph81:                                         ; preds = %._crit_edge77, %.lr.ph81
  %.06379 = phi i64 [ %80, %.lr.ph81 ], [ 1, %._crit_edge77 ]
  %.06478 = phi i64 [ %81, %.lr.ph81 ], [ 0, %._crit_edge77 ]
  %76 = call noundef nonnull align 8 dereferenceable(24) ptr @_ZNSt6vectorIS_IxSaIxEESaIS1_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) @len, i64 noundef %.06478) #7
  %77 = call noundef i64 @_ZNKSt6vectorIxSaIxEE4sizeEv(ptr noundef nonnull align 8 dereferenceable(24) %76) #7
  %78 = mul i64 %77, %.06379
  %79 = load i64, ptr @MOD, align 8, !tbaa !11
  %80 = urem i64 %78, %79
  %81 = add nuw nsw i64 %.06478, 1
  %82 = load i64, ptr @K, align 8, !tbaa !11
  %83 = icmp slt i64 %81, %82
  br i1 %83, label %.lr.ph81, label %._crit_edge82, !llvm.loop !20

._crit_edge90:                                    ; preds = %._crit_edge86
  store i64 1, ptr getelementptr inbounds (i8, ptr @dp, i64 20008), align 8, !tbaa !11
  %84 = icmp sgt i64 %100, 0
  %.pre124 = load i64, ptr @Y, align 8, !tbaa !11
  br i1 %84, label %.lr.ph101, label %._crit_edge102

.lr.ph101:                                        ; preds = %._crit_edge90
  %85 = icmp sgt i64 %.pre124, 0
  br i1 %85, label %.lr.ph101.split, label %._crit_edge102.thread

._crit_edge102.thread:                            ; preds = %.lr.ph101
  %86 = load i64, ptr @all_paths, align 8, !tbaa !11
  %.pre125.pre128 = load i64, ptr @MOD, align 8, !tbaa !11
  br label %.preheader

.lr.ph89:                                         ; preds = %._crit_edge82, %._crit_edge86
  %.06587 = phi i64 [ %99, %._crit_edge86 ], [ 0, %._crit_edge82 ]
  %87 = call noundef nonnull align 8 dereferenceable(24) ptr @_ZNSt6vectorIS_IxSaIxEESaIS1_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) @len, i64 noundef %.06587) #7
  %88 = call noundef i64 @_ZNKSt6vectorIxSaIxEE4sizeEv(ptr noundef nonnull align 8 dereferenceable(24) %87) #7
  %89 = load i64, ptr @MOD, align 8, !tbaa !11
  %90 = add nsw i64 %89, -2
  %91 = call noundef i64 @_Z4fexpxx(i64 noundef %88, i64 noundef %90)
  %92 = mul nsw i64 %91, %.063.lcssa
  %93 = load i64, ptr @MOD, align 8, !tbaa !11
  %94 = srem i64 %92, %93
  %95 = call noundef nonnull align 8 dereferenceable(24) ptr @_ZNSt6vectorIS_IxSaIxEESaIS1_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) @len, i64 noundef %.06587) #7
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %10) #7
  %96 = call ptr @_ZNSt6vectorIxSaIxEE5beginEv(ptr noundef nonnull align 8 dereferenceable(24) %95) #7
  store ptr %96, ptr %10, align 8
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %11) #7
  %97 = call ptr @_ZNSt6vectorIxSaIxEE3endEv(ptr noundef nonnull align 8 dereferenceable(24) %95) #7
  store ptr %97, ptr %11, align 8
  %98 = call noundef zeroext i1 @_ZN9__gnu_cxxneIPxSt6vectorIxSaIxEEEEbRKNS_17__normal_iteratorIT_T0_EESA_(ptr noundef nonnull align 8 dereferenceable(8) %10, ptr noundef nonnull align 8 dereferenceable(8) %11) #7
  br i1 %98, label %.lr.ph85, label %._crit_edge86

._crit_edge86:                                    ; preds = %.lr.ph85, %.lr.ph89
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %11) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %10) #7
  %99 = add nuw nsw i64 %.06587, 1
  %100 = load i64, ptr @K, align 8, !tbaa !11
  %101 = icmp slt i64 %99, %100
  br i1 %101, label %.lr.ph89, label %._crit_edge90, !llvm.loop !21

.lr.ph85:                                         ; preds = %.lr.ph89, %.lr.ph85
  %102 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNK9__gnu_cxx17__normal_iteratorIPxSt6vectorIxSaIxEEEdeEv(ptr noundef nonnull align 8 dereferenceable(8) %10) #7
  %103 = load i64, ptr %102, align 8, !tbaa !11
  %104 = load i64, ptr @all_paths, align 8, !tbaa !11
  %105 = mul nsw i64 %103, %94
  %106 = add nsw i64 %104, %105
  %107 = load i64, ptr @MOD, align 8, !tbaa !11
  %108 = srem i64 %106, %107
  store i64 %108, ptr @all_paths, align 8, !tbaa !11
  %109 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZN9__gnu_cxx17__normal_iteratorIPxSt6vectorIxSaIxEEEppEv(ptr noundef nonnull align 8 dereferenceable(8) %10) #7
  %110 = call noundef zeroext i1 @_ZN9__gnu_cxxneIPxSt6vectorIxSaIxEEEEbRKNS_17__normal_iteratorIT_T0_EESA_(ptr noundef nonnull align 8 dereferenceable(8) %10, ptr noundef nonnull align 8 dereferenceable(8) %11) #7
  br i1 %110, label %.lr.ph85, label %._crit_edge86

._crit_edge102:                                   ; preds = %._crit_edge98, %._crit_edge90.thread, %._crit_edge90
  %111 = phi i64 [ %.pre124, %._crit_edge90 ], [ %.pre124126, %._crit_edge90.thread ], [ %.pr, %._crit_edge98 ]
  %.lcssa = phi i64 [ %100, %._crit_edge90 ], [ %69, %._crit_edge90.thread ], [ %121, %._crit_edge98 ]
  %112 = load i64, ptr @all_paths, align 8, !tbaa !11
  %113 = icmp sgt i64 %111, 0
  %.pre125.pre = load i64, ptr @MOD, align 8, !tbaa !11
  br i1 %113, label %.lr.ph107, label %.preheader

.lr.ph107:                                        ; preds = %._crit_edge102
  %114 = add nsw i64 %.lcssa, -1
  %115 = srem i64 %114, 2
  br label %149

.lr.ph101.split:                                  ; preds = %.lr.ph101, %._crit_edge98
  %116 = phi i64 [ %.pr, %._crit_edge98 ], [ %.pre124, %.lr.ph101 ]
  %117 = phi i64 [ %121, %._crit_edge98 ], [ %100, %.lr.ph101 ]
  %.06299 = phi i64 [ %122, %._crit_edge98 ], [ 0, %.lr.ph101 ]
  %118 = and i64 %.06299, 1
  %119 = xor i64 %118, 1
  %120 = icmp sgt i64 %116, 0
  br i1 %120, label %.lr.ph97, label %._crit_edge98

._crit_edge98.loopexit:                           ; preds = %.critedge
  %.pre122 = load i64, ptr @K, align 8, !tbaa !11
  br label %._crit_edge98

._crit_edge98:                                    ; preds = %._crit_edge98.loopexit, %.lr.ph101.split
  %121 = phi i64 [ %.pre122, %._crit_edge98.loopexit ], [ %117, %.lr.ph101.split ]
  %122 = add nuw nsw i64 %.06299, 1
  %123 = icmp slt i64 %122, %121
  %.pr = load i64, ptr @Y, align 8, !tbaa !11
  br i1 %123, label %.lr.ph101.split, label %._crit_edge102, !llvm.loop !22

.lr.ph97:                                         ; preds = %.lr.ph101.split, %.critedge
  %.05995.in = phi i64 [ %.05995, %.critedge ], [ %116, %.lr.ph101.split ]
  %.05995 = add nsw i64 %.05995.in, -1
  %124 = getelementptr inbounds [2 x [2501 x i64]], ptr @dp, i64 0, i64 %118, i64 %.05995
  store i64 0, ptr %124, align 8, !tbaa !11
  %125 = call noundef nonnull align 8 dereferenceable(24) ptr @_ZNSt6vectorIS_IxSaIxEESaIS1_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) @len, i64 noundef %.06299) #7
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %12) #7
  %126 = call ptr @_ZNSt6vectorIxSaIxEE5beginEv(ptr noundef nonnull align 8 dereferenceable(24) %125) #7
  store ptr %126, ptr %12, align 8
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %13) #7
  %127 = call ptr @_ZNSt6vectorIxSaIxEE3endEv(ptr noundef nonnull align 8 dereferenceable(24) %125) #7
  store ptr %127, ptr %13, align 8
  %128 = call noundef zeroext i1 @_ZN9__gnu_cxxneIPxSt6vectorIxSaIxEEEEbRKNS_17__normal_iteratorIT_T0_EESA_(ptr noundef nonnull align 8 dereferenceable(8) %12, ptr noundef nonnull align 8 dereferenceable(8) %13) #7
  br i1 %128, label %.lr.ph92, label %.critedge

.lr.ph92:                                         ; preds = %.lr.ph97, %135
  %129 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNK9__gnu_cxx17__normal_iteratorIPxSt6vectorIxSaIxEEEdeEv(ptr noundef nonnull align 8 dereferenceable(8) %12) #7
  %130 = load i64, ptr %129, align 8, !tbaa !11
  %131 = load i64, ptr @X, align 8, !tbaa !11
  %132 = add i64 %130, %131
  %133 = sub i64 %.05995, %132
  %134 = icmp sgt i64 %133, -1
  br i1 %134, label %135, label %.critedge

135:                                              ; preds = %.lr.ph92
  %136 = load i64, ptr %124, align 8, !tbaa !11
  %137 = getelementptr inbounds [2 x [2501 x i64]], ptr @dp, i64 0, i64 %119, i64 %133
  %138 = load i64, ptr %137, align 8, !tbaa !11
  %139 = add nsw i64 %138, %136
  %140 = load i64, ptr @MOD, align 8, !tbaa !11
  %141 = srem i64 %139, %140
  store i64 %141, ptr %124, align 8, !tbaa !11
  %142 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZN9__gnu_cxx17__normal_iteratorIPxSt6vectorIxSaIxEEEppEv(ptr noundef nonnull align 8 dereferenceable(8) %12) #7
  %143 = call noundef zeroext i1 @_ZN9__gnu_cxxneIPxSt6vectorIxSaIxEEEEbRKNS_17__normal_iteratorIT_T0_EESA_(ptr noundef nonnull align 8 dereferenceable(8) %12, ptr noundef nonnull align 8 dereferenceable(8) %13) #7
  br i1 %143, label %.lr.ph92, label %.critedge

.critedge:                                        ; preds = %135, %.lr.ph92, %.lr.ph97
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %13) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %12) #7
  %144 = icmp sgt i64 %.05995.in, 1
  br i1 %144, label %.lr.ph97, label %._crit_edge98.loopexit, !llvm.loop !24

.preheader:                                       ; preds = %149, %._crit_edge102.thread, %._crit_edge102
  %.pre125.pre130 = phi i64 [ %.pre125.pre, %._crit_edge102 ], [ %.pre125.pre128, %._crit_edge102.thread ], [ %.pre125.pre, %149 ]
  %.lcssa129 = phi i64 [ %.lcssa, %._crit_edge102 ], [ %100, %._crit_edge102.thread ], [ %.lcssa, %149 ]
  %.057.lcssa = phi i64 [ %112, %._crit_edge102 ], [ %86, %._crit_edge102.thread ], [ %156, %149 ]
  %145 = icmp sgt i64 %.lcssa129, 1
  br i1 %145, label %.lr.ph111.preheader, label %._crit_edge112

.lr.ph111.preheader:                              ; preds = %.preheader
  %146 = add nsw i64 %.lcssa129, -1
  %147 = add nsw i64 %.lcssa129, -2
  %xtraiter = and i64 %146, 3
  %148 = icmp ult i64 %147, 3
  br i1 %148, label %._crit_edge112.loopexit.unr-lcssa, label %.lr.ph111.preheader.new

.lr.ph111.preheader.new:                          ; preds = %.lr.ph111.preheader
  %unroll_iter = and i64 %146, -4
  br label %.lr.ph111

149:                                              ; preds = %.lr.ph107, %149
  %.056105 = phi i64 [ 0, %.lr.ph107 ], [ %157, %149 ]
  %.057104 = phi i64 [ %112, %.lr.ph107 ], [ %156, %149 ]
  %150 = getelementptr inbounds [2 x [2501 x i64]], ptr @dp, i64 0, i64 %115, i64 %.056105
  %151 = load i64, ptr %150, align 8, !tbaa !11
  %152 = mul nsw i64 %151, %.056105
  %153 = srem i64 %152, %.pre125.pre
  %154 = add i64 %.pre125.pre, %.057104
  %155 = sub i64 %154, %153
  %156 = srem i64 %155, %.pre125.pre
  %157 = add nuw nsw i64 %.056105, 1
  %exitcond.not = icmp eq i64 %157, %111
  br i1 %exitcond.not, label %.preheader, label %149, !llvm.loop !25

._crit_edge112.loopexit.unr-lcssa:                ; preds = %.lr.ph111, %.lr.ph111.preheader
  %.lcssa145.ph = phi i64 [ poison, %.lr.ph111.preheader ], [ %180, %.lr.ph111 ]
  %.0110.unr = phi i64 [ 1, %.lr.ph111.preheader ], [ %181, %.lr.ph111 ]
  %.055109.unr = phi i64 [ 1, %.lr.ph111.preheader ], [ %180, %.lr.ph111 ]
  %lcmp.mod.not = icmp eq i64 %xtraiter, 0
  br i1 %lcmp.mod.not, label %._crit_edge112, label %.lr.ph111.epil

.lr.ph111.epil:                                   ; preds = %._crit_edge112.loopexit.unr-lcssa, %.lr.ph111.epil
  %.0110.epil = phi i64 [ %160, %.lr.ph111.epil ], [ %.0110.unr, %._crit_edge112.loopexit.unr-lcssa ]
  %.055109.epil = phi i64 [ %159, %.lr.ph111.epil ], [ %.055109.unr, %._crit_edge112.loopexit.unr-lcssa ]
  %epil.iter = phi i64 [ %epil.iter.next, %.lr.ph111.epil ], [ 0, %._crit_edge112.loopexit.unr-lcssa ]
  %158 = mul nsw i64 %.0110.epil, %.055109.epil
  %159 = srem i64 %158, %.pre125.pre130
  %160 = add nuw nsw i64 %.0110.epil, 1
  %epil.iter.next = add i64 %epil.iter, 1
  %epil.iter.cmp.not = icmp eq i64 %epil.iter.next, %xtraiter
  br i1 %epil.iter.cmp.not, label %._crit_edge112, label %.lr.ph111.epil, !llvm.loop !26

._crit_edge112:                                   ; preds = %._crit_edge112.loopexit.unr-lcssa, %.lr.ph111.epil, %.preheader
  %.055.lcssa = phi i64 [ 1, %.preheader ], [ %.lcssa145.ph, %._crit_edge112.loopexit.unr-lcssa ], [ %159, %.lr.ph111.epil ]
  %161 = mul nsw i64 %.055.lcssa, %.057.lcssa
  %162 = srem i64 %161, %.pre125.pre130
  %163 = add nsw i64 %.pre125.pre130, -2
  %164 = call noundef i64 @_Z4fexpxx(i64 noundef 2, i64 noundef %163)
  %165 = mul nsw i64 %164, %162
  %166 = load i64, ptr @MOD, align 8, !tbaa !11
  %167 = srem i64 %165, %166
  %168 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEx(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cout, i64 noundef %167)
  %169 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc(ptr noundef nonnull align 8 dereferenceable(8) %168, ptr noundef nonnull @.str.8)
  ret i32 0

.lr.ph111:                                        ; preds = %.lr.ph111, %.lr.ph111.preheader.new
  %.0110 = phi i64 [ 1, %.lr.ph111.preheader.new ], [ %181, %.lr.ph111 ]
  %.055109 = phi i64 [ 1, %.lr.ph111.preheader.new ], [ %180, %.lr.ph111 ]
  %niter = phi i64 [ 0, %.lr.ph111.preheader.new ], [ %niter.next.3, %.lr.ph111 ]
  %170 = mul nsw i64 %.0110, %.055109
  %171 = srem i64 %170, %.pre125.pre130
  %172 = add nuw nsw i64 %.0110, 1
  %173 = mul nsw i64 %172, %171
  %174 = srem i64 %173, %.pre125.pre130
  %175 = add nuw nsw i64 %.0110, 2
  %176 = mul nsw i64 %175, %174
  %177 = srem i64 %176, %.pre125.pre130
  %178 = add nuw nsw i64 %.0110, 3
  %179 = mul nsw i64 %178, %177
  %180 = srem i64 %179, %.pre125.pre130
  %181 = add nuw nsw i64 %.0110, 4
  %niter.next.3 = add i64 %niter, 4
  %niter.ncmp.3 = icmp eq i64 %niter.next.3, %unroll_iter
  br i1 %niter.ncmp.3, label %._crit_edge112.loopexit.unr-lcssa, label %.lr.ph111, !llvm.loop !28
}

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

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

; Function Attrs: mustprogress nounwind uwtable
declare noundef ptr @_ZNSt9basic_iosIcSt11char_traitsIcEE3tieEPSo(ptr noundef nonnull align 8 dereferenceable(264), ptr noundef) local_unnamed_addr #0 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 #2 align 2

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZNSt6vectorISt4pairIxxESaIS1_EE9push_backEOS1_(ptr noundef nonnull align 8 dereferenceable(24), ptr noundef nonnull align 8 dereferenceable(16)) local_unnamed_addr #2 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZNSt4pairIxxEC2IxRxTnNSt9enable_ifIXaaclsr5_PCCPE22_MoveConstructiblePairIT_T0_EEclsr5_PCCPE30_ImplicitlyMoveConvertiblePairIS4_S5_EEEbE4typeELb1EEEOS4_OS5_(ptr noundef nonnull align 8 dereferenceable(16), ptr noundef nonnull align 8 dereferenceable(8), ptr noundef nonnull align 8 dereferenceable(8)) unnamed_addr #0 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local void @_ZNSt6vectorIxSaIxEE5clearEv(ptr noundef nonnull align 8 dereferenceable(24)) local_unnamed_addr #0 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local ptr @_ZNSt6vectorIxSaIxEE5beginEv(ptr noundef nonnull align 8 dereferenceable(24)) local_unnamed_addr #0 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local ptr @_ZNSt6vectorIxSaIxEE3endEv(ptr noundef nonnull align 8 dereferenceable(24)) local_unnamed_addr #0 align 2

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef zeroext i1 @_ZN9__gnu_cxxneIPxSt6vectorIxSaIxEEEEbRKNS_17__normal_iteratorIT_T0_EESA_(ptr noundef nonnull align 8 dereferenceable(8), ptr noundef nonnull align 8 dereferenceable(8)) local_unnamed_addr #5

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef nonnull align 8 dereferenceable(8) ptr @_ZNK9__gnu_cxx17__normal_iteratorIPxSt6vectorIxSaIxEEEdeEv(ptr noundef nonnull align 8 dereferenceable(8)) local_unnamed_addr #0 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef nonnull align 8 dereferenceable(8) ptr @_ZN9__gnu_cxx17__normal_iteratorIPxSt6vectorIxSaIxEEEppEv(ptr noundef nonnull align 8 dereferenceable(8)) local_unnamed_addr #0 align 2

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local void @_ZSt4sortIN9__gnu_cxx17__normal_iteratorIPxSt6vectorIxSaIxEEEEEvT_S7_(ptr, ptr) local_unnamed_addr #6

; Function Attrs: mustprogress uwtable
declare dso_local void @_ZNSt6vectorIS_IxSaIxEESaIS1_EE9push_backERKS1_(ptr noundef nonnull align 8 dereferenceable(24), ptr noundef nonnull align 8 dereferenceable(24)) local_unnamed_addr #2 align 2

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef i64 @_ZNKSt6vectorIS_IxSaIxEESaIS1_EE4sizeEv(ptr noundef nonnull align 8 dereferenceable(24)) local_unnamed_addr #0 align 2

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

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef i64 @_ZNKSt6vectorIxSaIxEE4sizeEv(ptr noundef nonnull align 8 dereferenceable(24)) local_unnamed_addr #0 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 #6

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

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 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 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 #4 = { "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #5 = { inlinehint mustprogress nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #6 = { 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 #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 = !{!"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 = distinct !{!13, !14}
!14 = !{!"llvm.loop.mustprogress"}
!15 = !{!16, !16, i64 0}
!16 = !{!"bool", !7, i64 0}
!17 = !{i8 0, i8 2}
!18 = !{}
!19 = distinct !{!19, !14}
!20 = distinct !{!20, !14}
!21 = distinct !{!21, !14}
!22 = distinct !{!22, !14, !23}
!23 = !{!"llvm.loop.unswitch.partial.disable"}
!24 = distinct !{!24, !14}
!25 = distinct !{!25, !14}
!26 = distinct !{!26, !27}
!27 = !{!"llvm.loop.unroll.disable"}
!28 = distinct !{!28, !14}


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