; LLVM IR from eyangch/competitive-programming :: Codeforces/1493 (d)

; Unoptimized IR (clang -disable-llvm-passes):
target datalayout = "e-m:e-p270:32:32-p271:32:32-p272:64:64-i64:64-i128:128-f80:128-n8:16:32:64-S128"
target triple = "x86_64-unknown-linux-gnu"

%"class.std::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::multiset" = type { %"class.std::_Rb_tree.0" }
%"class.std::_Rb_tree.0" = type { %"struct.std::_Rb_tree<long long, long long, std::_Identity<long long>, std::less<long long>>::_Rb_tree_impl" }
%"struct.std::_Rb_tree<long long, long long, std::_Identity<long long>, std::less<long long>>::_Rb_tree_impl" = type { [8 x i8], %"struct.std::_Rb_tree_header" }
%"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::_Rb_tree_iterator" = type { ptr }
%"struct.std::pair" = type { i64, i64 }
%"struct.std::_Rb_tree_const_iterator" = type { ptr }

@MOD = external dso_local global i64, align 8
@N = external dso_local global i64, align 8
@Q = external dso_local global i64, align 8
@sieve = external dso_local global [200001 x i64], align 16
@m = external dso_local global [200001 x %"class.std::map"], align 16
@ex = external dso_local global [200001 x %"class.std::multiset"], align 16
@_ZSt3cin = external global %"class.std::basic_istream", align 8
@_ZSt4cout = external global %"class.std::basic_ostream", align 8
@.str = external hidden unnamed_addr constant [2 x i8], align 1

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

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

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef i64 @_Z4bpowxx(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 personality ptr @__gxx_personality_v0 {
  %1 = alloca i32, align 4
  %2 = alloca i64, align 8
  %3 = alloca i32, align 4
  %4 = alloca i64, align 8
  %5 = alloca i64, align 8
  %6 = alloca i64, align 8
  %7 = alloca ptr, align 8
  %8 = alloca %"struct.std::_Rb_tree_iterator", align 8
  %9 = alloca %"struct.std::_Rb_tree_iterator", align 8
  %10 = alloca %"struct.std::pair", align 8
  %11 = alloca %"struct.std::_Rb_tree_const_iterator", align 8
  %12 = alloca i64, align 8
  %13 = alloca i64, align 8
  %14 = alloca %"struct.std::_Rb_tree_const_iterator", align 8
  %15 = alloca i64, align 8
  %16 = alloca i64, align 8
  %17 = alloca %"class.std::map", align 8
  %18 = alloca ptr, align 8
  %19 = alloca i32, align 4
  %20 = alloca ptr, align 8
  %21 = alloca %"struct.std::_Rb_tree_iterator", align 8
  %22 = alloca %"struct.std::_Rb_tree_iterator", align 8
  %23 = alloca %"struct.std::pair", align 8
  %24 = alloca i64, align 8
  %25 = alloca %"struct.std::_Rb_tree_const_iterator", align 8
  %26 = alloca %"struct.std::_Rb_tree_const_iterator", align 8
  %27 = alloca %"struct.std::_Rb_tree_const_iterator", align 8
  %28 = alloca %"struct.std::_Rb_tree_const_iterator", align 8
  %29 = alloca i64, align 8
  %30 = alloca %"struct.std::_Rb_tree_const_iterator", align 8
  store i32 0, ptr %1, align 4
  %31 = load ptr, ptr @_ZSt3cin, align 8, !tbaa !5
  %32 = getelementptr i8, ptr %31, i64 -24
  %33 = load i64, ptr %32, align 8
  %34 = getelementptr inbounds i8, ptr @_ZSt3cin, i64 %33
  %35 = call noundef ptr @_ZNSt9basic_iosIcSt11char_traitsIcEE3tieEPSo(ptr noundef nonnull align 8 dereferenceable(264) %34, ptr noundef null)
  %36 = call noundef zeroext i1 @_ZNSt8ios_base15sync_with_stdioEb(i1 noundef zeroext false)
  %37 = 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)
  %38 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERx(ptr noundef nonnull align 8 dereferenceable(16) %37, ptr noundef nonnull align 8 dereferenceable(8) @Q)
  call void @llvm.lifetime.start.p0(i64 8, ptr %2) #6
  store i64 2, ptr %2, align 8, !tbaa !8
  br label %39

39:                                               ; preds = %64, %0
  %40 = load i64, ptr %2, align 8, !tbaa !8
  %41 = icmp slt i64 %40, 200001
  br i1 %41, label %43, label %42

42:                                               ; preds = %39
  store i32 2, ptr %3, align 4
  call void @llvm.lifetime.end.p0(i64 8, ptr %2) #6
  br label %67

43:                                               ; preds = %39
  %44 = load i64, ptr %2, align 8, !tbaa !8
  %45 = getelementptr inbounds [200001 x i64], ptr @sieve, i64 0, i64 %44
  %46 = load i64, ptr %45, align 8, !tbaa !8
  %47 = icmp ne i64 %46, 0
  br i1 %47, label %63, label %48

48:                                               ; preds = %43
  call void @llvm.lifetime.start.p0(i64 8, ptr %4) #6
  %49 = load i64, ptr %2, align 8, !tbaa !8
  store i64 %49, ptr %4, align 8, !tbaa !8
  br label %50

50:                                               ; preds = %58, %48
  %51 = load i64, ptr %4, align 8, !tbaa !8
  %52 = icmp slt i64 %51, 200001
  br i1 %52, label %54, label %53

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

54:                                               ; preds = %50
  %55 = load i64, ptr %2, align 8, !tbaa !8
  %56 = load i64, ptr %4, align 8, !tbaa !8
  %57 = getelementptr inbounds [200001 x i64], ptr @sieve, i64 0, i64 %56
  store i64 %55, ptr %57, align 8, !tbaa !8
  br label %58

58:                                               ; preds = %54
  %59 = load i64, ptr %2, align 8, !tbaa !8
  %60 = load i64, ptr %4, align 8, !tbaa !8
  %61 = add nsw i64 %60, %59
  store i64 %61, ptr %4, align 8, !tbaa !8
  br label %50, !llvm.loop !11

62:                                               ; preds = %53
  br label %63

63:                                               ; preds = %62, %43
  br label %64

64:                                               ; preds = %63
  %65 = load i64, ptr %2, align 8, !tbaa !8
  %66 = add nsw i64 %65, 1
  store i64 %66, ptr %2, align 8, !tbaa !8
  br label %39, !llvm.loop !13

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

68:                                               ; preds = %114, %67
  %69 = load i64, ptr %5, align 8, !tbaa !8
  %70 = load i64, ptr @N, align 8, !tbaa !8
  %71 = icmp slt i64 %69, %70
  br i1 %71, label %73, label %72

72:                                               ; preds = %68
  store i32 8, ptr %3, align 4
  call void @llvm.lifetime.end.p0(i64 8, ptr %5) #6
  br label %117

73:                                               ; preds = %68
  call void @llvm.lifetime.start.p0(i64 8, ptr %6) #6
  %74 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERx(ptr noundef nonnull align 8 dereferenceable(16) @_ZSt3cin, ptr noundef nonnull align 8 dereferenceable(8) %6)
  br label %75

75:                                               ; preds = %78, %73
  %76 = load i64, ptr %6, align 8, !tbaa !8
  %77 = icmp sgt i64 %76, 1
  br i1 %77, label %78, label %91

78:                                               ; preds = %75
  %79 = load i64, ptr %5, align 8, !tbaa !8
  %80 = getelementptr inbounds [200001 x %"class.std::map"], ptr @m, i64 0, i64 %79
  %81 = load i64, ptr %6, align 8, !tbaa !8
  %82 = getelementptr inbounds [200001 x i64], ptr @sieve, i64 0, i64 %81
  %83 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSt3mapIxxSt4lessIxESaISt4pairIKxxEEEixERS3_(ptr noundef nonnull align 8 dereferenceable(48) %80, ptr noundef nonnull align 8 dereferenceable(8) %82)
  %84 = load i64, ptr %83, align 8, !tbaa !8
  %85 = add nsw i64 %84, 1
  store i64 %85, ptr %83, align 8, !tbaa !8
  %86 = load i64, ptr %6, align 8, !tbaa !8
  %87 = getelementptr inbounds [200001 x i64], ptr @sieve, i64 0, i64 %86
  %88 = load i64, ptr %87, align 8, !tbaa !8
  %89 = load i64, ptr %6, align 8, !tbaa !8
  %90 = sdiv i64 %89, %88
  store i64 %90, ptr %6, align 8, !tbaa !8
  br label %75, !llvm.loop !14

91:                                               ; preds = %75
  call void @llvm.lifetime.start.p0(i64 8, ptr %7) #6
  %92 = load i64, ptr %5, align 8, !tbaa !8
  %93 = getelementptr inbounds [200001 x %"class.std::map"], ptr @m, i64 0, i64 %92
  store ptr %93, ptr %7, align 8, !tbaa !15
  call void @llvm.lifetime.start.p0(i64 8, ptr %8) #6
  %94 = load ptr, ptr %7, align 8, !tbaa !15
  %95 = call ptr @_ZNSt3mapIxxSt4lessIxESaISt4pairIKxxEEE5beginEv(ptr noundef nonnull align 8 dereferenceable(48) %94) #6
  %96 = getelementptr inbounds %"struct.std::_Rb_tree_iterator", ptr %8, i32 0, i32 0
  store ptr %95, ptr %96, align 8
  call void @llvm.lifetime.start.p0(i64 8, ptr %9) #6
  %97 = load ptr, ptr %7, align 8, !tbaa !15
  %98 = call ptr @_ZNSt3mapIxxSt4lessIxESaISt4pairIKxxEEE3endEv(ptr noundef nonnull align 8 dereferenceable(48) %97) #6
  %99 = getelementptr inbounds %"struct.std::_Rb_tree_iterator", ptr %9, i32 0, i32 0
  store ptr %98, ptr %99, align 8
  br label %100

100:                                              ; preds = %111, %91
  %101 = 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
  br i1 %101, label %103, label %102

102:                                              ; preds = %100
  store i32 13, ptr %3, align 4
  call void @llvm.lifetime.end.p0(i64 8, ptr %9) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr %8) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr %7) #6
  br label %113

103:                                              ; preds = %100
  call void @llvm.lifetime.start.p0(i64 16, ptr %10) #6
  %104 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNKSt17_Rb_tree_iteratorISt4pairIKxxEEdeEv(ptr noundef nonnull align 8 dereferenceable(8) %8) #6
  call void @_ZNSt4pairIxxEC2IKxxTnNSt9enable_ifIXaaclsr6_PCCFPIT_T0_EE18_ConstructiblePairIS4_S5_EEclsr6_PCCFPIS4_S5_EE26_ImplicitlyConvertiblePairIS4_S5_EEEbE4typeELb1EEERKS_IS4_S5_E(ptr noundef nonnull align 8 dereferenceable(16) %10, ptr noundef nonnull align 8 dereferenceable(16) %104)
  %105 = getelementptr inbounds %"struct.std::pair", ptr %10, i32 0, i32 0
  %106 = load i64, ptr %105, align 8, !tbaa !17
  %107 = getelementptr inbounds [200001 x %"class.std::multiset"], ptr @ex, i64 0, i64 %106
  %108 = getelementptr inbounds %"struct.std::pair", ptr %10, i32 0, i32 1
  %109 = call ptr @_ZNSt8multisetIxSt4lessIxESaIxEE6insertERKx(ptr noundef nonnull align 8 dereferenceable(48) %107, ptr noundef nonnull align 8 dereferenceable(8) %108)
  %110 = getelementptr inbounds %"struct.std::_Rb_tree_const_iterator", ptr %11, i32 0, i32 0
  store ptr %109, ptr %110, align 8
  call void @llvm.lifetime.end.p0(i64 16, ptr %10) #6
  br label %111

111:                                              ; preds = %103
  %112 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSt17_Rb_tree_iteratorISt4pairIKxxEEppEv(ptr noundef nonnull align 8 dereferenceable(8) %8) #6
  br label %100

113:                                              ; preds = %102
  call void @llvm.lifetime.end.p0(i64 8, ptr %6) #6
  br label %114

114:                                              ; preds = %113
  %115 = load i64, ptr %5, align 8, !tbaa !8
  %116 = add nsw i64 %115, 1
  store i64 %116, ptr %5, align 8, !tbaa !8
  br label %68, !llvm.loop !19

117:                                              ; preds = %72
  call void @llvm.lifetime.start.p0(i64 8, ptr %12) #6
  store i64 1, ptr %12, align 8, !tbaa !8
  call void @llvm.lifetime.start.p0(i64 8, ptr %13) #6
  store i64 0, ptr %13, align 8, !tbaa !8
  br label %118

118:                                              ; preds = %142, %117
  %119 = load i64, ptr %13, align 8, !tbaa !8
  %120 = icmp slt i64 %119, 200001
  br i1 %120, label %122, label %121

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

122:                                              ; preds = %118
  %123 = load i64, ptr %13, align 8, !tbaa !8
  %124 = getelementptr inbounds [200001 x %"class.std::multiset"], ptr @ex, i64 0, i64 %123
  %125 = call noundef i64 @_ZNKSt8multisetIxSt4lessIxESaIxEE4sizeEv(ptr noundef nonnull align 8 dereferenceable(48) %124) #6
  %126 = load i64, ptr @N, align 8, !tbaa !8
  %127 = icmp eq i64 %125, %126
  br i1 %127, label %128, label %141

128:                                              ; preds = %122
  %129 = load i64, ptr %12, align 8, !tbaa !8
  %130 = load i64, ptr %13, align 8, !tbaa !8
  call void @llvm.lifetime.start.p0(i64 8, ptr %14) #6
  %131 = load i64, ptr %13, align 8, !tbaa !8
  %132 = getelementptr inbounds [200001 x %"class.std::multiset"], ptr @ex, i64 0, i64 %131
  %133 = call ptr @_ZNKSt8multisetIxSt4lessIxESaIxEE5beginEv(ptr noundef nonnull align 8 dereferenceable(48) %132) #6
  %134 = getelementptr inbounds %"struct.std::_Rb_tree_const_iterator", ptr %14, i32 0, i32 0
  store ptr %133, ptr %134, align 8
  %135 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNKSt23_Rb_tree_const_iteratorIxEdeEv(ptr noundef nonnull align 8 dereferenceable(8) %14) #6
  %136 = load i64, ptr %135, align 8, !tbaa !8
  %137 = call noundef i64 @_Z4bpowxx(i64 noundef %130, i64 noundef %136)
  %138 = mul nsw i64 %129, %137
  %139 = load i64, ptr @MOD, align 8, !tbaa !8
  %140 = srem i64 %138, %139
  store i64 %140, ptr %12, align 8, !tbaa !8
  call void @llvm.lifetime.end.p0(i64 8, ptr %14) #6
  br label %141

141:                                              ; preds = %128, %122
  br label %142

142:                                              ; preds = %141
  %143 = load i64, ptr %13, align 8, !tbaa !8
  %144 = add nsw i64 %143, 1
  store i64 %144, ptr %13, align 8, !tbaa !8
  br label %118, !llvm.loop !20

145:                                              ; preds = %121
  br label %146

146:                                              ; preds = %290, %145
  %147 = load i64, ptr @Q, align 8, !tbaa !8
  %148 = add nsw i64 %147, -1
  store i64 %148, ptr @Q, align 8, !tbaa !8
  %149 = icmp ne i64 %147, 0
  br i1 %149, label %150, label %292

150:                                              ; preds = %146
  call void @llvm.lifetime.start.p0(i64 8, ptr %15) #6
  call void @llvm.lifetime.start.p0(i64 8, ptr %16) #6
  %151 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERx(ptr noundef nonnull align 8 dereferenceable(16) @_ZSt3cin, ptr noundef nonnull align 8 dereferenceable(8) %15)
  %152 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERx(ptr noundef nonnull align 8 dereferenceable(16) %151, ptr noundef nonnull align 8 dereferenceable(8) %16)
  %153 = load i64, ptr %15, align 8, !tbaa !8
  %154 = add nsw i64 %153, -1
  store i64 %154, ptr %15, align 8, !tbaa !8
  call void @llvm.lifetime.start.p0(i64 48, ptr %17) #6
  call void @_ZNSt3mapIxxSt4lessIxESaISt4pairIKxxEEEC2Ev(ptr noundef nonnull align 8 dereferenceable(48) %17) #6
  br label %155

155:                                              ; preds = %162, %150
  %156 = load i64, ptr %16, align 8, !tbaa !8
  %157 = icmp sgt i64 %156, 1
  br i1 %157, label %158, label %174

158:                                              ; preds = %155
  %159 = load i64, ptr %16, align 8, !tbaa !8
  %160 = getelementptr inbounds [200001 x i64], ptr @sieve, i64 0, i64 %159
  %161 = invoke noundef nonnull align 8 dereferenceable(8) ptr @_ZNSt3mapIxxSt4lessIxESaISt4pairIKxxEEEixERS3_(ptr noundef nonnull align 8 dereferenceable(48) %17, ptr noundef nonnull align 8 dereferenceable(8) %160)
          to label %162 unwind label %170

162:                                              ; preds = %158
  %163 = load i64, ptr %161, align 8, !tbaa !8
  %164 = add nsw i64 %163, 1
  store i64 %164, ptr %161, align 8, !tbaa !8
  %165 = load i64, ptr %16, align 8, !tbaa !8
  %166 = getelementptr inbounds [200001 x i64], ptr @sieve, i64 0, i64 %165
  %167 = load i64, ptr %166, align 8, !tbaa !8
  %168 = load i64, ptr %16, align 8, !tbaa !8
  %169 = sdiv i64 %168, %167
  store i64 %169, ptr %16, align 8, !tbaa !8
  br label %155, !llvm.loop !21

170:                                              ; preds = %288, %285, %158
  %171 = landingpad { ptr, i32 }
          cleanup
  %172 = extractvalue { ptr, i32 } %171, 0
  store ptr %172, ptr %18, align 8
  %173 = extractvalue { ptr, i32 } %171, 1
  store i32 %173, ptr %19, align 4
  br label %291

174:                                              ; preds = %155
  call void @llvm.lifetime.start.p0(i64 8, ptr %20) #6
  store ptr %17, ptr %20, align 8, !tbaa !15
  call void @llvm.lifetime.start.p0(i64 8, ptr %21) #6
  %175 = load ptr, ptr %20, align 8, !tbaa !15
  %176 = call ptr @_ZNSt3mapIxxSt4lessIxESaISt4pairIKxxEEE5beginEv(ptr noundef nonnull align 8 dereferenceable(48) %175) #6
  %177 = getelementptr inbounds %"struct.std::_Rb_tree_iterator", ptr %21, i32 0, i32 0
  store ptr %176, ptr %177, align 8
  call void @llvm.lifetime.start.p0(i64 8, ptr %22) #6
  %178 = load ptr, ptr %20, align 8, !tbaa !15
  %179 = call ptr @_ZNSt3mapIxxSt4lessIxESaISt4pairIKxxEEE3endEv(ptr noundef nonnull align 8 dereferenceable(48) %178) #6
  %180 = getelementptr inbounds %"struct.std::_Rb_tree_iterator", ptr %22, i32 0, i32 0
  store ptr %179, ptr %180, align 8
  br label %181

181:                                              ; preds = %282, %174
  %182 = call noundef zeroext i1 @_ZStneRKSt17_Rb_tree_iteratorISt4pairIKxxEES5_(ptr noundef nonnull align 8 dereferenceable(8) %21, ptr noundef nonnull align 8 dereferenceable(8) %22) #6
  br i1 %182, label %184, label %183

183:                                              ; preds = %181
  store i32 22, ptr %3, align 4
  call void @llvm.lifetime.end.p0(i64 8, ptr %22) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr %21) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr %20) #6
  br label %285

184:                                              ; preds = %181
  call void @llvm.lifetime.start.p0(i64 16, ptr %23) #6
  %185 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNKSt17_Rb_tree_iteratorISt4pairIKxxEEdeEv(ptr noundef nonnull align 8 dereferenceable(8) %21) #6
  invoke void @_ZNSt4pairIxxEC2IKxxTnNSt9enable_ifIXaaclsr6_PCCFPIT_T0_EE18_ConstructiblePairIS4_S5_EEclsr6_PCCFPIS4_S5_EE26_ImplicitlyConvertiblePairIS4_S5_EEEbE4typeELb1EEERKS_IS4_S5_E(ptr noundef nonnull align 8 dereferenceable(16) %23, ptr noundef nonnull align 8 dereferenceable(16) %185)
          to label %186 unwind label %201

186:                                              ; preds = %184
  call void @llvm.lifetime.start.p0(i64 8, ptr %24) #6
  call void @llvm.lifetime.start.p0(i64 8, ptr %25) #6
  %187 = getelementptr inbounds %"struct.std::pair", ptr %23, i32 0, i32 0
  %188 = load i64, ptr %187, align 8, !tbaa !17
  %189 = getelementptr inbounds [200001 x %"class.std::multiset"], ptr @ex, i64 0, i64 %188
  %190 = call ptr @_ZNKSt8multisetIxSt4lessIxESaIxEE5beginEv(ptr noundef nonnull align 8 dereferenceable(48) %189) #6
  %191 = getelementptr inbounds %"struct.std::_Rb_tree_const_iterator", ptr %25, i32 0, i32 0
  store ptr %190, ptr %191, align 8
  %192 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNKSt23_Rb_tree_const_iteratorIxEdeEv(ptr noundef nonnull align 8 dereferenceable(8) %25) #6
  %193 = load i64, ptr %192, align 8, !tbaa !8
  call void @llvm.lifetime.end.p0(i64 8, ptr %25) #6
  store i64 %193, ptr %24, align 8, !tbaa !8
  %194 = getelementptr inbounds %"struct.std::pair", ptr %23, i32 0, i32 0
  %195 = load i64, ptr %194, align 8, !tbaa !17
  %196 = getelementptr inbounds [200001 x %"class.std::multiset"], ptr @ex, i64 0, i64 %195
  %197 = call noundef i64 @_ZNKSt8multisetIxSt4lessIxESaIxEE4sizeEv(ptr noundef nonnull align 8 dereferenceable(48) %196) #6
  %198 = load i64, ptr @N, align 8, !tbaa !8
  %199 = icmp slt i64 %197, %198
  br i1 %199, label %200, label %205

200:                                              ; preds = %186
  store i64 0, ptr %24, align 8, !tbaa !8
  br label %205

201:                                              ; preds = %184
  %202 = landingpad { ptr, i32 }
          cleanup
  %203 = extractvalue { ptr, i32 } %202, 0
  store ptr %203, ptr %18, align 8
  %204 = extractvalue { ptr, i32 } %202, 1
  store i32 %204, ptr %19, align 4
  br label %284

205:                                              ; preds = %200, %186
  %206 = load i64, ptr %15, align 8, !tbaa !8
  %207 = getelementptr inbounds [200001 x %"class.std::map"], ptr @m, i64 0, i64 %206
  %208 = getelementptr inbounds %"struct.std::pair", ptr %23, i32 0, i32 0
  %209 = invoke noundef i64 @_ZNKSt3mapIxxSt4lessIxESaISt4pairIKxxEEE5countERS3_(ptr noundef nonnull align 8 dereferenceable(48) %207, ptr noundef nonnull align 8 dereferenceable(8) %208)
          to label %210 unwind label %232

210:                                              ; preds = %205
  %211 = icmp ne i64 %209, 0
  br i1 %211, label %212, label %236

212:                                              ; preds = %210
  %213 = getelementptr inbounds %"struct.std::pair", ptr %23, i32 0, i32 0
  %214 = load i64, ptr %213, align 8, !tbaa !17
  %215 = getelementptr inbounds [200001 x %"class.std::multiset"], ptr @ex, i64 0, i64 %214
  %216 = getelementptr inbounds %"struct.std::pair", ptr %23, i32 0, i32 0
  %217 = load i64, ptr %216, align 8, !tbaa !17
  %218 = getelementptr inbounds [200001 x %"class.std::multiset"], ptr @ex, i64 0, i64 %217
  %219 = load i64, ptr %15, align 8, !tbaa !8
  %220 = getelementptr inbounds [200001 x %"class.std::map"], ptr @m, i64 0, i64 %219
  %221 = getelementptr inbounds %"struct.std::pair", ptr %23, i32 0, i32 0
  %222 = invoke noundef nonnull align 8 dereferenceable(8) ptr @_ZNSt3mapIxxSt4lessIxESaISt4pairIKxxEEEixERS3_(ptr noundef nonnull align 8 dereferenceable(48) %220, ptr noundef nonnull align 8 dereferenceable(8) %221)
          to label %223 unwind label %232

223:                                              ; preds = %212
  %224 = invoke ptr @_ZNSt8multisetIxSt4lessIxESaIxEE4findERKx(ptr noundef nonnull align 8 dereferenceable(48) %218, ptr noundef nonnull align 8 dereferenceable(8) %222)
          to label %225 unwind label %232

225:                                              ; preds = %223
  %226 = getelementptr inbounds %"struct.std::_Rb_tree_const_iterator", ptr %26, i32 0, i32 0
  store ptr %224, ptr %226, align 8
  %227 = getelementptr inbounds %"struct.std::_Rb_tree_const_iterator", ptr %26, i32 0, i32 0
  %228 = load ptr, ptr %227, align 8
  %229 = invoke ptr @_ZNSt8multisetIxSt4lessIxESaIxEE5eraseB5cxx11ESt23_Rb_tree_const_iteratorIxE(ptr noundef nonnull align 8 dereferenceable(48) %215, ptr %228)
          to label %230 unwind label %232

230:                                              ; preds = %225
  %231 = getelementptr inbounds %"struct.std::_Rb_tree_const_iterator", ptr %27, i32 0, i32 0
  store ptr %229, ptr %231, align 8
  br label %236

232:                                              ; preds = %253, %243, %236, %225, %223, %212, %205
  %233 = landingpad { ptr, i32 }
          cleanup
  %234 = extractvalue { ptr, i32 } %233, 0
  store ptr %234, ptr %18, align 8
  %235 = extractvalue { ptr, i32 } %233, 1
  store i32 %235, ptr %19, align 4
  call void @llvm.lifetime.end.p0(i64 8, ptr %24) #6
  br label %284

236:                                              ; preds = %230, %210
  %237 = getelementptr inbounds %"struct.std::pair", ptr %23, i32 0, i32 1
  %238 = load i64, ptr %237, align 8, !tbaa !22
  %239 = load i64, ptr %15, align 8, !tbaa !8
  %240 = getelementptr inbounds [200001 x %"class.std::map"], ptr @m, i64 0, i64 %239
  %241 = getelementptr inbounds %"struct.std::pair", ptr %23, i32 0, i32 0
  %242 = invoke noundef nonnull align 8 dereferenceable(8) ptr @_ZNSt3mapIxxSt4lessIxESaISt4pairIKxxEEEixERS3_(ptr noundef nonnull align 8 dereferenceable(48) %240, ptr noundef nonnull align 8 dereferenceable(8) %241)
          to label %243 unwind label %232

243:                                              ; preds = %236
  %244 = load i64, ptr %242, align 8, !tbaa !8
  %245 = add nsw i64 %244, %238
  store i64 %245, ptr %242, align 8, !tbaa !8
  %246 = getelementptr inbounds %"struct.std::pair", ptr %23, i32 0, i32 0
  %247 = load i64, ptr %246, align 8, !tbaa !17
  %248 = getelementptr inbounds [200001 x %"class.std::multiset"], ptr @ex, i64 0, i64 %247
  %249 = load i64, ptr %15, align 8, !tbaa !8
  %250 = getelementptr inbounds [200001 x %"class.std::map"], ptr @m, i64 0, i64 %249
  %251 = getelementptr inbounds %"struct.std::pair", ptr %23, i32 0, i32 0
  %252 = invoke noundef nonnull align 8 dereferenceable(8) ptr @_ZNSt3mapIxxSt4lessIxESaISt4pairIKxxEEEixERS3_(ptr noundef nonnull align 8 dereferenceable(48) %250, ptr noundef nonnull align 8 dereferenceable(8) %251)
          to label %253 unwind label %232

253:                                              ; preds = %243
  %254 = invoke ptr @_ZNSt8multisetIxSt4lessIxESaIxEE6insertERKx(ptr noundef nonnull align 8 dereferenceable(48) %248, ptr noundef nonnull align 8 dereferenceable(8) %252)
          to label %255 unwind label %232

255:                                              ; preds = %253
  %256 = getelementptr inbounds %"struct.std::_Rb_tree_const_iterator", ptr %28, i32 0, i32 0
  store ptr %254, ptr %256, align 8
  call void @llvm.lifetime.start.p0(i64 8, ptr %29) #6
  call void @llvm.lifetime.start.p0(i64 8, ptr %30) #6
  %257 = getelementptr inbounds %"struct.std::pair", ptr %23, i32 0, i32 0
  %258 = load i64, ptr %257, align 8, !tbaa !17
  %259 = getelementptr inbounds [200001 x %"class.std::multiset"], ptr @ex, i64 0, i64 %258
  %260 = call ptr @_ZNKSt8multisetIxSt4lessIxESaIxEE5beginEv(ptr noundef nonnull align 8 dereferenceable(48) %259) #6
  %261 = getelementptr inbounds %"struct.std::_Rb_tree_const_iterator", ptr %30, i32 0, i32 0
  store ptr %260, ptr %261, align 8
  %262 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNKSt23_Rb_tree_const_iteratorIxEdeEv(ptr noundef nonnull align 8 dereferenceable(8) %30) #6
  %263 = load i64, ptr %262, align 8, !tbaa !8
  call void @llvm.lifetime.end.p0(i64 8, ptr %30) #6
  store i64 %263, ptr %29, align 8, !tbaa !8
  %264 = getelementptr inbounds %"struct.std::pair", ptr %23, i32 0, i32 0
  %265 = load i64, ptr %264, align 8, !tbaa !17
  %266 = getelementptr inbounds [200001 x %"class.std::multiset"], ptr @ex, i64 0, i64 %265
  %267 = call noundef i64 @_ZNKSt8multisetIxSt4lessIxESaIxEE4sizeEv(ptr noundef nonnull align 8 dereferenceable(48) %266) #6
  %268 = load i64, ptr @N, align 8, !tbaa !8
  %269 = icmp slt i64 %267, %268
  br i1 %269, label %270, label %271

270:                                              ; preds = %255
  store i64 0, ptr %29, align 8, !tbaa !8
  br label %271

271:                                              ; preds = %270, %255
  %272 = load i64, ptr %12, align 8, !tbaa !8
  %273 = getelementptr inbounds %"struct.std::pair", ptr %23, i32 0, i32 0
  %274 = load i64, ptr %273, align 8, !tbaa !17
  %275 = load i64, ptr %29, align 8, !tbaa !8
  %276 = load i64, ptr %24, align 8, !tbaa !8
  %277 = sub nsw i64 %275, %276
  %278 = call noundef i64 @_Z4bpowxx(i64 noundef %274, i64 noundef %277)
  %279 = mul nsw i64 %272, %278
  %280 = load i64, ptr @MOD, align 8, !tbaa !8
  %281 = srem i64 %279, %280
  store i64 %281, ptr %12, align 8, !tbaa !8
  call void @llvm.lifetime.end.p0(i64 8, ptr %29) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr %24) #6
  call void @llvm.lifetime.end.p0(i64 16, ptr %23) #6
  br label %282

282:                                              ; preds = %271
  %283 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSt17_Rb_tree_iteratorISt4pairIKxxEEppEv(ptr noundef nonnull align 8 dereferenceable(8) %21) #6
  br label %181

284:                                              ; preds = %232, %201
  call void @llvm.lifetime.end.p0(i64 16, ptr %23) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr %22) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr %21) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr %20) #6
  br label %291

285:                                              ; preds = %183
  %286 = load i64, ptr %12, align 8, !tbaa !8
  %287 = invoke noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEx(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cout, i64 noundef %286)
          to label %288 unwind label %170

288:                                              ; preds = %285
  %289 = invoke noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc(ptr noundef nonnull align 8 dereferenceable(8) %287, ptr noundef @.str)
          to label %290 unwind label %170

290:                                              ; preds = %288
  call void @_ZNSt3mapIxxSt4lessIxESaISt4pairIKxxEEED2Ev(ptr noundef nonnull align 8 dereferenceable(48) %17) #6
  call void @llvm.lifetime.end.p0(i64 48, ptr %17) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr %16) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr %15) #6
  br label %146, !llvm.loop !23

291:                                              ; preds = %284, %170
  call void @_ZNSt3mapIxxSt4lessIxESaISt4pairIKxxEEED2Ev(ptr noundef nonnull align 8 dereferenceable(48) %17) #6
  call void @llvm.lifetime.end.p0(i64 48, ptr %17) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr %16) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr %15) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr %12) #6
  br label %294

292:                                              ; preds = %146
  call void @llvm.lifetime.end.p0(i64 8, ptr %12) #6
  %293 = load i32, ptr %1, align 4
  ret i32 %293

294:                                              ; preds = %291
  %295 = load ptr, ptr %18, align 8
  %296 = load i32, ptr %19, align 4
  %297 = insertvalue { ptr, i32 } poison, ptr %295, 0
  %298 = insertvalue { ptr, i32 } %297, i32 %296, 1
  resume { ptr, i32 } %298
}

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

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

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

; Function Attrs: 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 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 @_ZNSt3mapIxxSt4lessIxESaISt4pairIKxxEEE3endEv(ptr noundef nonnull align 8 dereferenceable(48)) #0 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)) #0

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

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

; Function Attrs: mustprogress uwtable
declare dso_local ptr @_ZNSt8multisetIxSt4lessIxESaIxEE6insertERKx(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 noundef nonnull align 8 dereferenceable(8) ptr @_ZNSt17_Rb_tree_iteratorISt4pairIKxxEEppEv(ptr noundef nonnull align 8 dereferenceable(8)) #0 align 2

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

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

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

declare i32 @__gxx_personality_v0(...)

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

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

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

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

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

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

!0 = !{i32 1, !"wchar_size", i32 4}
!1 = !{i32 8, !"PIC Level", i32 2}
!2 = !{i32 7, !"PIE Level", i32 2}
!3 = !{i32 7, !"uwtable", i32 2}
!4 = !{!"clang version 19.1.0 (git@github.com:llvm/llvm-project.git a4bf6cd7cfb1a1421ba92bca9d017b49936c55e4)"}
!5 = !{!6, !6, i64 0}
!6 = !{!"vtable pointer", !7, i64 0}
!7 = !{!"Simple C++ TBAA"}
!8 = !{!9, !9, i64 0}
!9 = !{!"long long", !10, i64 0}
!10 = !{!"omnipotent char", !7, i64 0}
!11 = distinct !{!11, !12}
!12 = !{!"llvm.loop.mustprogress"}
!13 = distinct !{!13, !12}
!14 = distinct !{!14, !12}
!15 = !{!16, !16, i64 0}
!16 = !{!"any pointer", !10, i64 0}
!17 = !{!18, !9, i64 0}
!18 = !{!"_ZTSSt4pairIxxE", !9, i64 0, !9, i64 8}
!19 = distinct !{!19, !12}
!20 = distinct !{!20, !12}
!21 = distinct !{!21, !12}
!22 = !{!18, !9, i64 8}
!23 = distinct !{!23, !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::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::multiset" = type { %"class.std::_Rb_tree.0" }
%"class.std::_Rb_tree.0" = type { %"struct.std::_Rb_tree<long long, long long, std::_Identity<long long>, std::less<long long>>::_Rb_tree_impl" }
%"struct.std::_Rb_tree<long long, long long, std::_Identity<long long>, std::less<long long>>::_Rb_tree_impl" = type { [8 x i8], %"struct.std::_Rb_tree_header" }
%"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::_Rb_tree_iterator" = type { ptr }
%"struct.std::pair" = type { i64, i64 }
%"struct.std::_Rb_tree_const_iterator" = type { ptr }

@MOD = external dso_local local_unnamed_addr global i64, align 8
@N = external dso_local global i64, align 8
@Q = external dso_local global i64, align 8
@sieve = external dso_local global [200001 x i64], align 16
@m = external dso_local global [200001 x %"class.std::map"], align 16
@ex = external dso_local global [200001 x %"class.std::multiset"], align 16
@_ZSt3cin = external global %"class.std::basic_istream", align 8
@_ZSt4cout = external global %"class.std::basic_ostream", align 8
@.str = external hidden unnamed_addr constant [2 x i8], align 1

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

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

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef i64 @_Z4bpowxx(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 personality ptr @__gxx_personality_v0 {
  %1 = alloca i64, align 8
  %2 = alloca %"struct.std::_Rb_tree_iterator", align 8
  %3 = alloca %"struct.std::_Rb_tree_iterator", align 8
  %4 = alloca %"struct.std::pair", align 8
  %5 = alloca %"struct.std::_Rb_tree_const_iterator", align 8
  %6 = alloca i64, align 8
  %7 = alloca i64, align 8
  %8 = alloca %"class.std::map", align 8
  %9 = alloca %"struct.std::_Rb_tree_iterator", align 8
  %10 = alloca %"struct.std::_Rb_tree_iterator", align 8
  %11 = alloca %"struct.std::pair", align 8
  %12 = alloca %"struct.std::_Rb_tree_const_iterator", align 8
  %13 = alloca %"struct.std::_Rb_tree_const_iterator", align 8
  %14 = load ptr, ptr @_ZSt3cin, align 8, !tbaa !5
  %15 = getelementptr i8, ptr %14, i64 -24
  %16 = load i64, ptr %15, align 8
  %17 = getelementptr inbounds i8, ptr @_ZSt3cin, i64 %16
  %18 = tail call noundef ptr @_ZNSt9basic_iosIcSt11char_traitsIcEE3tieEPSo(ptr noundef nonnull align 8 dereferenceable(264) %17, ptr noundef null)
  %19 = tail call noundef zeroext i1 @_ZNSt8ios_base15sync_with_stdioEb(i1 noundef zeroext false)
  %20 = 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)
  %21 = tail call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERx(ptr noundef nonnull align 8 dereferenceable(16) %20, ptr noundef nonnull align 8 dereferenceable(8) @Q)
  br label %25

.preheader48:                                     ; preds = %.loopexit50
  %22 = load i64, ptr @N, align 8, !tbaa !8
  %23 = icmp sgt i64 %22, 0
  br i1 %23, label %.lr.ph60, label %.preheader47.preheader

.preheader47.preheader:                           ; preds = %._crit_edge58, %.preheader48
  br label %.preheader47

.lr.ph60:                                         ; preds = %.preheader48
  %24 = getelementptr inbounds i8, ptr %4, i64 8
  br label %39

25:                                               ; preds = %.loopexit50.1, %0
  %.03253 = phi i64 [ 2, %0 ], [ %38, %.loopexit50.1 ]
  %26 = getelementptr inbounds [200001 x i64], ptr @sieve, i64 0, i64 %.03253
  %27 = load i64, ptr %26, align 16, !tbaa !8
  %.not44 = icmp eq i64 %27, 0
  br i1 %.not44, label %.lr.ph, label %.loopexit50

.lr.ph:                                           ; preds = %25, %.lr.ph
  %.03352 = phi i64 [ %29, %.lr.ph ], [ %.03253, %25 ]
  %28 = getelementptr inbounds [200001 x i64], ptr @sieve, i64 0, i64 %.03352
  store i64 %.03253, ptr %28, align 16, !tbaa !8
  %29 = add nuw nsw i64 %.03352, %.03253
  %30 = icmp ult i64 %29, 200001
  br i1 %30, label %.lr.ph, label %.loopexit50, !llvm.loop !11

.loopexit50:                                      ; preds = %.lr.ph, %25
  %31 = or disjoint i64 %.03253, 1
  %exitcond.not = icmp eq i64 %.03253, 200000
  br i1 %exitcond.not, label %.preheader48, label %32, !llvm.loop !13

32:                                               ; preds = %.loopexit50
  %33 = getelementptr inbounds [200001 x i64], ptr @sieve, i64 0, i64 %31
  %34 = load i64, ptr %33, align 8, !tbaa !8
  %.not44.1 = icmp eq i64 %34, 0
  br i1 %.not44.1, label %.lr.ph.1, label %.loopexit50.1

.lr.ph.1:                                         ; preds = %32, %.lr.ph.1
  %.03352.1 = phi i64 [ %36, %.lr.ph.1 ], [ %31, %32 ]
  %35 = getelementptr inbounds [200001 x i64], ptr @sieve, i64 0, i64 %.03352.1
  store i64 %31, ptr %35, align 8, !tbaa !8
  %36 = add nuw nsw i64 %.03352.1, %31
  %37 = icmp ult i64 %36, 200001
  br i1 %37, label %.lr.ph.1, label %.loopexit50.1, !llvm.loop !11

.loopexit50.1:                                    ; preds = %.lr.ph.1, %32
  %38 = add nuw nsw i64 %.03253, 2
  br label %25

39:                                               ; preds = %.lr.ph60, %._crit_edge58
  %.03559 = phi i64 [ 0, %.lr.ph60 ], [ %58, %._crit_edge58 ]
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %1) #6
  %40 = 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)
  %.pr = load i64, ptr %1, align 8, !tbaa !8
  %41 = icmp sgt i64 %.pr, 1
  br i1 %41, label %.lr.ph55, label %._crit_edge

.lr.ph55:                                         ; preds = %39
  %42 = getelementptr inbounds [200001 x %"class.std::map"], ptr @m, i64 0, i64 %.03559
  br label %43

43:                                               ; preds = %.lr.ph55, %43
  %44 = phi i64 [ %.pr, %.lr.ph55 ], [ %52, %43 ]
  %45 = getelementptr inbounds [200001 x i64], ptr @sieve, i64 0, i64 %44
  %46 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSt3mapIxxSt4lessIxESaISt4pairIKxxEEEixERS3_(ptr noundef nonnull align 8 dereferenceable(48) %42, ptr noundef nonnull align 8 dereferenceable(8) %45)
  %47 = load i64, ptr %46, align 8, !tbaa !8
  %48 = add nsw i64 %47, 1
  store i64 %48, ptr %46, align 8, !tbaa !8
  %49 = load i64, ptr %1, align 8, !tbaa !8
  %50 = getelementptr inbounds [200001 x i64], ptr @sieve, i64 0, i64 %49
  %51 = load i64, ptr %50, align 8, !tbaa !8
  %52 = sdiv i64 %49, %51
  store i64 %52, ptr %1, align 8, !tbaa !8
  %53 = icmp sgt i64 %52, 1
  br i1 %53, label %43, label %._crit_edge, !llvm.loop !14

._crit_edge:                                      ; preds = %43, %39
  %54 = getelementptr inbounds [200001 x %"class.std::map"], ptr @m, i64 0, i64 %.03559
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %2) #6
  %55 = call ptr @_ZNSt3mapIxxSt4lessIxESaISt4pairIKxxEEE5beginEv(ptr noundef nonnull align 8 dereferenceable(48) %54) #6
  store ptr %55, ptr %2, align 8
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %3) #6
  %56 = call ptr @_ZNSt3mapIxxSt4lessIxESaISt4pairIKxxEEE3endEv(ptr noundef nonnull align 8 dereferenceable(48) %54) #6
  store ptr %56, ptr %3, align 8
  %57 = call noundef zeroext i1 @_ZStneRKSt17_Rb_tree_iteratorISt4pairIKxxEES5_(ptr noundef nonnull align 8 dereferenceable(8) %2, ptr noundef nonnull align 8 dereferenceable(8) %3) #6
  br i1 %57, label %.lr.ph57, label %._crit_edge58

._crit_edge58:                                    ; preds = %.lr.ph57, %._crit_edge
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %3) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %2) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %1) #6
  %58 = add nuw nsw i64 %.03559, 1
  %59 = load i64, ptr @N, align 8, !tbaa !8
  %60 = icmp slt i64 %58, %59
  br i1 %60, label %39, label %.preheader47.preheader, !llvm.loop !15

.lr.ph57:                                         ; preds = %._crit_edge, %.lr.ph57
  call void @llvm.lifetime.start.p0(i64 16, ptr nonnull %4) #6
  %61 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNKSt17_Rb_tree_iteratorISt4pairIKxxEEdeEv(ptr noundef nonnull align 8 dereferenceable(8) %2) #6
  call void @_ZNSt4pairIxxEC2IKxxTnNSt9enable_ifIXaaclsr6_PCCFPIT_T0_EE18_ConstructiblePairIS4_S5_EEclsr6_PCCFPIS4_S5_EE26_ImplicitlyConvertiblePairIS4_S5_EEEbE4typeELb1EEERKS_IS4_S5_E(ptr noundef nonnull align 8 dereferenceable(16) %4, ptr noundef nonnull align 8 dereferenceable(16) %61)
  %62 = load i64, ptr %4, align 8, !tbaa !16
  %63 = getelementptr inbounds [200001 x %"class.std::multiset"], ptr @ex, i64 0, i64 %62
  %64 = call ptr @_ZNSt8multisetIxSt4lessIxESaIxEE6insertERKx(ptr noundef nonnull align 8 dereferenceable(48) %63, ptr noundef nonnull align 8 dereferenceable(8) %24)
  call void @llvm.lifetime.end.p0(i64 16, ptr nonnull %4) #6
  %65 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSt17_Rb_tree_iteratorISt4pairIKxxEEppEv(ptr noundef nonnull align 8 dereferenceable(8) %2) #6
  %66 = call noundef zeroext i1 @_ZStneRKSt17_Rb_tree_iteratorISt4pairIKxxEES5_(ptr noundef nonnull align 8 dereferenceable(8) %2, ptr noundef nonnull align 8 dereferenceable(8) %3) #6
  br i1 %66, label %.lr.ph57, label %._crit_edge58

.preheader:                                       ; preds = %82
  %67 = load i64, ptr @Q, align 8, !tbaa !8
  %68 = add nsw i64 %67, -1
  store i64 %68, ptr @Q, align 8, !tbaa !8
  %.not70 = icmp eq i64 %67, 0
  br i1 %.not70, label %._crit_edge73, label %.lr.ph72

.lr.ph72:                                         ; preds = %.preheader
  %69 = getelementptr inbounds i8, ptr %11, i64 8
  br label %84

.preheader47:                                     ; preds = %.preheader47.preheader, %82
  %.03862 = phi i64 [ %83, %82 ], [ 0, %.preheader47.preheader ]
  %.03961 = phi i64 [ %.1, %82 ], [ 1, %.preheader47.preheader ]
  %70 = getelementptr inbounds [200001 x %"class.std::multiset"], ptr @ex, i64 0, i64 %.03862
  %71 = call noundef i64 @_ZNKSt8multisetIxSt4lessIxESaIxEE4sizeEv(ptr noundef nonnull align 8 dereferenceable(48) %70) #6
  %72 = load i64, ptr @N, align 8, !tbaa !8
  %73 = icmp eq i64 %71, %72
  br i1 %73, label %74, label %82

74:                                               ; preds = %.preheader47
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %5) #6
  %75 = call ptr @_ZNKSt8multisetIxSt4lessIxESaIxEE5beginEv(ptr noundef nonnull align 8 dereferenceable(48) %70) #6
  store ptr %75, ptr %5, align 8
  %76 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNKSt23_Rb_tree_const_iteratorIxEdeEv(ptr noundef nonnull align 8 dereferenceable(8) %5) #6
  %77 = load i64, ptr %76, align 8, !tbaa !8
  %78 = call noundef i64 @_Z4bpowxx(i64 noundef %.03862, i64 noundef %77)
  %79 = mul nsw i64 %78, %.03961
  %80 = load i64, ptr @MOD, align 8, !tbaa !8
  %81 = srem i64 %79, %80
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %5) #6
  br label %82

82:                                               ; preds = %.preheader47, %74
  %.1 = phi i64 [ %81, %74 ], [ %.03961, %.preheader47 ]
  %83 = add nuw nsw i64 %.03862, 1
  %exitcond74.not = icmp eq i64 %83, 200001
  br i1 %exitcond74.not, label %.preheader, label %.preheader47, !llvm.loop !18

84:                                               ; preds = %.lr.ph72, %168
  %.271 = phi i64 [ %.1, %.lr.ph72 ], [ %.3.lcssa, %168 ]
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %6) #6
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %7) #6
  %85 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERx(ptr noundef nonnull align 8 dereferenceable(16) @_ZSt3cin, ptr noundef nonnull align 8 dereferenceable(8) %6)
  %86 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERx(ptr noundef nonnull align 8 dereferenceable(16) %85, ptr noundef nonnull align 8 dereferenceable(8) %7)
  %87 = load i64, ptr %6, align 8, !tbaa !8
  %88 = add nsw i64 %87, -1
  store i64 %88, ptr %6, align 8, !tbaa !8
  call void @llvm.lifetime.start.p0(i64 48, ptr nonnull %8) #6
  call void @_ZNSt3mapIxxSt4lessIxESaISt4pairIKxxEEEC2Ev(ptr noundef nonnull align 8 dereferenceable(48) %8) #6
  %.pr46 = load i64, ptr %7, align 8, !tbaa !8
  %89 = icmp sgt i64 %.pr46, 1
  br i1 %89, label %.lr.ph64, label %._crit_edge65

.lr.ph64:                                         ; preds = %84, %93
  %90 = phi i64 [ %99, %93 ], [ %.pr46, %84 ]
  %91 = getelementptr inbounds [200001 x i64], ptr @sieve, i64 0, i64 %90
  %92 = invoke noundef nonnull align 8 dereferenceable(8) ptr @_ZNSt3mapIxxSt4lessIxESaISt4pairIKxxEEEixERS3_(ptr noundef nonnull align 8 dereferenceable(48) %8, ptr noundef nonnull align 8 dereferenceable(8) %91)
          to label %93 unwind label %.loopexit

93:                                               ; preds = %.lr.ph64
  %94 = load i64, ptr %92, align 8, !tbaa !8
  %95 = add nsw i64 %94, 1
  store i64 %95, ptr %92, align 8, !tbaa !8
  %96 = load i64, ptr %7, align 8, !tbaa !8
  %97 = getelementptr inbounds [200001 x i64], ptr @sieve, i64 0, i64 %96
  %98 = load i64, ptr %97, align 8, !tbaa !8
  %99 = sdiv i64 %96, %98
  store i64 %99, ptr %7, align 8, !tbaa !8
  %100 = icmp sgt i64 %99, 1
  br i1 %100, label %.lr.ph64, label %._crit_edge65, !llvm.loop !19

.loopexit:                                        ; preds = %.lr.ph64
  %lpad.loopexit = landingpad { ptr, i32 }
          cleanup
  br label %171

.loopexit.split-lp:                               ; preds = %._crit_edge69, %166
  %lpad.loopexit.split-lp = landingpad { ptr, i32 }
          cleanup
  br label %171

._crit_edge65:                                    ; preds = %93, %84
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %9) #6
  %101 = call ptr @_ZNSt3mapIxxSt4lessIxESaISt4pairIKxxEEE5beginEv(ptr noundef nonnull align 8 dereferenceable(48) %8) #6
  store ptr %101, ptr %9, align 8
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %10) #6
  %102 = call ptr @_ZNSt3mapIxxSt4lessIxESaISt4pairIKxxEEE3endEv(ptr noundef nonnull align 8 dereferenceable(48) %8) #6
  store ptr %102, ptr %10, align 8
  %103 = call noundef zeroext i1 @_ZStneRKSt17_Rb_tree_iteratorISt4pairIKxxEES5_(ptr noundef nonnull align 8 dereferenceable(8) %9, ptr noundef nonnull align 8 dereferenceable(8) %10) #6
  br i1 %103, label %.lr.ph68, label %._crit_edge69

._crit_edge69:                                    ; preds = %147, %._crit_edge65
  %.3.lcssa = phi i64 [ %.271, %._crit_edge65 ], [ %163, %147 ]
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %10) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %9) #6
  %104 = invoke noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEx(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cout, i64 noundef %.3.lcssa)
          to label %166 unwind label %.loopexit.split-lp

.lr.ph68:                                         ; preds = %._crit_edge65, %147
  %.366 = phi i64 [ %163, %147 ], [ %.271, %._crit_edge65 ]
  call void @llvm.lifetime.start.p0(i64 16, ptr nonnull %11) #6
  %105 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNKSt17_Rb_tree_iteratorISt4pairIKxxEEdeEv(ptr noundef nonnull align 8 dereferenceable(8) %9) #6
  call void @_ZNSt4pairIxxEC2IKxxTnNSt9enable_ifIXaaclsr6_PCCFPIT_T0_EE18_ConstructiblePairIS4_S5_EEclsr6_PCCFPIS4_S5_EE26_ImplicitlyConvertiblePairIS4_S5_EEEbE4typeELb1EEERKS_IS4_S5_E(ptr noundef nonnull align 8 dereferenceable(16) %11, ptr noundef nonnull align 8 dereferenceable(16) %105)
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %12) #6
  %106 = load i64, ptr %11, align 8, !tbaa !16
  %107 = getelementptr inbounds [200001 x %"class.std::multiset"], ptr @ex, i64 0, i64 %106
  %108 = call ptr @_ZNKSt8multisetIxSt4lessIxESaIxEE5beginEv(ptr noundef nonnull align 8 dereferenceable(48) %107) #6
  store ptr %108, ptr %12, align 8
  %109 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNKSt23_Rb_tree_const_iteratorIxEdeEv(ptr noundef nonnull align 8 dereferenceable(8) %12) #6
  %110 = load i64, ptr %109, align 8, !tbaa !8
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %12) #6
  %111 = load i64, ptr %11, align 8, !tbaa !16
  %112 = getelementptr inbounds [200001 x %"class.std::multiset"], ptr @ex, i64 0, i64 %111
  %113 = call noundef i64 @_ZNKSt8multisetIxSt4lessIxESaIxEE4sizeEv(ptr noundef nonnull align 8 dereferenceable(48) %112) #6
  %114 = load i64, ptr @N, align 8, !tbaa !8
  %115 = icmp slt i64 %113, %114
  %spec.select = select i1 %115, i64 0, i64 %110
  %116 = load i64, ptr %6, align 8, !tbaa !8
  %117 = getelementptr inbounds [200001 x %"class.std::map"], ptr @m, i64 0, i64 %116
  %118 = invoke noundef i64 @_ZNKSt3mapIxxSt4lessIxESaISt4pairIKxxEEE5countERS3_(ptr noundef nonnull align 8 dereferenceable(48) %117, ptr noundef nonnull align 8 dereferenceable(8) %11)
          to label %119 unwind label %130

119:                                              ; preds = %.lr.ph68
  %.not42 = icmp eq i64 %118, 0
  br i1 %.not42, label %132, label %120

120:                                              ; preds = %119
  %121 = load i64, ptr %11, align 8, !tbaa !16
  %122 = getelementptr inbounds [200001 x %"class.std::multiset"], ptr @ex, i64 0, i64 %121
  %123 = load i64, ptr %6, align 8, !tbaa !8
  %124 = getelementptr inbounds [200001 x %"class.std::map"], ptr @m, i64 0, i64 %123
  %125 = invoke noundef nonnull align 8 dereferenceable(8) ptr @_ZNSt3mapIxxSt4lessIxESaISt4pairIKxxEEEixERS3_(ptr noundef nonnull align 8 dereferenceable(48) %124, ptr noundef nonnull align 8 dereferenceable(8) %11)
          to label %126 unwind label %130

126:                                              ; preds = %120
  %127 = invoke ptr @_ZNSt8multisetIxSt4lessIxESaIxEE4findERKx(ptr noundef nonnull align 8 dereferenceable(48) %122, ptr noundef nonnull align 8 dereferenceable(8) %125)
          to label %128 unwind label %130

128:                                              ; preds = %126
  %129 = invoke ptr @_ZNSt8multisetIxSt4lessIxESaIxEE5eraseB5cxx11ESt23_Rb_tree_const_iteratorIxE(ptr noundef nonnull align 8 dereferenceable(48) %122, ptr %127)
          to label %132 unwind label %130

130:                                              ; preds = %144, %137, %132, %128, %126, %120, %.lr.ph68
  %131 = landingpad { ptr, i32 }
          cleanup
  call void @llvm.lifetime.end.p0(i64 16, ptr nonnull %11) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %10) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %9) #6
  br label %171

132:                                              ; preds = %128, %119
  %133 = load i64, ptr %69, align 8, !tbaa !20
  %134 = load i64, ptr %6, align 8, !tbaa !8
  %135 = getelementptr inbounds [200001 x %"class.std::map"], ptr @m, i64 0, i64 %134
  %136 = invoke noundef nonnull align 8 dereferenceable(8) ptr @_ZNSt3mapIxxSt4lessIxESaISt4pairIKxxEEEixERS3_(ptr noundef nonnull align 8 dereferenceable(48) %135, ptr noundef nonnull align 8 dereferenceable(8) %11)
          to label %137 unwind label %130

137:                                              ; preds = %132
  %138 = load i64, ptr %136, align 8, !tbaa !8
  %139 = add nsw i64 %138, %133
  store i64 %139, ptr %136, align 8, !tbaa !8
  %140 = load i64, ptr %11, align 8, !tbaa !16
  %141 = load i64, ptr %6, align 8, !tbaa !8
  %142 = getelementptr inbounds [200001 x %"class.std::map"], ptr @m, i64 0, i64 %141
  %143 = invoke noundef nonnull align 8 dereferenceable(8) ptr @_ZNSt3mapIxxSt4lessIxESaISt4pairIKxxEEEixERS3_(ptr noundef nonnull align 8 dereferenceable(48) %142, ptr noundef nonnull align 8 dereferenceable(8) %11)
          to label %144 unwind label %130

144:                                              ; preds = %137
  %145 = getelementptr inbounds [200001 x %"class.std::multiset"], ptr @ex, i64 0, i64 %140
  %146 = invoke ptr @_ZNSt8multisetIxSt4lessIxESaIxEE6insertERKx(ptr noundef nonnull align 8 dereferenceable(48) %145, ptr noundef nonnull align 8 dereferenceable(8) %143)
          to label %147 unwind label %130

147:                                              ; preds = %144
  call void @llvm.lifetime.start.p0(i64 8, ptr nonnull %13) #6
  %148 = load i64, ptr %11, align 8, !tbaa !16
  %149 = getelementptr inbounds [200001 x %"class.std::multiset"], ptr @ex, i64 0, i64 %148
  %150 = call ptr @_ZNKSt8multisetIxSt4lessIxESaIxEE5beginEv(ptr noundef nonnull align 8 dereferenceable(48) %149) #6
  store ptr %150, ptr %13, align 8
  %151 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNKSt23_Rb_tree_const_iteratorIxEdeEv(ptr noundef nonnull align 8 dereferenceable(8) %13) #6
  %152 = load i64, ptr %151, align 8, !tbaa !8
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %13) #6
  %153 = load i64, ptr %11, align 8, !tbaa !16
  %154 = getelementptr inbounds [200001 x %"class.std::multiset"], ptr @ex, i64 0, i64 %153
  %155 = call noundef i64 @_ZNKSt8multisetIxSt4lessIxESaIxEE4sizeEv(ptr noundef nonnull align 8 dereferenceable(48) %154) #6
  %156 = load i64, ptr @N, align 8, !tbaa !8
  %157 = icmp slt i64 %155, %156
  %spec.select45 = select i1 %157, i64 0, i64 %152
  %158 = load i64, ptr %11, align 8, !tbaa !16
  %159 = sub nsw i64 %spec.select45, %spec.select
  %160 = call noundef i64 @_Z4bpowxx(i64 noundef %158, i64 noundef %159)
  %161 = mul nsw i64 %160, %.366
  %162 = load i64, ptr @MOD, align 8, !tbaa !8
  %163 = srem i64 %161, %162
  call void @llvm.lifetime.end.p0(i64 16, ptr nonnull %11) #6
  %164 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSt17_Rb_tree_iteratorISt4pairIKxxEEppEv(ptr noundef nonnull align 8 dereferenceable(8) %9) #6
  %165 = call noundef zeroext i1 @_ZStneRKSt17_Rb_tree_iteratorISt4pairIKxxEES5_(ptr noundef nonnull align 8 dereferenceable(8) %9, ptr noundef nonnull align 8 dereferenceable(8) %10) #6
  br i1 %165, label %.lr.ph68, label %._crit_edge69

166:                                              ; preds = %._crit_edge69
  %167 = invoke noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_PKc(ptr noundef nonnull align 8 dereferenceable(8) %104, ptr noundef nonnull @.str)
          to label %168 unwind label %.loopexit.split-lp

168:                                              ; preds = %166
  call void @_ZNSt3mapIxxSt4lessIxESaISt4pairIKxxEEED2Ev(ptr noundef nonnull align 8 dereferenceable(48) %8) #6
  call void @llvm.lifetime.end.p0(i64 48, ptr nonnull %8) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %7) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %6) #6
  %169 = load i64, ptr @Q, align 8, !tbaa !8
  %170 = add nsw i64 %169, -1
  store i64 %170, ptr @Q, align 8, !tbaa !8
  %.not = icmp eq i64 %169, 0
  br i1 %.not, label %._crit_edge73, label %84, !llvm.loop !21

171:                                              ; preds = %.loopexit, %.loopexit.split-lp, %130
  %.pn = phi { ptr, i32 } [ %131, %130 ], [ %lpad.loopexit, %.loopexit ], [ %lpad.loopexit.split-lp, %.loopexit.split-lp ]
  call void @_ZNSt3mapIxxSt4lessIxESaISt4pairIKxxEEED2Ev(ptr noundef nonnull align 8 dereferenceable(48) %8) #6
  call void @llvm.lifetime.end.p0(i64 48, ptr nonnull %8) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %7) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr nonnull %6) #6
  resume { ptr, i32 } %.pn

._crit_edge73:                                    ; preds = %168, %.preheader
  ret i32 0
}

; 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

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

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

; Function Attrs: 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 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 @_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 @_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 noundef nonnull align 8 dereferenceable(16) ptr @_ZNKSt17_Rb_tree_iteratorISt4pairIKxxEEdeEv(ptr noundef nonnull align 8 dereferenceable(8)) local_unnamed_addr #0 align 2

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

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

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

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

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

declare i32 @__gxx_personality_v0(...)

; Function Attrs: mustprogress uwtable
declare dso_local noundef i64 @_ZNKSt3mapIxxSt4lessIxESaISt4pairIKxxEEE5countERS3_(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 ptr @_ZNSt8multisetIxSt4lessIxESaIxEE5eraseB5cxx11ESt23_Rb_tree_const_iteratorIxE(ptr noundef nonnull align 8 dereferenceable(48), ptr) local_unnamed_addr #4 align 2

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

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

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

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

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


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