; LLVM IR from tangjz/acm-icpc :: uoj/200.ll (Z6solve1v)

; 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.Edge = type { i32, i32, i32 }
%"class.std::vector" = type { %"struct.std::_Vector_base" }
%"struct.std::_Vector_base" = type { %"struct.std::_Vector_base<int, std::allocator<int>>::_Vector_impl" }
%"struct.std::_Vector_base<int, std::allocator<int>>::_Vector_impl" = type { %"struct.std::_Vector_base<int, std::allocator<int>>::_Vector_impl_data" }
%"struct.std::_Vector_base<int, std::allocator<int>>::_Vector_impl_data" = type { ptr, ptr, ptr }

@m = external dso_local global i32, align 4
@q = external dso_local global i32, align 4
@mod = external dso_local global i32, align 4
@ans = external dso_local global [100001 x i32], align 16
@e = external dso_local global [150001 x %struct.Edge], align 16
@que = external dso_local global [100001 x %struct.Edge], align 16
@.str.1 = external hidden unnamed_addr constant [61 x i8], align 1
@.str.3 = external hidden unnamed_addr constant [22 x i8], align 1
@__PRETTY_FUNCTION__._Z6solve1v = external hidden unnamed_addr constant [14 x i8], align 1
@.str.4 = external hidden unnamed_addr constant [55 x i8], align 1
@.str.5 = external hidden unnamed_addr constant [55 x i8], align 1
@.str.6 = external hidden unnamed_addr constant [55 x i8], align 1
@.str.7 = external hidden unnamed_addr constant [31 x i8], align 1
@_ZZ6solve1vE4fact = external hidden global [3 x [50001 x i32]], align 16

; Function Attrs: mustprogress uwtable
declare dso_local void @_Z9factorizei(ptr dead_on_unwind noalias writable sret(%"class.std::vector") align 8, i32 noundef) #0

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

declare i32 @__gxx_personality_v0(...)

; 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 void @_ZNSt6vectorIiSaIiEED2Ev(ptr noundef nonnull align 8 dereferenceable(24)) unnamed_addr #2 align 2

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

; Function Attrs: noreturn nounwind
declare void @__assert_fail(ptr noundef, ptr noundef, i32 noundef, ptr noundef) #3

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef i32 @_Z7mod_powii(i32 noundef, i32 noundef) #4

; Function Attrs: mustprogress uwtable
define dso_local void @_Z6solve1v() #0 personality ptr @__gxx_personality_v0 {
  %1 = alloca i32, align 4
  %2 = alloca %"class.std::vector", align 8
  %3 = alloca i32, align 4
  %4 = alloca i32, align 4
  %5 = alloca i32, align 4
  %6 = alloca ptr, align 8
  %7 = alloca i32, align 4
  %8 = alloca i32, align 4
  %9 = alloca ptr, align 8
  %10 = alloca i32, align 4
  %11 = alloca i32, align 4
  %12 = alloca i32, align 4
  %13 = alloca i32, align 4
  %14 = alloca i32, align 4
  %15 = alloca i32, align 4
  %16 = alloca i32, align 4
  %17 = alloca ptr, align 8
  %18 = alloca i32, align 4
  %19 = alloca i32, align 4
  %20 = alloca i32, align 4
  %21 = alloca i32, align 4
  %22 = alloca ptr, align 8
  %23 = alloca i32, align 4
  %24 = alloca i32, align 4
  call void @llvm.lifetime.start.p0(i64 4, ptr %1) #6
  store i32 2, ptr %1, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 24, ptr %2) #6
  %25 = load i32, ptr @mod, align 4, !tbaa !5
  call void @_Z9factorizei(ptr dead_on_unwind writable sret(%"class.std::vector") align 8 %2, i32 noundef %25)
  %26 = call noundef i64 @_ZNKSt6vectorIiSaIiEE4sizeEv(ptr noundef nonnull align 8 dereferenceable(24) %2) #6
  %27 = trunc i64 %26 to i32
  %28 = icmp eq i32 2, %27
  br i1 %28, label %29, label %30

29:                                               ; preds = %0
  br label %32

30:                                               ; preds = %0
  call void @__assert_fail(ptr noundef @.str.3, ptr noundef @.str.1, i32 noundef 105, ptr noundef @__PRETTY_FUNCTION__._Z6solve1v) #7
  unreachable

31:                                               ; No predecessors!
  br label %32

32:                                               ; preds = %31, %29
  call void @llvm.lifetime.start.p0(i64 4, ptr %3) #6
  store i32 0, ptr %3, align 4, !tbaa !5
  br label %33

33:                                               ; preds = %140, %32
  %34 = load i32, ptr %3, align 4, !tbaa !5
  %35 = load i32, ptr @m, align 4, !tbaa !5
  %36 = icmp slt i32 %34, %35
  br i1 %36, label %38, label %37

37:                                               ; preds = %33
  call void @llvm.lifetime.end.p0(i64 4, ptr %3) #6
  br label %143

38:                                               ; preds = %33
  call void @llvm.lifetime.start.p0(i64 4, ptr %4) #6
  %39 = load i32, ptr %3, align 4, !tbaa !5
  %40 = sdiv i32 %39, 3
  store i32 %40, ptr %4, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %5) #6
  %41 = load i32, ptr %3, align 4, !tbaa !5
  %42 = srem i32 %41, 3
  store i32 %42, ptr %5, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 8, ptr %6) #6
  %43 = load i32, ptr %3, align 4, !tbaa !5
  %44 = sext i32 %43 to i64
  %45 = getelementptr inbounds [150001 x %struct.Edge], ptr @e, i64 0, i64 %44
  store ptr %45, ptr %6, align 8, !tbaa !9
  %46 = load i32, ptr %5, align 4, !tbaa !5
  %47 = icmp eq i32 %46, 0
  br i1 %47, label %48, label %77

48:                                               ; preds = %38
  %49 = load ptr, ptr %6, align 8, !tbaa !9
  %50 = getelementptr inbounds %struct.Edge, ptr %49, i32 0, i32 0
  %51 = load i32, ptr %50, align 4, !tbaa !11
  %52 = load i32, ptr %4, align 4, !tbaa !5
  %53 = load i32, ptr %4, align 4, !tbaa !5
  %54 = add nsw i32 %52, %53
  %55 = add nsw i32 %54, 1
  %56 = icmp eq i32 %51, %55
  br i1 %56, label %57, label %71

57:                                               ; preds = %48
  %58 = load ptr, ptr %6, align 8, !tbaa !9
  %59 = getelementptr inbounds %struct.Edge, ptr %58, i32 0, i32 1
  %60 = load i32, ptr %59, align 4, !tbaa !13
  %61 = load i32, ptr %4, align 4, !tbaa !5
  %62 = load i32, ptr %4, align 4, !tbaa !5
  %63 = add nsw i32 %61, %62
  %64 = add nsw i32 %63, 2
  %65 = icmp eq i32 %60, %64
  br i1 %65, label %66, label %71

66:                                               ; preds = %57
  %67 = load ptr, ptr %6, align 8, !tbaa !9
  %68 = getelementptr inbounds %struct.Edge, ptr %67, i32 0, i32 2
  %69 = load i32, ptr %68, align 4, !tbaa !14
  %70 = icmp eq i32 %69, 1
  br label %71

71:                                               ; preds = %66, %57, %48
  %72 = phi i1 [ false, %57 ], [ false, %48 ], [ %70, %66 ]
  br i1 %72, label %73, label %74

73:                                               ; preds = %71
  br label %76

74:                                               ; preds = %71
  call void @__assert_fail(ptr noundef @.str.4, ptr noundef @.str.1, i32 noundef 110, ptr noundef @__PRETTY_FUNCTION__._Z6solve1v) #7
  unreachable

75:                                               ; No predecessors!
  br label %76

76:                                               ; preds = %75, %73
  br label %139

77:                                               ; preds = %38
  %78 = load i32, ptr %5, align 4, !tbaa !5
  %79 = icmp eq i32 %78, 1
  br i1 %79, label %80, label %109

80:                                               ; preds = %77
  %81 = load ptr, ptr %6, align 8, !tbaa !9
  %82 = getelementptr inbounds %struct.Edge, ptr %81, i32 0, i32 0
  %83 = load i32, ptr %82, align 4, !tbaa !11
  %84 = load i32, ptr %4, align 4, !tbaa !5
  %85 = load i32, ptr %4, align 4, !tbaa !5
  %86 = add nsw i32 %84, %85
  %87 = add nsw i32 %86, 1
  %88 = icmp eq i32 %83, %87
  br i1 %88, label %89, label %103

89:                                               ; preds = %80
  %90 = load ptr, ptr %6, align 8, !tbaa !9
  %91 = getelementptr inbounds %struct.Edge, ptr %90, i32 0, i32 1
  %92 = load i32, ptr %91, align 4, !tbaa !13
  %93 = load i32, ptr %4, align 4, !tbaa !5
  %94 = load i32, ptr %4, align 4, !tbaa !5
  %95 = add nsw i32 %93, %94
  %96 = add nsw i32 %95, 3
  %97 = icmp eq i32 %92, %96
  br i1 %97, label %98, label %103

98:                                               ; preds = %89
  %99 = load ptr, ptr %6, align 8, !tbaa !9
  %100 = getelementptr inbounds %struct.Edge, ptr %99, i32 0, i32 2
  %101 = load i32, ptr %100, align 4, !tbaa !14
  %102 = icmp eq i32 %101, 0
  br label %103

103:                                              ; preds = %98, %89, %80
  %104 = phi i1 [ false, %89 ], [ false, %80 ], [ %102, %98 ]
  br i1 %104, label %105, label %106

105:                                              ; preds = %103
  br label %108

106:                                              ; preds = %103
  call void @__assert_fail(ptr noundef @.str.5, ptr noundef @.str.1, i32 noundef 112, ptr noundef @__PRETTY_FUNCTION__._Z6solve1v) #7
  unreachable

107:                                              ; No predecessors!
  br label %108

108:                                              ; preds = %107, %105
  br label %138

109:                                              ; preds = %77
  %110 = load ptr, ptr %6, align 8, !tbaa !9
  %111 = getelementptr inbounds %struct.Edge, ptr %110, i32 0, i32 0
  %112 = load i32, ptr %111, align 4, !tbaa !11
  %113 = load i32, ptr %4, align 4, !tbaa !5
  %114 = load i32, ptr %4, align 4, !tbaa !5
  %115 = add nsw i32 %113, %114
  %116 = add nsw i32 %115, 2
  %117 = icmp eq i32 %112, %116
  br i1 %117, label %118, label %132

118:                                              ; preds = %109
  %119 = load ptr, ptr %6, align 8, !tbaa !9
  %120 = getelementptr inbounds %struct.Edge, ptr %119, i32 0, i32 1
  %121 = load i32, ptr %120, align 4, !tbaa !13
  %122 = load i32, ptr %4, align 4, !tbaa !5
  %123 = load i32, ptr %4, align 4, !tbaa !5
  %124 = add nsw i32 %122, %123
  %125 = add nsw i32 %124, 3
  %126 = icmp eq i32 %121, %125
  br i1 %126, label %127, label %132

127:                                              ; preds = %118
  %128 = load ptr, ptr %6, align 8, !tbaa !9
  %129 = getelementptr inbounds %struct.Edge, ptr %128, i32 0, i32 2
  %130 = load i32, ptr %129, align 4, !tbaa !14
  %131 = icmp eq i32 %130, 0
  br label %132

132:                                              ; preds = %127, %118, %109
  %133 = phi i1 [ false, %118 ], [ false, %109 ], [ %131, %127 ]
  br i1 %133, label %134, label %135

134:                                              ; preds = %132
  br label %137

135:                                              ; preds = %132
  call void @__assert_fail(ptr noundef @.str.6, ptr noundef @.str.1, i32 noundef 114, ptr noundef @__PRETTY_FUNCTION__._Z6solve1v) #7
  unreachable

136:                                              ; No predecessors!
  br label %137

137:                                              ; preds = %136, %134
  br label %138

138:                                              ; preds = %137, %108
  br label %139

139:                                              ; preds = %138, %76
  call void @llvm.lifetime.end.p0(i64 8, ptr %6) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr %5) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr %4) #6
  br label %140

140:                                              ; preds = %139
  %141 = load i32, ptr %3, align 4, !tbaa !5
  %142 = add nsw i32 %141, 1
  store i32 %142, ptr %3, align 4, !tbaa !5
  br label %33, !llvm.loop !15

143:                                              ; preds = %37
  call void @llvm.lifetime.start.p0(i64 4, ptr %7) #6
  store i32 50001, ptr %7, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %8) #6
  store i32 0, ptr %8, align 4, !tbaa !5
  br label %144

144:                                              ; preds = %171, %143
  %145 = load i32, ptr %8, align 4, !tbaa !5
  %146 = load i32, ptr @q, align 4, !tbaa !5
  %147 = icmp slt i32 %145, %146
  br i1 %147, label %149, label %148

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

149:                                              ; preds = %144
  call void @llvm.lifetime.start.p0(i64 8, ptr %9) #6
  %150 = load i32, ptr %8, align 4, !tbaa !5
  %151 = sext i32 %150 to i64
  %152 = getelementptr inbounds [100001 x %struct.Edge], ptr @que, i64 0, i64 %151
  store ptr %152, ptr %9, align 8, !tbaa !9
  %153 = load ptr, ptr %9, align 8, !tbaa !9
  %154 = getelementptr inbounds %struct.Edge, ptr %153, i32 0, i32 0
  %155 = load i32, ptr %154, align 4, !tbaa !11
  %156 = load ptr, ptr %9, align 8, !tbaa !9
  %157 = getelementptr inbounds %struct.Edge, ptr %156, i32 0, i32 1
  %158 = load i32, ptr %157, align 4, !tbaa !13
  %159 = icmp sle i32 %155, %158
  br i1 %159, label %160, label %165

160:                                              ; preds = %149
  %161 = load ptr, ptr %9, align 8, !tbaa !9
  %162 = getelementptr inbounds %struct.Edge, ptr %161, i32 0, i32 2
  %163 = load i32, ptr %162, align 4, !tbaa !14
  %164 = icmp slt i32 %163, 50001
  br label %165

165:                                              ; preds = %160, %149
  %166 = phi i1 [ false, %149 ], [ %164, %160 ]
  br i1 %166, label %167, label %168

167:                                              ; preds = %165
  br label %170

168:                                              ; preds = %165
  call void @__assert_fail(ptr noundef @.str.7, ptr noundef @.str.1, i32 noundef 120, ptr noundef @__PRETTY_FUNCTION__._Z6solve1v) #7
  unreachable

169:                                              ; No predecessors!
  br label %170

170:                                              ; preds = %169, %167
  call void @llvm.lifetime.end.p0(i64 8, ptr %9) #6
  br label %171

171:                                              ; preds = %170
  %172 = load i32, ptr %8, align 4, !tbaa !5
  %173 = add nsw i32 %172, 1
  store i32 %173, ptr %8, align 4, !tbaa !5
  br label %144, !llvm.loop !17

174:                                              ; preds = %148
  call void @llvm.lifetime.start.p0(i64 4, ptr %10) #6
  store i32 0, ptr %10, align 4, !tbaa !5
  br label %175

175:                                              ; preds = %187, %174
  %176 = load i32, ptr %10, align 4, !tbaa !5
  %177 = icmp sle i32 %176, 2
  br i1 %177, label %179, label %178

178:                                              ; preds = %175
  call void @llvm.lifetime.end.p0(i64 4, ptr %10) #6
  br label %190

179:                                              ; preds = %175
  %180 = load i32, ptr %10, align 4, !tbaa !5
  %181 = icmp eq i32 %180, 2
  %182 = zext i1 %181 to i32
  %183 = load i32, ptr %10, align 4, !tbaa !5
  %184 = sext i32 %183 to i64
  %185 = getelementptr inbounds [3 x [50001 x i32]], ptr @_ZZ6solve1vE4fact, i64 0, i64 %184
  %186 = getelementptr inbounds [50001 x i32], ptr %185, i64 0, i64 0
  store i32 %182, ptr %186, align 4, !tbaa !5
  br label %187

187:                                              ; preds = %179
  %188 = load i32, ptr %10, align 4, !tbaa !5
  %189 = add nsw i32 %188, 1
  store i32 %189, ptr %10, align 4, !tbaa !5
  br label %175, !llvm.loop !18

190:                                              ; preds = %178
  call void @llvm.lifetime.start.p0(i64 4, ptr %11) #6
  store i32 1, ptr %11, align 4, !tbaa !5
  br label %191

191:                                              ; preds = %259, %190
  %192 = load i32, ptr %11, align 4, !tbaa !5
  %193 = icmp slt i32 %192, 50001
  br i1 %193, label %195, label %194

194:                                              ; preds = %191
  store i32 11, ptr %12, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %11) #6
  br label %262

195:                                              ; preds = %191
  call void @llvm.lifetime.start.p0(i64 4, ptr %13) #6
  %196 = load i32, ptr %11, align 4, !tbaa !5
  store i32 %196, ptr %13, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %14) #6
  store i32 0, ptr %14, align 4, !tbaa !5
  br label %197

197:                                              ; preds = %239, %195
  %198 = load i32, ptr %14, align 4, !tbaa !5
  %199 = icmp slt i32 %198, 2
  br i1 %199, label %201, label %200

200:                                              ; preds = %197
  store i32 14, ptr %12, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %14) #6
  br label %242

201:                                              ; preds = %197
  call void @llvm.lifetime.start.p0(i64 4, ptr %15) #6
  %202 = load i32, ptr %14, align 4, !tbaa !5
  %203 = sext i32 %202 to i64
  %204 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZNSt6vectorIiSaIiEEixEm(ptr noundef nonnull align 8 dereferenceable(24) %2, i64 noundef %203) #6
  %205 = load i32, ptr %204, align 4, !tbaa !5
  store i32 %205, ptr %15, align 4, !tbaa !5
  %206 = load i32, ptr %14, align 4, !tbaa !5
  %207 = sext i32 %206 to i64
  %208 = getelementptr inbounds [3 x [50001 x i32]], ptr @_ZZ6solve1vE4fact, i64 0, i64 %207
  %209 = load i32, ptr %11, align 4, !tbaa !5
  %210 = sub nsw i32 %209, 1
  %211 = sext i32 %210 to i64
  %212 = getelementptr inbounds [50001 x i32], ptr %208, i64 0, i64 %211
  %213 = load i32, ptr %212, align 4, !tbaa !5
  %214 = load i32, ptr %14, align 4, !tbaa !5
  %215 = sext i32 %214 to i64
  %216 = getelementptr inbounds [3 x [50001 x i32]], ptr @_ZZ6solve1vE4fact, i64 0, i64 %215
  %217 = load i32, ptr %11, align 4, !tbaa !5
  %218 = sext i32 %217 to i64
  %219 = getelementptr inbounds [50001 x i32], ptr %216, i64 0, i64 %218
  store i32 %213, ptr %219, align 4, !tbaa !5
  br label %220

220:                                              ; preds = %226, %201
  %221 = load i32, ptr %13, align 4, !tbaa !5
  %222 = load i32, ptr %15, align 4, !tbaa !5
  %223 = srem i32 %221, %222
  %224 = icmp eq i32 %223, 0
  br i1 %224, label %225, label %238

225:                                              ; preds = %220
  br label %226

226:                                              ; preds = %225
  %227 = load i32, ptr %15, align 4, !tbaa !5
  %228 = load i32, ptr %13, align 4, !tbaa !5
  %229 = sdiv i32 %228, %227
  store i32 %229, ptr %13, align 4, !tbaa !5
  %230 = load i32, ptr %14, align 4, !tbaa !5
  %231 = sext i32 %230 to i64
  %232 = getelementptr inbounds [3 x [50001 x i32]], ptr @_ZZ6solve1vE4fact, i64 0, i64 %231
  %233 = load i32, ptr %11, align 4, !tbaa !5
  %234 = sext i32 %233 to i64
  %235 = getelementptr inbounds [50001 x i32], ptr %232, i64 0, i64 %234
  %236 = load i32, ptr %235, align 4, !tbaa !5
  %237 = add nsw i32 %236, 1
  store i32 %237, ptr %235, align 4, !tbaa !5
  br label %220, !llvm.loop !19

238:                                              ; preds = %220
  call void @llvm.lifetime.end.p0(i64 4, ptr %15) #6
  br label %239

239:                                              ; preds = %238
  %240 = load i32, ptr %14, align 4, !tbaa !5
  %241 = add nsw i32 %240, 1
  store i32 %241, ptr %14, align 4, !tbaa !5
  br label %197, !llvm.loop !20

242:                                              ; preds = %200
  %243 = load i32, ptr %11, align 4, !tbaa !5
  %244 = sub nsw i32 %243, 1
  %245 = sext i32 %244 to i64
  %246 = getelementptr inbounds [50001 x i32], ptr getelementptr inbounds ([3 x [50001 x i32]], ptr @_ZZ6solve1vE4fact, i64 0, i64 2), i64 0, i64 %245
  %247 = load i32, ptr %246, align 4, !tbaa !5
  %248 = sext i32 %247 to i64
  %249 = load i32, ptr %13, align 4, !tbaa !5
  %250 = sext i32 %249 to i64
  %251 = mul nsw i64 %248, %250
  %252 = load i32, ptr @mod, align 4, !tbaa !5
  %253 = sext i32 %252 to i64
  %254 = srem i64 %251, %253
  %255 = trunc i64 %254 to i32
  %256 = load i32, ptr %11, align 4, !tbaa !5
  %257 = sext i32 %256 to i64
  %258 = getelementptr inbounds [50001 x i32], ptr getelementptr inbounds ([3 x [50001 x i32]], ptr @_ZZ6solve1vE4fact, i64 0, i64 2), i64 0, i64 %257
  store i32 %255, ptr %258, align 4, !tbaa !5
  call void @llvm.lifetime.end.p0(i64 4, ptr %13) #6
  br label %259

259:                                              ; preds = %242
  %260 = load i32, ptr %11, align 4, !tbaa !5
  %261 = add nsw i32 %260, 1
  store i32 %261, ptr %11, align 4, !tbaa !5
  br label %191, !llvm.loop !21

262:                                              ; preds = %194
  call void @llvm.lifetime.start.p0(i64 4, ptr %16) #6
  store i32 0, ptr %16, align 4, !tbaa !5
  br label %263

263:                                              ; preds = %423, %262
  %264 = load i32, ptr %16, align 4, !tbaa !5
  %265 = load i32, ptr @q, align 4, !tbaa !5
  %266 = icmp slt i32 %264, %265
  br i1 %266, label %268, label %267

267:                                              ; preds = %263
  store i32 20, ptr %12, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %16) #6
  br label %427

268:                                              ; preds = %263
  call void @llvm.lifetime.start.p0(i64 8, ptr %17) #6
  %269 = load i32, ptr %16, align 4, !tbaa !5
  %270 = sext i32 %269 to i64
  %271 = getelementptr inbounds [100001 x %struct.Edge], ptr @que, i64 0, i64 %270
  store ptr %271, ptr %17, align 8, !tbaa !9
  call void @llvm.lifetime.start.p0(i64 4, ptr %18) #6
  %272 = load ptr, ptr %17, align 8, !tbaa !9
  %273 = getelementptr inbounds %struct.Edge, ptr %272, i32 0, i32 0
  %274 = load i32, ptr %273, align 4, !tbaa !11
  store i32 %274, ptr %18, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %19) #6
  %275 = load ptr, ptr %17, align 8, !tbaa !9
  %276 = getelementptr inbounds %struct.Edge, ptr %275, i32 0, i32 1
  %277 = load i32, ptr %276, align 4, !tbaa !13
  store i32 %277, ptr %19, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %20) #6
  %278 = load ptr, ptr %17, align 8, !tbaa !9
  %279 = getelementptr inbounds %struct.Edge, ptr %278, i32 0, i32 2
  %280 = load i32, ptr %279, align 4, !tbaa !14
  store i32 %280, ptr %20, align 4, !tbaa !5
  %281 = load i32, ptr %18, align 4, !tbaa !5
  %282 = load i32, ptr %19, align 4, !tbaa !5
  %283 = icmp eq i32 %281, %282
  br i1 %283, label %284, label %292

284:                                              ; preds = %268
  %285 = load i32, ptr %20, align 4, !tbaa !5
  %286 = icmp ne i32 %285, 0
  %287 = xor i1 %286, true
  %288 = zext i1 %287 to i32
  %289 = load i32, ptr %16, align 4, !tbaa !5
  %290 = sext i32 %289 to i64
  %291 = getelementptr inbounds [100001 x i32], ptr @ans, i64 0, i64 %290
  store i32 %288, ptr %291, align 4, !tbaa !5
  store i32 22, ptr %12, align 4
  br label %420

292:                                              ; preds = %268
  %293 = load i32, ptr %18, align 4, !tbaa !5
  %294 = and i32 %293, 1
  %295 = icmp ne i32 %294, 0
  br i1 %295, label %299, label %296

296:                                              ; preds = %292
  %297 = load i32, ptr %18, align 4, !tbaa !5
  %298 = add nsw i32 %297, 1
  store i32 %298, ptr %18, align 4, !tbaa !5
  br label %299

299:                                              ; preds = %296, %292
  %300 = load i32, ptr %19, align 4, !tbaa !5
  %301 = and i32 %300, 1
  %302 = icmp ne i32 %301, 0
  br i1 %302, label %308, label %303

303:                                              ; preds = %299
  %304 = load i32, ptr %19, align 4, !tbaa !5
  %305 = add nsw i32 %304, -1
  store i32 %305, ptr %19, align 4, !tbaa !5
  %306 = load i32, ptr %20, align 4, !tbaa !5
  %307 = add nsw i32 %306, -1
  store i32 %307, ptr %20, align 4, !tbaa !5
  br label %308

308:                                              ; preds = %303, %299
  call void @llvm.lifetime.start.p0(i64 4, ptr %21) #6
  %309 = load i32, ptr %19, align 4, !tbaa !5
  %310 = load i32, ptr %18, align 4, !tbaa !5
  %311 = sub nsw i32 %309, %310
  %312 = sdiv i32 %311, 2
  store i32 %312, ptr %21, align 4, !tbaa !5
  %313 = load i32, ptr %20, align 4, !tbaa !5
  %314 = icmp slt i32 %313, 0
  br i1 %314, label %319, label %315

315:                                              ; preds = %308
  %316 = load i32, ptr %21, align 4, !tbaa !5
  %317 = load i32, ptr %20, align 4, !tbaa !5
  %318 = icmp slt i32 %316, %317
  br i1 %318, label %319, label %323

319:                                              ; preds = %315, %308
  %320 = load i32, ptr %16, align 4, !tbaa !5
  %321 = sext i32 %320 to i64
  %322 = getelementptr inbounds [100001 x i32], ptr @ans, i64 0, i64 %321
  store i32 0, ptr %322, align 4, !tbaa !5
  store i32 22, ptr %12, align 4
  br label %419

323:                                              ; preds = %315
  %324 = load i32, ptr %21, align 4, !tbaa !5
  %325 = sext i32 %324 to i64
  %326 = getelementptr inbounds [50001 x i32], ptr getelementptr inbounds ([3 x [50001 x i32]], ptr @_ZZ6solve1vE4fact, i64 0, i64 2), i64 0, i64 %325
  %327 = load i32, ptr %326, align 4, !tbaa !5
  %328 = sext i32 %327 to i64
  %329 = load i32, ptr %20, align 4, !tbaa !5
  %330 = sext i32 %329 to i64
  %331 = getelementptr inbounds [50001 x i32], ptr getelementptr inbounds ([3 x [50001 x i32]], ptr @_ZZ6solve1vE4fact, i64 0, i64 2), i64 0, i64 %330
  %332 = load i32, ptr %331, align 4, !tbaa !5
  %333 = sext i32 %332 to i64
  %334 = load i32, ptr %21, align 4, !tbaa !5
  %335 = load i32, ptr %20, align 4, !tbaa !5
  %336 = sub nsw i32 %334, %335
  %337 = sext i32 %336 to i64
  %338 = getelementptr inbounds [50001 x i32], ptr getelementptr inbounds ([3 x [50001 x i32]], ptr @_ZZ6solve1vE4fact, i64 0, i64 2), i64 0, i64 %337
  %339 = load i32, ptr %338, align 4, !tbaa !5
  %340 = sext i32 %339 to i64
  %341 = mul nsw i64 %333, %340
  %342 = load i32, ptr @mod, align 4, !tbaa !5
  %343 = sext i32 %342 to i64
  %344 = srem i64 %341, %343
  %345 = trunc i64 %344 to i32
  %346 = invoke noundef i32 @_Z7mod_invi(i32 noundef %345)
          to label %347 unwind label %361

347:                                              ; preds = %323
  %348 = sext i32 %346 to i64
  %349 = mul nsw i64 %328, %348
  %350 = load i32, ptr @mod, align 4, !tbaa !5
  %351 = sext i32 %350 to i64
  %352 = srem i64 %349, %351
  %353 = trunc i64 %352 to i32
  %354 = load i32, ptr %16, align 4, !tbaa !5
  %355 = sext i32 %354 to i64
  %356 = getelementptr inbounds [100001 x i32], ptr @ans, i64 0, i64 %355
  store i32 %353, ptr %356, align 4, !tbaa !5
  call void @llvm.lifetime.start.p0(i64 4, ptr %24) #6
  store i32 0, ptr %24, align 4, !tbaa !5
  br label %357

357:                                              ; preds = %411, %347
  %358 = load i32, ptr %24, align 4, !tbaa !5
  %359 = icmp slt i32 %358, 2
  br i1 %359, label %365, label %360

360:                                              ; preds = %357
  store i32 23, ptr %12, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %24) #6
  br label %418

361:                                              ; preds = %323
  %362 = landingpad { ptr, i32 }
          cleanup
  %363 = extractvalue { ptr, i32 } %362, 0
  store ptr %363, ptr %22, align 8
  %364 = extractvalue { ptr, i32 } %362, 1
  store i32 %364, ptr %23, align 4
  br label %426

365:                                              ; preds = %357
  %366 = load i32, ptr %16, align 4, !tbaa !5
  %367 = sext i32 %366 to i64
  %368 = getelementptr inbounds [100001 x i32], ptr @ans, i64 0, i64 %367
  %369 = load i32, ptr %368, align 4, !tbaa !5
  %370 = sext i32 %369 to i64
  %371 = load i32, ptr %24, align 4, !tbaa !5
  %372 = sext i32 %371 to i64
  %373 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZNSt6vectorIiSaIiEEixEm(ptr noundef nonnull align 8 dereferenceable(24) %2, i64 noundef %372) #6
  %374 = load i32, ptr %373, align 4, !tbaa !5
  %375 = load i32, ptr %24, align 4, !tbaa !5
  %376 = sext i32 %375 to i64
  %377 = getelementptr inbounds [3 x [50001 x i32]], ptr @_ZZ6solve1vE4fact, i64 0, i64 %376
  %378 = load i32, ptr %21, align 4, !tbaa !5
  %379 = sext i32 %378 to i64
  %380 = getelementptr inbounds [50001 x i32], ptr %377, i64 0, i64 %379
  %381 = load i32, ptr %380, align 4, !tbaa !5
  %382 = load i32, ptr %24, align 4, !tbaa !5
  %383 = sext i32 %382 to i64
  %384 = getelementptr inbounds [3 x [50001 x i32]], ptr @_ZZ6solve1vE4fact, i64 0, i64 %383
  %385 = load i32, ptr %20, align 4, !tbaa !5
  %386 = sext i32 %385 to i64
  %387 = getelementptr inbounds [50001 x i32], ptr %384, i64 0, i64 %386
  %388 = load i32, ptr %387, align 4, !tbaa !5
  %389 = sub nsw i32 %381, %388
  %390 = load i32, ptr %24, align 4, !tbaa !5
  %391 = sext i32 %390 to i64
  %392 = getelementptr inbounds [3 x [50001 x i32]], ptr @_ZZ6solve1vE4fact, i64 0, i64 %391
  %393 = load i32, ptr %21, align 4, !tbaa !5
  %394 = load i32, ptr %20, align 4, !tbaa !5
  %395 = sub nsw i32 %393, %394
  %396 = sext i32 %395 to i64
  %397 = getelementptr inbounds [50001 x i32], ptr %392, i64 0, i64 %396
  %398 = load i32, ptr %397, align 4, !tbaa !5
  %399 = sub nsw i32 %389, %398
  %400 = invoke noundef i32 @_Z7mod_powii(i32 noundef %374, i32 noundef %399)
          to label %401 unwind label %414

401:                                              ; preds = %365
  %402 = sext i32 %400 to i64
  %403 = mul nsw i64 %370, %402
  %404 = load i32, ptr @mod, align 4, !tbaa !5
  %405 = sext i32 %404 to i64
  %406 = srem i64 %403, %405
  %407 = trunc i64 %406 to i32
  %408 = load i32, ptr %16, align 4, !tbaa !5
  %409 = sext i32 %408 to i64
  %410 = getelementptr inbounds [100001 x i32], ptr @ans, i64 0, i64 %409
  store i32 %407, ptr %410, align 4, !tbaa !5
  br label %411

411:                                              ; preds = %401
  %412 = load i32, ptr %24, align 4, !tbaa !5
  %413 = add nsw i32 %412, 1
  store i32 %413, ptr %24, align 4, !tbaa !5
  br label %357, !llvm.loop !22

414:                                              ; preds = %365
  %415 = landingpad { ptr, i32 }
          cleanup
  %416 = extractvalue { ptr, i32 } %415, 0
  store ptr %416, ptr %22, align 8
  %417 = extractvalue { ptr, i32 } %415, 1
  store i32 %417, ptr %23, align 4
  call void @llvm.lifetime.end.p0(i64 4, ptr %24) #6
  br label %426

418:                                              ; preds = %360
  store i32 0, ptr %12, align 4
  br label %419

419:                                              ; preds = %418, %319
  call void @llvm.lifetime.end.p0(i64 4, ptr %21) #6
  br label %420

420:                                              ; preds = %419, %284
  call void @llvm.lifetime.end.p0(i64 4, ptr %20) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr %19) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr %18) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr %17) #6
  %421 = load i32, ptr %12, align 4
  switch i32 %421, label %433 [
    i32 0, label %422
    i32 22, label %423
  ]

422:                                              ; preds = %420
  br label %423

423:                                              ; preds = %422, %420
  %424 = load i32, ptr %16, align 4, !tbaa !5
  %425 = add nsw i32 %424, 1
  store i32 %425, ptr %16, align 4, !tbaa !5
  br label %263, !llvm.loop !23

426:                                              ; preds = %414, %361
  call void @llvm.lifetime.end.p0(i64 4, ptr %21) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr %20) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr %19) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr %18) #6
  call void @llvm.lifetime.end.p0(i64 8, ptr %17) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr %16) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr %7) #6
  call void @_ZNSt6vectorIiSaIiEED2Ev(ptr noundef nonnull align 8 dereferenceable(24) %2) #6
  call void @llvm.lifetime.end.p0(i64 24, ptr %2) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr %1) #6
  br label %428

427:                                              ; preds = %267
  call void @llvm.lifetime.end.p0(i64 4, ptr %7) #6
  call void @_ZNSt6vectorIiSaIiEED2Ev(ptr noundef nonnull align 8 dereferenceable(24) %2) #6
  call void @llvm.lifetime.end.p0(i64 24, ptr %2) #6
  call void @llvm.lifetime.end.p0(i64 4, ptr %1) #6
  ret void

428:                                              ; preds = %426
  %429 = load ptr, ptr %22, align 8
  %430 = load i32, ptr %23, align 4
  %431 = insertvalue { ptr, i32 } poison, ptr %429, 0
  %432 = insertvalue { ptr, i32 } %431, i32 %430, 1
  resume { ptr, i32 } %432

433:                                              ; preds = %420
  unreachable
}

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

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local noundef i32 @_Z7mod_invi(i32 noundef) #5

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

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

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


; 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.Edge = type { i32, i32, i32 }
%"class.std::vector" = type { %"struct.std::_Vector_base" }
%"struct.std::_Vector_base" = type { %"struct.std::_Vector_base<int, std::allocator<int>>::_Vector_impl" }
%"struct.std::_Vector_base<int, std::allocator<int>>::_Vector_impl" = type { %"struct.std::_Vector_base<int, std::allocator<int>>::_Vector_impl_data" }
%"struct.std::_Vector_base<int, std::allocator<int>>::_Vector_impl_data" = type { ptr, ptr, ptr }

@m = external dso_local local_unnamed_addr global i32, align 4
@q = external dso_local local_unnamed_addr global i32, align 4
@mod = external dso_local local_unnamed_addr global i32, align 4
@ans = external dso_local local_unnamed_addr global [100001 x i32], align 16
@e = external dso_local local_unnamed_addr global [150001 x %struct.Edge], align 16
@que = external dso_local local_unnamed_addr global [100001 x %struct.Edge], align 16
@.str.1 = external hidden unnamed_addr constant [61 x i8], align 1
@.str.3 = external hidden unnamed_addr constant [22 x i8], align 1
@__PRETTY_FUNCTION__._Z6solve1v = external hidden unnamed_addr constant [14 x i8], align 1
@.str.4 = external hidden unnamed_addr constant [55 x i8], align 1
@.str.5 = external hidden unnamed_addr constant [55 x i8], align 1
@.str.6 = external hidden unnamed_addr constant [55 x i8], align 1
@.str.7 = external hidden unnamed_addr constant [31 x i8], align 1
@_ZZ6solve1vE4fact = external hidden local_unnamed_addr global [3 x [50001 x i32]], align 16

; Function Attrs: mustprogress uwtable
declare dso_local void @_Z9factorizei(ptr dead_on_unwind noalias writable sret(%"class.std::vector") align 8, i32 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

declare i32 @__gxx_personality_v0(...)

; 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 nounwind uwtable
declare dso_local void @_ZNSt6vectorIiSaIiEED2Ev(ptr noundef nonnull align 8 dereferenceable(24)) unnamed_addr #2 align 2

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

; Function Attrs: noreturn nounwind
declare void @__assert_fail(ptr noundef, ptr noundef, i32 noundef, ptr noundef) local_unnamed_addr #3

; Function Attrs: inlinehint mustprogress nounwind uwtable
declare dso_local noundef i32 @_Z7mod_powii(i32 noundef, i32 noundef) local_unnamed_addr #4

; Function Attrs: mustprogress uwtable
define dso_local void @_Z6solve1v() local_unnamed_addr #0 personality ptr @__gxx_personality_v0 {
  %1 = alloca %"class.std::vector", align 8
  call void @llvm.lifetime.start.p0(i64 24, ptr nonnull %1) #6
  %2 = load i32, ptr @mod, align 4, !tbaa !5
  call void @_Z9factorizei(ptr dead_on_unwind nonnull writable sret(%"class.std::vector") align 8 %1, i32 noundef %2)
  %3 = call noundef i64 @_ZNKSt6vectorIiSaIiEE4sizeEv(ptr noundef nonnull align 8 dereferenceable(24) %1) #6
  %4 = and i64 %3, 4294967295
  %5 = icmp eq i64 %4, 2
  br i1 %5, label %.preheader125, label %8

.preheader125:                                    ; preds = %0
  %6 = load i32, ptr @m, align 4, !tbaa !5
  %7 = icmp sgt i32 %6, 0
  br i1 %7, label %.lr.ph.preheader, label %.preheader124

.lr.ph.preheader:                                 ; preds = %.preheader125
  %wide.trip.count = zext nneg i32 %6 to i64
  br label %.lr.ph

8:                                                ; preds = %0
  call void @__assert_fail(ptr noundef nonnull @.str.3, ptr noundef nonnull @.str.1, i32 noundef 105, ptr noundef nonnull @__PRETTY_FUNCTION__._Z6solve1v) #7
  unreachable

.preheader124:                                    ; preds = %53, %.preheader125
  %9 = load i32, ptr @q, align 4, !tbaa !5
  %10 = icmp sgt i32 %9, 0
  br i1 %10, label %.lr.ph128.preheader, label %.preheader123

.lr.ph128.preheader:                              ; preds = %.preheader124
  %wide.trip.count146 = zext nneg i32 %9 to i64
  br label %.lr.ph128

.lr.ph:                                           ; preds = %.lr.ph.preheader, %53
  %indvars.iv = phi i64 [ 0, %.lr.ph.preheader ], [ %indvars.iv.next, %53 ]
  %11 = trunc nuw nsw i64 %indvars.iv to i32
  %12 = udiv i32 %11, 3
  %13 = urem i32 %11, 3
  %14 = getelementptr inbounds [150001 x %struct.Edge], ptr @e, i64 0, i64 %indvars.iv
  %15 = load i32, ptr %14, align 4, !tbaa !9
  %16 = shl nuw nsw i32 %12, 1
  switch i32 %13, label %41 [
    i32 0, label %17
    i32 1, label %29
  ]

17:                                               ; preds = %.lr.ph
  %18 = or disjoint i32 %16, 1
  %19 = icmp eq i32 %15, %18
  br i1 %19, label %20, label %.critedge

20:                                               ; preds = %17
  %21 = getelementptr inbounds i8, ptr %14, i64 4
  %22 = load i32, ptr %21, align 4, !tbaa !11
  %23 = add nuw nsw i32 %16, 2
  %24 = icmp eq i32 %22, %23
  br i1 %24, label %25, label %.critedge

25:                                               ; preds = %20
  %26 = getelementptr inbounds i8, ptr %14, i64 8
  %27 = load i32, ptr %26, align 4, !tbaa !12
  %28 = icmp eq i32 %27, 1
  br i1 %28, label %53, label %.critedge

.critedge:                                        ; preds = %20, %17, %25
  call void @__assert_fail(ptr noundef nonnull @.str.4, ptr noundef nonnull @.str.1, i32 noundef 110, ptr noundef nonnull @__PRETTY_FUNCTION__._Z6solve1v) #7
  unreachable

29:                                               ; preds = %.lr.ph
  %30 = or disjoint i32 %16, 1
  %31 = icmp eq i32 %15, %30
  br i1 %31, label %32, label %.critedge2

32:                                               ; preds = %29
  %33 = getelementptr inbounds i8, ptr %14, i64 4
  %34 = load i32, ptr %33, align 4, !tbaa !11
  %35 = add nuw nsw i32 %16, 3
  %36 = icmp eq i32 %34, %35
  br i1 %36, label %37, label %.critedge2

37:                                               ; preds = %32
  %38 = getelementptr inbounds i8, ptr %14, i64 8
  %39 = load i32, ptr %38, align 4, !tbaa !12
  %40 = icmp eq i32 %39, 0
  br i1 %40, label %53, label %.critedge2

.critedge2:                                       ; preds = %32, %29, %37
  call void @__assert_fail(ptr noundef nonnull @.str.5, ptr noundef nonnull @.str.1, i32 noundef 112, ptr noundef nonnull @__PRETTY_FUNCTION__._Z6solve1v) #7
  unreachable

41:                                               ; preds = %.lr.ph
  %42 = add nuw nsw i32 %16, 2
  %43 = icmp eq i32 %15, %42
  br i1 %43, label %44, label %.critedge4

44:                                               ; preds = %41
  %45 = getelementptr inbounds i8, ptr %14, i64 4
  %46 = load i32, ptr %45, align 4, !tbaa !11
  %47 = add nuw nsw i32 %16, 3
  %48 = icmp eq i32 %46, %47
  br i1 %48, label %49, label %.critedge4

49:                                               ; preds = %44
  %50 = getelementptr inbounds i8, ptr %14, i64 8
  %51 = load i32, ptr %50, align 4, !tbaa !12
  %52 = icmp eq i32 %51, 0
  br i1 %52, label %53, label %.critedge4

.critedge4:                                       ; preds = %44, %41, %49
  call void @__assert_fail(ptr noundef nonnull @.str.6, ptr noundef nonnull @.str.1, i32 noundef 114, ptr noundef nonnull @__PRETTY_FUNCTION__._Z6solve1v) #7
  unreachable

53:                                               ; preds = %37, %49, %25
  %indvars.iv.next = add nuw nsw i64 %indvars.iv, 1
  %exitcond.not = icmp eq i64 %indvars.iv.next, %wide.trip.count
  br i1 %exitcond.not, label %.preheader124, label %.lr.ph, !llvm.loop !13

54:                                               ; preds = %59
  %indvars.iv.next144 = add nuw nsw i64 %indvars.iv143, 1
  %exitcond147.not = icmp eq i64 %indvars.iv.next144, %wide.trip.count146
  br i1 %exitcond147.not, label %.preheader123, label %.lr.ph128, !llvm.loop !15

.preheader123:                                    ; preds = %54, %.preheader124
  store i32 0, ptr @_ZZ6solve1vE4fact, align 16, !tbaa !5
  store i32 0, ptr getelementptr inbounds (i8, ptr @_ZZ6solve1vE4fact, i64 200004), align 4, !tbaa !5
  store i32 1, ptr getelementptr inbounds (i8, ptr @_ZZ6solve1vE4fact, i64 400008), align 8, !tbaa !5
  br label %.preheader121

.lr.ph128:                                        ; preds = %.lr.ph128.preheader, %54
  %indvars.iv143 = phi i64 [ 0, %.lr.ph128.preheader ], [ %indvars.iv.next144, %54 ]
  %55 = getelementptr inbounds [100001 x %struct.Edge], ptr @que, i64 0, i64 %indvars.iv143
  %56 = load i32, ptr %55, align 4, !tbaa !9
  %57 = getelementptr inbounds i8, ptr %55, i64 4
  %58 = load i32, ptr %57, align 4, !tbaa !11
  %.not118 = icmp sgt i32 %56, %58
  br i1 %.not118, label %.critedge6, label %59

59:                                               ; preds = %.lr.ph128
  %60 = getelementptr inbounds i8, ptr %55, i64 8
  %61 = load i32, ptr %60, align 4, !tbaa !12
  %62 = icmp slt i32 %61, 50001
  br i1 %62, label %54, label %.critedge6

.critedge6:                                       ; preds = %.lr.ph128, %59
  call void @__assert_fail(ptr noundef nonnull @.str.7, ptr noundef nonnull @.str.1, i32 noundef 120, ptr noundef nonnull @__PRETTY_FUNCTION__._Z6solve1v) #7
  unreachable

.preheader121:                                    ; preds = %.preheader123, %._crit_edge.1
  %indvars.iv155 = phi i64 [ 1, %.preheader123 ], [ %indvars.iv.next156, %._crit_edge.1 ]
  %63 = add nsw i64 %indvars.iv155, -1
  %64 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZNSt6vectorIiSaIiEEixEm(ptr noundef nonnull align 8 dereferenceable(24) %1, i64 noundef 0) #6
  %65 = load i32, ptr %64, align 4, !tbaa !5
  %66 = getelementptr inbounds [3 x [50001 x i32]], ptr @_ZZ6solve1vE4fact, i64 0, i64 0, i64 %63
  %67 = load i32, ptr %66, align 4, !tbaa !5
  %68 = getelementptr inbounds [3 x [50001 x i32]], ptr @_ZZ6solve1vE4fact, i64 0, i64 0, i64 %indvars.iv155
  %69 = trunc nuw nsw i64 %indvars.iv155 to i32
  %70 = srem i32 %69, %65
  %71 = icmp eq i32 %70, 0
  br i1 %71, label %.lr.ph132, label %._crit_edge

.preheader:                                       ; preds = %._crit_edge.1
  %72 = load i32, ptr @q, align 4, !tbaa !5
  %73 = icmp sgt i32 %72, 0
  br i1 %73, label %.lr.ph139, label %._crit_edge140

.lr.ph132:                                        ; preds = %.preheader121, %.lr.ph132
  %.1131 = phi i32 [ %74, %.lr.ph132 ], [ %69, %.preheader121 ]
  %storemerge130 = phi i32 [ %75, %.lr.ph132 ], [ %67, %.preheader121 ]
  %74 = sdiv i32 %.1131, %65
  %75 = add nsw i32 %storemerge130, 1
  %76 = srem i32 %74, %65
  %77 = icmp eq i32 %76, 0
  br i1 %77, label %.lr.ph132, label %._crit_edge, !llvm.loop !16

._crit_edge:                                      ; preds = %.lr.ph132, %.preheader121
  %storemerge.lcssa = phi i32 [ %67, %.preheader121 ], [ %75, %.lr.ph132 ]
  %.1.lcssa = phi i32 [ %69, %.preheader121 ], [ %74, %.lr.ph132 ]
  store i32 %storemerge.lcssa, ptr %68, align 4, !tbaa !5
  %78 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZNSt6vectorIiSaIiEEixEm(ptr noundef nonnull align 8 dereferenceable(24) %1, i64 noundef 1) #6
  %79 = load i32, ptr %78, align 4, !tbaa !5
  %80 = getelementptr inbounds [3 x [50001 x i32]], ptr @_ZZ6solve1vE4fact, i64 0, i64 1, i64 %63
  %81 = load i32, ptr %80, align 4, !tbaa !5
  %82 = getelementptr inbounds [3 x [50001 x i32]], ptr @_ZZ6solve1vE4fact, i64 0, i64 1, i64 %indvars.iv155
  %83 = srem i32 %.1.lcssa, %79
  %84 = icmp eq i32 %83, 0
  br i1 %84, label %.lr.ph132.1, label %._crit_edge.1

.lr.ph132.1:                                      ; preds = %._crit_edge, %.lr.ph132.1
  %.1131.1 = phi i32 [ %85, %.lr.ph132.1 ], [ %.1.lcssa, %._crit_edge ]
  %storemerge130.1 = phi i32 [ %86, %.lr.ph132.1 ], [ %81, %._crit_edge ]
  %85 = sdiv i32 %.1131.1, %79
  %86 = add nsw i32 %storemerge130.1, 1
  %87 = srem i32 %85, %79
  %88 = icmp eq i32 %87, 0
  br i1 %88, label %.lr.ph132.1, label %._crit_edge.1, !llvm.loop !16

._crit_edge.1:                                    ; preds = %.lr.ph132.1, %._crit_edge
  %storemerge.lcssa.1 = phi i32 [ %81, %._crit_edge ], [ %86, %.lr.ph132.1 ]
  %.1.lcssa.1 = phi i32 [ %.1.lcssa, %._crit_edge ], [ %85, %.lr.ph132.1 ]
  store i32 %storemerge.lcssa.1, ptr %82, align 4, !tbaa !5
  %89 = getelementptr inbounds [50001 x i32], ptr getelementptr inbounds (i8, ptr @_ZZ6solve1vE4fact, i64 400008), i64 0, i64 %63
  %90 = load i32, ptr %89, align 4, !tbaa !5
  %91 = sext i32 %90 to i64
  %92 = sext i32 %.1.lcssa.1 to i64
  %93 = mul nsw i64 %91, %92
  %94 = load i32, ptr @mod, align 4, !tbaa !5
  %95 = sext i32 %94 to i64
  %96 = srem i64 %93, %95
  %97 = trunc nsw i64 %96 to i32
  %98 = getelementptr inbounds [50001 x i32], ptr getelementptr inbounds (i8, ptr @_ZZ6solve1vE4fact, i64 400008), i64 0, i64 %indvars.iv155
  store i32 %97, ptr %98, align 4, !tbaa !5
  %indvars.iv.next156 = add nuw nsw i64 %indvars.iv155, 1
  %exitcond158.not = icmp eq i64 %indvars.iv.next156, 50001
  br i1 %exitcond158.not, label %.preheader, label %.preheader121, !llvm.loop !17

._crit_edge140:                                   ; preds = %.loopexit, %.preheader
  call void @_ZNSt6vectorIiSaIiEED2Ev(ptr noundef nonnull align 8 dereferenceable(24) %1) #6
  call void @llvm.lifetime.end.p0(i64 24, ptr nonnull %1) #6
  ret void

.lr.ph139:                                        ; preds = %.preheader, %.loopexit
  %99 = phi i32 [ %181, %.loopexit ], [ %72, %.preheader ]
  %100 = phi i32 [ %182, %.loopexit ], [ %94, %.preheader ]
  %indvars.iv162 = phi i64 [ %indvars.iv.next163, %.loopexit ], [ 0, %.preheader ]
  %101 = getelementptr inbounds [100001 x %struct.Edge], ptr @que, i64 0, i64 %indvars.iv162
  %102 = load i32, ptr %101, align 4, !tbaa !9
  %103 = getelementptr inbounds i8, ptr %101, i64 4
  %104 = load i32, ptr %103, align 4, !tbaa !11
  %105 = getelementptr inbounds i8, ptr %101, i64 8
  %106 = load i32, ptr %105, align 4, !tbaa !12
  %107 = icmp eq i32 %102, %104
  br i1 %107, label %108, label %111

108:                                              ; preds = %.lr.ph139
  %.not117 = icmp eq i32 %106, 0
  %109 = zext i1 %.not117 to i32
  %110 = getelementptr inbounds [100001 x i32], ptr @ans, i64 0, i64 %indvars.iv162
  store i32 %109, ptr %110, align 4, !tbaa !5
  br label %.loopexit

111:                                              ; preds = %.lr.ph139
  %spec.select = or i32 %102, 1
  %112 = and i32 %104, 1
  %sext = add nsw i32 %112, -1
  %.0105 = add nsw i32 %106, %sext
  %.0106 = sub i32 %104, %spec.select
  %113 = add i32 %.0106, %sext
  %114 = sdiv i32 %113, 2
  %115 = icmp slt i32 %.0105, 0
  %116 = icmp slt i32 %114, %.0105
  %or.cond = or i1 %115, %116
  br i1 %or.cond, label %117, label %119

117:                                              ; preds = %111
  %118 = getelementptr inbounds [100001 x i32], ptr @ans, i64 0, i64 %indvars.iv162
  store i32 0, ptr %118, align 4, !tbaa !5
  br label %.loopexit

119:                                              ; preds = %111
  %120 = zext nneg i32 %114 to i64
  %121 = getelementptr inbounds [50001 x i32], ptr getelementptr inbounds (i8, ptr @_ZZ6solve1vE4fact, i64 400008), i64 0, i64 %120
  %122 = load i32, ptr %121, align 4, !tbaa !5
  %123 = zext nneg i32 %.0105 to i64
  %124 = getelementptr inbounds [50001 x i32], ptr getelementptr inbounds (i8, ptr @_ZZ6solve1vE4fact, i64 400008), i64 0, i64 %123
  %125 = load i32, ptr %124, align 4, !tbaa !5
  %126 = sext i32 %125 to i64
  %127 = sub nsw i32 %114, %.0105
  %128 = sext i32 %127 to i64
  %129 = getelementptr inbounds [50001 x i32], ptr getelementptr inbounds (i8, ptr @_ZZ6solve1vE4fact, i64 400008), i64 0, i64 %128
  %130 = load i32, ptr %129, align 4, !tbaa !5
  %131 = sext i32 %130 to i64
  %132 = mul nsw i64 %131, %126
  %133 = sext i32 %100 to i64
  %134 = srem i64 %132, %133
  %135 = trunc nsw i64 %134 to i32
  %136 = invoke noundef i32 @_Z7mod_invi(i32 noundef %135)
          to label %.loopexit.loopexit unwind label %179

.loopexit.loopexit:                               ; preds = %119
  %137 = sext i32 %122 to i64
  %138 = sext i32 %136 to i64
  %139 = mul nsw i64 %138, %137
  %140 = load i32, ptr @mod, align 4, !tbaa !5
  %141 = sext i32 %140 to i64
  %142 = srem i64 %139, %141
  %143 = trunc nsw i64 %142 to i32
  %144 = getelementptr inbounds [100001 x i32], ptr @ans, i64 0, i64 %indvars.iv162
  store i32 %143, ptr %144, align 4, !tbaa !5
  %145 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZNSt6vectorIiSaIiEEixEm(ptr noundef nonnull align 8 dereferenceable(24) %1, i64 noundef 0) #6
  %146 = load i32, ptr %145, align 4, !tbaa !5
  %147 = getelementptr inbounds [3 x [50001 x i32]], ptr @_ZZ6solve1vE4fact, i64 0, i64 0, i64 %120
  %148 = load i32, ptr %147, align 4, !tbaa !5
  %149 = getelementptr inbounds [3 x [50001 x i32]], ptr @_ZZ6solve1vE4fact, i64 0, i64 0, i64 %123
  %150 = load i32, ptr %149, align 4, !tbaa !5
  %151 = getelementptr inbounds [3 x [50001 x i32]], ptr @_ZZ6solve1vE4fact, i64 0, i64 0, i64 %128
  %152 = load i32, ptr %151, align 4, !tbaa !5
  %153 = add i32 %150, %152
  %154 = sub i32 %148, %153
  %155 = call noundef i32 @_Z7mod_powii(i32 noundef %146, i32 noundef %154)
  %156 = sext i32 %155 to i64
  %157 = mul nsw i64 %142, %156
  %158 = load i32, ptr @mod, align 4, !tbaa !5
  %159 = sext i32 %158 to i64
  %160 = srem i64 %157, %159
  %161 = trunc nsw i64 %160 to i32
  store i32 %161, ptr %144, align 4, !tbaa !5
  %162 = call noundef nonnull align 4 dereferenceable(4) ptr @_ZNSt6vectorIiSaIiEEixEm(ptr noundef nonnull align 8 dereferenceable(24) %1, i64 noundef 1) #6
  %163 = load i32, ptr %162, align 4, !tbaa !5
  %164 = getelementptr inbounds [3 x [50001 x i32]], ptr @_ZZ6solve1vE4fact, i64 0, i64 1, i64 %120
  %165 = load i32, ptr %164, align 4, !tbaa !5
  %166 = getelementptr inbounds [3 x [50001 x i32]], ptr @_ZZ6solve1vE4fact, i64 0, i64 1, i64 %123
  %167 = load i32, ptr %166, align 4, !tbaa !5
  %168 = getelementptr inbounds [3 x [50001 x i32]], ptr @_ZZ6solve1vE4fact, i64 0, i64 1, i64 %128
  %169 = load i32, ptr %168, align 4, !tbaa !5
  %170 = add i32 %167, %169
  %171 = sub i32 %165, %170
  %172 = call noundef i32 @_Z7mod_powii(i32 noundef %163, i32 noundef %171)
  %173 = sext i32 %172 to i64
  %174 = mul nsw i64 %160, %173
  %175 = load i32, ptr @mod, align 4, !tbaa !5
  %176 = sext i32 %175 to i64
  %177 = srem i64 %174, %176
  %178 = trunc nsw i64 %177 to i32
  store i32 %178, ptr %144, align 4, !tbaa !5
  %.pre = load i32, ptr @q, align 4, !tbaa !5
  br label %.loopexit

179:                                              ; preds = %119
  %180 = landingpad { ptr, i32 }
          cleanup
  call void @_ZNSt6vectorIiSaIiEED2Ev(ptr noundef nonnull align 8 dereferenceable(24) %1) #6
  call void @llvm.lifetime.end.p0(i64 24, ptr nonnull %1) #6
  resume { ptr, i32 } %180

.loopexit:                                        ; preds = %.loopexit.loopexit, %117, %108
  %181 = phi i32 [ %.pre, %.loopexit.loopexit ], [ %99, %117 ], [ %99, %108 ]
  %182 = phi i32 [ %175, %.loopexit.loopexit ], [ %100, %117 ], [ %100, %108 ]
  %indvars.iv.next163 = add nuw nsw i64 %indvars.iv162, 1
  %183 = sext i32 %181 to i64
  %184 = icmp slt i64 %indvars.iv.next163, %183
  br i1 %184, label %.lr.ph139, label %._crit_edge140, !llvm.loop !18
}

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

; Function Attrs: inlinehint mustprogress uwtable
declare dso_local noundef i32 @_Z7mod_invi(i32 noundef) local_unnamed_addr #5

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

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

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


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