; LLVM IR from VastoLorde95/Competitive-Programming :: CodeChef/LONG/FEB15/CHEFGRPH (grph)

; 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::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.0" = type { %"struct.std::_Vector_base.1" }
%"struct.std::_Vector_base.1" = 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::map" = type { %"class.std::_Rb_tree" }
%"class.std::_Rb_tree" = type { %"struct.std::_Rb_tree<long long, std::pair<const long long, long long>, std::_Select1st<std::pair<const long long, long long>>, std::less<long long>>::_Rb_tree_impl" }
%"struct.std::_Rb_tree<long long, std::pair<const long long, long long>, std::_Select1st<std::pair<const long long, long long>>, std::less<long long>>::_Rb_tree_impl" = type { [8 x i8], %"struct.std::_Rb_tree_header" }
%"struct.std::_Rb_tree_header" = type { %"struct.std::_Rb_tree_node_base", i64 }
%"struct.std::_Rb_tree_node_base" = type { i32, ptr, ptr, ptr }
%"class.std::map.8" = type { %"class.std::_Rb_tree.9" }
%"class.std::_Rb_tree.9" = type { %"struct.std::_Rb_tree<std::pair<long long, long long>, std::pair<const std::pair<long long, long long>, long long>, std::_Select1st<std::pair<const std::pair<long long, long long>, long long>>, std::less<std::pair<long long, long long>>>::_Rb_tree_impl" }
%"struct.std::_Rb_tree<std::pair<long long, long long>, std::pair<const std::pair<long long, long long>, long long>, std::_Select1st<std::pair<const std::pair<long long, long long>, long long>>, std::less<std::pair<long long, long long>>>::_Rb_tree_impl" = type { [8 x i8], %"struct.std::_Rb_tree_header" }
%"struct.std::_Rb_tree_iterator" = type { ptr }
%"class.std::basic_ostream" = type { ptr, %"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.__gnu_cxx::__normal_iterator" = type { ptr }
%"struct.std::pair" = type { i64, i64 }
%"struct.std::_Rb_tree_iterator.14" = type { ptr }
%"struct.std::pair.15" = type { i64, i64 }

@n = external dso_local global i64, align 8
@m = external dso_local global i64, align 8
@MOD = external dso_local global i64, align 8
@res = external dso_local global i64, align 8
@a = external dso_local global i64, align 8
@b = external dso_local global i64, align 8
@c = external dso_local global i64, align 8
@d = external dso_local global i64, align 8
@temp = external dso_local global i64, align 8
@t = external dso_local global %"class.std::vector", align 8
@x = external dso_local global %"class.std::vector.0", align 8
@ways = external dso_local global %"class.std::map", align 8
@spec_v = external dso_local global %"class.std::map.8", align 8
@it = external dso_local global %"struct.std::_Rb_tree_iterator", align 8
@k = external dso_local global i32, align 4
@.str = external hidden unnamed_addr constant [11 x i8], align 1
@.str.6 = external hidden unnamed_addr constant [17 x i8], align 1
@_ZSt4cout = external global %"class.std::basic_ostream", align 8

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef i64 @_Z3expxx(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 norecurse uwtable
define dso_local noundef i32 @main() #2 {
  %1 = alloca i32, align 4
  %2 = alloca i32, align 4
  %3 = alloca %"class.__gnu_cxx::__normal_iterator", align 8
  %4 = alloca %"class.__gnu_cxx::__normal_iterator", align 8
  %5 = alloca %"struct.std::pair", align 8
  %6 = alloca i32, align 4
  %7 = alloca i64, align 8
  %8 = alloca i64, align 8
  %9 = alloca %"struct.std::_Rb_tree_iterator.14", align 8
  %10 = alloca %"struct.std::pair", align 8
  %11 = alloca %"struct.std::_Rb_tree_iterator.14", align 8
  %12 = alloca %"struct.std::pair", align 8
  %13 = alloca %"struct.std::_Rb_tree_iterator", align 8
  %14 = alloca %"struct.std::_Rb_tree_iterator", align 8
  %15 = alloca %"struct.std::_Rb_tree_iterator", align 8
  %16 = alloca i64, align 8
  %17 = alloca %"struct.std::_Rb_tree_iterator", align 8
  %18 = alloca %"struct.std::_Rb_tree_iterator", align 8
  %19 = alloca %"struct.std::_Rb_tree_iterator", align 8
  %20 = alloca %"struct.std::_Rb_tree_iterator", align 8
  %21 = alloca %"struct.std::_Rb_tree_iterator", align 8
  %22 = alloca %"struct.std::_Rb_tree_iterator.14", align 8
  %23 = alloca %"struct.std::pair", align 8
  %24 = alloca %"struct.std::_Rb_tree_iterator.14", align 8
  %25 = alloca %"struct.std::pair", align 8
  %26 = alloca %"struct.std::pair", align 8
  %27 = alloca %"struct.std::pair", align 8
  %28 = alloca %"struct.std::_Rb_tree_iterator", align 8
  %29 = alloca %"struct.std::_Rb_tree_iterator", align 8
  store i32 0, ptr %1, align 4
  %30 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef @.str, ptr noundef @n, ptr noundef @m, ptr noundef @k)
  %31 = load i64, ptr @m, align 8, !tbaa !5
  %32 = load i64, ptr @n, align 8, !tbaa !5
  %33 = call noundef i64 @_Z3expxx(i64 noundef %31, i64 noundef %32)
  store i64 %33, ptr @res, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %2) #7
  store i32 0, ptr %2, align 4, !tbaa !9
  br label %34

34:                                               ; preds = %41, %0
  %35 = load i32, ptr %2, align 4, !tbaa !9
  %36 = load i32, ptr @k, align 4, !tbaa !9
  %37 = icmp slt i32 %35, %36
  br i1 %37, label %39, label %38

38:                                               ; preds = %34
  call void @llvm.lifetime.end.p0(i64 4, ptr %2) #7
  br label %44

39:                                               ; preds = %34
  %40 = call i32 (ptr, ...) @__isoc99_scanf(ptr noundef @.str.6, ptr noundef @a, ptr noundef @b, ptr noundef @c, ptr noundef @d)
  call void @_ZNSt6vectorIxSaIxEE5clearEv(ptr noundef nonnull align 8 dereferenceable(24) @x) #7
  call void @_ZNSt6vectorIxSaIxEE9push_backERKx(ptr noundef nonnull align 8 dereferenceable(24) @x, ptr noundef nonnull align 8 dereferenceable(8) @c)
  call void @_ZNSt6vectorIxSaIxEE9push_backERKx(ptr noundef nonnull align 8 dereferenceable(24) @x, ptr noundef nonnull align 8 dereferenceable(8) @a)
  call void @_ZNSt6vectorIxSaIxEE9push_backERKx(ptr noundef nonnull align 8 dereferenceable(24) @x, ptr noundef nonnull align 8 dereferenceable(8) @d)
  call void @_ZNSt6vectorIxSaIxEE9push_backERKx(ptr noundef nonnull align 8 dereferenceable(24) @x, ptr noundef nonnull align 8 dereferenceable(8) @b)
  call void @_ZNSt6vectorIS_IxSaIxEESaIS1_EE9push_backERKS1_(ptr noundef nonnull align 8 dereferenceable(24) @t, ptr noundef nonnull align 8 dereferenceable(24) @x)
  br label %41

41:                                               ; preds = %39
  %42 = load i32, ptr %2, align 4, !tbaa !9
  %43 = add nsw i32 %42, 1
  store i32 %43, ptr %2, align 4, !tbaa !9
  br label %34, !llvm.loop !11

44:                                               ; preds = %38
  %45 = call ptr @_ZNSt6vectorIS_IxSaIxEESaIS1_EE5beginEv(ptr noundef nonnull align 8 dereferenceable(24) @t) #7
  %46 = getelementptr inbounds %"class.__gnu_cxx::__normal_iterator", ptr %3, i32 0, i32 0
  store ptr %45, ptr %46, align 8
  %47 = call ptr @_ZNSt6vectorIS_IxSaIxEESaIS1_EE3endEv(ptr noundef nonnull align 8 dereferenceable(24) @t) #7
  %48 = getelementptr inbounds %"class.__gnu_cxx::__normal_iterator", ptr %4, i32 0, i32 0
  store ptr %47, ptr %48, align 8
  %49 = getelementptr inbounds %"class.__gnu_cxx::__normal_iterator", ptr %3, i32 0, i32 0
  %50 = load ptr, ptr %49, align 8
  %51 = getelementptr inbounds %"class.__gnu_cxx::__normal_iterator", ptr %4, i32 0, i32 0
  %52 = load ptr, ptr %51, align 8
  call void @_ZSt4sortIN9__gnu_cxx17__normal_iteratorIPSt6vectorIxSaIxEES2_IS4_SaIS4_EEEEEvT_S9_(ptr %50, ptr %52)
  %53 = load i32, ptr @k, align 4, !tbaa !9
  %54 = icmp sgt i32 %53, 0
  br i1 %54, label %55, label %352

55:                                               ; preds = %44
  %56 = load i64, ptr @m, align 8, !tbaa !5
  %57 = call noundef nonnull align 8 dereferenceable(24) ptr @_ZNSt6vectorIS_IxSaIxEESaIS1_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) @t, i64 noundef 0) #7
  %58 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSt6vectorIxSaIxEEixEm(ptr noundef nonnull align 8 dereferenceable(24) %57, i64 noundef 1) #7
  %59 = load i64, ptr %58, align 8, !tbaa !5
  %60 = sub nsw i64 %59, 1
  %61 = call noundef i64 @_Z3expxx(i64 noundef %56, i64 noundef %60)
  store i64 %61, ptr @temp, align 8, !tbaa !5
  %62 = load i64, ptr @temp, align 8, !tbaa !5
  %63 = call noundef nonnull align 8 dereferenceable(24) ptr @_ZNSt6vectorIS_IxSaIxEESaIS1_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) @t, i64 noundef 0) #7
  %64 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSt6vectorIxSaIxEEixEm(ptr noundef nonnull align 8 dereferenceable(24) %63, i64 noundef 0) #7
  %65 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSt3mapIxxSt4lessIxESaISt4pairIKxxEEEixERS3_(ptr noundef nonnull align 8 dereferenceable(48) @ways, ptr noundef nonnull align 8 dereferenceable(8) %64)
  store i64 %62, ptr %65, align 8, !tbaa !5
  %66 = load i64, ptr @temp, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 16, ptr %5) #7
  %67 = call noundef nonnull align 8 dereferenceable(24) ptr @_ZNSt6vectorIS_IxSaIxEESaIS1_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) @t, i64 noundef 0) #7
  %68 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSt6vectorIxSaIxEEixEm(ptr noundef nonnull align 8 dereferenceable(24) %67, i64 noundef 2) #7
  %69 = call noundef nonnull align 8 dereferenceable(24) ptr @_ZNSt6vectorIS_IxSaIxEESaIS1_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) @t, i64 noundef 0) #7
  %70 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSt6vectorIxSaIxEEixEm(ptr noundef nonnull align 8 dereferenceable(24) %69, i64 noundef 0) #7
  %71 = call { i64, i64 } @_ZSt9make_pairIRxS0_ESt4pairINSt25__strip_reference_wrapperINSt5decayIT_E4typeEE6__typeENS2_INS3_IT0_E4typeEE6__typeEEOS4_OS9_(ptr noundef nonnull align 8 dereferenceable(8) %68, ptr noundef nonnull align 8 dereferenceable(8) %70)
  %72 = getelementptr inbounds { i64, i64 }, ptr %5, i32 0, i32 0
  %73 = extractvalue { i64, i64 } %71, 0
  store i64 %73, ptr %72, align 8
  %74 = getelementptr inbounds { i64, i64 }, ptr %5, i32 0, i32 1
  %75 = extractvalue { i64, i64 } %71, 1
  store i64 %75, ptr %74, align 8
  %76 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSt3mapISt4pairIxxExSt4lessIS1_ESaIS0_IKS1_xEEEixEOS1_(ptr noundef nonnull align 8 dereferenceable(48) @spec_v, ptr noundef nonnull align 8 dereferenceable(16) %5)
  store i64 %66, ptr %76, align 8, !tbaa !5
  call void @llvm.lifetime.end.p0(i64 16, ptr %5) #7
  call void @llvm.lifetime.start.p0(i64 4, ptr %6) #7
  store i32 1, ptr %6, align 4, !tbaa !9
  br label %77

77:                                               ; preds = %348, %55
  %78 = load i32, ptr %6, align 4, !tbaa !9
  %79 = load i32, ptr @k, align 4, !tbaa !9
  %80 = icmp slt i32 %78, %79
  br i1 %80, label %82, label %81

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

82:                                               ; preds = %77
  call void @llvm.lifetime.start.p0(i64 8, ptr %7) #7
  %83 = load i64, ptr @m, align 8, !tbaa !5
  %84 = load i32, ptr %6, align 4, !tbaa !9
  %85 = sext i32 %84 to i64
  %86 = call noundef nonnull align 8 dereferenceable(24) ptr @_ZNSt6vectorIS_IxSaIxEESaIS1_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) @t, i64 noundef %85) #7
  %87 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSt6vectorIxSaIxEEixEm(ptr noundef nonnull align 8 dereferenceable(24) %86, i64 noundef 1) #7
  %88 = load i64, ptr %87, align 8, !tbaa !5
  %89 = sub nsw i64 %88, 1
  %90 = call noundef i64 @_Z3expxx(i64 noundef %83, i64 noundef %89)
  store i64 %90, ptr %7, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %8) #7
  call void @llvm.lifetime.start.p0(i64 8, ptr %9) #7
  call void @llvm.lifetime.start.p0(i64 16, ptr %10) #7
  %91 = load i32, ptr %6, align 4, !tbaa !9
  %92 = sext i32 %91 to i64
  %93 = call noundef nonnull align 8 dereferenceable(24) ptr @_ZNSt6vectorIS_IxSaIxEESaIS1_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) @t, i64 noundef %92) #7
  %94 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSt6vectorIxSaIxEEixEm(ptr noundef nonnull align 8 dereferenceable(24) %93, i64 noundef 3) #7
  %95 = load i32, ptr %6, align 4, !tbaa !9
  %96 = sext i32 %95 to i64
  %97 = call noundef nonnull align 8 dereferenceable(24) ptr @_ZNSt6vectorIS_IxSaIxEESaIS1_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) @t, i64 noundef %96) #7
  %98 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSt6vectorIxSaIxEEixEm(ptr noundef nonnull align 8 dereferenceable(24) %97, i64 noundef 1) #7
  %99 = call { i64, i64 } @_ZSt9make_pairIRxS0_ESt4pairINSt25__strip_reference_wrapperINSt5decayIT_E4typeEE6__typeENS2_INS3_IT0_E4typeEE6__typeEEOS4_OS9_(ptr noundef nonnull align 8 dereferenceable(8) %94, ptr noundef nonnull align 8 dereferenceable(8) %98)
  %100 = getelementptr inbounds { i64, i64 }, ptr %10, i32 0, i32 0
  %101 = extractvalue { i64, i64 } %99, 0
  store i64 %101, ptr %100, align 8
  %102 = getelementptr inbounds { i64, i64 }, ptr %10, i32 0, i32 1
  %103 = extractvalue { i64, i64 } %99, 1
  store i64 %103, ptr %102, align 8
  %104 = call ptr @_ZNSt3mapISt4pairIxxExSt4lessIS1_ESaIS0_IKS1_xEEE4findERS4_(ptr noundef nonnull align 8 dereferenceable(48) @spec_v, ptr noundef nonnull align 8 dereferenceable(16) %10)
  %105 = getelementptr inbounds %"struct.std::_Rb_tree_iterator.14", ptr %9, i32 0, i32 0
  store ptr %104, ptr %105, align 8
  call void @llvm.lifetime.start.p0(i64 8, ptr %11) #7
  %106 = call ptr @_ZNSt3mapISt4pairIxxExSt4lessIS1_ESaIS0_IKS1_xEEE3endEv(ptr noundef nonnull align 8 dereferenceable(48) @spec_v) #7
  %107 = getelementptr inbounds %"struct.std::_Rb_tree_iterator.14", ptr %11, i32 0, i32 0
  store ptr %106, ptr %107, align 8
  %108 = call noundef zeroext i1 @_ZStneRKSt17_Rb_tree_iteratorISt4pairIKS0_IxxExEES6_(ptr noundef nonnull align 8 dereferenceable(8) %9, ptr noundef nonnull align 8 dereferenceable(8) %11) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr %11) #7
  call void @llvm.lifetime.end.p0(i64 16, ptr %10) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr %9) #7
  br i1 %108, label %109, label %125

109:                                              ; preds = %82
  call void @llvm.lifetime.start.p0(i64 16, ptr %12) #7
  %110 = load i32, ptr %6, align 4, !tbaa !9
  %111 = sext i32 %110 to i64
  %112 = call noundef nonnull align 8 dereferenceable(24) ptr @_ZNSt6vectorIS_IxSaIxEESaIS1_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) @t, i64 noundef %111) #7
  %113 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSt6vectorIxSaIxEEixEm(ptr noundef nonnull align 8 dereferenceable(24) %112, i64 noundef 3) #7
  %114 = load i32, ptr %6, align 4, !tbaa !9
  %115 = sext i32 %114 to i64
  %116 = call noundef nonnull align 8 dereferenceable(24) ptr @_ZNSt6vectorIS_IxSaIxEESaIS1_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) @t, i64 noundef %115) #7
  %117 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSt6vectorIxSaIxEEixEm(ptr noundef nonnull align 8 dereferenceable(24) %116, i64 noundef 1) #7
  %118 = call { i64, i64 } @_ZSt9make_pairIRxS0_ESt4pairINSt25__strip_reference_wrapperINSt5decayIT_E4typeEE6__typeENS2_INS3_IT0_E4typeEE6__typeEEOS4_OS9_(ptr noundef nonnull align 8 dereferenceable(8) %113, ptr noundef nonnull align 8 dereferenceable(8) %117)
  %119 = getelementptr inbounds { i64, i64 }, ptr %12, i32 0, i32 0
  %120 = extractvalue { i64, i64 } %118, 0
  store i64 %120, ptr %119, align 8
  %121 = getelementptr inbounds { i64, i64 }, ptr %12, i32 0, i32 1
  %122 = extractvalue { i64, i64 } %118, 1
  store i64 %122, ptr %121, align 8
  %123 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSt3mapISt4pairIxxExSt4lessIS1_ESaIS0_IKS1_xEEEixEOS1_(ptr noundef nonnull align 8 dereferenceable(48) @spec_v, ptr noundef nonnull align 8 dereferenceable(16) %12)
  %124 = load i64, ptr %123, align 8, !tbaa !5
  store i64 %124, ptr %8, align 8, !tbaa !5
  call void @llvm.lifetime.end.p0(i64 16, ptr %12) #7
  br label %159

125:                                              ; preds = %82
  call void @llvm.lifetime.start.p0(i64 8, ptr %13) #7
  %126 = load i32, ptr %6, align 4, !tbaa !9
  %127 = sext i32 %126 to i64
  %128 = call noundef nonnull align 8 dereferenceable(24) ptr @_ZNSt6vectorIS_IxSaIxEESaIS1_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) @t, i64 noundef %127) #7
  %129 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSt6vectorIxSaIxEEixEm(ptr noundef nonnull align 8 dereferenceable(24) %128, i64 noundef 1) #7
  %130 = call ptr @_ZNSt3mapIxxSt4lessIxESaISt4pairIKxxEEE11lower_boundERS3_(ptr noundef nonnull align 8 dereferenceable(48) @ways, ptr noundef nonnull align 8 dereferenceable(8) %129)
  %131 = getelementptr inbounds %"struct.std::_Rb_tree_iterator", ptr %13, i32 0, i32 0
  store ptr %130, ptr %131, align 8
  call void @llvm.memcpy.p0.p0.i64(ptr align 8 @it, ptr align 8 %13, i64 8, i1 false), !tbaa.struct !13
  call void @llvm.lifetime.end.p0(i64 8, ptr %13) #7
  call void @llvm.lifetime.start.p0(i64 8, ptr %14) #7
  %132 = call ptr @_ZNSt3mapIxxSt4lessIxESaISt4pairIKxxEEE5beginEv(ptr noundef nonnull align 8 dereferenceable(48) @ways) #7
  %133 = getelementptr inbounds %"struct.std::_Rb_tree_iterator", ptr %14, i32 0, i32 0
  store ptr %132, ptr %133, align 8
  %134 = call noundef zeroext i1 @_ZStneRKSt17_Rb_tree_iteratorISt4pairIKxxEES5_(ptr noundef nonnull align 8 dereferenceable(8) @it, ptr noundef nonnull align 8 dereferenceable(8) %14) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr %14) #7
  br i1 %134, label %135, label %157

135:                                              ; preds = %125
  %136 = call ptr @_ZNSt17_Rb_tree_iteratorISt4pairIKxxEEmmEi(ptr noundef nonnull align 8 dereferenceable(8) @it, i32 noundef 0) #7
  %137 = getelementptr inbounds %"struct.std::_Rb_tree_iterator", ptr %15, i32 0, i32 0
  store ptr %136, ptr %137, align 8
  %138 = call noundef ptr @_ZNKSt17_Rb_tree_iteratorISt4pairIKxxEEptEv(ptr noundef nonnull align 8 dereferenceable(8) @it) #7
  %139 = getelementptr inbounds %"struct.std::pair.15", ptr %138, i32 0, i32 1
  %140 = load i64, ptr %139, align 8, !tbaa !16
  store i64 %140, ptr %8, align 8, !tbaa !5
  %141 = load i64, ptr %8, align 8, !tbaa !5
  %142 = load i64, ptr @m, align 8, !tbaa !5
  %143 = load i32, ptr %6, align 4, !tbaa !9
  %144 = sext i32 %143 to i64
  %145 = call noundef nonnull align 8 dereferenceable(24) ptr @_ZNSt6vectorIS_IxSaIxEESaIS1_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) @t, i64 noundef %144) #7
  %146 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSt6vectorIxSaIxEEixEm(ptr noundef nonnull align 8 dereferenceable(24) %145, i64 noundef 1) #7
  %147 = load i64, ptr %146, align 8, !tbaa !5
  %148 = call noundef ptr @_ZNKSt17_Rb_tree_iteratorISt4pairIKxxEEptEv(ptr noundef nonnull align 8 dereferenceable(8) @it) #7
  %149 = getelementptr inbounds %"struct.std::pair.15", ptr %148, i32 0, i32 0
  %150 = load i64, ptr %149, align 8, !tbaa !18
  %151 = sub nsw i64 %147, %150
  %152 = sub nsw i64 %151, 1
  %153 = call noundef i64 @_Z3expxx(i64 noundef %142, i64 noundef %152)
  %154 = mul nsw i64 %141, %153
  %155 = load i64, ptr @MOD, align 8, !tbaa !5
  %156 = srem i64 %154, %155
  store i64 %156, ptr %8, align 8, !tbaa !5
  br label %158

157:                                              ; preds = %125
  store i64 0, ptr %8, align 8, !tbaa !5
  br label %158

158:                                              ; preds = %157, %135
  br label %159

159:                                              ; preds = %158, %109
  call void @llvm.lifetime.start.p0(i64 8, ptr %16) #7
  call void @llvm.lifetime.start.p0(i64 8, ptr %17) #7
  %160 = load i32, ptr %6, align 4, !tbaa !9
  %161 = sext i32 %160 to i64
  %162 = call noundef nonnull align 8 dereferenceable(24) ptr @_ZNSt6vectorIS_IxSaIxEESaIS1_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) @t, i64 noundef %161) #7
  %163 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSt6vectorIxSaIxEEixEm(ptr noundef nonnull align 8 dereferenceable(24) %162, i64 noundef 0) #7
  %164 = call ptr @_ZNSt3mapIxxSt4lessIxESaISt4pairIKxxEEE11lower_boundERS3_(ptr noundef nonnull align 8 dereferenceable(48) @ways, ptr noundef nonnull align 8 dereferenceable(8) %163)
  %165 = getelementptr inbounds %"struct.std::_Rb_tree_iterator", ptr %17, i32 0, i32 0
  store ptr %164, ptr %165, align 8
  call void @llvm.memcpy.p0.p0.i64(ptr align 8 @it, ptr align 8 %17, i64 8, i1 false), !tbaa.struct !13
  call void @llvm.lifetime.end.p0(i64 8, ptr %17) #7
  call void @llvm.lifetime.start.p0(i64 8, ptr %18) #7
  %166 = call ptr @_ZNSt3mapIxxSt4lessIxESaISt4pairIKxxEEE5beginEv(ptr noundef nonnull align 8 dereferenceable(48) @ways) #7
  %167 = getelementptr inbounds %"struct.std::_Rb_tree_iterator", ptr %18, i32 0, i32 0
  store ptr %166, ptr %167, align 8
  %168 = call noundef zeroext i1 @_ZStneRKSt17_Rb_tree_iteratorISt4pairIKxxEES5_(ptr noundef nonnull align 8 dereferenceable(8) @it, ptr noundef nonnull align 8 dereferenceable(8) %18) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr %18) #7
  br i1 %168, label %169, label %191

169:                                              ; preds = %159
  %170 = call ptr @_ZNSt17_Rb_tree_iteratorISt4pairIKxxEEmmEi(ptr noundef nonnull align 8 dereferenceable(8) @it, i32 noundef 0) #7
  %171 = getelementptr inbounds %"struct.std::_Rb_tree_iterator", ptr %19, i32 0, i32 0
  store ptr %170, ptr %171, align 8
  %172 = call noundef ptr @_ZNKSt17_Rb_tree_iteratorISt4pairIKxxEEptEv(ptr noundef nonnull align 8 dereferenceable(8) @it) #7
  %173 = getelementptr inbounds %"struct.std::pair.15", ptr %172, i32 0, i32 1
  %174 = load i64, ptr %173, align 8, !tbaa !16
  store i64 %174, ptr %16, align 8, !tbaa !5
  %175 = load i64, ptr %16, align 8, !tbaa !5
  %176 = load i64, ptr @m, align 8, !tbaa !5
  %177 = load i32, ptr %6, align 4, !tbaa !9
  %178 = sext i32 %177 to i64
  %179 = call noundef nonnull align 8 dereferenceable(24) ptr @_ZNSt6vectorIS_IxSaIxEESaIS1_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) @t, i64 noundef %178) #7
  %180 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSt6vectorIxSaIxEEixEm(ptr noundef nonnull align 8 dereferenceable(24) %179, i64 noundef 0) #7
  %181 = load i64, ptr %180, align 8, !tbaa !5
  %182 = call noundef ptr @_ZNKSt17_Rb_tree_iteratorISt4pairIKxxEEptEv(ptr noundef nonnull align 8 dereferenceable(8) @it) #7
  %183 = getelementptr inbounds %"struct.std::pair.15", ptr %182, i32 0, i32 0
  %184 = load i64, ptr %183, align 8, !tbaa !18
  %185 = sub nsw i64 %181, %184
  %186 = sub nsw i64 %185, 1
  %187 = call noundef i64 @_Z3expxx(i64 noundef %176, i64 noundef %186)
  %188 = mul nsw i64 %175, %187
  %189 = load i64, ptr @MOD, align 8, !tbaa !5
  %190 = srem i64 %188, %189
  store i64 %190, ptr %16, align 8, !tbaa !5
  br label %192

191:                                              ; preds = %159
  store i64 0, ptr %16, align 8, !tbaa !5
  br label %192

192:                                              ; preds = %191, %169
  call void @llvm.lifetime.start.p0(i64 8, ptr %20) #7
  %193 = load i32, ptr %6, align 4, !tbaa !9
  %194 = sext i32 %193 to i64
  %195 = call noundef nonnull align 8 dereferenceable(24) ptr @_ZNSt6vectorIS_IxSaIxEESaIS1_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) @t, i64 noundef %194) #7
  %196 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSt6vectorIxSaIxEEixEm(ptr noundef nonnull align 8 dereferenceable(24) %195, i64 noundef 0) #7
  %197 = call ptr @_ZNSt3mapIxxSt4lessIxESaISt4pairIKxxEEE4findERS3_(ptr noundef nonnull align 8 dereferenceable(48) @ways, ptr noundef nonnull align 8 dereferenceable(8) %196)
  %198 = getelementptr inbounds %"struct.std::_Rb_tree_iterator", ptr %20, i32 0, i32 0
  store ptr %197, ptr %198, align 8
  call void @llvm.lifetime.start.p0(i64 8, ptr %21) #7
  %199 = call ptr @_ZNSt3mapIxxSt4lessIxESaISt4pairIKxxEEE3endEv(ptr noundef nonnull align 8 dereferenceable(48) @ways) #7
  %200 = getelementptr inbounds %"struct.std::_Rb_tree_iterator", ptr %21, i32 0, i32 0
  store ptr %199, ptr %200, align 8
  %201 = call noundef zeroext i1 @_ZStneRKSt17_Rb_tree_iteratorISt4pairIKxxEES5_(ptr noundef nonnull align 8 dereferenceable(8) %20, ptr noundef nonnull align 8 dereferenceable(8) %21) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr %21) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr %20) #7
  br i1 %201, label %202, label %222

202:                                              ; preds = %192
  %203 = load i32, ptr %6, align 4, !tbaa !9
  %204 = sext i32 %203 to i64
  %205 = call noundef nonnull align 8 dereferenceable(24) ptr @_ZNSt6vectorIS_IxSaIxEESaIS1_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) @t, i64 noundef %204) #7
  %206 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSt6vectorIxSaIxEEixEm(ptr noundef nonnull align 8 dereferenceable(24) %205, i64 noundef 0) #7
  %207 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSt3mapIxxSt4lessIxESaISt4pairIKxxEEEixERS3_(ptr noundef nonnull align 8 dereferenceable(48) @ways, ptr noundef nonnull align 8 dereferenceable(8) %206)
  %208 = load i64, ptr %207, align 8, !tbaa !5
  %209 = load i64, ptr %7, align 8, !tbaa !5
  %210 = load i64, ptr %8, align 8, !tbaa !5
  %211 = add nsw i64 %209, %210
  %212 = load i64, ptr @MOD, align 8, !tbaa !5
  %213 = srem i64 %211, %212
  %214 = add nsw i64 %208, %213
  %215 = load i64, ptr @MOD, align 8, !tbaa !5
  %216 = srem i64 %214, %215
  %217 = load i32, ptr %6, align 4, !tbaa !9
  %218 = sext i32 %217 to i64
  %219 = call noundef nonnull align 8 dereferenceable(24) ptr @_ZNSt6vectorIS_IxSaIxEESaIS1_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) @t, i64 noundef %218) #7
  %220 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSt6vectorIxSaIxEEixEm(ptr noundef nonnull align 8 dereferenceable(24) %219, i64 noundef 0) #7
  %221 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSt3mapIxxSt4lessIxESaISt4pairIKxxEEEixERS3_(ptr noundef nonnull align 8 dereferenceable(48) @ways, ptr noundef nonnull align 8 dereferenceable(8) %220)
  store i64 %216, ptr %221, align 8, !tbaa !5
  br label %266

222:                                              ; preds = %192
  %223 = load i32, ptr %6, align 4, !tbaa !9
  %224 = sext i32 %223 to i64
  %225 = call noundef nonnull align 8 dereferenceable(24) ptr @_ZNSt6vectorIS_IxSaIxEESaIS1_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) @t, i64 noundef %224) #7
  %226 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSt6vectorIxSaIxEEixEm(ptr noundef nonnull align 8 dereferenceable(24) %225, i64 noundef 0) #7
  %227 = load i64, ptr %226, align 8, !tbaa !5
  %228 = load i64, ptr @n, align 8, !tbaa !5
  %229 = add nsw i64 %228, 1
  %230 = icmp eq i64 %227, %229
  br i1 %230, label %231, label %246

231:                                              ; preds = %222
  %232 = load i64, ptr %7, align 8, !tbaa !5
  %233 = load i64, ptr %8, align 8, !tbaa !5
  %234 = add nsw i64 %232, %233
  %235 = load i64, ptr @MOD, align 8, !tbaa !5
  %236 = srem i64 %234, %235
  %237 = load i64, ptr %16, align 8, !tbaa !5
  %238 = add nsw i64 %236, %237
  %239 = load i64, ptr @MOD, align 8, !tbaa !5
  %240 = srem i64 %238, %239
  %241 = load i32, ptr %6, align 4, !tbaa !9
  %242 = sext i32 %241 to i64
  %243 = call noundef nonnull align 8 dereferenceable(24) ptr @_ZNSt6vectorIS_IxSaIxEESaIS1_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) @t, i64 noundef %242) #7
  %244 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSt6vectorIxSaIxEEixEm(ptr noundef nonnull align 8 dereferenceable(24) %243, i64 noundef 0) #7
  %245 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSt3mapIxxSt4lessIxESaISt4pairIKxxEEEixERS3_(ptr noundef nonnull align 8 dereferenceable(48) @ways, ptr noundef nonnull align 8 dereferenceable(8) %244)
  store i64 %240, ptr %245, align 8, !tbaa !5
  br label %265

246:                                              ; preds = %222
  %247 = load i64, ptr %7, align 8, !tbaa !5
  %248 = load i64, ptr %8, align 8, !tbaa !5
  %249 = add nsw i64 %247, %248
  %250 = load i64, ptr @MOD, align 8, !tbaa !5
  %251 = srem i64 %249, %250
  %252 = load i64, ptr %16, align 8, !tbaa !5
  %253 = load i64, ptr @m, align 8, !tbaa !5
  %254 = mul nsw i64 %252, %253
  %255 = load i64, ptr @MOD, align 8, !tbaa !5
  %256 = srem i64 %254, %255
  %257 = add nsw i64 %251, %256
  %258 = load i64, ptr @MOD, align 8, !tbaa !5
  %259 = srem i64 %257, %258
  %260 = load i32, ptr %6, align 4, !tbaa !9
  %261 = sext i32 %260 to i64
  %262 = call noundef nonnull align 8 dereferenceable(24) ptr @_ZNSt6vectorIS_IxSaIxEESaIS1_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) @t, i64 noundef %261) #7
  %263 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSt6vectorIxSaIxEEixEm(ptr noundef nonnull align 8 dereferenceable(24) %262, i64 noundef 0) #7
  %264 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSt3mapIxxSt4lessIxESaISt4pairIKxxEEEixERS3_(ptr noundef nonnull align 8 dereferenceable(48) @ways, ptr noundef nonnull align 8 dereferenceable(8) %263)
  store i64 %259, ptr %264, align 8, !tbaa !5
  br label %265

265:                                              ; preds = %246, %231
  br label %266

266:                                              ; preds = %265, %202
  call void @llvm.lifetime.start.p0(i64 8, ptr %22) #7
  call void @llvm.lifetime.start.p0(i64 16, ptr %23) #7
  %267 = load i32, ptr %6, align 4, !tbaa !9
  %268 = sext i32 %267 to i64
  %269 = call noundef nonnull align 8 dereferenceable(24) ptr @_ZNSt6vectorIS_IxSaIxEESaIS1_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) @t, i64 noundef %268) #7
  %270 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSt6vectorIxSaIxEEixEm(ptr noundef nonnull align 8 dereferenceable(24) %269, i64 noundef 2) #7
  %271 = load i32, ptr %6, align 4, !tbaa !9
  %272 = sext i32 %271 to i64
  %273 = call noundef nonnull align 8 dereferenceable(24) ptr @_ZNSt6vectorIS_IxSaIxEESaIS1_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) @t, i64 noundef %272) #7
  %274 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSt6vectorIxSaIxEEixEm(ptr noundef nonnull align 8 dereferenceable(24) %273, i64 noundef 0) #7
  %275 = call { i64, i64 } @_ZSt9make_pairIRxS0_ESt4pairINSt25__strip_reference_wrapperINSt5decayIT_E4typeEE6__typeENS2_INS3_IT0_E4typeEE6__typeEEOS4_OS9_(ptr noundef nonnull align 8 dereferenceable(8) %270, ptr noundef nonnull align 8 dereferenceable(8) %274)
  %276 = getelementptr inbounds { i64, i64 }, ptr %23, i32 0, i32 0
  %277 = extractvalue { i64, i64 } %275, 0
  store i64 %277, ptr %276, align 8
  %278 = getelementptr inbounds { i64, i64 }, ptr %23, i32 0, i32 1
  %279 = extractvalue { i64, i64 } %275, 1
  store i64 %279, ptr %278, align 8
  %280 = call ptr @_ZNSt3mapISt4pairIxxExSt4lessIS1_ESaIS0_IKS1_xEEE4findERS4_(ptr noundef nonnull align 8 dereferenceable(48) @spec_v, ptr noundef nonnull align 8 dereferenceable(16) %23)
  %281 = getelementptr inbounds %"struct.std::_Rb_tree_iterator.14", ptr %22, i32 0, i32 0
  store ptr %280, ptr %281, align 8
  call void @llvm.lifetime.start.p0(i64 8, ptr %24) #7
  %282 = call ptr @_ZNSt3mapISt4pairIxxExSt4lessIS1_ESaIS0_IKS1_xEEE3endEv(ptr noundef nonnull align 8 dereferenceable(48) @spec_v) #7
  %283 = getelementptr inbounds %"struct.std::_Rb_tree_iterator.14", ptr %24, i32 0, i32 0
  store ptr %282, ptr %283, align 8
  %284 = call noundef zeroext i1 @_ZStneRKSt17_Rb_tree_iteratorISt4pairIKS0_IxxExEES6_(ptr noundef nonnull align 8 dereferenceable(8) %22, ptr noundef nonnull align 8 dereferenceable(8) %24) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr %24) #7
  call void @llvm.lifetime.end.p0(i64 16, ptr %23) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr %22) #7
  br i1 %284, label %285, label %323

285:                                              ; preds = %266
  call void @llvm.lifetime.start.p0(i64 16, ptr %25) #7
  %286 = load i32, ptr %6, align 4, !tbaa !9
  %287 = sext i32 %286 to i64
  %288 = call noundef nonnull align 8 dereferenceable(24) ptr @_ZNSt6vectorIS_IxSaIxEESaIS1_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) @t, i64 noundef %287) #7
  %289 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSt6vectorIxSaIxEEixEm(ptr noundef nonnull align 8 dereferenceable(24) %288, i64 noundef 2) #7
  %290 = load i32, ptr %6, align 4, !tbaa !9
  %291 = sext i32 %290 to i64
  %292 = call noundef nonnull align 8 dereferenceable(24) ptr @_ZNSt6vectorIS_IxSaIxEESaIS1_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) @t, i64 noundef %291) #7
  %293 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSt6vectorIxSaIxEEixEm(ptr noundef nonnull align 8 dereferenceable(24) %292, i64 noundef 0) #7
  %294 = call { i64, i64 } @_ZSt9make_pairIRxS0_ESt4pairINSt25__strip_reference_wrapperINSt5decayIT_E4typeEE6__typeENS2_INS3_IT0_E4typeEE6__typeEEOS4_OS9_(ptr noundef nonnull align 8 dereferenceable(8) %289, ptr noundef nonnull align 8 dereferenceable(8) %293)
  %295 = getelementptr inbounds { i64, i64 }, ptr %25, i32 0, i32 0
  %296 = extractvalue { i64, i64 } %294, 0
  store i64 %296, ptr %295, align 8
  %297 = getelementptr inbounds { i64, i64 }, ptr %25, i32 0, i32 1
  %298 = extractvalue { i64, i64 } %294, 1
  store i64 %298, ptr %297, align 8
  %299 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSt3mapISt4pairIxxExSt4lessIS1_ESaIS0_IKS1_xEEEixEOS1_(ptr noundef nonnull align 8 dereferenceable(48) @spec_v, ptr noundef nonnull align 8 dereferenceable(16) %25)
  %300 = load i64, ptr %299, align 8, !tbaa !5
  %301 = load i64, ptr %7, align 8, !tbaa !5
  %302 = load i64, ptr %8, align 8, !tbaa !5
  %303 = add nsw i64 %301, %302
  %304 = load i64, ptr @MOD, align 8, !tbaa !5
  %305 = srem i64 %303, %304
  %306 = add nsw i64 %300, %305
  %307 = load i64, ptr @MOD, align 8, !tbaa !5
  %308 = srem i64 %306, %307
  call void @llvm.lifetime.start.p0(i64 16, ptr %26) #7
  %309 = load i32, ptr %6, align 4, !tbaa !9
  %310 = sext i32 %309 to i64
  %311 = call noundef nonnull align 8 dereferenceable(24) ptr @_ZNSt6vectorIS_IxSaIxEESaIS1_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) @t, i64 noundef %310) #7
  %312 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSt6vectorIxSaIxEEixEm(ptr noundef nonnull align 8 dereferenceable(24) %311, i64 noundef 2) #7
  %313 = load i32, ptr %6, align 4, !tbaa !9
  %314 = sext i32 %313 to i64
  %315 = call noundef nonnull align 8 dereferenceable(24) ptr @_ZNSt6vectorIS_IxSaIxEESaIS1_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) @t, i64 noundef %314) #7
  %316 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSt6vectorIxSaIxEEixEm(ptr noundef nonnull align 8 dereferenceable(24) %315, i64 noundef 0) #7
  %317 = call { i64, i64 } @_ZSt9make_pairIRxS0_ESt4pairINSt25__strip_reference_wrapperINSt5decayIT_E4typeEE6__typeENS2_INS3_IT0_E4typeEE6__typeEEOS4_OS9_(ptr noundef nonnull align 8 dereferenceable(8) %312, ptr noundef nonnull align 8 dereferenceable(8) %316)
  %318 = getelementptr inbounds { i64, i64 }, ptr %26, i32 0, i32 0
  %319 = extractvalue { i64, i64 } %317, 0
  store i64 %319, ptr %318, align 8
  %320 = getelementptr inbounds { i64, i64 }, ptr %26, i32 0, i32 1
  %321 = extractvalue { i64, i64 } %317, 1
  store i64 %321, ptr %320, align 8
  %322 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSt3mapISt4pairIxxExSt4lessIS1_ESaIS0_IKS1_xEEEixEOS1_(ptr noundef nonnull align 8 dereferenceable(48) @spec_v, ptr noundef nonnull align 8 dereferenceable(16) %26)
  store i64 %308, ptr %322, align 8, !tbaa !5
  call void @llvm.lifetime.end.p0(i64 16, ptr %26) #7
  call void @llvm.lifetime.end.p0(i64 16, ptr %25) #7
  br label %347

323:                                              ; preds = %266
  %324 = load i64, ptr %7, align 8, !tbaa !5
  %325 = load i64, ptr %8, align 8, !tbaa !5
  %326 = add nsw i64 %324, %325
  %327 = load i64, ptr @MOD, align 8, !tbaa !5
  %328 = srem i64 %326, %327
  %329 = load i64, ptr %16, align 8, !tbaa !5
  %330 = add nsw i64 %328, %329
  %331 = load i64, ptr @MOD, align 8, !tbaa !5
  %332 = srem i64 %330, %331
  call void @llvm.lifetime.start.p0(i64 16, ptr %27) #7
  %333 = load i32, ptr %6, align 4, !tbaa !9
  %334 = sext i32 %333 to i64
  %335 = call noundef nonnull align 8 dereferenceable(24) ptr @_ZNSt6vectorIS_IxSaIxEESaIS1_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) @t, i64 noundef %334) #7
  %336 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSt6vectorIxSaIxEEixEm(ptr noundef nonnull align 8 dereferenceable(24) %335, i64 noundef 2) #7
  %337 = load i32, ptr %6, align 4, !tbaa !9
  %338 = sext i32 %337 to i64
  %339 = call noundef nonnull align 8 dereferenceable(24) ptr @_ZNSt6vectorIS_IxSaIxEESaIS1_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) @t, i64 noundef %338) #7
  %340 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSt6vectorIxSaIxEEixEm(ptr noundef nonnull align 8 dereferenceable(24) %339, i64 noundef 0) #7
  %341 = call { i64, i64 } @_ZSt9make_pairIRxS0_ESt4pairINSt25__strip_reference_wrapperINSt5decayIT_E4typeEE6__typeENS2_INS3_IT0_E4typeEE6__typeEEOS4_OS9_(ptr noundef nonnull align 8 dereferenceable(8) %336, ptr noundef nonnull align 8 dereferenceable(8) %340)
  %342 = getelementptr inbounds { i64, i64 }, ptr %27, i32 0, i32 0
  %343 = extractvalue { i64, i64 } %341, 0
  store i64 %343, ptr %342, align 8
  %344 = getelementptr inbounds { i64, i64 }, ptr %27, i32 0, i32 1
  %345 = extractvalue { i64, i64 } %341, 1
  store i64 %345, ptr %344, align 8
  %346 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSt3mapISt4pairIxxExSt4lessIS1_ESaIS0_IKS1_xEEEixEOS1_(ptr noundef nonnull align 8 dereferenceable(48) @spec_v, ptr noundef nonnull align 8 dereferenceable(16) %27)
  store i64 %332, ptr %346, align 8, !tbaa !5
  call void @llvm.lifetime.end.p0(i64 16, ptr %27) #7
  br label %347

347:                                              ; preds = %323, %285
  call void @llvm.lifetime.end.p0(i64 8, ptr %16) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr %8) #7
  call void @llvm.lifetime.end.p0(i64 8, ptr %7) #7
  br label %348

348:                                              ; preds = %347
  %349 = load i32, ptr %6, align 4, !tbaa !9
  %350 = add nsw i32 %349, 1
  store i32 %350, ptr %6, align 4, !tbaa !9
  br label %77, !llvm.loop !19

351:                                              ; preds = %81
  br label %352

352:                                              ; preds = %351, %44
  %353 = call noundef zeroext i1 @_ZNKSt3mapIxxSt4lessIxESaISt4pairIKxxEEE5emptyEv(ptr noundef nonnull align 8 dereferenceable(48) @ways) #7
  br i1 %353, label %376, label %354

354:                                              ; preds = %352
  call void @llvm.lifetime.start.p0(i64 8, ptr %28) #7
  %355 = call ptr @_ZNSt3mapIxxSt4lessIxESaISt4pairIKxxEEE3endEv(ptr noundef nonnull align 8 dereferenceable(48) @ways) #7
  %356 = getelementptr inbounds %"struct.std::_Rb_tree_iterator", ptr %28, i32 0, i32 0
  store ptr %355, ptr %356, align 8
  call void @llvm.memcpy.p0.p0.i64(ptr align 8 @it, ptr align 8 %28, i64 8, i1 false), !tbaa.struct !13
  call void @llvm.lifetime.end.p0(i64 8, ptr %28) #7
  %357 = call ptr @_ZNSt17_Rb_tree_iteratorISt4pairIKxxEEmmEi(ptr noundef nonnull align 8 dereferenceable(8) @it, i32 noundef 0) #7
  %358 = getelementptr inbounds %"struct.std::_Rb_tree_iterator", ptr %29, i32 0, i32 0
  store ptr %357, ptr %358, align 8
  %359 = load i64, ptr @res, align 8, !tbaa !5
  %360 = call noundef ptr @_ZNKSt17_Rb_tree_iteratorISt4pairIKxxEEptEv(ptr noundef nonnull align 8 dereferenceable(8) @it) #7
  %361 = getelementptr inbounds %"struct.std::pair.15", ptr %360, i32 0, i32 1
  %362 = load i64, ptr %361, align 8, !tbaa !16
  %363 = load i64, ptr @m, align 8, !tbaa !5
  %364 = load i64, ptr @n, align 8, !tbaa !5
  %365 = call noundef ptr @_ZNKSt17_Rb_tree_iteratorISt4pairIKxxEEptEv(ptr noundef nonnull align 8 dereferenceable(8) @it) #7
  %366 = getelementptr inbounds %"struct.std::pair.15", ptr %365, i32 0, i32 0
  %367 = load i64, ptr %366, align 8, !tbaa !18
  %368 = sub nsw i64 %364, %367
  %369 = call noundef i64 @_Z3expxx(i64 noundef %363, i64 noundef %368)
  %370 = mul nsw i64 %362, %369
  %371 = load i64, ptr @MOD, align 8, !tbaa !5
  %372 = srem i64 %370, %371
  %373 = add nsw i64 %359, %372
  %374 = load i64, ptr @MOD, align 8, !tbaa !5
  %375 = srem i64 %373, %374
  store i64 %375, ptr @res, align 8, !tbaa !5
  br label %376

376:                                              ; preds = %354, %352
  %377 = load i64, ptr @res, align 8, !tbaa !5
  %378 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEx(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cout, i64 noundef %377)
  %379 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEPFRSoS_E(ptr noundef nonnull align 8 dereferenceable(8) %378, ptr noundef @_ZSt4endlIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_)
  ret i32 0
}

declare i32 @__isoc99_scanf(ptr noundef, ...) #3

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

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

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

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

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

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

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

; Function Attrs: mustprogress uwtable
declare dso_local noundef nonnull align 8 dereferenceable(8) ptr @_ZNSt3mapISt4pairIxxExSt4lessIS1_ESaIS0_IKS1_xEEEixEOS1_(ptr noundef nonnull align 8 dereferenceable(48), ptr noundef nonnull align 8 dereferenceable(16)) #4 align 2

; Function Attrs: mustprogress uwtable
declare dso_local { i64, i64 } @_ZSt9make_pairIRxS0_ESt4pairINSt25__strip_reference_wrapperINSt5decayIT_E4typeEE6__typeENS2_INS3_IT0_E4typeEE6__typeEEOS4_OS9_(ptr noundef nonnull align 8 dereferenceable(8), ptr noundef nonnull align 8 dereferenceable(8)) #4

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

; Function Attrs: mustprogress uwtable
declare dso_local ptr @_ZNSt3mapISt4pairIxxExSt4lessIS1_ESaIS0_IKS1_xEEE4findERS4_(ptr noundef nonnull align 8 dereferenceable(48), ptr noundef nonnull align 8 dereferenceable(16)) #4 align 2

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

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

; Function Attrs: nocallback nofree nounwind willreturn memory(argmem: readwrite)
declare void @llvm.memcpy.p0.p0.i64(ptr noalias nocapture writeonly, ptr noalias nocapture readonly, i64, i1 immarg) #6

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

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

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

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

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

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

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

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


; 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::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.0" = type { %"struct.std::_Vector_base.1" }
%"struct.std::_Vector_base.1" = 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::map" = type { %"class.std::_Rb_tree" }
%"class.std::_Rb_tree" = type { %"struct.std::_Rb_tree<long long, std::pair<const long long, long long>, std::_Select1st<std::pair<const long long, long long>>, std::less<long long>>::_Rb_tree_impl" }
%"struct.std::_Rb_tree<long long, std::pair<const long long, long long>, std::_Select1st<std::pair<const long long, long long>>, std::less<long long>>::_Rb_tree_impl" = type { [8 x i8], %"struct.std::_Rb_tree_header" }
%"struct.std::_Rb_tree_header" = type { %"struct.std::_Rb_tree_node_base", i64 }
%"struct.std::_Rb_tree_node_base" = type { i32, ptr, ptr, ptr }
%"class.std::map.8" = type { %"class.std::_Rb_tree.9" }
%"class.std::_Rb_tree.9" = type { %"struct.std::_Rb_tree<std::pair<long long, long long>, std::pair<const std::pair<long long, long long>, long long>, std::_Select1st<std::pair<const std::pair<long long, long long>, long long>>, std::less<std::pair<long long, long long>>>::_Rb_tree_impl" }
%"struct.std::_Rb_tree<std::pair<long long, long long>, std::pair<const std::pair<long long, long long>, long long>, std::_Select1st<std::pair<const std::pair<long long, long long>, long long>>, std::less<std::pair<long long, long long>>>::_Rb_tree_impl" = type { [8 x i8], %"struct.std::_Rb_tree_header" }
%"struct.std::_Rb_tree_iterator" = type { ptr }
%"class.std::basic_ostream" = type { ptr, %"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 }
%"struct.std::pair" = type { i64, i64 }
%"struct.std::_Rb_tree_iterator.14" = type { ptr }

@n = external dso_local global i64, align 8
@m = external dso_local global i64, align 8
@MOD = external dso_local local_unnamed_addr global i64, align 8
@res = external dso_local local_unnamed_addr global i64, align 8
@a = external dso_local global i64, align 8
@b = external dso_local global i64, align 8
@c = external dso_local global i64, align 8
@d = external dso_local global i64, align 8
@temp = external dso_local local_unnamed_addr global i64, align 8
@t = external dso_local global %"class.std::vector", align 8
@x = external dso_local global %"class.std::vector.0", align 8
@ways = external dso_local global %"class.std::map", align 8
@spec_v = external dso_local global %"class.std::map.8", align 8
@it = external dso_local global %"struct.std::_Rb_tree_iterator", align 8
@k = external dso_local global i32, align 4
@.str = external hidden unnamed_addr constant [11 x i8], align 1
@.str.6 = external hidden unnamed_addr constant [17 x i8], align 1
@_ZSt4cout = external global %"class.std::basic_ostream", align 8

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef i64 @_Z3expxx(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 norecurse uwtable
define dso_local noundef i32 @main() local_unnamed_addr #2 {
  %1 = alloca %"struct.std::pair", align 8
  %2 = alloca %"struct.std::_Rb_tree_iterator.14", align 8
  %3 = alloca %"struct.std::pair", align 8
  %4 = alloca %"struct.std::_Rb_tree_iterator.14", align 8
  %5 = alloca %"struct.std::pair", align 8
  %6 = alloca %"struct.std::_Rb_tree_iterator", align 8
  %7 = alloca %"struct.std::_Rb_tree_iterator", align 8
  %8 = alloca %"struct.std::_Rb_tree_iterator", align 8
  %9 = alloca %"struct.std::_Rb_tree_iterator", align 8
  %10 = alloca %"struct.std::_Rb_tree_iterator.14", align 8
  %11 = alloca %"struct.std::pair", align 8
  %12 = alloca %"struct.std::_Rb_tree_iterator.14", align 8
  %13 = alloca %"struct.std::pair", align 8
  %14 = alloca %"struct.std::pair", align 8
  %15 = alloca %"struct.std::pair", align 8
  %16 = tail call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str, ptr noundef nonnull @n, ptr noundef nonnull @m, ptr noundef nonnull @k)
  %17 = load i64, ptr @m, align 8, !tbaa !5
  %18 = load i64, ptr @n, align 8, !tbaa !5
  %19 = tail call noundef i64 @_Z3expxx(i64 noundef %17, i64 noundef %18)
  store i64 %19, ptr @res, align 8, !tbaa !5
  %20 = load i32, ptr @k, align 4, !tbaa !9
  %21 = icmp sgt i32 %20, 0
  br i1 %21, label %.lr.ph, label %._crit_edge

._crit_edge:                                      ; preds = %.lr.ph, %0
  %22 = tail call ptr @_ZNSt6vectorIS_IxSaIxEESaIS1_EE5beginEv(ptr noundef nonnull align 8 dereferenceable(24) @t) #6
  %23 = tail call ptr @_ZNSt6vectorIS_IxSaIxEESaIS1_EE3endEv(ptr noundef nonnull align 8 dereferenceable(24) @t) #6
  tail call void @_ZSt4sortIN9__gnu_cxx17__normal_iteratorIPSt6vectorIxSaIxEES2_IS4_SaIS4_EEEEEvT_S9_(ptr %22, ptr %23)
  %24 = load i32, ptr @k, align 4, !tbaa !9
  %25 = icmp sgt i32 %24, 0
  br i1 %25, label %30, label %.loopexit

.lr.ph:                                           ; preds = %0, %.lr.ph
  %.052 = phi i32 [ %27, %.lr.ph ], [ 0, %0 ]
  %26 = tail call i32 (ptr, ...) @__isoc99_scanf(ptr noundef nonnull @.str.6, ptr noundef nonnull @a, ptr noundef nonnull @b, ptr noundef nonnull @c, ptr noundef nonnull @d)
  tail call void @_ZNSt6vectorIxSaIxEE5clearEv(ptr noundef nonnull align 8 dereferenceable(24) @x) #6
  tail call void @_ZNSt6vectorIxSaIxEE9push_backERKx(ptr noundef nonnull align 8 dereferenceable(24) @x, ptr noundef nonnull align 8 dereferenceable(8) @c)
  tail call void @_ZNSt6vectorIxSaIxEE9push_backERKx(ptr noundef nonnull align 8 dereferenceable(24) @x, ptr noundef nonnull align 8 dereferenceable(8) @a)
  tail call void @_ZNSt6vectorIxSaIxEE9push_backERKx(ptr noundef nonnull align 8 dereferenceable(24) @x, ptr noundef nonnull align 8 dereferenceable(8) @d)
  tail call void @_ZNSt6vectorIxSaIxEE9push_backERKx(ptr noundef nonnull align 8 dereferenceable(24) @x, ptr noundef nonnull align 8 dereferenceable(8) @b)
  tail call void @_ZNSt6vectorIS_IxSaIxEESaIS1_EE9push_backERKS1_(ptr noundef nonnull align 8 dereferenceable(24) @t, ptr noundef nonnull align 8 dereferenceable(24) @x)
  %27 = add nuw nsw i32 %.052, 1
  %28 = load i32, ptr @k, align 4, !tbaa !9
  %29 = icmp slt i32 %27, %28
  br i1 %29, label %.lr.ph, label %._crit_edge, !llvm.loop !11

30:                                               ; preds = %._crit_edge
  %31 = load i64, ptr @m, align 8, !tbaa !5
  %32 = tail call noundef nonnull align 8 dereferenceable(24) ptr @_ZNSt6vectorIS_IxSaIxEESaIS1_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) @t, i64 noundef 0) #6
  %33 = tail call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSt6vectorIxSaIxEEixEm(ptr noundef nonnull align 8 dereferenceable(24) %32, i64 noundef 1) #6
  %34 = load i64, ptr %33, align 8, !tbaa !5
  %35 = add nsw i64 %34, -1
  %36 = tail call noundef i64 @_Z3expxx(i64 noundef %31, i64 noundef %35)
  store i64 %36, ptr @temp, align 8, !tbaa !5
  %37 = tail call noundef nonnull align 8 dereferenceable(24) ptr @_ZNSt6vectorIS_IxSaIxEESaIS1_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) @t, i64 noundef 0) #6
  %38 = tail call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSt6vectorIxSaIxEEixEm(ptr noundef nonnull align 8 dereferenceable(24) %37, i64 noundef 0) #6
  %39 = tail call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSt3mapIxxSt4lessIxESaISt4pairIKxxEEEixERS3_(ptr noundef nonnull align 8 dereferenceable(48) @ways, ptr noundef nonnull align 8 dereferenceable(8) %38)
  store i64 %36, ptr %39, align 8, !tbaa !5
  %40 = load i64, ptr @temp, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 16, ptr nonnull %1) #6
  %41 = tail call noundef nonnull align 8 dereferenceable(24) ptr @_ZNSt6vectorIS_IxSaIxEESaIS1_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) @t, i64 noundef 0) #6
  %42 = tail call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSt6vectorIxSaIxEEixEm(ptr noundef nonnull align 8 dereferenceable(24) %41, i64 noundef 2) #6
  %43 = tail call noundef nonnull align 8 dereferenceable(24) ptr @_ZNSt6vectorIS_IxSaIxEESaIS1_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) @t, i64 noundef 0) #6
  %44 = tail call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSt6vectorIxSaIxEEixEm(ptr noundef nonnull align 8 dereferenceable(24) %43, i64 noundef 0) #6
  %45 = tail call { i64, i64 } @_ZSt9make_pairIRxS0_ESt4pairINSt25__strip_reference_wrapperINSt5decayIT_E4typeEE6__typeENS2_INS3_IT0_E4typeEE6__typeEEOS4_OS9_(ptr noundef nonnull align 8 dereferenceable(8) %42, ptr noundef nonnull align 8 dereferenceable(8) %44)
  %46 = extractvalue { i64, i64 } %45, 0
  store i64 %46, ptr %1, align 8
  %47 = getelementptr inbounds i8, ptr %1, i64 8
  %48 = extractvalue { i64, i64 } %45, 1
  store i64 %48, ptr %47, align 8
  %49 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSt3mapISt4pairIxxExSt4lessIS1_ESaIS0_IKS1_xEEEixEOS1_(ptr noundef nonnull align 8 dereferenceable(48) @spec_v, ptr noundef nonnull align 8 dereferenceable(16) %1)
  store i64 %40, ptr %49, align 8, !tbaa !5
  call void @llvm.lifetime.end.p0(i64 16, ptr nonnull %1) #6
  %50 = load i32, ptr @k, align 4, !tbaa !9
  %51 = icmp sgt i32 %50, 1
  br i1 %51, label %.lr.ph55, label %.loopexit

.lr.ph55:                                         ; preds = %30
  %52 = getelementptr inbounds i8, ptr %3, i64 8
  %53 = getelementptr inbounds i8, ptr %5, i64 8
  %54 = getelementptr inbounds i8, ptr %11, i64 8
  %55 = getelementptr inbounds i8, ptr %15, i64 8
  %56 = getelementptr inbounds i8, ptr %13, i64 8
  %57 = getelementptr inbounds i8, ptr %14, i64 8
  br label %58

58:                                               ; preds = %.lr.ph55, %215
  %indvars.iv = phi i64 [ 1, %.lr.ph55 ], [ %indvars.iv.next, %215 ]
  %59 = load i64, ptr @m, align 8, !tbaa !5
  %60 = call noundef nonnull align 8 dereferenceable(24) ptr @_ZNSt6vectorIS_IxSaIxEESaIS1_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) @t, i64 noundef %indvars.iv) #6
  %61 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSt6vectorIxSaIxEEixEm(ptr noundef nonnull align 8 dereferenceable(24) %60, i64 noundef 1) #6
  %62 = load i64, ptr %61, align 8, !tbaa !5
  %63 = add nsw i64 %62, -1
  %64 = call noundef i64 @_Z3expxx(i64 noundef %59, i64 noundef %63)
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %2) #6
  call void @llvm.lifetime.start.p0(i64 16, ptr nonnull %3) #6
  %65 = call noundef nonnull align 8 dereferenceable(24) ptr @_ZNSt6vectorIS_IxSaIxEESaIS1_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) @t, i64 noundef %indvars.iv) #6
  %66 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSt6vectorIxSaIxEEixEm(ptr noundef nonnull align 8 dereferenceable(24) %65, i64 noundef 3) #6
  %67 = call noundef nonnull align 8 dereferenceable(24) ptr @_ZNSt6vectorIS_IxSaIxEESaIS1_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) @t, i64 noundef %indvars.iv) #6
  %68 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSt6vectorIxSaIxEEixEm(ptr noundef nonnull align 8 dereferenceable(24) %67, i64 noundef 1) #6
  %69 = call { i64, i64 } @_ZSt9make_pairIRxS0_ESt4pairINSt25__strip_reference_wrapperINSt5decayIT_E4typeEE6__typeENS2_INS3_IT0_E4typeEE6__typeEEOS4_OS9_(ptr noundef nonnull align 8 dereferenceable(8) %66, ptr noundef nonnull align 8 dereferenceable(8) %68)
  %70 = extractvalue { i64, i64 } %69, 0
  store i64 %70, ptr %3, align 8
  %71 = extractvalue { i64, i64 } %69, 1
  store i64 %71, ptr %52, align 8
  %72 = call ptr @_ZNSt3mapISt4pairIxxExSt4lessIS1_ESaIS0_IKS1_xEEE4findERS4_(ptr noundef nonnull align 8 dereferenceable(48) @spec_v, ptr noundef nonnull align 8 dereferenceable(16) %3)
  store ptr %72, ptr %2, align 8
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %4) #6
  %73 = call ptr @_ZNSt3mapISt4pairIxxExSt4lessIS1_ESaIS0_IKS1_xEEE3endEv(ptr noundef nonnull align 8 dereferenceable(48) @spec_v) #6
  store ptr %73, ptr %4, align 8
  %74 = call noundef zeroext i1 @_ZStneRKSt17_Rb_tree_iteratorISt4pairIKS0_IxxExEES6_(ptr noundef nonnull align 8 dereferenceable(8) %2, ptr noundef nonnull align 8 dereferenceable(8) %4) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %4) #6
  call void @llvm.lifetime.end.p0(i64 16, ptr nonnull %3) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %2) #6
  br i1 %74, label %75, label %85

75:                                               ; preds = %58
  call void @llvm.lifetime.start.p0(i64 16, ptr nonnull %5) #6
  %76 = call noundef nonnull align 8 dereferenceable(24) ptr @_ZNSt6vectorIS_IxSaIxEESaIS1_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) @t, i64 noundef %indvars.iv) #6
  %77 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSt6vectorIxSaIxEEixEm(ptr noundef nonnull align 8 dereferenceable(24) %76, i64 noundef 3) #6
  %78 = call noundef nonnull align 8 dereferenceable(24) ptr @_ZNSt6vectorIS_IxSaIxEESaIS1_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) @t, i64 noundef %indvars.iv) #6
  %79 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSt6vectorIxSaIxEEixEm(ptr noundef nonnull align 8 dereferenceable(24) %78, i64 noundef 1) #6
  %80 = call { i64, i64 } @_ZSt9make_pairIRxS0_ESt4pairINSt25__strip_reference_wrapperINSt5decayIT_E4typeEE6__typeENS2_INS3_IT0_E4typeEE6__typeEEOS4_OS9_(ptr noundef nonnull align 8 dereferenceable(8) %77, ptr noundef nonnull align 8 dereferenceable(8) %79)
  %81 = extractvalue { i64, i64 } %80, 0
  store i64 %81, ptr %5, align 8
  %82 = extractvalue { i64, i64 } %80, 1
  store i64 %82, ptr %53, align 8
  %83 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSt3mapISt4pairIxxExSt4lessIS1_ESaIS0_IKS1_xEEEixEOS1_(ptr noundef nonnull align 8 dereferenceable(48) @spec_v, ptr noundef nonnull align 8 dereferenceable(16) %5)
  %84 = load i64, ptr %83, align 8, !tbaa !5
  call void @llvm.lifetime.end.p0(i64 16, ptr nonnull %5) #6
  br label %108

85:                                               ; preds = %58
  %86 = call noundef nonnull align 8 dereferenceable(24) ptr @_ZNSt6vectorIS_IxSaIxEESaIS1_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) @t, i64 noundef %indvars.iv) #6
  %87 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSt6vectorIxSaIxEEixEm(ptr noundef nonnull align 8 dereferenceable(24) %86, i64 noundef 1) #6
  %88 = call ptr @_ZNSt3mapIxxSt4lessIxESaISt4pairIKxxEEE11lower_boundERS3_(ptr noundef nonnull align 8 dereferenceable(48) @ways, ptr noundef nonnull align 8 dereferenceable(8) %87)
  store ptr %88, ptr @it, align 8, !tbaa !13
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %6) #6
  %89 = call ptr @_ZNSt3mapIxxSt4lessIxESaISt4pairIKxxEEE5beginEv(ptr noundef nonnull align 8 dereferenceable(48) @ways) #6
  store ptr %89, ptr %6, align 8
  %90 = call noundef zeroext i1 @_ZStneRKSt17_Rb_tree_iteratorISt4pairIKxxEES5_(ptr noundef nonnull align 8 dereferenceable(8) @it, ptr noundef nonnull align 8 dereferenceable(8) %6) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %6) #6
  br i1 %90, label %91, label %108

91:                                               ; preds = %85
  %92 = call ptr @_ZNSt17_Rb_tree_iteratorISt4pairIKxxEEmmEi(ptr noundef nonnull align 8 dereferenceable(8) @it, i32 noundef 0) #6
  %93 = call noundef ptr @_ZNKSt17_Rb_tree_iteratorISt4pairIKxxEEptEv(ptr noundef nonnull align 8 dereferenceable(8) @it) #6
  %94 = getelementptr inbounds i8, ptr %93, i64 8
  %95 = load i64, ptr %94, align 8, !tbaa !15
  %96 = load i64, ptr @m, align 8, !tbaa !5
  %97 = call noundef nonnull align 8 dereferenceable(24) ptr @_ZNSt6vectorIS_IxSaIxEESaIS1_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) @t, i64 noundef %indvars.iv) #6
  %98 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSt6vectorIxSaIxEEixEm(ptr noundef nonnull align 8 dereferenceable(24) %97, i64 noundef 1) #6
  %99 = load i64, ptr %98, align 8, !tbaa !5
  %100 = call noundef ptr @_ZNKSt17_Rb_tree_iteratorISt4pairIKxxEEptEv(ptr noundef nonnull align 8 dereferenceable(8) @it) #6
  %101 = load i64, ptr %100, align 8, !tbaa !17
  %102 = xor i64 %101, -1
  %103 = add i64 %99, %102
  %104 = call noundef i64 @_Z3expxx(i64 noundef %96, i64 noundef %103)
  %105 = mul nsw i64 %104, %95
  %106 = load i64, ptr @MOD, align 8, !tbaa !5
  %107 = srem i64 %105, %106
  br label %108

108:                                              ; preds = %85, %91, %75
  %.050 = phi i64 [ %84, %75 ], [ %107, %91 ], [ 0, %85 ]
  %109 = call noundef nonnull align 8 dereferenceable(24) ptr @_ZNSt6vectorIS_IxSaIxEESaIS1_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) @t, i64 noundef %indvars.iv) #6
  %110 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSt6vectorIxSaIxEEixEm(ptr noundef nonnull align 8 dereferenceable(24) %109, i64 noundef 0) #6
  %111 = call ptr @_ZNSt3mapIxxSt4lessIxESaISt4pairIKxxEEE11lower_boundERS3_(ptr noundef nonnull align 8 dereferenceable(48) @ways, ptr noundef nonnull align 8 dereferenceable(8) %110)
  store ptr %111, ptr @it, align 8, !tbaa !13
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %7) #6
  %112 = call ptr @_ZNSt3mapIxxSt4lessIxESaISt4pairIKxxEEE5beginEv(ptr noundef nonnull align 8 dereferenceable(48) @ways) #6
  store ptr %112, ptr %7, align 8
  %113 = call noundef zeroext i1 @_ZStneRKSt17_Rb_tree_iteratorISt4pairIKxxEES5_(ptr noundef nonnull align 8 dereferenceable(8) @it, ptr noundef nonnull align 8 dereferenceable(8) %7) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %7) #6
  br i1 %113, label %114, label %131

114:                                              ; preds = %108
  %115 = call ptr @_ZNSt17_Rb_tree_iteratorISt4pairIKxxEEmmEi(ptr noundef nonnull align 8 dereferenceable(8) @it, i32 noundef 0) #6
  %116 = call noundef ptr @_ZNKSt17_Rb_tree_iteratorISt4pairIKxxEEptEv(ptr noundef nonnull align 8 dereferenceable(8) @it) #6
  %117 = getelementptr inbounds i8, ptr %116, i64 8
  %118 = load i64, ptr %117, align 8, !tbaa !15
  %119 = load i64, ptr @m, align 8, !tbaa !5
  %120 = call noundef nonnull align 8 dereferenceable(24) ptr @_ZNSt6vectorIS_IxSaIxEESaIS1_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) @t, i64 noundef %indvars.iv) #6
  %121 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSt6vectorIxSaIxEEixEm(ptr noundef nonnull align 8 dereferenceable(24) %120, i64 noundef 0) #6
  %122 = load i64, ptr %121, align 8, !tbaa !5
  %123 = call noundef ptr @_ZNKSt17_Rb_tree_iteratorISt4pairIKxxEEptEv(ptr noundef nonnull align 8 dereferenceable(8) @it) #6
  %124 = load i64, ptr %123, align 8, !tbaa !17
  %125 = xor i64 %124, -1
  %126 = add i64 %122, %125
  %127 = call noundef i64 @_Z3expxx(i64 noundef %119, i64 noundef %126)
  %128 = mul nsw i64 %127, %118
  %129 = load i64, ptr @MOD, align 8, !tbaa !5
  %130 = srem i64 %128, %129
  br label %131

131:                                              ; preds = %108, %114
  %.051 = phi i64 [ %130, %114 ], [ 0, %108 ]
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %8) #6
  %132 = call noundef nonnull align 8 dereferenceable(24) ptr @_ZNSt6vectorIS_IxSaIxEESaIS1_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) @t, i64 noundef %indvars.iv) #6
  %133 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSt6vectorIxSaIxEEixEm(ptr noundef nonnull align 8 dereferenceable(24) %132, i64 noundef 0) #6
  %134 = call ptr @_ZNSt3mapIxxSt4lessIxESaISt4pairIKxxEEE4findERS3_(ptr noundef nonnull align 8 dereferenceable(48) @ways, ptr noundef nonnull align 8 dereferenceable(8) %133)
  store ptr %134, ptr %8, align 8
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %9) #6
  %135 = call ptr @_ZNSt3mapIxxSt4lessIxESaISt4pairIKxxEEE3endEv(ptr noundef nonnull align 8 dereferenceable(48) @ways) #6
  store ptr %135, ptr %9, align 8
  %136 = call noundef zeroext i1 @_ZStneRKSt17_Rb_tree_iteratorISt4pairIKxxEES5_(ptr noundef nonnull align 8 dereferenceable(8) %8, ptr noundef nonnull align 8 dereferenceable(8) %9) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %9) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %8) #6
  %137 = call noundef nonnull align 8 dereferenceable(24) ptr @_ZNSt6vectorIS_IxSaIxEESaIS1_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) @t, i64 noundef %indvars.iv) #6
  %138 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSt6vectorIxSaIxEEixEm(ptr noundef nonnull align 8 dereferenceable(24) %137, i64 noundef 0) #6
  br i1 %136, label %139, label %147

139:                                              ; preds = %131
  %140 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSt3mapIxxSt4lessIxESaISt4pairIKxxEEEixERS3_(ptr noundef nonnull align 8 dereferenceable(48) @ways, ptr noundef nonnull align 8 dereferenceable(8) %138)
  %141 = load i64, ptr %140, align 8, !tbaa !5
  %142 = add nsw i64 %.050, %64
  %143 = load i64, ptr @MOD, align 8, !tbaa !5
  %144 = srem i64 %142, %143
  %145 = add nsw i64 %144, %141
  %146 = srem i64 %145, %143
  br label %164

147:                                              ; preds = %131
  %148 = load i64, ptr %138, align 8, !tbaa !5
  %149 = load i64, ptr @n, align 8, !tbaa !5
  %150 = add nsw i64 %149, 1
  %151 = icmp eq i64 %148, %150
  %152 = add nsw i64 %.050, %64
  %153 = load i64, ptr @MOD, align 8, !tbaa !5
  %154 = srem i64 %152, %153
  br i1 %151, label %155, label %158

155:                                              ; preds = %147
  %156 = add nsw i64 %154, %.051
  %157 = srem i64 %156, %153
  br label %164

158:                                              ; preds = %147
  %159 = load i64, ptr @m, align 8, !tbaa !5
  %160 = mul nsw i64 %159, %.051
  %161 = srem i64 %160, %153
  %162 = add nsw i64 %161, %154
  %163 = srem i64 %162, %153
  br label %164

164:                                              ; preds = %155, %158, %139
  %.sink = phi i64 [ %157, %155 ], [ %163, %158 ], [ %146, %139 ]
  %165 = call noundef nonnull align 8 dereferenceable(24) ptr @_ZNSt6vectorIS_IxSaIxEESaIS1_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) @t, i64 noundef %indvars.iv) #6
  %166 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSt6vectorIxSaIxEEixEm(ptr noundef nonnull align 8 dereferenceable(24) %165, i64 noundef 0) #6
  %167 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSt3mapIxxSt4lessIxESaISt4pairIKxxEEEixERS3_(ptr noundef nonnull align 8 dereferenceable(48) @ways, ptr noundef nonnull align 8 dereferenceable(8) %166)
  store i64 %.sink, ptr %167, align 8, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %10) #6
  call void @llvm.lifetime.start.p0(i64 16, ptr nonnull %11) #6
  %168 = call noundef nonnull align 8 dereferenceable(24) ptr @_ZNSt6vectorIS_IxSaIxEESaIS1_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) @t, i64 noundef %indvars.iv) #6
  %169 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSt6vectorIxSaIxEEixEm(ptr noundef nonnull align 8 dereferenceable(24) %168, i64 noundef 2) #6
  %170 = call noundef nonnull align 8 dereferenceable(24) ptr @_ZNSt6vectorIS_IxSaIxEESaIS1_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) @t, i64 noundef %indvars.iv) #6
  %171 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSt6vectorIxSaIxEEixEm(ptr noundef nonnull align 8 dereferenceable(24) %170, i64 noundef 0) #6
  %172 = call { i64, i64 } @_ZSt9make_pairIRxS0_ESt4pairINSt25__strip_reference_wrapperINSt5decayIT_E4typeEE6__typeENS2_INS3_IT0_E4typeEE6__typeEEOS4_OS9_(ptr noundef nonnull align 8 dereferenceable(8) %169, ptr noundef nonnull align 8 dereferenceable(8) %171)
  %173 = extractvalue { i64, i64 } %172, 0
  store i64 %173, ptr %11, align 8
  %174 = extractvalue { i64, i64 } %172, 1
  store i64 %174, ptr %54, align 8
  %175 = call ptr @_ZNSt3mapISt4pairIxxExSt4lessIS1_ESaIS0_IKS1_xEEE4findERS4_(ptr noundef nonnull align 8 dereferenceable(48) @spec_v, ptr noundef nonnull align 8 dereferenceable(16) %11)
  store ptr %175, ptr %10, align 8
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %12) #6
  %176 = call ptr @_ZNSt3mapISt4pairIxxExSt4lessIS1_ESaIS0_IKS1_xEEE3endEv(ptr noundef nonnull align 8 dereferenceable(48) @spec_v) #6
  store ptr %176, ptr %12, align 8
  %177 = call noundef zeroext i1 @_ZStneRKSt17_Rb_tree_iteratorISt4pairIKS0_IxxExEES6_(ptr noundef nonnull align 8 dereferenceable(8) %10, ptr noundef nonnull align 8 dereferenceable(8) %12) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %12) #6
  call void @llvm.lifetime.end.p0(i64 16, ptr nonnull %11) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %10) #6
  br i1 %177, label %178, label %201

178:                                              ; preds = %164
  call void @llvm.lifetime.start.p0(i64 16, ptr nonnull %13) #6
  %179 = call noundef nonnull align 8 dereferenceable(24) ptr @_ZNSt6vectorIS_IxSaIxEESaIS1_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) @t, i64 noundef %indvars.iv) #6
  %180 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSt6vectorIxSaIxEEixEm(ptr noundef nonnull align 8 dereferenceable(24) %179, i64 noundef 2) #6
  %181 = call noundef nonnull align 8 dereferenceable(24) ptr @_ZNSt6vectorIS_IxSaIxEESaIS1_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) @t, i64 noundef %indvars.iv) #6
  %182 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSt6vectorIxSaIxEEixEm(ptr noundef nonnull align 8 dereferenceable(24) %181, i64 noundef 0) #6
  %183 = call { i64, i64 } @_ZSt9make_pairIRxS0_ESt4pairINSt25__strip_reference_wrapperINSt5decayIT_E4typeEE6__typeENS2_INS3_IT0_E4typeEE6__typeEEOS4_OS9_(ptr noundef nonnull align 8 dereferenceable(8) %180, ptr noundef nonnull align 8 dereferenceable(8) %182)
  %184 = extractvalue { i64, i64 } %183, 0
  store i64 %184, ptr %13, align 8
  %185 = extractvalue { i64, i64 } %183, 1
  store i64 %185, ptr %56, align 8
  %186 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSt3mapISt4pairIxxExSt4lessIS1_ESaIS0_IKS1_xEEEixEOS1_(ptr noundef nonnull align 8 dereferenceable(48) @spec_v, ptr noundef nonnull align 8 dereferenceable(16) %13)
  %187 = load i64, ptr %186, align 8, !tbaa !5
  %188 = add nsw i64 %.050, %64
  %189 = load i64, ptr @MOD, align 8, !tbaa !5
  %190 = srem i64 %188, %189
  %191 = add nsw i64 %190, %187
  %192 = srem i64 %191, %189
  call void @llvm.lifetime.start.p0(i64 16, ptr nonnull %14) #6
  %193 = call noundef nonnull align 8 dereferenceable(24) ptr @_ZNSt6vectorIS_IxSaIxEESaIS1_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) @t, i64 noundef %indvars.iv) #6
  %194 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSt6vectorIxSaIxEEixEm(ptr noundef nonnull align 8 dereferenceable(24) %193, i64 noundef 2) #6
  %195 = call noundef nonnull align 8 dereferenceable(24) ptr @_ZNSt6vectorIS_IxSaIxEESaIS1_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) @t, i64 noundef %indvars.iv) #6
  %196 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSt6vectorIxSaIxEEixEm(ptr noundef nonnull align 8 dereferenceable(24) %195, i64 noundef 0) #6
  %197 = call { i64, i64 } @_ZSt9make_pairIRxS0_ESt4pairINSt25__strip_reference_wrapperINSt5decayIT_E4typeEE6__typeENS2_INS3_IT0_E4typeEE6__typeEEOS4_OS9_(ptr noundef nonnull align 8 dereferenceable(8) %194, ptr noundef nonnull align 8 dereferenceable(8) %196)
  %198 = extractvalue { i64, i64 } %197, 0
  store i64 %198, ptr %14, align 8
  %199 = extractvalue { i64, i64 } %197, 1
  store i64 %199, ptr %57, align 8
  %200 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSt3mapISt4pairIxxExSt4lessIS1_ESaIS0_IKS1_xEEEixEOS1_(ptr noundef nonnull align 8 dereferenceable(48) @spec_v, ptr noundef nonnull align 8 dereferenceable(16) %14)
  store i64 %192, ptr %200, align 8, !tbaa !5
  call void @llvm.lifetime.end.p0(i64 16, ptr nonnull %14) #6
  call void @llvm.lifetime.end.p0(i64 16, ptr nonnull %13) #6
  br label %215

201:                                              ; preds = %164
  %202 = add nsw i64 %.050, %64
  %203 = load i64, ptr @MOD, align 8, !tbaa !5
  %204 = srem i64 %202, %203
  %205 = add nsw i64 %204, %.051
  %206 = srem i64 %205, %203
  call void @llvm.lifetime.start.p0(i64 16, ptr nonnull %15) #6
  %207 = call noundef nonnull align 8 dereferenceable(24) ptr @_ZNSt6vectorIS_IxSaIxEESaIS1_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) @t, i64 noundef %indvars.iv) #6
  %208 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSt6vectorIxSaIxEEixEm(ptr noundef nonnull align 8 dereferenceable(24) %207, i64 noundef 2) #6
  %209 = call noundef nonnull align 8 dereferenceable(24) ptr @_ZNSt6vectorIS_IxSaIxEESaIS1_EEixEm(ptr noundef nonnull align 8 dereferenceable(24) @t, i64 noundef %indvars.iv) #6
  %210 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSt6vectorIxSaIxEEixEm(ptr noundef nonnull align 8 dereferenceable(24) %209, i64 noundef 0) #6
  %211 = call { i64, i64 } @_ZSt9make_pairIRxS0_ESt4pairINSt25__strip_reference_wrapperINSt5decayIT_E4typeEE6__typeENS2_INS3_IT0_E4typeEE6__typeEEOS4_OS9_(ptr noundef nonnull align 8 dereferenceable(8) %208, ptr noundef nonnull align 8 dereferenceable(8) %210)
  %212 = extractvalue { i64, i64 } %211, 0
  store i64 %212, ptr %15, align 8
  %213 = extractvalue { i64, i64 } %211, 1
  store i64 %213, ptr %55, align 8
  %214 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSt3mapISt4pairIxxExSt4lessIS1_ESaIS0_IKS1_xEEEixEOS1_(ptr noundef nonnull align 8 dereferenceable(48) @spec_v, ptr noundef nonnull align 8 dereferenceable(16) %15)
  store i64 %206, ptr %214, align 8, !tbaa !5
  call void @llvm.lifetime.end.p0(i64 16, ptr nonnull %15) #6
  br label %215

215:                                              ; preds = %201, %178
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  %216 = load i32, ptr @k, align 4, !tbaa !9
  %217 = sext i32 %216 to i64
  %218 = icmp slt i64 %indvars.iv.next, %217
  br i1 %218, label %58, label %.loopexit, !llvm.loop !18

.loopexit:                                        ; preds = %215, %30, %._crit_edge
  %219 = call noundef zeroext i1 @_ZNKSt3mapIxxSt4lessIxESaISt4pairIKxxEEE5emptyEv(ptr noundef nonnull align 8 dereferenceable(48) @ways) #6
  br i1 %219, label %.loopexit._crit_edge, label %220

.loopexit._crit_edge:                             ; preds = %.loopexit
  %.pre = load i64, ptr @res, align 8, !tbaa !5
  br label %238

220:                                              ; preds = %.loopexit
  %221 = call ptr @_ZNSt3mapIxxSt4lessIxESaISt4pairIKxxEEE3endEv(ptr noundef nonnull align 8 dereferenceable(48) @ways) #6
  store ptr %221, ptr @it, align 8, !tbaa !13
  %222 = call ptr @_ZNSt17_Rb_tree_iteratorISt4pairIKxxEEmmEi(ptr noundef nonnull align 8 dereferenceable(8) @it, i32 noundef 0) #6
  %223 = load i64, ptr @res, align 8, !tbaa !5
  %224 = call noundef ptr @_ZNKSt17_Rb_tree_iteratorISt4pairIKxxEEptEv(ptr noundef nonnull align 8 dereferenceable(8) @it) #6
  %225 = getelementptr inbounds i8, ptr %224, i64 8
  %226 = load i64, ptr %225, align 8, !tbaa !15
  %227 = load i64, ptr @m, align 8, !tbaa !5
  %228 = load i64, ptr @n, align 8, !tbaa !5
  %229 = call noundef ptr @_ZNKSt17_Rb_tree_iteratorISt4pairIKxxEEptEv(ptr noundef nonnull align 8 dereferenceable(8) @it) #6
  %230 = load i64, ptr %229, align 8, !tbaa !17
  %231 = sub nsw i64 %228, %230
  %232 = call noundef i64 @_Z3expxx(i64 noundef %227, i64 noundef %231)
  %233 = mul nsw i64 %232, %226
  %234 = load i64, ptr @MOD, align 8, !tbaa !5
  %235 = srem i64 %233, %234
  %236 = add nsw i64 %235, %223
  %237 = srem i64 %236, %234
  store i64 %237, ptr @res, align 8, !tbaa !5
  br label %238

238:                                              ; preds = %.loopexit._crit_edge, %220
  %239 = phi i64 [ %.pre, %.loopexit._crit_edge ], [ %237, %220 ]
  %240 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEx(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cout, i64 noundef %239)
  %241 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEPFRSoS_E(ptr noundef nonnull align 8 dereferenceable(8) %240, ptr noundef nonnull @_ZSt4endlIcSt11char_traitsIcEERSt13basic_ostreamIT_T0_ES6_)
  ret i32 0
}

; Function Attrs: nofree nounwind
declare noundef i32 @__isoc99_scanf(ptr nocapture noundef readonly, ...) local_unnamed_addr #3

; 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 uwtable
declare dso_local void @_ZNSt6vectorIxSaIxEE9push_backERKx(ptr noundef nonnull align 8 dereferenceable(24), ptr noundef nonnull align 8 dereferenceable(8)) local_unnamed_addr #4 align 2

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

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

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

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

; Function Attrs: mustprogress uwtable
declare dso_local noundef nonnull align 8 dereferenceable(8) ptr @_ZNSt3mapIxxSt4lessIxESaISt4pairIKxxEEEixERS3_(ptr noundef nonnull align 8 dereferenceable(48), ptr noundef nonnull align 8 dereferenceable(8)) local_unnamed_addr #4 align 2

; Function Attrs: mustprogress uwtable
declare dso_local noundef nonnull align 8 dereferenceable(8) ptr @_ZNSt3mapISt4pairIxxExSt4lessIS1_ESaIS0_IKS1_xEEEixEOS1_(ptr noundef nonnull align 8 dereferenceable(48), ptr noundef nonnull align 8 dereferenceable(16)) local_unnamed_addr #4 align 2

; Function Attrs: mustprogress uwtable
declare dso_local { i64, i64 } @_ZSt9make_pairIRxS0_ESt4pairINSt25__strip_reference_wrapperINSt5decayIT_E4typeEE6__typeENS2_INS3_IT0_E4typeEE6__typeEEOS4_OS9_(ptr noundef nonnull align 8 dereferenceable(8), ptr noundef nonnull align 8 dereferenceable(8)) local_unnamed_addr #4

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

; Function Attrs: mustprogress uwtable
declare dso_local ptr @_ZNSt3mapISt4pairIxxExSt4lessIS1_ESaIS0_IKS1_xEEE4findERS4_(ptr noundef nonnull align 8 dereferenceable(48), ptr noundef nonnull align 8 dereferenceable(16)) local_unnamed_addr #4 align 2

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

; Function Attrs: mustprogress uwtable
declare dso_local ptr @_ZNSt3mapIxxSt4lessIxESaISt4pairIKxxEEE11lower_boundERS3_(ptr noundef nonnull align 8 dereferenceable(48), ptr noundef nonnull align 8 dereferenceable(8)) local_unnamed_addr #4 align 2

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

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

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

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

; Function Attrs: mustprogress uwtable
declare dso_local ptr @_ZNSt3mapIxxSt4lessIxESaISt4pairIKxxEEE4findERS3_(ptr noundef nonnull align 8 dereferenceable(48), ptr noundef nonnull align 8 dereferenceable(8)) local_unnamed_addr #4 align 2

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

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

; 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 = { nofree nounwind "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 = !{!"long long", !7, i64 0}
!7 = !{!"omnipotent char", !8, i64 0}
!8 = !{!"Simple C++ TBAA"}
!9 = !{!10, !10, i64 0}
!10 = !{!"int", !7, i64 0}
!11 = distinct !{!11, !12}
!12 = !{!"llvm.loop.mustprogress"}
!13 = !{!14, !14, i64 0}
!14 = !{!"any pointer", !7, i64 0}
!15 = !{!16, !6, i64 8}
!16 = !{!"_ZTSSt4pairIKxxE", !6, i64 0, !6, i64 8}
!17 = !{!16, !6, i64 0}
!18 = distinct !{!18, !12}


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