; LLVM IR from eyangch/competitive-programming :: Codeforces/1096 (f)

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

%struct.BIT = type { [200001 x i64], i64 }
%"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" }

@MOD = external dso_local global i64, align 8
@N = external dso_local global i64, align 8
@P = external dso_local global [200000 x i64], align 16
@F = external dso_local global [300000 x i64], align 16
@cn1 = external dso_local global i64, align 8
@bf = external dso_local global [200000 x i64], align 16
@af = external dso_local global [200000 x i64], align 16
@lt = external dso_local global [200000 x i64], align 16
@gt = external dso_local global [200000 x i64], align 16
@pres = external dso_local global [200000 x i8], align 16
@bit = external dso_local global %struct.BIT, align 8
@_ZSt3cin = external global %"class.std::basic_istream", align 8
@_ZSt4cout = external global %"class.std::basic_ostream", align 8

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef i64 @_Z3invx(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 nounwind uwtable
declare dso_local noundef i64 @_Z3nc2x(i64 noundef) #0

; Function Attrs: mustprogress uwtable
declare dso_local noundef i64 @_Z4factx(i64 noundef) #2

; Function Attrs: mustprogress norecurse uwtable
define dso_local noundef i32 @main() #3 {
  %1 = alloca i32, align 4
  %2 = alloca i64, align 8
  %3 = alloca i64, align 8
  %4 = alloca i64, align 8
  %5 = alloca i64, align 8
  %6 = alloca i64, align 8
  %7 = alloca i64, align 8
  %8 = alloca i64, align 8
  %9 = alloca i64, align 8
  %10 = alloca i64, align 8
  %11 = alloca i64, align 8
  %12 = alloca i64, align 8
  %13 = alloca i64, align 8
  store i32 0, ptr %1, align 4
  %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 = call noundef ptr @_ZNSt9basic_iosIcSt11char_traitsIcEE3tieEPSo(ptr noundef nonnull align 8 dereferenceable(264) %17, ptr noundef null)
  %19 = call noundef zeroext i1 @_ZNSt8ios_base15sync_with_stdioEb(i1 noundef zeroext false)
  store i64 1, ptr @F, align 16, !tbaa !8
  call void @llvm.lifetime.start.p0(i64 8, ptr %2) #6
  store i64 1, ptr %2, align 8, !tbaa !8
  br label %20

20:                                               ; preds = %35, %0
  %21 = load i64, ptr %2, align 8, !tbaa !8
  %22 = icmp slt i64 %21, 300000
  br i1 %22, label %24, label %23

23:                                               ; preds = %20
  call void @llvm.lifetime.end.p0(i64 8, ptr %2) #6
  br label %38

24:                                               ; preds = %20
  %25 = load i64, ptr %2, align 8, !tbaa !8
  %26 = sub nsw i64 %25, 1
  %27 = getelementptr inbounds [300000 x i64], ptr @F, i64 0, i64 %26
  %28 = load i64, ptr %27, align 8, !tbaa !8
  %29 = load i64, ptr %2, align 8, !tbaa !8
  %30 = mul nsw i64 %28, %29
  %31 = load i64, ptr @MOD, align 8, !tbaa !8
  %32 = srem i64 %30, %31
  %33 = load i64, ptr %2, align 8, !tbaa !8
  %34 = getelementptr inbounds [300000 x i64], ptr @F, i64 0, i64 %33
  store i64 %32, ptr %34, align 8, !tbaa !8
  br label %35

35:                                               ; preds = %24
  %36 = load i64, ptr %2, align 8, !tbaa !8
  %37 = add nsw i64 %36, 1
  store i64 %37, ptr %2, align 8, !tbaa !8
  br label %20, !llvm.loop !11

38:                                               ; preds = %23
  %39 = 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)
  call void @llvm.lifetime.start.p0(i64 8, ptr %3) #6
  store i64 0, ptr %3, align 8, !tbaa !8
  br label %40

40:                                               ; preds = %67, %38
  %41 = load i64, ptr %3, align 8, !tbaa !8
  %42 = load i64, ptr @N, align 8, !tbaa !8
  %43 = icmp slt i64 %41, %42
  br i1 %43, label %45, label %44

44:                                               ; preds = %40
  call void @llvm.lifetime.end.p0(i64 8, ptr %3) #6
  br label %70

45:                                               ; preds = %40
  %46 = load i64, ptr %3, align 8, !tbaa !8
  %47 = getelementptr inbounds [200000 x i64], ptr @P, i64 0, i64 %46
  %48 = call noundef nonnull align 8 dereferenceable(16) ptr @_ZNSirsERx(ptr noundef nonnull align 8 dereferenceable(16) @_ZSt3cin, ptr noundef nonnull align 8 dereferenceable(8) %47)
  %49 = load i64, ptr %3, align 8, !tbaa !8
  %50 = getelementptr inbounds [200000 x i64], ptr @P, i64 0, i64 %49
  %51 = load i64, ptr %50, align 8, !tbaa !8
  %52 = xor i64 %51, -1
  %53 = icmp ne i64 %52, 0
  br i1 %53, label %54, label %63

54:                                               ; preds = %45
  %55 = load i64, ptr %3, align 8, !tbaa !8
  %56 = getelementptr inbounds [200000 x i64], ptr @P, i64 0, i64 %55
  %57 = load i64, ptr %56, align 8, !tbaa !8
  %58 = add nsw i64 %57, -1
  store i64 %58, ptr %56, align 8, !tbaa !8
  %59 = load i64, ptr %3, align 8, !tbaa !8
  %60 = getelementptr inbounds [200000 x i64], ptr @P, i64 0, i64 %59
  %61 = load i64, ptr %60, align 8, !tbaa !8
  %62 = getelementptr inbounds [200000 x i8], ptr @pres, i64 0, i64 %61
  store i8 1, ptr %62, align 1, !tbaa !13
  br label %66

63:                                               ; preds = %45
  %64 = load i64, ptr @cn1, align 8, !tbaa !8
  %65 = add nsw i64 %64, 1
  store i64 %65, ptr @cn1, align 8, !tbaa !8
  br label %66

66:                                               ; preds = %63, %54
  br label %67

67:                                               ; preds = %66
  %68 = load i64, ptr %3, align 8, !tbaa !8
  %69 = add nsw i64 %68, 1
  store i64 %69, ptr %3, align 8, !tbaa !8
  br label %40, !llvm.loop !15

70:                                               ; preds = %44
  call void @llvm.lifetime.start.p0(i64 8, ptr %4) #6
  store i64 1, ptr %4, align 8, !tbaa !8
  br label %71

71:                                               ; preds = %95, %70
  %72 = load i64, ptr %4, align 8, !tbaa !8
  %73 = load i64, ptr @N, align 8, !tbaa !8
  %74 = icmp slt i64 %72, %73
  br i1 %74, label %76, label %75

75:                                               ; preds = %71
  call void @llvm.lifetime.end.p0(i64 8, ptr %4) #6
  br label %98

76:                                               ; preds = %71
  %77 = load i64, ptr %4, align 8, !tbaa !8
  %78 = sub nsw i64 %77, 1
  %79 = getelementptr inbounds [200000 x i64], ptr @bf, i64 0, i64 %78
  %80 = load i64, ptr %79, align 8, !tbaa !8
  %81 = load i64, ptr %4, align 8, !tbaa !8
  %82 = getelementptr inbounds [200000 x i64], ptr @bf, i64 0, i64 %81
  store i64 %80, ptr %82, align 8, !tbaa !8
  %83 = load i64, ptr %4, align 8, !tbaa !8
  %84 = sub nsw i64 %83, 1
  %85 = getelementptr inbounds [200000 x i64], ptr @P, i64 0, i64 %84
  %86 = load i64, ptr %85, align 8, !tbaa !8
  %87 = xor i64 %86, -1
  %88 = icmp ne i64 %87, 0
  br i1 %88, label %94, label %89

89:                                               ; preds = %76
  %90 = load i64, ptr %4, align 8, !tbaa !8
  %91 = getelementptr inbounds [200000 x i64], ptr @bf, i64 0, i64 %90
  %92 = load i64, ptr %91, align 8, !tbaa !8
  %93 = add nsw i64 %92, 1
  store i64 %93, ptr %91, align 8, !tbaa !8
  br label %94

94:                                               ; preds = %89, %76
  br label %95

95:                                               ; preds = %94
  %96 = load i64, ptr %4, align 8, !tbaa !8
  %97 = add nsw i64 %96, 1
  store i64 %97, ptr %4, align 8, !tbaa !8
  br label %71, !llvm.loop !16

98:                                               ; preds = %75
  call void @llvm.lifetime.start.p0(i64 8, ptr %5) #6
  %99 = load i64, ptr @N, align 8, !tbaa !8
  %100 = sub nsw i64 %99, 2
  store i64 %100, ptr %5, align 8, !tbaa !8
  br label %101

101:                                              ; preds = %124, %98
  %102 = load i64, ptr %5, align 8, !tbaa !8
  %103 = icmp sge i64 %102, 0
  br i1 %103, label %105, label %104

104:                                              ; preds = %101
  call void @llvm.lifetime.end.p0(i64 8, ptr %5) #6
  br label %127

105:                                              ; preds = %101
  %106 = load i64, ptr %5, align 8, !tbaa !8
  %107 = add nsw i64 %106, 1
  %108 = getelementptr inbounds [200000 x i64], ptr @af, i64 0, i64 %107
  %109 = load i64, ptr %108, align 8, !tbaa !8
  %110 = load i64, ptr %5, align 8, !tbaa !8
  %111 = getelementptr inbounds [200000 x i64], ptr @af, i64 0, i64 %110
  store i64 %109, ptr %111, align 8, !tbaa !8
  %112 = load i64, ptr %5, align 8, !tbaa !8
  %113 = add nsw i64 %112, 1
  %114 = getelementptr inbounds [200000 x i64], ptr @P, i64 0, i64 %113
  %115 = load i64, ptr %114, align 8, !tbaa !8
  %116 = xor i64 %115, -1
  %117 = icmp ne i64 %116, 0
  br i1 %117, label %123, label %118

118:                                              ; preds = %105
  %119 = load i64, ptr %5, align 8, !tbaa !8
  %120 = getelementptr inbounds [200000 x i64], ptr @af, i64 0, i64 %119
  %121 = load i64, ptr %120, align 8, !tbaa !8
  %122 = add nsw i64 %121, 1
  store i64 %122, ptr %120, align 8, !tbaa !8
  br label %123

123:                                              ; preds = %118, %105
  br label %124

124:                                              ; preds = %123
  %125 = load i64, ptr %5, align 8, !tbaa !8
  %126 = add nsw i64 %125, -1
  store i64 %126, ptr %5, align 8, !tbaa !8
  br label %101, !llvm.loop !17

127:                                              ; preds = %104
  call void @llvm.lifetime.start.p0(i64 8, ptr %6) #6
  store i64 1, ptr %6, align 8, !tbaa !8
  br label %128

128:                                              ; preds = %151, %127
  %129 = load i64, ptr %6, align 8, !tbaa !8
  %130 = load i64, ptr @N, align 8, !tbaa !8
  %131 = icmp slt i64 %129, %130
  br i1 %131, label %133, label %132

132:                                              ; preds = %128
  call void @llvm.lifetime.end.p0(i64 8, ptr %6) #6
  br label %154

133:                                              ; preds = %128
  %134 = load i64, ptr %6, align 8, !tbaa !8
  %135 = sub nsw i64 %134, 1
  %136 = getelementptr inbounds [200000 x i64], ptr @lt, i64 0, i64 %135
  %137 = load i64, ptr %136, align 8, !tbaa !8
  %138 = load i64, ptr %6, align 8, !tbaa !8
  %139 = getelementptr inbounds [200000 x i64], ptr @lt, i64 0, i64 %138
  store i64 %137, ptr %139, align 8, !tbaa !8
  %140 = load i64, ptr %6, align 8, !tbaa !8
  %141 = sub nsw i64 %140, 1
  %142 = getelementptr inbounds [200000 x i8], ptr @pres, i64 0, i64 %141
  %143 = load i8, ptr %142, align 1, !tbaa !13, !range !18, !noundef !19
  %144 = trunc i8 %143 to i1
  br i1 %144, label %150, label %145

145:                                              ; preds = %133
  %146 = load i64, ptr %6, align 8, !tbaa !8
  %147 = getelementptr inbounds [200000 x i64], ptr @lt, i64 0, i64 %146
  %148 = load i64, ptr %147, align 8, !tbaa !8
  %149 = add nsw i64 %148, 1
  store i64 %149, ptr %147, align 8, !tbaa !8
  br label %150

150:                                              ; preds = %145, %133
  br label %151

151:                                              ; preds = %150
  %152 = load i64, ptr %6, align 8, !tbaa !8
  %153 = add nsw i64 %152, 1
  store i64 %153, ptr %6, align 8, !tbaa !8
  br label %128, !llvm.loop !20

154:                                              ; preds = %132
  call void @llvm.lifetime.start.p0(i64 8, ptr %7) #6
  %155 = load i64, ptr @N, align 8, !tbaa !8
  %156 = sub nsw i64 %155, 2
  store i64 %156, ptr %7, align 8, !tbaa !8
  br label %157

157:                                              ; preds = %179, %154
  %158 = load i64, ptr %7, align 8, !tbaa !8
  %159 = icmp sge i64 %158, 0
  br i1 %159, label %161, label %160

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

161:                                              ; preds = %157
  %162 = load i64, ptr %7, align 8, !tbaa !8
  %163 = add nsw i64 %162, 1
  %164 = getelementptr inbounds [200000 x i64], ptr @gt, i64 0, i64 %163
  %165 = load i64, ptr %164, align 8, !tbaa !8
  %166 = load i64, ptr %7, align 8, !tbaa !8
  %167 = getelementptr inbounds [200000 x i64], ptr @gt, i64 0, i64 %166
  store i64 %165, ptr %167, align 8, !tbaa !8
  %168 = load i64, ptr %7, align 8, !tbaa !8
  %169 = add nsw i64 %168, 1
  %170 = getelementptr inbounds [200000 x i8], ptr @pres, i64 0, i64 %169
  %171 = load i8, ptr %170, align 1, !tbaa !13, !range !18, !noundef !19
  %172 = trunc i8 %171 to i1
  br i1 %172, label %178, label %173

173:                                              ; preds = %161
  %174 = load i64, ptr %7, align 8, !tbaa !8
  %175 = getelementptr inbounds [200000 x i64], ptr @gt, i64 0, i64 %174
  %176 = load i64, ptr %175, align 8, !tbaa !8
  %177 = add nsw i64 %176, 1
  store i64 %177, ptr %175, align 8, !tbaa !8
  br label %178

178:                                              ; preds = %173, %161
  br label %179

179:                                              ; preds = %178
  %180 = load i64, ptr %7, align 8, !tbaa !8
  %181 = add nsw i64 %180, -1
  store i64 %181, ptr %7, align 8, !tbaa !8
  br label %157, !llvm.loop !21

182:                                              ; preds = %160
  %183 = load i64, ptr @N, align 8, !tbaa !8
  call void @_ZN3BIT4initEx(ptr noundef nonnull align 8 dereferenceable(1600016) @bit, i64 noundef %183)
  call void @llvm.lifetime.start.p0(i64 8, ptr %8) #6
  store i64 0, ptr %8, align 8, !tbaa !8
  call void @llvm.lifetime.start.p0(i64 8, ptr %9) #6
  %184 = load i64, ptr @N, align 8, !tbaa !8
  %185 = sub nsw i64 %184, 1
  store i64 %185, ptr %9, align 8, !tbaa !8
  br label %186

186:                                              ; preds = %207, %182
  %187 = load i64, ptr %9, align 8, !tbaa !8
  %188 = icmp sge i64 %187, 0
  br i1 %188, label %190, label %189

189:                                              ; preds = %186
  call void @llvm.lifetime.end.p0(i64 8, ptr %9) #6
  br label %210

190:                                              ; preds = %186
  %191 = load i64, ptr %9, align 8, !tbaa !8
  %192 = getelementptr inbounds [200000 x i64], ptr @P, i64 0, i64 %191
  %193 = load i64, ptr %192, align 8, !tbaa !8
  %194 = xor i64 %193, -1
  %195 = icmp ne i64 %194, 0
  br i1 %195, label %197, label %196

196:                                              ; preds = %190
  br label %207

197:                                              ; preds = %190
  %198 = load i64, ptr %9, align 8, !tbaa !8
  %199 = getelementptr inbounds [200000 x i64], ptr @P, i64 0, i64 %198
  %200 = load i64, ptr %199, align 8, !tbaa !8
  %201 = call noundef i64 @_ZN3BIT3qryEx(ptr noundef nonnull align 8 dereferenceable(1600016) @bit, i64 noundef %200)
  %202 = load i64, ptr %8, align 8, !tbaa !8
  %203 = add nsw i64 %202, %201
  store i64 %203, ptr %8, align 8, !tbaa !8
  %204 = load i64, ptr %9, align 8, !tbaa !8
  %205 = getelementptr inbounds [200000 x i64], ptr @P, i64 0, i64 %204
  %206 = load i64, ptr %205, align 8, !tbaa !8
  call void @_ZN3BIT3updExx(ptr noundef nonnull align 8 dereferenceable(1600016) @bit, i64 noundef %206, i64 noundef 1)
  br label %207

207:                                              ; preds = %197, %196
  %208 = load i64, ptr %9, align 8, !tbaa !8
  %209 = add nsw i64 %208, -1
  store i64 %209, ptr %9, align 8, !tbaa !8
  br label %186, !llvm.loop !22

210:                                              ; preds = %189
  %211 = load i64, ptr %8, align 8, !tbaa !8
  %212 = load i64, ptr @cn1, align 8, !tbaa !8
  %213 = call noundef i64 @_Z4factx(i64 noundef %212)
  %214 = mul nsw i64 %211, %213
  %215 = load i64, ptr @MOD, align 8, !tbaa !8
  %216 = srem i64 %214, %215
  store i64 %216, ptr %8, align 8, !tbaa !8
  call void @llvm.lifetime.start.p0(i64 8, ptr %10) #6
  store i64 0, ptr %10, align 8, !tbaa !8
  br label %217

217:                                              ; preds = %262, %210
  %218 = load i64, ptr %10, align 8, !tbaa !8
  %219 = load i64, ptr @N, align 8, !tbaa !8
  %220 = icmp slt i64 %218, %219
  br i1 %220, label %222, label %221

221:                                              ; preds = %217
  call void @llvm.lifetime.end.p0(i64 8, ptr %10) #6
  br label %265

222:                                              ; preds = %217
  %223 = load i64, ptr %10, align 8, !tbaa !8
  %224 = getelementptr inbounds [200000 x i64], ptr @P, i64 0, i64 %223
  %225 = load i64, ptr %224, align 8, !tbaa !8
  %226 = xor i64 %225, -1
  %227 = icmp ne i64 %226, 0
  br i1 %227, label %229, label %228

228:                                              ; preds = %222
  br label %262

229:                                              ; preds = %222
  call void @llvm.lifetime.start.p0(i64 8, ptr %11) #6
  %230 = load i64, ptr %10, align 8, !tbaa !8
  %231 = getelementptr inbounds [200000 x i64], ptr @af, i64 0, i64 %230
  %232 = load i64, ptr %231, align 8, !tbaa !8
  %233 = load i64, ptr %10, align 8, !tbaa !8
  %234 = getelementptr inbounds [200000 x i64], ptr @P, i64 0, i64 %233
  %235 = load i64, ptr %234, align 8, !tbaa !8
  %236 = getelementptr inbounds [200000 x i64], ptr @lt, i64 0, i64 %235
  %237 = load i64, ptr %236, align 8, !tbaa !8
  %238 = mul nsw i64 %232, %237
  %239 = load i64, ptr %10, align 8, !tbaa !8
  %240 = getelementptr inbounds [200000 x i64], ptr @bf, i64 0, i64 %239
  %241 = load i64, ptr %240, align 8, !tbaa !8
  %242 = load i64, ptr %10, align 8, !tbaa !8
  %243 = getelementptr inbounds [200000 x i64], ptr @P, i64 0, i64 %242
  %244 = load i64, ptr %243, align 8, !tbaa !8
  %245 = getelementptr inbounds [200000 x i64], ptr @gt, i64 0, i64 %244
  %246 = load i64, ptr %245, align 8, !tbaa !8
  %247 = mul nsw i64 %241, %246
  %248 = add nsw i64 %238, %247
  %249 = load i64, ptr @MOD, align 8, !tbaa !8
  %250 = srem i64 %248, %249
  %251 = load i64, ptr @cn1, align 8, !tbaa !8
  %252 = sub nsw i64 %251, 1
  %253 = call noundef i64 @_Z4factx(i64 noundef %252)
  %254 = mul nsw i64 %250, %253
  %255 = load i64, ptr @MOD, align 8, !tbaa !8
  %256 = srem i64 %254, %255
  store i64 %256, ptr %11, align 8, !tbaa !8
  %257 = load i64, ptr %8, align 8, !tbaa !8
  %258 = load i64, ptr %11, align 8, !tbaa !8
  %259 = add nsw i64 %257, %258
  %260 = load i64, ptr @MOD, align 8, !tbaa !8
  %261 = srem i64 %259, %260
  store i64 %261, ptr %8, align 8, !tbaa !8
  call void @llvm.lifetime.end.p0(i64 8, ptr %11) #6
  br label %262

262:                                              ; preds = %229, %228
  %263 = load i64, ptr %10, align 8, !tbaa !8
  %264 = add nsw i64 %263, 1
  store i64 %264, ptr %10, align 8, !tbaa !8
  br label %217, !llvm.loop !23

265:                                              ; preds = %221
  call void @llvm.lifetime.start.p0(i64 8, ptr %12) #6
  store i64 0, ptr %12, align 8, !tbaa !8
  br label %266

266:                                              ; preds = %297, %265
  %267 = load i64, ptr %12, align 8, !tbaa !8
  %268 = load i64, ptr @N, align 8, !tbaa !8
  %269 = icmp slt i64 %267, %268
  br i1 %269, label %271, label %270

270:                                              ; preds = %266
  call void @llvm.lifetime.end.p0(i64 8, ptr %12) #6
  br label %300

271:                                              ; preds = %266
  %272 = load i64, ptr %12, align 8, !tbaa !8
  %273 = getelementptr inbounds [200000 x i8], ptr @pres, i64 0, i64 %272
  %274 = load i8, ptr %273, align 1, !tbaa !13, !range !18, !noundef !19
  %275 = trunc i8 %274 to i1
  br i1 %275, label %276, label %277

276:                                              ; preds = %271
  br label %297

277:                                              ; preds = %271
  call void @llvm.lifetime.start.p0(i64 8, ptr %13) #6
  %278 = load i64, ptr %12, align 8, !tbaa !8
  %279 = getelementptr inbounds [200000 x i64], ptr @lt, i64 0, i64 %278
  %280 = load i64, ptr %279, align 8, !tbaa !8
  %281 = load i64, ptr @cn1, align 8, !tbaa !8
  %282 = call noundef i64 @_Z3nc2x(i64 noundef %281)
  %283 = mul nsw i64 %280, %282
  %284 = load i64, ptr @MOD, align 8, !tbaa !8
  %285 = srem i64 %283, %284
  %286 = load i64, ptr @cn1, align 8, !tbaa !8
  %287 = sub nsw i64 %286, 2
  %288 = call noundef i64 @_Z4factx(i64 noundef %287)
  %289 = mul nsw i64 %285, %288
  %290 = load i64, ptr @MOD, align 8, !tbaa !8
  %291 = srem i64 %289, %290
  store i64 %291, ptr %13, align 8, !tbaa !8
  %292 = load i64, ptr %8, align 8, !tbaa !8
  %293 = load i64, ptr %13, align 8, !tbaa !8
  %294 = add nsw i64 %292, %293
  %295 = load i64, ptr @MOD, align 8, !tbaa !8
  %296 = srem i64 %294, %295
  store i64 %296, ptr %8, align 8, !tbaa !8
  call void @llvm.lifetime.end.p0(i64 8, ptr %13) #6
  br label %297

297:                                              ; preds = %277, %276
  %298 = load i64, ptr %12, align 8, !tbaa !8
  %299 = add nsw i64 %298, 1
  store i64 %299, ptr %12, align 8, !tbaa !8
  br label %266, !llvm.loop !24

300:                                              ; preds = %270
  %301 = load i64, ptr %8, align 8, !tbaa !8
  %302 = load i64, ptr @cn1, align 8, !tbaa !8
  %303 = call noundef i64 @_Z4factx(i64 noundef %302)
  %304 = call noundef i64 @_Z3invx(i64 noundef %303)
  %305 = mul nsw i64 %301, %304
  %306 = load i64, ptr @MOD, align 8, !tbaa !8
  %307 = srem i64 %305, %306
  %308 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEx(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cout, i64 noundef %307)
  %309 = call noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_c(ptr noundef nonnull align 8 dereferenceable(8) %308, i8 noundef signext 10)
  call void @llvm.lifetime.end.p0(i64 8, ptr %8) #6
  %310 = load i32, ptr %1, align 4
  ret i32 %310
}

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

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

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

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

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

; Function Attrs: inlinehint mustprogress uwtable
declare noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_c(ptr noundef nonnull align 8 dereferenceable(8), i8 noundef signext) #5

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

attributes #0 = { mustprogress nounwind uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #1 = { nocallback nofree nosync nounwind willreturn memory(argmem: readwrite) }
attributes #2 = { mustprogress uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #3 = { mustprogress norecurse uwtable "min-legal-vector-width"="0" "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #4 = { "no-trapping-math"="true" "stack-protector-buffer-size"="8" "target-cpu"="x86-64" "target-features"="+cmov,+cx8,+fxsr,+mmx,+sse,+sse2,+x87" "tune-cpu"="generic" }
attributes #5 = { inlinehint mustprogress 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 = !{!14, !14, i64 0}
!14 = !{!"bool", !10, i64 0}
!15 = distinct !{!15, !12}
!16 = distinct !{!16, !12}
!17 = distinct !{!17, !12}
!18 = !{i8 0, i8 2}
!19 = !{}
!20 = distinct !{!20, !12}
!21 = distinct !{!21, !12}
!22 = distinct !{!22, !12}
!23 = distinct !{!23, !12}
!24 = distinct !{!24, !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"

%struct.BIT = type { [200001 x i64], i64 }
%"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" }

@MOD = external dso_local local_unnamed_addr global i64, align 8
@N = external dso_local global i64, align 8
@P = external dso_local global [200000 x i64], align 16
@F = external dso_local local_unnamed_addr global [300000 x i64], align 16
@cn1 = external dso_local local_unnamed_addr global i64, align 8
@bf = external dso_local local_unnamed_addr global [200000 x i64], align 16
@af = external dso_local local_unnamed_addr global [200000 x i64], align 16
@lt = external dso_local local_unnamed_addr global [200000 x i64], align 16
@gt = external dso_local local_unnamed_addr global [200000 x i64], align 16
@pres = external dso_local local_unnamed_addr global [200000 x i8], align 16
@bit = external dso_local global %struct.BIT, align 8
@_ZSt3cin = external global %"class.std::basic_istream", align 8
@_ZSt4cout = external global %"class.std::basic_ostream", align 8

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef i64 @_Z3invx(i64 noundef) local_unnamed_addr #0

; Function Attrs: mustprogress nounwind uwtable
declare dso_local noundef i64 @_Z3nc2x(i64 noundef) local_unnamed_addr #0

; Function Attrs: mustprogress uwtable
declare dso_local noundef i64 @_Z4factx(i64 noundef) local_unnamed_addr #1

; Function Attrs: mustprogress norecurse uwtable
define dso_local noundef i32 @main() local_unnamed_addr #2 {
  %1 = load ptr, ptr @_ZSt3cin, align 8, !tbaa !5
  %2 = getelementptr i8, ptr %1, i64 -24
  %3 = load i64, ptr %2, align 8
  %4 = getelementptr inbounds i8, ptr @_ZSt3cin, i64 %3
  %5 = tail call noundef ptr @_ZNSt9basic_iosIcSt11char_traitsIcEE3tieEPSo(ptr noundef nonnull align 8 dereferenceable(264) %4, ptr noundef null)
  %6 = tail call noundef zeroext i1 @_ZNSt8ios_base15sync_with_stdioEb(i1 noundef zeroext false)
  store i64 1, ptr @F, align 16, !tbaa !8
  %7 = load i64, ptr @MOD, align 8, !tbaa !8
  br label %12

8:                                                ; preds = %12
  %9 = 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)
  %10 = load i64, ptr @N, align 8, !tbaa !8
  %11 = icmp sgt i64 %10, 0
  br i1 %11, label %.lr.ph, label %._crit_edge88

12:                                               ; preds = %18, %0
  %13 = phi i64 [ 1, %0 ], [ %20, %18 ]
  %.077 = phi i64 [ 1, %0 ], [ %22, %18 ]
  %14 = mul nsw i64 %13, %.077
  %15 = srem i64 %14, %7
  %16 = getelementptr inbounds [300000 x i64], ptr @F, i64 0, i64 %.077
  store i64 %15, ptr %16, align 8, !tbaa !8
  %17 = add nuw nsw i64 %.077, 1
  %exitcond.not = icmp eq i64 %17, 300000
  br i1 %exitcond.not, label %8, label %18, !llvm.loop !11

18:                                               ; preds = %12
  %19 = mul nsw i64 %15, %17
  %20 = srem i64 %19, %7
  %21 = getelementptr inbounds [300000 x i64], ptr @F, i64 0, i64 %17
  store i64 %20, ptr %21, align 8, !tbaa !8
  %22 = add nuw nsw i64 %.077, 2
  br label %12

.preheader76:                                     ; preds = %36
  %23 = icmp sgt i64 %38, 1
  br i1 %23, label %.lr.ph80.preheader, label %._crit_edge88

.lr.ph80.preheader:                               ; preds = %.preheader76
  %.pre = load i64, ptr @bf, align 16, !tbaa !8
  %24 = add nsw i64 %38, -1
  %25 = add nsw i64 %38, -2
  %xtraiter = and i64 %24, 1
  %26 = icmp eq i64 %25, 0
  br i1 %26, label %._crit_edge.unr-lcssa, label %.lr.ph80.preheader.new

.lr.ph80.preheader.new:                           ; preds = %.lr.ph80.preheader
  %unroll_iter = and i64 %24, -2
  br label %.lr.ph80

.lr.ph:                                           ; preds = %8, %36
  %.06078 = phi i64 [ %37, %36 ], [ 0, %8 ]
  %27 = getelementptr inbounds [200000 x i64], ptr @P, i64 0, i64 %.06078
  %28 = 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) %27)
  %29 = load i64, ptr %27, align 8, !tbaa !8
  %.not73 = icmp eq i64 %29, -1
  br i1 %.not73, label %33, label %30

30:                                               ; preds = %.lr.ph
  %31 = add nsw i64 %29, -1
  store i64 %31, ptr %27, align 8, !tbaa !8
  %32 = getelementptr inbounds [200000 x i8], ptr @pres, i64 0, i64 %31
  store i8 1, ptr %32, align 1, !tbaa !13
  br label %36

33:                                               ; preds = %.lr.ph
  %34 = load i64, ptr @cn1, align 8, !tbaa !8
  %35 = add nsw i64 %34, 1
  store i64 %35, ptr @cn1, align 8, !tbaa !8
  br label %36

36:                                               ; preds = %30, %33
  %37 = add nuw nsw i64 %.06078, 1
  %38 = load i64, ptr @N, align 8, !tbaa !8
  %39 = icmp slt i64 %37, %38
  br i1 %39, label %.lr.ph, label %.preheader76, !llvm.loop !15

._crit_edge.unr-lcssa:                            ; preds = %71, %.lr.ph80.preheader
  %.unr = phi i64 [ %.pre, %.lr.ph80.preheader ], [ %72, %71 ]
  %.06779.unr = phi i64 [ 1, %.lr.ph80.preheader ], [ %73, %71 ]
  %lcmp.mod.not = icmp eq i64 %xtraiter, 0
  br i1 %lcmp.mod.not, label %._crit_edge, label %.lr.ph80.epil

.lr.ph80.epil:                                    ; preds = %._crit_edge.unr-lcssa
  %40 = add nsw i64 %.06779.unr, -1
  %41 = getelementptr inbounds [200000 x i64], ptr @bf, i64 0, i64 %.06779.unr
  store i64 %.unr, ptr %41, align 8, !tbaa !8
  %42 = getelementptr inbounds [200000 x i64], ptr @P, i64 0, i64 %40
  %43 = load i64, ptr %42, align 8, !tbaa !8
  %.not72.epil = icmp eq i64 %43, -1
  br i1 %.not72.epil, label %44, label %._crit_edge

44:                                               ; preds = %.lr.ph80.epil
  %45 = add nsw i64 %.unr, 1
  store i64 %45, ptr %41, align 8, !tbaa !8
  br label %._crit_edge

._crit_edge:                                      ; preds = %.lr.ph80.epil, %44, %._crit_edge.unr-lcssa
  %46 = add nsw i64 %38, -2
  br i1 %23, label %.lr.ph83.preheader, label %._crit_edge88

.lr.ph83.preheader:                               ; preds = %._crit_edge
  %xtraiter128 = and i64 %24, 1
  %lcmp.mod129.not = icmp eq i64 %xtraiter128, 0
  br i1 %lcmp.mod129.not, label %.lr.ph83.prol.loopexit, label %.lr.ph83.prol

.lr.ph83.prol:                                    ; preds = %.lr.ph83.preheader
  %47 = add nsw i64 %38, -1
  %48 = getelementptr inbounds [200000 x i64], ptr @af, i64 0, i64 %47
  %49 = load i64, ptr %48, align 8, !tbaa !8
  %50 = getelementptr inbounds [200000 x i64], ptr @af, i64 0, i64 %46
  store i64 %49, ptr %50, align 8, !tbaa !8
  %51 = getelementptr inbounds [200000 x i64], ptr @P, i64 0, i64 %47
  %52 = load i64, ptr %51, align 8, !tbaa !8
  %.not71.prol = icmp eq i64 %52, -1
  br i1 %.not71.prol, label %53, label %.lr.ph83.prol.loopexit.unr-lcssa

53:                                               ; preds = %.lr.ph83.prol
  %54 = add nsw i64 %49, 1
  store i64 %54, ptr %50, align 8, !tbaa !8
  br label %.lr.ph83.prol.loopexit.unr-lcssa

.lr.ph83.prol.loopexit.unr-lcssa:                 ; preds = %53, %.lr.ph83.prol
  %55 = add nsw i64 %38, -3
  br label %.lr.ph83.prol.loopexit

.lr.ph83.prol.loopexit:                           ; preds = %.lr.ph83.prol.loopexit.unr-lcssa, %.lr.ph83.preheader
  %.06681.unr = phi i64 [ %46, %.lr.ph83.preheader ], [ %55, %.lr.ph83.prol.loopexit.unr-lcssa ]
  %56 = icmp eq i64 %25, 0
  br i1 %56, label %.preheader75, label %.lr.ph83

.lr.ph80:                                         ; preds = %71, %.lr.ph80.preheader.new
  %57 = phi i64 [ %.pre, %.lr.ph80.preheader.new ], [ %72, %71 ]
  %.06779 = phi i64 [ 1, %.lr.ph80.preheader.new ], [ %73, %71 ]
  %niter = phi i64 [ 0, %.lr.ph80.preheader.new ], [ %niter.next.1, %71 ]
  %58 = add nsw i64 %.06779, -1
  %59 = getelementptr inbounds [200000 x i64], ptr @bf, i64 0, i64 %.06779
  store i64 %57, ptr %59, align 8, !tbaa !8
  %60 = getelementptr inbounds [200000 x i64], ptr @P, i64 0, i64 %58
  %61 = load i64, ptr %60, align 8, !tbaa !8
  %.not72 = icmp eq i64 %61, -1
  br i1 %.not72, label %62, label %.lr.ph80.1

62:                                               ; preds = %.lr.ph80
  %63 = add nsw i64 %57, 1
  store i64 %63, ptr %59, align 8, !tbaa !8
  br label %.lr.ph80.1

.lr.ph80.1:                                       ; preds = %.lr.ph80, %62
  %64 = phi i64 [ %57, %.lr.ph80 ], [ %63, %62 ]
  %65 = add nuw nsw i64 %.06779, 1
  %66 = getelementptr inbounds [200000 x i64], ptr @bf, i64 0, i64 %65
  store i64 %64, ptr %66, align 8, !tbaa !8
  %67 = getelementptr inbounds [200000 x i64], ptr @P, i64 0, i64 %.06779
  %68 = load i64, ptr %67, align 8, !tbaa !8
  %.not72.1 = icmp eq i64 %68, -1
  br i1 %.not72.1, label %69, label %71

69:                                               ; preds = %.lr.ph80.1
  %70 = add nsw i64 %64, 1
  store i64 %70, ptr %66, align 8, !tbaa !8
  br label %71

71:                                               ; preds = %69, %.lr.ph80.1
  %72 = phi i64 [ %64, %.lr.ph80.1 ], [ %70, %69 ]
  %73 = add nuw nsw i64 %.06779, 2
  %niter.next.1 = add i64 %niter, 2
  %niter.ncmp.1 = icmp eq i64 %niter.next.1, %unroll_iter
  br i1 %niter.ncmp.1, label %._crit_edge.unr-lcssa, label %.lr.ph80, !llvm.loop !16

.preheader75:                                     ; preds = %91, %.lr.ph83.prol.loopexit
  br i1 %23, label %.lr.ph85.preheader, label %._crit_edge88

.lr.ph85.preheader:                               ; preds = %.preheader75
  %.pre109 = load i64, ptr @lt, align 16, !tbaa !8
  %xtraiter130 = and i64 %24, 1
  %74 = icmp eq i64 %25, 0
  br i1 %74, label %.preheader74.unr-lcssa, label %.lr.ph85.preheader.new

.lr.ph85.preheader.new:                           ; preds = %.lr.ph85.preheader
  %unroll_iter133 = and i64 %24, -2
  br label %.lr.ph85

.lr.ph83:                                         ; preds = %.lr.ph83.prol.loopexit, %91
  %.06681 = phi i64 [ %92, %91 ], [ %.06681.unr, %.lr.ph83.prol.loopexit ]
  %75 = add nuw nsw i64 %.06681, 1
  %76 = getelementptr inbounds [200000 x i64], ptr @af, i64 0, i64 %75
  %77 = load i64, ptr %76, align 8, !tbaa !8
  %78 = getelementptr inbounds [200000 x i64], ptr @af, i64 0, i64 %.06681
  store i64 %77, ptr %78, align 8, !tbaa !8
  %79 = getelementptr inbounds [200000 x i64], ptr @P, i64 0, i64 %75
  %80 = load i64, ptr %79, align 8, !tbaa !8
  %.not71 = icmp eq i64 %80, -1
  br i1 %.not71, label %81, label %.lr.ph83.1

81:                                               ; preds = %.lr.ph83
  %82 = add nsw i64 %77, 1
  store i64 %82, ptr %78, align 8, !tbaa !8
  br label %.lr.ph83.1

.lr.ph83.1:                                       ; preds = %.lr.ph83, %81
  %83 = add nsw i64 %.06681, -1
  %84 = getelementptr inbounds [200000 x i64], ptr @af, i64 0, i64 %.06681
  %85 = load i64, ptr %84, align 8, !tbaa !8
  %86 = getelementptr inbounds [200000 x i64], ptr @af, i64 0, i64 %83
  store i64 %85, ptr %86, align 8, !tbaa !8
  %87 = getelementptr inbounds [200000 x i64], ptr @P, i64 0, i64 %.06681
  %88 = load i64, ptr %87, align 8, !tbaa !8
  %.not71.1 = icmp eq i64 %88, -1
  br i1 %.not71.1, label %89, label %91

89:                                               ; preds = %.lr.ph83.1
  %90 = add nsw i64 %85, 1
  store i64 %90, ptr %86, align 8, !tbaa !8
  br label %91

91:                                               ; preds = %89, %.lr.ph83.1
  %92 = add nsw i64 %.06681, -2
  %93 = icmp sgt i64 %.06681, 1
  br i1 %93, label %.lr.ph83, label %.preheader75, !llvm.loop !17

.preheader74.unr-lcssa:                           ; preds = %128, %.lr.ph85.preheader
  %.unr131 = phi i64 [ %.pre109, %.lr.ph85.preheader ], [ %129, %128 ]
  %.06584.unr = phi i64 [ 1, %.lr.ph85.preheader ], [ %130, %128 ]
  %lcmp.mod132.not = icmp eq i64 %xtraiter130, 0
  br i1 %lcmp.mod132.not, label %.preheader74, label %.lr.ph85.epil

.lr.ph85.epil:                                    ; preds = %.preheader74.unr-lcssa
  %94 = add nsw i64 %.06584.unr, -1
  %95 = getelementptr inbounds [200000 x i64], ptr @lt, i64 0, i64 %.06584.unr
  store i64 %.unr131, ptr %95, align 8, !tbaa !8
  %96 = getelementptr inbounds [200000 x i8], ptr @pres, i64 0, i64 %94
  %97 = load i8, ptr %96, align 1, !tbaa !13, !range !18, !noundef !19
  %98 = trunc nuw i8 %97 to i1
  br i1 %98, label %.preheader74, label %99

99:                                               ; preds = %.lr.ph85.epil
  %100 = add nsw i64 %.unr131, 1
  store i64 %100, ptr %95, align 8, !tbaa !8
  br label %.preheader74

.preheader74:                                     ; preds = %.lr.ph85.epil, %99, %.preheader74.unr-lcssa
  br i1 %23, label %.lr.ph87.preheader, label %._crit_edge88

.lr.ph87.preheader:                               ; preds = %.preheader74
  %xtraiter135 = and i64 %24, 1
  %lcmp.mod136.not = icmp eq i64 %xtraiter135, 0
  br i1 %lcmp.mod136.not, label %.lr.ph87.prol.loopexit, label %.lr.ph87.prol

.lr.ph87.prol:                                    ; preds = %.lr.ph87.preheader
  %101 = add nsw i64 %38, -1
  %102 = getelementptr inbounds [200000 x i64], ptr @gt, i64 0, i64 %101
  %103 = load i64, ptr %102, align 8, !tbaa !8
  %104 = getelementptr inbounds [200000 x i64], ptr @gt, i64 0, i64 %46
  store i64 %103, ptr %104, align 8, !tbaa !8
  %105 = getelementptr inbounds [200000 x i8], ptr @pres, i64 0, i64 %101
  %106 = load i8, ptr %105, align 1, !tbaa !13, !range !18, !noundef !19
  %107 = trunc nuw i8 %106 to i1
  br i1 %107, label %.lr.ph87.prol.loopexit.unr-lcssa, label %108

108:                                              ; preds = %.lr.ph87.prol
  %109 = add nsw i64 %103, 1
  store i64 %109, ptr %104, align 8, !tbaa !8
  br label %.lr.ph87.prol.loopexit.unr-lcssa

.lr.ph87.prol.loopexit.unr-lcssa:                 ; preds = %108, %.lr.ph87.prol
  %110 = add nsw i64 %38, -3
  br label %.lr.ph87.prol.loopexit

.lr.ph87.prol.loopexit:                           ; preds = %.lr.ph87.prol.loopexit.unr-lcssa, %.lr.ph87.preheader
  %.06486.unr = phi i64 [ %46, %.lr.ph87.preheader ], [ %110, %.lr.ph87.prol.loopexit.unr-lcssa ]
  %111 = icmp eq i64 %25, 0
  br i1 %111, label %._crit_edge88, label %.lr.ph87

.lr.ph85:                                         ; preds = %128, %.lr.ph85.preheader.new
  %112 = phi i64 [ %.pre109, %.lr.ph85.preheader.new ], [ %129, %128 ]
  %.06584 = phi i64 [ 1, %.lr.ph85.preheader.new ], [ %130, %128 ]
  %niter134 = phi i64 [ 0, %.lr.ph85.preheader.new ], [ %niter134.next.1, %128 ]
  %113 = add nsw i64 %.06584, -1
  %114 = getelementptr inbounds [200000 x i64], ptr @lt, i64 0, i64 %.06584
  store i64 %112, ptr %114, align 8, !tbaa !8
  %115 = getelementptr inbounds [200000 x i8], ptr @pres, i64 0, i64 %113
  %116 = load i8, ptr %115, align 1, !tbaa !13, !range !18, !noundef !19
  %117 = trunc nuw i8 %116 to i1
  br i1 %117, label %.lr.ph85.1, label %118

118:                                              ; preds = %.lr.ph85
  %119 = add nsw i64 %112, 1
  store i64 %119, ptr %114, align 8, !tbaa !8
  br label %.lr.ph85.1

.lr.ph85.1:                                       ; preds = %.lr.ph85, %118
  %120 = phi i64 [ %112, %.lr.ph85 ], [ %119, %118 ]
  %121 = add nuw nsw i64 %.06584, 1
  %122 = getelementptr inbounds [200000 x i64], ptr @lt, i64 0, i64 %121
  store i64 %120, ptr %122, align 8, !tbaa !8
  %123 = getelementptr inbounds [200000 x i8], ptr @pres, i64 0, i64 %.06584
  %124 = load i8, ptr %123, align 1, !tbaa !13, !range !18, !noundef !19
  %125 = trunc nuw i8 %124 to i1
  br i1 %125, label %128, label %126

126:                                              ; preds = %.lr.ph85.1
  %127 = add nsw i64 %120, 1
  store i64 %127, ptr %122, align 8, !tbaa !8
  br label %128

128:                                              ; preds = %126, %.lr.ph85.1
  %129 = phi i64 [ %120, %.lr.ph85.1 ], [ %127, %126 ]
  %130 = add nuw nsw i64 %.06584, 2
  %niter134.next.1 = add i64 %niter134, 2
  %niter134.ncmp.1 = icmp eq i64 %niter134.next.1, %unroll_iter133
  br i1 %niter134.ncmp.1, label %.preheader74.unr-lcssa, label %.lr.ph85, !llvm.loop !20

._crit_edge88:                                    ; preds = %.lr.ph87.prol.loopexit, %151, %8, %.preheader76, %._crit_edge, %.preheader75, %.preheader74
  %.lcssa113115119123 = phi i64 [ %38, %.preheader74 ], [ %38, %.preheader75 ], [ %38, %._crit_edge ], [ %38, %.preheader76 ], [ %10, %8 ], [ %38, %151 ], [ %38, %.lr.ph87.prol.loopexit ]
  tail call void @_ZN3BIT4initEx(ptr noundef nonnull align 8 dereferenceable(1600016) @bit, i64 noundef %.lcssa113115119123)
  %131 = load i64, ptr @N, align 8, !tbaa !8
  %132 = icmp sgt i64 %131, 0
  br i1 %132, label %.lr.ph93, label %._crit_edge94

.lr.ph87:                                         ; preds = %.lr.ph87.prol.loopexit, %151
  %.06486 = phi i64 [ %152, %151 ], [ %.06486.unr, %.lr.ph87.prol.loopexit ]
  %133 = add nuw nsw i64 %.06486, 1
  %134 = getelementptr inbounds [200000 x i64], ptr @gt, i64 0, i64 %133
  %135 = load i64, ptr %134, align 8, !tbaa !8
  %136 = getelementptr inbounds [200000 x i64], ptr @gt, i64 0, i64 %.06486
  store i64 %135, ptr %136, align 8, !tbaa !8
  %137 = getelementptr inbounds [200000 x i8], ptr @pres, i64 0, i64 %133
  %138 = load i8, ptr %137, align 1, !tbaa !13, !range !18, !noundef !19
  %139 = trunc nuw i8 %138 to i1
  br i1 %139, label %.lr.ph87.1, label %140

140:                                              ; preds = %.lr.ph87
  %141 = add nsw i64 %135, 1
  store i64 %141, ptr %136, align 8, !tbaa !8
  br label %.lr.ph87.1

.lr.ph87.1:                                       ; preds = %.lr.ph87, %140
  %142 = add nsw i64 %.06486, -1
  %143 = getelementptr inbounds [200000 x i64], ptr @gt, i64 0, i64 %.06486
  %144 = load i64, ptr %143, align 8, !tbaa !8
  %145 = getelementptr inbounds [200000 x i64], ptr @gt, i64 0, i64 %142
  store i64 %144, ptr %145, align 8, !tbaa !8
  %146 = getelementptr inbounds [200000 x i8], ptr @pres, i64 0, i64 %.06486
  %147 = load i8, ptr %146, align 1, !tbaa !13, !range !18, !noundef !19
  %148 = trunc nuw i8 %147 to i1
  br i1 %148, label %151, label %149

149:                                              ; preds = %.lr.ph87.1
  %150 = add nsw i64 %144, 1
  store i64 %150, ptr %145, align 8, !tbaa !8
  br label %151

151:                                              ; preds = %149, %.lr.ph87.1
  %152 = add nsw i64 %.06486, -2
  %153 = icmp sgt i64 %.06486, 1
  br i1 %153, label %.lr.ph87, label %._crit_edge88, !llvm.loop !21

._crit_edge94:                                    ; preds = %167, %._crit_edge88
  %.063.lcssa = phi i64 [ 0, %._crit_edge88 ], [ %.1, %167 ]
  %154 = load i64, ptr @cn1, align 8, !tbaa !8
  %155 = tail call noundef i64 @_Z4factx(i64 noundef %154)
  %156 = mul nsw i64 %155, %.063.lcssa
  %157 = load i64, ptr @MOD, align 8, !tbaa !8
  %158 = srem i64 %156, %157
  %159 = load i64, ptr @N, align 8, !tbaa !8
  %160 = icmp sgt i64 %159, 0
  br i1 %160, label %.lr.ph99, label %._crit_edge104

.lr.ph93:                                         ; preds = %._crit_edge88, %167
  %.06291.in = phi i64 [ %.06291, %167 ], [ %131, %._crit_edge88 ]
  %.06390 = phi i64 [ %.1, %167 ], [ 0, %._crit_edge88 ]
  %.06291 = add nsw i64 %.06291.in, -1
  %161 = getelementptr inbounds [200000 x i64], ptr @P, i64 0, i64 %.06291
  %162 = load i64, ptr %161, align 8, !tbaa !8
  %.not70 = icmp eq i64 %162, -1
  br i1 %.not70, label %167, label %163

163:                                              ; preds = %.lr.ph93
  %164 = tail call noundef i64 @_ZN3BIT3qryEx(ptr noundef nonnull align 8 dereferenceable(1600016) @bit, i64 noundef %162)
  %165 = add nsw i64 %164, %.06390
  %166 = load i64, ptr %161, align 8, !tbaa !8
  tail call void @_ZN3BIT3updExx(ptr noundef nonnull align 8 dereferenceable(1600016) @bit, i64 noundef %166, i64 noundef 1)
  br label %167

167:                                              ; preds = %.lr.ph93, %163
  %.1 = phi i64 [ %165, %163 ], [ %.06390, %.lr.ph93 ]
  %168 = icmp ugt i64 %.06291.in, 1
  br i1 %168, label %.lr.ph93, label %._crit_edge94, !llvm.loop !22

.preheader:                                       ; preds = %195
  %169 = icmp sgt i64 %196, 0
  br i1 %169, label %.lr.ph103, label %._crit_edge104

.lr.ph99:                                         ; preds = %._crit_edge94, %195
  %170 = phi i64 [ %196, %195 ], [ %159, %._crit_edge94 ]
  %171 = phi i64 [ %197, %195 ], [ %157, %._crit_edge94 ]
  %.06197 = phi i64 [ %198, %195 ], [ 0, %._crit_edge94 ]
  %.296 = phi i64 [ %.3, %195 ], [ %158, %._crit_edge94 ]
  %172 = getelementptr inbounds [200000 x i64], ptr @P, i64 0, i64 %.06197
  %173 = load i64, ptr %172, align 8, !tbaa !8
  %.not = icmp eq i64 %173, -1
  br i1 %.not, label %195, label %174

174:                                              ; preds = %.lr.ph99
  %175 = getelementptr inbounds [200000 x i64], ptr @af, i64 0, i64 %.06197
  %176 = load i64, ptr %175, align 8, !tbaa !8
  %177 = getelementptr inbounds [200000 x i64], ptr @lt, i64 0, i64 %173
  %178 = load i64, ptr %177, align 8, !tbaa !8
  %179 = mul nsw i64 %178, %176
  %180 = getelementptr inbounds [200000 x i64], ptr @bf, i64 0, i64 %.06197
  %181 = load i64, ptr %180, align 8, !tbaa !8
  %182 = getelementptr inbounds [200000 x i64], ptr @gt, i64 0, i64 %173
  %183 = load i64, ptr %182, align 8, !tbaa !8
  %184 = mul nsw i64 %183, %181
  %185 = add nsw i64 %184, %179
  %186 = srem i64 %185, %171
  %187 = load i64, ptr @cn1, align 8, !tbaa !8
  %188 = add nsw i64 %187, -1
  %189 = tail call noundef i64 @_Z4factx(i64 noundef %188)
  %190 = mul nsw i64 %189, %186
  %191 = load i64, ptr @MOD, align 8, !tbaa !8
  %192 = srem i64 %190, %191
  %193 = add nsw i64 %192, %.296
  %194 = srem i64 %193, %191
  %.pre110 = load i64, ptr @N, align 8, !tbaa !8
  br label %195

195:                                              ; preds = %.lr.ph99, %174
  %196 = phi i64 [ %.pre110, %174 ], [ %170, %.lr.ph99 ]
  %197 = phi i64 [ %191, %174 ], [ %171, %.lr.ph99 ]
  %.3 = phi i64 [ %194, %174 ], [ %.296, %.lr.ph99 ]
  %198 = add nuw nsw i64 %.06197, 1
  %199 = icmp slt i64 %198, %196
  br i1 %199, label %.lr.ph99, label %.preheader, !llvm.loop !23

._crit_edge104:                                   ; preds = %228, %._crit_edge94, %.preheader
  %.4.lcssa = phi i64 [ %.3, %.preheader ], [ %158, %._crit_edge94 ], [ %.5, %228 ]
  %200 = load i64, ptr @cn1, align 8, !tbaa !8
  %201 = tail call noundef i64 @_Z4factx(i64 noundef %200)
  %202 = tail call noundef i64 @_Z3invx(i64 noundef %201)
  %203 = mul nsw i64 %202, %.4.lcssa
  %204 = load i64, ptr @MOD, align 8, !tbaa !8
  %205 = srem i64 %203, %204
  %206 = tail call noundef nonnull align 8 dereferenceable(8) ptr @_ZNSolsEx(ptr noundef nonnull align 8 dereferenceable(8) @_ZSt4cout, i64 noundef %205)
  %207 = tail call noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_c(ptr noundef nonnull align 8 dereferenceable(8) %206, i8 noundef signext 10)
  ret i32 0

.lr.ph103:                                        ; preds = %.preheader, %228
  %208 = phi i64 [ %229, %228 ], [ %196, %.preheader ]
  %.059102 = phi i64 [ %230, %228 ], [ 0, %.preheader ]
  %.4101 = phi i64 [ %.5, %228 ], [ %.3, %.preheader ]
  %209 = getelementptr inbounds [200000 x i8], ptr @pres, i64 0, i64 %.059102
  %210 = load i8, ptr %209, align 1, !tbaa !13, !range !18, !noundef !19
  %211 = trunc nuw i8 %210 to i1
  br i1 %211, label %228, label %212

212:                                              ; preds = %.lr.ph103
  %213 = getelementptr inbounds [200000 x i64], ptr @lt, i64 0, i64 %.059102
  %214 = load i64, ptr %213, align 8, !tbaa !8
  %215 = load i64, ptr @cn1, align 8, !tbaa !8
  %216 = tail call noundef i64 @_Z3nc2x(i64 noundef %215)
  %217 = mul nsw i64 %216, %214
  %218 = load i64, ptr @MOD, align 8, !tbaa !8
  %219 = srem i64 %217, %218
  %220 = load i64, ptr @cn1, align 8, !tbaa !8
  %221 = add nsw i64 %220, -2
  %222 = tail call noundef i64 @_Z4factx(i64 noundef %221)
  %223 = mul nsw i64 %222, %219
  %224 = load i64, ptr @MOD, align 8, !tbaa !8
  %225 = srem i64 %223, %224
  %226 = add nsw i64 %225, %.4101
  %227 = srem i64 %226, %224
  %.pre111 = load i64, ptr @N, align 8, !tbaa !8
  br label %228

228:                                              ; preds = %.lr.ph103, %212
  %229 = phi i64 [ %208, %.lr.ph103 ], [ %.pre111, %212 ]
  %.5 = phi i64 [ %.4101, %.lr.ph103 ], [ %227, %212 ]
  %230 = add nuw nsw i64 %.059102, 1
  %231 = icmp slt i64 %230, %229
  br i1 %231, label %.lr.ph103, label %._crit_edge104, !llvm.loop !24
}

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

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

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

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

; Function Attrs: inlinehint mustprogress uwtable
declare noundef nonnull align 8 dereferenceable(8) ptr @_ZStlsISt11char_traitsIcEERSt13basic_ostreamIcT_ES5_c(ptr noundef nonnull align 8 dereferenceable(8), i8 noundef signext) local_unnamed_addr #4

; 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 #1 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 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 #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 = { 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" }

!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 = !{!14, !14, i64 0}
!14 = !{!"bool", !10, i64 0}
!15 = distinct !{!15, !12}
!16 = distinct !{!16, !12}
!17 = distinct !{!17, !12}
!18 = !{i8 0, i8 2}
!19 = !{}
!20 = distinct !{!20, !12}
!21 = distinct !{!21, !12}
!22 = distinct !{!22, !12}
!23 = distinct !{!23, !12}
!24 = distinct !{!24, !12}


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